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
@@ -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, useRef, useState } from 'react';
2
+ import React, { useCallback, useEffect, useRef, useState } from 'react';
3
3
  import { Animated, Easing, Pressable, StyleSheet, Text, View } from 'react-native';
4
4
  import { useControllableValue } from '../../hooks';
5
5
  import { nativeDriverEnabled } from '../../platform';
@@ -67,11 +67,11 @@ const NumberKeyboard = /*#__PURE__*/React.memo(props => {
67
67
  trigger: 'onChange'
68
68
  });
69
69
  const value = mergedValue ?? '';
70
- const maxlength = useMemo(() => {
70
+ const maxlength = (() => {
71
71
  const parsed = parseNumberLike(maxlengthProp, undefined);
72
72
  if (parsed === undefined || !Number.isFinite(parsed) || parsed < 0) return undefined;
73
73
  return Math.floor(parsed);
74
- }, [maxlengthProp]);
74
+ })();
75
75
  const valueRef = useRef(value);
76
76
  const maxlengthRef = useRef(maxlength);
77
77
  valueRef.current = value;
@@ -109,7 +109,7 @@ const NumberKeyboard = /*#__PURE__*/React.memo(props => {
109
109
  keyboardRegistry.delete(closeSelf);
110
110
  };
111
111
  }, [visible, closeSelf]);
