@draftbit/core 46.1.4-e6469c.0 → 46.2.1-327d47.2

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 (158) hide show
  1. package/lib/commonjs/components/ActionSheet/index.js.map +1 -1
  2. package/lib/commonjs/components/CardBlock.js +15 -5
  3. package/lib/commonjs/components/CardBlock.js.map +1 -1
  4. package/lib/commonjs/components/Carousel.js +3 -1
  5. package/lib/commonjs/components/Carousel.js.map +1 -1
  6. package/lib/commonjs/components/Checkbox/Checkbox.js +2 -4
  7. package/lib/commonjs/components/Checkbox/Checkbox.js.map +1 -1
  8. package/lib/commonjs/components/Checkbox/CheckboxGroupRow.js +23 -6
  9. package/lib/commonjs/components/Checkbox/CheckboxGroupRow.js.map +1 -1
  10. package/lib/commonjs/components/Checkbox/context.js +1 -1
  11. package/lib/commonjs/components/Checkbox/context.js.map +1 -1
  12. package/lib/commonjs/components/CircleImage.js +17 -3
  13. package/lib/commonjs/components/CircleImage.js.map +1 -1
  14. package/lib/commonjs/components/Config.js +3 -3
  15. package/lib/commonjs/components/Config.js.map +1 -1
  16. package/lib/commonjs/components/DatePicker/DatePicker.js +10 -11
  17. package/lib/commonjs/components/DatePicker/DatePicker.js.map +1 -1
  18. package/lib/commonjs/components/DatePicker/DatePickerComponent.web.js.map +1 -1
  19. package/lib/commonjs/components/DatePicker/DatePickerComponentType.js.map +1 -1
  20. package/lib/commonjs/components/DeprecatedButton.js +4 -20
  21. package/lib/commonjs/components/DeprecatedButton.js.map +1 -1
  22. package/lib/commonjs/components/DeprecatedCardWrapper.js +2 -14
  23. package/lib/commonjs/components/DeprecatedCardWrapper.js.map +1 -1
  24. package/lib/commonjs/components/DeprecatedFAB.js +21 -4
  25. package/lib/commonjs/components/DeprecatedFAB.js.map +1 -1
  26. package/lib/commonjs/components/HeaderLarge.js.map +1 -1
  27. package/lib/commonjs/components/Picker/Picker.js +4 -5
  28. package/lib/commonjs/components/Picker/Picker.js.map +1 -1
  29. package/lib/commonjs/components/Picker/PickerComponent.android.js +135 -0
  30. package/lib/commonjs/components/Picker/PickerComponent.android.js.map +1 -0
  31. package/lib/commonjs/components/Picker/PickerComponent.ios.js +161 -0
  32. package/lib/commonjs/components/Picker/PickerComponent.ios.js.map +1 -0
  33. package/lib/commonjs/components/Picker/PickerComponent.web.js +136 -0
  34. package/lib/commonjs/components/Picker/PickerComponent.web.js.map +1 -0
  35. package/lib/commonjs/components/Picker/PickerTypes.js +6 -0
  36. package/lib/commonjs/components/Picker/PickerTypes.js.map +1 -0
  37. package/lib/commonjs/components/RadioButton/RadioButton.js +1 -1
  38. package/lib/commonjs/components/RadioButton/RadioButton.js.map +1 -1
  39. package/lib/commonjs/components/RadioButton/RadioButtonGroup.js +17 -5
  40. package/lib/commonjs/components/RadioButton/RadioButtonGroup.js.map +1 -1
  41. package/lib/commonjs/components/RadioButton/RadioButtonRow.js +1 -1
  42. package/lib/commonjs/components/RadioButton/RadioButtonRow.js.map +1 -1
  43. package/lib/commonjs/components/StepIndicator.js +1 -1
  44. package/lib/commonjs/components/StepIndicator.js.map +1 -1
  45. package/lib/commonjs/components/Stepper.js +1 -1
  46. package/lib/commonjs/components/Stepper.js.map +1 -1
  47. package/lib/commonjs/components/Swiper/SwiperItem.js.map +1 -1
  48. package/lib/commonjs/components/Text.js +38 -11
  49. package/lib/commonjs/components/Text.js.map +1 -1
  50. package/lib/commonjs/mappings/CardContainerRating.js.map +1 -1
  51. package/lib/commonjs/mappings/Checkbox.js.map +1 -1
  52. package/lib/commonjs/mappings/NumberInput.js +241 -0
  53. package/lib/commonjs/mappings/NumberInput.js.map +1 -0
  54. package/lib/commonjs/mappings/RadioButtonGroup.js.map +1 -1
  55. package/lib/commonjs/mappings/RadioButtonRow.js.map +1 -1
  56. package/lib/commonjs/mappings/Text.js +33 -26
  57. package/lib/commonjs/mappings/Text.js.map +1 -1
  58. package/lib/commonjs/mappings/TextArea.js +192 -2
  59. package/lib/commonjs/mappings/TextArea.js.map +1 -1
  60. package/lib/commonjs/mappings/TextField.js +191 -2
  61. package/lib/commonjs/mappings/TextField.js.map +1 -1
  62. package/lib/commonjs/mappings/TextInput.js +180 -29
  63. package/lib/commonjs/mappings/TextInput.js.map +1 -1
  64. package/lib/commonjs/mappings/Video.js.map +1 -1
  65. package/lib/commonjs/styles/DarkTheme.js.map +1 -1
  66. package/lib/commonjs/utilities.js +1 -1
  67. package/lib/commonjs/utilities.js.map +1 -1
  68. package/lib/module/components/Carousel.js +3 -1
  69. package/lib/module/components/Carousel.js.map +1 -1
  70. package/lib/module/components/Config.js +3 -3
  71. package/lib/module/components/Config.js.map +1 -1
  72. package/lib/module/components/DatePicker/DatePicker.js +3 -3
  73. package/lib/module/components/DatePicker/DatePicker.js.map +1 -1
  74. package/lib/module/components/DatePicker/DatePickerComponent.js.map +1 -1
  75. package/lib/module/components/Picker/Picker.js +4 -5
  76. package/lib/module/components/Picker/Picker.js.map +1 -1
  77. package/lib/module/components/Picker/PickerComponent.android.js +112 -0
  78. package/lib/module/components/Picker/PickerComponent.android.js.map +1 -0
  79. package/lib/module/components/Picker/PickerComponent.ios.js +135 -0
  80. package/lib/module/components/Picker/PickerComponent.ios.js.map +1 -0
  81. package/lib/module/components/Picker/PickerComponent.web.js +113 -0
  82. package/lib/module/components/Picker/PickerComponent.web.js.map +1 -0
  83. package/lib/module/components/Picker/PickerTypes.js +2 -0
  84. package/lib/module/components/Picker/PickerTypes.js.map +1 -0
  85. package/lib/module/components/RadioButton/RadioButton.js +1 -1
  86. package/lib/module/components/RadioButton/RadioButton.js.map +1 -1
  87. package/lib/module/components/RadioButton/RadioButtonRow.js +1 -1
  88. package/lib/module/components/RadioButton/RadioButtonRow.js.map +1 -1
  89. package/lib/module/components/StepIndicator.js +1 -1
  90. package/lib/module/components/StepIndicator.js.map +1 -1
  91. package/lib/module/components/Stepper.js +1 -1
  92. package/lib/module/components/Stepper.js.map +1 -1
  93. package/lib/module/components/Touchable.js +2 -16
  94. package/lib/module/components/Touchable.js.map +1 -1
  95. package/lib/module/mappings/NumberInput.js +231 -0
  96. package/lib/module/mappings/NumberInput.js.map +1 -0
  97. package/lib/module/mappings/Surface.js.map +1 -1
  98. package/lib/module/mappings/Text.js +33 -26
  99. package/lib/module/mappings/Text.js.map +1 -1
  100. package/lib/module/mappings/TextArea.js +193 -3
  101. package/lib/module/mappings/TextArea.js.map +1 -1
  102. package/lib/module/mappings/TextField.js +192 -3
  103. package/lib/module/mappings/TextField.js.map +1 -1
  104. package/lib/module/mappings/TextInput.js +180 -29
  105. package/lib/module/mappings/TextInput.js.map +1 -1
  106. package/lib/module/utilities.js +1 -1
  107. package/lib/module/utilities.js.map +1 -1
  108. package/lib/typescript/src/components/Picker/PickerComponent.android.d.ts +6 -0
  109. package/lib/typescript/src/components/Picker/PickerComponent.ios.d.ts +7 -0
  110. package/lib/typescript/src/components/Picker/PickerComponent.web.d.ts +6 -0
  111. package/lib/typescript/src/components/Picker/PickerTypes.d.ts +18 -0
  112. package/lib/typescript/src/mappings/NumberInput.d.ts +297 -0
  113. package/lib/typescript/src/mappings/Text.d.ts +24 -10
  114. package/lib/typescript/src/mappings/TextArea.d.ts +12 -11
  115. package/lib/typescript/src/mappings/TextField.d.ts +4 -4
  116. package/lib/typescript/src/mappings/TextInput.d.ts +3 -254
  117. package/package.json +3 -3
  118. package/src/components/ActionSheet/ActionSheet.js +1 -1
  119. package/src/components/Carousel.js +4 -2
  120. package/src/components/Checkbox/Checkbox.js +3 -3
  121. package/src/components/Checkbox/CheckboxGroupRow.js +2 -2
  122. package/src/components/Checkbox/CheckboxRow.js +3 -3
  123. package/src/components/CircularProgress.js +29 -26
  124. package/src/components/DatePicker/DatePicker.js +1 -1
  125. package/src/components/NumberInput.js +1 -1
  126. package/src/components/Picker/Picker.js +8 -8
  127. package/src/components/Picker/Picker.tsx +8 -6
  128. package/src/components/Picker/PickerComponent.android.js +69 -0
  129. package/src/components/Picker/PickerComponent.android.tsx +116 -0
  130. package/src/components/Picker/PickerComponent.ios.js +79 -0
  131. package/src/components/Picker/PickerComponent.ios.tsx +142 -0
  132. package/src/components/Picker/PickerComponent.web.js +70 -0
  133. package/src/components/Picker/PickerComponent.web.tsx +117 -0
  134. package/src/components/Picker/PickerTypes.js +1 -0
  135. package/src/components/Picker/PickerTypes.ts +18 -0
  136. package/src/components/Portal/Portal.js +2 -2
  137. package/src/components/Portal/PortalConsumer.js +0 -1
  138. package/src/components/Portal/PortalHost.js +43 -41
  139. package/src/components/Portal/PortalManager.js +21 -18
  140. package/src/components/ProgressBar.js +9 -9
  141. package/src/components/RadioButton/RadioButton.js +3 -3
  142. package/src/components/RadioButton/RadioButtonGroup.js +1 -1
  143. package/src/components/RadioButton/RadioButtonRow.js +3 -3
  144. package/src/components/StepIndicator.js +225 -225
  145. package/src/components/Stepper.js +2 -2
  146. package/src/components/Text.js +0 -1
  147. package/src/components/TextField.js +62 -59
  148. package/src/constants.js +1 -1
  149. package/src/mappings/NumberInput.js +248 -0
  150. package/src/mappings/NumberInput.ts +267 -0
  151. package/src/mappings/Text.js +33 -26
  152. package/src/mappings/Text.ts +34 -27
  153. package/src/mappings/TextArea.js +221 -3
  154. package/src/mappings/TextArea.ts +227 -3
  155. package/src/mappings/TextField.js +220 -3
  156. package/src/mappings/TextField.ts +227 -3
  157. package/src/mappings/TextInput.js +208 -31
  158. package/src/mappings/TextInput.ts +214 -34
