@plusscommunities/pluss-core-app 1.4.8 → 1.5.2
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/dist/module/actions/FollowerActions.js +34 -0
- package/dist/module/actions/FollowerActions.js.map +1 -0
- package/dist/module/actions/MediaActions.js +20 -0
- package/dist/module/actions/MediaActions.js.map +1 -0
- package/dist/module/actions/ResidentActions.js +26 -0
- package/dist/module/actions/ResidentActions.js.map +1 -0
- package/dist/module/actions/UserActions.js +214 -0
- package/dist/module/actions/UserActions.js.map +1 -0
- package/dist/module/actions/index.js +5 -0
- package/dist/module/actions/index.js.map +1 -0
- package/dist/module/actions/types.js +14 -0
- package/dist/module/actions/types.js.map +1 -0
- package/dist/module/apis/analyticsActions.js +20 -0
- package/dist/module/apis/analyticsActions.js.map +1 -0
- package/dist/module/apis/contactActions.js +27 -0
- package/dist/module/apis/contactActions.js.map +1 -0
- package/dist/module/apis/eventActions.js +163 -0
- package/dist/module/apis/eventActions.js.map +1 -0
- package/dist/module/apis/fileActions.js +96 -0
- package/dist/module/apis/fileActions.js.map +1 -0
- package/dist/module/apis/followerActions.js +38 -0
- package/dist/module/apis/followerActions.js.map +1 -0
- package/dist/module/apis/index.js +11 -0
- package/dist/module/apis/index.js.map +1 -0
- package/dist/module/apis/notificationActions.js +60 -0
- package/dist/module/apis/notificationActions.js.map +1 -0
- package/dist/module/apis/profileActions.js +14 -0
- package/dist/module/apis/profileActions.js.map +1 -0
- package/dist/module/apis/reactionActions.js +78 -0
- package/dist/module/apis/reactionActions.js.map +1 -0
- package/dist/module/apis/typeActions.js +15 -0
- package/dist/module/apis/typeActions.js.map +1 -0
- package/dist/module/apis/userActions.js +104 -0
- package/dist/module/apis/userActions.js.map +1 -0
- package/{assets → dist/module/assets}/icons/reactions/heart.png +0 -0
- package/{assets → dist/module/assets}/icons/reactions/party.png +0 -0
- package/{assets → dist/module/assets}/icons/reactions/sad.png +0 -0
- package/{assets → dist/module/assets}/icons/reactions/smile.png +0 -0
- package/dist/module/colours.js +149 -0
- package/dist/module/colours.js.map +1 -0
- package/dist/module/components/AddButton.js +45 -0
- package/dist/module/components/AddButton.js.map +1 -0
- package/dist/module/components/Attachment.js +59 -0
- package/dist/module/components/Attachment.js.map +1 -0
- package/dist/module/components/AudienceSelectorLauncher.js +70 -0
- package/dist/module/components/AudienceSelectorLauncher.js.map +1 -0
- package/dist/module/components/AudienceSelectorPage.js +376 -0
- package/dist/module/components/AudienceSelectorPage.js.map +1 -0
- package/dist/module/components/BackButton.js +62 -0
- package/dist/module/components/BackButton.js.map +1 -0
- package/dist/module/components/CategoryTabs.js +171 -0
- package/dist/module/components/CategoryTabs.js.map +1 -0
- package/dist/module/components/CommentReply.js +363 -0
- package/dist/module/components/CommentReply.js.map +1 -0
- package/dist/module/components/CommentSection.js +785 -0
- package/dist/module/components/CommentSection.js.map +1 -0
- package/dist/module/components/ConfirmPopup.js +85 -0
- package/dist/module/components/ConfirmPopup.js.map +1 -0
- package/dist/module/components/ConfirmationPopup.js +77 -0
- package/dist/module/components/ConfirmationPopup.js.map +1 -0
- package/dist/module/components/DropDownItem.js +82 -0
- package/dist/module/components/DropDownItem.js.map +1 -0
- package/dist/module/components/DropDownMenu.js +46 -0
- package/dist/module/components/DropDownMenu.js.map +1 -0
- package/dist/module/components/EmptyStateMain.js +50 -0
- package/dist/module/components/EmptyStateMain.js.map +1 -0
- package/dist/module/components/EmptyStateWidget.js +52 -0
- package/dist/module/components/EmptyStateWidget.js.map +1 -0
- package/dist/module/components/FontScaleButton.js +37 -0
- package/dist/module/components/FontScaleButton.js.map +1 -0
- package/dist/module/components/FontScalePopup.js +77 -0
- package/dist/module/components/FontScalePopup.js.map +1 -0
- package/dist/module/components/FormCard.js +28 -0
- package/dist/module/components/FormCard.js.map +1 -0
- package/dist/module/components/FormCardSection.js +240 -0
- package/dist/module/components/FormCardSection.js.map +1 -0
- package/dist/module/components/FormCardSectionOptionLauncher.js +77 -0
- package/dist/module/components/FormCardSectionOptionLauncher.js.map +1 -0
- package/dist/module/components/FormattedText.js +145 -0
- package/dist/module/components/FormattedText.js.map +1 -0
- package/dist/module/components/GenericInput.js +161 -0
- package/dist/module/components/GenericInput.js.map +1 -0
- package/dist/module/components/GenericInputSection.js +174 -0
- package/dist/module/components/GenericInputSection.js.map +1 -0
- package/dist/module/components/Header.js +491 -0
- package/dist/module/components/Header.js.map +1 -0
- package/dist/module/components/ImagePopup.js +257 -0
- package/dist/module/components/ImagePopup.js.map +1 -0
- package/dist/module/components/ImageUploadProgress.js +72 -0
- package/dist/module/components/ImageUploadProgress.js.map +1 -0
- package/dist/module/components/ImageUploader.js +850 -0
- package/dist/module/components/ImageUploader.js.map +1 -0
- package/dist/module/components/InlineButton.js +72 -0
- package/dist/module/components/InlineButton.js.map +1 -0
- package/dist/module/components/Input.js +164 -0
- package/dist/module/components/Input.js.map +1 -0
- package/dist/module/components/LoadingCircles.js +224 -0
- package/dist/module/components/LoadingCircles.js.map +1 -0
- package/dist/module/components/LoadingIndicator.js +95 -0
- package/dist/module/components/LoadingIndicator.js.map +1 -0
- package/dist/module/components/LoadingStateWidget.js +51 -0
- package/dist/module/components/LoadingStateWidget.js.map +1 -0
- package/dist/module/components/MediaPlayer.js +453 -0
- package/dist/module/components/MediaPlayer.js.map +1 -0
- package/dist/module/components/MiddlePopup.js +46 -0
- package/dist/module/components/MiddlePopup.js.map +1 -0
- package/dist/module/components/PDFPopup.js +188 -0
- package/dist/module/components/PDFPopup.js.map +1 -0
- package/dist/module/components/PlussChat.js +997 -0
- package/dist/module/components/PlussChat.js.map +1 -0
- package/dist/module/components/PlussChatMessage.js +204 -0
- package/dist/module/components/PlussChatMessage.js.map +1 -0
- package/dist/module/components/PlussChatTime.js +66 -0
- package/dist/module/components/PlussChatTime.js.map +1 -0
- package/dist/module/components/Popup.js +138 -0
- package/dist/module/components/Popup.js.map +1 -0
- package/dist/module/components/PopupMenu.js +128 -0
- package/dist/module/components/PopupMenu.js.map +1 -0
- package/dist/module/components/PositionedImage.js +333 -0
- package/dist/module/components/PositionedImage.js.map +1 -0
- package/dist/module/components/ProfilePic.js +119 -0
- package/dist/module/components/ProfilePic.js.map +1 -0
- package/dist/module/components/RadioButton.js +84 -0
- package/dist/module/components/RadioButton.js.map +1 -0
- package/dist/module/components/Reaction.js +129 -0
- package/dist/module/components/Reaction.js.map +1 -0
- package/dist/module/components/Reactions.js +84 -0
- package/dist/module/components/Reactions.js.map +1 -0
- package/dist/module/components/SharingTools.js +162 -0
- package/dist/module/components/SharingTools.js.map +1 -0
- package/dist/module/components/Spinner.js +25 -0
- package/dist/module/components/Spinner.js.map +1 -0
- package/dist/module/components/StickyFooter.js +37 -0
- package/dist/module/components/StickyFooter.js.map +1 -0
- package/dist/module/components/TextStyle.js +34 -0
- package/dist/module/components/TextStyle.js.map +1 -0
- package/dist/module/components/Toggle.js +70 -0
- package/dist/module/components/Toggle.js.map +1 -0
- package/dist/module/components/TouchableSearchBar.js +73 -0
- package/dist/module/components/TouchableSearchBar.js.map +1 -0
- package/dist/module/components/UserListPopup.js +146 -0
- package/dist/module/components/UserListPopup.js.map +1 -0
- package/dist/module/components/UserListing.js +291 -0
- package/dist/module/components/UserListing.js.map +1 -0
- package/dist/module/components/VideoPopup.js +123 -0
- package/dist/module/components/VideoPopup.js.map +1 -0
- package/dist/module/components/WarningPopup.js +87 -0
- package/dist/module/components/WarningPopup.js.map +1 -0
- package/dist/module/components/expo-image-picker-multiple/ImageBrowser.js +325 -0
- package/dist/module/components/expo-image-picker-multiple/ImageBrowser.js.map +1 -0
- package/dist/module/components/expo-image-picker-multiple/ImageTile.js +123 -0
- package/dist/module/components/expo-image-picker-multiple/ImageTile.js.map +1 -0
- package/dist/module/components/index.js +53 -0
- package/dist/module/components/index.js.map +1 -0
- package/dist/module/components/react-native-expo-image-cropper/ExpoImageManipulator.js +416 -0
- package/dist/module/components/react-native-expo-image-cropper/ExpoImageManipulator.js.map +1 -0
- package/dist/module/components/react-native-expo-image-cropper/ImageCropOverlay.js +405 -0
- package/dist/module/components/react-native-expo-image-cropper/ImageCropOverlay.js.map +1 -0
- package/dist/module/config.js +27 -0
- package/dist/module/config.js.map +1 -0
- package/dist/module/constants.js +16 -0
- package/dist/module/constants.js.map +1 -0
- package/dist/module/fonts/index.js +2 -0
- package/dist/module/fonts/index.js.map +1 -0
- package/dist/module/fonts/pluss60-icons.js +5 -0
- package/dist/module/fonts/pluss60-icons.js.map +1 -0
- package/dist/module/fonts/pluss60-icons.json +1097 -0
- package/dist/module/helper.js +436 -0
- package/dist/module/helper.js.map +1 -0
- package/dist/module/index.js +13 -0
- package/dist/module/index.js.map +1 -0
- package/dist/module/session.js +54 -0
- package/dist/module/session.js.map +1 -0
- package/dist/module/styles.js +67 -0
- package/dist/module/styles.js.map +1 -0
- package/package.json +24 -7
- package/src/assets/icons/reactions/heart.png +0 -0
- package/src/assets/icons/reactions/party.png +0 -0
- package/src/assets/icons/reactions/sad.png +0 -0
- package/src/assets/icons/reactions/smile.png +0 -0
- package/src/components/CommentReply.js +3 -5
- package/src/components/CommentSection.js +4 -4
- package/src/components/MediaPlayer.js +14 -4
- package/src/components/VideoPopup.js +1 -1
- package/src/constants.js +4 -4
- package/src/helper.js +4 -4
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import React, { PureComponent } from 'react';
|
|
2
|
+
import { TouchableOpacity, Text, View } from 'react-native';
|
|
3
|
+
import { TEXT_DARK, LINEGREY } from '../colours';
|
|
4
|
+
/*
|
|
5
|
+
Props-
|
|
6
|
+
style - custom style for container
|
|
7
|
+
buttonLeftStyle - custom style for left button
|
|
8
|
+
buttonRightStyle - custom style for right button
|
|
9
|
+
onPressSmall - callback function
|
|
10
|
+
onPressLarge - custom style for right button
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
class FontScalePopup extends PureComponent {
|
|
14
|
+
render() {
|
|
15
|
+
if (!this.props.visible) {
|
|
16
|
+
return null;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
return /*#__PURE__*/React.createElement(View, {
|
|
20
|
+
style: [styles.container, this.props.style]
|
|
21
|
+
}, /*#__PURE__*/React.createElement(TouchableOpacity, {
|
|
22
|
+
style: [styles.button, styles.buttonLeft, this.props.buttonLeftStyle],
|
|
23
|
+
onPress: this.props.onPressSmall
|
|
24
|
+
}, /*#__PURE__*/React.createElement(Text, {
|
|
25
|
+
style: styles.smallText
|
|
26
|
+
}, "A")), /*#__PURE__*/React.createElement(TouchableOpacity, {
|
|
27
|
+
style: [styles.button, styles.buttonRight, this.props.buttonRightStyle],
|
|
28
|
+
onPress: this.props.onPressLarge
|
|
29
|
+
}, /*#__PURE__*/React.createElement(Text, {
|
|
30
|
+
style: styles.largeText
|
|
31
|
+
}, "A")));
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
const styles = {
|
|
37
|
+
container: {
|
|
38
|
+
flexDirection: 'row',
|
|
39
|
+
borderRadius: 2,
|
|
40
|
+
shadowColor: '#000',
|
|
41
|
+
shadowOffset: {
|
|
42
|
+
width: 0,
|
|
43
|
+
height: 2
|
|
44
|
+
},
|
|
45
|
+
shadowOpacity: 0.2,
|
|
46
|
+
shadowRadius: 4,
|
|
47
|
+
elevation: 4,
|
|
48
|
+
zIndex: 10,
|
|
49
|
+
backgroundColor: '#fff',
|
|
50
|
+
padding: 2
|
|
51
|
+
},
|
|
52
|
+
button: {
|
|
53
|
+
height: 50,
|
|
54
|
+
width: 64,
|
|
55
|
+
borderColor: LINEGREY,
|
|
56
|
+
alignItems: 'center',
|
|
57
|
+
justifyContent: 'center'
|
|
58
|
+
},
|
|
59
|
+
buttonLeft: {
|
|
60
|
+
borderRightWidth: 1
|
|
61
|
+
},
|
|
62
|
+
buttonRight: {
|
|
63
|
+
borderLeftWidth: 1
|
|
64
|
+
},
|
|
65
|
+
smallText: {
|
|
66
|
+
fontFamily: 'sf-medium',
|
|
67
|
+
color: TEXT_DARK,
|
|
68
|
+
fontSize: 16
|
|
69
|
+
},
|
|
70
|
+
largeText: {
|
|
71
|
+
fontFamily: 'sf-medium',
|
|
72
|
+
color: TEXT_DARK,
|
|
73
|
+
fontSize: 24
|
|
74
|
+
}
|
|
75
|
+
};
|
|
76
|
+
export { FontScalePopup };
|
|
77
|
+
//# sourceMappingURL=FontScalePopup.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["FontScalePopup.js"],"names":["React","PureComponent","TouchableOpacity","Text","View","TEXT_DARK","LINEGREY","FontScalePopup","render","props","visible","styles","container","style","button","buttonLeft","buttonLeftStyle","onPressSmall","smallText","buttonRight","buttonRightStyle","onPressLarge","largeText","flexDirection","borderRadius","shadowColor","shadowOffset","width","height","shadowOpacity","shadowRadius","elevation","zIndex","backgroundColor","padding","borderColor","alignItems","justifyContent","borderRightWidth","borderLeftWidth","fontFamily","color","fontSize"],"mappings":"AAAA,OAAOA,KAAP,IAAgBC,aAAhB,QAAqC,OAArC;AACA,SAASC,gBAAT,EAA2BC,IAA3B,EAAiCC,IAAjC,QAA6C,cAA7C;AACA,SAASC,SAAT,EAAoBC,QAApB,QAAoC,YAApC;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,MAAMC,cAAN,SAA6BN,aAA7B,CAA2C;AACzCO,EAAAA,MAAM,GAAG;AACP,QAAI,CAAC,KAAKC,KAAL,CAAWC,OAAhB,EAAyB;AACvB,aAAO,IAAP;AACD;;AACD,wBACE,oBAAC,IAAD;AAAM,MAAA,KAAK,EAAE,CAACC,MAAM,CAACC,SAAR,EAAmB,KAAKH,KAAL,CAAWI,KAA9B;AAAb,oBACE,oBAAC,gBAAD;AAAkB,MAAA,KAAK,EAAE,CAACF,MAAM,CAACG,MAAR,EAAgBH,MAAM,CAACI,UAAvB,EAAmC,KAAKN,KAAL,CAAWO,eAA9C,CAAzB;AAAyF,MAAA,OAAO,EAAE,KAAKP,KAAL,CAAWQ;AAA7G,oBACE,oBAAC,IAAD;AAAM,MAAA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,GA7BE;AAkCbpB,EAAAA,SAAS,EAAE;AACTkB,IAAAA,UAAU,EAAE,WADH;AAETC,IAAAA,KAAK,EAAEpC,SAFE;AAGTqC,IAAAA,QAAQ,EAAE;AAHD;AAlCE,CAAf;AAyCA,SAASnC,cAAT","sourcesContent":["import React, { PureComponent } from 'react';\nimport { TouchableOpacity, Text, View } from 'react-native';\nimport { TEXT_DARK, LINEGREY } from '../colours';\n\n/* \nProps- \n style - custom style for container\n buttonLeftStyle - custom style for left button\n buttonRightStyle - custom style for right button\n onPressSmall - callback function \n onPressLarge - custom style for right button\n*/\n\nclass FontScalePopup extends PureComponent {\n render() {\n if (!this.props.visible) {\n return null;\n }\n return (\n <View style={[styles.container, this.props.style]}>\n <TouchableOpacity style={[styles.button, styles.buttonLeft, this.props.buttonLeftStyle]} onPress={this.props.onPressSmall}>\n <Text style={styles.smallText}>A</Text>\n </TouchableOpacity>\n <TouchableOpacity style={[styles.button, styles.buttonRight, this.props.buttonRightStyle]} onPress={this.props.onPressLarge}>\n <Text style={styles.largeText}>A</Text>\n </TouchableOpacity>\n </View>\n );\n }\n}\n\nconst styles = {\n container: {\n flexDirection: 'row',\n borderRadius: 2,\n shadowColor: '#000',\n shadowOffset: {\n width: 0,\n height: 2,\n },\n shadowOpacity: 0.2,\n shadowRadius: 4,\n elevation: 4,\n zIndex: 10,\n backgroundColor: '#fff',\n padding: 2,\n },\n button: {\n height: 50,\n width: 64,\n borderColor: LINEGREY,\n alignItems: 'center',\n justifyContent: 'center',\n },\n buttonLeft: {\n borderRightWidth: 1,\n },\n buttonRight: {\n borderLeftWidth: 1,\n },\n smallText: {\n fontFamily: 'sf-medium',\n color: TEXT_DARK,\n fontSize: 16,\n },\n largeText: {\n fontFamily: 'sf-medium',\n color: TEXT_DARK,\n fontSize: 24,\n },\n};\n\nexport { FontScalePopup };\n"]}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import React, { PureComponent } from 'react';
|
|
2
|
+
import { View } from 'react-native';
|
|
3
|
+
|
|
4
|
+
class FormCard extends PureComponent {
|
|
5
|
+
render() {
|
|
6
|
+
return /*#__PURE__*/React.createElement(View, {
|
|
7
|
+
style: [styles.section, this.props.style]
|
|
8
|
+
}, this.props.children);
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
const styles = {
|
|
14
|
+
section: {
|
|
15
|
+
backgroundColor: '#fff',
|
|
16
|
+
paddingHorizontal: 16,
|
|
17
|
+
shadowColor: '#000',
|
|
18
|
+
shadowOffset: {
|
|
19
|
+
width: 0,
|
|
20
|
+
height: 1
|
|
21
|
+
},
|
|
22
|
+
shadowOpacity: 0.1,
|
|
23
|
+
shadowRadius: 6,
|
|
24
|
+
elevation: 2
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
export { FormCard };
|
|
28
|
+
//# sourceMappingURL=FormCard.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["FormCard.js"],"names":["React","PureComponent","View","FormCard","render","styles","section","props","style","children","backgroundColor","paddingHorizontal","shadowColor","shadowOffset","width","height","shadowOpacity","shadowRadius","elevation"],"mappings":"AAAA,OAAOA,KAAP,IAAgBC,aAAhB,QAAqC,OAArC;AACA,SAASC,IAAT,QAAqB,cAArB;;AAEA,MAAMC,QAAN,SAAuBF,aAAvB,CAAqC;AACnCG,EAAAA,MAAM,GAAG;AACP,wBAAO,oBAAC,IAAD;AAAM,MAAA,KAAK,EAAE,CAACC,MAAM,CAACC,OAAR,EAAiB,KAAKC,KAAL,CAAWC,KAA5B;AAAb,OAAkD,KAAKD,KAAL,CAAWE,QAA7D,CAAP;AACD;;AAHkC;;AAMrC,MAAMJ,MAAM,GAAG;AACbC,EAAAA,OAAO,EAAE;AACPI,IAAAA,eAAe,EAAE,MADV;AAEPC,IAAAA,iBAAiB,EAAE,EAFZ;AAGPC,IAAAA,WAAW,EAAE,MAHN;AAIPC,IAAAA,YAAY,EAAE;AACZC,MAAAA,KAAK,EAAE,CADK;AAEZC,MAAAA,MAAM,EAAE;AAFI,KAJP;AAQPC,IAAAA,aAAa,EAAE,GARR;AASPC,IAAAA,YAAY,EAAE,CATP;AAUPC,IAAAA,SAAS,EAAE;AAVJ;AADI,CAAf;AAeA,SAASf,QAAT","sourcesContent":["import React, { PureComponent } from 'react';\nimport { View } from 'react-native';\n\nclass FormCard extends PureComponent {\n render() {\n return <View style={[styles.section, this.props.style]}>{this.props.children}</View>;\n }\n}\n\nconst styles = {\n section: {\n backgroundColor: '#fff',\n paddingHorizontal: 16,\n shadowColor: '#000',\n shadowOffset: {\n width: 0,\n height: 1,\n },\n shadowOpacity: 0.1,\n shadowRadius: 6,\n elevation: 2,\n },\n};\n\nexport { FormCard };\n"]}
|
|
@@ -0,0 +1,240 @@
|
|
|
1
|
+
import React, { Component } from 'react';
|
|
2
|
+
import _ from 'lodash';
|
|
3
|
+
import { View, Text, TextInput, TouchableOpacity, StyleSheet } from 'react-native';
|
|
4
|
+
import { connect } from 'react-redux';
|
|
5
|
+
import { Pl60Icon } from '../fonts';
|
|
6
|
+
import { TEXT_LIGHTER, TEXT_DARK, COLOUR_GREEN, LINEGREY, TEXT_LIGHT, COLOUR_GRAPEFRUIT, getMainBrandingColourFromState, getDarkBrandingColourFromState } from '../colours';
|
|
7
|
+
import { getValueOrDefault } from '../helper';
|
|
8
|
+
|
|
9
|
+
class FormCardSection extends Component {
|
|
10
|
+
constructor(props) {
|
|
11
|
+
super(props);
|
|
12
|
+
this.state = {
|
|
13
|
+
height: getValueOrDefault(this.props.minHeight, 20),
|
|
14
|
+
focused: false,
|
|
15
|
+
isSecure: true
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
onFocus() {
|
|
20
|
+
this.setState({
|
|
21
|
+
focused: true
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
if (this.props.onFocus) {
|
|
25
|
+
this.props.onFocus();
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
onBlur() {
|
|
30
|
+
this.setState({
|
|
31
|
+
focused: false
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
if (this.props.onBlur) {
|
|
35
|
+
this.props.onBlur();
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
onGrow(event) {
|
|
40
|
+
this.setState({
|
|
41
|
+
height: Math.max(event.nativeEvent.contentSize.height, this.props.minHeight)
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
toggleSecure() {
|
|
46
|
+
const current = this.state.isSecure;
|
|
47
|
+
this.setState({
|
|
48
|
+
isSecure: !current
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
showSecure() {
|
|
53
|
+
if (!_.isUndefined(this.props.secureTextToggle) && this.props.secureTextToggle) {
|
|
54
|
+
return this.state.isSecure;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
return this.props.secureTextEntry;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
isValid() {
|
|
61
|
+
if (this.props.required && _.isEmpty(this.props.textValue)) {
|
|
62
|
+
return false;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
if (this.props.isValid && !this.props.isValid()) {
|
|
66
|
+
return false;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
return true;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
renderErrorDot() {
|
|
73
|
+
if (this.props.required || this.props.hasError) {
|
|
74
|
+
return /*#__PURE__*/React.createElement(View, {
|
|
75
|
+
style: [styles.errorDot, {
|
|
76
|
+
backgroundColor: this.props.colourBrandingMain
|
|
77
|
+
}, !this.isValid() && styles.errorError, this.isValid() && styles.errorValid, this.props.errorDotStyle]
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
return null;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
renderLabel() {
|
|
85
|
+
if (_.isEmpty(this.props.label)) {
|
|
86
|
+
return null;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
return /*#__PURE__*/React.createElement(View, {
|
|
90
|
+
style: styles.labelContainer
|
|
91
|
+
}, /*#__PURE__*/React.createElement(Text, {
|
|
92
|
+
style: [styles.labelText, this.state.focused && {
|
|
93
|
+
color: this.props.colourBrandingMain
|
|
94
|
+
}, !this.isValid() && !_.isEmpty(this.props.textValue) && styles.labelError, this.props.labelStyle]
|
|
95
|
+
}, this.props.label), this.renderErrorDot());
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
renderInput() {
|
|
99
|
+
return /*#__PURE__*/React.createElement(View, {
|
|
100
|
+
style: {
|
|
101
|
+
flexDirection: 'row'
|
|
102
|
+
}
|
|
103
|
+
}, /*#__PURE__*/React.createElement(View, {
|
|
104
|
+
style: {
|
|
105
|
+
flex: 1
|
|
106
|
+
}
|
|
107
|
+
}, /*#__PURE__*/React.createElement(TextInput, {
|
|
108
|
+
value: this.props.textValue,
|
|
109
|
+
onChangeText: this.props.onChangeText,
|
|
110
|
+
keyboardType: this.props.keyboardType
|
|
111
|
+
/* Main Styling Props */
|
|
112
|
+
,
|
|
113
|
+
selectionColor: this.props.colourBrandingDark,
|
|
114
|
+
placeholder: this.props.placeholder,
|
|
115
|
+
placeholderTextColor: this.props.placeholderTextColor || TEXT_LIGHTER,
|
|
116
|
+
style: [styles.inputStyle, {
|
|
117
|
+
textAlignVertical: this.props.autoGrow ? 'top' : 'center',
|
|
118
|
+
color: this.props.textColour || TEXT_DARK,
|
|
119
|
+
minHeight: this.props.minHeight || 20
|
|
120
|
+
}, this.props.textStyle],
|
|
121
|
+
underlineColorAndroid: 'rgba(0,0,0,0)'
|
|
122
|
+
/* Other Props */
|
|
123
|
+
,
|
|
124
|
+
autoFocus: _.isUndefined(this.props.autoFocus) ? false : this.props.autoFocus,
|
|
125
|
+
editable: _.isUndefined(this.props.editable) ? true : this.props.editable,
|
|
126
|
+
secureTextEntry: _.isUndefined(this.props.secureTextEntry) ? false : this.showSecure(),
|
|
127
|
+
autoCorrect: _.isUndefined(this.props.autoCorrect) ? false : this.props.autoCorrect,
|
|
128
|
+
multiline: _.isUndefined(this.props.multiline) ? false : this.props.multiline,
|
|
129
|
+
autoGrow: _.isUndefined(this.props.autoGrow) ? false : this.props.autoGrow,
|
|
130
|
+
autoCapitalize: _.isUndefined(this.props.autoCapitalize) ? 'sentences' : this.props.autoCapitalize,
|
|
131
|
+
onContentSizeChange: this.onGrow.bind(this)
|
|
132
|
+
/* Focus Props */
|
|
133
|
+
,
|
|
134
|
+
onFocus: this.onFocus.bind(this),
|
|
135
|
+
onBlur: this.onBlur.bind(this)
|
|
136
|
+
})), !_.isUndefined(this.props.secureTextToggle) && this.props.secureTextToggle && /*#__PURE__*/React.createElement(TouchableOpacity, {
|
|
137
|
+
onPress: this.toggleSecure.bind(this)
|
|
138
|
+
}, /*#__PURE__*/React.createElement(Pl60Icon, {
|
|
139
|
+
name: this.state.isSecure ? 'show' : 'hide',
|
|
140
|
+
style: {
|
|
141
|
+
fontSize: 21,
|
|
142
|
+
lineHeight: 20,
|
|
143
|
+
color: TEXT_LIGHT,
|
|
144
|
+
paddingLeft: 16
|
|
145
|
+
}
|
|
146
|
+
})));
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
renderContent() {
|
|
150
|
+
if (this.props.hasContent) {
|
|
151
|
+
return this.props.children;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
if (this.props.pointerEvents) {
|
|
155
|
+
return /*#__PURE__*/React.createElement(View, {
|
|
156
|
+
pointerEvents: this.props.pointerEvents
|
|
157
|
+
}, this.renderInput());
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
return this.renderInput();
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
render() {
|
|
164
|
+
return /*#__PURE__*/React.createElement(View, null, /*#__PURE__*/React.createElement(View, {
|
|
165
|
+
style: [styles.sectionItem, this.props.hasUnderline && styles.sectionItemUnderline, this.state.focused && styles.inputFocus, this.state.focused && {
|
|
166
|
+
borderBottomColor: this.props.colourBrandingMain
|
|
167
|
+
}, !this.isValid() && !_.isEmpty(this.props.textValue) && styles.inputError, !_.isUndefined(this.props.showError) && this.props.showError === true && !this.isValid() && styles.inputError, this.props.sectionStyle]
|
|
168
|
+
}, this.renderLabel(), /*#__PURE__*/React.createElement(View, null, this.renderContent())), !_.isUndefined(this.props.showError) && this.props.showError === true && !this.isValid() && /*#__PURE__*/React.createElement(Text, {
|
|
169
|
+
style: styles.errorText
|
|
170
|
+
}, this.props.errorText));
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
const styles = StyleSheet.create({
|
|
176
|
+
sectionItem: {
|
|
177
|
+
paddingVertical: 16,
|
|
178
|
+
paddingHorizontal: 8,
|
|
179
|
+
borderBottomColor: LINEGREY
|
|
180
|
+
},
|
|
181
|
+
sectionItemUnderline: {
|
|
182
|
+
borderBottomWidth: 1
|
|
183
|
+
},
|
|
184
|
+
inputFocus: {
|
|
185
|
+
borderBottomWidth: 1
|
|
186
|
+
},
|
|
187
|
+
inputError: {
|
|
188
|
+
borderBottomWidth: 1,
|
|
189
|
+
borderBottomColor: COLOUR_GRAPEFRUIT
|
|
190
|
+
},
|
|
191
|
+
labelContainer: {
|
|
192
|
+
flexDirection: 'row',
|
|
193
|
+
alignItems: 'center',
|
|
194
|
+
marginBottom: 6
|
|
195
|
+
},
|
|
196
|
+
labelText: {
|
|
197
|
+
fontFamily: 'sf-regular',
|
|
198
|
+
fontSize: 13,
|
|
199
|
+
color: TEXT_LIGHT
|
|
200
|
+
},
|
|
201
|
+
labelError: {
|
|
202
|
+
color: COLOUR_GRAPEFRUIT
|
|
203
|
+
},
|
|
204
|
+
errorDot: {
|
|
205
|
+
height: 6,
|
|
206
|
+
width: 6,
|
|
207
|
+
borderRadius: 3,
|
|
208
|
+
marginLeft: 8,
|
|
209
|
+
marginBottom: 3
|
|
210
|
+
},
|
|
211
|
+
errorError: {
|
|
212
|
+
backgroundColor: COLOUR_GRAPEFRUIT
|
|
213
|
+
},
|
|
214
|
+
errorValid: {
|
|
215
|
+
backgroundColor: COLOUR_GREEN
|
|
216
|
+
},
|
|
217
|
+
inputStyle: {
|
|
218
|
+
fontFamily: 'sf-regular',
|
|
219
|
+
fontSize: 17,
|
|
220
|
+
margin: 0,
|
|
221
|
+
padding: 0
|
|
222
|
+
},
|
|
223
|
+
errorText: {
|
|
224
|
+
paddingTop: 8,
|
|
225
|
+
fontSize: 13,
|
|
226
|
+
fontFamily: 'sf-regular',
|
|
227
|
+
color: COLOUR_GRAPEFRUIT
|
|
228
|
+
}
|
|
229
|
+
});
|
|
230
|
+
|
|
231
|
+
const mapStateToProps = state => {
|
|
232
|
+
return {
|
|
233
|
+
colourBrandingMain: getMainBrandingColourFromState(state),
|
|
234
|
+
colourBrandingDark: getDarkBrandingColourFromState(state)
|
|
235
|
+
};
|
|
236
|
+
};
|
|
237
|
+
|
|
238
|
+
const formCardSection = connect(mapStateToProps, {})(FormCardSection);
|
|
239
|
+
export { formCardSection as FormCardSection };
|
|
240
|
+
//# sourceMappingURL=FormCardSection.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["FormCardSection.js"],"names":["React","Component","_","View","Text","TextInput","TouchableOpacity","StyleSheet","connect","Pl60Icon","TEXT_LIGHTER","TEXT_DARK","COLOUR_GREEN","LINEGREY","TEXT_LIGHT","COLOUR_GRAPEFRUIT","getMainBrandingColourFromState","getDarkBrandingColourFromState","getValueOrDefault","FormCardSection","constructor","props","state","height","minHeight","focused","isSecure","onFocus","setState","onBlur","onGrow","event","Math","max","nativeEvent","contentSize","toggleSecure","current","showSecure","isUndefined","secureTextToggle","secureTextEntry","isValid","required","isEmpty","textValue","renderErrorDot","hasError","styles","errorDot","backgroundColor","colourBrandingMain","errorError","errorValid","errorDotStyle","renderLabel","label","labelContainer","labelText","color","labelError","labelStyle","renderInput","flexDirection","flex","onChangeText","keyboardType","colourBrandingDark","placeholder","placeholderTextColor","inputStyle","textAlignVertical","autoGrow","textColour","textStyle","autoFocus","editable","autoCorrect","multiline","autoCapitalize","bind","fontSize","lineHeight","paddingLeft","renderContent","hasContent","children","pointerEvents","render","sectionItem","hasUnderline","sectionItemUnderline","inputFocus","borderBottomColor","inputError","showError","sectionStyle","errorText","create","paddingVertical","paddingHorizontal","borderBottomWidth","alignItems","marginBottom","fontFamily","width","borderRadius","marginLeft","margin","padding","paddingTop","mapStateToProps","formCardSection"],"mappings":"AAAA,OAAOA,KAAP,IAAgBC,SAAhB,QAAiC,OAAjC;AACA,OAAOC,CAAP,MAAc,QAAd;AACA,SAASC,IAAT,EAAeC,IAAf,EAAqBC,SAArB,EAAgCC,gBAAhC,EAAkDC,UAAlD,QAAoE,cAApE;AACA,SAASC,OAAT,QAAwB,aAAxB;AACA,SAASC,QAAT,QAAyB,UAAzB;AACA,SACEC,YADF,EAEEC,SAFF,EAGEC,YAHF,EAIEC,QAJF,EAKEC,UALF,EAMEC,iBANF,EAOEC,8BAPF,EAQEC,8BARF,QASO,YATP;AAUA,SAASC,iBAAT,QAAkC,WAAlC;;AAEA,MAAMC,eAAN,SAA8BlB,SAA9B,CAAwC;AACtCmB,EAAAA,WAAW,CAACC,KAAD,EAAQ;AACjB,UAAMA,KAAN;AAEA,SAAKC,KAAL,GAAa;AACXC,MAAAA,MAAM,EAAEL,iBAAiB,CAAC,KAAKG,KAAL,CAAWG,SAAZ,EAAuB,EAAvB,CADd;AAEXC,MAAAA,OAAO,EAAE,KAFE;AAGXC,MAAAA,QAAQ,EAAE;AAHC,KAAb;AAKD;;AAEDC,EAAAA,OAAO,GAAG;AACR,SAAKC,QAAL,CAAc;AAAEH,MAAAA,OAAO,EAAE;AAAX,KAAd;;AACA,QAAI,KAAKJ,KAAL,CAAWM,OAAf,EAAwB;AACtB,WAAKN,KAAL,CAAWM,OAAX;AACD;AACF;;AAEDE,EAAAA,MAAM,GAAG;AACP,SAAKD,QAAL,CAAc;AAAEH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IAAAA,MAAM,EAAE,CAHE;AAIVC,IAAAA,OAAO,EAAE;AAJC,GA1CmB;AAgD/BZ,EAAAA,SAAS,EAAE;AACTa,IAAAA,UAAU,EAAE,CADH;AAET7B,IAAAA,QAAQ,EAAE,EAFD;AAGTuB,IAAAA,UAAU,EAAE,YAHH;AAIT7C,IAAAA,KAAK,EAAE5C;AAJE;AAhDoB,CAAlB,CAAf;;AAwDA,MAAMgG,eAAe,GAAGzF,KAAK,IAAI;AAC/B,SAAO;AACL6B,IAAAA,kBAAkB,EAAEnC,8BAA8B,CAACM,KAAD,CAD7C;AAEL6C,IAAAA,kBAAkB,EAAElD,8BAA8B,CAACK,KAAD;AAF7C,GAAP;AAID,CALD;;AAOA,MAAM0F,eAAe,GAAGxG,OAAO,CAACuG,eAAD,EAAkB,EAAlB,CAAP,CAA6B5F,eAA7B,CAAxB;AACA,SAAS6F,eAAe,IAAI7F,eAA5B","sourcesContent":["import React, { Component } from 'react';\nimport _ from 'lodash';\nimport { View, Text, TextInput, TouchableOpacity, StyleSheet } from 'react-native';\nimport { connect } from 'react-redux';\nimport { Pl60Icon } from '../fonts';\nimport {\n TEXT_LIGHTER,\n TEXT_DARK,\n COLOUR_GREEN,\n LINEGREY,\n TEXT_LIGHT,\n COLOUR_GRAPEFRUIT,\n getMainBrandingColourFromState,\n getDarkBrandingColourFromState,\n} from '../colours';\nimport { getValueOrDefault } from '../helper';\n\nclass FormCardSection extends Component {\n constructor(props) {\n super(props);\n\n this.state = {\n height: getValueOrDefault(this.props.minHeight, 20),\n focused: false,\n isSecure: true,\n };\n }\n\n onFocus() {\n this.setState({ focused: true });\n if (this.props.onFocus) {\n this.props.onFocus();\n }\n }\n\n onBlur() {\n this.setState({ focused: false });\n if (this.props.onBlur) {\n this.props.onBlur();\n }\n }\n\n onGrow(event) {\n this.setState({\n height: Math.max(event.nativeEvent.contentSize.height, this.props.minHeight),\n });\n }\n\n toggleSecure() {\n const current = this.state.isSecure;\n this.setState({ isSecure: !current });\n }\n\n showSecure() {\n if (!_.isUndefined(this.props.secureTextToggle) && this.props.secureTextToggle) {\n return this.state.isSecure;\n }\n return this.props.secureTextEntry;\n }\n\n isValid() {\n if (this.props.required && _.isEmpty(this.props.textValue)) {\n return false;\n }\n if (this.props.isValid && !this.props.isValid()) {\n return false;\n }\n return true;\n }\n\n renderErrorDot() {\n if (this.props.required || this.props.hasError) {\n return (\n <View\n style={[\n styles.errorDot,\n { backgroundColor: this.props.colourBrandingMain },\n !this.isValid() && styles.errorError,\n this.isValid() && styles.errorValid,\n this.props.errorDotStyle,\n ]}\n />\n );\n }\n return null;\n }\n\n renderLabel() {\n if (_.isEmpty(this.props.label)) {\n return null;\n }\n return (\n <View style={styles.labelContainer}>\n <Text\n style={[\n styles.labelText,\n this.state.focused && { color: this.props.colourBrandingMain },\n !this.isValid() && !_.isEmpty(this.props.textValue) && styles.labelError,\n this.props.labelStyle,\n ]}\n >\n {this.props.label}\n </Text>\n {this.renderErrorDot()}\n </View>\n );\n }\n\n renderInput() {\n return (\n <View style={{ flexDirection: 'row' }}>\n <View style={{ flex: 1 }}>\n <TextInput\n value={this.props.textValue}\n onChangeText={this.props.onChangeText}\n keyboardType={this.props.keyboardType}\n /* Main Styling Props */\n selectionColor={this.props.colourBrandingDark}\n placeholder={this.props.placeholder}\n placeholderTextColor={this.props.placeholderTextColor || TEXT_LIGHTER}\n style={[\n styles.inputStyle,\n {\n textAlignVertical: this.props.autoGrow ? 'top' : 'center',\n color: this.props.textColour || TEXT_DARK,\n minHeight: this.props.minHeight || 20,\n },\n this.props.textStyle,\n ]}\n underlineColorAndroid={'rgba(0,0,0,0)'}\n /* Other Props */\n autoFocus={_.isUndefined(this.props.autoFocus) ? false : this.props.autoFocus}\n editable={_.isUndefined(this.props.editable) ? true : this.props.editable}\n secureTextEntry={_.isUndefined(this.props.secureTextEntry) ? false : this.showSecure()}\n autoCorrect={_.isUndefined(this.props.autoCorrect) ? false : this.props.autoCorrect}\n multiline={_.isUndefined(this.props.multiline) ? false : this.props.multiline}\n autoGrow={_.isUndefined(this.props.autoGrow) ? false : this.props.autoGrow}\n autoCapitalize={_.isUndefined(this.props.autoCapitalize) ? 'sentences' : this.props.autoCapitalize}\n onContentSizeChange={this.onGrow.bind(this)}\n /* Focus Props */\n onFocus={this.onFocus.bind(this)}\n onBlur={this.onBlur.bind(this)}\n />\n </View>\n {!_.isUndefined(this.props.secureTextToggle) && this.props.secureTextToggle && (\n <TouchableOpacity onPress={this.toggleSecure.bind(this)}>\n {/* <Icon\n name={this.state.isSecure ? 'eye' : 'eye-slash'}\n type='font-awesome'\n iconStyle={{ fontSize: 16, color: TEXT_MID, paddingLeft: 16 }}\n /> */}\n <Pl60Icon\n name={this.state.isSecure ? 'show' : 'hide'}\n style={{ fontSize: 21, lineHeight: 20, color: TEXT_LIGHT, paddingLeft: 16 }}\n />\n </TouchableOpacity>\n )}\n </View>\n );\n }\n\n renderContent() {\n if (this.props.hasContent) {\n return this.props.children;\n }\n if (this.props.pointerEvents) {\n return <View pointerEvents={this.props.pointerEvents}>{this.renderInput()}</View>;\n }\n return this.renderInput();\n }\n\n render() {\n return (\n <View>\n <View\n style={[\n styles.sectionItem,\n this.props.hasUnderline && styles.sectionItemUnderline,\n this.state.focused && styles.inputFocus,\n this.state.focused && { borderBottomColor: this.props.colourBrandingMain },\n !this.isValid() && !_.isEmpty(this.props.textValue) && styles.inputError,\n !_.isUndefined(this.props.showError) && this.props.showError === true && !this.isValid() && styles.inputError,\n this.props.sectionStyle,\n ]}\n >\n {this.renderLabel()}\n <View>{this.renderContent()}</View>\n </View>\n {!_.isUndefined(this.props.showError) && this.props.showError === true && !this.isValid() && (\n <Text style={styles.errorText}>{this.props.errorText}</Text>\n )}\n </View>\n );\n }\n}\n\nconst styles = StyleSheet.create({\n sectionItem: {\n paddingVertical: 16,\n paddingHorizontal: 8,\n borderBottomColor: LINEGREY,\n },\n sectionItemUnderline: {\n borderBottomWidth: 1,\n },\n inputFocus: {\n borderBottomWidth: 1,\n },\n inputError: {\n borderBottomWidth: 1,\n borderBottomColor: COLOUR_GRAPEFRUIT,\n },\n labelContainer: {\n flexDirection: 'row',\n alignItems: 'center',\n marginBottom: 6,\n },\n labelText: {\n fontFamily: 'sf-regular',\n fontSize: 13,\n color: TEXT_LIGHT,\n },\n labelError: {\n color: COLOUR_GRAPEFRUIT,\n },\n errorDot: {\n height: 6,\n width: 6,\n borderRadius: 3,\n marginLeft: 8,\n marginBottom: 3,\n },\n errorError: {\n backgroundColor: COLOUR_GRAPEFRUIT,\n },\n errorValid: {\n backgroundColor: COLOUR_GREEN,\n },\n inputStyle: {\n fontFamily: 'sf-regular',\n fontSize: 17,\n margin: 0,\n padding: 0,\n },\n errorText: {\n paddingTop: 8,\n fontSize: 13,\n fontFamily: 'sf-regular',\n color: COLOUR_GRAPEFRUIT,\n },\n});\n\nconst mapStateToProps = state => {\n return {\n colourBrandingMain: getMainBrandingColourFromState(state),\n colourBrandingDark: getDarkBrandingColourFromState(state),\n };\n};\n\nconst formCardSection = connect(mapStateToProps, {})(FormCardSection);\nexport { formCardSection as FormCardSection };\n"]}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import React, { PureComponent } from 'react';
|
|
2
|
+
import { View, Text, TouchableOpacity } from 'react-native';
|
|
3
|
+
import { Icon } from 'react-native-elements';
|
|
4
|
+
import { connect } from 'react-redux';
|
|
5
|
+
import { TEXT_DARK, TEXT_LIGHT, getMainBrandingColourFromState } from '../colours';
|
|
6
|
+
import { FormCardSection } from './FormCardSection';
|
|
7
|
+
|
|
8
|
+
class FormCardSectionOptionLauncher extends PureComponent {
|
|
9
|
+
render() {
|
|
10
|
+
const {
|
|
11
|
+
onPress,
|
|
12
|
+
sectionStyle,
|
|
13
|
+
textStyle,
|
|
14
|
+
title,
|
|
15
|
+
description,
|
|
16
|
+
value,
|
|
17
|
+
icon,
|
|
18
|
+
colourBrandingMain
|
|
19
|
+
} = this.props;
|
|
20
|
+
return /*#__PURE__*/React.createElement(TouchableOpacity, {
|
|
21
|
+
onPress: onPress
|
|
22
|
+
}, /*#__PURE__*/React.createElement(FormCardSection, {
|
|
23
|
+
hasContent: true,
|
|
24
|
+
sectionStyle: sectionStyle
|
|
25
|
+
}, /*#__PURE__*/React.createElement(View, {
|
|
26
|
+
style: styles.container
|
|
27
|
+
}, /*#__PURE__*/React.createElement(Text, {
|
|
28
|
+
style: [styles.text, {
|
|
29
|
+
marginRight: 16,
|
|
30
|
+
flex: 1
|
|
31
|
+
}, textStyle]
|
|
32
|
+
}, title), /*#__PURE__*/React.createElement(Text, {
|
|
33
|
+
style: [styles.text, {
|
|
34
|
+
marginRight: 16
|
|
35
|
+
}]
|
|
36
|
+
}, value), /*#__PURE__*/React.createElement(Icon, {
|
|
37
|
+
name: icon ? icon : 'angle-right',
|
|
38
|
+
type: "font-awesome",
|
|
39
|
+
iconStyle: [styles.text, {
|
|
40
|
+
fontSize: 20,
|
|
41
|
+
color: colourBrandingMain
|
|
42
|
+
}]
|
|
43
|
+
})), description ? /*#__PURE__*/React.createElement(Text, {
|
|
44
|
+
style: styles.description
|
|
45
|
+
}, description) : null));
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
const styles = {
|
|
51
|
+
container: {
|
|
52
|
+
flexDirection: 'row',
|
|
53
|
+
alignSelf: 'stretch',
|
|
54
|
+
alignItems: 'center'
|
|
55
|
+
},
|
|
56
|
+
text: {
|
|
57
|
+
fontFamily: 'sf-regular',
|
|
58
|
+
fontSize: 17,
|
|
59
|
+
color: TEXT_DARK
|
|
60
|
+
},
|
|
61
|
+
description: {
|
|
62
|
+
fontFamily: 'sf-regular',
|
|
63
|
+
fontSize: 15,
|
|
64
|
+
color: TEXT_LIGHT,
|
|
65
|
+
marginTop: 8
|
|
66
|
+
}
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
const mapStateToProps = state => {
|
|
70
|
+
return {
|
|
71
|
+
colourBrandingMain: getMainBrandingColourFromState(state)
|
|
72
|
+
};
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
const formCardSectionOptionLauncher = connect(mapStateToProps, {})(FormCardSectionOptionLauncher);
|
|
76
|
+
export { formCardSectionOptionLauncher as FormCardSectionOptionLauncher };
|
|
77
|
+
//# sourceMappingURL=FormCardSectionOptionLauncher.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["FormCardSectionOptionLauncher.js"],"names":["React","PureComponent","View","Text","TouchableOpacity","Icon","connect","TEXT_DARK","TEXT_LIGHT","getMainBrandingColourFromState","FormCardSection","FormCardSectionOptionLauncher","render","onPress","sectionStyle","textStyle","title","description","value","icon","colourBrandingMain","props","styles","container","text","marginRight","flex","fontSize","color","flexDirection","alignSelf","alignItems","fontFamily","marginTop","mapStateToProps","state","formCardSectionOptionLauncher"],"mappings":"AAAA,OAAOA,KAAP,IAAgBC,aAAhB,QAAqC,OAArC;AACA,SAASC,IAAT,EAAeC,IAAf,EAAqBC,gBAArB,QAA6C,cAA7C;AACA,SAASC,IAAT,QAAqB,uBAArB;AACA,SAASC,OAAT,QAAwB,aAAxB;AACA,SAASC,SAAT,EAAoBC,UAApB,EAAgCC,8BAAhC,QAAsE,YAAtE;AACA,SAASC,eAAT,QAAgC,mBAAhC;;AAEA,MAAMC,6BAAN,SAA4CV,aAA5C,CAA0D;AACxDW,EAAAA,MAAM,GAAG;AACP,UAAM;AAAEC,MAAAA,OAAF;AAAWC,MAAAA,YAAX;AAAyBC,MAAAA,SAAzB;AAAoCC,MAAAA,KAApC;AAA2CC,MAAAA,WAA3C;AAAwDC,MAAAA,KAAxD;AAA+DC,MAAAA,IAA/D;AAAqEC,MAAAA;AAArE,QAA4F,KAAKC,KAAvG;AAEA,wBACE,oBAAC,gBAAD;AAAkB,MAAA,OAAO,EAAER;AAA3B,oBACE,oBAAC,eAAD;AAAiB,MAAA,UAAU,MAA3B;AAA4B,MAAA,YAAY,EAAEC;AAA1C,oBACE,oBAAC,IAAD;AAAM,MA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AGC,KAAK,IAAI;AAC/B,SAAO;AACLf,IAAAA,kBAAkB,EAAEX,8BAA8B,CAAC0B,KAAD;AAD7C,GAAP;AAGD,CAJD;;AAMA,MAAMC,6BAA6B,GAAG9B,OAAO,CAAC4B,eAAD,EAAkB,EAAlB,CAAP,CAA6BvB,6BAA7B,CAAtC;AACA,SAASyB,6BAA6B,IAAIzB,6BAA1C","sourcesContent":["import React, { PureComponent } from 'react';\nimport { View, Text, TouchableOpacity } from 'react-native';\nimport { Icon } from 'react-native-elements';\nimport { connect } from 'react-redux';\nimport { TEXT_DARK, TEXT_LIGHT, getMainBrandingColourFromState } from '../colours';\nimport { FormCardSection } from './FormCardSection';\n\nclass FormCardSectionOptionLauncher extends PureComponent {\n render() {\n const { onPress, sectionStyle, textStyle, title, description, value, icon, colourBrandingMain } = this.props;\n\n return (\n <TouchableOpacity onPress={onPress}>\n <FormCardSection hasContent sectionStyle={sectionStyle}>\n <View style={styles.container}>\n <Text style={[styles.text, { marginRight: 16, flex: 1 }, textStyle]}>{title}</Text>\n <Text style={[styles.text, { marginRight: 16 }]}>{value}</Text>\n <Icon\n name={icon ? icon : 'angle-right'}\n type=\"font-awesome\"\n iconStyle={[styles.text, { fontSize: 20, color: colourBrandingMain }]}\n />\n </View>\n {description ? <Text style={styles.description}>{description}</Text> : null}\n </FormCardSection>\n </TouchableOpacity>\n );\n }\n}\n\nconst styles = {\n container: {\n flexDirection: 'row',\n alignSelf: 'stretch',\n alignItems: 'center',\n },\n text: {\n fontFamily: 'sf-regular',\n fontSize: 17,\n color: TEXT_DARK,\n },\n description: {\n fontFamily: 'sf-regular',\n fontSize: 15,\n color: TEXT_LIGHT,\n marginTop: 8,\n },\n};\n\nconst mapStateToProps = state => {\n return {\n colourBrandingMain: getMainBrandingColourFromState(state),\n };\n};\n\nconst formCardSectionOptionLauncher = connect(mapStateToProps, {})(FormCardSectionOptionLauncher);\nexport { formCardSectionOptionLauncher as FormCardSectionOptionLauncher };\n"]}
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
2
|
+
|
|
3
|
+
import React, { Component } from 'react';
|
|
4
|
+
import { Linking } from 'react-native';
|
|
5
|
+
import { connect } from 'react-redux';
|
|
6
|
+
import ParsedText from 'react-native-parsed-text';
|
|
7
|
+
import { getMainBrandingColourFromState, TEXT_DARKEST } from '../colours';
|
|
8
|
+
import { getValidUrl } from '../helper';
|
|
9
|
+
import { analyticsActions } from '../apis';
|
|
10
|
+
|
|
11
|
+
class FormattedText extends Component {
|
|
12
|
+
constructor() {
|
|
13
|
+
super(...arguments);
|
|
14
|
+
|
|
15
|
+
_defineProperty(this, "onPressUrl", url => {
|
|
16
|
+
const urlToUse = getValidUrl(url);
|
|
17
|
+
Linking.openURL(urlToUse);
|
|
18
|
+
this.checkLog('UrlClick', urlToUse);
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
_defineProperty(this, "onPressUrlText", urlText => {
|
|
22
|
+
const texts = urlText.match(FormattedText.UrlTextRegex);
|
|
23
|
+
this.onPressUrl(texts[1]);
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
_defineProperty(this, "onPressEmail", email => {
|
|
27
|
+
Linking.openURL(`mailto:${email}`);
|
|
28
|
+
this.checkLog('EmailClick', email);
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
_defineProperty(this, "onPressPhone", phone => {
|
|
32
|
+
const parsedPhone = phone.replace(/\D/g, '');
|
|
33
|
+
Linking.openURL(`tel:${parsedPhone.replace(/\D/g, '')}`);
|
|
34
|
+
this.checkLog('PhoneClick', parsedPhone);
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
_defineProperty(this, "ifEnabled", value => this.props.disabled ? undefined : value);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
static get UrlTextRegex() {
|
|
41
|
+
return /\[([^\]\|\]]+)\|([^\]\|\]]+)\]/i;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
checkLog(type, target) {
|
|
45
|
+
if (this.props.logClicks) {
|
|
46
|
+
analyticsActions.log(this.props.site, type, this.props.entityType, this.props.entityId, {
|
|
47
|
+
target
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
renderTextContent(matchingString, matches) {
|
|
53
|
+
return matches[1];
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
renderUrlText(matchingString, matches) {
|
|
57
|
+
return matches[2];
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
render() {
|
|
61
|
+
const {
|
|
62
|
+
style,
|
|
63
|
+
numberOfLines,
|
|
64
|
+
titleSize,
|
|
65
|
+
colourBrandingMain,
|
|
66
|
+
subtitleSize,
|
|
67
|
+
children
|
|
68
|
+
} = this.props;
|
|
69
|
+
return /*#__PURE__*/React.createElement(ParsedText, {
|
|
70
|
+
style: [styles.text, this.ifEnabled({
|
|
71
|
+
lineHeight: 24
|
|
72
|
+
}), style],
|
|
73
|
+
numberOfLines: numberOfLines,
|
|
74
|
+
parse: [{
|
|
75
|
+
pattern: /\*\*(.*?)\*\*/i,
|
|
76
|
+
style: this.ifEnabled({
|
|
77
|
+
fontFamily: 'sf-bold',
|
|
78
|
+
lineHeight: 24
|
|
79
|
+
}),
|
|
80
|
+
renderText: this.renderTextContent
|
|
81
|
+
}, {
|
|
82
|
+
pattern: /\*t\*(.*?)\*t\*/i,
|
|
83
|
+
style: this.ifEnabled({
|
|
84
|
+
fontSize: titleSize || 22,
|
|
85
|
+
color: colourBrandingMain,
|
|
86
|
+
fontFamily: 'sf-semibold',
|
|
87
|
+
lineHeight: 24
|
|
88
|
+
}),
|
|
89
|
+
renderText: this.renderTextContent
|
|
90
|
+
}, {
|
|
91
|
+
pattern: /\*s\*(.*?)\*s\*/i,
|
|
92
|
+
style: this.ifEnabled({
|
|
93
|
+
fontSize: subtitleSize || 18,
|
|
94
|
+
color: TEXT_DARKEST,
|
|
95
|
+
fontFamily: 'sf-semibold',
|
|
96
|
+
lineHeight: 24
|
|
97
|
+
}),
|
|
98
|
+
renderText: this.renderTextContent
|
|
99
|
+
}, {
|
|
100
|
+
pattern: FormattedText.UrlTextRegex,
|
|
101
|
+
style: this.ifEnabled({
|
|
102
|
+
color: colourBrandingMain
|
|
103
|
+
}),
|
|
104
|
+
onPress: this.ifEnabled(this.onPressUrlText),
|
|
105
|
+
renderText: this.renderUrlText
|
|
106
|
+
}, {
|
|
107
|
+
pattern: /(?:(?:https?|ftp|file):\/\/|www\.|ftp\.)(?:\([-A-Z0-9+&@#\/%=~_|$?!:,.]*\)|[-A-Z0-9+&@#\/%=~_|$?!:,.])*(?:\([-A-Z0-9+&@#\/%=~_|$?!:,.]*\)|[A-Z0-9+&@#\/%=~_|$])/im,
|
|
108
|
+
style: this.ifEnabled({
|
|
109
|
+
color: colourBrandingMain
|
|
110
|
+
}),
|
|
111
|
+
onPress: this.ifEnabled(this.onPressUrl)
|
|
112
|
+
}, {
|
|
113
|
+
pattern: /([A-Z0-9._%-]+)@([A-Z0-9.-]+\.[A-Z]{2,4})/im,
|
|
114
|
+
style: this.ifEnabled({
|
|
115
|
+
color: colourBrandingMain
|
|
116
|
+
}),
|
|
117
|
+
onPress: this.ifEnabled(this.onPressEmail)
|
|
118
|
+
}, {
|
|
119
|
+
pattern: /(?:\+?(\d{1,3}))?([-. (]*(\d{1,3})[-. )]*)?((\d{2,4})[-. ]*(\d{2,4})(?:[-.x ]*(\d+))?)\s*$/im,
|
|
120
|
+
style: this.ifEnabled({
|
|
121
|
+
color: colourBrandingMain
|
|
122
|
+
}),
|
|
123
|
+
onPress: this.ifEnabled(this.onPressPhone)
|
|
124
|
+
}]
|
|
125
|
+
}, children);
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
const styles = {
|
|
131
|
+
text: {
|
|
132
|
+
color: TEXT_DARKEST,
|
|
133
|
+
fontSize: 14,
|
|
134
|
+
fontFamily: 'sf-regular'
|
|
135
|
+
}
|
|
136
|
+
};
|
|
137
|
+
|
|
138
|
+
const mapStateToProps = state => {
|
|
139
|
+
return {
|
|
140
|
+
colourBrandingMain: getMainBrandingColourFromState(state)
|
|
141
|
+
};
|
|
142
|
+
};
|
|
143
|
+
|
|
144
|
+
export default connect(mapStateToProps, {})(FormattedText);
|
|
145
|
+
//# sourceMappingURL=FormattedText.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["FormattedText.js"],"names":["React","Component","Linking","connect","ParsedText","getMainBrandingColourFromState","TEXT_DARKEST","getValidUrl","analyticsActions","FormattedText","url","urlToUse","openURL","checkLog","urlText","texts","match","UrlTextRegex","onPressUrl","email","phone","parsedPhone","replace","value","props","disabled","undefined","type","target","logClicks","log","site","entityType","entityId","renderTextContent","matchingString","matches","renderUrlText","render","style","numberOfLines","titleSize","colourBrandingMain","subtitleSize","children","styles","text","ifEnabled","lineHeight","pattern","fontFamily","renderText","fontSize","color","onPress","onPressUrlText","onPressEmail","onPressPhone","mapStateToProps","state"],"mappings":";;AAAA,OAAOA,KAAP,IAAgBC,SAAhB,QAAiC,OAAjC;AACA,SAASC,OAAT,QAAwB,cAAxB;AACA,SAASC,OAAT,QAAwB,aAAxB;AACA,OAAOC,UAAP,MAAuB,0BAAvB;AACA,SAASC,8BAAT,EAAyCC,YAAzC,QAA6D,YAA7D;AACA,SAASC,WAAT,QAA4B,WAA5B;AACA,SAASC,gBAAT,QAAiC,SAAjC;;AAEA,MAAMC,aAAN,SAA4BR,SAA5B,CAAsC;AAAA;AAAA;;AAAA,wCAWvBS,GAAG,IAAI;AAClB,YAAMC,QAAQ,GAAGJ,WAAW,CAACG,GAAD,CAA5B;AACAR,MAAAA,OAAO,CAACU,OAAR,CAAgBD,QAAhB;AACA,WAAKE,QAAL,CAAc,UAAd,EAA0BF,QAA1B;AACD,KAfmC;;AAAA,4CAiBnB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B,EAAlB,CAAP,CAA6BjD,aAA7B,CAAf","sourcesContent":["import React, { Component } from 'react';\nimport { Linking } from 'react-native';\nimport { connect } from 'react-redux';\nimport ParsedText from 'react-native-parsed-text';\nimport { getMainBrandingColourFromState, TEXT_DARKEST } from '../colours';\nimport { getValidUrl } from '../helper';\nimport { analyticsActions } from '../apis';\n\nclass FormattedText extends Component {\n static get UrlTextRegex() {\n return /\\[([^\\]\\|\\]]+)\\|([^\\]\\|\\]]+)\\]/i;\n }\n\n checkLog(type, target) {\n if (this.props.logClicks) {\n analyticsActions.log(this.props.site, type, this.props.entityType, this.props.entityId, { target });\n }\n }\n\n onPressUrl = url => {\n const urlToUse = getValidUrl(url);\n Linking.openURL(urlToUse);\n this.checkLog('UrlClick', urlToUse);\n };\n\n onPressUrlText = urlText => {\n const texts = urlText.match(FormattedText.UrlTextRegex);\n this.onPressUrl(texts[1]);\n };\n\n onPressEmail = email => {\n Linking.openURL(`mailto:${email}`);\n this.checkLog('EmailClick', email);\n };\n\n onPressPhone = phone => {\n const parsedPhone = phone.replace(/\\D/g, '');\n Linking.openURL(`tel:${parsedPhone.replace(/\\D/g, '')}`);\n this.checkLog('PhoneClick', parsedPhone);\n };\n\n ifEnabled = value => (this.props.disabled ? undefined : value);\n\n renderTextContent(matchingString, matches) {\n return matches[1];\n }\n\n renderUrlText(matchingString, matches) {\n return matches[2];\n }\n\n render() {\n const { style, numberOfLines, titleSize, colourBrandingMain, subtitleSize, children } = this.props;\n\n return (\n <ParsedText\n style={[styles.text, this.ifEnabled({ lineHeight: 24 }), style]}\n numberOfLines={numberOfLines}\n parse={[\n {\n pattern: /\\*\\*(.*?)\\*\\*/i,\n style: this.ifEnabled({\n fontFamily: 'sf-bold',\n lineHeight: 24,\n }),\n renderText: this.renderTextContent,\n },\n {\n pattern: /\\*t\\*(.*?)\\*t\\*/i,\n style: this.ifEnabled({\n fontSize: titleSize || 22,\n color: colourBrandingMain,\n fontFamily: 'sf-semibold',\n lineHeight: 24,\n }),\n renderText: this.renderTextContent,\n },\n {\n pattern: /\\*s\\*(.*?)\\*s\\*/i,\n style: this.ifEnabled({\n fontSize: subtitleSize || 18,\n color: TEXT_DARKEST,\n fontFamily: 'sf-semibold',\n lineHeight: 24,\n }),\n renderText: this.renderTextContent,\n },\n {\n pattern: FormattedText.UrlTextRegex,\n style: this.ifEnabled({ color: colourBrandingMain }),\n onPress: this.ifEnabled(this.onPressUrlText),\n renderText: this.renderUrlText,\n },\n {\n pattern: /(?:(?:https?|ftp|file):\\/\\/|www\\.|ftp\\.)(?:\\([-A-Z0-9+&@#\\/%=~_|$?!:,.]*\\)|[-A-Z0-9+&@#\\/%=~_|$?!:,.])*(?:\\([-A-Z0-9+&@#\\/%=~_|$?!:,.]*\\)|[A-Z0-9+&@#\\/%=~_|$])/im,\n style: this.ifEnabled({ color: colourBrandingMain }),\n onPress: this.ifEnabled(this.onPressUrl),\n },\n {\n pattern: /([A-Z0-9._%-]+)@([A-Z0-9.-]+\\.[A-Z]{2,4})/im,\n style: this.ifEnabled({ color: colourBrandingMain }),\n onPress: this.ifEnabled(this.onPressEmail),\n },\n {\n pattern: /(?:\\+?(\\d{1,3}))?([-. (]*(\\d{1,3})[-. )]*)?((\\d{2,4})[-. ]*(\\d{2,4})(?:[-.x ]*(\\d+))?)\\s*$/im,\n style: this.ifEnabled({ color: colourBrandingMain }),\n onPress: this.ifEnabled(this.onPressPhone),\n },\n ]}\n >\n {children}\n </ParsedText>\n );\n }\n}\n\nconst styles = {\n text: {\n color: TEXT_DARKEST,\n fontSize: 14,\n fontFamily: 'sf-regular',\n },\n};\n\nconst mapStateToProps = state => {\n return {\n colourBrandingMain: getMainBrandingColourFromState(state),\n };\n};\n\nexport default connect(mapStateToProps, {})(FormattedText);\n"]}
|