@compsych-ui-components/react-native 3.2.5 → 4.0.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.
- package/package.json +4 -3
- package/src/{index.ts → index.d.ts} +2 -2
- package/src/index.js +3 -0
- package/src/index.js.map +1 -0
- package/src/lib/button.d.ts +7 -0
- package/src/lib/button.js +43 -0
- package/src/lib/button.js.map +1 -0
- package/.gitkeep +0 -0
- package/.swcrc +0 -21
- package/project.json +0 -19
- package/src/lib/button.tsx +0 -50
- package/tsconfig.json +0 -10
- package/tsconfig.lib.json +0 -8
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@compsych-ui-components/react-native",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "4.0.0",
|
|
4
4
|
"description": "React Native UI components for compsych",
|
|
5
5
|
"main": "./src/index.js",
|
|
6
6
|
"types": "./src/index.d.ts",
|
|
@@ -18,5 +18,6 @@
|
|
|
18
18
|
"@compsych-ui-components/shared": "*",
|
|
19
19
|
"react": ">=18.0.0",
|
|
20
20
|
"react-native": ">=0.73.0"
|
|
21
|
-
}
|
|
22
|
-
|
|
21
|
+
},
|
|
22
|
+
"type": "commonjs"
|
|
23
|
+
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { Button } from './lib/button';
|
|
2
|
-
export type { ButtonProps } from './lib/button';
|
|
1
|
+
export { Button } from './lib/button';
|
|
2
|
+
export type { ButtonProps } from './lib/button';
|
package/src/index.js
ADDED
package/src/index.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../packages/react-native/src/index.ts"],"sourcesContent":["export { Button } from './lib/button';\r\nexport type { ButtonProps } from './lib/button';\r\n"],"names":["Button"],"mappings":"AAAA,SAASA,MAAM,QAAQ,eAAe"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { Pressable, StyleSheet, Text } from 'react-native';
|
|
4
|
+
import { showAlert } from '@compsych-ui-components/shared';
|
|
5
|
+
export function Button({ label = 'Click me', alertMessage = 'Hello from @compsych/react-native!', onPress }) {
|
|
6
|
+
const handlePress = ()=>{
|
|
7
|
+
if (onPress) {
|
|
8
|
+
onPress();
|
|
9
|
+
} else {
|
|
10
|
+
showAlert(alertMessage);
|
|
11
|
+
}
|
|
12
|
+
};
|
|
13
|
+
return /*#__PURE__*/ _jsx(Pressable, {
|
|
14
|
+
style: ({ pressed })=>[
|
|
15
|
+
styles.button,
|
|
16
|
+
pressed && styles.pressed
|
|
17
|
+
],
|
|
18
|
+
onPress: handlePress,
|
|
19
|
+
accessibilityRole: "button",
|
|
20
|
+
children: /*#__PURE__*/ _jsx(Text, {
|
|
21
|
+
style: styles.label,
|
|
22
|
+
children: label
|
|
23
|
+
})
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
const styles = StyleSheet.create({
|
|
27
|
+
button: {
|
|
28
|
+
paddingVertical: 8,
|
|
29
|
+
paddingHorizontal: 16,
|
|
30
|
+
backgroundColor: '#1976d2',
|
|
31
|
+
borderRadius: 4,
|
|
32
|
+
alignItems: 'center'
|
|
33
|
+
},
|
|
34
|
+
pressed: {
|
|
35
|
+
backgroundColor: '#1565c0'
|
|
36
|
+
},
|
|
37
|
+
label: {
|
|
38
|
+
color: '#ffffff',
|
|
39
|
+
fontSize: 14
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
//# sourceMappingURL=button.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../packages/react-native/src/lib/button.tsx"],"sourcesContent":["import React from 'react';\r\nimport { Pressable, StyleSheet, Text } from 'react-native';\r\nimport { showAlert } from '@compsych-ui-components/shared';\r\n\r\nexport interface ButtonProps {\r\n label?: string;\r\n alertMessage?: string;\r\n onPress?: () => void;\r\n}\r\n\r\nexport function Button({\r\n label = 'Click me',\r\n alertMessage = 'Hello from @compsych/react-native!',\r\n onPress,\r\n}: ButtonProps) {\r\n const handlePress = () => {\r\n if (onPress) {\r\n onPress();\r\n } else {\r\n showAlert(alertMessage);\r\n }\r\n };\r\n\r\n return (\r\n <Pressable\r\n style={({ pressed }) => [styles.button, pressed && styles.pressed]}\r\n onPress={handlePress}\r\n accessibilityRole=\"button\"\r\n >\r\n <Text style={styles.label}>{label}</Text>\r\n </Pressable>\r\n );\r\n}\r\n\r\nconst styles = StyleSheet.create({\r\n button: {\r\n paddingVertical: 8,\r\n paddingHorizontal: 16,\r\n backgroundColor: '#1976d2',\r\n borderRadius: 4,\r\n alignItems: 'center',\r\n },\r\n pressed: {\r\n backgroundColor: '#1565c0',\r\n },\r\n label: {\r\n color: '#ffffff',\r\n fontSize: 14,\r\n },\r\n});\r\n"],"names":["React","Pressable","StyleSheet","Text","showAlert","Button","label","alertMessage","onPress","handlePress","style","pressed","styles","button","accessibilityRole","create","paddingVertical","paddingHorizontal","backgroundColor","borderRadius","alignItems","color","fontSize"],"mappings":";AAAA,OAAOA,WAAW,QAAQ;AAC1B,SAASC,SAAS,EAAEC,UAAU,EAAEC,IAAI,QAAQ,eAAe;AAC3D,SAASC,SAAS,QAAQ,iCAAiC;AAQ3D,OAAO,SAASC,OAAO,EACrBC,QAAQ,UAAU,EAClBC,eAAe,oCAAoC,EACnDC,OAAO,EACK;IACZ,MAAMC,cAAc;QAClB,IAAID,SAAS;YACXA;QACF,OAAO;YACLJ,UAAUG;QACZ;IACF;IAEA,qBACE,KAACN;QACCS,OAAO,CAAC,EAAEC,OAAO,EAAE,GAAK;gBAACC,OAAOC,MAAM;gBAAEF,WAAWC,OAAOD,OAAO;aAAC;QAClEH,SAASC;QACTK,mBAAkB;kBAElB,cAAA,KAACX;YAAKO,OAAOE,OAAON,KAAK;sBAAGA;;;AAGlC;AAEA,MAAMM,SAASV,WAAWa,MAAM,CAAC;IAC/BF,QAAQ;QACNG,iBAAiB;QACjBC,mBAAmB;QACnBC,iBAAiB;QACjBC,cAAc;QACdC,YAAY;IACd;IACAT,SAAS;QACPO,iBAAiB;IACnB;IACAZ,OAAO;QACLe,OAAO;QACPC,UAAU;IACZ;AACF"}
|
package/.gitkeep
DELETED
|
File without changes
|
package/.swcrc
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"jsc": {
|
|
3
|
-
"target": "es2022",
|
|
4
|
-
"parser": {
|
|
5
|
-
"syntax": "typescript",
|
|
6
|
-
"tsx": true,
|
|
7
|
-
"decorators": false,
|
|
8
|
-
"dynamicImport": true
|
|
9
|
-
},
|
|
10
|
-
"transform": {
|
|
11
|
-
"react": {
|
|
12
|
-
"runtime": "automatic"
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
},
|
|
16
|
-
"module": {
|
|
17
|
-
"type": "nodenext"
|
|
18
|
-
},
|
|
19
|
-
"sourceMaps": true,
|
|
20
|
-
"exclude": [".*\\.spec\\.tsx?$"]
|
|
21
|
-
}
|
package/project.json
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "react-native",
|
|
3
|
-
"$schema": "../../node_modules/nx/schemas/project-schema.json",
|
|
4
|
-
"sourceRoot": "packages/react-native/src",
|
|
5
|
-
"projectType": "library",
|
|
6
|
-
"targets": {
|
|
7
|
-
"build": {
|
|
8
|
-
"executor": "@nx/js:swc",
|
|
9
|
-
"outputs": ["{options.outputPath}"],
|
|
10
|
-
"options": {
|
|
11
|
-
"outputPath": "dist/packages/react-native",
|
|
12
|
-
"main": "packages/react-native/src/index.ts",
|
|
13
|
-
"tsConfig": "packages/react-native/tsconfig.lib.json"
|
|
14
|
-
},
|
|
15
|
-
"dependsOn": ["^build"]
|
|
16
|
-
}
|
|
17
|
-
},
|
|
18
|
-
"implicitDependencies": ["shared"]
|
|
19
|
-
}
|
package/src/lib/button.tsx
DELETED
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { Pressable, StyleSheet, Text } from 'react-native';
|
|
3
|
-
import { showAlert } from '@compsych/shared';
|
|
4
|
-
|
|
5
|
-
export interface ButtonProps {
|
|
6
|
-
label?: string;
|
|
7
|
-
alertMessage?: string;
|
|
8
|
-
onPress?: () => void;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
export function Button({
|
|
12
|
-
label = 'Click me',
|
|
13
|
-
alertMessage = 'Hello from @compsych/react-native!',
|
|
14
|
-
onPress,
|
|
15
|
-
}: ButtonProps) {
|
|
16
|
-
const handlePress = () => {
|
|
17
|
-
if (onPress) {
|
|
18
|
-
onPress();
|
|
19
|
-
} else {
|
|
20
|
-
showAlert(alertMessage);
|
|
21
|
-
}
|
|
22
|
-
};
|
|
23
|
-
|
|
24
|
-
return (
|
|
25
|
-
<Pressable
|
|
26
|
-
style={({ pressed }) => [styles.button, pressed && styles.pressed]}
|
|
27
|
-
onPress={handlePress}
|
|
28
|
-
accessibilityRole="button"
|
|
29
|
-
>
|
|
30
|
-
<Text style={styles.label}>{label}</Text>
|
|
31
|
-
</Pressable>
|
|
32
|
-
);
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
const styles = StyleSheet.create({
|
|
36
|
-
button: {
|
|
37
|
-
paddingVertical: 8,
|
|
38
|
-
paddingHorizontal: 16,
|
|
39
|
-
backgroundColor: '#1976d2',
|
|
40
|
-
borderRadius: 4,
|
|
41
|
-
alignItems: 'center',
|
|
42
|
-
},
|
|
43
|
-
pressed: {
|
|
44
|
-
backgroundColor: '#1565c0',
|
|
45
|
-
},
|
|
46
|
-
label: {
|
|
47
|
-
color: '#ffffff',
|
|
48
|
-
fontSize: 14,
|
|
49
|
-
},
|
|
50
|
-
});
|
package/tsconfig.json
DELETED