@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
package/.cspell/custom-words.txt
CHANGED
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,20 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
|
4
4
|
|
|
5
|
+
### [0.3.48](https://github.com/spaced-out/ui-design-system/compare/v0.3.47...v0.3.48) (2025-07-02)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Features
|
|
9
|
+
|
|
10
|
+
* added data management icon in side menu link ([#363](https://github.com/spaced-out/ui-design-system/issues/363)) ([86a0e4b](https://github.com/spaced-out/ui-design-system/commit/86a0e4b36ae2aa220897330b0090882ebacc5298))
|
|
11
|
+
|
|
12
|
+
### [0.3.47](https://github.com/spaced-out/ui-design-system/compare/v0.3.47-beta.0...v0.3.47) (2025-06-24)
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
### Bug Fixes
|
|
16
|
+
|
|
17
|
+
* added labels support for i18n ([#360](https://github.com/spaced-out/ui-design-system/issues/360)) ([f33f4ed](https://github.com/spaced-out/ui-design-system/commit/f33f4ed8fe8346c1c884d67fd8d9ea0cd0331602))
|
|
18
|
+
|
|
5
19
|
### [0.3.47-beta.0](https://github.com/spaced-out/ui-design-system/compare/v0.3.46...v0.3.47-beta.0) (2025-06-20)
|
|
6
20
|
|
|
7
21
|
|
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
import classify from '../../utils/classify';
|
|
12
12
|
import type {AvatarSize} from '../Avatar';
|
|
13
13
|
import {BaseAvatar} from '../Avatar';
|
|
14
|
-
import type {
|
|
14
|
+
import type {PlacementType} from '../Tooltip';
|
|
15
15
|
import {Tooltip} from '../Tooltip';
|
|
16
16
|
|
|
17
17
|
import css from './AvatarGroup.module.css';
|
|
@@ -26,7 +26,7 @@ export type AvatarGroupProps = {
|
|
|
26
26
|
maxTooltipLines?: number,
|
|
27
27
|
placement?: PlacementType,
|
|
28
28
|
maxAvatars?: number,
|
|
29
|
-
tooltipElevation?:
|
|
29
|
+
tooltipElevation?: string,
|
|
30
30
|
};
|
|
31
31
|
|
|
32
32
|
export const AvatarGroup: React$AbstractComponent<
|
|
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.STRATEGY_TYPE = exports.ButtonDropdown = exports.ANCHOR_POSITION_TYPE = void 0;
|
|
7
7
|
var React = _interopRequireWildcard(require("react"));
|
|
8
8
|
var _react2 = require("@floating-ui/react");
|
|
9
|
-
var
|
|
9
|
+
var _size = require("../../styles/variables/_size");
|
|
10
10
|
var _space = require("../../styles/variables/_space");
|
|
11
11
|
var _classify = require("../../utils/classify");
|
|
12
12
|
var _clickAway = require("../../utils/click-away");
|
|
@@ -48,17 +48,17 @@ const ButtonDropdown = exports.ButtonDropdown = /*#__PURE__*/React.forwardRef((_
|
|
|
48
48
|
isFluid,
|
|
49
49
|
tooltip,
|
|
50
50
|
onClick,
|
|
51
|
-
elevation = 'modal',
|
|
52
51
|
clickAwayRef,
|
|
53
52
|
...restButtonProps
|
|
54
53
|
} = _ref;
|
|
54
|
+
const menuBtnRef = React.useRef(null);
|
|
55
55
|
const [isMenuOpen, setIsMenuOpen] = React.useState(false);
|
|
56
|
+
React.useImperativeHandle(forwardRef, () => menuBtnRef.current);
|
|
56
57
|
const {
|
|
57
58
|
x,
|
|
58
59
|
y,
|
|
59
60
|
refs,
|
|
60
|
-
strategy
|
|
61
|
-
context
|
|
61
|
+
strategy
|
|
62
62
|
} = (0, _react2.useFloating)({
|
|
63
63
|
open: true,
|
|
64
64
|
strategy: positionStrategy,
|
|
@@ -66,7 +66,6 @@ const ButtonDropdown = exports.ButtonDropdown = /*#__PURE__*/React.forwardRef((_
|
|
|
66
66
|
whileElementsMounted: _react2.autoUpdate,
|
|
67
67
|
middleware: [(0, _react2.shift)(), (0, _react2.flip)(), (0, _react2.offset)(parseInt(_space.spaceXXSmall))]
|
|
68
68
|
});
|
|
69
|
-
const dropdownWidth = (0, _hooks.useReferenceElementWidth)(refs.reference?.current);
|
|
70
69
|
const onMenuToggle = isOpen => {
|
|
71
70
|
if (isOpen) {
|
|
72
71
|
onMenuOpen?.();
|
|
@@ -92,7 +91,7 @@ const ButtonDropdown = exports.ButtonDropdown = /*#__PURE__*/React.forwardRef((_
|
|
|
92
91
|
className: (0, _classify.classify)(_ButtonDropdownModule.default.buttonDropdownContainer, {
|
|
93
92
|
[_ButtonDropdownModule.default.isFluid]: isFluid === true
|
|
94
93
|
}, classNames?.dropdownContainer),
|
|
95
|
-
ref:
|
|
94
|
+
ref: menuBtnRef
|
|
96
95
|
}, /*#__PURE__*/React.createElement(_ConditionalWrapper.ConditionalWrapper, {
|
|
97
96
|
condition: Boolean(tooltip),
|
|
98
97
|
wrapper: children => /*#__PURE__*/React.createElement(_Tooltip.Tooltip, _extends({}, tooltip, {
|
|
@@ -114,27 +113,16 @@ const ButtonDropdown = exports.ButtonDropdown = /*#__PURE__*/React.forwardRef((_
|
|
|
114
113
|
wrapper: classNames?.buttonWrapper,
|
|
115
114
|
icon: classNames?.buttonIcon
|
|
116
115
|
}
|
|
117
|
-
}), children)), isOpen && menu && /*#__PURE__*/React.createElement(
|
|
118
|
-
modal: false,
|
|
119
|
-
context: context,
|
|
120
|
-
initialFocus: refs.reference
|
|
121
|
-
}, /*#__PURE__*/React.createElement("div", {
|
|
122
|
-
className: _ButtonDropdownModule.default.menuWrapper,
|
|
116
|
+
}), children)), isOpen && menu && /*#__PURE__*/React.createElement("div", {
|
|
123
117
|
ref: (0, _mergeRefs.mergeRefs)([refs.setFloating, boundaryRef]),
|
|
124
118
|
style: {
|
|
125
119
|
display: 'flex',
|
|
126
120
|
position: strategy,
|
|
127
121
|
top: y ?? _space.spaceNone,
|
|
128
122
|
left: x ?? _space.spaceNone,
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
we must manually set the dropdown width here; otherwise, it uses a fixed width.
|
|
133
|
-
Also, Only treat menu as non-fluid if isFluid is strictly false, since default is true in menu and undefined means fluid. */
|
|
134
|
-
...(menu.isFluid !== false && {
|
|
135
|
-
'--dropdown-width': dropdownWidth
|
|
136
|
-
}),
|
|
137
|
-
'--menu-elevation': (0, _Tooltip.getElevationValue)(elevation)
|
|
123
|
+
...(isFluid && {
|
|
124
|
+
width: _size.sizeFluid
|
|
125
|
+
})
|
|
138
126
|
}
|
|
139
127
|
}, /*#__PURE__*/React.createElement(_Menu.Menu, _extends({}, menu, {
|
|
140
128
|
onSelect: (option, e) => {
|
|
@@ -147,6 +135,6 @@ const ButtonDropdown = exports.ButtonDropdown = /*#__PURE__*/React.forwardRef((_
|
|
|
147
135
|
},
|
|
148
136
|
size: menu.size || size,
|
|
149
137
|
onTabOut: clickAway
|
|
150
|
-
}))))
|
|
138
|
+
}))));
|
|
151
139
|
});
|
|
152
140
|
});
|
|
@@ -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,
|
|
@@ -18,7 +14,7 @@ import {
|
|
|
18
14
|
useFloating,
|
|
19
15
|
} from '@floating-ui/react';
|
|
20
16
|
|
|
21
|
-
import {
|
|
17
|
+
import {sizeFluid} from '../../styles/variables/_size';
|
|
22
18
|
import {spaceNone, spaceXXSmall} from '../../styles/variables/_space';
|
|
23
19
|
import {classify} from '../../utils/classify';
|
|
24
20
|
import {type ClickAwayRefType, ClickAway} from '../../utils/click-away';
|
|
@@ -28,8 +24,8 @@ import {Button} from '../Button';
|
|
|
28
24
|
import {ConditionalWrapper} from '../ConditionalWrapper';
|
|
29
25
|
import type {MenuOption, MenuProps} from '../Menu';
|
|
30
26
|
import {Menu} from '../Menu';
|
|
31
|
-
import type {BaseTooltipProps
|
|
32
|
-
import {
|
|
27
|
+
import type {BaseTooltipProps} from '../Tooltip';
|
|
28
|
+
import {Tooltip} from '../Tooltip';
|
|
33
29
|
|
|
34
30
|
import css from './ButtonDropdown.module.css';
|
|
35
31
|
|
|
@@ -67,7 +63,6 @@ export type ButtonDropdownProps = {
|
|
|
67
63
|
onMenuOpen?: () => mixed,
|
|
68
64
|
onMenuClose?: () => mixed,
|
|
69
65
|
tooltip?: BaseTooltipProps,
|
|
70
|
-
elevation?: ElevationType,
|
|
71
66
|
clickAwayRef?: ClickAwayRefType,
|
|
72
67
|
...
|
|
73
68
|
};
|
|
@@ -93,15 +88,15 @@ export const ButtonDropdown: React$AbstractComponent<
|
|
|
93
88
|
isFluid,
|
|
94
89
|
tooltip,
|
|
95
90
|
onClick,
|
|
96
|
-
elevation = 'modal',
|
|
97
91
|
clickAwayRef,
|
|
98
92
|
...restButtonProps
|
|
99
93
|
}: ButtonDropdownProps,
|
|
100
94
|
forwardRef,
|
|
101
95
|
) => {
|
|
96
|
+
const menuBtnRef = React.useRef(null);
|
|
102
97
|
const [isMenuOpen, setIsMenuOpen] = React.useState(false);
|
|
103
|
-
|
|
104
|
-
const {x, y, refs, strategy
|
|
98
|
+
React.useImperativeHandle(forwardRef, () => menuBtnRef.current);
|
|
99
|
+
const {x, y, refs, strategy} = useFloating({
|
|
105
100
|
open: true,
|
|
106
101
|
strategy: positionStrategy,
|
|
107
102
|
placement: anchorPosition,
|
|
@@ -109,8 +104,6 @@ export const ButtonDropdown: React$AbstractComponent<
|
|
|
109
104
|
middleware: [shift(), flip(), offset(parseInt(spaceXXSmall))],
|
|
110
105
|
});
|
|
111
106
|
|
|
112
|
-
const dropdownWidth = useReferenceElementWidth(refs.reference?.current);
|
|
113
|
-
|
|
114
107
|
const onMenuToggle = (isOpen: boolean) => {
|
|
115
108
|
if (isOpen) {
|
|
116
109
|
onMenuOpen?.();
|
|
@@ -133,7 +126,7 @@ export const ButtonDropdown: React$AbstractComponent<
|
|
|
133
126
|
},
|
|
134
127
|
classNames?.dropdownContainer,
|
|
135
128
|
)}
|
|
136
|
-
ref={
|
|
129
|
+
ref={menuBtnRef}
|
|
137
130
|
>
|
|
138
131
|
<ConditionalWrapper
|
|
139
132
|
condition={Boolean(tooltip)}
|
|
@@ -173,50 +166,32 @@ export const ButtonDropdown: React$AbstractComponent<
|
|
|
173
166
|
</ConditionalWrapper>
|
|
174
167
|
|
|
175
168
|
{isOpen && menu && (
|
|
176
|
-
<
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
{...menu}
|
|
203
|
-
onSelect={(option, e) => {
|
|
204
|
-
onOptionSelect && onOptionSelect(option, e);
|
|
205
|
-
if (
|
|
206
|
-
// option.keepMenuOpenOnOptionSelect - to allow the menu persist its open stat upon option selection in normal variant
|
|
207
|
-
!option.keepMenuOpenOnOptionSelect &&
|
|
208
|
-
(!menu.optionsVariant ||
|
|
209
|
-
menu.optionsVariant === 'normal')
|
|
210
|
-
) {
|
|
211
|
-
clickAway();
|
|
212
|
-
}
|
|
213
|
-
}}
|
|
214
|
-
size={menu.size || size}
|
|
215
|
-
onTabOut={clickAway}
|
|
216
|
-
/>
|
|
217
|
-
</div>
|
|
218
|
-
</FloatingFocusManager>
|
|
219
|
-
</FloatingPortal>
|
|
169
|
+
<div
|
|
170
|
+
ref={mergeRefs([refs.setFloating, boundaryRef])}
|
|
171
|
+
style={{
|
|
172
|
+
display: 'flex',
|
|
173
|
+
position: strategy,
|
|
174
|
+
top: y ?? spaceNone,
|
|
175
|
+
left: x ?? spaceNone,
|
|
176
|
+
...(isFluid && {width: sizeFluid}),
|
|
177
|
+
}}
|
|
178
|
+
>
|
|
179
|
+
<Menu
|
|
180
|
+
{...menu}
|
|
181
|
+
onSelect={(option, e) => {
|
|
182
|
+
onOptionSelect && onOptionSelect(option, e);
|
|
183
|
+
if (
|
|
184
|
+
// option.keepMenuOpenOnOptionSelect - to allow the menu persist its open stat upon option selection in normal variant
|
|
185
|
+
!option.keepMenuOpenOnOptionSelect &&
|
|
186
|
+
(!menu.optionsVariant || menu.optionsVariant === 'normal')
|
|
187
|
+
) {
|
|
188
|
+
clickAway();
|
|
189
|
+
}
|
|
190
|
+
}}
|
|
191
|
+
size={menu.size || size}
|
|
192
|
+
onTabOut={clickAway}
|
|
193
|
+
/>
|
|
194
|
+
</div>
|
|
220
195
|
)}
|
|
221
196
|
</div>
|
|
222
197
|
)}
|
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
@value (
|
|
2
|
-
sizeFluid
|
|
3
|
-
) from '../../styles/variables/_size.css';
|
|
1
|
+
@value ( sizeFluid) from '../../styles/variables/_size.css';
|
|
4
2
|
|
|
5
3
|
.buttonDropdownContainer {
|
|
6
4
|
display: flex;
|
|
@@ -10,8 +8,3 @@
|
|
|
10
8
|
.isFluid {
|
|
11
9
|
width: sizeFluid;
|
|
12
10
|
}
|
|
13
|
-
|
|
14
|
-
.menuWrapper {
|
|
15
|
-
width: var(--dropdown-width);
|
|
16
|
-
z-index: var(--menu-elevation);
|
|
17
|
-
}
|
|
@@ -32,7 +32,6 @@ const SimpleButtonDropdownBase = (props, ref) => {
|
|
|
32
32
|
showLabelTooltip,
|
|
33
33
|
allowWrap = false,
|
|
34
34
|
clickAwayRef,
|
|
35
|
-
elevation = 'modal',
|
|
36
35
|
...buttonProps
|
|
37
36
|
} = props;
|
|
38
37
|
const [btnText, setBtnText] = React.useState('');
|
|
@@ -66,11 +65,9 @@ const SimpleButtonDropdownBase = (props, ref) => {
|
|
|
66
65
|
size: size,
|
|
67
66
|
onOptionSelect: handleOptionChange,
|
|
68
67
|
onMenuOpen: onMenuOpen,
|
|
69
|
-
elevation: elevation,
|
|
70
68
|
onMenuClose: onMenuClose,
|
|
71
69
|
clickAwayRef: clickAwayRef,
|
|
72
70
|
menu: {
|
|
73
|
-
// TODO (Sharad): The isFluid prop here controls menu width unlike ButtonDropdown, and is independent from the isFluid prop in ButtonDropdown. There should be a way to set the isFluid prop of ButtonDropdown.
|
|
74
71
|
isFluid,
|
|
75
72
|
options,
|
|
76
73
|
selectedKeys: buttonDropdownSelectedKeys,
|
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
} from '../../utils/menu';
|
|
11
11
|
import type {ButtonProps} from '../Button';
|
|
12
12
|
import type {MenuOption, MenuOptionsVariant, Virtualization} from '../Menu';
|
|
13
|
-
import type {BaseTooltipProps
|
|
13
|
+
import type {BaseTooltipProps} from '../Tooltip';
|
|
14
14
|
|
|
15
15
|
import type {AnchorType} from './ButtonDropdown';
|
|
16
16
|
import {ButtonDropdown} from './ButtonDropdown';
|
|
@@ -30,7 +30,6 @@ export type SimpleButtonDropdownProps = {
|
|
|
30
30
|
// Input props
|
|
31
31
|
...ButtonProps,
|
|
32
32
|
|
|
33
|
-
elevation?: ElevationType,
|
|
34
33
|
classNames?: ClassNames,
|
|
35
34
|
anchorPosition?: AnchorType,
|
|
36
35
|
tooltip?: BaseTooltipProps,
|
|
@@ -46,7 +45,6 @@ export type SimpleButtonDropdownProps = {
|
|
|
46
45
|
menuClassNames?: MenuClassNames,
|
|
47
46
|
showLabelTooltip?: MenuLabelTooltip,
|
|
48
47
|
allowWrap?: boolean,
|
|
49
|
-
|
|
50
48
|
// events
|
|
51
49
|
onOptionSelect?: (option: MenuOption, ?SyntheticEvent<HTMLElement>) => mixed,
|
|
52
50
|
onMenuOpen?: () => mixed,
|
|
@@ -82,7 +80,6 @@ const SimpleButtonDropdownBase = (props: SimpleButtonDropdownProps, ref) => {
|
|
|
82
80
|
showLabelTooltip,
|
|
83
81
|
allowWrap = false,
|
|
84
82
|
clickAwayRef,
|
|
85
|
-
elevation = 'modal',
|
|
86
83
|
...buttonProps
|
|
87
84
|
} = props;
|
|
88
85
|
|
|
@@ -135,11 +132,9 @@ const SimpleButtonDropdownBase = (props: SimpleButtonDropdownProps, ref) => {
|
|
|
135
132
|
size={size}
|
|
136
133
|
onOptionSelect={handleOptionChange}
|
|
137
134
|
onMenuOpen={onMenuOpen}
|
|
138
|
-
elevation={elevation}
|
|
139
135
|
onMenuClose={onMenuClose}
|
|
140
136
|
clickAwayRef={clickAwayRef}
|
|
141
137
|
menu={{
|
|
142
|
-
// TODO (Sharad): The isFluid prop here controls menu width unlike ButtonDropdown, and is independent from the isFluid prop in ButtonDropdown. There should be a way to set the isFluid prop of ButtonDropdown.
|
|
143
138
|
isFluid,
|
|
144
139
|
options,
|
|
145
140
|
selectedKeys: buttonDropdownSelectedKeys,
|
|
@@ -12,7 +12,6 @@ var _classify = _interopRequireDefault(require("../../utils/classify"));
|
|
|
12
12
|
var _clickAway = require("../../utils/click-away");
|
|
13
13
|
var _mergeRefs = require("../../utils/merge-refs");
|
|
14
14
|
var _Menu = require("../Menu");
|
|
15
|
-
var _Tooltip = require("../Tooltip");
|
|
16
15
|
var _ButtonTab = require("./ButtonTab");
|
|
17
16
|
var _ButtonTabDropdownModule = _interopRequireDefault(require("./ButtonTabDropdown.module.css"));
|
|
18
17
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
@@ -21,10 +20,10 @@ function _extends() { return _extends = Object.assign ? Object.assign.bind() : f
|
|
|
21
20
|
const ButtonTabDropdown = _ref => {
|
|
22
21
|
let {
|
|
23
22
|
title,
|
|
24
|
-
elevation = 'modal',
|
|
25
23
|
anchorPosition = 'bottom-end',
|
|
26
24
|
...buttonTabProps
|
|
27
25
|
} = _ref;
|
|
26
|
+
const menuBtnRef = React.useRef();
|
|
28
27
|
const {
|
|
29
28
|
size,
|
|
30
29
|
children,
|
|
@@ -64,8 +63,7 @@ const ButtonTabDropdown = _ref => {
|
|
|
64
63
|
x,
|
|
65
64
|
y,
|
|
66
65
|
refs,
|
|
67
|
-
strategy
|
|
68
|
-
context
|
|
66
|
+
strategy
|
|
69
67
|
} = (0, _react2.useFloating)({
|
|
70
68
|
open: true,
|
|
71
69
|
strategy: 'absolute',
|
|
@@ -83,6 +81,7 @@ const ButtonTabDropdown = _ref => {
|
|
|
83
81
|
} = _ref3;
|
|
84
82
|
return /*#__PURE__*/React.createElement("div", {
|
|
85
83
|
"data-testid": "ButtonTabDropdown",
|
|
84
|
+
ref: menuBtnRef,
|
|
86
85
|
className: (0, _classify.default)(_ButtonTabDropdownModule.default.buttonTabDropDownWrapper, dropdownClass)
|
|
87
86
|
}, /*#__PURE__*/React.createElement(_ButtonTab.ButtonTab, _extends({}, buttonTabProps, {
|
|
88
87
|
ref: (0, _mergeRefs.mergeRefs)([refs.setReference, triggerRef]),
|
|
@@ -91,19 +90,13 @@ const ButtonTabDropdown = _ref => {
|
|
|
91
90
|
e?.stopPropagation();
|
|
92
91
|
onOpen();
|
|
93
92
|
}
|
|
94
|
-
}), title), isOpen && /*#__PURE__*/React.createElement(
|
|
95
|
-
modal: false,
|
|
96
|
-
context: context,
|
|
97
|
-
initialFocus: refs.reference
|
|
98
|
-
}, /*#__PURE__*/React.createElement("div", {
|
|
99
|
-
className: _ButtonTabDropdownModule.default.menuWrapper,
|
|
93
|
+
}), title), isOpen && /*#__PURE__*/React.createElement("div", {
|
|
100
94
|
ref: (0, _mergeRefs.mergeRefs)([refs.setFloating, boundaryRef]),
|
|
101
95
|
style: {
|
|
102
96
|
display: 'flex',
|
|
103
97
|
position: strategy,
|
|
104
98
|
top: y ?? _space.spaceNone,
|
|
105
|
-
left: x ?? _space.spaceNone
|
|
106
|
-
'--menu-elevation': (0, _Tooltip.getElevationValue)(elevation)
|
|
99
|
+
left: x ?? _space.spaceNone
|
|
107
100
|
}
|
|
108
101
|
}, /*#__PURE__*/React.createElement(_Menu.Menu, {
|
|
109
102
|
onSelect: (option, e) => {
|
|
@@ -114,7 +107,7 @@ const ButtonTabDropdown = _ref => {
|
|
|
114
107
|
options: menuOptions,
|
|
115
108
|
onTabOut: clickAway,
|
|
116
109
|
selectedKeys: [selectedButtonTabId ?? '']
|
|
117
|
-
})))
|
|
110
|
+
})));
|
|
118
111
|
});
|
|
119
112
|
};
|
|
120
113
|
exports.ButtonTabDropdown = ButtonTabDropdown;
|
|
@@ -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 {ClickAway} from '../../utils/click-away';
|
|
|
25
21
|
import {mergeRefs} from '../../utils/merge-refs';
|
|
26
22
|
import type {AnchorType} from '../ButtonDropdown';
|
|
27
23
|
import {Menu} from '../Menu';
|
|
28
|
-
import type {ElevationType} from '../Tooltip';
|
|
29
|
-
import {getElevationValue} from '../Tooltip';
|
|
30
24
|
|
|
31
25
|
import type {ButtonTabProps} from './ButtonTab';
|
|
32
26
|
import {ButtonTab} from './ButtonTab';
|
|
@@ -37,18 +31,17 @@ import css from './ButtonTabDropdown.module.css';
|
|
|
37
31
|
export type ButtonTabDropdownProps = {
|
|
38
32
|
...ButtonTabProps,
|
|
39
33
|
title: string,
|
|
40
|
-
elevation?: ElevationType,
|
|
41
|
-
dropdownClass?: string,
|
|
42
34
|
anchorPosition?: AnchorType,
|
|
35
|
+
dropdownClass?: string,
|
|
43
36
|
...
|
|
44
37
|
};
|
|
45
38
|
|
|
46
39
|
export const ButtonTabDropdown = ({
|
|
47
40
|
title,
|
|
48
|
-
elevation = 'modal',
|
|
49
41
|
anchorPosition = 'bottom-end',
|
|
50
42
|
...buttonTabProps
|
|
51
43
|
}: ButtonTabDropdownProps): React.Node => {
|
|
44
|
+
const menuBtnRef = React.useRef();
|
|
52
45
|
const {
|
|
53
46
|
size,
|
|
54
47
|
children,
|
|
@@ -85,7 +78,7 @@ export const ButtonTabDropdown = ({
|
|
|
85
78
|
? 'more-tab'
|
|
86
79
|
: selectedButtonTabId;
|
|
87
80
|
|
|
88
|
-
const {x, y, refs, strategy
|
|
81
|
+
const {x, y, refs, strategy} = useFloating({
|
|
89
82
|
open: true,
|
|
90
83
|
strategy: 'absolute',
|
|
91
84
|
placement: anchorPosition,
|
|
@@ -98,6 +91,7 @@ export const ButtonTabDropdown = ({
|
|
|
98
91
|
{({isOpen, onOpen, clickAway, boundaryRef, triggerRef}) => (
|
|
99
92
|
<div
|
|
100
93
|
data-testid="ButtonTabDropdown"
|
|
94
|
+
ref={menuBtnRef}
|
|
101
95
|
className={classify(css.buttonTabDropDownWrapper, dropdownClass)}
|
|
102
96
|
>
|
|
103
97
|
<ButtonTab
|
|
@@ -112,36 +106,26 @@ export const ButtonTabDropdown = ({
|
|
|
112
106
|
{title}
|
|
113
107
|
</ButtonTab>
|
|
114
108
|
{isOpen && (
|
|
115
|
-
<
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
clickAway();
|
|
136
|
-
}}
|
|
137
|
-
size={size}
|
|
138
|
-
options={menuOptions}
|
|
139
|
-
onTabOut={clickAway}
|
|
140
|
-
selectedKeys={[selectedButtonTabId ?? '']}
|
|
141
|
-
/>
|
|
142
|
-
</div>
|
|
143
|
-
</FloatingFocusManager>
|
|
144
|
-
</FloatingPortal>
|
|
109
|
+
<div
|
|
110
|
+
ref={mergeRefs([refs.setFloating, boundaryRef])}
|
|
111
|
+
style={{
|
|
112
|
+
display: 'flex',
|
|
113
|
+
position: strategy,
|
|
114
|
+
top: y ?? spaceNone,
|
|
115
|
+
left: x ?? spaceNone,
|
|
116
|
+
}}
|
|
117
|
+
>
|
|
118
|
+
<Menu
|
|
119
|
+
onSelect={(option, e) => {
|
|
120
|
+
onTabSelect && onTabSelect(option.key, e);
|
|
121
|
+
clickAway();
|
|
122
|
+
}}
|
|
123
|
+
size={size}
|
|
124
|
+
options={menuOptions}
|
|
125
|
+
onTabOut={clickAway}
|
|
126
|
+
selectedKeys={[selectedButtonTabId ?? '']}
|
|
127
|
+
/>
|
|
128
|
+
</div>
|
|
145
129
|
)}
|
|
146
130
|
</div>
|
|
147
131
|
)}
|
|
@@ -20,7 +20,6 @@ const ButtonTabs = exports.ButtonTabs = /*#__PURE__*/React.forwardRef((_ref, ref
|
|
|
20
20
|
selectedButtonTabId,
|
|
21
21
|
onButtonTabSelect,
|
|
22
22
|
wrapAfter,
|
|
23
|
-
elevation = 'modal',
|
|
24
23
|
wrapTabTitle = 'more',
|
|
25
24
|
anchorPosition
|
|
26
25
|
} = _ref;
|
|
@@ -35,7 +34,6 @@ const ButtonTabs = exports.ButtonTabs = /*#__PURE__*/React.forwardRef((_ref, ref
|
|
|
35
34
|
id: "more-tab",
|
|
36
35
|
title: wrapTabTitle,
|
|
37
36
|
iconName: "ellipsis-vertical",
|
|
38
|
-
elevation: elevation,
|
|
39
37
|
anchorPosition: anchorPosition,
|
|
40
38
|
dropdownClass: classNames?.buttonTabDropdownWrapper
|
|
41
39
|
}, wrappedNodes));
|
|
@@ -4,7 +4,6 @@ import * as React from 'react';
|
|
|
4
4
|
|
|
5
5
|
import classify from '../../utils/classify';
|
|
6
6
|
import type {AnchorType} from '../ButtonDropdown';
|
|
7
|
-
import type {ElevationType} from '../Tooltip';
|
|
8
7
|
|
|
9
8
|
import {ButtonTabDropdown} from './ButtonTabDropdown';
|
|
10
9
|
|
|
@@ -25,7 +24,6 @@ export type ButtonTabsProps = {
|
|
|
25
24
|
selectedButtonTabId?: string,
|
|
26
25
|
onButtonTabSelect?: ?(id: string, e?: ?SyntheticEvent<HTMLElement>) => mixed,
|
|
27
26
|
wrapAfter?: number,
|
|
28
|
-
elevation?: ElevationType,
|
|
29
27
|
wrapTabTitle?: string,
|
|
30
28
|
anchorPosition?: AnchorType,
|
|
31
29
|
};
|
|
@@ -44,7 +42,6 @@ export const ButtonTabs: React$AbstractComponent<
|
|
|
44
42
|
selectedButtonTabId,
|
|
45
43
|
onButtonTabSelect,
|
|
46
44
|
wrapAfter,
|
|
47
|
-
elevation = 'modal',
|
|
48
45
|
wrapTabTitle = 'more',
|
|
49
46
|
anchorPosition,
|
|
50
47
|
}: ButtonTabsProps,
|
|
@@ -65,7 +62,6 @@ export const ButtonTabs: React$AbstractComponent<
|
|
|
65
62
|
id="more-tab"
|
|
66
63
|
title={wrapTabTitle}
|
|
67
64
|
iconName="ellipsis-vertical"
|
|
68
|
-
elevation={elevation}
|
|
69
65
|
anchorPosition={anchorPosition}
|
|
70
66
|
dropdownClass={classNames?.buttonTabDropdownWrapper}
|
|
71
67
|
>
|
|
@@ -24,7 +24,9 @@ const DateRangePicker = exports.DateRangePicker = /*#__PURE__*/React.forwardRef(
|
|
|
24
24
|
onCancel,
|
|
25
25
|
classNames,
|
|
26
26
|
hideTimezone = false,
|
|
27
|
-
selectedDateRange = {}
|
|
27
|
+
selectedDateRange = {},
|
|
28
|
+
startDateLabel,
|
|
29
|
+
endDateLabel
|
|
28
30
|
} = _ref;
|
|
29
31
|
const localTimezone = _momentTimezone.default.tz.guess();
|
|
30
32
|
const {
|
|
@@ -128,6 +130,8 @@ const DateRangePicker = exports.DateRangePicker = /*#__PURE__*/React.forwardRef(
|
|
|
128
130
|
setRangeEndMonth: setRangeEndMonthValidated,
|
|
129
131
|
hideTimezone: hideTimezone,
|
|
130
132
|
cardWrapperClass: (0, _classify.default)(_DateRangePickerModule.default.container, classNames?.wrapper),
|
|
131
|
-
today: today
|
|
133
|
+
today: today,
|
|
134
|
+
startDateLabel: startDateLabel,
|
|
135
|
+
endDateLabel: endDateLabel
|
|
132
136
|
});
|
|
133
137
|
});
|
|
@@ -45,6 +45,8 @@ export type DateRangePickerProps = {
|
|
|
45
45
|
hideTimezone?: boolean,
|
|
46
46
|
minDate?: string,
|
|
47
47
|
maxDate?: string,
|
|
48
|
+
startDateLabel?: string,
|
|
49
|
+
endDateLabel?: string,
|
|
48
50
|
};
|
|
49
51
|
|
|
50
52
|
export const DateRangePicker: React$AbstractComponent<
|
|
@@ -61,6 +63,8 @@ export const DateRangePicker: React$AbstractComponent<
|
|
|
61
63
|
classNames,
|
|
62
64
|
hideTimezone = false,
|
|
63
65
|
selectedDateRange = {},
|
|
66
|
+
startDateLabel,
|
|
67
|
+
endDateLabel,
|
|
64
68
|
}: DateRangePickerProps,
|
|
65
69
|
ref,
|
|
66
70
|
): React.Node => {
|
|
@@ -195,6 +199,8 @@ export const DateRangePicker: React$AbstractComponent<
|
|
|
195
199
|
hideTimezone={hideTimezone}
|
|
196
200
|
cardWrapperClass={classify(css.container, classNames?.wrapper)}
|
|
197
201
|
today={today}
|
|
202
|
+
startDateLabel={startDateLabel}
|
|
203
|
+
endDateLabel={endDateLabel}
|
|
198
204
|
/>
|
|
199
205
|
);
|
|
200
206
|
},
|