@plusscommunities/pluss-core-app 8.0.29 → 8.0.31

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.
Files changed (210) hide show
  1. package/dist/module/actions/FollowerActions.js +34 -0
  2. package/dist/module/actions/FollowerActions.js.map +1 -0
  3. package/dist/module/actions/MediaActions.js +29 -0
  4. package/dist/module/actions/MediaActions.js.map +1 -0
  5. package/dist/module/actions/ResidentActions.js +26 -0
  6. package/dist/module/actions/ResidentActions.js.map +1 -0
  7. package/dist/module/actions/UserActions.js +223 -0
  8. package/dist/module/actions/UserActions.js.map +1 -0
  9. package/dist/module/actions/UserSettingsActions.js +14 -0
  10. package/dist/module/actions/UserSettingsActions.js.map +1 -0
  11. package/dist/module/actions/index.js +6 -0
  12. package/dist/module/actions/index.js.map +1 -0
  13. package/dist/module/actions/types.js +17 -0
  14. package/dist/module/actions/types.js.map +1 -0
  15. package/dist/module/apis/analyticsActions.js +20 -0
  16. package/dist/module/apis/analyticsActions.js.map +1 -0
  17. package/dist/module/apis/contactActions.js +27 -0
  18. package/dist/module/apis/contactActions.js.map +1 -0
  19. package/dist/module/apis/eventActions.js +161 -0
  20. package/dist/module/apis/eventActions.js.map +1 -0
  21. package/dist/module/apis/fileActions.js +93 -0
  22. package/dist/module/apis/fileActions.js.map +1 -0
  23. package/dist/module/apis/followerActions.js +38 -0
  24. package/dist/module/apis/followerActions.js.map +1 -0
  25. package/dist/module/apis/index.js +13 -0
  26. package/dist/module/apis/index.js.map +1 -0
  27. package/dist/module/apis/notificationActions.js +60 -0
  28. package/dist/module/apis/notificationActions.js.map +1 -0
  29. package/dist/module/apis/profileActions.js +14 -0
  30. package/dist/module/apis/profileActions.js.map +1 -0
  31. package/dist/module/apis/reactionActions.js +76 -0
  32. package/dist/module/apis/reactionActions.js.map +1 -0
  33. package/dist/module/apis/settingActions.js +22 -0
  34. package/dist/module/apis/settingActions.js.map +1 -0
  35. package/dist/module/apis/stringActions.js +30 -0
  36. package/dist/module/apis/stringActions.js.map +1 -0
  37. package/dist/module/apis/typeActions.js +15 -0
  38. package/dist/module/apis/typeActions.js.map +1 -0
  39. package/dist/module/apis/userActions.js +104 -0
  40. package/dist/module/apis/userActions.js.map +1 -0
  41. package/dist/module/assets/icons/fontawesome/fa-brands-400.ttf +0 -0
  42. package/dist/module/assets/icons/fontawesome/fa-light-300.ttf +0 -0
  43. package/dist/module/assets/icons/fontawesome/fa-regular-400.ttf +0 -0
  44. package/dist/module/assets/icons/fontawesome/fa-solid-900.ttf +0 -0
  45. package/dist/module/assets/icons/fontawesome/fa-thin-100.ttf +0 -0
  46. package/dist/module/assets/icons/fontawesome/fa7-glyphmap.json +4205 -0
  47. package/dist/module/assets/icons/reactions/heart.png +0 -0
  48. package/dist/module/assets/icons/reactions/party.png +0 -0
  49. package/dist/module/assets/icons/reactions/sad.png +0 -0
  50. package/dist/module/assets/icons/reactions/smile.png +0 -0
  51. package/dist/module/colours.js +165 -0
  52. package/dist/module/colours.js.map +1 -0
  53. package/dist/module/components/AddButton.js +43 -0
  54. package/dist/module/components/AddButton.js.map +1 -0
  55. package/dist/module/components/AddToCalendarButton.js +225 -0
  56. package/dist/module/components/AddToCalendarButton.js.map +1 -0
  57. package/dist/module/components/Attachment.js +55 -0
  58. package/dist/module/components/Attachment.js.map +1 -0
  59. package/dist/module/components/AudienceSelectorLauncher.js +64 -0
  60. package/dist/module/components/AudienceSelectorLauncher.js.map +1 -0
  61. package/dist/module/components/AudienceSelectorPage.js +351 -0
  62. package/dist/module/components/AudienceSelectorPage.js.map +1 -0
  63. package/dist/module/components/AutoOffsetImage.js +184 -0
  64. package/dist/module/components/AutoOffsetImage.js.map +1 -0
  65. package/dist/module/components/BackButton.js +58 -0
  66. package/dist/module/components/BackButton.js.map +1 -0
  67. package/dist/module/components/CalendarPopup.js +126 -0
  68. package/dist/module/components/CalendarPopup.js.map +1 -0
  69. package/dist/module/components/CategoryTabs.js +155 -0
  70. package/dist/module/components/CategoryTabs.js.map +1 -0
  71. package/dist/module/components/CommentReply.js +334 -0
  72. package/dist/module/components/CommentReply.js.map +1 -0
  73. package/dist/module/components/CommentSection.js +823 -0
  74. package/dist/module/components/CommentSection.js.map +1 -0
  75. package/dist/module/components/ConfirmPopup.js +109 -0
  76. package/dist/module/components/ConfirmPopup.js.map +1 -0
  77. package/dist/module/components/ConfirmationPopup.js +72 -0
  78. package/dist/module/components/ConfirmationPopup.js.map +1 -0
  79. package/dist/module/components/DocumentUploader.js +253 -0
  80. package/dist/module/components/DocumentUploader.js.map +1 -0
  81. package/dist/module/components/DropDownItem.js +75 -0
  82. package/dist/module/components/DropDownItem.js.map +1 -0
  83. package/dist/module/components/DropDownMenu.js +41 -0
  84. package/dist/module/components/DropDownMenu.js.map +1 -0
  85. package/dist/module/components/EmptyStateMain.js +51 -0
  86. package/dist/module/components/EmptyStateMain.js.map +1 -0
  87. package/dist/module/components/EmptyStateWidget.js +48 -0
  88. package/dist/module/components/EmptyStateWidget.js.map +1 -0
  89. package/dist/module/components/FontScaleButton.js +37 -0
  90. package/dist/module/components/FontScaleButton.js.map +1 -0
  91. package/dist/module/components/FontScalePopup.js +76 -0
  92. package/dist/module/components/FontScalePopup.js.map +1 -0
  93. package/dist/module/components/Forbidden.js +58 -0
  94. package/dist/module/components/Forbidden.js.map +1 -0
  95. package/dist/module/components/FormCard.js +25 -0
  96. package/dist/module/components/FormCard.js.map +1 -0
  97. package/dist/module/components/FormCardSection.js +214 -0
  98. package/dist/module/components/FormCardSection.js.map +1 -0
  99. package/dist/module/components/FormCardSectionOptionLauncher.js +73 -0
  100. package/dist/module/components/FormCardSectionOptionLauncher.js.map +1 -0
  101. package/dist/module/components/FormattedText.js +133 -0
  102. package/dist/module/components/FormattedText.js.map +1 -0
  103. package/dist/module/components/GenericInput.js +151 -0
  104. package/dist/module/components/GenericInput.js.map +1 -0
  105. package/dist/module/components/GenericInputSection.js +173 -0
  106. package/dist/module/components/GenericInputSection.js.map +1 -0
  107. package/dist/module/components/Header.js +459 -0
  108. package/dist/module/components/Header.js.map +1 -0
  109. package/dist/module/components/Icon.js +109 -0
  110. package/dist/module/components/Icon.js.map +1 -0
  111. package/dist/module/components/ImagePopup.js +400 -0
  112. package/dist/module/components/ImagePopup.js.map +1 -0
  113. package/dist/module/components/ImageUploadProgress.js +69 -0
  114. package/dist/module/components/ImageUploadProgress.js.map +1 -0
  115. package/dist/module/components/ImageUploader.js +831 -0
  116. package/dist/module/components/ImageUploader.js.map +1 -0
  117. package/dist/module/components/InlineButton.js +66 -0
  118. package/dist/module/components/InlineButton.js.map +1 -0
  119. package/dist/module/components/Input.js +156 -0
  120. package/dist/module/components/Input.js.map +1 -0
  121. package/dist/module/components/LoadingCircles.js +219 -0
  122. package/dist/module/components/LoadingCircles.js.map +1 -0
  123. package/dist/module/components/LoadingIndicator.js +86 -0
  124. package/dist/module/components/LoadingIndicator.js.map +1 -0
  125. package/dist/module/components/LoadingStateWidget.js +46 -0
  126. package/dist/module/components/LoadingStateWidget.js.map +1 -0
  127. package/dist/module/components/MediaPlayer.js +407 -0
  128. package/dist/module/components/MediaPlayer.js.map +1 -0
  129. package/dist/module/components/MiddlePopup.js +49 -0
  130. package/dist/module/components/MiddlePopup.js.map +1 -0
  131. package/dist/module/components/PDFPopup.js +296 -0
  132. package/dist/module/components/PDFPopup.js.map +1 -0
  133. package/dist/module/components/PlussChat.js +1078 -0
  134. package/dist/module/components/PlussChat.js.map +1 -0
  135. package/dist/module/components/PlussChatMessage.js +299 -0
  136. package/dist/module/components/PlussChatMessage.js.map +1 -0
  137. package/dist/module/components/PlussChatTime.js +59 -0
  138. package/dist/module/components/PlussChatTime.js.map +1 -0
  139. package/dist/module/components/Popup.js +126 -0
  140. package/dist/module/components/Popup.js.map +1 -0
  141. package/dist/module/components/PopupMenu.js +120 -0
  142. package/dist/module/components/PopupMenu.js.map +1 -0
  143. package/dist/module/components/PositionedImage.js +313 -0
  144. package/dist/module/components/PositionedImage.js.map +1 -0
  145. package/dist/module/components/ProfilePic.js +105 -0
  146. package/dist/module/components/ProfilePic.js.map +1 -0
  147. package/dist/module/components/RadioButton.js +78 -0
  148. package/dist/module/components/RadioButton.js.map +1 -0
  149. package/dist/module/components/Reaction.js +117 -0
  150. package/dist/module/components/Reaction.js.map +1 -0
  151. package/dist/module/components/Reactions.js +71 -0
  152. package/dist/module/components/Reactions.js.map +1 -0
  153. package/dist/module/components/SharingTools.js +189 -0
  154. package/dist/module/components/SharingTools.js.map +1 -0
  155. package/dist/module/components/Spinner.js +22 -0
  156. package/dist/module/components/Spinner.js.map +1 -0
  157. package/dist/module/components/StickyFooter.js +34 -0
  158. package/dist/module/components/StickyFooter.js.map +1 -0
  159. package/dist/module/components/Text.js +57 -0
  160. package/dist/module/components/Text.js.map +1 -0
  161. package/dist/module/components/TickIcon.js +24 -0
  162. package/dist/module/components/TickIcon.js.map +1 -0
  163. package/dist/module/components/Toggle.js +66 -0
  164. package/dist/module/components/Toggle.js.map +1 -0
  165. package/dist/module/components/TouchableSearchBar.js +68 -0
  166. package/dist/module/components/TouchableSearchBar.js.map +1 -0
  167. package/dist/module/components/UserListPopup.js +136 -0
  168. package/dist/module/components/UserListPopup.js.map +1 -0
  169. package/dist/module/components/UserListing.js +268 -0
  170. package/dist/module/components/UserListing.js.map +1 -0
  171. package/dist/module/components/VideoPopup.js +113 -0
  172. package/dist/module/components/VideoPopup.js.map +1 -0
  173. package/dist/module/components/WarningPopup.js +85 -0
  174. package/dist/module/components/WarningPopup.js.map +1 -0
  175. package/dist/module/components/expo-image-picker-multiple/ImageBrowser.js +289 -0
  176. package/dist/module/components/expo-image-picker-multiple/ImageBrowser.js.map +1 -0
  177. package/dist/module/components/expo-image-picker-multiple/ImageTile.js +117 -0
  178. package/dist/module/components/expo-image-picker-multiple/ImageTile.js.map +1 -0
  179. package/dist/module/components/index.js +60 -0
  180. package/dist/module/components/index.js.map +1 -0
  181. package/dist/module/components/react-native-expo-image-cropper/ExpoImageManipulator.js +422 -0
  182. package/dist/module/components/react-native-expo-image-cropper/ExpoImageManipulator.js.map +1 -0
  183. package/dist/module/components/react-native-expo-image-cropper/ImageCropOverlay.js +387 -0
  184. package/dist/module/components/react-native-expo-image-cropper/ImageCropOverlay.js.map +1 -0
  185. package/dist/module/config.js +27 -0
  186. package/dist/module/config.js.map +1 -0
  187. package/dist/module/constants.js +18 -0
  188. package/dist/module/constants.js.map +1 -0
  189. package/dist/module/helper.js +424 -0
  190. package/dist/module/helper.js.map +1 -0
  191. package/dist/module/index.js +13 -0
  192. package/dist/module/index.js.map +1 -0
  193. package/dist/module/js/images/detectFaces.js +31 -0
  194. package/dist/module/js/images/detectFaces.js.map +1 -0
  195. package/dist/module/js/images/findLandmarkRange.js +93 -0
  196. package/dist/module/js/images/findLandmarkRange.js.map +1 -0
  197. package/dist/module/js/images/getScaledOffset.js +81 -0
  198. package/dist/module/js/images/getScaledOffset.js.map +1 -0
  199. package/dist/module/js/site/getSiteLevelFromState.js +29 -0
  200. package/dist/module/js/site/getSiteLevelFromState.js.map +1 -0
  201. package/dist/module/js/site/isTVEnabled.js +10 -0
  202. package/dist/module/js/site/isTVEnabled.js.map +1 -0
  203. package/dist/module/session.js +58 -0
  204. package/dist/module/session.js.map +1 -0
  205. package/dist/module/styles.js +67 -0
  206. package/dist/module/styles.js.map +1 -0
  207. package/dist/module/withNavigationFocus.js +30 -0
  208. package/dist/module/withNavigationFocus.js.map +1 -0
  209. package/package.json +1 -1
  210. package/src/components/PDFPopup.js +130 -35
