@spaced-out/ui-design-system 0.3.47-beta.0 → 0.3.48
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/.cspell/custom-words.txt +1 -0
- package/CHANGELOG.md +14 -0
- package/lib/components/AvatarGroup/AvatarGroup.js.flow +2 -2
- package/lib/components/ButtonDropdown/ButtonDropdown.js +10 -22
- package/lib/components/ButtonDropdown/ButtonDropdown.js.flow +33 -58
- package/lib/components/ButtonDropdown/ButtonDropdown.module.css +1 -8
- package/lib/components/ButtonDropdown/SimpleButtonDropdown.js +0 -3
- package/lib/components/ButtonDropdown/SimpleButtonDropdown.js.flow +1 -6
- package/lib/components/ButtonTabs/ButtonTabDropdown.js +6 -13
- package/lib/components/ButtonTabs/ButtonTabDropdown.js.flow +24 -40
- package/lib/components/ButtonTabs/ButtonTabDropdown.module.css +0 -4
- package/lib/components/ButtonTabs/ButtonTabs.js +0 -2
- package/lib/components/ButtonTabs/ButtonTabs.js.flow +0 -4
- package/lib/components/DateRangePicker/DateRangePicker.js +6 -2
- package/lib/components/DateRangePicker/DateRangePicker.js.flow +6 -0
- package/lib/components/DateRangePicker/DateRangeWrapper.js +4 -4
- package/lib/components/DateRangePicker/DateRangeWrapper.js.flow +4 -4
- package/lib/components/Dropdown/Dropdown.js +8 -23
- package/lib/components/Dropdown/Dropdown.js.flow +32 -57
- package/lib/components/Dropdown/Dropdown.module.css +0 -5
- package/lib/components/Dropdown/SimpleDropdown.js +0 -2
- package/lib/components/Dropdown/SimpleDropdown.js.flow +0 -4
- package/lib/components/InlineDropdown/InlineDropdown.js +8 -25
- package/lib/components/InlineDropdown/InlineDropdown.js.flow +30 -57
- package/lib/components/InlineDropdown/InlineDropdown.module.css +0 -5
- package/lib/components/InlineDropdown/SimpleInlineDropdown.js +0 -2
- package/lib/components/InlineDropdown/SimpleInlineDropdown.js.flow +0 -4
- package/lib/components/SideMenuLink/SideMenuLink.js +5 -0
- package/lib/components/SideMenuLink/SideMenuLink.js.flow +5 -0
- package/lib/components/Table/StaticTable.js +1 -1
- package/lib/components/Table/StaticTable.js.flow +1 -1
- package/lib/components/Table/Table.docs.js +1 -1
- package/lib/components/Table/Table.docs.js.flow +1 -1
- package/lib/components/Tabs/TabList/TabDropdown.js +7 -14
- package/lib/components/Tabs/TabList/TabDropdown.js.flow +22 -38
- package/lib/components/Tabs/TabList/TabDropdown.module.css +0 -4
- package/lib/components/Tabs/TabList/TabList.js +2 -4
- package/lib/components/Tabs/TabList/TabList.js.flow +0 -4
- package/lib/components/TokenListInput/TokenListInput.js +7 -26
- package/lib/components/TokenListInput/TokenListInput.js.flow +32 -58
- package/lib/components/TokenListInput/TokenListInput.module.css +0 -5
- package/lib/components/Tooltip/Tooltip.js +1 -2
- package/lib/components/Tooltip/Tooltip.js.flow +2 -2
- package/lib/components/Typeahead/SimpleTypeahead.js +1 -3
- package/lib/components/Typeahead/SimpleTypeahead.js.flow +0 -4
- package/lib/components/Typeahead/Typeahead.js +8 -25
- package/lib/components/Typeahead/Typeahead.js.flow +30 -58
- package/lib/components/Typeahead/Typeahead.module.css +0 -5
- package/lib/hooks/index.js +0 -11
- package/lib/hooks/index.js.flow +0 -1
- package/package.json +1 -1
- package/lib/hooks/useReferenceElementWidth/index.js +0 -16
- package/lib/hooks/useReferenceElementWidth/index.js.flow +0 -3
- package/lib/hooks/useReferenceElementWidth/useReferenceElementWidth.js +0 -21
- package/lib/hooks/useReferenceElementWidth/useReferenceElementWidth.js.flow +0 -23
|
@@ -193,6 +193,11 @@ export const MENU_NAME_LIST = Object.freeze({
|
|
|
193
193
|
iconName: 'user-headset',
|
|
194
194
|
iconType: 'duotone',
|
|
195
195
|
},
|
|
196
|
+
dataManagement: {
|
|
197
|
+
title: 'Data Management',
|
|
198
|
+
iconName: 'database',
|
|
199
|
+
iconType: 'duotone',
|
|
200
|
+
},
|
|
196
201
|
});
|
|
197
202
|
|
|
198
203
|
type ClassNames = $ReadOnly<{wrapper?: string}>;
|
|
@@ -74,7 +74,7 @@ function StaticTable(props) {
|
|
|
74
74
|
}, [width]);
|
|
75
75
|
|
|
76
76
|
/**
|
|
77
|
-
* this function is also used to decide weather to show checkbox in header or not. so it's value is undefined
|
|
77
|
+
* this function is also used to decide weather to show checkbox in header or not. so it's value is undefined incase selectedKeys is not there.
|
|
78
78
|
*/
|
|
79
79
|
|
|
80
80
|
const handleHeaderCheckboxClick = selectedKeys ? ({
|
|
@@ -89,7 +89,7 @@ export function StaticTable<Data: GenericObject, Extras: GenericObject>(props: {
|
|
|
89
89
|
}, [width]);
|
|
90
90
|
|
|
91
91
|
/**
|
|
92
|
-
* this function is also used to decide weather to show checkbox in header or not. so it's value is undefined
|
|
92
|
+
* this function is also used to decide weather to show checkbox in header or not. so it's value is undefined incase selectedKeys is not there.
|
|
93
93
|
*/
|
|
94
94
|
|
|
95
95
|
const handleHeaderCheckboxClick = selectedKeys
|
|
@@ -104,7 +104,7 @@ const TABLE_DOCS = exports.TABLE_DOCS = {
|
|
|
104
104
|
}
|
|
105
105
|
},
|
|
106
106
|
selectedKeys: {
|
|
107
|
-
description: 'array of keys which are selected. This prop is also used to decide weather to show checkboxes or not. So, pass an empty array
|
|
107
|
+
description: 'array of keys which are selected. This prop is also used to decide weather to show checkboxes or not. So, pass an empty array incase no row is selected.',
|
|
108
108
|
control: {
|
|
109
109
|
type: 'object'
|
|
110
110
|
},
|
|
@@ -89,7 +89,7 @@ export const TABLE_DOCS = {
|
|
|
89
89
|
},
|
|
90
90
|
selectedKeys: {
|
|
91
91
|
description:
|
|
92
|
-
'array of keys which are selected. This prop is also used to decide weather to show checkboxes or not. So, pass an empty array
|
|
92
|
+
'array of keys which are selected. This prop is also used to decide weather to show checkboxes or not. So, pass an empty array incase no row is selected.',
|
|
93
93
|
control: {
|
|
94
94
|
type: 'object',
|
|
95
95
|
},
|
|
@@ -11,7 +11,6 @@ var _classify = require("../../../utils/classify");
|
|
|
11
11
|
var _clickAway = require("../../../utils/click-away");
|
|
12
12
|
var _mergeRefs = require("../../../utils/merge-refs");
|
|
13
13
|
var _Menu = require("../../Menu");
|
|
14
|
-
var _Tooltip = require("../../Tooltip");
|
|
15
14
|
var _Tab = require("../Tab");
|
|
16
15
|
var _TabDropdownModule = _interopRequireDefault(require("./TabDropdown.module.css"));
|
|
17
16
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
@@ -23,15 +22,14 @@ const TabDropdown = _ref => {
|
|
|
23
22
|
size,
|
|
24
23
|
onOptionSelect,
|
|
25
24
|
props,
|
|
26
|
-
elevation = 'modal',
|
|
27
25
|
classNames
|
|
28
26
|
} = _ref;
|
|
27
|
+
const menuBtnRef = React.useRef();
|
|
29
28
|
const {
|
|
30
29
|
x,
|
|
31
30
|
y,
|
|
32
31
|
refs,
|
|
33
|
-
strategy
|
|
34
|
-
context
|
|
32
|
+
strategy
|
|
35
33
|
} = (0, _react2.useFloating)({
|
|
36
34
|
open: true,
|
|
37
35
|
strategy: 'absolute',
|
|
@@ -49,7 +47,8 @@ const TabDropdown = _ref => {
|
|
|
49
47
|
} = _ref2;
|
|
50
48
|
return /*#__PURE__*/React.createElement("div", {
|
|
51
49
|
"data-testid": "TabDropdown",
|
|
52
|
-
className: (0, _classify.classify)(_TabDropdownModule.default.tabDropdownContainer, classNames?.wrapper)
|
|
50
|
+
className: (0, _classify.classify)(_TabDropdownModule.default.tabDropdownContainer, classNames?.wrapper),
|
|
51
|
+
ref: menuBtnRef
|
|
53
52
|
}, /*#__PURE__*/React.createElement(_Tab.Tab, _extends({}, props?.tab, {
|
|
54
53
|
size: size,
|
|
55
54
|
ref: (0, _mergeRefs.mergeRefs)([refs.setReference, triggerRef]),
|
|
@@ -61,19 +60,13 @@ const TabDropdown = _ref => {
|
|
|
61
60
|
wrapper: _TabDropdownModule.default.dotTabWrapper,
|
|
62
61
|
iconTextWrap: _TabDropdownModule.default.dotTextWrap
|
|
63
62
|
}
|
|
64
|
-
})), isOpen && props?.menu && /*#__PURE__*/React.createElement(
|
|
65
|
-
modal: false,
|
|
66
|
-
context: context,
|
|
67
|
-
initialFocus: refs.reference
|
|
68
|
-
}, /*#__PURE__*/React.createElement("div", {
|
|
63
|
+
})), isOpen && props?.menu && /*#__PURE__*/React.createElement("div", {
|
|
69
64
|
ref: (0, _mergeRefs.mergeRefs)([refs.setFloating, boundaryRef]),
|
|
70
|
-
className: _TabDropdownModule.default.menuWrapper,
|
|
71
65
|
style: {
|
|
72
66
|
display: 'flex',
|
|
73
67
|
position: strategy,
|
|
74
68
|
top: y ?? _space.spaceNone,
|
|
75
|
-
left: x ?? _space.spaceNone
|
|
76
|
-
'--menu-elevation': (0, _Tooltip.getElevationValue)(elevation)
|
|
69
|
+
left: x ?? _space.spaceNone
|
|
77
70
|
}
|
|
78
71
|
}, /*#__PURE__*/React.createElement(_Menu.Menu, _extends({}, props.menu, {
|
|
79
72
|
onSelect: (option, e) => {
|
|
@@ -82,7 +75,7 @@ const TabDropdown = _ref => {
|
|
|
82
75
|
},
|
|
83
76
|
size: props.menu.size || size,
|
|
84
77
|
onTabOut: clickAway
|
|
85
|
-
}))))
|
|
78
|
+
}))));
|
|
86
79
|
});
|
|
87
80
|
};
|
|
88
81
|
exports.TabDropdown = TabDropdown;
|
|
@@ -7,10 +7,6 @@ import {
|
|
|
7
7
|
// $FlowFixMe[untyped-import]
|
|
8
8
|
flip,
|
|
9
9
|
// $FlowFixMe[untyped-import]
|
|
10
|
-
FloatingFocusManager,
|
|
11
|
-
// $FlowFixMe[untyped-import]
|
|
12
|
-
FloatingPortal,
|
|
13
|
-
// $FlowFixMe[untyped-import]
|
|
14
10
|
offset,
|
|
15
11
|
// $FlowFixMe[untyped-import]
|
|
16
12
|
shift,
|
|
@@ -25,8 +21,6 @@ import {mergeRefs} from '../../../utils/merge-refs';
|
|
|
25
21
|
import type {AnchorType} from '../../ButtonDropdown';
|
|
26
22
|
import type {MenuOption, MenuProps} from '../../Menu';
|
|
27
23
|
import {Menu} from '../../Menu';
|
|
28
|
-
import type {ElevationType} from '../../Tooltip';
|
|
29
|
-
import {getElevationValue} from '../../Tooltip';
|
|
30
24
|
import type {TabProps} from '../Tab';
|
|
31
25
|
import {Tab} from '../Tab';
|
|
32
26
|
|
|
@@ -46,7 +40,6 @@ export type TabDropdownProps = {
|
|
|
46
40
|
classNames?: ClassNames,
|
|
47
41
|
selected?: boolean,
|
|
48
42
|
disabled?: boolean,
|
|
49
|
-
elevation?: ElevationType,
|
|
50
43
|
};
|
|
51
44
|
|
|
52
45
|
export const TabDropdown = ({
|
|
@@ -54,10 +47,10 @@ export const TabDropdown = ({
|
|
|
54
47
|
size,
|
|
55
48
|
onOptionSelect,
|
|
56
49
|
props,
|
|
57
|
-
elevation = 'modal',
|
|
58
50
|
classNames,
|
|
59
51
|
}: TabDropdownProps): React.Node => {
|
|
60
|
-
const
|
|
52
|
+
const menuBtnRef = React.useRef();
|
|
53
|
+
const {x, y, refs, strategy} = useFloating({
|
|
61
54
|
open: true,
|
|
62
55
|
strategy: 'absolute',
|
|
63
56
|
placement: anchorPosition,
|
|
@@ -71,6 +64,7 @@ export const TabDropdown = ({
|
|
|
71
64
|
<div
|
|
72
65
|
data-testid="TabDropdown"
|
|
73
66
|
className={classify(css.tabDropdownContainer, classNames?.wrapper)}
|
|
67
|
+
ref={menuBtnRef}
|
|
74
68
|
>
|
|
75
69
|
<Tab
|
|
76
70
|
{...props?.tab}
|
|
@@ -86,35 +80,25 @@ export const TabDropdown = ({
|
|
|
86
80
|
}}
|
|
87
81
|
/>
|
|
88
82
|
{isOpen && props?.menu && (
|
|
89
|
-
<
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
onSelect={(option, e) => {
|
|
109
|
-
onOptionSelect && onOptionSelect(option, e);
|
|
110
|
-
clickAway();
|
|
111
|
-
}}
|
|
112
|
-
size={props.menu.size || size}
|
|
113
|
-
onTabOut={clickAway}
|
|
114
|
-
/>
|
|
115
|
-
</div>
|
|
116
|
-
</FloatingFocusManager>
|
|
117
|
-
</FloatingPortal>
|
|
83
|
+
<div
|
|
84
|
+
ref={mergeRefs([refs.setFloating, boundaryRef])}
|
|
85
|
+
style={{
|
|
86
|
+
display: 'flex',
|
|
87
|
+
position: strategy,
|
|
88
|
+
top: y ?? spaceNone,
|
|
89
|
+
left: x ?? spaceNone,
|
|
90
|
+
}}
|
|
91
|
+
>
|
|
92
|
+
<Menu
|
|
93
|
+
{...props.menu}
|
|
94
|
+
onSelect={(option, e) => {
|
|
95
|
+
onOptionSelect && onOptionSelect(option, e);
|
|
96
|
+
clickAway();
|
|
97
|
+
}}
|
|
98
|
+
size={props.menu.size || size}
|
|
99
|
+
onTabOut={clickAway}
|
|
100
|
+
/>
|
|
101
|
+
</div>
|
|
118
102
|
)}
|
|
119
103
|
</div>
|
|
120
104
|
)}
|
|
@@ -20,8 +20,7 @@ const TabList = exports.TabList = /*#__PURE__*/React.forwardRef((_ref, forwardRe
|
|
|
20
20
|
size,
|
|
21
21
|
onSelect,
|
|
22
22
|
selectedTab,
|
|
23
|
-
menuWidth
|
|
24
|
-
elevation = 'modal'
|
|
23
|
+
menuWidth
|
|
25
24
|
} = _ref;
|
|
26
25
|
const ref = React.useRef(null);
|
|
27
26
|
React.useImperativeHandle(forwardRef, () => ref.current);
|
|
@@ -105,8 +104,7 @@ const TabList = exports.TabList = /*#__PURE__*/React.forwardRef((_ref, forwardRe
|
|
|
105
104
|
selectedKeys,
|
|
106
105
|
width: menuWidth
|
|
107
106
|
}
|
|
108
|
-
}
|
|
109
|
-
elevation: elevation
|
|
107
|
+
}
|
|
110
108
|
}) : null;
|
|
111
109
|
nodes = [...tabListNodes, tabDropDownNode];
|
|
112
110
|
return nodes;
|
|
@@ -6,7 +6,6 @@ import {useWindowSize} from '../../../hooks/useWindowSize/useWindowSize';
|
|
|
6
6
|
import {size36, size100} from '../../../styles/variables/_size';
|
|
7
7
|
import {spaceMedium} from '../../../styles/variables/_space';
|
|
8
8
|
import {classify} from '../../../utils/classify';
|
|
9
|
-
import type {ElevationType} from '../../Tooltip';
|
|
10
9
|
|
|
11
10
|
import {TabDropdown} from './TabDropdown';
|
|
12
11
|
|
|
@@ -22,7 +21,6 @@ export type TabListProps = {
|
|
|
22
21
|
size?: 'medium',
|
|
23
22
|
selectedTab?: {tabId: string, label?: string},
|
|
24
23
|
menuWidth?: string,
|
|
25
|
-
elevation?: ElevationType,
|
|
26
24
|
};
|
|
27
25
|
|
|
28
26
|
export const TabList: React$AbstractComponent<TabListProps, HTMLDivElement> =
|
|
@@ -35,7 +33,6 @@ export const TabList: React$AbstractComponent<TabListProps, HTMLDivElement> =
|
|
|
35
33
|
onSelect,
|
|
36
34
|
selectedTab,
|
|
37
35
|
menuWidth,
|
|
38
|
-
elevation = 'modal',
|
|
39
36
|
}: TabListProps,
|
|
40
37
|
forwardRef,
|
|
41
38
|
): React.Node => {
|
|
@@ -123,7 +120,6 @@ export const TabList: React$AbstractComponent<TabListProps, HTMLDivElement> =
|
|
|
123
120
|
width: menuWidth,
|
|
124
121
|
},
|
|
125
122
|
}}
|
|
126
|
-
elevation={elevation}
|
|
127
123
|
/>
|
|
128
124
|
) : null;
|
|
129
125
|
|
|
@@ -8,7 +8,7 @@ exports.TokenListInput = TokenListInput;
|
|
|
8
8
|
var React = _interopRequireWildcard(require("react"));
|
|
9
9
|
var _react2 = require("@floating-ui/react");
|
|
10
10
|
var _without = _interopRequireDefault(require("lodash/without"));
|
|
11
|
-
var
|
|
11
|
+
var _size = require("../../styles/variables/_size");
|
|
12
12
|
var _space = require("../../styles/variables/_space");
|
|
13
13
|
var _typography = require("../../types/typography");
|
|
14
14
|
var _classify = _interopRequireDefault(require("../../utils/classify"));
|
|
@@ -20,7 +20,6 @@ var _CircularLoader = require("../CircularLoader");
|
|
|
20
20
|
var _Icon = require("../Icon");
|
|
21
21
|
var _Menu = require("../Menu");
|
|
22
22
|
var _Text = require("../Text");
|
|
23
|
-
var _Tooltip = require("../Tooltip");
|
|
24
23
|
var _TokenValueChips = require("./TokenValueChips");
|
|
25
24
|
var _TokenListInputModule = _interopRequireDefault(require("./TokenListInput.module.css"));
|
|
26
25
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
@@ -56,16 +55,14 @@ function TokenListInput(props) {
|
|
|
56
55
|
tabIndex,
|
|
57
56
|
values,
|
|
58
57
|
resolveTokenValue,
|
|
59
|
-
inputProps
|
|
60
|
-
elevation = 'modal'
|
|
58
|
+
inputProps
|
|
61
59
|
} = props;
|
|
62
60
|
const menuRef = React.useRef(null);
|
|
63
61
|
const {
|
|
64
62
|
x,
|
|
65
63
|
y,
|
|
66
64
|
refs,
|
|
67
|
-
strategy
|
|
68
|
-
context
|
|
65
|
+
strategy
|
|
69
66
|
} = (0, _react2.useFloating)({
|
|
70
67
|
open: true,
|
|
71
68
|
strategy: _ButtonDropdown.STRATEGY_TYPE.absolute,
|
|
@@ -74,7 +71,6 @@ function TokenListInput(props) {
|
|
|
74
71
|
middleware: [(0, _react2.flip)(), (0, _react2.offset)(parseInt(_space.spaceXXSmall))]
|
|
75
72
|
});
|
|
76
73
|
const inputRef = React.useRef();
|
|
77
|
-
const dropdownWidth = (0, _hooks.useReferenceElementWidth)(refs.reference?.current);
|
|
78
74
|
const onOpenToggle = isOpen => {
|
|
79
75
|
if (isOpen) {
|
|
80
76
|
onMenuOpen?.();
|
|
@@ -156,9 +152,8 @@ function TokenListInput(props) {
|
|
|
156
152
|
triggerRef
|
|
157
153
|
} = _ref;
|
|
158
154
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
|
|
159
|
-
ref: menuRef,
|
|
160
155
|
className: (0, _classify.default)(_TokenListInputModule.default.tokenListContainer, classNames?.wrapper),
|
|
161
|
-
|
|
156
|
+
ref: menuRef
|
|
162
157
|
}, /*#__PURE__*/React.createElement("div", {
|
|
163
158
|
onClick: () => {
|
|
164
159
|
if (disabled || locked || values.length >= limit) {
|
|
@@ -229,27 +224,13 @@ function TokenListInput(props) {
|
|
|
229
224
|
color: _typography.TEXT_COLORS.danger
|
|
230
225
|
}, errorText) : typeof helperText === 'string' ? /*#__PURE__*/React.createElement(_Text.BodySmall, {
|
|
231
226
|
color: _typography.TEXT_COLORS.secondary
|
|
232
|
-
}, helperText) : helperText), !locked && isOpen && menu && /*#__PURE__*/React.createElement(
|
|
233
|
-
modal: false,
|
|
234
|
-
context: context,
|
|
235
|
-
returnFocus: false,
|
|
236
|
-
initialFocus: refs.reference
|
|
237
|
-
}, /*#__PURE__*/React.createElement("div", {
|
|
238
|
-
className: _TokenListInputModule.default.menuWrapper,
|
|
227
|
+
}, helperText) : helperText), !locked && isOpen && menu && /*#__PURE__*/React.createElement("div", {
|
|
239
228
|
ref: (0, _mergeRefs.mergeRefs)([refs.setFloating, boundaryRef]),
|
|
240
229
|
style: {
|
|
241
230
|
position: strategy,
|
|
242
231
|
top: y ?? _space.spaceNone,
|
|
243
232
|
left: x ?? _space.spaceNone,
|
|
244
|
-
|
|
245
|
-
so its parent is effectively the <body> element. This means the menu
|
|
246
|
-
would otherwise default to the body's width. To support fluid width,
|
|
247
|
-
we must manually set the dropdown width here; otherwise, it uses a fixed width.
|
|
248
|
-
Also, Only treat menu as non-fluid if isFluid is strictly false, since default is true in menu and undefined means fluid. */
|
|
249
|
-
...(menu.isFluid !== false && {
|
|
250
|
-
'--dropdown-width': dropdownWidth
|
|
251
|
-
}),
|
|
252
|
-
'--menu-elevation': (0, _Tooltip.getElevationValue)(elevation)
|
|
233
|
+
width: _size.sizeFluid
|
|
253
234
|
}
|
|
254
235
|
}, /*#__PURE__*/React.createElement(_Menu.Menu, _extends({}, menu, {
|
|
255
236
|
onSelect: option => {
|
|
@@ -265,7 +246,7 @@ function TokenListInput(props) {
|
|
|
265
246
|
size: menu.size || size,
|
|
266
247
|
onTabOut: clickAway,
|
|
267
248
|
ref: menuRef
|
|
268
|
-
})))))
|
|
249
|
+
})))));
|
|
269
250
|
});
|
|
270
251
|
}
|
|
271
252
|
TokenListInput.displayName = 'TokenListInput';
|
|
@@ -7,17 +7,13 @@ import {
|
|
|
7
7
|
// $FlowFixMe[untyped-import]
|
|
8
8
|
flip,
|
|
9
9
|
// $FlowFixMe[untyped-import]
|
|
10
|
-
FloatingFocusManager,
|
|
11
|
-
// $FlowFixMe[untyped-import]
|
|
12
|
-
FloatingPortal,
|
|
13
|
-
// $FlowFixMe[untyped-import]
|
|
14
10
|
offset,
|
|
15
11
|
// $FlowFixMe[untyped-import]
|
|
16
12
|
useFloating,
|
|
17
13
|
} from '@floating-ui/react';
|
|
18
14
|
import without from 'lodash/without';
|
|
19
15
|
|
|
20
|
-
import {
|
|
16
|
+
import {sizeFluid} from '../../styles/variables/_size';
|
|
21
17
|
import {spaceNone, spaceXXSmall} from '../../styles/variables/_space';
|
|
22
18
|
import {TEXT_COLORS} from '../../types/typography';
|
|
23
19
|
import classify from '../../utils/classify';
|
|
@@ -35,7 +31,6 @@ import type {InputProps} from '../Input';
|
|
|
35
31
|
import type {BaseMenuProps} from '../Menu';
|
|
36
32
|
import {Menu} from '../Menu';
|
|
37
33
|
import {BodySmall} from '../Text';
|
|
38
|
-
import {type ElevationType, getElevationValue} from '../Tooltip';
|
|
39
34
|
|
|
40
35
|
import type {ResolveTokenValueProps} from './TokenValueChips';
|
|
41
36
|
import {TokenValueChips} from './TokenValueChips';
|
|
@@ -96,7 +91,6 @@ export type Props<T> = {
|
|
|
96
91
|
onMenuClose?: () => mixed,
|
|
97
92
|
resolveTokenValue?: (ResolveTokenValueProps<T>) => React.Node,
|
|
98
93
|
inputProps?: InputProps,
|
|
99
|
-
elevation?: ElevationType,
|
|
100
94
|
};
|
|
101
95
|
|
|
102
96
|
export function TokenListInput<T>(props: Props<T>): React.Node {
|
|
@@ -126,11 +120,11 @@ export function TokenListInput<T>(props: Props<T>): React.Node {
|
|
|
126
120
|
values,
|
|
127
121
|
resolveTokenValue,
|
|
128
122
|
inputProps,
|
|
129
|
-
elevation = 'modal',
|
|
130
123
|
} = props;
|
|
124
|
+
|
|
131
125
|
const menuRef = React.useRef<HTMLDivElement | null>(null);
|
|
132
126
|
|
|
133
|
-
const {x, y, refs, strategy
|
|
127
|
+
const {x, y, refs, strategy} = useFloating({
|
|
134
128
|
open: true,
|
|
135
129
|
strategy: STRATEGY_TYPE.absolute,
|
|
136
130
|
placement: ANCHOR_POSITION_TYPE.bottomStart,
|
|
@@ -139,7 +133,6 @@ export function TokenListInput<T>(props: Props<T>): React.Node {
|
|
|
139
133
|
});
|
|
140
134
|
|
|
141
135
|
const inputRef = React.useRef<?HTMLInputElement>();
|
|
142
|
-
const dropdownWidth = useReferenceElementWidth(refs.reference?.current);
|
|
143
136
|
|
|
144
137
|
const onOpenToggle = (isOpen) => {
|
|
145
138
|
if (isOpen) {
|
|
@@ -229,9 +222,8 @@ export function TokenListInput<T>(props: Props<T>): React.Node {
|
|
|
229
222
|
{({isOpen, onOpen, clickAway, boundaryRef, triggerRef}) => (
|
|
230
223
|
<>
|
|
231
224
|
<div
|
|
232
|
-
ref={menuRef}
|
|
233
225
|
className={classify(css.tokenListContainer, classNames?.wrapper)}
|
|
234
|
-
|
|
226
|
+
ref={menuRef}
|
|
235
227
|
>
|
|
236
228
|
<div
|
|
237
229
|
onClick={() => {
|
|
@@ -332,52 +324,34 @@ export function TokenListInput<T>(props: Props<T>): React.Node {
|
|
|
332
324
|
</div>
|
|
333
325
|
)}
|
|
334
326
|
{!locked && isOpen && menu && (
|
|
335
|
-
<
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
{...menu}
|
|
364
|
-
onSelect={(option) => {
|
|
365
|
-
if (values.length >= limit) {
|
|
366
|
-
return;
|
|
367
|
-
}
|
|
368
|
-
// $FlowFixMe[incompatible-call] option from Menu is MenuOption but addValue expects T
|
|
369
|
-
// $FlowFixMe[prop-missing] MenuOption properties are missing in T
|
|
370
|
-
addValue(option);
|
|
371
|
-
clickAway();
|
|
372
|
-
inputRef.current?.focus();
|
|
373
|
-
}}
|
|
374
|
-
size={menu.size || size}
|
|
375
|
-
onTabOut={clickAway}
|
|
376
|
-
ref={menuRef}
|
|
377
|
-
/>
|
|
378
|
-
</div>
|
|
379
|
-
</FloatingFocusManager>
|
|
380
|
-
</FloatingPortal>
|
|
327
|
+
<div
|
|
328
|
+
ref={mergeRefs([refs.setFloating, boundaryRef])}
|
|
329
|
+
style={{
|
|
330
|
+
position: strategy,
|
|
331
|
+
top: y ?? spaceNone,
|
|
332
|
+
left: x ?? spaceNone,
|
|
333
|
+
width: sizeFluid,
|
|
334
|
+
}}
|
|
335
|
+
>
|
|
336
|
+
{/* $FlowFixMe[incompatible-type] Menu expects MenuOption but receives T */}
|
|
337
|
+
{/* $FlowFixMe[prop-missing] MenuOption properties are missing in T */}
|
|
338
|
+
<Menu
|
|
339
|
+
{...menu}
|
|
340
|
+
onSelect={(option) => {
|
|
341
|
+
if (values.length >= limit) {
|
|
342
|
+
return;
|
|
343
|
+
}
|
|
344
|
+
// $FlowFixMe[incompatible-call] option from Menu is MenuOption but addValue expects T
|
|
345
|
+
// $FlowFixMe[prop-missing] MenuOption properties are missing in T
|
|
346
|
+
addValue(option);
|
|
347
|
+
clickAway();
|
|
348
|
+
inputRef.current?.focus();
|
|
349
|
+
}}
|
|
350
|
+
size={menu.size || size}
|
|
351
|
+
onTabOut={clickAway}
|
|
352
|
+
ref={menuRef}
|
|
353
|
+
/>
|
|
354
|
+
</div>
|
|
381
355
|
)}
|
|
382
356
|
</div>
|
|
383
357
|
</>
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.
|
|
6
|
+
exports.Tooltip = exports.ELEVATION_TYPES = exports.DELAY_MOTION_DURATION_TYPES = void 0;
|
|
7
7
|
var React = _interopRequireWildcard(require("react"));
|
|
8
8
|
var _react2 = require("@floating-ui/react");
|
|
9
9
|
var ELEVATION = _interopRequireWildcard(require("../../styles/variables/_elevation"));
|
|
@@ -39,7 +39,6 @@ const getElevationValue = elevation => {
|
|
|
39
39
|
const elevationKey = 'elevation' + (0, _string.capitalize)(elevation);
|
|
40
40
|
return ELEVATION[elevationKey] || elevation;
|
|
41
41
|
};
|
|
42
|
-
exports.getElevationValue = getElevationValue;
|
|
43
42
|
const Tooltip = _ref => {
|
|
44
43
|
let {
|
|
45
44
|
classNames,
|
|
@@ -84,7 +84,7 @@ export type BaseTooltipProps = {
|
|
|
84
84
|
titleMaxLines?: number,
|
|
85
85
|
delayMotionDuration?: DelayMotionDurationType,
|
|
86
86
|
hidden?: boolean,
|
|
87
|
-
elevation?:
|
|
87
|
+
elevation?: string,
|
|
88
88
|
};
|
|
89
89
|
|
|
90
90
|
export type TooltipProps = {
|
|
@@ -94,7 +94,7 @@ export type TooltipProps = {
|
|
|
94
94
|
children: any,
|
|
95
95
|
};
|
|
96
96
|
|
|
97
|
-
|
|
97
|
+
const getElevationValue = (elevation: string): string => {
|
|
98
98
|
const elevationKey = 'elevation' + capitalize(elevation);
|
|
99
99
|
return ELEVATION[elevationKey] || elevation;
|
|
100
100
|
};
|
|
@@ -31,7 +31,6 @@ const SimpleTypeaheadBase = (props, ref) => {
|
|
|
31
31
|
showLabelTooltip,
|
|
32
32
|
allowInternalFilter = true,
|
|
33
33
|
allowWrap = false,
|
|
34
|
-
elevation = 'modal',
|
|
35
34
|
...inputProps
|
|
36
35
|
} = props;
|
|
37
36
|
const [typeaheadInputText, setTypeaheadInputText] = React.useState('');
|
|
@@ -85,8 +84,7 @@ const SimpleTypeaheadBase = (props, ref) => {
|
|
|
85
84
|
showLabelTooltip,
|
|
86
85
|
allowWrap
|
|
87
86
|
},
|
|
88
|
-
clickAwayRef: clickAwayRef
|
|
89
|
-
elevation: elevation
|
|
87
|
+
clickAwayRef: clickAwayRef
|
|
90
88
|
}));
|
|
91
89
|
};
|
|
92
90
|
const SimpleTypeahead = exports.SimpleTypeahead = /*#__PURE__*/React.forwardRef(SimpleTypeaheadBase);
|
|
@@ -7,7 +7,6 @@ import type {ClickAwayRefType} from '../../utils/click-away';
|
|
|
7
7
|
import {getTextLabelFromSelectedKeys} from '../../utils/menu';
|
|
8
8
|
import type {InputProps} from '../Input';
|
|
9
9
|
import type {MenuOption, Virtualization} from '../Menu';
|
|
10
|
-
import type {ElevationType} from '../Tooltip';
|
|
11
10
|
|
|
12
11
|
import {Typeahead} from './Typeahead';
|
|
13
12
|
|
|
@@ -39,7 +38,6 @@ export type SimpleTypeaheadProps = {
|
|
|
39
38
|
menuClassNames?: MenuClassNames,
|
|
40
39
|
showLabelTooltip?: MenuLabelTooltip,
|
|
41
40
|
allowWrap?: boolean,
|
|
42
|
-
elevation?: ElevationType,
|
|
43
41
|
|
|
44
42
|
// events
|
|
45
43
|
onSelect?: (option: MenuOption, ?SyntheticEvent<HTMLElement>) => mixed,
|
|
@@ -78,7 +76,6 @@ const SimpleTypeaheadBase = (props: SimpleTypeaheadProps, ref) => {
|
|
|
78
76
|
showLabelTooltip,
|
|
79
77
|
allowInternalFilter = true,
|
|
80
78
|
allowWrap = false,
|
|
81
|
-
elevation = 'modal',
|
|
82
79
|
...inputProps
|
|
83
80
|
} = props;
|
|
84
81
|
|
|
@@ -151,7 +148,6 @@ const SimpleTypeaheadBase = (props: SimpleTypeaheadProps, ref) => {
|
|
|
151
148
|
allowWrap,
|
|
152
149
|
}}
|
|
153
150
|
clickAwayRef={clickAwayRef}
|
|
154
|
-
elevation={elevation}
|
|
155
151
|
/>
|
|
156
152
|
);
|
|
157
153
|
};
|