@webority-technologies/mobile 0.0.14 → 0.0.20

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 (202) hide show
  1. package/lib/commonjs/components/Accordion/Accordion.js +60 -19
  2. package/lib/commonjs/components/AppBar/AppBar.js +29 -20
  3. package/lib/commonjs/components/Avatar/Avatar.js +38 -8
  4. package/lib/commonjs/components/Badge/Badge.js +66 -4
  5. package/lib/commonjs/components/Banner/Banner.js +146 -66
  6. package/lib/commonjs/components/BottomNavigation/BottomNavigation.js +37 -15
  7. package/lib/commonjs/components/BottomSheet/BottomSheet.js +85 -50
  8. package/lib/commonjs/components/Button/Button.js +12 -5
  9. package/lib/commonjs/components/Card/Card.js +106 -16
  10. package/lib/commonjs/components/Carousel/Carousel.js +66 -12
  11. package/lib/commonjs/components/Checkbox/Checkbox.js +11 -7
  12. package/lib/commonjs/components/Chip/Chip.js +44 -12
  13. package/lib/commonjs/components/DatePicker/DatePicker.js +185 -76
  14. package/lib/commonjs/components/DateRangePicker/DateRangePicker.js +133 -59
  15. package/lib/commonjs/components/Dialog/Dialog.js +16 -10
  16. package/lib/commonjs/components/Drawer/Drawer.js +13 -10
  17. package/lib/commonjs/components/FieldBase/FieldBase.js +306 -0
  18. package/lib/commonjs/components/FieldBase/index.js +32 -0
  19. package/lib/commonjs/components/FloatingActionButton/FloatingActionButton.js +69 -44
  20. package/lib/commonjs/components/ForceUpdateDialog/ForceUpdateDialog.js +8 -2
  21. package/lib/commonjs/components/FormField/FormField.js +3 -2
  22. package/lib/commonjs/components/ImageGallery/ImageGallery.js +132 -44
  23. package/lib/commonjs/components/Input/Input.js +144 -181
  24. package/lib/commonjs/components/ListItem/ListItem.js +90 -11
  25. package/lib/commonjs/components/Modal/Modal.js +55 -27
  26. package/lib/commonjs/components/NumberInput/NumberInput.js +60 -106
  27. package/lib/commonjs/components/OTPInput/OTPInput.js +65 -58
  28. package/lib/commonjs/components/PickerTrigger/PickerTrigger.js +185 -0
  29. package/lib/commonjs/components/{AppIcon → PickerTrigger}/index.js +4 -4
  30. package/lib/commonjs/components/ProgressBar/ProgressBar.js +19 -11
  31. package/lib/commonjs/components/Radio/Radio.js +11 -6
  32. package/lib/commonjs/components/Rating/Rating.js +85 -19
  33. package/lib/commonjs/components/SearchBar/SearchBar.js +84 -107
  34. package/lib/commonjs/components/SegmentedControl/SegmentedControl.js +22 -11
  35. package/lib/commonjs/components/Select/Select.js +62 -91
  36. package/lib/commonjs/components/Skeleton/Skeleton.js +131 -174
  37. package/lib/commonjs/components/Skeleton/SkeletonClock.js +117 -0
  38. package/lib/commonjs/components/Skeleton/SkeletonContent.js +164 -81
  39. package/lib/commonjs/components/Skeleton/SkeletonProvider.js +72 -10
  40. package/lib/commonjs/components/Skeleton/index.js +17 -16
  41. package/lib/commonjs/components/Slider/Slider.js +44 -25
  42. package/lib/commonjs/components/Stepper/Stepper.js +199 -29
  43. package/lib/commonjs/components/Swipeable/Swipeable.js +36 -19
  44. package/lib/commonjs/components/Switch/Switch.js +9 -2
  45. package/lib/commonjs/components/Tabs/Tabs.js +84 -21
  46. package/lib/commonjs/components/TimePicker/TimePicker.js +123 -45
  47. package/lib/commonjs/components/Toast/Toast.js +27 -16
  48. package/lib/commonjs/components/Tooltip/Tooltip.js +56 -32
  49. package/lib/commonjs/components/index.js +37 -37
  50. package/lib/commonjs/theme/tokens.js +55 -7
  51. package/lib/module/components/Accordion/Accordion.js +61 -20
  52. package/lib/module/components/AppBar/AppBar.js +29 -20
  53. package/lib/module/components/Avatar/Avatar.js +39 -9
  54. package/lib/module/components/Badge/Badge.js +67 -5
  55. package/lib/module/components/Banner/Banner.js +147 -67
  56. package/lib/module/components/BottomNavigation/BottomNavigation.js +37 -15
  57. package/lib/module/components/BottomSheet/BottomSheet.js +87 -52
  58. package/lib/module/components/Button/Button.js +12 -5
  59. package/lib/module/components/Card/Card.js +107 -17
  60. package/lib/module/components/Carousel/Carousel.js +67 -13
  61. package/lib/module/components/Checkbox/Checkbox.js +11 -7
  62. package/lib/module/components/Chip/Chip.js +45 -13
  63. package/lib/module/components/DatePicker/DatePicker.js +185 -76
  64. package/lib/module/components/DateRangePicker/DateRangePicker.js +134 -60
  65. package/lib/module/components/Dialog/Dialog.js +16 -10
  66. package/lib/module/components/Drawer/Drawer.js +13 -10
  67. package/lib/module/components/FieldBase/FieldBase.js +297 -0
  68. package/lib/module/components/FieldBase/index.js +4 -0
  69. package/lib/module/components/FloatingActionButton/FloatingActionButton.js +69 -44
  70. package/lib/module/components/ForceUpdateDialog/ForceUpdateDialog.js +8 -2
  71. package/lib/module/components/FormField/FormField.js +3 -2
  72. package/lib/module/components/ImageGallery/ImageGallery.js +128 -40
  73. package/lib/module/components/Input/Input.js +144 -179
  74. package/lib/module/components/ListItem/ListItem.js +91 -12
  75. package/lib/module/components/Modal/Modal.js +55 -27
  76. package/lib/module/components/NumberInput/NumberInput.js +60 -106
  77. package/lib/module/components/OTPInput/OTPInput.js +65 -58
  78. package/lib/module/components/PickerTrigger/PickerTrigger.js +181 -0
  79. package/lib/module/components/PickerTrigger/index.js +4 -0
  80. package/lib/module/components/ProgressBar/ProgressBar.js +19 -11
  81. package/lib/module/components/Radio/Radio.js +11 -6
  82. package/lib/module/components/Rating/Rating.js +86 -20
  83. package/lib/module/components/SearchBar/SearchBar.js +84 -107
  84. package/lib/module/components/SegmentedControl/SegmentedControl.js +22 -11
  85. package/lib/module/components/Select/Select.js +62 -91
  86. package/lib/module/components/Skeleton/Skeleton.js +135 -175
  87. package/lib/module/components/Skeleton/SkeletonClock.js +110 -0
  88. package/lib/module/components/Skeleton/SkeletonContent.js +167 -84
  89. package/lib/module/components/Skeleton/SkeletonProvider.js +71 -10
  90. package/lib/module/components/Skeleton/index.js +3 -2
  91. package/lib/module/components/Slider/Slider.js +44 -25
  92. package/lib/module/components/Stepper/Stepper.js +201 -31
  93. package/lib/module/components/Swipeable/Swipeable.js +36 -19
  94. package/lib/module/components/Switch/Switch.js +9 -2
  95. package/lib/module/components/Tabs/Tabs.js +84 -21
  96. package/lib/module/components/TimePicker/TimePicker.js +123 -45
  97. package/lib/module/components/Toast/Toast.js +27 -16
  98. package/lib/module/components/Tooltip/Tooltip.js +56 -32
  99. package/lib/module/components/index.js +2 -2
  100. package/lib/module/theme/tokens.js +55 -7
  101. package/lib/typescript/commonjs/components/Accordion/Accordion.d.ts +10 -5
  102. package/lib/typescript/commonjs/components/AppBar/AppBar.d.ts +8 -0
  103. package/lib/typescript/commonjs/components/Avatar/Avatar.d.ts +12 -6
  104. package/lib/typescript/commonjs/components/Badge/Badge.d.ts +7 -6
  105. package/lib/typescript/commonjs/components/Banner/Banner.d.ts +17 -6
  106. package/lib/typescript/commonjs/components/BottomSheet/BottomSheet.d.ts +7 -0
  107. package/lib/typescript/commonjs/components/Card/Card.d.ts +17 -6
  108. package/lib/typescript/commonjs/components/Carousel/Carousel.d.ts +7 -6
  109. package/lib/typescript/commonjs/components/Checkbox/Checkbox.d.ts +9 -1
  110. package/lib/typescript/commonjs/components/Chip/Chip.d.ts +13 -6
  111. package/lib/typescript/commonjs/components/DatePicker/DatePicker.d.ts +38 -3
  112. package/lib/typescript/commonjs/components/DateRangePicker/DateRangePicker.d.ts +36 -3
  113. package/lib/typescript/commonjs/components/Dialog/Dialog.d.ts +13 -1
  114. package/lib/typescript/commonjs/components/FieldBase/FieldBase.d.ts +141 -0
  115. package/lib/typescript/commonjs/components/FieldBase/index.d.ts +3 -0
  116. package/lib/typescript/commonjs/components/FloatingActionButton/FloatingActionButton.d.ts +8 -6
  117. package/lib/typescript/commonjs/components/FloatingActionButton/index.d.ts +1 -1
  118. package/lib/typescript/commonjs/components/ForceUpdateDialog/ForceUpdateDialog.d.ts +7 -0
  119. package/lib/typescript/commonjs/components/FormField/FormField.d.ts +7 -0
  120. package/lib/typescript/commonjs/components/ImageGallery/ImageGallery.d.ts +6 -4
  121. package/lib/typescript/commonjs/components/Input/Input.d.ts +6 -0
  122. package/lib/typescript/commonjs/components/ListItem/ListItem.d.ts +13 -6
  123. package/lib/typescript/commonjs/components/NumberInput/NumberInput.d.ts +3 -0
  124. package/lib/typescript/commonjs/components/PickerTrigger/PickerTrigger.d.ts +57 -0
  125. package/lib/typescript/commonjs/components/PickerTrigger/index.d.ts +3 -0
  126. package/lib/typescript/commonjs/components/ProgressBar/ProgressBar.d.ts +2 -0
  127. package/lib/typescript/commonjs/components/Radio/Radio.d.ts +3 -0
  128. package/lib/typescript/commonjs/components/Rating/Rating.d.ts +9 -6
  129. package/lib/typescript/commonjs/components/SegmentedControl/SegmentedControl.d.ts +3 -0
  130. package/lib/typescript/commonjs/components/Skeleton/Skeleton.d.ts +49 -20
  131. package/lib/typescript/commonjs/components/Skeleton/SkeletonClock.d.ts +60 -0
  132. package/lib/typescript/commonjs/components/Skeleton/SkeletonContent.d.ts +80 -19
  133. package/lib/typescript/commonjs/components/Skeleton/SkeletonProvider.d.ts +39 -5
  134. package/lib/typescript/commonjs/components/Skeleton/index.d.ts +6 -4
  135. package/lib/typescript/commonjs/components/Slider/Slider.d.ts +12 -1
  136. package/lib/typescript/commonjs/components/Stepper/Stepper.d.ts +18 -6
  137. package/lib/typescript/commonjs/components/Swipeable/Swipeable.d.ts +2 -0
  138. package/lib/typescript/commonjs/components/Switch/Switch.d.ts +1 -0
  139. package/lib/typescript/commonjs/components/Tabs/Tabs.d.ts +26 -2
  140. package/lib/typescript/commonjs/components/TimePicker/TimePicker.d.ts +36 -3
  141. package/lib/typescript/commonjs/components/Toast/Toast.d.ts +8 -0
  142. package/lib/typescript/commonjs/components/Tooltip/Tooltip.d.ts +7 -1
  143. package/lib/typescript/commonjs/components/index.d.ts +5 -5
  144. package/lib/typescript/commonjs/index.d.ts +1 -1
  145. package/lib/typescript/commonjs/theme/index.d.ts +1 -1
  146. package/lib/typescript/commonjs/theme/types.d.ts +553 -11
  147. package/lib/typescript/module/components/Accordion/Accordion.d.ts +10 -5
  148. package/lib/typescript/module/components/AppBar/AppBar.d.ts +8 -0
  149. package/lib/typescript/module/components/Avatar/Avatar.d.ts +12 -6
  150. package/lib/typescript/module/components/Badge/Badge.d.ts +7 -6
  151. package/lib/typescript/module/components/Banner/Banner.d.ts +17 -6
  152. package/lib/typescript/module/components/BottomSheet/BottomSheet.d.ts +7 -0
  153. package/lib/typescript/module/components/Card/Card.d.ts +17 -6
  154. package/lib/typescript/module/components/Carousel/Carousel.d.ts +7 -6
  155. package/lib/typescript/module/components/Checkbox/Checkbox.d.ts +9 -1
  156. package/lib/typescript/module/components/Chip/Chip.d.ts +13 -6
  157. package/lib/typescript/module/components/DatePicker/DatePicker.d.ts +38 -3
  158. package/lib/typescript/module/components/DateRangePicker/DateRangePicker.d.ts +36 -3
  159. package/lib/typescript/module/components/Dialog/Dialog.d.ts +13 -1
  160. package/lib/typescript/module/components/FieldBase/FieldBase.d.ts +141 -0
  161. package/lib/typescript/module/components/FieldBase/index.d.ts +3 -0
  162. package/lib/typescript/module/components/FloatingActionButton/FloatingActionButton.d.ts +8 -6
  163. package/lib/typescript/module/components/FloatingActionButton/index.d.ts +1 -1
  164. package/lib/typescript/module/components/ForceUpdateDialog/ForceUpdateDialog.d.ts +7 -0
  165. package/lib/typescript/module/components/FormField/FormField.d.ts +7 -0
  166. package/lib/typescript/module/components/ImageGallery/ImageGallery.d.ts +6 -4
  167. package/lib/typescript/module/components/Input/Input.d.ts +6 -0
  168. package/lib/typescript/module/components/ListItem/ListItem.d.ts +13 -6
  169. package/lib/typescript/module/components/NumberInput/NumberInput.d.ts +3 -0
  170. package/lib/typescript/module/components/PickerTrigger/PickerTrigger.d.ts +57 -0
  171. package/lib/typescript/module/components/PickerTrigger/index.d.ts +3 -0
  172. package/lib/typescript/module/components/ProgressBar/ProgressBar.d.ts +2 -0
  173. package/lib/typescript/module/components/Radio/Radio.d.ts +3 -0
  174. package/lib/typescript/module/components/Rating/Rating.d.ts +9 -6
  175. package/lib/typescript/module/components/SegmentedControl/SegmentedControl.d.ts +3 -0
  176. package/lib/typescript/module/components/Skeleton/Skeleton.d.ts +49 -20
  177. package/lib/typescript/module/components/Skeleton/SkeletonClock.d.ts +60 -0
  178. package/lib/typescript/module/components/Skeleton/SkeletonContent.d.ts +80 -19
  179. package/lib/typescript/module/components/Skeleton/SkeletonProvider.d.ts +39 -5
  180. package/lib/typescript/module/components/Skeleton/index.d.ts +6 -4
  181. package/lib/typescript/module/components/Slider/Slider.d.ts +12 -1
  182. package/lib/typescript/module/components/Stepper/Stepper.d.ts +18 -6
  183. package/lib/typescript/module/components/Swipeable/Swipeable.d.ts +2 -0
  184. package/lib/typescript/module/components/Switch/Switch.d.ts +1 -0
  185. package/lib/typescript/module/components/Tabs/Tabs.d.ts +26 -2
  186. package/lib/typescript/module/components/TimePicker/TimePicker.d.ts +36 -3
  187. package/lib/typescript/module/components/Toast/Toast.d.ts +8 -0
  188. package/lib/typescript/module/components/Tooltip/Tooltip.d.ts +7 -1
  189. package/lib/typescript/module/components/index.d.ts +5 -5
  190. package/lib/typescript/module/index.d.ts +1 -1
  191. package/lib/typescript/module/theme/index.d.ts +1 -1
  192. package/lib/typescript/module/theme/types.d.ts +553 -11
  193. package/package.json +2 -6
  194. package/lib/commonjs/components/AppIcon/AppIcon.js +0 -120
  195. package/lib/commonjs/types/vector-icons.d.js +0 -2
  196. package/lib/module/components/AppIcon/AppIcon.js +0 -111
  197. package/lib/module/components/AppIcon/index.js +0 -4
  198. package/lib/module/types/vector-icons.d.js +0 -2
  199. package/lib/typescript/commonjs/components/AppIcon/AppIcon.d.ts +0 -20
  200. package/lib/typescript/commonjs/components/AppIcon/index.d.ts +0 -3
  201. package/lib/typescript/module/components/AppIcon/AppIcon.d.ts +0 -20
  202. package/lib/typescript/module/components/AppIcon/index.d.ts +0 -3
