@scrumble-nl/gatherer-frontend 0.0.1

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 (289) hide show
  1. package/README.md +159 -0
  2. package/lib/commonjs/context/picker-context.js +85 -0
  3. package/lib/commonjs/context/picker-context.js.map +1 -0
  4. package/lib/commonjs/context/scan-context.js +20 -0
  5. package/lib/commonjs/context/scan-context.js.map +1 -0
  6. package/lib/commonjs/hooks/use-instance.js +28 -0
  7. package/lib/commonjs/hooks/use-instance.js.map +1 -0
  8. package/lib/commonjs/hooks/use-pick-item-switch.js +53 -0
  9. package/lib/commonjs/hooks/use-pick-item-switch.js.map +1 -0
  10. package/lib/commonjs/hooks/use-picker.js +13 -0
  11. package/lib/commonjs/hooks/use-picker.js.map +1 -0
  12. package/lib/commonjs/hooks/use-scanner.js +35 -0
  13. package/lib/commonjs/hooks/use-scanner.js.map +1 -0
  14. package/lib/commonjs/index.js +41 -0
  15. package/lib/commonjs/index.js.map +1 -0
  16. package/lib/commonjs/lang/en/components/pick-list.js +14 -0
  17. package/lib/commonjs/lang/en/components/pick-list.js.map +1 -0
  18. package/lib/commonjs/lang/en/components/picker.js +16 -0
  19. package/lib/commonjs/lang/en/components/picker.js.map +1 -0
  20. package/lib/commonjs/lang/en/english.js +16 -0
  21. package/lib/commonjs/lang/en/english.js.map +1 -0
  22. package/lib/commonjs/lang/nl/components/pick-list.js +14 -0
  23. package/lib/commonjs/lang/nl/components/pick-list.js.map +1 -0
  24. package/lib/commonjs/lang/nl/components/picker.js +16 -0
  25. package/lib/commonjs/lang/nl/components/picker.js.map +1 -0
  26. package/lib/commonjs/lang/nl/dutch.js +16 -0
  27. package/lib/commonjs/lang/nl/dutch.js.map +1 -0
  28. package/lib/commonjs/lang/translations.js +15 -0
  29. package/lib/commonjs/lang/translations.js.map +1 -0
  30. package/lib/commonjs/pick-list/partials/empty-list.js +23 -0
  31. package/lib/commonjs/pick-list/partials/empty-list.js.map +1 -0
  32. package/lib/commonjs/pick-list/partials/pick-group-item.js +45 -0
  33. package/lib/commonjs/pick-list/partials/pick-group-item.js.map +1 -0
  34. package/lib/commonjs/pick-list/partials/search.js +64 -0
  35. package/lib/commonjs/pick-list/partials/search.js.map +1 -0
  36. package/lib/commonjs/pick-list/pick-list.js +80 -0
  37. package/lib/commonjs/pick-list/pick-list.js.map +1 -0
  38. package/lib/commonjs/pick-list/styles/empty-list-styles.js +19 -0
  39. package/lib/commonjs/pick-list/styles/empty-list-styles.js.map +1 -0
  40. package/lib/commonjs/pick-list/styles/pick-group-item-styles.js +24 -0
  41. package/lib/commonjs/pick-list/styles/pick-group-item-styles.js.map +1 -0
  42. package/lib/commonjs/pick-list/styles/search-styles.js +34 -0
  43. package/lib/commonjs/pick-list/styles/search-styles.js.map +1 -0
  44. package/lib/commonjs/picker/partials/modal/pick-modal.js +44 -0
  45. package/lib/commonjs/picker/partials/modal/pick-modal.js.map +1 -0
  46. package/lib/commonjs/picker/partials/modal/pick-quantity-select.js +132 -0
  47. package/lib/commonjs/picker/partials/modal/pick-quantity-select.js.map +1 -0
  48. package/lib/commonjs/picker/partials/pick-amount.js +33 -0
  49. package/lib/commonjs/picker/partials/pick-amount.js.map +1 -0
  50. package/lib/commonjs/picker/partials/product-info.js +38 -0
  51. package/lib/commonjs/picker/partials/product-info.js.map +1 -0
  52. package/lib/commonjs/picker/partials/progress-bar.js +37 -0
  53. package/lib/commonjs/picker/partials/progress-bar.js.map +1 -0
  54. package/lib/commonjs/picker/picker.js +67 -0
  55. package/lib/commonjs/picker/picker.js.map +1 -0
  56. package/lib/commonjs/picker/styles/pick-amount-styles.js +31 -0
  57. package/lib/commonjs/picker/styles/pick-amount-styles.js.map +1 -0
  58. package/lib/commonjs/picker/styles/pick-modal-styles.js +81 -0
  59. package/lib/commonjs/picker/styles/pick-modal-styles.js.map +1 -0
  60. package/lib/commonjs/picker/styles/picker-styles.js +14 -0
  61. package/lib/commonjs/picker/styles/picker-styles.js.map +1 -0
  62. package/lib/commonjs/picker/styles/product-info-styles.js +27 -0
  63. package/lib/commonjs/picker/styles/product-info-styles.js.map +1 -0
  64. package/lib/commonjs/picker/styles/progress-bar-styles.js +19 -0
  65. package/lib/commonjs/picker/styles/progress-bar-styles.js.map +1 -0
  66. package/lib/commonjs/shared/api/api-urls.js +22 -0
  67. package/lib/commonjs/shared/api/api-urls.js.map +1 -0
  68. package/lib/commonjs/shared/badge/badge.js +44 -0
  69. package/lib/commonjs/shared/badge/badge.js.map +1 -0
  70. package/lib/commonjs/shared/badge/styles/badge-styles.js +24 -0
  71. package/lib/commonjs/shared/badge/styles/badge-styles.js.map +1 -0
  72. package/lib/commonjs/shared/constants.js +37 -0
  73. package/lib/commonjs/shared/constants.js.map +1 -0
  74. package/lib/commonjs/shared/default-pick-group-item.js +22 -0
  75. package/lib/commonjs/shared/default-pick-group-item.js.map +1 -0
  76. package/lib/commonjs/shared/layout/data-column.js +26 -0
  77. package/lib/commonjs/shared/layout/data-column.js.map +1 -0
  78. package/lib/commonjs/shared/layout/data-format.js +22 -0
  79. package/lib/commonjs/shared/layout/data-format.js.map +1 -0
  80. package/lib/commonjs/shared/layout/data-row.js +36 -0
  81. package/lib/commonjs/shared/layout/data-row.js.map +1 -0
  82. package/lib/commonjs/shared/layout/styles/layout-styles.js +26 -0
  83. package/lib/commonjs/shared/layout/styles/layout-styles.js.map +1 -0
  84. package/lib/commonjs/shared/press-button/press-button.js +34 -0
  85. package/lib/commonjs/shared/press-button/press-button.js.map +1 -0
  86. package/lib/commonjs/types/badge/badge.d.js +2 -0
  87. package/lib/commonjs/types/badge/badge.d.js.map +1 -0
  88. package/lib/commonjs/types/config/config.d.js +2 -0
  89. package/lib/commonjs/types/config/config.d.js.map +1 -0
  90. package/lib/commonjs/types/control/control.d.js +2 -0
  91. package/lib/commonjs/types/control/control.d.js.map +1 -0
  92. package/lib/commonjs/types/pick-group/pick-group.d.js +2 -0
  93. package/lib/commonjs/types/pick-group/pick-group.d.js.map +1 -0
  94. package/lib/commonjs/types/pick-group/search-params.d.js +2 -0
  95. package/lib/commonjs/types/pick-group/search-params.d.js.map +1 -0
  96. package/lib/commonjs/types/pick-item/pick-item.d.js +2 -0
  97. package/lib/commonjs/types/pick-item/pick-item.d.js.map +1 -0
  98. package/lib/commonjs/types/scanner/scanner.d.js +2 -0
  99. package/lib/commonjs/types/scanner/scanner.d.js.map +1 -0
  100. package/lib/module/context/picker-context.js +74 -0
  101. package/lib/module/context/picker-context.js.map +1 -0
  102. package/lib/module/context/scan-context.js +10 -0
  103. package/lib/module/context/scan-context.js.map +1 -0
  104. package/lib/module/hooks/use-instance.js +20 -0
  105. package/lib/module/hooks/use-instance.js.map +1 -0
  106. package/lib/module/hooks/use-pick-item-switch.js +46 -0
  107. package/lib/module/hooks/use-pick-item-switch.js.map +1 -0
  108. package/lib/module/hooks/use-picker.js +6 -0
  109. package/lib/module/hooks/use-picker.js.map +1 -0
  110. package/lib/module/hooks/use-scanner.js +28 -0
  111. package/lib/module/hooks/use-scanner.js.map +1 -0
  112. package/lib/module/index.js +6 -0
  113. package/lib/module/index.js.map +1 -0
  114. package/lib/module/lang/en/components/pick-list.js +7 -0
  115. package/lib/module/lang/en/components/pick-list.js.map +1 -0
  116. package/lib/module/lang/en/components/picker.js +9 -0
  117. package/lib/module/lang/en/components/picker.js.map +1 -0
  118. package/lib/module/lang/en/english.js +9 -0
  119. package/lib/module/lang/en/english.js.map +1 -0
  120. package/lib/module/lang/nl/components/pick-list.js +7 -0
  121. package/lib/module/lang/nl/components/pick-list.js.map +1 -0
  122. package/lib/module/lang/nl/components/picker.js +9 -0
  123. package/lib/module/lang/nl/components/picker.js.map +1 -0
  124. package/lib/module/lang/nl/dutch.js +9 -0
  125. package/lib/module/lang/nl/dutch.js.map +1 -0
  126. package/lib/module/lang/translations.js +8 -0
  127. package/lib/module/lang/translations.js.map +1 -0
  128. package/lib/module/pick-list/partials/empty-list.js +15 -0
  129. package/lib/module/pick-list/partials/empty-list.js.map +1 -0
  130. package/lib/module/pick-list/partials/pick-group-item.js +37 -0
  131. package/lib/module/pick-list/partials/pick-group-item.js.map +1 -0
  132. package/lib/module/pick-list/partials/search.js +54 -0
  133. package/lib/module/pick-list/partials/search.js.map +1 -0
  134. package/lib/module/pick-list/pick-list.js +71 -0
  135. package/lib/module/pick-list/pick-list.js.map +1 -0
  136. package/lib/module/pick-list/styles/empty-list-styles.js +12 -0
  137. package/lib/module/pick-list/styles/empty-list-styles.js.map +1 -0
  138. package/lib/module/pick-list/styles/pick-group-item-styles.js +17 -0
  139. package/lib/module/pick-list/styles/pick-group-item-styles.js.map +1 -0
  140. package/lib/module/pick-list/styles/search-styles.js +27 -0
  141. package/lib/module/pick-list/styles/search-styles.js.map +1 -0
  142. package/lib/module/picker/partials/modal/pick-modal.js +36 -0
  143. package/lib/module/picker/partials/modal/pick-modal.js.map +1 -0
  144. package/lib/module/picker/partials/modal/pick-quantity-select.js +122 -0
  145. package/lib/module/picker/partials/modal/pick-quantity-select.js.map +1 -0
  146. package/lib/module/picker/partials/pick-amount.js +25 -0
  147. package/lib/module/picker/partials/pick-amount.js.map +1 -0
  148. package/lib/module/picker/partials/product-info.js +30 -0
  149. package/lib/module/picker/partials/product-info.js.map +1 -0
  150. package/lib/module/picker/partials/progress-bar.js +29 -0
  151. package/lib/module/picker/partials/progress-bar.js.map +1 -0
  152. package/lib/module/picker/picker.js +59 -0
  153. package/lib/module/picker/picker.js.map +1 -0
  154. package/lib/module/picker/styles/pick-amount-styles.js +24 -0
  155. package/lib/module/picker/styles/pick-amount-styles.js.map +1 -0
  156. package/lib/module/picker/styles/pick-modal-styles.js +74 -0
  157. package/lib/module/picker/styles/pick-modal-styles.js.map +1 -0
  158. package/lib/module/picker/styles/picker-styles.js +7 -0
  159. package/lib/module/picker/styles/picker-styles.js.map +1 -0
  160. package/lib/module/picker/styles/product-info-styles.js +20 -0
  161. package/lib/module/picker/styles/product-info-styles.js.map +1 -0
  162. package/lib/module/picker/styles/progress-bar-styles.js +12 -0
  163. package/lib/module/picker/styles/progress-bar-styles.js.map +1 -0
  164. package/lib/module/shared/api/api-urls.js +9 -0
  165. package/lib/module/shared/api/api-urls.js.map +1 -0
  166. package/lib/module/shared/badge/badge.js +36 -0
  167. package/lib/module/shared/badge/badge.js.map +1 -0
  168. package/lib/module/shared/badge/styles/badge-styles.js +17 -0
  169. package/lib/module/shared/badge/styles/badge-styles.js.map +1 -0
  170. package/lib/module/shared/constants.js +16 -0
  171. package/lib/module/shared/constants.js.map +1 -0
  172. package/lib/module/shared/default-pick-group-item.js +15 -0
  173. package/lib/module/shared/default-pick-group-item.js.map +1 -0
  174. package/lib/module/shared/layout/data-column.js +18 -0
  175. package/lib/module/shared/layout/data-column.js.map +1 -0
  176. package/lib/module/shared/layout/data-format.js +14 -0
  177. package/lib/module/shared/layout/data-format.js.map +1 -0
  178. package/lib/module/shared/layout/data-row.js +28 -0
  179. package/lib/module/shared/layout/data-row.js.map +1 -0
  180. package/lib/module/shared/layout/styles/layout-styles.js +19 -0
  181. package/lib/module/shared/layout/styles/layout-styles.js.map +1 -0
  182. package/lib/module/shared/press-button/press-button.js +25 -0
  183. package/lib/module/shared/press-button/press-button.js.map +1 -0
  184. package/lib/module/types/badge/badge.d.js +2 -0
  185. package/lib/module/types/badge/badge.d.js.map +1 -0
  186. package/lib/module/types/config/config.d.js +2 -0
  187. package/lib/module/types/config/config.d.js.map +1 -0
  188. package/lib/module/types/control/control.d.js +2 -0
  189. package/lib/module/types/control/control.d.js.map +1 -0
  190. package/lib/module/types/pick-group/pick-group.d.js +2 -0
  191. package/lib/module/types/pick-group/pick-group.d.js.map +1 -0
  192. package/lib/module/types/pick-group/search-params.d.js +2 -0
  193. package/lib/module/types/pick-group/search-params.d.js.map +1 -0
  194. package/lib/module/types/pick-item/pick-item.d.js +2 -0
  195. package/lib/module/types/pick-item/pick-item.d.js.map +1 -0
  196. package/lib/module/types/scanner/scanner.d.js +2 -0
  197. package/lib/module/types/scanner/scanner.d.js.map +1 -0
  198. package/lib/typescript/context/picker-context.d.ts +18 -0
  199. package/lib/typescript/context/scan-context.d.ts +11 -0
  200. package/lib/typescript/hooks/use-instance.d.ts +2 -0
  201. package/lib/typescript/hooks/use-pick-item-switch.d.ts +1 -0
  202. package/lib/typescript/hooks/use-picker.d.ts +2 -0
  203. package/lib/typescript/hooks/use-scanner.d.ts +3 -0
  204. package/lib/typescript/index.d.ts +5 -0
  205. package/lib/typescript/lang/en/components/pick-list.d.ts +6 -0
  206. package/lib/typescript/lang/en/components/picker.d.ts +8 -0
  207. package/lib/typescript/lang/en/english.d.ts +14 -0
  208. package/lib/typescript/lang/nl/components/pick-list.d.ts +6 -0
  209. package/lib/typescript/lang/nl/components/picker.d.ts +8 -0
  210. package/lib/typescript/lang/nl/dutch.d.ts +14 -0
  211. package/lib/typescript/lang/translations.d.ts +2 -0
  212. package/lib/typescript/pick-list/partials/empty-list.d.ts +5 -0
  213. package/lib/typescript/pick-list/partials/pick-group-item.d.ts +6 -0
  214. package/lib/typescript/pick-list/partials/search.d.ts +5 -0
  215. package/lib/typescript/pick-list/pick-list.d.ts +9 -0
  216. package/lib/typescript/pick-list/styles/empty-list-styles.d.ts +9 -0
  217. package/lib/typescript/pick-list/styles/pick-group-item-styles.d.ts +14 -0
  218. package/lib/typescript/pick-list/styles/search-styles.d.ts +24 -0
  219. package/lib/typescript/picker/partials/modal/pick-modal.d.ts +6 -0
  220. package/lib/typescript/picker/partials/modal/pick-quantity-select.d.ts +6 -0
  221. package/lib/typescript/picker/partials/pick-amount.d.ts +1 -0
  222. package/lib/typescript/picker/partials/product-info.d.ts +1 -0
  223. package/lib/typescript/picker/partials/progress-bar.d.ts +5 -0
  224. package/lib/typescript/picker/picker.d.ts +16 -0
  225. package/lib/typescript/picker/styles/pick-amount-styles.d.ts +21 -0
  226. package/lib/typescript/picker/styles/pick-modal-styles.d.ts +71 -0
  227. package/lib/typescript/picker/styles/picker-styles.d.ts +5 -0
  228. package/lib/typescript/picker/styles/product-info-styles.d.ts +17 -0
  229. package/lib/typescript/picker/styles/progress-bar-styles.d.ts +9 -0
  230. package/lib/typescript/shared/api/api-urls.d.ts +7 -0
  231. package/lib/typescript/shared/badge/badge.d.ts +6 -0
  232. package/lib/typescript/shared/badge/styles/badge-styles.d.ts +14 -0
  233. package/lib/typescript/shared/constants.d.ts +15 -0
  234. package/lib/typescript/shared/default-pick-group-item.d.ts +1 -0
  235. package/lib/typescript/shared/layout/data-column.d.ts +7 -0
  236. package/lib/typescript/shared/layout/data-format.d.ts +5 -0
  237. package/lib/typescript/shared/layout/data-row.d.ts +10 -0
  238. package/lib/typescript/shared/layout/styles/layout-styles.d.ts +16 -0
  239. package/lib/typescript/shared/press-button/press-button.d.ts +8 -0
  240. package/package.json +133 -0
  241. package/src/context/picker-context.tsx +117 -0
  242. package/src/context/scan-context.tsx +16 -0
  243. package/src/hooks/use-instance.tsx +23 -0
  244. package/src/hooks/use-pick-item-switch.tsx +55 -0
  245. package/src/hooks/use-picker.tsx +8 -0
  246. package/src/hooks/use-scanner.tsx +33 -0
  247. package/src/index.tsx +5 -0
  248. package/src/lang/en/components/pick-list.ts +6 -0
  249. package/src/lang/en/components/picker.ts +8 -0
  250. package/src/lang/en/english.ts +9 -0
  251. package/src/lang/nl/components/pick-list.ts +6 -0
  252. package/src/lang/nl/components/picker.ts +8 -0
  253. package/src/lang/nl/dutch.ts +9 -0
  254. package/src/lang/translations.ts +9 -0
  255. package/src/pick-list/partials/empty-list.tsx +18 -0
  256. package/src/pick-list/partials/pick-group-item.tsx +45 -0
  257. package/src/pick-list/partials/search.tsx +52 -0
  258. package/src/pick-list/pick-list.tsx +92 -0
  259. package/src/pick-list/styles/empty-list-styles.ts +13 -0
  260. package/src/pick-list/styles/pick-group-item-styles.ts +18 -0
  261. package/src/pick-list/styles/search-styles.ts +28 -0
  262. package/src/picker/partials/modal/pick-modal.tsx +31 -0
  263. package/src/picker/partials/modal/pick-quantity-select.tsx +129 -0
  264. package/src/picker/partials/pick-amount.tsx +23 -0
  265. package/src/picker/partials/product-info.tsx +29 -0
  266. package/src/picker/partials/progress-bar.tsx +39 -0
  267. package/src/picker/picker.tsx +67 -0
  268. package/src/picker/styles/pick-amount-styles.ts +25 -0
  269. package/src/picker/styles/pick-modal-styles.ts +75 -0
  270. package/src/picker/styles/picker-styles.ts +7 -0
  271. package/src/picker/styles/product-info-styles.ts +21 -0
  272. package/src/picker/styles/progress-bar-styles.ts +13 -0
  273. package/src/shared/api/api-urls.ts +9 -0
  274. package/src/shared/badge/badge.tsx +45 -0
  275. package/src/shared/badge/styles/badge-styles.ts +18 -0
  276. package/src/shared/constants.ts +16 -0
  277. package/src/shared/default-pick-group-item.ts +14 -0
  278. package/src/shared/layout/data-column.tsx +22 -0
  279. package/src/shared/layout/data-format.tsx +16 -0
  280. package/src/shared/layout/data-row.tsx +27 -0
  281. package/src/shared/layout/styles/layout-styles.ts +20 -0
  282. package/src/shared/press-button/press-button.tsx +30 -0
  283. package/src/types/badge/badge.d.ts +1 -0
  284. package/src/types/config/config.d.ts +17 -0
  285. package/src/types/control/control.d.ts +6 -0
  286. package/src/types/pick-group/pick-group.d.ts +9 -0
  287. package/src/types/pick-group/search-params.d.ts +4 -0
  288. package/src/types/pick-item/pick-item.d.ts +14 -0
  289. package/src/types/scanner/scanner.d.ts +4 -0