@@ -63,7 +63,7 @@ export declare const SEED_DATA_PROPS: {
63
63
  required: boolean;
64
64
  };
65
65
  };
66
- export declare const SEED_DATA: ({
66
+ export declare const SEED_DATA: {
67
67
  name: string;
68
68
  tag: string;
69
69
  description: string;
@@ -273,23 +273,13 @@ export declare const SEED_DATA: ({
273
273
  formType: string;
274
274
  propType: string;
275
275
  };
276
- disabled: {
277
- group: string;
278
- label: string;
279
- description: string;
280
- formType: string;
281
- propType: string;
282
- defaultValue: null;
283
- editable: boolean;
284
- required: boolean;
285
- };
286
276
  editable: {
287
277
  group: string;
288
278
  label: string;
289
279
  description: string;
290
280
  editable: boolean;
291
281
  required: boolean;
292
- defaultValue: null;
282
+ defaultValue: boolean;
293
283
  formType: string;
294
284
  propType: string;
295
285
  };
@@ -400,245 +390,4 @@ export declare const SEED_DATA: ({
400
390
  propType: string;
401
391
  };
402
392
  };
403
- } | {
404
- name: string;
405
- tag: string;
406
- description: string;
407
- category: string;
408
- preview_image_url: string;
409
- supports_list_render: boolean;
410
- layout: {
411
- borderLeftWidth: number;
412
- borderRightWidth: number;
413
- borderTopWidth: number;
414
- borderBottomWidth: number;
415
- borderColor: string;
416
- paddingLeft: number;
417
- paddingRight: number;
418
- paddingTop: number;
419
- paddingBottom: number;
420
- borderRadius: number;
421
- };
422
- triggers: string[];
423
- props: {
424
- fieldName: {
425
- handlerPropName: string;
426
- group: string;
427
- label: string;
428
- description: string;
429
- formType: string;
430
- propType: string;
431
- defaultValue: string;
432
- valuePropName: string;
433
- editable: boolean;
434
- required: boolean;
435
- };
436
- allowFontScaling: {
437
- group: string;
438
- label: string;
439
- description: string;
440
- editable: boolean;
441
- required: boolean;
442
- defaultValue: null;
443
- formType: string;
444
- propType: string;
445
- };
446
- autoFocus: {
447
- group: string;
448
- label: string;
449
- description: string;
450
- editable: boolean;
451
- required: boolean;
452
- defaultValue: null;
453
- formType: string;
454
- propType: string;
455
- };
456
- caretHidden: {
457
- group: string;
458
- label: string;
459
- description: string;
460
- editable: boolean;
461
- required: boolean;
462
- defaultValue: null;
463
- formType: string;
464
- propType: string;
465
- };
466
- contextMenuHidden: {
467
- group: string;
468
- label: string;
469
- description: string;
470
- editable: boolean;
471
- required: boolean;
472
- defaultValue: null;
473
- formType: string;
474
- propType: string;
475
- };
476
- disabled: {
477
- group: string;
478
- label: string;
479
- description: string;
480
- formType: string;
481
- propType: string;
482
- defaultValue: null;
483
- editable: boolean;
484
- required: boolean;
485
- };
486
- editable: {
487
- group: string;
488
- label: string;
489
- description: string;
490
- editable: boolean;
491
- required: boolean;
492
- defaultValue: null;
493
- formType: string;
494
- propType: string;
495
- };
496
- keyboardAppearance: {
497
- group: string;
498
- label: string;
499
- description: string;
500
- editable: boolean;
501
- required: boolean;
502
- defaultValue: null;
503
- options: string[];
504
- formType: string;
505
- propType: string;
506
- };
507
- keyboardType: {
508
- group: string;
509
- label: string;
510
- description: string;
511
- editable: boolean;
512
- required: boolean;
513
- defaultValue: null;
514
- options: string[];
515
- formType: string;
516
- propType: string;
517
- };
518
- maxLength: {
519
- group: string;
520
- label: string;
521
- description: string;
522
- editable: boolean;
523
- required: boolean;
524
- defaultValue: null;
525
- min: number;
526
- step: number;
527
- precision: number;
528
- formType: string;
529
- propType: string;
530
- };
531
- placeholder: {
532
- group: string;
533
- label: string;
534
- description: string;
535
- editable: boolean;
536
- required: boolean;
537
- defaultValue: string;
538
- formType: string;
539
- propType: string;
540
- };
541
- placeholderTextColor: {
542
- group: string;
543
- label: string;
544
- description: string;
545
- editable: boolean;
546
- required: boolean;
547
- defaultValue: null;
548
- formType: string;
549
- propType: string;
550
- };
551
- returnKeyLabel: {
552
- group: string;
553
- label: string;
554
- description: string;
555
- editable: boolean;
556
- required: boolean;
557
- defaultValue: null;
558
- formType: string;
559
- propType: string;
560
- };
561
- returnKeyType: {
562
- group: string;
563
- label: string;
564
- description: string;
565
- editable: boolean;
566
- required: boolean;
567
- defaultValue: null;
568
- options: string[];
569
- formType: string;
570
- propType: string;
571
- };
572
- selectionColor: {
573
- group: string;
574
- label: string;
575
- description: string;
576
- editable: boolean;
577
- required: boolean;
578
- defaultValue: null;
579
- formType: string;
580
- propType: string;
581
- };
582
- selectTextOnFocus: {
583
- group: string;
584
- label: string;
585
- description: string;
586
- editable: boolean;
587
- required: boolean;
588
- defaultValue: null;
589
- formType: string;
590
- propType: string;
591
- };
592
- style: {
593
- group: string;
594
- label: string;
595
- description: string;
596
- editable: boolean;
597
- required: boolean;
598
- formType: string;
599
- propType: string;
600
- defaultValue: null;
601
- };
602
- clearButtonMode: {
603
- group: string;
604
- label: string;
605
- description: string;
606
- editable: boolean;
607
- required: boolean;
608
- options: string[];
609
- defaultValue: null;
610
- formType: string;
611
- propType: string;
612
- };
613
- clearTextOnFocus: {
614
- group: string;
615
- label: string;
616
- description: string;
617
- editable: boolean;
618
- required: boolean;
619
- defaultValue: null;
620
- formType: string;
621
- propType: string;
622
- };
623
- enablesReturnKeyAutomatically: {
624
- group: string;
625
- label: string;
626
- description: string;
627
- editable: boolean;
628
- required: boolean;
629
- defaultValue: null;
630
- formType: string;
631
- propType: string;
632
- };
633
- underlineColorAndroid: {
634
- group: string;
635
- label: string;
636
- description: string;
637
- editable: boolean;
638
- required: boolean;
639
- defaultValue: null;
640
- formType: string;
641
- propType: string;
642
- };
643
- };
644
- })[];
393
+ }[];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@draftbit/core",
3
- "version": "46.1.4-e6469c.0+e6469ca2",
3
+ "version": "46.2.1-327d47.2+327d47fe",
4
4
  "description": "Core (non-native) Components",
5
5
  "main": "lib/commonjs/index.js",
6
6
  "module": "lib/module/index.js",
@@ -41,7 +41,7 @@
41
41
  "dependencies": {
42
42
  "@date-io/date-fns": "^1.3.13",
43
43
  "@draftbit/react-theme-provider": "^2.1.1",
44
- "@draftbit/types": "^46.1.1",
44
+ "@draftbit/types": "^46.1.4",
45
45
  "@material-ui/core": "^4.11.0",
46
46
  "@material-ui/pickers": "^3.2.10",
47
47
  "@react-native-community/slider": "4.2.3",
@@ -79,5 +79,5 @@
79
79
  ]
80
80
  ]
