@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
@@ -41,8 +41,8 @@ const Tooltip = props => {
41
41
  height: 0
42
42
  });
43
43
  const wrapperRef = (0, _react.useRef)(null);
44
- const scale = (0, _react.useRef)(new _reactNative.Animated.Value(visible ? 1 : 0.85)).current;
45
- const opacity = (0, _react.useRef)(new _reactNative.Animated.Value(visible ? 1 : 0)).current;
44
+ const scale = (0, _react.useRef)((0, _index.createAnimatedValue)(visible ? 1 : 0.85)).current;
45
+ const opacity = (0, _react.useRef)((0, _index.createAnimatedValue)(visible ? 1 : 0)).current;
46
46
  const autoHideTimer = (0, _react.useRef)(null);
47
47
  const didMount = (0, _react.useRef)(false);
48
48
  const setVisible = (0, _react.useCallback)(next => {
@@ -0,0 +1,57 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.isGradientAvailable = exports.Gradient = void 0;
7
+ var _react = _interopRequireDefault(require("react"));
8
+ var _reactNative = require("react-native");
9
+ var _jsxRuntime = require("react/jsx-runtime");
10
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
11
+ /**
12
+ * Render a linear gradient using `react-native-linear-gradient` when available.
13
+ *
14
+ * The dep is OPTIONAL — apps that never use gradients don't need it installed.
15
+ * If `<Gradient>` (or any component that accepts a `gradient` prop) is reached
16
+ * without the package present, we fall back to a flat View using the first
17
+ * colour and emit a one-time dev warning so the omission is loud but
18
+ * non-fatal.
19
+ */
20
+ let LinearGradientImpl = null;
21
+ let warned = false;
22
+ try {
23
+ // eslint-disable-next-line @typescript-eslint/no-require-imports
24
+ LinearGradientImpl = require('react-native-linear-gradient').default;
25
+ } catch {
26
+ // Optional peer; resolved lazily by consumers that need gradients.
27
+ }
28
+ const Gradient = ({
29
+ gradient,
30
+ style,
31
+ children
32
+ }) => {
33
+ if (LinearGradientImpl) {
34
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(LinearGradientImpl, {
35
+ colors: gradient.colors,
36
+ locations: gradient.locations,
37
+ start: gradient.start,
38
+ end: gradient.end,
39
+ style: style,
40
+ children: children
41
+ });
42
+ }
43
+ if (__DEV__ && !warned) {
44
+ warned = true;
45
+ console.warn('[@webority-technologies/mobile] gradient prop set but react-native-linear-gradient is not installed. ' + 'Run `npm install react-native-linear-gradient` to enable.');
46
+ }
47
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
48
+ style: [{
49
+ backgroundColor: gradient.colors[0]
50
+ }, style],
51
+ children: children
52
+ });
53
+ };
54
+ exports.Gradient = Gradient;
55
+ const isGradientAvailable = () => LinearGradientImpl != null;
56
+ exports.isGradientAvailable = isGradientAvailable;
57
+ //# sourceMappingURL=Gradient.js.map
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.createAnimatedValue = void 0;
7
+ var _reactNative = require("react-native");
8
+ /**
9
+ * Create an `Animated.Value` that survives RN 0.85's dev-mode prop deepFreeze.
10
+ *
11
+ * RN's Fabric renderer deep-freezes prop trees on host components. If an
12
+ * `Animated.Value` is reachable from a `style` prop via interpolation chains
13
+ * (the `_parent` ref on `AnimatedInterpolation` nodes), the recursive freeze
14
+ * converts the value's `_animation` slot into a throwing setter — the next
15
+ * `Animated.timing(v).start()` then crashes with
16
+ * "_animation: object that is meant to be immutable".
17
+ *
18
+ * Sealing the value at construction makes `Object.isSealed(v) === true`,
19
+ * which causes `deepFreezeAndThrowOnMutationInDev` to skip-and-return at
20
+ * its top guard. Existing-property mutation (`_animation`, `_value`,
21
+ * `_listeners`, `_tracking`) keeps working — seal only blocks adding NEW
22
+ * properties, and `Animated.Value` doesn't add any post-construction.
23
+ *
24
+ * Use everywhere the library would otherwise call `new Animated.Value(...)`.
25
+ */
26
+ const createAnimatedValue = (initial, config) => Object.seal(new _reactNative.Animated.Value(initial, config));
27
+ exports.createAnimatedValue = createAnimatedValue;
28
+ //# sourceMappingURL=animatedValue.js.map
@@ -3,19 +3,43 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
+ Object.defineProperty(exports, "Gradient", {
7
+ enumerable: true,
8
+ get: function () {
9
+ return _Gradient.Gradient;
10
+ }
11
+ });
6
12
  Object.defineProperty(exports, "ThemeProvider", {
7
13
  enumerable: true,
8
14
  get: function () {
9
15
  return _ThemeContext.ThemeProvider;
10
16
  }
11
17
  });
