@webority-technologies/mobile 0.0.15 → 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 +78 -53
  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 +80 -55
  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
@@ -87,6 +87,8 @@ const Rating = exports.Rating = /*#__PURE__*/(0, _react.forwardRef)((props, ref)
87
87
  loading = false,
88
88
  accessibilityLabel,
89
89
  style,
90
+ containerStyle,
91
+ starContainerStyle,
90
92
  testID
91
93
  } = props;
92
94
  const theme = (0, _index.useTheme)();
@@ -100,17 +102,31 @@ const Rating = exports.Rating = /*#__PURE__*/(0, _react.forwardRef)((props, ref)
100
102
  const handleStarLayout = (0, _react.useCallback)(e => {
101
103
  starWidthRef.current = e.nativeEvent.layout.width;
102
104
  }, []);
103
- const scaleRefs = (0, _react.useRef)([]);
104
- if (scaleRefs.current.length !== max) {
105
- scaleRefs.current = Array.from({
106
- length: max
107
- }, (_, i) => scaleRefs.current[i] ?? new _reactNative.Animated.Value(1));
108
- }
105
+ const scaleMapRef = (0, _react.useRef)(new Map());
106
+ const scaleRefs = (0, _react.useMemo)(() => {
107
+ const map = scaleMapRef.current;
108
+ const out = [];
109
+ for (let i = 0; i < max; i += 1) {
110
+ let v = map.get(i);
111
+ if (!v) {
112
+ v = new _reactNative.Animated.Value(1);
113
+ map.set(i, v);
114
+ }
115
+ out.push(v);
116
+ }
117
+ for (const key of Array.from(map.keys())) {
118
+ if (key >= max) map.delete(key);
119
+ }
120
+ return out;
121
+ }, [max]);
122
+ const pulseOnPress = theme.components.rating?.pulseOnPress ?? false;
123
+ const pulseScale = theme.components.rating?.pulseScale ?? 1.2;
124
+ const pressHapticEnabled = theme.components.rating?.pressHaptic ?? false;
109
125
  const pulse = (0, _react.useCallback)(idx => {
110
- const v = scaleRefs.current[idx];
126
+ const v = scaleRefs[idx];
111
127
  if (!v) return;
112
128
  _reactNative.Animated.sequence([_reactNative.Animated.timing(v, {
113
- toValue: 1.2,
129
+ toValue: pulseScale,
114
130
  duration: theme.motion.duration.fast,
115
131
  easing: _reactNative.Easing.bezier(...theme.motion.easing.standard),
116
132
  useNativeDriver: true
@@ -121,14 +137,14 @@ const Rating = exports.Rating = /*#__PURE__*/(0, _react.forwardRef)((props, ref)
121
137
  mass: theme.motion.spring.bouncy.mass,
122
138
  useNativeDriver: true
123
139
  })]).start();
124
- }, [theme.motion]);
140
+ }, [theme.motion, pulseScale, scaleRefs]);
125
141
  const commit = (0, _react.useCallback)((next, animatedIndex) => {
126
142
  if (!interactive || !onChange) return;
127
143
  const cleaned = clampToStep(next, max, step);
128
- (0, _hapticUtils.triggerHaptic)('selection');
129
- if (typeof animatedIndex === 'number') pulse(animatedIndex);
144
+ if (pressHapticEnabled) (0, _hapticUtils.triggerHaptic)('selection');
145
+ if (pulseOnPress && typeof animatedIndex === 'number') pulse(animatedIndex);
130
146
  onChange(cleaned);
131
- }, [interactive, onChange, max, step, pulse]);
147
+ }, [interactive, onChange, max, step, pulse, pressHapticEnabled, pulseOnPress]);
132
148
  const handleStarPress = (0, _react.useCallback)(index => e => {
133
149
  if (!interactive) return;
134
150
  const w = starWidthRef.current || starSize;
@@ -149,13 +165,15 @@ const Rating = exports.Rating = /*#__PURE__*/(0, _react.forwardRef)((props, ref)
149
165
  const a11yLabel = accessibilityLabel ?? label ?? valueText;
150
166
  const stars = [];
151
167
  for (let i = 0; i < max; i += 1) {
168
+ const scaleVal = scaleRefs[i];
169
+ if (!scaleVal) continue;
152
170
  const star = /*#__PURE__*/(0, _jsxRuntime.jsx)(Star, {
153
171
  index: i,
154
172
  filled: value,
155
173
  size: starSize,
156
174
  filledColor: filledColor,
157
175
  emptyColor: emptyColor,
158
- scale: scaleRefs.current[i] ?? new _reactNative.Animated.Value(1)
176
+ scale: scaleVal
159
177
  }, i);
160
178
  stars.push(interactive ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Pressable, {
161
179
  onPress: handleStarPress(i),
@@ -171,7 +189,7 @@ const Rating = exports.Rating = /*#__PURE__*/(0, _react.forwardRef)((props, ref)
171
189
  }, i));
172
190
  }
173
191
  const rendered = /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
174
- style: [styles.wrapper, style],
192
+ style: [styles.wrapper, style, containerStyle],
175
193
  ref: ref,
176
194
  testID: testID,
177
195
  children: [label ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
@@ -181,7 +199,7 @@ const Rating = exports.Rating = /*#__PURE__*/(0, _react.forwardRef)((props, ref)
181
199
  }],
182
200
  children: label
183
201
  }) : null, /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
184
- style: styles.row,
202
+ style: [styles.row, starContainerStyle],
185
203
  accessible: true,
186
204
  accessibilityRole: interactive ? 'adjustable' : 'text',
187
205
  accessibilityLabel: a11yLabel,
@@ -201,15 +219,63 @@ const Rating = exports.Rating = /*#__PURE__*/(0, _react.forwardRef)((props, ref)
201
219
  })]
