react-native-system-ui 0.0.3 → 0.0.5

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 (168) hide show
  1. package/dist/cjs/components/area/Area.js +4 -10
  2. package/dist/cjs/components/avatar/Avatar.js +3 -3
  3. package/dist/cjs/components/avatar/tokens.js +2 -1
  4. package/dist/cjs/components/badge/Badge.js +30 -38
  5. package/dist/cjs/components/button/Button.js +13 -13
  6. package/dist/cjs/components/button/ButtonGroup.js +8 -8
  7. package/dist/cjs/components/calendar/Calendar.js +10 -10
  8. package/dist/cjs/components/cascader/Cascader.js +4 -4
  9. package/dist/cjs/components/cascader/useCascaderExtend.js +5 -15
  10. package/dist/cjs/components/checkbox/CheckboxGroup.js +2 -2
  11. package/dist/cjs/components/circle/Circle.js +2 -2
  12. package/dist/cjs/components/collapse/Collapse.js +13 -16
  13. package/dist/cjs/components/config-provider/ConfigProvider.js +1 -1
  14. package/dist/cjs/components/datetime-picker/DatetimePicker.js +7 -7
  15. package/dist/cjs/components/dialog/Dialog.js +4 -6
  16. package/dist/cjs/components/dialog/tokens.js +2 -1
  17. package/dist/cjs/components/dropdown-menu/DropdownItem.js +53 -52
  18. package/dist/cjs/components/dropdown-menu/DropdownMenu.js +19 -23
  19. package/dist/cjs/components/dropdown-menu/tokens.js +20 -3
  20. package/dist/cjs/components/field/Field.js +6 -6
  21. package/dist/cjs/components/form/Form.js +5 -9
  22. package/dist/cjs/components/grid/Grid.js +4 -4
  23. package/dist/cjs/components/image/Image.js +19 -15
  24. package/dist/cjs/components/image-preview/ImagePreview.js +62 -60
  25. package/dist/cjs/components/image-preview/tokens.js +21 -2
  26. package/dist/cjs/components/index-bar/IndexAnchor.js +7 -6
  27. package/dist/cjs/components/index-bar/IndexBar.js +38 -44
  28. package/dist/cjs/components/index-bar/tokens.js +22 -13
  29. package/dist/cjs/components/index.js +343 -0
  30. package/dist/cjs/components/input/Input.js +7 -10
  31. package/dist/cjs/components/notice-bar/NoticeBar.js +69 -95
  32. package/dist/cjs/components/notify/Notify.js +49 -24
  33. package/dist/cjs/components/notify/defaults.js +2 -2
  34. package/dist/cjs/components/notify/imperative.js +1 -1
  35. package/dist/cjs/components/notify/tokens.js +5 -4
  36. package/dist/cjs/components/number-keyboard/NumberKeyboard.js +12 -12
  37. package/dist/cjs/components/number-keyboard/tokens.js +4 -2
  38. package/dist/cjs/components/overlay/useOverlayStack.js +5 -1
  39. package/dist/cjs/components/pagination/Pagination.js +2 -2
  40. package/dist/cjs/components/password-input/PasswordInput.js +35 -27
  41. package/dist/cjs/components/picker/Picker.js +11 -12
  42. package/dist/cjs/components/picker/WheelPicker.js +9 -9
  43. package/dist/cjs/components/picker/tokens.js +4 -2
  44. package/dist/cjs/components/popup/Popup.js +39 -54
  45. package/dist/cjs/components/popup/tokens.js +2 -1
  46. package/dist/cjs/components/portal/Portal.js +5 -0
  47. package/dist/cjs/components/portal/PortalHost.js +1 -13
  48. package/dist/cjs/components/pull-refresh/PullRefresh.js +46 -27
  49. package/dist/cjs/components/radio/RadioGroup.js +2 -2
  50. package/dist/cjs/components/search/Search.js +52 -67
  51. package/dist/cjs/components/search/tokens.js +2 -1
  52. package/dist/cjs/components/selector/Selector.js +3 -3
  53. package/dist/cjs/components/share-sheet/ShareSheet.js +64 -62
  54. package/dist/cjs/components/share-sheet/tokens.js +15 -2
  55. package/dist/cjs/components/sidebar/Sidebar.js +15 -19
  56. package/dist/cjs/components/sidebar/SidebarItem.js +0 -3
  57. package/dist/cjs/components/skeleton/Skeleton.js +44 -56
  58. package/dist/cjs/components/slider/Slider.js +55 -61
  59. package/dist/cjs/components/stepper/Stepper.js +13 -16
  60. package/dist/cjs/components/stepper/tokens.js +4 -2
  61. package/dist/cjs/components/swiper/Swiper.js +21 -42
  62. package/dist/cjs/components/swiper/useSwiperWeb.js +15 -18
  63. package/dist/cjs/components/tabbar/Tabbar.js +8 -11
  64. package/dist/cjs/components/tabbar/TabbarItem.js +0 -3
  65. package/dist/cjs/components/tabs/Tabs.js +33 -54
  66. package/dist/cjs/components/tabs/tokens.js +9 -1
  67. package/dist/cjs/components/tabs/useTabsScroll.js +4 -0
  68. package/dist/cjs/components/toast/Toast.js +10 -8
  69. package/dist/cjs/components/toast/tokens.js +5 -1
  70. package/dist/cjs/components/typography/Typography.js +17 -30
  71. package/dist/cjs/components/uploader/Uploader.js +49 -46
  72. package/dist/cjs/components/uploader/tokens.js +27 -1
  73. package/dist/cjs/components/water-mark/WaterMark.js +16 -16
  74. package/dist/cjs/hooks/usePresenceAnimation.js +12 -2
  75. package/dist/es/components/area/Area.js +5 -11
  76. package/dist/es/components/avatar/Avatar.js +3 -3
  77. package/dist/es/components/avatar/tokens.js +2 -1
  78. package/dist/es/components/badge/Badge.js +31 -39
  79. package/dist/es/components/button/Button.js +14 -14
  80. package/dist/es/components/button/ButtonGroup.js +7 -7
  81. package/dist/es/components/calendar/Calendar.js +11 -11
  82. package/dist/es/components/cascader/Cascader.js +5 -5
  83. package/dist/es/components/cascader/useCascaderExtend.js +5 -9
  84. package/dist/es/components/checkbox/CheckboxGroup.js +3 -3
  85. package/dist/es/components/circle/Circle.js +3 -3
  86. package/dist/es/components/collapse/Collapse.js +14 -17
  87. package/dist/es/components/config-provider/ConfigProvider.js +2 -2
  88. package/dist/es/components/datetime-picker/DatetimePicker.js +8 -8
  89. package/dist/es/components/dialog/Dialog.js +4 -6
  90. package/dist/es/components/dialog/tokens.js +2 -1
  91. package/dist/es/components/dropdown-menu/DropdownItem.js +53 -52
  92. package/dist/es/components/dropdown-menu/DropdownMenu.js +20 -24
  93. package/dist/es/components/dropdown-menu/tokens.js +20 -3
  94. package/dist/es/components/field/Field.js +7 -7
  95. package/dist/es/components/field/index.js +1 -1
  96. package/dist/es/components/form/Form.js +6 -10
  97. package/dist/es/components/grid/Grid.js +3 -3
  98. package/dist/es/components/image/Image.js +20 -16
  99. package/dist/es/components/image-preview/ImagePreview.js +63 -61
  100. package/dist/es/components/image-preview/tokens.js +21 -2
  101. package/dist/es/components/index-bar/IndexAnchor.js +7 -6
  102. package/dist/es/components/index-bar/IndexBar.js +39 -45
  103. package/dist/es/components/index-bar/tokens.js +22 -13
  104. package/dist/es/components/index.js +50 -1
  105. package/dist/es/components/input/Input.js +8 -11
  106. package/dist/es/components/notice-bar/NoticeBar.js +70 -96
  107. package/dist/es/components/notify/Notify.js +49 -25
  108. package/dist/es/components/notify/defaults.js +2 -2
  109. package/dist/es/components/notify/imperative.js +1 -1
  110. package/dist/es/components/notify/tokens.js +5 -4
  111. package/dist/es/components/number-keyboard/NumberKeyboard.js +13 -13
  112. package/dist/es/components/number-keyboard/tokens.js +4 -2
  113. package/dist/es/components/overlay/useOverlayStack.js +6 -2
  114. package/dist/es/components/pagination/Pagination.js +3 -3
  115. package/dist/es/components/password-input/PasswordInput.js +36 -28
  116. package/dist/es/components/picker/Picker.js +12 -13
  117. package/dist/es/components/picker/WheelPicker.js +10 -10
  118. package/dist/es/components/picker/tokens.js +4 -2
  119. package/dist/es/components/popup/Popup.js +41 -56
  120. package/dist/es/components/popup/tokens.js +2 -1
  121. package/dist/es/components/portal/Portal.js +5 -0
  122. package/dist/es/components/portal/PortalHost.js +1 -13
  123. package/dist/es/components/pull-refresh/PullRefresh.js +47 -28
  124. package/dist/es/components/radio/RadioGroup.js +3 -3
  125. package/dist/es/components/search/Search.js +53 -68
  126. package/dist/es/components/search/tokens.js +2 -1
  127. package/dist/es/components/selector/Selector.js +4 -4
  128. package/dist/es/components/share-sheet/ShareSheet.js +65 -63
  129. package/dist/es/components/share-sheet/tokens.js +15 -2
  130. package/dist/es/components/sidebar/Sidebar.js +14 -18
  131. package/dist/es/components/sidebar/SidebarItem.js +0 -3
  132. package/dist/es/components/skeleton/Skeleton.js +45 -57
  133. package/dist/es/components/slider/Slider.js +56 -62
  134. package/dist/es/components/stepper/Stepper.js +14 -17
  135. package/dist/es/components/stepper/tokens.js +4 -2
  136. package/dist/es/components/swiper/Swiper.js +22 -43
  137. package/dist/es/components/swiper/useSwiperWeb.js +16 -19
  138. package/dist/es/components/tabbar/Tabbar.js +9 -12
  139. package/dist/es/components/tabbar/TabbarItem.js +0 -3
  140. package/dist/es/components/tabs/Tabs.js +34 -55
  141. package/dist/es/components/tabs/tokens.js +9 -1
  142. package/dist/es/components/tabs/useTabsScroll.js +4 -0
  143. package/dist/es/components/toast/Toast.js +10 -8
  144. package/dist/es/components/toast/tokens.js +5 -1
  145. package/dist/es/components/typography/Typography.js +18 -31
  146. package/dist/es/components/uploader/Uploader.js +49 -46
  147. package/dist/es/components/uploader/tokens.js +27 -1
  148. package/dist/es/components/water-mark/WaterMark.js +17 -17
  149. package/dist/es/hooks/usePresenceAnimation.js +12 -2
  150. package/dist/types/components/dialog/tokens.d.ts +1 -0
  151. package/dist/types/components/dropdown-menu/tokens.d.ts +17 -0
  152. package/dist/types/components/field/index.d.ts +1 -1
  153. package/dist/types/components/image-preview/tokens.d.ts +16 -0
  154. package/dist/types/components/index-bar/tokens.d.ts +13 -4
  155. package/dist/types/components/index.d.ts +102 -0
  156. package/dist/types/components/notify/defaults.d.ts +2 -2
  157. package/dist/types/components/number-keyboard/tokens.d.ts +1 -0
  158. package/dist/types/components/password-input/PasswordInput.d.ts +4 -0
  159. package/dist/types/components/picker/tokens.d.ts +2 -0
  160. package/dist/types/components/popup/tokens.d.ts +1 -0
  161. package/dist/types/components/search/tokens.d.ts +1 -0
  162. package/dist/types/components/share-sheet/tokens.d.ts +13 -0
  163. package/dist/types/components/stepper/tokens.d.ts +2 -0
  164. package/dist/types/components/tabs/tokens.d.ts +8 -0
  165. package/dist/types/components/toast/tokens.d.ts +4 -0
  166. package/dist/types/components/uploader/tokens.d.ts +25 -0
  167. package/dist/types/hooks/usePresenceAnimation.d.ts +6 -1
  168. package/package.json +135 -135
