@particle-network/ui-native 0.0.4 → 0.0.6
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 +1 -1
- package/dist/components/ProgressWrapper/index.js +1 -1
- package/dist/components/Text/text.js +2 -1
- package/dist/components/Text/text.types.d.ts +1 -1
- package/dist/components/UXButton/button.js +3 -2
- package/dist/components/UXCheckbox/checkbox-group.d.ts +1 -1
- package/dist/components/UXCheckbox/checkbox-group.js +1 -1
- package/dist/components/UXCheckbox/checkbox.d.ts +1 -1
- package/dist/components/UXCheckbox/checkbox.js +3 -1
- package/dist/components/UXChip/chip.js +3 -2
- package/dist/components/UXChip/types.d.ts +1 -1
- package/dist/components/UXDivider/index.d.ts +1 -1
- package/dist/components/UXDivider/index.js +1 -1
- package/dist/components/UXHint/index.d.ts +1 -1
- package/dist/components/UXHint/index.js +1 -1
- package/dist/components/UXModal/index.js +6 -1
- package/dist/components/UXPressable/index.d.ts +2 -1
- package/dist/components/UXPressable/index.js +1 -1
- package/dist/components/UXRadio/radio-group.d.ts +1 -1
- package/dist/components/UXRadio/radio-group.js +1 -1
- package/dist/components/UXRadio/radio.d.ts +1 -1
- package/dist/components/UXRadio/radio.js +2 -1
- package/dist/components/UXSwitch/switch.js +2 -1
- package/dist/components/UXSwitch/types.d.ts +1 -1
- package/dist/components/UXTabs/tab.js +3 -1
- package/dist/components/UXTabs/tabs.js +4 -3
- package/dist/components/UXTabs/types.d.ts +1 -1
- package/dist/components/UXTooltip/index.d.ts +1 -1
- package/dist/components/UXTooltip/index.js +3 -1
- package/dist/components/UXTouchableOpacity/index.d.ts +2 -1
- package/dist/components/UXTouchableOpacity/index.js +1 -1
- package/dist/components/input/input.js +5 -3
- package/dist/components/input/number-input.js +5 -3
- package/dist/components/input/styles.d.ts +2 -2
- package/dist/components/layout/Center.d.ts +1 -1
- package/dist/components/layout/Center.js +1 -1
- package/dist/components/layout/Circle.d.ts +2 -2
- package/dist/components/layout/Circle.js +1 -1
- package/dist/components/layout/Flex/useFlexBox.style.d.ts +2 -1
- package/dist/components/layout/Flex/useFlexBox.style.js +2 -1
- package/dist/components/layout/HStack.d.ts +1 -1
- package/dist/components/layout/HStack.js +1 -1
- package/dist/components/layout/Square.d.ts +1 -1
- package/dist/components/layout/Square.js +1 -1
- package/dist/components/layout/VStack.d.ts +1 -1
- package/dist/components/layout/VStack.js +1 -1
- package/package.json +6 -5
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { type StyleProp, type ViewStyle } from 'react-native';
|
|
3
3
|
import type { UXForegroundColor, UXRadius } from '@particle-network/ui-shared';
|
|
4
|
-
import { type FlexProps } from '
|
|
4
|
+
import { type FlexProps } from '../layout/Flex';
|
|
5
5
|
export interface ProgressWrapperProps extends Omit<FlexProps, 'radius' | 'width' | 'height' | 'w' | 'h'> {
|
|
6
6
|
/**
|
|
7
7
|
* 进度 (%)
|
|
@@ -2,8 +2,8 @@ import { jsx, jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import { useMemo, useState } from "react";
|
|
3
3
|
import { StyleSheet, View } from "react-native";
|
|
4
4
|
import react_native_svg, { Path } from "react-native-svg";
|
|
5
|
-
import { Flex } from "../index.js";
|
|
6
5
|
import { useColors, useRadius } from "../../hooks/index.js";
|
|
6
|
+
import { Flex } from "../layout/Flex/index.js";
|
|
7
7
|
const ProgressWrapper = ({ style, svgStyle, value = 0, width, height, radius = 'sm', strokeWidth = 1, color = 'primary', children, ...restProps })=>{
|
|
8
8
|
const { getColor } = useColors();
|
|
9
9
|
const { getRadius } = useRadius();
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { forwardRef, useMemo, useState } from "react";
|
|
3
3
|
import { StyleSheet, Text, View } from "react-native";
|
|
4
|
-
import { Box, HStack, useBoxStyle } from "../index.js";
|
|
5
4
|
import { useColors } from "../../hooks/index.js";
|
|
5
|
+
import { Box, useBoxStyle } from "../layout/Box/index.js";
|
|
6
|
+
import { HStack } from "../layout/HStack.js";
|
|
6
7
|
import { textStyles } from "./text.types.js";
|
|
7
8
|
const text_Text = /*#__PURE__*/ forwardRef((props, ref)=>{
|
|
8
9
|
const { variant = 'body2Bold', fontWeight, color = 'default', lineHeight, align, style, h1, h2, h3, body1, body1Bold, body2, body2Bold, body3, body3Bold, caption1, caption1Bold, underlineStyle, 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, ...restProps } = props;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { TextProps as RNTextProps, TextStyle } from 'react-native';
|
|
2
2
|
import type { UXForegroundColor } from '@particle-network/ui-shared';
|
|
3
|
-
import type { UseBoxProps } from '
|
|
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';
|
|
6
6
|
type TextLineHeight = '1' | '1.4';
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { forwardRef, useMemo } from "react";
|
|
3
3
|
import { ActivityIndicator, Keyboard } from "react-native";
|
|
4
|
-
import { Text, UXPressable } from "../index.js";
|
|
5
4
|
import { triggerHapticFeedback } from "../../utils/triggerHapticFeedback.js";
|
|
5
|
+
import { Text } from "../Text/index.js";
|
|
6
|
+
import { UXPressable } from "../UXPressable/index.js";
|
|
6
7
|
import { useStyles } from "./button.styles.js";
|
|
7
8
|
const UXButton = /*#__PURE__*/ forwardRef((props, ref)=>{
|
|
8
9
|
const { style, size, radius, color, variant, onPress, isDisabled, isLoading, startContent, endContent, fullWidth, fill, width, isIconOnly, children, ...restProps } = props;
|
|
@@ -23,7 +24,7 @@ const UXButton = /*#__PURE__*/ forwardRef((props, ref)=>{
|
|
|
23
24
|
width,
|
|
24
25
|
fill
|
|
25
26
|
});
|
|
26
|
-
const content = useMemo(
|
|
27
|
+
const content = useMemo(()=>{
|
|
27
28
|
if ('string' == typeof children || 'number' == typeof children) return /*#__PURE__*/ jsx(Text, {
|
|
28
29
|
style: styles.title,
|
|
29
30
|
children: children.toString()
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
2
|
import "react";
|
|
3
|
-
import { Flex } from "../index.js";
|
|
3
|
+
import { Flex } from "../layout/Flex/index.js";
|
|
4
4
|
import { CheckboxGroupContext } from "./context.js";
|
|
5
5
|
const UXCheckboxGroup = ({ size, isDisabled, color, children, gap = 8, value = [], onValueChange, ...props })=>{
|
|
6
6
|
const handleValueChange = (checkboxValue, selected)=>{
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { type FlexProps } from '
|
|
2
|
+
import { type FlexProps } from '../layout/Flex';
|
|
3
3
|
import type { UXCheckboxCommonProps } from './types';
|
|
4
4
|
export type UXCheckboxProps = UXCheckboxCommonProps & FlexProps & {
|
|
5
5
|
defaultSelected?: boolean;
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useEffect, useMemo, useState } from "react";
|
|
3
3
|
import { ms } from "react-native-size-matters";
|
|
4
|
-
import { Flex, Text, UXPressable } from "../index.js";
|
|
5
4
|
import CheckboxOffIcon from "../../icons/CheckboxOffIcon.js";
|
|
6
5
|
import CheckboxOnIcon from "../../icons/CheckboxOnIcon.js";
|
|
7
6
|
import { disabledOpacity } from "../../theme/index.js";
|
|
7
|
+
import { Flex } from "../layout/Flex/index.js";
|
|
8
|
+
import { Text } from "../Text/index.js";
|
|
9
|
+
import { UXPressable } from "../UXPressable/index.js";
|
|
8
10
|
import { useCheckboxGroup } from "./context.js";
|
|
9
11
|
const UXCheckbox = ({ size, color, defaultSelected = false, isSelected, children, value, onValueChange, isDisabled, ...props })=>{
|
|
10
12
|
const [internalSelected, setInternalSelected] = useState(defaultSelected ?? isSelected);
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { forwardRef, useMemo } from "react";
|
|
3
|
-
import { HStack
|
|
3
|
+
import { HStack } from "../layout/HStack.js";
|
|
4
|
+
import { Text } from "../Text/index.js";
|
|
4
5
|
import { useStyles } from "./styles.js";
|
|
5
6
|
const UXChip = /*#__PURE__*/ forwardRef((props, ref)=>{
|
|
6
7
|
const { style, size, gap = 2, radius = 4, color, variant, isDisabled, startContent, endContent, children, ...restProps } = props;
|
|
@@ -10,7 +11,7 @@ const UXChip = /*#__PURE__*/ forwardRef((props, ref)=>{
|
|
|
10
11
|
variant,
|
|
11
12
|
isDisabled
|
|
12
13
|
});
|
|
13
|
-
const content = useMemo(
|
|
14
|
+
const content = useMemo(()=>{
|
|
14
15
|
if ('string' == typeof children || 'number' == typeof children) return /*#__PURE__*/ jsx(Text, {
|
|
15
16
|
style: styles.title,
|
|
16
17
|
children: children.toString()
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type React from 'react';
|
|
2
2
|
import type { UXForegroundColor } from '@particle-network/ui-shared';
|
|
3
|
-
import type { HStackProps } from '
|
|
3
|
+
import type { HStackProps } from '../layout/HStack';
|
|
4
4
|
export interface UXChipProps extends HStackProps {
|
|
5
5
|
color?: UXForegroundColor;
|
|
6
6
|
size?: 'sm' | 'md' | 'lg';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
2
|
import { forwardRef, useMemo } from "react";
|
|
3
|
-
import { Box } from "../index.js";
|
|
3
|
+
import { Box } from "../layout/Box/index.js";
|
|
4
4
|
const UXDivider = /*#__PURE__*/ forwardRef((props, ref)=>{
|
|
5
5
|
const { w, h, orientation = 'horizontal', style, ...restProps } = props;
|
|
6
6
|
const width = useMemo(()=>{
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
2
|
import "react";
|
|
3
3
|
import { ms } from "react-native-size-matters";
|
|
4
|
-
import { UXTooltip } from "../index.js";
|
|
5
4
|
import QuestionIcon from "../../icons/QuestionIcon.js";
|
|
5
|
+
import { UXTooltip } from "../UXTooltip/index.js";
|
|
6
6
|
const UXHint = (props)=>{
|
|
7
7
|
const { content, children, iconStyle, ...restProps } = props;
|
|
8
8
|
return /*#__PURE__*/ jsx(UXTooltip, {
|
|
@@ -4,8 +4,13 @@ import { Animated, Dimensions, PanResponder, Platform, ScrollView, StyleSheet }
|
|
|
4
4
|
import { Modal, Portal } from "react-native-paper";
|
|
5
5
|
import { useSafeAreaInsets } from "react-native-safe-area-context";
|
|
6
6
|
import { ms } from "react-native-size-matters";
|
|
7
|
-
import { Box, Circle, Flex, HStack, Text, VStack } from "../index.js";
|
|
8
7
|
import { useColors, useKeyboard } from "../../hooks/index.js";
|
|
8
|
+
import { Box } from "../layout/Box/index.js";
|
|
9
|
+
import { Circle } from "../layout/Circle.js";
|
|
10
|
+
import { Flex } from "../layout/Flex/index.js";
|
|
11
|
+
import { HStack } from "../layout/HStack.js";
|
|
12
|
+
import { VStack } from "../layout/VStack.js";
|
|
13
|
+
import { Text } from "../Text/index.js";
|
|
9
14
|
const { height } = Dimensions.get('window');
|
|
10
15
|
const UXModal = /*#__PURE__*/ forwardRef((props, scrollViewRef)=>{
|
|
11
16
|
const { style, contentStyle, isOpen, title, titleAlign = 'left', onClose, onVisibleChange, children, disableCloseBySwipe, closeByLineOnly, wrapPortal, footer, modalName, tip, keyboardAvoidPosition = 'container' } = props;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { PressableProps, View } from 'react-native';
|
|
2
|
-
import {
|
|
2
|
+
import type { UseBoxProps } from '../layout/Box';
|
|
3
|
+
import { type UseFlexProps } from '../layout/Flex';
|
|
3
4
|
export type UXPressableProps = PressableProps & UseBoxProps & UseFlexProps;
|
|
4
5
|
export declare const UXPressable: import("react").ForwardRefExoticComponent<PressableProps & UseBoxProps & UseFlexProps & import("react").RefAttributes<View>>;
|
|
@@ -2,7 +2,7 @@ import { jsx } from "react/jsx-runtime";
|
|
|
2
2
|
import { forwardRef, useCallback } from "react";
|
|
3
3
|
import { Pressable } from "react-native";
|
|
4
4
|
import useDebounceFn from "ahooks/es/useDebounceFn";
|
|
5
|
-
import { useFlexBoxStyle } from "../index.js";
|
|
5
|
+
import { useFlexBoxStyle } from "../layout/Flex/index.js";
|
|
6
6
|
const UXPressable = /*#__PURE__*/ forwardRef(({ style, onPress, ...props }, ref)=>{
|
|
7
7
|
const { run } = useDebounceFn(onPress || (()=>null), {
|
|
8
8
|
wait: 300,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { type FlexProps } from '
|
|
2
|
+
import { type FlexProps } from '../layout/Flex';
|
|
3
3
|
import type { UXRadioCommonProps } from './types';
|
|
4
4
|
export type UXRadioGroupProps = UXRadioCommonProps & FlexProps;
|
|
5
5
|
export declare const UXRadioGroup: React.FC<UXRadioGroupProps>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
2
|
import "react";
|
|
3
|
-
import { Flex } from "../index.js";
|
|
3
|
+
import { Flex } from "../layout/Flex/index.js";
|
|
4
4
|
import { RadioGroupContext } from "./context.js";
|
|
5
5
|
const UXRadioGroup = ({ value = '', onValueChange, color, size, isDisabled, children, gap = 8, ...props })=>/*#__PURE__*/ jsx(RadioGroupContext.Provider, {
|
|
6
6
|
value: {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { type FlexProps } from '
|
|
2
|
+
import { type FlexProps } from '../layout/Flex';
|
|
3
3
|
import type { UXRadioCommonProps } from './types';
|
|
4
4
|
export type UXRadioProps = Omit<UXRadioCommonProps, 'onValueChange'> & FlexProps;
|
|
5
5
|
export declare const UXRadio: React.FC<UXRadioProps>;
|
|
@@ -2,10 +2,11 @@ import { jsx, jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import { useMemo } from "react";
|
|
3
3
|
import { Pressable } from "react-native";
|
|
4
4
|
import { ms } from "react-native-size-matters";
|
|
5
|
-
import { Flex, Text } from "../index.js";
|
|
6
5
|
import RadioOffIcon from "../../icons/RadioOffIcon.js";
|
|
7
6
|
import RadioOnIcon from "../../icons/RadioOnIcon.js";
|
|
8
7
|
import { disabledOpacity } from "../../theme/index.js";
|
|
8
|
+
import { Flex } from "../layout/Flex/index.js";
|
|
9
|
+
import { Text } from "../Text/index.js";
|
|
9
10
|
import { useRadioGroup } from "./context.js";
|
|
10
11
|
const UXRadio = ({ size, color, children, value, isDisabled, ...props })=>{
|
|
11
12
|
const groupContext = useRadioGroup();
|
|
@@ -3,9 +3,10 @@ import { useEffect, useMemo, useRef, useState } from "react";
|
|
|
3
3
|
import { Animated } from "react-native";
|
|
4
4
|
import { ms } from "react-native-size-matters";
|
|
5
5
|
import useUpdateEffect from "ahooks/es/useUpdateEffect";
|
|
6
|
-
import { Text, UXTouchableOpacity } from "../index.js";
|
|
7
6
|
import { useColors } from "../../hooks/index.js";
|
|
8
7
|
import { disabledOpacity } from "../../theme/index.js";
|
|
8
|
+
import { Text } from "../Text/index.js";
|
|
9
|
+
import { UXTouchableOpacity } from "../UXTouchableOpacity/index.js";
|
|
9
10
|
import { useStyles } from "./styles.js";
|
|
10
11
|
const UXSwitch = (props)=>{
|
|
11
12
|
const { color = 'primary', size = 'md', defaultSelected = false, isSelected: isSelectedProps = false, onValueChange, isReadOnly, isDisabled, children, ...flexProps } = props;
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useCallback } from "react";
|
|
3
|
-
import { HStack, Text, UXTouchableOpacity } from "../index.js";
|
|
4
3
|
import DotIcon from "../../icons/DotIcon.js";
|
|
4
|
+
import { HStack } from "../layout/HStack.js";
|
|
5
|
+
import { Text } from "../Text/index.js";
|
|
6
|
+
import { UXTouchableOpacity } from "../UXTouchableOpacity/index.js";
|
|
5
7
|
import { useTabsContext } from "./context.js";
|
|
6
8
|
import { useStyles } from "./styles.js";
|
|
7
9
|
const UXTab = ({ tabKey = '', title, icon, style, notification })=>{
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { Children, cloneElement, isValidElement, useState } from "react";
|
|
3
3
|
import useUpdateEffect from "ahooks/es/useUpdateEffect";
|
|
4
|
-
import { HStack, VStack } from "../index.js";
|
|
5
4
|
import { disabledOpacity } from "../../theme/index.js";
|
|
5
|
+
import { HStack } from "../layout/HStack.js";
|
|
6
|
+
import { VStack } from "../layout/VStack.js";
|
|
6
7
|
import { TabsContext } from "./context.js";
|
|
7
8
|
import { useStyles } from "./styles.js";
|
|
8
9
|
const UXTabs = (props)=>{
|
|
@@ -24,14 +25,14 @@ const UXTabs = (props)=>{
|
|
|
24
25
|
onSelectionChange?.(key);
|
|
25
26
|
}
|
|
26
27
|
};
|
|
27
|
-
const tabs = Children.map(children,
|
|
28
|
+
const tabs = Children.map(children, (child)=>{
|
|
28
29
|
if (/*#__PURE__*/ isValidElement(child) && child.key) return /*#__PURE__*/ cloneElement(child, {
|
|
29
30
|
tabKey: String(child.key),
|
|
30
31
|
style: tabStyle
|
|
31
32
|
});
|
|
32
33
|
return child;
|
|
33
34
|
});
|
|
34
|
-
const renderSelectedTabContent = ()=>Children.map(children,
|
|
35
|
+
const renderSelectedTabContent = ()=>Children.map(children, (child)=>{
|
|
35
36
|
if (/*#__PURE__*/ isValidElement(child) && child.key === selectedKey) return child.props.children;
|
|
36
37
|
return null;
|
|
37
38
|
});
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type React from 'react';
|
|
2
2
|
import type { StyleProp, ViewStyle } from 'react-native';
|
|
3
3
|
import type { UXForegroundColor, UXSize } from '@particle-network/ui-shared';
|
|
4
|
-
import type { HStackProps } from '
|
|
4
|
+
import type { HStackProps } from '../layout/HStack';
|
|
5
5
|
export interface UXTabsProps extends HStackProps {
|
|
6
6
|
color?: UXForegroundColor;
|
|
7
7
|
size?: UXSize;
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useState } from "react";
|
|
3
|
-
import { Text
|
|
3
|
+
import { Text } from "../Text/index.js";
|
|
4
|
+
import { UXModal } from "../UXModal/index.js";
|
|
5
|
+
import { UXPressable } from "../UXPressable/index.js";
|
|
4
6
|
const UXTooltip = (props)=>{
|
|
5
7
|
const { content, children, ...restProps } = props;
|
|
6
8
|
const [isShow, setIsShow] = useState(false);
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { type TouchableOpacityProps, type View } from 'react-native';
|
|
2
|
-
import {
|
|
2
|
+
import type { UseBoxProps } from '../layout/Box';
|
|
3
|
+
import { type UseFlexProps } from '../layout/Flex';
|
|
3
4
|
export type UXTouchableOpacityProps = TouchableOpacityProps & UseBoxProps & UseFlexProps;
|
|
4
5
|
export declare const UXTouchableOpacity: import("react").ForwardRefExoticComponent<TouchableOpacityProps & UseBoxProps & UseFlexProps & import("react").RefAttributes<View>>;
|
|
@@ -2,7 +2,7 @@ import { jsx } from "react/jsx-runtime";
|
|
|
2
2
|
import { forwardRef } from "react";
|
|
3
3
|
import { TouchableOpacity } from "react-native";
|
|
4
4
|
import useDebounceFn from "ahooks/es/useDebounceFn";
|
|
5
|
-
import { useFlexBoxStyle } from "../index.js";
|
|
5
|
+
import { useFlexBoxStyle } from "../layout/Flex/index.js";
|
|
6
6
|
const UXTouchableOpacity = /*#__PURE__*/ forwardRef(({ onPress, style, ...props }, ref)=>{
|
|
7
7
|
const { run } = useDebounceFn(onPress || (()=>null), {
|
|
8
8
|
wait: 300,
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { forwardRef, useCallback, useEffect, useImperativeHandle, useMemo, useRef, useState } from "react";
|
|
3
3
|
import { TextInput } from "react-native";
|
|
4
|
-
import { HStack, Text, VStack } from "../index.js";
|
|
5
4
|
import { useColors } from "../../hooks/index.js";
|
|
5
|
+
import { HStack } from "../layout/HStack.js";
|
|
6
|
+
import { VStack } from "../layout/VStack.js";
|
|
7
|
+
import { Text } from "../Text/index.js";
|
|
6
8
|
import { useStyles } from "./styles.js";
|
|
7
9
|
const UXInput = /*#__PURE__*/ forwardRef((props, ref)=>{
|
|
8
10
|
const { containerStyle, wrapperStyle, inputStyle, value: controlledValue, defaultValue, errorMessage, startContent, endContent, isReadOnly, isDisabled, isRequired, isInvalid: isInvalidProp, autoErrorMessage, label, onChangeText, onValueChange, onFocus, onBlur, ...restProps } = props;
|
|
@@ -67,7 +69,7 @@ const UXInput = /*#__PURE__*/ forwardRef((props, ref)=>{
|
|
|
67
69
|
internalValue,
|
|
68
70
|
isRequired
|
|
69
71
|
]);
|
|
70
|
-
const renderError = useMemo(
|
|
72
|
+
const renderError = useMemo(()=>{
|
|
71
73
|
if (isInvalidProp && errorMessage) {
|
|
72
74
|
setIsInvalid(true);
|
|
73
75
|
return errorMessage;
|
|
@@ -80,7 +82,7 @@ const UXInput = /*#__PURE__*/ forwardRef((props, ref)=>{
|
|
|
80
82
|
isInvalidProp,
|
|
81
83
|
autoErrorMessage
|
|
82
84
|
]);
|
|
83
|
-
const renderContent =
|
|
85
|
+
const renderContent = (content)=>{
|
|
84
86
|
if (!content) return null;
|
|
85
87
|
if ('object' == typeof content) return content;
|
|
86
88
|
return /*#__PURE__*/ jsx(Text, {
|
|
@@ -1,8 +1,10 @@
|
|
|
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 { HStack, Text, VStack } from "../index.js";
|
|
5
4
|
import { useColors } from "../../hooks/index.js";
|
|
5
|
+
import { HStack } from "../layout/HStack.js";
|
|
6
|
+
import { VStack } from "../layout/VStack.js";
|
|
7
|
+
import { Text } from "../Text/index.js";
|
|
6
8
|
import { useStyles } from "./styles.js";
|
|
7
9
|
const UXNumberInput = /*#__PURE__*/ forwardRef((props, ref)=>{
|
|
8
10
|
const { containerStyle, wrapperStyle, inputStyle, value: controlledValue, defaultValue, errorMessage, minValue, maxValue, formatOptions, startContent, endContent, isRequired, isReadOnly, isDisabled, isInvalid: isInvalidProp, autoErrorMessage, allowNegative, label, onChangeText, onValueChange, onFocus, onBlur, ...restProps } = props;
|
|
@@ -157,7 +159,7 @@ const UXNumberInput = /*#__PURE__*/ forwardRef((props, ref)=>{
|
|
|
157
159
|
isFocused,
|
|
158
160
|
formatOptions
|
|
159
161
|
]);
|
|
160
|
-
const renderError = useMemo(
|
|
162
|
+
const renderError = useMemo(()=>{
|
|
161
163
|
if (isInvalidProp && errorMessage) {
|
|
162
164
|
setIsInvalid(true);
|
|
163
165
|
return errorMessage;
|
|
@@ -176,7 +178,7 @@ const UXNumberInput = /*#__PURE__*/ forwardRef((props, ref)=>{
|
|
|
176
178
|
}, [
|
|
177
179
|
allowNegative
|
|
178
180
|
]);
|
|
179
|
-
const renderContent =
|
|
181
|
+
const renderContent = (content)=>{
|
|
180
182
|
if (!content) return null;
|
|
181
183
|
if ('object' == typeof content) return content;
|
|
182
184
|
return /*#__PURE__*/ jsx(Text, {
|
|
@@ -4,7 +4,7 @@ type UseStylesProps = UXInputCommonProps & {
|
|
|
4
4
|
};
|
|
5
5
|
export declare const useStyles: ({ isInvalid, isDisabled, fullWidth, isFocused, color, size, variant, radius, width: widthProp, textAlign, }: UseStylesProps) => {
|
|
6
6
|
container: {
|
|
7
|
-
width: number |
|
|
7
|
+
width: number | import("react-native").Animated.AnimatedNode | "auto" | `${number}%`;
|
|
8
8
|
height: number;
|
|
9
9
|
borderRadius: number | undefined;
|
|
10
10
|
borderColor: string | undefined;
|
|
@@ -22,7 +22,7 @@ export declare const useStyles: ({ isInvalid, isDisabled, fullWidth, isFocused,
|
|
|
22
22
|
fontSize: number;
|
|
23
23
|
color: string | undefined;
|
|
24
24
|
fontWeight: "500";
|
|
25
|
-
textAlign: "
|
|
25
|
+
textAlign: "right" | "left" | "center";
|
|
26
26
|
};
|
|
27
27
|
clearButton: {
|
|
28
28
|
padding: number;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import type { View } from 'react-native';
|
|
3
|
-
import { type FlexProps } from '
|
|
3
|
+
import { type FlexProps } from './Flex';
|
|
4
4
|
export type CenterProps = Omit<FlexProps, 'justify' | 'align'>;
|
|
5
5
|
export declare const Center: React.ForwardRefExoticComponent<CenterProps & React.RefAttributes<View>>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
2
|
import { forwardRef } from "react";
|
|
3
|
-
import { Flex } from "
|
|
3
|
+
import { Flex } from "./Flex/index.js";
|
|
4
4
|
const Center = /*#__PURE__*/ forwardRef((props, ref)=>/*#__PURE__*/ jsx(Flex, {
|
|
5
5
|
ref: ref,
|
|
6
6
|
center: true,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import type { View } from 'react-native';
|
|
3
|
-
import { type SquareProps } from '
|
|
3
|
+
import { type SquareProps } from './Square';
|
|
4
4
|
export type CircleProps = SquareProps;
|
|
5
|
-
export declare const Circle: React.ForwardRefExoticComponent<Omit<import("
|
|
5
|
+
export declare const Circle: React.ForwardRefExoticComponent<Omit<import("./Center").CenterProps, "h" | "w"> & {
|
|
6
6
|
size?: number;
|
|
7
7
|
} & React.RefAttributes<View>>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
2
|
import { forwardRef } from "react";
|
|
3
|
-
import { Square } from "
|
|
3
|
+
import { Square } from "./Square.js";
|
|
4
4
|
const Circle = /*#__PURE__*/ forwardRef((props, ref)=>{
|
|
5
5
|
const { size, ...restProps } = props;
|
|
6
6
|
return /*#__PURE__*/ jsx(Square, {
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { UseBoxProps } from '../Box';
|
|
2
|
+
import type { UseFlexProps } from './useFlex.type';
|
|
2
3
|
export declare const useFlexBoxStyle: (props: UseFlexProps & UseBoxProps) => {
|
|
3
4
|
backfaceVisibility?: "visible" | "hidden" | undefined;
|
|
4
5
|
backgroundColor?: import("react-native").ColorValue | undefined;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { useBoxStyle
|
|
1
|
+
import { useBoxStyle } from "../Box/useBox.style.js";
|
|
2
|
+
import { useFlexStyle } from "./useFlex.style.js";
|
|
2
3
|
const useFlexBoxStyle = (props)=>{
|
|
3
4
|
const { fill, vertical, gap, inline, center, direction = 'row', justify, items, self, content, wrap, basis, grow, shrink, ...boxProps } = props;
|
|
4
5
|
const flexStyle = useFlexStyle({
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import type { View } from 'react-native';
|
|
3
|
-
import { type FlexProps } from '
|
|
3
|
+
import { type FlexProps } from './Flex';
|
|
4
4
|
export type HStackProps = Omit<FlexProps, 'direction' | 'vertical' | 'inline'>;
|
|
5
5
|
export declare const HStack: React.ForwardRefExoticComponent<HStackProps & React.RefAttributes<View>>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
2
|
import { forwardRef } from "react";
|
|
3
|
-
import { Flex } from "
|
|
3
|
+
import { Flex } from "./Flex/index.js";
|
|
4
4
|
const HStack = /*#__PURE__*/ forwardRef((props, ref)=>/*#__PURE__*/ jsx(Flex, {
|
|
5
5
|
ref: ref,
|
|
6
6
|
direction: "row",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
2
|
import { forwardRef } from "react";
|
|
3
|
-
import { Center } from "
|
|
3
|
+
import { Center } from "./Center.js";
|
|
4
4
|
const Square = /*#__PURE__*/ forwardRef((props, ref)=>{
|
|
5
5
|
const { size, ...restProps } = props;
|
|
6
6
|
return /*#__PURE__*/ jsx(Center, {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import type { View } from 'react-native';
|
|
3
|
-
import { type FlexProps } from '
|
|
3
|
+
import { type FlexProps } from './Flex';
|
|
4
4
|
export type VStackProps = Omit<FlexProps, 'direction' | 'vertical' | 'inline'>;
|
|
5
5
|
export declare const VStack: React.ForwardRefExoticComponent<VStackProps & React.RefAttributes<View>>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
2
|
import { forwardRef } from "react";
|
|
3
|
-
import { Flex } from "
|
|
3
|
+
import { Flex } from "./Flex/index.js";
|
|
4
4
|
const VStack = /*#__PURE__*/ forwardRef((props, ref)=>{
|
|
5
5
|
const { items = 'stretch', ...restProps } = props;
|
|
6
6
|
return /*#__PURE__*/ jsx(Flex, {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@particle-network/ui-native",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.6",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"main": "./entry.js",
|
|
6
6
|
"react-native": "./dist/index.js",
|
|
@@ -50,7 +50,10 @@
|
|
|
50
50
|
],
|
|
51
51
|
"author": "UniversalX",
|
|
52
52
|
"dependencies": {
|
|
53
|
-
"@particle-network/ui-shared": "*"
|
|
53
|
+
"@particle-network/ui-shared": "*",
|
|
54
|
+
"ahooks": "^3.9.4",
|
|
55
|
+
"expo-haptics": "^14.1.4",
|
|
56
|
+
"react-native-size-matters": "^0.4.2"
|
|
54
57
|
},
|
|
55
58
|
"devDependencies": {
|
|
56
59
|
"@babel/core": "^7.24.0",
|
|
@@ -74,13 +77,11 @@
|
|
|
74
77
|
"@storybook/react-native": "^9",
|
|
75
78
|
"@storybook/react-native-web-vite": "^9",
|
|
76
79
|
"@types/react": "~19.0.10",
|
|
77
|
-
"ahooks": "^3.9.4",
|
|
78
80
|
"babel-plugin-module-resolver": "^5.0.2",
|
|
79
81
|
"babel-plugin-react-docgen-typescript": "^1.5.1",
|
|
80
82
|
"cross-env": "^7.0.3",
|
|
81
83
|
"expo": "~53.0.22",
|
|
82
84
|
"expo-constants": "~17.1.6",
|
|
83
|
-
"expo-haptics": "^14.1.4",
|
|
84
85
|
"expo-status-bar": "~2.2.3",
|
|
85
86
|
"lucide-react-native": "^0.541.0",
|
|
86
87
|
"react": "19.0.0",
|
|
@@ -90,11 +91,11 @@
|
|
|
90
91
|
"react-native-paper": "^5.14.5",
|
|
91
92
|
"react-native-reanimated": "~3.17.4",
|
|
92
93
|
"react-native-safe-area-context": "5.4.0",
|
|
93
|
-
"react-native-size-matters": "^0.4.2",
|
|
94
94
|
"react-native-svg": "15.11.2",
|
|
95
95
|
"react-native-web": "^0.20.0",
|
|
96
96
|
"storybook": "^9",
|
|
97
97
|
"typescript": "~5.8.3",
|
|
98
|
+
"unfetch": "^4.2.0",
|
|
98
99
|
"vite": "^6.3.5"
|
|
99
100
|
},
|
|
100
101
|
"resolutions": {
|