@particle-network/ui-react 0.4.3 → 0.4.5-beta.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/UXCopy/index.d.ts +2 -0
- package/dist/components/UXCopy/index.js +4 -3
- package/dist/components/UXThemeSwitch/theme-switch.d.ts +5 -3
- package/dist/components/UXThemeSwitch/theme-switch.js +9 -5
- package/dist/components/UXThemeSwitch/use-theme-color.d.ts +22 -1
- package/dist/components/UXThemeSwitch/use-theme-color.js +5 -1
- package/dist/components/typography/Text.type.d.ts +0 -14
- package/package.json +3 -3
- package/tailwind-preset.js +105 -26
|
@@ -7,14 +7,15 @@ import { useI18n } from "../../hooks/useI18n.js";
|
|
|
7
7
|
import { toast } from "../UXToast/index.js";
|
|
8
8
|
import { UXTooltip } from "../UXTooltip/index.js";
|
|
9
9
|
import { shortAddress } from "./utils.js";
|
|
10
|
-
const UXCopy = ({ className, copyText, toastText, withTooltip, tooltipContent, children })=>{
|
|
10
|
+
const UXCopy = ({ className, copyText, toastText, withTooltip, tooltipContent, children, withoutToast, onCopy })=>{
|
|
11
11
|
const i18n = useI18n();
|
|
12
12
|
const handleCopy = ()=>{
|
|
13
13
|
try {
|
|
14
14
|
copy_to_clipboard(String(copyText));
|
|
15
|
-
toast.success(toastText || i18n.copy.success);
|
|
15
|
+
if (!withoutToast) toast.success(toastText || i18n.copy.success);
|
|
16
|
+
onCopy?.();
|
|
16
17
|
} catch (error) {
|
|
17
|
-
toast.error(`${i18n.copy.error}${error instanceof Error ? error.message : String(error)}`);
|
|
18
|
+
if (!withoutToast) toast.error(`${i18n.copy.error}${error instanceof Error ? error.message : String(error)}`);
|
|
18
19
|
}
|
|
19
20
|
};
|
|
20
21
|
const childrenWithProps = /*#__PURE__*/ react.cloneElement(children, {
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import {
|
|
3
|
-
export
|
|
2
|
+
import type { UXModalProps } from '../UXModal';
|
|
3
|
+
export interface UXThemeSwitchModalProps extends Pick<UXModalProps, 'isOpen' | 'onClose' | 'onOpenChange' | 'backdrop'> {
|
|
4
|
+
as?: 'modal' | 'drawer';
|
|
5
|
+
}
|
|
4
6
|
export declare const UXThemeSwitchModal: React.FC<UXThemeSwitchModalProps>;
|
|
5
|
-
export interface UXThemeSwitchProps {
|
|
7
|
+
export interface UXThemeSwitchProps extends Pick<UXThemeSwitchModalProps, 'as' | 'backdrop'> {
|
|
6
8
|
children?: (onOpen: () => void) => React.ReactNode;
|
|
7
9
|
}
|
|
8
10
|
export declare const UXThemeSwitch: React.FC<UXThemeSwitchProps>;
|
|
@@ -10,6 +10,7 @@ import { HStack, VStack } from "../layout/index.js";
|
|
|
10
10
|
import { Text } from "../typography/Text.js";
|
|
11
11
|
import { UXButton } from "../UXButton/index.js";
|
|
12
12
|
import { UXDivider } from "../UXDivider/index.js";
|
|
13
|
+
import { UXDrawer } from "../UXDrawer/index.js";
|
|
13
14
|
import { UXInput } from "../UXInput/index.js";
|
|
14
15
|
import { UXModal } from "../UXModal/index.js";
|
|
15
16
|
import { UXSpinner } from "../UXSpinner/index.js";
|
|
@@ -29,16 +30,18 @@ const FONT_EXAMPLES = [
|
|
|
29
30
|
url: 'https://fonts.googleapis.com/css2?family=Roboto:ital,wght@0,100..900;1,100..900&display=swap'
|
|
30
31
|
}
|
|
31
32
|
];
|
|
32
|
-
const UXThemeSwitchModal = ({ isOpen, onClose, onOpenChange
|
|
33
|
+
const UXThemeSwitchModal = ({ as = 'modal', backdrop, isOpen, onClose, onOpenChange })=>{
|
|
33
34
|
const i18n = useI18n();
|
|
34
35
|
const { theme: selectedTheme, setTheme, fontUrl, setFontUrl, fontName, fontLoadStatus, clearFontUrl } = useTheme();
|
|
35
36
|
const [isFontExampleOpen, setIsFontExampleOpen] = useState(false);
|
|
36
|
-
|
|
37
|
+
const Component = 'modal' === as ? UXModal : UXDrawer;
|
|
38
|
+
return /*#__PURE__*/ jsx(Component, {
|
|
37
39
|
isOpen: isOpen,
|
|
38
40
|
classNames: {
|
|
39
|
-
base: 'md:max-h-[800px]'
|
|
41
|
+
base: 'modal' === as ? 'md:max-h-[800px]' : ''
|
|
40
42
|
},
|
|
41
43
|
title: i18n.theme.title,
|
|
44
|
+
backdrop: backdrop,
|
|
42
45
|
footer: /*#__PURE__*/ jsx(UXButton, {
|
|
43
46
|
fullWidth: true,
|
|
44
47
|
size: "lg",
|
|
@@ -47,7 +50,6 @@ const UXThemeSwitchModal = ({ isOpen, onClose, onOpenChange, ...props })=>{
|
|
|
47
50
|
children: i18n.theme.done
|
|
48
51
|
}),
|
|
49
52
|
onOpenChange: onOpenChange,
|
|
50
|
-
...props,
|
|
51
53
|
children: /*#__PURE__*/ jsxs(VStack, {
|
|
52
54
|
gap: "lg",
|
|
53
55
|
children: [
|
|
@@ -157,7 +159,7 @@ const UXThemeSwitchModal = ({ isOpen, onClose, onOpenChange, ...props })=>{
|
|
|
157
159
|
})
|
|
158
160
|
});
|
|
159
161
|
};
|
|
160
|
-
const UXThemeSwitch = ({ children })=>{
|
|
162
|
+
const UXThemeSwitch = ({ as = 'modal', backdrop, children })=>{
|
|
161
163
|
const { isOpen, onOpen, onClose, onOpenChange } = useDisclosure();
|
|
162
164
|
const renderChildren = ()=>{
|
|
163
165
|
if (children) return children(onOpen);
|
|
@@ -172,6 +174,8 @@ const UXThemeSwitch = ({ children })=>{
|
|
|
172
174
|
children: [
|
|
173
175
|
renderChildren(),
|
|
174
176
|
/*#__PURE__*/ jsx(UXThemeSwitchModal, {
|
|
177
|
+
as: as,
|
|
178
|
+
backdrop: backdrop,
|
|
175
179
|
isOpen: isOpen,
|
|
176
180
|
onClose: onClose,
|
|
177
181
|
onOpenChange: onOpenChange
|
|
@@ -1 +1,22 @@
|
|
|
1
|
-
export declare const useThemeColor: () =>
|
|
1
|
+
export declare const useThemeColor: () => {
|
|
2
|
+
transparent: string;
|
|
3
|
+
white: string;
|
|
4
|
+
default: string;
|
|
5
|
+
alert: string;
|
|
6
|
+
success: string;
|
|
7
|
+
foreground: string;
|
|
8
|
+
secondary: string;
|
|
9
|
+
tertiary: string;
|
|
10
|
+
primary: string;
|
|
11
|
+
danger: string;
|
|
12
|
+
warning: string;
|
|
13
|
+
gold: string;
|
|
14
|
+
bullish: string;
|
|
15
|
+
bearish: string;
|
|
16
|
+
"bg-default": string;
|
|
17
|
+
"bg-300": string;
|
|
18
|
+
"bg-200": string;
|
|
19
|
+
"bg-400": string;
|
|
20
|
+
divider: string;
|
|
21
|
+
overlay: string;
|
|
22
|
+
};
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import { useTheme } from "./use-theme.js";
|
|
2
2
|
const useThemeColor = ()=>{
|
|
3
3
|
const { theme } = useTheme();
|
|
4
|
-
return
|
|
4
|
+
return {
|
|
5
|
+
...theme.colorVariables,
|
|
6
|
+
transparent: 'transparent',
|
|
7
|
+
white: '#FFFFFF'
|
|
8
|
+
};
|
|
5
9
|
};
|
|
6
10
|
export { useThemeColor };
|
|
@@ -75,20 +75,6 @@ export interface TextProps extends React.HTMLAttributes<HTMLSpanElement> {
|
|
|
75
75
|
* | extrabold | 800 |
|
|
76
76
|
*/
|
|
77
77
|
fontWeight?: TextWeight;
|
|
78
|
-
/**
|
|
79
|
-
* | color | dark | light |
|
|
80
|
-
* | :--------- | :-------- | :-------- |
|
|
81
|
-
* | default | - | - |
|
|
82
|
-
* | foreground | #FFFFFF | #000000 |
|
|
83
|
-
* | secondary | #A1A1AA | #767A80 |
|
|
84
|
-
* | tertiary | #4E4E56 | #D8D8DE |
|
|
85
|
-
* | primary | #D745FF | #000000 |
|
|
86
|
-
* | success | #45B167 | #2E9F4A |
|
|
87
|
-
* | danger | #E84A5A | #DE4A40 |
|
|
88
|
-
* | alert | #F57733 | #E65E16 |
|
|
89
|
-
* | warning | #FF9821 | #FF9821 |
|
|
90
|
-
* | gold | #FFB800 | #F38300 |
|
|
91
|
-
*/
|
|
92
78
|
color?: UXForegroundColor | `#${string}`;
|
|
93
79
|
lineHeight?: TextLineHeight;
|
|
94
80
|
align?: TextAlign;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@particle-network/ui-react",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.5-beta.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": {
|
|
@@ -49,8 +49,8 @@
|
|
|
49
49
|
"ahooks": "^3.9.4",
|
|
50
50
|
"copy-to-clipboard": "^3.3.3",
|
|
51
51
|
"zustand": "^5.0.8",
|
|
52
|
-
"@particle-network/icons": "0.4.
|
|
53
|
-
"@particle-network/ui-shared": "0.3.
|
|
52
|
+
"@particle-network/icons": "0.4.2-beta.0",
|
|
53
|
+
"@particle-network/ui-shared": "0.3.2-beta.0"
|
|
54
54
|
},
|
|
55
55
|
"scripts": {
|
|
56
56
|
"build": "rslib build",
|
package/tailwind-preset.js
CHANGED
|
@@ -201,7 +201,7 @@ module.exports = {
|
|
|
201
201
|
},
|
|
202
202
|
foreground: {
|
|
203
203
|
100: '#D8D8DE',
|
|
204
|
-
300: '#
|
|
204
|
+
300: '#61656B',
|
|
205
205
|
500: '#0C0C0F',
|
|
206
206
|
DEFAULT: '#0C0C0F',
|
|
207
207
|
},
|
|
@@ -223,7 +223,7 @@ module.exports = {
|
|
|
223
223
|
foreground: '#FFFFFF',
|
|
224
224
|
},
|
|
225
225
|
secondary: {
|
|
226
|
-
DEFAULT: '#
|
|
226
|
+
DEFAULT: '#61656B',
|
|
227
227
|
foreground: '#FFFFFF',
|
|
228
228
|
},
|
|
229
229
|
tertiary: {
|
|
@@ -480,16 +480,16 @@ module.exports = {
|
|
|
480
480
|
foreground: '#FFFFFF',
|
|
481
481
|
},
|
|
482
482
|
success: {
|
|
483
|
-
DEFAULT: '#
|
|
484
|
-
foreground: '#
|
|
483
|
+
DEFAULT: '#19AB5E',
|
|
484
|
+
foreground: '#FFFFFF',
|
|
485
485
|
},
|
|
486
486
|
danger: {
|
|
487
|
-
DEFAULT: '#
|
|
488
|
-
foreground: '#
|
|
487
|
+
DEFAULT: '#FF5868',
|
|
488
|
+
foreground: '#FFFFFF',
|
|
489
489
|
},
|
|
490
490
|
warning: {
|
|
491
491
|
DEFAULT: '#F8BF63',
|
|
492
|
-
foreground: '#
|
|
492
|
+
foreground: '#FFFFFF',
|
|
493
493
|
},
|
|
494
494
|
divider: {
|
|
495
495
|
DEFAULT: '#26272D',
|
|
@@ -497,19 +497,19 @@ module.exports = {
|
|
|
497
497
|
},
|
|
498
498
|
alert: {
|
|
499
499
|
DEFAULT: '#F37A39',
|
|
500
|
-
foreground: '#
|
|
500
|
+
foreground: '#FFFFFF',
|
|
501
501
|
},
|
|
502
502
|
gold: {
|
|
503
503
|
DEFAULT: '#FFB800',
|
|
504
|
-
foreground: '#
|
|
504
|
+
foreground: '#FFFFFF',
|
|
505
505
|
},
|
|
506
506
|
bullish: {
|
|
507
|
-
DEFAULT: '#
|
|
508
|
-
foreground: '#
|
|
507
|
+
DEFAULT: '#19AB5E',
|
|
508
|
+
foreground: '#FFFFFF',
|
|
509
509
|
},
|
|
510
510
|
bearish: {
|
|
511
|
-
DEFAULT: '#
|
|
512
|
-
foreground: '#
|
|
511
|
+
DEFAULT: '#FF5868',
|
|
512
|
+
foreground: '#FFFFFF',
|
|
513
513
|
},
|
|
514
514
|
},
|
|
515
515
|
},
|
|
@@ -533,7 +533,7 @@ module.exports = {
|
|
|
533
533
|
},
|
|
534
534
|
foreground: {
|
|
535
535
|
100: '#CFCFD7',
|
|
536
|
-
300: '#
|
|
536
|
+
300: '#55585C',
|
|
537
537
|
500: '#000000',
|
|
538
538
|
DEFAULT: '#000000',
|
|
539
539
|
},
|
|
@@ -555,7 +555,7 @@ module.exports = {
|
|
|
555
555
|
foreground: '#FFFFFF',
|
|
556
556
|
},
|
|
557
557
|
secondary: {
|
|
558
|
-
DEFAULT: '#
|
|
558
|
+
DEFAULT: '#55585C',
|
|
559
559
|
foreground: '#FFFFFF',
|
|
560
560
|
},
|
|
561
561
|
tertiary: {
|
|
@@ -809,7 +809,7 @@ module.exports = {
|
|
|
809
809
|
},
|
|
810
810
|
tertiary: {
|
|
811
811
|
DEFAULT: '#5D6466',
|
|
812
|
-
foreground: '#
|
|
812
|
+
foreground: '#FFFFFF',
|
|
813
813
|
},
|
|
814
814
|
success: {
|
|
815
815
|
DEFAULT: '#1FA67D',
|
|
@@ -1040,16 +1040,16 @@ module.exports = {
|
|
|
1040
1040
|
foreground: '#FFFFFF',
|
|
1041
1041
|
},
|
|
1042
1042
|
primary: {
|
|
1043
|
-
100: '#
|
|
1044
|
-
200: '#
|
|
1045
|
-
300: '#
|
|
1046
|
-
400: '#
|
|
1047
|
-
500: '#
|
|
1048
|
-
600: '#
|
|
1049
|
-
700: '#
|
|
1050
|
-
800: '#
|
|
1051
|
-
900: '#
|
|
1052
|
-
DEFAULT: '#
|
|
1043
|
+
100: '#F0F4F2',
|
|
1044
|
+
200: '#C8DBD2',
|
|
1045
|
+
300: '#9CC6B2',
|
|
1046
|
+
400: '#6DB590',
|
|
1047
|
+
500: '#459C6E',
|
|
1048
|
+
600: '#3B805B',
|
|
1049
|
+
700: '#316648',
|
|
1050
|
+
800: '#264B35',
|
|
1051
|
+
900: '#1A3224',
|
|
1052
|
+
DEFAULT: '#459C6E',
|
|
1053
1053
|
foreground: '#000000',
|
|
1054
1054
|
},
|
|
1055
1055
|
secondary: {
|
|
@@ -1094,6 +1094,85 @@ module.exports = {
|
|
|
1094
1094
|
},
|
|
1095
1095
|
},
|
|
1096
1096
|
},
|
|
1097
|
+
custom: {
|
|
1098
|
+
extend: 'dark',
|
|
1099
|
+
colors: {
|
|
1100
|
+
default: {
|
|
1101
|
+
DEFAULT: '#1F2025',
|
|
1102
|
+
foreground: '#FFFFFF',
|
|
1103
|
+
},
|
|
1104
|
+
secondary: {
|
|
1105
|
+
DEFAULT: '#BBBBC4',
|
|
1106
|
+
foreground: '#000000',
|
|
1107
|
+
},
|
|
1108
|
+
tertiary: {
|
|
1109
|
+
DEFAULT: '#4E4E56',
|
|
1110
|
+
foreground: '#FFFFFF',
|
|
1111
|
+
},
|
|
1112
|
+
primary: {
|
|
1113
|
+
100: '#EEF6F3',
|
|
1114
|
+
200: '#BAE2D0',
|
|
1115
|
+
300: '#7ED6AB',
|
|
1116
|
+
400: '#39D385',
|
|
1117
|
+
500: '#19AB5E',
|
|
1118
|
+
600: '#188E4D',
|
|
1119
|
+
700: '#16723E',
|
|
1120
|
+
800: '#14572F',
|
|
1121
|
+
900: '#0F3D21',
|
|
1122
|
+
DEFAULT: '#19AB5E',
|
|
1123
|
+
foreground: '#000000',
|
|
1124
|
+
},
|
|
1125
|
+
success: {
|
|
1126
|
+
DEFAULT: '#19AB5E',
|
|
1127
|
+
foreground: '#000000',
|
|
1128
|
+
},
|
|
1129
|
+
danger: {
|
|
1130
|
+
DEFAULT: '#FF5868',
|
|
1131
|
+
foreground: '#000000',
|
|
1132
|
+
},
|
|
1133
|
+
alert: {
|
|
1134
|
+
DEFAULT: '#F37A39',
|
|
1135
|
+
foreground: '#000000',
|
|
1136
|
+
},
|
|
1137
|
+
warning: {
|
|
1138
|
+
DEFAULT: '#F8BF63',
|
|
1139
|
+
foreground: '#000000',
|
|
1140
|
+
},
|
|
1141
|
+
gold: {
|
|
1142
|
+
DEFAULT: '#FFB800',
|
|
1143
|
+
foreground: '#000000',
|
|
1144
|
+
},
|
|
1145
|
+
overlay: {
|
|
1146
|
+
DEFAULT: '#1F2025',
|
|
1147
|
+
foreground: '#FFFFFF',
|
|
1148
|
+
},
|
|
1149
|
+
divider: {
|
|
1150
|
+
DEFAULT: '#26272D',
|
|
1151
|
+
foreground: '#FFFFFF',
|
|
1152
|
+
},
|
|
1153
|
+
bullish: {
|
|
1154
|
+
DEFAULT: '#19AB5E',
|
|
1155
|
+
foreground: '#000000',
|
|
1156
|
+
},
|
|
1157
|
+
bearish: {
|
|
1158
|
+
DEFAULT: '#FF5868',
|
|
1159
|
+
foreground: '#000000',
|
|
1160
|
+
},
|
|
1161
|
+
background: {
|
|
1162
|
+
200: '#2A2A30',
|
|
1163
|
+
300: '#1F2025',
|
|
1164
|
+
400: '#171517',
|
|
1165
|
+
500: '#100E11',
|
|
1166
|
+
DEFAULT: '#100E11',
|
|
1167
|
+
},
|
|
1168
|
+
foreground: {
|
|
1169
|
+
100: '#4E4E56',
|
|
1170
|
+
300: '#BBBBC4',
|
|
1171
|
+
500: '#FDFDFE',
|
|
1172
|
+
DEFAULT: '#FDFDFE',
|
|
1173
|
+
},
|
|
1174
|
+
},
|
|
1175
|
+
},
|
|
1097
1176
|
},
|
|
1098
1177
|
function({ addVariant, addComponents }) {
|
|
1099
1178
|
addVariant('child', '& > *');
|