@onehat/ui 0.1.3 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (355) hide show
  1. package/ckeditor5/LICENSE.md +49 -0
  2. package/ckeditor5/README.md +68 -0
  3. package/ckeditor5/build/ckeditor.js +6 -0
  4. package/ckeditor5/build/ckeditor.js.map +1 -0
  5. package/ckeditor5/build/translations/af.js +1 -0
  6. package/ckeditor5/build/translations/ar.js +1 -0
  7. package/ckeditor5/build/translations/ast.js +1 -0
  8. package/ckeditor5/build/translations/az.js +1 -0
  9. package/ckeditor5/build/translations/bg.js +1 -0
  10. package/ckeditor5/build/translations/bn.js +1 -0
  11. package/ckeditor5/build/translations/bs.js +1 -0
  12. package/ckeditor5/build/translations/ca.js +1 -0
  13. package/ckeditor5/build/translations/cs.js +1 -0
  14. package/ckeditor5/build/translations/da.js +1 -0
  15. package/ckeditor5/build/translations/de-ch.js +1 -0
  16. package/ckeditor5/build/translations/de.js +1 -0
  17. package/ckeditor5/build/translations/el.js +1 -0
  18. package/ckeditor5/build/translations/en-au.js +1 -0
  19. package/ckeditor5/build/translations/en-gb.js +1 -0
  20. package/ckeditor5/build/translations/eo.js +1 -0
  21. package/ckeditor5/build/translations/es-co.js +1 -0
  22. package/ckeditor5/build/translations/es.js +1 -0
  23. package/ckeditor5/build/translations/et.js +1 -0
  24. package/ckeditor5/build/translations/eu.js +1 -0
  25. package/ckeditor5/build/translations/fa.js +1 -0
  26. package/ckeditor5/build/translations/fi.js +1 -0
  27. package/ckeditor5/build/translations/fr.js +1 -0
  28. package/ckeditor5/build/translations/gl.js +1 -0
  29. package/ckeditor5/build/translations/gu.js +1 -0
  30. package/ckeditor5/build/translations/he.js +1 -0
  31. package/ckeditor5/build/translations/hi.js +1 -0
  32. package/ckeditor5/build/translations/hr.js +1 -0
  33. package/ckeditor5/build/translations/hu.js +1 -0
  34. package/ckeditor5/build/translations/id.js +1 -0
  35. package/ckeditor5/build/translations/it.js +1 -0
  36. package/ckeditor5/build/translations/ja.js +1 -0
  37. package/ckeditor5/build/translations/jv.js +1 -0
  38. package/ckeditor5/build/translations/kk.js +1 -0
  39. package/ckeditor5/build/translations/km.js +1 -0
  40. package/ckeditor5/build/translations/kn.js +1 -0
  41. package/ckeditor5/build/translations/ko.js +1 -0
  42. package/ckeditor5/build/translations/ku.js +1 -0
  43. package/ckeditor5/build/translations/lt.js +1 -0
  44. package/ckeditor5/build/translations/lv.js +1 -0
  45. package/ckeditor5/build/translations/ms.js +1 -0
  46. package/ckeditor5/build/translations/nb.js +1 -0
  47. package/ckeditor5/build/translations/ne.js +1 -0
  48. package/ckeditor5/build/translations/nl.js +1 -0
  49. package/ckeditor5/build/translations/no.js +1 -0
  50. package/ckeditor5/build/translations/oc.js +1 -0
  51. package/ckeditor5/build/translations/pl.js +1 -0
  52. package/ckeditor5/build/translations/pt-br.js +1 -0
  53. package/ckeditor5/build/translations/pt.js +1 -0
  54. package/ckeditor5/build/translations/ro.js +1 -0
  55. package/ckeditor5/build/translations/ru.js +1 -0
  56. package/ckeditor5/build/translations/si.js +1 -0
  57. package/ckeditor5/build/translations/sk.js +1 -0
  58. package/ckeditor5/build/translations/sl.js +1 -0
  59. package/ckeditor5/build/translations/sq.js +1 -0
  60. package/ckeditor5/build/translations/sr-latn.js +1 -0
  61. package/ckeditor5/build/translations/sr.js +1 -0
  62. package/ckeditor5/build/translations/sv.js +1 -0
  63. package/ckeditor5/build/translations/th.js +1 -0
  64. package/ckeditor5/build/translations/tk.js +1 -0
  65. package/ckeditor5/build/translations/tr.js +1 -0
  66. package/ckeditor5/build/translations/tt.js +1 -0
  67. package/ckeditor5/build/translations/ug.js +1 -0
  68. package/ckeditor5/build/translations/uk.js +1 -0
  69. package/ckeditor5/build/translations/ur.js +1 -0
  70. package/ckeditor5/build/translations/uz.js +1 -0
  71. package/ckeditor5/build/translations/vi.js +1 -0
  72. package/ckeditor5/build/translations/zh-cn.js +1 -0
  73. package/ckeditor5/build/translations/zh.js +1 -0
  74. package/ckeditor5/package.json +46 -0
  75. package/ckeditor5/sample/index.html +130 -0
  76. package/ckeditor5/sample/styles.css +496 -0
  77. package/ckeditor5/src/ckeditor.js +138 -0
  78. package/ckeditor5/webpack.config.js +96 -0
  79. package/package.json +19 -23
  80. package/src/Components/Accordion/Accordion.js +144 -0
  81. package/src/Components/Blank.js +14 -0
  82. package/src/Components/Buttons/BackButton.js +16 -0
  83. package/src/Components/Buttons/CartButtonWithBadge.js +25 -0
  84. package/src/Components/Buttons/IconButton.js +42 -0
  85. package/src/Components/Container/Container.js +178 -0
  86. package/src/Components/Container/Splitter.js +61 -0
  87. package/src/Components/Filter/DateRange.js +99 -0
  88. package/src/Components/Filter/NumberRange.js +96 -0
  89. package/src/Components/Form/Field/CKEditor/CKEditor.js +62 -0
  90. package/src/Components/Form/Field/CKEditor/styles.css +503 -0
  91. package/src/Components/Form/Field/CKEditor.js +12 -0
  92. package/src/Components/Form/Field/CheckboxGroup/ArrayCheckboxGroup.js +13 -0
  93. package/src/Components/Form/Field/CheckboxGroup/CheckboxGroup.js +61 -0
  94. package/src/Components/Form/Field/Color.js +226 -0
  95. package/src/Components/Form/Field/Combo/ArrayCombo.js +15 -0
  96. package/src/Components/Form/Field/Combo/BooleanCombo.js +23 -0
  97. package/src/Components/Form/Field/Combo/Combo.js +504 -0
  98. package/src/Components/Form/Field/Combo/ComboEditor.js +22 -0
  99. package/src/Components/Form/Field/Combo/IntervalsCombo.js +18 -0
  100. package/src/Components/Form/Field/Combo/MonthsCombo.js +24 -0
  101. package/src/Components/Form/Field/Combo/PageSizeCombo.js +38 -0
  102. package/src/Components/Form/Field/Combo/Tag.js +12 -0
  103. package/src/Components/Form/Field/Combo/TimezonesCombo.js +432 -0
  104. package/src/Components/Form/Field/Combo/YearsCombo.js +35 -0
  105. package/src/Components/Form/Field/Date.js +370 -0
  106. package/src/Components/Form/Field/DisplayField.js +28 -0
  107. package/src/Components/Form/Field/Field.js +14 -0
  108. package/src/Components/Form/Field/File.js +218 -0
  109. package/src/Components/Form/Field/Input.js +96 -0
  110. package/src/Components/Form/Field/Number.js +151 -0
  111. package/src/Components/Form/Field/RadioGroup/ArrayRadioGroup.js +13 -0
  112. package/src/Components/Form/Field/RadioGroup/RadioGroup.js +62 -0
  113. package/src/Components/Form/Field/Tag.js +11 -0
  114. package/src/Components/Form/Field/Text.js +28 -0
  115. package/src/Components/Form/Field/TextArea.js +26 -0
  116. package/src/Components/Form/Field/Toggle.js +39 -0
  117. package/src/Components/Form/Field/datetime.css +5 -0
  118. package/src/Components/Form/FieldSet.js +64 -0
  119. package/src/Components/Form/FiltersForm.js +66 -0
  120. package/src/Components/Form/Form.js +535 -0
  121. package/src/Components/Form/Label.js +24 -0
  122. package/src/Components/Grid/Grid.js +877 -0
  123. package/src/Components/Grid/GridHeaderRow.js +455 -0
  124. package/src/Components/Grid/GridRow.js +134 -0
  125. package/src/Components/Grid/HeaderReorderHandle.js +29 -0
  126. package/src/Components/Grid/HeaderResizeHandle.js +29 -0
  127. package/src/Components/Grid/NoRecordsFound.js +43 -0
  128. package/src/Components/Grid/ReactGrid.js +468 -0
  129. package/src/Components/Grid/SenchaGrid.js +421 -0
  130. package/src/Components/Grid/reactgrid.css +6 -0
  131. package/src/Components/Hoc/withAlert.js +176 -0
  132. package/src/Components/Hoc/withBlank.js +12 -0
  133. package/src/Components/Hoc/withCollapsible.js +20 -0
  134. package/src/Components/Hoc/withContextMenu.js +127 -0
  135. package/src/Components/Hoc/withData.js +85 -0
  136. package/src/Components/Hoc/withDraggable.js +259 -0
  137. package/src/Components/Hoc/withEditor.js +160 -0
  138. package/src/Components/Hoc/withEvents.js +12 -0
  139. package/src/Components/Hoc/withFilters.js +456 -0
  140. package/src/Components/Hoc/withInlineEditor.js +119 -0
  141. package/src/Components/Hoc/withMultiSelection.js +16 -0
  142. package/src/Components/Hoc/withPresetButtons.js +239 -0
  143. package/src/Components/Hoc/withSelection.js +332 -0
  144. package/src/Components/Hoc/withTooltip.js +21 -0
  145. package/src/Components/Hoc/withValue.js +87 -0
  146. package/src/Components/Hoc/withWindowedEditor.js +51 -0
  147. package/src/Components/Icons/AddressBook.js +14 -0
  148. package/src/Components/Icons/Alt.js +17 -0
  149. package/src/Components/Icons/AngleLeft.js +18 -0
  150. package/src/Components/Icons/AngleRight.js +18 -0
  151. package/src/Components/Icons/AnglesLeft.js +18 -0
  152. package/src/Components/Icons/AnglesRight.js +18 -0
  153. package/src/Components/Icons/Asterisk.js +14 -0
  154. package/src/Components/Icons/Ban.js +18 -0
  155. package/src/Components/Icons/Bars.js +14 -0
  156. package/src/Components/Icons/BigCircle.js +17 -0
  157. package/src/Components/Icons/Book.js +14 -0
  158. package/src/Components/Icons/BookOpen.js +14 -0
  159. package/src/Components/Icons/Bug.js +14 -0
  160. package/src/Components/Icons/Building.js +14 -0
  161. package/src/Components/Icons/Calendar.js +18 -0
  162. package/src/Components/Icons/Calendar2.js +18 -0
  163. package/src/Components/Icons/CalendarDays.js +18 -0
  164. package/src/Components/Icons/Camera.js +18 -0
  165. package/src/Components/Icons/CaretDown.js +18 -0
  166. package/src/Components/Icons/CaretUp.js +18 -0
  167. package/src/Components/Icons/CartPlus.js +14 -0
  168. package/src/Components/Icons/CartShopping.js +14 -0
  169. package/src/Components/Icons/CashRegister.js +14 -0
  170. package/src/Components/Icons/ChartLine.js +14 -0
  171. package/src/Components/Icons/Check.js +14 -0
  172. package/src/Components/Icons/CheckDouble.js +14 -0
  173. package/src/Components/Icons/ChevronDown.js +14 -0
  174. package/src/Components/Icons/ChevronLeft.js +14 -0
  175. package/src/Components/Icons/ChevronRight.js +14 -0
  176. package/src/Components/Icons/ChevronUp.js +14 -0
  177. package/src/Components/Icons/CircleArrowRight.js +14 -0
  178. package/src/Components/Icons/CircleExclamation.js +18 -0
  179. package/src/Components/Icons/CircleInfo.js +14 -0
  180. package/src/Components/Icons/CircleQuestion.js +14 -0
  181. package/src/Components/Icons/CircleXmark.js +14 -0
  182. package/src/Components/Icons/CircleXmarkRegular.js +14 -0
  183. package/src/Components/Icons/Clipboard.js +18 -0
  184. package/src/Components/Icons/Clock.js +14 -0
  185. package/src/Components/Icons/ClockRegular.js +14 -0
  186. package/src/Components/Icons/ClockRotateLeft.js +14 -0
  187. package/src/Components/Icons/Clone.js +14 -0
  188. package/src/Components/Icons/Comment.js +14 -0
  189. package/src/Components/Icons/CommentRegular.js +14 -0
  190. package/src/Components/Icons/Comments.js +14 -0
  191. package/src/Components/Icons/CommentsRegular.js +14 -0
  192. package/src/Components/Icons/Copyright.js +14 -0
  193. package/src/Components/Icons/Duplicate.js +18 -0
  194. package/src/Components/Icons/Edit.js +18 -0
  195. package/src/Components/Icons/EllipsisVertical.js +18 -0
  196. package/src/Components/Icons/Envelope.js +14 -0
  197. package/src/Components/Icons/EnvelopeRegular.js +14 -0
  198. package/src/Components/Icons/Exclamation.js +14 -0
  199. package/src/Components/Icons/Expand.js +14 -0
  200. package/src/Components/Icons/Eye.js +18 -0
  201. package/src/Components/Icons/File.js +18 -0
  202. package/src/Components/Icons/FloppyDiskRegular.js +14 -0
  203. package/src/Components/Icons/Gear.js +18 -0
  204. package/src/Components/Icons/Gift.js +14 -0
  205. package/src/Components/Icons/Grip.js +18 -0
  206. package/src/Components/Icons/GripLines.js +18 -0
  207. package/src/Components/Icons/GripLinesVertical.js +18 -0
  208. package/src/Components/Icons/GripVertical.js +18 -0
  209. package/src/Components/Icons/Hammer.js +14 -0
  210. package/src/Components/Icons/Hand.js +14 -0
  211. package/src/Components/Icons/House.js +14 -0
  212. package/src/Components/Icons/Info.js +14 -0
  213. package/src/Components/Icons/ItunesNote.js +14 -0
  214. package/src/Components/Icons/List.js +14 -0
  215. package/src/Components/Icons/ListCheck.js +14 -0
  216. package/src/Components/Icons/LocationDot.js +14 -0
  217. package/src/Components/Icons/Loop.js +17 -0
  218. package/src/Components/Icons/Loop1.js +18 -0
  219. package/src/Components/Icons/LoopAll.js +18 -0
  220. package/src/Components/Icons/Maximize.js +14 -0
  221. package/src/Components/Icons/Microphone.js +14 -0
  222. package/src/Components/Icons/Minimize.js +14 -0
  223. package/src/Components/Icons/Minus.js +18 -0
  224. package/src/Components/Icons/MobileScreenButton.js +14 -0
  225. package/src/Components/Icons/MoneyBill.js +14 -0
  226. package/src/Components/Icons/MoneyBillWave.js +14 -0
  227. package/src/Components/Icons/Mouth.js +24 -0
  228. package/src/Components/Icons/Music.js +14 -0
  229. package/src/Components/Icons/NoLoop.js +24 -0
  230. package/src/Components/Icons/NoReorderRows.js +25 -0
  231. package/src/Components/Icons/ObjectGroupRegular.js +14 -0
  232. package/src/Components/Icons/Pause.js +14 -0
  233. package/src/Components/Icons/Pencil.js +18 -0
  234. package/src/Components/Icons/Phone.js +14 -0
  235. package/src/Components/Icons/Play.js +14 -0
  236. package/src/Components/Icons/Plus.js +18 -0
  237. package/src/Components/Icons/Presentation.js +19 -0
  238. package/src/Components/Icons/Print.js +18 -0
  239. package/src/Components/Icons/Question.js +14 -0
  240. package/src/Components/Icons/Rate-.25x.js +20 -0
  241. package/src/Components/Icons/Rate-.5x.js +19 -0
  242. package/src/Components/Icons/Rate-.75x.js +19 -0
  243. package/src/Components/Icons/Rate-1.25x.js +20 -0
  244. package/src/Components/Icons/Rate-1.5x.js +19 -0
  245. package/src/Components/Icons/Rate-1.75x.js +19 -0
  246. package/src/Components/Icons/Rate-1x.js +19 -0
  247. package/src/Components/Icons/Rate-2x.js +19 -0
  248. package/src/Components/Icons/RateIcon-.25x.js +20 -0
  249. package/src/Components/Icons/RateIcon-.5x.js +19 -0
  250. package/src/Components/Icons/RateIcon-.75x.js +19 -0
  251. package/src/Components/Icons/RateIcon-1.25x.js +20 -0
  252. package/src/Components/Icons/RateIcon-1.5x.js +19 -0
  253. package/src/Components/Icons/RateIcon-1.75x.js +19 -0
  254. package/src/Components/Icons/RateIcon-1x.js +19 -0
  255. package/src/Components/Icons/RateIcon-2x.js +19 -0
  256. package/src/Components/Icons/RectangleXmark.js +14 -0
  257. package/src/Components/Icons/RectangleXmarkRegular.js +14 -0
  258. package/src/Components/Icons/ReorderRows.js +21 -0
  259. package/src/Components/Icons/RightFromBracket.js +14 -0
  260. package/src/Components/Icons/RightToBracket.js +14 -0
  261. package/src/Components/Icons/Rotate.js +18 -0
  262. package/src/Components/Icons/RotateLeft.js +14 -0
  263. package/src/Components/Icons/RotateRight.js +18 -0
  264. package/src/Components/Icons/ScrewdriverWrench.js +14 -0
  265. package/src/Components/Icons/Scroll.js +14 -0
  266. package/src/Components/Icons/Share.js +14 -0
  267. package/src/Components/Icons/Shop.js +14 -0
  268. package/src/Components/Icons/SortDown.js +18 -0
  269. package/src/Components/Icons/SortUp.js +18 -0
  270. package/src/Components/Icons/Square.js +14 -0
  271. package/src/Components/Icons/SquareCheck.js +14 -0
  272. package/src/Components/Icons/SquareCheckRegular.js +14 -0
  273. package/src/Components/Icons/SquareMinus.js +18 -0
  274. package/src/Components/Icons/SquareRegular.js +14 -0
  275. package/src/Components/Icons/Store.js +14 -0
  276. package/src/Components/Icons/ThumbsDown.js +14 -0
  277. package/src/Components/Icons/ThumbsDownRegular.js +14 -0
  278. package/src/Components/Icons/ThumbsUp.js +14 -0
  279. package/src/Components/Icons/ThumbsUpRegular.js +14 -0
  280. package/src/Components/Icons/Trash.js +18 -0
  281. package/src/Components/Icons/TrashCan.js +18 -0
  282. package/src/Components/Icons/TriangleExclamation.js +18 -0
  283. package/src/Components/Icons/Truck.js +14 -0
  284. package/src/Components/Icons/TruckFast.js +14 -0
  285. package/src/Components/Icons/User.js +14 -0
  286. package/src/Components/Icons/UserGroup.js +14 -0
  287. package/src/Components/Icons/UserSecret.js +14 -0
  288. package/src/Components/Icons/X.js +14 -0
  289. package/src/Components/Icons/Xmark.js +14 -0
  290. package/src/Components/Mask.js +11 -0
  291. package/src/Components/Messages/ConfirmationMessage.js +26 -0
  292. package/src/Components/Messages/ErrorMessage.js +15 -0
  293. package/src/Components/Messages/Loading.js +16 -0
  294. package/src/Components/Messages/OkMessage.js +24 -0
  295. package/src/Components/Messages/WaitMessage.js +18 -0
  296. package/src/Components/Panel/AccordionGridPanel.js +94 -0
  297. package/src/Components/Panel/Footer.js +20 -0
  298. package/src/Components/Panel/FormPanel.js +23 -0
  299. package/src/Components/Panel/GridPanel.js +45 -0
  300. package/src/Components/Panel/Header.js +107 -0
  301. package/src/Components/Panel/Panel.js +152 -0
  302. package/src/Components/Panel/TabPanel.js +331 -0
  303. package/src/Components/Panel/UploadDownload.js +10 -0
  304. package/src/Components/Picker/Picker.js +64 -0
  305. package/src/Components/ScreenContainer.js +71 -0
  306. package/src/Components/Screens/DataMgt.js +250 -0
  307. package/src/Components/Toolbar/FilterToolbar.js +20 -0
  308. package/src/Components/Toolbar/Pagination.js +146 -0
  309. package/src/Components/Toolbar/PaginationToolbar.js +22 -0
  310. package/src/Components/Toolbar/Toolbar.js +18 -0
  311. package/src/Components/WaitModal.js +31 -0
  312. package/src/Components/Window/Editor.js +19 -0
  313. package/src/Constants/Alert.js +3 -0
  314. package/src/Constants/Date.js +3 -0
  315. package/src/Constants/Directions.js +8 -0
  316. package/src/Constants/EditorTypes.js +4 -0
  317. package/src/Constants/File.js +2 -0
  318. package/src/Constants/Grid.js +4 -0
  319. package/src/Constants/Input.js +1 -0
  320. package/src/Constants/Selection.js +5 -0
  321. package/src/Constants/Styles.js +86 -0
  322. package/src/Constants/UiModes.js +2 -0
  323. package/src/Data/Hoc/withRedux.js +48 -0
  324. package/src/Data/useOneHatData.js +75 -0
  325. package/src/Functions/BankersRound.js +11 -0
  326. package/src/Functions/Timer.js +92 -0
  327. package/src/Functions/deleteSecure.js +6 -0
  328. package/src/Functions/emptyFn.js +1 -0
  329. package/src/Functions/getComponentFromType.js +106 -0
  330. package/src/Functions/getIsMobile.js +5 -0
  331. package/src/Functions/getPref.js +7 -0
  332. package/src/Functions/getSecure.js +21 -0
  333. package/src/Functions/getTokenHeaders.js +13 -0
  334. package/src/Functions/inArray.js +5 -0
  335. package/src/Functions/isJson.js +8 -0
  336. package/src/Functions/processImage.js +16 -0
  337. package/src/Functions/setPref.js +14 -0
  338. package/src/Functions/setProgress.js +49 -0
  339. package/src/Functions/setSecure.js +35 -0
  340. package/src/Functions/setUiMode.js +5 -0
  341. package/src/Functions/sleep.js +3 -0
  342. package/src/Functions/testProps.js +24 -0
  343. package/src/Functions/trackEngagementHit.js +11 -0
  344. package/src/Functions/verifyCompleted.js +18 -0
  345. package/src/Functions/waitFor.js +16 -0
  346. package/src/Hooks/useAppState.js +34 -0
  347. package/src/Hooks/useAsync.js +13 -0
  348. package/src/Hooks/useBlocking.js +18 -0
  349. package/src/Hooks/useCameraRoll.js +41 -0
  350. package/src/Hooks/useForceUpdate.js +14 -0
  351. package/src/Hooks/useIsMounted.js +14 -0
  352. package/src/Hooks/useNotifications.js +279 -0
  353. package/src/Styles/StyleSheets.js +14 -0
  354. package/src/Styles/ThemeOverrides.js +264 -0
  355. package/src/UiConfig.js +19 -0
