@particle-network/ui-native 0.4.2-beta.0 → 0.4.2-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/UXButton/button.js +2 -1
- package/dist/components/UXButton/button.styles.js +11 -3
- package/dist/components/UXButton/button.types.d.ts +1 -0
- package/dist/components/UXTabSwitch/index.d.ts +17 -0
- package/dist/components/UXTabSwitch/index.js +31 -0
- package/dist/components/UXTabs/styles.js +2 -2
- package/dist/components/index.d.ts +1 -0
- package/dist/components/index.js +1 -0
- package/dist/components/input/styles.js +5 -2
- package/dist/components/input/types.d.ts +1 -0
- package/dist/locales/en.d.ts +4 -0
- package/dist/locales/en.js +4 -0
- package/dist/locales/index.d.ts +12 -0
- package/dist/locales/zh.js +4 -0
- package/package.json +9 -9
|
@@ -7,7 +7,7 @@ import { UXPressable } from "../UXPressable/index.js";
|
|
|
7
7
|
import { UXSpinner } from "../UXSpinner/index.js";
|
|
8
8
|
import { useStyles } from "./button.styles.js";
|
|
9
9
|
const UXButton = /*#__PURE__*/ forwardRef((props, ref)=>{
|
|
10
|
-
const { style, size, radius, color, variant, onPress, isDisabled, isLoading, startContent, endContent, fullWidth, width, gap, w, h, ph, isIconOnly, children, ...restProps } = props;
|
|
10
|
+
const { style, size, radius, color, variant, onPress, isDisabled, isLoading, isSelected, startContent, endContent, fullWidth, width, gap, w, h, ph, isIconOnly, children, ...restProps } = props;
|
|
11
11
|
const handlePress = (e)=>{
|
|
12
12
|
Keyboard.dismiss();
|
|
13
13
|
triggerHapticFeedback();
|
|
@@ -20,6 +20,7 @@ const UXButton = /*#__PURE__*/ forwardRef((props, ref)=>{
|
|
|
20
20
|
variant,
|
|
21
21
|
isDisabled,
|
|
22
22
|
isLoading,
|
|
23
|
+
isSelected,
|
|
23
24
|
fullWidth,
|
|
24
25
|
isIconOnly,
|
|
25
26
|
width,
|
|
@@ -4,7 +4,7 @@ import { useColors, useComponentConfig, useMs, useRadius, useSpacing } from "../
|
|
|
4
4
|
import { disabledOpacity } from "../../theme/index.js";
|
|
5
5
|
const useStyles = (props)=>{
|
|
6
6
|
const { button: buttonConfig } = useComponentConfig();
|
|
7
|
-
const { size = 'md', radius = buttonConfig.defaultProps?.radius, color = 'default', variant = 'solid', isDisabled, isLoading, width, gap, w, h, ph, fullWidth, isIconOnly } = props;
|
|
7
|
+
const { size = 'md', radius = buttonConfig.defaultProps?.radius, color = 'default', variant = 'solid', isDisabled, isLoading, isSelected, width, gap, w, h, ph, fullWidth, isIconOnly } = props;
|
|
8
8
|
const { getColor } = useColors();
|
|
9
9
|
const { getRadius } = useRadius();
|
|
10
10
|
const { getSpacing } = useSpacing();
|
|
@@ -102,6 +102,9 @@ const useStyles = (props)=>{
|
|
|
102
102
|
]);
|
|
103
103
|
const textColor = useMemo(()=>{
|
|
104
104
|
const customColorConfig = buttonConfig?.color?.[color];
|
|
105
|
+
if (isSelected) {
|
|
106
|
+
if ('secondary' === color) return 'foreground';
|
|
107
|
+
}
|
|
105
108
|
if ('solid' === variant) {
|
|
106
109
|
if (customColorConfig) return customColorConfig.text;
|
|
107
110
|
if ('contrast' === color) return 'bg-default';
|
|
@@ -111,7 +114,8 @@ const useStyles = (props)=>{
|
|
|
111
114
|
}, [
|
|
112
115
|
color,
|
|
113
116
|
variant,
|
|
114
|
-
buttonConfig?.color
|
|
117
|
+
buttonConfig?.color,
|
|
118
|
+
isSelected
|
|
115
119
|
]);
|
|
116
120
|
const textActualColor = useMemo(()=>getColor(textColor), [
|
|
117
121
|
textColor,
|
|
@@ -119,6 +123,9 @@ const useStyles = (props)=>{
|
|
|
119
123
|
]);
|
|
120
124
|
const backgroundColor = useMemo(()=>{
|
|
121
125
|
const customColorConfig = buttonConfig?.color?.[color];
|
|
126
|
+
if (isSelected) {
|
|
127
|
+
if ('secondary' === color && 'solid' === variant) return getColor('tertiary');
|
|
128
|
+
}
|
|
122
129
|
if ('solid' === variant) {
|
|
123
130
|
if (customColorConfig) return getColor(customColorConfig.background);
|
|
124
131
|
if ('contrast' === color) return getColor('foreground');
|
|
@@ -142,7 +149,8 @@ const useStyles = (props)=>{
|
|
|
142
149
|
color,
|
|
143
150
|
getColor,
|
|
144
151
|
variant,
|
|
145
|
-
buttonConfig?.color
|
|
152
|
+
buttonConfig?.color,
|
|
153
|
+
isSelected
|
|
146
154
|
]);
|
|
147
155
|
const borderColor = useMemo(()=>{
|
|
148
156
|
if ('bordered' === variant) {
|
|
@@ -27,6 +27,7 @@ export interface UXButtonProps extends Omit<UXPressableProps, 'style' | 'disable
|
|
|
27
27
|
variant?: 'solid' | 'bordered' | 'flat' | 'text' | 'light';
|
|
28
28
|
radius?: UXRadius;
|
|
29
29
|
isDisabled?: boolean;
|
|
30
|
+
isSelected?: boolean;
|
|
30
31
|
isLoading?: boolean;
|
|
31
32
|
startContent?: React.ReactNode;
|
|
32
33
|
endContent?: React.ReactNode;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { type UXTabsProps } from '../UXTabs';
|
|
3
|
+
interface UXTabSwitchProps {
|
|
4
|
+
tabStyle?: UXTabsProps['tabStyle'];
|
|
5
|
+
containerStyle?: UXTabsProps['containerStyle'];
|
|
6
|
+
size?: UXTabsProps['size'];
|
|
7
|
+
color?: UXTabsProps['color'];
|
|
8
|
+
onTitle?: string;
|
|
9
|
+
onIcon?: React.ReactNode;
|
|
10
|
+
offTitle?: string;
|
|
11
|
+
offIcon?: React.ReactNode;
|
|
12
|
+
isSelected?: boolean;
|
|
13
|
+
isDisabled?: boolean;
|
|
14
|
+
onValueChange?: (isSelected: boolean) => void;
|
|
15
|
+
}
|
|
16
|
+
export declare const UXTabSwitch: React.FC<UXTabSwitchProps>;
|
|
17
|
+
export {};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import "react";
|
|
3
|
+
import { useI18n } from "../../hooks/useI18n.js";
|
|
4
|
+
import { UXTab, UXTabs } from "../UXTabs/index.js";
|
|
5
|
+
const UXTabSwitch = (props)=>{
|
|
6
|
+
const { tabStyle, containerStyle, size, color, onTitle, onIcon, offTitle, offIcon, isSelected = false, isDisabled = false, onValueChange } = props;
|
|
7
|
+
const i18n = useI18n();
|
|
8
|
+
return /*#__PURE__*/ jsxs(UXTabs, {
|
|
9
|
+
tabStyle: tabStyle,
|
|
10
|
+
containerStyle: containerStyle,
|
|
11
|
+
size: size,
|
|
12
|
+
variant: "switch",
|
|
13
|
+
color: color,
|
|
14
|
+
isDisabled: isDisabled,
|
|
15
|
+
selectedKey: isSelected.toString(),
|
|
16
|
+
onSelectionChange: (key)=>{
|
|
17
|
+
onValueChange?.('true' === key);
|
|
18
|
+
},
|
|
19
|
+
children: [
|
|
20
|
+
/*#__PURE__*/ jsx(UXTab, {
|
|
21
|
+
title: offTitle || i18n.switch.off,
|
|
22
|
+
icon: offIcon
|
|
23
|
+
}, "false"),
|
|
24
|
+
/*#__PURE__*/ jsx(UXTab, {
|
|
25
|
+
title: onTitle || i18n.switch.on,
|
|
26
|
+
icon: onIcon
|
|
27
|
+
}, "true")
|
|
28
|
+
]
|
|
29
|
+
});
|
|
30
|
+
};
|
|
31
|
+
export { UXTabSwitch };
|
|
@@ -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 ('
|
|
129
|
-
return getColor('
|
|
128
|
+
if ('light' === variant) return getColor('bg-200');
|
|
129
|
+
return getColor('tertiary');
|
|
130
130
|
}
|
|
131
131
|
return getColor(color);
|
|
132
132
|
}, [
|
package/dist/components/index.js
CHANGED
|
@@ -16,6 +16,7 @@ export * from "./UXRadio/index.js";
|
|
|
16
16
|
export * from "./UXSpinner/index.js";
|
|
17
17
|
export * from "./UXSwitch/index.js";
|
|
18
18
|
export * from "./UXTabs/index.js";
|
|
19
|
+
export * from "./UXTabSwitch/index.js";
|
|
19
20
|
export * from "./UXToast/index.js";
|
|
20
21
|
export * from "./UXTooltip/index.js";
|
|
21
22
|
export * from "./UXTouchableOpacity/index.js";
|
|
@@ -4,7 +4,7 @@ import { useColors, useComponentConfig, useMs, useRadius } from "../../hooks/ind
|
|
|
4
4
|
import { disabledOpacity } from "../../theme/index.js";
|
|
5
5
|
const useStyles = (props)=>{
|
|
6
6
|
const { input: inputConfig } = useComponentConfig();
|
|
7
|
-
const { isInvalid, isDisabled, fullWidth, isFocused, color = 'default', size = 'md', variant = 'flat', multiline, radius = multiline ? void 0 : inputConfig.defaultProps?.radius, width: widthProp, textAlign = 'left' } = props;
|
|
7
|
+
const { isInvalid, isDisabled, fullWidth, isFocused, color = 'default', isColorText = false, size = 'md', variant = 'flat', multiline, radius = multiline ? void 0 : inputConfig.defaultProps?.radius, width: widthProp, textAlign = 'left' } = props;
|
|
8
8
|
const { getColor } = useColors();
|
|
9
9
|
const { getRadius } = useRadius();
|
|
10
10
|
const { ms } = useMs();
|
|
@@ -52,10 +52,13 @@ const useStyles = (props)=>{
|
|
|
52
52
|
]);
|
|
53
53
|
const inputTextColor = useMemo(()=>{
|
|
54
54
|
if (isInvalid) return getColor('danger');
|
|
55
|
+
if (isColorText) return getColor(color);
|
|
55
56
|
return getColor('foreground');
|
|
56
57
|
}, [
|
|
57
58
|
isInvalid,
|
|
58
|
-
getColor
|
|
59
|
+
getColor,
|
|
60
|
+
isColorText,
|
|
61
|
+
color
|
|
59
62
|
]);
|
|
60
63
|
const backgroundColor = useMemo(()=>getColor('bg-200'), [
|
|
61
64
|
getColor
|
|
@@ -36,6 +36,7 @@ export interface UXInputCommonProps extends Omit<TextInputProps, 'style' | 'valu
|
|
|
36
36
|
isReadOnly?: boolean;
|
|
37
37
|
isDisabled?: boolean;
|
|
38
38
|
isInvalid?: boolean;
|
|
39
|
+
isColorText?: boolean;
|
|
39
40
|
label?: string;
|
|
40
41
|
textAlign?: 'left' | 'center' | 'right';
|
|
41
42
|
autoErrorMessage?: boolean;
|
package/dist/locales/en.d.ts
CHANGED
package/dist/locales/en.js
CHANGED
package/dist/locales/index.d.ts
CHANGED
|
@@ -41,6 +41,10 @@ export declare const locales: {
|
|
|
41
41
|
warning: string;
|
|
42
42
|
info: string;
|
|
43
43
|
};
|
|
44
|
+
switch: {
|
|
45
|
+
on: string;
|
|
46
|
+
off: string;
|
|
47
|
+
};
|
|
44
48
|
};
|
|
45
49
|
zh: {
|
|
46
50
|
datePicker: {
|
|
@@ -81,6 +85,10 @@ export declare const locales: {
|
|
|
81
85
|
warning: string;
|
|
82
86
|
info: string;
|
|
83
87
|
};
|
|
88
|
+
switch: {
|
|
89
|
+
on: string;
|
|
90
|
+
off: string;
|
|
91
|
+
};
|
|
84
92
|
};
|
|
85
93
|
};
|
|
86
94
|
export declare function getLocaleText(locale: Locale): {
|
|
@@ -122,4 +130,8 @@ export declare function getLocaleText(locale: Locale): {
|
|
|
122
130
|
warning: string;
|
|
123
131
|
info: string;
|
|
124
132
|
};
|
|
133
|
+
switch: {
|
|
134
|
+
on: string;
|
|
135
|
+
off: string;
|
|
136
|
+
};
|
|
125
137
|
};
|
package/dist/locales/zh.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@particle-network/ui-native",
|
|
3
|
-
"version": "0.4.2-beta.
|
|
3
|
+
"version": "0.4.2-beta.10",
|
|
4
4
|
"main": "./entry.js",
|
|
5
5
|
"react-native": "./dist/index.js",
|
|
6
6
|
"module": "./dist/index.js",
|
|
@@ -44,8 +44,8 @@
|
|
|
44
44
|
"react-native-paper": "^5.14.5",
|
|
45
45
|
"react-native-size-matters": "^0.4.2",
|
|
46
46
|
"react-native-toast-message": "^2.3.3",
|
|
47
|
-
"@particle-network/icons": "0.4.2-beta.
|
|
48
|
-
"@particle-network/ui-shared": "0.3.2-beta.
|
|
47
|
+
"@particle-network/icons": "0.4.2-beta.7",
|
|
48
|
+
"@particle-network/ui-shared": "0.3.2-beta.3"
|
|
49
49
|
},
|
|
50
50
|
"devDependencies": {
|
|
51
51
|
"@babel/core": "^7.24.0",
|
|
@@ -75,8 +75,8 @@
|
|
|
75
75
|
"expo-constants": "~18.0.8",
|
|
76
76
|
"expo-status-bar": "~3.0.8",
|
|
77
77
|
"lucide-react-native": "^0.541.0",
|
|
78
|
-
"react": "19.1.
|
|
79
|
-
"react-dom": "19.1.
|
|
78
|
+
"react": "19.1.0",
|
|
79
|
+
"react-dom": "19.1.0",
|
|
80
80
|
"react-native": "0.81.5",
|
|
81
81
|
"react-native-gesture-handler": "~2.28.0",
|
|
82
82
|
"react-native-reanimated": "~4.1.0",
|
|
@@ -88,9 +88,9 @@
|
|
|
88
88
|
"unfetch": "^4.2.0",
|
|
89
89
|
"vite": "^6.3.5",
|
|
90
90
|
"zustand": "^5.0.8",
|
|
91
|
-
"@particle-network/
|
|
92
|
-
"@particle-network/
|
|
93
|
-
"@particle-network/
|
|
91
|
+
"@particle-network/icons": "0.4.2-beta.7",
|
|
92
|
+
"@particle-network/lintstaged-config": "0.1.0",
|
|
93
|
+
"@particle-network/eslint-config": "0.3.0"
|
|
94
94
|
},
|
|
95
95
|
"overrides": {
|
|
96
96
|
"react-docgen-typescript": "2.2.2",
|
|
@@ -111,7 +111,7 @@
|
|
|
111
111
|
"storybook:build": "storybook build",
|
|
112
112
|
"storybook:preview": "serve storybook-static",
|
|
113
113
|
"storybook:generate": "sb-rn-get-stories",
|
|
114
|
-
"type-check": "npx
|
|
114
|
+
"type-check": "npx tsc --noEmit -p ./tsconfig.json",
|
|
115
115
|
"dev": "rslib build --watch",
|
|
116
116
|
"build": "rslib build",
|
|
117
117
|
"lint": "eslint . --no-error-on-unmatched-pattern --quiet",
|