81
81
  },
82
- "gitHead": "e6469ca2737c7bb1742ee5f5897d212003e00cdd"
82
+ "gitHead": "327d47feb57a60c010c5a43d7801150936787101"
83
83
  }
@@ -8,7 +8,7 @@ const ActionSheet = ({ visible = false, onClose, children }) => {
8
8
  React.createElement(Touchable, { style: styles.wrapper, onPress: onClose },
9
9
  React.createElement(View, { style: styles.overlay }),
10
10
  React.createElement(View, { style: styles.groupWrapper },
11
- React.createElement(View, { style: styles.group }, React.Children.toArray(children).filter((child) => child?.type !== ActionSheetCancel)),
11
+ React.createElement(View, { style: styles.group }, React.Children.toArray(children).filter((child) => (child === null || child === void 0 ? void 0 : child.type) !== ActionSheetCancel)),
12
12
  React.createElement(View, { style: styles.group }, React.Children.toArray(children).filter((child) => child.type === ActionSheetCancel)))))) : (React.createElement(React.Fragment, null));
13
13
  };
14
14
  const styles = StyleSheet.create({
@@ -15,9 +15,10 @@ function Pager({ color, index, length, }) {
15
15
  })));
16
16
  }
17
17
  function Carousel({ data, children, dotColor = "strong", style, ...rest }) {
18
+ var _a;
18
19
  const [index, setIndex] = React.useState(0);
19
20
  const length = React.Children.count(children);
20
- const itemsLength = (data?.length ?? 0) + length;
21
+ const itemsLength = ((_a = data === null || data === void 0 ? void 0 : data.length) !== null && _a !== void 0 ? _a : 0) + length;
21
22
  const slides = Array.isArray(data) ? data : [];
22
23
  const { width, height } = StyleSheet.flatten(style || {});
23
24
  const slideWidth = width || screenWidth;
@@ -35,7 +36,8 @@ function Carousel({ data, children, dotColor = "strong", style, ...rest }) {
35
36
  })
