@webority-technologies/mobile 0.0.7 → 0.0.9

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 (105) hide show
  1. package/lib/commonjs/components/Accordion/Accordion.js +3 -3
  2. package/lib/commonjs/components/Avatar/Avatar.js +1 -1
  3. package/lib/commonjs/components/Badge/Badge.js +24 -14
  4. package/lib/commonjs/components/Banner/Banner.js +2 -2
  5. package/lib/commonjs/components/BottomNavigation/BottomNavigation.js +1 -1
  6. package/lib/commonjs/components/BottomSheet/BottomSheet.js +39 -5
  7. package/lib/commonjs/components/Button/Button.js +25 -6
  8. package/lib/commonjs/components/Card/Card.js +13 -1
  9. package/lib/commonjs/components/Carousel/Carousel.js +2 -2
  10. package/lib/commonjs/components/Checkbox/Checkbox.js +6 -4
  11. package/lib/commonjs/components/Chip/Chip.js +12 -3
  12. package/lib/commonjs/components/DatePicker/DatePicker.js +8 -8
  13. package/lib/commonjs/components/DateRangePicker/DateRangePicker.js +4 -4
  14. package/lib/commonjs/components/Dialog/Dialog.js +15 -8
  15. package/lib/commonjs/components/EmptyState/EmptyState.js +32 -26
  16. package/lib/commonjs/components/FloatingActionButton/FloatingActionButton.js +2 -2
  17. package/lib/commonjs/components/FormField/FormField.js +4 -4
  18. package/lib/commonjs/components/Input/Input.js +18 -10
  19. package/lib/commonjs/components/ListItem/ListItem.js +33 -27
  20. package/lib/commonjs/components/Modal/Modal.js +4 -4
  21. package/lib/commonjs/components/OTPInput/OTPInput.js +7 -4
  22. package/lib/commonjs/components/ProgressBar/ProgressBar.js +2 -2
  23. package/lib/commonjs/components/Radio/Radio.js +8 -7
  24. package/lib/commonjs/components/SearchBar/SearchBar.js +10 -6
  25. package/lib/commonjs/components/SegmentedControl/SegmentedControl.js +2 -2
  26. package/lib/commonjs/components/Select/Select.js +3 -3
  27. package/lib/commonjs/components/Skeleton/Skeleton.js +1 -1
  28. package/lib/commonjs/components/Slider/Slider.js +6 -6
  29. package/lib/commonjs/components/Spinner/Spinner.js +2 -2
  30. package/lib/commonjs/components/Stepper/Stepper.js +3 -3
  31. package/lib/commonjs/components/Switch/Switch.js +33 -4
  32. package/lib/commonjs/components/Tabs/Tabs.js +2 -2
  33. package/lib/commonjs/components/TimePicker/TimePicker.js +3 -3
  34. package/lib/commonjs/components/Toast/Toast.js +19 -14
  35. package/lib/commonjs/components/Tooltip/Tooltip.js +2 -2
  36. package/lib/commonjs/theme/Gradient.js +57 -0
  37. package/lib/commonjs/theme/animatedValue.js +28 -0
  38. package/lib/commonjs/theme/index.js +27 -0
  39. package/lib/commonjs/theme/textStyle.js +37 -0
  40. package/lib/commonjs/theme/tokens.js +260 -2
  41. package/lib/module/components/Accordion/Accordion.js +4 -4
  42. package/lib/module/components/Avatar/Avatar.js +2 -2
  43. package/lib/module/components/Badge/Badge.js +25 -15
  44. package/lib/module/components/Banner/Banner.js +3 -3
  45. package/lib/module/components/BottomNavigation/BottomNavigation.js +2 -2
  46. package/lib/module/components/BottomSheet/BottomSheet.js +40 -6
  47. package/lib/module/components/Button/Button.js +26 -7
  48. package/lib/module/components/Card/Card.js +14 -2
  49. package/lib/module/components/Carousel/Carousel.js +3 -3
  50. package/lib/module/components/Checkbox/Checkbox.js +7 -5
  51. package/lib/module/components/Chip/Chip.js +13 -4
  52. package/lib/module/components/DatePicker/DatePicker.js +9 -9
  53. package/lib/module/components/DateRangePicker/DateRangePicker.js +5 -5
  54. package/lib/module/components/Dialog/Dialog.js +16 -9
  55. package/lib/module/components/EmptyState/EmptyState.js +33 -27
  56. package/lib/module/components/FloatingActionButton/FloatingActionButton.js +3 -3
  57. package/lib/module/components/FormField/FormField.js +5 -5
  58. package/lib/module/components/Input/Input.js +19 -11
  59. package/lib/module/components/ListItem/ListItem.js +34 -28
  60. package/lib/module/components/Modal/Modal.js +5 -5
  61. package/lib/module/components/OTPInput/OTPInput.js +8 -5
  62. package/lib/module/components/ProgressBar/ProgressBar.js +3 -3
  63. package/lib/module/components/Radio/Radio.js +9 -8
  64. package/lib/module/components/SearchBar/SearchBar.js +11 -7
  65. package/lib/module/components/SegmentedControl/SegmentedControl.js +3 -3
  66. package/lib/module/components/Select/Select.js +4 -4
  67. package/lib/module/components/Skeleton/Skeleton.js +2 -2
  68. package/lib/module/components/Slider/Slider.js +7 -7
  69. package/lib/module/components/Spinner/Spinner.js +3 -3
  70. package/lib/module/components/Stepper/Stepper.js +4 -4
  71. package/lib/module/components/Switch/Switch.js +34 -5
  72. package/lib/module/components/Tabs/Tabs.js +3 -3
  73. package/lib/module/components/TimePicker/TimePicker.js +4 -4
  74. package/lib/module/components/Toast/Toast.js +20 -15
  75. package/lib/module/components/Tooltip/Tooltip.js +3 -3
  76. package/lib/module/theme/Gradient.js +50 -0
  77. package/lib/module/theme/animatedValue.js +24 -0
  78. package/lib/module/theme/index.js +3 -0
  79. package/lib/module/theme/textStyle.js +32 -0
  80. package/lib/module/theme/tokens.js +260 -2
  81. package/lib/typescript/commonjs/components/BottomSheet/BottomSheet.d.ts +10 -0
  82. package/lib/typescript/commonjs/components/Button/Button.d.ts +8 -0
  83. package/lib/typescript/commonjs/components/Card/Card.d.ts +8 -0
  84. package/lib/typescript/commonjs/components/Dialog/Dialog.d.ts +5 -0
  85. package/lib/typescript/commonjs/components/Input/Input.d.ts +12 -0
  86. package/lib/typescript/commonjs/components/Switch/Switch.d.ts +5 -0
  87. package/lib/typescript/commonjs/components/Toast/Toast.d.ts +5 -0
  88. package/lib/typescript/commonjs/theme/Gradient.d.ts +11 -0
  89. package/lib/typescript/commonjs/theme/animatedValue.d.ts +21 -0
  90. package/lib/typescript/commonjs/theme/index.d.ts +6 -1
  91. package/lib/typescript/commonjs/theme/textStyle.d.ts +18 -0
  92. package/lib/typescript/commonjs/theme/types.d.ts +178 -0
  93. package/lib/typescript/module/components/BottomSheet/BottomSheet.d.ts +10 -0
  94. package/lib/typescript/module/components/Button/Button.d.ts +8 -0
  95. package/lib/typescript/module/components/Card/Card.d.ts +8 -0
  96. package/lib/typescript/module/components/Dialog/Dialog.d.ts +5 -0
  97. package/lib/typescript/module/components/Input/Input.d.ts +12 -0
  98. package/lib/typescript/module/components/Switch/Switch.d.ts +5 -0
  99. package/lib/typescript/module/components/Toast/Toast.d.ts +5 -0
  100. package/lib/typescript/module/theme/Gradient.d.ts +11 -0
  101. package/lib/typescript/module/theme/animatedValue.d.ts +21 -0
  102. package/lib/typescript/module/theme/index.d.ts +6 -1
  103. package/lib/typescript/module/theme/textStyle.d.ts +18 -0
  104. package/lib/typescript/module/theme/types.d.ts +178 -0
  105. package/package.json +5 -1