@@ -6,10 +6,13 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports.default = exports.Modal = void 0;
7
7
  var _react = _interopRequireWildcard(require("react"));
8
8
  var _reactNative = require("react-native");
9
+ var _reactNativeSafeAreaContext = require("react-native-safe-area-context");
9
10
  var _index = require("../../theme/index.js");
10
11
  var _hapticUtils = require("../../utils/hapticUtils.js");
11
12
  var _jsxRuntime = require("react/jsx-runtime");
12
13
  function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
14
+ // Local shape mirror — see types.ts ModalTokens for the canonical definition.
15
+
13
16
  const Modal = exports.Modal = /*#__PURE__*/(0, _react.forwardRef)((props, ref) => {
14
17
  const {
15
18
  visible,
@@ -27,10 +30,14 @@ const Modal = exports.Modal = /*#__PURE__*/(0, _react.forwardRef)((props, ref) =
27
30
  testID
28
31
  } = props;
29
32
  const theme = (0, _index.useTheme)();
33
+ const insets = (0, _reactNativeSafeAreaContext.useSafeAreaInsets)();
30
34
  const duration = animationDuration ?? theme.motion.duration.normal;
31
35
  const screenHeight = _reactNative.Dimensions.get('window').height;
36
+ const modalTokens = theme.components.modal;
37
+ const scaleStartValue = modalTokens?.scaleStartValue ?? 0.9;
38
+ const backdropHaptic = modalTokens?.backdropHaptic ?? false;
32
39
  const backdropAnim = (0, _react.useRef)((0, _index.createAnimatedValue)(0)).current;
33
- const scaleAnim = (0, _react.useRef)((0, _index.createAnimatedValue)(0.9)).current;
40
+ const scaleAnim = (0, _react.useRef)((0, _index.createAnimatedValue)(scaleStartValue)).current;
34
41
  const opacityAnim = (0, _react.useRef)((0, _index.createAnimatedValue)(0)).current;
35
42
  const translateYAnim = (0, _react.useRef)((0, _index.createAnimatedValue)(screenHeight)).current;
36
43
  const containerRef = (0, _react.useRef)(null);
@@ -38,10 +45,16 @@ const Modal = exports.Modal = /*#__PURE__*/(0, _react.forwardRef)((props, ref) =
38
45
  const styles = (0, _react.useMemo)(() => buildStyles(theme), [theme]);
39
46
  (0, _react.useEffect)(() => {
40
47
  if (visible) {
48
+ // Two Fabric quirks force this combination: backdrop View needs
49
+ // `collapsable={false}` (see render) so flattening doesn't drop it,
50
+ // AND opacity must run on the JS driver — native-driver opacity on an
51
+ // Animated.View that also sets backgroundColor inline renders as 0 on
52
+ // RN 0.85 / Fabric / iOS, leaving the dim layer invisible. Single
53
+ // 240ms tween — JS thread cost is negligible.
41
54
  _reactNative.Animated.timing(backdropAnim, {
42
55
  toValue: 1,
43
56
  duration,
44
- useNativeDriver: true
57
+ useNativeDriver: false
45
58
  }).start();
46
59
  if (presentation === 'bottom') {
47
60
  _reactNative.Animated.spring(translateYAnim, {
@@ -65,12 +78,14 @@ const Modal = exports.Modal = /*#__PURE__*/(0, _react.forwardRef)((props, ref) =
65
78
  })]).start();
66
79
  }
67
80
  } else {
68
- (0, _index.setNativeValue)(backdropAnim, 0);
69
- (0, _index.setNativeValue)(scaleAnim, 0.9);
81
+ // backdropAnim is JS-driven (see note above) — reset directly so a
82
+ // zero-duration native timing doesn't re-claim the value.
83
+ backdropAnim.setValue(0);
84
+ (0, _index.setNativeValue)(scaleAnim, scaleStartValue);
70
85
  (0, _index.setNativeValue)(opacityAnim, 0);
71
86
  (0, _index.setNativeValue)(translateYAnim, screenHeight);
72
87
  }
73
- }, [visible, presentation, duration, backdropAnim, scaleAnim, opacityAnim, translateYAnim, screenHeight, theme.motion.spring.gentle.damping, theme.motion.spring.gentle.stiffness, theme.motion.spring.gentle.mass]);
88
+ }, [visible, presentation, duration, backdropAnim, scaleAnim, opacityAnim, translateYAnim, screenHeight, theme.motion.spring.gentle.damping, theme.motion.spring.gentle.stiffness, theme.motion.spring.gentle.mass, scaleStartValue]);
74
89
 
75
90
  // Accessibility focus trap: when the modal opens, push screen-reader focus
76
91
  // into the dialog container after the mount animation; when it closes,
@@ -105,9 +120,9 @@ const Modal = exports.Modal = /*#__PURE__*/(0, _react.forwardRef)((props, ref) =
105
120
  }, [visible, duration, restoreFocusRef]);