@@ -9,13 +9,39 @@ const createTokens = foundations => {
9
9
  const {
10
10
  palette,
11
11
  spacing,
12
- radii
12
+ radii,
13
+ fontSize
13
14
  } = foundations;
14
15
  const onPrimary = palette.primary.foreground ?? '#ffffff';
15
16
  return {
16
17
  size: 80,
17
18
  gap: spacing.sm,
18
19
  radius: radii.md,
20
+ spacing: {
21
+ placeholderPaddingHorizontal: spacing.ssm,
22
+ placeholderNameMarginTop: spacing.ssm,
23
+ statusGap: spacing.xs,
24
+ uploadContentGap: spacing.xs,
25
+ deleteOffset: spacing.xs,
26
+ deletePaddingHorizontal: spacing.xs
27
+ },
28
+ sizing: {
29
+ deleteMinSize: spacing.xl
30
+ },
31
+ opacity: {
32
+ pressed: 0.85,
33
+ disabled: 0.65
34
+ },
35
+ radii: {
36
+ deleteButton: radii.lg
37
+ },
38
+ typography: {
39
+ placeholderIconSize: fontSize.xl,
40
+ placeholderNameSize: 11,
41
+ statusTextSize: fontSize.xs,
42
+ uploadIconSize: 24,
43
+ uploadTextSize: fontSize.xs
44
+ },
19
45
  colors: {
20
46
  background: palette.default[100],
21
47
  border: palette.default[200],
@@ -106,41 +106,41 @@ const WaterMark = props => {
106
106
  height: window.height
107
107
  });
108
108
  }, [fullPage, onLayoutCalculated, window.width, window.height]);
