@webority-technologies/mobile 0.0.22 → 0.0.23

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 (181) hide show
  1. package/lib/commonjs/components/Accordion/Accordion.js +4 -2
  2. package/lib/commonjs/components/Avatar/Avatar.js +4 -2
  3. package/lib/commonjs/components/Badge/Badge.js +5 -5
  4. package/lib/commonjs/components/Banner/Banner.js +8 -4
  5. package/lib/commonjs/components/BottomNavigation/BottomNavigation.js +6 -4
  6. package/lib/commonjs/components/BottomSheet/BottomSheet.js +8 -9
  7. package/lib/commonjs/components/Box/Box.js +162 -0
  8. package/lib/commonjs/components/Box/index.js +37 -0
  9. package/lib/commonjs/components/Button/Button.js +7 -7
  10. package/lib/commonjs/components/Carousel/Carousel.js +4 -2
  11. package/lib/commonjs/components/Checkbox/Checkbox.js +14 -5
  12. package/lib/commonjs/components/DatePicker/DatePicker.js +9 -7
  13. package/lib/commonjs/components/DateRangePicker/DateRangePicker.js +5 -2
  14. package/lib/commonjs/components/Dialog/Dialog.js +2 -2
  15. package/lib/commonjs/components/FieldBase/FieldBase.js +8 -4
  16. package/lib/commonjs/components/FloatingActionButton/FloatingActionButton.js +13 -5
  17. package/lib/commonjs/components/FormField/FormField.js +61 -25
  18. package/lib/commonjs/components/Input/Input.js +41 -29
  19. package/lib/commonjs/components/KeyboardAwareScrollView/KeyboardAwareScrollView.js +102 -0
  20. package/lib/commonjs/components/KeyboardAwareScrollView/index.js +13 -0
  21. package/lib/commonjs/components/KeyboardToolbar/KeyboardToolbar.js +130 -0
  22. package/lib/commonjs/components/KeyboardToolbar/index.js +13 -0
  23. package/lib/commonjs/components/Modal/Modal.js +17 -6
  24. package/lib/commonjs/components/NumberInput/NumberInput.js +35 -28
  25. package/lib/commonjs/components/OTPInput/OTPInput.js +33 -18
  26. package/lib/commonjs/components/Radio/Radio.js +7 -5
  27. package/lib/commonjs/components/Radio/RadioGroup.js +10 -3
  28. package/lib/commonjs/components/SearchBar/SearchBar.js +4 -2
  29. package/lib/commonjs/components/SegmentedControl/SegmentedControl.js +20 -10
  30. package/lib/commonjs/components/Select/Select.js +33 -32
  31. package/lib/commonjs/components/Skeleton/SkeletonContent.js +5 -2
  32. package/lib/commonjs/components/Slider/Slider.js +42 -26
  33. package/lib/commonjs/components/Spinner/Spinner.js +5 -5
  34. package/lib/commonjs/components/Switch/Switch.js +29 -16
  35. package/lib/commonjs/components/Tabs/Tabs.js +4 -2
  36. package/lib/commonjs/components/Text/Text.js +142 -0
  37. package/lib/commonjs/components/Text/index.js +13 -0
  38. package/lib/commonjs/components/TimePicker/TimePicker.js +10 -7
  39. package/lib/commonjs/components/Toast/Toast.js +22 -10
  40. package/lib/commonjs/components/Tooltip/Tooltip.js +6 -2
  41. package/lib/commonjs/components/index.js +135 -89
  42. package/lib/commonjs/form/FormContext.js +40 -0
  43. package/lib/commonjs/form/index.js +68 -0
  44. package/lib/commonjs/form/path.js +79 -0
  45. package/lib/commonjs/form/rules.js +67 -0
  46. package/lib/commonjs/form/types.js +2 -0
  47. package/lib/commonjs/form/useField.js +54 -0
  48. package/lib/commonjs/form/useForm.js +316 -0
  49. package/lib/commonjs/hooks/index.js +14 -0
  50. package/lib/commonjs/hooks/useControllableState.js +30 -0
  51. package/lib/commonjs/hooks/useReducedMotion.js +31 -0
  52. package/lib/commonjs/index.js +96 -11
  53. package/lib/commonjs/theme/ThemeContext.js +30 -2
  54. package/lib/commonjs/theme/tokens.js +12 -0
  55. package/lib/module/components/Accordion/Accordion.js +4 -2
  56. package/lib/module/components/Avatar/Avatar.js +4 -2
  57. package/lib/module/components/Badge/Badge.js +5 -5
  58. package/lib/module/components/Banner/Banner.js +8 -4
  59. package/lib/module/components/BottomNavigation/BottomNavigation.js +6 -4
  60. package/lib/module/components/BottomSheet/BottomSheet.js +8 -9
  61. package/lib/module/components/Box/Box.js +156 -0
  62. package/lib/module/components/Box/index.js +4 -0
  63. package/lib/module/components/Button/Button.js +7 -7
  64. package/lib/module/components/Carousel/Carousel.js +4 -2
  65. package/lib/module/components/Checkbox/Checkbox.js +14 -5
  66. package/lib/module/components/DatePicker/DatePicker.js +9 -7
  67. package/lib/module/components/DateRangePicker/DateRangePicker.js +5 -2
  68. package/lib/module/components/Dialog/Dialog.js +2 -2
  69. package/lib/module/components/FieldBase/FieldBase.js +8 -4
  70. package/lib/module/components/FloatingActionButton/FloatingActionButton.js +13 -5
  71. package/lib/module/components/FormField/FormField.js +62 -26
  72. package/lib/module/components/Input/Input.js +41 -29
  73. package/lib/module/components/KeyboardAwareScrollView/KeyboardAwareScrollView.js +98 -0
  74. package/lib/module/components/KeyboardAwareScrollView/index.js +4 -0
  75. package/lib/module/components/KeyboardToolbar/KeyboardToolbar.js +125 -0
  76. package/lib/module/components/KeyboardToolbar/index.js +4 -0
  77. package/lib/module/components/Modal/Modal.js +17 -6
  78. package/lib/module/components/NumberInput/NumberInput.js +30 -23
  79. package/lib/module/components/OTPInput/OTPInput.js +30 -15
  80. package/lib/module/components/Radio/Radio.js +7 -5
  81. package/lib/module/components/Radio/RadioGroup.js +10 -3
  82. package/lib/module/components/SearchBar/SearchBar.js +4 -2
  83. package/lib/module/components/SegmentedControl/SegmentedControl.js +20 -10
  84. package/lib/module/components/Select/Select.js +33 -32
  85. package/lib/module/components/Skeleton/SkeletonContent.js +5 -2
  86. package/lib/module/components/Slider/Slider.js +42 -26
  87. package/lib/module/components/Spinner/Spinner.js +5 -5
  88. package/lib/module/components/Switch/Switch.js +29 -16
  89. package/lib/module/components/Tabs/Tabs.js +4 -2
  90. package/lib/module/components/Text/Text.js +138 -0
  91. package/lib/module/components/Text/index.js +4 -0
  92. package/lib/module/components/TimePicker/TimePicker.js +10 -7
  93. package/lib/module/components/Toast/Toast.js +22 -10
  94. package/lib/module/components/Tooltip/Tooltip.js +6 -2
  95. package/lib/module/components/index.js +4 -0
  96. package/lib/module/form/FormContext.js +32 -0
  97. package/lib/module/form/index.js +12 -0
  98. package/lib/module/form/path.js +72 -0
  99. package/lib/module/form/rules.js +52 -0
  100. package/lib/module/form/types.js +2 -0
  101. package/lib/module/form/useField.js +49 -0
  102. package/lib/module/form/useForm.js +312 -0
  103. package/lib/module/hooks/index.js +2 -0
  104. package/lib/module/hooks/useControllableState.js +26 -0
  105. package/lib/module/hooks/useReducedMotion.js +27 -0
  106. package/lib/module/index.js +3 -1
  107. package/lib/module/theme/ThemeContext.js +30 -2
  108. package/lib/module/theme/tokens.js +12 -0
  109. package/lib/typescript/commonjs/components/BottomNavigation/BottomNavigation.d.ts +1 -1
  110. package/lib/typescript/commonjs/components/Box/Box.d.ts +60 -0
  111. package/lib/typescript/commonjs/components/Box/index.d.ts +3 -0
  112. package/lib/typescript/commonjs/components/Button/Button.d.ts +1 -1
  113. package/lib/typescript/commonjs/components/Checkbox/Checkbox.d.ts +3 -2
  114. package/lib/typescript/commonjs/components/DatePicker/DatePicker.d.ts +3 -3
  115. package/lib/typescript/commonjs/components/Dialog/Dialog.d.ts +2 -2
  116. package/lib/typescript/commonjs/components/FormField/FormField.d.ts +13 -2
  117. package/lib/typescript/commonjs/components/KeyboardAwareScrollView/KeyboardAwareScrollView.d.ts +20 -0
  118. package/lib/typescript/commonjs/components/KeyboardAwareScrollView/index.d.ts +3 -0
  119. package/lib/typescript/commonjs/components/KeyboardToolbar/KeyboardToolbar.d.ts +29 -0
  120. package/lib/typescript/commonjs/components/KeyboardToolbar/index.d.ts +3 -0
  121. package/lib/typescript/commonjs/components/NumberInput/NumberInput.d.ts +3 -2
  122. package/lib/typescript/commonjs/components/OTPInput/OTPInput.d.ts +3 -2
  123. package/lib/typescript/commonjs/components/Radio/Radio.d.ts +2 -2
  124. package/lib/typescript/commonjs/components/Radio/RadioGroup.d.ts +3 -2
  125. package/lib/typescript/commonjs/components/SegmentedControl/SegmentedControl.d.ts +3 -2
  126. package/lib/typescript/commonjs/components/Slider/Slider.d.ts +6 -4
  127. package/lib/typescript/commonjs/components/Spinner/Spinner.d.ts +1 -1
  128. package/lib/typescript/commonjs/components/Switch/Switch.d.ts +3 -2
  129. package/lib/typescript/commonjs/components/Text/Text.d.ts +25 -0
  130. package/lib/typescript/commonjs/components/Text/index.d.ts +3 -0
  131. package/lib/typescript/commonjs/components/TimePicker/TimePicker.d.ts +3 -3
  132. package/lib/typescript/commonjs/components/index.d.ts +8 -0
  133. package/lib/typescript/commonjs/form/FormContext.d.ts +17 -0
  134. package/lib/typescript/commonjs/form/index.d.ts +9 -0
  135. package/lib/typescript/commonjs/form/path.d.ts +10 -0
  136. package/lib/typescript/commonjs/form/rules.d.ts +31 -0
  137. package/lib/typescript/commonjs/form/types.d.ts +94 -0
  138. package/lib/typescript/commonjs/form/useField.d.ts +27 -0
  139. package/lib/typescript/commonjs/form/useForm.d.ts +10 -0
  140. package/lib/typescript/commonjs/hooks/index.d.ts +3 -0
  141. package/lib/typescript/commonjs/hooks/useControllableState.d.ts +17 -0
  142. package/lib/typescript/commonjs/hooks/useReducedMotion.d.ts +8 -0
  143. package/lib/typescript/commonjs/index.d.ts +4 -2
  144. package/lib/typescript/commonjs/theme/types.d.ts +15 -0
  145. package/lib/typescript/module/components/BottomNavigation/BottomNavigation.d.ts +1 -1
  146. package/lib/typescript/module/components/Box/Box.d.ts +60 -0
  147. package/lib/typescript/module/components/Box/index.d.ts +3 -0
  148. package/lib/typescript/module/components/Button/Button.d.ts +1 -1
  149. package/lib/typescript/module/components/Checkbox/Checkbox.d.ts +3 -2
  150. package/lib/typescript/module/components/DatePicker/DatePicker.d.ts +3 -3
  151. package/lib/typescript/module/components/Dialog/Dialog.d.ts +2 -2
  152. package/lib/typescript/module/components/FormField/FormField.d.ts +13 -2
  153. package/lib/typescript/module/components/KeyboardAwareScrollView/KeyboardAwareScrollView.d.ts +20 -0
  154. package/lib/typescript/module/components/KeyboardAwareScrollView/index.d.ts +3 -0
  155. package/lib/typescript/module/components/KeyboardToolbar/KeyboardToolbar.d.ts +29 -0
  156. package/lib/typescript/module/components/KeyboardToolbar/index.d.ts +3 -0
  157. package/lib/typescript/module/components/NumberInput/NumberInput.d.ts +3 -2
  158. package/lib/typescript/module/components/OTPInput/OTPInput.d.ts +3 -2
  159. package/lib/typescript/module/components/Radio/Radio.d.ts +2 -2
  160. package/lib/typescript/module/components/Radio/RadioGroup.d.ts +3 -2
  161. package/lib/typescript/module/components/SegmentedControl/SegmentedControl.d.ts +3 -2
  162. package/lib/typescript/module/components/Slider/Slider.d.ts +6 -4
  163. package/lib/typescript/module/components/Spinner/Spinner.d.ts +1 -1
  164. package/lib/typescript/module/components/Switch/Switch.d.ts +3 -2
  165. package/lib/typescript/module/components/Text/Text.d.ts +25 -0
  166. package/lib/typescript/module/components/Text/index.d.ts +3 -0
  167. package/lib/typescript/module/components/TimePicker/TimePicker.d.ts +3 -3
  168. package/lib/typescript/module/components/index.d.ts +8 -0
  169. package/lib/typescript/module/form/FormContext.d.ts +17 -0
  170. package/lib/typescript/module/form/index.d.ts +9 -0
  171. package/lib/typescript/module/form/path.d.ts +10 -0
  172. package/lib/typescript/module/form/rules.d.ts +31 -0
  173. package/lib/typescript/module/form/types.d.ts +94 -0
  174. package/lib/typescript/module/form/useField.d.ts +27 -0
  175. package/lib/typescript/module/form/useForm.d.ts +10 -0
  176. package/lib/typescript/module/hooks/index.d.ts +3 -0
  177. package/lib/typescript/module/hooks/useControllableState.d.ts +17 -0
  178. package/lib/typescript/module/hooks/useReducedMotion.d.ts +8 -0
  179. package/lib/typescript/module/index.d.ts +4 -2
  180. package/lib/typescript/module/theme/types.d.ts +15 -0
  181. package/package.json +1 -1
