react-native-system-ui 1.0.0 → 1.0.1

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 (205) hide show
  1. package/dist/cjs/components/action-sheet/ActionSheet.js +45 -51
  2. package/dist/cjs/components/area/Area.js +22 -22
  3. package/dist/cjs/components/avatar/Avatar.js +23 -23
  4. package/dist/cjs/components/badge/Badge.js +56 -61
  5. package/dist/cjs/components/button/Button.js +87 -92
  6. package/dist/cjs/components/button/ButtonGroup.js +4 -4
  7. package/dist/cjs/components/calendar/Calendar.js +28 -28
  8. package/dist/cjs/components/cascader/Cascader.js +205 -212
  9. package/dist/cjs/components/cell/Cell.js +54 -51
  10. package/dist/cjs/components/cell/CellGroup.js +26 -25
  11. package/dist/cjs/components/checkbox/Checkbox.js +1 -0
  12. package/dist/cjs/components/checkbox/CheckboxGroup.js +20 -19
  13. package/dist/cjs/components/circle/Circle.js +66 -54
  14. package/dist/cjs/components/collapse/Collapse.js +18 -18
  15. package/dist/cjs/components/config-provider/ConfigProvider.js +5 -5
  16. package/dist/cjs/components/count-down/CountDown.js +17 -17
  17. package/dist/cjs/components/datetime-picker/DatetimePicker.js +34 -35
  18. package/dist/cjs/components/dialog/Dialog.js +16 -10
  19. package/dist/cjs/components/dialog/imperative.js +8 -14
  20. package/dist/cjs/components/dialog/tokens.js +1 -0
  21. package/dist/cjs/components/divider/Divider.js +48 -51
  22. package/dist/cjs/components/empty/Empty.js +30 -25
  23. package/dist/cjs/components/error-boundary/ErrorBoundary.js +3 -2
  24. package/dist/cjs/components/flex/Flex.js +27 -27
  25. package/dist/cjs/components/flex/FlexItem.js +1 -0
  26. package/dist/cjs/components/form/Form.js +93 -92
  27. package/dist/cjs/components/form/FormItem.js +60 -54
  28. package/dist/cjs/components/form/FormList.js +35 -35
  29. package/dist/cjs/components/grid/Grid.js +48 -48
  30. package/dist/cjs/components/grid/GridItem.js +9 -2
  31. package/dist/cjs/components/image/Image.js +25 -24
  32. package/dist/cjs/components/image/tokens.js +3 -1
  33. package/dist/cjs/components/image-preview/ImagePreview.js +19 -19
  34. package/dist/cjs/components/image-preview/tokens.js +3 -1
  35. package/dist/cjs/components/input/Input.js +16 -19
  36. package/dist/cjs/components/loading/Loading.js +27 -27
  37. package/dist/cjs/components/nav-bar/NavBar.js +21 -18
  38. package/dist/cjs/components/nav-bar/tokens.js +3 -1
  39. package/dist/cjs/components/notice-bar/NoticeBar.js +7 -3
  40. package/dist/cjs/components/notice-bar/tokens.js +3 -1
  41. package/dist/cjs/components/notify/Notify.js +2 -1
  42. package/dist/cjs/components/notify/imperative.js +17 -17
  43. package/dist/cjs/components/notify/tokens.js +1 -0
  44. package/dist/cjs/components/number-keyboard/NumberKeyboard.js +217 -201
  45. package/dist/cjs/components/number-keyboard/tokens.js +7 -1
  46. package/dist/cjs/components/overlay/Overlay.js +15 -15
  47. package/dist/cjs/components/password-input/PasswordInput.js +49 -49
  48. package/dist/cjs/components/picker/Picker.js +50 -58
  49. package/dist/cjs/components/popup/Popup.js +10 -10
  50. package/dist/cjs/components/popup/tokens.js +1 -0
  51. package/dist/cjs/components/portal/Portal.js +3 -4
  52. package/dist/cjs/components/progress/Progress.js +94 -95
  53. package/dist/cjs/components/progress/tokens.js +1 -0
  54. package/dist/cjs/components/radio/Radio.js +67 -63
  55. package/dist/cjs/components/radio/RadioGroup.js +6 -6
  56. package/dist/cjs/components/safe-area-view/SafeAreaView.js +7 -7
  57. package/dist/cjs/components/search/Search.js +28 -28
  58. package/dist/cjs/components/selector/Selector.js +19 -26
  59. package/dist/cjs/components/share-sheet/ShareSheet.js +6 -1
  60. package/dist/cjs/components/share-sheet/tokens.js +3 -1
  61. package/dist/cjs/components/sidebar/Sidebar.js +22 -16
  62. package/dist/cjs/components/sidebar/SidebarItem.js +9 -8
  63. package/dist/cjs/components/sidebar/tokens.js +3 -1
  64. package/dist/cjs/components/skeleton/Skeleton.js +43 -42
  65. package/dist/cjs/components/space/Space.js +45 -41
  66. package/dist/cjs/components/space/tokens.js +7 -1
  67. package/dist/cjs/components/stepper/Stepper.js +17 -15
  68. package/dist/cjs/components/stepper/tokens.js +1 -0
  69. package/dist/cjs/components/swiper/Swiper.js +10 -7
  70. package/dist/cjs/components/swiper/SwiperPagIndicator.js +3 -2
  71. package/dist/cjs/components/switch/Switch.js +23 -23
  72. package/dist/cjs/components/tabbar/Tabbar.js +26 -26
  73. package/dist/cjs/components/tabs/Tabs.js +143 -153
  74. package/dist/cjs/components/tabs/tokens.js +3 -1
  75. package/dist/cjs/components/tag/Tag.js +38 -38
  76. package/dist/cjs/components/toast/Toast.js +3 -2
  77. package/dist/cjs/components/toast/tokens.js +1 -0
  78. package/dist/cjs/components/typography/Typography.js +23 -21
  79. package/dist/cjs/components/water-mark/WaterMark.js +65 -65
  80. package/dist/cjs/design-system/Text.js +38 -0
  81. package/dist/cjs/design-system/createComponentTokensHook.js +2 -2
  82. package/dist/cjs/design-system/index.js +7 -0
  83. package/dist/cjs/design-system/mergeTokensOverride.js +1 -4
  84. package/dist/cjs/hooks/useControllableValue.js +11 -11
  85. package/dist/cjs/hooks/useCountDown.js +18 -18
  86. package/dist/cjs/platform/measure.js +4 -2
  87. package/dist/cjs/utils/color.js +2 -7
  88. package/dist/cjs/utils/compare.js +3 -3
  89. package/dist/cjs/utils/date.js +2 -2
  90. package/dist/cjs/utils/deepMerge.js +5 -5
  91. package/dist/cjs/utils/hairline.js +1 -0
  92. package/dist/cjs/utils/render.js +2 -8
  93. package/dist/cjs/utils/validate.js +2 -4
  94. package/dist/es/components/action-sheet/ActionSheet.js +45 -51
  95. package/dist/es/components/area/Area.js +22 -22
  96. package/dist/es/components/avatar/Avatar.js +23 -23
  97. package/dist/es/components/badge/Badge.js +56 -61
  98. package/dist/es/components/button/Button.js +87 -92
  99. package/dist/es/components/button/ButtonGroup.js +4 -4
  100. package/dist/es/components/calendar/Calendar.js +28 -28
  101. package/dist/es/components/cascader/Cascader.js +205 -212
  102. package/dist/es/components/cell/Cell.js +55 -52
  103. package/dist/es/components/cell/CellGroup.js +26 -25
  104. package/dist/es/components/checkbox/Checkbox.js +1 -0
  105. package/dist/es/components/checkbox/CheckboxGroup.js +20 -19
  106. package/dist/es/components/circle/Circle.js +66 -54
  107. package/dist/es/components/collapse/Collapse.js +18 -18
  108. package/dist/es/components/config-provider/ConfigProvider.js +5 -5
  109. package/dist/es/components/count-down/CountDown.js +17 -17
  110. package/dist/es/components/datetime-picker/DatetimePicker.js +34 -35
  111. package/dist/es/components/dialog/Dialog.js +16 -10
  112. package/dist/es/components/dialog/imperative.js +8 -14
  113. package/dist/es/components/dialog/tokens.js +1 -0
  114. package/dist/es/components/divider/Divider.js +48 -51
  115. package/dist/es/components/empty/Empty.js +30 -25
  116. package/dist/es/components/error-boundary/ErrorBoundary.js +3 -2
  117. package/dist/es/components/flex/Flex.js +27 -27
  118. package/dist/es/components/flex/FlexItem.js +1 -0
  119. package/dist/es/components/form/Form.js +93 -92
  120. package/dist/es/components/form/FormItem.js +60 -54
  121. package/dist/es/components/form/FormList.js +35 -35
  122. package/dist/es/components/grid/Grid.js +48 -48
  123. package/dist/es/components/grid/GridItem.js +10 -3
  124. package/dist/es/components/image/Image.js +25 -24
  125. package/dist/es/components/image/tokens.js +3 -1
  126. package/dist/es/components/image-preview/ImagePreview.js +19 -19
  127. package/dist/es/components/image-preview/tokens.js +3 -1
  128. package/dist/es/components/input/Input.js +16 -19
  129. package/dist/es/components/loading/Loading.js +27 -27
  130. package/dist/es/components/nav-bar/NavBar.js +21 -18
  131. package/dist/es/components/nav-bar/tokens.js +3 -1
  132. package/dist/es/components/notice-bar/NoticeBar.js +7 -3
  133. package/dist/es/components/notice-bar/tokens.js +3 -1
  134. package/dist/es/components/notify/Notify.js +2 -1
  135. package/dist/es/components/notify/imperative.js +17 -17
  136. package/dist/es/components/notify/tokens.js +1 -0
  137. package/dist/es/components/number-keyboard/NumberKeyboard.js +217 -201
  138. package/dist/es/components/number-keyboard/tokens.js +7 -1
  139. package/dist/es/components/overlay/Overlay.js +15 -15
  140. package/dist/es/components/password-input/PasswordInput.js +49 -49
  141. package/dist/es/components/picker/Picker.js +50 -58
  142. package/dist/es/components/popup/Popup.js +10 -10
  143. package/dist/es/components/popup/tokens.js +1 -0
  144. package/dist/es/components/portal/Portal.js +3 -4
  145. package/dist/es/components/progress/Progress.js +94 -95
  146. package/dist/es/components/progress/tokens.js +1 -0
  147. package/dist/es/components/radio/Radio.js +67 -63
  148. package/dist/es/components/radio/RadioGroup.js +6 -6
  149. package/dist/es/components/safe-area-view/SafeAreaView.js +7 -7
  150. package/dist/es/components/search/Search.js +28 -28
  151. package/dist/es/components/selector/Selector.js +19 -26
  152. package/dist/es/components/share-sheet/ShareSheet.js +6 -1
  153. package/dist/es/components/share-sheet/tokens.js +3 -1
  154. package/dist/es/components/sidebar/Sidebar.js +22 -16
  155. package/dist/es/components/sidebar/SidebarItem.js +9 -8
  156. package/dist/es/components/sidebar/tokens.js +3 -1
  157. package/dist/es/components/skeleton/Skeleton.js +43 -42
  158. package/dist/es/components/space/Space.js +45 -41
  159. package/dist/es/components/space/tokens.js +7 -1
  160. package/dist/es/components/stepper/Stepper.js +17 -15
  161. package/dist/es/components/stepper/tokens.js +1 -0
  162. package/dist/es/components/swiper/Swiper.js +11 -8
  163. package/dist/es/components/swiper/SwiperPagIndicator.js +3 -2
  164. package/dist/es/components/switch/Switch.js +23 -23
  165. package/dist/es/components/tabbar/Tabbar.js +26 -26
  166. package/dist/es/components/tabs/Tabs.js +144 -154
  167. package/dist/es/components/tabs/tokens.js +3 -1
  168. package/dist/es/components/tag/Tag.js +38 -38
  169. package/dist/es/components/toast/Toast.js +3 -2
  170. package/dist/es/components/toast/tokens.js +1 -0
  171. package/dist/es/components/typography/Typography.js +23 -21
  172. package/dist/es/components/water-mark/WaterMark.js +65 -65
  173. package/dist/es/design-system/Text.js +19 -0
  174. package/dist/es/design-system/createComponentTokensHook.js +2 -2
  175. package/dist/es/design-system/index.js +1 -0
  176. package/dist/es/design-system/mergeTokensOverride.js +1 -4
  177. package/dist/es/hooks/useControllableValue.js +11 -11
  178. package/dist/es/hooks/useCountDown.js +18 -18
  179. package/dist/es/platform/measure.js +4 -2
  180. package/dist/es/utils/color.js +1 -4
  181. package/dist/es/utils/compare.js +3 -3
  182. package/dist/es/utils/date.js +2 -2
  183. package/dist/es/utils/deepMerge.js +5 -5
  184. package/dist/es/utils/hairline.js +1 -0
  185. package/dist/es/utils/render.js +1 -1
  186. package/dist/es/utils/validate.js +1 -2
  187. package/dist/types/components/dialog/tokens.d.ts +1 -0
  188. package/dist/types/components/image-preview/tokens.d.ts +1 -0
  189. package/dist/types/components/nav-bar/tokens.d.ts +1 -1
  190. package/dist/types/components/notice-bar/tokens.d.ts +1 -0
  191. package/dist/types/components/number-keyboard/tokens.d.ts +5 -0
  192. package/dist/types/components/picker/Picker.d.ts +1 -1
  193. package/dist/types/components/popup/tokens.d.ts +1 -0
  194. package/dist/types/components/share-sheet/tokens.d.ts +1 -0
  195. package/dist/types/components/stepper/tokens.d.ts +1 -0
  196. package/dist/types/components/tabs/tokens.d.ts +1 -0
  197. package/dist/types/components/toast/tokens.d.ts +1 -0
  198. package/dist/types/design-system/Text.d.ts +3 -0
  199. package/dist/types/design-system/index.d.ts +1 -0
  200. package/dist/types/hooks/useCountDown.d.ts +1 -1
  201. package/dist/types/utils/color.d.ts +0 -2
  202. package/dist/types/utils/date.d.ts +1 -1
  203. package/dist/types/utils/render.d.ts +1 -1
  204. package/dist/types/utils/validate.d.ts +0 -1
  205. package/package.json +17 -3
