@compsych-ui-components/react-native 4.0.0 → 4.0.4
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 +1 -1
- package/src/index.js +11 -1
- package/src/index.js.map +1 -1
- package/src/lib/button.js +24 -9
- package/src/lib/button.js.map +1 -1
package/package.json
CHANGED
package/src/index.js
CHANGED
|
@@ -1,3 +1,13 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
Object.defineProperty(exports, "Button", {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: function() {
|
|
8
|
+
return _button.Button;
|
|
9
|
+
}
|
|
10
|
+
});
|
|
11
|
+
const _button = require("./lib/button");
|
|
2
12
|
|
|
3
13
|
//# sourceMappingURL=index.js.map
|
package/src/index.js.map
CHANGED
|
@@ -1 +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":"
|
|
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":";;;;+BAASA;;;eAAAA,cAAM;;;wBAAQ"}
|
package/src/lib/button.js
CHANGED
|
@@ -1,29 +1,44 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
Object.defineProperty(exports, "Button", {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: function() {
|
|
8
|
+
return Button;
|
|
9
|
+
}
|
|
10
|
+
});
|
|
11
|
+
const _jsxruntime = require("react/jsx-runtime");
|
|
12
|
+
const _react = /*#__PURE__*/ _interop_require_default(require("react"));
|
|
13
|
+
const _reactnative = require("react-native");
|
|
14
|
+
const _shared = require("@compsych-ui-components/shared");
|
|
15
|
+
function _interop_require_default(obj) {
|
|
16
|
+
return obj && obj.__esModule ? obj : {
|
|
17
|
+
default: obj
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
function Button({ label = 'Click me', alertMessage = 'Hello from @compsych/react-native!', onPress }) {
|
|
6
21
|
const handlePress = ()=>{
|
|
7
22
|
if (onPress) {
|
|
8
23
|
onPress();
|
|
9
24
|
} else {
|
|
10
|
-
showAlert(alertMessage);
|
|
25
|
+
(0, _shared.showAlert)(alertMessage);
|
|
11
26
|
}
|
|
12
27
|
};
|
|
13
|
-
return /*#__PURE__*/
|
|
28
|
+
return /*#__PURE__*/ (0, _jsxruntime.jsx)(_reactnative.Pressable, {
|
|
14
29
|
style: ({ pressed })=>[
|
|
15
30
|
styles.button,
|
|
16
31
|
pressed && styles.pressed
|
|
17
32
|
],
|
|
18
33
|
onPress: handlePress,
|
|
19
34
|
accessibilityRole: "button",
|
|
20
|
-
children: /*#__PURE__*/
|
|
35
|
+
children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_reactnative.Text, {
|
|
21
36
|
style: styles.label,
|
|
22
37
|
children: label
|
|
23
38
|
})
|
|
24
39
|
});
|
|
25
40
|
}
|
|
26
|
-
const styles = StyleSheet.create({
|
|
41
|
+
const styles = _reactnative.StyleSheet.create({
|
|
27
42
|
button: {
|
|
28
43
|
paddingVertical: 8,
|
|
29
44
|
paddingHorizontal: 16,
|
package/src/lib/button.js.map
CHANGED
|
@@ -1 +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":["
|
|
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":["Button","label","alertMessage","onPress","handlePress","showAlert","Pressable","style","pressed","styles","button","accessibilityRole","Text","StyleSheet","create","paddingVertical","paddingHorizontal","backgroundColor","borderRadius","alignItems","color","fontSize"],"mappings":";;;;+BAUgBA;;;eAAAA;;;;8DAVE;6BAC0B;wBAClB;;;;;;AAQnB,SAASA,OAAO,EACrBC,QAAQ,UAAU,EAClBC,eAAe,oCAAoC,EACnDC,OAAO,EACK;IACZ,MAAMC,cAAc;QAClB,IAAID,SAAS;YACXA;QACF,OAAO;YACLE,IAAAA,iBAAS,EAACH;QACZ;IACF;IAEA,qBACE,qBAACI,sBAAS;QACRC,OAAO,CAAC,EAAEC,OAAO,EAAE,GAAK;gBAACC,OAAOC,MAAM;gBAAEF,WAAWC,OAAOD,OAAO;aAAC;QAClEL,SAASC;QACTO,mBAAkB;kBAElB,cAAA,qBAACC,iBAAI;YAACL,OAAOE,OAAOR,KAAK;sBAAGA;;;AAGlC;AAEA,MAAMQ,SAASI,uBAAU,CAACC,MAAM,CAAC;IAC/BJ,QAAQ;QACNK,iBAAiB;QACjBC,mBAAmB;QACnBC,iBAAiB;QACjBC,cAAc;QACdC,YAAY;IACd;IACAX,SAAS;QACPS,iBAAiB;IACnB;IACAhB,OAAO;QACLmB,OAAO;QACPC,UAAU;IACZ;AACF"}
|