@chem-po/react-native 0.0.52 → 0.0.53

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 (98) hide show
  1. package/package.json +5 -20
  2. package/src/components/box/Center.tsx +0 -19
  3. package/src/components/box/CollapseHorizontal.tsx +0 -44
  4. package/src/components/box/ContentBox.tsx +0 -24
  5. package/src/components/box/DropShadow.tsx +0 -28
  6. package/src/components/box/ExpandOnMount.tsx +0 -74
  7. package/src/components/box/Expandable.tsx +0 -143
  8. package/src/components/box/FullSizeContainer.tsx +0 -64
  9. package/src/components/box/index.ts +0 -7
  10. package/src/components/button/ActionButton.tsx +0 -196
  11. package/src/components/button/ButtonText.tsx +0 -60
  12. package/src/components/button/DeleteButton.tsx +0 -288
  13. package/src/components/button/LoadingButton.tsx +0 -41
  14. package/src/components/button/Toggle.tsx +0 -109
  15. package/src/components/button/hooks.ts +0 -66
  16. package/src/components/button/index.ts +0 -5
  17. package/src/components/feed/FeedContentPane.tsx +0 -97
  18. package/src/components/feed/MediaFeed.tsx +0 -199
  19. package/src/components/feed/MediaFeedBackground.tsx +0 -136
  20. package/src/components/feed/MediaFeedRefresh.tsx +0 -113
  21. package/src/components/feed/constants.ts +0 -2
  22. package/src/components/feed/context.tsx +0 -19
  23. package/src/components/feed/hooks.ts +0 -279
  24. package/src/components/feed/index.ts +0 -2
  25. package/src/components/form/Condition.tsx +0 -27
  26. package/src/components/form/Field.tsx +0 -44
  27. package/src/components/form/Form.tsx +0 -452
  28. package/src/components/form/FormFooter.tsx +0 -164
  29. package/src/components/form/UploadProgress/index.tsx +0 -50
  30. package/src/components/form/index.ts +0 -3
  31. package/src/components/form/input/Editable.tsx +0 -206
  32. package/src/components/form/input/InputSlider.tsx +0 -71
  33. package/src/components/form/input/OptionalTag.tsx +0 -43
  34. package/src/components/form/input/StandaloneInput.tsx +0 -49
  35. package/src/components/form/input/boolean/index.tsx +0 -53
  36. package/src/components/form/input/color/index.tsx +0 -145
  37. package/src/components/form/input/common/InputClearButton.tsx +0 -57
  38. package/src/components/form/input/date/index.tsx +0 -125
  39. package/src/components/form/input/datetime/index.tsx +0 -176
  40. package/src/components/form/input/file/index.tsx +0 -310
  41. package/src/components/form/input/hooks/index.ts +0 -2
  42. package/src/components/form/input/hooks/useInputColor.ts +0 -7
  43. package/src/components/form/input/hooks/useInputImperativeHandle.ts +0 -22
  44. package/src/components/form/input/hooks/useInputStyles.ts +0 -114
  45. package/src/components/form/input/index.ts +0 -4
  46. package/src/components/form/input/input.tsx +0 -218
  47. package/src/components/form/input/multipleSelect/index.tsx +0 -221
  48. package/src/components/form/input/number/index.tsx +0 -108
  49. package/src/components/form/input/select/index.tsx +0 -152
  50. package/src/components/form/input/socialMedia/index.tsx +0 -235
  51. package/src/components/form/input/text/AutoResizeTextarea.tsx +0 -41
  52. package/src/components/form/input/text/index.tsx +0 -99
  53. package/src/components/form/input/text/textarea.tsx +0 -32
  54. package/src/components/form/input/text/useWebAutoResize.tsx +0 -73
  55. package/src/components/form/input/time/index.tsx +0 -125
  56. package/src/components/form/types.ts +0 -8
  57. package/src/components/form/view/file.tsx +0 -80
  58. package/src/components/form/view/index.tsx +0 -125
  59. package/src/components/form/view/multipleSelect.tsx +0 -85
  60. package/src/components/form/view/select.tsx +0 -83
  61. package/src/components/form/view/styles.ts +0 -12
  62. package/src/components/icons/index.tsx +0 -28
  63. package/src/components/image/ImageViewModal.tsx +0 -319
  64. package/src/components/image/index.ts +0 -1
  65. package/src/components/index.ts +0 -8
  66. package/src/components/layout/CollapseHorizontal.tsx +0 -92
  67. package/src/components/loading/CircularProgress.tsx +0 -56
  68. package/src/components/loading/Loading.tsx +0 -146
  69. package/src/components/loading/LoadingImage.tsx +0 -163
  70. package/src/components/loading/LoadingOverlay.tsx +0 -74
  71. package/src/components/loading/LoadingSwitch.tsx +0 -110
  72. package/src/components/loading/ProgressBar.tsx +0 -75
  73. package/src/components/loading/index.ts +0 -6
  74. package/src/components/text/AnimatedText.tsx +0 -68
  75. package/src/components/text/Txt.tsx +0 -12
  76. package/src/components/text/index.ts +0 -1
  77. package/src/components/theme/colorMode/DarkModeToggle.tsx +0 -47
  78. package/src/components/theme/colorMode/index.ts +0 -1
  79. package/src/components/theme/index.ts +0 -1
  80. package/src/constants/index.ts +0 -1
  81. package/src/constants/toast.ts +0 -24
  82. package/src/contexts/fonts.tsx +0 -23
  83. package/src/contexts/index.ts +0 -1
  84. package/src/contexts/root.tsx +0 -190
  85. package/src/hooks/index.ts +0 -3
  86. package/src/hooks/useFadeIn.ts +0 -48
  87. package/src/hooks/useFont.ts +0 -25
  88. package/src/hooks/useRefreshFontScale.ts +0 -39
  89. package/src/hooks/useThemeState.ts +0 -43
  90. package/src/index.ts +0 -6
  91. package/src/store/index.ts +0 -2
  92. package/src/store/useFontScale.ts +0 -8
  93. package/src/store/useScreen.ts +0 -25
  94. package/src/styles/fill.ts +0 -19
  95. package/src/types/forms.ts +0 -14
  96. package/src/types/index.ts +0 -1
  97. package/src/utils/downloadFile.ts +0 -61
  98. package/src/utils/downloadFileLegacy.ts +0 -66
