react-native-sj-ui 0.1.0 → 0.1.3
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/lib/module/components/Button.js +104 -0
- package/lib/module/components/Button.js.map +1 -0
- package/lib/module/components/Column.js +13 -0
- package/lib/module/components/Column.js.map +1 -0
- package/lib/module/components/Flex.js +37 -0
- package/lib/module/components/Flex.js.map +1 -0
- package/lib/module/components/Row.js +13 -0
- package/lib/module/components/Row.js.map +1 -0
- package/lib/module/components/index.js +10 -0
- package/lib/module/components/index.js.map +1 -0
- package/lib/module/index.js +2 -6
- package/lib/module/index.js.map +1 -1
- package/lib/typescript/src/components/Button.d.ts +20 -0
- package/lib/typescript/src/components/Button.d.ts.map +1 -0
- package/lib/typescript/src/components/Column.d.ts +7 -0
- package/lib/typescript/src/components/Column.d.ts.map +1 -0
- package/lib/typescript/src/components/Flex.d.ts +19 -0
- package/lib/typescript/src/components/Flex.d.ts.map +1 -0
- package/lib/typescript/src/components/Row.d.ts +7 -0
- package/lib/typescript/src/components/Row.d.ts.map +1 -0
- package/lib/typescript/src/components/index.d.ts +8 -0
- package/lib/typescript/src/components/index.d.ts.map +1 -0
- package/lib/typescript/src/index.d.ts +2 -6
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/components/Button.tsx +162 -0
- package/src/components/Column.tsx +12 -0
- package/src/components/Flex.tsx +71 -0
- package/src/components/Row.tsx +12 -0
- package/src/components/index.ts +8 -0
- package/src/index.tsx +2 -6
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { ActivityIndicator, TouchableOpacity } from 'react-native';
|
|
4
|
+
import ViewCard from "./ViewCard.js";
|
|
5
|
+
import TextView from "./TextView.js";
|
|
6
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
7
|
+
const COLORS = {
|
|
8
|
+
primary: '#2563EB',
|
|
9
|
+
secondary: '#6B7280',
|
|
10
|
+
success: '#16A34A',
|
|
11
|
+
danger: '#DC2626',
|
|
12
|
+
warning: '#D97706',
|
|
13
|
+
info: '#0891B2'
|
|
14
|
+
};
|
|
15
|
+
const Button = ({
|
|
16
|
+
title,
|
|
17
|
+
children,
|
|
18
|
+
variant = 'solid',
|
|
19
|
+
colorScheme = 'primary',
|
|
20
|
+
size = 'md',
|
|
21
|
+
loading = false,
|
|
22
|
+
disabled = false,
|
|
23
|
+
leftIcon,
|
|
24
|
+
rightIcon,
|
|
25
|
+
fullWidth = false,
|
|
26
|
+
borderRadius = 8,
|
|
27
|
+
onPress,
|
|
28
|
+
...props
|
|
29
|
+
}) => {
|
|
30
|
+
const color = COLORS[colorScheme];
|
|
31
|
+
const sizeStyle = {
|
|
32
|
+
sm: {
|
|
33
|
+
paddingVertical: 8,
|
|
34
|
+
paddingHorizontal: 12,
|
|
35
|
+
fontSize: 14
|
|
36
|
+
},
|
|
37
|
+
md: {
|
|
38
|
+
paddingVertical: 12,
|
|
39
|
+
paddingHorizontal: 16,
|
|
40
|
+
fontSize: 16
|
|
41
|
+
},
|
|
42
|
+
lg: {
|
|
43
|
+
paddingVertical: 16,
|
|
44
|
+
paddingHorizontal: 20,
|
|
45
|
+
fontSize: 18
|
|
46
|
+
}
|
|
47
|
+
}[size];
|
|
48
|
+
let backgroundColor = color;
|
|
49
|
+
let borderColor = color;
|
|
50
|
+
let borderWidth = 0;
|
|
51
|
+
let textColor = '#fff';
|
|
52
|
+
switch (variant) {
|
|
53
|
+
case 'outline':
|
|
54
|
+
backgroundColor = 'transparent';
|
|
55
|
+
borderColor = color;
|
|
56
|
+
borderWidth = 1;
|
|
57
|
+
textColor = color;
|
|
58
|
+
break;
|
|
59
|
+
case 'ghost':
|
|
60
|
+
backgroundColor = 'transparent';
|
|
61
|
+
borderColor = 'transparent';
|
|
62
|
+
borderWidth = 0;
|
|
63
|
+
textColor = color;
|
|
64
|
+
break;
|
|
65
|
+
}
|
|
66
|
+
if (disabled) {
|
|
67
|
+
backgroundColor = '#D1D5DB';
|
|
68
|
+
borderColor = '#D1D5DB';
|
|
69
|
+
textColor = '#6B7280';
|
|
70
|
+
}
|
|
71
|
+
return /*#__PURE__*/_jsx(TouchableOpacity, {
|
|
72
|
+
...props,
|
|
73
|
+
activeOpacity: 0.8,
|
|
74
|
+
disabled: disabled || loading,
|
|
75
|
+
onPress: onPress,
|
|
76
|
+
children: /*#__PURE__*/_jsx(ViewCard, {
|
|
77
|
+
flexDirection: "row",
|
|
78
|
+
alignItems: "center",
|
|
79
|
+
justifyContent: "center",
|
|
80
|
+
gap: 8,
|
|
81
|
+
width: fullWidth ? '100%' : undefined,
|
|
82
|
+
paddingVertical: sizeStyle.paddingVertical,
|
|
83
|
+
paddingHorizontal: sizeStyle.paddingHorizontal,
|
|
84
|
+
borderRadius: borderRadius,
|
|
85
|
+
backgroundColor: backgroundColor,
|
|
86
|
+
borderColor: borderColor,
|
|
87
|
+
borderWidth: borderWidth,
|
|
88
|
+
opacity: disabled ? 0.6 : 1,
|
|
89
|
+
children: loading ? /*#__PURE__*/_jsx(ActivityIndicator, {
|
|
90
|
+
color: variant === 'solid' ? '#fff' : color,
|
|
91
|
+
size: "small"
|
|
92
|
+
}) : /*#__PURE__*/_jsxs(_Fragment, {
|
|
93
|
+
children: [leftIcon, title && /*#__PURE__*/_jsx(TextView, {
|
|
94
|
+
textColor: textColor,
|
|
95
|
+
fontWeight: "600",
|
|
96
|
+
fontSize: sizeStyle.fontSize,
|
|
97
|
+
children: title
|
|
98
|
+
}), children, rightIcon]
|
|
99
|
+
})
|
|
100
|
+
})
|
|
101
|
+
});
|
|
102
|
+
};
|
|
103
|
+
export default Button;
|
|
104
|
+
//# sourceMappingURL=Button.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["ActivityIndicator","TouchableOpacity","ViewCard","TextView","jsx","_jsx","Fragment","_Fragment","jsxs","_jsxs","COLORS","primary","secondary","success","danger","warning","info","Button","title","children","variant","colorScheme","size","loading","disabled","leftIcon","rightIcon","fullWidth","borderRadius","onPress","props","color","sizeStyle","sm","paddingVertical","paddingHorizontal","fontSize","md","lg","backgroundColor","borderColor","borderWidth","textColor","activeOpacity","flexDirection","alignItems","justifyContent","gap","width","undefined","opacity","fontWeight"],"sourceRoot":"../../../src","sources":["components/Button.tsx"],"mappings":"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","ignoreList":[]}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import React from 'react';
|
|
4
|
+
import Flex from "./Flex.js";
|
|
5
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
6
|
+
const Column = props => {
|
|
7
|
+
return /*#__PURE__*/_jsx(Flex, {
|
|
8
|
+
direction: "column",
|
|
9
|
+
...props
|
|
10
|
+
});
|
|
11
|
+
};
|
|
12
|
+
export default Column;
|
|
13
|
+
//# sourceMappingURL=Column.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["React","Flex","jsx","_jsx","Column","props","direction"],"sourceRoot":"../../../src","sources":["components/Column.tsx"],"mappings":";;AAAA,OAAOA,KAAK,MAAM,OAAO;AAGzB,OAAOC,IAAI,MAAM,WAAQ;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAI1B,MAAMC,MAA6B,GAAIC,KAAK,IAAK;EAC/C,oBAAOF,IAAA,CAACF,IAAI;IAACK,SAAS,EAAC,QAAQ;IAAA,GAAKD;EAAK,CAAG,CAAC;AAC/C,CAAC;AAED,eAAeD,MAAM","ignoreList":[]}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import React from 'react';
|
|
4
|
+
import { View } from 'react-native';
|
|
5
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
6
|
+
const Flex = ({
|
|
7
|
+
children,
|
|
8
|
+
direction = 'column',
|
|
9
|
+
flex,
|
|
10
|
+
flexGrow,
|
|
11
|
+
flexShrink,
|
|
12
|
+
flexWrap,
|
|
13
|
+
gap,
|
|
14
|
+
justifyContent = 'flex-start',
|
|
15
|
+
alignItems = 'stretch',
|
|
16
|
+
alignSelf,
|
|
17
|
+
style,
|
|
18
|
+
...rest
|
|
19
|
+
}) => {
|
|
20
|
+
return /*#__PURE__*/_jsx(View, {
|
|
21
|
+
...rest,
|
|
22
|
+
style: [{
|
|
23
|
+
flexDirection: direction,
|
|
24
|
+
flex,
|
|
25
|
+
flexGrow,
|
|
26
|
+
flexShrink,
|
|
27
|
+
flexWrap,
|
|
28
|
+
gap,
|
|
29
|
+
justifyContent,
|
|
30
|
+
alignItems,
|
|
31
|
+
alignSelf
|
|
32
|
+
}, style],
|
|
33
|
+
children: children
|
|
34
|
+
});
|
|
35
|
+
};
|
|
36
|
+
export default Flex;
|
|
37
|
+
//# sourceMappingURL=Flex.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["React","View","jsx","_jsx","Flex","children","direction","flex","flexGrow","flexShrink","flexWrap","gap","justifyContent","alignItems","alignSelf","style","rest","flexDirection"],"sourceRoot":"../../../src","sources":["components/Flex.tsx"],"mappings":";;AAAA,OAAOA,KAAK,MAAM,OAAO;AAIzB,SAASC,IAAI,QAAQ,cAAc;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAqBpC,MAAMC,IAAyB,GAAGA,CAAC;EACjCC,QAAQ;EAERC,SAAS,GAAG,QAAQ;EAEpBC,IAAI;EACJC,QAAQ;EACRC,UAAU;EACVC,QAAQ;EAERC,GAAG;EAEHC,cAAc,GAAG,YAAY;EAC7BC,UAAU,GAAG,SAAS;EACtBC,SAAS;EAETC,KAAK;EACL,GAAGC;AACL,CAAC,KAAK;EACJ,oBACEb,IAAA,CAACF,IAAI;IAAA,GACCe,IAAI;IACRD,KAAK,EAAE,CACL;MACEE,aAAa,EAAEX,SAAS;MAExBC,IAAI;MACJC,QAAQ;MACRC,UAAU;MACVC,QAAQ;MAERC,GAAG;MAEHC,cAAc;MACdC,UAAU;MACVC;IACF,CAAC,EACDC,KAAK,CACL;IAAAV,QAAA,EAEDA;EAAQ,CACL,CAAC;AAEX,CAAC;AAED,eAAeD,IAAI","ignoreList":[]}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import React from 'react';
|
|
4
|
+
import Flex from "./Flex.js";
|
|
5
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
6
|
+
const Row = props => {
|
|
7
|
+
return /*#__PURE__*/_jsx(Flex, {
|
|
8
|
+
direction: "row",
|
|
9
|
+
...props
|
|
10
|
+
});
|
|
11
|
+
};
|
|
12
|
+
export default Row;
|
|
13
|
+
//# sourceMappingURL=Row.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["React","Flex","jsx","_jsx","Row","props","direction"],"sourceRoot":"../../../src","sources":["components/Row.tsx"],"mappings":";;AAAA,OAAOA,KAAK,MAAM,OAAO;AAGzB,OAAOC,IAAI,MAAM,WAAQ;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAI1B,MAAMC,GAAuB,GAAIC,KAAK,IAAK;EACzC,oBAAOF,IAAA,CAACF,IAAI;IAACK,SAAS,EAAC,KAAK;IAAA,GAAKD;EAAK,CAAG,CAAC;AAC5C,CAAC;AAED,eAAeD,GAAG","ignoreList":[]}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import Column from "./Column.js";
|
|
4
|
+
import Flex from "./Flex.js";
|
|
5
|
+
import Row from "./Row.js";
|
|
6
|
+
import TextView from "./TextView.js";
|
|
7
|
+
import ViewCard from "./ViewCard.js";
|
|
8
|
+
import Button from "./Button.js";
|
|
9
|
+
export { Column, Flex, Row, TextView, ViewCard, Button };
|
|
10
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["Column","Flex","Row","TextView","ViewCard","Button"],"sourceRoot":"../../../src","sources":["components/index.ts"],"mappings":";;AAAA,OAAOA,MAAM,MAAM,aAAU;AAC7B,OAAOC,IAAI,MAAM,WAAQ;AACzB,OAAOC,GAAG,MAAM,UAAO;AACvB,OAAOC,QAAQ,MAAM,eAAY;AACjC,OAAOC,QAAQ,MAAM,eAAY;AACjC,OAAOC,MAAM,MAAM,aAAU;AAE7B,SAASL,MAAM,EAAEC,IAAI,EAAEC,GAAG,EAAEC,QAAQ,EAAEC,QAAQ,EAAEC,MAAM","ignoreList":[]}
|
package/lib/module/index.js
CHANGED
|
@@ -1,9 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
import ViewCard from "./components/ViewCard.js";
|
|
6
|
-
export { TextView };
|
|
7
|
-
export { SjUiProvider };
|
|
8
|
-
export { ViewCard };
|
|
3
|
+
export { SjUiProvider } from "./provider/UIProvider.js";
|
|
4
|
+
export { TextView, ViewCard, Row, Column, Flex } from "./components/index.js";
|
|
9
5
|
//# sourceMappingURL=index.js.map
|
package/lib/module/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["SjUiProvider","TextView","ViewCard"],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":";;AAAA,SAASA,YAAY,QAAQ,0BAAuB;
|
|
1
|
+
{"version":3,"names":["SjUiProvider","TextView","ViewCard","Row","Column","Flex"],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":";;AAAA,SAASA,YAAY,QAAQ,0BAAuB;AAEpD,SAASC,QAAQ,EAAEC,QAAQ,EAAEC,GAAG,EAAEC,MAAM,EAAEC,IAAI,QAAQ,uBAAc","ignoreList":[]}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { type TouchableOpacityProps } from 'react-native';
|
|
2
|
+
type ButtonVariant = 'solid' | 'outline' | 'ghost';
|
|
3
|
+
type ButtonColorScheme = 'primary' | 'secondary' | 'success' | 'danger' | 'warning' | 'info';
|
|
4
|
+
type ButtonSize = 'sm' | 'md' | 'lg';
|
|
5
|
+
interface ButtonProps extends TouchableOpacityProps {
|
|
6
|
+
title?: string;
|
|
7
|
+
children?: React.ReactNode;
|
|
8
|
+
variant?: ButtonVariant;
|
|
9
|
+
colorScheme?: ButtonColorScheme;
|
|
10
|
+
size?: ButtonSize;
|
|
11
|
+
loading?: boolean;
|
|
12
|
+
leftIcon?: React.ReactNode;
|
|
13
|
+
rightIcon?: React.ReactNode;
|
|
14
|
+
fullWidth?: boolean;
|
|
15
|
+
borderRadius?: number;
|
|
16
|
+
onPress?: () => void;
|
|
17
|
+
}
|
|
18
|
+
declare const Button: React.FC<ButtonProps>;
|
|
19
|
+
export default Button;
|
|
20
|
+
//# sourceMappingURL=Button.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Button.d.ts","sourceRoot":"","sources":["../../../../src/components/Button.tsx"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,qBAAqB,EAC3B,MAAM,cAAc,CAAC;AAItB,KAAK,aAAa,GAAG,OAAO,GAAG,SAAS,GAAG,OAAO,CAAC;AAEnD,KAAK,iBAAiB,GAClB,SAAS,GACT,WAAW,GACX,SAAS,GACT,QAAQ,GACR,SAAS,GACT,MAAM,CAAC;AAEX,KAAK,UAAU,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;AAErC,UAAU,WAAY,SAAQ,qBAAqB;IACjD,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAE3B,OAAO,CAAC,EAAE,aAAa,CAAC;IACxB,WAAW,CAAC,EAAE,iBAAiB,CAAC;IAChC,IAAI,CAAC,EAAE,UAAU,CAAC;IAElB,OAAO,CAAC,EAAE,OAAO,CAAC;IAElB,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B,SAAS,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAE5B,SAAS,CAAC,EAAE,OAAO,CAAC;IAEpB,YAAY,CAAC,EAAE,MAAM,CAAC;IAEtB,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;CACtB;AAWD,QAAA,MAAM,MAAM,EAAE,KAAK,CAAC,EAAE,CAAC,WAAW,CA8GjC,CAAC;AAEF,eAAe,MAAM,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { ComponentProps } from 'react';
|
|
3
|
+
import Flex from './Flex.js';
|
|
4
|
+
type ColumnProps = Omit<ComponentProps<typeof Flex>, 'direction'>;
|
|
5
|
+
declare const Column: React.FC<ColumnProps>;
|
|
6
|
+
export default Column;
|
|
7
|
+
//# sourceMappingURL=Column.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Column.d.ts","sourceRoot":"","sources":["../../../../src/components/Column.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAE5C,OAAO,IAAI,MAAM,WAAQ,CAAC;AAE1B,KAAK,WAAW,GAAG,IAAI,CAAC,cAAc,CAAC,OAAO,IAAI,CAAC,EAAE,WAAW,CAAC,CAAC;AAElE,QAAA,MAAM,MAAM,EAAE,KAAK,CAAC,EAAE,CAAC,WAAW,CAEjC,CAAC;AAEF,eAAe,MAAM,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { ReactNode } from 'react';
|
|
3
|
+
import type { ViewProps, ViewStyle, StyleProp } from 'react-native';
|
|
4
|
+
interface FlexProps extends ViewProps {
|
|
5
|
+
children?: ReactNode;
|
|
6
|
+
direction?: ViewStyle['flexDirection'];
|
|
7
|
+
flex?: ViewStyle['flex'];
|
|
8
|
+
flexGrow?: ViewStyle['flexGrow'];
|
|
9
|
+
flexShrink?: ViewStyle['flexShrink'];
|
|
10
|
+
flexWrap?: ViewStyle['flexWrap'];
|
|
11
|
+
gap?: ViewStyle['gap'];
|
|
12
|
+
justifyContent?: ViewStyle['justifyContent'];
|
|
13
|
+
alignItems?: ViewStyle['alignItems'];
|
|
14
|
+
alignSelf?: ViewStyle['alignSelf'];
|
|
15
|
+
style?: StyleProp<ViewStyle>;
|
|
16
|
+
}
|
|
17
|
+
declare const Flex: React.FC<FlexProps>;
|
|
18
|
+
export default Flex;
|
|
19
|
+
//# sourceMappingURL=Flex.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Flex.d.ts","sourceRoot":"","sources":["../../../../src/components/Flex.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAIpE,UAAU,SAAU,SAAQ,SAAS;IACnC,QAAQ,CAAC,EAAE,SAAS,CAAC;IAErB,SAAS,CAAC,EAAE,SAAS,CAAC,eAAe,CAAC,CAAC;IAEvC,IAAI,CAAC,EAAE,SAAS,CAAC,MAAM,CAAC,CAAC;IACzB,QAAQ,CAAC,EAAE,SAAS,CAAC,UAAU,CAAC,CAAC;IACjC,UAAU,CAAC,EAAE,SAAS,CAAC,YAAY,CAAC,CAAC;IACrC,QAAQ,CAAC,EAAE,SAAS,CAAC,UAAU,CAAC,CAAC;IAEjC,GAAG,CAAC,EAAE,SAAS,CAAC,KAAK,CAAC,CAAC;IAEvB,cAAc,CAAC,EAAE,SAAS,CAAC,gBAAgB,CAAC,CAAC;IAC7C,UAAU,CAAC,EAAE,SAAS,CAAC,YAAY,CAAC,CAAC;IACrC,SAAS,CAAC,EAAE,SAAS,CAAC,WAAW,CAAC,CAAC;IAEnC,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;CAC9B;AAED,QAAA,MAAM,IAAI,EAAE,KAAK,CAAC,EAAE,CAAC,SAAS,CA2C7B,CAAC;AAEF,eAAe,IAAI,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { ComponentProps } from 'react';
|
|
3
|
+
import Flex from './Flex.js';
|
|
4
|
+
type RowProps = Omit<ComponentProps<typeof Flex>, 'direction'>;
|
|
5
|
+
declare const Row: React.FC<RowProps>;
|
|
6
|
+
export default Row;
|
|
7
|
+
//# sourceMappingURL=Row.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Row.d.ts","sourceRoot":"","sources":["../../../../src/components/Row.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAE5C,OAAO,IAAI,MAAM,WAAQ,CAAC;AAE1B,KAAK,QAAQ,GAAG,IAAI,CAAC,cAAc,CAAC,OAAO,IAAI,CAAC,EAAE,WAAW,CAAC,CAAC;AAE/D,QAAA,MAAM,GAAG,EAAE,KAAK,CAAC,EAAE,CAAC,QAAQ,CAE3B,CAAC;AAEF,eAAe,GAAG,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import Column from './Column.js';
|
|
2
|
+
import Flex from './Flex.js';
|
|
3
|
+
import Row from './Row.js';
|
|
4
|
+
import TextView from './TextView.js';
|
|
5
|
+
import ViewCard from './ViewCard.js';
|
|
6
|
+
import Button from './Button.js';
|
|
7
|
+
export { Column, Flex, Row, TextView, ViewCard, Button };
|
|
8
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/index.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,aAAU,CAAC;AAC9B,OAAO,IAAI,MAAM,WAAQ,CAAC;AAC1B,OAAO,GAAG,MAAM,UAAO,CAAC;AACxB,OAAO,QAAQ,MAAM,eAAY,CAAC;AAClC,OAAO,QAAQ,MAAM,eAAY,CAAC;AAClC,OAAO,MAAM,MAAM,aAAU,CAAC;AAE9B,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,EAAE,CAAC"}
|
|
@@ -1,7 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import ViewCard from './components/ViewCard.js';
|
|
4
|
-
export { TextView };
|
|
5
|
-
export { SjUiProvider };
|
|
6
|
-
export { ViewCard };
|
|
1
|
+
export { SjUiProvider } from './provider/UIProvider.js';
|
|
2
|
+
export { TextView, ViewCard, Row, Column, Flex } from './components/index.js';
|
|
7
3
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,0BAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,0BAAuB,CAAC;AAErD,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,uBAAc,CAAC"}
|
package/package.json
CHANGED
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
import {
|
|
2
|
+
ActivityIndicator,
|
|
3
|
+
TouchableOpacity,
|
|
4
|
+
type TouchableOpacityProps,
|
|
5
|
+
} from 'react-native';
|
|
6
|
+
import ViewCard from './ViewCard';
|
|
7
|
+
import TextView from './TextView';
|
|
8
|
+
|
|
9
|
+
type ButtonVariant = 'solid' | 'outline' | 'ghost';
|
|
10
|
+
|
|
11
|
+
type ButtonColorScheme =
|
|
12
|
+
| 'primary'
|
|
13
|
+
| 'secondary'
|
|
14
|
+
| 'success'
|
|
15
|
+
| 'danger'
|
|
16
|
+
| 'warning'
|
|
17
|
+
| 'info';
|
|
18
|
+
|
|
19
|
+
type ButtonSize = 'sm' | 'md' | 'lg';
|
|
20
|
+
|
|
21
|
+
interface ButtonProps extends TouchableOpacityProps {
|
|
22
|
+
title?: string;
|
|
23
|
+
children?: React.ReactNode;
|
|
24
|
+
|
|
25
|
+
variant?: ButtonVariant;
|
|
26
|
+
colorScheme?: ButtonColorScheme;
|
|
27
|
+
size?: ButtonSize;
|
|
28
|
+
|
|
29
|
+
loading?: boolean;
|
|
30
|
+
|
|
31
|
+
leftIcon?: React.ReactNode;
|
|
32
|
+
rightIcon?: React.ReactNode;
|
|
33
|
+
|
|
34
|
+
fullWidth?: boolean;
|
|
35
|
+
|
|
36
|
+
borderRadius?: number;
|
|
37
|
+
|
|
38
|
+
onPress?: () => void;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
const COLORS = {
|
|
42
|
+
primary: '#2563EB',
|
|
43
|
+
secondary: '#6B7280',
|
|
44
|
+
success: '#16A34A',
|
|
45
|
+
danger: '#DC2626',
|
|
46
|
+
warning: '#D97706',
|
|
47
|
+
info: '#0891B2',
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
const Button: React.FC<ButtonProps> = ({
|
|
51
|
+
title,
|
|
52
|
+
children,
|
|
53
|
+
variant = 'solid',
|
|
54
|
+
colorScheme = 'primary',
|
|
55
|
+
size = 'md',
|
|
56
|
+
loading = false,
|
|
57
|
+
disabled = false,
|
|
58
|
+
leftIcon,
|
|
59
|
+
rightIcon,
|
|
60
|
+
fullWidth = false,
|
|
61
|
+
borderRadius = 8,
|
|
62
|
+
onPress,
|
|
63
|
+
...props
|
|
64
|
+
}) => {
|
|
65
|
+
const color = COLORS[colorScheme];
|
|
66
|
+
|
|
67
|
+
const sizeStyle = {
|
|
68
|
+
sm: {
|
|
69
|
+
paddingVertical: 8,
|
|
70
|
+
paddingHorizontal: 12,
|
|
71
|
+
fontSize: 14,
|
|
72
|
+
},
|
|
73
|
+
md: {
|
|
74
|
+
paddingVertical: 12,
|
|
75
|
+
paddingHorizontal: 16,
|
|
76
|
+
fontSize: 16,
|
|
77
|
+
},
|
|
78
|
+
lg: {
|
|
79
|
+
paddingVertical: 16,
|
|
80
|
+
paddingHorizontal: 20,
|
|
81
|
+
fontSize: 18,
|
|
82
|
+
},
|
|
83
|
+
}[size];
|
|
84
|
+
|
|
85
|
+
let backgroundColor = color;
|
|
86
|
+
let borderColor = color;
|
|
87
|
+
let borderWidth = 0;
|
|
88
|
+
let textColor = '#fff';
|
|
89
|
+
|
|
90
|
+
switch (variant) {
|
|
91
|
+
case 'outline':
|
|
92
|
+
backgroundColor = 'transparent';
|
|
93
|
+
borderColor = color;
|
|
94
|
+
borderWidth = 1;
|
|
95
|
+
textColor = color;
|
|
96
|
+
break;
|
|
97
|
+
|
|
98
|
+
case 'ghost':
|
|
99
|
+
backgroundColor = 'transparent';
|
|
100
|
+
borderColor = 'transparent';
|
|
101
|
+
borderWidth = 0;
|
|
102
|
+
textColor = color;
|
|
103
|
+
break;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
if (disabled) {
|
|
107
|
+
backgroundColor = '#D1D5DB';
|
|
108
|
+
borderColor = '#D1D5DB';
|
|
109
|
+
textColor = '#6B7280';
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
return (
|
|
113
|
+
<TouchableOpacity
|
|
114
|
+
{...props}
|
|
115
|
+
activeOpacity={0.8}
|
|
116
|
+
disabled={disabled || loading}
|
|
117
|
+
onPress={onPress}
|
|
118
|
+
>
|
|
119
|
+
<ViewCard
|
|
120
|
+
flexDirection="row"
|
|
121
|
+
alignItems="center"
|
|
122
|
+
justifyContent="center"
|
|
123
|
+
gap={8}
|
|
124
|
+
width={fullWidth ? '100%' : undefined}
|
|
125
|
+
paddingVertical={sizeStyle.paddingVertical}
|
|
126
|
+
paddingHorizontal={sizeStyle.paddingHorizontal}
|
|
127
|
+
borderRadius={borderRadius}
|
|
128
|
+
backgroundColor={backgroundColor}
|
|
129
|
+
borderColor={borderColor}
|
|
130
|
+
borderWidth={borderWidth}
|
|
131
|
+
opacity={disabled ? 0.6 : 1}
|
|
132
|
+
>
|
|
133
|
+
{loading ? (
|
|
134
|
+
<ActivityIndicator
|
|
135
|
+
color={variant === 'solid' ? '#fff' : color}
|
|
136
|
+
size="small"
|
|
137
|
+
/>
|
|
138
|
+
) : (
|
|
139
|
+
<>
|
|
140
|
+
{leftIcon}
|
|
141
|
+
|
|
142
|
+
{title && (
|
|
143
|
+
<TextView
|
|
144
|
+
textColor={textColor}
|
|
145
|
+
fontWeight="600"
|
|
146
|
+
fontSize={sizeStyle.fontSize}
|
|
147
|
+
>
|
|
148
|
+
{title}
|
|
149
|
+
</TextView>
|
|
150
|
+
)}
|
|
151
|
+
|
|
152
|
+
{children}
|
|
153
|
+
|
|
154
|
+
{rightIcon}
|
|
155
|
+
</>
|
|
156
|
+
)}
|
|
157
|
+
</ViewCard>
|
|
158
|
+
</TouchableOpacity>
|
|
159
|
+
);
|
|
160
|
+
};
|
|
161
|
+
|
|
162
|
+
export default Button;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { ComponentProps } from 'react';
|
|
3
|
+
|
|
4
|
+
import Flex from './Flex';
|
|
5
|
+
|
|
6
|
+
type ColumnProps = Omit<ComponentProps<typeof Flex>, 'direction'>;
|
|
7
|
+
|
|
8
|
+
const Column: React.FC<ColumnProps> = (props) => {
|
|
9
|
+
return <Flex direction="column" {...props} />;
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
export default Column;
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { ReactNode } from 'react';
|
|
3
|
+
import type { ViewProps, ViewStyle, StyleProp } from 'react-native';
|
|
4
|
+
|
|
5
|
+
import { View } from 'react-native';
|
|
6
|
+
|
|
7
|
+
interface FlexProps extends ViewProps {
|
|
8
|
+
children?: ReactNode;
|
|
9
|
+
|
|
10
|
+
direction?: ViewStyle['flexDirection'];
|
|
11
|
+
|
|
12
|
+
flex?: ViewStyle['flex'];
|
|
13
|
+
flexGrow?: ViewStyle['flexGrow'];
|
|
14
|
+
flexShrink?: ViewStyle['flexShrink'];
|
|
15
|
+
flexWrap?: ViewStyle['flexWrap'];
|
|
16
|
+
|
|
17
|
+
gap?: ViewStyle['gap'];
|
|
18
|
+
|
|
19
|
+
justifyContent?: ViewStyle['justifyContent'];
|
|
20
|
+
alignItems?: ViewStyle['alignItems'];
|
|
21
|
+
alignSelf?: ViewStyle['alignSelf'];
|
|
22
|
+
|
|
23
|
+
style?: StyleProp<ViewStyle>;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
const Flex: React.FC<FlexProps> = ({
|
|
27
|
+
children,
|
|
28
|
+
|
|
29
|
+
direction = 'column',
|
|
30
|
+
|
|
31
|
+
flex,
|
|
32
|
+
flexGrow,
|
|
33
|
+
flexShrink,
|
|
34
|
+
flexWrap,
|
|
35
|
+
|
|
36
|
+
gap,
|
|
37
|
+
|
|
38
|
+
justifyContent = 'flex-start',
|
|
39
|
+
alignItems = 'stretch',
|
|
40
|
+
alignSelf,
|
|
41
|
+
|
|
42
|
+
style,
|
|
43
|
+
...rest
|
|
44
|
+
}) => {
|
|
45
|
+
return (
|
|
46
|
+
<View
|
|
47
|
+
{...rest}
|
|
48
|
+
style={[
|
|
49
|
+
{
|
|
50
|
+
flexDirection: direction,
|
|
51
|
+
|
|
52
|
+
flex,
|
|
53
|
+
flexGrow,
|
|
54
|
+
flexShrink,
|
|
55
|
+
flexWrap,
|
|
56
|
+
|
|
57
|
+
gap,
|
|
58
|
+
|
|
59
|
+
justifyContent,
|
|
60
|
+
alignItems,
|
|
61
|
+
alignSelf,
|
|
62
|
+
},
|
|
63
|
+
style,
|
|
64
|
+
]}
|
|
65
|
+
>
|
|
66
|
+
{children}
|
|
67
|
+
</View>
|
|
68
|
+
);
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
export default Flex;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { ComponentProps } from 'react';
|
|
3
|
+
|
|
4
|
+
import Flex from './Flex';
|
|
5
|
+
|
|
6
|
+
type RowProps = Omit<ComponentProps<typeof Flex>, 'direction'>;
|
|
7
|
+
|
|
8
|
+
const Row: React.FC<RowProps> = (props) => {
|
|
9
|
+
return <Flex direction="row" {...props} />;
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
export default Row;
|
package/src/index.tsx
CHANGED
|
@@ -1,7 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
import TextView from './components/TextView';
|
|
3
|
-
import ViewCard from './components/ViewCard';
|
|
1
|
+
export { SjUiProvider } from './provider/UIProvider';
|
|
4
2
|
|
|
5
|
-
export { TextView };
|
|
6
|
-
export { SjUiProvider };
|
|
7
|
-
export { ViewCard };
|
|
3
|
+
export { TextView, ViewCard, Row, Column, Flex } from './components';
|