react-native-system-ui 1.0.2 → 1.0.3

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 (496) hide show
  1. package/README.md +42 -22
  2. package/dist/cjs/components/action-sheet/ActionSheet.js +1 -301
  3. package/dist/cjs/components/action-sheet/index.js +1 -16
  4. package/dist/cjs/components/action-sheet/tokens.js +1 -133
  5. package/dist/cjs/components/area/Area.js +1 -127
  6. package/dist/cjs/components/area/index.js +1 -9
  7. package/dist/cjs/components/area/tokens.js +1 -14
  8. package/dist/cjs/components/avatar/Avatar.js +1 -125
  9. package/dist/cjs/components/avatar/index.js +1 -18
  10. package/dist/cjs/components/avatar/tokens.js +1 -56
  11. package/dist/cjs/components/badge/Badge.js +1 -166
  12. package/dist/cjs/components/badge/index.js +1 -8
  13. package/dist/cjs/components/badge/tokens.js +1 -81
  14. package/dist/cjs/components/button/Button.js +1 -203
  15. package/dist/cjs/components/button/ButtonContext.js +1 -12
  16. package/dist/cjs/components/button/ButtonGroup.js +1 -65
  17. package/dist/cjs/components/button/index.js +1 -12
  18. package/dist/cjs/components/button/tokens.js +1 -176
  19. package/dist/cjs/components/calendar/Calendar.js +1 -452
  20. package/dist/cjs/components/calendar/index.js +1 -9
  21. package/dist/cjs/components/calendar/tokens.js +1 -129
  22. package/dist/cjs/components/cascader/Cascader.js +1 -482
  23. package/dist/cjs/components/cascader/index.js +1 -15
  24. package/dist/cjs/components/cascader/tokens.js +1 -138
  25. package/dist/cjs/components/cascader/useCascaderExtend.js +1 -39
  26. package/dist/cjs/components/cell/Cell.js +1 -181
  27. package/dist/cjs/components/cell/CellContext.js +1 -19
  28. package/dist/cjs/components/cell/CellGroup.js +1 -100
  29. package/dist/cjs/components/cell/index.js +1 -19
  30. package/dist/cjs/components/cell/tokens.js +1 -173
  31. package/dist/cjs/components/checkbox/Checkbox.js +1 -251
  32. package/dist/cjs/components/checkbox/CheckboxContext.js +1 -12
  33. package/dist/cjs/components/checkbox/CheckboxGroup.js +1 -148
  34. package/dist/cjs/components/checkbox/index.js +1 -16
  35. package/dist/cjs/components/checkbox/tokens.js +1 -97
  36. package/dist/cjs/components/circle/Circle.js +1 -212
  37. package/dist/cjs/components/circle/index.js +1 -9
  38. package/dist/cjs/components/circle/tokens.js +1 -55
  39. package/dist/cjs/components/collapse/Collapse.js +1 -311
  40. package/dist/cjs/components/collapse/index.js +1 -8
  41. package/dist/cjs/components/collapse/tokens.js +1 -81
  42. package/dist/cjs/components/config-provider/ConfigProvider.js +1 -44
  43. package/dist/cjs/components/config-provider/DirectionContext.js +1 -15
  44. package/dist/cjs/components/config-provider/LocaleContext.js +1 -16
  45. package/dist/cjs/components/config-provider/index.js +1 -40
  46. package/dist/cjs/components/config-provider/locale/en-US.js +1 -112
  47. package/dist/cjs/components/config-provider/locale/zh-CN.js +1 -112
  48. package/dist/cjs/components/config-provider/tokens.js +1 -11
  49. package/dist/cjs/components/config-provider/useDirection.js +1 -16
  50. package/dist/cjs/components/config-provider/useLocale.js +1 -16
  51. package/dist/cjs/components/count-down/CountDown.js +1 -88
  52. package/dist/cjs/components/count-down/index.js +1 -15
  53. package/dist/cjs/components/count-down/tokens.js +1 -34
  54. package/dist/cjs/components/datetime-picker/DatetimePicker.js +1 -319
  55. package/dist/cjs/components/datetime-picker/index.js +1 -9
  56. package/dist/cjs/components/datetime-picker/tokens.js +1 -22
  57. package/dist/cjs/components/dialog/Dialog.js +1 -433
  58. package/dist/cjs/components/dialog/imperative.js +1 -199
  59. package/dist/cjs/components/dialog/index.js +1 -23
  60. package/dist/cjs/components/dialog/tokens.js +1 -64
  61. package/dist/cjs/components/divider/Divider.js +1 -126
  62. package/dist/cjs/components/divider/index.js +1 -8
  63. package/dist/cjs/components/divider/tokens.js +1 -62
  64. package/dist/cjs/components/empty/Empty.js +1 -125
  65. package/dist/cjs/components/empty/index.js +1 -8
  66. package/dist/cjs/components/empty/tokens.js +1 -55
  67. package/dist/cjs/components/error-boundary/ErrorBoundary.js +1 -74
  68. package/dist/cjs/components/error-boundary/index.js +1 -19
  69. package/dist/cjs/components/field/Field.js +1 -565
  70. package/dist/cjs/components/field/index.js +1 -29
  71. package/dist/cjs/components/field/tokens.js +1 -150
  72. package/dist/cjs/components/flex/Flex.js +1 -85
  73. package/dist/cjs/components/flex/FlexContext.js +1 -12
  74. package/dist/cjs/components/flex/FlexItem.js +1 -95
  75. package/dist/cjs/components/flex/index.js +1 -19
  76. package/dist/cjs/components/flex/tokens.js +1 -21
  77. package/dist/cjs/components/form/Form.js +1 -340
  78. package/dist/cjs/components/form/FormContext.js +1 -12
  79. package/dist/cjs/components/form/FormItem.js +1 -151
  80. package/dist/cjs/components/form/FormList.js +1 -95
  81. package/dist/cjs/components/form/index.js +1 -50
  82. package/dist/cjs/components/form/tokens.js +1 -14
  83. package/dist/cjs/components/form/utils.js +1 -56
  84. package/dist/cjs/components/grid/Grid.js +1 -118
  85. package/dist/cjs/components/grid/GridContext.js +1 -12
  86. package/dist/cjs/components/grid/GridItem.js +1 -158
  87. package/dist/cjs/components/grid/index.js +1 -12
  88. package/dist/cjs/components/grid/tokens.js +1 -105
  89. package/dist/cjs/components/image/Image.js +1 -263
  90. package/dist/cjs/components/image/index.js +1 -16
  91. package/dist/cjs/components/image/tokens.js +1 -66
  92. package/dist/cjs/components/image-preview/ImagePreview.js +1 -408
  93. package/dist/cjs/components/image-preview/imperative.js +1 -72
  94. package/dist/cjs/components/image-preview/index.js +1 -17
  95. package/dist/cjs/components/image-preview/tokens.js +1 -43
  96. package/dist/cjs/components/index.js +1 -769
  97. package/dist/cjs/components/input/Input.js +1 -122
  98. package/dist/cjs/components/input/index.js +1 -15
  99. package/dist/cjs/components/input/tokens.js +1 -22
  100. package/dist/cjs/components/loading/Loading.js +1 -76
  101. package/dist/cjs/components/loading/index.js +1 -8
  102. package/dist/cjs/components/loading/tokens.js +1 -32
  103. package/dist/cjs/components/nav-bar/NavBar.js +1 -196
  104. package/dist/cjs/components/nav-bar/index.js +1 -16
  105. package/dist/cjs/components/nav-bar/tokens.js +1 -90
  106. package/dist/cjs/components/notice-bar/NoticeBar.js +1 -369
  107. package/dist/cjs/components/notice-bar/index.js +1 -8
  108. package/dist/cjs/components/notice-bar/tokens.js +1 -39
  109. package/dist/cjs/components/notify/Notify.js +1 -262
  110. package/dist/cjs/components/notify/imperative.js +1 -145
  111. package/dist/cjs/components/notify/index.js +1 -10
  112. package/dist/cjs/components/notify/tokens.js +1 -74
  113. package/dist/cjs/components/number-keyboard/NumberKeyboard.js +1 -487
  114. package/dist/cjs/components/number-keyboard/index.js +1 -15
  115. package/dist/cjs/components/number-keyboard/tokens.js +1 -59
  116. package/dist/cjs/components/overlay/Overlay.js +1 -81
  117. package/dist/cjs/components/overlay/index.js +1 -28
  118. package/dist/cjs/components/overlay/tokens.js +1 -13
  119. package/dist/cjs/components/password-input/PasswordInput.js +1 -346
  120. package/dist/cjs/components/password-input/index.js +1 -13
  121. package/dist/cjs/components/password-input/tokens.js +1 -53
  122. package/dist/cjs/components/picker/Picker.js +1 -1056
  123. package/dist/cjs/components/picker/index.js +1 -15
  124. package/dist/cjs/components/picker/tokens.js +1 -53
  125. package/dist/cjs/components/popup/Popup.js +1 -518
  126. package/dist/cjs/components/popup/index.js +1 -15
  127. package/dist/cjs/components/popup/tokens.js +1 -62
  128. package/dist/cjs/components/portal/Portal.js +1 -50
  129. package/dist/cjs/components/portal/PortalContext.js +1 -15
  130. package/dist/cjs/components/portal/PortalHost.js +1 -253
  131. package/dist/cjs/components/portal/index.js +1 -25
  132. package/dist/cjs/components/portal/tokens.js +1 -11
  133. package/dist/cjs/components/progress/Progress.js +1 -216
  134. package/dist/cjs/components/progress/index.js +1 -14
  135. package/dist/cjs/components/progress/tokens.js +1 -52
  136. package/dist/cjs/components/radio/Radio.js +1 -245
  137. package/dist/cjs/components/radio/RadioContext.js +1 -12
  138. package/dist/cjs/components/radio/RadioGroup.js +1 -113
  139. package/dist/cjs/components/radio/index.js +1 -16
  140. package/dist/cjs/components/radio/tokens.js +1 -92
  141. package/dist/cjs/components/safe-area-view/SafeAreaView.js +1 -59
  142. package/dist/cjs/components/safe-area-view/index.js +1 -12
  143. package/dist/cjs/components/safe-area-view/tokens.js +1 -11
  144. package/dist/cjs/components/search/Search.js +1 -215
  145. package/dist/cjs/components/search/index.js +1 -15
  146. package/dist/cjs/components/search/tokens.js +1 -54
  147. package/dist/cjs/components/selector/Selector.js +1 -185
  148. package/dist/cjs/components/selector/index.js +1 -15
  149. package/dist/cjs/components/selector/tokens.js +1 -100
  150. package/dist/cjs/components/share-sheet/ShareSheet.js +1 -287
  151. package/dist/cjs/components/share-sheet/index.js +1 -16
  152. package/dist/cjs/components/share-sheet/tokens.js +1 -55
  153. package/dist/cjs/components/sidebar/Sidebar.js +1 -103
  154. package/dist/cjs/components/sidebar/SidebarContext.js +1 -17
  155. package/dist/cjs/components/sidebar/SidebarItem.js +1 -103
  156. package/dist/cjs/components/sidebar/index.js +1 -26
  157. package/dist/cjs/components/sidebar/tokens.js +1 -93
  158. package/dist/cjs/components/skeleton/Skeleton.js +1 -162
  159. package/dist/cjs/components/skeleton/index.js +1 -22
  160. package/dist/cjs/components/skeleton/tokens.js +1 -39
  161. package/dist/cjs/components/slider/Slider.js +1 -633
  162. package/dist/cjs/components/slider/index.js +1 -8
  163. package/dist/cjs/components/slider/tokens.js +1 -37
  164. package/dist/cjs/components/space/Space.js +1 -134
  165. package/dist/cjs/components/space/index.js +1 -18
  166. package/dist/cjs/components/space/tokens.js +1 -39
  167. package/dist/cjs/components/stepper/Stepper.js +1 -484
  168. package/dist/cjs/components/stepper/index.js +1 -15
  169. package/dist/cjs/components/stepper/tokens.js +1 -60
  170. package/dist/cjs/components/swiper/Swiper.js +1 -364
  171. package/dist/cjs/components/swiper/SwiperItem.js +1 -12
  172. package/dist/cjs/components/swiper/SwiperPagIndicator.js +1 -106
  173. package/dist/cjs/components/swiper/index.js +1 -40
  174. package/dist/cjs/components/swiper/tokens.js +1 -18
  175. package/dist/cjs/components/switch/Switch.js +1 -102
  176. package/dist/cjs/components/switch/index.js +1 -15
  177. package/dist/cjs/components/switch/tokens.js +1 -31
  178. package/dist/cjs/components/tabbar/Tabbar.js +1 -149
  179. package/dist/cjs/components/tabbar/TabbarContext.js +1 -17
  180. package/dist/cjs/components/tabbar/TabbarItem.js +1 -159
  181. package/dist/cjs/components/tabbar/index.js +1 -25
  182. package/dist/cjs/components/tabbar/tokens.js +1 -41
  183. package/dist/cjs/components/tabs/Tabs.js +1 -860
  184. package/dist/cjs/components/tabs/index.js +1 -25
  185. package/dist/cjs/components/tabs/tokens.js +1 -111
  186. package/dist/cjs/components/tag/Tag.js +1 -130
  187. package/dist/cjs/components/tag/index.js +1 -8
  188. package/dist/cjs/components/tag/tokens.js +1 -104
  189. package/dist/cjs/components/toast/Toast.js +1 -306
  190. package/dist/cjs/components/toast/imperative.js +1 -144
  191. package/dist/cjs/components/toast/index.js +1 -10
  192. package/dist/cjs/components/toast/tokens.js +1 -43
  193. package/dist/cjs/components/typography/Typography.js +1 -181
  194. package/dist/cjs/components/typography/index.js +1 -9
  195. package/dist/cjs/components/typography/tokens.js +1 -88
  196. package/dist/cjs/components/water-mark/WaterMark.js +1 -172
  197. package/dist/cjs/components/water-mark/index.js +1 -22
  198. package/dist/cjs/components/water-mark/tokens.js +1 -54
  199. package/dist/cjs/design-system/Text.js +1 -38
  200. package/dist/cjs/design-system/ThemeContext.js +1 -19
  201. package/dist/cjs/design-system/ThemeProvider.js +1 -31
  202. package/dist/cjs/design-system/createComponentTokensHook.js +1 -28
  203. package/dist/cjs/design-system/index.js +1 -66
  204. package/dist/cjs/design-system/mergeTokensOverride.js +1 -9
  205. package/dist/cjs/design-system/presets.js +1 -146
  206. package/dist/cjs/design-system/tokens.js +1 -135
  207. package/dist/cjs/design-system/useTheme.js +1 -16
  208. package/dist/cjs/hooks/animation/index.js +1 -25
  209. package/dist/cjs/hooks/animation/useAnimatedTransition.js +1 -72
  210. package/dist/cjs/hooks/animation/useReducedMotion.js +1 -75
  211. package/dist/cjs/hooks/aria/index.js +1 -49
  212. package/dist/cjs/hooks/aria/useAriaListBox.js +1 -50
  213. package/dist/cjs/hooks/aria/useAriaOverlay.js +1 -50
  214. package/dist/cjs/hooks/aria/useAriaPress.js +1 -94
  215. package/dist/cjs/hooks/aria/useAriaToggle.js +1 -41
  216. package/dist/cjs/hooks/gesture/index.js +1 -16
  217. package/dist/cjs/hooks/gesture/useGestureScroll.js +1 -129
  218. package/dist/cjs/hooks/index.js +1 -96
  219. package/dist/cjs/hooks/overlay/OverlayStackStore.js +1 -106
  220. package/dist/cjs/hooks/overlay/index.js +1 -27
  221. package/dist/cjs/hooks/overlay/useOverlayStack.js +1 -53
  222. package/dist/cjs/hooks/useControllableValue.js +1 -41
  223. package/dist/cjs/hooks/useCountDown.js +1 -99
  224. package/dist/cjs/hooks/useHairline.js +1 -46
  225. package/dist/cjs/hooks/useSafeAreaPadding.js +1 -38
  226. package/dist/cjs/index.js +1 -104
  227. package/dist/cjs/nativewind.js +1 -0
  228. package/dist/cjs/platform/animation.js +1 -22
  229. package/dist/cjs/platform/history.js +1 -14
  230. package/dist/cjs/platform/index.js +1 -60
  231. package/dist/cjs/platform/measure.js +1 -39
  232. package/dist/cjs/platform/runtime.js +1 -19
  233. package/dist/cjs/platform/scrollLock.js +1 -24
  234. package/dist/cjs/utils/array.js +1 -12
  235. package/dist/cjs/utils/color.js +1 -33
  236. package/dist/cjs/utils/compare.js +1 -21
  237. package/dist/cjs/utils/createPlatformShadow.js +1 -52
  238. package/dist/cjs/utils/date.js +1 -45
  239. package/dist/cjs/utils/deepMerge.js +1 -27
  240. package/dist/cjs/utils/hairline.js +1 -107
  241. package/dist/cjs/utils/index.js +1 -148
  242. package/dist/cjs/utils/number.js +1 -65
  243. package/dist/cjs/utils/promise.js +1 -9
  244. package/dist/cjs/utils/render.js +1 -21
  245. package/dist/cjs/utils/rtl.js +1 -25
  246. package/dist/cjs/utils/string.js +1 -22
  247. package/dist/cjs/utils/validate.js +1 -39
  248. package/dist/es/components/action-sheet/ActionSheet.js +1 -275
  249. package/dist/es/components/action-sheet/index.js +1 -3
  250. package/dist/es/components/action-sheet/tokens.js +1 -126
  251. package/dist/es/components/area/Area.js +1 -113
  252. package/dist/es/components/area/index.js +1 -2
  253. package/dist/es/components/area/tokens.js +1 -8
  254. package/dist/es/components/avatar/Avatar.js +1 -106
  255. package/dist/es/components/avatar/index.js +1 -1
  256. package/dist/es/components/avatar/tokens.js +1 -49
  257. package/dist/es/components/badge/Badge.js +1 -147
  258. package/dist/es/components/badge/index.js +1 -2
  259. package/dist/es/components/badge/tokens.js +1 -75
  260. package/dist/es/components/button/Button.js +1 -184
  261. package/dist/es/components/button/ButtonContext.js +1 -1
  262. package/dist/es/components/button/ButtonGroup.js +1 -46
  263. package/dist/es/components/button/index.js +1 -7
  264. package/dist/es/components/button/tokens.js +1 -170
  265. package/dist/es/components/calendar/Calendar.js +1 -432
  266. package/dist/es/components/calendar/index.js +1 -2
  267. package/dist/es/components/calendar/tokens.js +1 -122
  268. package/dist/es/components/cascader/Cascader.js +1 -456
  269. package/dist/es/components/cascader/index.js +1 -3
  270. package/dist/es/components/cascader/tokens.js +1 -131
  271. package/dist/es/components/cascader/useCascaderExtend.js +1 -32
  272. package/dist/es/components/cell/Cell.js +1 -156
  273. package/dist/es/components/cell/CellContext.js +1 -6
  274. package/dist/es/components/cell/CellGroup.js +1 -81
  275. package/dist/es/components/cell/index.js +1 -8
  276. package/dist/es/components/cell/tokens.js +1 -160
  277. package/dist/es/components/checkbox/Checkbox.js +1 -220
  278. package/dist/es/components/checkbox/CheckboxContext.js +1 -1
  279. package/dist/es/components/checkbox/CheckboxGroup.js +1 -117
  280. package/dist/es/components/checkbox/index.js +1 -5
  281. package/dist/es/components/checkbox/tokens.js +1 -85
  282. package/dist/es/components/circle/Circle.js +1 -187
  283. package/dist/es/components/circle/index.js +1 -2
  284. package/dist/es/components/circle/tokens.js +1 -48
  285. package/dist/es/components/collapse/Collapse.js +1 -286
  286. package/dist/es/components/collapse/index.js +1 -2
  287. package/dist/es/components/collapse/tokens.js +1 -74
  288. package/dist/es/components/config-provider/ConfigProvider.js +1 -25
  289. package/dist/es/components/config-provider/DirectionContext.js +1 -2
  290. package/dist/es/components/config-provider/LocaleContext.js +1 -3
  291. package/dist/es/components/config-provider/index.js +1 -5
  292. package/dist/es/components/config-provider/locale/en-US.js +1 -106
  293. package/dist/es/components/config-provider/locale/zh-CN.js +1 -106
  294. package/dist/es/components/config-provider/tokens.js +1 -5
  295. package/dist/es/components/config-provider/useDirection.js +1 -3
  296. package/dist/es/components/config-provider/useLocale.js +1 -3
  297. package/dist/es/components/count-down/CountDown.js +1 -69
  298. package/dist/es/components/count-down/index.js +1 -3
  299. package/dist/es/components/count-down/tokens.js +1 -27
  300. package/dist/es/components/datetime-picker/DatetimePicker.js +1 -305
  301. package/dist/es/components/datetime-picker/index.js +1 -2
  302. package/dist/es/components/datetime-picker/tokens.js +1 -16
  303. package/dist/es/components/dialog/Dialog.js +1 -407
  304. package/dist/es/components/dialog/imperative.js +1 -185
  305. package/dist/es/components/dialog/index.js +1 -17
  306. package/dist/es/components/dialog/tokens.js +1 -57
  307. package/dist/es/components/divider/Divider.js +1 -107
  308. package/dist/es/components/divider/index.js +1 -2
  309. package/dist/es/components/divider/tokens.js +1 -55
  310. package/dist/es/components/empty/Empty.js +1 -100
  311. package/dist/es/components/empty/index.js +1 -2
  312. package/dist/es/components/empty/tokens.js +1 -48
  313. package/dist/es/components/error-boundary/ErrorBoundary.js +1 -62
  314. package/dist/es/components/error-boundary/index.js +1 -1
  315. package/dist/es/components/field/Field.js +1 -539
  316. package/dist/es/components/field/index.js +1 -6
  317. package/dist/es/components/field/tokens.js +1 -138
  318. package/dist/es/components/flex/Flex.js +1 -66
  319. package/dist/es/components/flex/FlexContext.js +1 -1
  320. package/dist/es/components/flex/FlexItem.js +1 -76
  321. package/dist/es/components/flex/index.js +1 -8
  322. package/dist/es/components/flex/tokens.js +1 -15
  323. package/dist/es/components/form/Form.js +1 -319
  324. package/dist/es/components/form/FormContext.js +1 -1
  325. package/dist/es/components/form/FormItem.js +1 -138
  326. package/dist/es/components/form/FormList.js +1 -81
  327. package/dist/es/components/form/index.js +1 -13
  328. package/dist/es/components/form/tokens.js +1 -8
  329. package/dist/es/components/form/utils.js +1 -45
  330. package/dist/es/components/grid/Grid.js +1 -99
  331. package/dist/es/components/grid/GridContext.js +1 -1
  332. package/dist/es/components/grid/GridItem.js +1 -138
  333. package/dist/es/components/grid/index.js +1 -6
  334. package/dist/es/components/grid/tokens.js +1 -98
  335. package/dist/es/components/image/Image.js +1 -238
  336. package/dist/es/components/image/index.js +1 -3
  337. package/dist/es/components/image/tokens.js +1 -60
  338. package/dist/es/components/image-preview/ImagePreview.js +1 -388
  339. package/dist/es/components/image-preview/imperative.js +1 -58
  340. package/dist/es/components/image-preview/index.js +1 -11
  341. package/dist/es/components/image-preview/tokens.js +1 -37
  342. package/dist/es/components/index.js +1 -110
  343. package/dist/es/components/input/Input.js +1 -109
  344. package/dist/es/components/input/index.js +1 -3
  345. package/dist/es/components/input/tokens.js +1 -16
  346. package/dist/es/components/loading/Loading.js +1 -57
  347. package/dist/es/components/loading/index.js +1 -2
  348. package/dist/es/components/loading/tokens.js +1 -25
  349. package/dist/es/components/nav-bar/NavBar.js +1 -171
  350. package/dist/es/components/nav-bar/index.js +1 -3
  351. package/dist/es/components/nav-bar/tokens.js +1 -83
  352. package/dist/es/components/notice-bar/NoticeBar.js +1 -344
  353. package/dist/es/components/notice-bar/index.js +1 -2
  354. package/dist/es/components/notice-bar/tokens.js +1 -32
  355. package/dist/es/components/notify/Notify.js +1 -242
  356. package/dist/es/components/notify/imperative.js +1 -131
  357. package/dist/es/components/notify/index.js +1 -5
  358. package/dist/es/components/notify/tokens.js +1 -67
  359. package/dist/es/components/number-keyboard/NumberKeyboard.js +1 -467
  360. package/dist/es/components/number-keyboard/index.js +1 -3
  361. package/dist/es/components/number-keyboard/tokens.js +1 -53
  362. package/dist/es/components/overlay/Overlay.js +1 -50
  363. package/dist/es/components/overlay/index.js +1 -4
  364. package/dist/es/components/overlay/tokens.js +1 -7
  365. package/dist/es/components/password-input/PasswordInput.js +1 -327
  366. package/dist/es/components/password-input/index.js +1 -1
  367. package/dist/es/components/password-input/tokens.js +1 -41
  368. package/dist/es/components/picker/Picker.js +1 -1031
  369. package/dist/es/components/picker/index.js +1 -3
  370. package/dist/es/components/picker/tokens.js +1 -47
  371. package/dist/es/components/popup/Popup.js +1 -492
  372. package/dist/es/components/popup/index.js +1 -3
  373. package/dist/es/components/popup/tokens.js +1 -55
  374. package/dist/es/components/portal/Portal.js +1 -37
  375. package/dist/es/components/portal/PortalContext.js +1 -2
  376. package/dist/es/components/portal/PortalHost.js +1 -234
  377. package/dist/es/components/portal/index.js +1 -3
  378. package/dist/es/components/portal/tokens.js +1 -5
  379. package/dist/es/components/progress/Progress.js +1 -196
  380. package/dist/es/components/progress/index.js +1 -3
  381. package/dist/es/components/progress/tokens.js +1 -45
  382. package/dist/es/components/radio/Radio.js +1 -214
  383. package/dist/es/components/radio/RadioContext.js +1 -1
  384. package/dist/es/components/radio/RadioGroup.js +1 -82
  385. package/dist/es/components/radio/index.js +1 -5
  386. package/dist/es/components/radio/tokens.js +1 -80
  387. package/dist/es/components/safe-area-view/SafeAreaView.js +1 -40
  388. package/dist/es/components/safe-area-view/index.js +1 -1
  389. package/dist/es/components/safe-area-view/tokens.js +1 -5
  390. package/dist/es/components/search/Search.js +1 -189
  391. package/dist/es/components/search/index.js +1 -3
  392. package/dist/es/components/search/tokens.js +1 -48
  393. package/dist/es/components/selector/Selector.js +1 -166
  394. package/dist/es/components/selector/index.js +1 -3
  395. package/dist/es/components/selector/tokens.js +1 -88
  396. package/dist/es/components/share-sheet/ShareSheet.js +1 -267
  397. package/dist/es/components/share-sheet/index.js +1 -3
  398. package/dist/es/components/share-sheet/tokens.js +1 -49
  399. package/dist/es/components/sidebar/Sidebar.js +1 -84
  400. package/dist/es/components/sidebar/SidebarContext.js +1 -3
  401. package/dist/es/components/sidebar/SidebarItem.js +1 -84
  402. package/dist/es/components/sidebar/index.js +1 -8
  403. package/dist/es/components/sidebar/tokens.js +1 -80
  404. package/dist/es/components/skeleton/Skeleton.js +1 -143
  405. package/dist/es/components/skeleton/index.js +1 -4
  406. package/dist/es/components/skeleton/tokens.js +1 -33
  407. package/dist/es/components/slider/Slider.js +1 -596
  408. package/dist/es/components/slider/index.js +1 -2
  409. package/dist/es/components/slider/tokens.js +1 -31
  410. package/dist/es/components/space/Space.js +1 -115
  411. package/dist/es/components/space/index.js +1 -2
  412. package/dist/es/components/space/tokens.js +1 -32
  413. package/dist/es/components/stepper/Stepper.js +1 -465
  414. package/dist/es/components/stepper/index.js +1 -3
  415. package/dist/es/components/stepper/tokens.js +1 -54
  416. package/dist/es/components/swiper/Swiper.js +1 -344
  417. package/dist/es/components/swiper/SwiperItem.js +1 -1
  418. package/dist/es/components/swiper/SwiperPagIndicator.js +1 -87
  419. package/dist/es/components/swiper/index.js +1 -10
  420. package/dist/es/components/swiper/tokens.js +1 -12
  421. package/dist/es/components/switch/Switch.js +1 -83
  422. package/dist/es/components/switch/index.js +1 -3
  423. package/dist/es/components/switch/tokens.js +1 -25
  424. package/dist/es/components/tabbar/Tabbar.js +1 -130
  425. package/dist/es/components/tabbar/TabbarContext.js +1 -3
  426. package/dist/es/components/tabbar/TabbarItem.js +1 -139
  427. package/dist/es/components/tabbar/index.js +1 -7
  428. package/dist/es/components/tabbar/tokens.js +1 -35
  429. package/dist/es/components/tabs/Tabs.js +1 -841
  430. package/dist/es/components/tabs/index.js +1 -7
  431. package/dist/es/components/tabs/tokens.js +1 -105
  432. package/dist/es/components/tag/Tag.js +1 -105
  433. package/dist/es/components/tag/index.js +1 -2
  434. package/dist/es/components/tag/tokens.js +1 -97
  435. package/dist/es/components/toast/Toast.js +1 -280
  436. package/dist/es/components/toast/imperative.js +1 -130
  437. package/dist/es/components/toast/index.js +1 -5
  438. package/dist/es/components/toast/tokens.js +1 -36
  439. package/dist/es/components/typography/Typography.js +1 -162
  440. package/dist/es/components/typography/index.js +1 -2
  441. package/dist/es/components/typography/tokens.js +1 -82
  442. package/dist/es/components/water-mark/WaterMark.js +1 -153
  443. package/dist/es/components/water-mark/index.js +1 -4
  444. package/dist/es/components/water-mark/tokens.js +1 -42
  445. package/dist/es/design-system/Text.js +1 -19
  446. package/dist/es/design-system/ThemeContext.js +1 -6
  447. package/dist/es/design-system/ThemeProvider.js +1 -17
  448. package/dist/es/design-system/createComponentTokensHook.js +1 -15
  449. package/dist/es/design-system/index.js +1 -7
  450. package/dist/es/design-system/mergeTokensOverride.js +1 -2
  451. package/dist/es/design-system/presets.js +1 -139
  452. package/dist/es/design-system/tokens.js +1 -128
  453. package/dist/es/design-system/useTheme.js +1 -3
  454. package/dist/es/hooks/animation/index.js +1 -2
  455. package/dist/es/hooks/animation/useAnimatedTransition.js +1 -53
  456. package/dist/es/hooks/animation/useReducedMotion.js +1 -54
  457. package/dist/es/hooks/aria/index.js +1 -5
  458. package/dist/es/hooks/aria/useAriaListBox.js +1 -25
  459. package/dist/es/hooks/aria/useAriaOverlay.js +1 -25
  460. package/dist/es/hooks/aria/useAriaPress.js +1 -57
  461. package/dist/es/hooks/aria/useAriaToggle.js +1 -16
  462. package/dist/es/hooks/gesture/index.js +1 -2
  463. package/dist/es/hooks/gesture/useGestureScroll.js +1 -110
  464. package/dist/es/hooks/index.js +1 -8
  465. package/dist/es/hooks/overlay/OverlayStackStore.js +1 -93
  466. package/dist/es/hooks/overlay/index.js +1 -3
  467. package/dist/es/hooks/overlay/useOverlayStack.js +1 -40
  468. package/dist/es/hooks/useControllableValue.js +1 -29
  469. package/dist/es/hooks/useCountDown.js +1 -87
  470. package/dist/es/hooks/useHairline.js +1 -26
  471. package/dist/es/hooks/useSafeAreaPadding.js +1 -20
  472. package/dist/es/index.js +1 -11
  473. package/dist/es/nativewind.js +1 -0
  474. package/dist/es/platform/animation.js +1 -10
  475. package/dist/es/platform/history.js +1 -7
  476. package/dist/es/platform/index.js +1 -6
  477. package/dist/es/platform/measure.js +1 -32
  478. package/dist/es/platform/runtime.js +1 -4
  479. package/dist/es/platform/scrollLock.js +1 -16
  480. package/dist/es/types.js +1 -1
  481. package/dist/es/utils/array.js +1 -5
  482. package/dist/es/utils/color.js +1 -25
  483. package/dist/es/utils/compare.js +1 -13
  484. package/dist/es/utils/createPlatformShadow.js +1 -39
  485. package/dist/es/utils/date.js +1 -33
  486. package/dist/es/utils/deepMerge.js +1 -21
  487. package/dist/es/utils/hairline.js +1 -93
  488. package/dist/es/utils/index.js +1 -14
  489. package/dist/es/utils/number.js +1 -48
  490. package/dist/es/utils/promise.js +1 -2
  491. package/dist/es/utils/render.js +1 -7
  492. package/dist/es/utils/rtl.js +1 -17
  493. package/dist/es/utils/string.js +1 -13
  494. package/dist/es/utils/validate.js +1 -14
  495. package/dist/types/nativewind.d.ts +4 -0
  496. package/package.json +15 -3
