@orfium/ictinus 4.6.1 → 4.7.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/dist/components/Table/Table.d.ts +2 -0
- package/dist/components/Table/components/RenderRowOrNestedRow/RenderRowOrNestedRow.js +5 -1
- package/dist/components/Table/components/RenderRowOrNestedRow/components/ContentCell/ContentCell.d.ts +1 -0
- package/dist/components/Table/components/RenderRowOrNestedRow/components/ContentCell/ContentCell.js +9 -2
- package/dist/components/TruncatedContent/TruncatedContent.d.ts +11 -0
- package/dist/components/TruncatedContent/TruncatedContent.js +69 -0
- package/dist/components/TruncatedContent/TruncatedContent.style.d.ts +4 -0
- package/dist/components/TruncatedContent/TruncatedContent.style.js +26 -0
- package/dist/components/TruncatedContent/index.d.ts +1 -0
- package/dist/components/TruncatedContent/index.js +10 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +5 -1
- package/package.json +1 -1
|
@@ -3,6 +3,8 @@ import { ExtendedColumn, Sort, SortingOrder } from './types';
|
|
|
3
3
|
export declare type ContentComponent<T> = (data: Cell<T>) => React.Component | JSX.Element;
|
|
4
4
|
export declare type Cell<T> = {
|
|
5
5
|
content: number | string | ContentComponent<T>;
|
|
6
|
+
tooltipContent?: string;
|
|
7
|
+
hasTruncatedTooltip?: boolean;
|
|
6
8
|
colSpan?: number;
|
|
7
9
|
type?: 'financial' | 'normal';
|
|
8
10
|
align?: 'left' | 'right';
|
|
@@ -86,16 +86,20 @@ var RenderRowWithCells = /*#__PURE__*/React.memo(function (_ref) {
|
|
|
86
86
|
onClick: tChange
|
|
87
87
|
}))), (_row$cells2 = row.cells) == null ? void 0 : _row$cells2.map(function (_ref2, index) {
|
|
88
88
|
var content = _ref2.content,
|
|
89
|
+
tooltipContent = _ref2.tooltipContent,
|
|
90
|
+
_ref2$hasTruncatedToo = _ref2.hasTruncatedTooltip,
|
|
91
|
+
hasTruncatedTooltip = _ref2$hasTruncatedToo === void 0 ? true : _ref2$hasTruncatedToo,
|
|
89
92
|
colSpan = _ref2.colSpan,
|
|
90
93
|
cellType = _ref2.type,
|
|
91
94
|
align = _ref2.align;
|
|
92
95
|
return (0, _react2.jsx)(_ContentCell["default"], {
|
|
93
96
|
key: row.id + "-" + index,
|
|
94
97
|
cellCounter: index,
|
|
98
|
+
columnWidth: columnsWithWidth[index],
|
|
95
99
|
columns: columns,
|
|
100
|
+
tooltipContent: hasTruncatedTooltip ? (0, _helpers.isComponentFunctionType)(content) ? tooltipContent : tooltipContent != null ? tooltipContent : content.toString() : undefined,
|
|
96
101
|
padded: padded,
|
|
97
102
|
colSpan: colSpan,
|
|
98
|
-
columnWidth: columnsWithWidth[index],
|
|
99
103
|
content: content,
|
|
100
104
|
cellType: cellType,
|
|
101
105
|
rowType: type,
|
package/dist/components/Table/components/RenderRowOrNestedRow/components/ContentCell/ContentCell.js
CHANGED
|
@@ -7,6 +7,8 @@ var _react = _interopRequireDefault(require("react"));
|
|
|
7
7
|
|
|
8
8
|
var _helpers = require("../../../../../../utils/helpers");
|
|
9
9
|
|
|
10
|
+
var _TruncatedContent = _interopRequireDefault(require("../../../../../TruncatedContent"));
|
|
11
|
+
|
|
10
12
|
var _TableCell = _interopRequireDefault(require("../../../TableCell"));
|
|
11
13
|
|
|
12
14
|
var _ContentCell = require("./ContentCell.style");
|
|
@@ -19,6 +21,7 @@ var ContentCell = function ContentCell(_ref) {
|
|
|
19
21
|
var columns = _ref.columns,
|
|
20
22
|
padded = _ref.padded,
|
|
21
23
|
columnWidth = _ref.columnWidth,
|
|
24
|
+
tooltipContent = _ref.tooltipContent,
|
|
22
25
|
content = _ref.content,
|
|
23
26
|
colSpan = _ref.colSpan,
|
|
24
27
|
rowType = _ref.rowType,
|
|
@@ -40,12 +43,16 @@ var ContentCell = function ContentCell(_ref) {
|
|
|
40
43
|
index: index
|
|
41
44
|
}, rowType === 'nested-header' && (0, _react2.jsx)("div", {
|
|
42
45
|
css: (0, _ContentCell.nestedHeaderStyle)()
|
|
43
|
-
}, columns[cellCounter]), (0,
|
|
46
|
+
}, columns[cellCounter]), (0, _react2.jsx)(_TruncatedContent["default"], {
|
|
47
|
+
placement: 'bottom',
|
|
48
|
+
shouldAlwaysShow: (0, _helpers.isComponentFunctionType)(content) && !!tooltipContent,
|
|
49
|
+
tooltipContent: tooltipContent
|
|
50
|
+
}, (0, _helpers.isComponentFunctionType)(content) ? content({
|
|
44
51
|
content: content,
|
|
45
52
|
colSpan: colSpan
|
|
46
53
|
}) : (0, _react2.jsx)("span", {
|
|
47
54
|
"data-column": columns[cellCounter]
|
|
48
|
-
}, content));
|
|
55
|
+
}, content)));
|
|
49
56
|
};
|
|
50
57
|
|
|
51
58
|
var _default = /*#__PURE__*/_react["default"].memo(ContentCell);
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
declare type Props = {
|
|
3
|
+
/** The content of the tooltip */
|
|
4
|
+
tooltipContent: string | undefined;
|
|
5
|
+
/** Flag for overriding other settings to always show the tooltip */
|
|
6
|
+
shouldAlwaysShow?: boolean;
|
|
7
|
+
/** The placement of the tooltip */
|
|
8
|
+
placement?: 'top' | 'bottom' | 'right' | 'left';
|
|
9
|
+
};
|
|
10
|
+
declare const TruncatedContent: React.FC<Props>;
|
|
11
|
+
export default TruncatedContent;
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
exports.__esModule = true;
|
|
4
|
+
exports["default"] = void 0;
|
|
5
|
+
|
|
6
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
7
|
+
|
|
8
|
+
var _TruncatedContent = require("./TruncatedContent.style");
|
|
9
|
+
|
|
10
|
+
var _Tooltip = _interopRequireDefault(require("../Tooltip"));
|
|
11
|
+
|
|
12
|
+
var _react2 = require("@emotion/react");
|
|
13
|
+
|
|
14
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
15
|
+
|
|
16
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
17
|
+
|
|
18
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
19
|
+
|
|
20
|
+
var TruncatedContent = function TruncatedContent(_ref) {
|
|
21
|
+
var children = _ref.children,
|
|
22
|
+
_ref$shouldAlwaysShow = _ref.shouldAlwaysShow,
|
|
23
|
+
shouldAlwaysShow = _ref$shouldAlwaysShow === void 0 ? false : _ref$shouldAlwaysShow,
|
|
24
|
+
tooltipContent = _ref.tooltipContent,
|
|
25
|
+
_ref$placement = _ref.placement,
|
|
26
|
+
placement = _ref$placement === void 0 ? 'bottom' : _ref$placement;
|
|
27
|
+
|
|
28
|
+
var _useState = (0, _react.useState)(false),
|
|
29
|
+
isHovered = _useState[0],
|
|
30
|
+
setIsHovered = _useState[1];
|
|
31
|
+
|
|
32
|
+
var targetRef = (0, _react.useRef)(null);
|
|
33
|
+
var target = targetRef.current;
|
|
34
|
+
var handleMouseEnter = (0, _react.useCallback)(function () {
|
|
35
|
+
setIsHovered(true);
|
|
36
|
+
}, []);
|
|
37
|
+
var handleMouseLeave = (0, _react.useCallback)(function () {
|
|
38
|
+
setIsHovered(false);
|
|
39
|
+
}, []);
|
|
40
|
+
var isTruncated = (0, _react.useMemo)(function () {
|
|
41
|
+
return !!target && target.scrollWidth > target.offsetWidth;
|
|
42
|
+
}, [target]);
|
|
43
|
+
var showTooltip = (0, _react.useCallback)(function (tooltipContent, isHovered, isTruncated, shouldAlwaysShow) {
|
|
44
|
+
if (tooltipContent === undefined) {
|
|
45
|
+
return false;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
if (shouldAlwaysShow) {
|
|
49
|
+
return true;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
return isHovered && isTruncated;
|
|
53
|
+
}, []);
|
|
54
|
+
return showTooltip(tooltipContent, isHovered, isTruncated, shouldAlwaysShow) ? (0, _react2.jsx)(_Tooltip["default"], {
|
|
55
|
+
placement: placement,
|
|
56
|
+
content: tooltipContent
|
|
57
|
+
}, (0, _react2.jsx)(_TruncatedContent.TruncationDiv, {
|
|
58
|
+
ref: targetRef,
|
|
59
|
+
onMouseEnter: handleMouseEnter,
|
|
60
|
+
onMouseLeave: handleMouseLeave
|
|
61
|
+
}, children)) : (0, _react2.jsx)(_TruncatedContent.TruncationDiv, {
|
|
62
|
+
ref: targetRef,
|
|
63
|
+
onMouseEnter: handleMouseEnter,
|
|
64
|
+
onMouseLeave: handleMouseLeave
|
|
65
|
+
}, children);
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
var _default = TruncatedContent;
|
|
69
|
+
exports["default"] = _default;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export declare const TruncationDiv: import("@emotion/styled").StyledComponent<{
|
|
2
|
+
theme?: import("@emotion/react").Theme | undefined;
|
|
3
|
+
as?: import("react").ElementType<any> | undefined;
|
|
4
|
+
}, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
exports.__esModule = true;
|
|
4
|
+
exports.TruncationDiv = void 0;
|
|
5
|
+
|
|
6
|
+
var _base = _interopRequireDefault(require("@emotion/styled/base"));
|
|
7
|
+
|
|
8
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
9
|
+
|
|
10
|
+
function _EMOTION_STRINGIFIED_CSS_ERROR__() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; }
|
|
11
|
+
|
|
12
|
+
var TruncationDiv = (0, _base["default"])("div", process.env.NODE_ENV === "production" ? {
|
|
13
|
+
target: "ep8j7z50"
|
|
14
|
+
} : {
|
|
15
|
+
target: "ep8j7z50",
|
|
16
|
+
label: "TruncationDiv"
|
|
17
|
+
})(process.env.NODE_ENV === "production" ? {
|
|
18
|
+
name: "1h52dri",
|
|
19
|
+
styles: "overflow:hidden;text-overflow:ellipsis;white-space:nowrap"
|
|
20
|
+
} : {
|
|
21
|
+
name: "1h52dri",
|
|
22
|
+
styles: "overflow:hidden;text-overflow:ellipsis;white-space:nowrap",
|
|
23
|
+
map: "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uLy4uL3NyYy9jb21wb25lbnRzL1RydW5jYXRlZENvbnRlbnQvVHJ1bmNhdGVkQ29udGVudC5zdHlsZS50c3giXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBRXVDIiwiZmlsZSI6Ii4uLy4uLy4uL3NyYy9jb21wb25lbnRzL1RydW5jYXRlZENvbnRlbnQvVHJ1bmNhdGVkQ29udGVudC5zdHlsZS50c3giLCJzb3VyY2VzQ29udGVudCI6WyJpbXBvcnQgc3R5bGVkIGZyb20gJ0BlbW90aW9uL3N0eWxlZCc7XG5cbmV4cG9ydCBjb25zdCBUcnVuY2F0aW9uRGl2ID0gc3R5bGVkLmRpdmBcbiAgb3ZlcmZsb3c6IGhpZGRlbjtcbiAgdGV4dC1vdmVyZmxvdzogZWxsaXBzaXM7XG4gIHdoaXRlLXNwYWNlOiBub3dyYXA7XG5gO1xuIl19 */",
|
|
24
|
+
toString: _EMOTION_STRINGIFIED_CSS_ERROR__
|
|
25
|
+
});
|
|
26
|
+
exports.TruncationDiv = TruncationDiv;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './TruncatedContent';
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
exports.__esModule = true;
|
|
4
|
+
exports["default"] = void 0;
|
|
5
|
+
|
|
6
|
+
var _TruncatedContent = _interopRequireDefault(require("./TruncatedContent"));
|
|
7
|
+
|
|
8
|
+
exports["default"] = _TruncatedContent["default"];
|
|
9
|
+
|
|
10
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
package/dist/index.d.ts
CHANGED
|
@@ -52,5 +52,6 @@ export { default as useTheme } from './hooks/useTheme';
|
|
|
52
52
|
export { default as useBreakpoints } from './hooks/useBreakpoints';
|
|
53
53
|
export { default as useEscape } from './hooks/useEscape';
|
|
54
54
|
export { default as Filter } from './components/Filter';
|
|
55
|
+
export { default as TruncatedContent } from './components/TruncatedContent';
|
|
55
56
|
export { default as themeConfig } from './theme';
|
|
56
57
|
export { themeFunctions, palette, spacing, typography, elevation, overrides, queriesSizes, };
|
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
exports.__esModule = true;
|
|
4
|
-
exports.typography = exports.spacing = exports.palette = exports.overrides = exports.themeFunctions = exports.elevation = exports.themeConfig = exports.Filter = exports.useEscape = exports.useBreakpoints = exports.useTheme = exports.TopNavBar = exports.Tooltip = exports.Toast = exports.ThemeProvider = exports.TextArea = exports.SearchField = exports.TextField = exports.Table = exports.Select = exports.RadioGroup = exports.Radio = exports.Pagination = exports.Snackbar = exports.Banner = exports.NotificationVisual = exports.NotificationsContainer = exports.InlineNotification = exports.Modal = exports.Menu = exports.Loader = exports.List = exports.Label = exports.IconButton = exports.Icon = exports.ExpandCollapse = exports.Drawer = exports.DatePicker = exports.Chip = exports.CheckBox = exports.DonutChart = exports.BarChart = exports.LineChart = exports.Card = exports.Button = exports.Breadcrumb = exports.Avatar = void 0;
|
|
4
|
+
exports.typography = exports.spacing = exports.palette = exports.overrides = exports.themeFunctions = exports.elevation = exports.themeConfig = exports.TruncatedContent = exports.Filter = exports.useEscape = exports.useBreakpoints = exports.useTheme = exports.TopNavBar = exports.Tooltip = exports.Toast = exports.ThemeProvider = exports.TextArea = exports.SearchField = exports.TextField = exports.Table = exports.Select = exports.RadioGroup = exports.Radio = exports.Pagination = exports.Snackbar = exports.Banner = exports.NotificationVisual = exports.NotificationsContainer = exports.InlineNotification = exports.Modal = exports.Menu = exports.Loader = exports.List = exports.Label = exports.IconButton = exports.Icon = exports.ExpandCollapse = exports.Drawer = exports.DatePicker = exports.Chip = exports.CheckBox = exports.DonutChart = exports.BarChart = exports.LineChart = exports.Card = exports.Button = exports.Breadcrumb = exports.Avatar = void 0;
|
|
5
5
|
|
|
6
6
|
var _useBreakpoints = _interopRequireWildcard(require("./hooks/useBreakpoints"));
|
|
7
7
|
|
|
@@ -188,6 +188,10 @@ var _Filter = _interopRequireDefault(require("./components/Filter"));
|
|
|
188
188
|
|
|
189
189
|
exports.Filter = _Filter["default"];
|
|
190
190
|
|
|
191
|
+
var _TruncatedContent = _interopRequireDefault(require("./components/TruncatedContent"));
|
|
192
|
+
|
|
193
|
+
exports.TruncatedContent = _TruncatedContent["default"];
|
|
194
|
+
|
|
191
195
|
var _theme = _interopRequireDefault(require("./theme"));
|
|
192
196
|
|
|
193
197
|
exports.themeConfig = _theme["default"];
|