@particle-network/ui-react 0.4.1-beta.1 → 0.4.1-beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import ExtendedTooltip from './tooltip.extend';
|
|
3
3
|
export type UXTooltipProps = React.ComponentPropsWithRef<typeof ExtendedTooltip>;
|
|
4
4
|
export declare const UXTooltip: React.FC<UXTooltipProps>;
|
|
@@ -1,3 +1,32 @@
|
|
|
1
|
-
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import "react";
|
|
3
|
+
import { hasLongWord } from "../../utils/index.js";
|
|
4
|
+
import tooltip_extend from "./tooltip.extend.js";
|
|
5
|
+
const renderContent = (content)=>{
|
|
6
|
+
if (!content) return null;
|
|
7
|
+
if ('string' != typeof content) return content;
|
|
8
|
+
if (!content.includes('\n')) return content;
|
|
9
|
+
return content.split('\n').flatMap((x, i, arr)=>i < arr.length - 1 ? [
|
|
10
|
+
x,
|
|
11
|
+
/*#__PURE__*/ jsx("br", {}, i)
|
|
12
|
+
] : [
|
|
13
|
+
x
|
|
14
|
+
]);
|
|
15
|
+
};
|
|
16
|
+
const UXTooltip = (props)=>{
|
|
17
|
+
const { content, classNames, ...restProps } = props;
|
|
18
|
+
const { content: contentClassName, ...restClassNames } = classNames ?? {};
|
|
19
|
+
return /*#__PURE__*/ jsx(tooltip_extend, {
|
|
20
|
+
content: renderContent(content),
|
|
21
|
+
classNames: {
|
|
22
|
+
content: [
|
|
23
|
+
hasLongWord(content) && 'break-all',
|
|
24
|
+
contentClassName
|
|
25
|
+
],
|
|
26
|
+
...restClassNames
|
|
27
|
+
},
|
|
28
|
+
...restProps
|
|
29
|
+
});
|
|
30
|
+
};
|
|
2
31
|
UXTooltip.displayName = 'UX.Tooltip';
|
|
3
32
|
export { UXTooltip };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@particle-network/ui-react",
|
|
3
|
-
"version": "0.4.1-beta.
|
|
3
|
+
"version": "0.4.1-beta.2",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": {
|
|
@@ -38,8 +38,8 @@
|
|
|
38
38
|
"@rslib/core": "^0.12.3",
|
|
39
39
|
"@types/react": "^19.1.10",
|
|
40
40
|
"react": "^19.1.2",
|
|
41
|
-
"@particle-network/
|
|
42
|
-
"@particle-network/
|
|
41
|
+
"@particle-network/eslint-config": "0.3.0",
|
|
42
|
+
"@particle-network/lintstaged-config": "0.1.0"
|
|
43
43
|
},
|
|
44
44
|
"peerDependencies": {
|
|
45
45
|
"react": ">=16.9.0",
|