@@ -62,6 +62,8 @@ const Input = exports.Input = /*#__PURE__*/(0, _react.forwardRef)((props, ref) =
62
62
  variant = 'outlined',
63
63
  required = false,
64
64
  maxLength,
65
+ format,
66
+ parse,
65
67
  style,
66
68
  inputStyle,
67
69
  labelStyle,
@@ -74,7 +76,10 @@ const Input = exports.Input = /*#__PURE__*/(0, _react.forwardRef)((props, ref) =
74
76
  } = props;
75
77
  const theme = (0, _index.useTheme)();
76
78
  const styles = (0, _react.useMemo)(() => buildStyles(theme), [theme]);
77
- const sizeStyles = sizeMap[size];
79
+ const sizeStyles = {
80
+ ...sizeMap[size],
81
+ ...(theme.components.input?.[size] ?? {})
82
+ };
78
83
  const [isFocused, setIsFocused] = (0, _react.useState)(false);
79
84
  const [isPasswordVisible, setIsPasswordVisible] = (0, _react.useState)(false);
80
85
  const hasValue = typeof value === 'string' && value.length > 0;
@@ -84,11 +89,11 @@ const Input = exports.Input = /*#__PURE__*/(0, _react.forwardRef)((props, ref) =
84
89
  const showFloatingLabel = Boolean(label) && !multiline;
85
90
 
86
91
  // Animations
87
- const focusAnim = (0, _react.useRef)(new _reactNative.Animated.Value(0)).current; // 0 -> blurred, 1 -> focused
88
- const errorAnim = (0, _react.useRef)(new _reactNative.Animated.Value(0)).current; // 0 -> no error, 1 -> error
89
- const labelAnim = (0, _react.useRef)(new _reactNative.Animated.Value(shouldFloat ? 1 : 0)).current;
90
- const shakeAnim = (0, _react.useRef)(new _reactNative.Animated.Value(0)).current;
91
- const messageAnim = (0, _react.useRef)(new _reactNative.Animated.Value(hasError || helperText ? 1 : 0)).current;
92
+ const focusAnim = (0, _react.useRef)((0, _index.createAnimatedValue)(0)).current;
93
+ const errorAnim = (0, _react.useRef)((0, _index.createAnimatedValue)(0)).current;
94
+ const labelAnim = (0, _react.useRef)((0, _index.createAnimatedValue)(shouldFloat ? 1 : 0)).current;
95
+ const shakeAnim = (0, _react.useRef)((0, _index.createAnimatedValue)(0)).current;
96
+ const messageAnim = (0, _react.useRef)((0, _index.createAnimatedValue)(hasError || helperText ? 1 : 0)).current;
92
97
 
93
98
  // Focus border animation
94
99
  (0, _react.useEffect)(() => {
@@ -224,7 +229,7 @@ const Input = exports.Input = /*#__PURE__*/(0, _react.forwardRef)((props, ref) =
224
229
  style: [styles.staticLabel, {
225
230
  color: hasError ? theme.colors.error : isFocused ? theme.colors.border.focus : theme.colors.text.secondary,
226
231
  fontSize: theme.typography.fontSize.sm,
227
- fontWeight: theme.typography.fontWeight.medium,
232
+ ...(0, _index.fontFor)(theme, 'medium'),
228
233
  marginBottom: theme.spacing.xxs
229
234
  }, labelStyle],
230
235
  children: [label, required ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
@@ -258,7 +263,7 @@ const Input = exports.Input = /*#__PURE__*/(0, _react.forwardRef)((props, ref) =
258
263
  left: leftPad,
259
264
  color: labelColor,
260
265
  fontSize: sizeStyles.fontSize,
261
- fontWeight: theme.typography.fontWeight.medium,
266
+ ...(0, _index.fontFor)(theme, 'medium'),
262
267
  backgroundColor: shouldFloat && variant === 'outlined' ? theme.colors.background.primary : 'transparent',
263
268
  paddingHorizontal: shouldFloat && variant === 'outlined' ? 4 : 0,
264
269
  transform: [{
@@ -284,8 +289,11 @@ const Input = exports.Input = /*#__PURE__*/(0, _react.forwardRef)((props, ref) =
284
289
  }, inputStyle],
285
290
  placeholder: showFloatingLabel && !shouldFloat ? undefined : placeholder,
286
291
  placeholderTextColor: placeholderTextColor,
287
- value: value,
288
- onChangeText: onChangeText,
292
+ value: format && value != null ? format(value) : value,
293
+ onChangeText: text => {
294
+ if (!onChangeText) return;
295
+ onChangeText(parse ? parse(text) : text);
296
+ },
289
297
  onFocus: handleFocus,
290
298
  onBlur: handleBlur,
291
299
  editable: isEditable,
@@ -13,32 +13,38 @@ var _index2 = require("../Swipeable/index.js");
13
13
  var _index3 = require("../Skeleton/index.js");
14
14
  var _jsxRuntime = require("react/jsx-runtime");
15
15
  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); }
16
- const sizeFor = (theme, size) => {
17
- switch (size) {
18
- case 'sm':
19
- return {
20
- paddingVertical: theme.spacing.sm,
21
- titleSize: theme.typography.fontSize.sm,
22
- subtitleSize: theme.typography.fontSize.xs,
23
- minHeight: 44
24
- };
25
- case 'lg':
26
- return {
27
- paddingVertical: theme.spacing.lg,
28
- titleSize: theme.typography.fontSize.lg,
29
- subtitleSize: theme.typography.fontSize.sm,
30
- minHeight: 72
31
- };
32
- case 'md':
33
- default:
34
- return {
35
- paddingVertical: theme.spacing.md,
36
- titleSize: theme.typography.fontSize.base,
37
- subtitleSize: theme.typography.fontSize.sm,
38
- minHeight: 56
39
- };
16
+ const SIZE_FALLBACK = {
17
+ sm: {
18
+ paddingVertical: 'sm',
19
+ titleFontSize: 'sm',
20
+ subtitleFontSize: 'xs',
21
+ minHeight: 44
22
+ },
23
+ md: {
24
+ paddingVertical: 'md',
25
+ titleFontSize: 'base',
26
+ subtitleFontSize: 'sm',
27
+ minHeight: 56
28
+ },
29
+ lg: {
30
+ paddingVertical: 'lg',
31
+ titleFontSize: 'lg',
32
+ subtitleFontSize: 'sm',
33
+ minHeight: 72
40
34
  }
41
35
  };
36
+ const sizeFor = (theme, size) => {
37
+ const tokens = {
38
+ ...SIZE_FALLBACK[size],
39
+ ...(theme.components.listItem?.[size] ?? {})
40
+ };
41
+ return {
42
+ paddingVertical: theme.spacing[tokens.paddingVertical],
43
+ titleSize: theme.typography.fontSize[tokens.titleFontSize],
44
+ subtitleSize: theme.typography.fontSize[tokens.subtitleFontSize],
45
+ minHeight: tokens.minHeight
46
+ };
47
+ };
42
48
  const Chevron = ({
43
49
  color
44
50
  }) => /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
@@ -106,7 +112,7 @@ const ListItem = exports.ListItem = /*#__PURE__*/(0, _react.forwardRef)((props,
106
112
  children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
107
113
  style: [styles.title, {
108
114
  fontSize: sz.titleSize,
109
- fontWeight: theme.typography.fontWeight.medium,
115
+ ...(0, _index.fontFor)(theme, 'medium'),
110
116
  color: disabled ? theme.colors.text.disabled : theme.colors.text.primary
111
117
  }],
112
118
  numberOfLines: 1,
@@ -237,11 +243,11 @@ const buildStyles = theme => _reactNative.StyleSheet.create({
237
243
  },
238
244
  subtitle: {
239
245
  marginTop: 2,
240
- fontWeight: theme.typography.fontWeight.normal
246
+ ...(0, _index.fontFor)(theme, 'normal')
241
247
  },
242
248
  description: {
243
249
  marginTop: 2,
244
- fontWeight: theme.typography.fontWeight.normal
250
+ ...(0, _index.fontFor)(theme, 'normal')
245
251
  }
246
252
  });
247
253
  var _default = exports.default = ListItem;
@@ -29,10 +29,10 @@ const Modal = exports.Modal = /*#__PURE__*/(0, _react.forwardRef)((props, ref) =
29
29
  const theme = (0, _index.useTheme)();
30
30
  const duration = animationDuration ?? theme.motion.duration.normal;
31
31
  const screenHeight = _reactNative.Dimensions.get('window').height;
32
- const backdropAnim = (0, _react.useRef)(new _reactNative.Animated.Value(0)).current;
33
- const scaleAnim = (0, _react.useRef)(new _reactNative.Animated.Value(0.9)).current;
34
- const opacityAnim = (0, _react.useRef)(new _reactNative.Animated.Value(0)).current;
35
- const translateYAnim = (0, _react.useRef)(new _reactNative.Animated.Value(screenHeight)).current;
32
+ const backdropAnim = (0, _react.useRef)((0, _index.createAnimatedValue)(0)).current;
33
+ const scaleAnim = (0, _react.useRef)((0, _index.createAnimatedValue)(0.9)).current;
34
+ const opacityAnim = (0, _react.useRef)((0, _index.createAnimatedValue)(0)).current;
35
+ const translateYAnim = (0, _react.useRef)((0, _index.createAnimatedValue)(screenHeight)).current;
36
36
  const containerRef = (0, _react.useRef)(null);
37
37
  const wasVisibleRef = (0, _react.useRef)(false);
38
38
  const styles = (0, _react.useMemo)(() => buildStyles(theme), [theme]);
@@ -57,11 +57,14 @@ const OTPInput = exports.OTPInput = /*#__PURE__*/(0, _react.forwardRef)((props,
57
57
  } = props;
58
58
  const theme = (0, _index.useTheme)();
59
59
  const styles = (0, _react.useMemo)(() => buildStyles(theme), [theme]);
60
- const sizeStyles = sizeMap[size];
60
+ const sizeStyles = {
61
+ ...sizeMap[size],
62
+ ...(theme.components.otpInput?.[size] ?? {})
63
+ };
61
64
  const inputsRef = (0, _react.useRef)([]);
62
65
  const [focusedIndex, setFocusedIndex] = (0, _react.useState)(-1);
63
66
  const previousErrorRef = (0, _react.useRef)(null);
64
- const shake = (0, _react.useRef)(new _reactNative.Animated.Value(0)).current;
67
+ const shake = (0, _react.useRef)((0, _index.createAnimatedValue)(0)).current;
65
68
  const underlines = (0, _react.useRef)(Array.from({
66
69
  length
67
70
  }, () => new _reactNative.Animated.Value(0))).current;
@@ -302,7 +305,7 @@ const OTPInput = exports.OTPInput = /*#__PURE__*/(0, _react.forwardRef)((props,
302
305
  style: [styles.input, {
303
306
  fontSize: sizeStyles.fontSize,
304
307
  color: theme.colors.text.primary,
305
- fontWeight: theme.typography.fontWeight.semibold
308
+ ...(0, _index.fontFor)(theme, 'semibold')
306
309
  }, textStyle]
307
310
  }), secure && isFilled ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
308
311
  pointerEvents: "none",
@@ -311,7 +314,7 @@ const OTPInput = exports.OTPInput = /*#__PURE__*/(0, _react.forwardRef)((props,
311
314
  style: [{
312
315
  fontSize: sizeStyles.fontSize,
313
316
  color: theme.colors.text.primary,
314
- fontWeight: theme.typography.fontWeight.semibold
317
+ ...(0, _index.fontFor)(theme, 'semibold')
315
318
  }, textStyle],
316
319
  children: display
317
320
  })
@@ -45,8 +45,8 @@ const ProgressBar = exports.ProgressBar = /*#__PURE__*/(0, _react.forwardRef)((p
45
45
  } = props;
46
46
  const isIndeterminate = indeterminateProp ?? typeof progress !== 'number';
47
47
  const clamped = clampProgress(progress);
48
- const fillAnim = (0, _react.useRef)(new _reactNative.Animated.Value(clamped)).current;
49
- const loopAnim = (0, _react.useRef)(new _reactNative.Animated.Value(0)).current;
48
+ const fillAnim = (0, _react.useRef)((0, _index.createAnimatedValue)(clamped)).current;
49
+ const loopAnim = (0, _react.useRef)((0, _index.createAnimatedValue)(0)).current;
50
50
  const widthRef = (0, _react.useRef)(0);
51
51
  const styles = (0, _react.useMemo)(() => buildStyles(theme), [theme]);
52
52
  const resolvedRadius = radius ?? theme.radius.full;
@@ -62,11 +62,12 @@ const Radio = exports.Radio = /*#__PURE__*/(0, _react.forwardRef)((props, ref) =
62
62
  const selected = ctx ? ctx.selectedValue === value : !!selectedProp;
63
63
  const disabled = ctx ? ctx.disabled || disabledProp : disabledProp;
64
64
  const fillColor = toneColor(theme, tone);
65
- const {
66
- outer,
67
- inner
68
- } = sizeMap[size];
69
- const progress = (0, _react.useRef)(new _reactNative.Animated.Value(selected ? 1 : 0)).current;
65
+ const sizeOverrides = theme.components.radio?.[size];
66
+ const outer = sizeOverrides?.outer ?? sizeMap[size].outer;
67
+ const inner = sizeOverrides?.inner ?? sizeMap[size].inner;
68
+ const radioBorderWidth = theme.components.radio?.borderWidth ?? 1.5;
69
+ const radioLabelGap = theme.components.radio?.labelGap ?? 10;
70
+ const progress = (0, _react.useRef)((0, _index.createAnimatedValue)(selected ? 1 : 0)).current;
70
71
  (0, _react.useEffect)(() => {
71
72
  _reactNative.Animated.spring(progress, {
72
73
  toValue: selected ? 1 : 0,
@@ -114,6 +115,7 @@ const Radio = exports.Radio = /*#__PURE__*/(0, _react.forwardRef)((props, ref) =
114
115
  style: [styles.outer, {
115
116
  width: outer,
116
117
  height: outer,
118
+ borderWidth: radioBorderWidth,
117
119
  borderRadius: outer / 2,
118
120
  borderColor
119
121
  }, circleStyle],
@@ -131,6 +133,7 @@ const Radio = exports.Radio = /*#__PURE__*/(0, _react.forwardRef)((props, ref) =
131
133
  })
132
134
  }), label ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
133
135
  style: [styles.label, {
136
+ marginLeft: radioLabelGap,
134
137
  color: disabled ? theme.colors.text.disabled : theme.colors.text.primary,
135
138
  fontSize: theme.typography.fontSize.base
136
139
  }],
@@ -146,13 +149,11 @@ const buildStyles = _theme => _reactNative.StyleSheet.create({
146
149
  alignItems: 'center'
147
150
  },
148
151
  outer: {
149
- borderWidth: 1.5,
150
152
  alignItems: 'center',
151
153
  justifyContent: 'center'
152
154
  },
153
155
  inner: {},
154
156
  label: {
155
- marginLeft: 10,
156
157
  flexShrink: 1
157
158
  }
158
159
  });
@@ -58,12 +58,16 @@ const SearchBar = exports.SearchBar = /*#__PURE__*/(0, _react.forwardRef)((props
58
58
  ...rest
59
59
  } = props;
60
60
  const theme = (0, _index.useTheme)();
61
- const sizeStyles = sizeMap[size];
61
+ const sizeStyles = {
62
+ ...sizeMap[size],
63
+ ...(theme.components.searchBar?.[size] ?? {})
64
+ };
65
+ const cancelWidth = theme.components.searchBar?.cancelButtonWidth ?? CANCEL_WIDTH;
62
66
  const styles = (0, _react.useMemo)(() => buildStyles(theme), [theme]);
63
67
  const [isFocused, setIsFocused] = (0, _react.useState)(false);
64
68
  const [internalValue, setInternalValue] = (0, _react.useState)(value);
65
69
  const debouncedValue = (0, _useDebounce.useDebounce)(internalValue, debounceMs ?? 0);
66
- const cancelAnim = (0, _react.useRef)(new _reactNative.Animated.Value(0)).current;
70
+ const cancelAnim = (0, _react.useRef)((0, _index.createAnimatedValue)(0)).current;
67
71
 
68
72
  // Keep internal value in sync with controlled value when debouncing.
69
73
  (0, _react.useEffect)(() => {
@@ -127,7 +131,7 @@ const SearchBar = exports.SearchBar = /*#__PURE__*/(0, _react.forwardRef)((props
127
131
  // Container shrinks left to make room for cancel button on right.
128
132
  const cancelTranslateX = cancelAnim.interpolate({
129
133
  inputRange: [0, 1],
130
- outputRange: [CANCEL_WIDTH, 0]
134
+ outputRange: [cancelWidth, 0]
131
135
  });
132
136
  const cancelOpacity = cancelAnim;
133
137
  return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
@@ -144,7 +148,7 @@ const SearchBar = exports.SearchBar = /*#__PURE__*/(0, _react.forwardRef)((props
144
148
  opacity: disabled ? 0.55 : 1,
145
149
  marginRight: cancelAnim.interpolate({
146
150
  inputRange: [0, 1],
147
- outputRange: [0, CANCEL_WIDTH + theme.spacing.sm]
151
+ outputRange: [0, cancelWidth + theme.spacing.sm]
148
152
  })
149
153
  }],
150
154
  accessibilityRole: "search",
@@ -199,7 +203,7 @@ const SearchBar = exports.SearchBar = /*#__PURE__*/(0, _react.forwardRef)((props
199
203
  }), showCancel ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Animated.View, {
200
204
  pointerEvents: showCancelButton ? 'auto' : 'none',
201
205
  style: [styles.cancelWrap, {
202
- width: CANCEL_WIDTH,
206
+ width: cancelWidth,
203
207
  transform: [{
204
208
  translateX: cancelTranslateX
205
209
  }],
@@ -215,7 +219,7 @@ const SearchBar = exports.SearchBar = /*#__PURE__*/(0, _react.forwardRef)((props
215
219
  style: [styles.cancelText, {
216
220
  color: theme.colors.primary,
217
221
  fontSize: sizeStyles.fontSize,
218
- fontWeight: theme.typography.fontWeight.medium
222
+ ...(0, _index.fontFor)(theme, 'medium')
219
223
  }],
220
224
  numberOfLines: 1,
221
225
  children: cancelLabel
@@ -52,8 +52,8 @@ const SegmentedControl = exports.SegmentedControl = /*#__PURE__*/(0, _react.forw
52
52
 
53
53
  // Total track width — measured from onLayout; thumb width = trackWidth / segments.length.
54
54
  const trackWidthRef = (0, _react.useRef)(0);
55
- const thumbTranslateX = (0, _react.useRef)(new _reactNative.Animated.Value(0)).current;
56
- const thumbWidth = (0, _react.useRef)(new _reactNative.Animated.Value(0)).current;
55
+ const thumbTranslateX = (0, _react.useRef)((0, _index.createAnimatedValue)(0)).current;
56
+ const thumbWidth = (0, _react.useRef)((0, _index.createAnimatedValue)(0)).current;
57
57
  const activeIndex = Math.max(0, segments.findIndex(s => s.value === value));
58
58
  const animateThumb = (0, _react.useCallback)((index, totalWidth) => {
59
59
  if (totalWidth <= 0 || segments.length === 0) return;
@@ -69,8 +69,8 @@ const Select = exports.Select = /*#__PURE__*/(0, _react.forwardRef)((props, ref)
69
69
  const sheetMaxHeight = Math.round(screenHeight * 0.7);
70
70
 
71
71
  // Animations: backdrop fade + sheet slide-up.
72
- const backdropAnim = (0, _react.useRef)(new _reactNative.Animated.Value(0)).current;
73
- const sheetAnim = (0, _react.useRef)(new _reactNative.Animated.Value(sheetMaxHeight)).current;
72
+ const backdropAnim = (0, _react.useRef)((0, _index.createAnimatedValue)(0)).current;
73
+ const sheetAnim = (0, _react.useRef)((0, _index.createAnimatedValue)(sheetMaxHeight)).current;
74
74
  (0, _react.useEffect)(() => {
75
75
  if (open) {
76
76
  _reactNative.Animated.parallel([_reactNative.Animated.timing(backdropAnim, {
@@ -395,7 +395,7 @@ const Chevron = ({
395
395
  size,
396
396
  open
397
397
  }) => {
398
- const rotate = (0, _react.useRef)(new _reactNative.Animated.Value(open ? 1 : 0)).current;
398
+ const rotate = (0, _react.useRef)((0, _index.createAnimatedValue)(open ? 1 : 0)).current;
399
399
  (0, _react.useEffect)(() => {
400
400
  _reactNative.Animated.timing(rotate, {
401
401
  toValue: open ? 1 : 0,
@@ -52,7 +52,7 @@ const Skeleton = ({
52
52
  const borderRadius = resolveRadius(theme, resolvedRadiusToken);
53
53
  const resolvedWidth = resolveWidth(width);
54
54
  const resolvedHeight = _index2.Responsive.size(height);
55
- const progress = (0, _react.useRef)(new _reactNative.Animated.Value(0)).current;
55
+ const progress = (0, _react.useRef)((0, _index.createAnimatedValue)(0)).current;
56
56
  const [containerWidth, setContainerWidth] = (0, _react.useState)(0);
57
57
  (0, _react.useEffect)(() => {
58
58
  progress.setValue(0);
@@ -70,16 +70,16 @@ const Slider = exports.Slider = /*#__PURE__*/(0, _react.forwardRef)((props, ref)
70
70
  const lastReportedHigh = (0, _react.useRef)(highRef.current);
71
71
 
72
72
  // Animated x positions (px) for thumbs.
73
- const lowX = (0, _react.useRef)(new _reactNative.Animated.Value(0)).current;
74
- const highX = (0, _react.useRef)(new _reactNative.Animated.Value(0)).current;
73
+ const lowX = (0, _react.useRef)((0, _index.createAnimatedValue)(0)).current;
74
+ const highX = (0, _react.useRef)((0, _index.createAnimatedValue)(0)).current;
75
75
 
76
76
  // Press / drag scale animations.
77
- const lowScale = (0, _react.useRef)(new _reactNative.Animated.Value(1)).current;
78
- const highScale = (0, _react.useRef)(new _reactNative.Animated.Value(1)).current;
77
+ const lowScale = (0, _react.useRef)((0, _index.createAnimatedValue)(1)).current;
78
+ const highScale = (0, _react.useRef)((0, _index.createAnimatedValue)(1)).current;
79
79
 
80
80
  // Label opacity per thumb.
81
- const lowLabelOpacity = (0, _react.useRef)(new _reactNative.Animated.Value(0)).current;
82
- const highLabelOpacity = (0, _react.useRef)(new _reactNative.Animated.Value(0)).current;
81
+ const lowLabelOpacity = (0, _react.useRef)((0, _index.createAnimatedValue)(0)).current;
82
+ const highLabelOpacity = (0, _react.useRef)((0, _index.createAnimatedValue)(0)).current;
83
83
 
84
84
  // Track which thumb is actively dragging (to anchor gesture math).
85
85
  const dragOffsetRef = (0, _react.useRef)(0);
@@ -23,7 +23,7 @@ const Dot = ({
23
23
  delay,
24
24
  duration
25
25
  }) => {
26
- const scale = (0, _react.useRef)(new _reactNative.Animated.Value(1)).current;
26
+ const scale = (0, _react.useRef)((0, _index.createAnimatedValue)(1)).current;
27
27
  (0, _react.useEffect)(() => {
28
28
  const animation = _reactNative.Animated.loop(_reactNative.Animated.sequence([_reactNative.Animated.delay(delay), _reactNative.Animated.timing(scale, {
29
29
  toValue: 1.4,
@@ -66,7 +66,7 @@ const Spinner = exports.Spinner = /*#__PURE__*/(0, _react.forwardRef)((props, re
66
66
  testID
67
67
  } = props;
68
68
  const theme = (0, _index.useTheme)();
69
- const fade = (0, _react.useRef)(new _reactNative.Animated.Value(0)).current;
69
+ const fade = (0, _react.useRef)((0, _index.createAnimatedValue)(0)).current;
70
70
  (0, _react.useEffect)(() => {
71
71
  _reactNative.Animated.timing(fade, {
72
72
  toValue: 1,
@@ -35,8 +35,8 @@ const StepCircle = ({
35
35
  onPress
36
36
  }) => {
37
37
  const isActive = status === 'active';
38
- const pulseScale = (0, _react.useRef)(new _reactNative.Animated.Value(1)).current;
39
- const pulseOpacity = (0, _react.useRef)(new _reactNative.Animated.Value(0.5)).current;
38
+ const pulseScale = (0, _react.useRef)((0, _index.createAnimatedValue)(1)).current;
39
+ const pulseOpacity = (0, _react.useRef)((0, _index.createAnimatedValue)(0.5)).current;
40
40
  (0, _react.useEffect)(() => {
41
41
  if (!isActive) {
42
42
  pulseScale.setValue(1);
@@ -181,7 +181,7 @@ const Stepper = exports.Stepper = /*#__PURE__*/(0, _react.forwardRef)((props, re
181
181
 
182
182
  // Connector progress: animates as activeStep changes.
183
183
  const initialProgress = total <= 1 ? 0 : activeStep / (total - 1);
184
- const progress = (0, _react.useRef)(new _reactNative.Animated.Value(initialProgress)).current;
184
+ const progress = (0, _react.useRef)((0, _index.createAnimatedValue)(initialProgress)).current;
185
185
  const lastTargetRef = (0, _react.useRef)(initialProgress);
186
186
  (0, _react.useEffect)(() => {
187
187
  const target = total <= 1 ? 0 : activeStep / (total - 1);
@@ -53,6 +53,7 @@ const Switch = exports.Switch = /*#__PURE__*/(0, _react.forwardRef)((props, ref)
53
53
  label,
54
54
  accessibilityLabel,
55
55
  haptic = 'selection',
56
+ bounce = false,
56
57
  style,
57
58
  trackStyle,
58
59
  thumbStyle,
@@ -60,11 +61,15 @@ const Switch = exports.Switch = /*#__PURE__*/(0, _react.forwardRef)((props, ref)
60
61
  ...rest
61
62
  } = props;
62
63
  const theme = (0, _index.useTheme)();
63
- const sizeStyles = sizeMap[size];
64
+ const sizeStyles = {
65
+ ...sizeMap[size],
66
+ ...(theme.components.switch?.[size] ?? {})
67
+ };
68
+ const switchThumbColor = theme.components.switch?.thumbColor ?? '#FFFFFF';
64
69
  const styles = (0, _react.useMemo)(() => buildStyles(theme), [theme]);
65
70
  const offTrackColor = theme.mode === 'dark' ? theme.colors.secondary : theme.colors.surface.disabled;
66
71
  const onTrackColor = toneColor(theme, tone);
67
- const progress = (0, _react.useRef)(new _reactNative.Animated.Value(value ? 1 : 0)).current;
72
+ const progress = (0, _react.useRef)((0, _index.createAnimatedValue)(value ? 1 : 0)).current;
68
73
  (0, _react.useEffect)(() => {
69
74
  _reactNative.Animated.spring(progress, {
70
75
  toValue: value ? 1 : 0,
@@ -74,7 +79,7 @@ const Switch = exports.Switch = /*#__PURE__*/(0, _react.forwardRef)((props, ref)
74
79
  useNativeDriver: true
75
80
  }).start();
76
81
  }, [value, progress, theme.motion.spring.snappy]);
77
- const trackBgAnim = (0, _react.useRef)(new _reactNative.Animated.Value(value ? 1 : 0)).current;
82
+ const trackBgAnim = (0, _react.useRef)((0, _index.createAnimatedValue)(value ? 1 : 0)).current;
78
83
  (0, _react.useEffect)(() => {
79
84
  _reactNative.Animated.timing(trackBgAnim, {
80
85
  toValue: value ? 1 : 0,
@@ -93,6 +98,28 @@ const Switch = exports.Switch = /*#__PURE__*/(0, _react.forwardRef)((props, ref)
93
98
  inputRange: [0, 1],
94
99
  outputRange: [offTrackColor, onTrackColor]
95
100
  });
101
+ const bounceScale = (0, _react.useRef)((0, _index.createAnimatedValue)(1)).current;
102
+ const isFirstRender = (0, _react.useRef)(true);
103
+ (0, _react.useEffect)(() => {
104
+ if (!bounce) return;
105
+ if (isFirstRender.current) {
106
+ isFirstRender.current = false;
107
+ return;
108
+ }
109
+ _reactNative.Animated.sequence([_reactNative.Animated.spring(bounceScale, {
110
+ toValue: 1.15,
111
+ damping: 10,
112
+ stiffness: 220,
113
+ mass: 1,
114
+ useNativeDriver: true
115
+ }), _reactNative.Animated.spring(bounceScale, {
116
+ toValue: 1,
117
+ damping: 14,
118
+ stiffness: 240,
119
+ mass: 1,
120
+ useNativeDriver: true
121
+ })]).start();
122
+ }, [value, bounce, bounceScale]);
96
123
  const handlePress = event => {
97
124
  if (disabled) return;
98
125
  if (haptic !== false) (0, _hapticUtils.triggerHaptic)(haptic);
@@ -127,11 +154,14 @@ const Switch = exports.Switch = /*#__PURE__*/(0, _react.forwardRef)((props, ref)
127
154
  }, trackStyle],
128
155
  children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Animated.View, {
129
156
  style: [styles.thumb, theme.shadows.sm, {
157
+ backgroundColor: switchThumbColor,
130
158
  width: sizeStyles.thumbSize,
131
159
  height: sizeStyles.thumbSize,
132
160
  borderRadius: sizeStyles.thumbSize / 2,
133
161
  transform: [{
134
162
  translateX
163
+ }, {
164
+ scale: bounceScale
135
165
  }]
136
166
  }, thumbStyle]
137
167
  })
@@ -160,7 +190,6 @@ const buildStyles = _theme => _reactNative.StyleSheet.create({
160
190
  justifyContent: 'center'
161
191
  },
162
192
  thumb: {
163
- backgroundColor: '#FFFFFF',
164
193
  position: 'absolute',
165
194
  top: 2
166
195
  },
@@ -39,8 +39,8 @@ const Tabs = exports.Tabs = /*#__PURE__*/(0, _react.forwardRef)((props, ref) =>
39
39
 
40
40
  // Per-tab measured layouts (key → {x, width}).
41
41
  const [layouts, setLayouts] = (0, _react.useState)({});
42
- const indicatorTranslateX = (0, _react.useRef)(new _reactNative.Animated.Value(0)).current;
43
- const indicatorWidth = (0, _react.useRef)(new _reactNative.Animated.Value(0)).current;
42
+ const indicatorTranslateX = (0, _react.useRef)((0, _index.createAnimatedValue)(0)).current;
43
+ const indicatorWidth = (0, _react.useRef)((0, _index.createAnimatedValue)(0)).current;
44
44
  const activeLayout = layouts[activeKey];
45
45
 
46
46
  // Animate indicator whenever activeKey or its layout changes.
@@ -65,7 +65,7 @@ const Wheel = ({
65
65
  testID
66
66
  }) => {
67
67
  const listRef = (0, _react.useRef)(null);
68
- const scrollY = (0, _react.useRef)(new _reactNative.Animated.Value(selectedIndex * ITEM_HEIGHT)).current;
68
+ const scrollY = (0, _react.useRef)((0, _index.createAnimatedValue)(selectedIndex * ITEM_HEIGHT)).current;
69
69
  const lastIndexRef = (0, _react.useRef)(selectedIndex);
70
70
  const lastHapticAtRef = (0, _react.useRef)(0);
71
71
 
@@ -264,8 +264,8 @@ const TimePicker = ({
264
264
  }, [visible, value, format, minuteStep, hours, minutes]);
265
265
 
266
266
  // Sheet animations.
267
- const opacity = (0, _react.useRef)(new _reactNative.Animated.Value(0)).current;
268
- const translateY = (0, _react.useRef)(new _reactNative.Animated.Value(40)).current;
267
+ const opacity = (0, _react.useRef)((0, _index.createAnimatedValue)(0)).current;
268
+ const translateY = (0, _react.useRef)((0, _index.createAnimatedValue)(40)).current;
269
269
  (0, _react.useEffect)(() => {
270
270
  if (visible) {
271
271
  _reactNative.Animated.parallel([_reactNative.Animated.timing(opacity, {
@@ -23,10 +23,15 @@ const Toast = ({
23
23
  const position = toast.position ?? 'bottom';
24
24
  const styles = (0, _react.useMemo)(() => buildStyles(theme), [theme]);
25
25
  const tint = (0, _react.useMemo)(() => tintFor(theme, variant), [theme, variant]);
26
+ const toastTokens = theme.components.toast;
27
+ const iconCircleSize = toastTokens?.iconCircleSize ?? 28;
28
+ const iconCircleBorderRadius = toastTokens?.iconCircleBorderRadius ?? 14;
29
+ const iconGlyphFontSize = toastTokens?.iconGlyphFontSize ?? 16;
30
+ const tintBarWidth = toastTokens?.tintBarWidth ?? 4;
26
31
  const enterFrom = position === 'top' ? -120 : 120;
27
- const translateY = (0, _react.useRef)(new _reactNative.Animated.Value(enterFrom)).current;
28
- const translateX = (0, _react.useRef)(new _reactNative.Animated.Value(0)).current;
29
- const opacity = (0, _react.useRef)(new _reactNative.Animated.Value(0)).current;
32
+ const translateY = (0, _react.useRef)((0, _index.createAnimatedValue)(enterFrom)).current;
33
+ const translateX = (0, _react.useRef)((0, _index.createAnimatedValue)(0)).current;
34
+ const opacity = (0, _react.useRef)((0, _index.createAnimatedValue)(0)).current;
30
35
  const dismissedRef = (0, _react.useRef)(false);
31
36
  const dismiss = (animateOut = true) => {
32
37
  if (dismissedRef.current) return;
@@ -112,11 +117,15 @@ const Toast = ({
112
117
  if (!glyph) return null;
113
118
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
114
119
  style: [styles.iconCircle, {
120
+ width: iconCircleSize,
121
+ height: iconCircleSize,
122
+ borderRadius: iconCircleBorderRadius,
115
123
  backgroundColor: tint + '22'
116
124
  }],
117
125
  children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
118
126
  style: [styles.iconGlyph, {
119
- color: tint
127
+ color: tint,
128
+ fontSize: iconGlyphFontSize
120
129
  }],
121
130
  accessible: false,
122
131
  children: glyph
@@ -143,9 +152,10 @@ const Toast = ({
143
152
  }, {
144
153
  scale: stackScale
145
154
  }]
146
- }],
155
+ }, toast.style],
147
156
  children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
148
157
  style: [styles.tintBar, {
158
+ width: tintBarWidth,
149
159
  backgroundColor: tint
150
160
  }]
151
161
  }), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
@@ -156,8 +166,8 @@ const Toast = ({
156
166
  style: [styles.message, {
157
167
  color: theme.colors.text.primary,
158
168
  fontSize: theme.typography.fontSize.base,
159
- fontWeight: theme.typography.fontWeight.semibold
160
- }],
169
+ ...(0, _index.fontFor)(theme, 'semibold')
170
+ }, toast.textStyle],
161
171
  numberOfLines: 2,
162
172
  children: toast.message
163
173
  }), toast.description ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
@@ -181,7 +191,7 @@ const Toast = ({
181
191
  style: {
182
192
  color: tint,
183
193
  fontSize: theme.typography.fontSize.sm,
184
- fontWeight: theme.typography.fontWeight.semibold
194
+ ...(0, _index.fontFor)(theme, 'semibold')
185
195
  },
186
196
  numberOfLines: 1,
187
197
  children: toast.action.label
@@ -230,8 +240,7 @@ const buildStyles = _theme => _reactNative.StyleSheet.create({
230
240
  position: 'absolute',
231
241
  left: 0,
232
242
  top: 0,
233
- bottom: 0,
234
- width: 4
243
+ bottom: 0
235
244
  },
236
245
  row: {
237
246
  flexDirection: 'row',
@@ -239,15 +248,11 @@ const buildStyles = _theme => _reactNative.StyleSheet.create({
239
248
  paddingLeft: 8
240
249
  },
241
250
  iconCircle: {
242
- width: 28,
243
- height: 28,
244
- borderRadius: 14,
245
251
  alignItems: 'center',
246
252
  justifyContent: 'center',
247
253
  marginRight: 12
248
254
  },
249
255
  iconGlyph: {
250
- fontSize: 16,
251
256
  fontWeight: '700',
252
257
  lineHeight: 18
253
258
  },