@@ -0,0 +1,18 @@
1
+ import { useRef, } from 'react';
2
+
3
+ // Handy utility that will set isBlocked.current as true for 100ms,
4
+ // then will set it back to false. Use this to block mouse events
5
+ // for a brief time.
6
+ // let isBlocked = { current: false };
7
+
8
+ export default function useBlocking() {
9
+ const
10
+ isBlocked = useRef(),
11
+ block = () => {
12
+ isBlocked.current = true;
13
+ setTimeout(() => {
14
+ isBlocked.current = false;
15
+ }, 200);
16
+ };
17
+ return { isBlocked, block };
18
+ }
@@ -0,0 +1,41 @@
1
+ import { useCallback, useState } from 'react';
2
+ import * as MediaLibrary from 'expo-media-library';
3
+ // import { CameraRoll } from 'react-native';
4
+ // import CameraRoll from '@react-native-community/cameraroll';
5
+
6
+ // This is taken from https://dev.to/atalkwithdev/resolving-expo-multi-select-photos-with-react-hooks-487k
7
+ export default function useCameraRoll({
8
+ first = 40,
9
+ assetType = 'Photos',
10
+ groupTypes = 'All',
11
+ }) {
12
+ const [photos, setPhotos] = useState([]),
13
+ [after, setAfter] = useState(null),
14
+ [hasNextPage, setHasNextPage] = useState(true);
15
+
16
+ const getPhotos = useCallback(async () => {
17
+ if (!hasNextPage) {
18
+ return;
19
+ }
20
+
21
+ // BUG::This dies because the RN library isn't linked to Native CameraRoll code.
22
+ const { edges, page_info: pageInfo } = await CameraRoll.getPhotos({
23
+ first,
24
+ assetType,
25
+ groupTypes,
26
+ ...(after && { after }),
27
+ });
28
+
29
+ if (after === pageInfo.end_cursor) {
30
+ return;
31
+ }
32
+
33
+ const images = edges.map(i => i.node).map(i => i.image);
34
+
35
+ setPhotos([...photos, ...images]);
36
+ setAfter(pageInfo.end_cursor);
37
+ setHasNextPage(pageInfo.has_next_page);
38
+ }, [after, hasNextPage, photos]);
39
+
40
+ return [photos, getPhotos];
41
+ }
@@ -0,0 +1,14 @@
1
+ /**
2
+ * This file is categorized as "Proprietary Framework Code"
3
+ * and is subject to the terms and conditions defined in
4
+ * file 'LICENSE.txt', which is part of this source code package.
5
+ */
6
+ import { useState, useCallback } from 'react'
7
+
8
+ export default function useForceUpdate() {
9
+ const [, setTick] = useState(0);
10
+ const update = useCallback(() => {
11
+ setTick(tick => tick + 1);
12
+ }, [])
13
+ return update;
14
+ }
@@ -0,0 +1,14 @@
1
+ import { useRef, useEffect } from 'react';
2
+
3
+ // From https://stackoverflow.com/a/65152534
4
+
5
+ export default function useIsMounted() {
6
+ const isMounted = useRef(false);
7
+
8
+ useEffect(() => {
9
+ isMounted.current = true;
10
+ return () => isMounted.current = false;
11
+ }, []);
12
+
13
+ return isMounted;
14
+ }
@@ -0,0 +1,279 @@
1
+ import { useEffect, useState, } from 'react';
2
+ import * as TaskManager from 'expo-task-manager';
3
+ import * as Notifications from 'expo-notifications';
4
+ import * as Device from 'expo-device';
5
+ import AppGlobals from '../../AppGlobals';
6
+ import { Alert } from 'react-native';
7
+ import { BACKGROUND_NOTIFICATION_TASK } from '../../Constants/Tasks';
8
+ import moment from 'moment';
9
+
10
+
11
+ // Much of this was adapted from react-native-hook-use-notification found here: https://github.com/dameyerdave/react-native-hook-use-notification#readme
12
+
13
+ export const askForNotificationPermission = async () => {
14
+
15
+ // Get notification permissions
16
+ // (Not sure if I need this code, so it's commented out)
17
+ // const result = await Notifications.requestPermissionsAsync({
18
+ // android: {},
19
+ // ios: {
20
+ // allowAlert: true,
21
+ // allowBadge: false,
22
+ // allowSound: true,
23
+ // allowDisplayInCarPlay: false,
24
+ // allowCriticalAlerts: true,
25
+ // provideAppNotificationSettings: true,
26
+ // allowProvisional: true,
27
+ // allowAnnouncements: true,
28
+ // },
29
+ // });
30
+
31
+
32
+ const {
33
+ status: existingStatus
34
+ } = await Notifications.getPermissionsAsync();
35
+ let finalStatus = existingStatus;
36
+
37
+ if (existingStatus !== 'granted') {
38
+ const {
39
+ status
40
+ } = await Notifications.requestPermissionsAsync();
41
+ finalStatus = status;
42
+ }
43
+
44
+ if (finalStatus !== 'granted') {
45
+ return false;
46
+ }
47
+
48
+ if (Platform.OS === 'android') {
49
+ Notifications.setNotificationChannelAsync('default', {
50
+ name: 'default',
51
+ importance: Notifications.AndroidImportance.MAX,
52
+ vibrationPattern: [0, 250, 250, 250],
53
+ // lightColor: '#FF231F7C',
54
+ });
55
+ }
56
+
57
+ return true;
58
+ };
59
+
60
+ export const notify = async (title = 'Notification', body = 'Hello', data = {}, trigger = null, sound = true, vibrate = true) => {
61
+ if (!Array.isArray(trigger)) {
62
+ trigger = [trigger]
63
+ }
64
+ for (let _trigger of trigger) {
65
+ try {
66
+ await Notifications.scheduleNotificationAsync({
67
+ // identifier: title + body + JSON.stringify(data) + JSON.stringify(trigger),
68
+ content: {
69
+ title: title,
70
+ body: body,
71
+ data: data,
72
+ sound: sound,
73
+ vibrate: vibrate,
74
+ // attachments: [
75
+ // {
76
+ // // identifier: new Date().getTime().toString(),
77
+ // url: 'http://www.clipartbest.com/cliparts/ncB/Mrp/ncBMrpy7i.jpg',
78
+ // // type: 'Image'
79
+ // // typeHint: 'Image',
80
+ // hideThumbnail: false,
81
+ // // thumbnailClipArea: { x: 0, y: 0, width: 10, height: 10 }
82
+ // }
83
+ // ]
84
+ },
85
+ trigger: _trigger,
86
+ })
87
+ } catch (err) {
88
+ console.log(err)
89
+ }
90
+ }
91
+ };
92
+
93
+ export const getScheduledNotifications = async () => {
94
+ try {
95
+ return Notifications.getAllScheduledNotificationsAsync()
96
+ } catch (err) {
97
+ console.log(err)
98
+ }
99
+
100
+ };
101
+
102
+ export const clearScheduledNotifications = async () => {
103
+ try {
104
+ await Notifications.cancelAllScheduledNotificationsAsync()
105
+ } catch (err) {
106
+ console.log(err)
107
+ }
108
+ };
109
+
110
+ export const parseResponse = (notification) => {
111
+ if (notification.notification) {
112
+ notification = notification.notification;
113
+ }
114
+ const body = notification?.request?.content?.body,
115
+ title = notification?.request?.content?.title,
116
+ data = notification?.request?.content?.data;
117
+ return {
118
+ body,
119
+ title,
120
+ data,
121
+ };
122
+ };
123
+
124
+ export const useNotifications = (args) => {
125
+
126
+ const {
127
+ onNotificationReceived,
128
+ onNotificationDropped,
129
+ onNotificationResponseReceived,
130
+ onBackgroundNotificationTaskReceived,
131
+ getExpoPushToken,
132
+ options = {
133
+ alert: true,
134
+ sound: true,
135
+ badge: false,
136
+ },
137
+ } = args,
138
+ [askedPermissions, setAskedPermissions] = useState(false);
139
+
140
+ // if (onBackgroundNotificationTaskReceived && !TaskManager.isTaskDefined(BACKGROUND_NOTIFICATION_TASK)) {
141
+ // TaskManager.defineTask(BACKGROUND_NOTIFICATION_TASK, onBackgroundNotificationTaskReceived);
142
+ // debugger;
143
+ // Notifications.registerTaskAsync(BACKGROUND_NOTIFICATION_TASK);
144
+ // }
145
+
146
+ if (Device.isDevice) {
147
+
148
+ useEffect(() => {
149
+
150
+ askForNotificationPermission()
151
+ .then((granted) => {
152
+ if (!granted) {
153
+ Alert.alert('Notifications', 'Notifications are not allowed. This functionality will be disabled until permissions are given.');
154
+ return;
155
+ }
156
+
157
+ let responseListener = null,
158
+ responseDroppedListener = null,
159
+ responseReceivedListener = null;
160
+ if (onNotificationReceived) { // For whenever a new notification is received
161
+ responseListener = Notifications.addNotificationReceivedListener((notification) => {
162
+ const response = parseResponse(notification);
163
+ onNotificationReceived(response);
164
+ });
165
+ }
166
+ if (onNotificationDropped) { // For whenever some notifications have been dropped
167
+ responseDroppedListener = Notifications.addNotificationsDroppedListener((notification) => {
168
+ const response = parseResponse(notification);
169
+ onNotificationDropped(response);
170
+ });
171
+ }
172
+ if (onNotificationResponseReceived) { // For whenever user interacts with a notification
173
+ responseReceivedListener = Notifications.addNotificationResponseReceivedListener((notification) => {
174
+ const response = parseResponse(notification);
175
+ onNotificationResponseReceived(response);
176
+ });
177
+ }
178
+ if (getExpoPushToken) {
179
+ Notifications.getExpoPushTokenAsync({
180
+ experienceId: AppGlobals.experienceId,
181
+ }).then((token) => {
182
+ getExpoPushToken(token);
183
+ }).catch((err) => {
184
+ Alert.alert('Debug', err.toString());
185
+ console.log(err);
186
+ });
187
+ }
188
+
189
+ return () => {
190
+ if (responseListener) {
191
+ Notifications.removeNotificationSubscription(responseListener);
192
+ }
193
+ if (responseDroppedListener) {
194
+ Notifications.removeNotificationSubscription(responseDroppedListener);
195
+ }
196
+ if (responseReceivedListener) {
197
+ Notifications.removeNotificationSubscription(responseReceivedListener);
198
+ }
199
+ };
200
+ }).catch((err) => {
201
+ console.log(err);
202
+ }).finally(() => {
203
+ setAskedPermissions(true);
204
+ });
205
+
206
+ Notifications.setNotificationHandler({
207
+ handleNotification: async () => ({
208
+ shouldShowAlert: options.alert,
209
+ shouldPlaySound: options.sound,
210
+ shouldSetBadge: options.badge,
211
+ }),
212
+ });
213
+ }, []);
214
+ }
215
+
216
+ return [
217
+ notify,
218
+ askedPermissions,
219
+ ];
220
+ };
221
+
222
+
223
+
224
+ // Triggers
225
+
226
+ export const intervalTrigger = (seconds, repeats = true) => {
227
+ return {
228
+ repeats: repeats,
229
+ seconds: seconds
230
+ }
231
+ };
232
+
233
+ export const dailyTrigger = (hour, minute) => {
234
+ return {
235
+ repeats: true,
236
+ hour: hour,
237
+ minute: minute
238
+ }
239
+ };
240
+
241
+ export const cronTrigger = (cron) => {
242
+ const now = moment().milliseconds(0)
243
+
244
+ let triggers = []
245
+ const cron_parts = cron.split(' ')
246
+ if (cron_parts.length === 5) {
247
+ let [__minute, __hour, __dom, __month, __dow] = cron_parts
248
+
249
+ const minute = __minute == '*' ? now.minute().toString() : __minute
250
+ const hour = __hour == '*' ? now.hour().toString() : __hour
251
+ const dom = __dom == '*' ? now.date().toString() : __dom
252
+ const month = __month == '*' ? now.month().toString() : __month.split(',').map(m => m - 1).join(',')
253
+ const dow = __dow
254
+
255
+ for (let _minute of minute.split(',')) {
256
+ for (let _hour of hour.split(',')) {
257
+ for (let _dom of dom.split(',')) {
258
+ for (let _month of month.split(',')) {
259
+ for (let _dow of dow.split(',')) {
260
+ const runtime = moment(now).minute(_minute).hour(_hour).date(_dom).month(_month)
261
+ triggers.push({
262
+ repeats: true,
263
+ second: 0,
264
+ minute: __minute != '*' ? runtime.minute() : undefined,
265
+ hour: __hour != '*' ? runtime.hour() : undefined,
266
+ day: __dom != '*' ? runtime.date() : undefined,
267
+ month: __month != '*' ? runtime.month() : undefined,
268
+ weekday: __dow != '*' ? Number(_dow) + 1 : undefined
269
+ })
270
+ }
271
+ }
272
+ }
273
+ }
274
+ }
275
+ } else {
276
+ console.log('Error in cron_definition of schedule ' + schedule.description + ' (' + schedule.cron_definition + ')')
277
+ }
278
+ return triggers
279
+ };
@@ -0,0 +1,14 @@
1
+ import { StyleSheet } from 'react-native';
2
+
3
+ export const styles = {
4
+ nsResize: {
5
+ cursor: 'ns-resize',
6
+ },
7
+ ewResize: {
8
+ cursor: 'ew-resize',
9
+ },
10
+ shiftUpAbove: {
11
+ transform: 'translateY(-100%)',
12
+ },
13
+ };
14
+ export default StyleSheet.create(styles);
@@ -0,0 +1,264 @@
1
+ const ThemeOverrides = {
2
+ colors: {
3
+ primary: {
4
+ 100: '#4D89CC',
5
+ 200: '#467DBA',
6
+ 300: '#3F71A8',
7
+ 400: '#396799',
8
+ 500: '#335C89', // default for buttons
9
+ 600: '#2E527A',
10
+ 700: '#28486B',
11
+ 800: '#203A57',
12
+ 900: '#182C42',
13
+ },
14
+ // secondary: {
15
+ // 500: '#1F3854', // default for buttons
16
+ // },
17
+ selected: '#ffc',
18
+ hover: '#eee',
19
+ selectedHover: '#eeb',
20
+ unselected: '#bbb',
21
+ disabled: '#ccc',
22
+ control: '#1B518C',
23
+ vip: '#3a78bc',
24
+ navBlue: '#3b82f6',
25
+ warning: '#d92b2b',
26
+ orange: '#de9000',
27
+ greens: {
28
+ 100: '#4CAF50',
29
+ 200: '#449E48',
30
+ 300: '#3d8C40',
31
+ 400: '#357A38',
32
+ 500: '#2E6930',
33
+ 600: '#265828',
34
+ 700: '#1E4620',
35
+ 800: '#173518',
36
+ 900: '#0F2310',
37
+ },
38
+ },
39
+ // config: {
40
+ // initialColorMode: 'dark',
41
+ // },
42
+ Components: {
43
+ Select: {
44
+ defaultProps: {
45
+ h: 50,
46
+ flex: 1,
47
+ bg: '#fff',
48
+ borderWidth: 1,
49
+ borderColor: '#000',
50
+ isDisabled: false,
51
+ },
52
+ },
53
+ Icon: {
54
+ defaultProps: {
55
+ size: 'md',
56
+ color: '#fff',
57
+ },
58
+ },
59
+ Input: {
60
+ variants: {
61
+ form: (props) => {
62
+ const c = props.colorScheme,
63
+ m = props.colorMode,
64
+ isLightMode = m === 'light';
65
+ return {
66
+ autoCapitalize: 'none',
67
+ mb: 4,
68
+ w: '100%',
69
+ h: '50px',
70
+
71
+ // BEGIN Taken from variant 'filled'
72
+ bg: props.bg || (isLightMode ? 'muted.200' : 'muted.600'),
73
+ borderWidth: '1',
74
+ borderColor: 'transparent',
75
+ _hover: {
76
+ bg: isLightMode ? 'muted.200' : 'muted.700',
77
+ },
78
+ // END
79
+ };
80
+ },
81
+ },
82
+ defaultProps: {
83
+ size: 'xl',
84
+ },
85
+ },
86
+ Button: {
87
+ variants: {
88
+ footer: (props) => {
89
+ const c = props.colorScheme,
90
+ m = props.colorMode,
91
+ isLightMode = m === 'light';
92
+
93
+ return {
94
+ flex: 1,
95
+ _text: {
96
+ color: '#fff',
97
+ },
98
+ alignSelf: 'center',
99
+ alignItems: 'center',
100
+ justifyContent: 'center',
101
+
102
+ // BEGIN Taken from variant 'solid'
103
+ _web: {
104
+ outlineWidth: '0'
105
+ },
106
+ bg: c + '.800',
107
+ _hover: {
108
+ bg: c + '.600'
109
+ },
110
+ _pressed: {
111
+ bg: c + '.700'
112
+ },
113
+ _focus: {
114
+ bg: c + '.600'
115
+ },
116
+ _loading: {
117
+ bg: isLightMode ? 'warmGray.50' : c + '.300',
118
+ opacity: '50'
119
+ },
120
+ _disabled: {
121
+ _text: {
122
+ color: '#000',
123
+ },
124
+ bg: isLightMode ? 'trueGray.400' : 'trueGray.600',
125
+ },
126
+ // END
127
+ };
128
+ },
129
+ solid2: (props) => {
130
+ const c = props.colorScheme,
131
+ m = props.colorMode,
132
+ isLightMode = m === 'light';
133
+
134
+ return {
135
+ _text: {
136
+ color: '#fff',
137
+ },
138
+ // BEGIN Taken from variant 'solid'
139
+ _web: {
140
+ outlineWidth: '0'
141
+ },
142
+ bg: 'trueGray.200',
143
+ borderColor: c + '.800',
144
+ borderWidth: 1,
145
+ _hover: {
146
+ bg: 'trueGray.400'
147
+ },
148
+ _pressed: {
149
+ bg: 'trueGray.700'
150
+ },
151
+ _focus: {
152
+ bg: 'trueGray.600',
153
+ },
154
+ _loading: {
155
+ bg: isLightMode ? 'warmGray.50' : c + '.300',
156
+ opacity: '50'
157
+ },
158
+ _disabled: {
159
+ _text: {
160
+ color: '#000',
161
+ },
162
+ bg: isLightMode ? 'trueGray.400' : 'trueGray.600',
163
+ },
164
+ // END
165
+ };
166
+ },
167
+ money: (props) => {
168
+ const c = props.colorScheme,
169
+ m = props.colorMode,
170
+ isLightMode = m === 'light';
171
+
172
+ return {
173
+ alignSelf: 'center',
174
+ alignItems: 'center',
175
+ justifyContent: 'center',
176
+ color: 'greens.200',
177
+ borderColor: 'greens.200',
178
+ borderWidth: 2,
179
+ borderRadius: 'xl',
180
+ bg: '#fff',
181
+ };
182
+ },
183
+ },
184
+ defaultProps: {
185
+ size: 'lg',
186
+ },
187
+ },
188
+ IconButton: {
189
+ variants: {
190
+ footer: (props) => {
191
+ const c = props.colorScheme,
192
+ m = props.colorMode,
193
+ isLightMode = m === 'light';
194
+
195
+ return {
196
+ flex: 1,
197
+ alignSelf: 'center',
198
+ alignItems: 'center',
199
+ justifyContent: 'center',
200
+
201
+ // BEGIN Taken from variant 'solid'
202
+ _web: {
203
+ outlineWidth: '0'
204
+ },
205
+ bg: c + '.800',
206
+ _hover: {
207
+ bg: c + '.600'
208
+ },
209
+ _pressed: {
210
+ bg: c + '.700'
211
+ },
212
+ _focus: {
213
+ bg: c + '.600'
214
+ },
215
+ _loading: {
216
+ bg: isLightMode ? 'warmGray.50' : c + '.300',
217
+ opacity: '50'
218
+ },
219
+ _disabled: {
220
+ bg: isLightMode ? 'trueGray.400' : 'trueGray.600',
221
+ },
222
+ // END
223
+ };
224
+ },
225
+ solid2: (props) => {
226
+ const c = props.colorScheme,
227
+ m = props.colorMode,
228
+ isLightMode = m === 'light';
229
+
230
+ return {
231
+ // BEGIN Taken from variant 'solid'
232
+ _web: {
233
+ outlineWidth: '0'
234
+ },
235
+ bg: 'trueGray.200',
236
+ borderColor: c + '.800',
237
+ borderWidth: 1,
238
+ _hover: {
239
+ bg: 'trueGray.400'
240
+ },
241
+ _pressed: {
242
+ bg: 'trueGray.700'
243
+ },
244
+ _focus: {
245
+ bg: 'trueGray.600',
246
+ },
247
+ _loading: {
248
+ bg: isLightMode ? 'warmGray.50' : c + '.300',
249
+ opacity: '50'
250
+ },
251
+ _disabled: {
252
+ bg: isLightMode ? 'trueGray.400' : 'trueGray.600',
253
+ },
254
+ // END
255
+ };
256
+ },
257
+ },
258
+ defaultProps: {
259
+ size: 'lg',
260
+ },
261
+ },
262
+ },
263
+ };
264
+ export default ThemeOverrides;
@@ -0,0 +1,19 @@
1
+ import { isBrowser, isNode, isWebWorker, isJsDom, isDeno } from "browser-or-node";
2
+ import {
3
+ UI_MODE_WEB,
4
+ UI_MODE_REACT_NATIVE,
5
+ } from './Constants/UiModes';
6
+
7
+
8
+ const UiConfig = {
9
+ mode: null,
10
+ };
11
+
12
+ if (isBrowser || isWebWorker) {
13
+ UiConfig.mode = UI_MODE_WEB;
14
+ } else
15
+ if (isNode) {
16
+ UiConfig.mode = UI_MODE_REACT_NATIVE;
17
+ }
18
+
19
+ export default UiConfig;