@semcore/ellipsis 16.0.5 → 16.0.6-prerelease.2
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/CHANGELOG.md +7 -0
- package/lib/cjs/Ellipsis.js +56 -74
- package/lib/cjs/Ellipsis.js.map +1 -1
- package/lib/cjs/index.d.js.map +1 -1
- package/lib/cjs/style/ellipsis.shadow.css +8 -8
- package/lib/es6/Ellipsis.js +55 -73
- package/lib/es6/Ellipsis.js.map +1 -1
- package/lib/es6/index.d.js.map +1 -1
- package/lib/es6/style/ellipsis.shadow.css +8 -8
- package/lib/esm/Ellipsis.mjs +53 -70
- package/lib/esm/style/ellipsis.shadow.css +8 -8
- package/lib/types/index.d.ts +2 -1
- package/package.json +4 -4
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,13 @@
|
|
|
2
2
|
|
|
3
3
|
CHANGELOG.md standards are inspired by [keepachangelog.com](https://keepachangelog.com/en/1.0.0/).
|
|
4
4
|
|
|
5
|
+
## [16.0.6] - 2025-08-08
|
|
6
|
+
|
|
7
|
+
### Fixed
|
|
8
|
+
|
|
9
|
+
- Ellipsis with `trim=middle` cut off text at the end.
|
|
10
|
+
- Incorrect cropping with different font-size.
|
|
11
|
+
|
|
5
12
|
## [16.0.5] - 2025-07-23
|
|
6
13
|
|
|
7
14
|
### Changed
|
package/lib/cjs/Ellipsis.js
CHANGED
|
@@ -22,30 +22,37 @@ var _findComponent = _interopRequireWildcard(require("@semcore/core/lib/utils/fi
|
|
|
22
22
|
var _getOriginChildren = _interopRequireDefault(require("@semcore/core/lib/utils/getOriginChildren"));
|
|
23
23
|
var _pick = _interopRequireDefault(require("@semcore/core/lib/utils/pick"));
|
|
24
24
|
var _reactToText = _interopRequireDefault(require("@semcore/core/lib/utils/reactToText"));
|
|
25
|
-
var
|
|
25
|
+
var _ref9 = require("@semcore/core/lib/utils/ref");
|
|
26
26
|
var _useEnhancedEffect = _interopRequireDefault(require("@semcore/core/lib/utils/use/useEnhancedEffect"));
|
|
27
27
|
var _flexBox = require("@semcore/flex-box");
|
|
28
28
|
var _tooltip = _interopRequireDefault(require("@semcore/tooltip"));
|
|
29
29
|
var _react = _interopRequireDefault(require("react"));
|
|
30
30
|
var _useResizeObserver = require("./useResizeObserver");
|
|
31
|
-
var _excluded = ["styles", "Children", "maxLine", "tooltip", "trim", "containerRect", "containerRef", "includeTooltipProps", "children"]
|
|
32
|
-
_excluded2 = ["styles", "text", "tooltip", "containerRect", "containerRef", "textRef", "tooltipProps", "children", "advanceMode"];
|
|
31
|
+
var _excluded = ["styles", "Children", "maxLine", "tooltip", "trim", "containerRect", "containerRef", "includeTooltipProps", "children"];
|
|
33
32
|
function _callSuper(t, o, e) { return o = (0, _getPrototypeOf2["default"])(o), (0, _possibleConstructorReturn2["default"])(t, (0, _isNativeReflectConstruct2["default"])() ? Reflect.construct(o, e || [], (0, _getPrototypeOf2["default"])(t).constructor) : o.apply(t, e)); }
|
|
34
33
|
/*!__reshadow-styles__:"./style/ellipsis.shadow.css"*/
|
|
35
|
-
var style = (/*__reshadow_css_start__*/_core.sstyled.insert(/*__inner_css_start__*/".
|
|
34
|
+
var style = (/*__reshadow_css_start__*/_core.sstyled.insert(/*__inner_css_start__*/".___SBeginning_yog1u_gg_,.___SEllipsis_yog1u_gg_{overflow:hidden;display:inline-block;text-overflow:ellipsis;white-space:pre}.___SEllipsis_yog1u_gg_.__maxLine_yog1u_gg_{display:-webkit-box;-webkit-line-clamp:var(--maxLine_yog1u);-webkit-box-orient:vertical;overflow:hidden;white-space:normal;word-wrap:break-word}.___SContainerMiddle_yog1u_gg_,.___SContainer_yog1u_gg_,.___SEllipsis_yog1u_gg_.__middle-mod_yog1u_gg_,.___SNoTooltipContainer_yog1u_gg_{display:flex;overflow:hidden}.___SContainerMiddle_yog1u_gg_>:has(.___SBeginning_yog1u_gg_),.___SContainerMiddle_yog1u_gg_>:has(.___STail_yog1u_gg_){display:flex;width:100%}.___STail_yog1u_gg_{white-space:pre}", /*__inner_css_end__*/"yog1u_gg_"),
|
|
36
35
|
/*__reshadow_css_end__*/
|
|
37
36
|
{
|
|
38
|
-
"
|
|
39
|
-
"
|
|
40
|
-
"
|
|
41
|
-
"
|
|
42
|
-
"
|
|
43
|
-
"
|
|
44
|
-
"
|
|
45
|
-
"
|
|
46
|
-
"__STail": "
|
|
37
|
+
"__SBeginning": "___SBeginning_yog1u_gg_",
|
|
38
|
+
"__SEllipsis": "___SEllipsis_yog1u_gg_",
|
|
39
|
+
"__SContainer": "___SContainer_yog1u_gg_",
|
|
40
|
+
"__SNoTooltipContainer": "___SNoTooltipContainer_yog1u_gg_",
|
|
41
|
+
"__SContainerMiddle": "___SContainerMiddle_yog1u_gg_",
|
|
42
|
+
"_maxLine": "__maxLine_yog1u_gg_",
|
|
43
|
+
"--maxLine": "--maxLine_yog1u",
|
|
44
|
+
"_middle-mod": "__middle-mod_yog1u_gg_",
|
|
45
|
+
"__STail": "___STail_yog1u_gg_"
|
|
47
46
|
});
|
|
48
47
|
var defaultTooltipProps = ['title', 'theme', 'strategy', 'modifiers', 'placement', 'interaction', 'timeout', 'visible', 'defaultVisible', 'onVisibleChange', 'offset', 'preventOverflow', 'arrow', 'flip', 'computeStyles', 'eventListeners', 'onFirstUpdate', 'cursorAnchoring'];
|
|
48
|
+
var setFontSettings = function setFontSettings(element, styleElement) {
|
|
49
|
+
element.style.fontFamily = styleElement.getPropertyValue('font-family');
|
|
50
|
+
element.style.fontSize = styleElement.getPropertyValue('font-size');
|
|
51
|
+
element.style.fontWeight = styleElement.getPropertyValue('font-weight');
|
|
52
|
+
element.style.lineHeight = styleElement.getPropertyValue('line-height');
|
|
53
|
+
element.style.fontFeatureSettings = styleElement.getPropertyValue('font-feature-settings');
|
|
54
|
+
element.style.fontVariantNumeric = styleElement.getPropertyValue('font-variant-numeric');
|
|
55
|
+
};
|
|
49
56
|
var createMeasurerElement = function createMeasurerElement(element, text) {
|
|
50
57
|
var styleElement = window.getComputedStyle(element, null);
|
|
51
58
|
var temporaryElement = document.createElement('temporary-block');
|
|
@@ -55,14 +62,9 @@ var createMeasurerElement = function createMeasurerElement(element, text) {
|
|
|
55
62
|
temporaryElement.style.right = '0%';
|
|
56
63
|
temporaryElement.style.bottom = '0%';
|
|
57
64
|
temporaryElement.style.visibility = 'hidden';
|
|
58
|
-
temporaryElement.style.fontFamily = styleElement.getPropertyValue('font-family');
|
|
59
|
-
temporaryElement.style.fontSize = styleElement.getPropertyValue('font-size');
|
|
60
|
-
temporaryElement.style.fontWeight = styleElement.getPropertyValue('font-weight');
|
|
61
|
-
temporaryElement.style.lineHeight = styleElement.getPropertyValue('line-height');
|
|
62
65
|
temporaryElement.style.whiteSpace = styleElement.getPropertyValue('white-space');
|
|
63
66
|
temporaryElement.style.wordWrap = styleElement.getPropertyValue('word-wrap');
|
|
64
|
-
temporaryElement
|
|
65
|
-
temporaryElement.style.fontVariantNumeric = styleElement.getPropertyValue('font-variant-numeric');
|
|
67
|
+
setFontSettings(temporaryElement, styleElement);
|
|
66
68
|
temporaryElement.innerHTML = text !== null && text !== void 0 ? text : element.innerHTML;
|
|
67
69
|
return temporaryElement;
|
|
68
70
|
};
|
|
@@ -145,10 +147,9 @@ var RootEllipsis = /*#__PURE__*/function (_Component) {
|
|
|
145
147
|
}, {
|
|
146
148
|
key: "render",
|
|
147
149
|
value: function render() {
|
|
148
|
-
var
|
|
150
|
+
var _ref3, _tooltipProps$visible;
|
|
149
151
|
var SEllipsis = this.Root;
|
|
150
152
|
var SContainer = _tooltip["default"];
|
|
151
|
-
var SNoTooltipContainer = _flexBox.Box;
|
|
152
153
|
var _this$asProps3 = this.asProps,
|
|
153
154
|
styles = _this$asProps3.styles,
|
|
154
155
|
Children = _this$asProps3.Children,
|
|
@@ -180,22 +181,14 @@ var RootEllipsis = /*#__PURE__*/function (_Component) {
|
|
|
180
181
|
"advanceMode": advanceMode
|
|
181
182
|
}, other)), /*#__PURE__*/_react["default"].createElement(Children, _ref2.cn("Children", {})));
|
|
182
183
|
}
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
"title": !advanceMode ? text : undefined
|
|
188
|
-
}, tooltipProps), advanceMode ? forcedAdvancedMode : noAdvancedMode)), advanceMode ? /*#__PURE__*/_react["default"].createElement(Children, _ref3.cn("Children", {})) : /*#__PURE__*/_react["default"].createElement(SEllipsis, _ref3.cn("SEllipsis", (0, _objectSpread2["default"])({
|
|
189
|
-
"render": _flexBox.Box,
|
|
190
|
-
"ref": this.textRef,
|
|
191
|
-
"maxLine": maxLine
|
|
192
|
-
}, other)), /*#__PURE__*/_react["default"].createElement(Children, _ref3.cn("Children", {}))));
|
|
193
|
-
}
|
|
194
|
-
return _ref4 = (0, _core.sstyled)(styles), /*#__PURE__*/_react["default"].createElement(SNoTooltipContainer, _ref4.cn("SNoTooltipContainer", {}), advanceMode ? /*#__PURE__*/_react["default"].createElement(Children, _ref4.cn("Children", {})) : /*#__PURE__*/_react["default"].createElement(SEllipsis, _ref4.cn("SEllipsis", (0, _objectSpread2["default"])({
|
|
184
|
+
return _ref3 = (0, _core.sstyled)(styles), /*#__PURE__*/_react["default"].createElement(SContainer, _ref3.cn("SContainer", (0, _objectSpread2["default"])((0, _objectSpread2["default"])({
|
|
185
|
+
"interaction": tooltip ? 'hover' : 'none',
|
|
186
|
+
"title": !advanceMode ? text : undefined
|
|
187
|
+
}, tooltipProps), advanceMode ? forcedAdvancedMode : noAdvancedMode)), advanceMode ? /*#__PURE__*/_react["default"].createElement(Children, _ref3.cn("Children", {})) : /*#__PURE__*/_react["default"].createElement(SEllipsis, _ref3.cn("SEllipsis", (0, _objectSpread2["default"])({
|
|
195
188
|
"render": _flexBox.Box,
|
|
196
189
|
"ref": this.textRef,
|
|
197
190
|
"maxLine": maxLine
|
|
198
|
-
}, other)), /*#__PURE__*/_react["default"].createElement(Children,
|
|
191
|
+
}, other)), /*#__PURE__*/_react["default"].createElement(Children, _ref3.cn("Children", {}))));
|
|
199
192
|
}
|
|
200
193
|
}]);
|
|
201
194
|
}(_core.Component);
|
|
@@ -209,7 +202,7 @@ var RootEllipsis = /*#__PURE__*/function (_Component) {
|
|
|
209
202
|
});
|
|
210
203
|
var EllipsisMiddleContext = /*#__PURE__*/_react["default"].createContext(null);
|
|
211
204
|
var EllipsisMiddle = function EllipsisMiddle(props) {
|
|
212
|
-
var
|
|
205
|
+
var _ref5;
|
|
213
206
|
var styles = props.styles,
|
|
214
207
|
text = props.text,
|
|
215
208
|
tooltip = props.tooltip,
|
|
@@ -219,37 +212,33 @@ var EllipsisMiddle = function EllipsisMiddle(props) {
|
|
|
219
212
|
tooltipProps = props.tooltipProps,
|
|
220
213
|
children = props.children,
|
|
221
214
|
advanceMode = props.advanceMode,
|
|
222
|
-
|
|
215
|
+
tag = props.tag;
|
|
223
216
|
var resizeElement = _react["default"].useRef(null);
|
|
224
|
-
var _React$useState = _react["default"].useState(
|
|
225
|
-
fontSize: '14',
|
|
226
|
-
symbolWidth: 0
|
|
227
|
-
}),
|
|
217
|
+
var _React$useState = _react["default"].useState(0),
|
|
228
218
|
_React$useState2 = (0, _slicedToArray2["default"])(_React$useState, 2),
|
|
229
|
-
|
|
230
|
-
|
|
219
|
+
symbolWidth = _React$useState2[0],
|
|
220
|
+
setSymbolWidth = _React$useState2[1];
|
|
231
221
|
var blockWidth = (0, _useResizeObserver.useResizeObserver)(resizeElement, containerRect).width;
|
|
232
222
|
(0, _useEnhancedEffect["default"])(function () {
|
|
233
223
|
var node = (containerRef === null || containerRef === void 0 ? void 0 : containerRef.current) || (resizeElement === null || resizeElement === void 0 ? void 0 : resizeElement.current);
|
|
234
224
|
if (!node) return;
|
|
225
|
+
var styleElement = window.getComputedStyle(node);
|
|
235
226
|
var dateSpan = document.createElement('temporary-block');
|
|
236
|
-
dateSpan
|
|
227
|
+
setFontSettings(dateSpan, styleElement);
|
|
237
228
|
dateSpan.innerHTML = 'a';
|
|
238
229
|
document.body.appendChild(dateSpan);
|
|
239
230
|
var rect = dateSpan.getBoundingClientRect();
|
|
240
|
-
|
|
241
|
-
fontSize: window.getComputedStyle(node, null).getPropertyValue('font-size'),
|
|
242
|
-
symbolWidth: rect.width
|
|
243
|
-
});
|
|
231
|
+
setSymbolWidth(rect.width);
|
|
244
232
|
document.body.removeChild(dateSpan);
|
|
245
233
|
}, []);
|
|
246
234
|
var STail = 'span';
|
|
247
235
|
var SBeginning = 'span';
|
|
248
|
-
var SContainerMiddle =
|
|
236
|
+
var SContainerMiddle = _tooltip["default"];
|
|
249
237
|
var SAdvancedModeContainerMiddle = _tooltip["default"];
|
|
250
238
|
var displayedSymbols = _react["default"].useMemo(function () {
|
|
251
|
-
|
|
252
|
-
|
|
239
|
+
var displayedSymbols = Math.round(blockWidth / symbolWidth);
|
|
240
|
+
return displayedSymbols % 2 === 0 ? displayedSymbols : displayedSymbols - 1;
|
|
241
|
+
}, [blockWidth, symbolWidth]);
|
|
253
242
|
var interaction = text.length > displayedSymbols ? 'hover' : 'none';
|
|
254
243
|
var ref = containerRef !== null && containerRef !== void 0 ? containerRef : resizeElement;
|
|
255
244
|
var contextValue = _react["default"].useMemo(function () {
|
|
@@ -260,47 +249,40 @@ var EllipsisMiddle = function EllipsisMiddle(props) {
|
|
|
260
249
|
};
|
|
261
250
|
}, [text, displayedSymbols]);
|
|
262
251
|
if (advanceMode) {
|
|
263
|
-
var
|
|
264
|
-
return
|
|
265
|
-
"interaction": interaction
|
|
252
|
+
var _ref4;
|
|
253
|
+
return _ref4 = (0, _core.sstyled)(styles), /*#__PURE__*/_react["default"].createElement(SAdvancedModeContainerMiddle, _ref4.cn("SAdvancedModeContainerMiddle", (0, _objectSpread2["default"])((0, _objectSpread2["default"])({
|
|
254
|
+
"interaction": tooltip ? interaction : 'none'
|
|
266
255
|
}, tooltipProps), forcedAdvancedMode)), /*#__PURE__*/_react["default"].createElement(EllipsisMiddleContext.Provider, {
|
|
267
256
|
value: contextValue
|
|
268
257
|
}, children));
|
|
269
258
|
}
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
"tag": _tooltip["default"],
|
|
277
|
-
"__excludeProps": ['title']
|
|
278
|
-
}, tooltipProps)), /*#__PURE__*/_react["default"].createElement(SBeginning, _ref6.cn("SBeginning", {}), contextValue.begining), /*#__PURE__*/_react["default"].createElement(STail, _ref6.cn("STail", {}), contextValue.tail));
|
|
279
|
-
}
|
|
280
|
-
return _ref7 = (0, _core.sstyled)(styles), /*#__PURE__*/_react["default"].createElement(SContainerMiddle, _ref7.cn("SContainerMiddle", (0, _objectSpread2["default"])((0, _objectSpread2["default"])({}, otherProps), {}, {
|
|
281
|
-
"ref": containerRef !== null && containerRef !== void 0 ? containerRef : resizeElement
|
|
282
|
-
})), /*#__PURE__*/_react["default"].createElement(SBeginning, _ref7.cn("SBeginning", {}), contextValue.begining), /*#__PURE__*/_react["default"].createElement(STail, _ref7.cn("STail", {}), contextValue.tail));
|
|
259
|
+
return _ref5 = (0, _core.sstyled)(styles), /*#__PURE__*/_react["default"].createElement(SContainerMiddle, _ref5.cn("SContainerMiddle", (0, _objectSpread2["default"])({
|
|
260
|
+
"interaction": tooltip ? interaction : 'none',
|
|
261
|
+
"title": text,
|
|
262
|
+
"ref": (0, _ref9.forkRef)(ref, textRef),
|
|
263
|
+
"tag": tag
|
|
264
|
+
}, tooltipProps)), /*#__PURE__*/_react["default"].createElement(SBeginning, _ref5.cn("SBeginning", {}), contextValue.begining), /*#__PURE__*/_react["default"].createElement(STail, _ref5.cn("STail", {}), contextValue.tail));
|
|
283
265
|
};
|
|
284
|
-
var Content = function Content(
|
|
266
|
+
var Content = function Content(_ref8) {
|
|
285
267
|
var _ref = arguments[0],
|
|
286
|
-
|
|
287
|
-
var styles =
|
|
288
|
-
Children =
|
|
268
|
+
_ref7;
|
|
269
|
+
var styles = _ref8.styles,
|
|
270
|
+
Children = _ref8.Children;
|
|
289
271
|
var SEllipsis = _tooltip["default"].Trigger;
|
|
290
272
|
var ellipsisMiddleContext = _react["default"].useContext(EllipsisMiddleContext);
|
|
291
273
|
var STail = 'span';
|
|
292
274
|
var SBeginning = 'span';
|
|
293
275
|
if (ellipsisMiddleContext) {
|
|
294
|
-
var
|
|
276
|
+
var _ref6;
|
|
295
277
|
var begining = ellipsisMiddleContext.begining,
|
|
296
278
|
tail = ellipsisMiddleContext.tail,
|
|
297
279
|
ref = ellipsisMiddleContext.ref;
|
|
298
|
-
return
|
|
280
|
+
return _ref6 = (0, _core.sstyled)(styles), /*#__PURE__*/_react["default"].createElement(SEllipsis, _ref6.cn("SEllipsis", (0, _objectSpread2["default"])({}, (0, _core.assignProps)({
|
|
299
281
|
"middle-mod": true,
|
|
300
282
|
"ref": ref
|
|
301
|
-
}, _ref))), /*#__PURE__*/_react["default"].createElement(SBeginning,
|
|
283
|
+
}, _ref))), /*#__PURE__*/_react["default"].createElement(SBeginning, _ref6.cn("SBeginning", {}), begining), /*#__PURE__*/_react["default"].createElement(STail, _ref6.cn("STail", {}), tail));
|
|
302
284
|
}
|
|
303
|
-
return
|
|
285
|
+
return _ref7 = (0, _core.sstyled)(styles), /*#__PURE__*/_react["default"].createElement(SEllipsis, _ref7.cn("SEllipsis", (0, _objectSpread2["default"])({}, (0, _core.assignProps)({}, _ref))), /*#__PURE__*/_react["default"].createElement(Children, _ref7.cn("Children", {})));
|
|
304
286
|
};
|
|
305
287
|
var Ellipsis = (0, _core.createComponent)(RootEllipsis, {
|
|
306
288
|
Content: Content,
|
package/lib/cjs/Ellipsis.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Ellipsis.js","names":["_core","require","_assignProps3","_findComponent","_interopRequireWildcard","_getOriginChildren","_interopRequireDefault","_pick","_reactToText","_ref1","_useEnhancedEffect","_flexBox","_tooltip","_react","_useResizeObserver","_excluded","_excluded2","_callSuper","t","o","e","_getPrototypeOf2","_possibleConstructorReturn2","_isNativeReflectConstruct2","Reflect","construct","constructor","apply","style","sstyled","insert","defaultTooltipProps","createMeasurerElement","element","text","styleElement","window","getComputedStyle","temporaryElement","document","createElement","display","getPropertyValue","padding","position","right","bottom","visibility","fontFamily","fontSize","fontWeight","lineHeight","whiteSpace","wordWrap","fontFeatureSettings","fontVariantNumeric","innerHTML","isTextOverflowing","multiline","_element$getBoundingC","getBoundingClientRect","currentHeight","height","currentWidth","width","measuringElement","isOverflowing","body","appendChild","concat","scrollWidth","Math","ceil","removeChild","forcedAdvancedMode","noAdvancedMode","RootEllipsis","_Component","_this","_classCallCheck2","_len","arguments","length","args","Array","_key","_defineProperty2","visible","React","createRef","setState","showTooltip","_inherits2","_createClass2","key","value","_this$asProps","asProps","_this$asProps$maxLine","maxLine","Children","reactToText","getOriginChildren","textRef","current","getContentProps","ref","getPopperProps","_this$asProps2","includeTooltipProps","tooltipProps","pick","_objectSpread2","children","render","_ref4","_tooltipProps$visible","SEllipsis","Root","SContainer","Tooltip","SNoTooltipContainer","Box","_this$asProps3","styles","tooltip","trim","containerRect","containerRef","_children","other","_objectWithoutProperties2","state","advancedContent","findComponent","Ellipsis","Content","displayName","advanceMode","isAdvanceMode","Popper","onVisibleChange","callAllEventHandlers","handlerVisibleChange","_ref2","EllipsisMiddle","cn","_ref3","undefined","Component","__excludeProps","EllipsisMiddleContext","createContext","props","_ref7","otherProps","resizeElement","useRef","_React$useState","useState","symbolWidth","_React$useState2","_slicedToArray2","dimension","setDimension","blockWidth","useResizeObserver","useEnhancedEffect","node","dateSpan","setAttribute","rect","STail","SBeginning","SContainerMiddle","tag","SAdvancedModeContainerMiddle","displayedSymbols","useMemo","round","interaction","contextValue","begining","substring","tail","_ref5","Provider","_ref6","forkRef","_ref0","_ref","arguments[0]","_ref9","Trigger","ellipsisMiddleContext","useContext","_ref8","assignProps","createComponent","_default","exports"],"sources":["../../src/Ellipsis.tsx"],"sourcesContent":["import { createComponent, Component, type Intergalactic, Root, sstyled } from '@semcore/core';\nimport { callAllEventHandlers } from '@semcore/core/lib/utils/assignProps';\nimport findComponent, { isAdvanceMode } from '@semcore/core/lib/utils/findComponent';\nimport getOriginChildren from '@semcore/core/lib/utils/getOriginChildren';\nimport pick from '@semcore/core/lib/utils/pick';\nimport reactToText from '@semcore/core/lib/utils/reactToText';\nimport { forkRef } from '@semcore/core/lib/utils/ref';\nimport useEnhancedEffect from '@semcore/core/lib/utils/use/useEnhancedEffect';\nimport { Box, type BoxProps } from '@semcore/flex-box';\nimport Tooltip, { type TooltipProps } from '@semcore/tooltip';\nimport React, { type RefObject } from 'react';\n\nimport style from './style/ellipsis.shadow.css';\nimport { useResizeObserver } from './useResizeObserver';\n\ntype AsProps = {\n maxLine?: number;\n trim?: 'end' | 'middle';\n tooltip?: boolean;\n styles?: React.CSSProperties;\n containerRect?: { width: number };\n\n containerRef?: RefObject<HTMLDivElement>;\n includeTooltipProps?: string[];\n __excludeProps?: string[];\n};\n\ntype AsPropsMiddle = {\n text: string;\n textRef: RefObject<HTMLElement>;\n tooltip?: boolean;\n styles?: React.CSSProperties;\n containerRect?: { width: number };\n\n containerRef?: RefObject<HTMLDivElement>;\n tooltipProps: TooltipProps;\n children?: React.ReactNode;\n advanceMode?: boolean;\n tag?: React.ElementType;\n};\n\ntype EllipsisProps = BoxProps &\n Partial<TooltipProps> & {\n /**\n * Rows count in multiline Ellipsis\n * @default 1\n */\n maxLine?: number;\n /**\n * Trimming type\n * @default end\n */\n trim?: 'end' | 'middle';\n /**\n * Show tooltip\n * @default true\n */\n tooltip?: boolean;\n /**\n * Ref to the item that will be observed by ResizeObserver\n */\n containerRef?: RefObject<HTMLDivElement>;\n /**\n * Explicit sizes of container text should be trimmed in\n **/\n containerRect?: { width: number };\n /** List of props that will be passed to tooltip\n * @default ['title', 'theme', 'strategy', 'modifiers', 'placement', 'interaction', 'timeout', 'visible', 'defaultVisible', 'onVisibleChange', 'offset', 'preventOverflow', 'arrow', 'flip', 'computeStyles', 'eventListeners', 'onFirstUpdate']\n */\n includeTooltipProps?: string[];\n };\n\nconst defaultTooltipProps = [\n 'title',\n 'theme',\n 'strategy',\n 'modifiers',\n 'placement',\n 'interaction',\n 'timeout',\n 'visible',\n 'defaultVisible',\n 'onVisibleChange',\n 'offset',\n 'preventOverflow',\n 'arrow',\n 'flip',\n 'computeStyles',\n 'eventListeners',\n 'onFirstUpdate',\n 'cursorAnchoring',\n];\n\nconst createMeasurerElement = (element: HTMLDivElement, text?: string) => {\n const styleElement = window.getComputedStyle(element, null);\n const temporaryElement = document.createElement('temporary-block');\n temporaryElement.style.display = styleElement.getPropertyValue('display');\n temporaryElement.style.padding = styleElement.getPropertyValue('padding');\n temporaryElement.style.position = 'absolute';\n temporaryElement.style.right = '0%';\n temporaryElement.style.bottom = '0%';\n temporaryElement.style.visibility = 'hidden';\n temporaryElement.style.fontFamily = styleElement.getPropertyValue('font-family');\n temporaryElement.style.fontSize = styleElement.getPropertyValue('font-size');\n temporaryElement.style.fontWeight = styleElement.getPropertyValue('font-weight');\n temporaryElement.style.lineHeight = styleElement.getPropertyValue('line-height');\n temporaryElement.style.whiteSpace = styleElement.getPropertyValue('white-space');\n temporaryElement.style.wordWrap = styleElement.getPropertyValue('word-wrap');\n\n temporaryElement.style.fontFeatureSettings =\n styleElement.getPropertyValue('font-feature-settings');\n temporaryElement.style.fontVariantNumeric = styleElement.getPropertyValue('font-variant-numeric');\n\n temporaryElement.innerHTML = text ?? element.innerHTML;\n return temporaryElement;\n};\n\nfunction isTextOverflowing(element: HTMLDivElement, multiline: boolean, text?: string): boolean {\n if (!element) return false;\n\n const { height: currentHeight, width: currentWidth } = element.getBoundingClientRect();\n const measuringElement = createMeasurerElement(element, text);\n let isOverflowing = false;\n\n document.body.appendChild(measuringElement);\n if (multiline) {\n measuringElement.style.width = `${currentWidth}px`;\n\n const width = measuringElement.scrollWidth;\n const height = measuringElement.getBoundingClientRect().height;\n\n if (Math.ceil(currentHeight) < height || Math.ceil(currentWidth) < width) {\n isOverflowing = true;\n }\n } else {\n measuringElement.style.whiteSpace = 'nowrap';\n isOverflowing = Math.ceil(currentWidth) < measuringElement.getBoundingClientRect().width;\n }\n\n document.body.removeChild(measuringElement);\n\n return isOverflowing;\n}\n\nconst forcedAdvancedMode = { forcedAdvancedMode: true } as any;\nconst noAdvancedMode = {} as any;\n\nclass RootEllipsis extends Component<AsProps> {\n static displayName = 'Ellipsis';\n static style = style;\n static defaultProps: AsProps = {\n trim: 'end',\n tooltip: true,\n includeTooltipProps: defaultTooltipProps,\n __excludeProps: ['title'],\n };\n\n state = {\n visible: false,\n };\n\n textRef = React.createRef<HTMLDivElement>();\n\n showTooltip() {\n const { maxLine = 1, Children } = this.asProps;\n const text = reactToText(getOriginChildren(Children));\n return isTextOverflowing(this.textRef.current!, maxLine > 1, text);\n }\n\n handlerVisibleChange = (visible: boolean) => {\n this.setState({ visible: visible && this.showTooltip() });\n };\n\n getContentProps() {\n return {\n ref: this.textRef,\n maxLine: this.asProps.maxLine,\n };\n }\n\n getPopperProps() {\n const { Children, includeTooltipProps } = this.asProps;\n const text = reactToText(getOriginChildren(Children));\n const tooltipProps = pick(this.asProps, includeTooltipProps as any) as TooltipProps;\n return { children: text, ...tooltipProps };\n }\n\n render() {\n const SEllipsis = this.Root;\n const SContainer = Tooltip;\n const SNoTooltipContainer = Box;\n const {\n styles,\n Children,\n maxLine,\n tooltip,\n trim,\n containerRect,\n containerRef,\n includeTooltipProps,\n children: _children,\n ...other\n } = this.asProps;\n const { visible } = this.state;\n const advancedContent = findComponent(Children, [(Ellipsis as any).Content.displayName]);\n const text = reactToText(advancedContent || getOriginChildren(Children));\n const advanceMode = isAdvanceMode(Children, [\n (Ellipsis as any).Content.displayName,\n (Ellipsis as any).Popper.displayName,\n ]);\n const tooltipProps = pick(this.asProps, includeTooltipProps as any) as TooltipProps;\n\n tooltipProps.visible = tooltipProps.visible ?? visible;\n tooltipProps.onVisibleChange = tooltipProps.onVisibleChange\n ? callAllEventHandlers(tooltipProps.onVisibleChange, this.handlerVisibleChange)\n : this.handlerVisibleChange;\n\n if (trim === 'middle') {\n return sstyled(styles)(\n <EllipsisMiddle\n text={text}\n styles={styles}\n tooltip={tooltip}\n containerRect={containerRect}\n containerRef={containerRef}\n textRef={this.textRef}\n tooltipProps={tooltipProps}\n advanceMode={advanceMode}\n {...other}\n >\n <Children />\n </EllipsisMiddle>,\n );\n }\n if (tooltip) {\n return sstyled(styles)(\n <SContainer\n interaction='hover'\n title={!advanceMode ? text : undefined}\n {...tooltipProps}\n {...(advanceMode ? forcedAdvancedMode : noAdvancedMode)}\n >\n {advanceMode\n ? (\n <Children />\n )\n : (\n <SEllipsis render={Box} ref={this.textRef} maxLine={maxLine} {...other}>\n <Children />\n </SEllipsis>\n )}\n </SContainer>,\n );\n }\n return sstyled(styles)(\n <SNoTooltipContainer>\n {advanceMode\n ? (\n <Children />\n )\n : (\n <SEllipsis render={Box} ref={this.textRef} maxLine={maxLine} {...other}>\n <Children />\n </SEllipsis>\n )}\n </SNoTooltipContainer>,\n );\n }\n}\n\nconst EllipsisMiddleContext = React.createContext<null | {\n begining: string;\n tail: string;\n ref: React.RefObject<HTMLElement>;\n}>(null);\n\nconst EllipsisMiddle: React.FC<AsPropsMiddle> = (props) => {\n const {\n styles,\n text,\n tooltip,\n containerRect,\n containerRef,\n textRef,\n tooltipProps,\n children,\n advanceMode,\n ...otherProps\n } = props;\n const resizeElement = React.useRef<HTMLDivElement>(null);\n const [dimension, setDimension] = React.useState<{ fontSize: string; symbolWidth: number }>({\n fontSize: '14',\n symbolWidth: 0,\n });\n const blockWidth = useResizeObserver(resizeElement, containerRect).width;\n\n useEnhancedEffect(() => {\n const node = containerRef?.current || resizeElement?.current;\n if (!node) return;\n\n const dateSpan = document.createElement('temporary-block');\n dateSpan.setAttribute('style', `fontSize: ${dimension.fontSize}px`);\n dateSpan.innerHTML = 'a';\n document.body.appendChild(dateSpan);\n const rect = dateSpan.getBoundingClientRect();\n\n setDimension({\n fontSize: window.getComputedStyle(node, null).getPropertyValue('font-size'),\n symbolWidth: rect.width,\n });\n document.body.removeChild(dateSpan);\n }, []);\n\n const STail = 'span';\n const SBeginning = 'span';\n const SContainerMiddle = props.tag || Box;\n const SAdvancedModeContainerMiddle = Tooltip;\n const displayedSymbols = React.useMemo(\n () => Math.round(blockWidth / dimension.symbolWidth),\n [blockWidth, dimension.symbolWidth],\n );\n\n const interaction = text.length > displayedSymbols ? 'hover' : 'none';\n const ref = containerRef ?? resizeElement;\n const contextValue = React.useMemo(\n () => ({\n begining: text.substring(0, text.length - displayedSymbols / 2 - 1),\n tail: text.substring(text.length - displayedSymbols / 2 - 1),\n ref,\n }),\n [text, displayedSymbols],\n );\n\n if (advanceMode) {\n return sstyled(styles)(\n <SAdvancedModeContainerMiddle\n interaction={interaction}\n {...tooltipProps}\n {...forcedAdvancedMode}\n >\n <EllipsisMiddleContext.Provider value={contextValue}>\n {children}\n </EllipsisMiddleContext.Provider>\n </SAdvancedModeContainerMiddle>,\n ) as any;\n }\n if (tooltip) {\n return sstyled(styles)(\n <SContainerMiddle\n interaction={interaction}\n title={text as any}\n ref={forkRef(ref, textRef)}\n tag={Tooltip}\n __excludeProps={['title']}\n {...tooltipProps}\n >\n <SBeginning>{contextValue.begining}</SBeginning>\n <STail>{contextValue.tail}</STail>\n </SContainerMiddle>,\n ) as any;\n }\n return sstyled(styles)(\n <SContainerMiddle {...otherProps} ref={containerRef ?? resizeElement}>\n <SBeginning>{contextValue.begining}</SBeginning>\n <STail>{contextValue.tail}</STail>\n </SContainerMiddle>,\n ) as any;\n};\n\ntype EllipsisContentAsProps = {\n styles: any;\n Children: React.FC;\n};\n\nconst Content: React.FC<EllipsisContentAsProps> = ({ styles, Children }) => {\n const SEllipsis = Root;\n const ellipsisMiddleContext = React.useContext(EllipsisMiddleContext);\n const STail = 'span';\n const SBeginning = 'span';\n\n if (ellipsisMiddleContext) {\n const { begining, tail, ref } = ellipsisMiddleContext;\n return sstyled(styles)(\n <SEllipsis render={Tooltip.Trigger} middle-mod ref={ref}>\n <SBeginning>{begining}</SBeginning>\n <STail>{tail}</STail>\n </SEllipsis>,\n ) as any;\n }\n\n return sstyled(styles)(\n <SEllipsis render={Tooltip.Trigger}>\n <Children />\n </SEllipsis>,\n ) as any;\n};\n\nconst Ellipsis = createComponent(RootEllipsis, {\n Content,\n Popper: Tooltip.Popper,\n}) as any as Intergalactic.Component<'div', EllipsisProps> & {\n Content: typeof Box;\n Popper: typeof Tooltip.Popper;\n};\n\nexport default Ellipsis;\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,aAAA,GAAAD,OAAA;AACA,IAAAE,cAAA,GAAAC,uBAAA,CAAAH,OAAA;AACA,IAAAI,kBAAA,GAAAC,sBAAA,CAAAL,OAAA;AACA,IAAAM,KAAA,GAAAD,sBAAA,CAAAL,OAAA;AACA,IAAAO,YAAA,GAAAF,sBAAA,CAAAL,OAAA;AACA,IAAAQ,KAAA,GAAAR,OAAA;AACA,IAAAS,kBAAA,GAAAJ,sBAAA,CAAAL,OAAA;AACA,IAAAU,QAAA,GAAAV,OAAA;AACA,IAAAW,QAAA,GAAAN,sBAAA,CAAAL,OAAA;AACA,IAAAY,MAAA,GAAAP,sBAAA,CAAAL,OAAA;AAGA,IAAAa,kBAAA,GAAAb,OAAA;AAAwD,IAAAc,SAAA;EAAAC,UAAA;AAAA,SAAAC,WAAAC,CAAA,EAAAC,CAAA,EAAAC,CAAA,WAAAD,CAAA,OAAAE,gBAAA,aAAAF,CAAA,OAAAG,2BAAA,aAAAJ,CAAA,MAAAK,0BAAA,iBAAAC,OAAA,CAAAC,SAAA,CAAAN,CAAA,EAAAC,CAAA,YAAAC,gBAAA,aAAAH,CAAA,EAAAQ,WAAA,IAAAP,CAAA,CAAAQ,KAAA,CAAAT,CAAA,EAAAE,CAAA;AAAA;AAAA,IAAAQ,KAAA,8BAAA5B,KAAA,CAAA6B,OAAA,CAAAC,MAAA;AAAA;AAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA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CAAA9C,EAAA,kBAAAlC,cAAA,qBAAAhH,KAAA,CAAAqM,WAAA,MAAAP,IAAA,kBACRjL,MAAA,YAAA2B,aAAA,CAAC4D,QAAQ,EAAA4F,KAAA,CAAA9C,EAAA,gBAAE,CACF,CAAC;AAEhB,CAAC;AAED,IAAMX,QAAQ,GAAG,IAAA+D,qBAAe,EAAC1H,YAAY,EAAE;EAC7C4D,OAAO,EAAPA,OAAO;EACPI,MAAM,EAAEpB,mBAAO,CAACoB;AAClB,CAAC,CAGA;AAAC,IAAA2D,QAAA,GAAAC,OAAA,cAEajE,QAAQ","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"Ellipsis.js","names":["_core","require","_assignProps3","_findComponent","_interopRequireWildcard","_getOriginChildren","_interopRequireDefault","_pick","_reactToText","_ref9","_useEnhancedEffect","_flexBox","_tooltip","_react","_useResizeObserver","_excluded","_callSuper","t","o","e","_getPrototypeOf2","_possibleConstructorReturn2","_isNativeReflectConstruct2","Reflect","construct","constructor","apply","style","sstyled","insert","defaultTooltipProps","setFontSettings","element","styleElement","fontFamily","getPropertyValue","fontSize","fontWeight","lineHeight","fontFeatureSettings","fontVariantNumeric","createMeasurerElement","text","window","getComputedStyle","temporaryElement","document","createElement","display","padding","position","right","bottom","visibility","whiteSpace","wordWrap","innerHTML","isTextOverflowing","multiline","_element$getBoundingC","getBoundingClientRect","currentHeight","height","currentWidth","width","measuringElement","isOverflowing","body","appendChild","concat","scrollWidth","Math","ceil","removeChild","forcedAdvancedMode","noAdvancedMode","RootEllipsis","_Component","_this","_classCallCheck2","_len","arguments","length","args","Array","_key","_defineProperty2","visible","React","createRef","setState","showTooltip","_inherits2","_createClass2","key","value","_this$asProps","asProps","_this$asProps$maxLine","maxLine","Children","reactToText","getOriginChildren","textRef","current","getContentProps","ref","getPopperProps","_this$asProps2","includeTooltipProps","tooltipProps","pick","_objectSpread2","children","render","_ref3","_tooltipProps$visible","SEllipsis","Root","SContainer","Tooltip","_this$asProps3","styles","tooltip","trim","containerRect","containerRef","_children","other","_objectWithoutProperties2","state","advancedContent","findComponent","Ellipsis","Content","displayName","advanceMode","isAdvanceMode","Popper","onVisibleChange","callAllEventHandlers","handlerVisibleChange","_ref2","EllipsisMiddle","cn","undefined","Box","Component","__excludeProps","EllipsisMiddleContext","createContext","props","_ref5","tag","resizeElement","useRef","_React$useState","useState","_React$useState2","_slicedToArray2","symbolWidth","setSymbolWidth","blockWidth","useResizeObserver","useEnhancedEffect","node","dateSpan","rect","STail","SBeginning","SContainerMiddle","SAdvancedModeContainerMiddle","displayedSymbols","useMemo","round","interaction","contextValue","begining","substring","tail","_ref4","Provider","forkRef","_ref8","_ref","arguments[0]","_ref7","Trigger","ellipsisMiddleContext","useContext","_ref6","assignProps","createComponent","_default","exports"],"sources":["../../src/Ellipsis.tsx"],"sourcesContent":["import { createComponent, Component, type Intergalactic, Root, sstyled } from '@semcore/core';\nimport { callAllEventHandlers } from '@semcore/core/lib/utils/assignProps';\nimport findComponent, { isAdvanceMode } from '@semcore/core/lib/utils/findComponent';\nimport getOriginChildren from '@semcore/core/lib/utils/getOriginChildren';\nimport pick from '@semcore/core/lib/utils/pick';\nimport reactToText from '@semcore/core/lib/utils/reactToText';\nimport { forkRef } from '@semcore/core/lib/utils/ref';\nimport useEnhancedEffect from '@semcore/core/lib/utils/use/useEnhancedEffect';\nimport { Box, type BoxProps } from '@semcore/flex-box';\nimport Tooltip, { type TooltipProps } from '@semcore/tooltip';\nimport React, { type RefObject } from 'react';\n\nimport style from './style/ellipsis.shadow.css';\nimport { useResizeObserver } from './useResizeObserver';\n\ntype AsProps = {\n maxLine?: number;\n trim?: 'end' | 'middle';\n tooltip?: boolean;\n styles?: React.CSSProperties;\n containerRect?: { width: number };\n\n containerRef?: RefObject<HTMLDivElement>;\n includeTooltipProps?: string[];\n __excludeProps?: string[];\n};\n\ntype AsPropsMiddle = {\n text: string;\n textRef: RefObject<HTMLElement>;\n tooltip?: boolean;\n styles?: React.CSSProperties;\n containerRect?: { width: number };\n\n containerRef?: RefObject<HTMLDivElement>;\n tooltipProps: TooltipProps;\n children?: React.ReactNode;\n advanceMode?: boolean;\n tag?: React.ElementType;\n};\n\ntype EllipsisProps = BoxProps &\n Partial<TooltipProps> & {\n /**\n * Rows count in multiline Ellipsis\n * @default 1\n */\n maxLine?: number;\n /**\n * Trimming type\n * @default end\n */\n trim?: 'end' | 'middle';\n /**\n * Show tooltip\n * @default true\n */\n tooltip?: boolean;\n /**\n * Ref to the item that will be observed by ResizeObserver\n */\n containerRef?: RefObject<HTMLDivElement>;\n /**\n * Explicit sizes of container text should be trimmed in\n **/\n containerRect?: { width: number };\n /** List of props that will be passed to tooltip\n * @default ['title', 'theme', 'strategy', 'modifiers', 'placement', 'interaction', 'timeout', 'visible', 'defaultVisible', 'onVisibleChange', 'offset', 'preventOverflow', 'arrow', 'flip', 'computeStyles', 'eventListeners', 'onFirstUpdate']\n */\n includeTooltipProps?: string[];\n };\n\nconst defaultTooltipProps = [\n 'title',\n 'theme',\n 'strategy',\n 'modifiers',\n 'placement',\n 'interaction',\n 'timeout',\n 'visible',\n 'defaultVisible',\n 'onVisibleChange',\n 'offset',\n 'preventOverflow',\n 'arrow',\n 'flip',\n 'computeStyles',\n 'eventListeners',\n 'onFirstUpdate',\n 'cursorAnchoring',\n];\n\nconst setFontSettings = (element: HTMLElement, styleElement: CSSStyleDeclaration): void => {\n element.style.fontFamily = styleElement.getPropertyValue('font-family');\n element.style.fontSize = styleElement.getPropertyValue('font-size');\n element.style.fontWeight = styleElement.getPropertyValue('font-weight');\n element.style.lineHeight = styleElement.getPropertyValue('line-height');\n element.style.fontFeatureSettings =\n styleElement.getPropertyValue('font-feature-settings');\n element.style.fontVariantNumeric = styleElement.getPropertyValue('font-variant-numeric');\n};\n\nconst createMeasurerElement = (element: HTMLDivElement, text?: string) => {\n const styleElement = window.getComputedStyle(element, null);\n const temporaryElement = document.createElement('temporary-block');\n temporaryElement.style.display = styleElement.getPropertyValue('display');\n temporaryElement.style.padding = styleElement.getPropertyValue('padding');\n temporaryElement.style.position = 'absolute';\n temporaryElement.style.right = '0%';\n temporaryElement.style.bottom = '0%';\n temporaryElement.style.visibility = 'hidden';\n temporaryElement.style.whiteSpace = styleElement.getPropertyValue('white-space');\n temporaryElement.style.wordWrap = styleElement.getPropertyValue('word-wrap');\n\n setFontSettings(temporaryElement, styleElement);\n\n temporaryElement.innerHTML = text ?? element.innerHTML;\n return temporaryElement;\n};\n\nfunction isTextOverflowing(element: HTMLDivElement, multiline: boolean, text?: string): boolean {\n if (!element) return false;\n\n const { height: currentHeight, width: currentWidth } = element.getBoundingClientRect();\n const measuringElement = createMeasurerElement(element, text);\n let isOverflowing = false;\n\n document.body.appendChild(measuringElement);\n if (multiline) {\n measuringElement.style.width = `${currentWidth}px`;\n\n const width = measuringElement.scrollWidth;\n const height = measuringElement.getBoundingClientRect().height;\n\n if (Math.ceil(currentHeight) < height || Math.ceil(currentWidth) < width) {\n isOverflowing = true;\n }\n } else {\n measuringElement.style.whiteSpace = 'nowrap';\n isOverflowing = Math.ceil(currentWidth) < measuringElement.getBoundingClientRect().width;\n }\n\n document.body.removeChild(measuringElement);\n\n return isOverflowing;\n}\n\nconst forcedAdvancedMode = { forcedAdvancedMode: true } as any;\nconst noAdvancedMode = {} as any;\n\nclass RootEllipsis extends Component<AsProps> {\n static displayName = 'Ellipsis';\n static style = style;\n static defaultProps: AsProps = {\n trim: 'end',\n tooltip: true,\n includeTooltipProps: defaultTooltipProps,\n __excludeProps: ['title'],\n };\n\n state = {\n visible: false,\n };\n\n textRef = React.createRef<HTMLDivElement>();\n\n showTooltip() {\n const { maxLine = 1, Children } = this.asProps;\n const text = reactToText(getOriginChildren(Children));\n return isTextOverflowing(this.textRef.current!, maxLine > 1, text);\n }\n\n handlerVisibleChange = (visible: boolean) => {\n this.setState({ visible: visible && this.showTooltip() });\n };\n\n getContentProps() {\n return {\n ref: this.textRef,\n maxLine: this.asProps.maxLine,\n };\n }\n\n getPopperProps() {\n const { Children, includeTooltipProps } = this.asProps;\n const text = reactToText(getOriginChildren(Children));\n const tooltipProps = pick(this.asProps, includeTooltipProps as any) as TooltipProps;\n return { children: text, ...tooltipProps };\n }\n\n render() {\n const SEllipsis = this.Root;\n const SContainer = Tooltip;\n const {\n styles,\n Children,\n maxLine,\n tooltip,\n trim,\n containerRect,\n containerRef,\n includeTooltipProps,\n children: _children,\n ...other\n } = this.asProps;\n const { visible } = this.state;\n const advancedContent = findComponent(Children, [(Ellipsis as any).Content.displayName]);\n const text = reactToText(advancedContent || getOriginChildren(Children));\n const advanceMode = isAdvanceMode(Children, [\n (Ellipsis as any).Content.displayName,\n (Ellipsis as any).Popper.displayName,\n ]);\n const tooltipProps = pick(this.asProps, includeTooltipProps as any) as TooltipProps;\n\n tooltipProps.visible = tooltipProps.visible ?? visible;\n tooltipProps.onVisibleChange = tooltipProps.onVisibleChange\n ? callAllEventHandlers(tooltipProps.onVisibleChange, this.handlerVisibleChange)\n : this.handlerVisibleChange;\n\n if (trim === 'middle') {\n return sstyled(styles)(\n <EllipsisMiddle\n text={text}\n styles={styles}\n tooltip={tooltip}\n containerRect={containerRect}\n containerRef={containerRef}\n textRef={this.textRef}\n tooltipProps={tooltipProps}\n advanceMode={advanceMode}\n {...other}\n >\n <Children />\n </EllipsisMiddle>,\n );\n }\n\n return sstyled(styles)(\n <SContainer\n interaction={tooltip ? 'hover' : 'none'}\n title={!advanceMode ? text : undefined}\n {...tooltipProps}\n {...(advanceMode ? forcedAdvancedMode : noAdvancedMode)}\n >\n {advanceMode\n ? (\n <Children />\n )\n : (\n <SEllipsis render={Box} ref={this.textRef} maxLine={maxLine} {...other}>\n <Children />\n </SEllipsis>\n )}\n </SContainer>,\n );\n }\n}\n\nconst EllipsisMiddleContext = React.createContext<null | {\n begining: string;\n tail: string;\n ref: React.RefObject<HTMLElement>;\n}>(null);\n\nconst EllipsisMiddle: React.FC<AsPropsMiddle> = (props) => {\n const {\n styles,\n text,\n tooltip,\n containerRect,\n containerRef,\n textRef,\n tooltipProps,\n children,\n advanceMode,\n tag,\n } = props;\n\n const resizeElement = React.useRef<HTMLDivElement>(null);\n const [symbolWidth, setSymbolWidth] = React.useState(0);\n const blockWidth = useResizeObserver(resizeElement, containerRect).width;\n\n useEnhancedEffect(() => {\n const node = containerRef?.current || resizeElement?.current;\n if (!node) return;\n\n const styleElement = window.getComputedStyle(node);\n const dateSpan = document.createElement('temporary-block');\n\n setFontSettings(dateSpan, styleElement);\n dateSpan.innerHTML = 'a';\n document.body.appendChild(dateSpan);\n const rect = dateSpan.getBoundingClientRect();\n\n setSymbolWidth(rect.width);\n document.body.removeChild(dateSpan);\n }, []);\n\n const STail = 'span';\n const SBeginning = 'span';\n const SContainerMiddle = Tooltip;\n const SAdvancedModeContainerMiddle = Tooltip;\n const displayedSymbols = React.useMemo(\n () => {\n const displayedSymbols = Math.round(blockWidth / symbolWidth);\n\n return displayedSymbols % 2 === 0 ? displayedSymbols : displayedSymbols - 1;\n },\n [blockWidth, symbolWidth],\n );\n\n const interaction = text.length > displayedSymbols ? 'hover' : 'none';\n const ref = containerRef ?? resizeElement;\n const contextValue = React.useMemo(\n () => ({\n begining: text.substring(0, text.length - displayedSymbols / 2 - 1),\n tail: text.substring(text.length - displayedSymbols / 2 - 1),\n ref,\n }),\n [text, displayedSymbols],\n );\n\n if (advanceMode) {\n return sstyled(styles)(\n <SAdvancedModeContainerMiddle\n interaction={tooltip ? interaction : 'none'}\n {...tooltipProps}\n {...forcedAdvancedMode}\n >\n <EllipsisMiddleContext.Provider value={contextValue}>\n {children}\n </EllipsisMiddleContext.Provider>\n </SAdvancedModeContainerMiddle>,\n );\n }\n return sstyled(styles)(\n <SContainerMiddle\n interaction={tooltip ? interaction : 'none'}\n title={text}\n ref={forkRef(ref, textRef)}\n tag={tag}\n {...tooltipProps}\n >\n <SBeginning>{contextValue.begining}</SBeginning>\n <STail>{contextValue.tail}</STail>\n </SContainerMiddle>,\n );\n};\n\ntype EllipsisContentAsProps = {\n styles: any;\n Children: React.FC;\n};\n\nconst Content: React.FC<EllipsisContentAsProps> = ({ styles, Children }) => {\n const SEllipsis = Root;\n const ellipsisMiddleContext = React.useContext(EllipsisMiddleContext);\n const STail = 'span';\n const SBeginning = 'span';\n\n if (ellipsisMiddleContext) {\n const { begining, tail, ref } = ellipsisMiddleContext;\n return sstyled(styles)(\n <SEllipsis render={Tooltip.Trigger} middle-mod ref={ref}>\n <SBeginning>{begining}</SBeginning>\n <STail>{tail}</STail>\n </SEllipsis>,\n ) as any;\n }\n\n return sstyled(styles)(\n <SEllipsis render={Tooltip.Trigger}>\n <Children />\n </SEllipsis>,\n ) as any;\n};\n\nconst Ellipsis = createComponent(RootEllipsis, {\n Content,\n Popper: Tooltip.Popper,\n}) as any as Intergalactic.Component<'div', EllipsisProps> & {\n Content: typeof Box;\n Popper: typeof Tooltip.Popper;\n};\n\nexport default Ellipsis;\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,aAAA,GAAAD,OAAA;AACA,IAAAE,cAAA,GAAAC,uBAAA,CAAAH,OAAA;AACA,IAAAI,kBAAA,GAAAC,sBAAA,CAAAL,OAAA;AACA,IAAAM,KAAA,GAAAD,sBAAA,CAAAL,OAAA;AACA,IAAAO,YAAA,GAAAF,sBAAA,CAAAL,OAAA;AACA,IAAAQ,KAAA,GAAAR,OAAA;AACA,IAAAS,kBAAA,GAAAJ,sBAAA,CAAAL,OAAA;AACA,IAAAU,QAAA,GAAAV,OAAA;AACA,IAAAW,QAAA,GAAAN,sBAAA,CAAAL,OAAA;AACA,IAAAY,MAAA,GAAAP,sBAAA,CAAAL,OAAA;AAGA,IAAAa,kBAAA,GAAAb,OAAA;AAAwD,IAAAc,SAAA;AAAA,SAAAC,WAAAC,CAAA,EAAAC,CAAA,EAAAC,CAAA,WAAAD,CAAA,OAAAE,gBAAA,aAAAF,CAAA,OAAAG,2BAAA,aAAAJ,CAAA,MAAAK,0BAAA,iBAAAC,OA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E,KAAA,CAAA9C,EAAA,kBAAAhC,cAAA,qBAAAhH,KAAA,CAAA+L,WAAA;MAAA;MAAA,OAA0CrF;IAAG,GAAA8E,IAAA,kBACrD3K,MAAA,YAAAkC,aAAA,CAAC0H,UAAU,EAAAqB,KAAA,CAAA9C,EAAA,oBAAEiC,QAAqB,CAAC,eACnCpK,MAAA,YAAAkC,aAAA,CAACyH,KAAK,EAAAsB,KAAA,CAAA9C,EAAA,eAAEmC,IAAY,CACX,CAAC;EAEhB;EAEA,OAAAO,KAAA,GAAO,IAAA9J,aAAO,EAAC8F,MAAM,CAAC,eACpB7G,MAAA,YAAAkC,aAAA,CAACsE,SAAS,EAAAqE,KAAA,CAAA1C,EAAA,kBAAAhC,cAAA,qBAAAhH,KAAA,CAAA+L,WAAA,MAAAP,IAAA,kBACR3K,MAAA,YAAAkC,aAAA,CAACqD,QAAQ,EAAAsF,KAAA,CAAA1C,EAAA,gBAAE,CACF,CAAC;AAEhB,CAAC;AAED,IAAMX,QAAQ,GAAG,IAAA2D,qBAAe,EAACpH,YAAY,EAAE;EAC7C0D,OAAO,EAAPA,OAAO;EACPI,MAAM,EAAElB,mBAAO,CAACkB;AAClB,CAAC,CAGA;AAAC,IAAAuD,QAAA,GAAAC,OAAA,cAEa7D,QAAQ","ignoreList":[]}
|
package/lib/cjs/index.d.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.js","names":[],"sources":["../../src/index.d.ts"],"sourcesContent":["import type { UnknownProperties, Intergalactic } from '@semcore/core';\nimport type { Box, BoxProps } from '@semcore/flex-box';\nimport type { TooltipProps } from '@semcore/tooltip';\nimport type Tooltip from '@semcore/tooltip';\nimport type { RefObject } from 'react';\n\n/** @deprecated */\nexport interface IEllipsisProps extends EllipsisProps, UnknownProperties {}\nexport type EllipsisProps = BoxProps &\n Partial<TooltipProps> & {\n /**\n * Rows count in multiline Ellipsis
|
|
1
|
+
{"version":3,"file":"index.d.js","names":[],"sources":["../../src/index.d.ts"],"sourcesContent":["import type { UnknownProperties, Intergalactic } from '@semcore/core';\nimport type { Box, BoxProps } from '@semcore/flex-box';\nimport type { TooltipProps } from '@semcore/tooltip';\nimport type Tooltip from '@semcore/tooltip';\nimport type { RefObject } from 'react';\n\n/** @deprecated */\nexport interface IEllipsisProps extends EllipsisProps, UnknownProperties {}\nexport type EllipsisProps = BoxProps &\n Partial<TooltipProps> & {\n /**\n * Rows count in multiline Ellipsis.\n * Applies only for `trim = end`\n * @default 1\n */\n maxLine?: number;\n /**\n * Trimming type\n * @default end\n */\n trim?: 'end' | 'middle';\n /**\n * Show tooltip\n * @default true\n */\n tooltip?: boolean;\n /**\n * Ref to the item that will be observed by ResizeObserver\n */\n containerRef?: RefObject<HTMLElement | null>;\n /**\n * Explicit sizes of container text should be trimmed in\n **/\n containerRect?: { width: number };\n /** List of props that will be passed to tooltip\n * @default ['title', 'theme', 'strategy', 'modifiers', 'placement', 'interaction', 'timeout', 'visible', 'defaultVisible', 'onVisibleChange', 'offset', 'preventOverflow', 'arrow', 'flip', 'computeStyles', 'eventListeners', 'onFirstUpdate']\n */\n includeTooltipProps?: string[];\n };\n\ndeclare const useResizeObserver: (\n ref: RefObject<HTMLElement>,\n hookOverride?: { width: number },\n) => { width: number };\n\ndeclare const Ellipsis: Intergalactic.Component<'div', EllipsisProps> & {\n Content: typeof Box;\n Popper: typeof Tooltip.Popper;\n};\n\nexport { useResizeObserver };\nexport default Ellipsis;\n"],"mappings":"","ignoreList":[]}
|
|
@@ -1,10 +1,3 @@
|
|
|
1
|
-
SContainer,
|
|
2
|
-
SNoTooltipContainer,
|
|
3
|
-
SContainerMiddle {
|
|
4
|
-
display: flex;
|
|
5
|
-
overflow: hidden;
|
|
6
|
-
}
|
|
7
|
-
|
|
8
1
|
SBeginning,
|
|
9
2
|
SEllipsis {
|
|
10
3
|
overflow: hidden;
|
|
@@ -13,7 +6,9 @@ SEllipsis {
|
|
|
13
6
|
white-space: pre;
|
|
14
7
|
}
|
|
15
8
|
|
|
16
|
-
|
|
9
|
+
SContainer,
|
|
10
|
+
SNoTooltipContainer,
|
|
11
|
+
SContainerMiddle {
|
|
17
12
|
display: flex;
|
|
18
13
|
overflow: hidden;
|
|
19
14
|
}
|
|
@@ -27,6 +22,11 @@ SEllipsis[maxLine] {
|
|
|
27
22
|
overflow-wrap: break-word;
|
|
28
23
|
}
|
|
29
24
|
|
|
25
|
+
SEllipsis[middle-mod] {
|
|
26
|
+
display: flex;
|
|
27
|
+
overflow: hidden;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
30
|
SContainerMiddle> :has(SBeginning),
|
|
31
31
|
SContainerMiddle> :has(STail) {
|
|
32
32
|
display: flex;
|
package/lib/es6/Ellipsis.js
CHANGED
|
@@ -11,8 +11,7 @@ import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
|
11
11
|
import { sstyled as _sstyled } from "@semcore/core";
|
|
12
12
|
import { assignProps as _assignProps2 } from "@semcore/core";
|
|
13
13
|
import { assignProps as _assignProps } from "@semcore/core";
|
|
14
|
-
var _excluded = ["styles", "Children", "maxLine", "tooltip", "trim", "containerRect", "containerRef", "includeTooltipProps", "children"]
|
|
15
|
-
_excluded2 = ["styles", "text", "tooltip", "containerRect", "containerRef", "textRef", "tooltipProps", "children", "advanceMode"];
|
|
14
|
+
var _excluded = ["styles", "Children", "maxLine", "tooltip", "trim", "containerRect", "containerRef", "includeTooltipProps", "children"];
|
|
16
15
|
function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
|
|
17
16
|
import { createComponent, Component, Root, sstyled } from '@semcore/core';
|
|
18
17
|
import { callAllEventHandlers } from '@semcore/core/lib/utils/assignProps';
|
|
@@ -26,21 +25,29 @@ import { Box } from '@semcore/flex-box';
|
|
|
26
25
|
import Tooltip from '@semcore/tooltip';
|
|
27
26
|
import React from 'react';
|
|
28
27
|
/*!__reshadow-styles__:"./style/ellipsis.shadow.css"*/
|
|
29
|
-
var style = (/*__reshadow_css_start__*/_sstyled.insert(/*__inner_css_start__*/".
|
|
28
|
+
var style = (/*__reshadow_css_start__*/_sstyled.insert(/*__inner_css_start__*/".___SBeginning_yog1u_gg_,.___SEllipsis_yog1u_gg_{overflow:hidden;display:inline-block;text-overflow:ellipsis;white-space:pre}.___SEllipsis_yog1u_gg_.__maxLine_yog1u_gg_{display:-webkit-box;-webkit-line-clamp:var(--maxLine_yog1u);-webkit-box-orient:vertical;overflow:hidden;white-space:normal;word-wrap:break-word}.___SContainerMiddle_yog1u_gg_,.___SContainer_yog1u_gg_,.___SEllipsis_yog1u_gg_.__middle-mod_yog1u_gg_,.___SNoTooltipContainer_yog1u_gg_{display:flex;overflow:hidden}.___SContainerMiddle_yog1u_gg_>:has(.___SBeginning_yog1u_gg_),.___SContainerMiddle_yog1u_gg_>:has(.___STail_yog1u_gg_){display:flex;width:100%}.___STail_yog1u_gg_{white-space:pre}", /*__inner_css_end__*/"yog1u_gg_"),
|
|
30
29
|
/*__reshadow_css_end__*/
|
|
31
30
|
{
|
|
32
|
-
"
|
|
33
|
-
"
|
|
34
|
-
"
|
|
35
|
-
"
|
|
36
|
-
"
|
|
37
|
-
"
|
|
38
|
-
"
|
|
39
|
-
"
|
|
40
|
-
"__STail": "
|
|
31
|
+
"__SBeginning": "___SBeginning_yog1u_gg_",
|
|
32
|
+
"__SEllipsis": "___SEllipsis_yog1u_gg_",
|
|
33
|
+
"__SContainer": "___SContainer_yog1u_gg_",
|
|
34
|
+
"__SNoTooltipContainer": "___SNoTooltipContainer_yog1u_gg_",
|
|
35
|
+
"__SContainerMiddle": "___SContainerMiddle_yog1u_gg_",
|
|
36
|
+
"_maxLine": "__maxLine_yog1u_gg_",
|
|
37
|
+
"--maxLine": "--maxLine_yog1u",
|
|
38
|
+
"_middle-mod": "__middle-mod_yog1u_gg_",
|
|
39
|
+
"__STail": "___STail_yog1u_gg_"
|
|
41
40
|
});
|
|
42
41
|
import { useResizeObserver } from './useResizeObserver';
|
|
43
42
|
var defaultTooltipProps = ['title', 'theme', 'strategy', 'modifiers', 'placement', 'interaction', 'timeout', 'visible', 'defaultVisible', 'onVisibleChange', 'offset', 'preventOverflow', 'arrow', 'flip', 'computeStyles', 'eventListeners', 'onFirstUpdate', 'cursorAnchoring'];
|
|
43
|
+
var setFontSettings = function setFontSettings(element, styleElement) {
|
|
44
|
+
element.style.fontFamily = styleElement.getPropertyValue('font-family');
|
|
45
|
+
element.style.fontSize = styleElement.getPropertyValue('font-size');
|
|
46
|
+
element.style.fontWeight = styleElement.getPropertyValue('font-weight');
|
|
47
|
+
element.style.lineHeight = styleElement.getPropertyValue('line-height');
|
|
48
|
+
element.style.fontFeatureSettings = styleElement.getPropertyValue('font-feature-settings');
|
|
49
|
+
element.style.fontVariantNumeric = styleElement.getPropertyValue('font-variant-numeric');
|
|
50
|
+
};
|
|
44
51
|
var createMeasurerElement = function createMeasurerElement(element, text) {
|
|
45
52
|
var styleElement = window.getComputedStyle(element, null);
|
|
46
53
|
var temporaryElement = document.createElement('temporary-block');
|
|
@@ -50,14 +57,9 @@ var createMeasurerElement = function createMeasurerElement(element, text) {
|
|
|
50
57
|
temporaryElement.style.right = '0%';
|
|
51
58
|
temporaryElement.style.bottom = '0%';
|
|
52
59
|
temporaryElement.style.visibility = 'hidden';
|
|
53
|
-
temporaryElement.style.fontFamily = styleElement.getPropertyValue('font-family');
|
|
54
|
-
temporaryElement.style.fontSize = styleElement.getPropertyValue('font-size');
|
|
55
|
-
temporaryElement.style.fontWeight = styleElement.getPropertyValue('font-weight');
|
|
56
|
-
temporaryElement.style.lineHeight = styleElement.getPropertyValue('line-height');
|
|
57
60
|
temporaryElement.style.whiteSpace = styleElement.getPropertyValue('white-space');
|
|
58
61
|
temporaryElement.style.wordWrap = styleElement.getPropertyValue('word-wrap');
|
|
59
|
-
temporaryElement
|
|
60
|
-
temporaryElement.style.fontVariantNumeric = styleElement.getPropertyValue('font-variant-numeric');
|
|
62
|
+
setFontSettings(temporaryElement, styleElement);
|
|
61
63
|
temporaryElement.innerHTML = text !== null && text !== void 0 ? text : element.innerHTML;
|
|
62
64
|
return temporaryElement;
|
|
63
65
|
};
|
|
@@ -140,10 +142,9 @@ var RootEllipsis = /*#__PURE__*/function (_Component) {
|
|
|
140
142
|
}, {
|
|
141
143
|
key: "render",
|
|
142
144
|
value: function render() {
|
|
143
|
-
var
|
|
145
|
+
var _ref3, _tooltipProps$visible;
|
|
144
146
|
var SEllipsis = this.Root;
|
|
145
147
|
var SContainer = Tooltip;
|
|
146
|
-
var SNoTooltipContainer = Box;
|
|
147
148
|
var _this$asProps3 = this.asProps,
|
|
148
149
|
styles = _this$asProps3.styles,
|
|
149
150
|
Children = _this$asProps3.Children,
|
|
@@ -175,22 +176,14 @@ var RootEllipsis = /*#__PURE__*/function (_Component) {
|
|
|
175
176
|
"advanceMode": advanceMode
|
|
176
177
|
}, other)), /*#__PURE__*/React.createElement(Children, _ref2.cn("Children", {})));
|
|
177
178
|
}
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
"title": !advanceMode ? text : undefined
|
|
183
|
-
}, tooltipProps), advanceMode ? forcedAdvancedMode : noAdvancedMode)), advanceMode ? /*#__PURE__*/React.createElement(Children, _ref3.cn("Children", {})) : /*#__PURE__*/React.createElement(SEllipsis, _ref3.cn("SEllipsis", _objectSpread({
|
|
184
|
-
"render": Box,
|
|
185
|
-
"ref": this.textRef,
|
|
186
|
-
"maxLine": maxLine
|
|
187
|
-
}, other)), /*#__PURE__*/React.createElement(Children, _ref3.cn("Children", {}))));
|
|
188
|
-
}
|
|
189
|
-
return _ref4 = sstyled(styles), /*#__PURE__*/React.createElement(SNoTooltipContainer, _ref4.cn("SNoTooltipContainer", {}), advanceMode ? /*#__PURE__*/React.createElement(Children, _ref4.cn("Children", {})) : /*#__PURE__*/React.createElement(SEllipsis, _ref4.cn("SEllipsis", _objectSpread({
|
|
179
|
+
return _ref3 = sstyled(styles), /*#__PURE__*/React.createElement(SContainer, _ref3.cn("SContainer", _objectSpread(_objectSpread({
|
|
180
|
+
"interaction": tooltip ? 'hover' : 'none',
|
|
181
|
+
"title": !advanceMode ? text : undefined
|
|
182
|
+
}, tooltipProps), advanceMode ? forcedAdvancedMode : noAdvancedMode)), advanceMode ? /*#__PURE__*/React.createElement(Children, _ref3.cn("Children", {})) : /*#__PURE__*/React.createElement(SEllipsis, _ref3.cn("SEllipsis", _objectSpread({
|
|
190
183
|
"render": Box,
|
|
191
184
|
"ref": this.textRef,
|
|
192
185
|
"maxLine": maxLine
|
|
193
|
-
}, other)), /*#__PURE__*/React.createElement(Children,
|
|
186
|
+
}, other)), /*#__PURE__*/React.createElement(Children, _ref3.cn("Children", {}))));
|
|
194
187
|
}
|
|
195
188
|
}]);
|
|
196
189
|
}(Component);
|
|
@@ -204,7 +197,7 @@ _defineProperty(RootEllipsis, "defaultProps", {
|
|
|
204
197
|
});
|
|
205
198
|
var EllipsisMiddleContext = /*#__PURE__*/React.createContext(null);
|
|
206
199
|
var EllipsisMiddle = function EllipsisMiddle(props) {
|
|
207
|
-
var
|
|
200
|
+
var _ref5;
|
|
208
201
|
var styles = props.styles,
|
|
209
202
|
text = props.text,
|
|
210
203
|
tooltip = props.tooltip,
|
|
@@ -214,37 +207,33 @@ var EllipsisMiddle = function EllipsisMiddle(props) {
|
|
|
214
207
|
tooltipProps = props.tooltipProps,
|
|
215
208
|
children = props.children,
|
|
216
209
|
advanceMode = props.advanceMode,
|
|
217
|
-
|
|
210
|
+
tag = props.tag;
|
|
218
211
|
var resizeElement = React.useRef(null);
|
|
219
|
-
var _React$useState = React.useState(
|
|
220
|
-
fontSize: '14',
|
|
221
|
-
symbolWidth: 0
|
|
222
|
-
}),
|
|
212
|
+
var _React$useState = React.useState(0),
|
|
223
213
|
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
224
|
-
|
|
225
|
-
|
|
214
|
+
symbolWidth = _React$useState2[0],
|
|
215
|
+
setSymbolWidth = _React$useState2[1];
|
|
226
216
|
var blockWidth = useResizeObserver(resizeElement, containerRect).width;
|
|
227
217
|
useEnhancedEffect(function () {
|
|
228
218
|
var node = (containerRef === null || containerRef === void 0 ? void 0 : containerRef.current) || (resizeElement === null || resizeElement === void 0 ? void 0 : resizeElement.current);
|
|
229
219
|
if (!node) return;
|
|
220
|
+
var styleElement = window.getComputedStyle(node);
|
|
230
221
|
var dateSpan = document.createElement('temporary-block');
|
|
231
|
-
dateSpan
|
|
222
|
+
setFontSettings(dateSpan, styleElement);
|
|
232
223
|
dateSpan.innerHTML = 'a';
|
|
233
224
|
document.body.appendChild(dateSpan);
|
|
234
225
|
var rect = dateSpan.getBoundingClientRect();
|
|
235
|
-
|
|
236
|
-
fontSize: window.getComputedStyle(node, null).getPropertyValue('font-size'),
|
|
237
|
-
symbolWidth: rect.width
|
|
238
|
-
});
|
|
226
|
+
setSymbolWidth(rect.width);
|
|
239
227
|
document.body.removeChild(dateSpan);
|
|
240
228
|
}, []);
|
|
241
229
|
var STail = 'span';
|
|
242
230
|
var SBeginning = 'span';
|
|
243
|
-
var SContainerMiddle =
|
|
231
|
+
var SContainerMiddle = Tooltip;
|
|
244
232
|
var SAdvancedModeContainerMiddle = Tooltip;
|
|
245
233
|
var displayedSymbols = React.useMemo(function () {
|
|
246
|
-
|
|
247
|
-
|
|
234
|
+
var displayedSymbols = Math.round(blockWidth / symbolWidth);
|
|
235
|
+
return displayedSymbols % 2 === 0 ? displayedSymbols : displayedSymbols - 1;
|
|
236
|
+
}, [blockWidth, symbolWidth]);
|
|
248
237
|
var interaction = text.length > displayedSymbols ? 'hover' : 'none';
|
|
249
238
|
var ref = containerRef !== null && containerRef !== void 0 ? containerRef : resizeElement;
|
|
250
239
|
var contextValue = React.useMemo(function () {
|
|
@@ -255,47 +244,40 @@ var EllipsisMiddle = function EllipsisMiddle(props) {
|
|
|
255
244
|
};
|
|
256
245
|
}, [text, displayedSymbols]);
|
|
257
246
|
if (advanceMode) {
|
|
258
|
-
var
|
|
259
|
-
return
|
|
260
|
-
"interaction": interaction
|
|
247
|
+
var _ref4;
|
|
248
|
+
return _ref4 = sstyled(styles), /*#__PURE__*/React.createElement(SAdvancedModeContainerMiddle, _ref4.cn("SAdvancedModeContainerMiddle", _objectSpread(_objectSpread({
|
|
249
|
+
"interaction": tooltip ? interaction : 'none'
|
|
261
250
|
}, tooltipProps), forcedAdvancedMode)), /*#__PURE__*/React.createElement(EllipsisMiddleContext.Provider, {
|
|
262
251
|
value: contextValue
|
|
263
252
|
}, children));
|
|
264
253
|
}
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
"tag": Tooltip,
|
|
272
|
-
"__excludeProps": ['title']
|
|
273
|
-
}, tooltipProps)), /*#__PURE__*/React.createElement(SBeginning, _ref6.cn("SBeginning", {}), contextValue.begining), /*#__PURE__*/React.createElement(STail, _ref6.cn("STail", {}), contextValue.tail));
|
|
274
|
-
}
|
|
275
|
-
return _ref7 = sstyled(styles), /*#__PURE__*/React.createElement(SContainerMiddle, _ref7.cn("SContainerMiddle", _objectSpread(_objectSpread({}, otherProps), {}, {
|
|
276
|
-
"ref": containerRef !== null && containerRef !== void 0 ? containerRef : resizeElement
|
|
277
|
-
})), /*#__PURE__*/React.createElement(SBeginning, _ref7.cn("SBeginning", {}), contextValue.begining), /*#__PURE__*/React.createElement(STail, _ref7.cn("STail", {}), contextValue.tail));
|
|
254
|
+
return _ref5 = sstyled(styles), /*#__PURE__*/React.createElement(SContainerMiddle, _ref5.cn("SContainerMiddle", _objectSpread({
|
|
255
|
+
"interaction": tooltip ? interaction : 'none',
|
|
256
|
+
"title": text,
|
|
257
|
+
"ref": forkRef(ref, textRef),
|
|
258
|
+
"tag": tag
|
|
259
|
+
}, tooltipProps)), /*#__PURE__*/React.createElement(SBeginning, _ref5.cn("SBeginning", {}), contextValue.begining), /*#__PURE__*/React.createElement(STail, _ref5.cn("STail", {}), contextValue.tail));
|
|
278
260
|
};
|
|
279
|
-
var Content = function Content(
|
|
261
|
+
var Content = function Content(_ref8) {
|
|
280
262
|
var _ref = arguments[0],
|
|
281
|
-
|
|
282
|
-
var styles =
|
|
283
|
-
Children =
|
|
263
|
+
_ref7;
|
|
264
|
+
var styles = _ref8.styles,
|
|
265
|
+
Children = _ref8.Children;
|
|
284
266
|
var SEllipsis = Tooltip.Trigger;
|
|
285
267
|
var ellipsisMiddleContext = React.useContext(EllipsisMiddleContext);
|
|
286
268
|
var STail = 'span';
|
|
287
269
|
var SBeginning = 'span';
|
|
288
270
|
if (ellipsisMiddleContext) {
|
|
289
|
-
var
|
|
271
|
+
var _ref6;
|
|
290
272
|
var begining = ellipsisMiddleContext.begining,
|
|
291
273
|
tail = ellipsisMiddleContext.tail,
|
|
292
274
|
ref = ellipsisMiddleContext.ref;
|
|
293
|
-
return
|
|
275
|
+
return _ref6 = sstyled(styles), /*#__PURE__*/React.createElement(SEllipsis, _ref6.cn("SEllipsis", _objectSpread({}, _assignProps({
|
|
294
276
|
"middle-mod": true,
|
|
295
277
|
"ref": ref
|
|
296
|
-
}, _ref))), /*#__PURE__*/React.createElement(SBeginning,
|
|
278
|
+
}, _ref))), /*#__PURE__*/React.createElement(SBeginning, _ref6.cn("SBeginning", {}), begining), /*#__PURE__*/React.createElement(STail, _ref6.cn("STail", {}), tail));
|
|
297
279
|
}
|
|
298
|
-
return
|
|
280
|
+
return _ref7 = sstyled(styles), /*#__PURE__*/React.createElement(SEllipsis, _ref7.cn("SEllipsis", _objectSpread({}, _assignProps2({}, _ref))), /*#__PURE__*/React.createElement(Children, _ref7.cn("Children", {})));
|
|
299
281
|
};
|
|
300
282
|
var Ellipsis = createComponent(RootEllipsis, {
|
|
301
283
|
Content: Content,
|
package/lib/es6/Ellipsis.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Ellipsis.js","names":["createComponent","Component","Root","sstyled","callAllEventHandlers","findComponent","isAdvanceMode","getOriginChildren","pick","reactToText","forkRef","useEnhancedEffect","Box","Tooltip","React","style","_sstyled","insert","useResizeObserver","defaultTooltipProps","createMeasurerElement","element","text","styleElement","window","getComputedStyle","temporaryElement","document","createElement","display","getPropertyValue","padding","position","right","bottom","visibility","fontFamily","fontSize","fontWeight","lineHeight","whiteSpace","wordWrap","fontFeatureSettings","fontVariantNumeric","innerHTML","isTextOverflowing","multiline","_element$getBoundingC","getBoundingClientRect","currentHeight","height","currentWidth","width","measuringElement","isOverflowing","body","appendChild","concat","scrollWidth","Math","ceil","removeChild","forcedAdvancedMode","noAdvancedMode","RootEllipsis","_Component","_this","_classCallCheck","_len","arguments","length","args","Array","_key","_callSuper","_defineProperty","visible","createRef","setState","showTooltip","_inherits","_createClass","key","value","_this$asProps","asProps","_this$asProps$maxLine","maxLine","Children","textRef","current","getContentProps","ref","getPopperProps","_this$asProps2","includeTooltipProps","tooltipProps","_objectSpread","children","render","_ref4","_tooltipProps$visible","SEllipsis","SContainer","SNoTooltipContainer","_this$asProps3","styles","tooltip","trim","containerRect","containerRef","_children","other","_objectWithoutProperties","_excluded","state","advancedContent","Ellipsis","Content","displayName","advanceMode","Popper","onVisibleChange","handlerVisibleChange","_ref2","EllipsisMiddle","cn","_ref3","undefined","__excludeProps","EllipsisMiddleContext","createContext","props","_ref7","otherProps","_excluded2","resizeElement","useRef","_React$useState","useState","symbolWidth","_React$useState2","_slicedToArray","dimension","setDimension","blockWidth","node","dateSpan","setAttribute","rect","STail","SBeginning","SContainerMiddle","tag","SAdvancedModeContainerMiddle","displayedSymbols","useMemo","round","interaction","contextValue","begining","substring","tail","_ref5","Provider","_ref6","_ref0","_ref","arguments[0]","_ref9","Trigger","ellipsisMiddleContext","useContext","_ref8","_assignProps","_assignProps2"],"sources":["../../src/Ellipsis.tsx"],"sourcesContent":["import { createComponent, Component, type Intergalactic, Root, sstyled } from '@semcore/core';\nimport { callAllEventHandlers } from '@semcore/core/lib/utils/assignProps';\nimport findComponent, { isAdvanceMode } from '@semcore/core/lib/utils/findComponent';\nimport getOriginChildren from '@semcore/core/lib/utils/getOriginChildren';\nimport pick from '@semcore/core/lib/utils/pick';\nimport reactToText from '@semcore/core/lib/utils/reactToText';\nimport { forkRef } from '@semcore/core/lib/utils/ref';\nimport useEnhancedEffect from '@semcore/core/lib/utils/use/useEnhancedEffect';\nimport { Box, type BoxProps } from '@semcore/flex-box';\nimport Tooltip, { type TooltipProps } from '@semcore/tooltip';\nimport React, { type RefObject } from 'react';\n\nimport style from './style/ellipsis.shadow.css';\nimport { useResizeObserver } from './useResizeObserver';\n\ntype AsProps = {\n maxLine?: number;\n trim?: 'end' | 'middle';\n tooltip?: boolean;\n styles?: React.CSSProperties;\n containerRect?: { width: number };\n\n containerRef?: RefObject<HTMLDivElement>;\n includeTooltipProps?: string[];\n __excludeProps?: string[];\n};\n\ntype AsPropsMiddle = {\n text: string;\n textRef: RefObject<HTMLElement>;\n tooltip?: boolean;\n styles?: React.CSSProperties;\n containerRect?: { width: number };\n\n containerRef?: RefObject<HTMLDivElement>;\n tooltipProps: TooltipProps;\n children?: React.ReactNode;\n advanceMode?: boolean;\n tag?: React.ElementType;\n};\n\ntype EllipsisProps = BoxProps &\n Partial<TooltipProps> & {\n /**\n * Rows count in multiline Ellipsis\n * @default 1\n */\n maxLine?: number;\n /**\n * Trimming type\n * @default end\n */\n trim?: 'end' | 'middle';\n /**\n * Show tooltip\n * @default true\n */\n tooltip?: boolean;\n /**\n * Ref to the item that will be observed by ResizeObserver\n */\n containerRef?: RefObject<HTMLDivElement>;\n /**\n * Explicit sizes of container text should be trimmed in\n **/\n containerRect?: { width: number };\n /** List of props that will be passed to tooltip\n * @default ['title', 'theme', 'strategy', 'modifiers', 'placement', 'interaction', 'timeout', 'visible', 'defaultVisible', 'onVisibleChange', 'offset', 'preventOverflow', 'arrow', 'flip', 'computeStyles', 'eventListeners', 'onFirstUpdate']\n */\n includeTooltipProps?: string[];\n };\n\nconst defaultTooltipProps = [\n 'title',\n 'theme',\n 'strategy',\n 'modifiers',\n 'placement',\n 'interaction',\n 'timeout',\n 'visible',\n 'defaultVisible',\n 'onVisibleChange',\n 'offset',\n 'preventOverflow',\n 'arrow',\n 'flip',\n 'computeStyles',\n 'eventListeners',\n 'onFirstUpdate',\n 'cursorAnchoring',\n];\n\nconst createMeasurerElement = (element: HTMLDivElement, text?: string) => {\n const styleElement = window.getComputedStyle(element, null);\n const temporaryElement = document.createElement('temporary-block');\n temporaryElement.style.display = styleElement.getPropertyValue('display');\n temporaryElement.style.padding = styleElement.getPropertyValue('padding');\n temporaryElement.style.position = 'absolute';\n temporaryElement.style.right = '0%';\n temporaryElement.style.bottom = '0%';\n temporaryElement.style.visibility = 'hidden';\n temporaryElement.style.fontFamily = styleElement.getPropertyValue('font-family');\n temporaryElement.style.fontSize = styleElement.getPropertyValue('font-size');\n temporaryElement.style.fontWeight = styleElement.getPropertyValue('font-weight');\n temporaryElement.style.lineHeight = styleElement.getPropertyValue('line-height');\n temporaryElement.style.whiteSpace = styleElement.getPropertyValue('white-space');\n temporaryElement.style.wordWrap = styleElement.getPropertyValue('word-wrap');\n\n temporaryElement.style.fontFeatureSettings =\n styleElement.getPropertyValue('font-feature-settings');\n temporaryElement.style.fontVariantNumeric = styleElement.getPropertyValue('font-variant-numeric');\n\n temporaryElement.innerHTML = text ?? element.innerHTML;\n return temporaryElement;\n};\n\nfunction isTextOverflowing(element: HTMLDivElement, multiline: boolean, text?: string): boolean {\n if (!element) return false;\n\n const { height: currentHeight, width: currentWidth } = element.getBoundingClientRect();\n const measuringElement = createMeasurerElement(element, text);\n let isOverflowing = false;\n\n document.body.appendChild(measuringElement);\n if (multiline) {\n measuringElement.style.width = `${currentWidth}px`;\n\n const width = measuringElement.scrollWidth;\n const height = measuringElement.getBoundingClientRect().height;\n\n if (Math.ceil(currentHeight) < height || Math.ceil(currentWidth) < width) {\n isOverflowing = true;\n }\n } else {\n measuringElement.style.whiteSpace = 'nowrap';\n isOverflowing = Math.ceil(currentWidth) < measuringElement.getBoundingClientRect().width;\n }\n\n document.body.removeChild(measuringElement);\n\n return isOverflowing;\n}\n\nconst forcedAdvancedMode = { forcedAdvancedMode: true } as any;\nconst noAdvancedMode = {} as any;\n\nclass RootEllipsis extends Component<AsProps> {\n static displayName = 'Ellipsis';\n static style = style;\n static defaultProps: AsProps = {\n trim: 'end',\n tooltip: true,\n includeTooltipProps: defaultTooltipProps,\n __excludeProps: ['title'],\n };\n\n state = {\n visible: false,\n };\n\n textRef = React.createRef<HTMLDivElement>();\n\n showTooltip() {\n const { maxLine = 1, Children } = this.asProps;\n const text = reactToText(getOriginChildren(Children));\n return isTextOverflowing(this.textRef.current!, maxLine > 1, text);\n }\n\n handlerVisibleChange = (visible: boolean) => {\n this.setState({ visible: visible && this.showTooltip() });\n };\n\n getContentProps() {\n return {\n ref: this.textRef,\n maxLine: this.asProps.maxLine,\n };\n }\n\n getPopperProps() {\n const { Children, includeTooltipProps } = this.asProps;\n const text = reactToText(getOriginChildren(Children));\n const tooltipProps = pick(this.asProps, includeTooltipProps as any) as TooltipProps;\n return { children: text, ...tooltipProps };\n }\n\n render() {\n const SEllipsis = this.Root;\n const SContainer = Tooltip;\n const SNoTooltipContainer = Box;\n const {\n styles,\n Children,\n maxLine,\n tooltip,\n trim,\n containerRect,\n containerRef,\n includeTooltipProps,\n children: _children,\n ...other\n } = this.asProps;\n const { visible } = this.state;\n const advancedContent = findComponent(Children, [(Ellipsis as any).Content.displayName]);\n const text = reactToText(advancedContent || getOriginChildren(Children));\n const advanceMode = isAdvanceMode(Children, [\n (Ellipsis as any).Content.displayName,\n (Ellipsis as any).Popper.displayName,\n ]);\n const tooltipProps = pick(this.asProps, includeTooltipProps as any) as TooltipProps;\n\n tooltipProps.visible = tooltipProps.visible ?? visible;\n tooltipProps.onVisibleChange = tooltipProps.onVisibleChange\n ? callAllEventHandlers(tooltipProps.onVisibleChange, this.handlerVisibleChange)\n : this.handlerVisibleChange;\n\n if (trim === 'middle') {\n return sstyled(styles)(\n <EllipsisMiddle\n text={text}\n styles={styles}\n tooltip={tooltip}\n containerRect={containerRect}\n containerRef={containerRef}\n textRef={this.textRef}\n tooltipProps={tooltipProps}\n advanceMode={advanceMode}\n {...other}\n >\n <Children />\n </EllipsisMiddle>,\n );\n }\n if (tooltip) {\n return sstyled(styles)(\n <SContainer\n interaction='hover'\n title={!advanceMode ? text : undefined}\n {...tooltipProps}\n {...(advanceMode ? forcedAdvancedMode : noAdvancedMode)}\n >\n {advanceMode\n ? (\n <Children />\n )\n : (\n <SEllipsis render={Box} ref={this.textRef} maxLine={maxLine} {...other}>\n <Children />\n </SEllipsis>\n )}\n </SContainer>,\n );\n }\n return sstyled(styles)(\n <SNoTooltipContainer>\n {advanceMode\n ? (\n <Children />\n )\n : (\n <SEllipsis render={Box} ref={this.textRef} maxLine={maxLine} {...other}>\n <Children />\n </SEllipsis>\n )}\n </SNoTooltipContainer>,\n );\n }\n}\n\nconst EllipsisMiddleContext = React.createContext<null | {\n begining: string;\n tail: string;\n ref: React.RefObject<HTMLElement>;\n}>(null);\n\nconst EllipsisMiddle: React.FC<AsPropsMiddle> = (props) => {\n const {\n styles,\n text,\n tooltip,\n containerRect,\n containerRef,\n textRef,\n tooltipProps,\n children,\n advanceMode,\n ...otherProps\n } = props;\n const resizeElement = React.useRef<HTMLDivElement>(null);\n const [dimension, setDimension] = React.useState<{ fontSize: string; symbolWidth: number }>({\n fontSize: '14',\n symbolWidth: 0,\n });\n const blockWidth = useResizeObserver(resizeElement, containerRect).width;\n\n useEnhancedEffect(() => {\n const node = containerRef?.current || resizeElement?.current;\n if (!node) return;\n\n const dateSpan = document.createElement('temporary-block');\n dateSpan.setAttribute('style', `fontSize: ${dimension.fontSize}px`);\n dateSpan.innerHTML = 'a';\n document.body.appendChild(dateSpan);\n const rect = dateSpan.getBoundingClientRect();\n\n setDimension({\n fontSize: window.getComputedStyle(node, null).getPropertyValue('font-size'),\n symbolWidth: rect.width,\n });\n document.body.removeChild(dateSpan);\n }, []);\n\n const STail = 'span';\n const SBeginning = 'span';\n const SContainerMiddle = props.tag || Box;\n const SAdvancedModeContainerMiddle = Tooltip;\n const displayedSymbols = React.useMemo(\n () => Math.round(blockWidth / dimension.symbolWidth),\n [blockWidth, dimension.symbolWidth],\n );\n\n const interaction = text.length > displayedSymbols ? 'hover' : 'none';\n const ref = containerRef ?? resizeElement;\n const contextValue = React.useMemo(\n () => ({\n begining: text.substring(0, text.length - displayedSymbols / 2 - 1),\n tail: text.substring(text.length - displayedSymbols / 2 - 1),\n ref,\n }),\n [text, displayedSymbols],\n );\n\n if (advanceMode) {\n return sstyled(styles)(\n <SAdvancedModeContainerMiddle\n interaction={interaction}\n {...tooltipProps}\n {...forcedAdvancedMode}\n >\n <EllipsisMiddleContext.Provider value={contextValue}>\n {children}\n </EllipsisMiddleContext.Provider>\n </SAdvancedModeContainerMiddle>,\n ) as any;\n }\n if (tooltip) {\n return sstyled(styles)(\n <SContainerMiddle\n interaction={interaction}\n title={text as any}\n ref={forkRef(ref, textRef)}\n tag={Tooltip}\n __excludeProps={['title']}\n {...tooltipProps}\n >\n <SBeginning>{contextValue.begining}</SBeginning>\n <STail>{contextValue.tail}</STail>\n </SContainerMiddle>,\n ) as any;\n }\n return sstyled(styles)(\n <SContainerMiddle {...otherProps} ref={containerRef ?? resizeElement}>\n <SBeginning>{contextValue.begining}</SBeginning>\n <STail>{contextValue.tail}</STail>\n </SContainerMiddle>,\n ) as any;\n};\n\ntype EllipsisContentAsProps = {\n styles: any;\n Children: React.FC;\n};\n\nconst Content: React.FC<EllipsisContentAsProps> = ({ styles, Children }) => {\n const SEllipsis = Root;\n const ellipsisMiddleContext = React.useContext(EllipsisMiddleContext);\n const STail = 'span';\n const SBeginning = 'span';\n\n if (ellipsisMiddleContext) {\n const { begining, tail, ref } = ellipsisMiddleContext;\n return sstyled(styles)(\n <SEllipsis render={Tooltip.Trigger} middle-mod ref={ref}>\n <SBeginning>{begining}</SBeginning>\n <STail>{tail}</STail>\n </SEllipsis>,\n ) as any;\n }\n\n return sstyled(styles)(\n <SEllipsis render={Tooltip.Trigger}>\n <Children />\n </SEllipsis>,\n ) as any;\n};\n\nconst Ellipsis = createComponent(RootEllipsis, {\n Content,\n Popper: Tooltip.Popper,\n}) as any as Intergalactic.Component<'div', EllipsisProps> & {\n Content: typeof Box;\n Popper: typeof Tooltip.Popper;\n};\n\nexport default Ellipsis;\n"],"mappings":";;;;;;;;;;;;;;;;AAAA,SAASA,eAAe,EAAEC,SAAS,EAAsBC,IAAI,EAAEC,OAAO,QAAQ,eAAe;AAC7F,SAASC,oBAAoB,QAAQ,qCAAqC;AAC1E,OAAOC,aAAa,IAAIC,aAAa,QAAQ,uCAAuC;AACpF,OAAOC,iBAAiB,MAAM,2CAA2C;AACzE,OAAOC,IAAI,MAAM,8BAA8B;AAC/C,OAAOC,WAAW,MAAM,qCAAqC;AAC7D,SAASC,OAAO,QAAQ,6BAA6B;AACrD,OAAOC,iBAAiB,MAAM,+CAA+C;AAC7E,SAASC,GAAG,QAAuB,mBAAmB;AACtD,OAAOC,OAAO,MAA6B,kBAAkB;AAC7D,OAAOC,KAAK,MAA0B,OAAO;AAAC;AAAA,IAAAC,KAAA,8BAAAC,QAAA,CAAAC,MAAA;AAAA;AAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;AAAA;AAG9C,SAASC,iBAAiB,QAAQ,qBAAqB;AA2DvD,IAAMC,mBAAmB,GAAG,CAC1B,OAAO,EACP,OAAO,EACP,UAAU,EACV,WAAW,EACX,WAAW,EACX,aAAa,EACb,SAAS,EACT,SAAS,EACT,gBAAgB,EAChB,iBAAiB,EACjB,QAAQ,EACR,iBAAiB,EACjB,OAAO,EACP,MAAM,EACN,eAAe,EACf,gBAAgB,EAChB,eAAe,EACf,iBAAiB,CAClB;AAED,IAAMC,qBAAqB,GAAG,SAAxBA,qBAAqBA,CAAIC,OAAuB,EAAEC,IAAa,EAAK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AQb,QAAQ,GAAgBW,qBAAqB,CAA7CX,QAAQ;MAAEE,IAAI,GAAUS,qBAAqB,CAAnCT,IAAI;MAAEtE,GAAG,GAAK+E,qBAAqB,CAA7B/E,GAAG;IAC3B,OAAAiF,KAAA,GAAO1K,OAAO,CAACuG,MAAM,CAAC,eACpB5F,KAAA,CAAAc,aAAA,CAAC0E,SAAS,EAAAuE,KAAA,CAAA/C,EAAA,cAAA7B,aAAA,KAAA6E,YAAA;MAAA;MAAA,OAA0ClF;IAAG,GAAA2E,IAAA,kBACrDzJ,KAAA,CAAAc,aAAA,CAAC2H,UAAU,EAAAsB,KAAA,CAAA/C,EAAA,oBAAEkC,QAAqB,CAAC,eACnClJ,KAAA,CAAAc,aAAA,CAAC0H,KAAK,EAAAuB,KAAA,CAAA/C,EAAA,eAAEoC,IAAY,CACX,CAAC;EAEhB;EAEA,OAAAO,KAAA,GAAOtK,OAAO,CAACuG,MAAM,CAAC,eACpB5F,KAAA,CAAAc,aAAA,CAAC0E,SAAS,EAAAmE,KAAA,CAAA3C,EAAA,cAAA7B,aAAA,KAAA8E,aAAA,KAAAR,IAAA,kBACRzJ,KAAA,CAAAc,aAAA,CAAC4D,QAAQ,EAAAiF,KAAA,CAAA3C,EAAA,gBAAE,CACF,CAAC;AAEhB,CAAC;AAED,IAAMT,QAAQ,GAAGrH,eAAe,CAACgE,YAAY,EAAE;EAC7CsD,OAAO,EAAPA,OAAO;EACPG,MAAM,EAAE5G,OAAO,CAAC4G;AAClB,CAAC,CAGA;AAED,eAAeJ,QAAQ","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"Ellipsis.js","names":["createComponent","Component","Root","sstyled","callAllEventHandlers","findComponent","isAdvanceMode","getOriginChildren","pick","reactToText","forkRef","useEnhancedEffect","Box","Tooltip","React","style","_sstyled","insert","useResizeObserver","defaultTooltipProps","setFontSettings","element","styleElement","fontFamily","getPropertyValue","fontSize","fontWeight","lineHeight","fontFeatureSettings","fontVariantNumeric","createMeasurerElement","text","window","getComputedStyle","temporaryElement","document","createElement","display","padding","position","right","bottom","visibility","whiteSpace","wordWrap","innerHTML","isTextOverflowing","multiline","_element$getBoundingC","getBoundingClientRect","currentHeight","height","currentWidth","width","measuringElement","isOverflowing","body","appendChild","concat","scrollWidth","Math","ceil","removeChild","forcedAdvancedMode","noAdvancedMode","RootEllipsis","_Component","_this","_classCallCheck","_len","arguments","length","args","Array","_key","_callSuper","_defineProperty","visible","createRef","setState","showTooltip","_inherits","_createClass","key","value","_this$asProps","asProps","_this$asProps$maxLine","maxLine","Children","textRef","current","getContentProps","ref","getPopperProps","_this$asProps2","includeTooltipProps","tooltipProps","_objectSpread","children","render","_ref3","_tooltipProps$visible","SEllipsis","SContainer","_this$asProps3","styles","tooltip","trim","containerRect","containerRef","_children","other","_objectWithoutProperties","_excluded","state","advancedContent","Ellipsis","Content","displayName","advanceMode","Popper","onVisibleChange","handlerVisibleChange","_ref2","EllipsisMiddle","cn","undefined","__excludeProps","EllipsisMiddleContext","createContext","props","_ref5","tag","resizeElement","useRef","_React$useState","useState","_React$useState2","_slicedToArray","symbolWidth","setSymbolWidth","blockWidth","node","dateSpan","rect","STail","SBeginning","SContainerMiddle","SAdvancedModeContainerMiddle","displayedSymbols","useMemo","round","interaction","contextValue","begining","substring","tail","_ref4","Provider","_ref8","_ref","arguments[0]","_ref7","Trigger","ellipsisMiddleContext","useContext","_ref6","_assignProps","_assignProps2"],"sources":["../../src/Ellipsis.tsx"],"sourcesContent":["import { createComponent, Component, type Intergalactic, Root, sstyled } from '@semcore/core';\nimport { callAllEventHandlers } from '@semcore/core/lib/utils/assignProps';\nimport findComponent, { isAdvanceMode } from '@semcore/core/lib/utils/findComponent';\nimport getOriginChildren from '@semcore/core/lib/utils/getOriginChildren';\nimport pick from '@semcore/core/lib/utils/pick';\nimport reactToText from '@semcore/core/lib/utils/reactToText';\nimport { forkRef } from '@semcore/core/lib/utils/ref';\nimport useEnhancedEffect from '@semcore/core/lib/utils/use/useEnhancedEffect';\nimport { Box, type BoxProps } from '@semcore/flex-box';\nimport Tooltip, { type TooltipProps } from '@semcore/tooltip';\nimport React, { type RefObject } from 'react';\n\nimport style from './style/ellipsis.shadow.css';\nimport { useResizeObserver } from './useResizeObserver';\n\ntype AsProps = {\n maxLine?: number;\n trim?: 'end' | 'middle';\n tooltip?: boolean;\n styles?: React.CSSProperties;\n containerRect?: { width: number };\n\n containerRef?: RefObject<HTMLDivElement>;\n includeTooltipProps?: string[];\n __excludeProps?: string[];\n};\n\ntype AsPropsMiddle = {\n text: string;\n textRef: RefObject<HTMLElement>;\n tooltip?: boolean;\n styles?: React.CSSProperties;\n containerRect?: { width: number };\n\n containerRef?: RefObject<HTMLDivElement>;\n tooltipProps: TooltipProps;\n children?: React.ReactNode;\n advanceMode?: boolean;\n tag?: React.ElementType;\n};\n\ntype EllipsisProps = BoxProps &\n Partial<TooltipProps> & {\n /**\n * Rows count in multiline Ellipsis\n * @default 1\n */\n maxLine?: number;\n /**\n * Trimming type\n * @default end\n */\n trim?: 'end' | 'middle';\n /**\n * Show tooltip\n * @default true\n */\n tooltip?: boolean;\n /**\n * Ref to the item that will be observed by ResizeObserver\n */\n containerRef?: RefObject<HTMLDivElement>;\n /**\n * Explicit sizes of container text should be trimmed in\n **/\n containerRect?: { width: number };\n /** List of props that will be passed to tooltip\n * @default ['title', 'theme', 'strategy', 'modifiers', 'placement', 'interaction', 'timeout', 'visible', 'defaultVisible', 'onVisibleChange', 'offset', 'preventOverflow', 'arrow', 'flip', 'computeStyles', 'eventListeners', 'onFirstUpdate']\n */\n includeTooltipProps?: string[];\n };\n\nconst defaultTooltipProps = [\n 'title',\n 'theme',\n 'strategy',\n 'modifiers',\n 'placement',\n 'interaction',\n 'timeout',\n 'visible',\n 'defaultVisible',\n 'onVisibleChange',\n 'offset',\n 'preventOverflow',\n 'arrow',\n 'flip',\n 'computeStyles',\n 'eventListeners',\n 'onFirstUpdate',\n 'cursorAnchoring',\n];\n\nconst setFontSettings = (element: HTMLElement, styleElement: CSSStyleDeclaration): void => {\n element.style.fontFamily = styleElement.getPropertyValue('font-family');\n element.style.fontSize = styleElement.getPropertyValue('font-size');\n element.style.fontWeight = styleElement.getPropertyValue('font-weight');\n element.style.lineHeight = styleElement.getPropertyValue('line-height');\n element.style.fontFeatureSettings =\n styleElement.getPropertyValue('font-feature-settings');\n element.style.fontVariantNumeric = styleElement.getPropertyValue('font-variant-numeric');\n};\n\nconst createMeasurerElement = (element: HTMLDivElement, text?: string) => {\n const styleElement = window.getComputedStyle(element, null);\n const temporaryElement = document.createElement('temporary-block');\n temporaryElement.style.display = styleElement.getPropertyValue('display');\n temporaryElement.style.padding = styleElement.getPropertyValue('padding');\n temporaryElement.style.position = 'absolute';\n temporaryElement.style.right = '0%';\n temporaryElement.style.bottom = '0%';\n temporaryElement.style.visibility = 'hidden';\n temporaryElement.style.whiteSpace = styleElement.getPropertyValue('white-space');\n temporaryElement.style.wordWrap = styleElement.getPropertyValue('word-wrap');\n\n setFontSettings(temporaryElement, styleElement);\n\n temporaryElement.innerHTML = text ?? element.innerHTML;\n return temporaryElement;\n};\n\nfunction isTextOverflowing(element: HTMLDivElement, multiline: boolean, text?: string): boolean {\n if (!element) return false;\n\n const { height: currentHeight, width: currentWidth } = element.getBoundingClientRect();\n const measuringElement = createMeasurerElement(element, text);\n let isOverflowing = false;\n\n document.body.appendChild(measuringElement);\n if (multiline) {\n measuringElement.style.width = `${currentWidth}px`;\n\n const width = measuringElement.scrollWidth;\n const height = measuringElement.getBoundingClientRect().height;\n\n if (Math.ceil(currentHeight) < height || Math.ceil(currentWidth) < width) {\n isOverflowing = true;\n }\n } else {\n measuringElement.style.whiteSpace = 'nowrap';\n isOverflowing = Math.ceil(currentWidth) < measuringElement.getBoundingClientRect().width;\n }\n\n document.body.removeChild(measuringElement);\n\n return isOverflowing;\n}\n\nconst forcedAdvancedMode = { forcedAdvancedMode: true } as any;\nconst noAdvancedMode = {} as any;\n\nclass RootEllipsis extends Component<AsProps> {\n static displayName = 'Ellipsis';\n static style = style;\n static defaultProps: AsProps = {\n trim: 'end',\n tooltip: true,\n includeTooltipProps: defaultTooltipProps,\n __excludeProps: ['title'],\n };\n\n state = {\n visible: false,\n };\n\n textRef = React.createRef<HTMLDivElement>();\n\n showTooltip() {\n const { maxLine = 1, Children } = this.asProps;\n const text = reactToText(getOriginChildren(Children));\n return isTextOverflowing(this.textRef.current!, maxLine > 1, text);\n }\n\n handlerVisibleChange = (visible: boolean) => {\n this.setState({ visible: visible && this.showTooltip() });\n };\n\n getContentProps() {\n return {\n ref: this.textRef,\n maxLine: this.asProps.maxLine,\n };\n }\n\n getPopperProps() {\n const { Children, includeTooltipProps } = this.asProps;\n const text = reactToText(getOriginChildren(Children));\n const tooltipProps = pick(this.asProps, includeTooltipProps as any) as TooltipProps;\n return { children: text, ...tooltipProps };\n }\n\n render() {\n const SEllipsis = this.Root;\n const SContainer = Tooltip;\n const {\n styles,\n Children,\n maxLine,\n tooltip,\n trim,\n containerRect,\n containerRef,\n includeTooltipProps,\n children: _children,\n ...other\n } = this.asProps;\n const { visible } = this.state;\n const advancedContent = findComponent(Children, [(Ellipsis as any).Content.displayName]);\n const text = reactToText(advancedContent || getOriginChildren(Children));\n const advanceMode = isAdvanceMode(Children, [\n (Ellipsis as any).Content.displayName,\n (Ellipsis as any).Popper.displayName,\n ]);\n const tooltipProps = pick(this.asProps, includeTooltipProps as any) as TooltipProps;\n\n tooltipProps.visible = tooltipProps.visible ?? visible;\n tooltipProps.onVisibleChange = tooltipProps.onVisibleChange\n ? callAllEventHandlers(tooltipProps.onVisibleChange, this.handlerVisibleChange)\n : this.handlerVisibleChange;\n\n if (trim === 'middle') {\n return sstyled(styles)(\n <EllipsisMiddle\n text={text}\n styles={styles}\n tooltip={tooltip}\n containerRect={containerRect}\n containerRef={containerRef}\n textRef={this.textRef}\n tooltipProps={tooltipProps}\n advanceMode={advanceMode}\n {...other}\n >\n <Children />\n </EllipsisMiddle>,\n );\n }\n\n return sstyled(styles)(\n <SContainer\n interaction={tooltip ? 'hover' : 'none'}\n title={!advanceMode ? text : undefined}\n {...tooltipProps}\n {...(advanceMode ? forcedAdvancedMode : noAdvancedMode)}\n >\n {advanceMode\n ? (\n <Children />\n )\n : (\n <SEllipsis render={Box} ref={this.textRef} maxLine={maxLine} {...other}>\n <Children />\n </SEllipsis>\n )}\n </SContainer>,\n );\n }\n}\n\nconst EllipsisMiddleContext = React.createContext<null | {\n begining: string;\n tail: string;\n ref: React.RefObject<HTMLElement>;\n}>(null);\n\nconst EllipsisMiddle: React.FC<AsPropsMiddle> = (props) => {\n const {\n styles,\n text,\n tooltip,\n containerRect,\n containerRef,\n textRef,\n tooltipProps,\n children,\n advanceMode,\n tag,\n } = props;\n\n const resizeElement = React.useRef<HTMLDivElement>(null);\n const [symbolWidth, setSymbolWidth] = React.useState(0);\n const blockWidth = useResizeObserver(resizeElement, containerRect).width;\n\n useEnhancedEffect(() => {\n const node = containerRef?.current || resizeElement?.current;\n if (!node) return;\n\n const styleElement = window.getComputedStyle(node);\n const dateSpan = document.createElement('temporary-block');\n\n setFontSettings(dateSpan, styleElement);\n dateSpan.innerHTML = 'a';\n document.body.appendChild(dateSpan);\n const rect = dateSpan.getBoundingClientRect();\n\n setSymbolWidth(rect.width);\n document.body.removeChild(dateSpan);\n }, []);\n\n const STail = 'span';\n const SBeginning = 'span';\n const SContainerMiddle = Tooltip;\n const SAdvancedModeContainerMiddle = Tooltip;\n const displayedSymbols = React.useMemo(\n () => {\n const displayedSymbols = Math.round(blockWidth / symbolWidth);\n\n return displayedSymbols % 2 === 0 ? displayedSymbols : displayedSymbols - 1;\n },\n [blockWidth, symbolWidth],\n );\n\n const interaction = text.length > displayedSymbols ? 'hover' : 'none';\n const ref = containerRef ?? resizeElement;\n const contextValue = React.useMemo(\n () => ({\n begining: text.substring(0, text.length - displayedSymbols / 2 - 1),\n tail: text.substring(text.length - displayedSymbols / 2 - 1),\n ref,\n }),\n [text, displayedSymbols],\n );\n\n if (advanceMode) {\n return sstyled(styles)(\n <SAdvancedModeContainerMiddle\n interaction={tooltip ? interaction : 'none'}\n {...tooltipProps}\n {...forcedAdvancedMode}\n >\n <EllipsisMiddleContext.Provider value={contextValue}>\n {children}\n </EllipsisMiddleContext.Provider>\n </SAdvancedModeContainerMiddle>,\n );\n }\n return sstyled(styles)(\n <SContainerMiddle\n interaction={tooltip ? interaction : 'none'}\n title={text}\n ref={forkRef(ref, textRef)}\n tag={tag}\n {...tooltipProps}\n >\n <SBeginning>{contextValue.begining}</SBeginning>\n <STail>{contextValue.tail}</STail>\n </SContainerMiddle>,\n );\n};\n\ntype EllipsisContentAsProps = {\n styles: any;\n Children: React.FC;\n};\n\nconst Content: React.FC<EllipsisContentAsProps> = ({ styles, Children }) => {\n const SEllipsis = Root;\n const ellipsisMiddleContext = React.useContext(EllipsisMiddleContext);\n const STail = 'span';\n const SBeginning = 'span';\n\n if (ellipsisMiddleContext) {\n const { begining, tail, ref } = ellipsisMiddleContext;\n return sstyled(styles)(\n <SEllipsis render={Tooltip.Trigger} middle-mod ref={ref}>\n <SBeginning>{begining}</SBeginning>\n <STail>{tail}</STail>\n </SEllipsis>,\n ) as any;\n }\n\n return sstyled(styles)(\n <SEllipsis render={Tooltip.Trigger}>\n <Children />\n </SEllipsis>,\n ) as any;\n};\n\nconst Ellipsis = createComponent(RootEllipsis, {\n Content,\n Popper: Tooltip.Popper,\n}) as any as Intergalactic.Component<'div', EllipsisProps> & {\n Content: typeof Box;\n Popper: typeof Tooltip.Popper;\n};\n\nexport default Ellipsis;\n"],"mappings":";;;;;;;;;;;;;;;AAAA,SAASA,eAAe,EAAEC,SAAS,EAAsBC,IAAI,EAAEC,OAAO,QAAQ,eAAe;AAC7F,SAASC,oBAAoB,QAAQ,qCAAqC;AAC1E,OAAOC,aAAa,IAAIC,aAAa,QAAQ,uCAAuC;AACpF,OAAOC,iBAAiB,MAAM,2CAA2C;AACzE,OAAOC,IAAI,MAAM,8BAA8B;AAC/C,OAAOC,WAAW,MAAM,q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,CAAC+G,UAAU,EAAAoB,KAAA,CAAAzC,EAAA,oBAAE6B,QAAqB,CAAC,eACnC7I,KAAA,CAAAsB,aAAA,CAAC8G,KAAK,EAAAqB,KAAA,CAAAzC,EAAA,eAAE+B,IAAY,CACX,CAAC;EAEhB;EAEA,OAAAM,KAAA,GAAOhK,OAAO,CAACuG,MAAM,CAAC,eACpB5F,KAAA,CAAAsB,aAAA,CAACmE,SAAS,EAAA4D,KAAA,CAAArC,EAAA,cAAA5B,aAAA,KAAAuE,aAAA,KAAAR,IAAA,kBACRnJ,KAAA,CAAAsB,aAAA,CAACqD,QAAQ,EAAA0E,KAAA,CAAArC,EAAA,gBAAE,CACF,CAAC;AAEhB,CAAC;AAED,IAAMT,QAAQ,GAAGrH,eAAe,CAACiE,YAAY,EAAE;EAC7CqD,OAAO,EAAPA,OAAO;EACPG,MAAM,EAAE5G,OAAO,CAAC4G;AAClB,CAAC,CAGA;AAED,eAAeJ,QAAQ","ignoreList":[]}
|
package/lib/es6/index.d.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.js","names":[],"sources":["../../src/index.d.ts"],"sourcesContent":["import type { UnknownProperties, Intergalactic } from '@semcore/core';\nimport type { Box, BoxProps } from '@semcore/flex-box';\nimport type { TooltipProps } from '@semcore/tooltip';\nimport type Tooltip from '@semcore/tooltip';\nimport type { RefObject } from 'react';\n\n/** @deprecated */\nexport interface IEllipsisProps extends EllipsisProps, UnknownProperties {}\nexport type EllipsisProps = BoxProps &\n Partial<TooltipProps> & {\n /**\n * Rows count in multiline Ellipsis
|
|
1
|
+
{"version":3,"file":"index.d.js","names":[],"sources":["../../src/index.d.ts"],"sourcesContent":["import type { UnknownProperties, Intergalactic } from '@semcore/core';\nimport type { Box, BoxProps } from '@semcore/flex-box';\nimport type { TooltipProps } from '@semcore/tooltip';\nimport type Tooltip from '@semcore/tooltip';\nimport type { RefObject } from 'react';\n\n/** @deprecated */\nexport interface IEllipsisProps extends EllipsisProps, UnknownProperties {}\nexport type EllipsisProps = BoxProps &\n Partial<TooltipProps> & {\n /**\n * Rows count in multiline Ellipsis.\n * Applies only for `trim = end`\n * @default 1\n */\n maxLine?: number;\n /**\n * Trimming type\n * @default end\n */\n trim?: 'end' | 'middle';\n /**\n * Show tooltip\n * @default true\n */\n tooltip?: boolean;\n /**\n * Ref to the item that will be observed by ResizeObserver\n */\n containerRef?: RefObject<HTMLElement | null>;\n /**\n * Explicit sizes of container text should be trimmed in\n **/\n containerRect?: { width: number };\n /** List of props that will be passed to tooltip\n * @default ['title', 'theme', 'strategy', 'modifiers', 'placement', 'interaction', 'timeout', 'visible', 'defaultVisible', 'onVisibleChange', 'offset', 'preventOverflow', 'arrow', 'flip', 'computeStyles', 'eventListeners', 'onFirstUpdate']\n */\n includeTooltipProps?: string[];\n };\n\ndeclare const useResizeObserver: (\n ref: RefObject<HTMLElement>,\n hookOverride?: { width: number },\n) => { width: number };\n\ndeclare const Ellipsis: Intergalactic.Component<'div', EllipsisProps> & {\n Content: typeof Box;\n Popper: typeof Tooltip.Popper;\n};\n\nexport { useResizeObserver };\nexport default Ellipsis;\n"],"mappings":"","ignoreList":[]}
|
|
@@ -1,10 +1,3 @@
|
|
|
1
|
-
SContainer,
|
|
2
|
-
SNoTooltipContainer,
|
|
3
|
-
SContainerMiddle {
|
|
4
|
-
display: flex;
|
|
5
|
-
overflow: hidden;
|
|
6
|
-
}
|
|
7
|
-
|
|
8
1
|
SBeginning,
|
|
9
2
|
SEllipsis {
|
|
10
3
|
overflow: hidden;
|
|
@@ -13,7 +6,9 @@ SEllipsis {
|
|
|
13
6
|
white-space: pre;
|
|
14
7
|
}
|
|
15
8
|
|
|
16
|
-
|
|
9
|
+
SContainer,
|
|
10
|
+
SNoTooltipContainer,
|
|
11
|
+
SContainerMiddle {
|
|
17
12
|
display: flex;
|
|
18
13
|
overflow: hidden;
|
|
19
14
|
}
|
|
@@ -27,6 +22,11 @@ SEllipsis[maxLine] {
|
|
|
27
22
|
overflow-wrap: break-word;
|
|
28
23
|
}
|
|
29
24
|
|
|
25
|
+
SEllipsis[middle-mod] {
|
|
26
|
+
display: flex;
|
|
27
|
+
overflow: hidden;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
30
|
SContainerMiddle> :has(SBeginning),
|
|
31
31
|
SContainerMiddle> :has(STail) {
|
|
32
32
|
display: flex;
|
package/lib/esm/Ellipsis.mjs
CHANGED
|
@@ -20,7 +20,7 @@ import { Box } from "@semcore/flex-box";
|
|
|
20
20
|
import Tooltip from "@semcore/tooltip";
|
|
21
21
|
import React from "react";
|
|
22
22
|
import { useResizeObserver } from "./useResizeObserver.mjs";
|
|
23
|
-
var _excluded = ["styles", "Children", "maxLine", "tooltip", "trim", "containerRect", "containerRef", "includeTooltipProps", "children"]
|
|
23
|
+
var _excluded = ["styles", "Children", "maxLine", "tooltip", "trim", "containerRect", "containerRef", "includeTooltipProps", "children"];
|
|
24
24
|
function _callSuper(t, o, e) {
|
|
25
25
|
return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e));
|
|
26
26
|
}
|
|
@@ -29,23 +29,31 @@ var style = (
|
|
|
29
29
|
/*__reshadow_css_start__*/
|
|
30
30
|
(sstyled.insert(
|
|
31
31
|
/*__inner_css_start__*/
|
|
32
|
-
".
|
|
32
|
+
".___SBeginning_yog1u_gg_,.___SEllipsis_yog1u_gg_{overflow:hidden;display:inline-block;text-overflow:ellipsis;white-space:pre}.___SEllipsis_yog1u_gg_.__maxLine_yog1u_gg_{display:-webkit-box;-webkit-line-clamp:var(--maxLine_yog1u);-webkit-box-orient:vertical;overflow:hidden;white-space:normal;word-wrap:break-word}.___SContainerMiddle_yog1u_gg_,.___SContainer_yog1u_gg_,.___SEllipsis_yog1u_gg_.__middle-mod_yog1u_gg_,.___SNoTooltipContainer_yog1u_gg_{display:flex;overflow:hidden}.___SContainerMiddle_yog1u_gg_>:has(.___SBeginning_yog1u_gg_),.___SContainerMiddle_yog1u_gg_>:has(.___STail_yog1u_gg_){display:flex;width:100%}.___STail_yog1u_gg_{white-space:pre}",
|
|
33
33
|
/*__inner_css_end__*/
|
|
34
|
-
"
|
|
34
|
+
"yog1u_gg_"
|
|
35
35
|
), /*__reshadow_css_end__*/
|
|
36
36
|
{
|
|
37
|
-
"
|
|
38
|
-
"
|
|
39
|
-
"
|
|
40
|
-
"
|
|
41
|
-
"
|
|
42
|
-
"
|
|
43
|
-
"
|
|
44
|
-
"
|
|
45
|
-
"__STail": "
|
|
37
|
+
"__SBeginning": "___SBeginning_yog1u_gg_",
|
|
38
|
+
"__SEllipsis": "___SEllipsis_yog1u_gg_",
|
|
39
|
+
"__SContainer": "___SContainer_yog1u_gg_",
|
|
40
|
+
"__SNoTooltipContainer": "___SNoTooltipContainer_yog1u_gg_",
|
|
41
|
+
"__SContainerMiddle": "___SContainerMiddle_yog1u_gg_",
|
|
42
|
+
"_maxLine": "__maxLine_yog1u_gg_",
|
|
43
|
+
"--maxLine": "--maxLine_yog1u",
|
|
44
|
+
"_middle-mod": "__middle-mod_yog1u_gg_",
|
|
45
|
+
"__STail": "___STail_yog1u_gg_"
|
|
46
46
|
})
|
|
47
47
|
);
|
|
48
48
|
var defaultTooltipProps = ["title", "theme", "strategy", "modifiers", "placement", "interaction", "timeout", "visible", "defaultVisible", "onVisibleChange", "offset", "preventOverflow", "arrow", "flip", "computeStyles", "eventListeners", "onFirstUpdate", "cursorAnchoring"];
|
|
49
|
+
var setFontSettings = function setFontSettings2(element, styleElement) {
|
|
50
|
+
element.style.fontFamily = styleElement.getPropertyValue("font-family");
|
|
51
|
+
element.style.fontSize = styleElement.getPropertyValue("font-size");
|
|
52
|
+
element.style.fontWeight = styleElement.getPropertyValue("font-weight");
|
|
53
|
+
element.style.lineHeight = styleElement.getPropertyValue("line-height");
|
|
54
|
+
element.style.fontFeatureSettings = styleElement.getPropertyValue("font-feature-settings");
|
|
55
|
+
element.style.fontVariantNumeric = styleElement.getPropertyValue("font-variant-numeric");
|
|
56
|
+
};
|
|
49
57
|
var createMeasurerElement = function createMeasurerElement2(element, text) {
|
|
50
58
|
var styleElement = window.getComputedStyle(element, null);
|
|
51
59
|
var temporaryElement = document.createElement("temporary-block");
|
|
@@ -55,14 +63,9 @@ var createMeasurerElement = function createMeasurerElement2(element, text) {
|
|
|
55
63
|
temporaryElement.style.right = "0%";
|
|
56
64
|
temporaryElement.style.bottom = "0%";
|
|
57
65
|
temporaryElement.style.visibility = "hidden";
|
|
58
|
-
temporaryElement.style.fontFamily = styleElement.getPropertyValue("font-family");
|
|
59
|
-
temporaryElement.style.fontSize = styleElement.getPropertyValue("font-size");
|
|
60
|
-
temporaryElement.style.fontWeight = styleElement.getPropertyValue("font-weight");
|
|
61
|
-
temporaryElement.style.lineHeight = styleElement.getPropertyValue("line-height");
|
|
62
66
|
temporaryElement.style.whiteSpace = styleElement.getPropertyValue("white-space");
|
|
63
67
|
temporaryElement.style.wordWrap = styleElement.getPropertyValue("word-wrap");
|
|
64
|
-
temporaryElement
|
|
65
|
-
temporaryElement.style.fontVariantNumeric = styleElement.getPropertyValue("font-variant-numeric");
|
|
68
|
+
setFontSettings(temporaryElement, styleElement);
|
|
66
69
|
temporaryElement.innerHTML = text !== null && text !== void 0 ? text : element.innerHTML;
|
|
67
70
|
return temporaryElement;
|
|
68
71
|
};
|
|
@@ -138,10 +141,9 @@ var RootEllipsis = /* @__PURE__ */ function(_Component) {
|
|
|
138
141
|
}, {
|
|
139
142
|
key: "render",
|
|
140
143
|
value: function render() {
|
|
141
|
-
var
|
|
144
|
+
var _ref3, _tooltipProps$visible;
|
|
142
145
|
var SEllipsis = this.Root;
|
|
143
146
|
var SContainer = Tooltip;
|
|
144
|
-
var SNoTooltipContainer = Box;
|
|
145
147
|
var _this$asProps3 = this.asProps, styles = _this$asProps3.styles, Children = _this$asProps3.Children, maxLine = _this$asProps3.maxLine, tooltip = _this$asProps3.tooltip, trim = _this$asProps3.trim, containerRect = _this$asProps3.containerRect, containerRef = _this$asProps3.containerRef, includeTooltipProps = _this$asProps3.includeTooltipProps;
|
|
146
148
|
_this$asProps3.children;
|
|
147
149
|
var other = _objectWithoutProperties(_this$asProps3, _excluded);
|
|
@@ -165,22 +167,14 @@ var RootEllipsis = /* @__PURE__ */ function(_Component) {
|
|
|
165
167
|
"advanceMode": advanceMode
|
|
166
168
|
}, other)), /* @__PURE__ */ React.createElement(Children, _ref2.cn("Children", {})));
|
|
167
169
|
}
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
"title": !advanceMode ? text : void 0
|
|
173
|
-
}, tooltipProps), advanceMode ? forcedAdvancedMode : noAdvancedMode)), advanceMode ? /* @__PURE__ */ React.createElement(Children, _ref3.cn("Children", {})) : /* @__PURE__ */ React.createElement(SEllipsis, _ref3.cn("SEllipsis", _objectSpread({
|
|
174
|
-
"render": Box,
|
|
175
|
-
"ref": this.textRef,
|
|
176
|
-
"maxLine": maxLine
|
|
177
|
-
}, other)), /* @__PURE__ */ React.createElement(Children, _ref3.cn("Children", {}))));
|
|
178
|
-
}
|
|
179
|
-
return _ref4 = sstyled(styles), /* @__PURE__ */ React.createElement(SNoTooltipContainer, _ref4.cn("SNoTooltipContainer", {}), advanceMode ? /* @__PURE__ */ React.createElement(Children, _ref4.cn("Children", {})) : /* @__PURE__ */ React.createElement(SEllipsis, _ref4.cn("SEllipsis", _objectSpread({
|
|
170
|
+
return _ref3 = sstyled(styles), /* @__PURE__ */ React.createElement(SContainer, _ref3.cn("SContainer", _objectSpread(_objectSpread({
|
|
171
|
+
"interaction": tooltip ? "hover" : "none",
|
|
172
|
+
"title": !advanceMode ? text : void 0
|
|
173
|
+
}, tooltipProps), advanceMode ? forcedAdvancedMode : noAdvancedMode)), advanceMode ? /* @__PURE__ */ React.createElement(Children, _ref3.cn("Children", {})) : /* @__PURE__ */ React.createElement(SEllipsis, _ref3.cn("SEllipsis", _objectSpread({
|
|
180
174
|
"render": Box,
|
|
181
175
|
"ref": this.textRef,
|
|
182
176
|
"maxLine": maxLine
|
|
183
|
-
}, other)), /* @__PURE__ */ React.createElement(Children,
|
|
177
|
+
}, other)), /* @__PURE__ */ React.createElement(Children, _ref3.cn("Children", {}))));
|
|
184
178
|
}
|
|
185
179
|
}]);
|
|
186
180
|
}(Component);
|
|
@@ -194,35 +188,31 @@ _defineProperty(RootEllipsis, "defaultProps", {
|
|
|
194
188
|
});
|
|
195
189
|
var EllipsisMiddleContext = /* @__PURE__ */ React.createContext(null);
|
|
196
190
|
var EllipsisMiddle = function EllipsisMiddle2(props) {
|
|
197
|
-
var
|
|
198
|
-
var styles = props.styles, text = props.text, tooltip = props.tooltip, containerRect = props.containerRect, containerRef = props.containerRef, textRef = props.textRef, tooltipProps = props.tooltipProps, children = props.children, advanceMode = props.advanceMode,
|
|
191
|
+
var _ref5;
|
|
192
|
+
var styles = props.styles, text = props.text, tooltip = props.tooltip, containerRect = props.containerRect, containerRef = props.containerRef, textRef = props.textRef, tooltipProps = props.tooltipProps, children = props.children, advanceMode = props.advanceMode, tag = props.tag;
|
|
199
193
|
var resizeElement = React.useRef(null);
|
|
200
|
-
var _React$useState = React.useState(
|
|
201
|
-
fontSize: "14",
|
|
202
|
-
symbolWidth: 0
|
|
203
|
-
}), _React$useState2 = _slicedToArray(_React$useState, 2), dimension = _React$useState2[0], setDimension = _React$useState2[1];
|
|
194
|
+
var _React$useState = React.useState(0), _React$useState2 = _slicedToArray(_React$useState, 2), symbolWidth = _React$useState2[0], setSymbolWidth = _React$useState2[1];
|
|
204
195
|
var blockWidth = useResizeObserver(resizeElement, containerRect).width;
|
|
205
196
|
useEnhancedEffect(function() {
|
|
206
197
|
var node = (containerRef === null || containerRef === void 0 ? void 0 : containerRef.current) || (resizeElement === null || resizeElement === void 0 ? void 0 : resizeElement.current);
|
|
207
198
|
if (!node) return;
|
|
199
|
+
var styleElement = window.getComputedStyle(node);
|
|
208
200
|
var dateSpan = document.createElement("temporary-block");
|
|
209
|
-
dateSpan
|
|
201
|
+
setFontSettings(dateSpan, styleElement);
|
|
210
202
|
dateSpan.innerHTML = "a";
|
|
211
203
|
document.body.appendChild(dateSpan);
|
|
212
204
|
var rect = dateSpan.getBoundingClientRect();
|
|
213
|
-
|
|
214
|
-
fontSize: window.getComputedStyle(node, null).getPropertyValue("font-size"),
|
|
215
|
-
symbolWidth: rect.width
|
|
216
|
-
});
|
|
205
|
+
setSymbolWidth(rect.width);
|
|
217
206
|
document.body.removeChild(dateSpan);
|
|
218
207
|
}, []);
|
|
219
208
|
var STail = "span";
|
|
220
209
|
var SBeginning = "span";
|
|
221
|
-
var SContainerMiddle =
|
|
210
|
+
var SContainerMiddle = Tooltip;
|
|
222
211
|
var SAdvancedModeContainerMiddle = Tooltip;
|
|
223
212
|
var displayedSymbols = React.useMemo(function() {
|
|
224
|
-
|
|
225
|
-
|
|
213
|
+
var displayedSymbols2 = Math.round(blockWidth / symbolWidth);
|
|
214
|
+
return displayedSymbols2 % 2 === 0 ? displayedSymbols2 : displayedSymbols2 - 1;
|
|
215
|
+
}, [blockWidth, symbolWidth]);
|
|
226
216
|
var interaction = text.length > displayedSymbols ? "hover" : "none";
|
|
227
217
|
var ref = containerRef !== null && containerRef !== void 0 ? containerRef : resizeElement;
|
|
228
218
|
var contextValue = React.useMemo(function() {
|
|
@@ -233,43 +223,36 @@ var EllipsisMiddle = function EllipsisMiddle2(props) {
|
|
|
233
223
|
};
|
|
234
224
|
}, [text, displayedSymbols]);
|
|
235
225
|
if (advanceMode) {
|
|
236
|
-
var
|
|
237
|
-
return
|
|
238
|
-
"interaction": interaction
|
|
226
|
+
var _ref4;
|
|
227
|
+
return _ref4 = sstyled(styles), /* @__PURE__ */ React.createElement(SAdvancedModeContainerMiddle, _ref4.cn("SAdvancedModeContainerMiddle", _objectSpread(_objectSpread({
|
|
228
|
+
"interaction": tooltip ? interaction : "none"
|
|
239
229
|
}, tooltipProps), forcedAdvancedMode)), /* @__PURE__ */ React.createElement(EllipsisMiddleContext.Provider, {
|
|
240
230
|
value: contextValue
|
|
241
231
|
}, children));
|
|
242
232
|
}
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
"tag": Tooltip,
|
|
250
|
-
"__excludeProps": ["title"]
|
|
251
|
-
}, tooltipProps)), /* @__PURE__ */ React.createElement(SBeginning, _ref6.cn("SBeginning", {}), contextValue.begining), /* @__PURE__ */ React.createElement(STail, _ref6.cn("STail", {}), contextValue.tail));
|
|
252
|
-
}
|
|
253
|
-
return _ref7 = sstyled(styles), /* @__PURE__ */ React.createElement(SContainerMiddle, _ref7.cn("SContainerMiddle", _objectSpread(_objectSpread({}, otherProps), {}, {
|
|
254
|
-
"ref": containerRef !== null && containerRef !== void 0 ? containerRef : resizeElement
|
|
255
|
-
})), /* @__PURE__ */ React.createElement(SBeginning, _ref7.cn("SBeginning", {}), contextValue.begining), /* @__PURE__ */ React.createElement(STail, _ref7.cn("STail", {}), contextValue.tail));
|
|
233
|
+
return _ref5 = sstyled(styles), /* @__PURE__ */ React.createElement(SContainerMiddle, _ref5.cn("SContainerMiddle", _objectSpread({
|
|
234
|
+
"interaction": tooltip ? interaction : "none",
|
|
235
|
+
"title": text,
|
|
236
|
+
"ref": forkRef(ref, textRef),
|
|
237
|
+
"tag": tag
|
|
238
|
+
}, tooltipProps)), /* @__PURE__ */ React.createElement(SBeginning, _ref5.cn("SBeginning", {}), contextValue.begining), /* @__PURE__ */ React.createElement(STail, _ref5.cn("STail", {}), contextValue.tail));
|
|
256
239
|
};
|
|
257
|
-
var Content = function Content2(
|
|
258
|
-
var _ref = arguments[0],
|
|
259
|
-
var styles =
|
|
240
|
+
var Content = function Content2(_ref8) {
|
|
241
|
+
var _ref = arguments[0], _ref7;
|
|
242
|
+
var styles = _ref8.styles, Children = _ref8.Children;
|
|
260
243
|
var SEllipsis = Tooltip.Trigger;
|
|
261
244
|
var ellipsisMiddleContext = React.useContext(EllipsisMiddleContext);
|
|
262
245
|
var STail = "span";
|
|
263
246
|
var SBeginning = "span";
|
|
264
247
|
if (ellipsisMiddleContext) {
|
|
265
|
-
var
|
|
248
|
+
var _ref6;
|
|
266
249
|
var begining = ellipsisMiddleContext.begining, tail = ellipsisMiddleContext.tail, ref = ellipsisMiddleContext.ref;
|
|
267
|
-
return
|
|
250
|
+
return _ref6 = sstyled(styles), /* @__PURE__ */ React.createElement(SEllipsis, _ref6.cn("SEllipsis", _objectSpread({}, assignProps({
|
|
268
251
|
"middle-mod": true,
|
|
269
252
|
"ref": ref
|
|
270
|
-
}, _ref))), /* @__PURE__ */ React.createElement(SBeginning,
|
|
253
|
+
}, _ref))), /* @__PURE__ */ React.createElement(SBeginning, _ref6.cn("SBeginning", {}), begining), /* @__PURE__ */ React.createElement(STail, _ref6.cn("STail", {}), tail));
|
|
271
254
|
}
|
|
272
|
-
return
|
|
255
|
+
return _ref7 = sstyled(styles), /* @__PURE__ */ React.createElement(SEllipsis, _ref7.cn("SEllipsis", _objectSpread({}, assignProps({}, _ref))), /* @__PURE__ */ React.createElement(Children, _ref7.cn("Children", {})));
|
|
273
256
|
};
|
|
274
257
|
var Ellipsis = createComponent(RootEllipsis, {
|
|
275
258
|
Content,
|
|
@@ -1,10 +1,3 @@
|
|
|
1
|
-
SContainer,
|
|
2
|
-
SNoTooltipContainer,
|
|
3
|
-
SContainerMiddle {
|
|
4
|
-
display: flex;
|
|
5
|
-
overflow: hidden;
|
|
6
|
-
}
|
|
7
|
-
|
|
8
1
|
SBeginning,
|
|
9
2
|
SEllipsis {
|
|
10
3
|
overflow: hidden;
|
|
@@ -13,7 +6,9 @@ SEllipsis {
|
|
|
13
6
|
white-space: pre;
|
|
14
7
|
}
|
|
15
8
|
|
|
16
|
-
|
|
9
|
+
SContainer,
|
|
10
|
+
SNoTooltipContainer,
|
|
11
|
+
SContainerMiddle {
|
|
17
12
|
display: flex;
|
|
18
13
|
overflow: hidden;
|
|
19
14
|
}
|
|
@@ -27,6 +22,11 @@ SEllipsis[maxLine] {
|
|
|
27
22
|
overflow-wrap: break-word;
|
|
28
23
|
}
|
|
29
24
|
|
|
25
|
+
SEllipsis[middle-mod] {
|
|
26
|
+
display: flex;
|
|
27
|
+
overflow: hidden;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
30
|
SContainerMiddle> :has(SBeginning),
|
|
31
31
|
SContainerMiddle> :has(STail) {
|
|
32
32
|
display: flex;
|
package/lib/types/index.d.ts
CHANGED
|
@@ -9,7 +9,8 @@ export interface IEllipsisProps extends EllipsisProps, UnknownProperties {}
|
|
|
9
9
|
export type EllipsisProps = BoxProps &
|
|
10
10
|
Partial<TooltipProps> & {
|
|
11
11
|
/**
|
|
12
|
-
* Rows count in multiline Ellipsis
|
|
12
|
+
* Rows count in multiline Ellipsis.
|
|
13
|
+
* Applies only for `trim = end`
|
|
13
14
|
* @default 1
|
|
14
15
|
*/
|
|
15
16
|
maxLine?: number;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@semcore/ellipsis",
|
|
3
3
|
"description": "Semrush Ellipsis Component",
|
|
4
|
-
"version": "16.0.
|
|
4
|
+
"version": "16.0.6-prerelease.2",
|
|
5
5
|
"main": "lib/cjs/index.js",
|
|
6
6
|
"module": "lib/es6/index.js",
|
|
7
7
|
"typings": "lib/types/index.d.ts",
|
|
@@ -14,11 +14,11 @@
|
|
|
14
14
|
"types": "./lib/types/index.d.ts"
|
|
15
15
|
},
|
|
16
16
|
"dependencies": {
|
|
17
|
-
"@semcore/tooltip": "16.0.
|
|
18
|
-
"@semcore/flex-box": "16.0.
|
|
17
|
+
"@semcore/tooltip": "16.0.6-prerelease.2",
|
|
18
|
+
"@semcore/flex-box": "16.0.6-prerelease.2"
|
|
19
19
|
},
|
|
20
20
|
"peerDependencies": {
|
|
21
|
-
"@semcore/base-components": "^16.0.
|
|
21
|
+
"@semcore/base-components": "^16.2.0-prerelease.2"
|
|
22
22
|
},
|
|
23
23
|
"devDependencies": {
|
|
24
24
|
"@semcore/core": "16.0.4",
|