@ringcentral/juno 2.32.0 → 2.34.0
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/components/Badge/Badge.js +1 -2
- package/components/Badge/styles/BadgeStyle.d.ts +3 -0
- package/components/Badge/styles/BadgeStyle.js +2 -1
- package/components/Presence/Presence.d.ts +11 -1
- package/components/Presence/Presence.js +22 -8
- package/components/Presence/assets/Check.d.ts +3 -0
- package/components/Presence/assets/Check.js +9 -0
- package/components/Presence/assets/Default.d.ts +3 -0
- package/components/Presence/assets/Default.js +9 -0
- package/components/Presence/assets/Dnd.d.ts +3 -0
- package/components/Presence/assets/Dnd.js +9 -0
- package/components/Presence/assets/Offline.d.ts +3 -0
- package/components/Presence/assets/Offline.js +9 -0
- package/components/Presence/assets/Unattended.js +1 -1
- package/components/Presence/assets/index.d.ts +4 -1
- package/components/Presence/assets/index.js +8 -2
- package/components/Presence/styles/StyledPresence.d.ts +5 -18
- package/components/Presence/styles/StyledPresence.js +18 -12
- package/components/Presence/styles/index.d.ts +0 -1
- package/components/Presence/styles/index.js +0 -1
- package/components/Presence/utils/RcPresenceUtils.d.ts +1 -2
- package/components/Presence/utils/RcPresenceUtils.js +18 -23
- package/components/Tabs/TabList/TabList.js +8 -6
- package/components/Tabs/Tabs/MoreMenuTab/MoreMenuTab.d.ts +1 -1
- package/components/Tabs/Tabs/MoreMenuTab/MoreMenuTab.js +18 -9
- package/components/Tabs/Tabs/MoreMenuTabs/MoreMenuTabSentinel.d.ts +7 -0
- package/components/Tabs/Tabs/MoreMenuTabs/MoreMenuTabSentinel.js +9 -0
- package/components/Tabs/Tabs/MoreMenuTabs/MoreMenuTabs.d.ts +0 -1
- package/components/Tabs/Tabs/MoreMenuTabs/MoreMenuTabs.js +277 -197
- package/components/Tabs/Tabs/MoreMenuTabs/utils/MoreMenuTabsUtils.d.ts +3 -34
- package/components/Tabs/Tabs/MoreMenuTabs/utils/MoreMenuTabsUtils.js +0 -87
- package/components/Tabs/Tabs/MoreMenuTabs/utils/index.js +0 -2
- package/es6/components/Badge/Badge.js +2 -3
- package/es6/components/Badge/styles/BadgeStyle.js +3 -2
- package/es6/components/Presence/Presence.js +26 -12
- package/es6/components/Presence/assets/Check.js +7 -0
- package/es6/components/Presence/assets/Default.js +7 -0
- package/es6/components/Presence/assets/Dnd.js +7 -0
- package/es6/components/Presence/assets/Offline.js +7 -0
- package/es6/components/Presence/assets/Unattended.js +1 -1
- package/es6/components/Presence/assets/index.js +4 -1
- package/es6/components/Presence/styles/StyledPresence.js +20 -14
- package/es6/components/Presence/styles/index.js +0 -1
- package/es6/components/Presence/utils/RcPresenceUtils.js +18 -23
- package/es6/components/Tabs/TabList/TabList.js +8 -6
- package/es6/components/Tabs/Tabs/MoreMenuTab/MoreMenuTab.js +18 -9
- package/es6/components/Tabs/Tabs/MoreMenuTabs/MoreMenuTabSentinel.js +6 -0
- package/es6/components/Tabs/Tabs/MoreMenuTabs/MoreMenuTabs.js +279 -199
- package/es6/components/Tabs/Tabs/MoreMenuTabs/utils/MoreMenuTabsUtils.js +0 -87
- package/es6/components/Tabs/Tabs/MoreMenuTabs/utils/index.js +0 -1
- package/es6/foundation/hooks/useDebounce/useDebounce.js +3 -2
- package/es6/foundation/hooks/useOnReRender/useOnReRender.js +6 -3
- package/es6/foundation/hooks/useThrottle/useThrottle.js +4 -3
- package/foundation/hooks/useDebounce/useDebounce.d.ts +3 -2
- package/foundation/hooks/useDebounce/useDebounce.js +3 -2
- package/foundation/hooks/useOnReRender/useOnReRender.d.ts +1 -1
- package/foundation/hooks/useOnReRender/useOnReRender.js +5 -2
- package/foundation/hooks/useThrottle/useThrottle.d.ts +3 -2
- package/foundation/hooks/useThrottle/useThrottle.js +4 -3
- package/package.json +1 -1
- package/components/Presence/assets/Attended.d.ts +0 -3
- package/components/Presence/assets/Attended.js +0 -9
- package/components/Presence/styles/StyledDND.d.ts +0 -13
- package/components/Presence/styles/StyledDND.js +0 -12
- package/es6/components/Presence/assets/Attended.js +0 -7
- package/es6/components/Presence/styles/StyledDND.js +0 -10
|
@@ -5,8 +5,7 @@ import MuiBadge from '@material-ui/core/Badge';
|
|
|
5
5
|
import { capitalize } from '@material-ui/core/utils';
|
|
6
6
|
import { combineClasses, combineProps, logInDev, styled, useChange, useForkRef, useThemeProps, } from '../../foundation';
|
|
7
7
|
import { RcBox } from '../Box';
|
|
8
|
-
import {
|
|
9
|
-
import { BadgeStyle } from './styles';
|
|
8
|
+
import { BadgeStyle, DefaultDotComponent } from './styles';
|
|
10
9
|
import { RcBadgeClasses, useRoundBadgeOffset } from './utils';
|
|
11
10
|
var _RcBadge = forwardRef(function (inProps, ref) {
|
|
12
11
|
var props = useThemeProps({ props: inProps, name: 'RcBadge' });
|
|
@@ -41,7 +40,7 @@ var _RcBadge = forwardRef(function (inProps, ref) {
|
|
|
41
40
|
var OmitChildren = _a.children, rest = __rest(_a, ["children"]);
|
|
42
41
|
var _b = anchorOrigin, horizontal = _b.horizontal, vertical = _b.vertical;
|
|
43
42
|
var addClassName = "MuiBadge-anchorOrigin" + capitalize(vertical) + capitalize(horizontal) + capitalize(overlap);
|
|
44
|
-
var DotComponent = dotComponent !== null && dotComponent !== void 0 ? dotComponent :
|
|
43
|
+
var DotComponent = dotComponent !== null && dotComponent !== void 0 ? dotComponent : DefaultDotComponent;
|
|
45
44
|
var applyDotProps = combineProps({ className: clsx(addClassName, RcBadgeClasses.badge) }, dotProps);
|
|
46
45
|
return (React.createElement("div", __assign({}, rest, { ref: ref }),
|
|
47
46
|
children,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { __makeTemplateObject } from "tslib";
|
|
2
|
-
import { css, fakeBorder, getParsePaletteColor, } from '../../../foundation';
|
|
2
|
+
import { css, fakeBorder, getParsePaletteColor, palette2, styled, } from '../../../foundation';
|
|
3
3
|
import { RcBadgeClasses, roundBadgeMarginKey } from '../utils';
|
|
4
4
|
export var BadgeStyle = function (_a) {
|
|
5
5
|
var badgeContent = _a.badgeContent, overlap = _a.overlap, variant = _a.variant, textColor = _a.textColor, borderColor = _a.borderColor, max = _a.max, color = _a.color;
|
|
@@ -19,4 +19,5 @@ export var BadgeStyle = function (_a) {
|
|
|
19
19
|
? fakeBorder({ color: borderCurrColor, radius: 'round' })
|
|
20
20
|
: css(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n border-color: ", ";\n "], ["\n border-color: ", ";\n "])), borderCurrColor)), isStandard && css(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n height: 18px;\n min-width: 18px;\n padding: ", ";\n "], ["\n height: 18px;\n min-width: 18px;\n padding: ", ";\n "])), !manyChar && 0), overlapNone && css(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n position: unset;\n transform: unset;\n\n &.", " {\n transform: scale(0);\n }\n "], ["\n position: unset;\n transform: unset;\n\n &.", " {\n transform: scale(0);\n }\n "])), RcBadgeClasses.invisible));
|
|
21
21
|
};
|
|
22
|
-
var
|
|
22
|
+
export var DefaultDotComponent = styled.div(templateObject_6 || (templateObject_6 = __makeTemplateObject(["\n border-radius: 50%;\n width: 8px;\n height: 8px;\n border: 2px solid ", ";\n"], ["\n border-radius: 50%;\n width: 8px;\n height: 8px;\n border: 2px solid ", ";\n"])), palette2('neutral', 'l01'));
|
|
23
|
+
var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5, templateObject_6;
|
|
@@ -1,25 +1,39 @@
|
|
|
1
|
-
import { __assign, __makeTemplateObject } from "tslib";
|
|
2
|
-
import React, { forwardRef
|
|
1
|
+
import { __assign, __makeTemplateObject, __rest } from "tslib";
|
|
2
|
+
import React, { forwardRef } from 'react';
|
|
3
3
|
import { styled, useThemeProps, } from '../../foundation';
|
|
4
4
|
import { RcIcon } from '../Icon';
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
5
|
+
import { Unattended, Dnd, Check, Offline, Default } from './assets';
|
|
6
|
+
import { StyledPresence, PresenceContainer } from './styles';
|
|
7
|
+
import { RcPresenceColors, RcPresenceSizes } from './utils';
|
|
7
8
|
var _RcPresence = forwardRef(function (inProps, ref) {
|
|
8
9
|
var props = useThemeProps({ props: inProps, name: 'RcPresence' });
|
|
9
|
-
var type = props.type, size = props.size;
|
|
10
|
-
var
|
|
10
|
+
var type = props.type, color = props.color, size = props.size, borderSize = props.borderSize, rest = __rest(props, ["type", "color", "size", "borderSize"]);
|
|
11
|
+
var sizeProps = {
|
|
12
|
+
iconSizeValue: RcPresenceSizes[size][0],
|
|
13
|
+
borderSizeValue: RcPresenceSizes[borderSize || size][1],
|
|
14
|
+
borderSize: borderSize,
|
|
15
|
+
type: type,
|
|
16
|
+
};
|
|
17
|
+
var symbol = (function () {
|
|
11
18
|
switch (type) {
|
|
12
19
|
case 'DND':
|
|
13
|
-
return
|
|
20
|
+
return Dnd;
|
|
21
|
+
case 'available':
|
|
14
22
|
case 'attended':
|
|
15
|
-
return
|
|
23
|
+
return Check;
|
|
16
24
|
case 'unAttended':
|
|
17
|
-
return
|
|
25
|
+
return Unattended;
|
|
26
|
+
case 'offline':
|
|
27
|
+
case 'unavailable':
|
|
28
|
+
case 'notReady':
|
|
29
|
+
return Offline;
|
|
18
30
|
default:
|
|
19
|
-
return
|
|
31
|
+
return Default;
|
|
20
32
|
}
|
|
21
|
-
}
|
|
22
|
-
return (React.createElement(
|
|
33
|
+
})();
|
|
34
|
+
return (React.createElement(PresenceContainer, __assign({ ref: ref }, sizeProps, rest),
|
|
35
|
+
React.createElement(StyledPresence, __assign({}, sizeProps, { color: color }),
|
|
36
|
+
React.createElement(RcIcon, { symbol: symbol, color: color || RcPresenceColors[type], size: "inherit" }))));
|
|
23
37
|
});
|
|
24
38
|
/** @release */
|
|
25
39
|
var RcPresence = styled(_RcPresence)(templateObject_1 || (templateObject_1 = __makeTemplateObject([""], [""])));
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { __assign } from "tslib";
|
|
2
|
+
import React, { forwardRef, memo } from 'react';
|
|
3
|
+
var Check = memo(forwardRef(function (props, svgRef) { return (React.createElement("svg", __assign({ xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 32 32", ref: svgRef }, props),
|
|
4
|
+
React.createElement("path", { id: "Shape", d: "M16,0A16,16,0,1,0,32,16,16,16,0,0,0,16,0Zm8.62,10.38L17.51,23.72A2.19,2.19,0,0,1,16,24.89h-.41a2.17,2.17,0,0,1-1.37-.53L8,19a2.22,2.22,0,0,1,2.38-3.7,1.76,1.76,0,0,1,.39.32L14.9,19.2,20.71,8.3a2.21,2.21,0,0,1,2.95-1.06,2.15,2.15,0,0,1,1.15,1.25,2.23,2.23,0,0,1-.08,1.7l-.11.21Z" }))); }));
|
|
5
|
+
Check.displayName = 'Check';
|
|
6
|
+
Check['iconName'] = 'check';
|
|
7
|
+
export default Check;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { __assign } from "tslib";
|
|
2
|
+
import React, { forwardRef, memo } from 'react';
|
|
3
|
+
var Default = memo(forwardRef(function (props, svgRef) { return (React.createElement("svg", __assign({ xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 32 32", ref: svgRef }, props),
|
|
4
|
+
React.createElement("circle", { cx: "16", cy: "16", r: "16" }))); }));
|
|
5
|
+
Default.displayName = 'Default';
|
|
6
|
+
Default['iconName'] = 'default';
|
|
7
|
+
export default Default;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { __assign } from "tslib";
|
|
2
|
+
import React, { forwardRef, memo } from 'react';
|
|
3
|
+
var Dnd = memo(forwardRef(function (props, svgRef) { return (React.createElement("svg", __assign({ xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 32 32", ref: svgRef }, props),
|
|
4
|
+
React.createElement("path", { d: "M16,0A16,16,0,1,0,32,16,16,16,0,0,0,16,0Zm8.44,18.22H7.56a2.22,2.22,0,1,1,0-4.44H24.44a2.22,2.22,0,1,1,0,4.44Z" }))); }));
|
|
5
|
+
Dnd.displayName = 'Dnd';
|
|
6
|
+
Dnd['iconName'] = 'dnd';
|
|
7
|
+
export default Dnd;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { __assign } from "tslib";
|
|
2
|
+
import React, { forwardRef, memo } from 'react';
|
|
3
|
+
var Offline = memo(forwardRef(function (props, svgRef) { return (React.createElement("svg", __assign({ viewBox: "0 0 32 32", ref: svgRef }, props),
|
|
4
|
+
React.createElement("path", { d: "M16,0A16,16,0,1,0,32,16,16,16,0,0,0,16,0Zm0,27.2A11.2,11.2,0,1,1,27.2,16,11.19,11.19,0,0,1,16,27.2Z" }))); }));
|
|
5
|
+
Offline.displayName = 'Offline';
|
|
6
|
+
Offline['iconName'] = 'offline';
|
|
7
|
+
export default Offline;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { __assign } from "tslib";
|
|
2
2
|
import React, { forwardRef, memo } from 'react';
|
|
3
3
|
var Unattended = memo(forwardRef(function (props, svgRef) { return (React.createElement("svg", __assign({ xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 32 32", ref: svgRef }, props),
|
|
4
|
-
React.createElement("path", { d: "
|
|
4
|
+
React.createElement("path", { d: "M16,0A16,16,0,1,0,32,16,16,16,0,0,0,16,0Zm7.54,20.39a2.23,2.23,0,0,1-3.15,3.15h0L16,19.15l-4.39,4.39a2.23,2.23,0,0,1-3.15-3.15h0L12.85,16,8.46,11.61a2.23,2.23,0,0,1,3.15-3.15L16,12.85l4.39-4.39a2.23,2.23,0,0,1,3.15,3.15h0L19.15,16Z" }))); }));
|
|
5
5
|
Unattended.displayName = 'Unattended';
|
|
6
6
|
Unattended['iconName'] = 'unattended';
|
|
7
7
|
export default Unattended;
|
|
@@ -1,2 +1,5 @@
|
|
|
1
|
-
export { default as Attended } from './Attended';
|
|
2
1
|
export { default as Unattended } from './Unattended';
|
|
2
|
+
export { default as Check } from './Check';
|
|
3
|
+
export { default as Default } from './Default';
|
|
4
|
+
export { default as Offline } from './Offline';
|
|
5
|
+
export { default as Dnd } from './Dnd';
|
|
@@ -1,22 +1,28 @@
|
|
|
1
1
|
import { __assign, __makeTemplateObject, __rest } from "tslib";
|
|
2
2
|
import React, { forwardRef } from 'react';
|
|
3
|
-
import { css, getParsePaletteColor, palette2,
|
|
3
|
+
import { css, getParsePaletteColor, palette2, styled, fakeBorder, } from '../../../foundation';
|
|
4
4
|
import { RcIcon } from '../../Icon';
|
|
5
|
-
import {
|
|
5
|
+
import { RcPresenceBackgroundColors } from '../utils';
|
|
6
|
+
export var PresenceContainer = styled.div(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n ", "\n"], ["\n ",
|
|
7
|
+
"\n"])), function (_a) {
|
|
8
|
+
var iconSizeValue = _a.iconSizeValue, borderSizeValue = _a.borderSizeValue;
|
|
9
|
+
return css(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n display: flex;\n justify-content: center;\n width: ", "px;\n height: ", "px;\n padding: ", "px;\n "], ["\n display: flex;\n justify-content: center;\n width: ", "px;\n height: ", "px;\n padding: ", "px;\n "])), iconSizeValue, iconSizeValue, borderSizeValue);
|
|
10
|
+
});
|
|
6
11
|
export var _StyledPresence = forwardRef(function (_a, ref) {
|
|
7
|
-
var color = _a.color,
|
|
8
|
-
return
|
|
12
|
+
var color = _a.color, type = _a.type, rest = __rest(_a, ["color", "type"]);
|
|
13
|
+
return React.createElement("div", __assign({ ref: ref }, rest));
|
|
9
14
|
});
|
|
10
|
-
export var StyledPresence = styled(_StyledPresence)(
|
|
15
|
+
export var StyledPresence = styled(_StyledPresence)(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n display: flex;\n flex-shrink: 0;\n justify-content: center;\n align-items: center;\n border-radius: 50%;\n box-sizing: content-box;\n\n ", ";\n"], ["\n display: flex;\n flex-shrink: 0;\n justify-content: center;\n align-items: center;\n border-radius: 50%;\n box-sizing: content-box;\n\n ",
|
|
11
16
|
";\n"])), function (_a) {
|
|
12
|
-
var
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
var scaleRate = availableSize[1];
|
|
17
|
-
return css(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n width: ", ";\n height: ", ";\n border: ", "px solid\n ", ";\n background: ", ";\n\n ", " {\n transform: ", ";\n\n svg {\n width: ", ";\n height: ", ";\n }\n }\n "], ["\n width: ", ";\n height: ", ";\n border: ", "px solid\n ", ";\n background: ",
|
|
18
|
-
";\n\n ", " {\n transform: ", ";\n\n svg {\n width: ", ";\n height: ", ";\n }\n }\n "])), sizeValue, sizeValue, RcPresenceSizes[borderSize || size][1], palette2('neutral', 'l01'), color
|
|
17
|
+
var type = _a.type, iconSizeValue = _a.iconSizeValue, borderSizeValue = _a.borderSizeValue, color = _a.color;
|
|
18
|
+
return css(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n width: ", "px;\n height: ", "px;\n background: ", ";\n ", ";\n ", " {\n svg {\n width: ", "px;\n height: ", "px;\n }\n }\n "], ["\n width: ", "px;\n height: ", "px;\n background: ",
|
|
19
|
+
";\n ",
|
|
20
|
+
";\n ", " {\n svg {\n width: ", "px;\n height: ", "px;\n }\n }\n "])), iconSizeValue, iconSizeValue, color
|
|
19
21
|
? getParsePaletteColor(color)
|
|
20
|
-
:
|
|
22
|
+
: RcPresenceBackgroundColors[type] || palette2('neutral', 'l01'), fakeBorder({
|
|
23
|
+
inset: false,
|
|
24
|
+
color: palette2('neutral', 'l01'),
|
|
25
|
+
size: borderSizeValue,
|
|
26
|
+
}), RcIcon, iconSizeValue, iconSizeValue);
|
|
21
27
|
});
|
|
22
|
-
var templateObject_1, templateObject_2;
|
|
28
|
+
var templateObject_1, templateObject_2, templateObject_3, templateObject_4;
|
|
@@ -2,30 +2,11 @@ import { palette2 } from '../../../foundation';
|
|
|
2
2
|
// first is width, second is border
|
|
3
3
|
export var RcPresenceSizes = {
|
|
4
4
|
xxsmall: [8, 1],
|
|
5
|
-
xsmall: [
|
|
5
|
+
xsmall: [10, 1],
|
|
6
6
|
small: [10, 2],
|
|
7
|
-
medium: [
|
|
8
|
-
large: [
|
|
9
|
-
xlarge: [
|
|
10
|
-
};
|
|
11
|
-
// width, height
|
|
12
|
-
export var RcPresenceInnerIconSizes = {
|
|
13
|
-
xxsmall: [4, 2],
|
|
14
|
-
xsmall: [6, 2],
|
|
15
|
-
small: [6, 2],
|
|
16
|
-
medium: [6, 2],
|
|
17
|
-
large: [10, 4],
|
|
18
|
-
xlarge: [14, 4],
|
|
19
|
-
};
|
|
20
|
-
// use scale rate to make that be odd value
|
|
21
|
-
// width, scaleRate
|
|
22
|
-
export var RcPresenceAvailableIconSizes = {
|
|
23
|
-
xxsmall: [10, 0.5],
|
|
24
|
-
xsmall: [10, 0.5],
|
|
25
|
-
small: [6, undefined],
|
|
26
|
-
medium: [6, undefined],
|
|
27
|
-
large: [10, undefined],
|
|
28
|
-
xlarge: [12, undefined],
|
|
7
|
+
medium: [12, 2],
|
|
8
|
+
large: [16, 2],
|
|
9
|
+
xlarge: [20, 2],
|
|
29
10
|
};
|
|
30
11
|
var presenceOn = palette2('presence', 'available');
|
|
31
12
|
var presenceBusy = palette2('presence', 'busy');
|
|
@@ -45,3 +26,17 @@ export var RcPresenceColors = {
|
|
|
45
26
|
notReady: presenceOff,
|
|
46
27
|
offline: presenceOff,
|
|
47
28
|
};
|
|
29
|
+
export var RcPresenceBackgroundColors = {
|
|
30
|
+
// positive
|
|
31
|
+
available: '#FFFFFF',
|
|
32
|
+
attended: '#FFFFFF',
|
|
33
|
+
// negative
|
|
34
|
+
unAttended: '#FFFFFF',
|
|
35
|
+
onCall: '#FFFFFF',
|
|
36
|
+
inMeeting: '#FFFFFF',
|
|
37
|
+
DND: '#FFFFFF',
|
|
38
|
+
busy: '#FFFFFF',
|
|
39
|
+
unavailable: palette2('neutral', 'l01'),
|
|
40
|
+
notReady: palette2('neutral', 'l01'),
|
|
41
|
+
offline: palette2('neutral', 'l01'),
|
|
42
|
+
};
|
|
@@ -18,13 +18,15 @@ var _RcTabList = forwardRef(function (inProps, ref) {
|
|
|
18
18
|
if (context === null) {
|
|
19
19
|
throw new TypeError('[RcTabList] No TabContext provided');
|
|
20
20
|
}
|
|
21
|
-
var children =
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
21
|
+
var children = useMemo(function () {
|
|
22
|
+
return React.Children.map(childrenProp, function (child) {
|
|
23
|
+
var value = child.props.value;
|
|
24
|
+
return React.cloneElement(child, {
|
|
25
|
+
'aria-controls': getPanelId(context, value),
|
|
26
|
+
id: getTabId(context, value),
|
|
27
|
+
});
|
|
26
28
|
});
|
|
27
|
-
});
|
|
29
|
+
}, [childrenProp, context]);
|
|
28
30
|
return (React.createElement(RcTabs, __assign({}, rest, { ref: ref, classes: classes, value: context.value }), children));
|
|
29
31
|
});
|
|
30
32
|
var RcTabList = styled(_RcTabList)(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n ", "\n"], ["\n ", "\n"])), TabListStyle);
|
|
@@ -7,7 +7,6 @@ import { RcListItemIcon, RcListItemText } from '../../../List';
|
|
|
7
7
|
import { RcMenu, RcMenuItem, } from '../../../Menu';
|
|
8
8
|
import { RcTooltip } from '../../../Tooltip';
|
|
9
9
|
import { RcTab } from '../../Tab';
|
|
10
|
-
import { getKey } from '../MoreMenuTabs/utils';
|
|
11
10
|
import { MoreMenuTabStyle } from './styles';
|
|
12
11
|
var DEFAULT_MORE_MENU_TAB_LABEL = 'more_menu_tab';
|
|
13
12
|
var _MoreMenuTab = forwardRef(function (props, ref) {
|
|
@@ -15,13 +14,23 @@ var _MoreMenuTab = forwardRef(function (props, ref) {
|
|
|
15
14
|
var menuIdProp = MenuProps.id, onMenuCloseProp = MenuProps.onClose, MenuPropsRest = __rest(MenuProps, ["id", "onClose"]);
|
|
16
15
|
var menuId = useId(menuIdProp);
|
|
17
16
|
var _c = __read(useState(null), 2), anchorEl = _c[0], setAnchorEl = _c[1];
|
|
18
|
-
var
|
|
19
|
-
|
|
17
|
+
var open = Boolean(anchorEl);
|
|
18
|
+
var MoreIcon = (function () {
|
|
19
|
+
var Icon;
|
|
20
|
+
if (!MoreIconProp) {
|
|
21
|
+
Icon = (React.createElement(RcIcon, { size: "medium", color: "neutral.f04", symbol: MoreHorizIcon }));
|
|
22
|
+
}
|
|
23
|
+
else if (typeof MoreIconProp === 'function') {
|
|
24
|
+
Icon = MoreIconProp(open);
|
|
25
|
+
}
|
|
26
|
+
else {
|
|
27
|
+
Icon = MoreIconProp;
|
|
28
|
+
}
|
|
20
29
|
if (TooltipProps === null || TooltipProps === void 0 ? void 0 : TooltipProps.title) {
|
|
21
30
|
return React.createElement(RcTooltip, __assign({}, TooltipProps), Icon);
|
|
22
31
|
}
|
|
23
32
|
return Icon;
|
|
24
|
-
}
|
|
33
|
+
})();
|
|
25
34
|
var handleTabClick = useEventCallback(function (event) {
|
|
26
35
|
setAnchorEl(event.currentTarget);
|
|
27
36
|
});
|
|
@@ -33,20 +42,20 @@ var _MoreMenuTab = forwardRef(function (props, ref) {
|
|
|
33
42
|
if (!menuItems || menuItems.length === 0) {
|
|
34
43
|
return null;
|
|
35
44
|
}
|
|
36
|
-
return menuItems.map(function (item
|
|
37
|
-
var icon = item.icon, label = item.label, value = item.value, disabled = item.disabled, onClick = item.onClick, selected = item.selected, menuItemRest = __rest(item, ["icon", "label", "value", "disabled", "onClick", "selected"]);
|
|
45
|
+
return menuItems.map(function (item) {
|
|
46
|
+
var icon = item.icon, label = item.label, value = item.value, disabled = item.disabled, onClick = item.onClick, selected = item.selected, key = item.key, menuItemRest = __rest(item, ["icon", "label", "value", "disabled", "onClick", "selected", "key"]);
|
|
38
47
|
var handleClick = function (event) {
|
|
39
48
|
onChange === null || onChange === void 0 ? void 0 : onChange(event, value);
|
|
40
49
|
onClick === null || onClick === void 0 ? void 0 : onClick(event);
|
|
41
50
|
};
|
|
42
|
-
return (React.createElement(MenuItemComponent, { key:
|
|
51
|
+
return (React.createElement(MenuItemComponent, { key: key, disabled: disabled, selected: selected, value: value, onClick: handleClick, "data-test-automation-id": menuItemRest['data-test-automation-id'] },
|
|
43
52
|
icon ? React.createElement(RcListItemIcon, null, icon) : null,
|
|
44
53
|
React.createElement(RcListItemText, { primary: label || value })));
|
|
45
54
|
});
|
|
46
55
|
}, [MenuItemComponent, menuItems, onChange]);
|
|
47
56
|
return (React.createElement(React.Fragment, null,
|
|
48
|
-
React.createElement(RcTab, __assign({}, rest, { ref: ref, onClick: handleTabClick, label: MoreIcon, value: DEFAULT_MORE_MENU_TAB_LABEL, "aria-haspopup": "true", "aria-controls": menuId })),
|
|
49
|
-
React.createElement(RcMenu, __assign({ autoClose: true }, MenuPropsRest, { id: menuId, anchorEl: anchorEl, open:
|
|
57
|
+
React.createElement(RcTab, __assign({}, rest, { ref: ref, onClick: handleTabClick, label: MoreIcon, value: DEFAULT_MORE_MENU_TAB_LABEL, "aria-haspopup": "true", "aria-controls": menuId, "data-tab-more-button": "" })),
|
|
58
|
+
React.createElement(RcMenu, __assign({ autoClose: true }, MenuPropsRest, { id: menuId, anchorEl: anchorEl, open: open, variant: "menu", onClose: handleMenuClose }), MenuList)));
|
|
50
59
|
});
|
|
51
60
|
/** inner component */
|
|
52
61
|
var MoreMenuTab = styled(_MoreMenuTab)(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n ", "\n"], ["\n ", "\n"])), MoreMenuTabStyle);
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import React, { forwardRef } from 'react';
|
|
2
|
+
export var MoreMenuTabSentinel = forwardRef(function (props, ref) {
|
|
3
|
+
var onFocus = props.onFocus, id = props.id;
|
|
4
|
+
return (React.createElement("div", { ref: ref, "aria-hidden": true, style: { position: 'absolute', top: 0, left: 0, height: 0, width: 0 }, tabIndex: -1, "data-tab-sentinel": id, onFocus: onFocus }));
|
|
5
|
+
});
|
|
6
|
+
MoreMenuTabSentinel.displayName = 'MoreMenuTabSentinel';
|