@@ -1,452 +0,0 @@
1
- import { InputSize, isField, isListField } from '@chem-po/core'
2
- import {
3
- ChempoFormProvider,
4
- DataViewProps,
5
- DataViewProvider,
6
- Field,
7
- FieldFormProps,
8
- FieldMap,
9
- FieldMapFormProps,
10
- FieldMapValue,
11
- FormOnSubmit,
12
- FormProps,
13
- IFormElement,
14
- ListField,
15
- useButtonColor,
16
- useDataView,
17
- useFormSubmit,
18
- UseFormSubmitProps,
19
- useGetItemField,
20
- } from '@chem-po/react'
21
- import React, { FC, useMemo, useState } from 'react'
22
- import { useFieldArray, useFormContext } from 'react-hook-form'
23
- import { StyleSheet, Text, View } from 'react-native'
24
- import { Pressable } from 'react-native-gesture-handler'
25
- import { useFontScale } from '../../store/useFontScale'
26
- import { Expandable } from '../box/Expandable'
27
- import { DeleteButton } from '../button/DeleteButton'
28
- import { Condition } from './Condition'
29
- import { FieldComponent } from './Field'
30
- import { FormFooter } from './FormFooter'
31
- import { Editable } from './input/Editable'
32
- import { FieldView } from './view'
33
-
34
- const styles = StyleSheet.create({
35
- container: {
36
- width: '100%',
37
- },
38
- listContainer: {
39
- width: '100%',
40
- paddingHorizontal: 8,
41
- paddingVertical: 4,
42
- gap: 8,
43
- },
44
- listHeader: {
45
- fontSize: 14,
46
- opacity: 0.7,
47
- lineHeight: 1,
48
- },
49
- listContent: {
50
- gap: 8,
51
- paddingVertical: 4,
52
- minHeight: 30,
53
- },
54
- listItem: {
55
- paddingTop: 8,
56
- paddingHorizontal: 8,
57
- borderWidth: 1,
58
- borderColor: '#e2e8f0',
59
- borderRadius: 4,
60
- },
61
- listItemContent: {
62
- flexDirection: 'row',
63
- alignItems: 'center',
64
- gap: 4,
65
- width: '100%',
66
- },
67
- listItemInput: {
68
- flex: 1,
69
- minWidth: 0,
70
- },
71
- emptyListText: {
72
- fontSize: 14,
73
- opacity: 0.7,
74
- paddingVertical: 4,
75
- paddingHorizontal: 8,
76
- },
77
- newButton: {
78
- alignSelf: 'flex-start',
79
- paddingVertical: 4,
80
- paddingHorizontal: 8,
81
- borderRadius: 4,
82
- },
83
- newButtonText: {
84
- fontSize: 14,
85
- color: '#4a5568',
86
- },
87
- formElementContainer: {
88
- width: '100%',
89
- // paddingVertical: 5,
90
- // gap: 5,
91
- },
92
- dataViewHeader: {
93
- flexDirection: 'row',
94
- alignItems: 'center',
95
- paddingHorizontal: 8,
96
- width: '100%',
97
- },
98
- dataViewTitle: {
99
- fontSize: 18,
100
- fontFamily: 'System',
101
- paddingVertical: 8,
102
- },
103
- dataViewActions: {
104
- flexDirection: 'row',
105
- alignItems: 'center',
106
- gap: 8,
107
- marginLeft: 'auto',
108
- },
109
- dataViewContent: {
110
- paddingHorizontal: 16,
111
- paddingVertical: 8,
112
- },
113
- submitButton: {
114
- paddingVertical: 10,
115
- paddingHorizontal: 20,
116
- borderRadius: 8,
117
- alignItems: 'center',
118
- justifyContent: 'center',
119
- },
120
- submitButtonText: {
121
- fontSize: 16,
122
- fontWeight: 'bold',
123
- },
124
- editButtonText: {
125
- fontSize: 16,
126
- fontWeight: 'bold',
127
- color: '#4a5568',
128
- },
129
- cancelButtonText: {
130
- fontSize: 16,
131
- fontWeight: 'bold',
132
- color: '#4a5568',
133
- },
134
- })
135
-
136
- export const ListFieldInput: FC<{
137
- field: ListField
138
- name: string
139
- size: InputSize
140
- }> = ({ field, name, size }) => {
141
- const emptyData = useMemo(() => {
142
- if (isField(field.itemField)) return ''
143
- if (isListField(field.itemField)) return []
144
- return {}
145
- }, [field])
146
-
147
- const buttonColor = useButtonColor()
148
- const { control } = useFormContext()
149
- const { fields, append, remove } = useFieldArray({
150
- control,
151
- name,
152
- })
153
-
154
- return (
155
- <View style={styles.listContainer}>
156
- <Text style={styles.listHeader}>{field.placeholder}</Text>
157
- <View style={styles.listContent}>
158
- {fields.length ? (
159
- fields.map((formField, idx) => (
160
- <View key={formField.id} style={styles.listItem}>
161
- <View style={styles.listItemContent}>
162
- <View style={styles.listItemInput}>
163
- <FormElement size={size} name={formField.id} field={field.itemField} />
164
- </View>
165
- <DeleteButton
166
- onDelete={() => remove(idx)}
167
- itemName={`${field.placeholder} ${idx + 1}`}
168
- />
169
- </View>
170
- </View>
171
- ))
172
- ) : (
173
- <Text style={styles.emptyListText}>No items</Text>
174
- )}
175
- </View>
176
- <Pressable
177
- style={[styles.newButton, { backgroundColor: buttonColor }]}
178
- onPress={() => append(emptyData)}>
179
- <Text style={styles.newButtonText}>+ NEW</Text>
180
- </Pressable>
181
- </View>
182
- )
183
- }
184
-
185
- export const FormElement = ({
186
- field,
187
- name,
188
- size,
189
- }: {
190
- field: IFormElement
191
- name: string
192
- size: InputSize
193
- }) => {
194
- const fontScale = useFontScale(s => s.fontScale)
195
- const fields = useMemo<Array<{ name: string; field: IFormElement }>>(() => {
196
- if (isField(field) || isListField(field)) return [{ name: 'value', field }]
197
-
198
- return Object.entries((field as FieldMap).children).map(([childName, childField]) => ({
199
- name: `${name ? `${name}.` : ''}${childName}`,
200
- field: childField,
201
- }))
202
- }, [field, name])
203
-
204
- return (
205
- <View
206
- style={[styles.formElementContainer, { gap: fontScale * 5, paddingVertical: fontScale * 5 }]}>
207
- {fields.map(f => {
208
- if (isListField(f.field)) {
209
- const b = <ListFieldInput key={f.name} name={f.name} field={f.field} size={size} />
210
- return f.field.condition ? (
211
- <Condition path={name} condition={f.field.condition} key={f.name}>
212
- {b}
213
- </Condition>
214
- ) : (
215
- b
216
- )
217
- }
218
- if (isField(f.field)) {
219
- const b = <FieldComponent key={f.name} name={f.name} field={f.field} size={size} />
220
- return f.field.condition ? (
221
- <Condition path={name} condition={f.field.condition} key={f.name}>
222
- {b}
223
- </Condition>
224
- ) : (
225
- b
226
- )
227
- }
228
-
229
- const b = <FormElement key={f.name} name={f.name} field={f.field} size={size} />
230
- return f.field.condition ? (
231
- <Condition path={name} condition={f.field.condition} key={f.name}>
232
- {b}
233
- </Condition>
234
- ) : (
235
- b
236
- )
237
- })}
238
- </View>
239
- )
240
- }
241
-
242
- const ListFieldView = ({
243
- field,
244
- value,
245
- path,
246
- }: {
247
- field: ListField
248
- value: any[]
249
- path: string
250
- }) => {
251
- const { placeholder } = field
252
- const getItemField = useGetItemField(field)
253
- return (
254
- <View style={styles.listContainer}>
255
- <Expandable header={() => <Text style={styles.listHeader}>{placeholder}</Text>} initExpanded>
256
- <View style={styles.listContent}>
257
- {value?.length ? (
258
- value.map((item, index) => (
259
- <View key={`${path}.${index}`} style={styles.listItem}>
260
- <FormElementView
261
- path={`${path}.${index}`}
262
- field={getItemField(index)}
263
- value={item}
264
- />
265
- </View>
266
- ))
267
- ) : (
268
- <Text style={styles.emptyListText}>No items</Text>
269
- )}
270
- </View>
271
- </Expandable>
272
- </View>
273
- )
274
- }
275
-
276
- const FormElementView = ({
277
- field,
278
- value,
279
- path,
280
- storagePath,
281
- }: {
282
- field: IFormElement
283
- value: any
284
- path: string
285
- storagePath?: string
286
- }) => {
287
- const { updateField } = useDataView()
288
- if (isField(field)) {
289
- return updateField ? (
290
- <Editable
291
- storagePath={storagePath}
292
- field={field}
293
- value={value}
294
- onSubmit={v => updateField(path, v)}
295
- />
296
- ) : (
297
- <FieldView field={field} value={value} />
298
- )
299
- }
300
- if (isListField(field)) {
301
- return <ListFieldView path={path} field={field} value={value} />
302
- }
303
- return (
304
- <DataView
305
- storagePath={storagePath ? `${storagePath}.${path}` : undefined}
306
- path={path}
307
- field={field}
308
- />
309
- )
310
- }
311
-
312
- export const DataView = ({
313
- field,
314
- value,
315
- onClose,
316
- onDelete,
317
- onSubmit,
318
- itemName,
319
- storagePath,
320
- path = '',
321
- }: DataViewProps & { path?: string }) => {
322
- const { name: fieldName, children } = field
323
- const [isEditing, setIsEditing] = useState(false)
324
-
325
- return (
326
- <DataViewProvider value={value} onSubmit={onSubmit}>
327
- <Expandable
328
- alwaysExpanded
329
- header={() => (
330
- <View style={styles.dataViewHeader}>
331
- <Text style={styles.dataViewTitle}>{fieldName}</Text>
332
- <View style={styles.dataViewActions}>
333
- {onDelete && <DeleteButton onDelete={onDelete} itemName={itemName ?? 'item'} />}
334
- <Pressable onPress={() => setIsEditing(true)}>
335
- <Text style={styles.editButtonText}>Edit</Text>
336
- </Pressable>
337
- {onClose && (
338
- <Pressable onPress={onClose}>
339
- <Text style={styles.cancelButtonText}>Cancel</Text>
340
- </Pressable>
341
- )}
342
- </View>
343
- </View>
344
- )}>
345
- {isEditing && onSubmit ? (
346
- <Form
347
- storagePath={storagePath}
348
- field={field}
349
- value={value}
350
- onSubmit={onSubmit}
351
- onBack={() => setIsEditing(false)}
352
- />
353
- ) : (
354
- <View style={styles.dataViewContent}>
355
- {Object.entries(children).map(([key, childField]) => (
356
- <FormElementView
357
- storagePath={storagePath ? `${storagePath}/${key}` : undefined}
358
- path={path ? `${path}.${key}` : key}
359
- key={key}
360
- field={childField}
361
- value={value?.[key]}
362
- />
363
- ))}
364
- </View>
365
- )}
366
- </Expandable>
367
- </DataViewProvider>
368
- )
369
- }
370
-
371
- export const FieldMapForm = <F extends FieldMap>({
372
- onSubmit: onSubmitProp,
373
- onBack,
374
- field,
375
- value,
376
- buttonText = 'SUBMIT',
377
- renderFooter,
378
- storagePath,
379
- size = 'md',
380
- }: FieldMapFormProps<F>) => {
381
- const useSubmitDataProps = useMemo<UseFormSubmitProps<F>>(
382
- () => ({
383
- field,
384
- value,
385
- submit: onSubmitProp as FormOnSubmit<FieldMap>,
386
- storagePath,
387
- }),
388
- [field, value, onSubmitProp, storagePath],
389
- )
390
- const { onSubmit, uploads } = useFormSubmit(useSubmitDataProps)
391
-
392
- return (
393
- <View style={styles.container}>
394
- <FormElement name="" field={field} size={size} />
395
- <FormFooter
396
- uploads={uploads}
397
- onSubmit={onSubmit}
398
- renderFooter={renderFooter}
399
- onBack={onBack}
400
- buttonText={buttonText}
401
- />
402
- </View>
403
- )
404
- }
405
-
406
- export const FieldForm = <F extends Field | ListField>({
407
- onSubmit,
408
- field,
409
- value,
410
- size,
411
- ...props
412
- }: FieldFormProps<F>) => {
413
- const fieldMap = useMemo<FieldMap>(() => ({ children: { value: field } }), [field])
414
- const fieldMapValue = useMemo<FieldMapValue<FieldMap>>(() => ({ value }), [value])
415
- return (
416
- <FieldMapForm
417
- size={size}
418
- field={fieldMap}
419
- value={fieldMapValue}
420
- onSubmit={data => onSubmit(data?.value)}
421
- {...props}
422
- />
423
- )
424
- }
425
-
426
- export const Form = <F extends IFormElement>({
427
- field,
428
- onSubmit,
429
- size = 'md',
430
- ...props
431
- }: FormProps<F>) => {
432
- const body =
433
- isField(field) || isListField(field) ? (
434
- <FieldForm
435
- size={size}
436
- field={field}
437
- onSubmit={onSubmit as FormOnSubmit<Field | ListField>}
438
- {...props}
439
- />
440
- ) : (
441
- <FieldMapForm
442
- size={size}
443
- field={field}
444
- onSubmit={onSubmit as FormOnSubmit<FieldMap>}
445
- {...props}
446
- />
447
- )
448
-
449
- return <ChempoFormProvider>{body}</ChempoFormProvider>
450
- }
451
-
452
- export default Form
@@ -1,164 +0,0 @@
1
- import {
2
- FormFooterProps,
3
- IFormElement,
4
- useBorderColor,
5
- useButtonColor,
6
- usePlaceholderColor,
7
- } from '@chem-po/react'
8
- import React, { FC, PropsWithChildren, useEffect, useMemo, useRef } from 'react'
9
- import { useFormContext, useFormState } from 'react-hook-form'
10
- import { ActivityIndicator, Animated, StyleSheet, Text, View } from 'react-native'
11
- import { Pressable } from 'react-native-gesture-handler'
12
- import { UploadProgress } from './UploadProgress'
13
-
14
- const buttonTextColor = '#ffffff'
15
- const styles = StyleSheet.create({
16
- container: {
17
- width: '100%',
18
- },
19
- progressContainer: {
20
- height: 5,
21
- width: '100%',
22
- },
23
- footerContainer: {
24
- flexDirection: 'column',
25
- paddingVertical: 8,
26
- gap: 5,
27
- borderTopWidth: 1,
28
- paddingHorizontal: 12,
29
- width: '100%',
30
- },
31
- buttonsContainer: {
32
- flexDirection: 'row',
33
- justifyContent: 'space-between',
34
- gap: 10,
35
- },
36
- cancelButton: {
37
- flex: 1,
38
- paddingVertical: 6,
39
- borderRadius: 4,
40
- borderWidth: 1,
41
- },
42
- cancelButtonText: {
43
- color: buttonTextColor,
44
- fontSize: 16,
45
- fontWeight: '500',
46
- textAlign: 'center',
47
- },
48
- submitButtonContainer: {
49
- flex: 1,
50
- borderRadius: 4,
51
- },
52
- submitButton: {
53
- paddingVertical: 6,
54
- },
55
- submitButtonText: {
56
- color: buttonTextColor,
57
- fontSize: 16,
58
- fontWeight: '500',
59
- // textShadowColor: 'rgba(0, 0, 0, 0.75)',
60
- textShadowOffset: { width: 0.5, height: 0.5 },
61
- textShadowRadius: 5,
62
- textAlign: 'center',
63
- },
64
- errorText: {
65
- color: 'red',
66
- fontSize: 16,
67
- paddingVertical: 4,
68
- },
69
- })
70
-
71
- const CancelButton = ({
72
- onBack,
73
- children,
74
- submitting,
75
- }: PropsWithChildren<{ onBack: () => void; submitting: boolean }>) => {
76
- const placeholderColor = usePlaceholderColor()
77
- const borderColor = useBorderColor()
78
- return (
79
- <Pressable
80
- disabled={submitting}
81
- style={[styles.cancelButton, { borderColor }]}
82
- onPress={onBack}>
83
- <Text style={[styles.cancelButtonText, { color: placeholderColor }]}>{children}</Text>
84
- </Pressable>
85
- )
86
- }
87
-
88
- export const SubmitButton: FC<
89
- PropsWithChildren<{ onSubmitClick: () => Promise<void>; submitting: boolean; valid: boolean }>
90
- > = ({ onSubmitClick, submitting, children, valid }) => {
91
- const animatedOpacity = useRef(new Animated.Value(1)).current
92
-
93
- const textShadowColor = useMemo(() => {
94
- if (submitting || !valid) return 'rgba(0, 0, 0, 0.0)'
95
- return 'rgba(0, 0, 0, 0.5)'
96
- }, [submitting, valid])
97
- useEffect(() => {
98
- Animated.timing(animatedOpacity, {
99
- toValue: submitting || !valid ? 0.5 : 1,
100
- duration: 200,
101
- useNativeDriver: true,
102
- }).start()
103
- }, [submitting, valid, animatedOpacity])
104
-
105
- const buttonBg = useButtonColor()
106
-
107
- return (
108
- <Animated.View
109
- style={[
110
- styles.submitButtonContainer,
111
- { opacity: animatedOpacity, backgroundColor: buttonBg },
112
- ]}>
113
- <Pressable
114
- style={styles.submitButton}
115
- onPress={() => {
116
- onSubmitClick()
117
- }}
118
- disabled={submitting}>
119
- {submitting ? (
120
- <ActivityIndicator color={buttonTextColor} />
121
- ) : (
122
- <Text style={[styles.submitButtonText, { textShadowColor }]}>{children}</Text>
123
- )}
124
- </Pressable>
125
- </Animated.View>
126
- )
127
- }
128
-
129
- const FormErrorView = () => {
130
- const { formState } = useFormContext()
131
- if (!formState.errors.root) return null
132
- return <Text style={styles.errorText}>{formState.errors.root.message}</Text>
133
- }
134
-
135
- export const FormFooter = <F extends IFormElement>({
136
- renderFooter: RenderFooter,
137
- ...props
138
- }: FormFooterProps<F>) => {
139
- const { uploads, onSubmit, onBack, buttonText } = props
140
- const borderColor = useBorderColor()
141
- const { isSubmitting: submitting, isValid: valid } = useFormState()
142
- return (
143
- <View style={styles.container}>
144
- <UploadProgress uploads={uploads} />
145
- {RenderFooter ? (
146
- <RenderFooter {...props} />
147
- ) : (
148
- <View style={[styles.footerContainer, { borderColor }]}>
149
- <FormErrorView />
150
- <View style={styles.buttonsContainer}>
151
- {onBack && (
152
- <CancelButton submitting={submitting} onBack={onBack}>
153
- Cancel
154
- </CancelButton>
155
- )}
156
- <SubmitButton onSubmitClick={onSubmit} submitting={submitting} valid={valid}>
157
- {buttonText}
158
- </SubmitButton>
159
- </View>
160
- </View>
161
- )}
162
- </View>
163
- )
164
- }
@@ -1,50 +0,0 @@
1
- import { UploadsState } from '@chem-po/core'
2
- import React, { useMemo } from 'react'
3
- import { StyleSheet, View } from 'react-native'
4
- import { ProgressBar } from '../../loading/ProgressBar'
5
-
6
- const styles = StyleSheet.create({
7
- container: {
8
- width: '100%',
9
- flexDirection: 'column',
10
- },
11
- progressContainer: {
12
- paddingHorizontal: 8,
13
- height: 26,
14
- width: '100%',
15
- justifyContent: 'center',
16
- alignItems: 'center',
17
- },
18
- progressBar: {
19
- height: '100%',
20
- width: '100%',
21
- borderRadius: 13,
22
- backgroundColor: 'rgba(0, 0, 0, 0.1)',
23
- overflow: 'hidden',
24
- },
25
- progressFill: {
26
- height: '100%',
27
- },
28
- label: {
29
- position: 'absolute',
30
- color: 'white',
31
- fontSize: 12,
32
- fontWeight: '500',
33
- textTransform: 'uppercase',
34
- textShadowColor: 'rgba(0, 0, 0, 0.67)',
35
- textShadowOffset: { width: 1, height: 1 },
36
- textShadowRadius: 3,
37
- },
38
- })
39
-
40
- export const UploadProgress = ({ uploads }: { uploads: UploadsState }) => {
41
- const asArr = useMemo(() => Object.values(uploads), [uploads])
42
-
43
- return (
44
- <View style={styles.container}>
45
- {asArr.map(upload => (
46
- <ProgressBar key={upload.label} progress={upload.percent} label={upload.label} />
47
- ))}
48
- </View>
49
- )
50
- }
@@ -1,3 +0,0 @@
1
- export * from './Form'
2
- export * from './input'
3
- export { FileView } from './input/file'