@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.
Files changed (37) hide show
  1. package/dist/Dialog/Dialog.EditValue.js +6 -19
  2. package/dist/Dialog/Dialog.Sheet.js +48 -12
  3. package/dist/Dialog/OverlayHost.d.ts +2 -1
  4. package/dist/Dialog/OverlayHost.js +36 -2
  5. package/dist/Dialog/SheetSurface.d.ts +19 -0
  6. package/dist/Dialog/SheetSurface.js +279 -225
  7. package/dist/Display/Display.DocumentPreview.d.ts +15 -0
  8. package/dist/Display/Display.DocumentPreview.js +349 -0
  9. package/dist/Display/Display.DocumentViewer.d.ts +15 -0
  10. package/dist/Display/Display.DocumentViewer.js +465 -0
  11. package/dist/Display/Display.SwipeableRow.js +30 -23
  12. package/dist/Display/document-pages.d.ts +21 -0
  13. package/dist/Display/document-pages.js +282 -0
  14. package/dist/Display/document-renderer.d.ts +30 -0
  15. package/dist/Display/document-renderer.js +28 -0
  16. package/dist/Display/icon-map.d.ts +10 -10
  17. package/dist/Display/icon-map.js +14 -10
  18. package/dist/Display/index.d.ts +8 -0
  19. package/dist/Display/index.js +6 -0
  20. package/dist/Form/Form.DatePicker.js +2 -0
  21. package/dist/Form/Form.Input.d.ts +1 -1
  22. package/dist/Form/Form.Input.js +234 -215
  23. package/dist/Form/Form.KeyboardToolbarHost.js +78 -37
  24. package/dist/Form/Form.PickerField.js +133 -156
  25. package/dist/Form/Form.RadioButton.d.ts +1 -0
  26. package/dist/Form/Form.RadioButton.js +11 -122
  27. package/dist/Form/Form.Select.d.ts +2 -1
  28. package/dist/Form/Form.Select.js +183 -286
  29. package/dist/Form/choice-row.d.ts +15 -0
  30. package/dist/Form/choice-row.js +236 -0
  31. package/dist/theme/active.d.ts +2 -0
  32. package/dist/theme/active.js +13 -0
  33. package/dist/theme/useTheme.d.ts +4 -0
  34. package/dist/theme/useTheme.js +7 -12
  35. package/dist/utils/document.d.ts +18 -0
  36. package/dist/utils/document.js +46 -0
  37. package/package.json +4 -1
@@ -6,6 +6,7 @@ import { cn, tv } from "../theme/tw.js";
6
6
  import { Typography } from "../Typography/index.js";
7
7
  import { useState } from "react";
8
8
  import { TextInput, TouchableOpacity, View } from "react-native";
9
+ import { KeyboardController } from "react-native-keyboard-controller";
9
10
  import { jsx as _jsx, jsxs as _jsxs } from "nativewind/jsx-runtime";
10
11
  // `card`: filled surface, the default of forms built with the DS. Same box as the
11
12
  // Select, DatePicker, PickerField and Dropdown triggers.