109
- const zIndexStyle = (0, _react().useMemo)(() => ({
109
+ const zIndexStyle = {
110
110
  zIndex
111
- }), [zIndex]);
112
- const cellStyle = (0, _react().useMemo)(() => ({
111
+ };
112
+ const cellStyle = {
113
113
  width: cellWidth,
114
114
  height: cellHeight
115
- }), [cellWidth, cellHeight]);
116
- const oddRowStyle = (0, _react().useMemo)(() => ({
115
+ };
116
+ const oddRowStyle = {
117
117
  paddingLeft: cellWidth / 2
118
- }), [cellWidth]);
119
- const markStyle = (0, _react().useMemo)(() => ({
118
+ };
119
+ const markStyle = {
120
120
  width: markWidth,
121
121
  height: markHeight,
122
122
  transform: [{
123
123
  rotate: `${resolvedRotate}deg`
124
124
  }]
125
- }), [markHeight, markWidth, resolvedRotate]);
126
- const imageStyle = (0, _react().useMemo)(() => ({
125
+ };
126
+ const imageStyle = {
127
127
  width: markWidth,
128
128
  height: markHeight,
129
129
  opacity: resolvedOpacity
130
- }), [markHeight, markWidth, resolvedOpacity]);
131
- const textBaseStyle = (0, _react().useMemo)(() => ({
130
+ };
131
+ const textBaseStyle = {
132
132
  fontSize: normalizedFontSize,
133
133
  color: resolvedColor,
134
134
  opacity: resolvedOpacity,
135
135
  fontFamily: font?.family,
136
136
  fontWeight: font?.weight
137
- }), [font?.family, font?.weight, normalizedFontSize, resolvedColor, resolvedOpacity]);
138
- const rowIndexes = (0, _react().useMemo)(() => Array.from({
137
+ };
138
+ const rowIndexes = Array.from({
139
139
  length: rows
140
- }, (_, i) => i), [rows]);
141
- const colIndexes = (0, _react().useMemo)(() => Array.from({
140
+ }, (_, i) => i);
141
+ const colIndexes = Array.from({
142
142
  length: cols
143
- }, (_, i) => i), [cols]);
143
+ }, (_, i) => i);
144
144
  return /*#__PURE__*/_react().default.createElement(_reactNative().View, _extends({
145
145
  pointerEvents: "none",
146
146
  style: [fullPage ? tokens.layout.absoluteFill : null, zIndexStyle, style],
@@ -22,7 +22,8 @@ var _platform = require("../platform");
22
22
  const usePresenceAnimation = (visible, {
23
23
  duration = 180,
24
24
  easing = _reactNative().Easing.out(_reactNative().Easing.cubic),
25
- appear = false
25
+ appear = false,
26
+ canAnimate = true
26
27
  } = {}) => {
27
28
  const [mounted, setMounted] = (0, _react().useState)(visible);
28
29
  const animated = (0, _react().useRef)(new (_reactNative().Animated.Value)(visible && !appear ? 1 : 0)).current;
@@ -34,6 +35,10 @@ const usePresenceAnimation = (visible, {
34
35
  animated.stopAnimation();
35
36
  if (visible) {
36
37
  setMounted(true);
38
+ if (!canAnimate) {
39
+ animated.setValue(0);
40
+ return;
41
+ }
37
42
  _reactNative().Animated.timing(animated, {
38
43
  toValue: 1,
39
44
  duration,
@@ -41,6 +46,11 @@ const usePresenceAnimation = (visible, {
41
46
  useNativeDriver
42
47
  }).start();
43
48
  } else {
49
+ if (!canAnimate) {
50
+ animated.setValue(0);
51
+ setMounted(false);
52
+ return;
53
+ }
44
54
  _reactNative().Animated.timing(animated, {
45
55
  toValue: 0,
46
56
  duration,
@@ -51,7 +61,7 @@ const usePresenceAnimation = (visible, {
51
61
  setMounted(false);
52
62
  });
53
63
  }
54
- }, [animated, duration, easing, useNativeDriver, visible]);
64
+ }, [animated, canAnimate, duration, easing, useNativeDriver, visible]);
55
65
  return {
56
66
  mounted,
57
67
  animated
@@ -1,5 +1,5 @@
1
1
  function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
2
- import React, { useCallback, useMemo } from 'react';
2
+ import React, { useCallback } from 'react';
3
3
  import Picker from '../picker';
4
4
  import { buildAreaColumns } from './utils';
5
5
  const normalizeCascadeValue = (root, raw, depth) => {
@@ -34,19 +34,13 @@ const Area = props => {
34
34
  city_list,
35
35
  county_list
36
36
  } = areaList;
37
- const columns = useMemo(() => buildAreaColumns({
37
+ const columns = buildAreaColumns({
38
38
  province_list,
39
39
  city_list,
40
40
  county_list
41
- }, resolvedColumnsNum), [province_list, city_list, county_list, resolvedColumnsNum]);
42
- const normalizedValue = useMemo(() => {
43
- if (value === undefined) return undefined;
44
- return normalizeCascadeValue(columns, value, resolvedColumnsNum);
45
- }, [columns, resolvedColumnsNum, value]);
46
- const normalizedDefaultValue = useMemo(() => {
47
- if (defaultValue === undefined) return undefined;
48
- return normalizeCascadeValue(columns, defaultValue, resolvedColumnsNum);
49
- }, [columns, defaultValue, resolvedColumnsNum]);
41
+ }, resolvedColumnsNum);
42
+ const normalizedValue = value === undefined ? undefined : normalizeCascadeValue(columns, value, resolvedColumnsNum);
43
+ const normalizedDefaultValue = defaultValue === undefined ? undefined : normalizeCascadeValue(columns, defaultValue, resolvedColumnsNum);
50
44
  const handleChange = useCallback((values, options) => {
51
45
  onChange?.(values.map(String), options);
52
46
  }, [onChange]);
@@ -4,9 +4,6 @@ import { Pressable, Text, View } from 'react-native';
4
4
  import Image from '../image';
5
5
  import { isNumber } from '../../utils';
6
6
  import { useAvatarTokens } from './tokens';
7
- const transparentContainerStyle = {
8
- backgroundColor: 'transparent'
9
- };
10
7
  export const Avatar = /*#__PURE__*/React.forwardRef((props, ref) => {
11
8
  const {
12
9
  src,
@@ -33,6 +30,9 @@ export const Avatar = /*#__PURE__*/React.forwardRef((props, ref) => {
33
30
  const avatarWidth = width ?? baseSize;
34
31
  const avatarHeight = height ?? baseSize;
35
32
  const borderRadius = resolvedShape === 'circle' ? Math.min(avatarWidth, avatarHeight) / 2 : Math.max(tokens.radii.squareMin, Math.min(avatarWidth, avatarHeight) / tokens.radii.squareDivisor);
33
+ const transparentContainerStyle = {
34
+ backgroundColor: tokens.colors.transparent
35
+ };
36
36
  const fallbackText = text ? text.trim().slice(0, 2).toUpperCase() : undefined;
37
37
  const fallbackContent = icon ? /*#__PURE__*/React.createElement(View, {
38
38
  style: [tokens.layout.iconWrapper, {
@@ -25,7 +25,8 @@ export const createAvatarTokens = foundations => ({
25
25
  },
26
26
  colors: {
27
27
  background: foundations.palette.default[100],
28
- text: foundations.palette.default[800]
28
+ text: foundations.palette.default[800],
29
+ transparent: "transparent"
29
30
  },
30
31
  typography: {
31
32
  fontWeight: "600",
@@ -1,5 +1,5 @@
1
1
  function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
2
- import React, { useCallback, useMemo, useState } from 'react';
2
+ import React, { useCallback, useState } from 'react';
3
3
  import { Pressable, Text, View } from 'react-native';
4
4
  import { isNumericLike, isRenderable } from '../../utils';
5
5
  import { useBadgeTokens } from './tokens';
@@ -27,7 +27,7 @@ export const Badge = /*#__PURE__*/React.forwardRef((props, ref) => {
27
27
  const {
28
28
  visible,
29
29
  formattedContent
30
- } = useMemo(() => {
30
+ } = (() => {
31
31
  const numericContent = isNumericLike(content) ? Number(content) : null;
32
32
  const shouldHide = numericContent === 0 && !resolvedShowZero;
33
33
  const isVisible = dot || isRenderable(content) && !shouldHide;
@@ -41,7 +41,7 @@ export const Badge = /*#__PURE__*/React.forwardRef((props, ref) => {
41
41
  visible: true,
42
42
  formattedContent: finalContent
43
43
  };
44
- }, [content, dot, max, resolvedShowZero]);
44
+ })();
45
45
  const [size, setSize] = useState({
46
46
  width: 0,
47
47
  height: 0
@@ -58,7 +58,7 @@ export const Badge = /*#__PURE__*/React.forwardRef((props, ref) => {
58
58
  });
59
59
  }
60
60
  }, [size.width, size.height]);
61
- const transformStyle = useMemo(() => {
61
+ const transformStyle = (() => {
62
62
  if (!hasChildren) return undefined;
63
63
  if (dot) {
64
64
  const half = tokens.sizing.dotSize / 2;
@@ -80,35 +80,30 @@ export const Badge = /*#__PURE__*/React.forwardRef((props, ref) => {
80
80
  translateY: -size.height / 2
81
81
  }]
82
82
  };
83
- }, [hasChildren, dot, tokens.sizing.dotSize, size.width, size.height]);
84
- const baseBadgeStyle = useMemo(() => {
85
- if (dot) {
86
- return {
87
- width: tokens.sizing.dotSize,
88
- height: tokens.sizing.dotSize,
89
- borderRadius: tokens.radii.dot,
90
- backgroundColor: color ?? tokens.colors.dot
91
- };
92
- }
93
- return {
94
- minWidth: tokens.sizing.minWidth,
95
- minHeight: tokens.sizing.height,
96
- paddingHorizontal: tokens.sizing.paddingHorizontal,
97
- paddingVertical: tokens.sizing.paddingVertical,
98
- borderRadius: tokens.radii.badge,
99
- borderWidth: tokens.borders.width,
100
- borderColor: tokens.colors.border,
101
- backgroundColor: color ?? tokens.colors.background
102
- };
103
- }, [dot, color, tokens]);
104
- const mergedTextStyle = useMemo(() => [tokens.layout.text, {
83
+ })();
84
+ const baseBadgeStyle = dot ? {
85
+ width: tokens.sizing.dotSize,
86
+ height: tokens.sizing.dotSize,
87
+ borderRadius: tokens.radii.dot,
88
+ backgroundColor: color ?? tokens.colors.dot
89
+ } : {
90
+ minWidth: tokens.sizing.minWidth,
91
+ minHeight: tokens.sizing.height,
92
+ paddingHorizontal: tokens.sizing.paddingHorizontal,
93
+ paddingVertical: tokens.sizing.paddingVertical,
94
+ borderRadius: tokens.radii.badge,
95
+ borderWidth: tokens.borders.width,
96
+ borderColor: tokens.colors.border,
97
+ backgroundColor: color ?? tokens.colors.background
98
+ };
99
+ const mergedTextStyle = [tokens.layout.text, {
105
100
  color: textColor ?? tokens.colors.text,
106
101
  fontSize: tokens.typography.fontSize,
107
102
  lineHeight: tokens.typography.lineHeight,
108
103
  fontFamily: tokens.typography.fontFamily,
109
104
  fontWeight: tokens.typography.fontWeight
110
- }, userTextStyle], [textColor, tokens, userTextStyle]);
111
- const offsetStyle = useMemo(() => {
105
+ }, userTextStyle];
106
+ const offsetStyle = (() => {
112
107
  if (!offset) return undefined;
113
108
  const [x, y] = offset;
114
109
  return hasChildren ? {
@@ -118,17 +113,14 @@ export const Badge = /*#__PURE__*/React.forwardRef((props, ref) => {
118
113
  marginLeft: x,
119
114
  marginTop: y
120
115
  };
121
- }, [offset, hasChildren]);
122
- const badgeElement = useMemo(() => {
123
- if (!visible) return null;
124
- return /*#__PURE__*/React.createElement(View, {
125
- pointerEvents: hasChildren ? 'none' : 'auto',
126
- onLayout: hasChildren && !dot ? handleLayout : undefined,
127
- style: [hasChildren ? tokens.layout.badgeAbsolute : tokens.layout.badgeStandalone, baseBadgeStyle, transformStyle, offsetStyle, badgeStyle, !hasChildren ? style : undefined]
128
- }, !dot && (/*#__PURE__*/React.isValidElement(formattedContent) ? formattedContent : /*#__PURE__*/React.createElement(Text, {
129
- style: mergedTextStyle
130
- }, formattedContent)));
131
- }, [visible, hasChildren, dot, handleLayout, baseBadgeStyle, transformStyle, offsetStyle, badgeStyle, style, formattedContent, mergedTextStyle]);
116
+ })();
117
+ const badgeElement = !visible ? null : /*#__PURE__*/React.createElement(View, {
118
+ pointerEvents: hasChildren ? 'none' : 'auto',
119
+ onLayout: hasChildren && !dot ? handleLayout : undefined,
120
+ style: [hasChildren ? tokens.layout.badgeAbsolute : tokens.layout.badgeStandalone, baseBadgeStyle, transformStyle, offsetStyle, badgeStyle, !hasChildren ? style : undefined]
121
+ }, !dot && (/*#__PURE__*/React.isValidElement(formattedContent) ? formattedContent : /*#__PURE__*/React.createElement(Text, {
122
+ style: mergedTextStyle
123
+ }, formattedContent)));
132
124
  if (hasChildren) {
133
125
  return onPress ? /*#__PURE__*/React.createElement(Pressable, _extends({
134
126
  ref: ref,
@@ -1,5 +1,5 @@
1
1
  function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
2
- import React, { useContext, useMemo } from 'react';
2
+ import React, { useContext } from 'react';
3
3
  import { ActivityIndicator, Platform, Pressable, Text, View } from 'react-native';
4
4
  import { withAlpha, extractFirstColorToken } from '../../utils/color';
5
5
  import { createPlatformShadow } from '../../utils/createPlatformShadow';
@@ -148,14 +148,14 @@ export const Button = /*#__PURE__*/React.forwardRef((props, forwardedRef) => {
148
148
  const gradientWebStyle = gradientFillEnabled && supportsGradientFill && gradientString ? {
149
149
  backgroundImage: gradientString
150
150
  } : undefined;
151
- const iconWrapperStyle = useMemo(() => iconPosition === 'left' ? {
151
+ const iconWrapperStyle = iconPosition === 'left' ? {
152
152
  marginRight: buttonTokens.spacing.iconGap
153
153
  } : {
154
154
  marginLeft: buttonTokens.spacing.iconGap
155
- }, [buttonTokens.spacing.iconGap, iconPosition]);
156
- const loadingIconWrapperStyle = useMemo(() => ({
155
+ };
156
+ const loadingIconWrapperStyle = {
157
157
  marginRight: buttonTokens.spacing.iconGap
158
- }), [buttonTokens.spacing.iconGap]);
158
+ };
159
159
  const renderIcon = () => {
160
160
  if (!icon) return null;
161
161
  try {
@@ -185,14 +185,14 @@ export const Button = /*#__PURE__*/React.forwardRef((props, forwardedRef) => {
185
185
  }, loadingIndicator ?? defaultIndicator);
186
186
  };
187
187
  const label = loading && loadingText !== undefined ? loadingText : text !== undefined ? text : children;
188
- const sharedLabelTextStyle = useMemo(() => ({
188
+ const sharedLabelTextStyle = {
189
189
  fontFamily: buttonTokens.typography.fontFamily,
190
190
  fontWeight: buttonTokens.typography.fontWeight,
191
191
  fontSize: sizeTokens.fontSize,
192
192
  lineHeight: sizeTokens.fontSize * buttonTokens.typography.lineHeightMultiplier,
193
193
  color: resolvedTextColor,
194
194
  textTransform: uppercase ? 'uppercase' : undefined
195
- }), [buttonTokens.typography.fontFamily, buttonTokens.typography.fontWeight, buttonTokens.typography.lineHeightMultiplier, resolvedTextColor, sizeTokens.fontSize, uppercase]);
195
+ };
196
196
  const renderText = () => {
197
197
  if (label === undefined || label === null) {
198
198
  return null;
@@ -234,7 +234,7 @@ export const Button = /*#__PURE__*/React.forwardRef((props, forwardedRef) => {
234
234
  onPressEnd: onPressOut || undefined
235
235
  });
236
236
  const resolvedOpacity = disabled ? buttonTokens.states.disabledOpacity : loading ? buttonTokens.states.loadingOpacity : states.pressed ? buttonTokens.states.pressedOpacity : 1;
237
- const containerStyle = useMemo(() => ({
237
+ const containerStyle = {
238
238
  minHeight: sizeTokens.height,
239
239
  paddingHorizontal: sizeTokens.paddingHorizontal,
240
240
  borderRadius,
@@ -242,21 +242,21 @@ export const Button = /*#__PURE__*/React.forwardRef((props, forwardedRef) => {
242
242
  borderColor,
243
243
  borderWidth: resolvedBorderWidth,
244
244
  opacity: resolvedOpacity
245
- }), [backgroundColor, borderColor, borderRadius, resolvedBorderWidth, resolvedOpacity, sizeTokens.height, sizeTokens.paddingHorizontal]);
246
- const rippleClipStyle = useMemo(() => Platform.OS === 'android' && borderRadius > 0 && !shouldShowShadow ? {
245
+ };
246
+ const rippleClipStyle = Platform.OS === 'android' && borderRadius > 0 && !shouldShowShadow ? {
247
247
  overflow: 'hidden'
248
- } : null, [borderRadius, shouldShowShadow]);
249
- const baseContainerStyle = useMemo(() => [buttonTokens.layout.base, containerStyle, rippleClipStyle, block ? buttonTokens.layout.block : null, shadowStyle, gradientWebStyle, style], [block, buttonTokens.layout.base, buttonTokens.layout.block, containerStyle, gradientWebStyle, rippleClipStyle, shadowStyle, style]);
248
+ } : null;
249
+ const baseContainerStyle = [buttonTokens.layout.base, containerStyle, rippleClipStyle, block ? buttonTokens.layout.block : null, shadowStyle, gradientWebStyle, style];
250
250
  const mergedAccessibilityState = {
251
251
  ...accessibilityState,
252
252
  disabled: isDisabled,
253
253
  busy: loading
254
254
  };
255
255
  const defaultRippleColor = rippleColorProp ?? (derivedMode === 'text' || derivedMode === 'outlined' || legacyPlain ? resolvedTextColor : type === 'default' && !normalizedColor ? withAlpha(resolvedTextColor, 0.15) : buttonTokens.colors.ripple);
256
- const resolvedAndroidRipple = useMemo(() => Platform.OS === 'android' ? androidRippleProp ?? {
256
+ const resolvedAndroidRipple = Platform.OS === 'android' ? androidRippleProp ?? {
257
257
  color: defaultRippleColor,
258
258
  borderless: false
259
- } : androidRippleProp, [androidRippleProp, defaultRippleColor]);
259
+ } : androidRippleProp;
260
260
  return /*#__PURE__*/React.createElement(Pressable, _extends({
261
261
  ref: forwardedRef,
262
262
  disabled: isDisabled,
@@ -1,4 +1,4 @@
1
- import React, { useMemo } from 'react';
1
+ import React from 'react';
2
2
  import { Platform, View } from 'react-native';
3
3
  import { ButtonGroupContext } from './ButtonContext';
4
4
  import { useButtonTokens } from './tokens';
@@ -23,7 +23,7 @@ export const ButtonGroup = /*#__PURE__*/React.memo(({
23
23
  const gap = spacing ?? tokens.spacing.groupGap;
24
24
  const isHorizontal = direction === 'horizontal';
25
25
  const supportsGap = Platform.OS === 'web';
26
- const groupValue = useMemo(() => ({
26
+ const groupValue = {
27
27
  type,
28
28
  size,
29
29
  plain,
@@ -35,8 +35,8 @@ export const ButtonGroup = /*#__PURE__*/React.memo(({
35
35
  iconPosition,
36
36
  hairline,
37
37
  mode
38
- }), [type, size, plain, block, round, square, shadow, disabled, iconPosition, hairline, mode]);
39
- const containerStyle = useMemo(() => {
38
+ };
39
+ const containerStyle = (() => {
40
40
  const base = {
41
41
  flexDirection: isHorizontal ? 'row' : 'column',
42
42
  alignItems: 'center'
@@ -52,8 +52,8 @@ export const ButtonGroup = /*#__PURE__*/React.memo(({
52
52
  }
53
53
  }
54
54
  return [base, style];
55
- }, [isHorizontal, block, supportsGap, gap, style]);
56
- const content = useMemo(() => {
55
+ })();
56
+ const content = (() => {
57
57
  if (supportsGap) {
58
58
  return children;
59
59
  }
@@ -72,7 +72,7 @@ export const ButtonGroup = /*#__PURE__*/React.memo(({
72
72
  key: element.key ?? index
73
73
  });
74
74
  });
75
- }, [children, supportsGap, isHorizontal, gap]);
75
+ })();
76
76
  return /*#__PURE__*/React.createElement(ButtonGroupContext.Provider, {
77
77
  value: groupValue
78
78
  }, /*#__PURE__*/React.createElement(View, {
@@ -1,5 +1,5 @@
1
1
  function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
2
- import React, { useCallback, useEffect, useMemo, useState } from 'react';
2
+ import React, { useCallback, useEffect, useState } from 'react';
3
3
  import { Pressable, Text, View } from 'react-native';
4
4
  import { useControllableValue } from '../../hooks';
5
5
  import { isText } from '../../utils/validate';
@@ -115,7 +115,7 @@ const Calendar = props => {
115
115
  defaultValuePropName: 'defaultValue',
116
116
  trigger: 'onSelect'
117
117
  });
118
- const value = useMemo(() => normalizeValue(toArrayValue(selectedValue), type), [selectedValue, type]);
118
+ const value = normalizeValue(toArrayValue(selectedValue), type);
119
119
  const [currentMonth, setCurrentMonth] = useState(() => {
120
120
  const initial = value.length ? value[0] : new Date();
121
121
  return clampMonth(initial, minDate, maxDate);
@@ -130,13 +130,13 @@ const Calendar = props => {
130
130
  const first = clampMonth(value[0], minDate, maxDate);
131
131
  setCurrentMonth(prev => isSameMonth(first, prev) ? prev : first);
132
132
  }, [firstValueTime, minDateTime, maxDateTime]);
133
- const monthDays = useMemo(() => buildMonth(currentMonth, weekStartsOn), [currentMonth, weekStartsOn]);
134
- const minDay = useMemo(() => startOfDay(minDate).getTime(), [minDate]);
135
- const maxDay = useMemo(() => startOfDay(maxDate).getTime(), [maxDate]);
136
- const weekLabels = useMemo(() => reorderWeekdays(weekdays ?? tokens.defaults.weekdays, weekStartsOn, tokens.defaults.weekdays), [tokens.defaults.weekdays, weekdays, weekStartsOn]);
137
- const monthLabel = useMemo(() => formatMonthTitle ? formatMonthTitle(currentMonth) : formatMonth(currentMonth), [formatMonthTitle, currentMonth]);
138
- const minMonthStart = useMemo(() => startOfMonth(minDate), [minDate]);
139
- const maxMonthStart = useMemo(() => startOfMonth(maxDate), [maxDate]);
133
+ const monthDays = buildMonth(currentMonth, weekStartsOn);
134
+ const minDay = startOfDay(minDate).getTime();
135
+ const maxDay = startOfDay(maxDate).getTime();
136
+ const weekLabels = reorderWeekdays(weekdays ?? tokens.defaults.weekdays, weekStartsOn, tokens.defaults.weekdays);
137
+ const monthLabel = formatMonthTitle ? formatMonthTitle(currentMonth) : formatMonth(currentMonth);
138
+ const minMonthStart = startOfMonth(minDate);
139
+ const maxMonthStart = startOfMonth(maxDate);
140
140
  const canGoPrev = currentMonth.getTime() > minMonthStart.getTime();
141
141
  const canGoNext = currentMonth.getTime() < maxMonthStart.getTime();
142
142
  const goToMonth = useCallback(delta => {
@@ -225,8 +225,8 @@ const Calendar = props => {
225
225
  maybeAutoConfirm(normalizedNext);
226
226
  }
227
227
  }, [value, type, minDay, maxDay, allowSameDay, isSelectionAllowed, setSelectedValue, showConfirm, maybeAutoConfirm]);
228
- const valueTimes = useMemo(() => value.map(item => startOfDay(item).getTime()), [value]);
229
- const selectedSet = useMemo(() => new Set(valueTimes), [valueTimes]);
228
+ const valueTimes = value.map(item => startOfDay(item).getTime());
229
+ const selectedSet = new Set(valueTimes);
230
230
  const rangeBounds = type === 'range' && valueTimes.length === 2 ? [valueTimes[0], valueTimes[1]] : null;
231
231
  const renderDay = useCallback((day, index) => {
232
232
  if (!day) {
@@ -1,5 +1,5 @@
1
1
  function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
2
- import React, { useCallback, useEffect, useMemo, useState } from "react";
2
+ import React, { useCallback, useEffect, useState } from "react";
3
3
  import { FlatList, Pressable, Text, View, useWindowDimensions } from "react-native";
4
4
  import { Checked, Cross } from "react-native-system-icon";
5
5
  import { useControllableValue } from "../../hooks";
@@ -71,7 +71,7 @@ const Cascader = props => {
71
71
  defaultValue: [],
72
72
  trigger: "onChange"
73
73
  });
74
- const keys = useMemo(() => getFieldKeys(fieldNames), [fieldNames]);
74
+ const keys = getFieldKeys(fieldNames);
75
75
  const cascaderValue = Array.isArray(value) ? value : [];
76
76
  const [panelValue, setPanelValue] = useState(cascaderValue);
77
77
  const resolvedCloseable = closeable ?? tokens.defaults.closeable;
@@ -96,7 +96,7 @@ const Cascader = props => {
96
96
  if (!width) return;
97
97
  setMeasuredWidth(prev => prev === width ? prev : width);
98
98
  }, []);
99
- const confirmedRows = useMemo(() => resolveSelectedRows(options, keys, cascaderValue), [cascaderValue, keys, options]);
99
+ const confirmedRows = resolveSelectedRows(options, keys, cascaderValue);
100
100
  const [activeTab, setActiveTab] = useState(0);
101
101
  useEffect(() => {
102
102
  const currentLength = Array.isArray(currentValue) ? currentValue.length : 0;
@@ -310,11 +310,11 @@ const Cascader = props => {
310
310
  } = popupPropsOverrides ?? {};
311
311
  const resolvedOverlay = popupOverlay ?? true;
312
312
  const resolvedCloseOnOverlayPress = overrideCloseOnOverlayPress ?? closeOnClickOverlay;
313
- const cascaderActions = useMemo(() => ({
313
+ const cascaderActions = {
314
314
  open: openPopup,
315
315
  close: () => closePopup(true),
316
316
  toggle: togglePopup
317
- }), [closePopup, openPopup, togglePopup]);
317
+ };
318
318
  const enhanceTriggerNode = useCallback(node => {
319
319
  if (! /*#__PURE__*/React.isValidElement(node)) return node;
320
320
  const props = node.props;
@@ -1,6 +1,5 @@
1
- import { useMemo } from 'react';
2
1
  export const useCascaderExtend = (options = [], keys, value) => {
3
- const depth = useMemo(() => {
2
+ const depth = (() => {
4
3
  let maxDepth = 1;
5
4
  const traverse = (opts, level) => {
6
5
  if (!opts || !opts.length) return;
@@ -15,8 +14,8 @@ export const useCascaderExtend = (options = [], keys, value) => {
15
14
  };
16
15
  traverse(options, 1);
17
16
  return maxDepth;
18
- }, [keys.childrenKey, options]);
19
- const tabs = useMemo(() => {
17
+ })();
18
+ const tabs = (() => {
20
19
  if (!value || !value.length) return [options];
21
20
  return value.reduce((acc, val, index) => {
22
21
  if (val == null) return acc;
@@ -27,11 +26,8 @@ export const useCascaderExtend = (options = [], keys, value) => {
27
26
  if (children) acc.push(children);
28
27
  return acc;
29
28
  }, [options]);
30
- }, [keys.childrenKey, keys.valueKey, options, value]);
31
- const items = useMemo(() => {
32
- if (!value || !value.length) return [];
33
- return value.map((val, index) => tabs[index]?.find(option => option[keys.valueKey] === val));
34
- }, [keys.valueKey, tabs, value]);
29
+ })();
30
+ const items = !value || !value.length ? [] : value.map((val, index) => tabs[index]?.find(option => option[keys.valueKey] === val));
35
31
  return {
36
32
  tabs,
37
33
  items,
@@ -1,5 +1,5 @@
1
1
  function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
2
- import React, { useCallback, useImperativeHandle, useMemo, useRef } from 'react';
2
+ import React, { useCallback, useImperativeHandle, useRef } from 'react';
3
3
  import { Platform, View } from 'react-native';
4
4
  import { useCheckboxGroup } from '@react-native-aria/checkbox';
5
5
  import { useCheckboxGroupState } from '@react-stately/checkbox';
@@ -105,7 +105,7 @@ export const CheckboxGroup = /*#__PURE__*/React.forwardRef((props, ref) => {
105
105
  useImperativeHandle(ref, () => ({
106
106
  toggleAll
107
107
  }), [toggleAll]);
108
- const contextValue = useMemo(() => ({
108
+ const contextValue = {
109
109
  state,
110
110
  direction,
111
111
  shape,
@@ -116,7 +116,7 @@ export const CheckboxGroup = /*#__PURE__*/React.forwardRef((props, ref) => {
116
116
  max,
117
117
  registerValue,
118
118
  unregisterValue
119
- }), [state, direction, shape, iconSize, iconRender, checkedColor, labelDisabled, max]);
119
+ };
120
120
  return /*#__PURE__*/React.createElement(CheckboxGroupContext.Provider, {
121
121
  value: contextValue
122
122
  }, /*#__PURE__*/React.createElement(View, _extends({}, resolvedGroupProps, viewProps, {
@@ -1,4 +1,4 @@
1
- import React, { useEffect, useMemo, useRef } from 'react';
1
+ import React, { useEffect, useRef } from 'react';
2
2
  import { Animated, Platform, Text, View } from 'react-native';
3
3
  import Svg, { Circle as SvgCircle } from 'react-native-svg';
4
4
  import { isText, clamp, parseNumber, parsePercentage } from '../../utils';
@@ -65,7 +65,7 @@ export const Circle = props => {
65
65
  width: resolvedSize,
66
66
  height: resolvedSize
67
67
  }];
68
- const content = useMemo(() => {
68
+ const content = (() => {
69
69
  if (children == null || children === false) return null;
70
70
  const childArray = React.Children.toArray(children);
71
71
  if (childArray.every(isText)) {
@@ -78,7 +78,7 @@ export const Circle = props => {
78
78
  }, childArray.map(String).join(''));
79
79
  }
80
80
  return children;
81
- }, [children, textStyle, tokens.colors.text, tokens.layout.text, tokens.typography.fontSize, tokens.typography.lineHeight]);
81
+ })();
82
82
  if (Platform.OS === 'web') {
83
83
  const safeStroke = Math.min(resolvedStrokeWidth, resolvedSize / 2);
84
84
  const innerSize = Math.max(0, resolvedSize - safeStroke * 2);