@particle-network/ui-native 0.5.1-beta.0 → 0.5.1-beta.10
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.d.ts +2 -2
- package/dist/components/Text/text.types.d.ts +2 -2
- package/dist/components/UXButton/button.styles.js +5 -5
- package/dist/components/UXCheckbox/checkbox.js +11 -5
- package/dist/components/UXCheckbox/icons.js +15 -9
- package/dist/components/UXCheckbox/types.d.ts +1 -1
- package/dist/components/UXChip/styles.js +2 -2
- package/dist/components/UXChip/types.d.ts +2 -2
- package/dist/components/UXHint/index.d.ts +3 -2
- package/dist/components/UXHint/index.js +4 -5
- package/dist/components/UXModal/index.js +1 -1
- package/dist/components/UXRadio/radio.js +3 -8
- package/dist/components/UXSlider/slider.js +1 -1
- package/dist/components/UXSlider/slider.styles.js +1 -1
- package/dist/components/UXSwitch/switch.js +1 -1
- package/dist/components/UXTabs/styles.js +4 -4
- package/dist/components/UXToast/ToastView.d.ts +1 -0
- package/dist/components/UXToast/ToastView.js +20 -12
- package/dist/components/UXToast/toastConfig.d.ts +6 -3
- package/dist/components/UXToast/toastConfig.js +6 -3
- package/dist/components/date-picker/date-button.js +2 -2
- package/dist/components/input/input.js +3 -3
- package/dist/components/input/number-input.js +1 -1
- package/dist/components/input/styles.js +1 -1
- package/dist/components/layout/Box/useBox.style.js +3 -3
- package/dist/components/layout/Box/useBox.type.d.ts +11 -9
- package/dist/config/config.default.js +2 -2
- package/dist/config/config.street.js +3 -3
- package/dist/hooks/useColors.d.ts +2 -2
- package/package.json +4 -4
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { type StyleProp, type ViewStyle } from 'react-native';
|
|
3
|
-
import type { UXForegroundColor, UXRadius } from '@particle-network/ui-shared';
|
|
3
|
+
import type { HexColor, UXForegroundColor, UXRadius } from '@particle-network/ui-shared';
|
|
4
4
|
import { type FlexProps } from '../layout/Flex';
|
|
5
5
|
export interface ProgressWrapperProps extends Omit<FlexProps, 'radius' | 'width' | 'height' | 'w' | 'h'> {
|
|
6
6
|
/**
|
|
@@ -26,7 +26,7 @@ export interface ProgressWrapperProps extends Omit<FlexProps, 'radius' | 'width'
|
|
|
26
26
|
/**
|
|
27
27
|
* 进度条颜色
|
|
28
28
|
*/
|
|
29
|
-
color?: UXForegroundColor | 'transparent' |
|
|
29
|
+
color?: UXForegroundColor | 'transparent' | HexColor;
|
|
30
30
|
/**
|
|
31
31
|
* SVG 样式
|
|
32
32
|
*/
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { TextProps as RNTextProps, TextStyle } from 'react-native';
|
|
2
|
-
import type { UXForegroundColor } from '@particle-network/ui-shared';
|
|
2
|
+
import type { HexColor, UXForegroundColor } from '@particle-network/ui-shared';
|
|
3
3
|
import type { UseBoxProps } from '../layout/Box';
|
|
4
4
|
type TextVariant = 'h1' | 'h2' | 'h3' | 'body1' | 'body1Bold' | 'body2' | 'body2Bold' | 'body3' | 'body3Bold' | 'caption1' | 'caption1Bold';
|
|
5
5
|
type TextWeight = 'normal' | 'medium' | 'semibold' | 'bold' | 'extrabold';
|
|
@@ -76,7 +76,7 @@ export interface TextProps extends RNTextProps, UseBoxProps {
|
|
|
76
76
|
* | extrabold | 800 |
|
|
77
77
|
*/
|
|
78
78
|
fontWeight?: TextWeight;
|
|
79
|
-
color?: UXForegroundColor |
|
|
79
|
+
color?: UXForegroundColor | HexColor;
|
|
80
80
|
lineHeight?: TextLineHeight;
|
|
81
81
|
align?: TextAlign;
|
|
82
82
|
underlineStyle?: TextStyle['textDecorationStyle'];
|
|
@@ -112,7 +112,7 @@ const useStyles = (props)=>{
|
|
|
112
112
|
}
|
|
113
113
|
if ('solid' === variant) {
|
|
114
114
|
if (customColorConfig) return customColorConfig.text;
|
|
115
|
-
if ('contrast' === color) return '
|
|
115
|
+
if ('contrast' === color) return 'bgDefault';
|
|
116
116
|
return 'white';
|
|
117
117
|
}
|
|
118
118
|
return color;
|
|
@@ -129,7 +129,7 @@ const useStyles = (props)=>{
|
|
|
129
129
|
const backgroundColor = useMemo(()=>{
|
|
130
130
|
const customColorConfig = buttonConfig?.color?.[color];
|
|
131
131
|
if (isSelected) {
|
|
132
|
-
if ('secondary' === color && 'solid' === variant) return getColor('
|
|
132
|
+
if ('secondary' === color && 'solid' === variant) return getColor('cursor');
|
|
133
133
|
}
|
|
134
134
|
if ('solid' === variant) {
|
|
135
135
|
if (customColorConfig) return getColor(customColorConfig.background);
|
|
@@ -138,7 +138,7 @@ const useStyles = (props)=>{
|
|
|
138
138
|
'default',
|
|
139
139
|
'secondary'
|
|
140
140
|
].includes(color)) return getColor(color);
|
|
141
|
-
return getColor('
|
|
141
|
+
return getColor('bg200');
|
|
142
142
|
}
|
|
143
143
|
if ('flat' === variant) {
|
|
144
144
|
if (customColorConfig) return `${getColor(customColorConfig.background)}20`;
|
|
@@ -146,7 +146,7 @@ const useStyles = (props)=>{
|
|
|
146
146
|
if ([
|
|
147
147
|
'default',
|
|
148
148
|
'secondary'
|
|
149
|
-
].includes(color)) return getColor('
|
|
149
|
+
].includes(color)) return getColor('bg300');
|
|
150
150
|
return `${getColor(color)}20`;
|
|
151
151
|
}
|
|
152
152
|
return 'transparent';
|
|
@@ -163,7 +163,7 @@ const useStyles = (props)=>{
|
|
|
163
163
|
'default',
|
|
164
164
|
'secondary'
|
|
165
165
|
].includes(color)) return getColor('secondary');
|
|
166
|
-
if ('contrast' === color) return getColor('
|
|
166
|
+
if ('contrast' === color) return getColor('bgDefault');
|
|
167
167
|
return getColor(color);
|
|
168
168
|
}
|
|
169
169
|
return 'transparent';
|
|
@@ -23,7 +23,7 @@ const UXCheckbox = ({ size, color, defaultSelected = false, isSelected, children
|
|
|
23
23
|
const checkboxColor = color || groupContext?.color || 'primary';
|
|
24
24
|
const displayLabelPlacement = labelPlacement || groupContext?.labelPlacement || 'right';
|
|
25
25
|
const bgColor = useMemo(()=>{
|
|
26
|
-
if ('secondary' === checkboxColor) return '
|
|
26
|
+
if ('secondary' === checkboxColor) return 'cursor';
|
|
27
27
|
return checkboxColor;
|
|
28
28
|
}, [
|
|
29
29
|
checkboxColor
|
|
@@ -52,9 +52,9 @@ const UXCheckbox = ({ size, color, defaultSelected = false, isSelected, children
|
|
|
52
52
|
ms
|
|
53
53
|
]);
|
|
54
54
|
const labelVariant = useMemo(()=>{
|
|
55
|
-
if ('sm' === checkboxSize) return '
|
|
56
|
-
if ('lg' === checkboxSize) return '
|
|
57
|
-
return '
|
|
55
|
+
if ('sm' === checkboxSize) return 'body2Bold';
|
|
56
|
+
if ('lg' === checkboxSize) return 'body1Bold';
|
|
57
|
+
return 'body2Bold';
|
|
58
58
|
}, [
|
|
59
59
|
checkboxSize
|
|
60
60
|
]);
|
|
@@ -64,6 +64,12 @@ const UXCheckbox = ({ size, color, defaultSelected = false, isSelected, children
|
|
|
64
64
|
}, [
|
|
65
65
|
displayLabelPlacement
|
|
66
66
|
]);
|
|
67
|
+
const gap = useMemo(()=>{
|
|
68
|
+
if ('sm' === checkboxSize) return 6;
|
|
69
|
+
return 8;
|
|
70
|
+
}, [
|
|
71
|
+
checkboxSize
|
|
72
|
+
]);
|
|
67
73
|
return /*#__PURE__*/ jsx(UXPressable, {
|
|
68
74
|
disabled: checkboxIsDisabled,
|
|
69
75
|
style: {
|
|
@@ -72,7 +78,7 @@ const UXCheckbox = ({ size, color, defaultSelected = false, isSelected, children
|
|
|
72
78
|
onPress: handleSelectChange,
|
|
73
79
|
children: /*#__PURE__*/ jsxs(Flex, {
|
|
74
80
|
direction: flexDirection,
|
|
75
|
-
gap:
|
|
81
|
+
gap: gap,
|
|
76
82
|
items: "center",
|
|
77
83
|
...props,
|
|
78
84
|
children: [
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import "react";
|
|
3
|
-
import react_native_svg, { Path } from "react-native-svg";
|
|
3
|
+
import react_native_svg, { Path, Rect } from "react-native-svg";
|
|
4
4
|
import { useColors } from "../../hooks/index.js";
|
|
5
5
|
const CheckboxOnIcon = ({ size = 16, color1 = 'default', color2 = 'white' })=>{
|
|
6
6
|
const { getColor } = useColors();
|
|
@@ -8,16 +8,18 @@ const CheckboxOnIcon = ({ size = 16, color1 = 'default', color2 = 'white' })=>{
|
|
|
8
8
|
const color2Value = getColor(color2);
|
|
9
9
|
return /*#__PURE__*/ jsxs(react_native_svg, {
|
|
10
10
|
fill: "none",
|
|
11
|
-
viewBox: "0 0
|
|
11
|
+
viewBox: "0 0 18 18",
|
|
12
12
|
width: size,
|
|
13
13
|
height: size,
|
|
14
14
|
children: [
|
|
15
|
-
/*#__PURE__*/ jsx(
|
|
16
|
-
|
|
15
|
+
/*#__PURE__*/ jsx(Rect, {
|
|
16
|
+
width: 18,
|
|
17
|
+
height: 18,
|
|
18
|
+
rx: 2.25,
|
|
17
19
|
fill: color1Value
|
|
18
20
|
}),
|
|
19
21
|
/*#__PURE__*/ jsx(Path, {
|
|
20
|
-
d: "
|
|
22
|
+
d: "M7.82501 10.225L5.67501 8.075C5.49168 7.89167 5.25834 7.8 4.97501 7.8C4.69168 7.8 4.45834 7.89167 4.27501 8.075C4.09168 8.25833 4.00001 8.49167 4.00001 8.775C4.00001 9.05833 4.09168 9.29167 4.27501 9.475L7.12501 12.325C7.32501 12.525 7.55835 12.625 7.82501 12.625C8.09168 12.625 8.32501 12.525 8.52501 12.325L14.175 6.675C14.3583 6.49167 14.45 6.25833 14.45 5.975C14.45 5.69167 14.3583 5.45833 14.175 5.275C13.9917 5.09167 13.7583 5 13.475 5C13.1917 5 12.9583 5.09167 12.775 5.275L7.82501 10.225Z",
|
|
21
23
|
fill: color2Value
|
|
22
24
|
})
|
|
23
25
|
]
|
|
@@ -27,14 +29,18 @@ const CheckboxOffIcon = ({ size = 16, color = 'default' })=>{
|
|
|
27
29
|
const { getColor } = useColors();
|
|
28
30
|
const colorValue = getColor(color);
|
|
29
31
|
return /*#__PURE__*/ jsx(react_native_svg, {
|
|
32
|
+
viewBox: "0 0 18 18",
|
|
30
33
|
fill: "none",
|
|
31
|
-
viewBox: "0 0 16 16",
|
|
32
34
|
width: size,
|
|
33
35
|
height: size,
|
|
34
|
-
children: /*#__PURE__*/ jsx(
|
|
35
|
-
|
|
36
|
+
children: /*#__PURE__*/ jsx(Rect, {
|
|
37
|
+
x: 0.7,
|
|
38
|
+
y: 0.7,
|
|
39
|
+
width: 16.6,
|
|
40
|
+
height: 16.6,
|
|
41
|
+
rx: 1.55,
|
|
36
42
|
stroke: colorValue,
|
|
37
|
-
strokeWidth: 1.
|
|
43
|
+
strokeWidth: 1.4
|
|
38
44
|
})
|
|
39
45
|
});
|
|
40
46
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export interface UXCheckboxCommonProps {
|
|
2
|
-
color?: 'secondary' | 'primary' | 'success' | 'danger' | 'alert' | 'warning' | '
|
|
2
|
+
color?: 'secondary' | 'primary' | 'success' | 'danger' | 'alert' | 'warning' | 'bullish' | 'bearish';
|
|
3
3
|
size?: 'sm' | 'md' | 'lg';
|
|
4
4
|
isDisabled?: boolean;
|
|
5
5
|
labelPlacement?: 'left' | 'right';
|
|
@@ -44,13 +44,13 @@ const useStyles = ({ size = 'md', color = 'default', variant = 'flat', isDisable
|
|
|
44
44
|
if ('solid' === variant) {
|
|
45
45
|
if ([
|
|
46
46
|
'default'
|
|
47
|
-
].includes(color)) return getColor('
|
|
47
|
+
].includes(color)) return getColor('bg200');
|
|
48
48
|
return getColor(color);
|
|
49
49
|
}
|
|
50
50
|
if ('flat' === variant) {
|
|
51
51
|
if ([
|
|
52
52
|
'default'
|
|
53
|
-
].includes(color)) return getColor('
|
|
53
|
+
].includes(color)) return getColor('bg300');
|
|
54
54
|
return `${getColor(color)}20`;
|
|
55
55
|
}
|
|
56
56
|
return 'transparent';
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type React from 'react';
|
|
2
|
-
import type { UXForegroundColor } from '@particle-network/ui-shared';
|
|
2
|
+
import type { HexColor, UXForegroundColor } from '@particle-network/ui-shared';
|
|
3
3
|
import type { HStackProps } from '../layout/HStack';
|
|
4
4
|
export interface UXChipProps extends HStackProps {
|
|
5
|
-
color?: UXForegroundColor |
|
|
5
|
+
color?: UXForegroundColor | HexColor;
|
|
6
6
|
size?: 'sm' | 'md' | 'lg';
|
|
7
7
|
variant?: 'solid' | 'flat';
|
|
8
8
|
isDisabled?: boolean;
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import
|
|
2
|
+
import CircleQuestionIcon from '@particle-network/icons/native/CircleQuestionIcon';
|
|
3
3
|
import type { SquareProps } from '../layout/Square';
|
|
4
4
|
import { type UXTooltipProps } from '../UXTooltip';
|
|
5
5
|
export type UXHintProps = UXTooltipProps & {
|
|
6
6
|
style?: SquareProps['style'];
|
|
7
|
-
iconStyle?:
|
|
7
|
+
iconStyle?: React.ComponentProps<typeof CircleQuestionIcon>['style'];
|
|
8
|
+
iconColor?: React.ComponentProps<typeof CircleQuestionIcon>['color'];
|
|
8
9
|
};
|
|
9
10
|
export declare const UXHint: React.FC<UXHintProps>;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
2
|
import "react";
|
|
3
|
+
import CircleQuestionIcon from "@particle-network/icons/native/CircleQuestionIcon";
|
|
3
4
|
import { useMs } from "../../hooks/index.js";
|
|
4
|
-
import { Icon } from "../../icons/index.js";
|
|
5
5
|
import { Square } from "../layout/Square.js";
|
|
6
6
|
import { UXTooltip } from "../UXTooltip/index.js";
|
|
7
7
|
const UXHint = (props)=>{
|
|
8
|
-
const { content, children, iconStyle, style, ...restProps } = props;
|
|
8
|
+
const { content, children, iconStyle, iconColor = 'secondary', style, ...restProps } = props;
|
|
9
9
|
const { ms } = useMs();
|
|
10
10
|
return /*#__PURE__*/ jsx(UXTooltip, {
|
|
11
11
|
content: content || children,
|
|
@@ -14,9 +14,8 @@ const UXHint = (props)=>{
|
|
|
14
14
|
center: true,
|
|
15
15
|
size: 16,
|
|
16
16
|
style: style,
|
|
17
|
-
children: /*#__PURE__*/ jsx(
|
|
18
|
-
|
|
19
|
-
color: "secondary",
|
|
17
|
+
children: /*#__PURE__*/ jsx(CircleQuestionIcon, {
|
|
18
|
+
color: iconColor,
|
|
20
19
|
size: ms(14),
|
|
21
20
|
style: iconStyle
|
|
22
21
|
})
|
|
@@ -246,7 +246,7 @@ const UXModal = /*#__PURE__*/ forwardRef((props, scrollViewRef)=>{
|
|
|
246
246
|
onTouchMove: onTouchMoveSideLine,
|
|
247
247
|
onTouchStart: onTouchStartSideLine,
|
|
248
248
|
children: /*#__PURE__*/ jsx(Box, {
|
|
249
|
-
bg: "
|
|
249
|
+
bg: "cursor",
|
|
250
250
|
h: 4,
|
|
251
251
|
radius: "full",
|
|
252
252
|
w: 40
|
|
@@ -23,7 +23,8 @@ const UXRadio = ({ size, color, children, value, isDisabled, ...props })=>{
|
|
|
23
23
|
if ('lg' === radioSize) return ms(14);
|
|
24
24
|
return ms(12);
|
|
25
25
|
}, [
|
|
26
|
-
radioSize
|
|
26
|
+
radioSize,
|
|
27
|
+
ms
|
|
27
28
|
]);
|
|
28
29
|
const labelVariant = useMemo(()=>{
|
|
29
30
|
if ('sm' === radioSize) return 'body3';
|
|
@@ -32,12 +33,6 @@ const UXRadio = ({ size, color, children, value, isDisabled, ...props })=>{
|
|
|
32
33
|
}, [
|
|
33
34
|
radioSize
|
|
34
35
|
]);
|
|
35
|
-
const gap = useMemo(()=>{
|
|
36
|
-
if ('sm' === radioSize) return 6;
|
|
37
|
-
return 8;
|
|
38
|
-
}, [
|
|
39
|
-
radioSize
|
|
40
|
-
]);
|
|
41
36
|
return /*#__PURE__*/ jsx(Pressable, {
|
|
42
37
|
disabled: radioIsDisabled,
|
|
43
38
|
style: {
|
|
@@ -45,7 +40,7 @@ const UXRadio = ({ size, color, children, value, isDisabled, ...props })=>{
|
|
|
45
40
|
},
|
|
46
41
|
onPress: handleSelectChange,
|
|
47
42
|
children: /*#__PURE__*/ jsxs(Flex, {
|
|
48
|
-
gap:
|
|
43
|
+
gap: 4,
|
|
49
44
|
items: "center",
|
|
50
45
|
...props,
|
|
51
46
|
children: [
|
|
@@ -228,7 +228,7 @@ const UXSlider = ({ color = 'primary', minValue = 0, maxValue = 100, defaultValu
|
|
|
228
228
|
styles.mark,
|
|
229
229
|
{
|
|
230
230
|
left: markPos - MARK_SIZE / 2,
|
|
231
|
-
backgroundColor: isActive ? colors[color] : colors.
|
|
231
|
+
backgroundColor: isActive ? colors[color] : colors.secondary
|
|
232
232
|
}
|
|
233
233
|
]
|
|
234
234
|
}, index);
|
|
@@ -77,7 +77,7 @@ const UXSwitch = (props)=>{
|
|
|
77
77
|
style: [
|
|
78
78
|
styles.track,
|
|
79
79
|
{
|
|
80
|
-
backgroundColor: isSelected ? getColor(color) : getColor('
|
|
80
|
+
backgroundColor: isSelected ? getColor(color) : getColor('cursor')
|
|
81
81
|
}
|
|
82
82
|
],
|
|
83
83
|
children: /*#__PURE__*/ jsx(Animated.View, {
|
|
@@ -80,8 +80,8 @@ const useStyles = (props)=>{
|
|
|
80
80
|
ms
|
|
81
81
|
]);
|
|
82
82
|
const wrapperBackgroundColor = useMemo(()=>{
|
|
83
|
-
if ('switch' === variant) return getColor('
|
|
84
|
-
if ('solid' === variant) return getColor('
|
|
83
|
+
if ('switch' === variant) return getColor('bg200');
|
|
84
|
+
if ('solid' === variant) return getColor('bg200');
|
|
85
85
|
return 'transparent';
|
|
86
86
|
}, [
|
|
87
87
|
variant,
|
|
@@ -125,8 +125,8 @@ const useStyles = (props)=>{
|
|
|
125
125
|
if (!isSelected) return 'transparent';
|
|
126
126
|
if ('text' === variant || 'underlined' === variant) return 'transparent';
|
|
127
127
|
if ('default' === color) {
|
|
128
|
-
if ('light' === variant) return getColor('
|
|
129
|
-
return getColor('
|
|
128
|
+
if ('light' === variant) return getColor('bg200');
|
|
129
|
+
return getColor('cursor');
|
|
130
130
|
}
|
|
131
131
|
return getColor(color);
|
|
132
132
|
}, [
|
|
@@ -1,19 +1,18 @@
|
|
|
1
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useMemo } from "react";
|
|
3
3
|
import react_native_toast_message from "react-native-toast-message";
|
|
4
|
-
import {
|
|
5
|
-
import { HStack } from "../layout/HStack.js";
|
|
4
|
+
import { HStack, VStack } from "../layout/index.js";
|
|
6
5
|
import { Text } from "../Text/index.js";
|
|
7
6
|
import { UXButton } from "../UXButton/index.js";
|
|
8
7
|
import { useComponentConfig, useTheme } from "../../hooks/index.js";
|
|
9
8
|
import { Icon } from "../../icons/index.js";
|
|
10
9
|
import { ToastIcon } from "./ToastIcon.js";
|
|
11
|
-
const ToastView = ({ type, text, props: toastProps })=>{
|
|
12
|
-
const { btnText, numberOfLines =
|
|
10
|
+
const ToastView = ({ type, text, text2, props: toastProps })=>{
|
|
11
|
+
const { btnText, numberOfLines = 10, colorBg, onPress = ()=>null } = toastProps ?? {};
|
|
13
12
|
const { toast: toastConfig } = useComponentConfig();
|
|
14
13
|
const { colors } = useTheme();
|
|
15
14
|
const bg = useMemo(()=>{
|
|
16
|
-
if (!colorBg) return colors.
|
|
15
|
+
if (!colorBg) return colors.cursor;
|
|
17
16
|
if ('success' === type) return '#0E3728';
|
|
18
17
|
if ('error' === type) return '#501D1D';
|
|
19
18
|
}, [
|
|
@@ -39,14 +38,23 @@ const ToastView = ({ type, text, props: toastProps })=>{
|
|
|
39
38
|
/*#__PURE__*/ jsx(ToastIcon, {
|
|
40
39
|
type: type
|
|
41
40
|
}),
|
|
42
|
-
/*#__PURE__*/
|
|
41
|
+
/*#__PURE__*/ jsxs(VStack, {
|
|
43
42
|
shrink: 1,
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
43
|
+
gap: 4,
|
|
44
|
+
children: [
|
|
45
|
+
/*#__PURE__*/ jsx(Text, {
|
|
46
|
+
body2Bold: true,
|
|
47
|
+
color: colorBg ? 'white' : 'foreground',
|
|
48
|
+
numberOfLines: 2,
|
|
49
|
+
children: text
|
|
50
|
+
}),
|
|
51
|
+
text2 && /*#__PURE__*/ jsx(Text, {
|
|
52
|
+
body3: true,
|
|
53
|
+
color: "secondary",
|
|
54
|
+
numberOfLines: numberOfLines,
|
|
55
|
+
children: text2
|
|
56
|
+
})
|
|
57
|
+
]
|
|
50
58
|
}),
|
|
51
59
|
btnText && onPress ? /*#__PURE__*/ jsx(UXButton, {
|
|
52
60
|
variant: "text",
|
|
@@ -1,16 +1,19 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import type { ToastProps } from './types';
|
|
3
3
|
export declare const toastConfig: {
|
|
4
|
-
success: ({ text1, props }: {
|
|
4
|
+
success: ({ text1, text2, props }: {
|
|
5
5
|
text1: string;
|
|
6
|
+
text2?: string;
|
|
6
7
|
props?: ToastProps;
|
|
7
8
|
}) => React.JSX.Element;
|
|
8
|
-
error: ({ text1, props }: {
|
|
9
|
+
error: ({ text1, text2, props }: {
|
|
9
10
|
text1: string;
|
|
11
|
+
text2?: string;
|
|
10
12
|
props?: ToastProps;
|
|
11
13
|
}) => React.JSX.Element;
|
|
12
|
-
loading: ({ text1, props }: {
|
|
14
|
+
loading: ({ text1, text2, props }: {
|
|
13
15
|
text1: string;
|
|
16
|
+
text2?: string;
|
|
14
17
|
props?: ToastProps;
|
|
15
18
|
}) => React.JSX.Element;
|
|
16
19
|
};
|
|
@@ -2,19 +2,22 @@ import { jsx } from "react/jsx-runtime";
|
|
|
2
2
|
import "react";
|
|
3
3
|
import { ToastView } from "./ToastView.js";
|
|
4
4
|
const toastConfig = {
|
|
5
|
-
success: ({ text1, props })=>/*#__PURE__*/ jsx(ToastView, {
|
|
5
|
+
success: ({ text1, text2, props })=>/*#__PURE__*/ jsx(ToastView, {
|
|
6
6
|
type: "success",
|
|
7
7
|
text: text1,
|
|
8
|
+
text2: text2,
|
|
8
9
|
props: props
|
|
9
10
|
}),
|
|
10
|
-
error: ({ text1, props })=>/*#__PURE__*/ jsx(ToastView, {
|
|
11
|
+
error: ({ text1, text2, props })=>/*#__PURE__*/ jsx(ToastView, {
|
|
11
12
|
type: "error",
|
|
12
13
|
text: text1,
|
|
14
|
+
text2: text2,
|
|
13
15
|
props: props
|
|
14
16
|
}),
|
|
15
|
-
loading: ({ text1, props })=>/*#__PURE__*/ jsx(ToastView, {
|
|
17
|
+
loading: ({ text1, text2, props })=>/*#__PURE__*/ jsx(ToastView, {
|
|
16
18
|
type: "loading",
|
|
17
19
|
text: text1,
|
|
20
|
+
text2: text2,
|
|
18
21
|
props: props
|
|
19
22
|
})
|
|
20
23
|
};
|
|
@@ -8,8 +8,8 @@ const DateButton = ({ isSelected, text, ...props })=>/*#__PURE__*/ jsx(UXPressab
|
|
|
8
8
|
border: 1,
|
|
9
9
|
h: 30,
|
|
10
10
|
radius: 4,
|
|
11
|
-
borderColor: isSelected ? 'primary' : '
|
|
12
|
-
bg: "
|
|
11
|
+
borderColor: isSelected ? 'primary' : 'bg200',
|
|
12
|
+
bg: "bg200",
|
|
13
13
|
...props,
|
|
14
14
|
children: /*#__PURE__*/ jsx(Text, {
|
|
15
15
|
body3Bold: true,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { forwardRef, useCallback, useEffect, useImperativeHandle, useMemo, useRef, useState } from "react";
|
|
3
3
|
import { Platform, TextInput } from "react-native";
|
|
4
|
-
import {
|
|
4
|
+
import { useI18n, useKeyboard, useTheme } from "../../hooks/index.js";
|
|
5
5
|
import { Icon } from "../../icons/index.js";
|
|
6
6
|
import { HStack } from "../layout/HStack.js";
|
|
7
7
|
import { VStack } from "../layout/VStack.js";
|
|
@@ -10,7 +10,7 @@ import { UXPressable } from "../UXPressable/index.js";
|
|
|
10
10
|
import { useStyles } from "./styles.js";
|
|
11
11
|
const UXInput = /*#__PURE__*/ forwardRef((props, ref)=>{
|
|
12
12
|
const { containerStyle, wrapperStyle, inputStyle, value: controlledValue, defaultValue, errorMessage, startContent, endContent, isReadOnly, isDisabled, isRequired, isClearable, isInvalid: isInvalidProp, autoErrorMessage, label, onChangeText, onValueChange, onFocus, onBlur, blurOnKeyboardHide = true, ...restProps } = props;
|
|
13
|
-
const {
|
|
13
|
+
const { colors } = useTheme();
|
|
14
14
|
const inputRef = useRef(null);
|
|
15
15
|
const [internalValue, setInternalValue] = useState(defaultValue);
|
|
16
16
|
const [isFocused, setIsFocused] = useState(false);
|
|
@@ -143,7 +143,7 @@ const UXInput = /*#__PURE__*/ forwardRef((props, ref)=>{
|
|
|
143
143
|
ref: inputRef,
|
|
144
144
|
allowFontScaling: false,
|
|
145
145
|
editable: !isDisabled && !isReadOnly,
|
|
146
|
-
placeholderTextColor:
|
|
146
|
+
placeholderTextColor: colors.cursor,
|
|
147
147
|
cursorColor: styles.container.borderColor,
|
|
148
148
|
selectionColor: `${styles.container.borderColor}90`,
|
|
149
149
|
style: [
|
|
@@ -239,7 +239,7 @@ const UXNumberInput = /*#__PURE__*/ forwardRef((props, ref)=>{
|
|
|
239
239
|
allowFontScaling: false,
|
|
240
240
|
editable: !isDisabled && !isReadOnly,
|
|
241
241
|
keyboardType: keyboardType,
|
|
242
|
-
placeholderTextColor: getColor('
|
|
242
|
+
placeholderTextColor: getColor('cursor'),
|
|
243
243
|
cursorColor: styles.container.borderColor,
|
|
244
244
|
selectionColor: `${styles.container.borderColor}90`,
|
|
245
245
|
style: [
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { useColors, useMs, useRadius, useSpacing } from "../../../hooks/index.js";
|
|
2
2
|
import { useShadow } from "../../../hooks/useShadow.js";
|
|
3
3
|
const useBoxStyle = (props)=>{
|
|
4
|
-
const { fullWidth, fullHeight, h, minH, maxH, w, minW, maxW, m, mt, mr, mb, ml, ms, me, mh, mv, p, pt, pr, pb, pl, ps, pe, ph, pv, borderStyle, border, borderTop, borderRight, borderBottom, borderLeft, borderStart, borderEnd, borderColor, borderTopColor, borderRightColor, borderBottomColor, borderLeftColor, borderStartColor, borderEndColor, radius, topLeftRadius, topRightRadius, bottomLeftRadius, bottomRightRadius, topStartRadius, topEndRadius, bottomStartRadius, bottomEndRadius, position, top, right, bottom, left, start, end, bg, bgOpacity, opacity, zIndex, overflow, shadow } = props;
|
|
4
|
+
const { fullWidth, fullHeight, h, minH, maxH, w, minW, maxW, m, mt, mr, mb, ml, ms, me, mh, mv, p, pt, pr, pb, pl, ps, pe, ph, px, py, pv, borderStyle, border, borderTop, borderRight, borderBottom, borderLeft, borderStart, borderEnd, borderColor, borderTopColor, borderRightColor, borderBottomColor, borderLeftColor, borderStartColor, borderEndColor, radius, topLeftRadius, topRightRadius, bottomLeftRadius, bottomRightRadius, topStartRadius, topEndRadius, bottomStartRadius, bottomEndRadius, position, top, right, bottom, left, start, end, bg, bgOpacity, opacity, zIndex, overflow, shadow } = props;
|
|
5
5
|
const { ms: uxms } = useMs();
|
|
6
6
|
const { getColor } = useColors();
|
|
7
7
|
const { getSpacing } = useSpacing();
|
|
@@ -25,8 +25,8 @@ const useBoxStyle = (props)=>{
|
|
|
25
25
|
styleObj.marginLeft = getSpacing(ml);
|
|
26
26
|
styleObj.marginStart = getSpacing(ms);
|
|
27
27
|
styleObj.marginEnd = getSpacing(me);
|
|
28
|
-
styleObj.marginHorizontal = getSpacing(mh);
|
|
29
|
-
styleObj.marginVertical = getSpacing(mv);
|
|
28
|
+
styleObj.marginHorizontal = getSpacing(mh || px);
|
|
29
|
+
styleObj.marginVertical = getSpacing(mv || py);
|
|
30
30
|
styleObj.padding = getSpacing(p);
|
|
31
31
|
styleObj.paddingTop = getSpacing(pt);
|
|
32
32
|
styleObj.paddingRight = getSpacing(pr);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ViewStyle } from 'react-native';
|
|
2
|
-
import type { RadiusType, SpacingType, UXColor } from '@particle-network/ui-shared';
|
|
2
|
+
import type { HexColor, RadiusType, SpacingType, UXColor } from '@particle-network/ui-shared';
|
|
3
3
|
export interface UseBoxProps {
|
|
4
4
|
/**
|
|
5
5
|
* Shorthand for the `width=100%` style property.
|
|
@@ -101,10 +101,12 @@ export interface UseBoxProps {
|
|
|
101
101
|
* Shorthand for the `paddingHorizontal` style property.
|
|
102
102
|
*/
|
|
103
103
|
ph?: SpacingType;
|
|
104
|
+
px?: SpacingType;
|
|
104
105
|
/**
|
|
105
106
|
* Shorthand for the `paddingVertical` style property.
|
|
106
107
|
*/
|
|
107
108
|
pv?: SpacingType;
|
|
109
|
+
py?: SpacingType;
|
|
108
110
|
/**
|
|
109
111
|
* Shorthand for the `borderStyle` style property.
|
|
110
112
|
*/
|
|
@@ -140,31 +142,31 @@ export interface UseBoxProps {
|
|
|
140
142
|
/**
|
|
141
143
|
* Shorthand for the `borderColor` style property.
|
|
142
144
|
*/
|
|
143
|
-
borderColor?: UXColor |
|
|
145
|
+
borderColor?: UXColor | HexColor;
|
|
144
146
|
/**
|
|
145
147
|
* Shorthand for the `borderTopColor` style property.
|
|
146
148
|
*/
|
|
147
|
-
borderTopColor?: UXColor |
|
|
149
|
+
borderTopColor?: UXColor | HexColor;
|
|
148
150
|
/**
|
|
149
151
|
* Shorthand for the `borderRightColor` style property.
|
|
150
152
|
*/
|
|
151
|
-
borderRightColor?: UXColor |
|
|
153
|
+
borderRightColor?: UXColor | HexColor;
|
|
152
154
|
/**
|
|
153
155
|
* Shorthand for the `borderBottomColor` style property.
|
|
154
156
|
*/
|
|
155
|
-
borderBottomColor?: UXColor |
|
|
157
|
+
borderBottomColor?: UXColor | HexColor;
|
|
156
158
|
/**
|
|
157
159
|
* Shorthand for the `borderLeftColor` style property.
|
|
158
160
|
*/
|
|
159
|
-
borderLeftColor?: UXColor |
|
|
161
|
+
borderLeftColor?: UXColor | HexColor;
|
|
160
162
|
/**
|
|
161
163
|
* Shorthand for the `borderStartColor` style property.
|
|
162
164
|
*/
|
|
163
|
-
borderStartColor?: UXColor |
|
|
165
|
+
borderStartColor?: UXColor | HexColor;
|
|
164
166
|
/**
|
|
165
167
|
* Shorthand for the `borderEndColor` style property.
|
|
166
168
|
*/
|
|
167
|
-
borderEndColor?: UXColor |
|
|
169
|
+
borderEndColor?: UXColor | HexColor;
|
|
168
170
|
/**
|
|
169
171
|
* Shorthand for the `borderRadius` style property.
|
|
170
172
|
*/
|
|
@@ -232,7 +234,7 @@ export interface UseBoxProps {
|
|
|
232
234
|
/**
|
|
233
235
|
* Shorthand for the `backgroundColor` style property.
|
|
234
236
|
*/
|
|
235
|
-
bg?: UXColor |
|
|
237
|
+
bg?: UXColor | HexColor;
|
|
236
238
|
/**
|
|
237
239
|
* 背景色透明度
|
|
238
240
|
* @example bgOpacity={0.2}
|
|
@@ -20,10 +20,10 @@ const streetComponentConfig = {
|
|
|
20
20
|
color: {
|
|
21
21
|
default: {
|
|
22
22
|
background: 'foreground',
|
|
23
|
-
text: '
|
|
23
|
+
text: 'bgDefault'
|
|
24
24
|
},
|
|
25
25
|
secondary: {
|
|
26
|
-
background: '
|
|
26
|
+
background: 'bg200',
|
|
27
27
|
text: 'foreground'
|
|
28
28
|
}
|
|
29
29
|
}
|
|
@@ -45,7 +45,7 @@ const streetComponentConfig = {
|
|
|
45
45
|
},
|
|
46
46
|
modal: {
|
|
47
47
|
radius: 34,
|
|
48
|
-
bg: '
|
|
48
|
+
bg: 'bgDefault',
|
|
49
49
|
backdrop: {
|
|
50
50
|
light: '#00000050',
|
|
51
51
|
dark: '#1f1f2370'
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { type UXColor } from '@particle-network/ui-shared';
|
|
1
|
+
import { type HexColor, type UXColor } from '@particle-network/ui-shared';
|
|
2
2
|
/**
|
|
3
3
|
* 颜色工具 Hook
|
|
4
4
|
*/
|
|
5
5
|
export declare function useColors(): {
|
|
6
|
-
getColor: (name?: UXColor |
|
|
6
|
+
getColor: (name?: UXColor | HexColor, opacity?: number) => string | undefined;
|
|
7
7
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@particle-network/ui-native",
|
|
3
|
-
"version": "0.5.1-beta.
|
|
3
|
+
"version": "0.5.1-beta.10",
|
|
4
4
|
"main": "./entry.js",
|
|
5
5
|
"react-native": "./dist/index.js",
|
|
6
6
|
"module": "./dist/index.js",
|
|
@@ -45,8 +45,8 @@
|
|
|
45
45
|
"react-native-size-matters": "^0.4.2",
|
|
46
46
|
"react-native-toast-message": "^2.3.3",
|
|
47
47
|
"react-native-worklets": "0.5.1",
|
|
48
|
-
"@particle-network/icons": "0.5.1-beta.
|
|
49
|
-
"@particle-network/ui-shared": "0.4.
|
|
48
|
+
"@particle-network/icons": "0.5.1-beta.7",
|
|
49
|
+
"@particle-network/ui-shared": "0.4.1-beta.6"
|
|
50
50
|
},
|
|
51
51
|
"devDependencies": {
|
|
52
52
|
"@babel/core": "^7.24.0",
|
|
@@ -89,7 +89,7 @@
|
|
|
89
89
|
"unfetch": "^4.2.0",
|
|
90
90
|
"vite": "^6.3.5",
|
|
91
91
|
"zustand": "^5.0.8",
|
|
92
|
-
"@particle-network/icons": "0.5.1-beta.
|
|
92
|
+
"@particle-network/icons": "0.5.1-beta.7",
|
|
93
93
|
"@particle-network/lintstaged-config": "0.1.0",
|
|
94
94
|
"@particle-network/eslint-config": "0.3.0"
|
|
95
95
|
},
|