@@ -114,7 +114,7 @@ const Accordion = props => {
114
114
  // Skip animation when state matches the previous value (e.g. on mount).
115
115
  if (lastExpandedRef.current === expanded) return;
116
116
  lastExpandedRef.current = expanded;
117
- _reactNative.Animated.parallel([_reactNative.Animated.timing(heightAnim, {
117
+ const anim = _reactNative.Animated.parallel([_reactNative.Animated.timing(heightAnim, {
118
118
  toValue: expanded ? 1 : 0,
119
119
  duration: theme.motion.duration.normal,
120
120
  easing: _reactNative.Easing.bezier(...theme.motion.easing.standard),
@@ -133,7 +133,9 @@ const Accordion = props => {
133
133
  duration: theme.motion.duration.normal,
134
134
  easing: _reactNative.Easing.bezier(...theme.motion.easing.standard),
135
135
  useNativeDriver: false
136
- })]).start();
136
+ })]);
137
+ anim.start();
138
+ return () => anim.stop();
137
139
  }, [expanded, heightAnim, opacityAnim, rotateAnim, theme.motion]);
138
140
  const onContentLayout = (0, _react.useCallback)(e => {
139
141
  const h = e.nativeEvent.layout.height;
@@ -213,13 +213,15 @@ const AvatarGroupItem = ({
213
213
  }) => {
214
214
  const opacity = (0, _react.useRef)((0, _index.createAnimatedValue)(0)).current;
215
215
  (0, _react.useEffect)(() => {
216
- _reactNative.Animated.timing(opacity, {
216
+ const anim = _reactNative.Animated.timing(opacity, {
217
217
  toValue: 1,
218
218
  duration: ENTRANCE_DURATION_MS,
219
219
  delay,
220
220
  easing: _reactNative.Easing.out(_reactNative.Easing.cubic),
221
221
  useNativeDriver: true
222
- }).start();
222
+ });
223
+ anim.start();
224
+ return () => anim.stop();
223
225
  }, [delay, opacity]);
224
226
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Animated.View, {
225
227
  style: [groupStyles.item, {
@@ -15,22 +15,22 @@ const toneFor = (theme, tone) => {
15
15
  case 'primary':
16
16
  return {
17
17
  background: theme.colors.primary,
18
- text: theme.colors.text.inverse
18
+ text: theme.colors.onPrimary
19
19
  };
20
20
  case 'success':
21
21
  return {
22
22
  background: theme.colors.success,
23
- text: theme.colors.text.inverse
23
+ text: theme.colors.onSuccess
24
24
  };
25
25
  case 'warning':
26
26
  return {
27
27
  background: theme.colors.warning,
28
- text: theme.colors.text.inverse
28
+ text: theme.colors.onWarning
29
29
  };
30
30
  case 'info':
31
31
  return {
32
32
  background: theme.colors.info,
33
- text: theme.colors.text.inverse
33
+ text: theme.colors.onInfo
34
34
  };
35
35
  case 'neutral':
36
36
  return {
@@ -41,7 +41,7 @@ const toneFor = (theme, tone) => {
41
41
  default:
42
42
  return {
43
43
  background: theme.colors.error,
44
- text: theme.colors.text.inverse
44
+ text: theme.colors.onError
45
45
  };
46
46
  }
47
47
  };
@@ -44,9 +44,10 @@ const Banner = exports.Banner = /*#__PURE__*/(0, _react.forwardRef)((props, ref)
44
44
  isFirstRun.current = false;
45
45
  if (!animateMount) return;
46
46
  }
47
+ let anim;
47
48
  if (visible) {
48
49
  setMounted(true);
49
- _reactNative.Animated.parallel([_reactNative.Animated.timing(translateY, {
50
+ anim = _reactNative.Animated.parallel([_reactNative.Animated.timing(translateY, {
50
51
  toValue: 0,
51
52
  duration: theme.motion.duration.normal,
52
53
  useNativeDriver: true
@@ -54,9 +55,10 @@ const Banner = exports.Banner = /*#__PURE__*/(0, _react.forwardRef)((props, ref)
54
55
  toValue: 1,
55
56
  duration: theme.motion.duration.normal,
56
57
  useNativeDriver: true
57
- })]).start();
58
+ })]);
59
+ anim.start();
58
60
  } else if (mounted) {
59
- _reactNative.Animated.parallel([_reactNative.Animated.timing(translateY, {
61
+ anim = _reactNative.Animated.parallel([_reactNative.Animated.timing(translateY, {
60
62
  toValue: -20,
61
63
  duration: theme.motion.duration.fast,
62
64
  useNativeDriver: true
@@ -64,10 +66,12 @@ const Banner = exports.Banner = /*#__PURE__*/(0, _react.forwardRef)((props, ref)
64
66
  toValue: 0,
65
67
  duration: theme.motion.duration.fast,
66
68
  useNativeDriver: true
67
- })]).start(() => {
69
+ })]);
70
+ anim.start(() => {
68
71
  setMounted(false);
69
72
  });
70
73
  }
74
+ return () => anim?.stop();
71
75
  // eslint-disable-next-line react-hooks/exhaustive-deps
72
76
  }, [visible]);
73
77
  if (!mounted) return null;
@@ -51,7 +51,7 @@ const BottomNavigation = exports.BottomNavigation = /*#__PURE__*/(0, _react.forw
51
51
  const {
52
52
  tabs,
53
53
  activeTab,
54
- onTabPress,
54
+ onChange,
55
55
  haptic = 'selection',
56
56
  showLabels = true,
57
57
  variant = 'pill',
@@ -100,12 +100,14 @@ const BottomNavigation = exports.BottomNavigation = /*#__PURE__*/(0, _react.forw
100
100
  // this value directly.
101
101
  (0, _react.useEffect)(() => {
102
102
  if (tabWidth <= 0) return;
103
- _reactNative.Animated.spring(indicatorTranslateX, {
103
+ const anim = _reactNative.Animated.spring(indicatorTranslateX, {
104
104
  toValue: activeIndex * tabWidth,
105
105
  tension: 120,
106
106
  friction: 14,
107
107
  useNativeDriver: true
108
- }).start();
108
+ });
109
+ anim.start();
110
+ return () => anim.stop();
109
111
  }, [activeIndex, tabWidth, indicatorTranslateX]);
110
112
  const handleLayout = e => {
111
113
  const total = e.nativeEvent.layout.width;
@@ -130,7 +132,7 @@ const BottomNavigation = exports.BottomNavigation = /*#__PURE__*/(0, _react.forw
130
132
  useNativeDriver: true
131
133
  })]).start();
132
134
  }
133
- onTabPress(tab.key);
135
+ onChange(tab.key);
134
136
  };
135
137
  const paddingBottom = Math.max(8, insets.bottom);
136
138
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
@@ -104,7 +104,6 @@ const BottomSheet = exports.BottomSheet = /*#__PURE__*/(0, _react.forwardRef)((p
104
104
  return () => sub.remove();
105
105
  }, []);
106
106
  const closedY = screenHeight; // fully off-screen
107
- const minSnapPoint = resolvedSnapPoints[0] ?? 0;
108
107
  const maxSnapPoint = resolvedSnapPoints[resolvedSnapPoints.length - 1] ?? 0;
109
108
 
110
109
  // translateY: 0 = top of screen, screenHeight = fully closed.
@@ -138,6 +137,13 @@ const BottomSheet = exports.BottomSheet = /*#__PURE__*/(0, _react.forwardRef)((p
138
137
  currentIndexShared.value = next;
139
138
  onChange?.(next);
140
139
  }, [currentIndex, currentIndexShared, onChange]);
140
+ const markAnimationDone = (0, _react.useCallback)(() => {
141
+ isAnimatingRef.current = false;
142
+ // If we just finished a close animation, unmount the sheet wrapper.
143
+ if (currentIndexShared.value < 0) {
144
+ if (mode === 'modal') setModalVisible(false);else setInlineMounted(false);
145
+ }
146
+ }, [mode, currentIndexShared]);
141
147
  const animateTo = (0, _react.useCallback)((to, fromIndex, toIndex) => {
142
148
  isAnimatingRef.current = true;
143
149
  onAnimate?.(fromIndex, toIndex);
@@ -148,14 +154,7 @@ const BottomSheet = exports.BottomSheet = /*#__PURE__*/(0, _react.forwardRef)((p
148
154
  (0, _reactNativeReanimated.runOnJS)(markAnimationDone)();
149
155
  }
150
156
  });
151
- }, [onAnimate, translateY]);
152
- const markAnimationDone = (0, _react.useCallback)(() => {
153
- isAnimatingRef.current = false;
154
- // If we just finished a close animation, unmount the sheet wrapper.
155
- if (currentIndexShared.value < 0) {
156
- if (mode === 'modal') setModalVisible(false);else setInlineMounted(false);
157
- }
158
- }, [mode, currentIndexShared]);
157
+ }, [onAnimate, translateY, markAnimationDone]);
159
158
  const expand = (0, _react.useCallback)(idx => {
160
159
  const target = typeof idx === 'number' ? clamp(idx, 0, resolvedSnapPoints.length - 1) : currentIndex >= 0 ? currentIndex : 0;
161
160
  const fromIndex = currentIndexShared.value;
@@ -0,0 +1,162 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.resolveBoxStyle = exports.default = exports.Stack = exports.Spacer = exports.Row = exports.Box = void 0;
7
+ var _react = _interopRequireWildcard(require("react"));
8
+ var _reactNative = require("react-native");
9
+ var _index = require("../../theme/index.js");
10
+ var _jsxRuntime = require("react/jsx-runtime");
11
+ 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); }
12
+ const space = (theme, token) => token == null ? undefined : theme.spacing[token];
13
+ const resolveBoxStyle = (theme, p) => {
14
+ const style = {};
15
+ if (p.p != null) style.padding = space(theme, p.p);
16
+ if (p.px != null) style.paddingHorizontal = space(theme, p.px);
17
+ if (p.py != null) style.paddingVertical = space(theme, p.py);
18
+ if (p.pt != null) style.paddingTop = space(theme, p.pt);
19
+ if (p.pr != null) style.paddingRight = space(theme, p.pr);
20
+ if (p.pb != null) style.paddingBottom = space(theme, p.pb);
21
+ if (p.pl != null) style.paddingLeft = space(theme, p.pl);
22
+ if (p.m != null) style.margin = space(theme, p.m);
23
+ if (p.mx != null) style.marginHorizontal = space(theme, p.mx);
24
+ if (p.my != null) style.marginVertical = space(theme, p.my);
25
+ if (p.mt != null) style.marginTop = space(theme, p.mt);
26
+ if (p.mr != null) style.marginRight = space(theme, p.mr);
27
+ if (p.mb != null) style.marginBottom = space(theme, p.mb);
28
+ if (p.ml != null) style.marginLeft = space(theme, p.ml);
29
+ if (p.gap != null) style.gap = space(theme, p.gap);
30
+ if (p.bg != null) {
31
+ const bgTokens = theme.colors.background;
32
+ style.backgroundColor = bgTokens[p.bg] ?? p.bg;
33
+ }
34
+ if (p.radius != null) style.borderRadius = theme.radius[p.radius];
35
+ if (p.border) {
36
+ style.borderWidth = theme.colors.border.width;
37
+ style.borderColor = theme.colors.border.primary;
38
+ }
39
+ if (p.flex != null) style.flex = p.flex;
40
+ if (p.align != null) style.alignItems = p.align;
41
+ if (p.justify != null) style.justifyContent = p.justify;
42
+ if (p.direction != null) style.flexDirection = p.direction;
43
+ if (p.wrap) style.flexWrap = 'wrap';
44
+ return style;
45
+ };
46
+ exports.resolveBoxStyle = resolveBoxStyle;
47
+ const Box = exports.Box = /*#__PURE__*/(0, _react.forwardRef)((props, ref) => {
48
+ const theme = (0, _index.useTheme)();
49
+ const {
50
+ // layout props consumed by the resolver — kept out of the View spread
51
+ p,
52
+ px,
53
+ py,
54
+ pt,
55
+ pr,
56
+ pb,
57
+ pl,
58
+ m,
59
+ mx,
60
+ my,
61
+ mt,
62
+ mr,
63
+ mb,
64
+ ml,
65
+ gap,
66
+ bg,
67
+ radius,
68
+ border,
69
+ flex,
70
+ align,
71
+ justify,
72
+ direction,
73
+ wrap,
74
+ style,
75
+ children,
76
+ ...viewProps
77
+ } = props;
78
+ const boxStyle = resolveBoxStyle(theme, {
79
+ p,
80
+ px,
81
+ py,
82
+ pt,
83
+ pr,
84
+ pb,
85
+ pl,
86
+ m,
87
+ mx,
88
+ my,
89
+ mt,
90
+ mr,
91
+ mb,
92
+ ml,
93
+ gap,
94
+ bg,
95
+ radius,
96
+ border,
97
+ flex,
98
+ align,
99
+ justify,
100
+ direction,
101
+ wrap
102
+ });
103
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
104
+ ref: ref,
105
+ style: [boxStyle, style],
106
+ ...viewProps,
107
+ children: children
108
+ });
109
+ });
110
+ Box.displayName = 'Box';
111
+ /** Vertical flex container with token spacing between children (default gap `md`). */
112
+ const Stack = exports.Stack = /*#__PURE__*/(0, _react.forwardRef)(({
113
+ gap = 'md',
114
+ ...rest
115
+ }, ref) => /*#__PURE__*/(0, _jsxRuntime.jsx)(Box, {
116
+ ref: ref,
117
+ direction: "column",
118
+ gap: gap,
119
+ ...rest
120
+ }));
121
+ Stack.displayName = 'Stack';
122
+ /** Horizontal flex container (default `align="center"`, gap `sm`). */
123
+ const Row = exports.Row = /*#__PURE__*/(0, _react.forwardRef)(({
124
+ gap = 'sm',
125
+ align = 'center',
126
+ ...rest
127
+ }, ref) => /*#__PURE__*/(0, _jsxRuntime.jsx)(Box, {
128
+ ref: ref,
129
+ direction: "row",
130
+ gap: gap,
131
+ align: align,
132
+ ...rest
133
+ }));
134
+ Row.displayName = 'Row';
135
+ /** Fixed gap (`size`) or a flexible push (`flex: 1`) between siblings. */
136
+ const Spacer = ({
137
+ size,
138
+ style,
139
+ testID
140
+ }) => {
141
+ const theme = (0, _index.useTheme)();
142
+ if (size != null) {
143
+ const value = theme.spacing[size];
144
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
145
+ testID: testID,
146
+ style: [{
147
+ width: value,
148
+ height: value
149
+ }, style]
150
+ });
151
+ }
152
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
153
+ testID: testID,
154
+ style: [{
155
+ flex: 1
156
+ }, style]
157
+ });
158
+ };
159
+ exports.Spacer = Spacer;
160
+ Spacer.displayName = 'Spacer';
161
+ var _default = exports.default = Box;
162
+ //# sourceMappingURL=Box.js.map
@@ -0,0 +1,37 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ Object.defineProperty(exports, "Box", {
7
+ enumerable: true,
8
+ get: function () {
9
+ return _Box.Box;
10
+ }
11
+ });
12
+ Object.defineProperty(exports, "Row", {
13
+ enumerable: true,
14
+ get: function () {
15
+ return _Box.Row;
16
+ }
17
+ });
18
+ Object.defineProperty(exports, "Spacer", {
19
+ enumerable: true,
20
+ get: function () {
21
+ return _Box.Spacer;
22
+ }
23
+ });
24
+ Object.defineProperty(exports, "Stack", {
25
+ enumerable: true,
26
+ get: function () {
27
+ return _Box.Stack;
28
+ }
29
+ });
30
+ Object.defineProperty(exports, "resolveBoxStyle", {
31
+ enumerable: true,
32
+ get: function () {
33
+ return _Box.resolveBoxStyle;
34
+ }
35
+ });
36
+ var _Box = require("./Box.js");
37
+ //# sourceMappingURL=index.js.map
@@ -72,7 +72,7 @@ const Button = exports.Button = /*#__PURE__*/(0, _react.forwardRef)((props, ref)
72
72
  style: styles.contentRow,
73
73
  children: loading ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_index2.Spinner, {
74
74
  variant: "circular",
75
- size: "small",
75
+ size: "sm",
76
76
  color: variantStyles.textColor,
77
77
  accessibilityLabel: "Loading"
78
78
  }) : /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
