@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
@@ -6,8 +6,10 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports.default = exports.Select = 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 _index2 = require("../../utils/index.js");
12
+ var _FieldBase = require("../FieldBase/FieldBase.js");
11
13
  var _jsxRuntime = require("react/jsx-runtime");
12
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); }
13
15
  /**
@@ -18,33 +20,6 @@ function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r
18
20
  * client-side search, theme-aware styling, full a11y, and dark-mode auto.
19
21
  */
20
22
 
21
- const sizeMap = {
22
- sm: {
23
- paddingHorizontal: 12,
24
- paddingVertical: 8,
25
- minHeight: 38,
26
- fontSize: 13,
27
- borderRadius: 10,
28
- iconSize: 16
29
- },
30
- md: {
31
- paddingHorizontal: 14,
32
- paddingVertical: 11,
33
- minHeight: 46,
34
- fontSize: 15,
35
- borderRadius: 12,
36
- iconSize: 18
37
- },
38
- lg: {
39
- paddingHorizontal: 16,
40
- paddingVertical: 14,
41
- minHeight: 54,
42
- fontSize: 16,
43
- borderRadius: 14,
44
- iconSize: 20
45
- }
46
- };
47
-
48
23
  // `unknown` here keeps the forwardRef signature non-generic — consumers who
49
24
  // pass non-`SelectOption` shapes use the accessor props; type inference is
50
25
  // preserved at the call site via the `SelectProps<T>` union.
