@ringcentral/juno 2.0.0-rc.0 → 2.0.3-beta.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/README.md +3 -2
- package/components/Avatar/Avatar.js +36 -32
- package/components/Buttons/Button/Button.js +11 -7
- package/components/Buttons/IconButton/IconButton.js +5 -3
- package/components/Buttons/SplitButton/SplitButton.js +2 -1
- package/components/DetachedWindow/DetachedWindow.d.ts +1 -7
- package/components/DetachedWindow/DetachedWindow.js +8 -6
- package/components/Dialer/DialPad/utils/useKeyAudio.js +4 -4
- package/components/Dialog/Dialog.js +11 -7
- package/components/Downshift/Downshift.js +116 -109
- package/components/Downshift/SuggestionList/SuggestionList.d.ts +7 -1
- package/components/Downshift/SuggestionList/SuggestionList.js +13 -5
- package/components/Downshift/utils/useDownshiftError.js +2 -1
- package/components/Forms/Checkbox/Checkbox.js +11 -7
- package/components/Forms/Picker/DatePicker/DatePicker.js +21 -17
- package/components/Forms/TextField/TextField.js +26 -22
- package/components/Icon/Icon.js +41 -37
- package/components/Icon/utils/IconUtils.js +24 -16
- package/components/Link/Link.js +16 -12
- package/components/List/ListItem/ListItem.js +16 -12
- package/components/List/ListItemText/ListItemText.js +21 -17
- package/components/Loading/Loading.js +6 -4
- package/components/Menu/MenuItem/MenuItem.js +6 -4
- package/components/PortalHost/PortalManager/PortalManager.js +24 -16
- package/components/Snackbar/SnackbarContent/SnackbarContent.js +11 -7
- package/components/Tabs/Tabs/MoreMenuTabs/MoreMenuTabs.js +11 -8
- package/components/Tag/Tag.js +11 -7
- package/components/Text/Text.js +1 -2
- package/components/Text/TextWithEllipsis.js +7 -4
- package/components/TextWithHighlight/TextWithHighlight.js +7 -4
- package/components/TextWithLink/TextWithLink.js +7 -4
- package/components/TextWithTooltip/TextWithTooltip.js +7 -4
- package/components/Thumbnail/Thumbnail.js +16 -12
- package/components/Tooltip/Tooltip.js +17 -11
- package/components/VirtualizedMenu/VirtualizedMenuList.js +8 -10
- package/es6/README.md +3 -2
- package/es6/components/Avatar/Avatar.js +37 -33
- package/es6/components/Buttons/Button/Button.js +12 -8
- package/es6/components/Buttons/IconButton/IconButton.js +6 -4
- package/es6/components/Buttons/SplitButton/SplitButton.js +2 -1
- package/es6/components/DetachedWindow/DetachedWindow.js +8 -6
- package/es6/components/Dialer/DialPad/utils/useKeyAudio.js +4 -4
- package/es6/components/Dialog/Dialog.js +12 -8
- package/es6/components/Downshift/Downshift.js +117 -110
- package/es6/components/Downshift/SuggestionList/SuggestionList.js +13 -5
- package/es6/components/Downshift/utils/useDownshiftError.js +3 -2
- package/es6/components/Forms/Checkbox/Checkbox.js +12 -8
- package/es6/components/Forms/Picker/DatePicker/DatePicker.js +22 -18
- package/es6/components/Forms/TextField/TextField.js +27 -23
- package/es6/components/Icon/Icon.js +42 -38
- package/es6/components/Icon/utils/IconUtils.js +24 -16
- package/es6/components/Link/Link.js +17 -13
- package/es6/components/List/ListItem/ListItem.js +17 -13
- package/es6/components/List/ListItemText/ListItemText.js +22 -18
- package/es6/components/Loading/Loading.js +6 -4
- package/es6/components/Menu/MenuItem/MenuItem.js +6 -4
- package/es6/components/PortalHost/PortalManager/PortalManager.js +24 -16
- package/es6/components/Snackbar/SnackbarContent/SnackbarContent.js +12 -8
- package/es6/components/Tabs/Tabs/MoreMenuTabs/MoreMenuTabs.js +12 -9
- package/es6/components/Tag/Tag.js +12 -8
- package/es6/components/Text/Text.js +1 -2
- package/es6/components/Text/TextWithEllipsis.js +7 -4
- package/es6/components/TextWithHighlight/TextWithHighlight.js +7 -4
- package/es6/components/TextWithLink/TextWithLink.js +7 -4
- package/es6/components/TextWithTooltip/TextWithTooltip.js +7 -4
- package/es6/components/Thumbnail/Thumbnail.js +17 -13
- package/es6/components/Tooltip/Tooltip.js +18 -12
- package/es6/components/VirtualizedMenu/VirtualizedMenuList.js +9 -11
- package/es6/foundation/config.js +77 -57
- package/es6/foundation/hooks/useAudio/useAudio.js +1 -1
- package/es6/foundation/hooks/useResizeObserver/useResizeObserver.js +10 -7
- package/es6/foundation/styles/opacity.js +6 -4
- package/es6/foundation/theme/useThemeProps.js +1 -1
- package/es6/foundation/utils/clearReactReferencesInNode.js +9 -7
- package/es6/foundation/utils/hasValue.js +1 -1
- package/es6/foundation/utils/index.js +0 -1
- package/es6/foundation/utils/isShowJunoWarning.js +0 -2
- package/es6/foundation/utils/withDeprecatedCheck.js +14 -15
- package/foundation/config.d.ts +23 -13
- package/foundation/config.js +78 -58
- package/foundation/hooks/useAudio/useAudio.d.ts +1 -1
- package/foundation/hooks/useAudio/useAudio.js +1 -1
- package/foundation/hooks/useResizeObserver/useResizeObserver.js +10 -7
- package/foundation/styles/opacity.js +6 -4
- package/foundation/theme/useThemeProps.d.ts +1 -1
- package/foundation/theme/useThemeProps.js +1 -1
- package/foundation/utils/clearReactReferencesInNode.js +9 -7
- package/foundation/utils/hasValue.js +1 -1
- package/foundation/utils/index.d.ts +0 -1
- package/foundation/utils/index.js +0 -1
- package/foundation/utils/isShowJunoWarning.d.ts +0 -1
- package/foundation/utils/isShowJunoWarning.js +0 -4
- package/foundation/utils/withDeprecatedCheck.d.ts +2 -2
- package/foundation/utils/withDeprecatedCheck.js +14 -15
- package/package.json +2 -2
|
@@ -8,29 +8,33 @@ var styles_1 = require("./styles");
|
|
|
8
8
|
var utils_1 = require("./utils");
|
|
9
9
|
var _RcListItemText = react_1.forwardRef(function (inProps, ref) {
|
|
10
10
|
var props = foundation_1.useThemeProps({ props: inProps, name: 'RcListItemText' });
|
|
11
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
12
|
+
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
13
|
+
foundation_1.useDeprecatedCheck(RcListItemText, props, [
|
|
14
|
+
{
|
|
15
|
+
prop: 'primaryColor',
|
|
16
|
+
time: '2021-4',
|
|
17
|
+
comment: 'recommend use primaryTypographyProps color prop',
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
prop: 'alignCenter',
|
|
21
|
+
time: '2021-4',
|
|
22
|
+
comment: "recommend using classes to define it",
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
prop: 'lineThrough',
|
|
26
|
+
time: '2021-4',
|
|
27
|
+
comment: "recommend using classes to define it",
|
|
28
|
+
},
|
|
29
|
+
]);
|
|
30
|
+
}
|
|
11
31
|
var classesProp = props.classes, children = props.children, isEllipsis = props.isEllipsis, primaryTypographyPropsProp = props.primaryTypographyProps, secondaryTypographyPropsProp = props.secondaryTypographyProps, primaryColor = props.primaryColor, alignCenter = props.alignCenter, lineThrough = props.lineThrough, rest = tslib_1.__rest(props, ["classes", "children", "isEllipsis", "primaryTypographyProps", "secondaryTypographyProps", "primaryColor", "alignCenter", "lineThrough"]);
|
|
12
32
|
var classes = react_1.useMemo(function () { return foundation_1.combineClasses(utils_1.RcListItemTextClasses, classesProp); }, [classesProp]);
|
|
13
33
|
var primaryTypographyProps = react_1.useMemo(function () { return foundation_1.omit(primaryTypographyPropsProp, ['color', 'variant']); }, [primaryTypographyPropsProp]);
|
|
14
34
|
var secondaryTypographyProps = react_1.useMemo(function () { return foundation_1.omit(secondaryTypographyPropsProp, ['color', 'variant']); }, [secondaryTypographyPropsProp]);
|
|
15
35
|
return (react_1.default.createElement(ListItemText_1.default, tslib_1.__assign({}, rest, { ref: ref, classes: classes, primaryTypographyProps: primaryTypographyProps, secondaryTypographyProps: secondaryTypographyProps }), children));
|
|
16
36
|
});
|
|
17
|
-
var RcListItemText = foundation_1.styled(
|
|
18
|
-
{
|
|
19
|
-
prop: 'primaryColor',
|
|
20
|
-
time: '2021-4',
|
|
21
|
-
comment: 'recommend use primaryTypographyProps color prop',
|
|
22
|
-
},
|
|
23
|
-
{
|
|
24
|
-
prop: 'alignCenter',
|
|
25
|
-
time: '2021-4',
|
|
26
|
-
comment: "recommend using classes to define it",
|
|
27
|
-
},
|
|
28
|
-
{
|
|
29
|
-
prop: 'lineThrough',
|
|
30
|
-
time: '2021-4',
|
|
31
|
-
comment: "recommend using classes to define it",
|
|
32
|
-
},
|
|
33
|
-
], 'RcListItemText'))(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n ", "\n"], ["\n ", "\n"])), styles_1.ListItemTextStyle);
|
|
37
|
+
var RcListItemText = foundation_1.styled(_RcListItemText)(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n ", "\n"], ["\n ", "\n"])), styles_1.ListItemTextStyle);
|
|
34
38
|
exports.RcListItemText = RcListItemText;
|
|
35
39
|
RcListItemText.defaultProps = {
|
|
36
40
|
isEllipsis: true,
|
|
@@ -20,10 +20,12 @@ var RcLoading = function (inProps) {
|
|
|
20
20
|
childrenWhenLoading.type !== react_1.default.Fragment) {
|
|
21
21
|
return (react_1.default.createElement(Box_1.RcBox, { clone: true, display: "none" }, childrenWhenLoading));
|
|
22
22
|
}
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
23
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
24
|
+
foundation_1.logInDev({
|
|
25
|
+
component: 'RcLoading',
|
|
26
|
+
message: 'please confirm your children is a valid html element to set style, when you use `keepVisible=false`',
|
|
27
|
+
});
|
|
28
|
+
}
|
|
27
29
|
return childrenWhenLoading;
|
|
28
30
|
};
|
|
29
31
|
return (react_1.default.createElement(react_1.default.Fragment, null,
|
|
@@ -52,10 +52,12 @@ var _RcMenuItem = react_1.forwardRef(function (inProps, ref) {
|
|
|
52
52
|
return foundation_1.isRcElement(icon, ['RcListItemIcon']) ? (icon) : (react_1.default.createElement(ListItemIcon_1.RcListItemIcon, null, icon));
|
|
53
53
|
}
|
|
54
54
|
if (typeof icon === 'string') {
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
55
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
56
|
+
foundation_1.logInDev({
|
|
57
|
+
component: 'RcMenuItem',
|
|
58
|
+
message: 'please use symbol to replace icon string',
|
|
59
|
+
});
|
|
60
|
+
}
|
|
59
61
|
return (react_1.default.createElement(ListItemIcon_1.RcListItemIcon, null,
|
|
60
62
|
react_1.default.createElement(Icon_1.RcIcon, { size: "small" }, icon)));
|
|
61
63
|
}
|
|
@@ -33,10 +33,12 @@ var PortalManager = /** @class */ (function (_super) {
|
|
|
33
33
|
var currPortal = this.portalStore.get(id);
|
|
34
34
|
// portalWithSameID opened
|
|
35
35
|
if (currPortal === null || currPortal === void 0 ? void 0 : currPortal.open) {
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
36
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
37
|
+
foundation_1.logInDev({
|
|
38
|
+
component: 'RcPortalHost',
|
|
39
|
+
message: "open the portal with id('" + id + "') failed, this portal is already open",
|
|
40
|
+
});
|
|
41
|
+
}
|
|
40
42
|
return currPortal.portalController;
|
|
41
43
|
}
|
|
42
44
|
var portalDescriptor = this.createPortalDescriptor({
|
|
@@ -120,10 +122,12 @@ var PortalManager = /** @class */ (function (_super) {
|
|
|
120
122
|
PortalManager.prototype.closeByID = function (id, feedback) {
|
|
121
123
|
var portal = this.portalStore.get(id);
|
|
122
124
|
if (!(portal === null || portal === void 0 ? void 0 : portal.open)) {
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
125
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
126
|
+
foundation_1.logInDev({
|
|
127
|
+
component: 'RcPortalHost',
|
|
128
|
+
message: 'close portal failed, this portal is already closed',
|
|
129
|
+
});
|
|
130
|
+
}
|
|
127
131
|
return;
|
|
128
132
|
}
|
|
129
133
|
this._feedbackMap.set(portal.id, feedback);
|
|
@@ -139,10 +143,12 @@ var PortalManager = /** @class */ (function (_super) {
|
|
|
139
143
|
PortalManager.prototype[types_1.UnmountSymbol] = function (id) {
|
|
140
144
|
var portal = this.portalStore.get(id);
|
|
141
145
|
if (!portal) {
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
147
|
+
foundation_1.logInDev({
|
|
148
|
+
component: 'RcPortalHost',
|
|
149
|
+
message: 'unmount portal failed, this portal is already unmount',
|
|
150
|
+
});
|
|
151
|
+
}
|
|
146
152
|
return;
|
|
147
153
|
}
|
|
148
154
|
this.portalStore.delete(portal.id);
|
|
@@ -153,10 +159,12 @@ var PortalManager = /** @class */ (function (_super) {
|
|
|
153
159
|
PortalManager.prototype.updatePropsByID = function (id, propsOrHandler) {
|
|
154
160
|
var portal = this.portalStore.get(id);
|
|
155
161
|
if (!(portal === null || portal === void 0 ? void 0 : portal.open)) {
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
162
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
163
|
+
foundation_1.logInDev({
|
|
164
|
+
component: 'RcPortalHost',
|
|
165
|
+
message: 'update props failed, this portal is already closed',
|
|
166
|
+
});
|
|
167
|
+
}
|
|
160
168
|
return;
|
|
161
169
|
}
|
|
162
170
|
var props = (function () {
|
|
@@ -10,6 +10,16 @@ var utils_1 = require("./utils");
|
|
|
10
10
|
/** @release */
|
|
11
11
|
var _RcSnackbarContent = react_1.forwardRef(function (inProps, ref) {
|
|
12
12
|
var props = foundation_1.useThemeProps({ props: inProps, name: 'RcSnackbarContent' });
|
|
13
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
14
|
+
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
15
|
+
foundation_1.useDeprecatedCheck(RcSnackbarContent, props, [
|
|
16
|
+
{
|
|
17
|
+
prop: 'ariaLabel',
|
|
18
|
+
time: '2021-3',
|
|
19
|
+
comment: "please use `aria-label` directly ",
|
|
20
|
+
},
|
|
21
|
+
]);
|
|
22
|
+
}
|
|
13
23
|
var classesProp = props.classes, loading = props.loading, size = props.size, messageAlign = props.messageAlign, type = props.type, fullWidth = props.fullWidth, actionProp = props.action, rest = tslib_1.__rest(props, ["classes", "loading", "size", "messageAlign", "type", "fullWidth", "action"]);
|
|
14
24
|
var classes = react_1.useMemo(function () { return foundation_1.combineClasses(utils_1.RcSnackbarContentClasses, classesProp); }, [classesProp]);
|
|
15
25
|
var action = react_1.useMemo(function () {
|
|
@@ -30,13 +40,7 @@ var _RcSnackbarContent = react_1.forwardRef(function (inProps, ref) {
|
|
|
30
40
|
}, [actionProp, size]);
|
|
31
41
|
return (react_1.default.createElement(SnackbarContent_1.default, tslib_1.__assign({}, rest, { ref: ref, classes: classes, action: loading ? (react_1.default.createElement(CircularProgress_1.RcCircularProgress, { color: "inherit", size: utils_1.RcSnackbarContentLoadingSizes[size] })) : (action) })));
|
|
32
42
|
});
|
|
33
|
-
var RcSnackbarContent = foundation_1.styled(
|
|
34
|
-
{
|
|
35
|
-
prop: 'ariaLabel',
|
|
36
|
-
time: '2021-3',
|
|
37
|
-
comment: "please use `aria-label` directly ",
|
|
38
|
-
},
|
|
39
|
-
], 'RcSnackbarContent'))(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n ", "\n"], ["\n ", "\n"])), styles_1.snackbarContentStyle);
|
|
43
|
+
var RcSnackbarContent = foundation_1.styled(_RcSnackbarContent)(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n ", "\n"], ["\n ", "\n"])), styles_1.snackbarContentStyle);
|
|
40
44
|
exports.RcSnackbarContent = RcSnackbarContent;
|
|
41
45
|
RcSnackbarContent.defaultProps = {
|
|
42
46
|
type: 'success',
|
|
@@ -22,6 +22,7 @@ exports.findChildrenByKey = function (childrenProp, key) {
|
|
|
22
22
|
var _MoreMenuTabs = react_1.forwardRef(function (props, ref) {
|
|
23
23
|
var orientation = props.orientation, childrenProp = props.children, valueProp = props.value, onChange = props.onChange, _a = props.MoreButtonProps, MoreButtonProps = _a === void 0 ? {} : _a, rest = tslib_1.__rest(props, ["orientation", "children", "value", "onChange", "MoreButtonProps"]);
|
|
24
24
|
var onGroupInfoChange = MoreButtonProps.onGroupInfoChange, MoreButtonPropsRest = tslib_1.__rest(MoreButtonProps, ["onGroupInfoChange"]);
|
|
25
|
+
var prevChildren = foundation_1.usePrevious(function () { return childrenProp; });
|
|
25
26
|
var isVertical = orientation === 'vertical';
|
|
26
27
|
var oriStr = isVertical ? 'height' : 'width';
|
|
27
28
|
var innerRef = react_1.useRef(null);
|
|
@@ -35,7 +36,7 @@ var _MoreMenuTabs = react_1.forwardRef(function (props, ref) {
|
|
|
35
36
|
var groupingRef = react_1.useRef();
|
|
36
37
|
var _b = tslib_1.__read(react_1.useState([]), 2), menuTabChild = _b[0], setMenuTabChild = _b[1];
|
|
37
38
|
var _c = tslib_1.__read(react_1.useState(true), 2), useMoreMode = _c[0], setUseMoreMode = _c[1];
|
|
38
|
-
var
|
|
39
|
+
var hasResizeRef = react_1.useRef(true);
|
|
39
40
|
var forceUpdate = foundation_1.useForceUpdate();
|
|
40
41
|
var sizeChange = function (size) {
|
|
41
42
|
if (tabsSizeRef.current.height !== size.height ||
|
|
@@ -49,7 +50,7 @@ var _MoreMenuTabs = react_1.forwardRef(function (props, ref) {
|
|
|
49
50
|
var _b = tslib_1.__read(_a, 1), entry = _b[0];
|
|
50
51
|
var _c = entry.contentRect, width = _c.width, height = _c.height;
|
|
51
52
|
var obj = { width: width, height: height };
|
|
52
|
-
|
|
53
|
+
hasResizeRef.current = true;
|
|
53
54
|
throttleTabsSizeChange(obj);
|
|
54
55
|
}, { mode: 'none' });
|
|
55
56
|
var tabsSize = tabsSizeRef.current;
|
|
@@ -113,10 +114,10 @@ var _MoreMenuTabs = react_1.forwardRef(function (props, ref) {
|
|
|
113
114
|
}, []);
|
|
114
115
|
react_1.useEffect(function () {
|
|
115
116
|
var _a;
|
|
116
|
-
var
|
|
117
|
+
var currSelectTabItem;
|
|
117
118
|
var tabRefsMap = tabRefsMapRef.current;
|
|
118
119
|
if (tabRefsMap) {
|
|
119
|
-
|
|
120
|
+
currSelectTabItem = tslib_1.__spread(tabRefsMap).find(function (_a) {
|
|
120
121
|
var _b = tslib_1.__read(_a, 2), mapValue = _b[1];
|
|
121
122
|
return valueProp === mapValue.value || valueProp === mapValue.index;
|
|
122
123
|
});
|
|
@@ -155,7 +156,7 @@ var _MoreMenuTabs = react_1.forwardRef(function (props, ref) {
|
|
|
155
156
|
});
|
|
156
157
|
});
|
|
157
158
|
var limitSize = tabsSize[oriStr] - moreTabSizeRef.current[oriStr];
|
|
158
|
-
var _a = utils_1.computeChildBySize(labelArray,
|
|
159
|
+
var _a = utils_1.computeChildBySize(labelArray, currSelectTabItem === null || currSelectTabItem === void 0 ? void 0 : currSelectTabItem[0], limitSize), tabsTabLabel = _a.plainArr, menuTabLabel = _a.groupArr;
|
|
159
160
|
computeGroupingInfo(tabsTabLabel, menuTabLabel);
|
|
160
161
|
var tabsTabChild = tabsTabLabel.map(function (key) {
|
|
161
162
|
return exports.findChildrenByKey(childrenProp, key);
|
|
@@ -191,18 +192,20 @@ var _MoreMenuTabs = react_1.forwardRef(function (props, ref) {
|
|
|
191
192
|
if (tabsSize.width !== 0 && tabsSize.height !== 0) {
|
|
192
193
|
// computed: 1.resize 2. valueProp 3.moreMenuClick
|
|
193
194
|
// not computed: visible tab change
|
|
194
|
-
if (((_a = groupingRef.current) === null || _a === void 0 ? void 0 : _a.tabs.includes((
|
|
195
|
-
|
|
195
|
+
if (((_a = groupingRef.current) === null || _a === void 0 ? void 0 : _a.tabs.includes((currSelectTabItem === null || currSelectTabItem === void 0 ? void 0 : currSelectTabItem[0]) || '')) &&
|
|
196
|
+
!hasResizeRef.current &&
|
|
197
|
+
prevChildren === childrenProp) {
|
|
196
198
|
return;
|
|
197
199
|
}
|
|
198
200
|
computeTabChild(tabsSize);
|
|
199
|
-
|
|
201
|
+
hasResizeRef.current = false;
|
|
200
202
|
}
|
|
201
203
|
}, [
|
|
202
204
|
childrenProp,
|
|
203
205
|
isVertical,
|
|
204
206
|
onGroupInfoChange,
|
|
205
207
|
oriStr,
|
|
208
|
+
prevChildren,
|
|
206
209
|
tabsSize,
|
|
207
210
|
valueProp,
|
|
208
211
|
]);
|
package/components/Tag/Tag.js
CHANGED
|
@@ -6,16 +6,20 @@ var foundation_1 = require("../../foundation");
|
|
|
6
6
|
var styles_1 = require("./styles");
|
|
7
7
|
var _RcTag = react_1.memo(react_1.forwardRef(function (inProps, ref) {
|
|
8
8
|
var props = foundation_1.useThemeProps({ props: inProps, name: 'RcTag' });
|
|
9
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
10
|
+
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
11
|
+
foundation_1.useDeprecatedCheck(RcTag, props, [
|
|
12
|
+
{
|
|
13
|
+
prop: 'content',
|
|
14
|
+
comment: 'you should replace with children',
|
|
15
|
+
time: '2021-1',
|
|
16
|
+
},
|
|
17
|
+
]);
|
|
18
|
+
}
|
|
9
19
|
var color = props.color, children = props.children, content = props.content, textColor = props.textColor, borderColor = props.borderColor, radius = props.radius, rest = tslib_1.__rest(props, ["color", "children", "content", "textColor", "borderColor", "radius"]);
|
|
10
20
|
return (react_1.default.createElement("span", tslib_1.__assign({}, rest, { ref: ref }), content || children));
|
|
11
21
|
}));
|
|
12
|
-
var RcTag = foundation_1.styled(
|
|
13
|
-
{
|
|
14
|
-
prop: 'content',
|
|
15
|
-
comment: 'you should replace with children',
|
|
16
|
-
time: '2021-1',
|
|
17
|
-
},
|
|
18
|
-
]))(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n ", "\n"], ["\n ", "\n"])), styles_1.TagStyle);
|
|
22
|
+
var RcTag = foundation_1.styled(_RcTag)(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n ", "\n"], ["\n ", "\n"])), styles_1.TagStyle);
|
|
19
23
|
exports.RcTag = RcTag;
|
|
20
24
|
RcTag.defaultProps = {
|
|
21
25
|
color: 'highlight.b03',
|
package/components/Text/Text.js
CHANGED
|
@@ -29,8 +29,7 @@ var _RcText = react_1.forwardRef(function (inProps, ref) {
|
|
|
29
29
|
}, [TooltipPropsProp, isShowTitle]);
|
|
30
30
|
return (react_1.default.createElement(Typography_1.RcTypography, tslib_1.__assign({ ref: textRef, title: isShowTitle || useRcTooltip // * if useRcTooltip always keep title pass into
|
|
31
31
|
? // * if user pass title, use title first
|
|
32
|
-
|
|
33
|
-
: undefined, TooltipProps: TooltipProps, useRcTooltip: useRcTooltip, variant: highlight ? 'inherit' : undefined, component: highlight ? 'span' : undefined, className: className }, rest), children));
|
|
32
|
+
title !== null && title !== void 0 ? title : (isString_1.default(children) ? children : undefined) : undefined, TooltipProps: TooltipProps, useRcTooltip: useRcTooltip, variant: highlight ? 'inherit' : undefined, component: highlight ? 'span' : undefined, className: className }, rest), children));
|
|
34
33
|
});
|
|
35
34
|
/**
|
|
36
35
|
* `RcText` will auto add title with children when that children is string
|
|
@@ -6,10 +6,13 @@ var core_1 = require("@material-ui/core");
|
|
|
6
6
|
var foundation_1 = require("../../foundation");
|
|
7
7
|
var styled_components_1 = tslib_1.__importDefault(require("../../foundation/styled-components"));
|
|
8
8
|
var _RcTextWithEllipsis = react_1.forwardRef(function (props, ref) {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
9
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
10
|
+
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
11
|
+
foundation_1.useDeprecatedLog({
|
|
12
|
+
component: 'RcTextWithEllipsis',
|
|
13
|
+
message: 'should not use that, just use `RcText` with `titleWhenOverflow` and `flexFull`',
|
|
14
|
+
});
|
|
15
|
+
}
|
|
13
16
|
return react_1.default.createElement(core_1.Typography, tslib_1.__assign({}, props, { ref: ref }));
|
|
14
17
|
});
|
|
15
18
|
/** @deprecated should not use that, just use `RcText` with `titleWhenOverflow` and `flexFull` */
|
|
@@ -7,10 +7,13 @@ var styled_components_1 = tslib_1.__importDefault(require("../../foundation/styl
|
|
|
7
7
|
var StyledSpan = styled_components_1.default.span(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n color: ", ";\n background-color: ", ";\n a {\n color: inherit;\n }\n"], ["\n color: ", ";\n background-color: ", ";\n a {\n color: inherit;\n }\n"])), foundation_1.palette2('highlight', 'f01'), foundation_1.palette2('highlight', 'b02'));
|
|
8
8
|
/** @deprecated should not use that, just use RcText with `highlight` */
|
|
9
9
|
var RcTextWithHighlight = function (props) {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
10
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
11
|
+
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
12
|
+
foundation_1.useDeprecatedLog({
|
|
13
|
+
component: 'RcTextWithHighlight',
|
|
14
|
+
message: 'should not use that, just use RcText with `highlight`',
|
|
15
|
+
});
|
|
16
|
+
}
|
|
14
17
|
return react_1.default.createElement(StyledSpan, tslib_1.__assign({ className: "highlight-term" }, props));
|
|
15
18
|
};
|
|
16
19
|
exports.RcTextWithHighlight = RcTextWithHighlight;
|
|
@@ -9,10 +9,13 @@ var Link_1 = require("../Link");
|
|
|
9
9
|
var TipsText = styled_components_1.default(Typography_1.default)(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n && {\n color: ", ";\n ", ";\n * {\n ", ";\n }\n }\n"], ["\n && {\n color: ", ";\n ", ";\n * {\n ", ";\n }\n }\n"])), foundation_1.palette2('neutral', 'f04'), foundation_1.typography('caption1'), foundation_1.typography('caption1'));
|
|
10
10
|
/** @deprecated please don't use that component, just use RcText and RcLink directly */
|
|
11
11
|
var RcTextWithLink = react_1.memo(function (props) {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
12
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
13
|
+
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
14
|
+
foundation_1.useDeprecatedLog({
|
|
15
|
+
component: 'RcTextWithLink',
|
|
16
|
+
message: "please don't use that component, just use `RcText` and RcLink directly",
|
|
17
|
+
});
|
|
18
|
+
}
|
|
16
19
|
var text = props.text, linkText = props.linkText, onClick = props.onClick, TypographyProps = props.TypographyProps, RcLinkProps = props.RcLinkProps;
|
|
17
20
|
var textProps;
|
|
18
21
|
if (TypographyProps) {
|
|
@@ -10,10 +10,13 @@ var StyledText = foundation_1.styled.span(templateObject_1 || (templateObject_1
|
|
|
10
10
|
});
|
|
11
11
|
/** @deprecated please don't use that component, just use `RcText` with `title` directly */
|
|
12
12
|
var RcTextWithTooltip = function (props) {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
13
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
14
|
+
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
15
|
+
foundation_1.useDeprecatedLog({
|
|
16
|
+
component: 'RcTextWithTooltip',
|
|
17
|
+
message: "please don't use that component, just use `RcText` with `title` directly",
|
|
18
|
+
});
|
|
19
|
+
}
|
|
17
20
|
var tooltip = props.tooltip, children = props.children, _a = props.textColor, textColor = _a === void 0 ? ['neutral', 'f06'] : _a;
|
|
18
21
|
var ref = react_1.useRef(null);
|
|
19
22
|
var _b = tslib_1.__read(react_1.useState(false), 2), showTooltip = _b[0], setShowTooltip = _b[1];
|
|
@@ -7,21 +7,25 @@ var Icon_1 = require("../Icon");
|
|
|
7
7
|
var styles_1 = require("./styles");
|
|
8
8
|
var _RcThumbnail = react_1.forwardRef(function (inProps, ref) {
|
|
9
9
|
var props = foundation_1.useThemeProps({ props: inProps, name: 'RcThumbnail' });
|
|
10
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
11
|
+
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
12
|
+
foundation_1.useDeprecatedCheck(RcThumbnail, props, [
|
|
13
|
+
{
|
|
14
|
+
prop: 'iconType',
|
|
15
|
+
time: '2021-2',
|
|
16
|
+
comment: 'Please use symbol to set icon',
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
prop: 'url',
|
|
20
|
+
time: '2021-2',
|
|
21
|
+
comment: 'Please use src to set url',
|
|
22
|
+
},
|
|
23
|
+
]);
|
|
24
|
+
}
|
|
10
25
|
var url = props.url, _a = props.src, src = _a === void 0 ? url : _a, iconType = props.iconType, size = props.size, symbol = props.symbol, rest = tslib_1.__rest(props, ["url", "src", "iconType", "size", "symbol"]);
|
|
11
26
|
return (react_1.default.createElement(react_1.default.Fragment, null, src ? (react_1.default.createElement(styles_1.StyledThumbnail, tslib_1.__assign({ ref: ref, src: src, size: size, "data-test-automation-id": "thumbnail" }, rest))) : (react_1.default.createElement(Icon_1.RcIcon, tslib_1.__assign({ ref: ref, "data-test-automation-id": "iconThumbnail" }, rest, { size: size === 'small' ? 'small' : 'xxxlarge', symbol: symbol }), iconType))));
|
|
12
27
|
});
|
|
13
|
-
var RcThumbnail = foundation_1.styled(
|
|
14
|
-
{
|
|
15
|
-
prop: 'iconType',
|
|
16
|
-
time: '2021-2',
|
|
17
|
-
comment: 'Please use symbol to set icon',
|
|
18
|
-
},
|
|
19
|
-
{
|
|
20
|
-
prop: 'url',
|
|
21
|
-
time: '2021-2',
|
|
22
|
-
comment: 'Please use src to set url',
|
|
23
|
-
},
|
|
24
|
-
], 'RcThumbnail'))(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject([""], [""])));
|
|
28
|
+
var RcThumbnail = foundation_1.styled(react_1.memo(_RcThumbnail))(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject([""], [""])));
|
|
25
29
|
exports.RcThumbnail = RcThumbnail;
|
|
26
30
|
RcThumbnail.defaultProps = {
|
|
27
31
|
size: 'large',
|
|
@@ -8,6 +8,16 @@ var styles_1 = require("./styles");
|
|
|
8
8
|
var utils_1 = require("./utils");
|
|
9
9
|
var _RcTooltip = react_1.forwardRef(function (inProps, ref) {
|
|
10
10
|
var props = foundation_1.useThemeProps({ props: inProps, name: 'RcTooltip' });
|
|
11
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
12
|
+
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
13
|
+
foundation_1.useDeprecatedCheck(RcTooltip, props, [
|
|
14
|
+
{
|
|
15
|
+
prop: 'injectGlobalStyle',
|
|
16
|
+
time: '2021-3',
|
|
17
|
+
comment: "@deprecated now need anymore */",
|
|
18
|
+
},
|
|
19
|
+
]);
|
|
20
|
+
}
|
|
11
21
|
var children = props.children, tooltipForceHide = props.tooltipForceHide, openProp = props.open, onOpen = props.onOpen, onClose = props.onClose,
|
|
12
22
|
// * that className will pass into children, just pick that and pass into root popper
|
|
13
23
|
// * that also not a props in mui doc https://material-ui.com/api/tooltip/
|
|
@@ -46,10 +56,12 @@ var _RcTooltip = react_1.forwardRef(function (inProps, ref) {
|
|
|
46
56
|
childNode.tagName.toLowerCase() === 'button' &&
|
|
47
57
|
childNode.disabled) {
|
|
48
58
|
setIsDisabledButton(true);
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
59
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
60
|
+
foundation_1.logInDev({
|
|
61
|
+
component: 'RcTooltip',
|
|
62
|
+
message: 'You have set a tooltip on disabled button, A disabled element does not fire events.',
|
|
63
|
+
});
|
|
64
|
+
}
|
|
53
65
|
}
|
|
54
66
|
else if (isDisabledButton) {
|
|
55
67
|
setIsDisabledButton(false);
|
|
@@ -58,13 +70,7 @@ var _RcTooltip = react_1.forwardRef(function (inProps, ref) {
|
|
|
58
70
|
return (react_1.default.createElement(Tooltip_1.default, tslib_1.__assign({ ref: tooltipRef, title: isDisabledButton ? '' : title, arrow: true, classes: classes, PopperProps: PopperProps }, additionProp, rest), ignorePointer ? (react_1.default.createElement(styles_1.Mask, tslib_1.__assign({}, maskProps), children)) : (children)));
|
|
59
71
|
});
|
|
60
72
|
/** @release */
|
|
61
|
-
var RcTooltip = foundation_1.styled(
|
|
62
|
-
{
|
|
63
|
-
prop: 'injectGlobalStyle',
|
|
64
|
-
time: '2021-3',
|
|
65
|
-
comment: "@deprecated now need anymore */",
|
|
66
|
-
},
|
|
67
|
-
], 'RcTooltip'))(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n ", ";\n"], ["\n ", ";\n"])), styles_1.tooltipStyle);
|
|
73
|
+
var RcTooltip = foundation_1.styled(_RcTooltip)(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n ", ";\n"], ["\n ", ";\n"])), styles_1.tooltipStyle);
|
|
68
74
|
exports.RcTooltip = RcTooltip;
|
|
69
75
|
RcTooltip.defaultProps = {
|
|
70
76
|
placement: 'bottom',
|
|
@@ -35,16 +35,14 @@ var _RcVirtualizedMenuList = react_1.forwardRef(function (inProps, ref) {
|
|
|
35
35
|
if (!react_1.default.isValidElement(child)) {
|
|
36
36
|
return;
|
|
37
37
|
}
|
|
38
|
-
if (
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
});
|
|
47
|
-
}
|
|
38
|
+
if (process.env.NODE_ENV !== 'production' && react_is_1.isFragment(child)) {
|
|
39
|
+
foundation_1.logInDev({
|
|
40
|
+
component: 'RcVirtualizedMenuList',
|
|
41
|
+
message: [
|
|
42
|
+
"Material-UI: The Menu component doesn't accept a Fragment as a child.",
|
|
43
|
+
'Consider providing an array instead.',
|
|
44
|
+
].join('\n'),
|
|
45
|
+
});
|
|
48
46
|
}
|
|
49
47
|
if (!child.props.disabled) {
|
|
50
48
|
if (variant === 'selectedMenu' && child.props.selected) {
|
package/es6/README.md
CHANGED
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
# Juno
|
|
2
2
|
|
|
3
3
|
[](https://www.npmjs.com/package/@ringcentral/juno)
|
|
4
|
-
|
|
5
4
|
[](https://www.npmjs.com/package/@ringcentral/juno?activeTab=versions)
|
|
6
5
|
|
|
6
|
+
[](https://www.npmjs.com/package/@ringcentral/juno-icon)
|
|
7
|
+
|
|
7
8
|
Ringcentral React Component library, make your app have the same user experience as Ringcentral Apps.
|
|
8
9
|
|
|
9
10
|
base on [MATERIAL-UI](https://material-ui.com/).
|
|
10
11
|
|
|
11
|
-
Explore Juno with the [interactive live Storybook instance](https://
|
|
12
|
+
Explore Juno with the [interactive live Storybook instance](https://ringcentral.github.io/juno/).
|
|
12
13
|
|
|
13
14
|
View in [Codesandbox Example](https://codesandbox.io/s/4j370).
|
|
14
15
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { __assign, __makeTemplateObject, __rest } from "tslib";
|
|
2
2
|
import React, { forwardRef, useMemo } from 'react';
|
|
3
3
|
import clsx from 'clsx';
|
|
4
|
-
import { styled,
|
|
4
|
+
import { styled, useDeprecatedCheck, useThemeProps, } from '../../foundation';
|
|
5
5
|
import { RcPresence } from '../Presence';
|
|
6
6
|
import { RcTooltip, withTooltip } from '../Tooltip';
|
|
7
7
|
import { RcAvatarMask, StyledAvatar, StyledAvatarWrapper, StyledIconAvatar, StyledPresenceWrapper, } from './styles';
|
|
@@ -9,6 +9,41 @@ import { RcAvatarClasses, RcAvatarSizes } from './utils';
|
|
|
9
9
|
var _RcAvatar = forwardRef(function (inProps, ref) {
|
|
10
10
|
// change default unClickable to here, prevent warning
|
|
11
11
|
var props = useThemeProps({ props: inProps, name: 'RcAvatar' });
|
|
12
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
13
|
+
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
14
|
+
useDeprecatedCheck(RcAvatar, inProps, [
|
|
15
|
+
{
|
|
16
|
+
prop: 'customColor',
|
|
17
|
+
time: '2021-3',
|
|
18
|
+
comment: "if 'true', will just use color value, use `color` directly ",
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
prop: 'unClickable',
|
|
22
|
+
time: '2021-3',
|
|
23
|
+
comment: "force set avatar clickable, default is true, please use clickable to set clickable ",
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
prop: 'isMember',
|
|
27
|
+
time: '2021-3',
|
|
28
|
+
comment: "not used, just keep type temp ",
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
prop: 'displayName',
|
|
32
|
+
time: '2021-3',
|
|
33
|
+
comment: "not used, just keep type temp ",
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
prop: 'alt',
|
|
37
|
+
time: '2021-3',
|
|
38
|
+
comment: "alt for img, just use `<img src /> in children or imgProps for apply alt` ",
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
prop: 'tooltip',
|
|
42
|
+
time: '2021-3',
|
|
43
|
+
comment: "support tooltip for avatar, use title to replace ",
|
|
44
|
+
},
|
|
45
|
+
]);
|
|
46
|
+
}
|
|
12
47
|
var presenceOrigin = props.presenceOrigin, idProps = props.id, size = props.size, classes = props.classes, color = props.color, children = props.children, _clickable = props.clickable, onClick = props.onClick, mask = props.mask, presence = props.presence, customColor = props.customColor, tooltip = props.tooltip, iconSize = props.iconSize, iconSymbol = props.iconSymbol, srcProp = props.src, altProp = props.alt, Img = props.Img, imgProps = props.imgProps, presenceProps = props.presenceProps, displayName = props.displayName, rest = __rest(props, ["presenceOrigin", "id", "size", "classes", "color", "children", "clickable", "onClick", "mask", "presence", "customColor", "tooltip", "iconSize", "iconSymbol", "src", "alt", "Img", "imgProps", "presenceProps", "displayName"]);
|
|
13
48
|
var unClickable = props.unClickable;
|
|
14
49
|
unClickable = unClickable !== null && unClickable !== void 0 ? unClickable : true;
|
|
@@ -93,38 +128,7 @@ var _RcAvatar = forwardRef(function (inProps, ref) {
|
|
|
93
128
|
avatar,
|
|
94
129
|
presenceChildren));
|
|
95
130
|
});
|
|
96
|
-
var RcAvatar = styled(
|
|
97
|
-
{
|
|
98
|
-
prop: 'customColor',
|
|
99
|
-
time: '2021-3',
|
|
100
|
-
comment: "if 'true', will just use color value, use `color` directly ",
|
|
101
|
-
},
|
|
102
|
-
{
|
|
103
|
-
prop: 'unClickable',
|
|
104
|
-
time: '2021-3',
|
|
105
|
-
comment: "force set avatar clickable, default is true, please use clickable to set clickable ",
|
|
106
|
-
},
|
|
107
|
-
{
|
|
108
|
-
prop: 'isMember',
|
|
109
|
-
time: '2021-3',
|
|
110
|
-
comment: "not used, just keep type temp ",
|
|
111
|
-
},
|
|
112
|
-
{
|
|
113
|
-
prop: 'displayName',
|
|
114
|
-
time: '2021-3',
|
|
115
|
-
comment: "not used, just keep type temp ",
|
|
116
|
-
},
|
|
117
|
-
{
|
|
118
|
-
prop: 'alt',
|
|
119
|
-
time: '2021-3',
|
|
120
|
-
comment: "alt for img, just use `<img src /> in children or imgProps for apply alt` ",
|
|
121
|
-
},
|
|
122
|
-
{
|
|
123
|
-
prop: 'tooltip',
|
|
124
|
-
time: '2021-3',
|
|
125
|
-
comment: "support tooltip for avatar, use title to replace ",
|
|
126
|
-
},
|
|
127
|
-
], 'RcAvatar'))(templateObject_1 || (templateObject_1 = __makeTemplateObject([""], [""])));
|
|
131
|
+
var RcAvatar = styled(withTooltip(_RcAvatar))(templateObject_1 || (templateObject_1 = __makeTemplateObject([""], [""])));
|
|
128
132
|
RcAvatar.defaultProps = {
|
|
129
133
|
size: 'medium',
|
|
130
134
|
presenceOrigin: {
|