202
220
  });
203
221
  if (loading) {
204
- return /*#__PURE__*/(0, _jsxRuntime.jsx)(_index2.SkeletonContent, {
205
- loading: true,
206
- mode: "auto",
207
- children: rendered
222
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(RatingSkeleton, {
223
+ ...props
208
224
  });
209
225
  }
210
226
  return rendered;
211
227
  });
212
228
  Rating.displayName = 'Rating';
229
+
230
+ /**
231
+ * Placeholder shape for `<Rating>`. Row of N star-shaped skeletons sized
232
+ * exactly like the live stars, plus an optional label line above. The
233
+ * footprint stays identical between loading and loaded states.
234
+ */
235
+ const RatingSkeleton = ({
236
+ max = 5,
237
+ size = 'md',
238
+ label,
239
+ containerStyle,
240
+ starContainerStyle,
241
+ style
242
+ }) => {
243
+ const starSize = resolveSize(size);
244
+ const stars = Math.max(1, max);
245
+ return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
246
+ style: [{
247
+ alignItems: 'flex-start'
248
+ }, containerStyle, style],
249
+ accessibilityRole: "progressbar",
250
+ accessibilityState: {
251
+ busy: true
252
+ },
253
+ children: [label !== undefined ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_index2.Skeleton, {
254
+ shape: "text",
255
+ width: 80,
256
+ height: 14,
257
+ style: {
258
+ marginBottom: 6
259
+ }
260
+ }) : null, /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
261
+ style: [{
262
+ flexDirection: 'row'
263
+ }, starContainerStyle],
264
+ children: Array.from({
265
+ length: stars
266
+ }).map((_, i) => /*#__PURE__*/(0, _jsxRuntime.jsx)(_index2.Skeleton, {
267
+ width: starSize,
268
+ height: starSize,
269
+ radius: Math.round(starSize * 0.25),
270
+ style: i < stars - 1 ? {
271
+ marginRight: 4
272
+ } : undefined
273
+ }, `sk-star-${i}`))
274
+ })]
275
+ });
276
+ };
277
+ RatingSkeleton.displayName = 'RatingSkeleton';
278
+ Rating.Skeleton = RatingSkeleton;
213
279
  const starStyles = _reactNative.StyleSheet.create({
214
280
  starWrap: {
215
281
  position: 'relative',
@@ -9,32 +9,9 @@ var _reactNative = require("react-native");
9
9
  var _index = require("../../theme/index.js");
10
10
  var _hapticUtils = require("../../utils/hapticUtils.js");
11
11
  var _useDebounce = require("../../hooks/useDebounce.js");
12
- var _index2 = require("../AppIcon/index.js");
12
+ var _FieldBase = require("../FieldBase/FieldBase.js");
13
13
  var _jsxRuntime = require("react/jsx-runtime");
14
14
  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); }
15
- const sizeMap = {
16
- sm: {
17
- height: 36,
18
- paddingHorizontal: 10,
19
- fontSize: 13,
20
- iconSize: 16,
21
- gap: 6
22
- },
23
- md: {
24
- height: 44,
25
- paddingHorizontal: 12,
26
- fontSize: 15,
27
- iconSize: 18,
28
- gap: 8
29
- },
30
- lg: {
31
- height: 52,
32
- paddingHorizontal: 14,
33
- fontSize: 16,
34
- iconSize: 20,
35
- gap: 10
36
- }
37
- };
38
15
  const CANCEL_WIDTH = 72;
39
16
  const SearchBar = exports.SearchBar = /*#__PURE__*/(0, _react.forwardRef)((props, ref) => {
40
17
  const {
@@ -50,7 +27,7 @@ const SearchBar = exports.SearchBar = /*#__PURE__*/(0, _react.forwardRef)((props
50
27
  leftIcon,
51
28
  debounceMs,
52
29
  size = 'md',
53
- variant = 'filled',
30
+ variant: variantProp,
54
31
  cancelLabel = 'Cancel',
55
32
  style,
56
33
  accessibilityLabel,
@@ -58,11 +35,21 @@ const SearchBar = exports.SearchBar = /*#__PURE__*/(0, _react.forwardRef)((props
58
35
  ...rest
59
36
  } = props;
60
37
  const theme = (0, _index.useTheme)();
38
+ // Resolution chain mirrors every other field-family control: caller prop →
39
+ // component-specific token (`components.searchBar.defaultVariant`) → shared
40
+ // field-family token (`components.field.defaultVariant`) → library default.
41
+ // Library default stays `'filled'` so SearchBar reads as the traditional
42
+ // pill-shaped, borderless search box when no theme opinion is expressed.
43
+ const variant = variantProp ?? theme.components.searchBar?.defaultVariant ?? theme.components.field?.defaultVariant ?? 'filled';
44
+ const fieldTokens = (0, _FieldBase.resolveFieldSize)(theme, size);
61
45
  const sizeStyles = {
62
- ...sizeMap[size],
46
+ ...fieldTokens,
63
47
  ...(theme.components.searchBar?.[size] ?? {})
64
48
  };
65
49
  const cancelWidth = theme.components.searchBar?.cancelButtonWidth ?? CANCEL_WIDTH;
50
+ const fieldText = (0, _FieldBase.resolveFieldTextStyle)(theme, {
51
+ disabled
52
+ });
66
53
  const styles = (0, _react.useMemo)(() => buildStyles(theme), [theme]);
67
54
 
68
55
  // Coerce nullable inputs to '' once at the top so every downstream read is
@@ -73,15 +60,11 @@ const SearchBar = exports.SearchBar = /*#__PURE__*/(0, _react.forwardRef)((props
73
60
  const [internalValue, setInternalValue] = (0, _react.useState)(value);
74
61
  const debouncedValue = (0, _useDebounce.useDebounce)(internalValue, debounceMs ?? 0);
75
62
  const cancelAnim = (0, _react.useRef)((0, _index.createAnimatedValue)(0)).current;
76
-
77
- // Keep internal value in sync with controlled value when debouncing.
78
63
  (0, _react.useEffect)(() => {
79
64
  if (debounceMs === undefined) return;
80
65
  if (value !== internalValue) setInternalValue(value);
81
66
  // eslint-disable-next-line react-hooks/exhaustive-deps
82
67
  }, [value, debounceMs]);
83
-
84
- // Fire debounced onChangeText when debounce is configured.
85
68
  const lastSentRef = (0, _react.useRef)(value);
86
69
  (0, _react.useEffect)(() => {
87
70
  if (debounceMs === undefined) return;
@@ -95,7 +78,6 @@ const SearchBar = exports.SearchBar = /*#__PURE__*/(0, _react.forwardRef)((props
95
78
  toValue: showCancelButton ? 1 : 0,
96
79
  duration: 200,
97
80
  easing: _reactNative.Easing.bezier(...theme.motion.easing.standard),
98
- // Container width / margin animates with this value, so layout-aware.
99
81
  useNativeDriver: false
100
82
  }).start();
101
83
  }, [showCancelButton, cancelAnim, theme.motion.easing.standard]);
@@ -130,81 +112,86 @@ const SearchBar = exports.SearchBar = /*#__PURE__*/(0, _react.forwardRef)((props
130
112
  }, [onSubmit, debounceMs, internalValue, value]);
131
113
  const displayValue = debounceMs !== undefined ? internalValue : value;
132
114
  const hasValue = displayValue.length > 0;
133
- const containerBackground = variant === 'filled' ? theme.colors.background.secondary : theme.colors.background.primary;
134
- const containerBorder = variant === 'outlined' ? theme.colors.border.primary : 'transparent';
135
-
136
- // Container shrinks left to make room for cancel button on right.
137
115
  const cancelTranslateX = cancelAnim.interpolate({
138
116
  inputRange: [0, 1],
139
117
  outputRange: [cancelWidth, 0]
140
118
  });
141
119
  const cancelOpacity = cancelAnim;
120
+ const fieldMarginRight = cancelAnim.interpolate({
121
+ inputRange: [0, 1],
122
+ outputRange: [0, cancelWidth + theme.spacing.sm]
123
+ });
124
+ const leading = leftIcon ? leftIcon : theme.icons?.search ? theme.icons.search({
125
+ size: sizeStyles.iconSize,
126
+ color: theme.colors.text.tertiary
127
+ }) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
128
+ style: {
129
+ fontSize: sizeStyles.iconSize,
130
+ color: theme.colors.text.tertiary
131
+ },
132
+ children: "\uD83D\uDD0D"
133
+ });
134
+ const trailing = hasValue && !disabled ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Pressable, {
135
+ onPress: handleClear,
136
+ hitSlop: 8,
137
+ accessibilityRole: "button",
138
+ accessibilityLabel: "Clear search",
139
+ children: theme.icons?.close ? theme.icons.close({
140
+ size: sizeStyles.iconSize,
141
+ color: theme.colors.text.secondary
142
+ }) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
143
+ style: {
144
+ fontSize: sizeStyles.iconSize,
145
+ color: theme.colors.text.secondary
146
+ },
147
+ children: "\xD7"
148
+ })
149
+ }) : null;
142
150
  return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
143
151
  style: [styles.root, style],
144
152
  testID: testID,
145
- children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.Animated.View, {
146
- style: [styles.searchContainer, {
147
- height: sizeStyles.height,
148
- paddingHorizontal: sizeStyles.paddingHorizontal,
149
- backgroundColor: containerBackground,
150
- borderColor: containerBorder,
151
- borderWidth: variant === 'outlined' ? 1 : 0,
152
- borderRadius: theme.radius.full,
153
- opacity: disabled ? 0.55 : 1,
154
- marginRight: cancelAnim.interpolate({
155
- inputRange: [0, 1],
156
- outputRange: [0, cancelWidth + theme.spacing.sm]
157
- })
153
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Animated.View, {
154
+ style: [styles.fieldWrap, {
155
+ marginRight: fieldMarginRight
158
156
  }],
159
- accessibilityRole: "search",
160
- accessibilityLabel: accessibilityLabel ?? placeholder,
161
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
162
- style: [styles.leftSlot, {
163
- marginRight: sizeStyles.gap
164
- }],
165
- children: leftIcon ? leftIcon : /*#__PURE__*/(0, _jsxRuntime.jsx)(_index2.AppIcon, {
166
- name: "search",
167
- family: "feather",
168
- size: sizeStyles.iconSize,
169
- color: theme.colors.text.tertiary
170
- })
171
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.TextInput, {
172
- ref: ref,
173
- style: [styles.input, {
174
- fontSize: sizeStyles.fontSize,
175
- color: disabled ? theme.colors.text.disabled : theme.colors.text.primary
176
- }],
177
- value: displayValue,
178
- onChangeText: handleChangeText,
179
- onSubmitEditing: handleSubmit,
180
- onFocus: () => setIsFocused(true),
181
- onBlur: () => setIsFocused(false),
182
- placeholder: placeholder,
183
- placeholderTextColor: theme.colors.text.tertiary,
184
- autoFocus: autoFocus,
185
- editable: !disabled,
186
- returnKeyType: "search",
187
- selectionColor: theme.colors.border.focus,
157
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_FieldBase.FieldBase, {
158
+ size: size,
159
+ variant: variant,
160
+ focused: isFocused,
161
+ disabled: disabled,
162
+ filled: hasValue,
163
+ minHeight: sizeStyles.minHeight,
164
+ paddingHorizontal: sizeStyles.paddingHorizontal,
165
+ borderRadius: sizeStyles.borderRadius,
166
+ leading: leading,
167
+ trailing: trailing,
168
+ accessibilityRole: "search",
188
169
  accessibilityLabel: accessibilityLabel ?? placeholder,
189
- accessibilityState: {
190
- disabled
191
- },
192
- ...rest
193
- }), hasValue && !disabled ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Pressable, {
194
- onPress: handleClear,
195
- hitSlop: 8,
196
- accessibilityRole: "button",
197
- accessibilityLabel: "Clear search",
198
- style: [styles.rightSlot, {
199
- marginLeft: sizeStyles.gap
200
- }],
201
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_index2.AppIcon, {
202
- name: "x",
203
- family: "feather",
204
- size: sizeStyles.iconSize,
205
- color: theme.colors.text.secondary
170
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.TextInput, {
171
+ ref: ref,
172
+ style: [styles.input, {
173
+ fontSize: sizeStyles.fontSize,
174
+ color: fieldText.color,
175
+ ...fieldText.weightStyle
176
+ }],
177
+ value: displayValue,
178
+ onChangeText: handleChangeText,
179
+ onSubmitEditing: handleSubmit,
180
+ onFocus: () => setIsFocused(true),
181
+ onBlur: () => setIsFocused(false),
182
+ placeholder: placeholder,
183
+ placeholderTextColor: fieldText.placeholderColor,
184
+ autoFocus: autoFocus,
185
+ editable: !disabled,
186
+ returnKeyType: "search",
187
+ selectionColor: (0, _FieldBase.resolveVariantColors)(theme, variant).borderFocused,
188
+ accessibilityLabel: accessibilityLabel ?? placeholder,
189
+ accessibilityState: {
190
+ disabled
191
+ },
192
+ ...rest
206
193
  })
207
- }) : null]
194
+ })
208
195
  }), showCancel ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Animated.View, {
209
196
  pointerEvents: showCancelButton ? 'auto' : 'none',
210
197
  style: [styles.cancelWrap, {
@@ -242,14 +229,8 @@ const buildStyles = _theme => _reactNative.StyleSheet.create({
242
229
  position: 'relative',
243
230
  overflow: 'hidden'
244
231
  },
245
- searchContainer: {
246
- flex: 1,
247
- flexDirection: 'row',
248
- alignItems: 'center'
249
- },
250
- leftSlot: {
251
- alignItems: 'center',
252
- justifyContent: 'center'
232
+ fieldWrap: {
233
+ flex: 1
253
234
  },
254
235
  input: {
255
236
  flex: 1,
@@ -257,10 +238,6 @@ const buildStyles = _theme => _reactNative.StyleSheet.create({
257
238
  margin: 0,
258
239
  includeFontPadding: false
259
240
  },
260
- rightSlot: {
261
- alignItems: 'center',
262
- justifyContent: 'center'
263
- },
264
241
  cancelWrap: {
265
242
  position: 'absolute',
266
243
  right: 0,
@@ -42,13 +42,24 @@ const SegmentedControl = exports.SegmentedControl = /*#__PURE__*/(0, _react.forw
42
42
  tone = 'primary',
43
43
  accessibilityLabel,
44
44
  style,
45
+ containerStyle,
45
46
  segmentStyle,
47
+ selectedIndicatorStyle,
46
48
  textStyle,
49
+ labelStyle,
47
50
  testID
48
51
  } = props;
49
52
  const theme = (0, _index.useTheme)();
53
+ const segTheme = theme.components.segmentedControl;
50
54
  const styles = (0, _react.useMemo)(() => buildStyles(theme), [theme]);
51
- const sizeStyles = sizeMap[size];
55
+ const baseSize = sizeMap[size];
56
+ const sizeStyles = {
57
+ height: segTheme?.[size]?.height ?? baseSize.height,
58
+ fontSize: segTheme?.[size]?.fontSize ?? baseSize.fontSize,
59
+ paddingHorizontal: segTheme?.[size]?.paddingHorizontal ?? baseSize.paddingHorizontal
60
+ };
61
+ const trackPadding = segTheme?.trackPadding ?? TRACK_PADDING;
62
+ const changeHapticEnabled = segTheme?.changeHaptic ?? false;
52
63
 
53
64
  // Track width is measured from onLayout. Thumb width is a regular number (not
54
65
  // animated) — `width` cannot be driven by the native animated module, and mixing
@@ -59,10 +70,10 @@ const SegmentedControl = exports.SegmentedControl = /*#__PURE__*/(0, _react.forw
59
70
  const [trackWidth, setTrackWidth] = (0, _react.useState)(0);
60
71
  const thumbTranslateX = (0, _react.useRef)((0, _index.createAnimatedValue)(0)).current;
61
72
  const activeIndex = Math.max(0, segments.findIndex(s => s.value === value));
62
- const segmentWidth = trackWidth > 0 ? (trackWidth - TRACK_PADDING * 2) / Math.max(segments.length, 1) : 0;
73
+ const segmentWidth = trackWidth > 0 ? (trackWidth - trackPadding * 2) / Math.max(segments.length, 1) : 0;
63
74
  const animateThumb = (0, _react.useCallback)((index, segWidth) => {
64
75
  if (segWidth <= 0) return;
65
- const targetX = TRACK_PADDING + segWidth * index;
76
+ const targetX = trackPadding + segWidth * index;
66
77
  const spring = theme.motion.spring.snappy;
67
78
  _reactNative.Animated.spring(thumbTranslateX, {
68
79
  toValue: targetX,
@@ -86,9 +97,9 @@ const SegmentedControl = exports.SegmentedControl = /*#__PURE__*/(0, _react.forw
86
97
  const handlePress = (0, _react.useCallback)(segment => {
87
98
  if (disabled) return;
88
99
  if (segment.value === value) return;
89
- (0, _index2.triggerHaptic)('selection');
100
+ if (changeHapticEnabled) (0, _index2.triggerHaptic)('selection');
90
101
  onChange(segment.value);
91
- }, [disabled, onChange, value]);
102
+ }, [disabled, onChange, value, changeHapticEnabled]);
92
103
  const thumbBg = tone === 'primary' ? theme.colors.background.elevated : theme.colors.background.elevated;
93
104
  const activeTextColor = tone === 'primary' ? theme.colors.text.primary : theme.colors.text.primary;
94
105
  return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
@@ -100,23 +111,24 @@ const SegmentedControl = exports.SegmentedControl = /*#__PURE__*/(0, _react.forw
100
111
  height: sizeStyles.height,
101
112
  borderRadius: theme.radius.md,
102
113
  backgroundColor: theme.colors.background.tertiary,
103
- padding: TRACK_PADDING,
114
+ padding: trackPadding,
104
115
  opacity: disabled ? 0.55 : 1,
105
116
  alignSelf: fullWidth ? 'stretch' : 'flex-start'
106
- }, style],
117
+ }, containerStyle, style],
107
118
  onLayout: handleTrackLayout,
108
119
  children: [segmentWidth > 0 ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Animated.View, {
109
120
  pointerEvents: "none",
110
121
  style: [styles.thumb, {
122
+ top: trackPadding,
111
123
  width: segmentWidth,
112
- height: sizeStyles.height - TRACK_PADDING * 2,
124
+ height: sizeStyles.height - trackPadding * 2,
113
125
  borderRadius: theme.radius.sm,
114
126
  backgroundColor: thumbBg,
115
127
  transform: [{
116
128
  translateX: thumbTranslateX
117
129
  }],
118
130
  ...theme.shadows.sm
119
- }]
131
+ }, selectedIndicatorStyle]
120
132
  }) : null, segments.map(segment => {
121
133
  const isActive = segment.value === value;
122
134
  return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.Pressable, {
@@ -142,7 +154,7 @@ const SegmentedControl = exports.SegmentedControl = /*#__PURE__*/(0, _react.forw
142
154
  color: isActive ? activeTextColor : theme.colors.text.tertiary,
143
155
  fontSize: sizeStyles.fontSize,
144
156
  fontWeight: isActive ? theme.typography.fontWeight.semibold : theme.typography.fontWeight.medium
145
- }, textStyle],
157
+ }, textStyle, labelStyle],
146
158
  numberOfLines: 1,
147
159
  children: segment.label
148
160
  })]
@@ -159,7 +171,6 @@ const buildStyles = _theme => _reactNative.StyleSheet.create({
159
171
  },
160
172
  thumb: {
161
173
  position: 'absolute',
162
- top: TRACK_PADDING,
163
174
  left: 0
164
175
  },
165
176
  segment: {