@edge-zuq/core 1.3.1 → 1.3.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/module/data/use-cases/remote-get-comment-list.js.map +1 -1
- package/lib/module/data/use-cases/remote-get-image-list.js.map +1 -1
- package/lib/module/infra/axios-http-client-adapter.js +2 -2
- package/lib/module/infra/axios-http-client-adapter.js.map +1 -1
- package/lib/module/infra/offline-mutation-queue.js.map +1 -1
- package/lib/module/infra/rnp-permission-manager-adapter.js.map +1 -1
- package/lib/module/presentation/components/atoms/UIIcon.js +40 -40
- package/lib/module/presentation/components/atoms/UIIcon.js.map +1 -1
- package/lib/module/presentation/components/atoms/UIProgress.js.map +1 -1
- package/lib/module/presentation/components/molecules/UIActionSheet.js.map +1 -1
- package/lib/module/presentation/components/molecules/UIButton.js +5 -5
- package/lib/module/presentation/components/molecules/UIButton.js.map +1 -1
- package/lib/module/presentation/components/molecules/UICurrencyInput.js.map +1 -1
- package/lib/module/presentation/components/molecules/UIImage.js.map +1 -1
- package/lib/module/presentation/components/molecules/UITextInput.js.map +1 -1
- package/lib/module/presentation/components/molecules/UITextInputMask.js.map +1 -1
- package/lib/module/presentation/components/organisms/UIFormButton.js.map +1 -1
- package/lib/module/presentation/components/organisms/UIFormCheckboxInput.js.map +1 -1
- package/lib/module/presentation/components/organisms/UIFormCurrencyInput.js.map +1 -1
- package/lib/module/presentation/components/organisms/UIFormDatetimeInput.js.map +1 -1
- package/lib/module/presentation/components/organisms/UIFormMultiselectInput.js.map +1 -1
- package/lib/module/presentation/components/organisms/UIFormSelectInput.js.map +1 -1
- package/lib/module/presentation/components/organisms/UIFormTextInput.js.map +1 -1
- package/lib/module/presentation/components/organisms/UIMultipleSelectChip.js +129 -0
- package/lib/module/presentation/components/organisms/UIMultipleSelectChip.js.map +1 -0
- package/lib/module/presentation/components/organisms/UISelectChip.js +33 -2
- package/lib/module/presentation/components/organisms/UISelectChip.js.map +1 -1
- package/lib/module/presentation/components/organisms/UISignature.js.map +1 -1
- package/lib/module/presentation/components/organisms/UISlideButton.js.map +1 -1
- package/lib/module/presentation/components/organisms/index.js +1 -0
- package/lib/module/presentation/components/organisms/index.js.map +1 -1
- package/lib/module/presentation/components/permissions/request-permissions.js.map +1 -1
- package/lib/module/presentation/domain/offline/use-offline-mutation.js +1 -1
- package/lib/module/presentation/domain/offline/use-offline-mutation.js.map +1 -1
- package/lib/module/presentation/domain/offline/use-offline-query.js.map +1 -1
- package/lib/module/theme.js +22 -22
- package/lib/module/theme.js.map +1 -1
- package/lib/typescript/src/presentation/components/atoms/UIIcon.d.ts.map +1 -1
- package/lib/typescript/src/presentation/components/atoms/UIProgress.d.ts.map +1 -1
- package/lib/typescript/src/presentation/components/molecules/UIActionSheet.d.ts.map +1 -1
- package/lib/typescript/src/presentation/components/molecules/UIButton.d.ts.map +1 -1
- package/lib/typescript/src/presentation/components/molecules/UIImage.d.ts.map +1 -1
- package/lib/typescript/src/presentation/components/molecules/UITextInput.d.ts.map +1 -1
- package/lib/typescript/src/presentation/components/molecules/UITextInputMask.d.ts.map +1 -1
- package/lib/typescript/src/presentation/components/organisms/UIFormMultiselectInput.d.ts.map +1 -1
- package/lib/typescript/src/presentation/components/organisms/UIFormSelectInput.d.ts.map +1 -1
- package/lib/typescript/src/presentation/components/organisms/UIMultipleSelectChip.d.ts +17 -0
- package/lib/typescript/src/presentation/components/organisms/UIMultipleSelectChip.d.ts.map +1 -0
- package/lib/typescript/src/presentation/components/organisms/UISelectChip.d.ts +6 -2
- package/lib/typescript/src/presentation/components/organisms/UISelectChip.d.ts.map +1 -1
- package/lib/typescript/src/presentation/components/organisms/UISignature.d.ts.map +1 -1
- package/lib/typescript/src/presentation/components/organisms/UISlideButton.d.ts.map +1 -1
- package/lib/typescript/src/presentation/components/organisms/index.d.ts +1 -0
- package/lib/typescript/src/presentation/components/organisms/index.d.ts.map +1 -1
- package/lib/typescript/src/presentation/components/permissions/request-permissions.d.ts.map +1 -1
- package/package.json +71 -75
- package/src/data/use-cases/remote-get-comment-list.ts +1 -1
- package/src/data/use-cases/remote-get-image-list.ts +2 -2
- package/src/infra/axios-http-client-adapter.ts +5 -5
- package/src/infra/offline-mutation-queue.ts +4 -4
- package/src/infra/rnp-permission-manager-adapter.ts +4 -4
- package/src/presentation/components/atoms/UIIcon.tsx +75 -110
- package/src/presentation/components/atoms/UIProgress.tsx +2 -3
- package/src/presentation/components/molecules/UIActionSheet.tsx +9 -13
- package/src/presentation/components/molecules/UIButton.tsx +6 -7
- package/src/presentation/components/molecules/UICurrencyInput.tsx +2 -2
- package/src/presentation/components/molecules/UIImage.tsx +3 -5
- package/src/presentation/components/molecules/UITextInput.tsx +5 -7
- package/src/presentation/components/molecules/UITextInputMask.tsx +5 -7
- package/src/presentation/components/organisms/UIFormButton.tsx +1 -1
- package/src/presentation/components/organisms/UIFormCheckboxInput.tsx +1 -1
- package/src/presentation/components/organisms/UIFormCurrencyInput.tsx +1 -1
- package/src/presentation/components/organisms/UIFormDatetimeInput.tsx +1 -1
- package/src/presentation/components/organisms/UIFormMultiselectInput.tsx +7 -9
- package/src/presentation/components/organisms/UIFormSelectInput.tsx +4 -6
- package/src/presentation/components/organisms/UIFormTextInput.tsx +1 -1
- package/src/presentation/components/organisms/UIMultipleSelectChip.tsx +139 -0
- package/src/presentation/components/organisms/UISelectChip.tsx +26 -3
- package/src/presentation/components/organisms/UISignature.tsx +4 -6
- package/src/presentation/components/organisms/UISlideButton.tsx +5 -7
- package/src/presentation/components/organisms/index.ts +1 -0
- package/src/presentation/components/permissions/request-permissions.tsx +5 -7
- package/src/presentation/domain/offline/use-offline-mutation.ts +2 -2
- package/src/presentation/domain/offline/use-offline-query.ts +1 -1
- package/src/theme.ts +22 -22
|
@@ -31,12 +31,11 @@ export const UIImage = ({
|
|
|
31
31
|
source={{
|
|
32
32
|
uri,
|
|
33
33
|
}}
|
|
34
|
-
onError={
|
|
34
|
+
onError={event => {
|
|
35
35
|
setHasError(Boolean(event.nativeEvent.error));
|
|
36
36
|
onError?.(event);
|
|
37
37
|
}}
|
|
38
|
-
{...props}
|
|
39
|
-
>
|
|
38
|
+
{...props}>
|
|
40
39
|
{hasError && (
|
|
41
40
|
<UIStack style={styles.error} flex={1}>
|
|
42
41
|
<UIText align="center">
|
|
@@ -50,8 +49,7 @@ export const UIImage = ({
|
|
|
50
49
|
variant="contained"
|
|
51
50
|
color="feedback-red-500"
|
|
52
51
|
style={styles.button}
|
|
53
|
-
onPress={onRemove}
|
|
54
|
-
>
|
|
52
|
+
onPress={onRemove}>
|
|
55
53
|
<UIStack horizontal center style={styles.remove}>
|
|
56
54
|
<UIIcon name="trash" color={theme.color.neutral.light['00']} />
|
|
57
55
|
<UIText color="neutral-light-00" size={12}>
|
|
@@ -38,7 +38,7 @@ export const UITextInput = React.forwardRef<TextInput, Props>(
|
|
|
38
38
|
const [hidden, setHidden] = React.useState(secureTextEntry);
|
|
39
39
|
const [focused, setFocused] = React.useState(false);
|
|
40
40
|
|
|
41
|
-
const toggleHidden = () => setHidden(
|
|
41
|
+
const toggleHidden = () => setHidden(value => !value);
|
|
42
42
|
|
|
43
43
|
return (
|
|
44
44
|
<View style={wrapperStyle}>
|
|
@@ -46,8 +46,7 @@ export const UITextInput = React.forwardRef<TextInput, Props>(
|
|
|
46
46
|
<UIText
|
|
47
47
|
weight="700"
|
|
48
48
|
variant="label"
|
|
49
|
-
style={[styles.label, focused && styles.labelFocused]}
|
|
50
|
-
>
|
|
49
|
+
style={[styles.label, focused && styles.labelFocused]}>
|
|
51
50
|
{label}
|
|
52
51
|
{required && <UIText color="feedback-red-500"> *</UIText>}
|
|
53
52
|
</UIText>
|
|
@@ -60,8 +59,7 @@ export const UITextInput = React.forwardRef<TextInput, Props>(
|
|
|
60
59
|
Boolean(endIcon) && styles.endIcon,
|
|
61
60
|
styles[variant],
|
|
62
61
|
containerStyle,
|
|
63
|
-
]}
|
|
64
|
-
>
|
|
62
|
+
]}>
|
|
65
63
|
{startIcon && React.cloneElement(startIcon, { focused })}
|
|
66
64
|
<TextInput
|
|
67
65
|
accessible
|
|
@@ -79,11 +77,11 @@ export const UITextInput = React.forwardRef<TextInput, Props>(
|
|
|
79
77
|
Boolean(endIcon) && styles.endIcon,
|
|
80
78
|
style,
|
|
81
79
|
]}
|
|
82
|
-
onFocus={
|
|
80
|
+
onFocus={e => {
|
|
83
81
|
setFocused(true);
|
|
84
82
|
onFocus?.(e);
|
|
85
83
|
}}
|
|
86
|
-
onBlur={
|
|
84
|
+
onBlur={e => {
|
|
87
85
|
setFocused(false);
|
|
88
86
|
onBlur?.(e);
|
|
89
87
|
}}
|
|
@@ -41,7 +41,7 @@ export const UITextInputMask = React.forwardRef<TextInput, Props>(
|
|
|
41
41
|
const [hidden, setHidden] = React.useState(secureTextEntry);
|
|
42
42
|
const [focused, setFocused] = React.useState(false);
|
|
43
43
|
|
|
44
|
-
const toggleHidden = () => setHidden(
|
|
44
|
+
const toggleHidden = () => setHidden(value => !value);
|
|
45
45
|
|
|
46
46
|
return (
|
|
47
47
|
<View style={wrapperStyle}>
|
|
@@ -49,8 +49,7 @@ export const UITextInputMask = React.forwardRef<TextInput, Props>(
|
|
|
49
49
|
<UIText
|
|
50
50
|
weight="700"
|
|
51
51
|
variant="label"
|
|
52
|
-
style={[styles.label, focused && styles.labelFocused]}
|
|
53
|
-
>
|
|
52
|
+
style={[styles.label, focused && styles.labelFocused]}>
|
|
54
53
|
{label}
|
|
55
54
|
{required && <UIText color="feedback-red-500"> *</UIText>}
|
|
56
55
|
</UIText>
|
|
@@ -61,8 +60,7 @@ export const UITextInputMask = React.forwardRef<TextInput, Props>(
|
|
|
61
60
|
focused && styles.focused,
|
|
62
61
|
styles[variant],
|
|
63
62
|
containerStyle,
|
|
64
|
-
]}
|
|
65
|
-
>
|
|
63
|
+
]}>
|
|
66
64
|
{startIcon && React.cloneElement(startIcon, { focused })}
|
|
67
65
|
<MaskInput
|
|
68
66
|
ref={ref}
|
|
@@ -79,11 +77,11 @@ export const UITextInputMask = React.forwardRef<TextInput, Props>(
|
|
|
79
77
|
!editable && Boolean(value) && styles.disabled,
|
|
80
78
|
style,
|
|
81
79
|
]}
|
|
82
|
-
onFocus={
|
|
80
|
+
onFocus={e => {
|
|
83
81
|
setFocused(true);
|
|
84
82
|
onFocus?.(e);
|
|
85
83
|
}}
|
|
86
|
-
onBlur={
|
|
84
|
+
onBlur={e => {
|
|
87
85
|
setFocused(false);
|
|
88
86
|
onBlur?.(e);
|
|
89
87
|
}}
|
|
@@ -18,7 +18,7 @@ export const UIFormButton = ({
|
|
|
18
18
|
const { handleSubmit, setError, clearErrors, reset } = useFormContext();
|
|
19
19
|
|
|
20
20
|
const onPress = handleSubmit(
|
|
21
|
-
async
|
|
21
|
+
async values => {
|
|
22
22
|
try {
|
|
23
23
|
await KeyboardController.dismiss({ animated: false, keepFocus: false });
|
|
24
24
|
clearErrors('_formError');
|
|
@@ -27,7 +27,7 @@ export const UIFormDatetimeInput = ({
|
|
|
27
27
|
<UIStack style={[styles.container, formContainerStyle]}>
|
|
28
28
|
<UIDatetimeInput
|
|
29
29
|
value={field.value && new Date(field.value)}
|
|
30
|
-
onSelect={
|
|
30
|
+
onSelect={date => {
|
|
31
31
|
field.onChange(date.getTime());
|
|
32
32
|
}}
|
|
33
33
|
{...props}
|
|
@@ -109,12 +109,12 @@ export const UIFormMultiselectInput = <T,>({
|
|
|
109
109
|
const onSelect = (item: T) => {
|
|
110
110
|
const current = (getValuesContext(name) ?? []) as T[];
|
|
111
111
|
const isSelected = current.find(
|
|
112
|
-
|
|
112
|
+
value => getItemKey(value) === getItemKey(item)
|
|
113
113
|
);
|
|
114
114
|
if (isSelected) {
|
|
115
115
|
setValueContext(
|
|
116
116
|
name,
|
|
117
|
-
current.filter(
|
|
117
|
+
current.filter(data => getItemKey(data) !== getItemKey(item))
|
|
118
118
|
);
|
|
119
119
|
} else {
|
|
120
120
|
setValueContext(name, [...current, item]);
|
|
@@ -136,7 +136,7 @@ export const UIFormMultiselectInput = <T,>({
|
|
|
136
136
|
if (!data) return [];
|
|
137
137
|
if (!Array.isArray(data)) return [];
|
|
138
138
|
if (!search) return data;
|
|
139
|
-
return data.filter(
|
|
139
|
+
return data.filter(item =>
|
|
140
140
|
String(getItemLabel(item) ?? '')
|
|
141
141
|
.toLowerCase()
|
|
142
142
|
.includes(search.toLowerCase())
|
|
@@ -145,7 +145,7 @@ export const UIFormMultiselectInput = <T,>({
|
|
|
145
145
|
|
|
146
146
|
const value = React.useMemo(() => {
|
|
147
147
|
const current = (getValuesContext(name) ?? []) as T[];
|
|
148
|
-
return current.map(
|
|
148
|
+
return current.map(value => getItemLabel(value)).join(', ');
|
|
149
149
|
}, [name, getItemLabel, getValuesContext, watchContext(name)]); //eslint-disable-line
|
|
150
150
|
|
|
151
151
|
return (
|
|
@@ -165,8 +165,7 @@ export const UIFormMultiselectInput = <T,>({
|
|
|
165
165
|
visible={visible}
|
|
166
166
|
onRequestClose={onClose}
|
|
167
167
|
title={title}
|
|
168
|
-
style={[styles.sheet, sheetStyle]}
|
|
169
|
-
>
|
|
168
|
+
style={[styles.sheet, sheetStyle]}>
|
|
170
169
|
<UIStack>
|
|
171
170
|
<UIForm schema={schema} form={form} style={styles.form}>
|
|
172
171
|
<UIFormTextInput
|
|
@@ -185,8 +184,7 @@ export const UIFormMultiselectInput = <T,>({
|
|
|
185
184
|
loading={isCreating}
|
|
186
185
|
variant={createVariant}
|
|
187
186
|
onSubmit={onSubmit}
|
|
188
|
-
getErrorMessage={getErrorMessage}
|
|
189
|
-
>
|
|
187
|
+
getErrorMessage={getErrorMessage}>
|
|
190
188
|
<UIStack style={styles.create} horizontal center>
|
|
191
189
|
<UIText color="neutral-light-00">{createMessage}</UIText>
|
|
192
190
|
<UIIcon
|
|
@@ -218,7 +216,7 @@ export const UIFormMultiselectInput = <T,>({
|
|
|
218
216
|
renderItem={({ item }) => {
|
|
219
217
|
const current = (watchContext(name) ?? []) as T[];
|
|
220
218
|
const isSelected = Boolean(
|
|
221
|
-
current.find(
|
|
219
|
+
current.find(value => getItemKey(value) === getItemKey(item))
|
|
222
220
|
);
|
|
223
221
|
const label = String(getItemLabel(item));
|
|
224
222
|
return (
|
|
@@ -174,7 +174,7 @@ export const UIFormSelectInput = <T,>({
|
|
|
174
174
|
if (!Array.isArray(data)) return [];
|
|
175
175
|
let filtered = data;
|
|
176
176
|
if (enableClientSearch && search) {
|
|
177
|
-
filtered = data.filter(
|
|
177
|
+
filtered = data.filter(item =>
|
|
178
178
|
String(getItemLabel(item) ?? '')
|
|
179
179
|
.toLowerCase()
|
|
180
180
|
.includes(search.toLowerCase())
|
|
@@ -233,8 +233,7 @@ export const UIFormSelectInput = <T,>({
|
|
|
233
233
|
onRequestClose={onClose}
|
|
234
234
|
title={title}
|
|
235
235
|
style={sheetStyle}
|
|
236
|
-
estimatedHeight={520}
|
|
237
|
-
>
|
|
236
|
+
estimatedHeight={520}>
|
|
238
237
|
<UIStack flex={1}>
|
|
239
238
|
<UIForm schema={schema} form={form} style={styles.form}>
|
|
240
239
|
<UIStack horizontal center>
|
|
@@ -242,7 +241,7 @@ export const UIFormSelectInput = <T,>({
|
|
|
242
241
|
name="search"
|
|
243
242
|
placeholder={searchPlaceholder}
|
|
244
243
|
variant={searchVariant}
|
|
245
|
-
onChangeText={
|
|
244
|
+
onChangeText={text => onSearchDebounced(text)}
|
|
246
245
|
endIcon={<UIInputIcon position="end" name="search" size={24} />}
|
|
247
246
|
/>
|
|
248
247
|
{action}
|
|
@@ -257,8 +256,7 @@ export const UIFormSelectInput = <T,>({
|
|
|
257
256
|
loading={isCreating}
|
|
258
257
|
variant={createVariant}
|
|
259
258
|
onSubmit={onSubmit}
|
|
260
|
-
getErrorMessage={getErrorMessage}
|
|
261
|
-
>
|
|
259
|
+
getErrorMessage={getErrorMessage}>
|
|
262
260
|
<UIStack style={styles.create} horizontal center>
|
|
263
261
|
<UIText color="neutral-light-00">{createMessage}</UIText>
|
|
264
262
|
<UIIcon
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
import { StyleSheet } from 'react-native';
|
|
2
|
+
import { UIButton, UIChip, UIList, UISkeleton } from '../molecules';
|
|
3
|
+
import { UIIcon, UISeparator, UISpacer, UIStack, UIText } from '../atoms';
|
|
4
|
+
import { theme } from '../../../theme';
|
|
5
|
+
|
|
6
|
+
type PropsToOmit = 'renderItem' | 'ItemSeparatorComponent';
|
|
7
|
+
|
|
8
|
+
type Props<T> = Omit<React.ComponentProps<typeof UIList<T>>, PropsToOmit> & {
|
|
9
|
+
data: T[];
|
|
10
|
+
getItemLabel: (item: T) => string;
|
|
11
|
+
getItemKey: (item: T) => string;
|
|
12
|
+
selected: T[];
|
|
13
|
+
onSelect: (item: T) => void;
|
|
14
|
+
onReset: () => void;
|
|
15
|
+
loading?: boolean;
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
export const UIMultipleSelectChip = <T,>({
|
|
19
|
+
data,
|
|
20
|
+
getItemLabel,
|
|
21
|
+
getItemKey,
|
|
22
|
+
selected,
|
|
23
|
+
onSelect,
|
|
24
|
+
onReset,
|
|
25
|
+
loading = false,
|
|
26
|
+
...props
|
|
27
|
+
}: Props<T>) => {
|
|
28
|
+
const isAllSelected = selected.length === 0;
|
|
29
|
+
|
|
30
|
+
const isSelected = (item: T) => {
|
|
31
|
+
return selected.some(
|
|
32
|
+
currentItem => getItemKey(currentItem) === getItemKey(item)
|
|
33
|
+
);
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
if (loading) return <UIMultipleSelectChip.Skeleton />;
|
|
37
|
+
|
|
38
|
+
return (
|
|
39
|
+
<UIList
|
|
40
|
+
horizontal
|
|
41
|
+
data={data}
|
|
42
|
+
ListHeaderComponent={() => (
|
|
43
|
+
<UIStack horizontal center size="md" style={styles.header}>
|
|
44
|
+
<UIButton onPress={() => onReset()} style={styles.button}>
|
|
45
|
+
<UIChip
|
|
46
|
+
content={
|
|
47
|
+
<UIStack horizontal center>
|
|
48
|
+
{isAllSelected && (
|
|
49
|
+
<UIIcon
|
|
50
|
+
name="check-alt"
|
|
51
|
+
color={theme.color.neutral.light['00']}
|
|
52
|
+
/>
|
|
53
|
+
)}
|
|
54
|
+
<UIText
|
|
55
|
+
weight="500"
|
|
56
|
+
color={
|
|
57
|
+
isAllSelected ? 'neutral-light-00' : 'neutral-mid-60'
|
|
58
|
+
}>
|
|
59
|
+
Todos
|
|
60
|
+
</UIText>
|
|
61
|
+
</UIStack>
|
|
62
|
+
}
|
|
63
|
+
color={isAllSelected ? 'brand-violet-500' : 'neutral-light-05'}
|
|
64
|
+
borderColor={
|
|
65
|
+
isAllSelected ? 'brand-violet-500' : 'neutral-light-50'
|
|
66
|
+
}
|
|
67
|
+
style={styles.chip}
|
|
68
|
+
/>
|
|
69
|
+
</UIButton>
|
|
70
|
+
<UISeparator horizontal={false} />
|
|
71
|
+
</UIStack>
|
|
72
|
+
)}
|
|
73
|
+
renderItem={({ item }) => {
|
|
74
|
+
const isSelectedItem = isSelected(item);
|
|
75
|
+
return (
|
|
76
|
+
<UIButton onPress={() => onSelect(item)} style={styles.button}>
|
|
77
|
+
<UIChip
|
|
78
|
+
content={
|
|
79
|
+
<UIStack horizontal center>
|
|
80
|
+
{isSelectedItem && (
|
|
81
|
+
<UIIcon
|
|
82
|
+
name="check-alt"
|
|
83
|
+
color={theme.color.neutral.light['00']}
|
|
84
|
+
/>
|
|
85
|
+
)}
|
|
86
|
+
<UIText
|
|
87
|
+
weight="500"
|
|
88
|
+
color={
|
|
89
|
+
isSelectedItem ? 'neutral-light-00' : 'neutral-mid-60'
|
|
90
|
+
}>
|
|
91
|
+
{getItemLabel(item)}
|
|
92
|
+
</UIText>
|
|
93
|
+
</UIStack>
|
|
94
|
+
}
|
|
95
|
+
color={isSelectedItem ? 'brand-violet-500' : 'neutral-light-05'}
|
|
96
|
+
borderColor={
|
|
97
|
+
isSelectedItem ? 'brand-violet-500' : 'neutral-light-50'
|
|
98
|
+
}
|
|
99
|
+
style={styles.chip}
|
|
100
|
+
/>
|
|
101
|
+
</UIButton>
|
|
102
|
+
);
|
|
103
|
+
}}
|
|
104
|
+
ItemSeparatorComponent={() => <UISpacer horizontal />}
|
|
105
|
+
{...props}
|
|
106
|
+
/>
|
|
107
|
+
);
|
|
108
|
+
};
|
|
109
|
+
|
|
110
|
+
UIMultipleSelectChip.Skeleton = () => {
|
|
111
|
+
return (
|
|
112
|
+
<UIList
|
|
113
|
+
horizontal
|
|
114
|
+
data={Array.from({ length: 3 })}
|
|
115
|
+
renderItem={() => <UISkeleton width={100} height={36} circle />}
|
|
116
|
+
ListHeaderComponent={() => (
|
|
117
|
+
<UIStack horizontal center size="md" style={styles.header}>
|
|
118
|
+
<UISkeleton width={85} height={36} circle />
|
|
119
|
+
<UISeparator horizontal={false} />
|
|
120
|
+
</UIStack>
|
|
121
|
+
)}
|
|
122
|
+
ItemSeparatorComponent={() => <UISpacer horizontal />}
|
|
123
|
+
/>
|
|
124
|
+
);
|
|
125
|
+
};
|
|
126
|
+
|
|
127
|
+
const styles = StyleSheet.create({
|
|
128
|
+
chip: {
|
|
129
|
+
paddingTop: 6,
|
|
130
|
+
paddingBottom: 6,
|
|
131
|
+
paddingHorizontal: 16,
|
|
132
|
+
},
|
|
133
|
+
header: {
|
|
134
|
+
marginRight: 8,
|
|
135
|
+
},
|
|
136
|
+
button: {
|
|
137
|
+
padding: 0,
|
|
138
|
+
},
|
|
139
|
+
});
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { StyleSheet } from 'react-native';
|
|
2
|
-
import { UIButton, UIChip, UIList } from '../molecules';
|
|
2
|
+
import { UIButton, UIChip, UIList, UISkeleton } from '../molecules';
|
|
3
3
|
import { UIIcon, UISeparator, UISpacer, UIStack, UIText } from '../atoms';
|
|
4
4
|
import { theme } from '../../../theme';
|
|
5
5
|
|
|
@@ -9,9 +9,10 @@ type Props<T> = Omit<React.ComponentProps<typeof UIList<T>>, PropsToOmit> & {
|
|
|
9
9
|
data: T[];
|
|
10
10
|
getItemLabel: (item: T) => string;
|
|
11
11
|
getItemKey: (item: T) => string;
|
|
12
|
-
selected: T;
|
|
12
|
+
selected: T | null;
|
|
13
13
|
onSelect: (item: T) => void;
|
|
14
14
|
onReset: () => void;
|
|
15
|
+
loading?: boolean;
|
|
15
16
|
};
|
|
16
17
|
|
|
17
18
|
export const UISelectChip = <T,>({
|
|
@@ -21,14 +22,19 @@ export const UISelectChip = <T,>({
|
|
|
21
22
|
selected,
|
|
22
23
|
onSelect,
|
|
23
24
|
onReset,
|
|
25
|
+
loading = false,
|
|
24
26
|
...props
|
|
25
27
|
}: Props<T>) => {
|
|
28
|
+
if (loading) return <UISelectChip.Skeleton />;
|
|
29
|
+
|
|
26
30
|
return (
|
|
27
31
|
<UIList
|
|
28
32
|
horizontal
|
|
29
33
|
data={data}
|
|
30
34
|
renderItem={({ item }) => {
|
|
31
|
-
const isSelected =
|
|
35
|
+
const isSelected = Boolean(
|
|
36
|
+
selected && getItemKey(selected) === getItemKey(item)
|
|
37
|
+
);
|
|
32
38
|
return (
|
|
33
39
|
<UIButton onPress={() => onSelect(item)} style={styles.button}>
|
|
34
40
|
<UIChip
|
|
@@ -89,6 +95,23 @@ export const UISelectChip = <T,>({
|
|
|
89
95
|
);
|
|
90
96
|
};
|
|
91
97
|
|
|
98
|
+
UISelectChip.Skeleton = () => {
|
|
99
|
+
return (
|
|
100
|
+
<UIList
|
|
101
|
+
horizontal
|
|
102
|
+
data={Array.from({ length: 3 })}
|
|
103
|
+
renderItem={() => <UISkeleton width={100} height={36} circle />}
|
|
104
|
+
ListHeaderComponent={() => (
|
|
105
|
+
<UIStack horizontal center size="md" style={styles.header}>
|
|
106
|
+
<UISkeleton width={85} height={36} circle />
|
|
107
|
+
<UISeparator horizontal={false} />
|
|
108
|
+
</UIStack>
|
|
109
|
+
)}
|
|
110
|
+
ItemSeparatorComponent={() => <UISpacer horizontal />}
|
|
111
|
+
/>
|
|
112
|
+
);
|
|
113
|
+
};
|
|
114
|
+
|
|
92
115
|
const styles = StyleSheet.create({
|
|
93
116
|
chip: {
|
|
94
117
|
paddingTop: 6,
|
|
@@ -97,13 +97,13 @@ export const UISignature = ({
|
|
|
97
97
|
.averageTouches(true)
|
|
98
98
|
.maxPointers(1)
|
|
99
99
|
.minDistance(1)
|
|
100
|
-
.onStart(
|
|
100
|
+
.onStart(e => {
|
|
101
101
|
currentPath.value.moveTo(e.x, e.y);
|
|
102
102
|
currentPath.value.lineTo(e.x, e.y);
|
|
103
103
|
notifyChange(currentPath);
|
|
104
104
|
if (onTouchStart) scheduleOnRN(onTouchStart);
|
|
105
105
|
})
|
|
106
|
-
.onUpdate(
|
|
106
|
+
.onUpdate(e => {
|
|
107
107
|
scheduleOnRN(setIsDirty, true);
|
|
108
108
|
currentPath.value.lineTo(e.x, e.y);
|
|
109
109
|
notifyChange(currentPath);
|
|
@@ -140,8 +140,7 @@ export const UISignature = ({
|
|
|
140
140
|
ref={canvasRef}
|
|
141
141
|
testID={testID}
|
|
142
142
|
accessibilityLabel={accessibilityLabel}
|
|
143
|
-
style={[styles.container, signatureStyle]}
|
|
144
|
-
>
|
|
143
|
+
style={[styles.container, signatureStyle]}>
|
|
145
144
|
<Path
|
|
146
145
|
path={currentPath}
|
|
147
146
|
strokeWidth={5}
|
|
@@ -158,8 +157,7 @@ export const UISignature = ({
|
|
|
158
157
|
<UIButton
|
|
159
158
|
style={styles.clear}
|
|
160
159
|
onPress={resetSignature}
|
|
161
|
-
disabled={disabled}
|
|
162
|
-
>
|
|
160
|
+
disabled={disabled}>
|
|
163
161
|
<UIIcon name="close" />
|
|
164
162
|
</UIButton>
|
|
165
163
|
</UIStack>
|
|
@@ -46,7 +46,7 @@ export const UISlideButton = ({ children, helperText, onPress }: Props) => {
|
|
|
46
46
|
});
|
|
47
47
|
|
|
48
48
|
const pan = Gesture.Pan()
|
|
49
|
-
.onUpdate(
|
|
49
|
+
.onUpdate(event => {
|
|
50
50
|
animation.value = interpolate(
|
|
51
51
|
clamp(event.translationX, 0, max),
|
|
52
52
|
[0, max],
|
|
@@ -69,10 +69,9 @@ export const UISlideButton = ({ children, helperText, onPress }: Props) => {
|
|
|
69
69
|
return (
|
|
70
70
|
<UIStack
|
|
71
71
|
style={styles.container}
|
|
72
|
-
onLayout={
|
|
72
|
+
onLayout={event => {
|
|
73
73
|
setContainerWidth(event.nativeEvent.layout.width);
|
|
74
|
-
}}
|
|
75
|
-
>
|
|
74
|
+
}}>
|
|
76
75
|
{helperText && (
|
|
77
76
|
<Animated.View style={[styles.text, labelAnimatedStyle]}>
|
|
78
77
|
<UIText weight="600">{helperText}</UIText>
|
|
@@ -83,10 +82,9 @@ export const UISlideButton = ({ children, helperText, onPress }: Props) => {
|
|
|
83
82
|
<UIButton
|
|
84
83
|
variant="contained"
|
|
85
84
|
style={styles.button}
|
|
86
|
-
onLayout={
|
|
85
|
+
onLayout={event => {
|
|
87
86
|
setButtonWidth(event.nativeEvent.layout.width);
|
|
88
|
-
}}
|
|
89
|
-
>
|
|
87
|
+
}}>
|
|
90
88
|
{children}
|
|
91
89
|
</UIButton>
|
|
92
90
|
</Animated.View>
|
|
@@ -30,15 +30,15 @@ export const RequestPermissions = ({
|
|
|
30
30
|
|
|
31
31
|
const check = React.useCallback(async () => {
|
|
32
32
|
const current = await Promise.all(
|
|
33
|
-
permissions.map(async
|
|
33
|
+
permissions.map(async permission => ({
|
|
34
34
|
permission,
|
|
35
35
|
state: await permissionManager.get(permission.value),
|
|
36
36
|
}))
|
|
37
37
|
);
|
|
38
38
|
setPending(
|
|
39
39
|
current
|
|
40
|
-
.filter(
|
|
41
|
-
.map(
|
|
40
|
+
.filter(item => ['denied', 'blocked'].includes(item.state))
|
|
41
|
+
.map(item => item.permission)
|
|
42
42
|
);
|
|
43
43
|
}, [permissionManager, permissions]);
|
|
44
44
|
|
|
@@ -73,8 +73,7 @@ export const RequestPermissions = ({
|
|
|
73
73
|
visible={visible}
|
|
74
74
|
onRequestClose={onClose}
|
|
75
75
|
title={title ?? 'Permissões'}
|
|
76
|
-
estimatedHeight={height}
|
|
77
|
-
>
|
|
76
|
+
estimatedHeight={height}>
|
|
78
77
|
<UIList
|
|
79
78
|
data={pending}
|
|
80
79
|
style={{ height: height ?? 400 }}
|
|
@@ -91,8 +90,7 @@ export const RequestPermissions = ({
|
|
|
91
90
|
variant="contained"
|
|
92
91
|
color="neutral-light-20"
|
|
93
92
|
textColor="brand-violet-500"
|
|
94
|
-
onPress={() => onAllow(item)}
|
|
95
|
-
>
|
|
93
|
+
onPress={() => onAllow(item)}>
|
|
96
94
|
{item.option.allow ?? 'Permitir'}
|
|
97
95
|
</UIButton>
|
|
98
96
|
</UIStack>
|
|
@@ -28,7 +28,7 @@ import type { Storage } from '../../../data/protocols';
|
|
|
28
28
|
const parseData = (data: any) => {
|
|
29
29
|
try {
|
|
30
30
|
return typeof data === 'string' ? JSON.parse(data) : data;
|
|
31
|
-
} catch
|
|
31
|
+
} catch {
|
|
32
32
|
return data;
|
|
33
33
|
}
|
|
34
34
|
};
|
|
@@ -110,7 +110,7 @@ export const useOfflineMutation = <TData, TError, TVariables>({
|
|
|
110
110
|
body: parsedData,
|
|
111
111
|
},
|
|
112
112
|
status: OfflineMutationStatus.PENDING,
|
|
113
|
-
dependencies: dependencies.map(
|
|
113
|
+
dependencies: dependencies.map(value =>
|
|
114
114
|
isIsomorphicId(value) ? value : String(value)
|
|
115
115
|
),
|
|
116
116
|
queryKeysToInvalidate,
|
|
@@ -30,7 +30,7 @@ export const useOfflineQuery = <
|
|
|
30
30
|
}: Params<TQueryFnData, TError, TData, TQueryKey>) => {
|
|
31
31
|
return useQuery({
|
|
32
32
|
queryKey,
|
|
33
|
-
queryFn: async
|
|
33
|
+
queryFn: async context => {
|
|
34
34
|
const data = await (queryFn as any)?.(context);
|
|
35
35
|
if (isInvalidData(data)) {
|
|
36
36
|
throw new Error(
|