@ringcentral/juno 2.15.0 → 2.17.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.
Files changed (105) hide show
  1. package/components/Downshift/Downshift.d.ts +9 -1
  2. package/components/Downshift/Downshift.js +26 -9
  3. package/components/Downshift/SuggestionList/SuggestionList.d.ts +13 -1
  4. package/components/Downshift/SuggestionList/SuggestionList.js +6 -4
  5. package/components/Downshift/styles/StyledPopper.d.ts +10 -5
  6. package/components/Downshift/styles/StyledPopper.js +2 -2
  7. package/components/Downshift/utils/useDownshift.d.ts +1 -0
  8. package/components/Downshift/utils/useDownshift.js +3 -0
  9. package/components/List/ListItem/ListItem.d.ts +3 -1
  10. package/components/List/ListItem/ListItem.js +3 -2
  11. package/components/List/ListItem/styles/ListItemStyle.d.ts +5 -0
  12. package/components/List/ListItem/styles/ListItemStyle.js +17 -5
  13. package/components/List/ListItem/utils/ListItemUtils.d.ts +2 -0
  14. package/components/List/ListItem/utils/ListItemUtils.js +5 -4
  15. package/components/Menu/MenuItem/MenuItem.d.ts +7 -6
  16. package/components/Menu/MenuItem/MenuItem.js +14 -4
  17. package/components/Menu/MenuItem/styles/MenuItemStyle.js +6 -3
  18. package/components/Menu/MenuItem/utils/MenuItemUtils.d.ts +4 -1
  19. package/components/Menu/MenuItem/utils/MenuItemUtils.js +4 -1
  20. package/components/Menu/MenuOption/styles/StyledMenuOption.d.ts +1 -1
  21. package/components/Menu/SubMenu/SubMenu.d.ts +1 -1
  22. package/components/Menu/SubMenu/utils/SubMenuUtils.d.ts +1 -1
  23. package/components/TablePagination/styles/TablePaginationStyle.d.ts +4 -4
  24. package/components/Text/index.d.ts +0 -1
  25. package/components/Text/index.js +0 -1
  26. package/components/index.d.ts +0 -1
  27. package/components/index.js +0 -1
  28. package/es6/components/Downshift/Downshift.js +27 -10
  29. package/es6/components/Downshift/SuggestionList/SuggestionList.js +6 -4
  30. package/es6/components/Downshift/styles/StyledPopper.js +2 -2
  31. package/es6/components/Downshift/utils/useDownshift.js +3 -0
  32. package/es6/components/List/ListItem/ListItem.js +3 -2
  33. package/es6/components/List/ListItem/styles/ListItemStyle.js +19 -7
  34. package/es6/components/List/ListItem/utils/ListItemUtils.js +4 -3
  35. package/es6/components/Menu/MenuItem/MenuItem.js +16 -6
  36. package/es6/components/Menu/MenuItem/styles/MenuItemStyle.js +10 -7
  37. package/es6/components/Menu/MenuItem/utils/MenuItemUtils.js +4 -1
  38. package/es6/components/Text/index.js +0 -1
  39. package/es6/components/index.js +0 -1
  40. package/foundation/theme/ThemeHandler.d.ts +1 -1
  41. package/foundation/theme/ThemeSwitcherProvider/ThemeSwitcherProvider.d.ts +2 -2
  42. package/package.json +1 -1
  43. package/components/Autocomplete/Autocomplete.d.ts +0 -4
  44. package/components/Autocomplete/Autocomplete.js +0 -7
  45. package/components/Autocomplete/index.d.ts +0 -1
  46. package/components/Autocomplete/index.js +0 -4
  47. package/components/Grid/deprecated/Grid.d.ts +0 -6
  48. package/components/Grid/deprecated/Grid.js +0 -8
  49. package/components/Grid/deprecated/index.d.ts +0 -1
  50. package/components/Grid/deprecated/index.js +0 -4
  51. package/components/ImageView/ImageView.d.ts +0 -311
  52. package/components/ImageView/ImageView.js +0 -206
  53. package/components/ImageView/index.d.ts +0 -1
  54. package/components/ImageView/index.js +0 -4
  55. package/components/Tables/Table.d.ts +0 -34
  56. package/components/Tables/Table.js +0 -31
  57. package/components/Tables/TableBodyCellContent.d.ts +0 -10
  58. package/components/Tables/TableBodyCellContent.js +0 -16
  59. package/components/Tables/TableHead.d.ts +0 -4
  60. package/components/Tables/TableHead.js +0 -18
  61. package/components/Tables/TableHeadCell.d.ts +0 -4
  62. package/components/Tables/TableHeadCell.js +0 -64
  63. package/components/Tables/TableRow.d.ts +0 -3
  64. package/components/Tables/TableRow.js +0 -6
  65. package/components/Tables/index.d.ts +0 -7
  66. package/components/Tables/index.js +0 -10
  67. package/components/Tables/styled.d.ts +0 -24
  68. package/components/Tables/styled.js +0 -46
  69. package/components/Tables/types.d.ts +0 -60
  70. package/components/Tables/types.js +0 -49
  71. package/components/Text/TextWithEllipsis.d.ts +0 -6
  72. package/components/Text/TextWithEllipsis.js +0 -21
  73. package/components/TextWithHighlight/TextWithHighlight.d.ts +0 -6
  74. package/components/TextWithHighlight/TextWithHighlight.js +0 -20
  75. package/components/TextWithHighlight/index.d.ts +0 -1
  76. package/components/TextWithHighlight/index.js +0 -4
  77. package/components/TextWithLink/TextWithLink.d.ts +0 -14
  78. package/components/TextWithLink/TextWithLink.js +0 -31
  79. package/components/TextWithLink/index.d.ts +0 -1
  80. package/components/TextWithLink/index.js +0 -4
  81. package/components/TextWithTooltip/TextWithTooltip.d.ts +0 -8
  82. package/components/TextWithTooltip/TextWithTooltip.js +0 -35
  83. package/components/TextWithTooltip/index.d.ts +0 -1
  84. package/components/TextWithTooltip/index.js +0 -4
  85. package/es6/components/Autocomplete/Autocomplete.js +0 -4
  86. package/es6/components/Autocomplete/index.js +0 -1
  87. package/es6/components/Grid/deprecated/Grid.js +0 -6
  88. package/es6/components/Grid/deprecated/index.js +0 -1
  89. package/es6/components/ImageView/ImageView.js +0 -204
  90. package/es6/components/ImageView/index.js +0 -1
  91. package/es6/components/Tables/Table.js +0 -29
  92. package/es6/components/Tables/TableBodyCellContent.js +0 -14
  93. package/es6/components/Tables/TableHead.js +0 -15
  94. package/es6/components/Tables/TableHeadCell.js +0 -62
  95. package/es6/components/Tables/TableRow.js +0 -4
  96. package/es6/components/Tables/index.js +0 -7
  97. package/es6/components/Tables/styled.js +0 -38
  98. package/es6/components/Tables/types.js +0 -41
  99. package/es6/components/Text/TextWithEllipsis.js +0 -19
  100. package/es6/components/TextWithHighlight/TextWithHighlight.js +0 -18
  101. package/es6/components/TextWithHighlight/index.js +0 -1
  102. package/es6/components/TextWithLink/TextWithLink.js +0 -29
  103. package/es6/components/TextWithLink/index.js +0 -1
  104. package/es6/components/TextWithTooltip/TextWithTooltip.js +0 -33
  105. package/es6/components/TextWithTooltip/index.js +0 -1