@@ -189,7 +189,7 @@ const toneFor = (theme, tone) => {
189
189
  base: theme.colors.primary,
190
190
  hover: theme.colors.primaryHover,
191
191
  pressed: theme.colors.primaryPressed,
192
- on: theme.colors.text.inverse,
192
+ on: theme.colors.onPrimary,
193
193
  muted: theme.colors.primaryMuted
194
194
  };
195
195
  case 'secondary':
@@ -197,7 +197,7 @@ const toneFor = (theme, tone) => {
197
197
  base: theme.colors.secondary,
198
198
  hover: theme.colors.secondaryHover,
199
199
  pressed: theme.colors.secondaryHover,
200
- on: theme.colors.text.primary,
200
+ on: theme.colors.onSecondary,
201
201
  muted: theme.colors.secondary
202
202
  };
203
203
  case 'success':
@@ -205,7 +205,7 @@ const toneFor = (theme, tone) => {
205
205
  base: theme.colors.success,
206
206
  hover: theme.colors.success,
207
207
  pressed: theme.colors.success,
208
- on: theme.colors.text.inverse,
208
+ on: theme.colors.onSuccess,
209
209
  muted: theme.colors.background.secondary
210
210
  };
211
211
  case 'warning':
@@ -213,15 +213,15 @@ const toneFor = (theme, tone) => {
213
213
  base: theme.colors.warning,
214
214
  hover: theme.colors.warning,
215
215
  pressed: theme.colors.warning,
216
- on: theme.colors.text.inverse,
216
+ on: theme.colors.onWarning,
217
217
  muted: theme.colors.background.secondary
218
218
  };