@@ -0,0 +1,214 @@
1
+ import React, { Component } from "react";
2
+ import { Text } from "@plusscommunities/pluss-core-app/components";
3
+ import _ from "lodash";
4
+ import { View, TextInput, TouchableOpacity, StyleSheet } from "react-native";
5
+ import { connect } from "react-redux";
6
+ import { TEXT_LIGHTER, TEXT_DARK, COLOUR_GREEN, LINEGREY, TEXT_LIGHT, COLOUR_GRAPEFRUIT, getMainBrandingColourFromState, getDarkBrandingColourFromState } from "../colours";
7
+ import { getValueOrDefault } from "../helper";
8
+ import { FontAwesome } from "./Icon";
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
+ onFocus() {
19
+ this.setState({
20
+ focused: true
21
+ });
22
+ if (this.props.onFocus) {
23
+ this.props.onFocus();
24
+ }
25
+ }
26
+ onBlur() {
27
+ this.setState({
28
+ focused: false
29
+ });
30
+ if (this.props.onBlur) {
31
+ this.props.onBlur();
32
+ }
33
+ }
34
+ onGrow(event) {
35
+ this.setState({
36
+ height: Math.max(event.nativeEvent.contentSize.height, this.props.minHeight)
37
+ });
38
+ }
39
+ toggleSecure() {
40
+ const current = this.state.isSecure;
41
+ this.setState({
42
+ isSecure: !current
43
+ });
44
+ }
45
+ showSecure() {
46
+ if (!_.isUndefined(this.props.secureTextToggle) && this.props.secureTextToggle) {
47
+ return this.state.isSecure;
48
+ }
49
+ return this.props.secureTextEntry;
50
+ }
51
+ isValid() {
52
+ if (this.props.required && _.isEmpty(this.props.textValue)) {
53
+ return false;
54
+ }
55
+ if (this.props.isValid && !this.props.isValid()) {
56
+ return false;
57
+ }
58
+ return true;
59
+ }
60
+ renderErrorDot() {
61
+ if (this.props.required || this.props.hasError) {
62
+ return /*#__PURE__*/React.createElement(View, {
63
+ style: [styles.errorDot, {
64
+ backgroundColor: this.props.colourBrandingMain
65
+ }, !this.isValid() && styles.errorError, this.isValid() && styles.errorValid, this.props.errorDotStyle]
66
+ });
67
+ }
68
+ return null;
69
+ }
70
+ renderLabel() {
71
+ if (_.isEmpty(this.props.label)) {
72
+ return null;
73
+ }
74
+ return /*#__PURE__*/React.createElement(View, {
75
+ style: styles.labelContainer
76
+ }, /*#__PURE__*/React.createElement(Text, {
77
+ style: [styles.labelText, this.state.focused && {
78
+ color: this.props.colourBrandingMain
79
+ }, !this.isValid() && !_.isEmpty(this.props.textValue) && styles.labelError, this.props.labelStyle]
80
+ }, this.props.label), this.renderErrorDot());
81
+ }
82
+ renderInput() {
83
+ return /*#__PURE__*/React.createElement(View, {
84
+ style: {
85
+ flexDirection: "row"
86
+ }
87
+ }, /*#__PURE__*/React.createElement(View, {
88
+ style: {
89
+ flex: 1
90
+ }
91
+ }, /*#__PURE__*/React.createElement(TextInput, {
92
+ maxFontSizeMultiplier: 1.2,
93
+ value: this.props.textValue,
94
+ onChangeText: this.props.onChangeText,
95
+ keyboardType: this.props.keyboardType
96
+ /* Main Styling Props */,
97
+ selectionColor: this.props.colourBrandingDark,
98
+ placeholder: this.props.placeholder,
99
+ placeholderTextColor: this.props.placeholderTextColor || TEXT_LIGHTER,
100
+ style: [styles.inputStyle, {
101
+ textAlignVertical: this.props.autoGrow ? "top" : "center",
102
+ color: this.props.textColour || TEXT_DARK,
103
+ minHeight: this.props.minHeight || 20
104
+ }, this.props.textStyle],
105
+ underlineColorAndroid: "rgba(0,0,0,0)"
106
+ /* Other Props */,
107
+ autoFocus: _.isUndefined(this.props.autoFocus) ? false : this.props.autoFocus,
108
+ editable: _.isUndefined(this.props.editable) ? true : this.props.editable,
109
+ secureTextEntry: _.isUndefined(this.props.secureTextEntry) ? false : this.showSecure(),
110
+ autoCorrect: _.isUndefined(this.props.autoCorrect) ? false : this.props.autoCorrect,
111
+ multiline: _.isUndefined(this.props.multiline) ? false : this.props.multiline,
112
+ autoGrow: _.isUndefined(this.props.autoGrow) ? false : this.props.autoGrow,
113
+ autoCapitalize: _.isUndefined(this.props.autoCapitalize) ? "sentences" : this.props.autoCapitalize,
114
+ onContentSizeChange: this.onGrow.bind(this)
115
+ /* Focus Props */,
116
+ onFocus: this.onFocus.bind(this),
117
+ onBlur: this.onBlur.bind(this)
118
+ })), !_.isUndefined(this.props.secureTextToggle) && this.props.secureTextToggle && /*#__PURE__*/React.createElement(TouchableOpacity, {
119
+ onPress: this.toggleSecure.bind(this)
120
+ }, /*#__PURE__*/React.createElement(FontAwesome, {
121
+ name: this.state.isSecure ? "eye" : "eye-slash",
122
+ style: {
123
+ fontSize: 21,
124
+ lineHeight: 20,
125
+ color: TEXT_LIGHT,
126
+ paddingLeft: 16
127
+ }
128
+ })));
129
+ }
130
+ renderContent() {
131
+ if (this.props.hasContent) {
132
+ return this.props.children;
133
+ }
134
+ if (this.props.pointerEvents) {
135
+ return /*#__PURE__*/React.createElement(View, {
136
+ pointerEvents: this.props.pointerEvents
137
+ }, this.renderInput());
138
+ }
139
+ return this.renderInput();
140
+ }
141
+ render() {
142
+ return /*#__PURE__*/React.createElement(View, null, /*#__PURE__*/React.createElement(View, {
143
+ style: [styles.sectionItem, this.props.hasUnderline && styles.sectionItemUnderline, this.state.focused && styles.inputFocus, this.state.focused && {
144
+ borderBottomColor: this.props.colourBrandingMain
145
+ }, !this.isValid() && !_.isEmpty(this.props.textValue) && styles.inputError, !_.isUndefined(this.props.showError) && this.props.showError === true && !this.isValid() && styles.inputError, this.props.sectionStyle]
146
+ }, this.renderLabel(), /*#__PURE__*/React.createElement(View, null, this.renderContent())), !_.isUndefined(this.props.showError) && this.props.showError === true && !this.isValid() && /*#__PURE__*/React.createElement(Text, {
147
+ style: styles.errorText
148
+ }, this.props.errorText));
149
+ }
150
+ }
151
+ const styles = StyleSheet.create({
152
+ sectionItem: {
153
+ paddingVertical: 16,
154
+ paddingHorizontal: 8,
155
+ borderBottomColor: LINEGREY
156
+ },
157
+ sectionItemUnderline: {
158
+ borderBottomWidth: 1
159
+ },
160
+ inputFocus: {
161
+ borderBottomWidth: 1
162
+ },
163
+ inputError: {
164
+ borderBottomWidth: 1,
165
+ borderBottomColor: COLOUR_GRAPEFRUIT
166
+ },
167
+ labelContainer: {
168
+ flexDirection: "row",
169
+ alignItems: "center",
170
+ marginBottom: 6
171
+ },
172
+ labelText: {
173
+ fontFamily: "sf-regular",
174
+ fontSize: 13,
175
+ color: TEXT_LIGHT
176
+ },
177
+ labelError: {
178
+ color: COLOUR_GRAPEFRUIT
179
+ },
180
+ errorDot: {
181
+ height: 6,
182
+ width: 6,
183
+ borderRadius: 3,
184
+ marginLeft: 8,
185
+ marginBottom: 3
186
+ },
187
+ errorError: {
188
+ backgroundColor: COLOUR_GRAPEFRUIT
189
+ },
190
+ errorValid: {
191
+ backgroundColor: COLOUR_GREEN
192
+ },
193
+ inputStyle: {
194
+ fontFamily: "sf-regular",
195
+ fontSize: 17,
196
+ margin: 0,
197
+ padding: 0
198
+ },
199
+ errorText: {
200
+ paddingTop: 8,
201
+ fontSize: 13,
202
+ fontFamily: "sf-regular",
203
+ color: COLOUR_GRAPEFRUIT
204
+ }
205
+ });
206
+ const mapStateToProps = state => {
207
+ return {
208
+ colourBrandingMain: getMainBrandingColourFromState(state),
209
+ colourBrandingDark: getDarkBrandingColourFromState(state)
210
+ };
211
+ };
212
+ const formCardSection = connect(mapStateToProps, {})(FormCardSection);
213
+ export { formCardSection as FormCardSection };
214
+ //# sourceMappingURL=FormCardSection.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["React","Component","Text","_","View","TextInput","TouchableOpacity","StyleSheet","connect","TEXT_LIGHTER","TEXT_DARK","COLOUR_GREEN","LINEGREY","TEXT_LIGHT","COLOUR_GRAPEFRUIT","getMainBrandingColourFromState","getDarkBrandingColourFromState","getValueOrDefault","FontAwesome","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","createElement","style","styles","errorDot","backgroundColor","colourBrandingMain","errorError","errorValid","errorDotStyle","renderLabel","label","labelContainer","labelText","color","labelError","labelStyle","renderInput","flexDirection","flex","maxFontSizeMultiplier","value","onChangeText","keyboardType","selectionColor","colourBrandingDark","placeholder","placeholderTextColor","inputStyle","textAlignVertical","autoGrow","textColour","textStyle","underlineColorAndroid","autoFocus","editable","autoCorrect","multiline","autoCapitalize","onContentSizeChange","bind","onPress","name","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"],"sources":["FormCardSection.js"],"sourcesContent":["import React, { Component } from \"react\";\nimport { Text } from \"@plusscommunities/pluss-core-app/components\";\nimport _ from \"lodash\";\nimport { View, TextInput, TouchableOpacity, StyleSheet } from \"react-native\";\nimport { connect } from \"react-redux\";\nimport {\n\tTEXT_LIGHTER,\n\tTEXT_DARK,\n\tCOLOUR_GREEN,\n\tLINEGREY,\n\tTEXT_LIGHT,\n\tCOLOUR_GRAPEFRUIT,\n\tgetMainBrandingColourFromState,\n\tgetDarkBrandingColourFromState,\n} from \"../colours\";\nimport { getValueOrDefault } from \"../helper\";\nimport { FontAwesome } from \"./Icon\";\n\nclass FormCardSection extends Component {\n\tconstructor(props) {\n\t\tsuper(props);\n\n\t\tthis.state = {\n\t\t\theight: getValueOrDefault(this.props.minHeight, 20),\n\t\t\tfocused: false,\n\t\t\tisSecure: true,\n\t\t};\n\t}\n\n\tonFocus() {\n\t\tthis.setState({ focused: true });\n\t\tif (this.props.onFocus) {\n\t\t\tthis.props.onFocus();\n\t\t}\n\t}\n\n\tonBlur() {\n\t\tthis.setState({ focused: false });\n\t\tif (this.props.onBlur) {\n\t\t\tthis.props.onBlur();\n\t\t}\n\t}\n\n\tonGrow(event) {\n\t\tthis.setState({\n\t\t\theight: Math.max(\n\t\t\t\tevent.nativeEvent.contentSize.height,\n\t\t\t\tthis.props.minHeight,\n\t\t\t),\n\t\t});\n\t}\n\n\ttoggleSecure() {\n\t\tconst current = this.state.isSecure;\n\t\tthis.setState({ isSecure: !current });\n\t}\n\n\tshowSecure() {\n\t\tif (\n\t\t\t!_.isUndefined(this.props.secureTextToggle) &&\n\t\t\tthis.props.secureTextToggle\n\t\t) {\n\t\t\treturn this.state.isSecure;\n\t\t}\n\t\treturn this.props.secureTextEntry;\n\t}\n\n\tisValid() {\n\t\tif (this.props.required && _.isEmpty(this.props.textValue)) {\n\t\t\treturn false;\n\t\t}\n\t\tif (this.props.isValid && !this.props.isValid()) {\n\t\t\treturn false;\n\t\t}\n\t\treturn true;\n\t}\n\n\trenderErrorDot() {\n\t\tif (this.props.required || this.props.hasError) {\n\t\t\treturn (\n\t\t\t\t<View\n\t\t\t\t\tstyle={[\n\t\t\t\t\t\tstyles.errorDot,\n\t\t\t\t\t\t{ backgroundColor: this.props.colourBrandingMain },\n\t\t\t\t\t\t!this.isValid() && styles.errorError,\n\t\t\t\t\t\tthis.isValid() && styles.errorValid,\n\t\t\t\t\t\tthis.props.errorDotStyle,\n\t\t\t\t\t]}\n\t\t\t\t/>\n\t\t\t);\n\t\t}\n\t\treturn null;\n\t}\n\n\trenderLabel() {\n\t\tif (_.isEmpty(this.props.label)) {\n\t\t\treturn null;\n\t\t}\n\t\treturn (\n\t\t\t<View style={styles.labelContainer}>\n\t\t\t\t<Text\n\t\t\t\t\tstyle={[\n\t\t\t\t\t\tstyles.labelText,\n\t\t\t\t\t\tthis.state.focused && { color: this.props.colourBrandingMain },\n\t\t\t\t\t\t!this.isValid() &&\n\t\t\t\t\t\t\t!_.isEmpty(this.props.textValue) &&\n\t\t\t\t\t\t\tstyles.labelError,\n\t\t\t\t\t\tthis.props.labelStyle,\n\t\t\t\t\t]}\n\t\t\t\t>\n\t\t\t\t\t{this.props.label}\n\t\t\t\t</Text>\n\t\t\t\t{this.renderErrorDot()}\n\t\t\t</View>\n\t\t);\n\t}\n\n\trenderInput() {\n\t\treturn (\n\t\t\t<View style={{ flexDirection: \"row\" }}>\n\t\t\t\t<View style={{ flex: 1 }}>\n\t\t\t\t\t<TextInput\n\t\t\t\t\t\tmaxFontSizeMultiplier={1.2}\n\t\t\t\t\t\tvalue={this.props.textValue}\n\t\t\t\t\t\tonChangeText={this.props.onChangeText}\n\t\t\t\t\t\tkeyboardType={this.props.keyboardType}\n\t\t\t\t\t\t/* Main Styling Props */\n\t\t\t\t\t\tselectionColor={this.props.colourBrandingDark}\n\t\t\t\t\t\tplaceholder={this.props.placeholder}\n\t\t\t\t\t\tplaceholderTextColor={\n\t\t\t\t\t\t\tthis.props.placeholderTextColor || TEXT_LIGHTER\n\t\t\t\t\t\t}\n\t\t\t\t\t\tstyle={[\n\t\t\t\t\t\t\tstyles.inputStyle,\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\ttextAlignVertical: this.props.autoGrow ? \"top\" : \"center\",\n\t\t\t\t\t\t\t\tcolor: this.props.textColour || TEXT_DARK,\n\t\t\t\t\t\t\t\tminHeight: this.props.minHeight || 20,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tthis.props.textStyle,\n\t\t\t\t\t\t]}\n\t\t\t\t\t\tunderlineColorAndroid={\"rgba(0,0,0,0)\"}\n\t\t\t\t\t\t/* Other Props */\n\t\t\t\t\t\tautoFocus={\n\t\t\t\t\t\t\t_.isUndefined(this.props.autoFocus) ? false : this.props.autoFocus\n\t\t\t\t\t\t}\n\t\t\t\t\t\teditable={\n\t\t\t\t\t\t\t_.isUndefined(this.props.editable) ? true : this.props.editable\n\t\t\t\t\t\t}\n\t\t\t\t\t\tsecureTextEntry={\n\t\t\t\t\t\t\t_.isUndefined(this.props.secureTextEntry)\n\t\t\t\t\t\t\t\t? false\n\t\t\t\t\t\t\t\t: this.showSecure()\n\t\t\t\t\t\t}\n\t\t\t\t\t\tautoCorrect={\n\t\t\t\t\t\t\t_.isUndefined(this.props.autoCorrect)\n\t\t\t\t\t\t\t\t? false\n\t\t\t\t\t\t\t\t: this.props.autoCorrect\n\t\t\t\t\t\t}\n\t\t\t\t\t\tmultiline={\n\t\t\t\t\t\t\t_.isUndefined(this.props.multiline) ? false : this.props.multiline\n\t\t\t\t\t\t}\n\t\t\t\t\t\tautoGrow={\n\t\t\t\t\t\t\t_.isUndefined(this.props.autoGrow) ? false : this.props.autoGrow\n\t\t\t\t\t\t}\n\t\t\t\t\t\tautoCapitalize={\n\t\t\t\t\t\t\t_.isUndefined(this.props.autoCapitalize)\n\t\t\t\t\t\t\t\t? \"sentences\"\n\t\t\t\t\t\t\t\t: this.props.autoCapitalize\n\t\t\t\t\t\t}\n\t\t\t\t\t\tonContentSizeChange={this.onGrow.bind(this)}\n\t\t\t\t\t\t/* Focus Props */\n\t\t\t\t\t\tonFocus={this.onFocus.bind(this)}\n\t\t\t\t\t\tonBlur={this.onBlur.bind(this)}\n\t\t\t\t\t/>\n\t\t\t\t</View>\n\t\t\t\t{!_.isUndefined(this.props.secureTextToggle) &&\n\t\t\t\t\tthis.props.secureTextToggle && (\n\t\t\t\t\t\t<TouchableOpacity onPress={this.toggleSecure.bind(this)}>\n\t\t\t\t\t\t\t{/* <Icon\n name={this.state.isSecure ? 'eye' : 'eye-slash'}\n type='font-awesome'\n iconStyle={{ fontSize: 16, color: TEXT_MID, paddingLeft: 16 }}\n /> */}\n\t\t\t\t\t\t\t<FontAwesome\n\t\t\t\t\t\t\t\tname={this.state.isSecure ? \"eye\" : \"eye-slash\"}\n\t\t\t\t\t\t\t\tstyle={{\n\t\t\t\t\t\t\t\t\tfontSize: 21,\n\t\t\t\t\t\t\t\t\tlineHeight: 20,\n\t\t\t\t\t\t\t\t\tcolor: TEXT_LIGHT,\n\t\t\t\t\t\t\t\t\tpaddingLeft: 16,\n\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</TouchableOpacity>\n\t\t\t\t\t)}\n\t\t\t</View>\n\t\t);\n\t}\n\n\trenderContent() {\n\t\tif (this.props.hasContent) {\n\t\t\treturn this.props.children;\n\t\t}\n\t\tif (this.props.pointerEvents) {\n\t\t\treturn (\n\t\t\t\t<View pointerEvents={this.props.pointerEvents}>\n\t\t\t\t\t{this.renderInput()}\n\t\t\t\t</View>\n\t\t\t);\n\t\t}\n\t\treturn this.renderInput();\n\t}\n\n\trender() {\n\t\treturn (\n\t\t\t<View>\n\t\t\t\t<View\n\t\t\t\t\tstyle={[\n\t\t\t\t\t\tstyles.sectionItem,\n\t\t\t\t\t\tthis.props.hasUnderline && styles.sectionItemUnderline,\n\t\t\t\t\t\tthis.state.focused && styles.inputFocus,\n\t\t\t\t\t\tthis.state.focused && {\n\t\t\t\t\t\t\tborderBottomColor: this.props.colourBrandingMain,\n\t\t\t\t\t\t},\n\t\t\t\t\t\t!this.isValid() &&\n\t\t\t\t\t\t\t!_.isEmpty(this.props.textValue) &&\n\t\t\t\t\t\t\tstyles.inputError,\n\t\t\t\t\t\t!_.isUndefined(this.props.showError) &&\n\t\t\t\t\t\t\tthis.props.showError === true &&\n\t\t\t\t\t\t\t!this.isValid() &&\n\t\t\t\t\t\t\tstyles.inputError,\n\t\t\t\t\t\tthis.props.sectionStyle,\n\t\t\t\t\t]}\n\t\t\t\t>\n\t\t\t\t\t{this.renderLabel()}\n\t\t\t\t\t<View>{this.renderContent()}</View>\n\t\t\t\t</View>\n\t\t\t\t{!_.isUndefined(this.props.showError) &&\n\t\t\t\t\tthis.props.showError === true &&\n\t\t\t\t\t!this.isValid() && (\n\t\t\t\t\t\t<Text style={styles.errorText}>{this.props.errorText}</Text>\n\t\t\t\t\t)}\n\t\t\t</View>\n\t\t);\n\t}\n}\n\nconst styles = StyleSheet.create({\n\tsectionItem: {\n\t\tpaddingVertical: 16,\n\t\tpaddingHorizontal: 8,\n\t\tborderBottomColor: LINEGREY,\n\t},\n\tsectionItemUnderline: {\n\t\tborderBottomWidth: 1,\n\t},\n\tinputFocus: {\n\t\tborderBottomWidth: 1,\n\t},\n\tinputError: {\n\t\tborderBottomWidth: 1,\n\t\tborderBottomColor: COLOUR_GRAPEFRUIT,\n\t},\n\tlabelContainer: {\n\t\tflexDirection: \"row\",\n\t\talignItems: \"center\",\n\t\tmarginBottom: 6,\n\t},\n\tlabelText: {\n\t\tfontFamily: \"sf-regular\",\n\t\tfontSize: 13,\n\t\tcolor: TEXT_LIGHT,\n\t},\n\tlabelError: {\n\t\tcolor: COLOUR_GRAPEFRUIT,\n\t},\n\terrorDot: {\n\t\theight: 6,\n\t\twidth: 6,\n\t\tborderRadius: 3,\n\t\tmarginLeft: 8,\n\t\tmarginBottom: 3,\n\t},\n\terrorError: {\n\t\tbackgroundColor: COLOUR_GRAPEFRUIT,\n\t},\n\terrorValid: {\n\t\tbackgroundColor: COLOUR_GREEN,\n\t},\n\tinputStyle: {\n\t\tfontFamily: \"sf-regular\",\n\t\tfontSize: 17,\n\t\tmargin: 0,\n\t\tpadding: 0,\n\t},\n\terrorText: {\n\t\tpaddingTop: 8,\n\t\tfontSize: 13,\n\t\tfontFamily: \"sf-regular\",\n\t\tcolor: COLOUR_GRAPEFRUIT,\n\t},\n});\n\nconst mapStateToProps = (state) => {\n\treturn {\n\t\tcolourBrandingMain: getMainBrandingColourFromState(state),\n\t\tcolourBrandingDark: getDarkBrandingColourFromState(state),\n\t};\n};\n\nconst formCardSection = connect(mapStateToProps, {})(FormCardSection);\nexport { formCardSection as FormCardSection };\n"],"mappings":"AAAA,OAAOA,KAAK,IAAIC,SAAS,QAAQ,OAAO;AACxC,SAASC,IAAI,QAAQ,6CAA6C;AAClE,OAAOC,CAAC,MAAM,QAAQ;AACtB,SAASC,IAAI,EAAEC,SAAS,EAAEC,gBAAgB,EAAEC,UAAU,QAAQ,cAAc;AAC5E,SAASC,OAAO,QAAQ,aAAa;AACrC,SACCC,YAAY,EACZC,SAAS,EACTC,YAAY,EACZC,QAAQ,EACRC,UAAU,EACVC,iBAAiB,EACjBC,8BAA8B,EAC9BC,8BAA8B,QACxB,YAAY;AACnB,SAASC,iBAAiB,QAAQ,WAAW;AAC7C,SAASC,WAAW,QAAQ,QAAQ;AAEpC,MAAMC,eAAe,SAASlB,SAAS,CAAC;EACvCmB,WAAWA,CAACC,KAAK,EAAE;IAClB,KAAK,CAACA,KAAK,CAAC;IAEZ,IAAI,CAACC,KAAK,GAAG;MACZC,MAAM,EAAEN,iBAAiB,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EAAE;EACf,CAAC;EACDpD,SAAS,EAAE;IACVqD,UAAU,EAAE,YAAY;IACxBvB,QAAQ,EAAE,EAAE;IACZ7B,KAAK,EAAEhD;EACR,CAAC;EACDiD,UAAU,EAAE;IACXD,KAAK,EAAE/C;EACR,CAAC;EACDqC,QAAQ,EAAE;IACT5B,MAAM,EAAE,CAAC;IACT2F,KAAK,EAAE,CAAC;IACRC,YAAY,EAAE,CAAC;IACfC,UAAU,EAAE,CAAC;IACbJ,YAAY,EAAE;EACf,CAAC;EACD1D,UAAU,EAAE;IACXF,eAAe,EAAEtC;EAClB,CAAC;EACDyC,UAAU,EAAE;IACXH,eAAe,EAAEzC;EAClB,CAAC;EACDgE,UAAU,EAAE;IACXsC,UAAU,EAAE,YAAY;IACxBvB,QAAQ,EAAE,EAAE;IACZ2B,MAAM,EAAE,CAAC;IACTC,OAAO,EAAE;EACV,CAAC;EACDZ,SAAS,EAAE;IACVa,UAAU,EAAE,CAAC;IACb7B,QAAQ,EAAE,EAAE;IACZuB,UAAU,EAAE,YAAY;IACxBpD,KAAK,EAAE/C;EACR;AACD,CAAC,CAAC;AAEF,MAAM0G,eAAe,GAAIlG,KAAK,IAAK;EAClC,OAAO;IACN+B,kBAAkB,EAAEtC,8BAA8B,CAACO,KAAK,CAAC;IACzDkD,kBAAkB,EAAExD,8BAA8B,CAACM,KAAK;EACzD,CAAC;AACF,CAAC;AAED,MAAMmG,eAAe,GAAGjH,OAAO,CAACgH,eAAe,EAAE,CAAC,CAAC,CAAC,CAACrG,eAAe,CAAC;AACrE,SAASsG,eAAe,IAAItG,eAAe","ignoreList":[]}
@@ -0,0 +1,73 @@
1
+ import React, { PureComponent } from "react";
2
+ import { View, TouchableOpacity } from "react-native";
3
+ import { Text } from "./Text";
4
+ import { Icon } from "@rneui/themed";
5
+ import { connect } from "react-redux";
6
+ import { TEXT_DARK, TEXT_LIGHT, getMainBrandingColourFromState } from "../colours";
7
+ import { FormCardSection } from "./FormCardSection";
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
+ const styles = {
49
+ container: {
50
+ flexDirection: "row",
51
+ alignSelf: "stretch",
52
+ alignItems: "center"
53
+ },
54
+ text: {
55
+ fontFamily: "sf-regular",
56
+ fontSize: 17,
57
+ color: TEXT_DARK
58
+ },
59
+ description: {
60
+ fontFamily: "sf-regular",
61
+ fontSize: 15,
62
+ color: TEXT_LIGHT,
63
+ marginTop: 8
64
+ }
65
+ };
66
+ const mapStateToProps = state => {
67
+ return {
68
+ colourBrandingMain: getMainBrandingColourFromState(state)
69
+ };
70
+ };
71
+ const formCardSectionOptionLauncher = connect(mapStateToProps, {})(FormCardSectionOptionLauncher);
72
+ export { formCardSectionOptionLauncher as FormCardSectionOptionLauncher };
73
+ //# sourceMappingURL=FormCardSectionOptionLauncher.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["React","PureComponent","View","TouchableOpacity","Text","Icon","connect","TEXT_DARK","TEXT_LIGHT","getMainBrandingColourFromState","FormCardSection","FormCardSectionOptionLauncher","render","onPress","sectionStyle","textStyle","title","description","value","icon","colourBrandingMain","props","createElement","hasContent","style","styles","container","text","marginRight","flex","name","type","iconStyle","fontSize","color","flexDirection","alignSelf","alignItems","fontFamily","marginTop","mapStateToProps","state","formCardSectionOptionLauncher"],"sources":["FormCardSectionOptionLauncher.js"],"sourcesContent":["import React, { PureComponent } from \"react\";\nimport { View, TouchableOpacity } from \"react-native\";\nimport { Text } from \"./Text\";\nimport { Icon } from \"@rneui/themed\";\nimport { connect } from \"react-redux\";\nimport {\n\tTEXT_DARK,\n\tTEXT_LIGHT,\n\tgetMainBrandingColourFromState,\n} from \"../colours\";\nimport { FormCardSection } from \"./FormCardSection\";\n\nclass FormCardSectionOptionLauncher extends PureComponent {\n\trender() {\n\t\tconst {\n\t\t\tonPress,\n\t\t\tsectionStyle,\n\t\t\ttextStyle,\n\t\t\ttitle,\n\t\t\tdescription,\n\t\t\tvalue,\n\t\t\ticon,\n\t\t\tcolourBrandingMain,\n\t\t} = this.props;\n\n\t\treturn (\n\t\t\t<TouchableOpacity onPress={onPress}>\n\t\t\t\t<FormCardSection hasContent sectionStyle={sectionStyle}>\n\t\t\t\t\t<View style={styles.container}>\n\t\t\t\t\t\t<Text\n\t\t\t\t\t\t\tstyle={[styles.text, { marginRight: 16, flex: 1 }, textStyle]}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{title}\n\t\t\t\t\t\t</Text>\n\t\t\t\t\t\t<Text style={[styles.text, { marginRight: 16 }]}>{value}</Text>\n\t\t\t\t\t\t<Icon\n\t\t\t\t\t\t\tname={icon ? icon : \"angle-right\"}\n\t\t\t\t\t\t\ttype=\"font-awesome\"\n\t\t\t\t\t\t\ticonStyle={[\n\t\t\t\t\t\t\t\tstyles.text,\n\t\t\t\t\t\t\t\t{ fontSize: 20, color: colourBrandingMain },\n\t\t\t\t\t\t\t]}\n\t\t\t\t\t\t/>\n\t\t\t\t\t</View>\n\t\t\t\t\t{description ? (\n\t\t\t\t\t\t<Text style={styles.description}>{description}</Text>\n\t\t\t\t\t) : null}\n\t\t\t\t</FormCardSection>\n\t\t\t</TouchableOpacity>\n\t\t);\n\t}\n}\n\nconst styles = {\n\tcontainer: {\n\t\tflexDirection: \"row\",\n\t\talignSelf: \"stretch\",\n\t\talignItems: \"center\",\n\t},\n\ttext: {\n\t\tfontFamily: \"sf-regular\",\n\t\tfontSize: 17,\n\t\tcolor: TEXT_DARK,\n\t},\n\tdescription: {\n\t\tfontFamily: \"sf-regular\",\n\t\tfontSize: 15,\n\t\tcolor: TEXT_LIGHT,\n\t\tmarginTop: 8,\n\t},\n};\n\nconst mapStateToProps = (state) => {\n\treturn {\n\t\tcolourBrandingMain: getMainBrandingColourFromState(state),\n\t};\n};\n\nconst formCardSectionOptionLauncher = connect(\n\tmapStateToProps,\n\t{},\n)(FormCardSectionOptionLauncher);\nexport { formCardSectionOptionLauncher as FormCardSectionOptionLauncher };\n"],"mappings":"AAAA,OAAOA,KAAK,IAAIC,aAAa,QAAQ,OAAO;AAC5C,SAASC,IAAI,EAAEC,gBAAgB,QAAQ,cAAc;AACrD,SAASC,IAAI,QAAQ,QAAQ;AAC7B,SAASC,IAAI,QAAQ,eAAe;AACpC,SAASC,OAAO,QAAQ,aAAa;AACrC,SACCC,SAAS,EACTC,UAAU,EACVC,8BAA8B,QACxB,YAAY;AACnB,SAASC,eAAe,QAAQ,mBAAmB;AAEnD,MAAMC,6BAA6B,SAASV,aAAa,CAAC;EACzDW,MAAMA,CAAA,EAAG;IACR,MAAM;MACLC,OAAO;MACPC,YAAY;MACZC,SAAS;MACTC,KAAK;MACLC,WAAW;MACXC,KAAK;MACLC,IAAI;MACJC;IACD,CAAC,GAAG,IAAI,CAACC,KAAK;IAEd,oBACCrB,KAAA,CAAAsB,aAAA,CAACnB,gBAAgB;MAACU,OAAO,EAAEA;IAAQ,gBAClCb,KAAA,CAAAsB,aAAA,CAACZ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e,GAAIC,KAAK,IAAK;EAClC,OAAO;IACNrB,kBAAkB,EAAEX,8BAA8B,CAACgC,KAAK;EACzD,CAAC;AACF,CAAC;AAED,MAAMC,6BAA6B,GAAGpC,OAAO,CAC5CkC,eAAe,EACf,CAAC,CACF,CAAC,CAAC7B,6BAA6B,CAAC;AAChC,SAAS+B,6BAA6B,IAAI/B,6BAA6B","ignoreList":[]}
@@ -0,0 +1,133 @@
1
+ function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
2
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
3
+ function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
4
+ import React, { Component } from "react";
5
+ import { Linking } from "react-native";
6
+ import { connect } from "react-redux";
7
+ import ParsedText from "react-native-parsed-text";
8
+ import { Text } from "./Text";
9
+ import { getMainBrandingColourFromState, TEXT_DARKEST } from "../colours";
10
+ import { getValidUrl } from "../helper";
11
+ import { analyticsActions } from "../apis";
12
+ class FormattedText extends Component {
13
+ constructor(...args) {
14
+ super(...args);
15
+ _defineProperty(this, "onPressUrl", url => {
16
+ const urlToUse = getValidUrl(url);
17
+ Linking.openURL(urlToUse);
18
+ this.checkLog("UrlClick", urlToUse);
19
+ });
20
+ _defineProperty(this, "onPressUrlText", urlText => {
21
+ const texts = urlText.match(FormattedText.UrlTextRegex);
22
+ this.onPressUrl(texts[1]);
23
+ });
24
+ _defineProperty(this, "onPressEmail", email => {
25
+ Linking.openURL(`mailto:${email}`);
26
+ this.checkLog("EmailClick", email);
27
+ });
28
+ _defineProperty(this, "onPressPhone", phone => {
29
+ const parsedPhone = phone.replace(/\D/g, "");
30
+ Linking.openURL(`tel:${parsedPhone.replace(/\D/g, "")}`);
31
+ this.checkLog("PhoneClick", parsedPhone);
32
+ });
33
+ _defineProperty(this, "ifEnabled", value => this.props.disabled ? undefined : value);
34
+ }
35
+ static get UrlTextRegex() {
36
+ return /\[([^\]\|\]]+)\|([^\]\|\]]+)\]/i;
37
+ }
38
+ checkLog(type, target) {
39
+ if (this.props.logClicks) {
40
+ analyticsActions.log(this.props.site, type, this.props.entityType, this.props.entityId, {
41
+ target
42
+ });
43
+ }
44
+ }
45
+ renderTextContent(matchingString, matches) {
46
+ return matches[1];
47
+ }
48
+ renderUrlText(matchingString, matches) {
49
+ return matches[2];
50
+ }
51
+ render() {
52
+ const {
53
+ style,
54
+ numberOfLines,
55
+ titleSize,
56
+ colourBrandingMain,
57
+ subtitleSize,
58
+ children
59
+ } = this.props;
60
+ return /*#__PURE__*/React.createElement(ParsedText, {
61
+ maxFontSizeMultiplier: 1.2,
62
+ style: [styles.text, this.ifEnabled({
63
+ lineHeight: 24
64
+ }), style],
65
+ numberOfLines: numberOfLines,
66
+ parse: [{
67
+ pattern: /\*\*(.*?)\*\*/i,
68
+ style: this.ifEnabled({
69
+ fontFamily: "sf-bold",
70
+ lineHeight: 24
71
+ }),
72
+ renderText: this.renderTextContent
73
+ }, {
74
+ pattern: /\*t\*(.*?)\*t\*/i,
75
+ style: this.ifEnabled({
76
+ fontSize: titleSize || 22,
77
+ color: colourBrandingMain,
78
+ fontFamily: "sf-semibold",
79
+ lineHeight: 24
80
+ }),
81
+ renderText: this.renderTextContent
82
+ }, {
83
+ pattern: /\*s\*(.*?)\*s\*/i,
84
+ style: this.ifEnabled({
85
+ fontSize: subtitleSize || 18,
86
+ color: TEXT_DARKEST,
87
+ fontFamily: "sf-semibold",
88
+ lineHeight: 24
89
+ }),
90
+ renderText: this.renderTextContent
91
+ }, {
92
+ pattern: FormattedText.UrlTextRegex,
93
+ style: this.ifEnabled({
94
+ color: colourBrandingMain
95
+ }),
96
+ onPress: this.ifEnabled(this.onPressUrlText),
97
+ renderText: this.renderUrlText
98
+ }, {
99
+ pattern: /(?:(?:https?|ftp|file):\/\/|www\.|ftp\.)(?:\([-A-Z0-9+&@#\/%=~_|$?!:,.]*\)|[-A-Z0-9+&@#\/%=~_|$?!:,.])*(?:\([-A-Z0-9+&@#\/%=~_|$?!:,.]*\)|[A-Z0-9+&@#\/%=~_|$])/im,
100
+ style: this.ifEnabled({
101
+ color: colourBrandingMain
102
+ }),
103
+ onPress: this.ifEnabled(this.onPressUrl)
104
+ }, {
105
+ pattern: /([A-Z0-9._%-]+)@([A-Z0-9.-]+\.[A-Z]{2,4})/im,
106
+ style: this.ifEnabled({
107
+ color: colourBrandingMain
108
+ }),
109
+ onPress: this.ifEnabled(this.onPressEmail)
110
+ }, {
111
+ pattern: /(?:\+?(\d{1,3}))?([-. (]*(\d{1,3})[-. )]*)?((\d{2,4})[-. ]*(\d{2,4})(?:[-.x ]*(\d+))?)\s*$/im,
112
+ style: this.ifEnabled({
113
+ color: colourBrandingMain
114
+ }),
115
+ onPress: this.ifEnabled(this.onPressPhone)
116
+ }]
117
+ }, children);
118
+ }
119
+ }
120
+ const styles = {
121
+ text: {
122
+ color: TEXT_DARKEST,
123
+ fontSize: 14,
124
+ fontFamily: "sf-regular"
125
+ }
126
+ };
127
+ const mapStateToProps = state => {
128
+ return {
129
+ colourBrandingMain: getMainBrandingColourFromState(state)
130
+ };
131
+ };
132
+ export default connect(mapStateToProps, {})(FormattedText);
133
+ //# sourceMappingURL=FormattedText.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["React","Component","Linking","connect","ParsedText","Text","getMainBrandingColourFromState","TEXT_DARKEST","getValidUrl","analyticsActions","FormattedText","constructor","args","_defineProperty","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","createElement","maxFontSizeMultiplier","styles","text","ifEnabled","lineHeight","parse","pattern","fontFamily","renderText","fontSize","color","onPress","onPressUrlText","onPressEmail","onPressPhone","mapStateToProps","state"],"sources":["FormattedText.js"],"sourcesContent":["import React, { Component } from \"react\";\nimport { Linking } from \"react-native\";\nimport { connect } from \"react-redux\";\nimport ParsedText from \"react-native-parsed-text\";\nimport { Text } from \"./Text\";\nimport { getMainBrandingColourFromState, TEXT_DARKEST } from \"../colours\";\nimport { getValidUrl } from \"../helper\";\nimport { analyticsActions } from \"../apis\";\n\nclass FormattedText extends Component {\n\tstatic get UrlTextRegex() {\n\t\treturn /\\[([^\\]\\|\\]]+)\\|([^\\]\\|\\]]+)\\]/i;\n\t}\n\n\tcheckLog(type, target) {\n\t\tif (this.props.logClicks) {\n\t\t\tanalyticsActions.log(\n\t\t\t\tthis.props.site,\n\t\t\t\ttype,\n\t\t\t\tthis.props.entityType,\n\t\t\t\tthis.props.entityId,\n\t\t\t\t{ target },\n\t\t\t);\n\t\t}\n\t}\n\n\tonPressUrl = (url) => {\n\t\tconst urlToUse = getValidUrl(url);\n\t\tLinking.openURL(urlToUse);\n\t\tthis.checkLog(\"UrlClick\", urlToUse);\n\t};\n\n\tonPressUrlText = (urlText) => {\n\t\tconst texts = urlText.match(FormattedText.UrlTextRegex);\n\t\tthis.onPressUrl(texts[1]);\n\t};\n\n\tonPressEmail = (email) => {\n\t\tLinking.openURL(`mailto:${email}`);\n\t\tthis.checkLog(\"EmailClick\", email);\n\t};\n\n\tonPressPhone = (phone) => {\n\t\tconst parsedPhone = phone.replace(/\\D/g, \"\");\n\t\tLinking.openURL(`tel:${parsedPhone.replace(/\\D/g, \"\")}`);\n\t\tthis.checkLog(\"PhoneClick\", parsedPhone);\n\t};\n\n\tifEnabled = (value) => (this.props.disabled ? undefined : value);\n\n\trenderTextContent(matchingString, matches) {\n\t\treturn matches[1];\n\t}\n\n\trenderUrlText(matchingString, matches) {\n\t\treturn matches[2];\n\t}\n\n\trender() {\n\t\tconst {\n\t\t\tstyle,\n\t\t\tnumberOfLines,\n\t\t\ttitleSize,\n\t\t\tcolourBrandingMain,\n\t\t\tsubtitleSize,\n\t\t\tchildren,\n\t\t} = this.props;\n\n\t\treturn (\n\t\t\t<ParsedText\n\t\t\t\tmaxFontSizeMultiplier={1.2}\n\t\t\t\tstyle={[styles.text, this.ifEnabled({ lineHeight: 24 }), style]}\n\t\t\t\tnumberOfLines={numberOfLines}\n\t\t\t\tparse={[\n\t\t\t\t\t{\n\t\t\t\t\t\tpattern: /\\*\\*(.*?)\\*\\*/i,\n\t\t\t\t\t\tstyle: this.ifEnabled({\n\t\t\t\t\t\t\tfontFamily: \"sf-bold\",\n\t\t\t\t\t\t\tlineHeight: 24,\n\t\t\t\t\t\t}),\n\t\t\t\t\t\trenderText: this.renderTextContent,\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tpattern: /\\*t\\*(.*?)\\*t\\*/i,\n\t\t\t\t\t\tstyle: this.ifEnabled({\n\t\t\t\t\t\t\tfontSize: titleSize || 22,\n\t\t\t\t\t\t\tcolor: colourBrandingMain,\n\t\t\t\t\t\t\tfontFamily: \"sf-semibold\",\n\t\t\t\t\t\t\tlineHeight: 24,\n\t\t\t\t\t\t}),\n\t\t\t\t\t\trenderText: this.renderTextContent,\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tpattern: /\\*s\\*(.*?)\\*s\\*/i,\n\t\t\t\t\t\tstyle: this.ifEnabled({\n\t\t\t\t\t\t\tfontSize: subtitleSize || 18,\n\t\t\t\t\t\t\tcolor: TEXT_DARKEST,\n\t\t\t\t\t\t\tfontFamily: \"sf-semibold\",\n\t\t\t\t\t\t\tlineHeight: 24,\n\t\t\t\t\t\t}),\n\t\t\t\t\t\trenderText: this.renderTextContent,\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tpattern: FormattedText.UrlTextRegex,\n\t\t\t\t\t\tstyle: this.ifEnabled({ color: colourBrandingMain }),\n\t\t\t\t\t\tonPress: this.ifEnabled(this.onPressUrlText),\n\t\t\t\t\t\trenderText: this.renderUrlText,\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tpattern:\n\t\t\t\t\t\t\t/(?:(?:https?|ftp|file):\\/\\/|www\\.|ftp\\.)(?:\\([-A-Z0-9+&@#\\/%=~_|$?!:,.]*\\)|[-A-Z0-9+&@#\\/%=~_|$?!:,.])*(?:\\([-A-Z0-9+&@#\\/%=~_|$?!:,.]*\\)|[A-Z0-9+&@#\\/%=~_|$])/im,\n\t\t\t\t\t\tstyle: this.ifEnabled({ color: colourBrandingMain }),\n\t\t\t\t\t\tonPress: this.ifEnabled(this.onPressUrl),\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tpattern: /([A-Z0-9._%-]+)@([A-Z0-9.-]+\\.[A-Z]{2,4})/im,\n\t\t\t\t\t\tstyle: this.ifEnabled({ color: colourBrandingMain }),\n\t\t\t\t\t\tonPress: this.ifEnabled(this.onPressEmail),\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tpattern:\n\t\t\t\t\t\t\t/(?:\\+?(\\d{1,3}))?([-. (]*(\\d{1,3})[-. )]*)?((\\d{2,4})[-. ]*(\\d{2,4})(?:[-.x ]*(\\d+))?)\\s*$/im,\n\t\t\t\t\t\tstyle: this.ifEnabled({ color: colourBrandingMain }),\n\t\t\t\t\t\tonPress: this.ifEnabled(this.onPressPhone),\n\t\t\t\t\t},\n\t\t\t\t]}\n\t\t\t>\n\t\t\t\t{children}\n\t\t\t</ParsedText>\n\t\t);\n\t}\n}\n\nconst styles = {\n\ttext: {\n\t\tcolor: TEXT_DARKEST,\n\t\tfontSize: 14,\n\t\tfontFamily: \"sf-regular\",\n\t},\n};\n\nconst mapStateToProps = (state) => {\n\treturn {\n\t\tcolourBrandingMain: getMainBrandingColourFromState(state),\n\t};\n};\n\nexport default connect(mapStateToProps, {})(Formatted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ACR,SAAS,CAAC,IAAI,CAACW,YAAY;MAC1C,CAAC;IACA,GAEDhB,QACU,CAAC;EAEf;AACD;AAEA,MAAMG,MAAM,GAAG;EACdC,IAAI,EAAE;IACLQ,KAAK,EAAErD,YAAY;IACnBoD,QAAQ,EAAE,EAAE;IACZF,UAAU,EAAE;EACb;AACD,CAAC;AAED,MAAMQ,eAAe,GAAIC,KAAK,IAAK;EAClC,OAAO;IACNpB,kBAAkB,EAAExC,8BAA8B,CAAC4D,KAAK;EACzD,CAAC;AACF,CAAC;AAED,eAAe/D,OAAO,CAAC8D,eAAe,EAAE,CAAC,CAAC,CAAC,CAACvD,aAAa,CAAC","ignoreList":[]}
@@ -0,0 +1,151 @@
1
+ import React, { Component } from "react";
2
+ import _ from "lodash";
3
+ import { TextInput, View, TouchableWithoutFeedback } from "react-native";
4
+ import { Text } from ".";
5
+ import { Icon } from "@rneui/themed";
6
+ import { TEXT_LIGHT, TEXT_DARK, TEXT_DARKEST } from "../colours";
7
+ import { FontAwesome } from "./Icon";
8
+ class GenericInput extends Component {
9
+ constructor(props) {
10
+ super(props);
11
+ this.state = {
12
+ showSecureText: false
13
+ };
14
+ this.inputRef = /*#__PURE__*/React.createRef();
15
+ }
16
+ blur() {
17
+ this.inputRef.current.blur();
18
+ }
19
+ toggleSecureText() {
20
+ this.setState({
21
+ showSecureText: !this.state.showSecureText
22
+ });
23
+ }
24
+ renderLeftIcon() {
25
+ if (!this.props.icon) {
26
+ return null;
27
+ }
28
+ if (this.props.iconType && this.props.iconType === "pl60") {
29
+ return /*#__PURE__*/React.createElement(FontAwesome, {
30
+ name: this.props.icon,
31
+ style: styles.searchIcon
32
+ });
33
+ }
34
+ return /*#__PURE__*/React.createElement(Icon, {
35
+ type: "font-awesome",
36
+ name: this.props.icon,
37
+ iconStyle: styles.searchIcon
38
+ });
39
+ }
40
+ renderRightIcon() {
41
+ if (this.props.secureTextEntry) {
42
+ return /*#__PURE__*/React.createElement(TouchableWithoutFeedback, {
43
+ onPress: this.toggleSecureText.bind(this)
44
+ }, /*#__PURE__*/React.createElement(FontAwesome, {
45
+ name: this.state.showSecureText ? "eye-slash" : "eye",
46
+ style: [styles.clearIcon, styles.secureIcon]
47
+ }));
48
+ }
49
+ if (this.props.rightIcon) {
50
+ if (this.props.rightIconAction) {
51
+ return /*#__PURE__*/React.createElement(TouchableWithoutFeedback, {
52
+ onPress: this.props.rightIconAction
53
+ }, /*#__PURE__*/React.createElement(Icon, {
54
+ type: "font-awesome",
55
+ name: this.props.rightIcon,
56
+ iconStyle: styles.clearIcon
57
+ }));
58
+ }
59
+ return /*#__PURE__*/React.createElement(Icon, {
60
+ type: "font-awesome",
61
+ name: this.props.rightIcon,
62
+ iconStyle: styles.clearIcon
63
+ });
64
+ }
65
+ if (this.props.hasClear && !_.isEmpty(this.props.value)) {
66
+ return /*#__PURE__*/React.createElement(TouchableWithoutFeedback, {
67
+ onPress: () => {
68
+ this.props.onChangeText("");
69
+ }
70
+ }, /*#__PURE__*/React.createElement(FontAwesome, {
71
+ name: "circle-x",
72
+ style: styles.clearIcon
73
+ }));
74
+ }
75
+ return null;
76
+ }
77
+ render() {
78
+ return /*#__PURE__*/React.createElement(View, {
79
+ style: [styles.searchInputContainer, this.props.squaredCorners && styles.squaredSearchInputContainer, this.props.autoGrow ? {
80
+ paddingVertical: 8,
81
+ minHeight: 40
82
+ } : {
83
+ height: 36
84
+ }, this.props.containerStyle]
85
+ }, this.renderLeftIcon(), /*#__PURE__*/React.createElement(TextInput, {
86
+ maxFontSizeMultiplier: 1.2,
87
+ ref: this.inputRef,
88
+ placeholder: this.props.placeholder,
89
+ placeholderTextColor: TEXT_LIGHT,
90
+ autoCorrect: this.props.autoCorrect != null ? this.props.autoCorrect : false,
91
+ autoFocus: this.props.autoFocus != null ? this.props.autoFocus : false,
92
+ autoGrow: this.props.autoGrow != null ? this.props.autoGrow : false,
93
+ multiline: this.props.multiline != null ? this.props.multiline : false,
94
+ style: [styles.searchText, this.props.style, {
95
+ textAlignVertical: this.props.multiline ? "top" : "center"
96
+ }, this.props.minHeight && {
97
+ minHeight: this.props.minHeight
98
+ }],
99
+ value: this.props.value,
100
+ onChangeText: this.props.onChangeText,
101
+ keyboardType: this.props.keyboardType,
102
+ returnKeyType: this.props.returnKeyType,
103
+ selectionColor: TEXT_DARK,
104
+ underlineColorAndroid: "rgba(0,0,0,0)",
105
+ editable: this.props.editable != null ? this.props.editable : true,
106
+ autoCapitalize: this.props.autoCapitalize || "none",
107
+ onKeyPress: this.props.onKeyPress,
108
+ onSubmitEditing: this.props.onSubmitEditing,
109
+ onFocus: this.props.onFocus,
110
+ onBlur: this.props.onBlur,
111
+ secureTextEntry: this.props.secureTextEntry && !this.state.showSecureText
112
+ }), this.renderRightIcon());
113
+ }
114
+ }
115
+ const styles = {
116
+ searchInputContainer: {
117
+ flex: 1,
118
+ borderRadius: 25,
119
+ backgroundColor: "#ebeff2",
120
+ alignItems: "center",
121
+ flexDirection: "row",
122
+ paddingHorizontal: 16
123
+ },
124
+ squaredSearchInputContainer: {
125
+ borderRadius: 5,
126
+ paddingHorizontal: 8
127
+ },
128
+ searchIcon: {
129
+ fontSize: 14,
130
+ color: TEXT_LIGHT,
131
+ marginRight: 8
132
+ },
133
+ clearIcon: {
134
+ fontSize: 14,
135
+ color: TEXT_LIGHT,
136
+ marginLeft: 8,
137
+ marginTop: 8,
138
+ marginBottom: 8
139
+ },
140
+ secureIcon: {
141
+ fontSize: 20
142
+ },
143
+ searchText: {
144
+ color: TEXT_DARKEST,
145
+ fontFamily: "sf-regular",
146
+ fontSize: 16,
147
+ flex: 1
148
+ }
149
+ };
150
+ export { GenericInput };
151
+ //# sourceMappingURL=GenericInput.js.map