@@ -76,8 +51,12 @@ const Select = exports.Select = /*#__PURE__*/(0, _react.forwardRef)((props, ref)
76
51
  const disabledOf = (0, _react.useCallback)(o => getOptionDisabled ? getOptionDisabled(o) : o.disabled === true, [getOptionDisabled]);
77
52
  const descriptionOf = (0, _react.useCallback)(o => getOptionDescription ? getOptionDescription(o) : o.description, [getOptionDescription]);
78
53
  const theme = (0, _index.useTheme)();
54
+ const insets = (0, _reactNativeSafeAreaContext.useSafeAreaInsets)();
79
55
  const styles = (0, _react.useMemo)(() => buildStyles(theme), [theme]);
80
- const sizeStyles = sizeMap[size];
56
+ const sizeTokens = (0, _FieldBase.resolveFieldSize)(theme, size);
57
+ const fieldText = (0, _FieldBase.resolveFieldTextStyle)(theme, {
58
+ disabled
59
+ });
81
60
  const [open, setOpen] = (0, _react.useState)(false);
82
61
  const [query, setQuery] = (0, _react.useState)('');
83
62
  const screenHeight = _reactNative.Dimensions.get('window').height;
@@ -88,11 +67,13 @@ const Select = exports.Select = /*#__PURE__*/(0, _react.forwardRef)((props, ref)
88
67
  const sheetAnim = (0, _react.useRef)((0, _index.createAnimatedValue)(sheetMaxHeight)).current;
89
68
  (0, _react.useEffect)(() => {
90
69
  if (open) {
91
- _reactNative.Animated.parallel([_reactNative.Animated.timing(backdropAnim, {
70
+ _reactNative.Animated.parallel([
71
+ // Backdrop opacity uses JS driver — see Modal.tsx for the Fabric reason.
72
+ _reactNative.Animated.timing(backdropAnim, {
92
73
  toValue: 1,
93
74
  duration: theme.motion.duration.fast,
94
75
  easing: _reactNative.Easing.bezier(...theme.motion.easing.standard),
95
- useNativeDriver: true
76
+ useNativeDriver: false
96
77
  }), _reactNative.Animated.spring(sheetAnim, {
97
78
  toValue: 0,
98
79
  damping: theme.motion.spring.snappy.damping,
@@ -105,7 +86,7 @@ const Select = exports.Select = /*#__PURE__*/(0, _react.forwardRef)((props, ref)
105
86
  toValue: 0,
106
87
  duration: theme.motion.duration.fast,
107
88
  easing: _reactNative.Easing.bezier(...theme.motion.easing.standard),
108
- useNativeDriver: true
89
+ useNativeDriver: false
109
90
  }), _reactNative.Animated.timing(sheetAnim, {
110
91
  toValue: sheetMaxHeight,
111
92
  duration: theme.motion.duration.fast,
@@ -165,7 +146,6 @@ const Select = exports.Select = /*#__PURE__*/(0, _react.forwardRef)((props, ref)
165
146
  const triggerText = selectedOptions.length === 0 ? placeholder ?? 'Select…' : selectedOptions.map(o => labelOf(o)).join(', ');
166
147
  const showingPlaceholder = selectedOptions.length === 0;
167
148
  const hasError = typeof error === 'string' && error.length > 0;
168
- const borderColor = hasError ? theme.colors.border.error : theme.colors.border.primary;
169
149
  const a11ySummary = selectedOptions.length === 0 ? placeholder ?? 'No selection' : `Selected: ${selectedOptions.map(o => labelOf(o)).join(', ')}`;
170
150
  const a11yLabel = accessibilityLabel ?? `${label ?? 'Select'}. ${a11ySummary}`;
171
151
  const renderOption = ({
@@ -245,45 +225,37 @@ const Select = exports.Select = /*#__PURE__*/(0, _react.forwardRef)((props, ref)
245
225
  marginBottom: theme.spacing.xxs
246
226
  }],
247
227
  children: label
248
- }) : null, /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.Pressable, {
228
+ }) : null, /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
249
229
  ref: ref,
250
- onPress: handleOpen,
251
- disabled: disabled,
252
- accessibilityRole: "button",
253
- accessibilityLabel: a11yLabel,
254
- accessibilityState: {
255
- disabled,
256
- expanded: open
257
- },
258
- android_ripple: {
259
- color: theme.colors.surface.pressed,
260
- borderless: false
261
- },
262
- style: ({
263
- pressed
264
- }) => [styles.trigger, {
265
- minHeight: sizeStyles.minHeight,
266
- paddingHorizontal: sizeStyles.paddingHorizontal,
267
- paddingVertical: sizeStyles.paddingVertical,
268
- borderRadius: sizeStyles.borderRadius,
269
- borderColor,
270
- borderWidth: 1.5,
271
- backgroundColor: disabled ? theme.colors.surface.disabled : pressed ? theme.colors.surface.pressed : theme.colors.background.primary,
272
- opacity: disabled ? 0.65 : 1
273
- }, triggerStyle],
274
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
275
- style: [styles.triggerText, {
276
- color: showingPlaceholder ? theme.colors.text.tertiary : theme.colors.text.primary,
277
- fontSize: sizeStyles.fontSize,
278
- fontWeight: theme.typography.fontWeight.medium
279
- }, textStyle],
280
- numberOfLines: 1,
281
- children: triggerText
282
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(Chevron, {
283
- color: disabled ? theme.colors.text.disabled : theme.colors.text.tertiary,
284
- size: sizeStyles.iconSize,
285
- open: open
286
- })]
230
+ collapsable: false,
231
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_FieldBase.FieldBase, {
232
+ size: size,
233
+ disabled: disabled,
234
+ error: hasError,
235
+ filled: selectedOptions.length > 0,
236
+ onPress: handleOpen,
237
+ accessibilityRole: "button",
238
+ accessibilityLabel: a11yLabel,
239
+ accessibilityState: {
240
+ disabled,
241
+ expanded: open
242
+ },
243
+ style: triggerStyle,
244
+ trailing: /*#__PURE__*/(0, _jsxRuntime.jsx)(Chevron, {
245
+ color: disabled ? theme.colors.text.disabled : theme.colors.text.tertiary,
246
+ size: sizeTokens.iconSize,
247
+ open: open
248
+ }),
249
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
250
+ style: [styles.triggerText, {
251
+ color: showingPlaceholder ? fieldText.placeholderColor : fieldText.color,
252
+ fontSize: sizeTokens.fontSize,
253
+ ...fieldText.weightStyle
254
+ }, textStyle],
255
+ numberOfLines: 1,
256
+ children: triggerText
257
+ })
258
+ })
287
259
  }), hasError ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
288
260
  style: [styles.errorText, {
289
261
  color: theme.colors.error,
@@ -297,25 +269,29 @@ const Select = exports.Select = /*#__PURE__*/(0, _react.forwardRef)((props, ref)
297
269
  transparent: true,
298
270
  animationType: "none",
299
271
  onRequestClose: handleClose,
300
- statusBarTranslucent: true,
301
- children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
302
- style: _reactNative.StyleSheet.absoluteFill,
303
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Animated.View, {
304
- style: [_reactNative.StyleSheet.absoluteFillObject, {
305
- backgroundColor: theme.colors.background.overlay,
306
- opacity: backdropAnim
307
- }],
308
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Pressable, {
309
- style: _reactNative.StyleSheet.absoluteFill,
310
- onPress: handleClose,
311
- accessibilityRole: "button",
312
- accessibilityLabel: "Close picker"
313
- })
272
+ statusBarTranslucent: true
273
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
274
+ // @ts-ignore — Android-only RN 0.71+; iOS ignores it.
275
+ ,
276
+ navigationBarTranslucent: true,
277
+ children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View
278
+ // Backdrop wraps the sheet — see Modal.tsx for the Fabric reason.
279
+ , {
280
+ collapsable: false,
281
+ style: [_reactNative.StyleSheet.absoluteFill, {
282
+ backgroundColor: theme.colors.background.overlay
283
+ }],
284
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Pressable, {
285
+ style: _reactNative.StyleSheet.absoluteFill,
286
+ onPress: handleClose,
287
+ accessibilityRole: "button",
288
+ accessibilityLabel: "Close picker"
314
289
  }), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.Animated.View, {
315
290
  accessibilityViewIsModal: true,
316
291
  accessibilityLabel: label ?? placeholder ?? 'Options',
317
292
  style: [styles.sheet, {
318
293
  maxHeight: sheetMaxHeight,
294
+ paddingBottom: insets.bottom + 16,
319
295
  backgroundColor: theme.colors.background.elevated,
320
296
  borderTopLeftRadius: theme.radius.xl,
321
297
  borderTopRightRadius: theme.radius.xl,
@@ -328,7 +304,7 @@ const Select = exports.Select = /*#__PURE__*/(0, _react.forwardRef)((props, ref)
328
304
  style: styles.sheetHandleRow,
329
305
  children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
330
306
  style: [styles.sheetHandle, {
331
- backgroundColor: theme.colors.border.primary
307
+ backgroundColor: theme.components.select?.handleColor ?? theme.components.bottomSheet?.handleColor ?? theme.colors.border.primary
332
308
  }]
333
309
  })
334
310
  }), label ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
@@ -350,7 +326,7 @@ const Select = exports.Select = /*#__PURE__*/(0, _react.forwardRef)((props, ref)
350
326
  onChangeText: setQuery,
351
327
  placeholder: "Search\u2026",
352
328
  placeholderTextColor: theme.colors.text.tertiary,
353
- selectionColor: theme.colors.border.focus,
329
+ selectionColor: (0, _FieldBase.resolveVariantColors)(theme, theme.components.field?.defaultVariant ?? 'outlined').borderFocused,
354
330
  accessibilityLabel: "Search options",
355
331
  style: [styles.searchInput, {
356
332
  color: theme.colors.text.primary,
@@ -461,11 +437,6 @@ const buildStyles = _theme => _reactNative.StyleSheet.create({
461
437
  label: {
462
438
  includeFontPadding: false
463
439
  },
464
- trigger: {
465
- flexDirection: 'row',
466
- alignItems: 'center',
467
- justifyContent: 'space-between'
468
- },
469
440
  triggerText: {
470
441
  flex: 1,
471
442
  includeFontPadding: false
@@ -3,25 +3,60 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.default = exports.SkeletonText = exports.SkeletonListItem = exports.SkeletonCircle = exports.SkeletonCard = exports.SkeletonAvatar = exports.Skeleton = void 0;
6
+ exports.default = exports.SkeletonText = exports.SkeletonCircle = exports.Skeleton = 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
10
  var _index2 = require("../../utils/index.js");
11
+ var _SkeletonClock = require("./SkeletonClock.js");
11
12
  var _SkeletonProvider = require("./SkeletonProvider.js");
12
13
  var _jsxRuntime = require("react/jsx-runtime");
13
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); }
14
- const SPEED_DURATION = {
15
- slow: 1800,
16
- normal: 1200,
17
- fast: 800
18
- };
19
- const PULSE_DURATION = 1000;
20
- const AVATAR_SIZE = {
21
- sm: 32,
22
- md: 48,
23
- lg: 64
24
- };
15
+ /**
16
+ * Skeleton — the leaf placeholder primitive.
17
+ *
18
+ * Every Skeleton on screen reads the shared shimmer/pulse clock from
19
+ * `SkeletonProvider` (see SkeletonClock.tsx). One native-driver loop per
20
+ * provider drives every instance, so 50 placeholders on a list don't spawn
21
+ * 50 timers and the shimmer bands never drift out of phase.
22
+ *
23
+ * Visual:
24
+ * - A View with the base color and `overflow: hidden` + radius gives the
25
+ * placeholder its shape.
26
+ * - For `animation: 'shimmer'`, an Animated.View carrying a 3-stop
27
+ * `LinearGradient` (transparent → highlight → transparent) translates
28
+ * across the box. The radius clips it to the right outline automatically.
29
+ * - For `animation: 'pulse'`, a full-fill Animated.View fades its opacity
30
+ * between 0 and 0.6. Cheap and useful for tiny shapes where a sweep
31
+ * would barely be visible.
32
+ * - For `animation: 'none'` (or when the OS Reduce Motion preference is
33
+ * on), just the base color renders.
34
+ *
35
+ * `variant` describes the SHAPE: rect (default), rounded (theme.radius.md),
36
+ * circle (50%), or text (small radius, slightly inset height). Set width /
37
+ * height directly for full control.
38
+ */
39
+
40
+ // `react-native-linear-gradient` is an OPTIONAL peer dep. When it's installed
41
+ // we sweep a real gradient band across the shimmer. When it isn't, we fall
42
+ // back to a solid-color band — still works, just less polished. This keeps
43
+ // the library deployable in apps that don't need gradients elsewhere.
44
+ let LinearGradientImpl = null;
45
+ try {
46
+ // eslint-disable-next-line @typescript-eslint/no-require-imports
47
+ LinearGradientImpl = require('react-native-linear-gradient').default;
48
+ } catch {
49
+ // Optional peer; resolved lazily by consumers that need shimmer polish.
50
+ }
51
+
52
+ /** Animation pattern. */
53
+
54
+ /** Sweep speed for the shimmer band. Ignored for pulse / none. */
55
+
56
+ /** Pre-defined shape archetype. Plays nicely with `width`/`height` overrides. */
57
+
58
+ /** `theme.radius` token name or a literal pixel value. */
59
+
25
60
  const resolveRadius = (theme, radius) => {
26
61
  if (typeof radius === 'number') return radius;
27
62
  return theme.radius[radius];
@@ -31,92 +66,128 @@ const resolveWidth = width => {
31
66
  if (typeof width === 'number') return width;
32
67
  return width;
33
68
  };
69
+ const radiusForShape = (theme, shape, width, height, explicit) => {
70
+ if (explicit !== undefined) return resolveRadius(theme, explicit);
71
+ switch (shape) {
72
+ case 'circle':
73
+ // Half the smallest known dimension. If width is a percentage we can't
74
+ // resolve here — fall back to height/2 which is the typical caller
75
+ // intent (square avatars).
76
+ return Math.floor(typeof width === 'number' ? Math.min(width, height) / 2 : height / 2);
77
+ case 'rounded':
78
+ return theme.radius.md;
79
+ case 'text':
80
+ return theme.radius.sm;
81
+ case 'rect':
82
+ default:
83
+ return theme.radius.sm;
84
+ }
85
+ };
34
86
  const Skeleton = ({
87
+ shape = 'rect',
35
88
  width = '100%',
36
89
  height = 16,
37
90
  radius,
38
91
  variant,
39
- speed,
92
+ speed: _speedProp,
40
93
  colors,
41
94
  style,
42
95
  testID
43
96
  }) => {
44
97
  const theme = (0, _index.useTheme)();
45
98
  const defaults = (0, _SkeletonProvider.useSkeletonDefaults)();
99
+ const clock = (0, _SkeletonClock.useSkeletonClock)();
46
100
  const resolvedVariant = variant ?? defaults.variant ?? 'shimmer';
47
- const resolvedSpeed = speed ?? defaults.speed ?? 'normal';
48
- const resolvedRadiusToken = radius ?? defaults.radius ?? 'sm';
101
+ const effectiveVariant = clock.enabled ? resolvedVariant : 'none';
49
102
  const backgroundColor = colors?.background ?? defaults.colors?.background ?? theme.colors.skeleton.background;
50
103
  const highlightColor = colors?.highlight ?? defaults.colors?.highlight ?? theme.colors.skeleton.highlight;
51
- const styles = (0, _react.useMemo)(() => buildStyles(theme), [theme]);
52
- const borderRadius = resolveRadius(theme, resolvedRadiusToken);
104
+ const styles = (0, _react.useMemo)(() => buildStyles(), []);
53
105
  const resolvedWidth = resolveWidth(width);
54
106
  const resolvedHeight = _index2.Responsive.size(height);
55
- const progress = (0, _react.useRef)((0, _index.createAnimatedValue)(0)).current;
107
+ const borderRadius = radiusForShape(theme, shape, resolvedWidth, resolvedHeight, radius);
56
108
  const [containerWidth, setContainerWidth] = (0, _react.useState)(0);
57
- (0, _react.useEffect)(() => {
58
- (0, _index.setNativeValue)(progress, 0);
59
- const duration = resolvedVariant === 'pulse' ? PULSE_DURATION : SPEED_DURATION[resolvedSpeed];
60
- const animation = resolvedVariant === 'pulse' ? _reactNative.Animated.loop(_reactNative.Animated.sequence([_reactNative.Animated.timing(progress, {
61
- toValue: 1,
62
- duration: duration / 2,
63
- easing: _reactNative.Easing.inOut(_reactNative.Easing.ease),
64
- useNativeDriver: true
65
- }), _reactNative.Animated.timing(progress, {
66
- toValue: 0,
67
- duration: duration / 2,
68
- easing: _reactNative.Easing.inOut(_reactNative.Easing.ease),
69
- useNativeDriver: true
70
- })])) : _reactNative.Animated.loop(_reactNative.Animated.timing(progress, {
71
- toValue: 1,
72
- duration,
73
- easing: _reactNative.Easing.linear,
74
- useNativeDriver: true
75
- }));
76
- animation.start();
77
- return () => {
78
- animation.stop();
79
- };
80
- }, [progress, resolvedSpeed, resolvedVariant]);
81
109
  const handleLayout = event => {
82
110
  const next = event.nativeEvent.layout.width;
83
111
  if (next !== containerWidth) setContainerWidth(next);
84
112
  };
113
+
114
+ // The shimmer band is wider than the box so the gradient feathers off the
115
+ // edges instead of popping at them. Width = 70% of container, capped to a
116
+ // sensible minimum so tiny placeholders still get a visible sweep.
117
+ const bandWidth = (0, _react.useMemo)(() => {
118
+ if (containerWidth <= 0) return 0;
119
+ return Math.max(48, containerWidth * 0.7);
120
+ }, [containerWidth]);
121
+
122
+ // Interpolate the shared 0→1 clock into translateX. The band starts fully
123
+ // off the left edge and ends fully off the right edge, so each loop sweeps
124
+ // the full width regardless of how wide the placeholder is.
125
+ const translateX = (0, _react.useMemo)(() => {
126
+ if (containerWidth <= 0) return 0;
127
+ return clock.shimmer.interpolate({
128
+ inputRange: [0, 1],
129
+ outputRange: [-bandWidth, containerWidth]
130
+ });
131
+ }, [clock.shimmer, bandWidth, containerWidth]);
85
132
  const overlay = (0, _react.useMemo)(() => {
86
- if (resolvedVariant === 'pulse') {
133
+ if (effectiveVariant === 'none') return null;
134
+ if (effectiveVariant === 'pulse') {
135
+ // Pulse fades a full-fill highlight overlay in and out. Cheaper than
136
+ // shimmer and visible at any size.
87
137
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Animated.View, {
88
138
  pointerEvents: "none",
89
139
  style: [_reactNative.StyleSheet.absoluteFillObject, {
90
140
  backgroundColor: highlightColor,
91
- opacity: progress.interpolate({
141
+ opacity: clock.pulse.interpolate({
92
142
  inputRange: [0, 1],
93
- outputRange: [0, 0.6]
143
+ outputRange: [0, 0.55]
94
144
  })
95
145
  }]
96
146
  });
97
147
  }
98
148
  if (containerWidth <= 0) return null;
99
- const highlightWidth = Math.max(48, containerWidth * 0.6);
100
- const translateX = progress.interpolate({
101
- inputRange: [0, 1],
102
- outputRange: [-highlightWidth, containerWidth]
103
- });
149
+
150
+ // 3-stop gradient: transparent → highlight → transparent. Feathered
151
+ // edges feel premium; a solid band looks like a bug. When the optional
152
+ // gradient package isn't installed we render the band as a solid
153
+ // highlight rectangle — visibly different but still recognizably a
154
+ // shimmer effect.
104
155
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Animated.View, {
105
156
  pointerEvents: "none",
106
- style: [styles.shimmer, {
107
- width: highlightWidth,
108
- backgroundColor: highlightColor,
157
+ style: [styles.shimmerBand, {
158
+ width: bandWidth,
109
159
  transform: [{
110
160
  translateX
111
161
  }]
112
- }]
162
+ }],
163
+ children: LinearGradientImpl ? /*#__PURE__*/(0, _jsxRuntime.jsx)(LinearGradientImpl, {
164
+ colors: ['transparent', highlightColor, 'transparent'],
165
+ locations: [0, 0.5, 1],
166
+ start: {
167
+ x: 0,
168
+ y: 0.5
169
+ },
170
+ end: {
171
+ x: 1,
172
+ y: 0.5
173
+ },
174
+ style: _reactNative.StyleSheet.absoluteFillObject
175
+ }) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
176
+ style: [_reactNative.StyleSheet.absoluteFillObject, {
177
+ backgroundColor: highlightColor,
178
+ opacity: 0.55
179
+ }]
180
+ })
113
181
  });
114
- }, [containerWidth, progress, styles.shimmer, highlightColor, resolvedVariant]);
182
+ }, [effectiveVariant, highlightColor, clock.pulse, containerWidth, styles.shimmerBand, bandWidth, translateX]);
115
183
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
116
184
  onLayout: handleLayout,
117
185
  accessible: true,
118
186
  accessibilityLabel: "Loading",
119
187
  accessibilityRole: "progressbar",
188
+ accessibilityState: {
189
+ busy: true
190
+ },
120
191
  accessibilityLiveRegion: "polite",
121
192
  testID: testID,
122
193
  style: [styles.base, {
@@ -138,9 +209,9 @@ const SkeletonCircle = ({
138
209
  const diameter = _index2.Responsive.size(size);
139
210
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(Skeleton, {
140
211
  ...rest,
212
+ shape: "circle",
141
213
  width: diameter,
142
214
  height: size,
143
- radius: "full",
144
215
  style: [{
145
216
  width: diameter,
146
217
  height: diameter,
@@ -175,6 +246,7 @@ const SkeletonText = ({
175
246
  const isLast = index === safeLines - 1;
176
247
  const lineWidth = isLast && safeLines > 1 ? lastLineWidth : width;
177
248
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(Skeleton, {
249
+ shape: "text",
178
250
  width: lineWidth,
179
251
  height: lineHeight,
180
252
  radius: radius,
@@ -189,130 +261,15 @@ const SkeletonText = ({
189
261
  };
190
262
  exports.SkeletonText = SkeletonText;
191
263
  SkeletonText.displayName = 'SkeletonText';
192
- const SkeletonAvatar = ({
193
- size = 'md',
194
- ...rest
195
- }) => {
196
- return /*#__PURE__*/(0, _jsxRuntime.jsx)(SkeletonCircle, {
197
- ...rest,
198
- size: AVATAR_SIZE[size]
199
- });
200
- };
201
- exports.SkeletonAvatar = SkeletonAvatar;
202
- SkeletonAvatar.displayName = 'SkeletonAvatar';
203
- const SkeletonCard = ({
204
- variant,
205
- speed,
206
- radius = 'md',
207
- style,
208
- testID
209
- }) => {
210
- const theme = (0, _index.useTheme)();
211
- return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
212
- style: [{
213
- padding: theme.spacing.md
214
- }, style],
215
- testID: testID,
216
- children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
217
- style: {
218
- flexDirection: 'row',
219
- alignItems: 'center',
220
- marginBottom: theme.spacing.md
221
- },
222
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(SkeletonAvatar, {
223
- size: "md",
224
- variant: variant,
225
- speed: speed
226
- }), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
227
- style: {
228
- flex: 1,
229
- marginLeft: theme.spacing.sm
230
- },
231
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(Skeleton, {
232
- width: "60%",
233
- height: 14,
234
- radius: radius,
235
- variant: variant,
236
- speed: speed,
237
- style: {
238
- marginBottom: theme.spacing.xs
239
- }
240
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(Skeleton, {
241
- width: "40%",
242
- height: 12,
243
- radius: radius,
244
- variant: variant,
245
- speed: speed
246
- })]
247
- })]
248
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(SkeletonText, {
249
- lines: 2,
250
- fontSize: 14,
251
- variant: variant,
252
- speed: speed,
253
- radius: radius
254
- })]
255
- });
256
- };
257
- exports.SkeletonCard = SkeletonCard;
258
- SkeletonCard.displayName = 'SkeletonCard';
259
- const SkeletonListItem = ({
260
- avatarSize = 'md',
261
- variant,
262
- speed,
263
- radius = 'sm',
264
- style,
265
- testID
266
- }) => {
267
- const theme = (0, _index.useTheme)();
268
- return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
269
- style: [{
270
- flexDirection: 'row',
271
- alignItems: 'center',
272
- paddingHorizontal: theme.spacing.md,
273
- paddingVertical: theme.spacing.sm
274
- }, style],
275
- testID: testID,
276
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(SkeletonAvatar, {
277
- size: avatarSize,
278
- variant: variant,
279
- speed: speed
280
- }), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
281
- style: {
282
- flex: 1,
283
- marginLeft: theme.spacing.sm
284
- },
285
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(Skeleton, {
286
- width: "70%",
287
- height: 14,
288
- radius: radius,
289
- variant: variant,
290
- speed: speed,
291
- style: {
292
- marginBottom: theme.spacing.xs
293
- }
294
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(Skeleton, {
295
- width: "45%",
296
- height: 12,
297
- radius: radius,
298
- variant: variant,
299
- speed: speed
300
- })]
301
- })]
302
- });
303
- };
304
- exports.SkeletonListItem = SkeletonListItem;
305
- SkeletonListItem.displayName = 'SkeletonListItem';
306
- const buildStyles = _theme => _reactNative.StyleSheet.create({
264
+ const buildStyles = () => _reactNative.StyleSheet.create({
307
265
  base: {
308
266
  overflow: 'hidden'
309
267
  },
310
- shimmer: {
268
+ shimmerBand: {
311
269
  position: 'absolute',
312
270
  top: 0,
313
271
  bottom: 0,
314
- left: 0,
315
- opacity: 0.55
272
+ left: 0
316
273
  }
317
274
  });
318
275
  var _default = exports.default = Skeleton;