36
37
  : null,
37
38
  React.Children.map(children, (child) => {
38
- const s = child?.props?.style || {};
39
+ var _a;
40
+ const s = ((_a = child === null || child === void 0 ? void 0 : child.props) === null || _a === void 0 ? void 0 : _a.style) || {};
39
41
  return (React.createElement(View, { style: { width: slideWidth } }, React.cloneElement(child, {
40
42
  style: { ...s, width: slideWidth },
41
43
  })));
@@ -25,12 +25,12 @@ const Checkbox = ({ Icon, status, disabled = false, onPress, onCheck, onUncheck,
25
25
  const handlePress = () => {
26
26
  const newValue = !internalValue;
27
27
  setInternalValue(newValue);
28
- onPress?.(newValue);
28
+ onPress === null || onPress === void 0 ? void 0 : onPress(newValue);
29
29
  if (newValue) {
30
- onCheck?.();
30
+ onCheck === null || onCheck === void 0 ? void 0 : onCheck();
31
31
  }
32
32
  if (!newValue) {
33
- onUncheck?.();
33
+ onUncheck === null || onUncheck === void 0 ? void 0 : onUncheck();
34
34
  }
35
35
  };
36
36
  return (React.createElement(Touchable, { ...rest, onPress: handlePress, disabled: disabled, accessibilityState: { disabled }, accessibilityRole: "button", accessibilityLiveRegion: "polite", style: [styles.container, style, { width: size, height: size }] },
@@ -36,8 +36,8 @@ const CheckboxGroupRow = ({ Icon, label = "Label", status, value, onPress, label
36
36
  const isChecked = status || values.includes(value);
37
37
  const handlePress = () => {
38
38
  if (!disabled) {
39
- onPress?.(!isChecked);
40
- onValueChange?.(value, !isChecked);
39
+ onPress === null || onPress === void 0 ? void 0 : onPress(!isChecked);
40
+ onValueChange === null || onValueChange === void 0 ? void 0 : onValueChange(value, !isChecked);
41
41
  }
42
42
  };
43
43
  const { textStyles, viewStyles } = extractStyles(style);
@@ -37,12 +37,12 @@ const CheckboxRow = ({ label = "Label", labelStyle, labelContainerStyle, checkbo
37
37
  const handlePress = () => {
38
38
  const newValue = !internalValue;
39
39
  setInternalValue(newValue);
40
- onPress?.(newValue);
40
+ onPress === null || onPress === void 0 ? void 0 : onPress(newValue);
41
41
  if (newValue) {
42
- onCheck?.();
42
+ onCheck === null || onCheck === void 0 ? void 0 : onCheck();
43
43
  }
44
44
  if (!newValue) {
45
- onUncheck?.();
45
+ onUncheck === null || onUncheck === void 0 ? void 0 : onUncheck();
46
46
  }
47
47
  };
48
48
  const { textStyles, viewStyles } = extractStyles(style);
@@ -2,33 +2,36 @@ import React from "react";
2
2
  import { View } from "react-native";
3
3
  import { Svg, Path, G } from "react-native-svg";
4
4
  class CircularProgress extends React.Component {
5
- polarToCartesian = (centerX, centerY, radius, angleInDegrees) => {
6
- var angleInRadians = ((angleInDegrees - 90) * Math.PI) / 180.0;
7
- return {
8
- x: centerX + radius * Math.cos(angleInRadians),
9
- y: centerY + radius * Math.sin(angleInRadians),
5
+ constructor() {
6
+ super(...arguments);
7
+ this.polarToCartesian = (centerX, centerY, radius, angleInDegrees) => {
8
+ var angleInRadians = ((angleInDegrees - 90) * Math.PI) / 180.0;
9
+ return {
10
+ x: centerX + radius * Math.cos(angleInRadians),
11
+ y: centerY + radius * Math.sin(angleInRadians),
12
+ };
10
13
  };
11
- };
12
- circlePath = (x, y, radius, startAngle, endAngle) => {
13
- var start = this.polarToCartesian(x, y, radius, endAngle * 0.9999);
14
- var end = this.polarToCartesian(x, y, radius, startAngle);
15
- var largeArcFlag = endAngle - startAngle <= 180 ? "0" : "1";
16
- var d = [
17
- "M",
18
- start.x,
19
- start.y,
20
- "A",
21
- radius,
22
- radius,
23
- 0,
24
- largeArcFlag,
25
- 0,
26
- end.x,
27
- end.y,
28
- ];
29
- return d.join(" ");
30
- };
31
- clampFill = (fill) => Math.min(100, Math.max(0, fill));
14
+ this.circlePath = (x, y, radius, startAngle, endAngle) => {
15
+ var start = this.polarToCartesian(x, y, radius, endAngle * 0.9999);
16
+ var end = this.polarToCartesian(x, y, radius, startAngle);
17
+ var largeArcFlag = endAngle - startAngle <= 180 ? "0" : "1";
18
+ var d = [
19
+ "M",
20
+ start.x,
21
+ start.y,
22
+ "A",
23
+ radius,
24
+ radius,
25
+ 0,
26
+ largeArcFlag,
27
+ 0,
28
+ end.x,
29
+ end.y,
30
+ ];
31
+ return d.join(" ");
32
+ };
33
+ this.clampFill = (fill) => Math.min(100, Math.max(0, fill));
34
+ }
32
35
  render() {
33
36
  const { size, width, backgroundWidth, tintColor = "black", tintTransparency = true, backgroundColor, style, rotation = 90, lineCap = "butt", arcSweepAngle = 360, fill, children, childrenContainerStyle, padding = 0, renderCap, dashedBackground = { width: 0, gap: 0 }, dashedTint = { width: 0, gap: 0 }, } = this.props;
34
37
  const maxWidthCircle = backgroundWidth
@@ -40,7 +40,7 @@ const DatePicker = ({ Icon, style, theme: { colors, typography, roundness, disab
40
40
  if (!value) {
41
41
  return new Date();
42
42
  }
43
- return typeof value?.getMonth === "function" ? value : new Date();
43
+ return typeof (value === null || value === void 0 ? void 0 : value.getMonth) === "function" ? value : new Date();
44
44
  };
45
45
  const formatDate = () => {
46
46
  if (!value)
@@ -34,7 +34,7 @@ const NumberInput = ({ onChangeText, value, defaultValue, ...props }) => {
34
34
  const newStringNumberValue = formatValueToStringNumber(newValue);
35
35
  const number = parseFloat(newStringNumberValue);
36
36
  setCurrentStringNumberValue(newStringNumberValue);
37
- onChangeText?.(number);
37
+ onChangeText === null || onChangeText === void 0 ? void 0 : onChangeText(number);
38
38
  };
39
39
  // run handleChangeText with value prop only when value prop changes (and first render to reset currentStringNumberValue)
40
40
  useEffect(() => {
@@ -36,6 +36,7 @@ const unstyledColor = "rgba(165, 173, 183, 1)";
36
36
  const disabledColor = "rgb(240, 240, 240)";
37
37
  const errorColor = "rgba(255, 69, 100, 1)";
38
38
  const Picker = ({ error, options = [], onValueChange, defaultValue, Icon, style, placeholder, value, disabled = false, theme, assistiveText, label, iconColor = unstyledColor, iconSize = 24, leftIconMode = "inset", leftIconName, placeholderTextColor = unstyledColor, rightIconName, type = "solid", }) => {
39
+ var _a, _b;
39
40
  const androidPickerRef = React.useRef(undefined);
40
41
  const [internalValue, setInternalValue] = React.useState(value || defaultValue);
41
42
  const [pickerVisible, setPickerVisible] = React.useState(false);
@@ -53,8 +54,9 @@ const Picker = ({ error, options = [], onValueChange, defaultValue, Icon, style,
53
54
  }
54
55
  }, [defaultValue]);
55
56
  React.useEffect(() => {
57
+ var _a;
56
58
  if (pickerVisible && androidPickerRef.current) {
57
- androidPickerRef?.current?.focus();
59
+ (_a = androidPickerRef === null || androidPickerRef === void 0 ? void 0 : androidPickerRef.current) === null || _a === void 0 ? void 0 : _a.focus();
58
60
  }
59
61
  }, [pickerVisible, androidPickerRef]);
60
62
  const normalizedOptions = normalizeOptions(options);
@@ -113,10 +115,8 @@ const Picker = ({ error, options = [], onValueChange, defaultValue, Icon, style,
113
115
  ...additionalBorderStyles,
114
116
  ...additionalMarginStyles,
115
117
  ]);
116
- const optionExists = internalValue
117
- ? pickerOptions.find((option) => option.value === internalValue)
118
- : { label: null };
119
- const selectedLabel = optionExists && optionExists.label ? optionExists.label : placeholder;
118
+ const selectedLabel = internalValue &&
119
+ ((_b = (_a = pickerOptions.find((option) => option.value === internalValue)) === null || _a === void 0 ? void 0 : _a.label) !== null && _b !== void 0 ? _b : internalValue);
120
120
  const labelText = label ? (React.createElement(Text, { style: {
121
121
  textAlign: textStyles.textAlign,
122
122
  color: unstyledColor,
@@ -132,7 +132,7 @@ const Picker = ({ error, options = [], onValueChange, defaultValue, Icon, style,
132
132
  marginRight: -10,
133
133
  marginLeft: 8,
134
134
  } })) : null;
135
- const textAlign = textStyles?.textAlign;
135
+ const textAlign = textStyles === null || textStyles === void 0 ? void 0 : textStyles.textAlign;
136
136
  const calculateLeftPadding = () => {
137
137
  if (leftIconOutset) {
138
138
  if (textAlign === "center") {
@@ -159,7 +159,7 @@ const Picker = ({ error, options = [], onValueChange, defaultValue, Icon, style,
159
159
  };
160
160
  const handleValueChange = (newValue, itemIndex) => {
161
161
  if (!placeholder || itemIndex > 0) {
162
- onValueChange?.(newValue, itemIndex);
162
+ onValueChange === null || onValueChange === void 0 ? void 0 : onValueChange(newValue, itemIndex);
163
163
  }
164
164
  setInternalValue(newValue);
165
165
  };
@@ -179,7 +179,7 @@ const Picker = ({ error, options = [], onValueChange, defaultValue, Icon, style,
179
179
  ] },
180
180
  React.createElement(View, { style: styles.primaryTextContainer },
181
181
  labelText,
182
- React.createElement(Text, { style: primaryTextStyle }, String(selectedLabel))),
182
+ React.createElement(Text, { style: primaryTextStyle }, String(selectedLabel !== null && selectedLabel !== void 0 ? selectedLabel : placeholder))),
183
183
  rightIcon)),
184
184
  assistiveTextLabel),
185
185
  isIos && pickerVisible ? (React.createElement(Portal, null,
@@ -212,12 +212,12 @@ const Picker: React.FC<PickerProps> = ({
212
212
  ...additionalMarginStyles,
213
213
  ]);
214
214
 
215
- const optionExists = internalValue
216
- ? pickerOptions.find((option) => option.value === internalValue)
217
- : { label: null };
218
-
219
215
  const selectedLabel =
220
- optionExists && optionExists.label ? optionExists.label : placeholder;
216
+ internalValue &&
217
+ ((pickerOptions as unknown as PickerOption[]).find(
218
+ (option) => option.value === internalValue
219
+ )?.label ??
220
+ internalValue);
221
221
 
222
222
  const labelText = label ? (
223
223
  <Text
@@ -333,7 +333,9 @@ const Picker: React.FC<PickerProps> = ({
333
333
  <View style={styles.primaryTextContainer}>
334
334
  {labelText}
335
335
 
336
- <Text style={primaryTextStyle}>{String(selectedLabel)}</Text>
336
+ <Text style={primaryTextStyle}>
337
+ {String(selectedLabel ?? placeholder)}
338
+ </Text>
337
339
  </View>
338
340
 
339
341
  {rightIcon}
@@ -0,0 +1,69 @@
1
+ import * as React from "react";
2
+ import { View, StyleSheet } from "react-native";
3
+ import omit from "lodash.omit";
4
+ import { withTheme } from "../../theming";
5
+ import { Picker as NativePicker } from "@react-native-picker/picker";
6
+ import { extractStyles } from "../../utilities";
7
+ import TextField from "../TextField";
8
+ import Touchable from "../Touchable";
9
+ const Picker = ({ style, options, placeholder, selectedValue, disabled = false, onValueChange: onValueChangeOverride = () => { }, ...props }) => {
10
+ var _a, _b;
11
+ const { viewStyles: { borderRadius, // eslint-disable-line @typescript-eslint/no-unused-vars
12
+ borderWidth, // eslint-disable-line @typescript-eslint/no-unused-vars
13
+ borderTopWidth, // eslint-disable-line @typescript-eslint/no-unused-vars
14
+ borderRightWidth, // eslint-disable-line @typescript-eslint/no-unused-vars
15
+ borderBottomWidth, // eslint-disable-line @typescript-eslint/no-unused-vars
16
+ borderLeftWidth, // eslint-disable-line @typescript-eslint/no-unused-vars
17
+ borderColor, // eslint-disable-line @typescript-eslint/no-unused-vars
18
+ backgroundColor, // eslint-disable-line @typescript-eslint/no-unused-vars
19
+ padding, // eslint-disable-line @typescript-eslint/no-unused-vars
20
+ paddingTop, // eslint-disable-line @typescript-eslint/no-unused-vars
21
+ paddingRight, // eslint-disable-line @typescript-eslint/no-unused-vars
22
+ paddingBottom, // eslint-disable-line @typescript-eslint/no-unused-vars
23
+ paddingLeft, // eslint-disable-line @typescript-eslint/no-unused-vars
24
+ ...viewStyles }, } = extractStyles(style);
25
+ const textField = React.useRef(undefined);
26
+ const onValueChange = (itemValue, itemIndex) => {
27
+ toggleFocus();
28
+ onValueChangeOverride(itemValue, itemIndex);
29
+ };
30
+ const toggleFocus = () => {
31
+ if (!disabled) {
32
+ // @ts-ignore
33
+ textField.current.toggleFocus(); // cannot determine if method exists due to component being wrapped in a withTheme()
34
+ }
35
+ };
36
+ const stylesWithoutMargin = style &&
37
+ omit(StyleSheet.flatten(style), [
38
+ "margin",
39
+ "marginTop",
40
+ "marginRight",
41
+ "marginBottom",
42
+ "marginLeft",
43
+ ]);
44
+ const selectedLabel = selectedValue &&
45
+ ((_b = (_a = options.find((o) => o.value === selectedValue)) === null || _a === void 0 ? void 0 : _a.label) !== null && _b !== void 0 ? _b : selectedValue);
46
+ return (React.createElement(Touchable, { disabled: disabled, onPress: toggleFocus, style: [styles.container, viewStyles] },
47
+ React.createElement(View, null,
48
+ React.createElement(NativePicker, { enabled: !disabled, selectedValue: selectedValue, onValueChange: onValueChange, style: {
49
+ opacity: 0,
50
+ position: "absolute",
51
+ top: 0,
52
+ left: 0,
53
+ right: 0,
54
+ bottom: 0,
55
+ width: "100%",
56
+ } }, options.map((o) => (React.createElement(NativePicker.Item, { label: o.label, value: o.value, key: o.value })))),
57
+ React.createElement(View, { pointerEvents: "none" },
58
+ React.createElement(TextField, { ...props, value: selectedLabel, placeholder: placeholder,
59
+ // @ts-ignore
60
+ ref: textField, disabled: disabled,
61
+ // @ts-expect-error
62
+ style: stylesWithoutMargin })))));
63
+ };
64
+ const styles = StyleSheet.create({
65
+ container: {
66
+ alignSelf: "stretch",
67
+ },
68
+ });
69
+ export default withTheme(Picker);