@@ -1,35 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- var tslib_1 = require("tslib");
4
- var react_1 = tslib_1.__importStar(require("react"));
5
- var foundation_1 = require("../../foundation");
6
- var StyledText = foundation_1.styled.span(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n color: ", ";\n"], ["\n color: ",
7
- ";\n"])), function (_a) {
8
- var textColor = _a.textColor;
9
- return foundation_1.getParsePaletteColor(textColor, foundation_1.palette2('neutral', 'f06'));
10
- });
11
- /** @deprecated please don't use that component, just use `RcText` with `title` directly */
12
- var RcTextWithTooltip = function (props) {
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
- }
20
- var tooltip = props.tooltip, children = props.children, _a = props.textColor, textColor = _a === void 0 ? ['neutral', 'f06'] : _a;
21
- var ref = react_1.useRef(null);
22
- var _b = tslib_1.__read(react_1.useState(false), 2), showTooltip = _b[0], setShowTooltip = _b[1];
23
- var onMouseOver = function () {
24
- var span = ref.current;
25
- if (span && span.parentElement) {
26
- var _a = span.parentElement, scrollHeight = _a.scrollHeight, scrollWidth = _a.scrollWidth, clientHeight = _a.clientHeight, clientWidth = _a.clientWidth;
27
- setShowTooltip(scrollWidth > clientWidth || scrollHeight > clientHeight);
28
- }
29
- };
30
- var toolTipText = typeof children === 'string' ? children : tooltip || '';
31
- return (react_1.default.createElement("span", { title: showTooltip ? toolTipText : '', onMouseOver: onMouseOver, ref: ref },
32
- react_1.default.createElement(StyledText, { textColor: textColor }, children)));
33
- };
34
- exports.RcTextWithTooltip = RcTextWithTooltip;
35
- var templateObject_1;
@@ -1 +0,0 @@
1
- export * from './TextWithTooltip';
@@ -1,4 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- var tslib_1 = require("tslib");
4
- tslib_1.__exportStar(require("./TextWithTooltip"), exports);
@@ -1,4 +0,0 @@
1
- import Autocomplete from '@material-ui/lab/Autocomplete';
2
- /** @deprecated should use `RcDownshift` to replace that */
3
- var RcAutocomplete = Autocomplete;
4
- export { RcAutocomplete };
@@ -1 +0,0 @@
1
- export * from './Autocomplete';
@@ -1,6 +0,0 @@
1
- import { __assign } from "tslib";
2
- import React from 'react';
3
- import MuiGrid from '@material-ui/core/Grid';
4
- export var RcGrid = React.memo(function (props) { return React.createElement(MuiGrid, __assign({}, props)); });
5
- RcGrid.displayName = 'RcGrid';
6
- RcGrid.dependencies = [RcGrid];
@@ -1 +0,0 @@
1
- export * from './Grid';
@@ -1,204 +0,0 @@
1
- import { __assign, __awaiter, __extends, __generator, __makeTemplateObject, __rest } from "tslib";
2
- import React, { createRef, } from 'react';
3
- import cloneDeep from 'lodash/cloneDeep';
4
- import values from 'lodash/values';
5
- import { ImageBroken } from '@ringcentral/juno-icon';
6
- import styled from '../../foundation/styled-components';
7
- import { RcIcon } from '../Icon';
8
- var StyledLoadingPage = styled.div(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n position: absolute;\n width: 100%;\n height: 100%;\n top: 0;\n left: 0;\n display: flex;\n align-items: center;\n justify-content: center;\n"], ["\n position: absolute;\n width: 100%;\n height: 100%;\n top: 0;\n left: 0;\n display: flex;\n align-items: center;\n justify-content: center;\n"])));
9
- var StyledBackground = styled.div(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n display: block;\n overflow: hidden;\n box-shadow: ", ";\n visibility: ", ";\n user-select: none;\n height: ", "px;\n width: ", "px;\n"], ["\n display: block;\n overflow: hidden;\n box-shadow: ", ";\n visibility: ", ";\n user-select: none;\n height: ", "px;\n width: ", "px;\n"])), function (_a) {
10
- var theme = _a.theme;
11
- return theme.shadows[7];
12
- }, function (_a) {
13
- var visibility = _a.visibility;
14
- return visibility;
15
- }, function (_a) {
16
- var height = _a.height;
17
- return height;
18
- }, function (_a) {
19
- var width = _a.width;
20
- return width;
21
- });
22
- var HiddenImage = styled.img(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n visibility: hidden;\n display: none;\n"], ["\n visibility: hidden;\n display: none;\n"])));
23
- function isThumbnailMode(props) {
24
- return props.thumbnailSrc && props.thumbnailSrc !== props.src;
25
- }
26
- var RcImageView = /** @class */ (function (_super) {
27
- __extends(RcImageView, _super);
28
- function RcImageView(props) {
29
- var _this = _super.call(this, props) || this;
30
- _this._imageRef = createRef();
31
- _this._canvasRef = createRef();
32
- _this.getImageRef = function () {
33
- return _this.props.imageRef || _this._imageRef;
34
- };
35
- _this._drawToCanvas = function (imgBitmap) {
36
- var canvasE = _this._canvasRef.current;
37
- if (!canvasE) {
38
- return;
39
- }
40
- var ctx = canvasE.getContext('2d');
41
- if (ctx) {
42
- if (!imgBitmap) {
43
- return;
44
- }
45
- var naturalWidth = imgBitmap.width, naturalHeight = imgBitmap.height;
46
- canvasE.width = naturalWidth;
47
- canvasE.height = naturalHeight;
48
- ctx.drawImage(imgBitmap, 0, 0, naturalWidth, naturalHeight, 0, 0, naturalWidth, naturalHeight);
49
- }
50
- };
51
- _this._loadHandler = function (event) { return __awaiter(_this, void 0, void 0, function () {
52
- var _a, loadings, currentShow, _b, onSizeLoad, onLoad, _c, naturalWidth, naturalHeight, performanceTracerEnd, target, bitmap;
53
- var _d;
54
- return __generator(this, function (_e) {
55
- switch (_e.label) {
56
- case 0:
57
- _a = this.state, loadings = _a.loadings, currentShow = _a.currentShow;
58
- _b = this.props, onSizeLoad = _b.onSizeLoad, onLoad = _b.onLoad;
59
- if (currentShow === 'raw') {
60
- _c = event.currentTarget, naturalWidth = _c.naturalWidth, naturalHeight = _c.naturalHeight;
61
- onSizeLoad === null || onSizeLoad === void 0 ? void 0 : onSizeLoad(naturalWidth, naturalHeight);
62
- onLoad === null || onLoad === void 0 ? void 0 : onLoad();
63
- performanceTracerEnd = this.props.performanceTracerEnd;
64
- performanceTracerEnd === null || performanceTracerEnd === void 0 ? void 0 : performanceTracerEnd();
65
- }
66
- this.setState({
67
- loadings: __assign(__assign({}, loadings), (_d = {}, _d[currentShow] = false, _d)),
68
- });
69
- if (!this._canvasRef.current) {
70
- return [2 /*return*/];
71
- }
72
- target = event.target;
73
- if (!('createImageBitmap' in window)) return [3 /*break*/, 2];
74
- return [4 /*yield*/, createImageBitmap(target)];
75
- case 1:
76
- bitmap = _e.sent();
77
- this._drawToCanvas(bitmap);
78
- return [3 /*break*/, 3];
79
- case 2:
80
- this._drawToCanvas(target);
81
- _e.label = 3;
82
- case 3: return [2 /*return*/];
83
- }
84
- });
85
- }); };
86
- _this._errorHandler = function () {
87
- var _a, _b;
88
- var _c = _this.state, loadings = _c.loadings, errors = _c.errors, currentShow = _c.currentShow;
89
- var onError = _this.props.onError;
90
- if (currentShow === 'raw') {
91
- onError === null || onError === void 0 ? void 0 : onError();
92
- }
93
- _this.setState({
94
- loadings: __assign(__assign({}, loadings), (_a = {}, _a[currentShow] = false, _a)),
95
- errors: __assign(__assign({}, errors), (_b = {}, _b[currentShow] = true, _b)),
96
- });
97
- onError === null || onError === void 0 ? void 0 : onError();
98
- };
99
- _this.rawImageLoader = function () {
100
- var currentShow = _this.state.currentShow;
101
- var _a = _this.props, thumbnailSrc = _a.thumbnailSrc, src = _a.src;
102
- var currentShowSrc = currentShow === 'raw' ? src : thumbnailSrc;
103
- if (!currentShowSrc) {
104
- return null;
105
- }
106
- var pathName = new URL(currentShowSrc).pathname;
107
- var isGif = /\.gif$/.test(pathName);
108
- if (isGif) {
109
- return (React.createElement("img", __assign({ src: currentShowSrc, alt: "", onLoad: _this._loadHandler, onError: _this._errorHandler }, _this._imageAttributes)));
110
- }
111
- return (React.createElement(React.Fragment, null,
112
- _this.canvasRenderer(),
113
- React.createElement(HiddenImage, { src: currentShowSrc, onLoad: _this._loadHandler, onError: _this._errorHandler })));
114
- };
115
- _this.canvasRenderer = function () {
116
- return (React.createElement(StyledBackground, __assign({}, _this._imageAttributes, { visibility: _this.error ? 'hidden' : 'visible' }),
117
- React.createElement("canvas", { ref: _this._canvasRef, style: { width: '100%' } })));
118
- };
119
- var performanceTracerStart = _this.props.performanceTracerStart;
120
- performanceTracerStart === null || performanceTracerStart === void 0 ? void 0 : performanceTracerStart();
121
- _this.state = _this.getInitState(props);
122
- var _a = _this.props, width = _a.width, height = _a.height, onSizeLoad = _a.onSizeLoad;
123
- if (width && height && onSizeLoad) {
124
- onSizeLoad === null || onSizeLoad === void 0 ? void 0 : onSizeLoad(Number(width), Number(height));
125
- }
126
- return _this;
127
- }
128
- RcImageView.prototype.getInitState = function (props) {
129
- if (isThumbnailMode(props)) {
130
- return cloneDeep(RcImageView.initThumbnailModeState);
131
- }
132
- return cloneDeep(RcImageView.initState);
133
- };
134
- RcImageView.prototype._errorView = function () {
135
- if (!this.error) {
136
- return null;
137
- }
138
- return (React.createElement(StyledLoadingPage, null,
139
- React.createElement(RcIcon, { size: "xxxlarge", color: "neutral.f02", symbol: ImageBroken })));
140
- };
141
- RcImageView.prototype._hiddenRawLoader = function () {
142
- var _this = this;
143
- var _a = this.state, loadings = _a.loadings, errors = _a.errors, currentShow = _a.currentShow;
144
- var _b = this.props, onSizeLoad = _b.onSizeLoad, src = _b.src;
145
- return (currentShow !== 'raw' && (React.createElement(HiddenImage, { src: src, onLoad: function (event) {
146
- var _a = event.currentTarget, naturalWidth = _a.naturalWidth, naturalHeight = _a.naturalHeight;
147
- onSizeLoad === null || onSizeLoad === void 0 ? void 0 : onSizeLoad(naturalWidth, naturalHeight);
148
- _this.setState({
149
- loadings: __assign(__assign({}, loadings), { raw: false }),
150
- currentShow: 'raw',
151
- });
152
- }, onError: function () {
153
- _this.setState({
154
- loadings: __assign(__assign({}, loadings), { raw: false }),
155
- errors: __assign(__assign({}, errors), { raw: true }),
156
- });
157
- } })));
158
- };
159
- Object.defineProperty(RcImageView.prototype, "error", {
160
- get: function () {
161
- var errors = this.state.errors;
162
- return values(errors).every(function (status) { return !!status; });
163
- },
164
- enumerable: true,
165
- configurable: true
166
- });
167
- Object.defineProperty(RcImageView.prototype, "_imageAttributes", {
168
- get: function () {
169
- var _a = this.props, onSizeLoad = _a.onSizeLoad, onLoad = _a.onLoad, onError = _a.onError, loadingPlaceHolder = _a.loadingPlaceHolder, viewRef = _a.imageRef, thumbnailSrc = _a.thumbnailSrc, src = _a.src, performanceTracerEnd = _a.performanceTracerEnd, performanceTracerStart = _a.performanceTracerStart, rest = __rest(_a, ["onSizeLoad", "onLoad", "onError", "loadingPlaceHolder", "imageRef", "thumbnailSrc", "src", "performanceTracerEnd", "performanceTracerStart"]);
170
- return __assign(__assign({}, rest), { ref: this.getImageRef() });
171
- },
172
- enumerable: true,
173
- configurable: true
174
- });
175
- RcImageView.prototype.render = function () {
176
- return (React.createElement(React.Fragment, null,
177
- this.rawImageLoader(),
178
- this._hiddenRawLoader(),
179
- this._errorView()));
180
- };
181
- RcImageView.initState = {
182
- loadings: {
183
- raw: true,
184
- },
185
- errors: {
186
- raw: false,
187
- },
188
- currentShow: 'raw',
189
- };
190
- RcImageView.initThumbnailModeState = {
191
- loadings: {
192
- raw: true,
193
- thumbnail: true,
194
- },
195
- errors: {
196
- raw: false,
197
- thumbnail: false,
198
- },
199
- currentShow: 'thumbnail',
200
- };
201
- return RcImageView;
202
- }(React.Component));
203
- export { RcImageView };
204
- var templateObject_1, templateObject_2, templateObject_3;
@@ -1 +0,0 @@
1
- export * from './ImageView';
@@ -1,29 +0,0 @@
1
- import { __makeTemplateObject } from "tslib";
2
- import React, { forwardRef, useMemo } from 'react';
3
- import clsx from 'clsx';
4
- import { styled, useThemeProps } from '../../foundation';
5
- import { StyledTable, TableWrapper } from './styled';
6
- import { TABLE_BORDER_TYPE, TABLE_STICKY_TYPE, TABLE_TYPE } from './types';
7
- var _RcTable = forwardRef(function (inProps, ref) {
8
- var props = useThemeProps({ props: inProps, name: 'RcTable' });
9
- var header = props.header, children = props.children, desc = props.desc, tableSticky = props.tableSticky, tableType = props.tableType, tableBorder = props.tableBorder, classes = props.classes, className = props.className;
10
- var containerClass = useMemo(function () {
11
- var _a;
12
- return clsx(className, classes === null || classes === void 0 ? void 0 : classes.root, (_a = {},
13
- _a[TABLE_BORDER_TYPE.BORDERED] = tableBorder === TABLE_BORDER_TYPE.BORDERED,
14
- _a));
15
- }, [className, classes, tableBorder]);
16
- var tableClass = useMemo(function () {
17
- var _a;
18
- return clsx(classes === null || classes === void 0 ? void 0 : classes.table, tableType || TABLE_TYPE.CARD, (_a = {},
19
- _a[TABLE_STICKY_TYPE.STICKY] = tableSticky === TABLE_STICKY_TYPE.STICKY,
20
- _a));
21
- }, [classes, tableSticky, tableType]);
22
- return (React.createElement(TableWrapper, { className: containerClass },
23
- React.createElement(StyledTable, { className: tableClass, "aria-label": desc, ref: ref },
24
- header ? header : null,
25
- React.createElement("tbody", null, children))));
26
- });
27
- var RcTable = styled(_RcTable)(templateObject_1 || (templateObject_1 = __makeTemplateObject([""], [""])));
28
- export { RcTable };
29
- var templateObject_1;
@@ -1,14 +0,0 @@
1
- import { __assign, __makeTemplateObject, __rest } from "tslib";
2
- import React, { forwardRef } from 'react';
3
- import { styled } from '../../foundation';
4
- import { RcTypography } from '../Typography';
5
- var _RcTableBodyCellContent = forwardRef(function (_a, ref) {
6
- var children = _a.children, _b = _a.noWrap, noWrap = _b === void 0 ? true : _b, rest = __rest(_a, ["children", "noWrap"]);
7
- return (React.createElement(RcTypography, __assign({ ref: ref, noWrap: noWrap, component: "div", color: "neutral.f05" }, rest), children));
8
- });
9
- var RcTableBodyCellContent = styled(_RcTableBodyCellContent)(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n text-align: ", ";\n"], ["\n text-align: ", ";\n"])), function (_a) {
10
- var textAlign = _a.textAlign;
11
- return textAlign;
12
- });
13
- export { RcTableBodyCellContent };
14
- var templateObject_1;
@@ -1,15 +0,0 @@
1
- import React from 'react';
2
- import { StyledTableRow } from './styled';
3
- import { RcTableHeadCell } from './TableHeadCell';
4
- import { ORDER_TABLE_BY } from './types';
5
- var RcTableHeadView = function (props) {
6
- var columnData = props.columnData, sortMap = props.sortMap, sortHandler = props.sortHandler;
7
- return (React.createElement("thead", null,
8
- React.createElement(StyledTableRow, null, columnData.map(function (column) {
9
- var sortDirection = sortMap && sortMap.sortKey === column.sortKey
10
- ? sortMap.sortDirection
11
- : ORDER_TABLE_BY.NONE;
12
- return (React.createElement(RcTableHeadCell, { key: column.sortKey + "-" + column.title, width: column.width, title: column.title, sortDirection: sortDirection, sortKey: column.sortKey, sortHandler: sortHandler, textAlign: column.textAlign, automationID: column.automationID }));
13
- }))));
14
- };
15
- export { RcTableHeadView };
@@ -1,62 +0,0 @@
1
- import { __assign } from "tslib";
2
- import React, { useMemo } from 'react';
3
- import isFunction from 'lodash/isFunction';
4
- import isNumber from 'lodash/isNumber';
5
- import { JumpToLatest as arrowDown, JumpToUnread as arrowUp, } from '@ringcentral/juno-icon';
6
- import { useA11yKeyEvent } from '../../foundation';
7
- import { RcIcon } from '../Icon';
8
- import { StyledSortIconWrapper, StyledTableHeadCell, StyledTableHeadCellContent, StyledTableHeadText, } from './styled';
9
- import { ARIA_SORT_VALUES, ORDER_TABLE_BY, SORT_ICON_CLASS, } from './types';
10
- var RcTableHeadCell = function (props) {
11
- var automationID = props.automationID, title = props.title, width = props.width, sortDirection = props.sortDirection, sortKey = props.sortKey, textAlign = props.textAlign;
12
- var onClick = function () {
13
- var sortHandler = props.sortHandler, sortKey = props.sortKey, sortDirection = props.sortDirection;
14
- if (sortKey === undefined || !sortHandler) {
15
- return;
16
- }
17
- if (sortDirection === ORDER_TABLE_BY.ASC) {
18
- sortHandler(ORDER_TABLE_BY.DESC, sortKey);
19
- }
20
- else {
21
- sortHandler(ORDER_TABLE_BY.ASC, sortKey);
22
- }
23
- };
24
- var onKeyDown = useA11yKeyEvent(onClick);
25
- // eslint-disable-next-line react-hooks/exhaustive-deps
26
- var shouldSort = function () {
27
- var sortHandler = props.sortHandler, sortKey = props.sortKey;
28
- return isFunction(sortHandler) && isNumber(sortKey);
29
- };
30
- var sortDirectionArrow = useMemo(function () {
31
- var sortClass = '';
32
- switch (sortDirection) {
33
- case ORDER_TABLE_BY.ASC:
34
- sortClass = SORT_ICON_CLASS.SORT_UP;
35
- break;
36
- case ORDER_TABLE_BY.DESC:
37
- sortClass = SORT_ICON_CLASS.SORT_DOWN;
38
- break;
39
- default:
40
- }
41
- if (shouldSort()) {
42
- return (React.createElement(StyledSortIconWrapper, { className: sortClass },
43
- React.createElement(RcIcon, { symbol: sortDirection === ORDER_TABLE_BY.ASC ? arrowUp : arrowDown, size: "small" })));
44
- }
45
- return React.createElement(React.Fragment, null);
46
- }, [shouldSort, sortDirection]);
47
- var ariaSort = __assign({}, (sortDirection !== undefined &&
48
- [ORDER_TABLE_BY.ASC, ORDER_TABLE_BY.DESC].includes(sortDirection) && {
49
- 'aria-sort': ARIA_SORT_VALUES[ORDER_TABLE_BY[sortDirection]],
50
- }));
51
- var headCellSortProps = __assign({}, (shouldSort() && __assign({ onKeyDown: onKeyDown }, ariaSort)));
52
- var cellContentSortProps = __assign({}, (shouldSort() && {
53
- role: 'button',
54
- onClickCapture: onClick,
55
- }));
56
- var hasSortKey = sortKey !== undefined;
57
- return (React.createElement(StyledTableHeadCell, __assign({ scope: "col", tabIndex: hasSortKey ? 0 : undefined, width: width, hasSortKey: hasSortKey, sortDirection: sortDirection, "data-test-automation-value": automationID, "data-test-automation-class": "table-header-cell" }, headCellSortProps),
58
- React.createElement(StyledTableHeadCellContent, __assign({ textAlign: textAlign }, cellContentSortProps),
59
- React.createElement(StyledTableHeadText, null, title),
60
- sortDirectionArrow)));
61
- };
62
- export { RcTableHeadCell };
@@ -1,4 +0,0 @@
1
- import { __makeTemplateObject } from "tslib";
2
- import { palette2, setOpacity, styled } from '../../foundation';
3
- export var RcTableRow = styled.tr(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n outline: none;\n\n &:not(:last-child) {\n border-bottom: 1px solid ", ";\n }\n\n &:hover {\n background-color: ", ";\n }\n"], ["\n outline: none;\n\n &:not(:last-child) {\n border-bottom: 1px solid ", ";\n }\n\n &:hover {\n background-color: ", ";\n }\n"])), palette2('neutral', 'l02'), setOpacity(palette2('action', 'grayLight'), '08'));
4
- var templateObject_1;
@@ -1,7 +0,0 @@
1
- export * from './Table';
2
- export * from './TableHead';
3
- export * from './TableHeadCell';
4
- export * from './types';
5
- export * from './TableRow';
6
- export * from './TableBodyCellContent';
7
- export * from './styled';
@@ -1,38 +0,0 @@
1
- import { __makeTemplateObject } from "tslib";
2
- import { css, fakeBorder, focusVisibleShadowStyle, focusWithin, palette2, spacing, styled, } from '../../foundation';
3
- import { COLUMN_TEXT_ALIGN, ORDER_TABLE_BY, TABLE_BORDER_TYPE, TABLE_STICKY_TYPE, TABLE_TYPE, } from './types';
4
- var TableWrapper = styled('div')(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n height: 100%;\n width: 100%;\n overflow: auto;\n\n background-color: ", ";\n &.", " {\n border-radius: 4px;\n border: 1px solid ", ";\n }\n"], ["\n height: 100%;\n width: 100%;\n overflow: auto;\n\n background-color: ", ";\n &.", " {\n border-radius: 4px;\n border: 1px solid ", ";\n }\n"])), palette2('neutral', 'b01'), TABLE_BORDER_TYPE.BORDERED, palette2('neutral', 'l02'));
5
- var StyledTable = styled('table')(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n border-collapse: collapse;\n table-layout: fixed;\n width: 100%;\n display: table;\n /* scroll when viewport is less than 960px including the 332px from left navs */\n min-width: ", ";\n\n @media only screen and (max-width: ", ") {\n table-layout: auto;\n }\n\n &.", " th {\n position: sticky;\n top: 0;\n }\n\n thead {\n border-bottom: 1px solid ", ";\n width: 100%;\n position: sticky;\n top: 0;\n display: table-header-group;\n z-index: 5;\n }\n\n tbody {\n display: table-row-group;\n }\n\n tr {\n display: table-row;\n padding-left: ", ";\n\n th,\n td {\n -webkit-box-sizing: border-box;\n -moz-box-sizing: border-box;\n box-sizing: border-box;\n vertical-align: middle;\n }\n td:first-child {\n padding-left: ", ";\n margin-left: -", ";\n }\n td:not(:first-child) {\n padding-left: ", ";\n padding-right: ", ";\n }\n }\n\n &.", " tr td {\n overflow: hidden;\n height: 40px;\n }\n\n &.", " tr td {\n overflow: hidden;\n height: 52px;\n }\n\n &.", " tr td {\n overflow: hidden;\n height: 64px;\n }\n\n &.", " tr td {\n overflow: hidden;\n padding: ", ";\n height: auto;\n }\n"], ["\n border-collapse: collapse;\n table-layout: fixed;\n width: 100%;\n display: table;\n /* scroll when viewport is less than 960px including the 332px from left navs */\n min-width: ", ";\n\n @media only screen and (max-width: ", ") {\n table-layout: auto;\n }\n\n &.", " th {\n position: sticky;\n top: 0;\n }\n\n thead {\n border-bottom: 1px solid ", ";\n width: 100%;\n position: sticky;\n top: 0;\n display: table-header-group;\n z-index: 5;\n }\n\n tbody {\n display: table-row-group;\n }\n\n tr {\n display: table-row;\n padding-left: ", ";\n\n th,\n td {\n -webkit-box-sizing: border-box;\n -moz-box-sizing: border-box;\n box-sizing: border-box;\n vertical-align: middle;\n }\n td:first-child {\n padding-left: ", ";\n margin-left: -", ";\n }\n td:not(:first-child) {\n padding-left: ", ";\n padding-right: ", ";\n }\n }\n\n &.", " tr td {\n overflow: hidden;\n height: 40px;\n }\n\n &.", " tr td {\n overflow: hidden;\n height: 52px;\n }\n\n &.", " tr td {\n overflow: hidden;\n height: 64px;\n }\n\n &.", " tr td {\n overflow: hidden;\n padding: ", ";\n height: auto;\n }\n"])), spacing(157), spacing(157), TABLE_STICKY_TYPE.STICKY, palette2('neutral', 'l02'), spacing(4), spacing(4), spacing(4), spacing(4), spacing(4), TABLE_TYPE.MODAL, TABLE_TYPE.CARD, TABLE_TYPE.FULL, TABLE_TYPE.AUTO, spacing(3, 4));
6
- var StyledTableRow = styled('tr')(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n height: 25px;\n display: table-row;\n font-size: 12px;\n text-align: left;\n vertical-align: middle;\n"], ["\n height: 25px;\n display: table-row;\n font-size: 12px;\n text-align: left;\n vertical-align: middle;\n"])));
7
- var StyledSortIconWrapper = styled.div(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n padding-left: 8px;\n padding-right: 8px;\n vertical-align: middle;\n display: inline-flex;\n\n & path {\n fill: ", ";\n }\n"], ["\n padding-left: 8px;\n padding-right: 8px;\n vertical-align: middle;\n display: inline-flex;\n\n & path {\n fill: ", ";\n }\n"])), palette2('neutral', 'f04'));
8
- var StyledTableHeadText = styled.div(templateObject_5 || (templateObject_5 = __makeTemplateObject(["\n text-overflow: ellipsis;\n overflow: auto;\n"], ["\n text-overflow: ellipsis;\n overflow: auto;\n"])));
9
- var StyledTableHeadCell = styled('th')(templateObject_7 || (templateObject_7 = __makeTemplateObject(["\n color: ", ";\n user-select: none;\n text-align: left;\n background-color: ", ";\n z-index: 100;\n line-height: 32px;\n width: ", ";\n padding-top: 0;\n padding-bottom: 0;\n display: table-cell;\n white-space: nowrap;\n overflow: hidden;\n\n & > div {\n border: 1px solid inherit;\n padding-left: ", ";\n -webkit-box-sizing: border-box;\n -moz-box-sizing: border-box;\n box-sizing: border-box;\n }\n\n ", "\n"], ["\n color: ",
10
- ";\n user-select: none;\n text-align: left;\n background-color: ",
11
- ";\n z-index: 100;\n line-height: 32px;\n width: ", ";\n padding-top: 0;\n padding-bottom: 0;\n display: table-cell;\n white-space: nowrap;\n overflow: hidden;\n\n & > div {\n border: 1px solid inherit;\n padding-left: ", ";\n -webkit-box-sizing: border-box;\n -moz-box-sizing: border-box;\n box-sizing: border-box;\n }\n\n ",
12
- "\n"])), function (props) {
13
- return props.sortDirection === ORDER_TABLE_BY.NONE
14
- ? palette2('neutral', 'f06')
15
- : palette2('interactive', 'f01');
16
- }, function (props) {
17
- return props.sortDirection === ORDER_TABLE_BY.NONE
18
- ? palette2('neutral', 'b02')
19
- : palette2('neutral', 'b03');
20
- }, function (props) { return props.width; }, spacing(4), function (_a) {
21
- var hasSortKey = _a.hasSortKey;
22
- return hasSortKey && css(templateObject_6 || (templateObject_6 = __makeTemplateObject(["\n ", " {\n background-color: ", ";\n ", ";\n cursor: pointer;\n outline: none;\n }\n position: relative;\n ", ";\n "], ["\n ", " {\n background-color: ", ";\n ", ";\n cursor: pointer;\n outline: none;\n }\n position: relative;\n ", ";\n "])), focusWithin, palette2('neutral', 'b03'), fakeBorder(), focusVisibleShadowStyle());
23
- });
24
- var StyledTableHeadCellContent = styled.div(templateObject_8 || (templateObject_8 = __makeTemplateObject(["\n display: flex;\n align-items: center;\n\n flex-direction: ", ";\n padding-left: ", ";\n padding-right: ", ";\n"], ["\n display: flex;\n align-items: center;\n\n flex-direction: ",
25
- ";\n padding-left: ",
26
- ";\n padding-right: ",
27
- ";\n"])), function (_a) {
28
- var textAlign = _a.textAlign;
29
- return textAlign === COLUMN_TEXT_ALIGN.RIGHT ? 'row-reverse' : 'row';
30
- }, function (_a) {
31
- var textAlign = _a.textAlign;
32
- return textAlign === COLUMN_TEXT_ALIGN.RIGHT ? 0 : spacing(4);
33
- }, function (_a) {
34
- var textAlign = _a.textAlign;
35
- return textAlign === COLUMN_TEXT_ALIGN.RIGHT ? spacing(4) : 0;
36
- });
37
- export { TableWrapper, StyledTable, StyledTableRow, StyledSortIconWrapper, StyledTableHeadCell, StyledTableHeadText, StyledTableHeadCellContent, };
38
- var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5, templateObject_6, templateObject_7, templateObject_8;
@@ -1,41 +0,0 @@
1
- var TABLE_BORDER_TYPE;
2
- (function (TABLE_BORDER_TYPE) {
3
- TABLE_BORDER_TYPE["BORDERED"] = "table-bordered";
4
- TABLE_BORDER_TYPE["NONE"] = "";
5
- })(TABLE_BORDER_TYPE || (TABLE_BORDER_TYPE = {}));
6
- var TABLE_STICKY_TYPE;
7
- (function (TABLE_STICKY_TYPE) {
8
- TABLE_STICKY_TYPE["STICKY"] = "table-sticky";
9
- TABLE_STICKY_TYPE["NONE"] = "";
10
- })(TABLE_STICKY_TYPE || (TABLE_STICKY_TYPE = {}));
11
- var TABLE_TYPE;
12
- (function (TABLE_TYPE) {
13
- TABLE_TYPE["AUTO"] = "table-auto";
14
- TABLE_TYPE["MODAL"] = "table-modal";
15
- TABLE_TYPE["CARD"] = "table-card";
16
- TABLE_TYPE["FULL"] = "table-full";
17
- })(TABLE_TYPE || (TABLE_TYPE = {}));
18
- var COLUMN_TEXT_ALIGN;
19
- (function (COLUMN_TEXT_ALIGN) {
20
- COLUMN_TEXT_ALIGN["LEFT"] = "left";
21
- COLUMN_TEXT_ALIGN["RIGHT"] = "right";
22
- })(COLUMN_TEXT_ALIGN || (COLUMN_TEXT_ALIGN = {}));
23
- var ORDER_TABLE_BY;
24
- (function (ORDER_TABLE_BY) {
25
- ORDER_TABLE_BY[ORDER_TABLE_BY["ASC"] = 0] = "ASC";
26
- ORDER_TABLE_BY[ORDER_TABLE_BY["DESC"] = 1] = "DESC";
27
- ORDER_TABLE_BY[ORDER_TABLE_BY["NONE"] = 2] = "NONE";
28
- })(ORDER_TABLE_BY || (ORDER_TABLE_BY = {}));
29
- var ARIA_SORT_VALUES;
30
- (function (ARIA_SORT_VALUES) {
31
- ARIA_SORT_VALUES["ASC"] = "ascending";
32
- ARIA_SORT_VALUES["DESC"] = "descending";
33
- ARIA_SORT_VALUES["NONE"] = "none";
34
- ARIA_SORT_VALUES["OTHER"] = "other";
35
- })(ARIA_SORT_VALUES || (ARIA_SORT_VALUES = {}));
36
- var SORT_ICON_CLASS;
37
- (function (SORT_ICON_CLASS) {
38
- SORT_ICON_CLASS["SORT_UP"] = "icon-sort-up";
39
- SORT_ICON_CLASS["SORT_DOWN"] = "icon-sort-down";
40
- })(SORT_ICON_CLASS || (SORT_ICON_CLASS = {}));
41
- export { ARIA_SORT_VALUES, COLUMN_TEXT_ALIGN, ORDER_TABLE_BY, SORT_ICON_CLASS, TABLE_BORDER_TYPE, TABLE_STICKY_TYPE, TABLE_TYPE, };
@@ -1,19 +0,0 @@
1
- import { __assign, __makeTemplateObject } from "tslib";
2
- import React, { forwardRef } from 'react';
3
- import { Typography as MuiTypography } from '@material-ui/core';
4
- import { ellipsis, useDeprecatedLog } from '../../foundation';
5
- import styled from '../../foundation/styled-components';
6
- var _RcTextWithEllipsis = forwardRef(function (props, ref) {
7
- if (process.env.NODE_ENV !== 'production') {
8
- // eslint-disable-next-line react-hooks/rules-of-hooks
9
- useDeprecatedLog({
10
- component: 'RcTextWithEllipsis',
11
- message: 'should not use that, just use `RcText` with `titleWhenOverflow` and `flexFull`',
12
- });
13
- }
14
- return React.createElement(MuiTypography, __assign({}, props, { ref: ref }));
15
- });
16
- /** @deprecated should not use that, just use `RcText` with `titleWhenOverflow` and `flexFull` */
17
- var RcTextWithEllipsis = styled(_RcTextWithEllipsis)(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n ", ";\n flex: 1 1 auto;\n"], ["\n ", ";\n flex: 1 1 auto;\n"])), ellipsis());
18
- export { RcTextWithEllipsis };
19
- var templateObject_1;
@@ -1,18 +0,0 @@
1
- import { __assign, __makeTemplateObject } from "tslib";
2
- import React from 'react';
3
- import { palette2, useDeprecatedLog } from '../../foundation';
4
- import styled from '../../foundation/styled-components';
5
- var StyledSpan = styled.span(templateObject_1 || (templateObject_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"])), palette2('highlight', 'f01'), palette2('highlight', 'b02'));
6
- /** @deprecated should not use that, just use RcText with `highlight` */
7
- var RcTextWithHighlight = function (props) {
8
- if (process.env.NODE_ENV !== 'production') {
9
- // eslint-disable-next-line react-hooks/rules-of-hooks
10
- useDeprecatedLog({
11
- component: 'RcTextWithHighlight',
12
- message: 'should not use that, just use RcText with `highlight`',
13
- });
14
- }
15
- return React.createElement(StyledSpan, __assign({ className: "highlight-term" }, props));
16
- };
17
- export { RcTextWithHighlight };
18
- var templateObject_1;
@@ -1 +0,0 @@
1
- export * from './TextWithHighlight';
@@ -1,29 +0,0 @@
1
- import { __assign, __makeTemplateObject, __rest } from "tslib";
2
- import React, { memo } from 'react';
3
- import MuiTypography from '@material-ui/core/Typography';
4
- import { palette2, typography, useDeprecatedLog } from '../../foundation';
5
- import styled from '../../foundation/styled-components';
6
- import { RcLink } from '../Link';
7
- var TipsText = styled(MuiTypography)(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n && {\n color: ", ";\n ", ";\n * {\n ", ";\n }\n }\n"], ["\n && {\n color: ", ";\n ", ";\n * {\n ", ";\n }\n }\n"])), palette2('neutral', 'f04'), typography('caption1'), typography('caption1'));
8
- /** @deprecated please don't use that component, just use RcText and RcLink directly */
9
- var RcTextWithLink = memo(function (props) {
10
- if (process.env.NODE_ENV !== 'production') {
11
- // eslint-disable-next-line react-hooks/rules-of-hooks
12
- useDeprecatedLog({
13
- component: 'RcTextWithLink',
14
- message: "please don't use that component, just use `RcText` and RcLink directly",
15
- });
16
- }
17
- var text = props.text, linkText = props.linkText, onClick = props.onClick, TypographyProps = props.TypographyProps, RcLinkProps = props.RcLinkProps;
18
- var textProps;
19
- if (TypographyProps) {
20
- var innerRef = TypographyProps.innerRef, rest = __rest(TypographyProps, ["innerRef"]);
21
- textProps = rest;
22
- }
23
- return (React.createElement(TipsText, __assign({}, textProps),
24
- text,
25
- React.createElement(RcLink, __assign({ handleOnClick: onClick }, RcLinkProps), linkText)));
26
- });
27
- RcTextWithLink.displayName = 'RcTextWithLink';
28
- export { RcTextWithLink };
29
- var templateObject_1;
@@ -1 +0,0 @@
1
- export * from './TextWithLink';
@@ -1,33 +0,0 @@
1
- import { __makeTemplateObject, __read } from "tslib";
2
- import React, { useRef, useState } from 'react';
3
- import { getParsePaletteColor, palette2, styled, useDeprecatedLog, } from '../../foundation';
4
- var StyledText = styled.span(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n color: ", ";\n"], ["\n color: ",
5
- ";\n"])), function (_a) {
6
- var textColor = _a.textColor;
7
- return getParsePaletteColor(textColor, palette2('neutral', 'f06'));
8
- });
9
- /** @deprecated please don't use that component, just use `RcText` with `title` directly */
10
- var RcTextWithTooltip = function (props) {
11
- if (process.env.NODE_ENV !== 'production') {
12
- // eslint-disable-next-line react-hooks/rules-of-hooks
13
- useDeprecatedLog({
14
- component: 'RcTextWithTooltip',
15
- message: "please don't use that component, just use `RcText` with `title` directly",
16
- });
17
- }
18
- var tooltip = props.tooltip, children = props.children, _a = props.textColor, textColor = _a === void 0 ? ['neutral', 'f06'] : _a;
19
- var ref = useRef(null);
20
- var _b = __read(useState(false), 2), showTooltip = _b[0], setShowTooltip = _b[1];
21
- var onMouseOver = function () {
22
- var span = ref.current;
23
- if (span && span.parentElement) {
24
- var _a = span.parentElement, scrollHeight = _a.scrollHeight, scrollWidth = _a.scrollWidth, clientHeight = _a.clientHeight, clientWidth = _a.clientWidth;
25
- setShowTooltip(scrollWidth > clientWidth || scrollHeight > clientHeight);
26
- }
27
- };
28
- var toolTipText = typeof children === 'string' ? children : tooltip || '';
29
- return (React.createElement("span", { title: showTooltip ? toolTipText : '', onMouseOver: onMouseOver, ref: ref },
30
- React.createElement(StyledText, { textColor: textColor }, children)));
31
- };
32
- export { RcTextWithTooltip };
33
- var templateObject_1;
@@ -1 +0,0 @@
1
- export * from './TextWithTooltip';