@@ -1,364 +1 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = exports.SwiperItem = void 0;
7
- function _react() {
8
- const data = _interopRequireWildcard(require("react"));
9
- _react = function () {
10
- return data;
11
- };
12
- return data;
13
- }
14
- function _reactNative() {
15
- const data = require("react-native");
16
- _reactNative = function () {
17
- return data;
18
- };
19
- return data;
20
- }
21
- var _number = require("../../utils/number");
22
- var _SwiperPagIndicator = _interopRequireDefault(require("./SwiperPagIndicator"));
23
- var _tokens = require("./tokens");
24
- function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
25
- 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); }
26
- 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); }
27
- const SwiperItemImpl = (props, ref) => /*#__PURE__*/_react().default.createElement(_reactNative().View, {
28
- ref: ref,
29
- style: [S.item, props.style],
30
- testID: props.testID
31
- }, props.children);
32
- const SwiperItemFR = /*#__PURE__*/(0, _react().forwardRef)(SwiperItemImpl);
33
- SwiperItemFR.displayName = 'SwiperItem';
34
- const SwiperItem = exports.SwiperItem = /*#__PURE__*/(0, _react().memo)(SwiperItemFR);
35
- const LOOP_THRESHOLD = 10;
36
- const SwiperImpl = (props, ref) => {
37
- const {
38
- data,
39
- renderItem,
40
- children,
41
- initialSwipe = 0,
42
- touchable = true,
43
- loop = true,
44
- autoplay = false,
45
- vertical = false,
46
- onChange,
47
- indicator = true,
48
- indicatorProps,
49
- style,
50
- testID
51
- } = props;
52
- const tokens = (0, _tokens.useSwiperTokens)();
53
- const listRef = (0, _react().useRef)(null);
54
- const autoRef = (0, _react().useRef)(null);
55
- const interRef = (0, _react().useRef)(false);
56
- const animRef = (0, _react().useRef)(false);
57
- const queueRef = (0, _react().useRef)(null);
58
- const momRef = (0, _react().useRef)(false);
59
- const dragRef = (0, _react().useRef)(null);
60
- const isWeb = _reactNative().Platform.OS === 'web';
61
- const [layout, setLayout] = (0, _react().useState)({
62
- width: 0,
63
- height: 0
64
- });
65
- const onLayout = (0, _react().useCallback)(e => {
66
- const {
67
- width: w,
68
- height: h
69
- } = e.nativeEvent.layout;
70
- setLayout(p => p.width === w && p.height === h ? p : {
71
- width: w,
72
- height: h
73
- });
74
- }, []);
75
- const items = (0, _react().useMemo)(() => !children ? [] : _react().Children.toArray(children).filter(c => /*#__PURE__*/(0, _react().isValidElement)(c)), [children]);
76
- const usingData = Array.isArray(data);
77
- const base = usingData ? data : items;
78
- const count = base.length;
79
- const shouldLoop = loop && count > 1;
80
- const display = (0, _react().useMemo)(() => shouldLoop ? [base[count - 1], ...base, base[0]] : base, [base, shouldLoop, count]);
81
- const dCount = display.length;
82
- const loopAll = shouldLoop && dCount <= LOOP_THRESHOLD;
83
- const realIdx = (0, _react().useCallback)(di => !shouldLoop ? (0, _number.clamp)(di, 0, count - 1) : di === 0 ? count - 1 : di === dCount - 1 ? 0 : di - 1, [shouldLoop, count, dCount]);
84
- const dispIdx = (0, _react().useCallback)(ri => shouldLoop ? (0, _number.clamp)(ri, 0, count - 1) + 1 : (0, _number.clamp)(ri, 0, count - 1), [shouldLoop, count]);
85
- const initReal = (0, _number.clamp)(initialSwipe, 0, Math.max(0, count - 1));
86
- const initDisp = dispIdx(initReal);
87
- const curRef = (0, _react().useRef)(initReal);
88
- const [curIdx, setCurIdx] = (0, _react().useState)(initReal);
89
- const ready = layout.width > 0 && layout.height > 0;
90
- const mainSz = vertical ? layout.height : layout.width;
91
- const crossSz = vertical ? layout.width : layout.height;
92
- const itemSz = (0, _react().useMemo)(() => ({
93
- width: vertical ? crossSz : mainSz,
94
- height: vertical ? mainSz : crossSz
95
- }), [vertical, mainSz, crossSz]);
96
- const clearAuto = (0, _react().useCallback)(() => {
97
- if (autoRef.current) {
98
- clearTimeout(autoRef.current);
99
- autoRef.current = null;
100
- }
101
- }, []);
102
- const onChangeRef = (0, _react().useRef)(onChange);
103
- onChangeRef.current = onChange;
104
- const update = (0, _react().useCallback)(n => {
105
- const c = (0, _number.clamp)(n, 0, Math.max(0, count - 1));
106
- if (curRef.current === c) return;
107
- curRef.current = c;
108
- setCurIdx(c);
109
- onChangeRef.current?.(c);
110
- }, [count]);
111
- const scrollTo = (0, _react().useCallback)((i, anim) => {
112
- try {
113
- listRef.current?.scrollToIndex({
114
- index: i,
115
- animated: anim
116
- });
117
- } catch {}
118
- }, []);
119
- const swipeTo = (0, _react().useCallback)((index, animated = true) => {
120
- if (count === 0) return;
121
- if (animated && animRef.current) {
122
- queueRef.current = index;
123
- return;
124
- }
125
- const tReal = (0, _number.clamp)(index, 0, count - 1);
126
- let tDisp = dispIdx(tReal);
127
- if (shouldLoop && animated) {
128
- const cDisp = dispIdx(curRef.current);
129
- if (cDisp === count && tReal === 0) tDisp = dCount - 1;else if (cDisp === 1 && tReal === count - 1) tDisp = 0;
130
- }
131
- const cReal = curRef.current,
132
- cDisp = dispIdx(cReal);
133
- if (tReal === cReal && tDisp === cDisp) {
134
- if (queueRef.current != null) {
135
- const q = queueRef.current;
136
- queueRef.current = null;
137
- swipeTo(q, true);
138
- }
139
- ;
140
- return;
141
- }
142
- if (animated) animRef.current = true;
143
- scrollTo(tDisp, animated);
144
- if (!animated) {
145
- update(tReal);
146
- if (queueRef.current != null) {
147
- const q = queueRef.current;
148
- queueRef.current = null;
149
- swipeTo(q, true);
150
- }
151
- }
152
- }, [count, dispIdx, scrollTo, shouldLoop, dCount, update]);
153
- const schedule = (0, _react().useCallback)(() => {
154
- const iv = typeof autoplay === 'number' ? Math.max(0, autoplay) : autoplay ? tokens.defaults.autoplayInterval : 0;
155
- if (!iv || count <= 1) return;
156
- if (interRef.current && !isWeb) return;
157
- clearAuto();
158
- autoRef.current = setTimeout(() => {
159
- if (interRef.current && !isWeb) return;
160
- swipeTo(shouldLoop ? (curRef.current + 1) % count : (0, _number.clamp)(curRef.current + 1, 0, count - 1), true);
161
- }, iv);
162
- }, [autoplay, count, clearAuto, shouldLoop, swipeTo, isWeb, tokens.defaults.autoplayInterval]);
163
- const next = (0, _react().useCallback)(() => {
164
- if (count === 0) return;
165
- swipeTo(shouldLoop ? (curRef.current + 1) % count : (0, _number.clamp)(curRef.current + 1, 0, count - 1), true);
166
- }, [count, shouldLoop, swipeTo]);
167
- const prev = (0, _react().useCallback)(() => {
168
- if (count === 0) return;
169
- swipeTo(shouldLoop ? (curRef.current - 1 + count) % count : (0, _number.clamp)(curRef.current - 1, 0, count - 1), true);
170
- }, [count, shouldLoop, swipeTo]);
171
- const flush = () => {
172
- if (queueRef.current == null) return;
173
- const q = queueRef.current;
174
- queueRef.current = null;
175
- swipeTo(q, true);
176
- };
177
- (0, _react().useImperativeHandle)(ref, () => ({
178
- swipeTo,
179
- swipeNext: next,
180
- swipePrev: prev,
181
- getCurrentIndex: () => curRef.current
182
- }), [swipeTo, next, prev]);
183
- (0, _react().useEffect)(() => {
184
- if (!ready || count === 0) return;
185
- scrollTo(initDisp, false);
186
- }, [ready, count, initDisp, scrollTo]);
187
- (0, _react().useEffect)(() => {
188
- schedule();
189
- return clearAuto;
190
- }, [schedule, clearAuto, curIdx]);
191
- const reset = (0, _react().useCallback)(() => {
192
- animRef.current = false;
193
- interRef.current = false;
194
- momRef.current = false;
195
- schedule();
196
- flush();
197
- }, [schedule]);
198
- const onScroll = (0, _react().useCallback)(e => {
199
- if (count <= 1) return;
200
- const off = vertical ? e.nativeEvent.contentOffset.y : e.nativeEvent.contentOffset.x;
201
- const di = Math.round(off / mainSz);
202
- const cdi = shouldLoop ? (0, _number.clamp)(di, 0, dCount - 1) : (0, _number.clamp)(di, 0, count - 1);
203
- update(realIdx(cdi));
204
- if (isWeb) {
205
- const aligned = di * mainSz;
206
- if (Math.abs(off - aligned) < 0.5) {
207
- if (shouldLoop && (di <= 0 || di >= dCount - 1)) scrollTo(di <= 0 ? count : 1, false);
208
- reset();
209
- }
210
- }
211
- }, [count, vertical, mainSz, shouldLoop, dCount, update, realIdx, scrollTo, reset, isWeb]);
212
- const onEnd = (0, _react().useCallback)(e => {
213
- if (isWeb || count === 0) return;
214
- const off = vertical ? e.nativeEvent.contentOffset.y : e.nativeEvent.contentOffset.x;
215
- const di = Math.round(off / mainSz);
216
- let ndi = di;
217
- if (shouldLoop) {
218
- if (di === 0) ndi = count;
219
- if (di === dCount - 1) ndi = 1;
220
- }
221
- if (ndi !== di) scrollTo(ndi, false);
222
- update(realIdx(ndi));
223
- reset();
224
- }, [vertical, count, mainSz, shouldLoop, dCount, scrollTo, update, realIdx, reset, isWeb]);
225
- const onDragBegin = (0, _react().useCallback)(() => {
226
- interRef.current = true;
227
- clearAuto();
228
- }, [clearAuto]);
229
- const onDragEnd = (0, _react().useCallback)(e => {
230
- if (!momRef.current) onEnd(e);
231
- }, [onEnd]);
232
- const onMomBegin = (0, _react().useCallback)(() => {
233
- momRef.current = true;
234
- }, []);
235
- const onFail = (0, _react().useCallback)(info => {
236
- scrollTo(info.index, false);
237
- update(realIdx(info.index));
238
- reset();
239
- }, [scrollTo, update, realIdx, reset]);
240
- const renderItemRef = (0, _react().useRef)(renderItem);
241
- renderItemRef.current = renderItem;
242
- const renderSlide = (0, _react().useCallback)(info => {
243
- const c = usingData ? renderItemRef.current?.(info) ?? null : info.item;
244
- return c ? /*#__PURE__*/_react().default.createElement(_reactNative().View, {
245
- style: [S.slide, itemSz]
246
- }, c) : null;
247
- }, [usingData, itemSz]);
248
- const getLayout = (0, _react().useCallback)((_, i) => ({
249
- length: mainSz,
250
- offset: mainSz * i,
251
- index: i
252
- }), [mainSz]);
253
- const keyEx = (0, _react().useCallback)((_, i) => `s-${i}`, []);
254
- if (count === 0) return null;
255
- const indNode = indicator === false || count <= 1 ? null : typeof indicator === 'function' ? indicator(count, curIdx) : /*#__PURE__*/_react().default.createElement(_SwiperPagIndicator.default, _extends({}, indicatorProps, {
256
- total: count,
257
- current: curIdx,
258
- vertical: vertical
259
- }));
260
- const webMouse = isWeb && touchable && count > 1 ? {
261
- onPointerDown: e => {
262
- if (e.nativeEvent.pointerType !== 'mouse' || e.nativeEvent.button !== 0) return;
263
- dragRef.current = vertical ? e.nativeEvent.pageY : e.nativeEvent.pageX;
264
- interRef.current = true;
265
- clearAuto();
266
- },
267
- onPointerUp: e => {
268
- const s = dragRef.current;
269
- dragRef.current = null;
270
- if (s == null || e.nativeEvent.pointerType !== 'mouse') return;
271
- const d = (vertical ? e.nativeEvent.pageY : e.nativeEvent.pageX) - s;
272
- if (Math.abs(d) >= mainSz * 0.15) {
273
- d < 0 ? next() : prev();
274
- }
275
- ;
276
- interRef.current = false;
277
- schedule();
278
- },
279
- onPointerLeave: () => {
280
- if (dragRef.current != null) {
281
- dragRef.current = null;
282
- interRef.current = false;
283
- schedule();
284
- }
285
- }
286
- } : undefined;
287
- if (!ready) {
288
- return /*#__PURE__*/_react().default.createElement(_reactNative().View, {
289
- style: [S.ctr, style],
290
- onLayout: onLayout,
291
- testID: testID
292
- });
293
- }
294
- return /*#__PURE__*/_react().default.createElement(_reactNative().View, _extends({
295
- accessibilityRole: "adjustable",
296
- accessibilityLabel: `swiper, ${curIdx + 1} of ${count}`,
297
- accessibilityValue: {
298
- min: 0,
299
- max: count - 1,
300
- now: curIdx
301
- },
302
- style: [S.ctr, webMouse && S.web, style],
303
- onLayout: onLayout,
304
- testID: testID
305
- }, webMouse), /*#__PURE__*/_react().default.createElement(_reactNative().FlatList, {
306
- ref: listRef,
307
- data: display,
308
- renderItem: renderSlide,
309
- keyExtractor: keyEx,
310
- horizontal: !vertical,
311
- getItemLayout: getLayout,
312
- initialScrollIndex: initDisp,
313
- scrollEnabled: touchable && count > 1,
314
- removeClippedSubviews: !shouldLoop || !loopAll,
315
- disableVirtualization: shouldLoop && loopAll,
316
- initialNumToRender: shouldLoop ? loopAll ? dCount : 3 : 3,
317
- maxToRenderPerBatch: shouldLoop ? loopAll ? dCount : 3 : 3,
318
- windowSize: shouldLoop ? loopAll ? dCount : 7 : 5,
319
- pagingEnabled: true,
320
- snapToInterval: mainSz,
321
- decelerationRate: "fast",
322
- showsHorizontalScrollIndicator: false,
323
- showsVerticalScrollIndicator: false,
324
- onScrollBeginDrag: onDragBegin,
325
- onScroll: onScroll,
326
- scrollEventThrottle: tokens.defaults.scrollEventThrottle,
327
- onScrollEndDrag: onDragEnd,
328
- onMomentumScrollBegin: onMomBegin,
329
- onMomentumScrollEnd: onEnd,
330
- onScrollToIndexFailed: onFail
331
- }), /*#__PURE__*/_react().default.createElement(_reactNative().View, {
332
- pointerEvents: "none",
333
- style: [S.ind, {
334
- zIndex: tokens.layer.zIndex,
335
- elevation: tokens.layer.elevation
336
- }]
337
- }, indNode));
338
- };
339
- const SwiperFR = /*#__PURE__*/(0, _react().forwardRef)(SwiperImpl);
340
- const Swiper = /*#__PURE__*/(0, _react().memo)(SwiperFR);
341
- const S = _reactNative().StyleSheet.create({
342
- ctr: {
343
- position: 'relative',
344
- overflow: 'hidden'
345
- },
346
- web: {
347
- cursor: 'grab',
348
- userSelect: 'none'
349
- },
350
- slide: {
351
- flex: 1
352
- },
353
- item: {
354
- flex: 1
355
- },
356
- ind: {
357
- position: 'absolute',
358
- left: 0,
359
- right: 0,
360
- top: 0,
361
- bottom: 0
362
- }
363
- });
364
- var _default = exports.default = Swiper;
1
+ "use strict";function _react(){const e=_interopRequireWildcard(require("react"));return _react=function(){return e},e}function _reactNative(){const e=require("react-native");return _reactNative=function(){return e},e}Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=exports.SwiperItem=void 0;var _number=require("../../utils/number"),_SwiperPagIndicator=_interopRequireDefault(require("./SwiperPagIndicator")),_tokens=require("./tokens");function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}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 a,c,l={__proto__:null,default:e};if(null===e||"object"!=typeof e&&"function"!=typeof e)return l;if(a=t?n:r){if(a.has(e))return a.get(e);a.set(e,l)}for(const t in e)"default"!==t&&{}.hasOwnProperty.call(e,t)&&((c=(a=Object.defineProperty)&&Object.getOwnPropertyDescriptor(e,t))&&(c.get||c.set)?a(l,t,c):l[t]=e[t]);return l})(e,t)}function _extends(){return _extends=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},_extends.apply(null,arguments)}const SwiperItemImpl=(e,t)=>_react().default.createElement(_reactNative().View,{ref:t,style:[S.item,e.style],testID:e.testID},e.children),SwiperItemFR=(0,_react().forwardRef)(SwiperItemImpl);SwiperItemFR.displayName="SwiperItem";const SwiperItem=exports.SwiperItem=(0,_react().memo)(SwiperItemFR),LOOP_THRESHOLD=10,SwiperImpl=(e,t)=>{const{data:r,renderItem:n,children:a,initialSwipe:c=0,touchable:l=!0,loop:u=!0,autoplay:i=!1,vertical:o=!1,onChange:s,indicator:_=!0,indicatorProps:f,style:d,testID:p}=e,m=(0,_tokens.useSwiperTokens)(),v=(0,_react().useRef)(null),b=(0,_react().useRef)(null),w=(0,_react().useRef)(!1),h=(0,_react().useRef)(!1),y=(0,_react().useRef)(null),I=(0,_react().useRef)(!1),g=(0,_react().useRef)(null),x="web"===_reactNative().Platform.OS,[E,k]=(0,_react().useState)({width:0,height:0}),R=(0,_react().useCallback)(e=>{const{width:t,height:r}=e.nativeEvent.layout;k(e=>e.width===t&&e.height===r?e:{width:t,height:r})},[]),C=(0,_react().useMemo)(()=>a?_react().Children.toArray(a).filter(e=>(0,_react().isValidElement)(e)):[],[a]),M=Array.isArray(r),O=M?r:C,P=O.length,T=u&&P>1,N=(0,_react().useMemo)(()=>T?[O[P-1],...O,O[0]]:O,[O,T,P]),D=N.length,q=T&&D<=10,V=(0,_react().useCallback)(e=>T?0===e?P-1:e===D-1?0:e-1:(0,_number.clamp)(e,0,P-1),[T,P,D]),L=(0,_react().useCallback)(e=>T?(0,_number.clamp)(e,0,P-1)+1:(0,_number.clamp)(e,0,P-1),[T,P]),j=(0,_number.clamp)(c,0,Math.max(0,P-1)),F=L(j),z=(0,_react().useRef)(j),[W,H]=(0,_react().useState)(j),A=E.width>0&&E.height>0,B=o?E.height:E.width,$=o?E.width:E.height,X=(0,_react().useMemo)(()=>({width:o?$:B,height:o?B:$}),[o,B,$]),Y=(0,_react().useCallback)(()=>{b.current&&(clearTimeout(b.current),b.current=null)},[]),U=(0,_react().useRef)(s);U.current=s;const G=(0,_react().useCallback)(e=>{const t=(0,_number.clamp)(e,0,Math.max(0,P-1));z.current!==t&&(z.current=t,H(t),U.current?.(t))},[P]),J=(0,_react().useCallback)((e,t)=>{try{v.current?.scrollToIndex({index:e,animated:t})}catch{}},[]),K=(0,_react().useCallback)((e,t=!0)=>{if(0===P)return;if(t&&h.current)return void(y.current=e);const r=(0,_number.clamp)(e,0,P-1);let n=L(r);if(T&&t){const e=L(z.current);e===P&&0===r?n=D-1:1===e&&r===P-1&&(n=0)}const a=z.current,c=L(a);if(r!==a||n!==c){if(t&&(h.current=!0),J(n,t),!t&&(G(r),null!=y.current)){const e=y.current;y.current=null,K(e,!0)}}else if(null!=y.current){const e=y.current;y.current=null,K(e,!0)}},[P,L,J,T,D,G]),Q=(0,_react().useCallback)(()=>{const e="number"==typeof i?Math.max(0,i):i?m.defaults.autoplayInterval:0;!e||P<=1||w.current&&!x||(Y(),b.current=setTimeout(()=>{w.current&&!x||K(T?(z.current+1)%P:(0,_number.clamp)(z.current+1,0,P-1),!0)},e))},[i,P,Y,T,K,x,m.defaults.autoplayInterval]),Z=(0,_react().useCallback)(()=>{0!==P&&K(T?(z.current+1)%P:(0,_number.clamp)(z.current+1,0,P-1),!0)},[P,T,K]),ee=(0,_react().useCallback)(()=>{0!==P&&K(T?(z.current-1+P)%P:(0,_number.clamp)(z.current-1,0,P-1),!0)},[P,T,K]);(0,_react().useImperativeHandle)(t,()=>({swipeTo:K,swipeNext:Z,swipePrev:ee,getCurrentIndex:()=>z.current}),[K,Z,ee]),(0,_react().useEffect)(()=>{A&&0!==P&&J(F,!1)},[A,P,F,J]),(0,_react().useEffect)(()=>(Q(),Y),[Q,Y,W]);const te=(0,_react().useCallback)(()=>{h.current=!1,w.current=!1,I.current=!1,Q(),(()=>{if(null==y.current)return;const e=y.current;y.current=null,K(e,!0)})()},[Q]),re=(0,_react().useCallback)(e=>{if(P<=1)return;const t=o?e.nativeEvent.contentOffset.y:e.nativeEvent.contentOffset.x,r=Math.round(t/B),n=T?(0,_number.clamp)(r,0,D-1):(0,_number.clamp)(r,0,P-1);if(G(V(n)),x){const e=r*B;Math.abs(t-e)<.5&&(T&&(r<=0||r>=D-1)&&J(r<=0?P:1,!1),te())}},[P,o,B,T,D,G,V,J,te,x]),ne=(0,_react().useCallback)(e=>{if(x||0===P)return;const t=o?e.nativeEvent.contentOffset.y:e.nativeEvent.contentOffset.x,r=Math.round(t/B);let n=r;T&&(0===r&&(n=P),r===D-1&&(n=1)),n!==r&&J(n,!1),G(V(n)),te()},[o,P,B,T,D,J,G,V,te,x]),ae=(0,_react().useCallback)(()=>{w.current=!0,Y()},[Y]),ce=(0,_react().useCallback)(e=>{I.current||ne(e)},[ne]),le=(0,_react().useCallback)(()=>{I.current=!0},[]),ue=(0,_react().useCallback)(e=>{J(e.index,!1),G(V(e.index)),te()},[J,G,V,te]),ie=(0,_react().useRef)(n);ie.current=n;const oe=(0,_react().useCallback)(e=>{const t=M?ie.current?.(e)??null:e.item;return t?_react().default.createElement(_reactNative().View,{style:[S.slide,X]},t):null},[M,X]),se=(0,_react().useCallback)((e,t)=>({length:B,offset:B*t,index:t}),[B]),_e=(0,_react().useCallback)((e,t)=>`s-${t}`,[]);if(0===P)return null;const fe=!1===_||P<=1?null:"function"==typeof _?_(P,W):_react().default.createElement(_SwiperPagIndicator.default,_extends({},f,{total:P,current:W,vertical:o})),de=x&&l&&P>1?{onPointerDown:e=>{"mouse"===e.nativeEvent.pointerType&&0===e.nativeEvent.button&&(g.current=o?e.nativeEvent.pageY:e.nativeEvent.pageX,w.current=!0,Y())},onPointerUp:e=>{const t=g.current;if(g.current=null,null==t||"mouse"!==e.nativeEvent.pointerType)return;const r=(o?e.nativeEvent.pageY:e.nativeEvent.pageX)-t;Math.abs(r)>=.15*B&&(r<0?Z():ee()),w.current=!1,Q()},onPointerLeave:()=>{null!=g.current&&(g.current=null,w.current=!1,Q())}}:void 0;return A?_react().default.createElement(_reactNative().View,_extends({accessibilityRole:"adjustable",accessibilityLabel:`swiper, ${W+1} of ${P}`,accessibilityValue:{min:0,max:P-1,now:W},style:[S.ctr,de&&S.web,d],onLayout:R,testID:p},de),_react().default.createElement(_reactNative().FlatList,{ref:v,data:N,renderItem:oe,keyExtractor:_e,horizontal:!o,getItemLayout:se,initialScrollIndex:F,scrollEnabled:l&&P>1,removeClippedSubviews:!T||!q,disableVirtualization:T&&q,initialNumToRender:T&&q?D:3,maxToRenderPerBatch:T&&q?D:3,windowSize:T?q?D:7:5,pagingEnabled:!0,snapToInterval:B,decelerationRate:"fast",showsHorizontalScrollIndicator:!1,showsVerticalScrollIndicator:!1,onScrollBeginDrag:ae,onScroll:re,scrollEventThrottle:m.defaults.scrollEventThrottle,onScrollEndDrag:ce,onMomentumScrollBegin:le,onMomentumScrollEnd:ne,onScrollToIndexFailed:ue}),_react().default.createElement(_reactNative().View,{pointerEvents:"none",style:[S.ind,{zIndex:m.layer.zIndex,elevation:m.layer.elevation}]},fe)):_react().default.createElement(_reactNative().View,{style:[S.ctr,d],onLayout:R,testID:p})},SwiperFR=(0,_react().forwardRef)(SwiperImpl),Swiper=(0,_react().memo)(SwiperFR),S=_reactNative().StyleSheet.create({ctr:{position:"relative",overflow:"hidden"},web:{cursor:"grab",userSelect:"none"},slide:{flex:1},item:{flex:1},ind:{position:"absolute",left:0,right:0,top:0,bottom:0}});var _default=exports.default=Swiper;
@@ -1,12 +1 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- Object.defineProperty(exports, "default", {
7
- enumerable: true,
8
- get: function () {
9
- return _Swiper.SwiperItem;
10
- }
11
- });
12
- var _Swiper = require("./Swiper");
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),Object.defineProperty(exports,"default",{enumerable:!0,get:function(){return _Swiper.SwiperItem}});var _Swiper=require("./Swiper");
@@ -1,106 +1 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.useSwiperPagIndicatorTokens = exports.default = void 0;
7
- function _react() {
8
- const data = _interopRequireWildcard(require("react"));
9
- _react = function () {
10
- return data;
11
- };
12
- return data;
13
- }
14
- function _reactNative() {
15
- const data = require("react-native");
16
- _reactNative = function () {
17
- return data;
18
- };
19
- return data;
20
- }
21
- var _designSystem = require("../../design-system");
22
- 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); }
23
- 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); }
24
- const createSwiperPagIndicatorTokens = f => ({
25
- colors: {
26
- active: f.palette.primary.foreground ?? '#ffffff',
27
- inactive: 'rgba(255,255,255,0.5)'
28
- },
29
- sizing: {
30
- dotSizeActive: 8,
31
- dotSizeInactive: 6
32
- },
33
- spacing: {
34
- dotMargin: f.spacing.xs
35
- },
36
- offset: {
37
- horizontalBottom: f.spacing.lg,
38
- verticalRight: f.spacing.lg
39
- },
40
- layer: {
41
- zIndex: 10,
42
- elevation: 10
43
- }
44
- });
45
- const useSwiperPagIndicatorTokens = exports.useSwiperPagIndicatorTokens = (0, _designSystem.createComponentTokensHook)('swiperPagIndicator', createSwiperPagIndicatorTokens);
46
- const SwiperPagIndicator = /*#__PURE__*/(0, _react().memo)(({
47
- total,
48
- current,
49
- vertical = false,
50
- style,
51
- activeColor,
52
- inactiveColor,
53
- tokensOverride,
54
- ...rest
55
- }) => {
56
- const tokens = useSwiperPagIndicatorTokens(tokensOverride);
57
- const dots = [];
58
- const ac = activeColor || tokens.colors.active;
59
- const ic = inactiveColor || tokens.colors.inactive;
60
- const posStyle = vertical ? [S.cv, {
61
- right: tokens.offset.verticalRight
62
- }] : [S.ch, {
63
- bottom: tokens.offset.horizontalBottom
64
- }];
65
- for (let i = 0; i < total; i++) {
66
- const a = current === i;
67
- const sz = a ? tokens.sizing.dotSizeActive : tokens.sizing.dotSizeInactive;
68
- dots.push(/*#__PURE__*/_react().default.createElement(_reactNative().View, {
69
- key: i,
70
- style: {
71
- marginHorizontal: tokens.spacing.dotMargin,
72
- marginVertical: tokens.spacing.dotMargin,
73
- backgroundColor: a ? ac : ic,
74
- width: sz,
75
- height: sz,
76
- borderRadius: sz / 2
77
- }
78
- }));
79
- }
80
- ;
81
- return /*#__PURE__*/_react().default.createElement(_reactNative().View, _extends({
82
- style: [S.c, {
83
- zIndex: tokens.layer.zIndex,
84
- elevation: tokens.layer.elevation
85
- }, posStyle, style]
86
- }, rest), dots);
87
- });
88
- const S = _reactNative().StyleSheet.create({
89
- c: {
90
- flexDirection: 'row',
91
- alignItems: 'center',
92
- justifyContent: 'center'
93
- },
94
- ch: {
95
- position: 'absolute',
96
- left: 0,
97
- right: 0
98
- },
99
- cv: {
100
- position: 'absolute',
101
- top: 0,
102
- bottom: 0,
103
- flexDirection: 'column'
104
- }
105
- });
106
- var _default = exports.default = SwiperPagIndicator;
1
+ "use strict";function _react(){const e=_interopRequireWildcard(require("react"));return _react=function(){return e},e}function _reactNative(){const e=require("react-native");return _reactNative=function(){return e},e}Object.defineProperty(exports,"__esModule",{value:!0}),exports.useSwiperPagIndicatorTokens=exports.default=void 0;var _designSystem=require("../../design-system");function _interopRequireWildcard(e,t){if("function"==typeof WeakMap)var r=new WeakMap,i=new WeakMap;return(_interopRequireWildcard=function(e,t){if(!t&&e&&e.__esModule)return e;var n,o,a={__proto__:null,default:e};if(null===e||"object"!=typeof e&&"function"!=typeof e)return a;if(n=t?i:r){if(n.has(e))return n.get(e);n.set(e,a)}for(const t in e)"default"!==t&&{}.hasOwnProperty.call(e,t)&&((o=(n=Object.defineProperty)&&Object.getOwnPropertyDescriptor(e,t))&&(o.get||o.set)?n(a,t,o):a[t]=e[t]);return a})(e,t)}function _extends(){return _extends=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var i in r)({}).hasOwnProperty.call(r,i)&&(e[i]=r[i])}return e},_extends.apply(null,arguments)}const createSwiperPagIndicatorTokens=e=>({colors:{active:e.palette.primary.foreground??"#ffffff",inactive:"rgba(255,255,255,0.5)"},sizing:{dotSizeActive:8,dotSizeInactive:6},spacing:{dotMargin:e.spacing.xs},offset:{horizontalBottom:e.spacing.lg,verticalRight:e.spacing.lg},layer:{zIndex:10,elevation:10}}),useSwiperPagIndicatorTokens=exports.useSwiperPagIndicatorTokens=(0,_designSystem.createComponentTokensHook)("swiperPagIndicator",createSwiperPagIndicatorTokens),SwiperPagIndicator=(0,_react().memo)(({total:e,current:t,vertical:r=!1,style:i,activeColor:n,inactiveColor:o,tokensOverride:a,...c})=>{const s=useSwiperPagIndicatorTokens(a),l=[],u=n||s.colors.active,d=o||s.colors.inactive,f=r?[S.cv,{right:s.offset.verticalRight}]:[S.ch,{bottom:s.offset.horizontalBottom}];for(let r=0;r<e;r++){const e=t===r,i=e?s.sizing.dotSizeActive:s.sizing.dotSizeInactive;l.push(_react().default.createElement(_reactNative().View,{key:r,style:{marginHorizontal:s.spacing.dotMargin,marginVertical:s.spacing.dotMargin,backgroundColor:e?u:d,width:i,height:i,borderRadius:i/2}}))}return _react().default.createElement(_reactNative().View,_extends({style:[S.c,{zIndex:s.layer.zIndex,elevation:s.layer.elevation},f,i]},c),l)}),S=_reactNative().StyleSheet.create({c:{flexDirection:"row",alignItems:"center",justifyContent:"center"},ch:{position:"absolute",left:0,right:0},cv:{position:"absolute",top:0,bottom:0,flexDirection:"column"}});var _default=exports.default=SwiperPagIndicator;
@@ -1,40 +1 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- Object.defineProperty(exports, "Swiper", {
7
- enumerable: true,
8
- get: function () {
9
- return _Swiper.default;
10
- }
11
- });
12
- Object.defineProperty(exports, "SwiperItem", {
13
- enumerable: true,
14
- get: function () {
15
- return _SwiperItem.default;
16
- }
17
- });
18
- Object.defineProperty(exports, "SwiperPagIndicator", {
19
- enumerable: true,
20
- get: function () {
21
- return _SwiperPagIndicator.default;
22
- }
23
- });
24
- exports.default = void 0;
25
- Object.defineProperty(exports, "useSwiperPagIndicatorTokens", {
26
- enumerable: true,
27
- get: function () {
28
- return _SwiperPagIndicator.useSwiperPagIndicatorTokens;
29
- }
30
- });
31
- var _Swiper = _interopRequireDefault(require("./Swiper"));
32
- var _SwiperItem = _interopRequireDefault(require("./SwiperItem"));
33
- var _SwiperPagIndicator = _interopRequireWildcard(require("./SwiperPagIndicator"));
34
- 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); }
35
- function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
36
- const SwiperWithItem = Object.assign(_Swiper.default, {
37
- Item: _SwiperItem.default,
38
- PagIndicator: _SwiperPagIndicator.default
39
- });
40
- var _default = exports.default = SwiperWithItem;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),Object.defineProperty(exports,"Swiper",{enumerable:!0,get:function(){return _Swiper.default}}),Object.defineProperty(exports,"SwiperItem",{enumerable:!0,get:function(){return _SwiperItem.default}}),Object.defineProperty(exports,"SwiperPagIndicator",{enumerable:!0,get:function(){return _SwiperPagIndicator.default}}),exports.default=void 0,Object.defineProperty(exports,"useSwiperPagIndicatorTokens",{enumerable:!0,get:function(){return _SwiperPagIndicator.useSwiperPagIndicatorTokens}});var _Swiper=_interopRequireDefault(require("./Swiper")),_SwiperItem=_interopRequireDefault(require("./SwiperItem")),_SwiperPagIndicator=_interopRequireWildcard(require("./SwiperPagIndicator"));function _interopRequireWildcard(e,r){if("function"==typeof WeakMap)var t=new WeakMap,i=new WeakMap;return(_interopRequireWildcard=function(e,r){if(!r&&e&&e.__esModule)return e;var n,u,a={__proto__:null,default:e};if(null===e||"object"!=typeof e&&"function"!=typeof e)return a;if(n=r?i:t){if(n.has(e))return n.get(e);n.set(e,a)}for(const r in e)"default"!==r&&{}.hasOwnProperty.call(e,r)&&((u=(n=Object.defineProperty)&&Object.getOwnPropertyDescriptor(e,r))&&(u.get||u.set)?n(a,r,u):a[r]=e[r]);return a})(e,r)}function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}const SwiperWithItem=Object.assign(_Swiper.default,{Item:_SwiperItem.default,PagIndicator:_SwiperPagIndicator.default});var _default=exports.default=SwiperWithItem;
@@ -1,18 +1 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.useSwiperTokens = void 0;
7
- var _designSystem = require("../../design-system");
8
- const createSwiperTokens = _foundations => ({
9
- defaults: {
10
- autoplayInterval: 3000,
11
- scrollEventThrottle: 16
12
- },
13
- layer: {
14
- zIndex: 10,
15
- elevation: 10
16
- }
17
- });
18
- const useSwiperTokens = exports.useSwiperTokens = (0, _designSystem.createComponentTokensHook)('swiper', createSwiperTokens);
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.useSwiperTokens=void 0;var _designSystem=require("../../design-system");const createSwiperTokens=e=>({defaults:{autoplayInterval:3e3,scrollEventThrottle:16},layer:{zIndex:10,elevation:10}}),useSwiperTokens=exports.useSwiperTokens=(0,_designSystem.createComponentTokensHook)("swiper",createSwiperTokens);
@@ -1,102 +1 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = exports.Switch = void 0;
7
- function _react() {
8
- const data = _interopRequireWildcard(require("react"));
9
- _react = function () {
10
- return data;
11
- };
12
- return data;
13
- }
14
- function _reactNative() {
15
- const data = require("react-native");
16
- _reactNative = function () {
17
- return data;
18
- };
19
- return data;
20
- }
21
- var _hooks = require("../../hooks");
22
- var _utils = require("../../utils");
23
- var _tokens = require("./tokens");
24
- 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); }
25
- const SwitchImpl = props => {
26
- const {
27
- disabled: disP,
28
- size: szP,
29
- activeColor: actClrP,
30
- inactiveColor: inactClrP,
31
- activeValue: actValP,
32
- inactiveValue: inactValP,
33
- tokensOverride,
34
- onClick,
35
- style
36
- } = props;
37
- const tokens = (0, _tokens.useSwitchTokens)(tokensOverride);
38
- const disabled = disP ?? tokens.defaults.disabled;
39
- const activeValue = actValP ?? tokens.defaults.activeValue;
40
- const inactiveValue = inactValP ?? tokens.defaults.inactiveValue;
41
- const scale = (0, _react().useMemo)(() => {
42
- if (!tokens.defaults.size) return 1;
43
- if (typeof szP === 'string') {
44
- const v = szP.toLowerCase();
45
- if (v === 'sm') return 0.75;
46
- if (v === 'md') return 1;
47
- if (v === 'lg') return 1.25;
48
- return Math.max(0, (0, _utils.parseNumber)(szP, tokens.defaults.size) / tokens.defaults.size);
49
- }
50
- ;
51
- if (typeof szP === 'number') return Math.max(0, szP / tokens.defaults.size);
52
- return 1;
53
- }, [szP, tokens.defaults.size]);
54
- const [value, triggerChange] = (0, _hooks.useControllableValue)(props, {
55
- valuePropName: 'checked',
56
- defaultValuePropName: 'defaultChecked',
57
- defaultValue: inactiveValue,
58
- trigger: 'onChange'
59
- });
60
- const isChecked = Object.is(value, activeValue);
61
- const actClr = actClrP ?? tokens.colors.activeTrack;
62
- const inactClr = inactClrP ?? tokens.colors.inactiveTrack;
63
- const handleTouchEnd = (0, _react().useCallback)(event => {
64
- if (disabled) return;
65
- onClick?.(event);
66
- }, [disabled, onClick]);
67
- const handleValueChange = (0, _react().useCallback)(() => {
68
- if (disabled) return;
69
- const next = isChecked ? inactiveValue : activeValue;
70
- if (Object.is(next, value)) return;
71
- triggerChange(next);
72
- }, [activeValue, disabled, inactiveValue, isChecked, triggerChange, value]);
73
- return /*#__PURE__*/_react().default.createElement(_reactNative().Switch, {
74
- value: isChecked,
75
- disabled: disabled,
76
- trackColor: {
77
- false: inactClr,
78
- true: actClr
79
- },
80
- thumbColor: tokens.colors.handle,
81
- ios_backgroundColor: inactClr,
82
- style: [{
83
- transform: [{
84
- scaleX: scale
85
- }, {
86
- scaleY: scale
87
- }]
88
- }, {
89
- opacity: disabled ? tokens.opacity.disabled : 1
90
- }, style],
91
- accessibilityRole: "switch",
92
- accessibilityState: {
93
- checked: isChecked,
94
- disabled
95
- },
96
- onValueChange: handleValueChange,
97
- onTouchEnd: handleTouchEnd
98
- });
99
- };
100
- const Switch = exports.Switch = /*#__PURE__*/_react().default.memo(SwitchImpl);
101
- Switch.displayName = 'Switch';
102
- var _default = exports.default = Switch;
1
+ "use strict";function _react(){const e=_interopRequireWildcard(require("react"));return _react=function(){return e},e}function _reactNative(){const e=require("react-native");return _reactNative=function(){return e},e}Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=exports.Switch=void 0;var _hooks=require("../../hooks"),_utils=require("../../utils"),_tokens=require("./tokens");function _interopRequireWildcard(e,t){if("function"==typeof WeakMap)var r=new WeakMap,a=new WeakMap;return(_interopRequireWildcard=function(e,t){if(!t&&e&&e.__esModule)return e;var i,o,c={__proto__:null,default:e};if(null===e||"object"!=typeof e&&"function"!=typeof e)return c;if(i=t?a:r){if(i.has(e))return i.get(e);i.set(e,c)}for(const t in e)"default"!==t&&{}.hasOwnProperty.call(e,t)&&((o=(i=Object.defineProperty)&&Object.getOwnPropertyDescriptor(e,t))&&(o.get||o.set)?i(c,t,o):c[t]=e[t]);return c})(e,t)}const SwitchImpl=e=>{const{disabled:t,size:r,activeColor:a,inactiveColor:i,activeValue:o,inactiveValue:c,tokensOverride:l,onClick:s,style:u}=e,n=(0,_tokens.useSwitchTokens)(l),d=t??n.defaults.disabled,f=o??n.defaults.activeValue,p=c??n.defaults.inactiveValue,_=(0,_react().useMemo)(()=>{if(!n.defaults.size)return 1;if("string"==typeof r){const e=r.toLowerCase();return"sm"===e?.75:"md"===e?1:"lg"===e?1.25:Math.max(0,(0,_utils.parseNumber)(r,n.defaults.size)/n.defaults.size)}return"number"==typeof r?Math.max(0,r/n.defaults.size):1},[r,n.defaults.size]),[h,k]=(0,_hooks.useControllableValue)(e,{valuePropName:"checked",defaultValuePropName:"defaultChecked",defaultValue:p,trigger:"onChange"}),v=Object.is(h,f),b=a??n.colors.activeTrack,m=i??n.colors.inactiveTrack,w=(0,_react().useCallback)(e=>{d||s?.(e)},[d,s]),y=(0,_react().useCallback)(()=>{if(d)return;const e=v?p:f;Object.is(e,h)||k(e)},[f,d,p,v,k,h]);return _react().default.createElement(_reactNative().Switch,{value:v,disabled:d,trackColor:{false:m,true:b},thumbColor:n.colors.handle,ios_backgroundColor:m,style:[{transform:[{scaleX:_},{scaleY:_}]},{opacity:d?n.opacity.disabled:1},u],accessibilityRole:"switch",accessibilityState:{checked:v,disabled:d},onValueChange:y,onTouchEnd:w})},Switch=exports.Switch=_react().default.memo(SwitchImpl);Switch.displayName="Switch";var _default=exports.default=Switch;