@@ -52,52 +52,52 @@ const useTabsAnimation = ({
52
52
  layoutMap,
53
53
  navContainerWidthRef
54
54
  }) => {
55
- const indicatorX = (0, _react().useRef)(new (_reactNative().Animated.Value)(0)).current;
56
- const indicatorWidth = (0, _react().useRef)(new (_reactNative().Animated.Value)(0)).current;
57
- const indicatorInitializedRef = (0, _react().useRef)(false);
58
- const indicatorAnimRef = (0, _react().useRef)(null);
55
+ const indX = (0, _react().useRef)(new (_reactNative().Animated.Value)(0)).current;
56
+ const indW = (0, _react().useRef)(new (_reactNative().Animated.Value)(0)).current;
57
+ const indInitRef = (0, _react().useRef)(false);
58
+ const animRef = (0, _react().useRef)(null);
59
59
  const animateIndicator = (0, _react().useCallback)((name, immediate) => {
60
60
  if (name == null || type !== 'line') return false;
61
- const shouldUseEqualWidth = !scrollable && align !== 'start' && navContainerWidthRef.current > 0 && panes.length > 0;
62
- const index = nameIndexMap.get(name) ?? -1;
63
- const equalTabWidth = shouldUseEqualWidth ? navContainerWidthRef.current / panes.length : 0;
64
- const layout = shouldUseEqualWidth ? {
65
- x: Math.max(index, 0) * equalTabWidth,
66
- width: equalTabWidth
61
+ const eqW = !scrollable && align !== 'start' && navContainerWidthRef.current > 0 && panes.length > 0;
62
+ const idx = nameIndexMap.get(name) ?? -1;
63
+ const eqTabW = eqW ? navContainerWidthRef.current / panes.length : 0;
64
+ const lay = eqW ? {
65
+ x: Math.max(idx, 0) * eqTabW,
66
+ width: eqTabW
67
67
  } : layoutMap.current.get(name);
68
- if (!layout || index < 0) return false;
69
- indicatorAnimRef.current?.stop();
70
- const timing = (value, toValue) => _reactNative().Animated.timing(value, {
71
- toValue,
68
+ if (!lay || idx < 0) return false;
69
+ animRef.current?.stop();
70
+ const timing = (v, to) => _reactNative().Animated.timing(v, {
71
+ toValue: to,
72
72
  duration: immediate || !animated ? 0 : resolvedDuration,
73
73
  useNativeDriver: false,
74
74
  isInteraction: false
75
75
  });
76
- const targetWidth = resolvedLineWidth ?? layout.width;
77
- const targetX = resolvedLineWidth ? layout.x + (layout.width - targetWidth) / 2 : layout.x;
78
- const anim = _reactNative().Animated.parallel([timing(indicatorX, targetX), timing(indicatorWidth, targetWidth)]);
79
- indicatorAnimRef.current = anim;
76
+ const tW = resolvedLineWidth ?? lay.width;
77
+ const tX = resolvedLineWidth ? lay.x + (lay.width - tW) / 2 : lay.x;
78
+ const anim = _reactNative().Animated.parallel([timing(indX, tX), timing(indW, tW)]);
79
+ animRef.current = anim;
80
80
  anim.start(({
81
81
  finished
82
82
  }) => {
83
- if (finished) indicatorAnimRef.current = null;
83
+ if (finished) animRef.current = null;
84
84
  });
85
85
  return true;
86
- }, [align, animated, indicatorWidth, indicatorX, nameIndexMap, panes.length, resolvedDuration, resolvedLineWidth, scrollable, type, layoutMap, navContainerWidthRef]);
86
+ }, [align, animated, indW, indX, nameIndexMap, panes.length, resolvedDuration, resolvedLineWidth, scrollable, type, layoutMap, navContainerWidthRef]);
87
87
  (0, _react().useEffect)(() => {
88
88
  if (currentName == null) return;
89
- const shouldAnimate = indicatorInitializedRef.current;
90
- const didAnimate = animateIndicator(currentName, !shouldAnimate);
91
- if (didAnimate && !indicatorInitializedRef.current) indicatorInitializedRef.current = true;
89
+ const should = indInitRef.current;
90
+ const did = animateIndicator(currentName, !should);
91
+ if (did && !indInitRef.current) indInitRef.current = true;
92
92
  }, [animateIndicator, currentName]);
93
93
  (0, _react().useEffect)(() => () => {
94
- indicatorAnimRef.current?.stop();
95
- indicatorAnimRef.current = null;
94
+ animRef.current?.stop();
95
+ animRef.current = null;
96
96
  }, []);
97
97
  return {
98
- indicatorX,
99
- indicatorWidth,
100
- indicatorInitializedRef,
98
+ indicatorX: indX,
99
+ indicatorWidth: indW,
100
+ indicatorInitializedRef: indInitRef,
101
101
  animateIndicator
102
102
  };
103
103
  };
@@ -110,97 +110,86 @@ const useTabsScroll = ({
110
110
  navContainerWidthRef,
111
111
  navContentWidthRef
112
112
  }) => {
113
- const navScrollRef = (0, _react().useRef)(null);
114
- const navScrollX = (0, _react().useRef)(new (_reactNative().Animated.Value)(0)).current;
115
- const navScrollAnimRef = (0, _react().useRef)(null);
116
- const navAutoScrollingRef = (0, _react().useRef)(false);
117
- const navLastScrollXRef = (0, _react().useRef)(0);
118
- const navAutoScrollFrameRef = (0, _react().useRef)(null);
113
+ const navScrRef = (0, _react().useRef)(null);
114
+ const navX = (0, _react().useRef)(new (_reactNative().Animated.Value)(0)).current;
115
+ const navAnimRef = (0, _react().useRef)(null);
116
+ const autoScrRef = (0, _react().useRef)(false);
117
+ const lastXRef = (0, _react().useRef)(0);
118
+ const frameRef = (0, _react().useRef)(null);
119
119
  const scrollIntoView = (0, _react().useCallback)(immediate => {
120
120
  if (!scrollable || currentName == null) return;
121
- const layout = layoutMap.current.get(currentName);
122
- const containerWidth = navContainerWidthRef.current;
123
- if (!layout || !containerWidth) return;
124
- const contentWidth = navContentWidthRef.current;
125
- const targetX = layout.x - (containerWidth - layout.width) / 2;
126
- const maxScroll = Math.max(contentWidth - containerWidth, 0);
127
- const clampedX = Math.max(0, Math.min(targetX, maxScroll));
128
- if (maxScroll <= 0) return;
129
- if (Math.abs(clampedX - navLastScrollXRef.current) < 1) return;
130
- if (navScrollAnimRef.current) {
131
- navScrollAnimRef.current.stop();
132
- navScrollAnimRef.current = null;
133
- }
134
- cancelFrame(navAutoScrollFrameRef.current);
135
- navAutoScrollFrameRef.current = null;
121
+ const lay = layoutMap.current.get(currentName);
122
+ const ctrW = navContainerWidthRef.current;
123
+ if (!lay || !ctrW) return;
124
+ const cntW = navContentWidthRef.current;
125
+ const tX = lay.x - (ctrW - lay.width) / 2;
126
+ const maxS = Math.max(cntW - ctrW, 0);
127
+ const clampX = Math.max(0, Math.min(tX, maxS));
128
+ if (maxS <= 0 || Math.abs(clampX - lastXRef.current) < 1) return;
129
+ navAnimRef.current?.stop();
130
+ navAnimRef.current = null;
131
+ cancelFrame(frameRef.current);
132
+ frameRef.current = null;
136
133
  if (immediate || !animated) {
137
- navAutoScrollingRef.current = true;
138
- navScrollX.setValue(clampedX);
139
- navAutoScrollFrameRef.current = requestFrame(() => {
140
- navAutoScrollFrameRef.current = null;
141
- navAutoScrollingRef.current = false;
134
+ autoScrRef.current = true;
135
+ navX.setValue(clampX);
136
+ frameRef.current = requestFrame(() => {
137
+ frameRef.current = null;
138
+ autoScrRef.current = false;
142
139
  });
143
140
  return;
144
141
  }
145
- navScrollX.setValue(navLastScrollXRef.current);
146
- navAutoScrollingRef.current = true;
147
- navScrollAnimRef.current = _reactNative().Animated.timing(navScrollX, {
148
- toValue: clampedX,
142
+ navX.setValue(lastXRef.current);
143
+ autoScrRef.current = true;
144
+ navAnimRef.current = _reactNative().Animated.timing(navX, {
145
+ toValue: clampX,
149
146
  duration: resolvedDuration,
150
147
  useNativeDriver: false,
151
148
  isInteraction: false
152
149
  });
153
- navScrollAnimRef.current.start(({
150
+ navAnimRef.current.start(({
154
151
  finished
155
152
  }) => {
156
- navScrollAnimRef.current = null;
157
- navAutoScrollingRef.current = false;
158
- if (!finished) return;
159
- navLastScrollXRef.current = clampedX;
153
+ navAnimRef.current = null;
154
+ autoScrRef.current = false;
155
+ if (finished) lastXRef.current = clampX;
160
156
  });
161
- }, [animated, currentName, navScrollX, resolvedDuration, scrollable, layoutMap, navContainerWidthRef, navContentWidthRef]);
157
+ }, [animated, currentName, navX, resolvedDuration, scrollable, layoutMap, navContainerWidthRef, navContentWidthRef]);
162
158
  (0, _react().useEffect)(() => {
163
159
  if (!scrollable) return;
164
- const listenerId = navScrollX.addListener(({
160
+ const id = navX.addListener(({
165
161
  value
166
162
  }) => {
167
- const prev = navLastScrollXRef.current;
168
- navLastScrollXRef.current = value;
169
- if (Math.abs(value - prev) < 0.5) return;
170
- navScrollRef.current?.scrollTo({
163
+ const prev = lastXRef.current;
164
+ lastXRef.current = value;
165
+ if (Math.abs(value - prev) >= 0.5) navScrRef.current?.scrollTo({
171
166
  x: value,
172
167
  y: 0,
173
168
  animated: false
174
169
  });
175
170
  });
176
- return () => {
177
- navScrollX.removeListener(listenerId);
178
- };
179
- }, [navScrollX, scrollable]);
180
- (0, _react().useEffect)(() => {
181
- return () => {
182
- cancelFrame(navAutoScrollFrameRef.current);
183
- navAutoScrollFrameRef.current = null;
184
- };
171
+ return () => navX.removeListener(id);
172
+ }, [navX, scrollable]);
173
+ (0, _react().useEffect)(() => () => {
174
+ cancelFrame(frameRef.current);
175
+ frameRef.current = null;
185
176
  }, []);
186
- const handleNavScrollBeginDrag = (0, _react().useCallback)(event => {
187
- navAutoScrollingRef.current = false;
188
- if (navScrollAnimRef.current) {
189
- navScrollAnimRef.current.stop();
190
- navScrollAnimRef.current = null;
191
- }
192
- navLastScrollXRef.current = event.nativeEvent.contentOffset.x;
177
+ const onNavBeginDrag = (0, _react().useCallback)(e => {
178
+ autoScrRef.current = false;
179
+ navAnimRef.current?.stop();
180
+ navAnimRef.current = null;
181
+ lastXRef.current = e.nativeEvent.contentOffset.x;
193
182
  }, []);
194
- const handleNavScroll = (0, _react().useCallback)(event => {
195
- if (navAutoScrollingRef.current) return;
196
- navLastScrollXRef.current = event.nativeEvent.contentOffset.x;
183
+ const onNavScroll = (0, _react().useCallback)(e => {
184
+ if (autoScrRef.current) return;
185
+ lastXRef.current = e.nativeEvent.contentOffset.x;
197
186
  }, []);
198
187
  return {
199
- navScrollRef,
200
- navScrollX,
188
+ navScrollRef: navScrRef,
189
+ navScrollX: navX,
201
190
  scrollIntoView,
202
- handleNavScrollBeginDrag,
203
- handleNavScroll
191
+ handleNavScrollBeginDrag: onNavBeginDrag,
192
+ handleNavScroll: onNavScroll
204
193
  };
205
194
  };
206
195
  const TabBarItemInner = ({
@@ -221,45 +210,45 @@ const TabBarItemInner = ({
221
210
  onLayout,
222
211
  isLast
223
212
  }) => {
224
- const isDisabled = !!pane.disabled;
225
- const ariaPress = (0, _hooks.useAriaPress)({
226
- onPress: event => onSelect(pane, pane.index, event),
213
+ const dis = !!pane.disabled;
214
+ const aria = (0, _hooks.useAriaPress)({
215
+ onPress: e => onSelect(pane, pane.index, e),
227
216
  extraProps: {
228
217
  accessibilityRole: 'tab',
229
218
  accessibilityState: {
230
219
  selected: isActive,
231
- disabled: isDisabled
220
+ disabled: dis
232
221
  },
233
222
  testID: `rv-tabs-item-${pane.name}`
234
223
  }
235
224
  });
236
- const isCapsule = type === 'capsule';
237
- const isJumbo = type === 'jumbo';
238
- const isCard = type === 'card';
239
- const renderTitle = (0, _validate.isFunction)(pane.title) ? pane.title(isActive) : pane.title ?? pane.name;
240
- const renderDescription = (0, _validate.isFunction)(pane.description) ? pane.description(isActive) : pane.description;
241
- const activeTitleColor = titleActiveColor ?? (isCard ? tokens.colors.cardActiveText : isCapsule ? tokens.colors.capsuleActiveText : color ?? tokens.colors.textActive);
242
- const inactiveTitleColor = titleInactiveColor ?? (isCard ? color ?? tokens.colors.cardBorder : isCapsule ? tokens.colors.capsuleText : tokens.colors.text);
243
- const textColor = pane.disabled ? tokens.colors.textDisabled : isActive ? activeTitleColor : inactiveTitleColor;
244
- const descriptionColor = isDisabled ? tokens.colors.textDisabled : isJumbo ? isActive ? tokens.colors.jumboDescriptionActive : tokens.colors.jumboDescription : isActive ? tokens.colors.descriptionActive : tokens.colors.description;
245
- const shouldFlex = !scrollable && (align !== 'start' || isCard);
246
- const isCompactType = isCard || isJumbo || isCapsule;
247
- const horizontalPadding = isCompactType ? 0 : tokens.tabList.paddingHorizontal;
248
- const verticalPadding = isCompactType ? 0 : tokens.tabList.paddingVertical;
249
- const labelWrapperStyles = [S.lblW, isJumbo && S.lblWJ, isCard && S.cardLbl, isCard && {
225
+ const isCap = type === 'capsule';
226
+ const isJ = type === 'jumbo';
227
+ const isC = type === 'card';
228
+ const rTitle = (0, _validate.isFunction)(pane.title) ? pane.title(isActive) : pane.title ?? pane.name;
229
+ const rDesc = (0, _validate.isFunction)(pane.description) ? pane.description(isActive) : pane.description;
230
+ const actClr = titleActiveColor ?? (isC ? tokens.colors.cardActiveText : isCap ? tokens.colors.capsuleActiveText : color ?? tokens.colors.textActive);
231
+ const inactClr = titleInactiveColor ?? (isC ? color ?? tokens.colors.cardBorder : isCap ? tokens.colors.capsuleText : tokens.colors.text);
232
+ const txtClr = pane.disabled ? tokens.colors.textDisabled : isActive ? actClr : inactClr;
233
+ const descClr = dis ? tokens.colors.textDisabled : isJ ? isActive ? tokens.colors.jumboDescriptionActive : tokens.colors.jumboDescription : isActive ? tokens.colors.descriptionActive : tokens.colors.description;
234
+ const flex = !scrollable && (align !== 'start' || isC);
235
+ const compact = isC || isJ || isCap;
236
+ const hPad = compact ? 0 : tokens.tabList.paddingHorizontal;
237
+ const vPad = compact ? 0 : tokens.tabList.paddingVertical;
238
+ const lblWrap = [S.lblW, isJ && S.lblWJ, isC && S.cardLbl, isC && {
250
239
  paddingHorizontal: tokens.card.paddingHorizontal,
251
240
  paddingVertical: tokens.card.paddingVertical
252
- }, isCapsule && {
241
+ }, isCap && {
253
242
  flex: 1,
254
243
  alignSelf: 'stretch',
255
244
  paddingHorizontal: tokens.capsule.paddingHorizontal,
256
245
  paddingVertical: tokens.capsule.paddingVertical
257
- }, isJumbo && {
246
+ }, isJ && {
258
247
  paddingHorizontal: tokens.jumbo.paddingHorizontal,
259
248
  paddingVertical: tokens.jumbo.paddingVertical,
260
249
  alignItems: 'center'
261
250
  }].filter(Boolean);
262
- const labelTextWrapperStyles = isCapsule ? [{
251
+ const lblTxtWrap = isCap ? [{
263
252
  flex: 1,
264
253
  alignSelf: 'stretch',
265
254
  justifyContent: 'center',
@@ -267,63 +256,64 @@ const TabBarItemInner = ({
267
256
  borderRadius: tokens.capsule.radius,
268
257
  backgroundColor: isActive ? color ?? tokens.colors.capsuleActiveBackground : tokens.colors.capsuleBackground
269
258
  }] : null;
270
- const titleTextStyle = [S.title, {
271
- color: textColor,
272
- fontSize: isJumbo ? tokens.typography.jumboTitleSize : tokens.typography.titleSize,
259
+ const titleStyleArr = [S.title, {
260
+ color: txtClr,
261
+ fontFamily: tokens.typography.fontFamily,
262
+ fontSize: isJ ? tokens.typography.jumboTitleSize : tokens.typography.titleSize,
273
263
  fontWeight: isActive ? tokens.typography.titleActiveWeight : tokens.typography.titleWeight,
274
- lineHeight: isJumbo ? tokens.typography.jumboLineHeight : undefined,
264
+ lineHeight: isJ ? tokens.typography.jumboLineHeight : undefined,
275
265
  textAlign: 'center'
276
- }, ellipsis && !isJumbo ? S.ellipsis : null, titleStyle];
277
- const titleNode = /*#__PURE__*/_react().default.createElement(_reactNative().Text, {
278
- style: titleTextStyle,
279
- numberOfLines: ellipsis && !isJumbo ? 1 : undefined
280
- }, renderTitle);
281
- const descriptionMarginTop = isJumbo ? tokens.spacing.jumboDescriptionMarginTop : tokens.spacing.descriptionMarginTop;
282
- const descriptionJumboStyle = isJumbo ? {
266
+ }, ellipsis && !isJ ? S.ellipsis : null, titleStyle];
267
+ const descMT = isJ ? tokens.spacing.jumboDescriptionMarginTop : tokens.spacing.descriptionMarginTop;
268
+ const descJStyle = isJ ? {
283
269
  backgroundColor: isActive ? tokens.colors.jumboDescriptionActiveBackground : tokens.colors.jumboDescriptionBackground,
284
270
  paddingHorizontal: tokens.jumbo.descriptionPaddingHorizontal,
285
271
  paddingVertical: tokens.jumbo.descriptionPaddingVertical,
286
272
  borderRadius: tokens.jumbo.descriptionRadius
287
273
  } : null;
288
- const descriptionTextStyle = [S.descTxt, {
289
- color: descriptionColor,
290
- fontSize: tokens.typography.descriptionSize,
291
- marginTop: descriptionMarginTop,
292
- textAlign: 'center'
293
- }, descriptionJumboStyle, descriptionStyle];
294
- const descriptionViewStyle = [{
295
- marginTop: descriptionMarginTop,
296
- alignItems: 'center'
297
- }, descriptionJumboStyle];
298
- const handleLayout = (0, _react().useCallback)(event => {
299
- onLayout(pane.name, event);
300
- }, [onLayout, pane.name]);
301
- return /*#__PURE__*/_react().default.createElement(_reactNative().Pressable, _extends({}, ariaPress.interactionProps, {
302
- onLayout: handleLayout,
303
- style: [S.tabI, shouldFlex ? S.flexI : null, {
304
- paddingHorizontal: horizontalPadding,
305
- paddingVertical: verticalPadding
306
- }, isCard ? {
274
+ const onLay = (0, _react().useCallback)(e => onLayout(pane.name, e), [onLayout, pane.name]);
275
+ return /*#__PURE__*/_react().default.createElement(_reactNative().Pressable, _extends({}, aria.interactionProps, {
276
+ onLayout: onLay,
277
+ style: [S.tabI, flex ? S.flexI : null, {
278
+ paddingHorizontal: hPad,
279
+ paddingVertical: vPad
280
+ }, isC ? {
307
281
  backgroundColor: isActive ? color ?? tokens.colors.cardActiveBackground : tokens.colors.cardBackground
308
282
  } : null, tabStyle]
309
283
  }), /*#__PURE__*/_react().default.createElement(_reactNative().View, {
310
- style: labelWrapperStyles
311
- }, labelTextWrapperStyles ? /*#__PURE__*/_react().default.createElement(_reactNative().View, {
312
- style: labelTextWrapperStyles
313
- }, titleNode) : titleNode, (0, _validate.isRenderable)(renderDescription) && ((0, _validate.isText)(renderDescription) ? /*#__PURE__*/_react().default.createElement(_reactNative().Text, {
314
- style: descriptionTextStyle
315
- }, renderDescription) : /*#__PURE__*/_react().default.createElement(_reactNative().View, {
316
- style: descriptionViewStyle
317
- }, renderDescription)), (0, _validate.isRenderable)(pane.badge) && /*#__PURE__*/_react().default.createElement(_reactNative().View, {
284
+ style: lblWrap
285
+ }, lblTxtWrap ? /*#__PURE__*/_react().default.createElement(_reactNative().View, {
286
+ style: lblTxtWrap
287
+ }, /*#__PURE__*/_react().default.createElement(_reactNative().Text, {
288
+ style: titleStyleArr,
289
+ numberOfLines: ellipsis && !isJ ? 1 : undefined
290
+ }, rTitle)) : /*#__PURE__*/_react().default.createElement(_reactNative().Text, {
291
+ style: titleStyleArr,
292
+ numberOfLines: ellipsis && !isJ ? 1 : undefined
293
+ }, rTitle), (0, _validate.isRenderable)(rDesc) && ((0, _validate.isText)(rDesc) ? /*#__PURE__*/_react().default.createElement(_reactNative().Text, {
294
+ style: [S.descTxt, {
295
+ color: descClr,
296
+ fontFamily: tokens.typography.fontFamily,
297
+ fontSize: tokens.typography.descriptionSize,
298
+ marginTop: descMT,
299
+ textAlign: 'center'
300
+ }, descJStyle, descriptionStyle]
301
+ }, rDesc) : /*#__PURE__*/_react().default.createElement(_reactNative().View, {
302
+ style: [{
303
+ marginTop: descMT,
304
+ alignItems: 'center'
305
+ }, descJStyle]
306
+ }, rDesc)), (0, _validate.isRenderable)(pane.badge) && /*#__PURE__*/_react().default.createElement(_reactNative().View, {
318
307
  style: {
319
308
  marginTop: tokens.spacing.badgeMarginTop
320
309
  }
321
310
  }, (0, _validate.isText)(pane.badge) ? /*#__PURE__*/_react().default.createElement(_reactNative().Text, {
322
311
  style: {
323
312
  color: tokens.colors.badgeText,
313
+ fontFamily: tokens.typography.fontFamily,
324
314
  fontSize: tokens.typography.badgeTextSize
325
315
  }
326
- }, pane.badge) : pane.badge)), isCard && !isLast && /*#__PURE__*/_react().default.createElement(_reactNative().View, {
316
+ }, pane.badge) : pane.badge)), isC && !isLast && /*#__PURE__*/_react().default.createElement(_reactNative().View, {
327
317
  style: (0, _hairline.createHairlineView)({
328
318
  position: 'right',
329
319
  color: color ?? tokens.colors.cardBorder,
@@ -398,7 +388,7 @@ const TabsBaseInner = (props, ref) => {
398
388
  _react().Children.forEach(nodes, node => {
399
389
  if (! /*#__PURE__*/(0, _react().isValidElement)(node)) return;
400
390
  const element = node;
401
- if (element.type === _react().Fragment) {
391
+ if (element.type === _react().default.Fragment) {
402
392
  walk(element.props.children);
403
393
  return;
404
394
  }
@@ -10,7 +10,8 @@ const createTokens = foundations => {
10
10
  palette,
11
11
  spacing,
12
12
  fontSize,
13
- radii
13
+ radii,
14
+ typography
14
15
  } = foundations;
15
16
  const onPrimary = palette.primary.foreground ?? '#ffffff';
16
17
  return {
@@ -62,6 +63,7 @@ const createTokens = foundations => {
62
63
  background: '#ffffff'
63
64
  },
64
65
  typography: {
66
+ fontFamily: typography.fontFamily,
65
67
  titleSize: fontSize.sm,
66
68
  titleWeight: foundations.typography.weight.medium,
67
69
  titleActiveWeight: foundations.typography.weight.semiBold,
@@ -35,14 +35,14 @@ const TagImpl = props => {
35
35
  const {
36
36
  tokensOverride,
37
37
  children,
38
- type: typeProp,
39
- size: sizeProp,
40
- plain: plainProp,
41
- round: roundProp,
42
- mark: markProp,
38
+ type: typeP,
39
+ size: sizeP,
40
+ plain: plainP,
41
+ round: roundP,
42
+ mark: markP,
43
43
  color,
44
44
  textColor,
45
- show: showProp,
45
+ show: showP,
46
46
  closeable,
47
47
  closeIcon,
48
48
  onClose,
@@ -53,20 +53,20 @@ const TagImpl = props => {
53
53
  } = props;
54
54
  const tokens = (0, _tokens.useTagTokens)(tokensOverride);
55
55
  const dir = (0, _useDirection.useDirection)();
56
- const type = typeProp ?? tokens.defaults.type;
57
- const size = sizeProp ?? tokens.defaults.size;
58
- const plain = plainProp ?? tokens.defaults.plain;
59
- const round = roundProp ?? tokens.defaults.round;
60
- const mark = markProp ?? tokens.defaults.mark;
61
- const show = showProp ?? tokens.defaults.show;
56
+ const type = typeP ?? tokens.defaults.type;
57
+ const size = sizeP ?? tokens.defaults.size;
58
+ const plain = plainP ?? tokens.defaults.plain;
59
+ const round = roundP ?? tokens.defaults.round;
60
+ const mark = markP ?? tokens.defaults.mark;
61
+ const show = showP ?? tokens.defaults.show;
62
62
  if (!show) return null;
63
63
  const tone = tokens.colors.toneMap[type] ?? tokens.colors.toneMap.default;
64
- const sizeTokens = tokens.sizing.sizes[size];
65
- const backgroundColor = plain ? tokens.colors.plainBackground : color ?? tone.background;
66
- const resolvedTextColor = textColor ?? (plain ? color ?? tone.background : tone.text);
67
- const borderColor = plain ? color ?? tone.background : 'transparent';
68
- const borderRadius = round ? tokens.radii.round : sizeTokens.borderRadius;
69
- const markRadii = mark ? dir === 'rtl' ? {
64
+ const szTok = tokens.sizing.sizes[size];
65
+ const bgClr = plain ? tokens.colors.plainBackground : color ?? tone.background;
66
+ const txtClr = textColor ?? (plain ? color ?? tone.background : tone.text);
67
+ const borderClr = plain ? color ?? tone.background : 'transparent';
68
+ const radius = round ? tokens.radii.round : szTok.borderRadius;
69
+ const markR = mark ? dir === 'rtl' ? {
70
70
  borderTopRightRadius: tokens.radii.markLeading,
71
71
  borderBottomRightRadius: tokens.radii.markLeading,
72
72
  borderTopLeftRadius: tokens.radii.round,
@@ -77,17 +77,17 @@ const TagImpl = props => {
77
77
  borderTopRightRadius: tokens.radii.round,
78
78
  borderBottomRightRadius: tokens.radii.round
79
79
  } : null;
80
- const resolvedRadius = mark ? tokens.radii.round : borderRadius;
81
- const containerStyle = [tokens.layout.container, {
82
- backgroundColor,
83
- paddingHorizontal: sizeTokens.paddingHorizontal,
84
- paddingVertical: sizeTokens.paddingVertical,
85
- borderRadius
86
- }, markRadii, style];
80
+ const resRadius = mark ? tokens.radii.round : radius;
81
+ const ctrStyle = [tokens.layout.container, {
82
+ backgroundColor: bgClr,
83
+ paddingHorizontal: szTok.paddingHorizontal,
84
+ paddingVertical: szTok.paddingVertical,
85
+ borderRadius: radius
86
+ }, markR, style];
87
87
  const label = !(0, _validate.isRenderable)(children) ? null : (0, _utils.renderTextOrNode)(children, [{
88
- color: resolvedTextColor,
89
- fontSize: sizeTokens.fontSize,
90
- lineHeight: sizeTokens.lineHeight,
88
+ color: txtClr,
89
+ fontSize: szTok.fontSize,
90
+ lineHeight: szTok.lineHeight,
91
91
  fontFamily: tokens.typography.fontFamily,
92
92
  fontWeight: tokens.typography.fontWeight
93
93
  }, textStyle].filter(Boolean));
@@ -97,33 +97,33 @@ const TagImpl = props => {
97
97
  style: [tokens.layout.close, {
98
98
  marginLeft: tokens.spacing.closeGap
99
99
  }],
100
- onPress: event => {
101
- event.stopPropagation?.();
100
+ onPress: e => {
101
+ e.stopPropagation?.();
102
102
  onClose?.();
103
103
  }
104
- }, (0, _utils.isFunction)(closeIcon) ? closeIcon(resolvedTextColor, tokens.sizing.closeIconSize) : closeIcon ?? /*#__PURE__*/_react().default.createElement(_reactNativeSystemIcon().Close, {
105
- color: resolvedTextColor,
104
+ }, (0, _utils.isFunction)(closeIcon) ? closeIcon(txtClr, tokens.sizing.closeIconSize) : closeIcon ?? /*#__PURE__*/_react().default.createElement(_reactNativeSystemIcon().Close, {
105
+ color: txtClr,
106
106
  size: tokens.sizing.closeIconSize
107
107
  }));
108
- const hairlineOverlay = plain ? /*#__PURE__*/_react().default.createElement(_reactNative().View, {
108
+ const hlOverlay = plain ? /*#__PURE__*/_react().default.createElement(_reactNative().View, {
109
109
  style: (0, _utils.createHairlineView)({
110
110
  position: 'all',
111
- color: borderColor,
112
- borderRadius: resolvedRadius
111
+ color: borderClr,
112
+ borderRadius: resRadius
113
113
  })
114
114
  }) : null;
115
- const content = /*#__PURE__*/_react().default.createElement(_react().default.Fragment, null, label, close, hairlineOverlay);
115
+ const content = /*#__PURE__*/_react().default.createElement(_react().default.Fragment, null, label, close, hlOverlay);
116
116
  if (onPress) return /*#__PURE__*/_react().default.createElement(_reactNative().Pressable, _extends({
117
117
  accessibilityRole: "button",
118
118
  onPress: onPress,
119
119
  style: ({
120
120
  pressed
121
- }) => [containerStyle, pressed && {
121
+ }) => [ctrStyle, pressed && {
122
122
  opacity: tokens.defaults.pressedOpacity
123
123
  }]
124
124
  }, rest), content);
125
125
  return /*#__PURE__*/_react().default.createElement(_reactNative().View, _extends({
126
- style: containerStyle
126
+ style: ctrStyle
127
127
  }, rest), content);
128
128
  };
129
129
  const Tag = exports.Tag = /*#__PURE__*/_react().default.memo(TagImpl);
@@ -219,8 +219,9 @@ const ToastContentImpl = props => {
219
219
  const messageStyle = (0, _react().useMemo)(() => ({
220
220
  color: colors.text,
221
221
  fontSize: tokens.fontSize,
222
- lineHeight: tokens.lineHeight
223
- }), [colors.text, tokens.fontSize, tokens.lineHeight]);
222
+ lineHeight: tokens.lineHeight,
223
+ fontFamily: tokens.fontFamily
224
+ }), [colors.text, tokens.fontSize, tokens.fontFamily, tokens.lineHeight]);
224
225
  const isTextOnly = type === 'info' && !iconNode;
225
226
  const baseStyle = (0, _react().useMemo)(() => isTextOnly ? {
226
227
  minWidth: tokens.textMinWidth,
@@ -22,6 +22,7 @@ const createToastTokens = foundations => {
22
22
  },
23
23
  fontSize: foundations.fontSize.sm,
24
24
  lineHeight: Math.round(foundations.fontSize.sm * foundations.typography.lineHeightMultiplier),
25
+ fontFamily: foundations.typography.fontFamily,
25
26
  radius: foundations.radii.md,
26
27
  gap: foundations.spacing.sm,
27
28
  iconSize: 36,