@semcore/ellipsis 16.0.12 → 17.0.0-prerelease.17

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.
@@ -1,15 +1,8 @@
1
- import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
2
- import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
3
- import _objectSpread from "@babel/runtime/helpers/objectSpread2";
4
- import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
5
- import _createClass from "@babel/runtime/helpers/createClass";
6
- import _callSuper from "@babel/runtime/helpers/callSuper";
7
- import _inherits from "@babel/runtime/helpers/inherits";
8
1
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
9
2
  import { sstyled as _sstyled } from "@semcore/core";
10
3
  import { assignProps as _assignProps2 } from "@semcore/core";
11
4
  import { assignProps as _assignProps } from "@semcore/core";
12
- var _excluded = ["styles", "Children", "maxLine", "tooltip", "trim", "containerRect", "containerRef", "includeTooltipProps", "children"];
5
+ import { Box } from '@semcore/base-components';
13
6
  import { createComponent, Component, Root, sstyled } from '@semcore/core';
14
7
  import { callAllEventHandlers } from '@semcore/core/lib/utils/assignProps';
15
8
  import findComponent, { isAdvanceMode } from '@semcore/core/lib/utils/findComponent';
@@ -18,172 +11,120 @@ import pick from '@semcore/core/lib/utils/pick';
18
11
  import reactToText from '@semcore/core/lib/utils/reactToText';
19
12
  import { forkRef } from '@semcore/core/lib/utils/ref';
20
13
  import useEnhancedEffect from '@semcore/core/lib/utils/use/useEnhancedEffect';
21
- import { Box } from '@semcore/flex-box';
22
14
  import Tooltip from '@semcore/tooltip';
23
15
  import React from 'react';
24
16
  /*!__reshadow-styles__:"./style/ellipsis.shadow.css"*/