219
- case 'danger':
219
+ case 'error':
220
220
  return {
221
221
  base: theme.colors.error,
222
222
  hover: theme.colors.error,
223
223
  pressed: theme.colors.error,
224
- on: theme.colors.text.inverse,
224
+ on: theme.colors.onError,
225
225
  muted: theme.colors.background.secondary
226
226
  };
227
227
  case 'neutral':
@@ -442,12 +442,14 @@ const ThumbnailItem = ({
442
442
  }) => {
443
443
  const scale = (0, _react.useRef)((0, _index.createAnimatedValue)(isActive ? 1.1 : 1)).current;
444
444
  (0, _react.useEffect)(() => {
445
- _reactNative.Animated.spring(scale, {
445
+ const anim = _reactNative.Animated.spring(scale, {
446
446
  toValue: isActive ? 1.1 : 1,
447
447
  useNativeDriver: true,
448
448
  friction: 6,
449
449
  tension: 80
450
- }).start();
450
+ });
451
+ anim.start();
452
+ return () => anim.stop();
451
453
  }, [isActive, scale]);
452
454
  const content = (0, _react.useMemo)(() => {
453
455
  if (renderThumbnail) return renderThumbnail(item, index);
@@ -7,6 +7,7 @@ exports.default = exports.Checkbox = void 0;
7
7
  var _react = _interopRequireWildcard(require("react"));
8
8
  var _reactNative = require("react-native");
9
9
  var _index = require("../../theme/index.js");
10
+ var _index2 = require("../../hooks/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); }
@@ -31,6 +32,7 @@ const toneColor = (theme, tone) => {
31
32
  const Checkbox = exports.Checkbox = /*#__PURE__*/(0, _react.forwardRef)((props, ref) => {
32
33
  const {
33
34
  checked,
35
+ defaultChecked,
34
36
  onChange,
35
37
  indeterminate = false,
36
38
  disabled = false,
@@ -48,22 +50,29 @@ const Checkbox = exports.Checkbox = /*#__PURE__*/(0, _react.forwardRef)((props,
48
50
  testID,
49
51
  ...rest
50
52
  } = props;
53
+ const [current, setCurrent] = (0, _index2.useControllableState)({
54
+ value: checked,
55
+ defaultValue: defaultChecked ?? false,
56
+ onChange
57
+ });
51
58
  const theme = (0, _index.useTheme)();
52
59
  const styles = (0, _react.useMemo)(() => buildStyles(theme), [theme]);
53
60
  const boxSize = theme.components.checkbox?.[size]?.boxSize ?? sizeMap[size];
54
61
  const checkboxBorderWidth = theme.colors.border.width;
55
62
  const checkboxLabelGap = theme.components.checkbox?.labelGap ?? 10;
56
63
  const fillColor = toneColor(theme, tone);
57
- const isActive = checked || indeterminate;
64
+ const isActive = current || indeterminate;
58
65
  const progress = (0, _react.useRef)((0, _index.createAnimatedValue)(isActive ? 1 : 0)).current;
59
66
  (0, _react.useEffect)(() => {
60
- _reactNative.Animated.spring(progress, {
67
+ const anim = _reactNative.Animated.spring(progress, {
61
68
  toValue: isActive ? 1 : 0,
62
69
  damping: theme.motion.spring.snappy.damping,
63
70
  stiffness: theme.motion.spring.snappy.stiffness,
64
71
  mass: theme.motion.spring.snappy.mass,
65
72
  useNativeDriver: true
66
- }).start();
73
+ });
74
+ anim.start();
75
+ return () => anim.stop();
67
76
  }, [isActive, progress, theme.motion.spring.snappy]);
68
77
  const scale = progress.interpolate({
69
78
  inputRange: [0, 1],
@@ -72,7 +81,7 @@ const Checkbox = exports.Checkbox = /*#__PURE__*/(0, _react.forwardRef)((props,
72
81
  const handlePress = event => {
73
82
  if (disabled) return;
74
83
  if (haptic !== false && theme.components.checkbox?.pressHaptic) (0, _hapticUtils.triggerHaptic)(haptic);
75
- onChange(!checked);
84
+ setCurrent(!current);
76
85
  rest.onPressOut?.(event);
77
86
  };
78
87
  const accessibleLabel = accessibilityLabel ?? label;
@@ -89,7 +98,7 @@ const Checkbox = exports.Checkbox = /*#__PURE__*/(0, _react.forwardRef)((props,
89
98
  accessibilityRole: "checkbox",
90
99
  accessibilityLabel: accessibleLabel,
91
100
  accessibilityState: {
92
- checked: indeterminate ? 'mixed' : checked,
101
+ checked: indeterminate ? 'mixed' : current,
93
102
  disabled
94
103
  },
95
104
  testID: testID,
@@ -15,14 +15,14 @@ function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r
15
15
  /**
16
16
  * DatePicker operates in two modes:
17
17
  *
18
- * 1. **Controlled-modal mode** — pass `visible` (plus `onSelect` / `onClose`)
18
+ * 1. **Controlled-modal mode** — pass `visible` (plus `onChange` / `onClose`)
19
19
  * and own the open state externally. The component renders only the modal.
20
20
  * 2. **Trigger mode** — omit `visible`. The component renders a built-in
21
21
  * PickerTrigger field (label / value / placeholder / chevron / clear /
22
22
  * helper / error / size / variant) and manages its own open state. The
23
23
  * field opens the modal on press and closes it on confirm/cancel.
24
24
  *
25
- * `onSelect` / `onClose` are typed optional to support trigger-only usage
25
+ * `onChange` / `onClose` are typed optional to support trigger-only usage
26
26
  * where the consumer may not need either callback. In controlled-modal mode
27
27
  * they remain semantically required.
28
28
  */
@@ -104,7 +104,7 @@ const buildDecadeCells = anchorYear => {
104
104
  const DatePicker = props => {
105
105
  const {
106
106
  value,
107
- onSelect,
107
+ onChange,
108
108
  onClose,
109
109
  minDate,
110
110
  maxDate,
@@ -179,7 +179,7 @@ const DatePicker = props => {
179
179
  if (open) {
180
180
  backdrop.setValue(0);
181
181
  (0, _index.setNativeValue)(sheet, 0);
182
- _reactNative.Animated.parallel([_reactNative.Animated.timing(backdrop, {
182
+ const anim = _reactNative.Animated.parallel([_reactNative.Animated.timing(backdrop, {
183
183
  toValue: 1,
184
184
  duration: theme.motion.duration.normal,
185
185
  easing: _reactNative.Easing.out(_reactNative.Easing.cubic),
@@ -190,7 +190,9 @@ const DatePicker = props => {
190
190
  stiffness: theme.motion.spring.gentle.stiffness,
191
191
  mass: theme.motion.spring.gentle.mass,
192
192
  useNativeDriver: true
193
- })]).start();
193
+ })]);
194
+ anim.start();
195
+ return () => anim.stop();
194
196
  }
195
197
  }, [open, mode, backdrop, sheet, theme.motion]);
196
198
  const disabledIsoSet = (0, _react.useMemo)(() => {
@@ -390,9 +392,9 @@ const DatePicker = props => {
390
392
  const handleConfirm = (0, _react.useCallback)(() => {
391
393
  if (!pendingDate) return;
392
394
  if (theme.components.datePicker?.haptic) (0, _index2.triggerHaptic)('notificationSuccess');
393
- onSelect?.(pendingDate);
395
+ onChange?.(pendingDate);
394
396
  handleClose();
395
- }, [handleClose, onSelect, pendingDate, theme.components.datePicker]);
397
+ }, [handleClose, onChange, pendingDate, theme.components.datePicker]);
396
398
  const sheetTranslate = sheet.interpolate({
397
399
  inputRange: [0, 1],
398
400
  outputRange: [320, 0]
@@ -152,10 +152,11 @@ const DateRangePicker = exports.DateRangePicker = /*#__PURE__*/(0, _react.forwar
152
152
  // Modal open / close animation. Backdrop opacity uses JS driver — see
153
153
  // Modal.tsx for the Fabric reason. Sheet transform stays native.
154
154
  (0, _react.useEffect)(() => {
155
+ let anim;
155
156
  if (open) {
156
157
  backdrop.setValue(0);
157
158
  (0, _index.setNativeValue)(sheet, 0);
158
- _reactNative.Animated.parallel([_reactNative.Animated.timing(backdrop, {
159
+ anim = _reactNative.Animated.parallel([_reactNative.Animated.timing(backdrop, {
159
160
  toValue: 1,
160
161
  duration: theme.motion.duration.normal,
161
162
  easing: _reactNative.Easing.out(_reactNative.Easing.cubic),
@@ -166,8 +167,10 @@ const DateRangePicker = exports.DateRangePicker = /*#__PURE__*/(0, _react.forwar
166
167
  stiffness: theme.motion.spring.gentle.stiffness,
167
168
  mass: theme.motion.spring.gentle.mass,
168
169
  useNativeDriver: true
169
- })]).start();
170
+ })]);
171
+ anim.start();
170
172
  }
173
+ return () => anim?.stop();
171
174
  }, [open, backdrop, sheet, theme.motion]);
172
175
  const disabledIsoSet = (0, _react.useMemo)(() => {
173
176
  const set = new Set();
@@ -150,7 +150,7 @@ const tintForVariant = (theme, variant) => {
150
150
  base: theme.colors.warning,
151
151
  muted: theme.colors.background.secondary
152
152
  };
153
- case 'danger':
153
+ case 'error':
154
154
  return {
155
155
  base: theme.colors.error,
156
156
  muted: theme.colors.background.secondary
@@ -181,7 +181,7 @@ const actionStyleFor = (theme, tone, variant) => {
181
181
  textColor: theme.colors.text.inverse
182
182
  };
183
183
  }
184
- case 'danger':
184
+ case 'error':
185
185
  return {
186
186
  backgroundColor: theme.colors.error,
187
187
  borderColor: 'transparent',
@@ -294,20 +294,24 @@ const FieldBase = props => {
294
294
  const focusAnim = (0, _react.useRef)((0, _index.createAnimatedValue)(focused ? 1 : 0)).current;
295
295
  const errorAnim = (0, _react.useRef)((0, _index.createAnimatedValue)(error ? 1 : 0)).current;
296
296
  (0, _react.useEffect)(() => {
297
- _reactNative.Animated.timing(focusAnim, {
297
+ const anim = _reactNative.Animated.timing(focusAnim, {
298
298
  toValue: focused ? 1 : 0,
299
299
  duration: theme.motion.duration.fast,
300
300
  easing: _reactNative.Easing.bezier(...theme.motion.easing.standard),
301
301
  useNativeDriver: false
302
- }).start();
302
+ });
303
+ anim.start();
304
+ return () => anim.stop();
303
305
  }, [focused, focusAnim, theme.motion.duration.fast, theme.motion.easing.standard]);
304
306
  (0, _react.useEffect)(() => {
305
- _reactNative.Animated.timing(errorAnim, {
307
+ const anim = _reactNative.Animated.timing(errorAnim, {
306
308
  toValue: error ? 1 : 0,
307
309
  duration: theme.motion.duration.fast,
308
310
  easing: _reactNative.Easing.bezier(...theme.motion.easing.standard),
309
311
  useNativeDriver: false
310
- }).start();
312
+ });
313
+ anim.start();
314
+ return () => anim.stop();
311
315
  }, [error, errorAnim, theme.motion.duration.fast, theme.motion.easing.standard]);
312
316
 
313
317
  // Resting border + fill (pre-animation). Error wins over focus when both