@@ -0,0 +1,6 @@
1
+ interface props {
2
+ visible: boolean;
3
+ onPickItems: () => void;
4
+ }
5
+ export declare const PickQuantitySelect: (props: props) => JSX.Element;
6
+ export {};
@@ -0,0 +1 @@
1
+ export declare const PickAmount: () => JSX.Element;
@@ -0,0 +1 @@
1
+ export declare const ProductInfo: () => JSX.Element;
@@ -0,0 +1,5 @@
1
+ export interface progressProps {
2
+ total?: number;
3
+ current?: number;
4
+ }
5
+ export declare const ProgressBar: (props: progressProps) => JSX.Element;
@@ -0,0 +1,16 @@
1
+ import { ReactNode } from 'react';
2
+ import { ViewStyle } from 'react-native';
3
+ interface props {
4
+ children: ReactNode;
5
+ style?: ViewStyle;
6
+ pickModal?: JSX.Element;
7
+ }
8
+ declare const Picker: {
9
+ (props: props): JSX.Element;
10
+ Row: (props: import("../shared/layout/data-row").rowProps) => JSX.Element;
11
+ Column: (props: import("../shared/layout/data-column").columnProps) => JSX.Element;
12
+ Progress: (props: import("./partials/progress-bar").progressProps) => JSX.Element;
13
+ PickAmount: () => JSX.Element;
14
+ ProductInfo: () => JSX.Element;
15
+ };
16
+ export { Picker };
@@ -0,0 +1,21 @@
1
+ export declare const styles: {
2
+ container: {
3
+ flex: number;
4
+ padding: number;
5
+ alignItems: "center";
6
+ justifyContent: "center";
7
+ };
8
+ pickBoxContainer: {
9
+ width: number;
10
+ height: number;
11
+ backgroundColor: string;
12
+ justifyContent: "center";
13
+ alignItems: "center";
14
+ borderRadius: number;
15
+ };
16
+ pickText: {
17
+ textAlign: "center";
18
+ fontSize: number;
19
+ color: string;
20
+ };
21
+ };
@@ -0,0 +1,71 @@
1
+ export declare const styles: {
2
+ background: {
3
+ flex: number;
4
+ backgroundColor: string;
5
+ justifyContent: "center";
6
+ alignItems: "center";
7
+ };
8
+ container: {
9
+ width: string;
10
+ marginLeft: number;
11
+ marginRight: number;
12
+ backgroundColor: string;
13
+ borderRadius: number;
14
+ };
15
+ innerContainer: {
16
+ padding: number;
17
+ flex: number;
18
+ flexDirection: "column";
19
+ };
20
+ title: {
21
+ textAlign: "center";
22
+ marginBottom: number;
23
+ fontWeight: "bold";
24
+ fontSize: number;
25
+ };
26
+ amountSelectRow: {
27
+ width: string;
28
+ flexDirection: "row";
29
+ };
30
+ button: {
31
+ flex: number;
32
+ overflow: "hidden";
33
+ alignItems: "center";
34
+ justifyContent: "center";
35
+ backgroundColor: string;
36
+ borderWidth: number;
37
+ borderColor: string;
38
+ paddingVertical: number;
39
+ };
40
+ subtractButton: {
41
+ borderTopLeftRadius: number;
42
+ borderBottomLeftRadius: number;
43
+ };
44
+ addButton: {
45
+ borderTopRightRadius: number;
46
+ borderBottomRightRadius: number;
47
+ };
48
+ amountText: {
49
+ textAlign: "center";
50
+ borderWidth: number;
51
+ borderColor: string;
52
+ flex: number;
53
+ justifyContent: "center";
54
+ paddingVertical: number;
55
+ fontSize: number;
56
+ fontWeight: "500";
57
+ };
58
+ pickButtonContainer: {
59
+ marginTop: string;
60
+ };
61
+ error: {
62
+ textAlign: "center";
63
+ color: string;
64
+ };
65
+ pickButton: {
66
+ borderRadius: number;
67
+ paddingHorizontal: number;
68
+ paddingVertical: number;
69
+ backgroundColor: string;
70
+ };
71
+ };
@@ -0,0 +1,5 @@
1
+ export declare const styles: {
2
+ container: {
3
+ flex: number;
4
+ };
5
+ };
@@ -0,0 +1,17 @@
1
+ export declare const styles: {
2
+ container: {
3
+ flex: number;
4
+ paddingHorizontal: number;
5
+ paddingVertical: number;
6
+ };
7
+ productName: {
8
+ textAlign: "center";
9
+ marginBottom: number;
10
+ fontSize: number;
11
+ };
12
+ productInfo: {
13
+ flex: number;
14
+ marginBottom: number;
15
+ justifyContent: "center";
16
+ };
17
+ };
@@ -0,0 +1,9 @@
1
+ export declare const styles: {
2
+ progressText: {
3
+ color: string;
4
+ fontSize: number;
5
+ alignSelf: "center";
6
+ position: "absolute";
7
+ top: number;
8
+ };
9
+ };
@@ -0,0 +1,7 @@
1
+ export declare const GET_PICKLIST_URL: string;
2
+ export declare const NEXT_PICK_ITEM_URL: string;
3
+ export declare const START_PICKING_URL: string;
4
+ export declare const SET_ITEM_PICKED_URL: string;
5
+ export declare const PREV_PICK_ITEM_URL: string;
6
+ export declare const GET_AFTER_PICKLIST_URL: string;
7
+ export declare const SET_GROUP_PICKED_URL: string;
@@ -0,0 +1,6 @@
1
+ interface props {
2
+ variant: BadgeVariant;
3
+ children: string | number;
4
+ }
5
+ export declare const Badge: (props: props) => JSX.Element;
6
+ export {};
@@ -0,0 +1,14 @@
1
+ export declare const styles: {
2
+ badge: {
3
+ paddingVertical: number;
4
+ paddingHorizontal: number;
5
+ borderRadius: number;
6
+ alignSelf: "flex-start";
7
+ };
8
+ text: {
9
+ textAlign: "center";
10
+ fontSize: number;
11
+ fontWeight: "600";
12
+ textTransform: "uppercase";
13
+ };
14
+ };
@@ -0,0 +1,15 @@
1
+ export declare const WHITE = "#fff";
2
+ export declare const BLACK = "#000";
3
+ export declare const NEAR_WHITE = "#f4f4f4";
4
+ export declare const GREY = "#94999b";
5
+ export declare const LIGHT_GREY = "#d9d9d9";
6
+ export declare const TEXT_COLOR = "#282525";
7
+ export declare const PRIMARY_COLOR = "#4fc3f7";
8
+ export declare const SECONDARY_COLOR = "#6c757d";
9
+ export declare const SUCCESS_COLOR = "#66bb6a";
10
+ export declare const DANGER_COLOR = "#f44336";
11
+ export declare const WARNING_COLOR = "#ffa726";
12
+ export declare const BIG_FONT = 20;
13
+ export declare const SMALL_FONT = 12;
14
+ export declare const SMALLEST_FONT = 10;
15
+ export declare const BIGGEST_FONT = 26;
@@ -0,0 +1 @@
1
+ export declare const defaultPickGroupItem: PickGroupItem<any>;
@@ -0,0 +1,7 @@
1
+ import { ViewStyle } from 'react-native';
2
+ export interface columnProps {
3
+ title: string;
4
+ data: JSX.Element | string | number;
5
+ columnStyles?: ViewStyle;
6
+ }
7
+ export declare const DataColumn: (props: columnProps) => JSX.Element;
@@ -0,0 +1,5 @@
1
+ interface props {
2
+ data: JSX.Element | string | number;
3
+ }
4
+ export declare const DataFormat: (props: props) => JSX.Element;
5
+ export {};
@@ -0,0 +1,10 @@
1
+ import { ViewStyle } from 'react-native';
2
+ export interface rowProps {
3
+ leftTitle: string;
4
+ leftContent: JSX.Element | string | number;
5
+ rightTitle?: string | null;
6
+ rightContent?: JSX.Element | string | number;
7
+ rowStyles?: ViewStyle;
8
+ columnStyles?: ViewStyle;
9
+ }
10
+ export declare const DataRow: (props: rowProps) => JSX.Element;
@@ -0,0 +1,16 @@
1
+ export declare const styles: {
2
+ dataRow: {
3
+ flexDirection: "row";
4
+ };
5
+ dataColumn: {
6
+ flex: number;
7
+ flexBasis: string;
8
+ maxWidth: string;
9
+ paddingHorizontal: number;
10
+ };
11
+ dataTitle: {
12
+ color: string;
13
+ fontStyle: "italic";
14
+ fontSize: number;
15
+ };
16
+ };
@@ -0,0 +1,8 @@
1
+ import { ReactNode } from 'react';
2
+ import { PressableProps, ViewStyle } from 'react-native';
3
+ interface props extends PressableProps {
4
+ children: ReactNode;
5
+ style: ViewStyle;
6
+ }
7
+ export declare const PressButton: (props: props) => JSX.Element;
8
+ export {};
package/package.json ADDED
@@ -0,0 +1,133 @@
1
+ {
2
+ "name": "@scrumble-nl/gatherer-frontend",
3
+ "version": "0.0.1",
4
+ "main": "lib/commonjs/index",
5
+ "module": "lib/module/index",
6
+ "types": "lib/typescript/index.d.ts",
7
+ "react-native": "src/index",
8
+ "source": "src/index",
9
+ "files": [
10
+ "src",
11
+ "lib",
12
+ "android",
13
+ "ios",
14
+ "cpp",
15
+ "scrumble-nl-gatherer-frontend.podspec",
16
+ "!lib/typescript/example",
17
+ "!android/build",
18
+ "!ios/build",
19
+ "!**/__tests__",
20
+ "!**/__fixtures__",
21
+ "!**/__mocks__"
22
+ ],
23
+ "scripts": {
24
+ "test": "echo \"Error: no test specified\" && exit 1",
25
+ "typescript": "tsc --noEmit",
26
+ "lint": "eslint \"**/*.{js,ts,tsx}\"",
27
+ "prepare": "bob build",
28
+ "release": "release-it",
29
+ "example": "yarn --cwd example",
30
+ "bootstrap": "yarn example && yarn && yarn example pods",
31
+ "eslint": "npm run lint"
32
+ },
33
+ "keywords": [
34
+ "react-native",
35
+ "ios",
36
+ "android"
37
+ ],
38
+ "repository": "https://gitlab.com/Scrumble/Packages/gatherer-frontend",
39
+ "author": "Scrumble <admin@scrumble.nl> (https://www.scrumble.nl)",
40
+ "license": "MIT",
41
+ "bugs": {
42
+ "url": "https://gitlab.com/Scrumble/Packages/gatherer-frontend/issues"
43
+ },
44
+ "homepage": "https://gitlab.com/Scrumble/Packages/gatherer-frontend#readme",
45
+ "publishConfig": {
46
+ "registry": "https://registry.npmjs.org/"
47
+ },
48
+ "dependencies": {
49
+ "axios": "^1.1.3",
50
+ "react-native-progress": "^5.0.0",
51
+ "react-native-vector-icons": "^9.2.0",
52
+ "react-polyglot": "^0.7.2"
53
+ },
54
+ "devDependencies": {
55
+ "@arkweid/lefthook": "^0.7.7",
56
+ "@babel/eslint-parser": "^7.18.2",
57
+ "@commitlint/config-conventional": "^17.0.2",
58
+ "@react-native-community/eslint-config": "^3.0.2",
59
+ "@release-it/conventional-changelog": "^5.0.0",
60
+ "@scrumble-nl/eslint-plugin-scrumble-rules": "^1.2.2",
61
+ "@scrumble-nl/react-custom-hooks": "^2.0.0",
62
+ "@types/jest": "^28.1.2",
63
+ "@types/react": "~17.0.21",
64
+ "@types/react-native": "0.68.0",
65
+ "@types/react-native-vector-icons": "^6.4.12",
66
+ "commitlint": "^17.0.2",
67
+ "eslint": "^8.4.1",
68
+ "eslint-config-prettier": "^8.5.0",
69
+ "eslint-plugin-prettier": "^4.0.0",
70
+ "jest": "^28.1.1",
71
+ "pod-install": "^0.1.0",
72
+ "prettier": "^2.0.5",
73
+ "react": "17.0.2",
74
+ "react-native": "0.68.2",
75
+ "react-native-builder-bob": "^0.18.3",
76
+ "release-it": "^15.0.0",
77
+ "typescript": "^4.5.2"
78
+ },
79
+ "resolutions": {
80
+ "@types/react": "17.0.21"
81
+ },
82
+ "peerDependencies": {
83
+ "react": "*",
84
+ "react-native": "*"
85
+ },
86
+ "jest": {
87
+ "preset": "react-native",
88
+ "modulePathIgnorePatterns": [
89
+ "<rootDir>/example/node_modules",
90
+ "<rootDir>/lib/"
91
+ ]
92
+ },
93
+ "commitlint": {
94
+ "extends": [
95
+ "@commitlint/config-conventional"
96
+ ]
97
+ },
98
+ "release-it": {
99
+ "git": {
100
+ "commitMessage": "chore: release ${version}",
101
+ "tagName": "v${version}"
102
+ },
103
+ "npm": {
104
+ "publish": true
105
+ },
106
+ "github": {
107
+ "release": true
108
+ },
109
+ "plugins": {
110
+ "@release-it/conventional-changelog": {
111
+ "preset": "angular"
112
+ }
113
+ }
114
+ },
115
+ "eslintIgnore": [
116
+ "node_modules/",
117
+ "lib/"
118
+ ],
119
+ "react-native-builder-bob": {
120
+ "source": "src",
121
+ "output": "lib",
122
+ "targets": [
123
+ "commonjs",
124
+ "module",
125
+ [
126
+ "typescript",
127
+ {
128
+ "project": "tsconfig.build.json"
129
+ }
130
+ ]
131
+ ]
132
+ }
133
+ }
@@ -0,0 +1,117 @@
1
+ import React, {createContext, ReactNode, useCallback, useMemo, useRef, useState} from 'react';
2
+
3
+ import axios from 'axios';
4
+ import {I18n} from 'react-polyglot';
5
+
6
+ import messages from '../lang/translations';
7
+ import {ScanContextProvider} from './scan-context';
8
+ import {defaultPickGroupItem} from '../shared/default-pick-group-item';
9
+ import {NEXT_PICK_ITEM_URL, PREV_PICK_ITEM_URL, START_PICKING_URL} from '../shared/api/api-urls';
10
+
11
+ export interface IPickerContext {
12
+ baseURL: string;
13
+ scanImplementation: any;
14
+ pickItem: PickGroupItem<any>;
15
+ currentPickGroupId: number;
16
+ onLastPick: () => void;
17
+ savePickGroupData: (data: PickGroupItem<any>) => void;
18
+ startPicking: (pickGroupId: number) => Promise<PickGroupItem<DefaultPickItem>>;
19
+ switchPickItem: (dir: ControlDir) => Promise<PickGroupItem<DefaultPickItem>>;
20
+ }
21
+
22
+ interface props {
23
+ children: ReactNode;
24
+ config: GathererConfig;
25
+ }
26
+
27
+ export const PickerContext = createContext<IPickerContext>({
28
+ baseURL: '',
29
+ scanImplementation: undefined,
30
+ currentPickGroupId: 0,
31
+ onLastPick: () => undefined,
32
+ pickItem: defaultPickGroupItem,
33
+ savePickGroupData: () => undefined,
34
+ startPicking: () => new Promise(() => undefined),
35
+ switchPickItem: () => new Promise(() => undefined),
36
+ });
37
+
38
+ export const PickerContextProvider = <T extends DefaultPickItem>(props: props): JSX.Element => {
39
+ const [pickItem, setPickItem] = useState<PickGroupItem<T>>(defaultPickGroupItem);
40
+ const prevPickItem = useRef<PickItem<T> | null>(null);
41
+ const nextPickItem = useRef<PickItem<T> | null>(null);
42
+ const currentPickGroupId = useRef<number>(0);
43
+ const instance = axios.create({baseURL: props.config.baseURL});
44
+ const language = useMemo(() => props.config.language ?? 'nl', [props.config.language]);
45
+
46
+ const savePickGroupData = useCallback((data: PickGroupItem<T>): void => {
47
+ setPickItem(data);
48
+ prevPickItem.current = data.previous;
49
+ nextPickItem.current = data.next;
50
+ }, []);
51
+
52
+ const startPicking = useCallback(
53
+ async (pickGroupId: number): Promise<PickGroupItem<T>> => {
54
+ return new Promise((resolve, reject) => {
55
+ instance
56
+ .post(START_PICKING_URL, {pick_group_id: pickGroupId})
57
+ .then(response => {
58
+ currentPickGroupId.current = pickGroupId;
59
+ savePickGroupData(response.data);
60
+ resolve(response.data);
61
+ })
62
+ .catch(reject);
63
+ });
64
+ },
65
+ [instance, savePickGroupData],
66
+ );
67
+
68
+ const switchPickItem = useCallback(
69
+ async (dir: ControlDir): Promise<PickGroupItem<T>> => {
70
+ const url = dir === 'prev' ? PREV_PICK_ITEM_URL : NEXT_PICK_ITEM_URL;
71
+
72
+ return new Promise((resolve, reject) => {
73
+ instance
74
+ .post(url, {
75
+ pick_group_id: currentPickGroupId.current,
76
+ pick_item_id: pickItem.pickItem.id,
77
+ })
78
+ .then(response => {
79
+ setPickItem(response.data);
80
+ resolve(response.data);
81
+ })
82
+ .catch(reject);
83
+ });
84
+ },
85
+ [instance, pickItem.pickItem.id],
86
+ );
87
+
88
+ const context = useMemo(
89
+ () => ({
90
+ pickItem,
91
+ startPicking,
92
+ switchPickItem,
93
+ savePickGroupData,
94
+ baseURL: props.config.baseURL,
95
+ onLastPick: props.config.onLastPick,
96
+ currentPickGroupId: currentPickGroupId.current,
97
+ scanImplementation: props.config.scanImplementation,
98
+ }),
99
+ [
100
+ pickItem,
101
+ startPicking,
102
+ switchPickItem,
103
+ savePickGroupData,
104
+ props.config.baseURL,
105
+ props.config.onLastPick,
106
+ props.config.scanImplementation,
107
+ ],
108
+ );
109
+
110
+ return (
111
+ <I18n locale={language} messages={messages[language]}>
112
+ <PickerContext.Provider value={context}>
113
+ <ScanContextProvider scanner={props.config.scanImplementation}>{props.children}</ScanContextProvider>
114
+ </PickerContext.Provider>
115
+ </I18n>
116
+ );
117
+ };
@@ -0,0 +1,16 @@
1
+ import React, {createContext, ReactNode} from 'react';
2
+
3
+ export type IScanContext = {
4
+ scanner: any;
5
+ };
6
+
7
+ interface props {
8
+ scanner: any;
9
+ children: ReactNode;
10
+ }
11
+
12
+ export const ScanContext = createContext<IScanContext>({scanner: undefined});
13
+
14
+ export const ScanContextProvider = (props: props): JSX.Element => {
15
+ return <ScanContext.Provider value={props.scanner}>{props.children}</ScanContext.Provider>;
16
+ };
@@ -0,0 +1,23 @@
1
+ import {ToastAndroid} from 'react-native';
2
+
3
+ import axios, {AxiosInstance} from 'axios';
4
+
5
+ import {usePicker} from './use-picker';
6
+
7
+ export const useInstance = (): AxiosInstance => {
8
+ const {baseURL} = usePicker();
9
+ const instance = axios.create({baseURL});
10
+
11
+ instance.interceptors.response.use(
12
+ response => response,
13
+ error => {
14
+ if (error.response.data?.error) {
15
+ ToastAndroid.show(error.response.data.error, ToastAndroid.LONG);
16
+ }
17
+
18
+ return Promise.reject(error);
19
+ },
20
+ );
21
+
22
+ return instance;
23
+ };
@@ -0,0 +1,55 @@
1
+ import {useCallback} from 'react';
2
+
3
+ import {usePicker} from './use-picker';
4
+ import {useInstance} from './use-instance';
5
+ import {SET_ITEM_PICKED_URL} from '../shared/api/api-urls';
6
+
7
+ export const usePickItemSwitch = (): ProductSwitch => {
8
+ const instance = useInstance();
9
+ const {pickItem, currentPickGroupId, savePickGroupData, switchPickItem, onLastPick} = usePicker();
10
+
11
+ const retrieveNextPickItem = useCallback((): void => {
12
+ switchPickItem('next');
13
+ }, [switchPickItem]);
14
+
15
+ const setItemToPicked = useCallback(
16
+ (quantityPicked?: number, metaData?: any): void => {
17
+ instance
18
+ .patch(SET_ITEM_PICKED_URL, {
19
+ quantity_picked: quantityPicked,
20
+ pick_group_id: currentPickGroupId,
21
+ pick_item_id: pickItem.pickItem.id,
22
+ metadata: metaData,
23
+ })
24
+ .then(response => {
25
+ if (response.data.content === 'Pick group finished') {
26
+ onLastPick();
27
+ } else {
28
+ savePickGroupData(response.data);
29
+ }
30
+ });
31
+ },
32
+ [currentPickGroupId, instance, onLastPick, pickItem.pickItem.id, savePickGroupData],
33
+ );
34
+
35
+ const nextPickItem = useCallback(
36
+ (isSkip: boolean, quantityPicked?: number, metaData?: any): void => {
37
+ if (isSkip) {
38
+ retrieveNextPickItem();
39
+ return;
40
+ }
41
+
42
+ setItemToPicked(quantityPicked, metaData);
43
+ },
44
+ [retrieveNextPickItem, setItemToPicked],
45
+ );
46
+
47
+ const previousPickItem = useCallback((): void => {
48
+ switchPickItem('prev');
49
+ }, [switchPickItem]);
50
+
51
+ return {
52
+ nextPickItem,
53
+ previousPickItem,
54
+ };
55
+ };
@@ -0,0 +1,8 @@
1
+ import {useContext} from 'react';
2
+
3
+ import {PickerContext} from '../context/picker-context';
4
+ import type {IPickerContext} from '../context/picker-context';
5
+
6
+ export const usePicker = (): IPickerContext => {
7
+ return useContext<IPickerContext>(PickerContext);
8
+ };
@@ -0,0 +1,33 @@
1
+ import {useCallback, useContext, useEffect, useRef} from 'react';
2
+
3
+ import {IScanContext, ScanContext} from '../context/scan-context';
4
+
5
+ type ScanCallback = (scan: string) => void;
6
+
7
+ export const useScanner = (onScan: ScanCallback): Scanner => {
8
+ const {scanner} = useContext<IScanContext>(ScanContext);
9
+ const callbackRef = useRef<ScanCallback>(onScan);
10
+
11
+ useEffect(() => {
12
+ callbackRef.current = onScan;
13
+ }, [onScan]);
14
+
15
+ const startScanner = useCallback((): void => {
16
+ setTimeout(() => {
17
+ scanner.startReader().then(() => {
18
+ scanner.onBarcodeReadSucccess((event: {data: string}) => {
19
+ callbackRef.current(event.data.trim());
20
+ });
21
+ });
22
+ }, 100);
23
+ }, [scanner]);
24
+
25
+ const stopScanner = useCallback((): void => {
26
+ scanner.stopReader().then(scanner.offBarcodeReadSuccess);
27
+ }, [scanner]);
28
+
29
+ return {
30
+ startScanner,
31
+ stopScanner,
32
+ };
33
+ };
package/src/index.tsx ADDED
@@ -0,0 +1,5 @@
1
+ export {Picker} from './picker/picker';
2
+ export {usePicker} from './hooks/use-picker';
3
+ export {PickList} from './pick-list/pick-list';
4
+ export {usePickItemSwitch} from './hooks/use-pick-item-switch';
5
+ export {PickerContextProvider} from './context/picker-context';