106
121
  const handleBackdropPress = (0, _react.useCallback)(() => {
107
122
  if (!backdropPressClose) return;
108
- (0, _hapticUtils.triggerHaptic)('selection');
123
+ if (backdropHaptic) (0, _hapticUtils.triggerHaptic)('selection');
109
124
  onRequestClose();
110
- }, [backdropPressClose, onRequestClose]);
125
+ }, [backdropPressClose, onRequestClose, backdropHaptic]);
111
126
  const handleHardwareBack = (0, _react.useCallback)(() => {
112
127
  if (hardwareBackPress) {
113
128
  onRequestClose();
@@ -120,11 +135,15 @@ const Modal = exports.Modal = /*#__PURE__*/(0, _react.forwardRef)((props, ref) =
120
135
  }];
121
136
  }
122
137
  if (presentation === 'bottom') {
138
+ // paddingBottom includes the Android navigation-bar / iOS home-indicator
139
+ // inset so sheet content never lands behind the system chrome.
123
140
  return [styles.bottomContent, {
124
141
  backgroundColor: theme.colors.background.elevated,
125
142
  borderTopLeftRadius: theme.radius.xl,
126
143
  borderTopRightRadius: theme.radius.xl,
127
- padding: theme.spacing.lg
144
+ paddingTop: theme.spacing.lg,
145
+ paddingHorizontal: theme.spacing.lg,
146
+ paddingBottom: theme.spacing.lg + insets.bottom
128
147
  }, theme.shadows.xl];
129
148
  }
130
149
  return [styles.centeredContent, {
@@ -132,7 +151,7 @@ const Modal = exports.Modal = /*#__PURE__*/(0, _react.forwardRef)((props, ref) =
132
151
  borderRadius: theme.radius.xl,
133
152
  padding: theme.spacing.xl
134
153
  }, theme.shadows.xl];
135
- }, [presentation, theme, styles]);
154
+ }, [presentation, theme, styles, insets.bottom]);
136
155
  const wrapperStyle = (0, _react.useMemo)(() => {
137
156
  if (presentation === 'bottom') return styles.bottomWrapper;
138
157
  if (presentation === 'fullScreen') return styles.fullScreenWrapper;
@@ -161,11 +180,19 @@ const Modal = exports.Modal = /*#__PURE__*/(0, _react.forwardRef)((props, ref) =
161
180
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Modal, {
162
181
  visible: visible,
163
182
  transparent: true,
164
- statusBarTranslucent: true,
183
+ statusBarTranslucent: true
184
+ // Android-only API (RN 0.71+). On iOS the prop is harmless / ignored.
185
+ // Lets the backdrop and sheet extend behind the system navigation bar
186
+ // so the dim layer covers the entire screen and gesture-nav devices
187
+ // don't show a gap under the sheet.
188
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
189
+ // @ts-ignore — typed in RN 0.73+, the runtime prop exists on 0.71+
190
+ ,
191
+ navigationBarTranslucent: true,
165
192
  animationType: "none",
166
193
  onRequestClose: handleHardwareBack,
167
194
  testID: testID,
168
- children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
195
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
169
196
  ref: node => {
170
197
  containerRef.current = node;
171
198
  if (typeof ref === 'function') {
@@ -177,32 +204,33 @@ const Modal = exports.Modal = /*#__PURE__*/(0, _react.forwardRef)((props, ref) =
177
204
  style: styles.root,
178
205
  accessible: true,
179
206
  accessibilityViewIsModal: true,
180
- accessibilityRole: 'dialog',
207
+ accessibilityRole: "alert",
181
208
  accessibilityLabel: accessibilityLabel,
182
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Animated.View, {
183
- style: [_reactNative.StyleSheet.absoluteFillObject, {
184
- backgroundColor: theme.colors.background.inverse,
185
- opacity: backdropAnim.interpolate({
186
- inputRange: [0, 1],
187
- outputRange: [0, backdropOpacity]
188
- })
209
+ children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View
210
+ // Backdrop wraps the dialog content (not sibling) — empirically,
211
+ // on RN 0.85 / Fabric / iOS a sibling backdrop is occluded by the
212
+ // wrapper View regardless of render order or pointerEvents.
213
+ // collapsable={false} prevents the backdrop View from being
214
+ // flattened out of the native tree. The backdrop uses a pre-baked
215
+ // rgba colour (no animated opacity) because Animated.View opacity
216
+ // on a coloured View doesn't update visibly on Fabric.
217
+ , {
218
+ collapsable: false,
219
+ style: [_reactNative.StyleSheet.absoluteFillObject, wrapperStyle, {
220
+ backgroundColor: theme.colors.background.overlay
189
221
  }, backdropStyle],
190
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Pressable, {
222
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Pressable, {
191
223
  style: _reactNative.StyleSheet.absoluteFillObject,
192
224
  onPress: handleBackdropPress,
193
225
  accessibilityRole: "button",
194
226
  accessibilityLabel: "Close modal",
195
227
  disabled: !backdropPressClose
196
- })
197
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
198
- style: wrapperStyle,
199
- pointerEvents: "box-none",
200
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Animated.View, {
228
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Animated.View, {
201
229
  style: [containerStyle, animatedTransform, contentStyle],
202
230
  pointerEvents: "auto",
203
231
  children: children
204
- })
205
- })]
232
+ })]
233
+ })
206
234
  })
207
235
  });
