@lamenna/lxp-native 0.0.1
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.
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { TouchableOpacityProps } from "react-native";
|
|
3
|
+
import { ReactNativeButtonProps } from "@lamenna/lxp-shared-components";
|
|
4
|
+
export type { ReactNativeButtonProps as ButtonProps };
|
|
5
|
+
type Props = ReactNativeButtonProps & Omit<TouchableOpacityProps, "style">;
|
|
6
|
+
export declare const Button: ({ children, variant, size, disabled, testID, onPress, ...rest }: Props) => React.JSX.Element;
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { TouchableOpacity, Text, StyleSheet, } from "react-native";
|
|
3
|
+
export const Button = ({ children, variant = "primary", size = "md", disabled = false, testID, onPress, ...rest }) => {
|
|
4
|
+
const variantStyle = variant === "primary"
|
|
5
|
+
? styles.primaryButton
|
|
6
|
+
: styles.secondaryButton;
|
|
7
|
+
const sizeStyle = size === "sm"
|
|
8
|
+
? styles.small
|
|
9
|
+
: size === "lg"
|
|
10
|
+
? styles.large
|
|
11
|
+
: styles.medium;
|
|
12
|
+
return (<TouchableOpacity style={[
|
|
13
|
+
styles.button,
|
|
14
|
+
variantStyle,
|
|
15
|
+
sizeStyle,
|
|
16
|
+
disabled && styles.disabled,
|
|
17
|
+
]} onPress={onPress} activeOpacity={0.7} disabled={disabled} testID={testID} {...rest}>
|
|
18
|
+
<Text style={styles.text}>{children}</Text>
|
|
19
|
+
</TouchableOpacity>);
|
|
20
|
+
};
|
|
21
|
+
const styles = StyleSheet.create({
|
|
22
|
+
button: {
|
|
23
|
+
borderRadius: 8,
|
|
24
|
+
alignItems: "center",
|
|
25
|
+
justifyContent: "center",
|
|
26
|
+
},
|
|
27
|
+
primaryButton: {
|
|
28
|
+
backgroundColor: "#2563EB",
|
|
29
|
+
},
|
|
30
|
+
secondaryButton: {
|
|
31
|
+
backgroundColor: "#7C3AED",
|
|
32
|
+
},
|
|
33
|
+
small: {
|
|
34
|
+
paddingVertical: 6,
|
|
35
|
+
paddingHorizontal: 12,
|
|
36
|
+
},
|
|
37
|
+
medium: {
|
|
38
|
+
paddingVertical: 8,
|
|
39
|
+
paddingHorizontal: 24,
|
|
40
|
+
},
|
|
41
|
+
large: {
|
|
42
|
+
paddingVertical: 12,
|
|
43
|
+
paddingHorizontal: 32,
|
|
44
|
+
},
|
|
45
|
+
disabled: {
|
|
46
|
+
opacity: 0.6,
|
|
47
|
+
},
|
|
48
|
+
text: {
|
|
49
|
+
color: "#FFFFFF",
|
|
50
|
+
fontSize: 16,
|
|
51
|
+
fontWeight: "500",
|
|
52
|
+
},
|
|
53
|
+
});
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./components/Button/Button";
|
package/dist/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./components/Button/Button";
|
package/package.json
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@lamenna/lxp-native",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"description": "React Native components for LXP",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"types": "dist/index.d.ts",
|
|
7
|
+
"files": [
|
|
8
|
+
"dist"
|
|
9
|
+
],
|
|
10
|
+
"publishConfig": {
|
|
11
|
+
"access": "public"
|
|
12
|
+
},
|
|
13
|
+
"peerDependencies": {
|
|
14
|
+
"react": "^18.2.0",
|
|
15
|
+
"react-native": ">=0.73.0"
|
|
16
|
+
},
|
|
17
|
+
"dependencies": {
|
|
18
|
+
"@lamenna/lxp-core": "0.0.1",
|
|
19
|
+
"@lamenna/lxp-tokens": "0.0.1",
|
|
20
|
+
"@lamenna/lxp-shared-components": "0.0.1"
|
|
21
|
+
},
|
|
22
|
+
"devDependencies": {
|
|
23
|
+
"@types/react": "18.2.79",
|
|
24
|
+
"@types/react-native": "^0.73.0",
|
|
25
|
+
"react": "^18.2.0",
|
|
26
|
+
"react-native": "^0.73.0",
|
|
27
|
+
"typescript": "^5.3.3"
|
|
28
|
+
},
|
|
29
|
+
"scripts": {
|
|
30
|
+
"build": "tsc",
|
|
31
|
+
"dev": "tsc --watch",
|
|
32
|
+
"test": "jest",
|
|
33
|
+
"test:watch": "jest --watch",
|
|
34
|
+
"test:coverage": "jest --coverage",
|
|
35
|
+
"clean": "rm -rf dist"
|
|
36
|
+
}
|
|
37
|
+
}
|