@@ -92,15 +93,17 @@ function SecureToggle(t0) {
92
93
  * | `outline` | bodyLarge | border only, rounded, 44 high | 16 |
93
94
  */
94
95
  function FormInput(t0) {
95
- const $ = _c(94);
96
+ const $ = _c(98);
96
97
  let className;
97
98
  let error;
98
99
  let label;
99
100
  let onBlur;
100
101
  let onFocus;
102
+ let onSubmitEditing;
101
103
  let props;
102
104
  let ref;
103
105
  let style;
106
+ let submitBehavior;
104
107
  let t1;
105
108
  let t2;
106
109
  let t3;
@@ -118,6 +121,8 @@ function FormInput(t0) {
118
121
  numberOfLines: t4,
119
122
  onFocus,
120
123
  onBlur,
124
+ onSubmitEditing,
125
+ submitBehavior,
121
126
  className,
122
127
  ref,
123
128
  ...props
@@ -128,28 +133,32 @@ function FormInput(t0) {
128
133
  $[3] = label;
129
134
  $[4] = onBlur;
130
135
  $[5] = onFocus;
131
- $[6] = props;
132
- $[7] = ref;
133
- $[8] = style;
134
- $[9] = t1;
135
- $[10] = t2;
136
- $[11] = t3;
137
- $[12] = t4;
138
- $[13] = tooltip;
136
+ $[6] = onSubmitEditing;
137
+ $[7] = props;
138
+ $[8] = ref;
139
+ $[9] = style;
140
+ $[10] = submitBehavior;
141
+ $[11] = t1;
142
+ $[12] = t2;
143
+ $[13] = t3;
144
+ $[14] = t4;
145
+ $[15] = tooltip;
139
146
  } else {
140
147
  className = $[1];
141
148
  error = $[2];
142
149
  label = $[3];
143
150
  onBlur = $[4];
144
151
  onFocus = $[5];
145
- props = $[6];
146
- ref = $[7];
147
- style = $[8];
148
- t1 = $[9];
149
- t2 = $[10];
150
- t3 = $[11];
151
- t4 = $[12];
152
- tooltip = $[13];
152
+ onSubmitEditing = $[6];
153
+ props = $[7];
154
+ ref = $[8];
155
+ style = $[9];
156
+ submitBehavior = $[10];
157
+ t1 = $[11];
158
+ t2 = $[12];
159
+ t3 = $[13];
160
+ t4 = $[14];
161
+ tooltip = $[15];
153
162
  }
154
163
  const look = t1 === undefined ? "card" : t1;
155
164
  const secure = t2 === undefined ? false : t2;
@@ -161,325 +170,335 @@ function FormInput(t0) {
161
170
  const hasError = Boolean(error);
162
171
  const state = hasError ? "error" : isFocused ? "focused" : "default";
163
172
  let t5;
164
- if ($[14] !== onFocus) {
173
+ if ($[16] !== onFocus) {
165
174
  t5 = e => {
166
175
  setIsFocused(true);
167
176
  onFocus?.(e);
168
177
  };
169
- $[14] = onFocus;
170
- $[15] = t5;
178
+ $[16] = onFocus;
179
+ $[17] = t5;
171
180
  } else {
172
- t5 = $[15];
181
+ t5 = $[17];
173
182
  }
174
183
  const handleFocus = t5;
175
184
  let t6;
176
- if ($[16] !== onBlur) {
185
+ if ($[18] !== onBlur) {
177
186
  t6 = e_0 => {
178
187
  setIsFocused(false);
179
188
  onBlur?.(e_0);
180
189
  };
181
- $[16] = onBlur;
182
- $[17] = t6;
190
+ $[18] = onBlur;
191
+ $[19] = t6;
183
192
  } else {
184
- t6 = $[17];
193
+ t6 = $[19];
185
194
  }
186
195
  const handleBlur = t6;
187
196
  let t7;
188
- if ($[18] === Symbol.for("react.memo_cache_sentinel")) {
197
+ if ($[20] === Symbol.for("react.memo_cache_sentinel")) {
189
198
  t7 = () => setRevealed(_temp);
190
- $[18] = t7;
199
+ $[20] = t7;
191
200
  } else {
192
- t7 = $[18];
201
+ t7 = $[20];
193
202
  }
194
203
  const toggle = t7;
204
+ const advances = props.returnKeyType === "next" && !multiline && !onSubmitEditing;
195
205
  const t8 = error || tooltip;
196
- const t9 = secure && !revealed;
197
- let t10;
198
- if ($[19] !== handleBlur || $[20] !== handleFocus || $[21] !== label || $[22] !== ref || $[23] !== t8 || $[24] !== t9 || $[25] !== theme.primary || $[26] !== theme.text.tertiary) {
199
- t10 = {
206
+ const t9 = advances ? _temp2 : onSubmitEditing;
207
+ const t10 = advances ? "submit" : submitBehavior;
208
+ const t11 = secure && !revealed;
209
+ let t12;
210
+ if ($[21] !== handleBlur || $[22] !== handleFocus || $[23] !== label || $[24] !== ref || $[25] !== t10 || $[26] !== t11 || $[27] !== t8 || $[28] !== t9 || $[29] !== theme.primary || $[30] !== theme.text.tertiary) {
211
+ t12 = {
200
212
  accessibilityHint: t8,
201
213
  accessibilityLabel: label,
202
214
  onBlur: handleBlur,
203
215
  onFocus: handleFocus,
216
+ onSubmitEditing: t9,
217
+ submitBehavior: t10,
204
218
  placeholderTextColor: theme.text.tertiary,
205
219
  ref,
206
- secureTextEntry: t9,
220
+ secureTextEntry: t11,
207
221
  selectionColor: theme.primary,
208
222
  underlineColorAndroid: "transparent"
209
223
  };
210
- $[19] = handleBlur;
211
- $[20] = handleFocus;
212
- $[21] = label;
213
- $[22] = ref;
214
- $[23] = t8;
215
- $[24] = t9;
216
- $[25] = theme.primary;
217
- $[26] = theme.text.tertiary;
218
- $[27] = t10;
224
+ $[21] = handleBlur;
225
+ $[22] = handleFocus;
226
+ $[23] = label;
227
+ $[24] = ref;
228
+ $[25] = t10;
229
+ $[26] = t11;
230
+ $[27] = t8;
231
+ $[28] = t9;
232
+ $[29] = theme.primary;
233
+ $[30] = theme.text.tertiary;
234
+ $[31] = t12;
219
235
  } else {
220
- t10 = $[27];
236
+ t12 = $[31];
221
237
  }
222
- const shared = t10;
223
- let t11;
224
- if ($[28] !== error || $[29] !== hasError || $[30] !== look) {
225
- t11 = hasError ? _jsx(Typography.Text, {
238
+ const shared = t12;
239
+ let t13;
240
+ if ($[32] !== error || $[33] !== hasError || $[34] !== look) {
241
+ t13 = hasError ? _jsx(Typography.Text, {
226
242
  accessibilityLiveRegion: "polite",
227
243
  className: look === "card" ? "mt-0.5 text-danger" : "mt-1 text-danger",
228
244
  variant: "bodySmall",
229
245
  children: error
230
246
  }) : null;
231
- $[28] = error;
232
- $[29] = hasError;
233
- $[30] = look;
234
- $[31] = t11;
247
+ $[32] = error;
248
+ $[33] = hasError;
249
+ $[34] = look;
250
+ $[35] = t13;
235
251
  } else {
236
- t11 = $[31];
252
+ t13 = $[35];
237
253
  }
238
- const errorText = t11;
254
+ const errorText = t13;
239
255
  if (look === "outline") {
240
- let t12;
241
- if ($[32] !== className) {
242
- t12 = cn("mb-4", className);
243
- $[32] = className;
244
- $[33] = t12;
256
+ let t14;
257
+ if ($[36] !== className) {
258
+ t14 = cn("mb-4", className);
259
+ $[36] = className;
260
+ $[37] = t14;
245
261
  } else {
246
- t12 = $[33];
262
+ t14 = $[37];
247
263
  }
248
- let t13;
249
- if ($[34] !== label) {
250
- t13 = label ? _jsx(Typography.Text, {
264
+ let t15;
265
+ if ($[38] !== label) {
266
+ t15 = label ? _jsx(Typography.Text, {
251
267
  className: "mb-1",
252
268
  variant: "bodyLarge",
253
269
  children: label
254
270
  }) : null;
255
- $[34] = label;
256
- $[35] = t13;
271
+ $[38] = label;
272
+ $[39] = t15;
257
273
  } else {
258
- t13 = $[35];
274
+ t15 = $[39];
259
275
  }
260
- let t14;
261
- if ($[36] !== state) {
262
- t14 = outlineInput({
276
+ let t16;
277
+ if ($[40] !== state) {
278
+ t16 = outlineInput({
263
279
  state
264
280
  });
265
- $[36] = state;
266
- $[37] = t14;
281
+ $[40] = state;
282
+ $[41] = t16;
267
283
  } else {
268
- t14 = $[37];
284
+ t16 = $[41];
269
285
  }
270
- let t15;
271
- if ($[38] === Symbol.for("react.memo_cache_sentinel")) {
272
- t15 = inputTextStyle();
273
- $[38] = t15;
286
+ let t17;
287
+ if ($[42] === Symbol.for("react.memo_cache_sentinel")) {
288
+ t17 = inputTextStyle();
289
+ $[42] = t17;
274
290
  } else {
275
- t15 = $[38];
291
+ t17 = $[42];
276
292
  }
277
- let t16;
278
- if ($[39] !== style) {
279
- t16 = [t15, style];
280
- $[39] = style;
281
- $[40] = t16;
293
+ let t18;
294
+ if ($[43] !== style) {
295
+ t18 = [t17, style];
296
+ $[43] = style;
297
+ $[44] = t18;
282
298
  } else {
283
- t16 = $[40];
299
+ t18 = $[44];
284
300
  }
285
- let t17;
286
- if ($[41] !== multiline || $[42] !== numberOfLines || $[43] !== props || $[44] !== shared || $[45] !== t14 || $[46] !== t16) {
287
- t17 = _jsx(TextInput, {
288
- className: t14,
301
+ let t19;
302
+ if ($[45] !== multiline || $[46] !== numberOfLines || $[47] !== props || $[48] !== shared || $[49] !== t16 || $[50] !== t18) {
303
+ t19 = _jsx(TextInput, {
304
+ className: t16,
289
305
  multiline: multiline,
290
306
  numberOfLines: numberOfLines,
291
- style: t16,
307
+ style: t18,
292
308
  ...shared,
293
309
  ...props
294
310
  });
295
- $[41] = multiline;
296
- $[42] = numberOfLines;
297
- $[43] = props;
298
- $[44] = shared;
299
- $[45] = t14;
300
- $[46] = t16;
301
- $[47] = t17;
311
+ $[45] = multiline;
312
+ $[46] = numberOfLines;
313
+ $[47] = props;
314
+ $[48] = shared;
315
+ $[49] = t16;
316
+ $[50] = t18;
317
+ $[51] = t19;
302
318
  } else {
303
- t17 = $[47];
319
+ t19 = $[51];
304
320
  }
305
- let t18;
306
- if ($[48] !== errorText || $[49] !== t12 || $[50] !== t13 || $[51] !== t17) {
307
- t18 = _jsxs(View, {
308
- className: t12,
309
- children: [t13, t17, errorText]
321
+ let t20;
322
+ if ($[52] !== errorText || $[53] !== t14 || $[54] !== t15 || $[55] !== t19) {
323
+ t20 = _jsxs(View, {
324
+ className: t14,
325
+ children: [t15, t19, errorText]
310
326
  });
311
- $[48] = errorText;
312
- $[49] = t12;
313
- $[50] = t13;
314
- $[51] = t17;
315
- $[52] = t18;
327
+ $[52] = errorText;
328
+ $[53] = t14;
329
+ $[54] = t15;
330
+ $[55] = t19;
331
+ $[56] = t20;
316
332
  } else {
317
- t18 = $[52];
333
+ t20 = $[56];
318
334
  }
319
- const field = t18;
335
+ const field = t20;
320
336
  if (!secure) {
321
337
  return field;
322
338
  }
323
- let t19;
324
- if ($[53] !== revealed) {
325
- t19 = _jsx(SecureToggle, {
339
+ let t21;
340
+ if ($[57] !== revealed) {
341
+ t21 = _jsx(SecureToggle, {
326
342
  className: "absolute right-3 bottom-[25px]",
327
343
  onToggle: toggle,
328
344
  visible: revealed
329
345
  });
330
- $[53] = revealed;
331
- $[54] = t19;
346
+ $[57] = revealed;
347
+ $[58] = t21;
332
348
  } else {
333
- t19 = $[54];
349
+ t21 = $[58];
334
350
  }
335
- let t20;
336
- if ($[55] !== field || $[56] !== t19) {
337
- t20 = _jsxs(View, {
351
+ let t22;
352
+ if ($[59] !== field || $[60] !== t21) {
353
+ t22 = _jsxs(View, {
338
354
  className: "mb-4 relative",
339
- children: [field, t19]
355
+ children: [field, t21]
340
356
  });
341
- $[55] = field;
342
- $[56] = t19;
343
- $[57] = t20;
357
+ $[59] = field;
358
+ $[60] = t21;
359
+ $[61] = t22;
344
360
  } else {
345
- t20 = $[57];
361
+ t22 = $[61];
346
362
  }
347
- return t20;
363
+ return t22;
348
364
  }
349
- let t12;
350
- if ($[58] !== className) {
351
- t12 = cn("mb-2", className);
352
- $[58] = className;
353
- $[59] = t12;
365
+ let t14;
366
+ if ($[62] !== className) {
367
+ t14 = cn("mb-2", className);
368
+ $[62] = className;
369
+ $[63] = t14;
354
370
  } else {
355
- t12 = $[59];
371
+ t14 = $[63];
356
372
  }
357
- let t13;
358
- if ($[60] !== label) {
359
- t13 = label ? _jsx(Typography.Text, {
373
+ let t15;
374
+ if ($[64] !== label) {
375
+ t15 = label ? _jsx(Typography.Text, {
360
376
  className: "mb-1 text-text-primary",
361
377
  semibold: true,
362
378
  variant: "bodySmall",
363
379
  children: label
364
380
  }) : null;
365
- $[60] = label;
366
- $[61] = t13;
381
+ $[64] = label;
382
+ $[65] = t15;
367
383
  } else {
368
- t13 = $[61];
384
+ t15 = $[65];
369
385
  }
370
- let t14;
371
- if ($[62] !== secure || $[63] !== state) {
372
- t14 = cn(cardBox({
386
+ let t16;
387
+ if ($[66] !== secure || $[67] !== state) {
388
+ t16 = cn(cardBox({
373
389
  state
374
390
  }), secure && "flex-row items-center");
375
- $[62] = secure;
376
- $[63] = state;
377
- $[64] = t14;
378
- } else {
379
- t14 = $[64];
380
- }
381
- const t15 = multiline && "min-h-[64px] pt-2.5";
382
- const t16 = secure && "flex-1";
383
- let t17;
384
- if ($[65] !== t15 || $[66] !== t16) {
385
- t17 = cn("px-3 py-2.5 min-h-[48px] text-text-primary", t15, t16);
386
- $[65] = t15;
387
- $[66] = t16;
388
- $[67] = t17;
391
+ $[66] = secure;
392
+ $[67] = state;
393
+ $[68] = t16;
389
394
  } else {
390
- t17 = $[67];
395
+ t16 = $[68];
391
396
  }
392
- let t18;
393
- if ($[68] === Symbol.for("react.memo_cache_sentinel")) {
394
- t18 = inputTextStyle();
395
- $[68] = t18;
397
+ const t17 = multiline && "min-h-[64px] pt-2.5";
398
+ const t18 = secure && "flex-1";
399
+ let t19;
400
+ if ($[69] !== t17 || $[70] !== t18) {
401
+ t19 = cn("px-3 py-2.5 min-h-[48px] text-text-primary", t17, t18);
402
+ $[69] = t17;
403
+ $[70] = t18;
404
+ $[71] = t19;
396
405
  } else {
397
- t18 = $[68];
406
+ t19 = $[71];
398
407
  }
399
- const t19 = multiline ? 64 : 48;
400
408
  let t20;
401
- if ($[69] !== t19) {
402
- t20 = {
403
- minHeight: t19
404
- };
405
- $[69] = t19;
406
- $[70] = t20;
409
+ if ($[72] === Symbol.for("react.memo_cache_sentinel")) {
410
+ t20 = inputTextStyle();
411
+ $[72] = t20;
407
412
  } else {
408
- t20 = $[70];
413
+ t20 = $[72];
409
414
  }
410
- let t21;
411
- if ($[71] !== style || $[72] !== t20) {
412
- t21 = [t18, t20, style];
413
- $[71] = style;
414
- $[72] = t20;
415
+ const t21 = multiline ? 64 : 48;
416
+ let t22;
417
+ if ($[73] !== t21) {
418
+ t22 = {
419
+ minHeight: t21
420
+ };
415
421
  $[73] = t21;
422
+ $[74] = t22;
416
423
  } else {
417
- t21 = $[73];
424
+ t22 = $[74];
418
425
  }
419
- const t22 = multiline ? "top" : "center";
420
426
  let t23;
421
- if ($[74] !== multiline || $[75] !== numberOfLines || $[76] !== props || $[77] !== shared || $[78] !== t17 || $[79] !== t21 || $[80] !== t22) {
422
- t23 = _jsx(TextInput, {
423
- className: t17,
427
+ if ($[75] !== style || $[76] !== t22) {
428
+ t23 = [t20, t22, style];
429
+ $[75] = style;
430
+ $[76] = t22;
431
+ $[77] = t23;
432
+ } else {
433
+ t23 = $[77];
434
+ }
435
+ const t24 = multiline ? "top" : "center";
436
+ let t25;
437
+ if ($[78] !== multiline || $[79] !== numberOfLines || $[80] !== props || $[81] !== shared || $[82] !== t19 || $[83] !== t23 || $[84] !== t24) {
438
+ t25 = _jsx(TextInput, {
439
+ className: t19,
424
440
  multiline: multiline,
425
441
  numberOfLines: numberOfLines,
426
- style: t21,
427
- textAlignVertical: t22,
442
+ style: t23,
443
+ textAlignVertical: t24,
428
444
  ...shared,
429
445
  ...props
430
446
  });
431
- $[74] = multiline;
432
- $[75] = numberOfLines;
433
- $[76] = props;
434
- $[77] = shared;
435
- $[78] = t17;
436
- $[79] = t21;
437
- $[80] = t22;
438
- $[81] = t23;
447
+ $[78] = multiline;
448
+ $[79] = numberOfLines;
449
+ $[80] = props;
450
+ $[81] = shared;
451
+ $[82] = t19;
452
+ $[83] = t23;
453
+ $[84] = t24;
454
+ $[85] = t25;
439
455
  } else {
440
- t23 = $[81];
456
+ t25 = $[85];
441
457
  }
442
- let t24;
443
- if ($[82] !== revealed || $[83] !== secure) {
444
- t24 = secure ? _jsx(SecureToggle, {
458
+ let t26;
459
+ if ($[86] !== revealed || $[87] !== secure) {
460
+ t26 = secure ? _jsx(SecureToggle, {
445
461
  className: "px-3",
446
462
  onToggle: toggle,
447
463
  visible: revealed
448
464
  }) : null;
449
- $[82] = revealed;
450
- $[83] = secure;
451
- $[84] = t24;
465
+ $[86] = revealed;
466
+ $[87] = secure;
467
+ $[88] = t26;
452
468
  } else {
453
- t24 = $[84];
469
+ t26 = $[88];
454
470
  }
455
- let t25;
456
- if ($[85] !== t14 || $[86] !== t23 || $[87] !== t24) {
457
- t25 = _jsxs(View, {
458
- className: t14,
459
- children: [t23, t24]
471
+ let t27;
472
+ if ($[89] !== t16 || $[90] !== t25 || $[91] !== t26) {
473
+ t27 = _jsxs(View, {
474
+ className: t16,
475
+ children: [t25, t26]
460
476
  });
461
- $[85] = t14;
462
- $[86] = t23;
463
- $[87] = t24;
464
- $[88] = t25;
477
+ $[89] = t16;
478
+ $[90] = t25;
479
+ $[91] = t26;
480
+ $[92] = t27;
465
481
  } else {
466
- t25 = $[88];
482
+ t27 = $[92];
467
483
  }
468
- let t26;
469
- if ($[89] !== errorText || $[90] !== t12 || $[91] !== t13 || $[92] !== t25) {
470
- t26 = _jsxs(View, {
471
- className: t12,
472
- children: [t13, t25, errorText]
484
+ let t28;
485
+ if ($[93] !== errorText || $[94] !== t14 || $[95] !== t15 || $[96] !== t27) {
486
+ t28 = _jsxs(View, {
487
+ className: t14,
488
+ children: [t15, t27, errorText]
473
489
  });
474
- $[89] = errorText;
475
- $[90] = t12;
476
- $[91] = t13;
477
- $[92] = t25;
478
- $[93] = t26;
490
+ $[93] = errorText;
491
+ $[94] = t14;
492
+ $[95] = t15;
493
+ $[96] = t27;
494
+ $[97] = t28;
479
495
  } else {
480
- t26 = $[93];
496
+ t28 = $[97];
481
497
  }
482
- return t26;
498
+ return t28;
499
+ }
500
+ function _temp2() {
501
+ return KeyboardController.setFocusTo("next");
483
502
  }
484
503
  function _temp(value) {
485
504
  return !value;