18
+ Object.defineProperty(exports, "createAnimatedValue", {
19
+ enumerable: true,
20
+ get: function () {
21
+ return _animatedValue.createAnimatedValue;
22
+ }
23
+ });
12
24
  Object.defineProperty(exports, "darkTheme", {
13
25
  enumerable: true,
14
26
  get: function () {
15
27
  return _tokens.darkTheme;
16
28
  }
17
29
  });
30
+ Object.defineProperty(exports, "fontFor", {
31
+ enumerable: true,
32
+ get: function () {
33
+ return _textStyle.fontFor;
34
+ }
35
+ });
18
36
  exports.getTheme = exports.getColorMode = void 0;
37
+ Object.defineProperty(exports, "isGradientAvailable", {
38
+ enumerable: true,
39
+ get: function () {
40
+ return _Gradient.isGradientAvailable;
41
+ }
42
+ });
19
43
  Object.defineProperty(exports, "lightTheme", {
20
44
  enumerable: true,
21
45
  get: function () {
@@ -44,6 +68,9 @@ Object.defineProperty(exports, "useThemeMode", {
44
68
  var _tokens = require("./tokens.js");
45
69
  var _merge = require("./merge.js");
46
70
  var _ThemeContext = require("./ThemeContext.js");
71
+ var _textStyle = require("./textStyle.js");
72
+ var _animatedValue = require("./animatedValue.js");
73
+ var _Gradient = require("./Gradient.js");
47
74
  let currentMode = 'light';
48
75
  let currentTheme = _tokens.lightTheme;
49
76
  let lightOverridesGlobal;
@@ -0,0 +1,37 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.fontFor = void 0;
7
+ const FAMILY_KEY = {
8
+ normal: 'regular',
9
+ medium: 'medium',
10
+ semibold: 'semibold',
11
+ bold: 'bold'
12
+ };
13
+
14
+ /**
15
+ * Resolve text-weight style for the active theme.
16
+ *
17
+ * When the consumer registers a brand `theme.typography.fontFamily.<weight>`,
18
+ * we set `fontFamily` and leave `fontWeight` undefined — RN can't combine the
19
+ * two reliably across iOS/Android once a custom face is in play, so the brand
20
+ * file controls the weight glyph itself. Falls back to `fontWeight` when no
21
+ * brand font is registered for that weight.
22
+ *
23
+ * Note: the fontWeight scale uses `normal` while FontFamilyScale uses
24
+ * `regular` (the conventional font-name suffix). The helper maps between
25
+ * them transparently.
26
+ */
27
+ const fontFor = (theme, weight) => {
28
+ const family = theme.typography.fontFamily?.[FAMILY_KEY[weight]];
29
+ if (family) return {
30
+ fontFamily: family
31
+ };
32
+ return {
33
+ fontWeight: theme.typography.fontWeight[weight]
34
+ };
35
+ };
36
+ exports.fontFor = fontFor;
37
+ //# sourceMappingURL=textStyle.js.map
@@ -54,6 +54,260 @@ const radius = {
54
54
  '2xl': 28,
55
55
  full: 9999
56
56
  };
57
+ const components = {
58
+ button: {
59
+ xs: {
60
+ paddingHorizontal: 10,
61
+ paddingVertical: 4,
62
+ minHeight: 28,
63
+ fontSize: 12,
64
+ borderRadius: 8
65
+ },
66
+ sm: {
67
+ paddingHorizontal: 12,
68
+ paddingVertical: 6,
69
+ minHeight: 34,
70
+ fontSize: 13,
71
+ borderRadius: 10
72
+ },
73
+ md: {
74
+ paddingHorizontal: 16,
75
+ paddingVertical: 9,
76
+ minHeight: 42,
77
+ fontSize: 15,
78
+ borderRadius: 12
79
+ },
80
+ lg: {
81
+ paddingHorizontal: 20,
82
+ paddingVertical: 12,
83
+ minHeight: 50,
84
+ fontSize: 16,
85
+ borderRadius: 14
86
+ },
87
+ xl: {
88
+ paddingHorizontal: 24,
89
+ paddingVertical: 14,
90
+ minHeight: 58,
91
+ fontSize: 17,
92
+ borderRadius: 16
93
+ }
94
+ },
95
+ input: {
96
+ sm: {
97
+ paddingHorizontal: 12,
98
+ paddingVertical: 8,
99
+ minHeight: 38,
100
+ multilineMinHeight: 72,
101
+ fontSize: 13,
102
+ borderRadius: 10,
103
+ iconSize: 16
104
+ },
105
+ md: {
106
+ paddingHorizontal: 14,
107
+ paddingVertical: 11,
108
+ minHeight: 46,
109
+ multilineMinHeight: 92,
110
+ fontSize: 15,
111
+ borderRadius: 12,
112
+ iconSize: 18
113
+ },
114
+ lg: {
115
+ paddingHorizontal: 16,
116
+ paddingVertical: 14,
117
+ minHeight: 54,
118
+ multilineMinHeight: 110,
119
+ fontSize: 16,
120
+ borderRadius: 14,
121
+ iconSize: 20
122
+ }
123
+ },
124
+ searchBar: {
125
+ sm: {
126
+ height: 36,
127
+ paddingHorizontal: 10,
128
+ fontSize: 13,
129
+ iconSize: 16,
130
+ gap: 6
131
+ },
132
+ md: {
133
+ height: 44,
134
+ paddingHorizontal: 12,
135
+ fontSize: 15,
136
+ iconSize: 18,
137
+ gap: 8
138
+ },
139
+ lg: {
140
+ height: 52,
141
+ paddingHorizontal: 14,
142
+ fontSize: 16,
143
+ iconSize: 20,
144
+ gap: 10
145
+ },
146
+ cancelButtonWidth: 72
147
+ },
148
+ emptyState: {
149
+ sm: {
150
+ iconSize: 48,
151
+ titleFontSize: 'lg',
152
+ descriptionFontSize: 'sm',
153
+ paddingVertical: 'lg'
154
+ },
155
+ md: {
156
+ iconSize: 64,
157
+ titleFontSize: 'xl',
158
+ descriptionFontSize: 'base',
159
+ paddingVertical: 'xl'
160
+ },
161
+ lg: {
162
+ iconSize: 80,
163
+ titleFontSize: '2xl',
164
+ descriptionFontSize: 'base',
165
+ paddingVertical: '2xl'
166
+ }
167
+ },
168
+ listItem: {
169
+ sm: {
170
+ paddingVertical: 'sm',
171
+ titleFontSize: 'sm',
172
+ subtitleFontSize: 'xs',
173
+ minHeight: 44
174
+ },
175
+ md: {
176
+ paddingVertical: 'md',
177
+ titleFontSize: 'base',
178
+ subtitleFontSize: 'sm',
179
+ minHeight: 56
180
+ },
181
+ lg: {
182
+ paddingVertical: 'lg',
183
+ titleFontSize: 'lg',
184
+ subtitleFontSize: 'sm',
185
+ minHeight: 72
186
+ }
187
+ },
188
+ badge: {
189
+ sm: {
190
+ fontSize: 10,
191
+ minWidth: 16,
192
+ height: 16,
193
+ paddingHorizontal: 5,
194
+ dotSize: 8
195
+ },
196
+ md: {
197
+ fontSize: 11,
198
+ minWidth: 20,
199
+ height: 20,
200
+ paddingHorizontal: 6,
201
+ dotSize: 10
202
+ },
203
+ borderWidth: 1.5,
204
+ anchorOffset: 4
205
+ },
206
+ chip: {
207
+ sm: {
208
+ paddingHorizontal: 10,
209
+ paddingVertical: 4,
210
+ fontSize: 12,
211
+ minHeight: 26,
212
+ closeSize: 16,
213
+ closeFontSize: 12,
214
+ gap: 6
215
+ },
216
+ md: {
217
+ paddingHorizontal: 12,
218
+ paddingVertical: 6,
219
+ fontSize: 13,
220
+ minHeight: 32,
221
+ closeSize: 18,
222
+ closeFontSize: 13,
223
+ gap: 8
224
+ }
225
+ },
226
+ checkbox: {
227
+ sm: {
228
+ boxSize: 16
229
+ },
230
+ md: {
231
+ boxSize: 20
232
+ },
233
+ lg: {
234
+ boxSize: 24
235
+ },
236
+ borderWidth: 1.5,
237
+ labelGap: 10
238
+ },
239
+ radio: {
240
+ sm: {
241
+ outer: 16,
242
+ inner: 8
243
+ },
244
+ md: {
245
+ outer: 20,
246
+ inner: 10
247
+ },
248
+ lg: {
249
+ outer: 24,
250
+ inner: 12
251
+ },
252
+ borderWidth: 1.5,
253
+ labelGap: 10
254
+ },
255
+ switch: {
256
+ sm: {
257
+ trackWidth: 42,
258
+ trackHeight: 26,
259
+ thumbSize: 22,
260
+ padding: 2
261
+ },
262
+ md: {
263
+ trackWidth: 51,
264
+ trackHeight: 31,
265
+ thumbSize: 27,
266
+ padding: 2
267
+ },
268
+ lg: {
269
+ trackWidth: 60,
270
+ trackHeight: 36,
271
+ thumbSize: 32,
272
+ padding: 2
273
+ },
274
+ thumbColor: '#FFFFFF'
275
+ },
276
+ otpInput: {
277
+ sm: {
278
+ cell: 36,
279
+ fontSize: 16,
280
+ borderRadius: 8,
281
+ gap: 8
282
+ },
283
+ md: {
284
+ cell: 48,
285
+ fontSize: 20,
286
+ borderRadius: 10,
287
+ gap: 10
288
+ },
289
+ lg: {
290
+ cell: 56,
291
+ fontSize: 24,
292
+ borderRadius: 12,
293
+ gap: 12
294
+ }
295
+ },
296
+ dialog: {
297
+ iconWrapperSize: 48,
298
+ iconWrapperBorderRadius: 24,
299
+ actionButtonMinHeight: 44
300
+ },
301
+ toast: {
302
+ iconCircleSize: 28,
303
+ iconCircleBorderRadius: 14,
304
+ iconGlyphFontSize: 16,
305
+ tintBarWidth: 4
306
+ },
307
+ formField: {
308
+ inlineLabelWidth: '35%'
309
+ }
310
+ };
57
311
  const motion = {
58
312
  duration: {
59
313
  instant: 80,
@@ -262,7 +516,9 @@ const lightTheme = exports.lightTheme = {
262
516
  spacing,
263
517
  radius,
264
518
  shadows: lightShadows,
265
- motion
519
+ motion,
520
+ components,
521
+ gradients: {}
266
522
  };
267
523
  const darkTheme = exports.darkTheme = {
268
524
  mode: 'dark',
@@ -314,6 +570,8 @@ const darkTheme = exports.darkTheme = {
314
570
  spacing,
315
571
  radius,
316
572
  shadows: darkShadows,
317
- motion
573
+ motion,
574
+ components,
575
+ gradients: {}
318
576
  };
319
577
  //# sourceMappingURL=tokens.js.map
@@ -2,7 +2,7 @@
2
2
 
3
3
  import React, { createContext, useCallback, useContext, useEffect, useMemo, useRef, useState } from 'react';
4
4
  import { Animated, Easing, LayoutAnimation, Pressable, StyleSheet, Text, View } from 'react-native';
5
- import { useTheme } from "../../theme/index.js";
5
+ import { useTheme, createAnimatedValue } from "../../theme/index.js";
6
6
  import { triggerHaptic } from "../../utils/hapticUtils.js";
7
7
  import { SkeletonContent } from "../Skeleton/index.js";
8
8
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
@@ -98,9 +98,9 @@ const Accordion = props => {
98
98
  const groupExpanded = group && id ? group.isExpanded(id) : null;
99
99
  const expanded = groupExpanded !== null ? groupExpanded : isControlled ? !!expandedProp : internalExpanded;
100
100
  const [measuredHeight, setMeasuredHeight] = useState(null);
101
- const heightAnim = useRef(new Animated.Value(expanded ? 1 : 0)).current;
102
- const opacityAnim = useRef(new Animated.Value(expanded ? 1 : 0)).current;
103
- const rotateAnim = useRef(new Animated.Value(expanded ? 1 : 0)).current;
101
+ const heightAnim = useRef(createAnimatedValue(expanded ? 1 : 0)).current;
102
+ const opacityAnim = useRef(createAnimatedValue(expanded ? 1 : 0)).current;
103
+ const rotateAnim = useRef(createAnimatedValue(expanded ? 1 : 0)).current;
104
104
  const lastExpandedRef = useRef(expanded);
105
105
  useEffect(() => {
106
106
  // Skip animation when state matches the previous value (e.g. on mount).
@@ -2,7 +2,7 @@
2
2
 
3
3
  import React, { Children, cloneElement, forwardRef, isValidElement, useEffect, useMemo, useRef, useState } from 'react';
4
4
  import { Animated, Easing, Image, StyleSheet, Text, View } from 'react-native';
5
- import { useTheme } from "../../theme/index.js";
5
+ import { useTheme, createAnimatedValue } from "../../theme/index.js";
6
6
  import { SkeletonContent } from "../Skeleton/index.js";
7
7
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
8
8
  const sizeMap = {
@@ -176,7 +176,7 @@ const AvatarGroupItem = ({
176
176
  borderWidth,
177
177
  children
178
178
  }) => {
179
- const opacity = useRef(new Animated.Value(0)).current;
179
+ const opacity = useRef(createAnimatedValue(0)).current;
180
180
  useEffect(() => {
181
181
  Animated.timing(opacity, {
182
182
  toValue: 1,
@@ -2,7 +2,7 @@
2
2
 
3
3
  import React, { forwardRef, useEffect, useMemo, useRef } from 'react';
4
4
  import { Animated, Easing, StyleSheet, Text, View } from 'react-native';
5
- import { useTheme } from "../../theme/index.js";
5
+ import { fontFor, useTheme, createAnimatedValue } from "../../theme/index.js";
6
6
  import { SkeletonContent } from "../Skeleton/index.js";
7
7
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
8
8
  const toneFor = (theme, tone) => {
@@ -56,28 +56,29 @@ const sizeMap = {
56
56
  dot: 10
57
57
  }
58
58
  };
59
- const anchorPosition = anchor => {
59
+ const anchorPosition = (anchor, offset) => {
60
+ const o = -offset;
60
61
  switch (anchor) {
61
62
  case 'topLeft':
62
63
  return {
63
- top: -4,
64
- left: -4
64
+ top: o,
65
+ left: o
65
66
  };
66
67
  case 'bottomRight':
67
68
  return {
68
- bottom: -4,
69
- right: -4
69
+ bottom: o,
70
+ right: o
70
71
  };
71
72
  case 'bottomLeft':
72
73
  return {
73
- bottom: -4,
74
- left: -4
74
+ bottom: o,
75
+ left: o
75
76
  };
76
77
  case 'topRight':
77
78
  default:
78
79
  return {
79
- top: -4,
80
- right: -4
80
+ top: o,
81
+ right: o
81
82
  };
82
83
  }
83
84
  };
@@ -110,10 +111,19 @@ const Badge = /*#__PURE__*/forwardRef((props, ref) => {
110
111
  } = props;
111
112
  const theme = useTheme();
112
113
  const tones = useMemo(() => toneFor(theme, tone), [theme, tone]);
113
- const sz = sizeMap[size];
114
+ const overrides = theme.components.badge?.[size];
115
+ const sz = {
116
+ fontSize: overrides?.fontSize ?? sizeMap[size].fontSize,
117
+ minWidth: overrides?.minWidth ?? sizeMap[size].minWidth,
118
+ height: overrides?.height ?? sizeMap[size].height,
119
+ paddingH: overrides?.paddingHorizontal ?? sizeMap[size].paddingH,
120
+ dot: overrides?.dotSize ?? sizeMap[size].dot
121
+ };
122
+ const badgeBorderWidth = theme.components.badge?.borderWidth ?? 1.5;
123
+ const badgeAnchorOffset = theme.components.badge?.anchorOffset ?? 4;
114
124
  const formatted = variant === 'dot' ? null : formatValue(value, max);
115
125
  const shouldRender = !invisible && (variant === 'dot' || formatted !== null);
116
- const pulseScale = useRef(new Animated.Value(1)).current;
126
+ const pulseScale = useRef(createAnimatedValue(1)).current;
117
127
  useEffect(() => {
118
128
  if (!pulse || !shouldRender) {
119
129
  pulseScale.setValue(1);
@@ -156,9 +166,9 @@ const Badge = /*#__PURE__*/forwardRef((props, ref) => {
156
166
  }]
157
167
  }, children ? {
158
168
  position: 'absolute',
159
- borderWidth: 1.5,
169
+ borderWidth: badgeBorderWidth,
160
170
  borderColor: theme.colors.background.elevated,
161
- ...anchorPosition(anchor)
171
+ ...anchorPosition(anchor, badgeAnchorOffset)
162
172
  } : null, badgeStyle],
163
173
  accessible: true,
164
174
  accessibilityRole: a11yRole,
@@ -167,7 +177,7 @@ const Badge = /*#__PURE__*/forwardRef((props, ref) => {
167
177
  style: [styles.text, {
168
178
  color: tones.text,
169
179
  fontSize: sz.fontSize,
170
- fontWeight: theme.typography.fontWeight.bold
180
+ ...fontFor(theme, 'bold')
171
181
  }, textStyle],
172
182
  numberOfLines: 1,
173
183
  allowFontScaling: false,
@@ -2,7 +2,7 @@
2
2
 
3
3
  import React, { forwardRef, useEffect, useMemo, useRef, useState } from 'react';
4
4
  import { Animated, Pressable, StyleSheet, Text, View } from 'react-native';
5
- import { useTheme } from "../../theme/index.js";
5
+ import { useTheme, createAnimatedValue } from "../../theme/index.js";
6
6
  import { SkeletonContent } from "../Skeleton/index.js";
7
7
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
8
8
  const Banner = /*#__PURE__*/forwardRef((props, ref) => {
@@ -24,8 +24,8 @@ const Banner = /*#__PURE__*/forwardRef((props, ref) => {
24
24
  const theme = useTheme();
25
25
  const styles = useMemo(() => buildStyles(theme), [theme]);
26
26
  const tint = useMemo(() => tintFor(theme, variant), [theme, variant]);
27
- const translateY = useRef(new Animated.Value(animateMount && visible ? -20 : 0)).current;
28
- const opacity = useRef(new Animated.Value(animateMount && visible ? 0 : visible ? 1 : 0)).current;
27
+ const translateY = useRef(createAnimatedValue(animateMount && visible ? -20 : 0)).current;
28
+ const opacity = useRef(createAnimatedValue(animateMount && visible ? 0 : visible ? 1 : 0)).current;
29
29
  const [mounted, setMounted] = useState(visible);
30
30
  const isFirstRun = useRef(true);
31
31
  useEffect(() => {
@@ -3,7 +3,7 @@
3
3
  import React, { forwardRef, useEffect, useMemo, useRef } from 'react';
4
4
  import { Animated, Pressable, StyleSheet, Text, View } from 'react-native';
5
5
  import { useSafeAreaInsets } from 'react-native-safe-area-context';
6
- import { useTheme } from "../../theme/index.js";
6
+ import { useTheme, createAnimatedValue } from "../../theme/index.js";
7
7
  import { triggerHaptic } from "../../utils/index.js";
8
8
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
9
9
  const ICON_SIZE = 24;
@@ -58,7 +58,7 @@ const BottomNavigation = /*#__PURE__*/forwardRef((props, ref) => {
58
58
  const styles = useMemo(() => buildStyles(theme), [theme]);
59
59
  const activeIndex = Math.max(0, tabs.findIndex(tab => tab.key === activeTab));
60
60
  const [tabWidth, setTabWidth] = React.useState(0);
61
- const indicatorTranslateX = useRef(new Animated.Value(0)).current;
61
+ const indicatorTranslateX = useRef(createAnimatedValue(0)).current;
62
62
  const iconScales = useRef({});
63
63
 
64
64
  // Ensure each tab has a persistent scale value