react-native-system-ui 0.0.5 → 0.0.7

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 (372) hide show
  1. package/README.md +12 -4
  2. package/dist/cjs/components/action-sheet/ActionSheet.js +28 -22
  3. package/dist/cjs/components/area/Area.js +72 -6
  4. package/dist/cjs/components/area/tokens.js +11 -0
  5. package/dist/cjs/components/avatar/Avatar.js +42 -10
  6. package/dist/cjs/components/badge/Badge.js +10 -10
  7. package/dist/cjs/components/badge/tokens.js +4 -0
  8. package/dist/cjs/components/button/Button.js +16 -65
  9. package/dist/cjs/components/button/ButtonContext.js +7 -10
  10. package/dist/cjs/components/button/ButtonGroup.js +13 -15
  11. package/dist/cjs/components/button/tokens.js +1 -5
  12. package/dist/cjs/components/calendar/Calendar.js +23 -12
  13. package/dist/cjs/components/cascader/Cascader.js +18 -13
  14. package/dist/cjs/components/cell/Cell.js +3 -3
  15. package/dist/cjs/components/cell/CellGroup.js +26 -21
  16. package/dist/cjs/components/checkbox/Checkbox.js +5 -4
  17. package/dist/cjs/components/checkbox/CheckboxContext.js +7 -10
  18. package/dist/cjs/components/checkbox/CheckboxGroup.js +24 -21
  19. package/dist/cjs/components/circle/Circle.js +6 -6
  20. package/dist/cjs/components/collapse/Collapse.js +10 -10
  21. package/dist/cjs/components/config-provider/locale/en-US.js +66 -4
  22. package/dist/cjs/components/config-provider/locale/zh-CN.js +74 -2
  23. package/dist/cjs/components/config-provider/tokens.js +11 -0
  24. package/dist/cjs/components/count-down/CountDown.js +6 -6
  25. package/dist/cjs/components/datetime-picker/DatetimePicker.js +6 -6
  26. package/dist/cjs/components/datetime-picker/tokens.js +11 -0
  27. package/dist/cjs/components/dialog/Dialog.js +39 -34
  28. package/dist/cjs/components/dialog/tokens.js +1 -4
  29. package/dist/cjs/components/divider/Divider.js +36 -1
  30. package/dist/cjs/components/field/Field.js +303 -201
  31. package/dist/cjs/components/flex/Flex.js +7 -3
  32. package/dist/cjs/components/flex/FlexContext.js +7 -14
  33. package/dist/cjs/components/form/Form.js +112 -122
  34. package/dist/cjs/components/form/FormContext.js +7 -10
  35. package/dist/cjs/components/form/FormItem.js +30 -4
  36. package/dist/cjs/components/form/FormList.js +16 -3
  37. package/dist/cjs/components/form/tokens.js +11 -0
  38. package/dist/cjs/components/form/utils.js +2 -1
  39. package/dist/cjs/components/grid/Grid.js +45 -31
  40. package/dist/cjs/components/grid/GridContext.js +7 -10
  41. package/dist/cjs/components/grid/GridItem.js +22 -22
  42. package/dist/cjs/components/image/Image.js +17 -13
  43. package/dist/cjs/components/image-preview/ImagePreview.js +43 -41
  44. package/dist/cjs/components/index.js +43 -141
  45. package/dist/cjs/components/input/Input.js +19 -5
  46. package/dist/cjs/components/loading/Loading.js +10 -139
  47. package/dist/cjs/components/loading/tokens.js +0 -24
  48. package/dist/cjs/components/notice-bar/NoticeBar.js +45 -41
  49. package/dist/cjs/components/notify/Notify.js +63 -22
  50. package/dist/cjs/components/notify/imperative.js +2 -2
  51. package/dist/cjs/components/notify/tokens.js +11 -1
  52. package/dist/cjs/components/number-keyboard/NumberKeyboard.js +6 -6
  53. package/dist/cjs/components/overlay/Overlay.js +70 -77
  54. package/dist/cjs/components/overlay/index.js +13 -27
  55. package/dist/cjs/components/overlay/tokens.js +4 -31
  56. package/dist/cjs/components/password-input/PasswordInput.js +2 -41
  57. package/dist/cjs/components/password-input/tokens.js +53 -0
  58. package/dist/cjs/components/picker/Picker.js +618 -38
  59. package/dist/cjs/components/popup/Popup.js +60 -47
  60. package/dist/cjs/components/portal/Portal.js +39 -31
  61. package/dist/cjs/components/portal/PortalHost.js +258 -213
  62. package/dist/cjs/components/portal/tokens.js +11 -0
  63. package/dist/cjs/components/progress/Progress.js +77 -36
  64. package/dist/cjs/components/progress/index.js +6 -0
  65. package/dist/cjs/components/radio/Radio.js +35 -12
  66. package/dist/cjs/components/radio/RadioContext.js +7 -10
  67. package/dist/cjs/components/radio/RadioGroup.js +23 -20
  68. package/dist/cjs/components/safe-area-view/tokens.js +11 -0
  69. package/dist/cjs/components/search/Search.js +16 -16
  70. package/dist/cjs/components/selector/Selector.js +6 -6
  71. package/dist/cjs/components/share-sheet/ShareSheet.js +50 -46
  72. package/dist/cjs/components/sidebar/Sidebar.js +27 -22
  73. package/dist/cjs/components/sidebar/SidebarItem.js +27 -22
  74. package/dist/cjs/components/skeleton/Skeleton.js +34 -21
  75. package/dist/cjs/components/slider/Slider.js +135 -78
  76. package/dist/cjs/components/stepper/Stepper.js +12 -10
  77. package/dist/cjs/components/swiper/Swiper.js +247 -710
  78. package/dist/cjs/components/swiper/SwiperItem.js +5 -33
  79. package/dist/cjs/components/swiper/tokens.js +11 -0
  80. package/dist/cjs/components/switch/Switch.js +46 -98
  81. package/dist/cjs/components/switch/tokens.js +1 -55
  82. package/dist/cjs/components/tabbar/Tabbar.js +26 -22
  83. package/dist/cjs/components/tabbar/TabbarItem.js +23 -22
  84. package/dist/cjs/components/tabbar/tokens.js +0 -2
  85. package/dist/cjs/components/tabs/Tabs.js +268 -94
  86. package/dist/cjs/components/tabs/index.js +4 -5
  87. package/dist/cjs/components/toast/Toast.js +72 -27
  88. package/dist/cjs/components/toast/imperative.js +2 -2
  89. package/dist/cjs/hooks/gesture/useGestureScroll.js +1 -2
  90. package/dist/cjs/hooks/index.js +12 -12
  91. package/dist/cjs/hooks/overlay/index.js +27 -0
  92. package/dist/cjs/hooks/useHairline.js +0 -4
  93. package/dist/cjs/platform/scrollLock.js +1 -1
  94. package/dist/cjs/utils/compare.js +26 -0
  95. package/dist/cjs/utils/index.js +11 -0
  96. package/dist/es/components/action-sheet/ActionSheet.js +29 -23
  97. package/dist/es/components/area/Area.js +73 -7
  98. package/dist/es/components/area/tokens.js +5 -0
  99. package/dist/es/components/avatar/Avatar.js +42 -10
  100. package/dist/es/components/badge/Badge.js +11 -11
  101. package/dist/es/components/badge/tokens.js +4 -0
  102. package/dist/es/components/button/Button.js +17 -65
  103. package/dist/es/components/button/ButtonContext.js +1 -2
  104. package/dist/es/components/button/ButtonGroup.js +10 -12
  105. package/dist/es/components/button/tokens.js +1 -5
  106. package/dist/es/components/calendar/Calendar.js +24 -13
  107. package/dist/es/components/cascader/Cascader.js +16 -11
  108. package/dist/es/components/cell/Cell.js +4 -4
  109. package/dist/es/components/cell/CellGroup.js +25 -20
  110. package/dist/es/components/checkbox/Checkbox.js +5 -4
  111. package/dist/es/components/checkbox/CheckboxContext.js +1 -2
  112. package/dist/es/components/checkbox/CheckboxGroup.js +24 -21
  113. package/dist/es/components/circle/Circle.js +7 -7
  114. package/dist/es/components/collapse/Collapse.js +11 -11
  115. package/dist/es/components/config-provider/locale/en-US.js +66 -4
  116. package/dist/es/components/config-provider/locale/zh-CN.js +74 -2
  117. package/dist/es/components/config-provider/tokens.js +5 -0
  118. package/dist/es/components/count-down/CountDown.js +7 -7
  119. package/dist/es/components/datetime-picker/DatetimePicker.js +7 -7
  120. package/dist/es/components/datetime-picker/tokens.js +5 -0
  121. package/dist/es/components/dialog/Dialog.js +40 -35
  122. package/dist/es/components/dialog/tokens.js +1 -4
  123. package/dist/es/components/divider/Divider.js +36 -1
  124. package/dist/es/components/field/Field.js +304 -202
  125. package/dist/es/components/flex/Flex.js +5 -1
  126. package/dist/es/components/flex/FlexContext.js +1 -6
  127. package/dist/es/components/form/Form.js +89 -99
  128. package/dist/es/components/form/FormContext.js +1 -2
  129. package/dist/es/components/form/FormItem.js +32 -6
  130. package/dist/es/components/form/FormList.js +18 -5
  131. package/dist/es/components/form/tokens.js +5 -0
  132. package/dist/es/components/form/utils.js +1 -0
  133. package/dist/es/components/grid/Grid.js +43 -29
  134. package/dist/es/components/grid/GridContext.js +1 -2
  135. package/dist/es/components/grid/GridItem.js +24 -24
  136. package/dist/es/components/image/Image.js +18 -14
  137. package/dist/es/components/image-preview/ImagePreview.js +44 -42
  138. package/dist/es/components/index.js +2 -17
  139. package/dist/es/components/input/Input.js +20 -6
  140. package/dist/es/components/loading/Loading.js +10 -139
  141. package/dist/es/components/loading/tokens.js +0 -24
  142. package/dist/es/components/notice-bar/NoticeBar.js +46 -42
  143. package/dist/es/components/notify/Notify.js +63 -22
  144. package/dist/es/components/notify/imperative.js +2 -2
  145. package/dist/es/components/notify/tokens.js +5 -1
  146. package/dist/es/components/number-keyboard/NumberKeyboard.js +7 -7
  147. package/dist/es/components/overlay/Overlay.js +58 -75
  148. package/dist/es/components/overlay/index.js +3 -4
  149. package/dist/es/components/overlay/tokens.js +3 -29
  150. package/dist/es/components/password-input/PasswordInput.js +1 -40
  151. package/dist/es/components/password-input/tokens.js +41 -0
  152. package/dist/es/components/picker/Picker.js +610 -34
  153. package/dist/es/components/popup/Popup.js +62 -49
  154. package/dist/es/components/portal/Portal.js +37 -31
  155. package/dist/es/components/portal/PortalHost.js +257 -211
  156. package/dist/es/components/portal/tokens.js +5 -0
  157. package/dist/es/components/progress/Progress.js +76 -36
  158. package/dist/es/components/progress/index.js +2 -1
  159. package/dist/es/components/radio/Radio.js +37 -14
  160. package/dist/es/components/radio/RadioContext.js +1 -2
  161. package/dist/es/components/radio/RadioGroup.js +23 -20
  162. package/dist/es/components/safe-area-view/tokens.js +5 -0
  163. package/dist/es/components/search/Search.js +17 -17
  164. package/dist/es/components/selector/Selector.js +7 -7
  165. package/dist/es/components/share-sheet/ShareSheet.js +51 -47
  166. package/dist/es/components/sidebar/Sidebar.js +26 -21
  167. package/dist/es/components/sidebar/SidebarItem.js +26 -22
  168. package/dist/es/components/skeleton/Skeleton.js +35 -22
  169. package/dist/es/components/slider/Slider.js +132 -75
  170. package/dist/es/components/stepper/Stepper.js +13 -11
  171. package/dist/es/components/swiper/Swiper.js +248 -711
  172. package/dist/es/components/swiper/SwiperItem.js +1 -21
  173. package/dist/es/components/swiper/tokens.js +5 -0
  174. package/dist/es/components/switch/Switch.js +49 -101
  175. package/dist/es/components/switch/tokens.js +1 -49
  176. package/dist/es/components/tabbar/Tabbar.js +27 -23
  177. package/dist/es/components/tabbar/TabbarItem.js +22 -22
  178. package/dist/es/components/tabbar/tokens.js +0 -2
  179. package/dist/es/components/tabs/Tabs.js +264 -90
  180. package/dist/es/components/tabs/index.js +1 -2
  181. package/dist/es/components/toast/Toast.js +72 -28
  182. package/dist/es/components/toast/imperative.js +2 -2
  183. package/dist/es/hooks/gesture/useGestureScroll.js +1 -2
  184. package/dist/es/hooks/index.js +1 -1
  185. package/dist/es/hooks/overlay/index.js +3 -0
  186. package/dist/es/hooks/useHairline.js +0 -4
  187. package/dist/es/platform/scrollLock.js +1 -1
  188. package/dist/es/utils/compare.js +18 -0
  189. package/dist/es/utils/index.js +1 -1
  190. package/dist/types/components/area/tokens.d.ts +3 -0
  191. package/dist/types/components/avatar/Avatar.d.ts +4 -2
  192. package/dist/types/components/button/ButtonContext.d.ts +2 -16
  193. package/dist/types/components/button/ButtonGroup.d.ts +14 -1
  194. package/dist/types/components/button/index.d.ts +1 -1
  195. package/dist/types/components/checkbox/CheckboxContext.d.ts +2 -16
  196. package/dist/types/components/checkbox/CheckboxGroup.d.ts +15 -1
  197. package/dist/types/components/collapse/Collapse.d.ts +0 -1
  198. package/dist/types/components/config-provider/LocaleContext.d.ts +2 -74
  199. package/dist/types/components/config-provider/tokens.d.ts +3 -0
  200. package/dist/types/components/config-provider/useLocale.d.ts +1 -74
  201. package/dist/types/components/datetime-picker/tokens.d.ts +3 -0
  202. package/dist/types/components/flex/Flex.d.ts +6 -0
  203. package/dist/types/components/flex/FlexContext.d.ts +2 -8
  204. package/dist/types/components/form/Form.d.ts +15 -1
  205. package/dist/types/components/form/FormContext.d.ts +2 -17
  206. package/dist/types/components/form/tokens.d.ts +3 -0
  207. package/dist/types/components/form/utils.d.ts +1 -0
  208. package/dist/types/components/grid/Grid.d.ts +16 -1
  209. package/dist/types/components/grid/GridContext.d.ts +2 -17
  210. package/dist/types/components/index.d.ts +3 -33
  211. package/dist/types/components/loading/index.d.ts +1 -1
  212. package/dist/types/components/notify/Notify.d.ts +1 -0
  213. package/dist/types/components/overlay/Overlay.d.ts +6 -1
  214. package/dist/types/components/overlay/index.d.ts +2 -3
  215. package/dist/types/components/overlay/tokens.d.ts +2 -3
  216. package/dist/types/components/password-input/PasswordInput.d.ts +0 -39
  217. package/dist/types/components/password-input/tokens.d.ts +40 -0
  218. package/dist/types/components/picker/Picker.d.ts +18 -2
  219. package/dist/types/components/picker/index.d.ts +1 -1
  220. package/dist/types/components/portal/Portal.d.ts +4 -6
  221. package/dist/types/components/portal/PortalHost.d.ts +1 -15
  222. package/dist/types/components/portal/tokens.d.ts +3 -0
  223. package/dist/types/components/progress/Progress.d.ts +4 -0
  224. package/dist/types/components/progress/index.d.ts +2 -1
  225. package/dist/types/components/radio/RadioContext.d.ts +2 -13
  226. package/dist/types/components/radio/RadioGroup.d.ts +12 -1
  227. package/dist/types/components/safe-area-view/tokens.d.ts +3 -0
  228. package/dist/types/components/swiper/Swiper.d.ts +4 -2
  229. package/dist/types/components/swiper/SwiperItem.d.ts +1 -5
  230. package/dist/types/components/swiper/tokens.d.ts +3 -0
  231. package/dist/types/components/tabs/Tabs.d.ts +8 -4
  232. package/dist/types/components/tabs/index.d.ts +3 -1
  233. package/dist/types/components/toast/Toast.d.ts +1 -4
  234. package/dist/types/hooks/aria/useAriaListBox.d.ts +0 -6
  235. package/dist/types/hooks/aria/useAriaOverlay.d.ts +0 -10
  236. package/dist/types/hooks/aria/useAriaPress.d.ts +0 -20
  237. package/dist/types/hooks/aria/useAriaToggle.d.ts +0 -3
  238. package/dist/types/hooks/index.d.ts +1 -1
  239. package/dist/types/hooks/overlay/index.d.ts +2 -0
  240. package/dist/types/hooks/useHairline.d.ts +0 -21
  241. package/dist/types/utils/compare.d.ts +2 -0
  242. package/dist/types/utils/index.d.ts +1 -0
  243. package/package.json +10 -48
  244. package/dist/cjs/components/area/utils.js +0 -74
  245. package/dist/cjs/components/cascader/utils.js +0 -20
  246. package/dist/cjs/components/config-provider/locale/base.js +0 -80
  247. package/dist/cjs/components/dropdown-menu/DropdownItem.js +0 -288
  248. package/dist/cjs/components/dropdown-menu/DropdownMenu.js +0 -340
  249. package/dist/cjs/components/dropdown-menu/DropdownMenuContext.js +0 -21
  250. package/dist/cjs/components/dropdown-menu/index.js +0 -25
  251. package/dist/cjs/components/dropdown-menu/tokens.js +0 -67
  252. package/dist/cjs/components/field/utils.js +0 -24
  253. package/dist/cjs/components/index-bar/IndexAnchor.js +0 -74
  254. package/dist/cjs/components/index-bar/IndexBar.js +0 -436
  255. package/dist/cjs/components/index-bar/index.js +0 -25
  256. package/dist/cjs/components/index-bar/tokens.js +0 -45
  257. package/dist/cjs/components/list/List.js +0 -165
  258. package/dist/cjs/components/list/index.js +0 -9
  259. package/dist/cjs/components/list/tokens.js +0 -39
  260. package/dist/cjs/components/notify/defaults.js +0 -15
  261. package/dist/cjs/components/pagination/Pagination.js +0 -160
  262. package/dist/cjs/components/pagination/index.js +0 -22
  263. package/dist/cjs/components/pagination/tokens.js +0 -103
  264. package/dist/cjs/components/picker/WheelPicker.js +0 -492
  265. package/dist/cjs/components/picker/utils.js +0 -138
  266. package/dist/cjs/components/pull-refresh/PullRefresh.js +0 -378
  267. package/dist/cjs/components/pull-refresh/index.js +0 -16
  268. package/dist/cjs/components/pull-refresh/tokens.js +0 -22
  269. package/dist/cjs/components/rate/Rate.js +0 -269
  270. package/dist/cjs/components/rate/index.js +0 -15
  271. package/dist/cjs/components/rate/tokens.js +0 -60
  272. package/dist/cjs/components/slider/utils.js +0 -60
  273. package/dist/cjs/components/swiper/useSwiperWeb.js +0 -209
  274. package/dist/cjs/components/swiper/utils.js +0 -49
  275. package/dist/cjs/components/tabs/TabPane.js +0 -9
  276. package/dist/cjs/components/tabs/useTabsAnimation.js +0 -74
  277. package/dist/cjs/components/tabs/useTabsScroll.js +0 -133
  278. package/dist/cjs/components/tabs/utils.js +0 -34
  279. package/dist/cjs/components/types.js +0 -1
  280. package/dist/cjs/components/uploader/Uploader.js +0 -557
  281. package/dist/cjs/components/uploader/index.js +0 -22
  282. package/dist/cjs/components/uploader/tokens.js +0 -58
  283. package/dist/cjs/components/uploader/utils.js +0 -72
  284. package/dist/cjs/hooks/usePresenceAnimation.js +0 -70
  285. package/dist/es/components/area/utils.js +0 -67
  286. package/dist/es/components/cascader/utils.js +0 -13
  287. package/dist/es/components/config-provider/locale/base.js +0 -74
  288. package/dist/es/components/dropdown-menu/DropdownItem.js +0 -269
  289. package/dist/es/components/dropdown-menu/DropdownMenu.js +0 -320
  290. package/dist/es/components/dropdown-menu/DropdownMenuContext.js +0 -7
  291. package/dist/es/components/dropdown-menu/index.js +0 -7
  292. package/dist/es/components/dropdown-menu/tokens.js +0 -61
  293. package/dist/es/components/field/utils.js +0 -17
  294. package/dist/es/components/index-bar/IndexAnchor.js +0 -55
  295. package/dist/es/components/index-bar/IndexBar.js +0 -417
  296. package/dist/es/components/index-bar/index.js +0 -7
  297. package/dist/es/components/index-bar/tokens.js +0 -39
  298. package/dist/es/components/list/List.js +0 -145
  299. package/dist/es/components/list/index.js +0 -2
  300. package/dist/es/components/list/tokens.js +0 -32
  301. package/dist/es/components/notify/defaults.js +0 -9
  302. package/dist/es/components/pagination/Pagination.js +0 -141
  303. package/dist/es/components/pagination/index.js +0 -4
  304. package/dist/es/components/pagination/tokens.js +0 -91
  305. package/dist/es/components/picker/WheelPicker.js +0 -473
  306. package/dist/es/components/picker/utils.js +0 -127
  307. package/dist/es/components/pull-refresh/PullRefresh.js +0 -359
  308. package/dist/es/components/pull-refresh/index.js +0 -3
  309. package/dist/es/components/pull-refresh/tokens.js +0 -16
  310. package/dist/es/components/rate/Rate.js +0 -250
  311. package/dist/es/components/rate/index.js +0 -3
  312. package/dist/es/components/rate/tokens.js +0 -53
  313. package/dist/es/components/slider/utils.js +0 -49
  314. package/dist/es/components/swiper/useSwiperWeb.js +0 -190
  315. package/dist/es/components/swiper/utils.js +0 -37
  316. package/dist/es/components/tabs/TabPane.js +0 -3
  317. package/dist/es/components/tabs/useTabsAnimation.js +0 -55
  318. package/dist/es/components/tabs/useTabsScroll.js +0 -114
  319. package/dist/es/components/tabs/utils.js +0 -19
  320. package/dist/es/components/types.js +0 -1
  321. package/dist/es/components/uploader/Uploader.js +0 -537
  322. package/dist/es/components/uploader/index.js +0 -4
  323. package/dist/es/components/uploader/tokens.js +0 -52
  324. package/dist/es/components/uploader/utils.js +0 -60
  325. package/dist/es/hooks/usePresenceAnimation.js +0 -51
  326. package/dist/types/components/area/utils.d.ts +0 -2
  327. package/dist/types/components/cascader/utils.d.ts +0 -6
  328. package/dist/types/components/config-provider/locale/base.d.ts +0 -74
  329. package/dist/types/components/dropdown-menu/DropdownItem.d.ts +0 -4
  330. package/dist/types/components/dropdown-menu/DropdownMenu.d.ts +0 -4
  331. package/dist/types/components/dropdown-menu/DropdownMenuContext.d.ts +0 -17
  332. package/dist/types/components/dropdown-menu/index.d.ts +0 -8
  333. package/dist/types/components/dropdown-menu/tokens.d.ts +0 -52
  334. package/dist/types/components/field/utils.d.ts +0 -4
  335. package/dist/types/components/index-bar/IndexAnchor.d.ts +0 -4
  336. package/dist/types/components/index-bar/IndexBar.d.ts +0 -4
  337. package/dist/types/components/index-bar/index.d.ts +0 -9
  338. package/dist/types/components/index-bar/tokens.d.ts +0 -31
  339. package/dist/types/components/list/List.d.ts +0 -4
  340. package/dist/types/components/list/index.d.ts +0 -3
  341. package/dist/types/components/list/tokens.d.ts +0 -4
  342. package/dist/types/components/notify/defaults.d.ts +0 -10
  343. package/dist/types/components/pagination/Pagination.d.ts +0 -5
  344. package/dist/types/components/pagination/index.d.ts +0 -5
  345. package/dist/types/components/pagination/tokens.d.ts +0 -2
  346. package/dist/types/components/picker/WheelPicker.d.ts +0 -21
  347. package/dist/types/components/picker/utils.d.ts +0 -17
  348. package/dist/types/components/pull-refresh/PullRefresh.d.ts +0 -5
  349. package/dist/types/components/pull-refresh/index.d.ts +0 -4
  350. package/dist/types/components/pull-refresh/tokens.d.ts +0 -10
  351. package/dist/types/components/rate/Rate.d.ts +0 -4
  352. package/dist/types/components/rate/index.d.ts +0 -4
  353. package/dist/types/components/rate/tokens.d.ts +0 -4
  354. package/dist/types/components/slider/utils.d.ts +0 -42
  355. package/dist/types/components/swiper/useSwiperWeb.d.ts +0 -41
  356. package/dist/types/components/swiper/utils.d.ts +0 -17
  357. package/dist/types/components/tabs/TabPane.d.ts +0 -4
  358. package/dist/types/components/tabs/useTabsAnimation.d.ts +0 -30
  359. package/dist/types/components/tabs/useTabsScroll.d.ts +0 -23
  360. package/dist/types/components/tabs/utils.d.ts +0 -5
  361. package/dist/types/components/types.d.ts +0 -59
  362. package/dist/types/components/uploader/Uploader.d.ts +0 -4
  363. package/dist/types/components/uploader/index.d.ts +0 -5
  364. package/dist/types/components/uploader/tokens.d.ts +0 -42
  365. package/dist/types/components/uploader/utils.d.ts +0 -11
  366. package/dist/types/hooks/usePresenceAnimation.d.ts +0 -20
  367. /package/dist/cjs/{components → hooks}/overlay/OverlayStackStore.js +0 -0
  368. /package/dist/cjs/{components → hooks}/overlay/useOverlayStack.js +0 -0
  369. /package/dist/es/{components → hooks}/overlay/OverlayStackStore.js +0 -0
  370. /package/dist/es/{components → hooks}/overlay/useOverlayStack.js +0 -0
  371. /package/dist/types/{components → hooks}/overlay/OverlayStackStore.d.ts +0 -0
  372. /package/dist/types/{components → hooks}/overlay/useOverlayStack.d.ts +0 -0
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.default = void 0;
6
+ exports.toArrayValue = exports.prepareColumns = exports.normalizePicker = exports.findEnabledIndex = exports.default = void 0;
7
7
  exports.usePickerValue = usePickerValue;
