@sincpro/mobile-ui 3.1.0 → 3.3.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.
- package/dist/Dialog/Dialog.EditValue.js +6 -19
- package/dist/Dialog/Dialog.Sheet.js +48 -12
- package/dist/Dialog/OverlayHost.d.ts +2 -1
- package/dist/Dialog/OverlayHost.js +36 -2
- package/dist/Dialog/SheetSurface.d.ts +19 -0
- package/dist/Dialog/SheetSurface.js +279 -225
- package/dist/Display/Display.DocumentPreview.d.ts +15 -0
- package/dist/Display/Display.DocumentPreview.js +349 -0
- package/dist/Display/Display.DocumentViewer.d.ts +15 -0
- package/dist/Display/Display.DocumentViewer.js +465 -0
- package/dist/Display/Display.SwipeableRow.js +30 -23
- package/dist/Display/document-pages.d.ts +21 -0
- package/dist/Display/document-pages.js +282 -0
- package/dist/Display/document-renderer.d.ts +30 -0
- package/dist/Display/document-renderer.js +28 -0
- package/dist/Display/icon-map.d.ts +10 -10
- package/dist/Display/icon-map.js +14 -10
- package/dist/Display/index.d.ts +8 -0
- package/dist/Display/index.js +6 -0
- package/dist/Form/Form.DatePicker.js +2 -0
- package/dist/Form/Form.Input.d.ts +1 -1
- package/dist/Form/Form.Input.js +234 -215
- package/dist/Form/Form.KeyboardToolbarHost.js +78 -37
- package/dist/Form/Form.PickerField.js +133 -156
- package/dist/Form/Form.RadioButton.d.ts +1 -0
- package/dist/Form/Form.RadioButton.js +11 -122
- package/dist/Form/Form.Select.d.ts +2 -1
- package/dist/Form/Form.Select.js +183 -286
- package/dist/Form/choice-row.d.ts +15 -0
- package/dist/Form/choice-row.js +236 -0
- package/dist/theme/active.d.ts +2 -0
- package/dist/theme/active.js +13 -0
- package/dist/theme/useTheme.d.ts +4 -0
- package/dist/theme/useTheme.js +7 -12
- package/dist/utils/document.d.ts +18 -0
- package/dist/utils/document.js +46 -0
- package/package.json +4 -1
|
@@ -0,0 +1,349 @@
|
|
|
1
|
+
import { c as _c } from "react/compiler-runtime";
|
|
2
|
+
import ExpoImage from "./Display.ExpoImage.js";
|
|
3
|
+
import Icon from "./Display.Icon.js";
|
|
4
|
+
import { documentHeading, documentMeta, DocumentStatus, useDocumentPages } from "./document-pages.js";
|
|
5
|
+
import Skeleton from "../Feedback/Feedback.Skeleton.js";
|
|
6
|
+
import Pressable from "../primitives/Pressable.js";
|
|
7
|
+
import { useTheme } from "../theme/index.js";
|
|
8
|
+
import { cn } from "../theme/tw.js";
|
|
9
|
+
import { Typography } from "../Typography/index.js";
|
|
10
|
+
import { useWindowDimensions, View } from "react-native";
|
|
11
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "nativewind/jsx-runtime";
|
|
12
|
+
const MAX_THUMBNAIL_WIDTH = 1080;
|
|
13
|
+
function Notice(t0) {
|
|
14
|
+
const $ = _c(8);
|
|
15
|
+
const {
|
|
16
|
+
icon,
|
|
17
|
+
label,
|
|
18
|
+
color
|
|
19
|
+
} = t0;
|
|
20
|
+
let t1;
|
|
21
|
+
if ($[0] !== color || $[1] !== icon) {
|
|
22
|
+
t1 = _jsx(Icon, {
|
|
23
|
+
color: color,
|
|
24
|
+
name: icon,
|
|
25
|
+
size: 28
|
|
26
|
+
});
|
|
27
|
+
$[0] = color;
|
|
28
|
+
$[1] = icon;
|
|
29
|
+
$[2] = t1;
|
|
30
|
+
} else {
|
|
31
|
+
t1 = $[2];
|
|
32
|
+
}
|
|
33
|
+
let t2;
|
|
34
|
+
if ($[3] !== label) {
|
|
35
|
+
t2 = _jsx(Typography.Text, {
|
|
36
|
+
align: "center",
|
|
37
|
+
className: "text-text-secondary",
|
|
38
|
+
variant: "bodySmall",
|
|
39
|
+
children: label
|
|
40
|
+
});
|
|
41
|
+
$[3] = label;
|
|
42
|
+
$[4] = t2;
|
|
43
|
+
} else {
|
|
44
|
+
t2 = $[4];
|
|
45
|
+
}
|
|
46
|
+
let t3;
|
|
47
|
+
if ($[5] !== t1 || $[6] !== t2) {
|
|
48
|
+
t3 = _jsxs(View, {
|
|
49
|
+
className: "flex-1 items-center justify-center gap-2 px-4",
|
|
50
|
+
children: [t1, t2]
|
|
51
|
+
});
|
|
52
|
+
$[5] = t1;
|
|
53
|
+
$[6] = t2;
|
|
54
|
+
$[7] = t3;
|
|
55
|
+
} else {
|
|
56
|
+
t3 = $[7];
|
|
57
|
+
}
|
|
58
|
+
return t3;
|
|
59
|
+
}
|
|
60
|
+
function DocumentPreview(t0) {
|
|
61
|
+
const $ = _c(68);
|
|
62
|
+
const {
|
|
63
|
+
source,
|
|
64
|
+
title,
|
|
65
|
+
height: t1,
|
|
66
|
+
fit: t2,
|
|
67
|
+
onPress,
|
|
68
|
+
renderer,
|
|
69
|
+
className,
|
|
70
|
+
testID
|
|
71
|
+
} = t0;
|
|
72
|
+
const height = t1 === undefined ? 180 : t1;
|
|
73
|
+
const fit = t2 === undefined ? "top" : t2;
|
|
74
|
+
const theme = useTheme();
|
|
75
|
+
const {
|
|
76
|
+
width,
|
|
77
|
+
scale
|
|
78
|
+
} = useWindowDimensions();
|
|
79
|
+
let t3;
|
|
80
|
+
if ($[0] !== scale || $[1] !== width) {
|
|
81
|
+
t3 = Math.round(width * scale);
|
|
82
|
+
$[0] = scale;
|
|
83
|
+
$[1] = width;
|
|
84
|
+
$[2] = t3;
|
|
85
|
+
} else {
|
|
86
|
+
t3 = $[2];
|
|
87
|
+
}
|
|
88
|
+
const document = useDocumentPages(source, Math.min(MAX_THUMBNAIL_WIDTH, t3), true, renderer);
|
|
89
|
+
const page = document.pages[0];
|
|
90
|
+
const failed = document.status === DocumentStatus.ERROR;
|
|
91
|
+
let t4;
|
|
92
|
+
if ($[3] !== document || $[4] !== title) {
|
|
93
|
+
t4 = title ?? documentHeading(document);
|
|
94
|
+
$[3] = document;
|
|
95
|
+
$[4] = title;
|
|
96
|
+
$[5] = t4;
|
|
97
|
+
} else {
|
|
98
|
+
t4 = $[5];
|
|
99
|
+
}
|
|
100
|
+
const heading = t4;
|
|
101
|
+
let t5;
|
|
102
|
+
if ($[6] !== document.isImage || $[7] !== document.label || $[8] !== document.pageCount) {
|
|
103
|
+
t5 = documentMeta(document.label, document.isImage, document.pageCount);
|
|
104
|
+
$[6] = document.isImage;
|
|
105
|
+
$[7] = document.label;
|
|
106
|
+
$[8] = document.pageCount;
|
|
107
|
+
$[9] = t5;
|
|
108
|
+
} else {
|
|
109
|
+
t5 = $[9];
|
|
110
|
+
}
|
|
111
|
+
const meta = t5;
|
|
112
|
+
const handlePress = failed ? document.retry : onPress;
|
|
113
|
+
let t6;
|
|
114
|
+
if ($[10] !== height || $[11] !== theme.bg.muted) {
|
|
115
|
+
t6 = {
|
|
116
|
+
height,
|
|
117
|
+
backgroundColor: theme.bg.muted
|
|
118
|
+
};
|
|
119
|
+
$[10] = height;
|
|
120
|
+
$[11] = theme.bg.muted;
|
|
121
|
+
$[12] = t6;
|
|
122
|
+
} else {
|
|
123
|
+
t6 = $[12];
|
|
124
|
+
}
|
|
125
|
+
let t7;
|
|
126
|
+
if ($[13] !== document.attempt || $[14] !== document.reportPageError || $[15] !== document.status || $[16] !== fit || $[17] !== page) {
|
|
127
|
+
t7 = document.status === DocumentStatus.READY && page ? _jsx(ExpoImage, {
|
|
128
|
+
contentFit: fit === "top" ? "cover" : "contain",
|
|
129
|
+
contentPosition: "top",
|
|
130
|
+
onError: document.reportPageError,
|
|
131
|
+
source: {
|
|
132
|
+
uri: page.uri
|
|
133
|
+
},
|
|
134
|
+
style: {
|
|
135
|
+
flex: 1,
|
|
136
|
+
width: "100%",
|
|
137
|
+
borderTopLeftRadius: 6,
|
|
138
|
+
borderTopRightRadius: 6
|
|
139
|
+
}
|
|
140
|
+
}, document.attempt) : null;
|
|
141
|
+
$[13] = document.attempt;
|
|
142
|
+
$[14] = document.reportPageError;
|
|
143
|
+
$[15] = document.status;
|
|
144
|
+
$[16] = fit;
|
|
145
|
+
$[17] = page;
|
|
146
|
+
$[18] = t7;
|
|
147
|
+
} else {
|
|
148
|
+
t7 = $[18];
|
|
149
|
+
}
|
|
150
|
+
let t8;
|
|
151
|
+
if ($[19] !== document.status) {
|
|
152
|
+
t8 = document.status === DocumentStatus.LOADING ? _jsx(Skeleton, {
|
|
153
|
+
height: "100%",
|
|
154
|
+
radius: 6,
|
|
155
|
+
width: "100%"
|
|
156
|
+
}) : null;
|
|
157
|
+
$[19] = document.status;
|
|
158
|
+
$[20] = t8;
|
|
159
|
+
} else {
|
|
160
|
+
t8 = $[20];
|
|
161
|
+
}
|
|
162
|
+
let t9;
|
|
163
|
+
if ($[21] !== failed || $[22] !== theme.danger) {
|
|
164
|
+
t9 = failed ? _jsx(Notice, {
|
|
165
|
+
color: theme.danger,
|
|
166
|
+
icon: "error",
|
|
167
|
+
label: "No se pudo generar la vista previa. Toca para reintentar."
|
|
168
|
+
}) : null;
|
|
169
|
+
$[21] = failed;
|
|
170
|
+
$[22] = theme.danger;
|
|
171
|
+
$[23] = t9;
|
|
172
|
+
} else {
|
|
173
|
+
t9 = $[23];
|
|
174
|
+
}
|
|
175
|
+
let t10;
|
|
176
|
+
if ($[24] !== document.status || $[25] !== theme.icon.tertiary) {
|
|
177
|
+
t10 = document.status === DocumentStatus.UNSUPPORTED ? _jsx(Notice, {
|
|
178
|
+
color: theme.icon.tertiary,
|
|
179
|
+
icon: "document",
|
|
180
|
+
label: "Vista previa no disponible"
|
|
181
|
+
}) : null;
|
|
182
|
+
$[24] = document.status;
|
|
183
|
+
$[25] = theme.icon.tertiary;
|
|
184
|
+
$[26] = t10;
|
|
185
|
+
} else {
|
|
186
|
+
t10 = $[26];
|
|
187
|
+
}
|
|
188
|
+
let t11;
|
|
189
|
+
if ($[27] !== t10 || $[28] !== t6 || $[29] !== t7 || $[30] !== t8 || $[31] !== t9) {
|
|
190
|
+
t11 = _jsxs(View, {
|
|
191
|
+
className: "px-3 pt-3",
|
|
192
|
+
style: t6,
|
|
193
|
+
children: [t7, t8, t9, t10]
|
|
194
|
+
});
|
|
195
|
+
$[27] = t10;
|
|
196
|
+
$[28] = t6;
|
|
197
|
+
$[29] = t7;
|
|
198
|
+
$[30] = t8;
|
|
199
|
+
$[31] = t9;
|
|
200
|
+
$[32] = t11;
|
|
201
|
+
} else {
|
|
202
|
+
t11 = $[32];
|
|
203
|
+
}
|
|
204
|
+
const t12 = document.isImage ? "image" : "document";
|
|
205
|
+
let t13;
|
|
206
|
+
if ($[33] !== t12 || $[34] !== theme.icon.secondary) {
|
|
207
|
+
t13 = _jsx(Icon, {
|
|
208
|
+
color: theme.icon.secondary,
|
|
209
|
+
name: t12,
|
|
210
|
+
size: 20
|
|
211
|
+
});
|
|
212
|
+
$[33] = t12;
|
|
213
|
+
$[34] = theme.icon.secondary;
|
|
214
|
+
$[35] = t13;
|
|
215
|
+
} else {
|
|
216
|
+
t13 = $[35];
|
|
217
|
+
}
|
|
218
|
+
let t14;
|
|
219
|
+
if ($[36] !== heading) {
|
|
220
|
+
t14 = _jsx(Typography.Text, {
|
|
221
|
+
className: "text-text-primary",
|
|
222
|
+
numberOfLines: 1,
|
|
223
|
+
semibold: true,
|
|
224
|
+
children: heading
|
|
225
|
+
});
|
|
226
|
+
$[36] = heading;
|
|
227
|
+
$[37] = t14;
|
|
228
|
+
} else {
|
|
229
|
+
t14 = $[37];
|
|
230
|
+
}
|
|
231
|
+
let t15;
|
|
232
|
+
if ($[38] !== meta) {
|
|
233
|
+
t15 = _jsx(Typography.Text, {
|
|
234
|
+
className: "text-text-secondary",
|
|
235
|
+
variant: "caption",
|
|
236
|
+
children: meta
|
|
237
|
+
});
|
|
238
|
+
$[38] = meta;
|
|
239
|
+
$[39] = t15;
|
|
240
|
+
} else {
|
|
241
|
+
t15 = $[39];
|
|
242
|
+
}
|
|
243
|
+
let t16;
|
|
244
|
+
if ($[40] !== t14 || $[41] !== t15) {
|
|
245
|
+
t16 = _jsxs(View, {
|
|
246
|
+
className: "flex-1",
|
|
247
|
+
children: [t14, t15]
|
|
248
|
+
});
|
|
249
|
+
$[40] = t14;
|
|
250
|
+
$[41] = t15;
|
|
251
|
+
$[42] = t16;
|
|
252
|
+
} else {
|
|
253
|
+
t16 = $[42];
|
|
254
|
+
}
|
|
255
|
+
let t17;
|
|
256
|
+
if ($[43] !== failed || $[44] !== onPress || $[45] !== theme.icon.tertiary) {
|
|
257
|
+
t17 = onPress && !failed ? _jsx(Icon, {
|
|
258
|
+
color: theme.icon.tertiary,
|
|
259
|
+
name: "next",
|
|
260
|
+
size: 18
|
|
261
|
+
}) : null;
|
|
262
|
+
$[43] = failed;
|
|
263
|
+
$[44] = onPress;
|
|
264
|
+
$[45] = theme.icon.tertiary;
|
|
265
|
+
$[46] = t17;
|
|
266
|
+
} else {
|
|
267
|
+
t17 = $[46];
|
|
268
|
+
}
|
|
269
|
+
let t18;
|
|
270
|
+
if ($[47] !== t13 || $[48] !== t16 || $[49] !== t17) {
|
|
271
|
+
t18 = _jsxs(View, {
|
|
272
|
+
className: "flex-row items-center gap-3 px-3 py-2.5",
|
|
273
|
+
children: [t13, t16, t17]
|
|
274
|
+
});
|
|
275
|
+
$[47] = t13;
|
|
276
|
+
$[48] = t16;
|
|
277
|
+
$[49] = t17;
|
|
278
|
+
$[50] = t18;
|
|
279
|
+
} else {
|
|
280
|
+
t18 = $[50];
|
|
281
|
+
}
|
|
282
|
+
let t19;
|
|
283
|
+
if ($[51] !== t11 || $[52] !== t18) {
|
|
284
|
+
t19 = _jsxs(_Fragment, {
|
|
285
|
+
children: [t11, t18]
|
|
286
|
+
});
|
|
287
|
+
$[51] = t11;
|
|
288
|
+
$[52] = t18;
|
|
289
|
+
$[53] = t19;
|
|
290
|
+
} else {
|
|
291
|
+
t19 = $[53];
|
|
292
|
+
}
|
|
293
|
+
const body = t19;
|
|
294
|
+
let t20;
|
|
295
|
+
if ($[54] !== className) {
|
|
296
|
+
t20 = cn("overflow-hidden rounded-xl border border-border-light bg-bg-card", className);
|
|
297
|
+
$[54] = className;
|
|
298
|
+
$[55] = t20;
|
|
299
|
+
} else {
|
|
300
|
+
t20 = $[55];
|
|
301
|
+
}
|
|
302
|
+
const surface = t20;
|
|
303
|
+
const label = `Vista previa de ${heading}, ${meta}`;
|
|
304
|
+
if (!handlePress) {
|
|
305
|
+
let t21;
|
|
306
|
+
if ($[56] !== body || $[57] !== label || $[58] !== surface || $[59] !== testID) {
|
|
307
|
+
t21 = _jsx(View, {
|
|
308
|
+
accessibilityLabel: label,
|
|
309
|
+
accessibilityRole: "image",
|
|
310
|
+
accessible: true,
|
|
311
|
+
className: surface,
|
|
312
|
+
testID: testID,
|
|
313
|
+
children: body
|
|
314
|
+
});
|
|
315
|
+
$[56] = body;
|
|
316
|
+
$[57] = label;
|
|
317
|
+
$[58] = surface;
|
|
318
|
+
$[59] = testID;
|
|
319
|
+
$[60] = t21;
|
|
320
|
+
} else {
|
|
321
|
+
t21 = $[60];
|
|
322
|
+
}
|
|
323
|
+
return t21;
|
|
324
|
+
}
|
|
325
|
+
const t21 = failed ? "Reintenta generar la vista previa" : "Abre el documento";
|
|
326
|
+
let t22;
|
|
327
|
+
if ($[61] !== body || $[62] !== handlePress || $[63] !== label || $[64] !== surface || $[65] !== t21 || $[66] !== testID) {
|
|
328
|
+
t22 = _jsx(Pressable, {
|
|
329
|
+
accessibilityHint: t21,
|
|
330
|
+
accessibilityLabel: label,
|
|
331
|
+
className: surface,
|
|
332
|
+
onPress: handlePress,
|
|
333
|
+
testID: testID,
|
|
334
|
+
children: body
|
|
335
|
+
});
|
|
336
|
+
$[61] = body;
|
|
337
|
+
$[62] = handlePress;
|
|
338
|
+
$[63] = label;
|
|
339
|
+
$[64] = surface;
|
|
340
|
+
$[65] = t21;
|
|
341
|
+
$[66] = testID;
|
|
342
|
+
$[67] = t22;
|
|
343
|
+
} else {
|
|
344
|
+
t22 = $[67];
|
|
345
|
+
}
|
|
346
|
+
return t22;
|
|
347
|
+
}
|
|
348
|
+
export default DocumentPreview;
|
|
349
|
+
export { DocumentPreview };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { DocumentRenderer } from "./document-renderer.js";
|
|
2
|
+
import type { DocumentSource } from "../utils/document.js";
|
|
3
|
+
import { type ReactNode } from "react";
|
|
4
|
+
export interface DocumentViewerProps {
|
|
5
|
+
visible: boolean;
|
|
6
|
+
source: DocumentSource | null;
|
|
7
|
+
title?: string;
|
|
8
|
+
onClose: () => void;
|
|
9
|
+
actions?: ReactNode;
|
|
10
|
+
renderer?: DocumentRenderer;
|
|
11
|
+
testID?: string;
|
|
12
|
+
}
|
|
13
|
+
declare function DocumentViewer({ visible, source, title, onClose, actions, renderer, testID, }: DocumentViewerProps): import("react").JSX.Element;
|
|
14
|
+
export default DocumentViewer;
|
|
15
|
+
export { DocumentViewer };
|