208
236
  });
@@ -8,42 +8,11 @@ var _react = _interopRequireWildcard(require("react"));
8
8
  var _reactNative = require("react-native");
9
9
  var _index = require("../../theme/index.js");
10
10
  var _index2 = require("../../utils/index.js");
11
+ var _FieldBase = require("../FieldBase/FieldBase.js");
11
12
  var _jsxRuntime = require("react/jsx-runtime");
12
13
  function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
13
- const sizeMap = {
14
- sm: {
15
- buttonSize: 30,
16
- inputMinWidth: 44,
17
- inputHeight: 30,
18
- fontSize: 13,
19
- iconFontSize: 16,
20
- borderRadius: 8,
21
- paddingHorizontal: 8,
22
- gap: 6
23
- },
24
- md: {
25
- buttonSize: 38,
26
- inputMinWidth: 56,
27
- inputHeight: 38,
28
- fontSize: 15,
29
- iconFontSize: 18,
30
- borderRadius: 10,
31
- paddingHorizontal: 10,
32
- gap: 8
33
- },
34
- lg: {
35
- buttonSize: 46,
36
- inputMinWidth: 68,
37
- inputHeight: 46,
38
- fontSize: 17,
39
- iconFontSize: 20,
40
- borderRadius: 12,
41
- paddingHorizontal: 12,
42
- gap: 10
43
- }
44
- };
45
- const LONG_PRESS_DELAY = 500;
46
- const LONG_PRESS_INTERVAL = 80;
14
+ const DEFAULT_LONG_PRESS_DELAY = 500;
15
+ const DEFAULT_LONG_PRESS_INTERVAL = 80;
47
16
  const roundToPrecision = (value, precision) => {
48
17
  if (!Number.isFinite(value)) return 0;
49
18
  if (precision <= 0) return Math.round(value);
@@ -65,12 +34,10 @@ const formatValue = (value, allowDecimal, precision) => {
65
34
  const sanitizeTyped = (raw, allowDecimal) => {
66
35
  if (!raw) return '';
67
36
  let cleaned = raw.replace(/[^0-9.-]/g, '');
68
- // Allow only one leading minus.
69
37
  cleaned = cleaned.replace(/(?!^)-/g, '');
70
38
  if (!allowDecimal) {
71
39
  cleaned = cleaned.replace(/\./g, '');
72
40
  } else {
73
- // Allow at most one decimal point.
74
41
  const firstDot = cleaned.indexOf('.');
75
42
  if (firstDot !== -1) {
76
43
  cleaned = cleaned.slice(0, firstDot + 1) + cleaned.slice(firstDot + 1).replace(/\./g, '');
@@ -96,17 +63,27 @@ const NumberInput = exports.NumberInput = /*#__PURE__*/(0, _react.forwardRef)((p
96
63
  unit,
97
64
  accessibilityLabel,
98
65
  style,
66
+ containerStyle,
99
67
  inputStyle,
68
+ buttonStyle,
69
+ unitStyle,
100
70
  labelStyle,
101
71
  textInputProps,
102
72
  testID
103
73
  } = props;
104
74
  const theme = (0, _index.useTheme)();
105
- const sizeStyles = sizeMap[size];
75
+ const sizeTokens = (0, _FieldBase.resolveFieldSize)(theme, size);
76
+ const fieldText = (0, _FieldBase.resolveFieldTextStyle)(theme, {
77
+ disabled
78
+ });
106
79
  const styles = (0, _react.useMemo)(() => buildStyles(theme), [theme]);
80
+ const longPressDelay = theme.components.numberInput?.longPressDelayMs ?? DEFAULT_LONG_PRESS_DELAY;
81
+ const longPressInterval = theme.components.numberInput?.longPressIntervalMs ?? DEFAULT_LONG_PRESS_INTERVAL;
82
+ const pressHaptic = theme.components.numberInput?.pressHaptic ?? false;
107
83
  const inputRef = (0, _react.useRef)(null);
108
84
  const [draft, setDraft] = (0, _react.useState)(formatValue(value, allowDecimal, precision));
109
85
  const [editing, setEditing] = (0, _react.useState)(false);
86
+ const [focused, setFocused] = (0, _react.useState)(false);
110
87
  const repeatTimeoutRef = (0, _react.useRef)(null);
111
88
  const repeatIntervalRef = (0, _react.useRef)(null);
112
89
  const clearRepeat = (0, _react.useCallback)(() => {
@@ -120,8 +97,6 @@ const NumberInput = exports.NumberInput = /*#__PURE__*/(0, _react.forwardRef)((p
120
97
  }
121
98
  }, []);
122
99
  (0, _react.useEffect)(() => clearRepeat, [clearRepeat]);
123
-
124
- // Keep draft in sync with value when not actively editing.
125
100
  (0, _react.useEffect)(() => {
126
101
  if (!editing) {
127
102
  setDraft(formatValue(value, allowDecimal, precision));
@@ -139,16 +114,14 @@ const NumberInput = exports.NumberInput = /*#__PURE__*/(0, _react.forwardRef)((p
139
114
  }, [allowDecimal, max, min, onChange, precision, value]);
140
115
  const decrement = (0, _react.useCallback)(() => {
141
116
  if (!interactive || atMin) return;
142
- (0, _index2.triggerHaptic)('impactLight');
117
+ if (pressHaptic) (0, _index2.triggerHaptic)('impactLight');
143
118
  setExternal(value - step);
144
- }, [atMin, interactive, setExternal, step, value]);
119
+ }, [atMin, interactive, pressHaptic, setExternal, step, value]);
145
120
  const increment = (0, _react.useCallback)(() => {
146
121
  if (!interactive || atMax) return;
147
- (0, _index2.triggerHaptic)('impactLight');
122
+ if (pressHaptic) (0, _index2.triggerHaptic)('impactLight');
148
123
  setExternal(value + step);
149
- }, [atMax, interactive, setExternal, step, value]);
150
-
151
- // Imperative ref.
124
+ }, [atMax, interactive, pressHaptic, setExternal, step, value]);
152
125
  _react.default.useImperativeHandle(ref, () => ({
153
126
  focus: () => inputRef.current?.focus(),
154
127
  blur: () => inputRef.current?.blur(),
@@ -167,23 +140,18 @@ const NumberInput = exports.NumberInput = /*#__PURE__*/(0, _react.forwardRef)((p
167
140
  repeatTimeoutRef.current = setTimeout(() => {
168
141
  repeatIntervalRef.current = setInterval(() => {
169
142
  if (direction === 'inc') {
170
- // Read latest via closure of state via setExternal.
171
- // Compute next by reading current value from props on each tick.
172
- // Since closures capture, we rely on state updating between intervals.
173
143
  increment();
174
144
  } else {
175
145
  decrement();
176
146
  }
177
- }, LONG_PRESS_INTERVAL);
178
- }, LONG_PRESS_DELAY);
179
- }, [clearRepeat, decrement, increment, interactive]);
147
+ }, longPressInterval);
148
+ }, longPressDelay);
149
+ }, [clearRepeat, decrement, increment, interactive, longPressDelay, longPressInterval]);
180
150
  const handleChangeText = (0, _react.useCallback)(text => {
181
151
  const cleaned = sanitizeTyped(text, allowDecimal);
182
152
  setDraft(cleaned);
183
- // Don't push numeric value while user types intermediate states (e.g., '-' or '1.').
184
153
  const parsed = Number(cleaned);
185
154
  if (cleaned !== '' && cleaned !== '-' && cleaned !== '.' && Number.isFinite(parsed)) {
186
- // Only push if within bounds; otherwise wait for blur to clamp.
187
155
  if (parsed >= min && parsed <= max) {
188
156
  if (parsed !== value) {
189
157
  onChange(roundToPrecision(parsed, allowDecimal ? precision : 0));
@@ -193,9 +161,9 @@ const NumberInput = exports.NumberInput = /*#__PURE__*/(0, _react.forwardRef)((p
193
161
  }, [allowDecimal, max, min, onChange, precision, value]);
194
162
  const handleBlur = (0, _react.useCallback)(() => {
195
163
  setEditing(false);
164
+ setFocused(false);
196
165
  const parsed = Number(draft);
197
166
  if (draft === '' || !Number.isFinite(parsed)) {
198
- // Reset to the last known good value.
199
167
  setDraft(formatValue(value, allowDecimal, precision));
200
168
  return;
201
169
  }
@@ -208,27 +176,16 @@ const NumberInput = exports.NumberInput = /*#__PURE__*/(0, _react.forwardRef)((p
208
176
  }, [allowDecimal, draft, max, min, onChange, precision, value]);
209
177
  const handleFocus = (0, _react.useCallback)(() => {
210
178
  setEditing(true);
179
+ setFocused(true);
211
180
  }, []);
212
- const minusBg = atMin || disabled ? theme.colors.surface.disabled : theme.colors.background.secondary;
213
- const plusBg = atMax || disabled ? theme.colors.surface.disabled : theme.colors.background.secondary;
214
181
  const minusFg = atMin || disabled ? theme.colors.text.disabled : theme.colors.text.primary;
215
182
  const plusFg = atMax || disabled ? theme.colors.text.disabled : theme.colors.text.primary;
216
- const inputBg = disabled ? theme.colors.surface.disabled : theme.colors.background.secondary;
217
- const borderColor = error ? theme.colors.border.error : theme.colors.border.primary;
218
- const buttonBaseStyle = {
219
- width: sizeStyles.buttonSize,
220
- height: sizeStyles.buttonSize,
221
- borderRadius: sizeStyles.borderRadius,
222
- borderWidth: 1,
223
- borderColor,
224
- alignItems: 'center',
225
- justifyContent: 'center'
226
- };
227
- const renderButton = (type, onPress, disabledLocal, a11yLabel, bg, fg, glyph) => /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Pressable, {
183
+ const stepperSize = sizeTokens.iconSize + 8;
184
+ const renderStepper = (type, onPress, disabledLocal, a11yLabel, fg, glyph) => /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Pressable, {
228
185
  onPress: onPress,
229
186
  onLongPress: () => startRepeating(type),
230
187
  onPressOut: clearRepeat,
231
- delayLongPress: LONG_PRESS_DELAY,
188
+ delayLongPress: longPressDelay,
232
189
  disabled: disabledLocal,
233
190
  accessibilityRole: "button",
234
191
  accessibilityLabel: a11yLabel,
@@ -237,36 +194,37 @@ const NumberInput = exports.NumberInput = /*#__PURE__*/(0, _react.forwardRef)((p
237
194
  },
238
195
  style: ({
239
196
  pressed
240
- }) => [buttonBaseStyle, {
241
- backgroundColor: bg
197
+ }) => [{
198
+ width: stepperSize,
199
+ height: stepperSize,
200
+ alignItems: 'center',
201
+ justifyContent: 'center',
202
+ borderRadius: stepperSize / 2
242
203
  }, pressed && !disabledLocal ? {
243
204
  backgroundColor: theme.colors.surface.pressed
244
- } : null],
205
+ } : null, buttonStyle],
245
206
  testID: `${testID ?? 'numberinput'}-${type === 'inc' ? 'plus' : 'minus'}`,
246
207
  children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
247
208
  style: {
248
- fontSize: sizeStyles.iconFontSize,
209
+ fontSize: sizeTokens.iconSize,
249
210
  color: fg,
250
211
  fontWeight: theme.typography.fontWeight.semibold,
251
- lineHeight: sizeStyles.iconFontSize + 2
212
+ lineHeight: sizeTokens.iconSize + 2
252
213
  },
253
214
  children: glyph
254
215
  })
255
216
  });
256
217
  const accessibleInputLabel = accessibilityLabel ?? label ?? 'Number input';
257
- const inputBlock = /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
258
- style: [styles.row, {
259
- columnGap: sizeStyles.gap
260
- }],
261
- children: [renderButton('dec', decrement, atMin || disabled, 'Decrease', minusBg, minusFg, '−'), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
262
- style: [styles.inputContainer, {
263
- minWidth: sizeStyles.inputMinWidth,
264
- height: sizeStyles.inputHeight,
265
- paddingHorizontal: sizeStyles.paddingHorizontal,
266
- borderRadius: sizeStyles.borderRadius,
267
- backgroundColor: inputBg,
268
- borderColor
269
- }],
218
+ const inputBlock = /*#__PURE__*/(0, _jsxRuntime.jsx)(_FieldBase.FieldBase, {
219
+ size: size,
220
+ disabled: disabled,
221
+ error: Boolean(error),
222
+ filled: true,
223
+ focused: focused,
224
+ leading: renderStepper('dec', decrement, atMin || disabled, 'Decrease', minusFg, '−'),
225
+ trailing: renderStepper('inc', increment, atMax || disabled, 'Increase', plusFg, '+'),
226
+ children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
227
+ style: styles.inputRow,
270
228
  children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.TextInput, {
271
229
  ref: inputRef,
272
230
  value: draft,
@@ -296,19 +254,19 @@ const NumberInput = exports.NumberInput = /*#__PURE__*/(0, _react.forwardRef)((p
296
254
  if (e.nativeEvent.actionName === 'decrement') decrement();
297
255
  },
298
256
  style: [styles.input, {
299
- fontSize: sizeStyles.fontSize,
300
- color: disabled ? theme.colors.text.disabled : theme.colors.text.primary,
301
- fontWeight: theme.typography.fontWeight.medium
257
+ fontSize: sizeTokens.fontSize,
258
+ color: fieldText.color,
259
+ ...fieldText.weightStyle
302
260
  }, inputStyle],
303
261
  ...textInputProps
304
262
  }), unit ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
305
263
  style: [styles.unit, {
306
- fontSize: sizeStyles.fontSize,
307
- color: theme.colors.text.tertiary
308
- }],
264
+ fontSize: sizeTokens.fontSize,
265
+ color: fieldText.placeholderColor
266
+ }, unitStyle],
309
267
  children: unit
310
268
  }) : null]
311
- }), renderButton('inc', increment, atMax || disabled, 'Increase', plusBg, plusFg, '+')]
269
+ })
312
270
  });
