@lamenna/lxp-native 0.0.2 → 0.1.0
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,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Button options tests - React Native package
|
|
3
|
+
*
|
|
4
|
+
* These tests validate that the React Native package can consume the
|
|
5
|
+
* shared button configuration (variants, sizes, common styles). They
|
|
6
|
+
* deliberately avoid React Native runtime dependencies so they work
|
|
7
|
+
* in a plain Jest + ts-jest environment.
|
|
8
|
+
*/
|
|
9
|
+
export {};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Button options tests - React Native package
|
|
3
|
+
*
|
|
4
|
+
* These tests validate that the React Native package can consume the
|
|
5
|
+
* shared button configuration (variants, sizes, common styles). They
|
|
6
|
+
* deliberately avoid React Native runtime dependencies so they work
|
|
7
|
+
* in a plain Jest + ts-jest environment.
|
|
8
|
+
*/
|
|
9
|
+
import { buttonConfig } from "@lamenna/lxp-shared-components";
|
|
10
|
+
describe("Button options (React Native)", () => {
|
|
11
|
+
it("should expose primary and secondary variants", () => {
|
|
12
|
+
expect(buttonConfig.variants.primary).toBeDefined();
|
|
13
|
+
expect(buttonConfig.variants.secondary).toBeDefined();
|
|
14
|
+
});
|
|
15
|
+
it("should expose standard sizes", () => {
|
|
16
|
+
expect(buttonConfig.sizes.sm).toBeDefined();
|
|
17
|
+
expect(buttonConfig.sizes.md).toBeDefined();
|
|
18
|
+
expect(buttonConfig.sizes.lg).toBeDefined();
|
|
19
|
+
});
|
|
20
|
+
it("should have common button styles configured", () => {
|
|
21
|
+
expect(buttonConfig.common.borderRadius).toBeDefined();
|
|
22
|
+
expect(buttonConfig.common.cursor).toBe("pointer");
|
|
23
|
+
});
|
|
24
|
+
});
|
|
@@ -1,21 +1,20 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { TouchableOpacity, Text, StyleSheet, } from "react-native";
|
|
3
|
+
import { buttonConfig, } from "@lamenna/lxp-shared-components";
|
|
3
4
|
export const Button = ({ children, variant = "primary", size = "md", disabled = false, testID, onPress, ...rest }) => {
|
|
4
|
-
const
|
|
5
|
-
|
|
6
|
-
: styles.secondaryButton;
|
|
7
|
-
const sizeStyle = size === "sm"
|
|
8
|
-
? styles.small
|
|
9
|
-
: size === "lg"
|
|
10
|
-
? styles.large
|
|
11
|
-
: styles.medium;
|
|
5
|
+
const variantConfig = buttonConfig.variants[variant];
|
|
6
|
+
const sizeStyle = size === "sm" ? styles.small : size === "lg" ? styles.large : styles.medium;
|
|
12
7
|
return (<TouchableOpacity style={[
|
|
13
8
|
styles.button,
|
|
14
|
-
|
|
9
|
+
{
|
|
10
|
+
backgroundColor: variantConfig.backgroundColor,
|
|
11
|
+
},
|
|
15
12
|
sizeStyle,
|
|
16
13
|
disabled && styles.disabled,
|
|
17
14
|
]} onPress={onPress} activeOpacity={0.7} disabled={disabled} testID={testID} {...rest}>
|
|
18
|
-
<Text style={styles.text
|
|
15
|
+
<Text style={[styles.text, { color: variantConfig.color }]}>
|
|
16
|
+
{children}
|
|
17
|
+
</Text>
|
|
19
18
|
</TouchableOpacity>);
|
|
20
19
|
};
|
|
21
20
|
const styles = StyleSheet.create({
|
|
@@ -24,12 +23,6 @@ const styles = StyleSheet.create({
|
|
|
24
23
|
alignItems: "center",
|
|
25
24
|
justifyContent: "center",
|
|
26
25
|
},
|
|
27
|
-
primaryButton: {
|
|
28
|
-
backgroundColor: "#2563EB",
|
|
29
|
-
},
|
|
30
|
-
secondaryButton: {
|
|
31
|
-
backgroundColor: "#7C3AED",
|
|
32
|
-
},
|
|
33
26
|
small: {
|
|
34
27
|
paddingVertical: 6,
|
|
35
28
|
paddingHorizontal: 12,
|
|
@@ -43,7 +36,7 @@ const styles = StyleSheet.create({
|
|
|
43
36
|
paddingHorizontal: 32,
|
|
44
37
|
},
|
|
45
38
|
disabled: {
|
|
46
|
-
opacity: 0.
|
|
39
|
+
opacity: 0.5,
|
|
47
40
|
},
|
|
48
41
|
text: {
|
|
49
42
|
color: "#FFFFFF",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lamenna/lxp-native",
|
|
3
|
-
"version": "0.0
|
|
3
|
+
"version": "0.1.0",
|
|
4
4
|
"description": "React Native components for LXP",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -11,27 +11,27 @@
|
|
|
11
11
|
"access": "public"
|
|
12
12
|
},
|
|
13
13
|
"peerDependencies": {
|
|
14
|
-
"react": "^
|
|
15
|
-
"react-native": ">=0.
|
|
14
|
+
"react": "^19.0.0",
|
|
15
|
+
"react-native": ">=0.83.0"
|
|
16
16
|
},
|
|
17
17
|
"dependencies": {
|
|
18
|
-
"@lamenna/lxp-core": "0.0
|
|
19
|
-
"@lamenna/lxp-tokens": "0.0
|
|
20
|
-
"@lamenna/lxp-shared-components": "0.0
|
|
18
|
+
"@lamenna/lxp-core": "0.1.0",
|
|
19
|
+
"@lamenna/lxp-tokens": "0.1.0",
|
|
20
|
+
"@lamenna/lxp-shared-components": "0.1.0"
|
|
21
21
|
},
|
|
22
22
|
"devDependencies": {
|
|
23
|
-
"@types/react": "
|
|
23
|
+
"@types/react": "^19.0.0",
|
|
24
24
|
"@types/react-native": "^0.73.0",
|
|
25
|
-
"react": "^
|
|
26
|
-
"react-native": "
|
|
27
|
-
"typescript": "^5.
|
|
25
|
+
"react": "^19.2.3",
|
|
26
|
+
"react-native": "0.83.0",
|
|
27
|
+
"typescript": "^5.9.3"
|
|
28
28
|
},
|
|
29
29
|
"scripts": {
|
|
30
30
|
"build": "tsc",
|
|
31
31
|
"dev": "tsc --watch",
|
|
32
|
-
"test": "jest",
|
|
33
|
-
"test:watch": "jest --watch",
|
|
34
|
-
"test:coverage": "jest --coverage",
|
|
32
|
+
"test": "jest --passWithNoTests",
|
|
33
|
+
"test:watch": "jest --watch --passWithNoTests",
|
|
34
|
+
"test:coverage": "jest --coverage --passWithNoTests",
|
|
35
35
|
"clean": "rm -rf dist"
|
|
36
36
|
}
|
|
37
37
|
}
|