@particle-network/ui-react 0.5.1-beta.8 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/ProgressWrapper/index.js +2 -3
- package/dist/components/UXAutocomplete/index.js +1 -2
- package/dist/components/UXCheckbox/checkbox.extend.js +15 -12
- package/dist/components/UXColorPicker/color-input.js +1 -1
- package/dist/components/UXColorPicker/color-picker.js +43 -31
- package/dist/components/UXColorPicker/types.d.ts +4 -0
- package/dist/components/UXCopy/index.js +1 -1
- package/dist/components/UXEmpty/index.js +1 -1
- package/dist/components/UXHint/index.js +2 -2
- package/dist/components/UXModal/index.d.ts +1 -1
- package/dist/components/UXRangeInput/index.d.ts +42 -0
- package/dist/components/UXRangeInput/index.js +94 -0
- package/dist/components/UXSlider/use-slider.js +1 -1
- package/dist/components/UXSpinner/spinner.js +1 -1
- package/dist/components/UXSwitch/switch.extend.js +6 -6
- package/dist/components/UXThemeSwitch/custom-theme-config.d.ts +4 -1
- package/dist/components/UXThemeSwitch/custom-theme-config.js +8 -7
- package/dist/components/UXThemeSwitch/index.d.ts +2 -2
- package/dist/components/UXThemeSwitch/index.js +2 -2
- package/dist/components/UXThemeSwitch/theme-item.js +6 -7
- package/dist/components/UXThemeSwitch/theme-switch.d.ts +8 -1
- package/dist/components/UXThemeSwitch/theme-switch.js +12 -18
- package/dist/components/UXThemeSwitch/use-theme.d.ts +2 -1
- package/dist/components/UXThemeSwitch/use-theme.js +4 -9
- package/dist/components/UXThemeSwitch/utils.js +52 -15
- package/dist/components/UXToast/index.d.ts +1 -1
- package/dist/components/UXToast/index.js +22 -10
- package/dist/components/UXTooltip/index.js +4 -12
- package/dist/components/WrapText/index.d.ts +6 -0
- package/dist/components/WrapText/index.js +15 -0
- package/dist/components/index.d.ts +2 -0
- package/dist/components/index.js +2 -0
- package/dist/components/layout/Box/box-theme.d.ts +36 -18
- package/dist/components/layout/Box/box-theme.js +25 -19
- package/dist/components/layout/Box/box.js +14 -5
- package/dist/components/layout/Square.js +2 -4
- package/dist/components/typography/Text.js +18 -8
- package/dist/components/typography/Text.type.d.ts +1 -0
- package/dist/hooks/useI18n.d.ts +18 -10
- package/dist/hooks/useI18n.js +18 -10
- package/dist/utils/cn.d.ts +2 -0
- package/dist/utils/cn.js +250 -0
- package/dist/utils/common.d.ts +4 -0
- package/dist/utils/common.js +13 -0
- package/dist/utils/index.d.ts +1 -0
- package/dist/utils/index.js +2 -1
- package/package.json +5 -5
- package/tailwind-preset.js +18 -18
- package/dist/components/UXThemeSwitch/use-color-scheme.d.ts +0 -5
- package/dist/components/UXThemeSwitch/use-color-scheme.js +0 -14
- package/dist/components/UXThemeSwitch/use-theme-color.d.ts +0 -1
- package/dist/components/UXThemeSwitch/use-theme-color.js +0 -6
- package/dist/components/UXThemeSwitch/use-theme-store.d.ts +0 -46
- package/dist/components/UXThemeSwitch/use-theme-store.js +0 -36
|
@@ -4,9 +4,16 @@ import { type UXModalProps } from '../UXModal';
|
|
|
4
4
|
export interface UXThemeSwitchModalProps extends Pick<UXModalProps, 'isOpen' | 'onClose' | 'onOpenChange' | 'backdrop'> {
|
|
5
5
|
as?: 'modal' | 'drawer';
|
|
6
6
|
omitThemes?: ThemeId[];
|
|
7
|
+
/**
|
|
8
|
+
* 颜色改变模式
|
|
9
|
+
* - drag: 拖动时改变颜色
|
|
10
|
+
* - dragEnd: 拖动停止时改变颜色
|
|
11
|
+
* @default dragEnd
|
|
12
|
+
*/
|
|
13
|
+
colorChangeMode?: 'drag' | 'dragEnd';
|
|
7
14
|
}
|
|
8
15
|
export declare const UXThemeSwitchModal: React.FC<UXThemeSwitchModalProps>;
|
|
9
|
-
export interface UXThemeSwitchProps extends Pick<UXThemeSwitchModalProps, 'as' | 'omitThemes' | 'backdrop'> {
|
|
16
|
+
export interface UXThemeSwitchProps extends Pick<UXThemeSwitchModalProps, 'as' | 'omitThemes' | 'backdrop' | 'colorChangeMode'> {
|
|
10
17
|
children?: (onOpen: () => void) => React.ReactNode;
|
|
11
18
|
}
|
|
12
19
|
export declare const UXThemeSwitch: React.FC<UXThemeSwitchProps>;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { useMemo, useState } from "react";
|
|
3
|
-
import { cn } from "@heroui/theme";
|
|
2
|
+
import { useEffect, useMemo, useState } from "react";
|
|
4
3
|
import { useDisclosure } from "@heroui/use-disclosure";
|
|
5
4
|
import { ChartColorSwitchIcon, CopyIcon } from "@particle-network/icons/web";
|
|
6
|
-
import {
|
|
5
|
+
import { themeData } from "@particle-network/ui-shared";
|
|
7
6
|
import { useI18n } from "../../hooks/index.js";
|
|
7
|
+
import { cn } from "../../utils/index.js";
|
|
8
8
|
import { HStack, VStack } from "../layout/index.js";
|
|
9
9
|
import { Text } from "../typography/Text.js";
|
|
10
10
|
import { UXButton } from "../UXButton/index.js";
|
|
@@ -32,27 +32,19 @@ const FONT_EXAMPLES = [
|
|
|
32
32
|
url: 'https://fonts.googleapis.com/css2?family=Roboto:ital,wght@0,100..900;1,100..900&display=swap'
|
|
33
33
|
}
|
|
34
34
|
];
|
|
35
|
-
const UXThemeSwitchModal = ({ as = 'modal', omitThemes = [], backdrop, isOpen, onClose, onOpenChange })=>{
|
|
35
|
+
const UXThemeSwitchModal = ({ as = 'modal', omitThemes = [], backdrop, isOpen, onClose, onOpenChange, colorChangeMode })=>{
|
|
36
36
|
const i18n = useI18n();
|
|
37
|
-
const { theme: selectedTheme, customTheme: savedCustomTheme, setTheme, fontUrl, setFontUrl, fontName, fontLoadStatus, clearFontUrl } = useTheme();
|
|
37
|
+
const { theme: selectedTheme, customTheme: savedCustomTheme, setTheme, initTheme, fontUrl, setFontUrl, fontName, fontLoadStatus, clearFontUrl } = useTheme();
|
|
38
38
|
const [isFontExampleOpen, setIsFontExampleOpen] = useState(false);
|
|
39
|
+
useEffect(()=>{
|
|
40
|
+
initTheme();
|
|
41
|
+
}, []);
|
|
39
42
|
const Component = 'modal' === as ? UXModal : UXDrawer;
|
|
40
43
|
const themes = useMemo(()=>themeData.filter((theme)=>!omitThemes.includes(theme.id)), [
|
|
41
44
|
omitThemes
|
|
42
45
|
]);
|
|
43
46
|
const handleThemeSelect = (theme)=>{
|
|
44
|
-
|
|
45
|
-
else {
|
|
46
|
-
const baseTheme = themeData.find((t)=>t.id === DEFAULT_THEME_ID) || themeData["0"];
|
|
47
|
-
const customTheme = {
|
|
48
|
-
...theme,
|
|
49
|
-
baseThemeId: DEFAULT_THEME_ID,
|
|
50
|
-
colorScheme: baseTheme.colorScheme,
|
|
51
|
-
colorVariables: baseTheme.colorVariables
|
|
52
|
-
};
|
|
53
|
-
setTheme(customTheme);
|
|
54
|
-
}
|
|
55
|
-
else setTheme(theme);
|
|
47
|
+
'custom' === theme.id ? setTheme(savedCustomTheme) : setTheme(theme);
|
|
56
48
|
};
|
|
57
49
|
return /*#__PURE__*/ jsx(Component, {
|
|
58
50
|
isOpen: isOpen,
|
|
@@ -83,7 +75,9 @@ const UXThemeSwitchModal = ({ as = 'modal', omitThemes = [], backdrop, isOpen, o
|
|
|
83
75
|
'custom' === selectedTheme.id && /*#__PURE__*/ jsxs(Fragment, {
|
|
84
76
|
children: [
|
|
85
77
|
/*#__PURE__*/ jsx(UXDivider, {}),
|
|
86
|
-
/*#__PURE__*/ jsx(CustomThemeConfig, {
|
|
78
|
+
/*#__PURE__*/ jsx(CustomThemeConfig, {
|
|
79
|
+
colorChangeMode: colorChangeMode
|
|
80
|
+
})
|
|
87
81
|
]
|
|
88
82
|
}),
|
|
89
83
|
/*#__PURE__*/ jsx(UXDivider, {}),
|
|
@@ -6,10 +6,11 @@ export declare const useTheme: () => {
|
|
|
6
6
|
theme: ThemeItemType;
|
|
7
7
|
customTheme: ThemeItemType;
|
|
8
8
|
setTheme: (theme: ThemeItemType) => void;
|
|
9
|
+
initTheme: () => void;
|
|
9
10
|
setCustomTheme: (customTheme: ThemeItemType) => void;
|
|
10
11
|
fontUrl: string;
|
|
11
12
|
setFontUrl: (link: string) => void;
|
|
12
13
|
clearFontUrl: () => void;
|
|
13
|
-
fontLoadStatus: import("
|
|
14
|
+
fontLoadStatus: import("@particle-network/ui-shared").FontLoadStatus;
|
|
14
15
|
fontName: string;
|
|
15
16
|
};
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { useThemeStore } from "@particle-network/ui-shared";
|
|
2
2
|
import { useDebounceFn } from "ahooks";
|
|
3
|
-
import { useThemeStore } from "./use-theme-store.js";
|
|
4
3
|
import { applyFont, applyTheme, extractFontFamilyFromLink, preloadFonts } from "./utils.js";
|
|
5
4
|
const useTheme = ()=>{
|
|
6
5
|
const theme = useThemeStore((state)=>state.theme);
|
|
@@ -42,16 +41,11 @@ const useTheme = ()=>{
|
|
|
42
41
|
const { run: debouncedApplyFont } = useDebounceFn((customFontLink, themeFontName)=>applyFontWithStatus(customFontLink, themeFontName), {
|
|
43
42
|
wait: 300
|
|
44
43
|
});
|
|
45
|
-
|
|
44
|
+
const initTheme = ()=>{
|
|
46
45
|
preloadFonts();
|
|
47
46
|
applyTheme(theme);
|
|
48
47
|
debouncedApplyFont(fontUrl, theme.fontName);
|
|
49
|
-
}
|
|
50
|
-
useEffect(()=>{
|
|
51
|
-
applyTheme(theme);
|
|
52
|
-
}, [
|
|
53
|
-
theme
|
|
54
|
-
]);
|
|
48
|
+
};
|
|
55
49
|
const setTheme = (theme)=>{
|
|
56
50
|
storeSetTheme(theme);
|
|
57
51
|
applyTheme(theme);
|
|
@@ -71,6 +65,7 @@ const useTheme = ()=>{
|
|
|
71
65
|
theme,
|
|
72
66
|
customTheme,
|
|
73
67
|
setTheme,
|
|
68
|
+
initTheme,
|
|
74
69
|
setCustomTheme: storeSetCustomTheme,
|
|
75
70
|
fontUrl,
|
|
76
71
|
setFontUrl,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { hexColorToHSLValue, themeKeys } from "@particle-network/ui-shared";
|
|
1
|
+
import { hexColorToHSLValue, objectEntries, themeData, themeKeys } from "@particle-network/ui-shared";
|
|
2
2
|
import { readableColor } from "color2k";
|
|
3
3
|
import { generateThemeColor } from "../../heroui/utils/colors.js";
|
|
4
4
|
import { DEFAULT_FONT_FAMILY, PRELOAD_FONTS_URL } from "./constants.js";
|
|
@@ -12,10 +12,17 @@ const getCSSProperties = (theme)=>{
|
|
|
12
12
|
]
|
|
13
13
|
],
|
|
14
14
|
secondary: [
|
|
15
|
-
|
|
15
|
+
[
|
|
16
|
+
'--heroui-secondary',
|
|
17
|
+
colorVariables.secondary
|
|
18
|
+
],
|
|
16
19
|
[
|
|
17
20
|
'--heroui-foreground-300',
|
|
18
21
|
colorVariables.secondary
|
|
22
|
+
],
|
|
23
|
+
[
|
|
24
|
+
'--heroui-secondary-foreground',
|
|
25
|
+
readableColor(colorVariables.secondary)
|
|
19
26
|
]
|
|
20
27
|
],
|
|
21
28
|
tertiary: [
|
|
@@ -33,8 +40,26 @@ const getCSSProperties = (theme)=>{
|
|
|
33
40
|
]
|
|
34
41
|
],
|
|
35
42
|
primary: generateThemeColor(colorVariables.primary, 'primary', theme.colorScheme).cssVariables,
|
|
36
|
-
success:
|
|
37
|
-
|
|
43
|
+
success: [
|
|
44
|
+
[
|
|
45
|
+
'--heroui-success',
|
|
46
|
+
colorVariables.success
|
|
47
|
+
],
|
|
48
|
+
[
|
|
49
|
+
'--heroui-success-foreground',
|
|
50
|
+
readableColor(colorVariables.success)
|
|
51
|
+
]
|
|
52
|
+
],
|
|
53
|
+
danger: [
|
|
54
|
+
[
|
|
55
|
+
'--heroui-danger',
|
|
56
|
+
colorVariables.danger
|
|
57
|
+
],
|
|
58
|
+
[
|
|
59
|
+
'--heroui-danger-foreground',
|
|
60
|
+
readableColor(colorVariables.danger)
|
|
61
|
+
]
|
|
62
|
+
],
|
|
38
63
|
alert: [
|
|
39
64
|
[
|
|
40
65
|
'--heroui-alert',
|
|
@@ -45,7 +70,16 @@ const getCSSProperties = (theme)=>{
|
|
|
45
70
|
readableColor(colorVariables.alert)
|
|
46
71
|
]
|
|
47
72
|
],
|
|
48
|
-
warning:
|
|
73
|
+
warning: [
|
|
74
|
+
[
|
|
75
|
+
'--heroui-warning',
|
|
76
|
+
colorVariables.warning
|
|
77
|
+
],
|
|
78
|
+
[
|
|
79
|
+
'--heroui-warning-foreground',
|
|
80
|
+
readableColor(colorVariables.warning)
|
|
81
|
+
]
|
|
82
|
+
],
|
|
49
83
|
blue: [
|
|
50
84
|
[
|
|
51
85
|
'--heroui-blue',
|
|
@@ -56,32 +90,32 @@ const getCSSProperties = (theme)=>{
|
|
|
56
90
|
readableColor(colorVariables.blue)
|
|
57
91
|
]
|
|
58
92
|
],
|
|
59
|
-
|
|
93
|
+
bgDefault: [
|
|
60
94
|
[
|
|
61
95
|
'--heroui-background',
|
|
62
|
-
colorVariables
|
|
96
|
+
colorVariables.bgDefault
|
|
63
97
|
],
|
|
64
98
|
[
|
|
65
99
|
'--heroui-background-500',
|
|
66
|
-
colorVariables
|
|
100
|
+
colorVariables.bgDefault
|
|
67
101
|
]
|
|
68
102
|
],
|
|
69
|
-
|
|
103
|
+
bg200: [
|
|
70
104
|
[
|
|
71
105
|
'--heroui-background-200',
|
|
72
|
-
colorVariables
|
|
106
|
+
colorVariables.bg200
|
|
73
107
|
]
|
|
74
108
|
],
|
|
75
|
-
|
|
109
|
+
bg300: [
|
|
76
110
|
[
|
|
77
111
|
'--heroui-background-300',
|
|
78
|
-
colorVariables
|
|
112
|
+
colorVariables.bg300
|
|
79
113
|
]
|
|
80
114
|
],
|
|
81
|
-
|
|
115
|
+
bg400: [
|
|
82
116
|
[
|
|
83
117
|
'--heroui-background-400',
|
|
84
|
-
colorVariables
|
|
118
|
+
colorVariables.bg400
|
|
85
119
|
]
|
|
86
120
|
],
|
|
87
121
|
cursor: [
|
|
@@ -161,8 +195,11 @@ const setCSSProperty = (property, value)=>{
|
|
|
161
195
|
};
|
|
162
196
|
const applyCustomThemeColors = (theme)=>{
|
|
163
197
|
if ('undefined' == typeof window) return;
|
|
198
|
+
const baseThemeColors = themeData.find((t)=>t.id === theme.baseThemeId).colorVariables;
|
|
199
|
+
const customThemeColors = theme.colorVariables;
|
|
164
200
|
const cssProperties = getCSSProperties(theme);
|
|
165
|
-
|
|
201
|
+
objectEntries(cssProperties).forEach(([colorKey, value])=>{
|
|
202
|
+
if (baseThemeColors[colorKey] === customThemeColors[colorKey]) return;
|
|
166
203
|
value.forEach(([variable, value])=>{
|
|
167
204
|
setCSSProperty(variable, value);
|
|
168
205
|
});
|
|
@@ -12,7 +12,7 @@ export declare const toast: {
|
|
|
12
12
|
error: (message: ReactNode, props?: Partial<ToastProps>) => string | null;
|
|
13
13
|
loading: (message: ReactNode, props?: Partial<ToastProps>) => string | null;
|
|
14
14
|
show: (props?: Partial<ToastProps> & {
|
|
15
|
-
type
|
|
15
|
+
type?: UXToastType;
|
|
16
16
|
}) => string | null;
|
|
17
17
|
closeAll: () => void;
|
|
18
18
|
close: (key: string) => void;
|
|
@@ -5,6 +5,7 @@ import CircleCloseIcon from "@particle-network/icons/web/CircleCloseIcon";
|
|
|
5
5
|
import CloseIcon from "@particle-network/icons/web/CloseIcon";
|
|
6
6
|
import { hasLongWord } from "../../utils/index.js";
|
|
7
7
|
import { UXSpinner } from "../UXSpinner/index.js";
|
|
8
|
+
import { WrapText } from "../WrapText/index.js";
|
|
8
9
|
const UXToastProvider = ()=>/*#__PURE__*/ jsx(ToastProvider, {
|
|
9
10
|
disableAnimation: true,
|
|
10
11
|
placement: "top-center",
|
|
@@ -13,7 +14,7 @@ const UXToastProvider = ()=>/*#__PURE__*/ jsx(ToastProvider, {
|
|
|
13
14
|
timeout: 4000
|
|
14
15
|
},
|
|
15
16
|
regionProps: {
|
|
16
|
-
className: 'items-center mt-12 p-0 gap-2'
|
|
17
|
+
className: 'items-center mt-12 p-0 gap-2 z-[9999999999]'
|
|
17
18
|
}
|
|
18
19
|
});
|
|
19
20
|
const getIcon = (type)=>{
|
|
@@ -32,19 +33,25 @@ const getIcon = (type)=>{
|
|
|
32
33
|
return null;
|
|
33
34
|
};
|
|
34
35
|
const show = (props)=>{
|
|
35
|
-
const { type, hideCloseButton, icon, variant, classNames, description, ...toastProps } = props ?? {};
|
|
36
|
-
const { base, description: descriptionClassName, icon: iconClassName, loadingComponent, content, closeButton, ...restClassNames } = classNames ?? {};
|
|
36
|
+
const { type = 'info', hideCloseButton, icon, variant, classNames, title, description, ...toastProps } = props ?? {};
|
|
37
|
+
const { base, title: titleClassName, description: descriptionClassName, icon: iconClassName, loadingComponent, content, closeButton, ...restClassNames } = classNames ?? {};
|
|
37
38
|
return addToast({
|
|
38
39
|
classNames: {
|
|
39
40
|
base: [
|
|
40
|
-
'bg-cursor rounded-xl px-3.5
|
|
41
|
+
'bg-cursor rounded-xl px-3.5 shadow-none min-h-11 border-none !w-fit max-w-[90vw] md:max-w-[400px] m-0',
|
|
41
42
|
!hideCloseButton && 'pr-12',
|
|
42
43
|
'flat' === variant && 'success' === type && 'bg-[#0E3728]',
|
|
43
44
|
'flat' === variant && 'error' === type && 'bg-[#501D1D]',
|
|
44
45
|
base
|
|
45
46
|
],
|
|
47
|
+
title: [
|
|
48
|
+
'text-cursor-foreground text-xs font-medium leading-4 !whitespace-normal me-0 line-clamp-2',
|
|
49
|
+
hasLongWord(title) && 'break-all',
|
|
50
|
+
'flat' === variant && 'text-white',
|
|
51
|
+
titleClassName
|
|
52
|
+
],
|
|
46
53
|
description: [
|
|
47
|
-
'text-
|
|
54
|
+
'text-secondary !text-body3 me-0 leading-4',
|
|
48
55
|
'flat' === variant && 'text-white',
|
|
49
56
|
hasLongWord(description) && 'break-all',
|
|
50
57
|
descriptionClassName
|
|
@@ -68,7 +75,12 @@ const show = (props)=>{
|
|
|
68
75
|
],
|
|
69
76
|
...restClassNames
|
|
70
77
|
},
|
|
71
|
-
|
|
78
|
+
title: /*#__PURE__*/ jsx(WrapText, {
|
|
79
|
+
children: title
|
|
80
|
+
}),
|
|
81
|
+
description: /*#__PURE__*/ jsx(WrapText, {
|
|
82
|
+
children: description
|
|
83
|
+
}),
|
|
72
84
|
icon: icon ?? getIcon(type),
|
|
73
85
|
hideIcon: !icon && !getIcon(type),
|
|
74
86
|
closeIcon: /*#__PURE__*/ jsx(CloseIcon, {
|
|
@@ -84,22 +96,22 @@ const show = (props)=>{
|
|
|
84
96
|
const toast = {
|
|
85
97
|
info: (message, props)=>show({
|
|
86
98
|
type: 'info',
|
|
87
|
-
|
|
99
|
+
title: message,
|
|
88
100
|
...props
|
|
89
101
|
}),
|
|
90
102
|
success: (message, props)=>show({
|
|
91
103
|
type: 'success',
|
|
92
|
-
|
|
104
|
+
title: message,
|
|
93
105
|
...props
|
|
94
106
|
}),
|
|
95
107
|
error: (message, props)=>show({
|
|
96
108
|
type: 'error',
|
|
97
|
-
|
|
109
|
+
title: message,
|
|
98
110
|
...props
|
|
99
111
|
}),
|
|
100
112
|
loading: (message, props)=>show({
|
|
101
113
|
type: 'loading',
|
|
102
|
-
|
|
114
|
+
title: message,
|
|
103
115
|
...props
|
|
104
116
|
}),
|
|
105
117
|
show,
|
|
@@ -1,23 +1,15 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
2
|
import "react";
|
|
3
3
|
import { hasLongWord } from "../../utils/index.js";
|
|
4
|
+
import { WrapText } from "../WrapText/index.js";
|
|
4
5
|
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
6
|
const UXTooltip = (props)=>{
|
|
17
7
|
const { content, classNames, ...restProps } = props;
|
|
18
8
|
const { content: contentClassName, ...restClassNames } = classNames ?? {};
|
|
19
9
|
return /*#__PURE__*/ jsx(tooltip_extend, {
|
|
20
|
-
content:
|
|
10
|
+
content: /*#__PURE__*/ jsx(WrapText, {
|
|
11
|
+
children: content
|
|
12
|
+
}),
|
|
21
13
|
classNames: {
|
|
22
14
|
content: [
|
|
23
15
|
hasLongWord(content) && 'break-all',
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
interface WarpTextProps {
|
|
3
|
+
children: React.ReactNode;
|
|
4
|
+
}
|
|
5
|
+
export declare const WrapText: (props: WarpTextProps) => string | number | bigint | true | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | Iterable<React.ReactNode> | Promise<string | number | bigint | boolean | React.ReactPortal | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | Iterable<React.ReactNode> | null | undefined> | (string | import("react/jsx-runtime").JSX.Element)[] | null;
|
|
6
|
+
export {};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import "react";
|
|
3
|
+
const WrapText = (props)=>{
|
|
4
|
+
const { children } = props;
|
|
5
|
+
if (!children) return null;
|
|
6
|
+
if ('string' != typeof children) return children;
|
|
7
|
+
if (!children.includes('\n')) return children;
|
|
8
|
+
return children.split('\n').flatMap((x, i, arr)=>i < arr.length - 1 ? [
|
|
9
|
+
x,
|
|
10
|
+
/*#__PURE__*/ jsx("br", {}, i)
|
|
11
|
+
] : [
|
|
12
|
+
x
|
|
13
|
+
]);
|
|
14
|
+
};
|
|
15
|
+
export { WrapText };
|
|
@@ -21,6 +21,7 @@ export * from './UXNumberInput';
|
|
|
21
21
|
export * from './UXPagination';
|
|
22
22
|
export * from './UXPopover';
|
|
23
23
|
export * from './UXRadio';
|
|
24
|
+
export * from './UXRangeInput';
|
|
24
25
|
export * from './UXSelect';
|
|
25
26
|
export * from './UXSlider';
|
|
26
27
|
export * from './UXSpinner';
|
|
@@ -32,3 +33,4 @@ export * from './UXTextarea';
|
|
|
32
33
|
export * from './UXThemeSwitch';
|
|
33
34
|
export * from './UXToast';
|
|
34
35
|
export * from './UXTooltip';
|
|
36
|
+
export * from './WrapText';
|
package/dist/components/index.js
CHANGED
|
@@ -21,6 +21,7 @@ export * from "./UXNumberInput/index.js";
|
|
|
21
21
|
export * from "./UXPagination/index.js";
|
|
22
22
|
export * from "./UXPopover/index.js";
|
|
23
23
|
export * from "./UXRadio/index.js";
|
|
24
|
+
export * from "./UXRangeInput/index.js";
|
|
24
25
|
export * from "./UXSelect/index.js";
|
|
25
26
|
export * from "./UXSlider/index.js";
|
|
26
27
|
export * from "./UXSpinner/index.js";
|
|
@@ -32,3 +33,4 @@ export * from "./UXTextarea/index.js";
|
|
|
32
33
|
export * from "./UXThemeSwitch/index.js";
|
|
33
34
|
export * from "./UXToast/index.js";
|
|
34
35
|
export * from "./UXTooltip/index.js";
|
|
36
|
+
export * from "./WrapText/index.js";
|
|
@@ -231,15 +231,11 @@ export declare const boxVariants: import("tailwind-variants").TVReturnType<{
|
|
|
231
231
|
true: string;
|
|
232
232
|
0: string;
|
|
233
233
|
1: string;
|
|
234
|
-
2: string;
|
|
235
|
-
3: string;
|
|
236
234
|
};
|
|
237
235
|
shrink: {
|
|
238
236
|
true: string;
|
|
239
237
|
0: string;
|
|
240
238
|
1: string;
|
|
241
|
-
2: string;
|
|
242
|
-
3: string;
|
|
243
239
|
};
|
|
244
240
|
order: {
|
|
245
241
|
first: string;
|
|
@@ -608,8 +604,8 @@ export declare const boxVariants: import("tailwind-variants").TVReturnType<{
|
|
|
608
604
|
bg: {
|
|
609
605
|
current: string;
|
|
610
606
|
transparent: string;
|
|
611
|
-
|
|
612
|
-
|
|
607
|
+
bgDefault: string;
|
|
608
|
+
bgPure: string;
|
|
613
609
|
bg100: string;
|
|
614
610
|
bg200: string;
|
|
615
611
|
bg300: string;
|
|
@@ -705,15 +701,25 @@ export declare const boxVariants: import("tailwind-variants").TVReturnType<{
|
|
|
705
701
|
divider: string;
|
|
706
702
|
foreground: string;
|
|
707
703
|
secondary: string;
|
|
704
|
+
secondaryForeground: string;
|
|
708
705
|
tertiary: string;
|
|
706
|
+
tertiaryForeground: string;
|
|
709
707
|
cursor: string;
|
|
708
|
+
cursorForeground: string;
|
|
710
709
|
primary: string;
|
|
710
|
+
primaryForeground: string;
|
|
711
711
|
success: string;
|
|
712
|
+
successForeground: string;
|
|
712
713
|
warning: string;
|
|
714
|
+
warningForeground: string;
|
|
713
715
|
danger: string;
|
|
716
|
+
dangerForeground: string;
|
|
714
717
|
alert: string;
|
|
718
|
+
alertForeground: string;
|
|
715
719
|
bullish: string;
|
|
720
|
+
bullishForeground: string;
|
|
716
721
|
bearish: string;
|
|
722
|
+
bearishForeground: string;
|
|
717
723
|
};
|
|
718
724
|
fontWeight: {
|
|
719
725
|
normal: string;
|
|
@@ -961,15 +967,11 @@ export declare const boxVariants: import("tailwind-variants").TVReturnType<{
|
|
|
961
967
|
true: string;
|
|
962
968
|
0: string;
|
|
963
969
|
1: string;
|
|
964
|
-
2: string;
|
|
965
|
-
3: string;
|
|
966
970
|
};
|
|
967
971
|
shrink: {
|
|
968
972
|
true: string;
|
|
969
973
|
0: string;
|
|
970
974
|
1: string;
|
|
971
|
-
2: string;
|
|
972
|
-
3: string;
|
|
973
975
|
};
|
|
974
976
|
order: {
|
|
975
977
|
first: string;
|
|
@@ -1338,8 +1340,8 @@ export declare const boxVariants: import("tailwind-variants").TVReturnType<{
|
|
|
1338
1340
|
bg: {
|
|
1339
1341
|
current: string;
|
|
1340
1342
|
transparent: string;
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
+
bgDefault: string;
|
|
1344
|
+
bgPure: string;
|
|
1343
1345
|
bg100: string;
|
|
1344
1346
|
bg200: string;
|
|
1345
1347
|
bg300: string;
|
|
@@ -1435,15 +1437,25 @@ export declare const boxVariants: import("tailwind-variants").TVReturnType<{
|
|
|
1435
1437
|
divider: string;
|
|
1436
1438
|
foreground: string;
|
|
1437
1439
|
secondary: string;
|
|
1440
|
+
secondaryForeground: string;
|
|
1438
1441
|
tertiary: string;
|
|
1442
|
+
tertiaryForeground: string;
|
|
1439
1443
|
cursor: string;
|
|
1444
|
+
cursorForeground: string;
|
|
1440
1445
|
primary: string;
|
|
1446
|
+
primaryForeground: string;
|
|
1441
1447
|
success: string;
|
|
1448
|
+
successForeground: string;
|
|
1442
1449
|
warning: string;
|
|
1450
|
+
warningForeground: string;
|
|
1443
1451
|
danger: string;
|
|
1452
|
+
dangerForeground: string;
|
|
1444
1453
|
alert: string;
|
|
1454
|
+
alertForeground: string;
|
|
1445
1455
|
bullish: string;
|
|
1456
|
+
bullishForeground: string;
|
|
1446
1457
|
bearish: string;
|
|
1458
|
+
bearishForeground: string;
|
|
1447
1459
|
};
|
|
1448
1460
|
fontWeight: {
|
|
1449
1461
|
normal: string;
|
|
@@ -1691,15 +1703,11 @@ export declare const boxVariants: import("tailwind-variants").TVReturnType<{
|
|
|
1691
1703
|
true: string;
|
|
1692
1704
|
0: string;
|
|
1693
1705
|
1: string;
|
|
1694
|
-
2: string;
|
|
1695
|
-
3: string;
|
|
1696
1706
|
};
|
|
1697
1707
|
shrink: {
|
|
1698
1708
|
true: string;
|
|
1699
1709
|
0: string;
|
|
1700
1710
|
1: string;
|
|
1701
|
-
2: string;
|
|
1702
|
-
3: string;
|
|
1703
1711
|
};
|
|
1704
1712
|
order: {
|
|
1705
1713
|
first: string;
|
|
@@ -2068,8 +2076,8 @@ export declare const boxVariants: import("tailwind-variants").TVReturnType<{
|
|
|
2068
2076
|
bg: {
|
|
2069
2077
|
current: string;
|
|
2070
2078
|
transparent: string;
|
|
2071
|
-
|
|
2072
|
-
|
|
2079
|
+
bgDefault: string;
|
|
2080
|
+
bgPure: string;
|
|
2073
2081
|
bg100: string;
|
|
2074
2082
|
bg200: string;
|
|
2075
2083
|
bg300: string;
|
|
@@ -2165,15 +2173,25 @@ export declare const boxVariants: import("tailwind-variants").TVReturnType<{
|
|
|
2165
2173
|
divider: string;
|
|
2166
2174
|
foreground: string;
|
|
2167
2175
|
secondary: string;
|
|
2176
|
+
secondaryForeground: string;
|
|
2168
2177
|
tertiary: string;
|
|
2178
|
+
tertiaryForeground: string;
|
|
2169
2179
|
cursor: string;
|
|
2180
|
+
cursorForeground: string;
|
|
2170
2181
|
primary: string;
|
|
2182
|
+
primaryForeground: string;
|
|
2171
2183
|
success: string;
|
|
2184
|
+
successForeground: string;
|
|
2172
2185
|
warning: string;
|
|
2186
|
+
warningForeground: string;
|
|
2173
2187
|
danger: string;
|
|
2188
|
+
dangerForeground: string;
|
|
2174
2189
|
alert: string;
|
|
2190
|
+
alertForeground: string;
|
|
2175
2191
|
bullish: string;
|
|
2192
|
+
bullishForeground: string;
|
|
2176
2193
|
bearish: string;
|
|
2194
|
+
bearishForeground: string;
|
|
2177
2195
|
};
|
|
2178
2196
|
fontWeight: {
|
|
2179
2197
|
normal: string;
|