@particle-network/ui-native 0.4.0-beta.18 → 0.4.0-beta.19
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.
|
@@ -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, w, h, ph, isIconOnly, children, ...restProps } = props;
|
|
10
|
+
const { style, size, radius, color, variant, onPress, isDisabled, isLoading, startContent, endContent, fullWidth, width, gap, w, h, ph, isIconOnly, children, ...restProps } = props;
|
|
11
11
|
const handlePress = (e)=>{
|
|
12
12
|
Keyboard.dismiss();
|
|
13
13
|
triggerHapticFeedback();
|
|
@@ -23,6 +23,7 @@ const UXButton = /*#__PURE__*/ forwardRef((props, ref)=>{
|
|
|
23
23
|
fullWidth,
|
|
24
24
|
isIconOnly,
|
|
25
25
|
width,
|
|
26
|
+
gap,
|
|
26
27
|
w,
|
|
27
28
|
h,
|
|
28
29
|
ph
|
|
@@ -6,7 +6,7 @@ export declare const useStyles: (props: UXButtonProps) => {
|
|
|
6
6
|
flexDirection: "row";
|
|
7
7
|
alignItems: "center";
|
|
8
8
|
justifyContent: "center";
|
|
9
|
-
gap: number;
|
|
9
|
+
gap: number | undefined;
|
|
10
10
|
paddingVertical: number;
|
|
11
11
|
height: number | undefined;
|
|
12
12
|
width: number | "100%" | undefined;
|
|
@@ -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, w, h, ph, fullWidth, isIconOnly } = props;
|
|
7
|
+
const { size = 'md', radius = buttonConfig.defaultProps?.radius, color = 'default', variant = 'solid', isDisabled, isLoading, width, gap, w, h, ph, fullWidth, isIconOnly } = props;
|
|
8
8
|
const { getColor } = useColors();
|
|
9
9
|
const { getRadius } = useRadius();
|
|
10
10
|
const { getSpacing } = useSpacing();
|
|
@@ -29,6 +29,15 @@ const useStyles = (props)=>{
|
|
|
29
29
|
ms,
|
|
30
30
|
buttonConfig.fontSize
|
|
31
31
|
]);
|
|
32
|
+
const iconSizeMap = useMemo(()=>({
|
|
33
|
+
xs: ms(14),
|
|
34
|
+
sm: ms(16),
|
|
35
|
+
md: ms(18),
|
|
36
|
+
lg: ms(24),
|
|
37
|
+
auto: ms(16)
|
|
38
|
+
}), [
|
|
39
|
+
ms
|
|
40
|
+
]);
|
|
32
41
|
const radiusMap = {
|
|
33
42
|
xs: 'xs',
|
|
34
43
|
sm: 'sm',
|
|
@@ -37,9 +46,9 @@ const useStyles = (props)=>{
|
|
|
37
46
|
auto: 'sm'
|
|
38
47
|
};
|
|
39
48
|
const paddingMap = useMemo(()=>({
|
|
40
|
-
xs: ms(
|
|
41
|
-
sm: ms(
|
|
42
|
-
md: ms(
|
|
49
|
+
xs: ms(10),
|
|
50
|
+
sm: ms(14),
|
|
51
|
+
md: ms(14),
|
|
43
52
|
lg: ms(14)
|
|
44
53
|
}), [
|
|
45
54
|
ms
|
|
@@ -70,9 +79,9 @@ const useStyles = (props)=>{
|
|
|
70
79
|
size,
|
|
71
80
|
fontSizeMap
|
|
72
81
|
]);
|
|
73
|
-
const spinnerSize = useMemo(()=>
|
|
74
|
-
|
|
75
|
-
|
|
82
|
+
const spinnerSize = useMemo(()=>iconSizeMap[size], [
|
|
83
|
+
size,
|
|
84
|
+
iconSizeMap
|
|
76
85
|
]);
|
|
77
86
|
const borderRadius = useMemo(()=>getRadius(radius ?? radiusMap[size]), [
|
|
78
87
|
radius,
|
|
@@ -120,12 +129,12 @@ const useStyles = (props)=>{
|
|
|
120
129
|
return getColor('bg-200');
|
|
121
130
|
}
|
|
122
131
|
if ('flat' === variant) {
|
|
123
|
-
if (customColorConfig) return `${getColor(customColorConfig.background)}
|
|
132
|
+
if (customColorConfig) return `${getColor(customColorConfig.background)}20`;
|
|
124
133
|
if ('contrast' === color) return `${getColor('foreground')}40`;
|
|
125
134
|
if ([
|
|
126
135
|
'default',
|
|
127
136
|
'secondary'
|
|
128
|
-
].includes(color)) return
|
|
137
|
+
].includes(color)) return getColor('bg-300');
|
|
129
138
|
return `${getColor(color)}20`;
|
|
130
139
|
}
|
|
131
140
|
return 'transparent';
|
|
@@ -161,7 +170,7 @@ const useStyles = (props)=>{
|
|
|
161
170
|
flexDirection: 'row',
|
|
162
171
|
alignItems: 'center',
|
|
163
172
|
justifyContent: 'center',
|
|
164
|
-
gap: ms(
|
|
173
|
+
gap: gap ? getSpacing(gap) : ms(4),
|
|
165
174
|
paddingVertical: 0,
|
|
166
175
|
height,
|
|
167
176
|
width: widthStyle,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@particle-network/ui-native",
|
|
3
|
-
"version": "0.4.0-beta.
|
|
3
|
+
"version": "0.4.0-beta.19",
|
|
4
4
|
"main": "./entry.js",
|
|
5
5
|
"react-native": "./dist/index.js",
|
|
6
6
|
"module": "./dist/index.js",
|
|
@@ -88,8 +88,8 @@
|
|
|
88
88
|
"unfetch": "^4.2.0",
|
|
89
89
|
"vite": "^6.3.5",
|
|
90
90
|
"zustand": "^5.0.8",
|
|
91
|
-
"@particle-network/eslint-config": "0.3.0",
|
|
92
91
|
"@particle-network/icons": "0.4.0-beta.14",
|
|
92
|
+
"@particle-network/eslint-config": "0.3.0",
|
|
93
93
|
"@particle-network/lintstaged-config": "0.1.0"
|
|
94
94
|
},
|
|
95
95
|
"overrides": {
|