313
271
  const labelEl = label ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
314
272
  style: [styles.label, {
@@ -328,7 +286,7 @@ const NumberInput = exports.NumberInput = /*#__PURE__*/(0, _react.forwardRef)((p
328
286
  }) : null;
329
287
  if (variant === 'horizontal') {
330
288
  return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
331
- style: [styles.horizontalContainer, style],
289
+ style: [styles.horizontalContainer, style, containerStyle],
332
290
  testID: testID,
333
291
  accessibilityState: {
334
292
  disabled
@@ -341,10 +299,8 @@ const NumberInput = exports.NumberInput = /*#__PURE__*/(0, _react.forwardRef)((p
341
299
  })]
342
300
  });
343
301
  }
344
-
345
- // 'inline' and 'stacked' both stack label above the spinner row.
346
302
  return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
347
- style: style,
303
+ style: [style, containerStyle],
348
304
  testID: testID,
349
305
  accessibilityState: {
350
306
  disabled
@@ -354,20 +310,18 @@ const NumberInput = exports.NumberInput = /*#__PURE__*/(0, _react.forwardRef)((p
354
310
  });
355
311
  NumberInput.displayName = 'NumberInput';
356
312
  const buildStyles = _theme => _reactNative.StyleSheet.create({
357
- row: {
358
- flexDirection: 'row',
359
- alignItems: 'center'
360
- },
361
- inputContainer: {
313
+ inputRow: {
314
+ flex: 1,
362
315
  flexDirection: 'row',
363
316
  alignItems: 'center',
364
- borderWidth: 1,
365
- flex: 0
317
+ justifyContent: 'center'
366
318
  },
367
319
  input: {
368
320
  flex: 1,
369
321
  textAlign: 'center',
370
- padding: 0
322
+ padding: 0,
323
+ margin: 0,
324
+ includeFontPadding: false
371
325
  },
372
326
  unit: {
373
327
  marginLeft: 4