@semcore/ellipsis 16.0.12-prerelease.37 → 16.1.0-prerelease.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
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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ponent","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\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,eAAe,EAAEC,SAAS,EAAsBC,IAAI,EAAEC,OAAO,QAAQ,eAAe;AAC7F,SAASC,oBAAoB,QAA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C,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;AAEA,IAAMT,QAAQ,GAAGrH,eAAe,CAACiE,YAAY,EAAE;EAC7CqD,OAAO,EAAPA,OAAO;EACPG,MAAM,EAAE5G,OAAO,CAAC4G;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 { 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":[]}
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,12 +1,16 @@
1
+ import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
1
2
  import canUseDOM from '@semcore/core/lib/utils/canUseDOM';
2
3
  import useEnhancedEffect from '@semcore/core/lib/utils/use/useEnhancedEffect';
3
4
  import React from 'react';
4
- export const useResizeObserver = (ref, hookOverride) => {
5
- const [width, setWidth] = React.useState(0);
6
- const handleResize = React.useCallback(entries => {
5
+ export var useResizeObserver = function useResizeObserver(ref, hookOverride) {
6
+ var _React$useState = React.useState(0),
7
+ _React$useState2 = _slicedToArray(_React$useState, 2),
8
+ width = _React$useState2[0],
9
+ setWidth = _React$useState2[1];
10
+ var handleResize = React.useCallback(function (entries) {
7
11
  setWidth(entries[0].contentRect.width);
8
12
  }, []);
9
- useEnhancedEffect(() => {
13
+ useEnhancedEffect(function () {
10
14
  if (!ref.current) {
11
15
  return;
12
16
  }
@@ -14,11 +18,11 @@ export const useResizeObserver = (ref, hookOverride) => {
14
18
  return;
15
19
  }
16
20
  if (canUseDOM()) {
17
- const ro = new ResizeObserver(entries => {
21
+ var ro = new ResizeObserver(function (entries) {
18
22
  handleResize(entries);
19
23
  });
20
24
  ro.observe(ref.current);
21
- return () => {
25
+ return function () {
22
26
  ro.disconnect();
23
27
  };
24
28
  }
@@ -27,7 +31,7 @@ export const useResizeObserver = (ref, hookOverride) => {
27
31
  return hookOverride;
28
32
  }
29
33
  return {
30
- width
34
+ width: width
31
35
  };
32
36
  };
33
37
  //# sourceMappingURL=useResizeObserver.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"useResizeObserver.js","names":["canUseDOM","useEnhancedEffect","React","useResizeObserver","ref","hookOverride","width","setWidth","useState","handleResize","useCallback","entries","contentRect","current","ro","ResizeObserver","observe","disconnect"],"sources":["../../src/useResizeObserver.tsx"],"sourcesContent":["import canUseDOM from '@semcore/core/lib/utils/canUseDOM';\nimport useEnhancedEffect from '@semcore/core/lib/utils/use/useEnhancedEffect';\nimport React, { type RefObject } from 'react';\n\nexport const useResizeObserver = (\n ref: RefObject<HTMLElement>,\n hookOverride?: { width: number },\n) => {\n const [width, setWidth] = React.useState<number>(0);\n\n const handleResize = React.useCallback((entries: ResizeObserverEntry[]) => {\n setWidth(entries[0].contentRect.width);\n }, []);\n\n useEnhancedEffect(() => {\n if (!ref.current) {\n return;\n }\n\n if (hookOverride) {\n return;\n }\n if (canUseDOM()) {\n const ro = new ResizeObserver((entries: ResizeObserverEntry[]) => {\n handleResize(entries);\n });\n\n ro.observe(ref.current);\n\n return () => {\n ro.disconnect();\n };\n }\n }, [hookOverride]);\n\n if (hookOverride) {\n return hookOverride;\n }\n return { width };\n};\n"],"mappings":"AAAA,OAAOA,SAAS,MAAM,mCAAmC;AACzD,OAAOC,iBAAiB,MAAM,+CAA+C;AAC7E,OAAOC,KAAK,MAA0B,OAAO;AAE7C,OAAO,MAAMC,iBAAiB,GAAGA,CAC/BC,GAA2B,EAC3BC,YAAgC,KAC7B;EACH,MAAM,CAACC,KAAK,EAAEC,QAAQ,CAAC,GAAGL,KAAK,CAACM,QAAQ,CAAS,CAAC,CAAC;EAEnD,MAAMC,YAAY,GAAGP,KAAK,CAACQ,WAAW,CAAEC,OAA8B,IAAK;IACzEJ,QAAQ,CAACI,OAAO,CAAC,CAAC,CAAC,CAACC,WAAW,CAACN,KAAK,CAAC;EACxC,CAAC,EAAE,EAAE,CAAC;EAENL,iBAAiB,CAAC,MAAM;IACtB,IAAI,CAACG,GAAG,CAACS,OAAO,EAAE;MAChB;IACF;IAEA,IAAIR,YAAY,EAAE;MAChB;IACF;IACA,IAAIL,SAAS,CAAC,CAAC,EAAE;MACf,MAAMc,EAAE,GAAG,IAAIC,cAAc,CAAEJ,OAA8B,IAAK;QAChEF,YAAY,CAACE,OAAO,CAAC;MACvB,CAAC,CAAC;MAEFG,EAAE,CAACE,OAAO,CAACZ,GAAG,CAACS,OAAO,CAAC;MAEvB,OAAO,MAAM;QACXC,EAAE,CAACG,UAAU,CAAC,CAAC;MACjB,CAAC;IACH;EACF,CAAC,EAAE,CAACZ,YAAY,CAAC,CAAC;EAElB,IAAIA,YAAY,EAAE;IAChB,OAAOA,YAAY;EACrB;EACA,OAAO;IAAEC;EAAM,CAAC;AAClB,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"useResizeObserver.js","names":["canUseDOM","useEnhancedEffect","React","useResizeObserver","ref","hookOverride","_React$useState","useState","_React$useState2","_slicedToArray","width","setWidth","handleResize","useCallback","entries","contentRect","current","ro","ResizeObserver","observe","disconnect"],"sources":["../../src/useResizeObserver.tsx"],"sourcesContent":["import canUseDOM from '@semcore/core/lib/utils/canUseDOM';\nimport useEnhancedEffect from '@semcore/core/lib/utils/use/useEnhancedEffect';\nimport React, { type RefObject } from 'react';\n\nexport const useResizeObserver = (\n ref: RefObject<HTMLElement>,\n hookOverride?: { width: number },\n) => {\n const [width, setWidth] = React.useState<number>(0);\n\n const handleResize = React.useCallback((entries: ResizeObserverEntry[]) => {\n setWidth(entries[0].contentRect.width);\n }, []);\n\n useEnhancedEffect(() => {\n if (!ref.current) {\n return;\n }\n\n if (hookOverride) {\n return;\n }\n if (canUseDOM()) {\n const ro = new ResizeObserver((entries: ResizeObserverEntry[]) => {\n handleResize(entries);\n });\n\n ro.observe(ref.current);\n\n return () => {\n ro.disconnect();\n };\n }\n }, [hookOverride]);\n\n if (hookOverride) {\n return hookOverride;\n }\n return { width };\n};\n"],"mappings":";AAAA,OAAOA,SAAS,MAAM,mCAAmC;AACzD,OAAOC,iBAAiB,MAAM,+CAA+C;AAC7E,OAAOC,KAAK,MAA0B,OAAO;AAE7C,OAAO,IAAMC,iBAAiB,GAAG,SAApBA,iBAAiBA,CAC5BC,GAA2B,EAC3BC,YAAgC,EAC7B;EACH,IAAAC,eAAA,GAA0BJ,KAAK,CAACK,QAAQ,CAAS,CAAC,CAAC;IAAAC,gBAAA,GAAAC,cAAA,CAAAH,eAAA;IAA5CI,KAAK,GAAAF,gBAAA;IAAEG,QAAQ,GAAAH,gBAAA;EAEtB,IAAMI,YAAY,GAAGV,KAAK,CAACW,WAAW,CAAC,UAACC,OAA8B,EAAK;IACzEH,QAAQ,CAACG,OAAO,CAAC,CAAC,CAAC,CAACC,WAAW,CAACL,KAAK,CAAC;EACxC,CAAC,EAAE,EAAE,CAAC;EAENT,iBAAiB,CAAC,YAAM;IACtB,IAAI,CAACG,GAAG,CAACY,OAAO,EAAE;MAChB;IACF;IAEA,IAAIX,YAAY,EAAE;MAChB;IACF;IACA,IAAIL,SAAS,CAAC,CAAC,EAAE;MACf,IAAMiB,EAAE,GAAG,IAAIC,cAAc,CAAC,UAACJ,OAA8B,EAAK;QAChEF,YAAY,CAACE,OAAO,CAAC;MACvB,CAAC,CAAC;MAEFG,EAAE,CAACE,OAAO,CAACf,GAAG,CAACY,OAAO,CAAC;MAEvB,OAAO,YAAM;QACXC,EAAE,CAACG,UAAU,CAAC,CAAC;MACjB,CAAC;IACH;EACF,CAAC,EAAE,CAACf,YAAY,CAAC,CAAC;EAElB,IAAIA,YAAY,EAAE;IAChB,OAAOA,YAAY;EACrB;EACA,OAAO;IAAEK,KAAK,EAALA;EAAM,CAAC;AAClB,CAAC","ignoreList":[]}
@@ -1,6 +1,12 @@
1
+ import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
2
+ import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
3
+ import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
4
+ import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
5
+ import _createClass from "@babel/runtime/helpers/esm/createClass";
6
+ import _callSuper from "@babel/runtime/helpers/esm/callSuper";
7
+ import _inherits from "@babel/runtime/helpers/esm/inherits";
1
8
  import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
2
- import { sstyled, Component, assignProps, createComponent } from "@semcore/core";
3
- import { Box } from "@semcore/base-components";
9
+ import { createComponent, sstyled, Component, assignProps } from "@semcore/core";
4
10
  import { callAllEventHandlers } from "@semcore/core/lib/utils/assignProps";
5
11
  import findComponent, { isAdvanceMode } from "@semcore/core/lib/utils/findComponent";
6
12
  import getOriginChildren from "@semcore/core/lib/utils/getOriginChildren";
@@ -8,126 +14,165 @@ import pick from "@semcore/core/lib/utils/pick";
8
14
  import reactToText from "@semcore/core/lib/utils/reactToText";
9
15
  import { forkRef } from "@semcore/core/lib/utils/ref";
10
16
  import useEnhancedEffect from "@semcore/core/lib/utils/use/useEnhancedEffect";
17
+ import { Box } from "@semcore/flex-box";
11
18
  import Tooltip from "@semcore/tooltip";
12
19
  import React from "react";
13
20
  import { useResizeObserver } from "./useResizeObserver.mjs";
14
- import { isTextOverflowing, setFontSettings } from "./utils.mjs";
15
- const style = (
21
+ var _excluded = ["styles", "Children", "maxLine", "tooltip", "trim", "containerRect", "containerRef", "includeTooltipProps", "children"];
22
+ /*!__reshadow-styles__:"./style/ellipsis.shadow.css"*/
23
+ var style = (
16
24
  /*__reshadow_css_start__*/
17
25
  (sstyled.insert(
18
26
  /*__inner_css_start__*/
19
- ".___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}",
27
+ ".___SBeginning_bcnty_gg_,.___SEllipsis_bcnty_gg_{overflow:hidden;display:inline-block;text-overflow:ellipsis;white-space:pre}.___SEllipsis_bcnty_gg_.__maxLine_bcnty_gg_{display:-webkit-box;-webkit-line-clamp:var(--maxLine_bcnty);-webkit-box-orient:vertical;overflow:hidden;white-space:normal;word-wrap:break-word}.___SContainerMiddle_bcnty_gg_,.___SContainer_bcnty_gg_,.___SEllipsis_bcnty_gg_.__middle-mod_bcnty_gg_,.___SNoTooltipContainer_bcnty_gg_{display:flex;overflow:hidden}.___SContainerMiddle_bcnty_gg_>:has(.___SBeginning_bcnty_gg_),.___SContainerMiddle_bcnty_gg_>:has(.___STail_bcnty_gg_){display:flex;width:100%}.___STail_bcnty_gg_{white-space:pre}",
20
28
  /*__inner_css_end__*/
21
- "4aonj_gg_"
29
+ "bcnty_gg_"
22
30
  ), /*__reshadow_css_end__*/
23
31
  {
24
- "__SBeginning": "___SBeginning_4aonj_gg_",
25
- "__SEllipsis": "___SEllipsis_4aonj_gg_",
26
- "__SContainer": "___SContainer_4aonj_gg_",
27
- "__SNoTooltipContainer": "___SNoTooltipContainer_4aonj_gg_",
28
- "__SContainerMiddle": "___SContainerMiddle_4aonj_gg_",
29
- "_maxLine": "__maxLine_4aonj_gg_",
30
- "--maxLine": "--maxLine_4aonj",
31
- "_middle-mod": "__middle-mod_4aonj_gg_",
32
- "__STail": "___STail_4aonj_gg_"
32
+ "__SBeginning": "___SBeginning_bcnty_gg_",
33
+ "__SEllipsis": "___SEllipsis_bcnty_gg_",
34
+ "__SContainer": "___SContainer_bcnty_gg_",
35
+ "__SNoTooltipContainer": "___SNoTooltipContainer_bcnty_gg_",
36
+ "__SContainerMiddle": "___SContainerMiddle_bcnty_gg_",
37
+ "_maxLine": "__maxLine_bcnty_gg_",
38
+ "--maxLine": "--maxLine_bcnty",
39
+ "_middle-mod": "__middle-mod_bcnty_gg_",
40
+ "__STail": "___STail_bcnty_gg_"
33
41
  })
34
42
  );
35
- const defaultTooltipProps = ["title", "theme", "strategy", "modifiers", "placement", "interaction", "timeout", "visible", "defaultVisible", "onVisibleChange", "offset", "preventOverflow", "arrow", "flip", "computeStyles", "eventListeners", "onFirstUpdate", "cursorAnchoring"];
36
- const forcedAdvancedMode = {
43
+ var defaultTooltipProps = ["title", "theme", "strategy", "modifiers", "placement", "interaction", "timeout", "visible", "defaultVisible", "onVisibleChange", "offset", "preventOverflow", "arrow", "flip", "computeStyles", "eventListeners", "onFirstUpdate", "cursorAnchoring"];
44
+ var setFontSettings = function setFontSettings2(element, styleElement) {
45
+ element.style.fontFamily = styleElement.getPropertyValue("font-family");
46
+ element.style.fontSize = styleElement.getPropertyValue("font-size");
47
+ element.style.fontWeight = styleElement.getPropertyValue("font-weight");
48
+ element.style.lineHeight = styleElement.getPropertyValue("line-height");
49
+ element.style.fontFeatureSettings = styleElement.getPropertyValue("font-feature-settings");
50
+ element.style.fontVariantNumeric = styleElement.getPropertyValue("font-variant-numeric");
51
+ };
52
+ var createMeasurerElement = function createMeasurerElement2(element, text) {
53
+ var styleElement = window.getComputedStyle(element, null);
54
+ var temporaryElement = document.createElement("temporary-block");
55
+ temporaryElement.style.display = styleElement.getPropertyValue("display");
56
+ temporaryElement.style.padding = styleElement.getPropertyValue("padding");
57
+ temporaryElement.style.position = "absolute";
58
+ temporaryElement.style.right = "0%";
59
+ temporaryElement.style.bottom = "0%";
60
+ temporaryElement.style.visibility = "hidden";
61
+ temporaryElement.style.whiteSpace = styleElement.getPropertyValue("white-space");
62
+ temporaryElement.style.wordWrap = styleElement.getPropertyValue("word-wrap");
63
+ setFontSettings(temporaryElement, styleElement);
64
+ temporaryElement.textContent = text !== null && text !== void 0 ? text : element.textContent;
65
+ return temporaryElement;
66
+ };
67
+ function isTextOverflowing(element, multiline, text) {
68
+ if (!element) return false;
69
+ var _element$getBoundingC = element.getBoundingClientRect(), currentHeight = _element$getBoundingC.height, currentWidth = _element$getBoundingC.width;
70
+ var measuringElement = createMeasurerElement(element, text);
71
+ var isOverflowing = false;
72
+ document.body.appendChild(measuringElement);
73
+ if (multiline) {
74
+ measuringElement.style.width = "".concat(currentWidth, "px");
75
+ var width = measuringElement.scrollWidth;
76
+ var height = measuringElement.getBoundingClientRect().height;
77
+ if (Math.ceil(currentHeight) < height || Math.ceil(currentWidth) < width) {
78
+ isOverflowing = true;
79
+ }
80
+ } else {
81
+ measuringElement.style.whiteSpace = "nowrap";
82
+ isOverflowing = Math.ceil(currentWidth) < measuringElement.getBoundingClientRect().width;
83
+ }
84
+ document.body.removeChild(measuringElement);
85
+ return isOverflowing;
86
+ }
87
+ var forcedAdvancedMode = {
37
88
  forcedAdvancedMode: true
38
89
  };
39
- const noAdvancedMode = {};
40
- class RootEllipsis extends Component {
41
- constructor(...args) {
42
- super(...args);
43
- _defineProperty(this, "state", {
90
+ var noAdvancedMode = {};
91
+ var RootEllipsis = /* @__PURE__ */ (function(_Component) {
92
+ function RootEllipsis2() {
93
+ var _this;
94
+ _classCallCheck(this, RootEllipsis2);
95
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
96
+ args[_key] = arguments[_key];
97
+ }
98
+ _this = _callSuper(this, RootEllipsis2, [].concat(args));
99
+ _defineProperty(_this, "state", {
44
100
  visible: false
45
101
  });
46
- _defineProperty(this, "textRef", /* @__PURE__ */ React.createRef());
47
- _defineProperty(this, "handlerVisibleChange", (visible) => {
48
- this.setState({
49
- visible: visible && this.showTooltip()
102
+ _defineProperty(_this, "textRef", /* @__PURE__ */ React.createRef());
103
+ _defineProperty(_this, "handlerVisibleChange", function(visible) {
104
+ _this.setState({
105
+ visible: visible && _this.showTooltip()
50
106
  });
51
107
  });
108
+ return _this;
52
109
  }
53
- showTooltip() {
54
- const {
55
- maxLine = 1,
56
- Children
57
- } = this.asProps;
58
- const text = reactToText(getOriginChildren(Children));
59
- return isTextOverflowing(this.textRef.current, maxLine > 1, text);
60
- }
61
- getContentProps() {
62
- return {
63
- ref: this.textRef,
64
- maxLine: this.asProps.maxLine
65
- };
66
- }
67
- getPopperProps() {
68
- const {
69
- Children,
70
- includeTooltipProps
71
- } = this.asProps;
72
- const text = reactToText(getOriginChildren(Children));
73
- const tooltipProps = pick(this.asProps, includeTooltipProps);
74
- return {
75
- children: text,
76
- ...tooltipProps
77
- };
78
- }
79
- render() {
80
- var _ref3;
81
- const SEllipsis = this.Root;
82
- const SContainer = Tooltip;
83
- const {
84
- styles,
85
- Children,
86
- maxLine,
87
- tooltip,
88
- trim,
89
- containerRect,
90
- containerRef,
91
- includeTooltipProps,
92
- children: _children,
93
- ...other
94
- } = this.asProps;
95
- const {
96
- visible
97
- } = this.state;
98
- const advancedContent = findComponent(Children, [Ellipsis.Content.displayName]);
99
- const text = reactToText(advancedContent || getOriginChildren(Children));
100
- const advanceMode = isAdvanceMode(Children, [Ellipsis.Content.displayName, Ellipsis.Popper.displayName]);
101
- const tooltipProps = pick(this.asProps, includeTooltipProps);
102
- tooltipProps.visible = tooltipProps.visible ?? visible;
103
- tooltipProps.onVisibleChange = tooltipProps.onVisibleChange ? callAllEventHandlers(tooltipProps.onVisibleChange, this.handlerVisibleChange) : this.handlerVisibleChange;
104
- if (trim === "middle") {
105
- var _ref2;
106
- return _ref2 = sstyled(styles), /* @__PURE__ */ React.createElement(EllipsisMiddle, _ref2.cn("EllipsisMiddle", {
107
- "text": text,
108
- "styles": styles,
109
- "tooltip": tooltip,
110
- "containerRect": containerRect,
111
- "containerRef": containerRef,
112
- "textRef": this.textRef,
113
- "tooltipProps": tooltipProps,
114
- "advanceMode": advanceMode,
115
- ...other
116
- }), /* @__PURE__ */ React.createElement(Children, _ref2.cn("Children", {})));
110
+ _inherits(RootEllipsis2, _Component);
111
+ return _createClass(RootEllipsis2, [{
112
+ key: "showTooltip",
113
+ value: function showTooltip() {
114
+ var _this$asProps = this.asProps, _this$asProps$maxLine = _this$asProps.maxLine, maxLine = _this$asProps$maxLine === void 0 ? 1 : _this$asProps$maxLine, Children = _this$asProps.Children;
115
+ var text = reactToText(getOriginChildren(Children));
116
+ return isTextOverflowing(this.textRef.current, maxLine > 1, text);
117
117
  }
118
- return _ref3 = sstyled(styles), /* @__PURE__ */ React.createElement(SContainer, _ref3.cn("SContainer", {
119
- "interaction": tooltip ? "hover" : "none",
120
- "title": !advanceMode ? text : void 0,
121
- ...tooltipProps,
122
- ...advanceMode ? forcedAdvancedMode : noAdvancedMode
123
- }), advanceMode ? /* @__PURE__ */ React.createElement(Children, _ref3.cn("Children", {})) : /* @__PURE__ */ React.createElement(SEllipsis, _ref3.cn("SEllipsis", {
124
- "render": Box,
125
- "ref": this.textRef,
126
- "maxLine": maxLine,
127
- ...other
128
- }), /* @__PURE__ */ React.createElement(Children, _ref3.cn("Children", {}))));
129
- }
130
- }
118
+ }, {
119
+ key: "getContentProps",
120
+ value: function getContentProps() {
121
+ return {
122
+ ref: this.textRef,
123
+ maxLine: this.asProps.maxLine
124
+ };
125
+ }
126
+ }, {
127
+ key: "getPopperProps",
128
+ value: function getPopperProps() {
129
+ var _this$asProps2 = this.asProps, Children = _this$asProps2.Children, includeTooltipProps = _this$asProps2.includeTooltipProps;
130
+ var text = reactToText(getOriginChildren(Children));
131
+ var tooltipProps = pick(this.asProps, includeTooltipProps);
132
+ return _objectSpread({
133
+ children: text
134
+ }, tooltipProps);
135
+ }
136
+ }, {
137
+ key: "render",
138
+ value: function render() {
139
+ var _ref3, _tooltipProps$visible;
140
+ var SEllipsis = this.Root;
141
+ var SContainer = Tooltip;
142
+ 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;
143
+ _this$asProps3.children;
144
+ var other = _objectWithoutProperties(_this$asProps3, _excluded);
145
+ var visible = this.state.visible;
146
+ var advancedContent = findComponent(Children, [Ellipsis.Content.displayName]);
147
+ var text = reactToText(advancedContent || getOriginChildren(Children));
148
+ var advanceMode = isAdvanceMode(Children, [Ellipsis.Content.displayName, Ellipsis.Popper.displayName]);
149
+ var tooltipProps = pick(this.asProps, includeTooltipProps);
150
+ tooltipProps.visible = (_tooltipProps$visible = tooltipProps.visible) !== null && _tooltipProps$visible !== void 0 ? _tooltipProps$visible : visible;
151
+ tooltipProps.onVisibleChange = tooltipProps.onVisibleChange ? callAllEventHandlers(tooltipProps.onVisibleChange, this.handlerVisibleChange) : this.handlerVisibleChange;
152
+ if (trim === "middle") {
153
+ var _ref2;
154
+ return _ref2 = sstyled(styles), /* @__PURE__ */ React.createElement(EllipsisMiddle, _ref2.cn("EllipsisMiddle", _objectSpread({
155
+ "text": text,
156
+ "styles": styles,
157
+ "tooltip": tooltip,
158
+ "containerRect": containerRect,
159
+ "containerRef": containerRef,
160
+ "textRef": this.textRef,
161
+ "tooltipProps": tooltipProps,
162
+ "advanceMode": advanceMode
163
+ }, other)), /* @__PURE__ */ React.createElement(Children, _ref2.cn("Children", {})));
164
+ }
165
+ return _ref3 = sstyled(styles), /* @__PURE__ */ React.createElement(SContainer, _ref3.cn("SContainer", _objectSpread(_objectSpread({
166
+ "interaction": tooltip ? "hover" : "none",
167
+ "title": !advanceMode ? text : void 0
168
+ }, tooltipProps), advanceMode ? forcedAdvancedMode : noAdvancedMode)), advanceMode ? /* @__PURE__ */ React.createElement(Children, _ref3.cn("Children", {})) : /* @__PURE__ */ React.createElement(SEllipsis, _ref3.cn("SEllipsis", _objectSpread({
169
+ "render": Box,
170
+ "ref": this.textRef,
171
+ "maxLine": maxLine
172
+ }, other)), /* @__PURE__ */ React.createElement(Children, _ref3.cn("Children", {}))));
173
+ }
174
+ }]);
175
+ })(Component);
131
176
  _defineProperty(RootEllipsis, "displayName", "Ellipsis");
132
177
  _defineProperty(RootEllipsis, "style", style);
133
178
  _defineProperty(RootEllipsis, "defaultProps", {
@@ -136,97 +181,75 @@ _defineProperty(RootEllipsis, "defaultProps", {
136
181
  includeTooltipProps: defaultTooltipProps,
137
182
  __excludeProps: ["title"]
138
183
  });
139
- const EllipsisMiddleContext = /* @__PURE__ */ React.createContext(null);
184
+ var EllipsisMiddleContext = /* @__PURE__ */ React.createContext(null);
140
185
  function EllipsisMiddle(props) {
141
186
  var _ref5;
142
- const {
143
- styles,
144
- text,
145
- tooltip,
146
- containerRect,
147
- containerRef,
148
- textRef,
149
- tooltipProps,
150
- children,
151
- advanceMode,
152
- tag
153
- } = props;
154
- const resizeElement = React.useRef(null);
155
- const [symbolWidth, setSymbolWidth] = React.useState(0);
156
- const blockWidth = useResizeObserver(resizeElement, containerRect).width;
157
- useEnhancedEffect(() => {
158
- const node = containerRef?.current || resizeElement?.current;
187
+ 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;
188
+ var resizeElement = React.useRef(null);
189
+ var _React$useState = React.useState(0), _React$useState2 = _slicedToArray(_React$useState, 2), symbolWidth = _React$useState2[0], setSymbolWidth = _React$useState2[1];
190
+ var blockWidth = useResizeObserver(resizeElement, containerRect).width;
191
+ useEnhancedEffect(function() {
192
+ var node = (containerRef === null || containerRef === void 0 ? void 0 : containerRef.current) || (resizeElement === null || resizeElement === void 0 ? void 0 : resizeElement.current);
159
193
  if (!node) return;
160
- const styleElement = window.getComputedStyle(node);
161
- const dateSpan = document.createElement("temporary-block");
194
+ var styleElement = window.getComputedStyle(node);
195
+ var dateSpan = document.createElement("temporary-block");
162
196
  setFontSettings(dateSpan, styleElement);
163
197
  dateSpan.textContent = "a";
164
198
  document.body.appendChild(dateSpan);
165
- const rect = dateSpan.getBoundingClientRect();
199
+ var rect = dateSpan.getBoundingClientRect();
166
200
  setSymbolWidth(rect.width);
167
201
  document.body.removeChild(dateSpan);
168
202
  }, []);
169
- const STail = "span";
170
- const SBeginning = "span";
171
- const SContainerMiddle = Tooltip;
172
- const SAdvancedModeContainerMiddle = Tooltip;
173
- const displayedSymbols = React.useMemo(() => {
174
- const displayedSymbols2 = Math.round(blockWidth / symbolWidth);
203
+ var STail = "span";
204
+ var SBeginning = "span";
205
+ var SContainerMiddle = Tooltip;
206
+ var SAdvancedModeContainerMiddle = Tooltip;
207
+ var displayedSymbols = React.useMemo(function() {
208
+ var displayedSymbols2 = Math.round(blockWidth / symbolWidth);
175
209
  return displayedSymbols2 % 2 === 0 ? displayedSymbols2 : displayedSymbols2 - 1;
176
210
  }, [blockWidth, symbolWidth]);
177
- const interaction = text.length > displayedSymbols ? "hover" : "none";
178
- const ref = containerRef ?? resizeElement;
179
- const contextValue = React.useMemo(() => ({
180
- begining: text.substring(0, text.length - displayedSymbols / 2 - 1),
181
- tail: text.substring(text.length - displayedSymbols / 2 - 1),
182
- ref
183
- }), [text, displayedSymbols]);
211
+ var interaction = text.length > displayedSymbols ? "hover" : "none";
212
+ var ref = containerRef !== null && containerRef !== void 0 ? containerRef : resizeElement;
213
+ var contextValue = React.useMemo(function() {
214
+ return {
215
+ begining: text.substring(0, text.length - displayedSymbols / 2 - 1),
216
+ tail: text.substring(text.length - displayedSymbols / 2 - 1),
217
+ ref
218
+ };
219
+ }, [text, displayedSymbols]);
184
220
  if (advanceMode) {
185
221
  var _ref4;
186
- return _ref4 = sstyled(styles), /* @__PURE__ */ React.createElement(SAdvancedModeContainerMiddle, _ref4.cn("SAdvancedModeContainerMiddle", {
187
- "interaction": tooltip ? interaction : "none",
188
- ...tooltipProps,
189
- ...forcedAdvancedMode
190
- }), /* @__PURE__ */ React.createElement(EllipsisMiddleContext.Provider, {
222
+ return _ref4 = sstyled(styles), /* @__PURE__ */ React.createElement(SAdvancedModeContainerMiddle, _ref4.cn("SAdvancedModeContainerMiddle", _objectSpread(_objectSpread({
223
+ "interaction": tooltip ? interaction : "none"
224
+ }, tooltipProps), forcedAdvancedMode)), /* @__PURE__ */ React.createElement(EllipsisMiddleContext.Provider, {
191
225
  value: contextValue
192
226
  }, children));
193
227
  }
194
- return _ref5 = sstyled(styles), /* @__PURE__ */ React.createElement(SContainerMiddle, _ref5.cn("SContainerMiddle", {
228
+ return _ref5 = sstyled(styles), /* @__PURE__ */ React.createElement(SContainerMiddle, _ref5.cn("SContainerMiddle", _objectSpread({
195
229
  "interaction": tooltip ? interaction : "none",
196
230
  "title": text,
197
231
  "ref": forkRef(ref, textRef),
198
- "tag": tag,
199
- ...tooltipProps
200
- }), /* @__PURE__ */ React.createElement(SBeginning, _ref5.cn("SBeginning", {}), contextValue.begining), /* @__PURE__ */ React.createElement(STail, _ref5.cn("STail", {}), contextValue.tail));
232
+ "tag": tag
233
+ }, tooltipProps)), /* @__PURE__ */ React.createElement(SBeginning, _ref5.cn("SBeginning", {}), contextValue.begining), /* @__PURE__ */ React.createElement(STail, _ref5.cn("STail", {}), contextValue.tail));
201
234
  }
202
- function Content({
203
- styles,
204
- Children
205
- }) {
235
+ function Content(_ref8) {
206
236
  var _ref = arguments[0], _ref7;
207
- const SEllipsis = Tooltip.Trigger;
208
- const ellipsisMiddleContext = React.useContext(EllipsisMiddleContext);
209
- const STail = "span";
210
- const SBeginning = "span";
237
+ var styles = _ref8.styles, Children = _ref8.Children;
238
+ var SEllipsis = Tooltip.Trigger;
239
+ var ellipsisMiddleContext = React.useContext(EllipsisMiddleContext);
240
+ var STail = "span";
241
+ var SBeginning = "span";
211
242
  if (ellipsisMiddleContext) {
212
243
  var _ref6;
213
- const {
214
- begining,
215
- tail,
216
- ref
217
- } = ellipsisMiddleContext;
218
- return _ref6 = sstyled(styles), /* @__PURE__ */ React.createElement(SEllipsis, _ref6.cn("SEllipsis", {
219
- ...assignProps({
220
- "middle-mod": true,
221
- "ref": ref
222
- }, _ref)
223
- }), /* @__PURE__ */ React.createElement(SBeginning, _ref6.cn("SBeginning", {}), begining), /* @__PURE__ */ React.createElement(STail, _ref6.cn("STail", {}), tail));
244
+ var begining = ellipsisMiddleContext.begining, tail = ellipsisMiddleContext.tail, ref = ellipsisMiddleContext.ref;
245
+ return _ref6 = sstyled(styles), /* @__PURE__ */ React.createElement(SEllipsis, _ref6.cn("SEllipsis", _objectSpread({}, assignProps({
246
+ "middle-mod": true,
247
+ "ref": ref
248
+ }, _ref))), /* @__PURE__ */ React.createElement(SBeginning, _ref6.cn("SBeginning", {}), begining), /* @__PURE__ */ React.createElement(STail, _ref6.cn("STail", {}), tail));
224
249
  }
225
- return _ref7 = sstyled(styles), /* @__PURE__ */ React.createElement(SEllipsis, _ref7.cn("SEllipsis", {
226
- ...assignProps({}, _ref)
227
- }), /* @__PURE__ */ React.createElement(Children, _ref7.cn("Children", {})));
250
+ return _ref7 = sstyled(styles), /* @__PURE__ */ React.createElement(SEllipsis, _ref7.cn("SEllipsis", _objectSpread({}, assignProps({}, _ref))), /* @__PURE__ */ React.createElement(Children, _ref7.cn("Children", {})));
228
251
  }
229
- const Ellipsis = createComponent(RootEllipsis, {
252
+ var Ellipsis = createComponent(RootEllipsis, {
230
253
  Content,
231
254
  Popper: Tooltip.Popper
232
255
  });