@particle-network/ui-native 0.0.14 → 0.0.16
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.
|
@@ -2,7 +2,7 @@ import type React from 'react';
|
|
|
2
2
|
import type { StyleProp, ViewStyle } from 'react-native';
|
|
3
3
|
import type { UXRadius } from '@particle-network/ui-shared';
|
|
4
4
|
import type { UXPressableProps } from '../UXPressable';
|
|
5
|
-
export interface UXButtonProps extends Omit<UXPressableProps, 'style'> {
|
|
5
|
+
export interface UXButtonProps extends Omit<UXPressableProps, 'style' | 'disabled'> {
|
|
6
6
|
style?: StyleProp<ViewStyle>;
|
|
7
7
|
color?: 'default' | 'primary' | 'secondary' | 'success' | 'alert' | 'warning' | 'danger' | 'bullish' | 'bearish' | 'contrast';
|
|
8
8
|
/**
|
|
@@ -5,7 +5,9 @@ type UseStylesProps = UXInputCommonProps & {
|
|
|
5
5
|
export declare const useStyles: (props: UseStylesProps) => {
|
|
6
6
|
container: {
|
|
7
7
|
width: number | import("react-native").Animated.AnimatedNode | "auto" | `${number}%`;
|
|
8
|
-
height: number;
|
|
8
|
+
height: number | undefined;
|
|
9
|
+
paddingTop: number;
|
|
10
|
+
paddingBottom: number;
|
|
9
11
|
borderRadius: number | undefined;
|
|
10
12
|
borderColor: string | undefined;
|
|
11
13
|
backgroundColor: string | undefined;
|
|
@@ -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 = 'primary', size = 'md', variant = 'flat', radius = inputConfig.defaultProps?.radius, width: widthProp, textAlign = 'left' } = props;
|
|
7
|
+
const { isInvalid, isDisabled, fullWidth, isFocused, color = 'primary', 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();
|
|
@@ -21,10 +21,13 @@ const useStyles = (props)=>{
|
|
|
21
21
|
fullWidth,
|
|
22
22
|
widthProp
|
|
23
23
|
]);
|
|
24
|
-
const height = useMemo(()=>
|
|
24
|
+
const height = useMemo(()=>{
|
|
25
|
+
if (!multiline) return ms(inputConfig.size[size]);
|
|
26
|
+
}, [
|
|
25
27
|
size,
|
|
26
28
|
inputConfig.size,
|
|
27
|
-
ms
|
|
29
|
+
ms,
|
|
30
|
+
multiline
|
|
28
31
|
]);
|
|
29
32
|
const fontSize = useMemo(()=>inputConfig.fontSize[size], [
|
|
30
33
|
size,
|
|
@@ -61,10 +64,25 @@ const useStyles = (props)=>{
|
|
|
61
64
|
isInvalid,
|
|
62
65
|
getColor
|
|
63
66
|
]);
|
|
67
|
+
const containerPadding = useMemo(()=>{
|
|
68
|
+
if (multiline) return {
|
|
69
|
+
paddingTop: ms(12),
|
|
70
|
+
paddingBottom: ms(12)
|
|
71
|
+
};
|
|
72
|
+
return {
|
|
73
|
+
paddingTop: 0,
|
|
74
|
+
paddingBottom: 0
|
|
75
|
+
};
|
|
76
|
+
}, [
|
|
77
|
+
multiline,
|
|
78
|
+
ms
|
|
79
|
+
]);
|
|
64
80
|
const styles = useMemo(()=>StyleSheet.create({
|
|
65
81
|
container: {
|
|
66
82
|
width,
|
|
67
83
|
height,
|
|
84
|
+
paddingTop: containerPadding.paddingTop,
|
|
85
|
+
paddingBottom: containerPadding.paddingBottom,
|
|
68
86
|
borderRadius,
|
|
69
87
|
borderColor,
|
|
70
88
|
backgroundColor,
|
|
@@ -95,7 +113,9 @@ const useStyles = (props)=>{
|
|
|
95
113
|
fontSize,
|
|
96
114
|
inputTextColor,
|
|
97
115
|
textAlign,
|
|
98
|
-
backgroundColor
|
|
116
|
+
backgroundColor,
|
|
117
|
+
containerPadding,
|
|
118
|
+
ms
|
|
99
119
|
]);
|
|
100
120
|
return styles;
|
|
101
121
|
};
|