112
- const keys = useMemo(() => {
112
+ const keys = (() => {
113
113
  const shouldShuffle = randomKeyOrder && visible;
114
114
  const numbers = shouldShuffle ? shuffle(NUMBER_KEYS) : NUMBER_KEYS;
115
115
  const main = numbers.map(text => ({
@@ -160,7 +160,7 @@ const NumberKeyboard = /*#__PURE__*/React.memo(props => {
160
160
  text: showDeleteKey ? undefined : ''
161
161
  });
162
162
  return main;
163
- }, [extraKey, isCustomTheme, randomKeyOrder, showDeleteKey, visible]);
163
+ })();
164
164
  const handleInput = useCallback((text, type) => {
165
165
  if (type === 'delete') {
166
166
  const currentValue = valueRef.current;
@@ -180,13 +180,13 @@ const NumberKeyboard = /*#__PURE__*/React.memo(props => {
180
180
  onInput?.(text);
181
181
  setMergedValue(`${currentValue}${text}`);
182
182
  }, [closeSelf, onDelete, onInput, setMergedValue]);
183
- const wrapperShadow = useMemo(() => createPlatformShadow({
183
+ const wrapperShadow = createPlatformShadow({
184
184
  color: shadow.color,
185
185
  opacity: shadow.opacity,
186
186
  radius: shadow.radius,
187
187
  offsetY: shadow.offsetY,
188
188
  elevation: shadow.elevation
189
- }), [shadow.color, shadow.opacity, shadow.radius, shadow.offsetY, shadow.elevation]);
189
+ });
190
190
  const keyGap = spacing.keyGap;
191
191
  const renderKey = useCallback((key, index, isClose = false, fullWidth = false, customHeight) => {
192
192
  const isPlaceholder = key.type === '' && !key.text;
@@ -281,10 +281,10 @@ const NumberKeyboard = /*#__PURE__*/React.memo(props => {
281
281
  animationRef.current = null;
282
282
  };
283
283
  }, [animated, visible, effectiveDuration]);
284
- const translateY = useMemo(() => animated.interpolate({
284
+ const translateY = animated.interpolate({
285
285
  inputRange: [0, 1],
286
286
  outputRange: [contentHeight || 320, 0]
287
- }), [animated, contentHeight]);
287
+ });
288
288
  const handleLayout = useCallback(e => {
289
289
  const {
290
290
  height
@@ -293,7 +293,7 @@ const NumberKeyboard = /*#__PURE__*/React.memo(props => {
293
293
  }, []);
294
294
  const hasHeader = !isCustomTheme && (title || closeButtonText);
295
295
  const doubleKeyHeight = sizing.keyHeight * 2 + keyGap;
296
- const memo = useMemo(() => {
296
+ const memo = (() => {
297
297
  const headerPaddingStyle = {
298
298
  paddingHorizontal: spacing.titlePadding
299
299
  };
@@ -374,7 +374,8 @@ const NumberKeyboard = /*#__PURE__*/React.memo(props => {
374
374
  style: [styles.header, headerPaddingStyle]
375
375
  }, /*#__PURE__*/React.createElement(Text, {
376
376
  style: [styles.title, styles.titleOverlay, {
377
- color: colors.title
377
+ color: colors.title,
378
+ fontSize: sizing.titleFontSize
378
379
  }],
379
380
  numberOfLines: 1
380
381
  }, title), resolvedCloseText ? /*#__PURE__*/React.createElement(Pressable, {
@@ -400,7 +401,7 @@ const NumberKeyboard = /*#__PURE__*/React.memo(props => {
400
401
  bodyNode,
401
402
  safeAreaNode
402
403
  };
403
- }, [colors.title, doubleKeyHeight, hasHeader, isCustomTheme, keyGap, keys, renderKey, resolvedCloseText, safeAreaInsetBottom, showDeleteKey, closeSelf, spacing.paddingHorizontal, spacing.titlePadding, title]);
404
+ })();
404
405
  if (!shouldRender && !visible) {
405
406
  return null;
406
407
  }
@@ -430,7 +431,6 @@ const styles = StyleSheet.create({
430
431
  position: 'relative'
431
432
  },
432
433
  title: {
433
- fontSize: 16,
434
434
  fontWeight: '600'
435
435
  },
436
436
  titleOverlay: {
@@ -3,7 +3,8 @@ const createTokens = foundations => {
3
3
  const {
4
4
  palette,
5
5
  spacing,
6
- radii
6
+ radii,
7
+ fontSize
7
8
  } = foundations;
8
9
  const onPrimary = palette.primary.foreground ?? '#ffffff';
9
10
  return {
@@ -28,7 +29,8 @@ const createTokens = foundations => {
28
29
  sizing: {
29
30
  keyHeight: 54,
30
31
  closeHeight: 44,
31
- fontSize: 28
32
+ fontSize: 28,
33
+ titleFontSize: fontSize.md
32
34
  },
33
35
  radii: {
34
36
  key: radii.xs
@@ -1,4 +1,4 @@
1
- import { useEffect, useMemo, useRef, useSyncExternalStore } from 'react';
1
+ import { useEffect, useRef, useSyncExternalStore } from 'react';
2
2
  import { overlayStackStore } from './OverlayStackStore';
3
3
  const useOverlayEntries = () => useSyncExternalStore(overlayStackStore.subscribe, overlayStackStore.getSnapshot, overlayStackStore.getSnapshot);
4
4
  export const useOverlayStack = ({
@@ -7,7 +7,11 @@ export const useOverlayStack = ({
7
7
  }) => {
8
8
  const entries = useOverlayEntries();
9
9
  const entryRef = useRef(null);
10
- const stableOptions = useMemo(() => options, [options.onClose, options.closeOnBack, options.lockScroll, options.zIndex, options.type, options.meta]);
10
+ const optionsRef = useRef(options);
11
+ if (optionsRef.current.onClose !== options.onClose || optionsRef.current.closeOnBack !== options.closeOnBack || optionsRef.current.lockScroll !== options.lockScroll || optionsRef.current.zIndex !== options.zIndex || optionsRef.current.type !== options.type || optionsRef.current.meta !== options.meta) {
12
+ optionsRef.current = options;
13
+ }
14
+ const stableOptions = optionsRef.current;
11
15
  useEffect(() => {
12
16
  if (!visible) {
13
17
  if (entryRef.current) {
@@ -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, { useEffect, useMemo } from 'react';
2
+ import React, { useEffect } from 'react';
3
3
  import { Pressable, Text, View } from 'react-native';
4
4
  import { usePaginationTokens } from './tokens';
5
5
  import { useControllableValue } from '../../hooks';
@@ -39,7 +39,7 @@ const Pagination = /*#__PURE__*/React.forwardRef((props, ref) => {
39
39
  const showPageSizeNumber = Number.isFinite(showPageSize) ? Math.floor(showPageSize) : 0;
40
40
  const count = pageCountNumber > 0 ? pageCountNumber : totalItemsNumber > 0 && itemsPerPageNumber > 0 ? Math.max(1, Math.ceil(totalItemsNumber / itemsPerPageNumber)) : 1;
41
41
  const currentPage = clamp(page, 1, count);
42
- const pages = useMemo(() => {
42
+ const pages = (() => {
43
43
  const items = [];
44
44
  if (mode !== 'multi') return items;
45
45
  const limit = Math.max(1, showPageSizeNumber);
@@ -72,7 +72,7 @@ const Pagination = /*#__PURE__*/React.forwardRef((props, ref) => {
72
72
  });
73
73
  }
74
74
  return items;
75
- }, [mode, count, showPageSizeNumber, currentPage, forceEllipses]);
75
+ })();
76
76
  useEffect(() => {
77
77
  if (page !== currentPage) {
78
78
  setPage(currentPage);
@@ -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, useImperativeHandle, useMemo, useRef, useState } from 'react';
2
+ import React, { useCallback, useEffect, useImperativeHandle, useRef, useState } from 'react';
3
3
  import { Pressable, StyleSheet, Text, TextInput, View } from 'react-native';
4
4
  import { createComponentTokensHook } from '../../design-system';
5
5
  import { useControllableValue } from '../../hooks';
@@ -7,7 +7,6 @@ import { parseNumberLike } from '../../utils/number';
7
7
  import { isString, isText } from '../../utils/validate';
8
8
  const HIDDEN_INPUT_PROPS = {
9
9
  caretHidden: true,
10
- underlineColorAndroid: 'transparent',
11
10
  autoCorrect: false,
12
11
  spellCheck: false,
13
12
  importantForAutofill: 'no',
@@ -21,10 +20,12 @@ const createPasswordInputTokens = foundations => ({
21
20
  muted: foundations.palette.default[500],
22
21
  error: foundations.palette.danger[500],
23
22
  cursor: foundations.palette.default[800],
24
- background: '#ffffff'
23
+ background: '#ffffff',
24
+ transparent: 'transparent'
25
25
  },
26
26
  radii: {
27
- wrapper: foundations.radii.sm
27
+ wrapper: foundations.radii.sm,
28
+ cellGutter: foundations.radii.none
28
29
  },
29
30
  sizing: {
30
31
  cellHeight: 50,
@@ -42,10 +43,12 @@ const createPasswordInputTokens = foundations => ({
42
43
  infoWeight: foundations.typography.weight.regular
43
44
  },
44
45
  opacity: {
45
- disabled: 0.6
46
+ disabled: 0.6,
47
+ hidden: 0
46
48
  },
47
49
  spacing: {
48
- infoMarginTop: foundations.spacing.sm
50
+ infoMarginTop: foundations.spacing.sm,
51
+ none: foundations.spacing.none
49
52
  }
50
53
  });
51
54
  const usePasswordInputTokens = createComponentTokensHook('passwordInput', createPasswordInputTokens);
@@ -91,8 +94,8 @@ const PasswordInput = /*#__PURE__*/React.forwardRef((props, ref) => {
91
94
  const [cursorVisible, setCursorVisible] = useState(true);
92
95
  const blinkTimer = useRef(null);
93
96
  const [focused, setFocused] = useState(autoFocus);
94
- const keyboardType = useMemo(() => type === 'number' ? 'number-pad' : 'default', [type]);
95
- const inputMode = useMemo(() => type === 'number' ? 'numeric' : 'text', [type]);
97
+ const keyboardType = type === 'number' ? 'number-pad' : 'default';
98
+ const inputMode = type === 'number' ? 'numeric' : 'text';
96
99
  const [code = '', setCode] = useControllableValue(props, {
97
100
  defaultValue: ''
98
101
  });
@@ -106,7 +109,7 @@ const PasswordInput = /*#__PURE__*/React.forwardRef((props, ref) => {
106
109
  }
107
110
  return next;
108
111
  }, [lengthSafe, type]);
109
- const normalizedCode = useMemo(() => normalizeValue(code), [code, normalizeValue]);
112
+ const normalizedCode = normalizeValue(code);
110
113
  const updateValue = useCallback(nextValue => {
111
114
  const normalized = normalizeValue(nextValue);
112
115
  if (normalized === normalizedCode) return;
@@ -184,7 +187,7 @@ const PasswordInput = /*#__PURE__*/React.forwardRef((props, ref) => {
184
187
  }
185
188
  };
186
189
  }, [disabled, focused, showCursor]);
187
- const cells = useMemo(() => Array.from({
190
+ const cells = Array.from({
188
191
  length: lengthSafe
189
192
  }, (_, index) => {
190
193
  const char = normalizedCode?.[index];
@@ -196,30 +199,35 @@ const PasswordInput = /*#__PURE__*/React.forwardRef((props, ref) => {
196
199
  isFilled,
197
200
  showBlink
198
201
  };
199
- }), [disabled, focused, lengthSafe, normalizedCode, showCursor]);
200
- const gutterValue = useMemo(() => Math.max(0, parseNumberLike(gutter, 0) ?? 0), [gutter]);
202
+ });
203
+ const gutterValue = Math.max(0, parseNumberLike(gutter, 0) ?? 0);
201
204
  const hasGutter = gutterValue > 0;
202
205
  const tip = errorInfo ?? info;
203
206
  const tipColor = errorInfo ? colors.error : colors.muted;
204
- const backgroundColor = hasGutter ? 'transparent' : colors.background;
205
- const cellTextBase = useMemo(() => ({
207
+ const backgroundColor = hasGutter ? colors.transparent : colors.background;
208
+ const hiddenInputProps = {
209
+ ...HIDDEN_INPUT_PROPS,
210
+ underlineColorAndroid: colors.transparent
211
+ };
212
+ const cellTextBase = {
206
213
  color: colors.text,
207
214
  fontSize: sizing.cellTextSize,
208
215
  fontWeight: typography.cellTextWeight,
209
216
  fontFamily: typography.fontFamily
210
- }), [colors.text, sizing.cellTextSize, typography.cellTextWeight, typography.fontFamily]);
211
- const wrapperStyle = useMemo(() => [styles.wrapper, {
217
+ };
218
+ const wrapperStyle = [styles.wrapper, {
212
219
  backgroundColor,
213
220
  borderRadius: radii.wrapper,
221
+ paddingHorizontal: spacing.none,
214
222
  opacity: disabled ? opacity.disabled : 1
215
223
  }, !hasGutter && {
216
224
  borderWidth: StyleSheet.hairlineWidth,
217
225
  borderColor: colors.border
218
- }], [backgroundColor, colors.border, disabled, hasGutter, opacity.disabled, radii.wrapper]);
219
- const securityStyle = useMemo(() => [styles.security, {
226
+ }];
227
+ const securityStyle = [styles.security, {
220
228
  borderRadius: hasGutter ? 0 : radii.wrapper,
221
229
  backgroundColor
222
- }], [backgroundColor, hasGutter, radii.wrapper]);
230
+ }];
223
231
  return /*#__PURE__*/React.createElement(View, {
224
232
  style: style
225
233
  }, /*#__PURE__*/React.createElement(Pressable, _extends({}, rest, {
@@ -240,7 +248,8 @@ const PasswordInput = /*#__PURE__*/React.forwardRef((props, ref) => {
240
248
  }, cellStyle, item.isFilled && cellFilledStyle];
241
249
  if (hasGutter) {
242
250
  baseCell.push(styles.cellGutter, {
243
- borderColor: colors.border
251
+ borderColor: colors.border,
252
+ borderRadius: radii.cellGutter
244
253
  }, index > 0 && {
245
254
  marginLeft: gutterValue
246
255
  });
@@ -285,8 +294,10 @@ const PasswordInput = /*#__PURE__*/React.forwardRef((props, ref) => {
285
294
  maxLength: lengthSafe,
286
295
  autoFocus: false,
287
296
  secureTextEntry: mask
288
- }, HIDDEN_INPUT_PROPS, {
289
- style: styles.hiddenInput,
297
+ }, hiddenInputProps, {
298
+ style: [styles.hiddenInput, {
299
+ opacity: opacity.hidden
300
+ }],
290
301
  onChangeText: handleChangeText,
291
302
  onFocus: handleFocus,
292
303
  onBlur: handleBlur,
@@ -304,8 +315,7 @@ const PasswordInput = /*#__PURE__*/React.forwardRef((props, ref) => {
304
315
  export default PasswordInput;
305
316
  const styles = StyleSheet.create({
306
317
  wrapper: {
307
- alignSelf: 'stretch',
308
- paddingHorizontal: 0
318
+ alignSelf: 'stretch'
309
319
  },
310
320
  security: {
311
321
  flexDirection: 'row',
@@ -319,16 +329,14 @@ const styles = StyleSheet.create({
319
329
  alignItems: 'center'
320
330
  },
321
331
  cellGutter: {
322
- borderWidth: StyleSheet.hairlineWidth,
323
- borderRadius: 0
332
+ borderWidth: StyleSheet.hairlineWidth
324
333
  },
325
334
  cursor: {
326
335
  position: 'absolute',
327
336
  left: '50%'
328
337
  },
329
338
  hiddenInput: {
330
- ...StyleSheet.absoluteFillObject,
331
- opacity: 0
339
+ ...StyleSheet.absoluteFillObject
332
340
  },
333
341
  infoWrapper: {
334
342
  alignItems: 'center'
@@ -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, useRef, useState } from 'react';
2
+ import React, { useCallback, useEffect, useRef, useState } from 'react';
3
3
  import { Pressable, Text, View, Platform, StyleSheet } from 'react-native';
4
4
  import Loading from '../loading';
5
5
  import { withAlpha } from '../../utils/color';
@@ -15,7 +15,7 @@ export function usePickerValue({
15
15
  onChange,
16
16
  onConfirm
17
17
  }) {
18
- const preparedColumns = useMemo(() => prepareColumns(columns), [columns]);
18
+ const preparedColumns = prepareColumns(columns);
19
19
  const isControlled = valueProp !== undefined;
20
20
  const [innerValue, setInnerValue] = useState(() => {
21
21
  const initial = toArrayValue(valueProp ?? defaultValue);
@@ -33,7 +33,7 @@ export function usePickerValue({
33
33
  commitValue(next);
34
34
  }
35
35
  }, [commitValue, isControlled, valueProp]);
36
- const normalized = useMemo(() => normalizePicker(preparedColumns, innerValue), [preparedColumns, innerValue]);
36
+ const normalized = normalizePicker(preparedColumns, innerValue);
37
37
  useEffect(() => {
38
38
  if (isControlled) return;
39
39
  if (!shallowEqualArray(innerValue, normalized.values)) {
@@ -149,11 +149,11 @@ const PickerColumn = /*#__PURE__*/React.memo(props => {
149
149
  swipeDuration
150
150
  } = props;
151
151
  const restVisible = Math.max(1, Math.floor((visibleItemCount - 1) / 2));
152
- const selectedIndex = useMemo(() => {
152
+ const selectedIndex = (() => {
153
153
  if (!options.length) return 0;
154
154
  const idx = options.findIndex(option => option.value === value);
155
155
  return findEnabledIndex(options, idx >= 0 ? idx : 0);
156
- }, [options, value]);
156
+ })();
157
157
  const handleChange = useCallback(index => {
158
158
  const target = findEnabledIndex(options, index);
159
159
  const option = options[target];
@@ -245,7 +245,6 @@ const Picker = props => {
245
245
  emitConfirmOnAutoSelect = true,
246
246
  maskColor,
247
247
  maskType = tokens.defaults.maskType,
248
- interactionMode = 'auto',
249
248
  onChange,
250
249
  onConfirm,
251
250
  onCancel,
@@ -349,7 +348,8 @@ const Picker = props => {
349
348
  }) : null;
350
349
  return /*#__PURE__*/React.createElement(View, _extends({}, rest, {
351
350
  style: [styles.container, {
352
- backgroundColor: tokens.colors.background
351
+ backgroundColor: tokens.colors.background,
352
+ borderRadius: tokens.radius.container
353
353
  }, style],
354
354
  testID: testID
355
355
  }), toolbarPosition === 'top' && toolbar, /*#__PURE__*/React.createElement(View, {
@@ -377,13 +377,13 @@ const Picker = props => {
377
377
  color: effectiveMaskColor,
378
378
  maskType: maskType
379
379
  }))), loading && /*#__PURE__*/React.createElement(View, {
380
- style: styles.loading
380
+ style: [styles.loading, {
381
+ backgroundColor: tokens.colors.loadingMask
382
+ }]
381
383
  }, /*#__PURE__*/React.createElement(Loading, null))), toolbarPosition === 'bottom' && toolbar);
382
384
  };
383
385
  const styles = StyleSheet.create({
384
- container: {
385
- borderRadius: 4
386
- },
386
+ container: {},
387
387
  body: {
388
388
  position: 'relative',
389
389
  overflow: 'hidden'
@@ -437,8 +437,7 @@ const styles = StyleSheet.create({
437
437
  right: 0,
438
438
  bottom: 0,
439
439
  alignItems: 'center',
440
- justifyContent: 'center',
441
- backgroundColor: 'rgba(255,255,255,0.65)'
440
+ justifyContent: 'center'
442
441
  }
443
442
  });
444
443
  Picker.displayName = 'Picker';
@@ -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, useRef, useState } from 'react';
2
+ import React, { useCallback, useEffect, useRef, useState } from 'react';
3
3
  import { FlatList, Platform, View, StyleSheet, PanResponder } from 'react-native';
4
4
  import { clamp } from '../../utils';
5
5
  import { findEnabledIndex } from './utils';
@@ -258,8 +258,8 @@ const WheelPickerInner = ({
258
258
  }]
259
259
  }, content);
260
260
  }, [itemHeight, renderItem]);
261
- const webIndex = useMemo(() => clamp(Math.round(-webOffset / itemHeight), 0, maxIndex), [itemHeight, maxIndex, webOffset]);
262
- const webRender = useMemo(() => {
261
+ const webIndex = clamp(Math.round(-webOffset / itemHeight), 0, maxIndex);
262
+ const webRender = (() => {
263
263
  if (!isWeb || total <= 0) {
264
264
  return {
265
265
  items: null,
@@ -303,24 +303,24 @@ const WheelPickerInner = ({
303
303
  }
304
304
  })
305
305
  };
306
- }, [data, isWeb, itemHeight, maxIndex, renderItem, total, visibleCount, webIndex, webVirtualEnabled, webVelocityBucket]);
307
- const webTransform = useMemo(() => ({
306
+ })();
307
+ const webTransform = {
308
308
  transform: [{
309
309
  translateY: webOffset
310
310
  }]
311
- }), [webOffset]);
312
- const webTransitionStyle = useMemo(() => webTransition ? {
311
+ };
312
+ const webTransitionStyle = webTransition ? {
313
313
  transitionProperty: 'transform',
314
314
  transitionDuration: `${webTransition}ms`,
315
315
  transitionTimingFunction: 'cubic-bezier(0.23, 1, 0.68, 1)',
316
316
  willChange: 'transform'
317
- } : undefined, [webTransition]);
317
+ } : undefined;
318
318
  const handleWebTransitionEnd = useCallback(event => {
319
319
  const propertyName = event.nativeEvent?.propertyName ?? event.propertyName;
320
320
  if (propertyName && propertyName !== 'transform' && propertyName !== 'webkitTransform') return;
321
321
  finalizePendingChange();
322
322
  }, [finalizePendingChange]);
323
- const panResponder = useMemo(() => PanResponder.create({
323
+ const panResponder = PanResponder.create({
324
324
  onStartShouldSetPanResponder: () => !readOnly,
325
325
  onMoveShouldSetPanResponder: () => !readOnly,
326
326
  onPanResponderGrant: () => {
@@ -365,7 +365,7 @@ const WheelPickerInner = ({
365
365
  notifyInteractEnd();
366
366
  setWebTransition(0);
367
367
  }
368
- }), [data, itemHeight, maxIndex, minOffset, notifyInteractEnd, notifyInteractStart, readOnly, setVelocityBucket, startWebSnap, stopRaf, total]);
368
+ });
369
369
  if (isWeb) {
370
370
  return /*#__PURE__*/React.createElement(View, _extends({
371
371
  style: [styles.column, {
@@ -24,7 +24,8 @@ const createPickerTokens = foundations => {
24
24
  textDisabled: palette.default[400],
25
25
  confirm: palette.primary[600],
26
26
  cancel: palette.default[600],
27
- mask: '#ffffff'
27
+ mask: '#ffffff',
28
+ loadingMask: 'rgba(255,255,255,0.65)'
28
29
  },
29
30
  spacing: {
30
31
  toolbarHeight: 44,
@@ -38,7 +39,8 @@ const createPickerTokens = foundations => {
38
39
  toolbarWeight: typography.weight.medium
39
40
  },
40
41
  radius: {
41
- toolbar: radii.none
42
+ toolbar: radii.none,
43
+ container: radii.xs
42
44
  }
43
45
  };
44
46
  };
@@ -1,6 +1,6 @@
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, useRef, useState } from 'react';
3
- import { Animated, Dimensions, Easing, Pressable, StyleSheet, Text, View } from 'react-native';
2
+ import React, { useCallback, useEffect, useRef, useState } from 'react';
3
+ import { Animated, Easing, Pressable, StyleSheet, Text, View, useWindowDimensions } from 'react-native';
4
4
  import { SafeAreaView } from '../safe-area-view';
5
5
  import { addPopStateListener, nativeDriverEnabled } from '../../platform';
6
6
  import { createPlatformShadow } from '../../utils/createPlatformShadow';
@@ -153,70 +153,59 @@ export const Popup = props => {
153
153
  const shouldTranslate = placement !== 'center';
154
154
  const safeAreaInsetBottom = safeAreaInsetBottomProp ?? false;
155
155
  const tokens = usePopupTokens(tokensOverride);
156
- const dynamicStyles = useMemo(() => {
157
- const shadow = createPlatformShadow({
158
- color: tokens.shadow.color,
159
- opacity: tokens.shadow.opacity,
160
- radius: tokens.shadow.radius,
161
- offsetY: tokens.shadow.offsetY,
162
- elevation: tokens.shadow.elevation
163
- });
164
- const popup = {
156
+ const shadow = createPlatformShadow({
157
+ color: tokens.shadow.color,
158
+ opacity: tokens.shadow.opacity,
159
+ radius: tokens.shadow.radius,
160
+ offsetY: tokens.shadow.offsetY,
161
+ elevation: tokens.shadow.elevation
162
+ });
163
+ const dynamicStyles = {
164
+ popup: {
165
165
  backgroundColor: tokens.colors.background,
166
166
  padding: tokens.spacing.padding,
167
167
  ...shadow
168
- };
169
- const title = {
168
+ },
169
+ title: {
170
170
  color: tokens.colors.title,
171
171
  fontSize: tokens.typography.titleSize,
172
172
  fontWeight: tokens.typography.titleWeight,
173
173
  marginHorizontal: tokens.spacing.descriptionHorizontal,
174
174
  textAlign: 'center'
175
- };
176
- const titleWrapper = {
175
+ },
176
+ titleWrapper: {
177
177
  marginTop: tokens.spacing.titleTop,
178
178
  marginBottom: tokens.spacing.titleBottom,
179
179
  marginHorizontal: tokens.spacing.descriptionHorizontal,
180
180
  alignItems: 'center'
181
- };
182
- const description = {
181
+ },
182
+ description: {
183
183
  color: tokens.colors.description,
184
184
  fontSize: tokens.typography.descriptionSize,
185
185
  lineHeight: tokens.typography.descriptionLineHeight
186
- };
187
- const descriptionWrapper = {
186
+ },
187
+ descriptionWrapper: {
188
188
  marginHorizontal: tokens.spacing.descriptionHorizontal,
189
189
  marginBottom: tokens.spacing.descriptionBottom
190
- };
191
- const closeIconBase = {
190
+ },
191
+ closeIconBase: {
192
192
  minWidth: tokens.spacing.closeIconSize,
193
193
  minHeight: tokens.spacing.closeIconSize,
194
- padding: 6
195
- };
196
- const closeIconDefault = {
194
+ padding: tokens.spacing.closeIconPadding
195
+ },
196
+ closeIconDefault: {
197
197
  width: tokens.spacing.closeIconSize,
198
198
  height: tokens.spacing.closeIconSize
199
- };
200
- const popupSide = {
199
+ },
200
+ popupSide: {
201
201
  width: tokens.layout.sideWidth,
202
202
  maxWidth: tokens.layout.maxWidth
203
- };
204
- const popupCenter = {
203
+ },
204
+ popupCenter: {
205
205
  minWidth: tokens.layout.minWidth,
206
206
  maxWidth: tokens.layout.centerMaxWidth
207
- };
208
- return {
209
- popup,
210
- title,
211
- titleWrapper,
212
- description,
213
- descriptionWrapper,
214
- closeIconBase,
215
- closeIconDefault,
216
- popupSide,
217
- popupCenter
218
- };
219
- }, [tokens]);
207
+ }
208
+ };
220
209
  const [mounted, setMounted] = useState(visible);
221
210
  const [interactionVisible, setInteractionVisible] = useState(visible);
222
211
  const isOpen = visible || interactionVisible;
@@ -335,22 +324,18 @@ export const Popup = props => {
335
324
  onStartShouldSetResponder: stopPropagationResponder
336
325
  } : overlayRestProps;
337
326
  const config = placementConfig[placement];
338
- const radiusStyle = useMemo(() => buildRadius(round, placement, tokens.radius.round), [placement, round, tokens.radius.round]);
327
+ const radiusStyle = buildRadius(round, placement, tokens.radius.round);
339
328
  const {
340
329
  animated: overlayOpacity
341
330
  } = usePresenceAnimation(visible, {
342
331
  duration
343
332
  });
344
- const translateDistance = useMemo(() => {
345
- if (placement === 'left' || placement === 'right') {
346
- return Dimensions.get('window').width;
347
- }
348
- if (placement === 'top' || placement === 'bottom') {
349
- return Dimensions.get('window').height;
350
- }
351
- return 0;
352
- }, [placement]);
353
- const translateTransform = useMemo(() => {
333
+ const {
334
+ width: windowWidth,
335
+ height: windowHeight
336
+ } = useWindowDimensions();
337
+ const translateDistance = placement === 'left' || placement === 'right' ? windowWidth : placement === 'top' || placement === 'bottom' ? windowHeight : 0;
338
+ const translateTransform = (() => {
354
339
  if (!shouldTranslate) return null;
355
340
  const outputRange = [translateDistance * direction, 0];
356
341
  return config.axis === 'y' ? {
@@ -364,9 +349,9 @@ export const Popup = props => {
364
349
  outputRange
365
350
  })
366
351
  };
367
- }, [config.axis, direction, progress, shouldTranslate, translateDistance]);
368
- const baseTransform = useMemo(() => translateTransform ? [translateTransform] : [], [translateTransform]);
369
- const animatedContentStyle = useMemo(() => {
352
+ })();
353
+ const baseTransform = translateTransform ? [translateTransform] : [];
354
+ const animatedContentStyle = (() => {
370
355
  const extraTransform = contentAnimationStyle?.transform;
371
356
  const transform = Array.isArray(extraTransform) ? [...baseTransform, ...extraTransform] : baseTransform;
372
357
  const baseStyle = {
@@ -386,7 +371,7 @@ export const Popup = props => {
386
371
  };
387
372
  }
388
373
  return baseStyle;
389
- }, [baseTransform, contentAnimationStyle, placement, progress]);
374
+ })();
390
375
  const handleContentLayout = useCallback(event => {
391
376
  overlayOnLayout?.(event);
392
377
  }, [overlayOnLayout]);
@@ -27,7 +27,8 @@ export const createPopupTokens = foundations => {
27
27
  descriptionBottom: spacing.md,
28
28
  closeIconTop: spacing.md,
29
29
  closeIconRight: spacing.md,
30
- closeIconSize: 36
30
+ closeIconSize: 36,
31
+ closeIconPadding: spacing.ssm
31
32
  },
32
33
  typography: {
33
34
  titleSize: fontSize.md,