8
8
  function _react() {
9
9
  const data = _interopRequireWildcard(require("react"));
@@ -22,12 +22,600 @@ function _reactNative() {
22
22
  var _loading = _interopRequireDefault(require("../loading"));
23
23
  var _color = require("../../utils/color");
24
24
  var _validate = require("../../utils/validate");
25
+ var _utils = require("../../utils");
25
26
  var _tokens = require("./tokens");
26
- var _WheelPicker = _interopRequireDefault(require("./WheelPicker"));
27
- var _utils = require("./utils");
28
27
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
29
28
  function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
30
29
  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); }
30
+ const toArrayValue = value => {
31
+ if (Array.isArray(value)) return value.filter(v => v !== undefined && v !== null);
32
+ if (value === undefined || value === null) return [];
33
+ return [value];
34
+ };
35
+ exports.toArrayValue = toArrayValue;
36
+ const isColumnWithOptions = col => !!col && (0, _utils.isObject)(col) && 'options' in col && Array.isArray(col.options);
37
+ const hasChildren = option => {
38
+ return !!option && (0, _utils.isObject)(option) && Array.isArray(option.children) && option.children.length > 0;
39
+ };
40
+ const findEnabledIndex = (options, startIndex) => {
41
+ if (!options.length) return -1;
42
+ const clampIndex = Math.min(Math.max(startIndex, 0), options.length - 1);
43
+ if (!options[clampIndex]?.disabled) return clampIndex;
44
+ for (let i = clampIndex + 1; i < options.length; i += 1) {
45
+ if (!options[i]?.disabled) return i;
46
+ }
47
+ for (let i = clampIndex - 1; i >= 0; i -= 1) {
48
+ if (!options[i]?.disabled) return i;
49
+ }
50
+ return -1;
51
+ };
52
+ exports.findEnabledIndex = findEnabledIndex;
53
+ const normalizeMultiple = (columnsList, defaults, rawValue) => {
54
+ const values = [];
55
+ const options = [];
56
+ columnsList.forEach((opts, index) => {
57
+ const current = rawValue[index];
58
+ const defaultIndex = defaults[index] !== undefined ? opts.findIndex(item => item.value === defaults[index]) : -1;
59
+ const currentIndex = opts.findIndex(item => item.value === current);
60
+ const startIndex = currentIndex >= 0 ? currentIndex : defaultIndex >= 0 ? defaultIndex : 0;
61
+ const targetIndex = findEnabledIndex(opts, startIndex);
62
+ const target = targetIndex >= 0 ? opts[targetIndex] : undefined;
63
+ const valid = currentIndex >= 0 && !opts[currentIndex]?.disabled;
64
+ values[index] = valid ? current : target?.value ?? defaults[index] ?? opts[0]?.value;
65
+ options[index] = target;
66
+ });
67
+ return {
68
+ columns: columnsList,
69
+ values,
70
+ options
71
+ };
72
+ };
73
+ const normalizeCascade = (rootOptions, rawValue) => {
74
+ const columns = [];
75
+ const values = [];
76
+ const options = [];
77
+ let currentOptions = rootOptions;
78
+ let depth = 0;
79
+ while (currentOptions && currentOptions.length && depth < 10) {
80
+ columns.push(currentOptions);
81
+ const current = rawValue[depth];
82
+ const startIndex = currentOptions.findIndex(item => item.value === current || String(item.value) === String(current));
83
+ const targetIndex = findEnabledIndex(currentOptions, startIndex >= 0 ? startIndex : 0);
84
+ const target = targetIndex >= 0 ? currentOptions[targetIndex] : currentOptions[0];
85
+ values[depth] = target?.value;
86
+ options[depth] = target;
87
+ if (target && hasChildren(target)) {
88
+ currentOptions = target.children;
89
+ depth += 1;
90
+ } else {
91
+ break;
92
+ }
93
+ }
94
+ return {
95
+ columns,
96
+ values,
97
+ options
98
+ };
99
+ };
100
+ const prepareColumns = (columnsInput = []) => {
101
+ if (!Array.isArray(columnsInput) || columnsInput.length === 0) {
102
+ return {
103
+ type: 'single',
104
+ columnsList: [],
105
+ defaults: [],
106
+ cascadeRoot: []
107
+ };
108
+ }
109
+ const everyPlainOption = columnsInput.every(item => !Array.isArray(item) && !isColumnWithOptions(item));
110
+ const cascade = everyPlainOption && columnsInput.some(item => hasChildren(item));
111
+ if (cascade) {
112
+ return {
113
+ type: 'cascade',
114
+ columnsList: [],
115
+ defaults: [],
116
+ cascadeRoot: columnsInput
117
+ };
118
+ }
119
+ const asArray = columnsInput;
120
+ const columnsList = [];
121
+ const defaults = [];
122
+ const treatAsSingleColumn = everyPlainOption && !cascade;
123
+ if (treatAsSingleColumn) {
124
+ columnsList.push(columnsInput);
125
+ defaults.push(undefined);
126
+ } else {
127
+ asArray.forEach(col => {
128
+ if (Array.isArray(col)) {
129
+ columnsList.push(col);
130
+ defaults.push(undefined);
131
+ } else if (isColumnWithOptions(col)) {
132
+ const c = col;
133
+ columnsList.push(c.options ?? []);
134
+ defaults.push(c.defaultValue);
135
+ }
136
+ });
137
+ }
138
+ return {
139
+ type: 'multiple',
140
+ columnsList,
141
+ defaults
142
+ };
143
+ };
144
+ exports.prepareColumns = prepareColumns;
145
+ const normalizePicker = (prepared, rawValueInput = []) => {
146
+ const rawValue = Array.isArray(rawValueInput) ? rawValueInput : [];
147
+ if (prepared.type === 'cascade' && prepared.cascadeRoot?.length) {
148
+ return normalizeCascade(prepared.cascadeRoot, rawValue);
149
+ }
150
+ return normalizeMultiple(prepared.columnsList, prepared.defaults, rawValue);
151
+ };
152
+ exports.normalizePicker = normalizePicker;
153
+ const wheelStyles = _reactNative().StyleSheet.create({
154
+ column: {
155
+ flex: 1
156
+ },
157
+ option: {
158
+ justifyContent: 'center',
159
+ alignItems: 'center'
160
+ },
161
+ indicator: {
162
+ position: 'absolute',
163
+ left: 0,
164
+ right: 0,
165
+ borderTopWidth: _reactNative().StyleSheet.hairlineWidth,
166
+ borderBottomWidth: _reactNative().StyleSheet.hairlineWidth,
167
+ zIndex: 3
168
+ }
169
+ });
170
+ const WheelPickerItemInner = ({
171
+ item,
172
+ index,
173
+ itemHeight,
174
+ active,
175
+ disabled,
176
+ renderItem
177
+ }) => {
178
+ const content = renderItem(item, index, {
179
+ active,
180
+ disabled
181
+ });
182
+ return /*#__PURE__*/_react().default.createElement(_reactNative().View, {
183
+ style: [wheelStyles.option, {
184
+ height: itemHeight
185
+ }]
186
+ }, content);
187
+ };
188
+ const WheelPickerItem = /*#__PURE__*/_react().default.memo(WheelPickerItemInner, (prev, next) => prev.item === next.item && prev.index === next.index && prev.itemHeight === next.itemHeight && prev.active === next.active && prev.disabled === next.disabled && prev.renderItem === next.renderItem);
189
+ const getVelocityBucket = velocity => {
190
+ const abs = Math.abs(velocity);
191
+ if (abs > 1.2) return 2;
192
+ if (abs > 0.6) return 1;
193
+ return 0;
194
+ };
195
+ const adjustIndex = (index, options) => {
196
+ const total = options.length;
197
+ if (!total) return 0;
198
+ const i = (0, _utils.clamp)(index, 0, total - 1);
199
+ const next = findEnabledIndex(options, i);
200
+ return next >= 0 ? next : i;
201
+ };
202
+ const indexToOffset = (index, itemHeight) => -index * itemHeight;
203
+ const offsetToIndex = (offset, itemHeight, total, options) => {
204
+ const minOffset = -Math.max(0, total - 1) * itemHeight;
205
+ const off = (0, _utils.clamp)(offset, minOffset, 0);
206
+ let index = Math.round(-off / itemHeight);
207
+ index = adjustIndex(index, options);
208
+ const snapOffset = indexToOffset(index, itemHeight);
209
+ return {
210
+ index,
211
+ snapOffset
212
+ };
213
+ };
214
+ const shouldMomentum = (distance, duration) => duration < 500 && Math.abs(distance) > 8;
215
+ const momentumTarget = (distance, duration, currentOffset, itemHeight, minOffset) => {
216
+ const speed = Math.abs(distance / duration);
217
+ const extra = speed / 0.0025 * (distance < 0 ? -1 : 1);
218
+ const target = (0, _utils.clamp)(currentOffset + extra, minOffset, 0);
219
+ const snapIndex = Math.round(-target / itemHeight);
220
+ return indexToOffset(snapIndex, itemHeight);
221
+ };
222
+ const WheelPickerInner = ({
223
+ data,
224
+ selectedIndex,
225
+ onChange,
226
+ onInteractStart,
227
+ onInteractEnd,
228
+ renderItem,
229
+ itemHeight,
230
+ visibleRest,
231
+ readOnly,
232
+ indicatorColor,
233
+ decelerationRate = _reactNative().Platform.select({
234
+ ios: 0.9985,
235
+ android: 0.995,
236
+ default: 0.995
237
+ }) ?? 'normal',
238
+ scrollEventThrottle = 16,
239
+ swipeDuration = 300
240
+ }) => {
241
+ const isWeb = _reactNative().Platform.OS === 'web';
242
+ const listRef = (0, _react().useRef)(null);
243
+ const scrollRef = (0, _react().useRef)(null);
244
+ const spacerHeight = visibleRest * itemHeight;
245
+ const total = data.length;
246
+ const maxIndex = Math.max(0, total - 1);
247
+ const minOffset = -maxIndex * itemHeight;
248
+ const containerHeight = itemHeight * (visibleRest * 2 + 1);
249
+ const rawSelectedIndex = (0, _utils.clamp)(selectedIndex, 0, maxIndex);
250
+ const enabledSelectedIndex = findEnabledIndex(data, rawSelectedIndex);
251
+ const safeSelectedIndex = enabledSelectedIndex >= 0 ? enabledSelectedIndex : rawSelectedIndex;
252
+ const visibleCount = visibleRest * 2 + 1;
253
+ const effectiveScrollThrottle = total > visibleCount * 20 ? 32 : scrollEventThrottle;
254
+ const webVirtualEnabled = total > visibleCount * 4;
255
+ const Spacer = (0, _react().useCallback)(() => /*#__PURE__*/_react().default.createElement(_reactNative().View, {
256
+ style: {
257
+ height: spacerHeight
258
+ }
259
+ }), [spacerHeight]);
260
+ const indicatorStyle = (0, _react().useMemo)(() => [wheelStyles.indicator, {
261
+ height: itemHeight,
262
+ top: itemHeight * visibleRest,
263
+ borderColor: indicatorColor
264
+ }], [itemHeight, visibleRest, indicatorColor]);
265
+ const dragEndTimerRef = (0, _react().useRef)(null);
266
+ const momentumRef = (0, _react().useRef)(false);
267
+ const lastOffsetRef = (0, _react().useRef)(0);
268
+ const clearDragEndTimer = (0, _react().useCallback)(() => {
269
+ if (dragEndTimerRef.current) {
270
+ clearTimeout(dragEndTimerRef.current);
271
+ dragEndTimerRef.current = null;
272
+ }
273
+ }, []);
274
+ const emitIndexFromOffset = (0, _react().useCallback)((offsetY, animated) => {
275
+ if (readOnly) return;
276
+ const {
277
+ index,
278
+ snapOffset
279
+ } = offsetToIndex(-offsetY, itemHeight, total, data);
280
+ const nextOffset = -snapOffset;
281
+ if (Math.abs(nextOffset - offsetY) > 0.5) {
282
+ listRef.current?.scrollToOffset({
283
+ offset: nextOffset,
284
+ animated
285
+ });
286
+ }
287
+ onChange(index);
288
+ }, [data, itemHeight, onChange, readOnly, total]);
289
+ (0, _react().useEffect)(() => {
290
+ const offset = safeSelectedIndex * itemHeight;
291
+ if (isWeb) return;
292
+ scrollRef.current?.scrollTo({
293
+ y: offset,
294
+ animated: false
295
+ });
296
+ }, [isWeb, itemHeight, safeSelectedIndex]);
297
+ const [webOffset, setWebOffset] = (0, _react().useState)(() => indexToOffset(safeSelectedIndex, itemHeight));
298
+ const webOffsetRef = (0, _react().useRef)(webOffset);
299
+ const startOffsetRef = (0, _react().useRef)(0);
300
+ const startTimeRef = (0, _react().useRef)(0);
301
+ const [webTransition, setWebTransition] = (0, _react().useState)(0);
302
+ const [webVelocityBucket, setWebVelocityBucket] = (0, _react().useState)(0);
303
+ const webVelocityBucketRef = (0, _react().useRef)(0);
304
+ const lastWheelTimeRef = (0, _react().useRef)(null);
305
+ const wheelDeltaRef = (0, _react().useRef)(0);
306
+ const wheelRafRef = (0, _react().useRef)(null);
307
+ const pendingIndexRef = (0, _react().useRef)(null);
308
+ const pendingTimerRef = (0, _react().useRef)(null);
309
+ const rafIdRef = (0, _react().useRef)(null);
310
+ const isInteractingRef = (0, _react().useRef)(false);
311
+ const notifyInteractStart = (0, _react().useCallback)(() => {
312
+ if (readOnly) return;
313
+ if (isInteractingRef.current) return;
314
+ isInteractingRef.current = true;
315
+ onInteractStart?.();
316
+ }, [onInteractStart, readOnly]);
317
+ const notifyInteractEnd = (0, _react().useCallback)(() => {
318
+ if (!isInteractingRef.current) return;
319
+ isInteractingRef.current = false;
320
+ onInteractEnd?.();
321
+ }, [onInteractEnd]);
322
+ const stopRaf = (0, _react().useCallback)(() => {
323
+ if (rafIdRef.current != null && typeof cancelAnimationFrame !== 'undefined') {
324
+ cancelAnimationFrame(rafIdRef.current);
325
+ rafIdRef.current = null;
326
+ }
327
+ if (wheelRafRef.current != null && typeof cancelAnimationFrame !== 'undefined') {
328
+ cancelAnimationFrame(wheelRafRef.current);
329
+ wheelRafRef.current = null;
330
+ }
331
+ }, []);
332
+ const clearPendingTimer = (0, _react().useCallback)(() => {
333
+ if (pendingTimerRef.current) {
334
+ clearTimeout(pendingTimerRef.current);
335
+ pendingTimerRef.current = null;
336
+ }
337
+ }, []);
338
+ (0, _react().useEffect)(() => {
339
+ return () => {
340
+ clearDragEndTimer();
341
+ clearPendingTimer();
342
+ stopRaf();
343
+ };
344
+ }, [clearDragEndTimer, clearPendingTimer, stopRaf]);
345
+ const setVelocityBucket = (0, _react().useCallback)(velocity => {
346
+ const next = getVelocityBucket(velocity);
347
+ if (next !== webVelocityBucketRef.current) {
348
+ webVelocityBucketRef.current = next;
349
+ setWebVelocityBucket(next);
350
+ }
351
+ }, []);
352
+ const updateWheelVelocity = (0, _react().useCallback)(delta => {
353
+ const now = Date.now();
354
+ const last = lastWheelTimeRef.current;
355
+ if (last != null) {
356
+ const dt = Math.max(1, now - last);
357
+ setVelocityBucket(delta / dt);
358
+ }
359
+ lastWheelTimeRef.current = now;
360
+ }, [setVelocityBucket]);
361
+ (0, _react().useEffect)(() => {
362
+ if (!isWeb) return;
363
+ clearPendingTimer();
364
+ pendingIndexRef.current = null;
365
+ setWebTransition(0);
366
+ const next = indexToOffset(safeSelectedIndex, itemHeight);
367
+ webOffsetRef.current = next;
368
+ setWebOffset(next);
369
+ }, [clearPendingTimer, isWeb, itemHeight, safeSelectedIndex, setWebTransition]);
370
+ const finalizePendingChange = (0, _react().useCallback)(() => {
371
+ if (readOnly) return;
372
+ const nextIndex = pendingIndexRef.current;
373
+ if (nextIndex == null) return;
374
+ pendingIndexRef.current = null;
375
+ clearPendingTimer();
376
+ setWebTransition(0);
377
+ notifyInteractEnd();
378
+ onChange(nextIndex);
379
+ }, [clearPendingTimer, onChange, readOnly, setWebTransition]);
380
+ const startWebSnap = (0, _react().useCallback)(targetIndex => {
381
+ if (readOnly) return;
382
+ notifyInteractStart();
383
+ const clampedIndex = (0, _utils.clamp)(targetIndex, 0, maxIndex);
384
+ const targetOffset = indexToOffset(clampedIndex, itemHeight);
385
+ clearPendingTimer();
386
+ pendingIndexRef.current = clampedIndex;
387
+ webOffsetRef.current = targetOffset;
388
+ setWebTransition(swipeDuration);
389
+ setWebOffset(targetOffset);
390
+ if (swipeDuration <= 0) {
391
+ finalizePendingChange();
392
+ } else {
393
+ pendingTimerRef.current = setTimeout(finalizePendingChange, swipeDuration + 80);
394
+ }
395
+ }, [clearPendingTimer, finalizePendingChange, itemHeight, maxIndex, readOnly, swipeDuration]);
396
+ const handleWheel = (0, _react().useCallback)(event => {
397
+ if (readOnly) return;
398
+ const delta = event.nativeEvent?.deltaY ?? 0;
399
+ if (!delta) return;
400
+ wheelDeltaRef.current += delta;
401
+ if (wheelRafRef.current != null || typeof requestAnimationFrame === 'undefined') {
402
+ return;
403
+ }
404
+ wheelRafRef.current = requestAnimationFrame(() => {
405
+ wheelRafRef.current = null;
406
+ const queued = wheelDeltaRef.current;
407
+ wheelDeltaRef.current = 0;
408
+ if (!queued) return;
409
+ updateWheelVelocity(queued);
410
+ const direction = queued > 0 ? 1 : -1;
411
+ const {
412
+ index
413
+ } = offsetToIndex(webOffsetRef.current, itemHeight, total, data);
414
+ const nextIndex = (0, _utils.clamp)(index + direction, 0, maxIndex);
415
+ startWebSnap(nextIndex);
416
+ });
417
+ }, [data, itemHeight, maxIndex, readOnly, startWebSnap, total, updateWheelVelocity]);
418
+ const webIndex = (0, _utils.clamp)(Math.round(-webOffset / itemHeight), 0, maxIndex);
419
+ const webRender = (0, _react().useMemo)(() => {
420
+ if (!isWeb || total <= 0) {
421
+ return {
422
+ items: null,
423
+ topSpacer: null,
424
+ bottomSpacer: null
425
+ };
426
+ }
427
+ let startIndex = 0;
428
+ let endIndex = maxIndex;
429
+ if (webVirtualEnabled) {
430
+ const baseBuffer = Math.max(visibleCount * 2, 8);
431
+ const velocityBoost = webVelocityBucket === 2 ? visibleCount * 4 : webVelocityBucket === 1 ? visibleCount * 2 : 0;
432
+ const buffer = Math.min(baseBuffer + velocityBoost, Math.max(visibleCount * 6, 24));
433
+ startIndex = (0, _utils.clamp)(webIndex - buffer, 0, maxIndex);
434
+ endIndex = (0, _utils.clamp)(webIndex + buffer, 0, maxIndex);
435
+ }
436
+ const items = [];
437
+ for (let index = startIndex; index <= endIndex; index += 1) {
438
+ const item = data[index];
439
+ if (!item) continue;
440
+ items.push(/*#__PURE__*/_react().default.createElement(WheelPickerItem, {
441
+ key: `${index}-${String(item.value ?? '')}`,
442
+ item: item,
443
+ index: index,
444
+ itemHeight: itemHeight,
445
+ active: index === safeSelectedIndex,
446
+ disabled: !!item.disabled,
447
+ renderItem: renderItem
448
+ }));
449
+ }
450
+ const topHeight = startIndex * itemHeight;
451
+ const bottomHeight = (maxIndex - endIndex) * itemHeight;
452
+ return {
453
+ items,
454
+ topSpacer: topHeight > 0 && /*#__PURE__*/_react().default.createElement(_reactNative().View, {
455
+ style: {
456
+ height: topHeight
457
+ }
458
+ }),
459
+ bottomSpacer: bottomHeight > 0 && /*#__PURE__*/_react().default.createElement(_reactNative().View, {
460
+ style: {
461
+ height: bottomHeight
462
+ }
463
+ })
464
+ };
465
+ }, [data, isWeb, itemHeight, maxIndex, renderItem, safeSelectedIndex, total, visibleCount, webIndex, webVelocityBucket, webVirtualEnabled]);
466
+ const webTransform = (0, _react().useMemo)(() => ({
467
+ transform: [{
468
+ translateY: webOffset
469
+ }]
470
+ }), [webOffset]);
471
+ const webTransitionStyle = (0, _react().useMemo)(() => webTransition ? {
472
+ transitionProperty: 'transform',
473
+ transitionDuration: `${webTransition}ms`,
474
+ transitionTimingFunction: 'cubic-bezier(0.23, 1, 0.68, 1)',
475
+ willChange: 'transform'
476
+ } : undefined, [webTransition]);
477
+ const handleWebTransitionEnd = (0, _react().useCallback)(event => {
478
+ const propertyName = event.nativeEvent?.propertyName ?? event.propertyName;
479
+ if (propertyName && propertyName !== 'transform' && propertyName !== 'webkitTransform') return;
480
+ finalizePendingChange();
481
+ }, [finalizePendingChange]);
482
+ const panResponder = (0, _react().useMemo)(() => _reactNative().PanResponder.create({
483
+ onStartShouldSetPanResponder: () => !readOnly,
484
+ onMoveShouldSetPanResponder: () => !readOnly,
485
+ onPanResponderGrant: () => {
486
+ stopRaf();
487
+ pendingIndexRef.current = null;
488
+ notifyInteractStart();
489
+ setWebTransition(0);
490
+ startOffsetRef.current = webOffsetRef.current;
491
+ startTimeRef.current = Date.now();
492
+ },
493
+ onPanResponderMove: (_, gesture) => {
494
+ if (readOnly) return;
495
+ setVelocityBucket(gesture.vy);
496
+ const next = (0, _utils.clamp)(startOffsetRef.current + gesture.dy, minOffset, 0);
497
+ webOffsetRef.current = next;
498
+ if (typeof requestAnimationFrame === 'undefined') {
499
+ setWebOffset(next);
500
+ return;
501
+ }
502
+ if (rafIdRef.current != null) return;
503
+ rafIdRef.current = requestAnimationFrame(() => {
504
+ rafIdRef.current = null;
505
+ setWebOffset(webOffsetRef.current);
506
+ });
507
+ },
508
+ onPanResponderRelease: (_, gesture) => {
509
+ if (readOnly) return;
510
+ setVelocityBucket(0);
511
+ const duration = Date.now() - startTimeRef.current;
512
+ const distance = gesture.dy;
513
+ let target = (0, _utils.clamp)(startOffsetRef.current + distance, minOffset, 0);
514
+ if (shouldMomentum(distance, duration)) {
515
+ target = momentumTarget(distance, duration, startOffsetRef.current, itemHeight, minOffset);
516
+ }
517
+ const {
518
+ index
519
+ } = offsetToIndex(target, itemHeight, total, data);
520
+ startWebSnap(index);
521
+ },
522
+ onPanResponderTerminationRequest: () => false,
523
+ onPanResponderTerminate: () => {
524
+ notifyInteractEnd();
525
+ setWebTransition(0);
526
+ }
527
+ }), [data, itemHeight, minOffset, notifyInteractEnd, notifyInteractStart, readOnly, setVelocityBucket, startWebSnap, stopRaf, total]);
528
+ if (isWeb) {
529
+ return /*#__PURE__*/_react().default.createElement(_reactNative().View, _extends({
530
+ style: [wheelStyles.column, {
531
+ height: containerHeight
532
+ }, webOnlyStyles.grab],
533
+ onWheel: handleWheel
534
+ }, panResponder.panHandlers), /*#__PURE__*/_react().default.createElement(_reactNative().View, {
535
+ style: indicatorStyle,
536
+ pointerEvents: "none"
537
+ }), /*#__PURE__*/_react().default.createElement(_reactNative().View, {
538
+ style: [webTransform, isWeb ? webTransitionStyle : undefined],
539
+ onTransitionEnd: handleWebTransitionEnd
540
+ }, /*#__PURE__*/_react().default.createElement(Spacer, null), webRender.topSpacer, webRender.items, webRender.bottomSpacer, /*#__PURE__*/_react().default.createElement(Spacer, null)));
541
+ }
542
+ const shouldCapture = !readOnly;
543
+ const contentContainerStyle = (0, _react().useMemo)(() => ({
544
+ paddingVertical: spacerHeight
545
+ }), [spacerHeight]);
546
+ return /*#__PURE__*/_react().default.createElement(_reactNative().View, {
547
+ style: [wheelStyles.column, {
548
+ height: containerHeight
549
+ }],
550
+ collapsable: false
551
+ }, /*#__PURE__*/_react().default.createElement(_reactNative().View, {
552
+ style: indicatorStyle,
553
+ pointerEvents: "none"
554
+ }), /*#__PURE__*/_react().default.createElement(_reactNative().ScrollView, {
555
+ ref: scrollRef,
556
+ showsVerticalScrollIndicator: false,
557
+ scrollEventThrottle: effectiveScrollThrottle,
558
+ decelerationRate: decelerationRate,
559
+ snapToInterval: itemHeight,
560
+ snapToAlignment: "start",
561
+ bounces: false,
562
+ overScrollMode: "never",
563
+ nestedScrollEnabled: true,
564
+ contentContainerStyle: contentContainerStyle,
565
+ onStartShouldSetResponderCapture: () => shouldCapture,
566
+ onMoveShouldSetResponderCapture: () => shouldCapture,
567
+ onScroll: e => {
568
+ lastOffsetRef.current = e.nativeEvent.contentOffset.y;
569
+ },
570
+ onScrollBeginDrag: () => {
571
+ momentumRef.current = false;
572
+ clearDragEndTimer();
573
+ notifyInteractStart();
574
+ },
575
+ onScrollEndDrag: e => {
576
+ if (readOnly) return;
577
+ const y = e.nativeEvent.contentOffset.y;
578
+ lastOffsetRef.current = y;
579
+ clearDragEndTimer();
580
+ dragEndTimerRef.current = setTimeout(() => {
581
+ if (!momentumRef.current) {
582
+ emitIndexFromOffset(lastOffsetRef.current, true);
583
+ notifyInteractEnd();
584
+ }
585
+ }, 80);
586
+ },
587
+ onMomentumScrollBegin: () => {
588
+ momentumRef.current = true;
589
+ clearDragEndTimer();
590
+ notifyInteractStart();
591
+ },
592
+ onMomentumScrollEnd: e => {
593
+ momentumRef.current = false;
594
+ clearDragEndTimer();
595
+ const y = e.nativeEvent.contentOffset.y;
596
+ lastOffsetRef.current = y;
597
+ emitIndexFromOffset(y, false);
598
+ notifyInteractEnd();
599
+ },
600
+ scrollEnabled: !readOnly
601
+ }, data.map((item, index) => /*#__PURE__*/_react().default.createElement(WheelPickerItem, {
602
+ key: `${index}-${String(item.value ?? '')}`,
603
+ item: item,
604
+ index: index,
605
+ itemHeight: itemHeight,
606
+ active: index === safeSelectedIndex,
607
+ disabled: !!item.disabled,
608
+ renderItem: renderItem
609
+ }))));
610
+ };
611
+ const WheelPicker = /*#__PURE__*/_react().default.memo(WheelPickerInner);
612
+ const webOnlyStyles = _reactNative().StyleSheet.create({
613
+ grab: {
614
+ cursor: 'pointer',
615
+ userSelect: 'none',
616
+ touchAction: 'none'
617
+ }
618
+ });
31
619
  function usePickerValue({
32
620
  columns,
33
621
  valueProp,
@@ -36,11 +624,11 @@ function usePickerValue({
36
624
  onChange,
37
625
  onConfirm
38
626
  }) {
39
- const preparedColumns = (0, _utils.prepareColumns)(columns);
627
+ const preparedColumns = (0, _react().useMemo)(() => prepareColumns(columns), [columns]);
40
628
  const isControlled = valueProp !== undefined;
41
629
  const [innerValue, setInnerValue] = (0, _react().useState)(() => {
42
- const initial = (0, _utils.toArrayValue)(valueProp ?? defaultValue);
43
- return (0, _utils.normalizePicker)(preparedColumns, initial).values;
630
+ const initial = toArrayValue(valueProp ?? defaultValue);
631
+ return normalizePicker(preparedColumns, initial).values;
44
632
  });
45
633
  const innerValueRef = (0, _react().useRef)(innerValue);
46
634
  const commitValue = (0, _react().useCallback)(next => {
@@ -49,12 +637,12 @@ function usePickerValue({
49
637
  }, []);
50
638
  (0, _react().useEffect)(() => {
51
639
  if (!isControlled) return;
52
- const next = (0, _utils.toArrayValue)(valueProp);
640
+ const next = toArrayValue(valueProp);
53
641
  if (!(0, _utils.shallowEqualArray)(innerValueRef.current, next)) {
54
642
  commitValue(next);
55
643
  }
56
644
  }, [commitValue, isControlled, valueProp]);
57
- const normalized = (0, _utils.normalizePicker)(preparedColumns, innerValue);
645
+ const normalized = (0, _react().useMemo)(() => normalizePicker(preparedColumns, innerValue), [preparedColumns, innerValue]);
58
646
  (0, _react().useEffect)(() => {
59
647
  if (isControlled) return;
60
648
  if (!(0, _utils.shallowEqualArray)(innerValue, normalized.values)) {
@@ -71,7 +659,7 @@ function usePickerValue({
71
659
  if (preparedColumns.type === 'cascade') {
72
660
  next.length = columnIndex + 1;
73
661
  }
74
- const final = (0, _utils.normalizePicker)(preparedColumns, next);
662
+ const final = normalizePicker(preparedColumns, next);
75
663
  if ((0, _utils.shallowEqualArray)(innerValueRef.current, final.values)) return;
76
664
  commitValue(final.values);
77
665
  onChange?.(final.values, final.options);
@@ -80,6 +668,7 @@ function usePickerValue({
80
668
  onConfirm?.(normalized.values, normalized.options);
81
669
  }, [normalized, onConfirm]);
82
670
  return {
671
+ preparedColumns,
83
672
  normalized,
84
673
  handleSelect,
85
674
  handleConfirm
@@ -90,7 +679,7 @@ const getVisibleCount = count => {
90
679
  return normalized % 2 === 0 ? normalized + 1 : normalized;
91
680
  };
92
681
  const GRADIENT_OVERLAY_ALPHA = 0.25;
93
- const GRADIENT_STEPS = [0.98, 0.9075, 0.835, 0.7625, 0.69, 0.6175, 0.545, 0.4725, 0.4];
682
+ const GRADIENT_STEPS = [0.95, 0.75, 0.55, 0.35];
94
683
  const GRADIENT_STEPS_REVERSED = [...GRADIENT_STEPS].reverse();
95
684
  const GradientMask = ({
96
685
  height,
@@ -99,14 +688,14 @@ const GradientMask = ({
99
688
  maskType
100
689
  }) => {
101
690
  const isWeb = _reactNative().Platform.OS === 'web';
102
- const baseStyle = [styles.gradientMask, {
691
+ const baseStyle = (0, _react().useMemo)(() => [styles.gradientMask, {
103
692
  height
104
693
  }, position === 'top' ? {
105
694
  top: 0
106
695
  } : {
107
696
  bottom: 0
108
- }];
109
- const overlayColor = (0, _color.withAlpha)(color, GRADIENT_OVERLAY_ALPHA);
697
+ }], [height, position]);
698
+ const overlayColor = (0, _react().useMemo)(() => (0, _color.withAlpha)(color, GRADIENT_OVERLAY_ALPHA), [color]);
110
699
  if (maskType === 'solid') {
111
700
  return /*#__PURE__*/_react().default.createElement(_reactNative().View, {
112
701
  pointerEvents: "none",
@@ -141,17 +730,6 @@ const GradientMask = ({
141
730
  }
142
731
  })));
143
732
  };
144
- const isCascadeColumns = columns => {
145
- if (!Array.isArray(columns) || columns.length === 0) return false;
146
- const first = columns[0];
147
- if (Array.isArray(first)) return false;
148
- if ((0, _validate.isObject)(first) && 'options' in first) return false;
149
- return columns.some(option => {
150
- if (!(0, _validate.isObject)(option)) return false;
151
- const children = option.children;
152
- return Array.isArray(children) && children.length > 0;
153
- });
154
- };
155
733
  const PickerColumn = /*#__PURE__*/_react().default.memo(props => {
156
734
  const {
157
735
  columnIndex,
@@ -170,13 +748,15 @@ const PickerColumn = /*#__PURE__*/_react().default.memo(props => {
170
748
  swipeDuration
171
749
  } = props;
172
750
  const restVisible = Math.max(1, Math.floor((visibleItemCount - 1) / 2));
173
- const selectedIndex = (() => {
751
+ const valueIndexMap = (0, _react().useMemo)(() => new Map(options.map((option, idx) => [option.value, idx])), [options]);
752
+ const selectedIndex = (0, _react().useMemo)(() => {
174
753
  if (!options.length) return 0;
175
- const idx = options.findIndex(option => option.value === value);
176
- return (0, _utils.findEnabledIndex)(options, idx >= 0 ? idx : 0);
177
- })();
754
+ const idx = valueIndexMap.get(value);
755
+ const startIndex = typeof idx === 'number' && idx >= 0 ? idx : 0;
756
+ return findEnabledIndex(options, startIndex);
757
+ }, [options, value, valueIndexMap]);
178
758
  const handleChange = (0, _react().useCallback)(index => {
179
- const target = (0, _utils.findEnabledIndex)(options, index);
759
+ const target = findEnabledIndex(options, index);
180
760
  const option = options[target];
181
761
  if (!option || option.disabled) return;
182
762
  onSelect(option, columnIndex, target);
@@ -185,7 +765,7 @@ const PickerColumn = /*#__PURE__*/_react().default.memo(props => {
185
765
  style: [styles.column, {
186
766
  height: itemHeight * visibleItemCount
187
767
  }]
188
- }, /*#__PURE__*/_react().default.createElement(_WheelPicker.default, {
768
+ }, /*#__PURE__*/_react().default.createElement(WheelPicker, {
189
769
  data: options,
190
770
  itemHeight: itemHeight,
191
771
  visibleRest: restVisible,
@@ -196,10 +776,9 @@ const PickerColumn = /*#__PURE__*/_react().default.memo(props => {
196
776
  decelerationRate: decelerationRate,
197
777
  scrollEventThrottle: scrollEventThrottle,
198
778
  swipeDuration: swipeDuration,
199
- renderItem: item => {
200
- if (!item) return null;
201
- const active = item.value === value;
202
- const disabled = !!item.disabled;
779
+ renderItem: (item, _index, meta) => {
780
+ const active = meta?.active ?? false;
781
+ const disabled = meta?.disabled ?? false;
203
782
  const textColor = disabled ? tokens.colors.textDisabled : active ? tokens.colors.text : tokens.colors.textMuted;
204
783
  const content = optionRender ? optionRender(item, {
205
784
  columnIndex,
@@ -252,8 +831,8 @@ const Picker = props => {
252
831
  loading = false,
253
832
  readOnly = false,
254
833
  decelerationRate = _reactNative().Platform.select({
255
- ios: 0.9975,
256
- android: 0.989,
834
+ ios: 0.999,
835
+ android: 0.997,
257
836
  default: 0.989
258
837
  }) ?? 'normal',
259
838
  swipeDuration = tokens.defaults.swipeDuration,
@@ -274,11 +853,11 @@ const Picker = props => {
274
853
  ...rest
275
854
  } = props;
276
855
  const visibleItemCount = getVisibleCount(visibleItemCountProp ?? tokens.defaults.visibleItemCount);
277
- const isCascade = isCascadeColumns(columns);
278
856
  const {
279
857
  normalized,
280
858
  handleSelect,
281
- handleConfirm
859
+ handleConfirm,
860
+ preparedColumns
282
861
  } = usePickerValue({
283
862
  columns,
284
863
  valueProp,
@@ -287,6 +866,7 @@ const Picker = props => {
287
866
  onChange,
288
867
  onConfirm
289
868
  });
869
+ const isCascade = preparedColumns.type === 'cascade';
290
870
  const renderActionContent = (content, color) => {
291
871
  if (/*#__PURE__*/_react().default.isValidElement(content)) return /*#__PURE__*/_react().default.createElement(_reactNative().View, {
292
872
  style: {