25
- var style = (/*__reshadow_css_start__*/_sstyled.insert(/*__inner_css_start__*/".___SBeginning_4aonj_gg_,.___SEllipsis_4aonj_gg_{overflow:hidden;display:inline-block;text-overflow:ellipsis;white-space:pre}.___SEllipsis_4aonj_gg_.__maxLine_4aonj_gg_{display:-webkit-box;-webkit-line-clamp:var(--maxLine_4aonj);-webkit-box-orient:vertical;overflow:hidden;white-space:normal;word-wrap:break-word}.___SContainerMiddle_4aonj_gg_,.___SContainer_4aonj_gg_,.___SEllipsis_4aonj_gg_.__middle-mod_4aonj_gg_,.___SNoTooltipContainer_4aonj_gg_{display:flex;overflow:hidden}.___SContainerMiddle_4aonj_gg_>:has(.___SBeginning_4aonj_gg_),.___SContainerMiddle_4aonj_gg_>:has(.___STail_4aonj_gg_){display:flex;width:100%}.___STail_4aonj_gg_{white-space:pre}", /*__inner_css_end__*/"4aonj_gg_"),
17
+ const style = (/*__reshadow_css_start__*/_sstyled.insert(/*__inner_css_start__*/".___SBeginning_1x34o_gg_,.___SEllipsis_1x34o_gg_{overflow:hidden;display:inline-block;text-overflow:ellipsis;white-space:pre}.___SEllipsis_1x34o_gg_.__maxLine_1x34o_gg_{display:-webkit-box;-webkit-line-clamp:var(--maxLine_1x34o);-webkit-box-orient:vertical;overflow:hidden;white-space:normal;word-wrap:break-word}.___SContainerMiddle_1x34o_gg_,.___SContainer_1x34o_gg_,.___SEllipsis_1x34o_gg_.__middle-mod_1x34o_gg_,.___SNoTooltipContainer_1x34o_gg_{display:flex;overflow:hidden}.___SContainerMiddle_1x34o_gg_>:has(.___SBeginning_1x34o_gg_),.___SContainerMiddle_1x34o_gg_>:has(.___STail_1x34o_gg_){display:flex;width:100%}.___STail_1x34o_gg_{white-space:pre}", /*__inner_css_end__*/"1x34o_gg_"),
26
18
  /*__reshadow_css_end__*/
27
19
  {
28
- "__SBeginning": "___SBeginning_4aonj_gg_",
29
- "__SEllipsis": "___SEllipsis_4aonj_gg_",
30
- "__SContainer": "___SContainer_4aonj_gg_",
31
- "__SNoTooltipContainer": "___SNoTooltipContainer_4aonj_gg_",
32
- "__SContainerMiddle": "___SContainerMiddle_4aonj_gg_",
33
- "_maxLine": "__maxLine_4aonj_gg_",
34
- "--maxLine": "--maxLine_4aonj",
35
- "_middle-mod": "__middle-mod_4aonj_gg_",
36
- "__STail": "___STail_4aonj_gg_"
20
+ "__SBeginning": "___SBeginning_1x34o_gg_",
21
+ "__SEllipsis": "___SEllipsis_1x34o_gg_",
22
+ "__SContainer": "___SContainer_1x34o_gg_",
23
+ "__SNoTooltipContainer": "___SNoTooltipContainer_1x34o_gg_",
24
+ "__SContainerMiddle": "___SContainerMiddle_1x34o_gg_",
25
+ "_maxLine": "__maxLine_1x34o_gg_",
26
+ "--maxLine": "--maxLine_1x34o",
27
+ "_middle-mod": "__middle-mod_1x34o_gg_",
28
+ "__STail": "___STail_1x34o_gg_"
37
29
  });
38
30
  import { useResizeObserver } from './useResizeObserver';
39
- var defaultTooltipProps = ['title', 'theme', 'strategy', 'modifiers', 'placement', 'interaction', 'timeout', 'visible', 'defaultVisible', 'onVisibleChange', 'offset', 'preventOverflow', 'arrow', 'flip', 'computeStyles', 'eventListeners', 'onFirstUpdate', 'cursorAnchoring'];
40
- var setFontSettings = function setFontSettings(element, styleElement) {
41
- element.style.fontFamily = styleElement.getPropertyValue('font-family');
42
- element.style.fontSize = styleElement.getPropertyValue('font-size');
43
- element.style.fontWeight = styleElement.getPropertyValue('font-weight');
44
- element.style.lineHeight = styleElement.getPropertyValue('line-height');
45
- element.style.fontFeatureSettings = styleElement.getPropertyValue('font-feature-settings');
46
- element.style.fontVariantNumeric = styleElement.getPropertyValue('font-variant-numeric');
47
- };
48
- var createMeasurerElement = function createMeasurerElement(element, text) {
49
- var styleElement = window.getComputedStyle(element, null);
50
- var temporaryElement = document.createElement('temporary-block');
51
- temporaryElement.style.display = styleElement.getPropertyValue('display');
52
- temporaryElement.style.padding = styleElement.getPropertyValue('padding');
53
- temporaryElement.style.position = 'absolute';
54
- temporaryElement.style.right = '0%';
55
- temporaryElement.style.bottom = '0%';
56
- temporaryElement.style.visibility = 'hidden';
57
- temporaryElement.style.whiteSpace = styleElement.getPropertyValue('white-space');
58
- temporaryElement.style.wordWrap = styleElement.getPropertyValue('word-wrap');
59
- setFontSettings(temporaryElement, styleElement);
60
- temporaryElement.textContent = text !== null && text !== void 0 ? text : element.textContent;
61
- return temporaryElement;
62
- };
63
- function isTextOverflowing(element, multiline, text) {
64
- if (!element) return false;
65
- var _element$getBoundingC = element.getBoundingClientRect(),
66
- currentHeight = _element$getBoundingC.height,
67
- currentWidth = _element$getBoundingC.width;
68
- var measuringElement = createMeasurerElement(element, text);
69
- var isOverflowing = false;
70
- document.body.appendChild(measuringElement);
71
- if (multiline) {
72
- measuringElement.style.width = "".concat(currentWidth, "px");
73
- var width = measuringElement.scrollWidth;
74
- var height = measuringElement.getBoundingClientRect().height;
75
- if (Math.ceil(currentHeight) < height || Math.ceil(currentWidth) < width) {
76
- isOverflowing = true;
77
- }
78
- } else {
79
- measuringElement.style.whiteSpace = 'nowrap';
80
- isOverflowing = Math.ceil(currentWidth) < measuringElement.getBoundingClientRect().width;
81
- }
82
- document.body.removeChild(measuringElement);
83
- return isOverflowing;
84
- }
85
- var forcedAdvancedMode = {
31
+ import { isTextOverflowing, setFontSettings } from './utils';
32
+ const defaultTooltipProps = ['title', 'theme', 'strategy', 'modifiers', 'placement', 'interaction', 'timeout', 'visible', 'defaultVisible', 'onVisibleChange', 'offset', 'preventOverflow', 'arrow', 'flip', 'computeStyles', 'eventListeners', 'onFirstUpdate', 'cursorAnchoring'];
33
+ const forcedAdvancedMode = {
86
34
  forcedAdvancedMode: true
87
35
  };
88
- var noAdvancedMode = {};
89
- var RootEllipsis = /*#__PURE__*/function (_Component) {
90
- function RootEllipsis() {
91
- var _this;
92
- _classCallCheck(this, RootEllipsis);
93
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
94
- args[_key] = arguments[_key];
95
- }
96
- _this = _callSuper(this, RootEllipsis, [].concat(args));
97
- _defineProperty(_this, "state", {
36
+ const noAdvancedMode = {};
37
+ class RootEllipsis extends Component {
38
+ constructor(...args) {
39
+ super(...args);
40
+ _defineProperty(this, "state", {
98
41
  visible: false
99
42
  });
100
- _defineProperty(_this, "textRef", /*#__PURE__*/React.createRef());
101
- _defineProperty(_this, "handlerVisibleChange", function (visible) {
102
- _this.setState({
103
- visible: visible && _this.showTooltip()
43
+ _defineProperty(this, "textRef", /*#__PURE__*/React.createRef());
44
+ _defineProperty(this, "handlerVisibleChange", visible => {
45
+ this.setState({
46
+ visible: visible && this.showTooltip()
104
47
  });
105
48
  });
106
- return _this;
107
49
  }
108
- _inherits(RootEllipsis, _Component);
109
- return _createClass(RootEllipsis, [{
110
- key: "showTooltip",
111
- value: function showTooltip() {
112
- var _this$asProps = this.asProps,
113
- _this$asProps$maxLine = _this$asProps.maxLine,
114
- maxLine = _this$asProps$maxLine === void 0 ? 1 : _this$asProps$maxLine,
115
- Children = _this$asProps.Children;
116
- var text = reactToText(getOriginChildren(Children));
117
- return isTextOverflowing(this.textRef.current, maxLine > 1, text);
118
- }
119
- }, {
120
- key: "getContentProps",
121
- value: function getContentProps() {
122
- return {
123
- ref: this.textRef,
124
- maxLine: this.asProps.maxLine
125
- };
126
- }
127
- }, {
128
- key: "getPopperProps",
129
- value: function getPopperProps() {
130
- var _this$asProps2 = this.asProps,
131
- Children = _this$asProps2.Children,
132
- includeTooltipProps = _this$asProps2.includeTooltipProps;
133
- var text = reactToText(getOriginChildren(Children));
134
- var tooltipProps = pick(this.asProps, includeTooltipProps);
135
- return _objectSpread({
136
- children: text
137
- }, tooltipProps);
138
- }
139
- }, {
140
- key: "render",
141
- value: function render() {
142
- var _ref3, _tooltipProps$visible;
143
- var SEllipsis = this.Root;
144
- var SContainer = Tooltip;
145
- var _this$asProps3 = this.asProps,
146
- styles = _this$asProps3.styles,
147
- Children = _this$asProps3.Children,
148
- maxLine = _this$asProps3.maxLine,
149
- tooltip = _this$asProps3.tooltip,
150
- trim = _this$asProps3.trim,
151
- containerRect = _this$asProps3.containerRect,
152
- containerRef = _this$asProps3.containerRef,
153
- includeTooltipProps = _this$asProps3.includeTooltipProps,
154
- _children = _this$asProps3.children,
155
- other = _objectWithoutProperties(_this$asProps3, _excluded);
156
- var visible = this.state.visible;
157
- var advancedContent = findComponent(Children, [Ellipsis.Content.displayName]);
158
- var text = reactToText(advancedContent || getOriginChildren(Children));
159
- var advanceMode = isAdvanceMode(Children, [Ellipsis.Content.displayName, Ellipsis.Popper.displayName]);
160
- var tooltipProps = pick(this.asProps, includeTooltipProps);
161
- tooltipProps.visible = (_tooltipProps$visible = tooltipProps.visible) !== null && _tooltipProps$visible !== void 0 ? _tooltipProps$visible : visible;
162
- tooltipProps.onVisibleChange = tooltipProps.onVisibleChange ? callAllEventHandlers(tooltipProps.onVisibleChange, this.handlerVisibleChange) : this.handlerVisibleChange;
163
- if (trim === 'middle') {
164
- var _ref2;
165
- return _ref2 = sstyled(styles), /*#__PURE__*/React.createElement(EllipsisMiddle, _ref2.cn("EllipsisMiddle", _objectSpread({
166
- "text": text,
167
- "styles": styles,
168
- "tooltip": tooltip,
169
- "containerRect": containerRect,
170
- "containerRef": containerRef,
171
- "textRef": this.textRef,
172
- "tooltipProps": tooltipProps,
173
- "advanceMode": advanceMode
174
- }, other)), /*#__PURE__*/React.createElement(Children, _ref2.cn("Children", {})));
175
- }
176
- return _ref3 = sstyled(styles), /*#__PURE__*/React.createElement(SContainer, _ref3.cn("SContainer", _objectSpread(_objectSpread({
177
- "interaction": tooltip ? 'hover' : 'none',
178
- "title": !advanceMode ? text : undefined
179
- }, tooltipProps), advanceMode ? forcedAdvancedMode : noAdvancedMode)), advanceMode ? /*#__PURE__*/React.createElement(Children, _ref3.cn("Children", {})) : /*#__PURE__*/React.createElement(SEllipsis, _ref3.cn("SEllipsis", _objectSpread({
180
- "render": Box,
181
- "ref": this.textRef,
182
- "maxLine": maxLine
183
- }, other)), /*#__PURE__*/React.createElement(Children, _ref3.cn("Children", {}))));
50
+ showTooltip() {
51
+ const {
52
+ maxLine = 1,
53
+ Children
54
+ } = this.asProps;
55
+ const text = reactToText(getOriginChildren(Children));
56
+ return isTextOverflowing(this.textRef.current, maxLine > 1, text);
57
+ }
58
+ getContentProps() {
59
+ return {
60
+ ref: this.textRef,
61
+ maxLine: this.asProps.maxLine
62
+ };
63
+ }
64
+ getPopperProps() {
65
+ const {
66
+ Children,
67
+ includeTooltipProps
68
+ } = this.asProps;
69
+ const text = reactToText(getOriginChildren(Children));
70
+ const tooltipProps = pick(this.asProps, includeTooltipProps);
71
+ return {
72
+ children: text,
73
+ ...tooltipProps
74
+ };
75
+ }
76
+ render() {
77
+ var _ref3;
78
+ const SEllipsis = this.Root;
79
+ const SContainer = Tooltip;
80
+ const {
81
+ styles,
82
+ Children,
83
+ maxLine,
84
+ tooltip,
85
+ trim,
86
+ containerRect,
87
+ containerRef,
88
+ includeTooltipProps,
89
+ children: _children,
90
+ ...other
91
+ } = this.asProps;
92
+ const {
93
+ visible
94
+ } = this.state;
95
+ const advancedContent = findComponent(Children, [Ellipsis.Content.displayName]);
96
+ const text = reactToText(advancedContent || getOriginChildren(Children));
97
+ const advanceMode = isAdvanceMode(Children, [Ellipsis.Content.displayName, Ellipsis.Popper.displayName]);
98
+ const tooltipProps = pick(this.asProps, includeTooltipProps);
99
+ tooltipProps.visible = tooltipProps.visible ?? visible;
100
+ tooltipProps.onVisibleChange = tooltipProps.onVisibleChange ? callAllEventHandlers(tooltipProps.onVisibleChange, this.handlerVisibleChange) : this.handlerVisibleChange;
101
+ if (trim === 'middle') {
102
+ var _ref2;
103
+ return _ref2 = sstyled(styles), /*#__PURE__*/React.createElement(EllipsisMiddle, _ref2.cn("EllipsisMiddle", {
104
+ "text": text,
105
+ "styles": styles,
106
+ "tooltip": tooltip,
107
+ "containerRect": containerRect,
108
+ "containerRef": containerRef,
109
+ "textRef": this.textRef,
110
+ "tooltipProps": tooltipProps,
111
+ "advanceMode": advanceMode,
112
+ ...other
113
+ }), /*#__PURE__*/React.createElement(Children, _ref2.cn("Children", {})));
184
114
  }
185
- }]);
186
- }(Component);
115
+ return _ref3 = sstyled(styles), /*#__PURE__*/React.createElement(SContainer, _ref3.cn("SContainer", {
116
+ "interaction": tooltip ? 'hover' : 'none',
117
+ "title": !advanceMode ? text : undefined,
118
+ ...tooltipProps,
119
+ ...(advanceMode ? forcedAdvancedMode : noAdvancedMode)
120
+ }), advanceMode ? /*#__PURE__*/React.createElement(Children, _ref3.cn("Children", {})) : /*#__PURE__*/React.createElement(SEllipsis, _ref3.cn("SEllipsis", {
121
+ "render": Box,
122
+ "ref": this.textRef,
123
+ "maxLine": maxLine,
124
+ ...other
125
+ }), /*#__PURE__*/React.createElement(Children, _ref3.cn("Children", {}))));
126
+ }
127
+ }
187
128
  _defineProperty(RootEllipsis, "displayName", 'Ellipsis');
188
129
  _defineProperty(RootEllipsis, "style", style);
189
130
  _defineProperty(RootEllipsis, "defaultProps", {
@@ -192,92 +133,99 @@ _defineProperty(RootEllipsis, "defaultProps", {
192
133
  includeTooltipProps: defaultTooltipProps,
193
134
  __excludeProps: ['title']
194
135
  });
195
- var EllipsisMiddleContext = /*#__PURE__*/React.createContext(null);
196
- var EllipsisMiddle = function EllipsisMiddle(props) {
136
+ const EllipsisMiddleContext = /*#__PURE__*/React.createContext(null);
137
+ function EllipsisMiddle(props) {
197
138
  var _ref5;
198
- var styles = props.styles,
199
- text = props.text,
200
- tooltip = props.tooltip,
201
- containerRect = props.containerRect,
202
- containerRef = props.containerRef,
203
- textRef = props.textRef,
204
- tooltipProps = props.tooltipProps,
205
- children = props.children,
206
- advanceMode = props.advanceMode,
207
- tag = props.tag;
208
- var resizeElement = React.useRef(null);
209
- var _React$useState = React.useState(0),
210
- _React$useState2 = _slicedToArray(_React$useState, 2),
211
- symbolWidth = _React$useState2[0],
212
- setSymbolWidth = _React$useState2[1];
213
- var blockWidth = useResizeObserver(resizeElement, containerRect).width;
214
- useEnhancedEffect(function () {
215
- var node = (containerRef === null || containerRef === void 0 ? void 0 : containerRef.current) || (resizeElement === null || resizeElement === void 0 ? void 0 : resizeElement.current);
139
+ const {
140
+ styles,
141
+ text,
142
+ tooltip,
143
+ containerRect,
144
+ containerRef,
145
+ textRef,
146
+ tooltipProps,
147
+ children,
148
+ advanceMode,
149
+ tag
150
+ } = props;
151
+ const resizeElement = React.useRef(null);
152
+ const [symbolWidth, setSymbolWidth] = React.useState(0);
153
+ const blockWidth = useResizeObserver(resizeElement, containerRect).width;
154
+ useEnhancedEffect(() => {
155
+ const node = containerRef?.current || resizeElement?.current;
216
156
  if (!node) return;
217
- var styleElement = window.getComputedStyle(node);
218
- var dateSpan = document.createElement('temporary-block');
157
+ const styleElement = window.getComputedStyle(node);
158
+ const dateSpan = document.createElement('temporary-block');
219
159
  setFontSettings(dateSpan, styleElement);
220
160
  dateSpan.textContent = 'a';
221
161
  document.body.appendChild(dateSpan);
222
- var rect = dateSpan.getBoundingClientRect();
162
+ const rect = dateSpan.getBoundingClientRect();
223
163
  setSymbolWidth(rect.width);
224
164
  document.body.removeChild(dateSpan);
225
165
  }, []);
226
- var STail = 'span';
227
- var SBeginning = 'span';
228
- var SContainerMiddle = Tooltip;
229
- var SAdvancedModeContainerMiddle = Tooltip;
230
- var displayedSymbols = React.useMemo(function () {
231
- var displayedSymbols = Math.round(blockWidth / symbolWidth);
166
+ const STail = 'span';
167
+ const SBeginning = 'span';
168
+ const SContainerMiddle = Tooltip;
169
+ const SAdvancedModeContainerMiddle = Tooltip;
170
+ const displayedSymbols = React.useMemo(() => {
171
+ const displayedSymbols = Math.round(blockWidth / symbolWidth);
232
172
  return displayedSymbols % 2 === 0 ? displayedSymbols : displayedSymbols - 1;
233
173
  }, [blockWidth, symbolWidth]);
234
- var interaction = text.length > displayedSymbols ? 'hover' : 'none';
235
- var ref = containerRef !== null && containerRef !== void 0 ? containerRef : resizeElement;
236
- var contextValue = React.useMemo(function () {
237
- return {
238
- begining: text.substring(0, text.length - displayedSymbols / 2 - 1),
239
- tail: text.substring(text.length - displayedSymbols / 2 - 1),
240
- ref: ref
241
- };
242
- }, [text, displayedSymbols]);
174
+ const interaction = text.length > displayedSymbols ? 'hover' : 'none';
175
+ const ref = containerRef ?? resizeElement;
176
+ const contextValue = React.useMemo(() => ({
177
+ begining: text.substring(0, text.length - displayedSymbols / 2 - 1),
178
+ tail: text.substring(text.length - displayedSymbols / 2 - 1),
179
+ ref
180
+ }), [text, displayedSymbols]);
243
181
  if (advanceMode) {
244
182
  var _ref4;
245
- return _ref4 = sstyled(styles), /*#__PURE__*/React.createElement(SAdvancedModeContainerMiddle, _ref4.cn("SAdvancedModeContainerMiddle", _objectSpread(_objectSpread({
246
- "interaction": tooltip ? interaction : 'none'
247
- }, tooltipProps), forcedAdvancedMode)), /*#__PURE__*/React.createElement(EllipsisMiddleContext.Provider, {
183
+ return _ref4 = sstyled(styles), /*#__PURE__*/React.createElement(SAdvancedModeContainerMiddle, _ref4.cn("SAdvancedModeContainerMiddle", {
184
+ "interaction": tooltip ? interaction : 'none',
185
+ ...tooltipProps,
186
+ ...forcedAdvancedMode
187
+ }), /*#__PURE__*/React.createElement(EllipsisMiddleContext.Provider, {
248
188
  value: contextValue
249
189
  }, children));
250
190
  }
251
- return _ref5 = sstyled(styles), /*#__PURE__*/React.createElement(SContainerMiddle, _ref5.cn("SContainerMiddle", _objectSpread({
191
+ return _ref5 = sstyled(styles), /*#__PURE__*/React.createElement(SContainerMiddle, _ref5.cn("SContainerMiddle", {
252
192
  "interaction": tooltip ? interaction : 'none',
253
193
  "title": text,
254
194
  "ref": forkRef(ref, textRef),
255
- "tag": tag
256
- }, tooltipProps)), /*#__PURE__*/React.createElement(SBeginning, _ref5.cn("SBeginning", {}), contextValue.begining), /*#__PURE__*/React.createElement(STail, _ref5.cn("STail", {}), contextValue.tail));
257
- };
258
- var Content = function Content(_ref8) {
195
+ "tag": tag,
196
+ ...tooltipProps
197
+ }), /*#__PURE__*/React.createElement(SBeginning, _ref5.cn("SBeginning", {}), contextValue.begining), /*#__PURE__*/React.createElement(STail, _ref5.cn("STail", {}), contextValue.tail));
198
+ }
199
+ function Content({
200
+ styles,
201
+ Children
202
+ }) {
259
203
  var _ref = arguments[0],
260
204
  _ref7;
261
- var styles = _ref8.styles,
262
- Children = _ref8.Children;
263
- var SEllipsis = Tooltip.Trigger;
264
- var ellipsisMiddleContext = React.useContext(EllipsisMiddleContext);
265
- var STail = 'span';
266
- var SBeginning = 'span';
205
+ const SEllipsis = Tooltip.Trigger;
206
+ const ellipsisMiddleContext = React.useContext(EllipsisMiddleContext);
207
+ const STail = 'span';
208
+ const SBeginning = 'span';
267
209
  if (ellipsisMiddleContext) {
268
210
  var _ref6;
269
- var begining = ellipsisMiddleContext.begining,
270
- tail = ellipsisMiddleContext.tail,
271
- ref = ellipsisMiddleContext.ref;
272
- return _ref6 = sstyled(styles), /*#__PURE__*/React.createElement(SEllipsis, _ref6.cn("SEllipsis", _objectSpread({}, _assignProps({
273
- "middle-mod": true,
274
- "ref": ref
275
- }, _ref))), /*#__PURE__*/React.createElement(SBeginning, _ref6.cn("SBeginning", {}), begining), /*#__PURE__*/React.createElement(STail, _ref6.cn("STail", {}), tail));
211
+ const {
212
+ begining,
213
+ tail,
214
+ ref
215
+ } = ellipsisMiddleContext;
216
+ return _ref6 = sstyled(styles), /*#__PURE__*/React.createElement(SEllipsis, _ref6.cn("SEllipsis", {
217
+ ..._assignProps({
218
+ "middle-mod": true,
219
+ "ref": ref
220
+ }, _ref)
221
+ }), /*#__PURE__*/React.createElement(SBeginning, _ref6.cn("SBeginning", {}), begining), /*#__PURE__*/React.createElement(STail, _ref6.cn("STail", {}), tail));
276
222
  }
277
- return _ref7 = sstyled(styles), /*#__PURE__*/React.createElement(SEllipsis, _ref7.cn("SEllipsis", _objectSpread({}, _assignProps2({}, _ref))), /*#__PURE__*/React.createElement(Children, _ref7.cn("Children", {})));
278
- };
279
- var Ellipsis = createComponent(RootEllipsis, {
280
- Content: Content,
223
+ return _ref7 = sstyled(styles), /*#__PURE__*/React.createElement(SEllipsis, _ref7.cn("SEllipsis", {
224
+ ..._assignProps2({}, _ref)
225
+ }), /*#__PURE__*/React.createElement(Children, _ref7.cn("Children", {})));
226
+ }
227
+ const Ellipsis = createComponent(RootEllipsis, {
228
+ Content,
281
229
  Popper: Tooltip.Popper
282
230
  });
283
231
  export default Ellipsis;
@@ -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","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","textContent","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.textContent = text ?? element.textContent;\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.textContent = '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', Ellips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gBU,qBAAqB,CAA7CV,QAAQ;MAAEE,IAAI,GAAUQ,qBAAqB,CAAnCR,IAAI;MAAEhE,GAAG,GAAKwE,qBAAqB,CAA7BxE,GAAG;IAC3B,OAAA0E,KAAA,GAAOpK,OAAO,CAACuG,MAAM,CAAC,eACpB5F,KAAA,CAAAsB,aAAA,CAACmE,SAAS,EAAAgE,KAAA,CAAAzC,EAAA,cAAA5B,aAAA,KAAAsE,YAAA;MAAA;MAAA,OAA0C3E;IAAG,GAAAoE,IAAA,kBACrDnJ,KAAA,CAAAsB,aAAA,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":[]}
1
+ {"version":3,"file":"Ellipsis.js","names":["Box","createComponent","Component","Root","sstyled","callAllEventHandlers","findComponent","isAdvanceMode","getOriginChildren","pick","reactToText","forkRef","useEnhancedEffect","Tooltip","React","style","_sstyled","insert","useResizeObserver","isTextOverflowing","setFontSettings","defaultTooltipProps","forcedAdvancedMode","noAdvancedMode","RootEllipsis","constructor","args","_defineProperty","visible","createRef","setState","showTooltip","maxLine","Children","asProps","text","textRef","current","getContentProps","ref","getPopperProps","includeTooltipProps","tooltipProps","children","render","_ref3","SEllipsis","SContainer","styles","tooltip","trim","containerRect","containerRef","_children","other","state","advancedContent","Ellipsis","Content","displayName","advanceMode","Popper","onVisibleChange","handlerVisibleChange","_ref2","createElement","EllipsisMiddle","cn","undefined","__excludeProps","EllipsisMiddleContext","createContext","props","_ref5","tag","resizeElement","useRef","symbolWidth","setSymbolWidth","useState","blockWidth","width","node","styleElement","window","getComputedStyle","dateSpan","document","textContent","body","appendChild","rect","getBoundingClientRect","removeChild","STail","SBeginning","SContainerMiddle","SAdvancedModeContainerMiddle","displayedSymbols","useMemo","Math","round","interaction","length","contextValue","begining","substring","tail","_ref4","Provider","value","_ref","arguments[0]","_ref7","Trigger","ellipsisMiddleContext","useContext","_ref6","_assignProps","_assignProps2"],"sources":["../../src/Ellipsis.tsx"],"sourcesContent":["import { Box, type BoxProps } from '@semcore/base-components';\nimport { 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 Tooltip, { type TooltipProps } from '@semcore/tooltip';\nimport React, { type RefObject } from 'react';\n\nimport style from './style/ellipsis.shadow.css';\nimport { useResizeObserver } from './useResizeObserver';\nimport { isTextOverflowing, setFontSettings } from './utils';\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 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\nfunction EllipsisMiddle(props: AsPropsMiddle) {\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.textContent = '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\nfunction Content({ styles, Children }: EllipsisContentAsProps) {\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,GAAG,QAAuB,0BAA0B;AAC7D,SAASC,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,OAAOC,OAAO,MAA6B,kBAAkB;AAC7D,OAAOC,KAAK,MAA0B,OAAO;AAAC;AAAA,MAAAC,KAAA,8BAAAC,QAAA,CAAAC,MAAA;AAAA;AAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;AAAA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AAA,CAAAmD,aAAA,CAACnB,SAAS,EAAAuE,KAAA,CAAAlD,EAAA;MAAA,GAAAmD,YAAA;QAAA;QAAA,OAA0C/E;MAAG,GAAAwE,IAAA;IAAA,iBACrDjG,KAAA,CAAAmD,aAAA,CAAC8B,UAAU,EAAAsB,KAAA,CAAAlD,EAAA,oBAAEsC,QAAqB,CAAC,eACnC3F,KAAA,CAAAmD,aAAA,CAAC6B,KAAK,EAAAuB,KAAA,CAAAlD,EAAA,eAAEwC,IAAY,CACX,CAAC;EAEhB;EAEA,OAAAM,KAAA,GAAO7G,OAAO,CAAC4C,MAAM,CAAC,eACpBlC,KAAA,CAAAmD,aAAA,CAACnB,SAAS,EAAAmE,KAAA,CAAA9C,EAAA;IAAA,GAAAoD,aAAA,KAAAR,IAAA;EAAA,iBACRjG,KAAA,CAAAmD,aAAA,CAAChC,QAAQ,EAAAgF,KAAA,CAAA9C,EAAA,gBAAE,CACF,CAAC;AAEhB;AAEA,MAAMV,QAAQ,GAAGxD,eAAe,CAACuB,YAAY,EAAE;EAC7CkC,OAAO;EACPG,MAAM,EAAEhD,OAAO,CAACgD;AAClB,CAAC,CAGA;AAED,eAAeJ,QAAQ","ignoreList":[]}
@@ -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.\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
+ {"version":3,"file":"index.d.js","names":[],"sources":["../../src/index.d.ts"],"sourcesContent":["import type { Box, BoxProps } from '@semcore/base-components';\nimport type { UnknownProperties, Intergalactic } from '@semcore/core';\nimport type { TooltipProps } from '@semcore/tooltip';\nimport type Tooltip from '@semcore/tooltip';\nimport type { RefObject } from 'react';\n\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/**\n * @deprecated. Use Text with ellipsis property for @semcore/typography.\n */\ndeclare const Ellipsis: Intergalactic.Component<'div', EllipsisProps> & {\n Content: typeof Box;\n Popper: typeof Tooltip.Popper;\n};\n\nexport default Ellipsis;\n\nexport { useResizeObserver };\n"],"mappings":"","ignoreList":[]}