wn-native-ui 0.0.0-stage → 0.1.0

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 (445) hide show
  1. package/CHANGELOG.md +11 -0
  2. package/LICENSE +21 -0
  3. package/README.md +128 -3
  4. package/lib/module/components/Avatar/Avatar.js +131 -0
  5. package/lib/module/components/Avatar/index.js +3 -0
  6. package/lib/module/components/Avatar/styles.js +49 -0
  7. package/lib/module/components/BottomActionBar/BottomActionBar.js +43 -0
  8. package/lib/module/components/BottomActionBar/index.js +3 -0
  9. package/lib/module/components/BottomActionBar/styles.js +22 -0
  10. package/lib/module/components/BottomSheet/BottomSheet.js +103 -0
  11. package/lib/module/components/BottomSheet/index.js +3 -0
  12. package/lib/module/components/BottomSheet/styles.js +84 -0
  13. package/lib/module/components/Button/Button.js +38 -0
  14. package/lib/module/components/Button/index.js +3 -0
  15. package/lib/module/components/Button/styles.js +50 -0
  16. package/lib/module/components/Checkbox/Checkbox.js +131 -0
  17. package/lib/module/components/Checkbox/index.js +3 -0
  18. package/lib/module/components/Checkbox/styles.js +64 -0
  19. package/lib/module/components/DatePicker/DatePicker.js +521 -0
  20. package/lib/module/components/DatePicker/index.js +3 -0
  21. package/lib/module/components/DatePicker/model.js +255 -0
  22. package/lib/module/components/DatePicker/styles.js +273 -0
  23. package/lib/module/components/Dialog/Dialog.js +146 -0
  24. package/lib/module/components/Dialog/index.js +3 -0
  25. package/lib/module/components/Dialog/styles.js +112 -0
  26. package/lib/module/components/EmptyState/EmptyState.js +56 -0
  27. package/lib/module/components/EmptyState/index.js +3 -0
  28. package/lib/module/components/EmptyState/styles.js +84 -0
  29. package/lib/module/components/Field/Field.js +54 -0
  30. package/lib/module/components/Field/FieldContext.js +7 -0
  31. package/lib/module/components/Field/index.js +3 -0
  32. package/lib/module/components/Field/styles.js +56 -0
  33. package/lib/module/components/FilterChips/FilterChips.js +74 -0
  34. package/lib/module/components/FilterChips/index.js +3 -0
  35. package/lib/module/components/FilterChips/styles.js +72 -0
  36. package/lib/module/components/Form/Form.js +53 -0
  37. package/lib/module/components/Form/FormItem.js +128 -0
  38. package/lib/module/components/Form/context.js +4 -0
  39. package/lib/module/components/Form/index.js +10 -0
  40. package/lib/module/components/Form/model.js +327 -0
  41. package/lib/module/components/Form/styles.js +10 -0
  42. package/lib/module/components/ImagePreview/ImagePreview.js +189 -0
  43. package/lib/module/components/ImagePreview/index.js +3 -0
  44. package/lib/module/components/ImagePreview/styles.js +87 -0
  45. package/lib/module/components/InlineFeedback/InlineFeedback.js +78 -0
  46. package/lib/module/components/InlineFeedback/index.js +3 -0
  47. package/lib/module/components/InlineFeedback/styles.js +148 -0
  48. package/lib/module/components/Input/Input.js +50 -0
  49. package/lib/module/components/Input/index.js +3 -0
  50. package/lib/module/components/Input/styles.js +41 -0
  51. package/lib/module/components/ListSkeleton/ListSkeleton.js +50 -0
  52. package/lib/module/components/ListSkeleton/index.js +3 -0
  53. package/lib/module/components/ListSkeleton/styles.js +30 -0
  54. package/lib/module/components/NavigationBar/NavigationBar.js +170 -0
  55. package/lib/module/components/NavigationBar/index.js +3 -0
  56. package/lib/module/components/NavigationBar/styles.js +98 -0
  57. package/lib/module/components/Picker/Picker.js +156 -0
  58. package/lib/module/components/Picker/index.js +3 -0
  59. package/lib/module/components/Picker/styles.js +96 -0
  60. package/lib/module/components/Radio/Radio.js +114 -0
  61. package/lib/module/components/Radio/index.js +3 -0
  62. package/lib/module/components/Radio/styles.js +70 -0
  63. package/lib/module/components/SearchInput/SearchInput.js +102 -0
  64. package/lib/module/components/SearchInput/index.js +3 -0
  65. package/lib/module/components/SearchInput/styles.js +106 -0
  66. package/lib/module/components/SideDrawer/SideDrawer.js +161 -0
  67. package/lib/module/components/SideDrawer/index.js +3 -0
  68. package/lib/module/components/SideDrawer/styles.js +89 -0
  69. package/lib/module/components/Skeleton/Skeleton.js +66 -0
  70. package/lib/module/components/Skeleton/index.js +3 -0
  71. package/lib/module/components/Skeleton/styles.js +18 -0
  72. package/lib/module/components/Switch/Switch.js +61 -0
  73. package/lib/module/components/Switch/index.js +3 -0
  74. package/lib/module/components/Switch/styles.js +33 -0
  75. package/lib/module/components/TabBar/TabBar.js +68 -0
  76. package/lib/module/components/TabBar/index.js +3 -0
  77. package/lib/module/components/TabBar/styles.js +84 -0
  78. package/lib/module/components/Tabs/Tabs.js +65 -0
  79. package/lib/module/components/Tabs/index.js +3 -0
  80. package/lib/module/components/Tabs/styles.js +99 -0
  81. package/lib/module/components/Tag/Tag.js +171 -0
  82. package/lib/module/components/Tag/index.js +3 -0
  83. package/lib/module/components/Tag/styles.js +163 -0
  84. package/lib/module/components/TextArea/TextArea.js +74 -0
  85. package/lib/module/components/TextArea/index.js +3 -0
  86. package/lib/module/components/TextArea/styles.js +45 -0
  87. package/lib/module/components/TimePicker/TimePicker.js +262 -0
  88. package/lib/module/components/TimePicker/index.js +3 -0
  89. package/lib/module/components/TimePicker/model.js +63 -0
  90. package/lib/module/components/TimePicker/styles.js +143 -0
  91. package/lib/module/components/Timeline/Timeline.js +154 -0
  92. package/lib/module/components/Timeline/index.js +3 -0
  93. package/lib/module/components/Timeline/model.js +36 -0
  94. package/lib/module/components/Timeline/styles.js +115 -0
  95. package/lib/module/components/Toast/Toast.js +249 -0
  96. package/lib/module/components/Toast/index.js +3 -0
  97. package/lib/module/components/Toast/styles.js +61 -0
  98. package/lib/module/components/Upload/Upload.js +762 -0
  99. package/lib/module/components/Upload/index.js +3 -0
  100. package/lib/module/components/Upload/model.js +3 -0
  101. package/lib/module/components/Upload/picker.js +97 -0
  102. package/lib/module/components/Upload/styles.js +358 -0
  103. package/lib/module/components/index.js +32 -0
  104. package/lib/module/index.js +4 -0
  105. package/lib/module/package.json +1 -0
  106. package/lib/module/ui/tokens.js +174 -0
  107. package/lib/typescript/components/Avatar/Avatar.d.ts +20 -0
  108. package/lib/typescript/components/Avatar/Avatar.d.ts.map +1 -0
  109. package/lib/typescript/components/Avatar/index.d.ts +3 -0
  110. package/lib/typescript/components/Avatar/index.d.ts.map +1 -0
  111. package/lib/typescript/components/Avatar/styles.d.ts +46 -0
  112. package/lib/typescript/components/Avatar/styles.d.ts.map +1 -0
  113. package/lib/typescript/components/BottomActionBar/BottomActionBar.d.ts +17 -0
  114. package/lib/typescript/components/BottomActionBar/BottomActionBar.d.ts.map +1 -0
  115. package/lib/typescript/components/BottomActionBar/index.d.ts +3 -0
  116. package/lib/typescript/components/BottomActionBar/index.d.ts.map +1 -0
  117. package/lib/typescript/components/BottomActionBar/styles.d.ts +19 -0
  118. package/lib/typescript/components/BottomActionBar/styles.d.ts.map +1 -0
  119. package/lib/typescript/components/BottomSheet/BottomSheet.d.ts +19 -0
  120. package/lib/typescript/components/BottomSheet/BottomSheet.d.ts.map +1 -0
  121. package/lib/typescript/components/BottomSheet/index.d.ts +3 -0
  122. package/lib/typescript/components/BottomSheet/index.d.ts.map +1 -0
  123. package/lib/typescript/components/BottomSheet/styles.d.ts +86 -0
  124. package/lib/typescript/components/BottomSheet/styles.d.ts.map +1 -0
  125. package/lib/typescript/components/Button/Button.d.ts +12 -0
  126. package/lib/typescript/components/Button/Button.d.ts.map +1 -0
  127. package/lib/typescript/components/Button/index.d.ts +3 -0
  128. package/lib/typescript/components/Button/index.d.ts.map +1 -0
  129. package/lib/typescript/components/Button/styles.d.ts +48 -0
  130. package/lib/typescript/components/Button/styles.d.ts.map +1 -0
  131. package/lib/typescript/components/Checkbox/Checkbox.d.ts +39 -0
  132. package/lib/typescript/components/Checkbox/Checkbox.d.ts.map +1 -0
  133. package/lib/typescript/components/Checkbox/index.d.ts +3 -0
  134. package/lib/typescript/components/Checkbox/index.d.ts.map +1 -0
  135. package/lib/typescript/components/Checkbox/styles.d.ts +65 -0
  136. package/lib/typescript/components/Checkbox/styles.d.ts.map +1 -0
  137. package/lib/typescript/components/DatePicker/DatePicker.d.ts +40 -0
  138. package/lib/typescript/components/DatePicker/DatePicker.d.ts.map +1 -0
  139. package/lib/typescript/components/DatePicker/index.d.ts +4 -0
  140. package/lib/typescript/components/DatePicker/index.d.ts.map +1 -0
  141. package/lib/typescript/components/DatePicker/model.d.ts +49 -0
  142. package/lib/typescript/components/DatePicker/model.d.ts.map +1 -0
  143. package/lib/typescript/components/DatePicker/styles.d.ts +287 -0
  144. package/lib/typescript/components/DatePicker/styles.d.ts.map +1 -0
  145. package/lib/typescript/components/Dialog/Dialog.d.ts +35 -0
  146. package/lib/typescript/components/Dialog/Dialog.d.ts.map +1 -0
  147. package/lib/typescript/components/Dialog/index.d.ts +3 -0
  148. package/lib/typescript/components/Dialog/index.d.ts.map +1 -0
  149. package/lib/typescript/components/Dialog/styles.d.ts +114 -0
  150. package/lib/typescript/components/Dialog/styles.d.ts.map +1 -0
  151. package/lib/typescript/components/EmptyState/EmptyState.d.ts +13 -0
  152. package/lib/typescript/components/EmptyState/EmptyState.d.ts.map +1 -0
  153. package/lib/typescript/components/EmptyState/index.d.ts +3 -0
  154. package/lib/typescript/components/EmptyState/index.d.ts.map +1 -0
  155. package/lib/typescript/components/EmptyState/styles.d.ts +86 -0
  156. package/lib/typescript/components/EmptyState/styles.d.ts.map +1 -0
  157. package/lib/typescript/components/Field/Field.d.ts +14 -0
  158. package/lib/typescript/components/Field/Field.d.ts.map +1 -0
  159. package/lib/typescript/components/Field/FieldContext.d.ts +8 -0
  160. package/lib/typescript/components/Field/FieldContext.d.ts.map +1 -0
  161. package/lib/typescript/components/Field/index.d.ts +3 -0
  162. package/lib/typescript/components/Field/index.d.ts.map +1 -0
  163. package/lib/typescript/components/Field/styles.d.ts +58 -0
  164. package/lib/typescript/components/Field/styles.d.ts.map +1 -0
  165. package/lib/typescript/components/FilterChips/FilterChips.d.ts +23 -0
  166. package/lib/typescript/components/FilterChips/FilterChips.d.ts.map +1 -0
  167. package/lib/typescript/components/FilterChips/index.d.ts +3 -0
  168. package/lib/typescript/components/FilterChips/index.d.ts.map +1 -0
  169. package/lib/typescript/components/FilterChips/styles.d.ts +75 -0
  170. package/lib/typescript/components/FilterChips/styles.d.ts.map +1 -0
  171. package/lib/typescript/components/Form/Form.d.ts +17 -0
  172. package/lib/typescript/components/Form/Form.d.ts.map +1 -0
  173. package/lib/typescript/components/Form/FormItem.d.ts +29 -0
  174. package/lib/typescript/components/Form/FormItem.d.ts.map +1 -0
  175. package/lib/typescript/components/Form/context.d.ts +8 -0
  176. package/lib/typescript/components/Form/context.d.ts.map +1 -0
  177. package/lib/typescript/components/Form/index.d.ts +12 -0
  178. package/lib/typescript/components/Form/index.d.ts.map +1 -0
  179. package/lib/typescript/components/Form/model.d.ts +82 -0
  180. package/lib/typescript/components/Form/model.d.ts.map +1 -0
  181. package/lib/typescript/components/Form/styles.d.ts +7 -0
  182. package/lib/typescript/components/Form/styles.d.ts.map +1 -0
  183. package/lib/typescript/components/ImagePreview/ImagePreview.d.ts +17 -0
  184. package/lib/typescript/components/ImagePreview/ImagePreview.d.ts.map +1 -0
  185. package/lib/typescript/components/ImagePreview/index.d.ts +3 -0
  186. package/lib/typescript/components/ImagePreview/index.d.ts.map +1 -0
  187. package/lib/typescript/components/ImagePreview/styles.d.ts +87 -0
  188. package/lib/typescript/components/ImagePreview/styles.d.ts.map +1 -0
  189. package/lib/typescript/components/InlineFeedback/InlineFeedback.d.ts +13 -0
  190. package/lib/typescript/components/InlineFeedback/InlineFeedback.d.ts.map +1 -0
  191. package/lib/typescript/components/InlineFeedback/index.d.ts +3 -0
  192. package/lib/typescript/components/InlineFeedback/index.d.ts.map +1 -0
  193. package/lib/typescript/components/InlineFeedback/styles.d.ts +151 -0
  194. package/lib/typescript/components/InlineFeedback/styles.d.ts.map +1 -0
  195. package/lib/typescript/components/Input/Input.d.ts +14 -0
  196. package/lib/typescript/components/Input/Input.d.ts.map +1 -0
  197. package/lib/typescript/components/Input/index.d.ts +3 -0
  198. package/lib/typescript/components/Input/index.d.ts.map +1 -0
  199. package/lib/typescript/components/Input/styles.d.ts +40 -0
  200. package/lib/typescript/components/Input/styles.d.ts.map +1 -0
  201. package/lib/typescript/components/ListSkeleton/ListSkeleton.d.ts +10 -0
  202. package/lib/typescript/components/ListSkeleton/ListSkeleton.d.ts.map +1 -0
  203. package/lib/typescript/components/ListSkeleton/index.d.ts +3 -0
  204. package/lib/typescript/components/ListSkeleton/index.d.ts.map +1 -0
  205. package/lib/typescript/components/ListSkeleton/styles.d.ts +27 -0
  206. package/lib/typescript/components/ListSkeleton/styles.d.ts.map +1 -0
  207. package/lib/typescript/components/NavigationBar/NavigationBar.d.ts +34 -0
  208. package/lib/typescript/components/NavigationBar/NavigationBar.d.ts.map +1 -0
  209. package/lib/typescript/components/NavigationBar/index.d.ts +3 -0
  210. package/lib/typescript/components/NavigationBar/index.d.ts.map +1 -0
  211. package/lib/typescript/components/NavigationBar/styles.d.ts +97 -0
  212. package/lib/typescript/components/NavigationBar/styles.d.ts.map +1 -0
  213. package/lib/typescript/components/Picker/Picker.d.ts +32 -0
  214. package/lib/typescript/components/Picker/Picker.d.ts.map +1 -0
  215. package/lib/typescript/components/Picker/index.d.ts +3 -0
  216. package/lib/typescript/components/Picker/index.d.ts.map +1 -0
  217. package/lib/typescript/components/Picker/styles.d.ts +99 -0
  218. package/lib/typescript/components/Picker/styles.d.ts.map +1 -0
  219. package/lib/typescript/components/Radio/Radio.d.ts +38 -0
  220. package/lib/typescript/components/Radio/Radio.d.ts.map +1 -0
  221. package/lib/typescript/components/Radio/index.d.ts +3 -0
  222. package/lib/typescript/components/Radio/index.d.ts.map +1 -0
  223. package/lib/typescript/components/Radio/styles.d.ts +71 -0
  224. package/lib/typescript/components/Radio/styles.d.ts.map +1 -0
  225. package/lib/typescript/components/SearchInput/SearchInput.d.ts +20 -0
  226. package/lib/typescript/components/SearchInput/SearchInput.d.ts.map +1 -0
  227. package/lib/typescript/components/SearchInput/index.d.ts +3 -0
  228. package/lib/typescript/components/SearchInput/index.d.ts.map +1 -0
  229. package/lib/typescript/components/SearchInput/styles.d.ts +105 -0
  230. package/lib/typescript/components/SearchInput/styles.d.ts.map +1 -0
  231. package/lib/typescript/components/SideDrawer/SideDrawer.d.ts +19 -0
  232. package/lib/typescript/components/SideDrawer/SideDrawer.d.ts.map +1 -0
  233. package/lib/typescript/components/SideDrawer/index.d.ts +3 -0
  234. package/lib/typescript/components/SideDrawer/index.d.ts.map +1 -0
  235. package/lib/typescript/components/SideDrawer/styles.d.ts +88 -0
  236. package/lib/typescript/components/SideDrawer/styles.d.ts.map +1 -0
  237. package/lib/typescript/components/Skeleton/Skeleton.d.ts +11 -0
  238. package/lib/typescript/components/Skeleton/Skeleton.d.ts.map +1 -0
  239. package/lib/typescript/components/Skeleton/index.d.ts +3 -0
  240. package/lib/typescript/components/Skeleton/index.d.ts.map +1 -0
  241. package/lib/typescript/components/Skeleton/styles.d.ts +15 -0
  242. package/lib/typescript/components/Skeleton/styles.d.ts.map +1 -0
  243. package/lib/typescript/components/Switch/Switch.d.ts +9 -0
  244. package/lib/typescript/components/Switch/Switch.d.ts.map +1 -0
  245. package/lib/typescript/components/Switch/index.d.ts +3 -0
  246. package/lib/typescript/components/Switch/index.d.ts.map +1 -0
  247. package/lib/typescript/components/Switch/styles.d.ts +30 -0
  248. package/lib/typescript/components/Switch/styles.d.ts.map +1 -0
  249. package/lib/typescript/components/TabBar/TabBar.d.ts +26 -0
  250. package/lib/typescript/components/TabBar/TabBar.d.ts.map +1 -0
  251. package/lib/typescript/components/TabBar/index.d.ts +3 -0
  252. package/lib/typescript/components/TabBar/index.d.ts.map +1 -0
  253. package/lib/typescript/components/TabBar/styles.d.ts +82 -0
  254. package/lib/typescript/components/TabBar/styles.d.ts.map +1 -0
  255. package/lib/typescript/components/Tabs/Tabs.d.ts +21 -0
  256. package/lib/typescript/components/Tabs/Tabs.d.ts.map +1 -0
  257. package/lib/typescript/components/Tabs/index.d.ts +3 -0
  258. package/lib/typescript/components/Tabs/index.d.ts.map +1 -0
  259. package/lib/typescript/components/Tabs/styles.d.ts +100 -0
  260. package/lib/typescript/components/Tabs/styles.d.ts.map +1 -0
  261. package/lib/typescript/components/Tag/Tag.d.ts +22 -0
  262. package/lib/typescript/components/Tag/Tag.d.ts.map +1 -0
  263. package/lib/typescript/components/Tag/index.d.ts +3 -0
  264. package/lib/typescript/components/Tag/index.d.ts.map +1 -0
  265. package/lib/typescript/components/Tag/styles.d.ts +164 -0
  266. package/lib/typescript/components/Tag/styles.d.ts.map +1 -0
  267. package/lib/typescript/components/TextArea/TextArea.d.ts +16 -0
  268. package/lib/typescript/components/TextArea/TextArea.d.ts.map +1 -0
  269. package/lib/typescript/components/TextArea/index.d.ts +3 -0
  270. package/lib/typescript/components/TextArea/index.d.ts.map +1 -0
  271. package/lib/typescript/components/TextArea/styles.d.ts +46 -0
  272. package/lib/typescript/components/TextArea/styles.d.ts.map +1 -0
  273. package/lib/typescript/components/TimePicker/TimePicker.d.ts +17 -0
  274. package/lib/typescript/components/TimePicker/TimePicker.d.ts.map +1 -0
  275. package/lib/typescript/components/TimePicker/index.d.ts +4 -0
  276. package/lib/typescript/components/TimePicker/index.d.ts.map +1 -0
  277. package/lib/typescript/components/TimePicker/model.d.ts +16 -0
  278. package/lib/typescript/components/TimePicker/model.d.ts.map +1 -0
  279. package/lib/typescript/components/TimePicker/styles.d.ts +150 -0
  280. package/lib/typescript/components/TimePicker/styles.d.ts.map +1 -0
  281. package/lib/typescript/components/Timeline/Timeline.d.ts +12 -0
  282. package/lib/typescript/components/Timeline/Timeline.d.ts.map +1 -0
  283. package/lib/typescript/components/Timeline/index.d.ts +4 -0
  284. package/lib/typescript/components/Timeline/index.d.ts.map +1 -0
  285. package/lib/typescript/components/Timeline/model.d.ts +45 -0
  286. package/lib/typescript/components/Timeline/model.d.ts.map +1 -0
  287. package/lib/typescript/components/Timeline/styles.d.ts +120 -0
  288. package/lib/typescript/components/Timeline/styles.d.ts.map +1 -0
  289. package/lib/typescript/components/Toast/Toast.d.ts +30 -0
  290. package/lib/typescript/components/Toast/Toast.d.ts.map +1 -0
  291. package/lib/typescript/components/Toast/index.d.ts +3 -0
  292. package/lib/typescript/components/Toast/index.d.ts.map +1 -0
  293. package/lib/typescript/components/Toast/styles.d.ts +59 -0
  294. package/lib/typescript/components/Toast/styles.d.ts.map +1 -0
  295. package/lib/typescript/components/Upload/Upload.d.ts +31 -0
  296. package/lib/typescript/components/Upload/Upload.d.ts.map +1 -0
  297. package/lib/typescript/components/Upload/index.d.ts +4 -0
  298. package/lib/typescript/components/Upload/index.d.ts.map +1 -0
  299. package/lib/typescript/components/Upload/model.d.ts +50 -0
  300. package/lib/typescript/components/Upload/model.d.ts.map +1 -0
  301. package/lib/typescript/components/Upload/picker.d.ts +13 -0
  302. package/lib/typescript/components/Upload/picker.d.ts.map +1 -0
  303. package/lib/typescript/components/Upload/styles.d.ts +376 -0
  304. package/lib/typescript/components/Upload/styles.d.ts.map +1 -0
  305. package/lib/typescript/components/index.d.ts +61 -0
  306. package/lib/typescript/components/index.d.ts.map +1 -0
  307. package/lib/typescript/index.d.ts +3 -0
  308. package/lib/typescript/index.d.ts.map +1 -0
  309. package/lib/typescript/package.json +1 -0
  310. package/lib/typescript/ui/tokens.d.ts +167 -0
  311. package/lib/typescript/ui/tokens.d.ts.map +1 -0
  312. package/package.json +216 -6
  313. package/src/components/Avatar/Avatar.tsx +192 -0
  314. package/src/components/Avatar/README.md +32 -0
  315. package/src/components/Avatar/index.ts +2 -0
  316. package/src/components/Avatar/styles.ts +49 -0
  317. package/src/components/BottomActionBar/BottomActionBar.tsx +53 -0
  318. package/src/components/BottomActionBar/README.md +50 -0
  319. package/src/components/BottomActionBar/index.ts +2 -0
  320. package/src/components/BottomActionBar/styles.ts +22 -0
  321. package/src/components/BottomSheet/BottomSheet.tsx +136 -0
  322. package/src/components/BottomSheet/README.md +51 -0
  323. package/src/components/BottomSheet/index.ts +2 -0
  324. package/src/components/BottomSheet/styles.ts +84 -0
  325. package/src/components/Button/Button.tsx +65 -0
  326. package/src/components/Button/README.md +59 -0
  327. package/src/components/Button/index.ts +2 -0
  328. package/src/components/Button/styles.ts +50 -0
  329. package/src/components/Checkbox/Checkbox.tsx +220 -0
  330. package/src/components/Checkbox/README.md +60 -0
  331. package/src/components/Checkbox/index.ts +2 -0
  332. package/src/components/Checkbox/styles.ts +64 -0
  333. package/src/components/DatePicker/DatePicker.tsx +728 -0
  334. package/src/components/DatePicker/README.md +88 -0
  335. package/src/components/DatePicker/index.ts +9 -0
  336. package/src/components/DatePicker/model.ts +316 -0
  337. package/src/components/DatePicker/styles.ts +267 -0
  338. package/src/components/Dialog/Dialog.tsx +254 -0
  339. package/src/components/Dialog/README.md +98 -0
  340. package/src/components/Dialog/index.ts +2 -0
  341. package/src/components/Dialog/styles.ts +109 -0
  342. package/src/components/EmptyState/EmptyState.tsx +58 -0
  343. package/src/components/EmptyState/README.md +44 -0
  344. package/src/components/EmptyState/index.ts +2 -0
  345. package/src/components/EmptyState/styles.ts +82 -0
  346. package/src/components/Field/Field.tsx +59 -0
  347. package/src/components/Field/FieldContext.ts +13 -0
  348. package/src/components/Field/README.md +68 -0
  349. package/src/components/Field/index.ts +2 -0
  350. package/src/components/Field/styles.ts +56 -0
  351. package/src/components/FilterChips/FilterChips.tsx +110 -0
  352. package/src/components/FilterChips/README.md +69 -0
  353. package/src/components/FilterChips/index.ts +2 -0
  354. package/src/components/FilterChips/styles.ts +72 -0
  355. package/src/components/Form/Form.tsx +77 -0
  356. package/src/components/Form/FormItem.tsx +204 -0
  357. package/src/components/Form/README.md +101 -0
  358. package/src/components/Form/context.ts +11 -0
  359. package/src/components/Form/index.ts +25 -0
  360. package/src/components/Form/model.ts +427 -0
  361. package/src/components/Form/styles.ts +10 -0
  362. package/src/components/ImagePreview/ImagePreview.tsx +207 -0
  363. package/src/components/ImagePreview/README.md +51 -0
  364. package/src/components/ImagePreview/index.ts +2 -0
  365. package/src/components/ImagePreview/styles.ts +87 -0
  366. package/src/components/InlineFeedback/InlineFeedback.tsx +88 -0
  367. package/src/components/InlineFeedback/README.md +47 -0
  368. package/src/components/InlineFeedback/index.ts +2 -0
  369. package/src/components/InlineFeedback/styles.ts +140 -0
  370. package/src/components/Input/Input.tsx +79 -0
  371. package/src/components/Input/README.md +62 -0
  372. package/src/components/Input/index.ts +2 -0
  373. package/src/components/Input/styles.ts +41 -0
  374. package/src/components/ListSkeleton/ListSkeleton.tsx +48 -0
  375. package/src/components/ListSkeleton/README.md +37 -0
  376. package/src/components/ListSkeleton/index.ts +2 -0
  377. package/src/components/ListSkeleton/styles.ts +30 -0
  378. package/src/components/NavigationBar/NavigationBar.tsx +218 -0
  379. package/src/components/NavigationBar/README.md +72 -0
  380. package/src/components/NavigationBar/index.ts +7 -0
  381. package/src/components/NavigationBar/styles.ts +98 -0
  382. package/src/components/Picker/Picker.tsx +238 -0
  383. package/src/components/Picker/README.md +76 -0
  384. package/src/components/Picker/index.ts +8 -0
  385. package/src/components/Picker/styles.ts +94 -0
  386. package/src/components/README.md +44 -0
  387. package/src/components/Radio/README.md +52 -0
  388. package/src/components/Radio/Radio.tsx +195 -0
  389. package/src/components/Radio/index.ts +2 -0
  390. package/src/components/Radio/styles.ts +70 -0
  391. package/src/components/SearchInput/README.md +48 -0
  392. package/src/components/SearchInput/SearchInput.tsx +131 -0
  393. package/src/components/SearchInput/index.ts +2 -0
  394. package/src/components/SearchInput/styles.ts +100 -0
  395. package/src/components/SideDrawer/README.md +48 -0
  396. package/src/components/SideDrawer/SideDrawer.tsx +198 -0
  397. package/src/components/SideDrawer/index.ts +2 -0
  398. package/src/components/SideDrawer/styles.ts +86 -0
  399. package/src/components/Skeleton/README.md +38 -0
  400. package/src/components/Skeleton/Skeleton.tsx +108 -0
  401. package/src/components/Skeleton/index.ts +2 -0
  402. package/src/components/Skeleton/styles.ts +18 -0
  403. package/src/components/Switch/README.md +27 -0
  404. package/src/components/Switch/Switch.tsx +77 -0
  405. package/src/components/Switch/index.ts +2 -0
  406. package/src/components/Switch/styles.ts +33 -0
  407. package/src/components/TabBar/README.md +66 -0
  408. package/src/components/TabBar/TabBar.tsx +93 -0
  409. package/src/components/TabBar/index.ts +2 -0
  410. package/src/components/TabBar/styles.ts +81 -0
  411. package/src/components/Tabs/README.md +64 -0
  412. package/src/components/Tabs/Tabs.tsx +114 -0
  413. package/src/components/Tabs/index.ts +2 -0
  414. package/src/components/Tabs/styles.ts +99 -0
  415. package/src/components/Tag/README.md +60 -0
  416. package/src/components/Tag/Tag.tsx +166 -0
  417. package/src/components/Tag/index.ts +2 -0
  418. package/src/components/Tag/styles.ts +159 -0
  419. package/src/components/TextArea/README.md +61 -0
  420. package/src/components/TextArea/TextArea.tsx +114 -0
  421. package/src/components/TextArea/index.ts +2 -0
  422. package/src/components/TextArea/styles.ts +45 -0
  423. package/src/components/TimePicker/README.md +62 -0
  424. package/src/components/TimePicker/TimePicker.tsx +343 -0
  425. package/src/components/TimePicker/index.ts +3 -0
  426. package/src/components/TimePicker/model.ts +88 -0
  427. package/src/components/TimePicker/styles.ts +141 -0
  428. package/src/components/Timeline/README.md +81 -0
  429. package/src/components/Timeline/Timeline.tsx +197 -0
  430. package/src/components/Timeline/index.ts +12 -0
  431. package/src/components/Timeline/model.ts +87 -0
  432. package/src/components/Timeline/styles.ts +115 -0
  433. package/src/components/Toast/README.md +68 -0
  434. package/src/components/Toast/Toast.tsx +310 -0
  435. package/src/components/Toast/index.ts +8 -0
  436. package/src/components/Toast/styles.ts +58 -0
  437. package/src/components/Upload/README.md +93 -0
  438. package/src/components/Upload/Upload.tsx +839 -0
  439. package/src/components/Upload/index.ts +14 -0
  440. package/src/components/Upload/model.ts +61 -0
  441. package/src/components/Upload/picker.ts +125 -0
  442. package/src/components/Upload/styles.ts +358 -0
  443. package/src/components/index.ts +119 -0
  444. package/src/index.ts +2 -0
  445. package/src/ui/tokens.ts +144 -0
package/CHANGELOG.md ADDED
@@ -0,0 +1,11 @@
1
+ # 更新记录
2
+
3
+ ## 0.1.0
4
+
5
+ - 品牌统一为 WN UI,npm 包名为 wn-native-ui,同步展示项目、导入路径及安装文档。
6
+
7
+ - 提取 30 组 React Native 公共组件,保留原交互与默认视觉。
8
+ - 移除原项目的路径别名,提供包入口、组件子路径和 token 导出。
9
+ - 增加 ES Module、TypeScript 声明、npm 打包和格式化配置。
10
+ - 展示应用独立放入 example,通过实际 tgz 安装组件库。
11
+ - 原始提取文件保存在 archive,不随 npm 包分发。
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 yee
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,128 @@
1
- # Temporary Holding Version
2
-
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
1
+ # WN UI
2
+
3
+ 30 组可复用的 React Native 公共组件,提供 TypeScript 类型、统一入口、单组件子路径和默认 UI token。不依赖原项目的路由、接口、登录态或 `@/` 路径别名。
4
+
5
+ 包名 `wn-native-ui`、版本 `0.1.0`,目前仅用于本地安装,尚未发布到 npm。`private: true` 防止误发布;`UNLICENSED` 表示尚未授权公开分发,并非开源许可证。
6
+
7
+ ## 在其他项目安装
8
+
9
+ 适用于 Expo / React Native 工程,不是普通 React DOM 组件库。本版沿用源项目依赖范围:Expo SDK 56、React 19.2.3、React Native 0.85.3。其他版本需单独验证,不建议使用 `--force` 跳过依赖冲突。
10
+
11
+ 在已有的兼容 Expo 工程根目录执行:
12
+
13
+ ```powershell
14
+ npx expo install expo-document-picker expo-image expo-image-picker expo-linear-gradient react-native-safe-area-context react-native-svg
15
+ npm install "D:/code/compontent/artifacts/wn-native-ui-0.1.0.tgz"
16
+ ```
17
+
18
+ 也可将 `.tgz` 复制到目标项目的 `vendor/` 后执行:
19
+
20
+ ```bash
21
+ npm install ./vendor/wn-native-ui-0.1.0.tgz
22
+ ```
23
+
24
+ 推荐安装 tgz,避免本地目录链接导致 React 多实例。不要从公共 npm 仓库直接安装同名包:此包尚未发布,同名包可能属于其他人。
25
+
26
+ 裸 React Native 工程需要先接入 Expo Modules,并安装兼容的原生依赖。iOS 按宿主流程安装 Pods;新增原生模块或更改相机/相册权限后需要重新构建 App。
27
+
28
+ ## 最小示例
29
+
30
+ ```tsx
31
+ import { View } from 'react-native';
32
+ import { SafeAreaProvider } from 'react-native-safe-area-context';
33
+ import { Button, Toast, ToastProvider } from 'wn-native-ui';
34
+
35
+ export default function App() {
36
+ return (
37
+ <SafeAreaProvider>
38
+ <ToastProvider>
39
+ <View style={{ flex: 1, justifyContent: 'center', padding: 24 }}>
40
+ <Button onPress={() => Toast.success('保存成功')}>保存</Button>
41
+ </View>
42
+ </ToastProvider>
43
+ </SafeAreaProvider>
44
+ );
45
+ }
46
+ ```
47
+
48
+ 宿主已有 SafeAreaProvider 时沿用现有 Provider。ToastProvider 全局挂载一次。库不要求使用 Expo Router,路由依赖仅属于展示项目。
49
+
50
+ 统一入口与子路径都可使用:
51
+
52
+ ```tsx
53
+ import { Button, Form, Input, type ButtonProps } from 'wn-native-ui';
54
+ import { DatePicker, type DatePickerProps } from 'wn-native-ui/DatePicker';
55
+ import { uiTokens } from 'wn-native-ui/tokens';
56
+ ```
57
+
58
+ 子路径只公开组件入口,不公开内部实现。单组件导入不意味着可以忽略本版声明的 peerDependencies。
59
+
60
+ ## 宿主责任与兼容边界
61
+
62
+ - 业务数据、接口请求和持久化由宿主提供。
63
+ - Upload 的 `upload` 回调由宿主对接真实上传服务;不提供时选择结果保留为待上传。展示页的 simulateUpload 仅供演示。
64
+ - 相机、相册、文件选择依赖 Expo 模块;权限文案、系统授权和原生构建由宿主配置。图片选择器插件配置可参考 `example/app.json`。
65
+ - 保留原组件默认视觉,可通过已暴露的 style、titleStyle 等属性调整。uiTokens 用于读取默认样式,本版没有运行时主题切换,不应修改 token 对象来切换主题。
66
+ - 默认文案含中文,是否可以覆盖取决于各组件 Props;本版未完成完整国际化。
67
+ - Web 需要 React Native Web。SSR、Node 服务端直接渲染及纯 React DOM 项目不在验证范围。
68
+
69
+ Props、事件与示例见 [组件目录](src/components/README.md) 及各组件的 README。
70
+
71
+ ## 开发和打包
72
+
73
+ 本次工具环境为 Node.js 22.22.0 / npm 10.9.4。
74
+
75
+ ```bash
76
+ npm ci
77
+ npm run format
78
+ npm run format:check
79
+ npm run typecheck
80
+ npm run build
81
+ npm run verify:package
82
+ npm pack --dry-run
83
+ ```
84
+
85
+ 生成安装包:
86
+
87
+ ```powershell
88
+ New-Item -ItemType Directory -Path artifacts -Force
89
+ npm pack --pack-destination artifacts
90
+ ```
91
+
92
+ prepack 自动执行类型检查、构建和包入口检查。安装 tgz 不会在使用方执行组件库构建。lib 包含 ES Module 与 `.d.ts` 声明;运行时依赖由宿主提供,React 没有打进产物。
93
+
94
+ ## 展示项目
95
+
96
+ 先生成 tgz,再执行:
97
+
98
+ ```bash
99
+ cd example
100
+ npm ci
101
+ npm run typecheck
102
+ npm run android
103
+ ```
104
+
105
+ macOS / Xcode 环境可运行 `npm run ios`。`npm run web` 用于 Web 布局检查,示例固定使用端口 5188,请先确保可用。
106
+
107
+ 示例使用 `file:../artifacts/wn-native-ui-0.1.0.tgz` 安装真实包,不使用指向库源码的别名。库更新后需要重新打包并更新安装;正式维护时递增版本,同时更新示例的 tgz 路径和锁文件,避免同版本缓存。
108
+
109
+ ## 目录
110
+
111
+ ```text
112
+ src/index.ts 公共包入口
113
+ src/components/ 30 组组件与文档
114
+ src/ui/tokens.ts 默认样式 token
115
+ lib/ 自动生成的 JS 与类型声明
116
+ example/ 独立 Expo 展示应用
117
+ scripts/verify-package.mjs 包入口、路径及依赖检查
118
+ artifacts/ npm 安装包
119
+ archive/ 原始提取 ZIP、清单、依赖记录和说明
120
+ ```
121
+
122
+ archive 的 SHA-256 清单仅对应原始备份,不对应整理后的文件。example、archive、artifacts、锁文件和开发脚本不随 npm 包分发。
123
+
124
+ ## 发布准备
125
+
126
+ 发布前确定自己拥有的 npm 包名或 scope、分发范围和许可证,再调整 private、license、包名及示例中的导入路径。本次没有登录或发布到 npm。
127
+
128
+ 构建参考 [React Native Builder Bob](https://oss.callstack.com/react-native-builder-bob/build),打包参考 [npm pack](https://docs.npmjs.com/cli/v11/commands/npm-pack/)。
@@ -0,0 +1,131 @@
1
+ "use strict";
2
+
3
+ import { useMemo, useState } from 'react';
4
+ import { Image, Text, View } from 'react-native';
5
+ import { styles } from "./styles.js";
6
+ import { jsx as _jsx } from "react/jsx-runtime";
7
+ export function Avatar({
8
+ accessibilityLabel,
9
+ decorative = false,
10
+ fallback,
11
+ label,
12
+ shape = 'circle',
13
+ size = 'large',
14
+ source,
15
+ src,
16
+ style,
17
+ testID,
18
+ textStyle,
19
+ tone = 'accent'
20
+ }) {
21
+ const [failedImageKey, setFailedImageKey] = useState('');
22
+ const imageSource = source ?? (src ? {
23
+ uri: src
24
+ } : undefined);
25
+ const imageSourceKey = useMemo(() => getImageSourceKey(source, src), [source, src]);
26
+ const sizeValue = resolveAvatarSize(size);
27
+ const radius = shape === 'circle' ? sizeValue / 2 : resolveRoundedRadius(sizeValue);
28
+ const textMetrics = resolveTextMetrics(sizeValue);
29
+ const initial = getAvatarInitial(fallback ?? label);
30
+ const showImage = Boolean(imageSource && failedImageKey !== imageSourceKey);
31
+ return /*#__PURE__*/_jsx(View, {
32
+ accessibilityElementsHidden: decorative,
33
+ accessibilityLabel: decorative ? undefined : accessibilityLabel ?? getAvatarAccessibilityLabel(label),
34
+ accessibilityRole: decorative ? undefined : 'image',
35
+ accessible: !decorative,
36
+ importantForAccessibility: decorative ? 'no-hide-descendants' : 'auto',
37
+ style: [styles.root, stylesByTone[tone].root, {
38
+ borderRadius: radius,
39
+ height: sizeValue,
40
+ width: sizeValue
41
+ }, style],
42
+ testID: testID,
43
+ children: showImage && imageSource ? /*#__PURE__*/_jsx(Image, {
44
+ accessibilityIgnoresInvertColors: true,
45
+ onError: () => setFailedImageKey(imageSourceKey),
46
+ resizeMode: "cover",
47
+ source: imageSource,
48
+ style: [styles.image, {
49
+ borderRadius: radius
50
+ }]
51
+ }) : /*#__PURE__*/_jsx(Text, {
52
+ allowFontScaling: false,
53
+ numberOfLines: 1,
54
+ style: [styles.text, stylesByTone[tone].text, textMetrics, textStyle],
55
+ children: initial
56
+ })
57
+ });
58
+ }
59
+ const stylesByTone = {
60
+ accent: {
61
+ root: styles.accentRoot,
62
+ text: styles.accentText
63
+ },
64
+ neutral: {
65
+ root: styles.neutralRoot,
66
+ text: styles.neutralText
67
+ }
68
+ };
69
+ function resolveAvatarSize(size) {
70
+ if (typeof size === 'number') {
71
+ return Math.max(20, size);
72
+ }
73
+ const sizes = {
74
+ large: 52,
75
+ medium: 40,
76
+ profile: 72,
77
+ small: 32
78
+ };
79
+ return sizes[size];
80
+ }
81
+ function resolveRoundedRadius(size) {
82
+ if (size >= 52) {
83
+ return 18;
84
+ }
85
+ if (size >= 40) {
86
+ return 14;
87
+ }
88
+ return 12;
89
+ }
90
+ function resolveTextMetrics(size) {
91
+ if (size >= 64) {
92
+ return styles.profileText;
93
+ }
94
+ if (size >= 52) {
95
+ return styles.largeText;
96
+ }
97
+ if (size >= 40) {
98
+ return styles.mediumText;
99
+ }
100
+ return styles.smallText;
101
+ }
102
+ function getAvatarInitial(value) {
103
+ const normalized = value?.trim();
104
+ if (!normalized) {
105
+ return '学';
106
+ }
107
+ return Array.from(normalized)[0] ?? '学';
108
+ }
109
+ function getAvatarAccessibilityLabel(label) {
110
+ const normalized = label?.trim();
111
+ if (!normalized) {
112
+ return '头像';
113
+ }
114
+ return `${normalized}头像`;
115
+ }
116
+ function getImageSourceKey(source, src) {
117
+ if (src) {
118
+ return src;
119
+ }
120
+ if (!source) {
121
+ return '';
122
+ }
123
+ if (typeof source === 'number') {
124
+ return String(source);
125
+ }
126
+ try {
127
+ return JSON.stringify(source);
128
+ } catch {
129
+ return 'source';
130
+ }
131
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+
3
+ export { Avatar } from "./Avatar.js";
@@ -0,0 +1,49 @@
1
+ "use strict";
2
+
3
+ import { StyleSheet } from 'react-native';
4
+ import { uiTokens as token } from "../../ui/tokens.js";
5
+ export const styles = StyleSheet.create({
6
+ accentRoot: {
7
+ backgroundColor: token.color.bgSelected
8
+ },
9
+ accentText: {
10
+ color: token.color.tintDefault
11
+ },
12
+ image: {
13
+ height: '100%',
14
+ width: '100%'
15
+ },
16
+ largeText: {
17
+ fontSize: 20,
18
+ lineHeight: 25
19
+ },
20
+ mediumText: {
21
+ fontSize: 16,
22
+ lineHeight: 21
23
+ },
24
+ neutralRoot: {
25
+ backgroundColor: token.color.bgDisabled
26
+ },
27
+ neutralText: {
28
+ color: token.color.labelSecondary
29
+ },
30
+ profileText: {
31
+ fontSize: 26,
32
+ lineHeight: 32
33
+ },
34
+ root: {
35
+ alignItems: 'center',
36
+ flexShrink: 0,
37
+ justifyContent: 'center',
38
+ overflow: 'hidden'
39
+ },
40
+ smallText: {
41
+ fontSize: 13,
42
+ lineHeight: 18
43
+ },
44
+ text: {
45
+ fontWeight: '700',
46
+ includeFontPadding: false,
47
+ textAlign: 'center'
48
+ }
49
+ });
@@ -0,0 +1,43 @@
1
+ "use strict";
2
+
3
+ import { View } from 'react-native';
4
+ import { SafeAreaView } from 'react-native-safe-area-context';
5
+ import { Button } from "../Button/index.js";
6
+ import { styles } from "./styles.js";
7
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
8
+ function ActionButton({
9
+ action,
10
+ defaultVariant
11
+ }) {
12
+ return /*#__PURE__*/_jsx(View, {
13
+ style: styles.action,
14
+ children: /*#__PURE__*/_jsx(Button, {
15
+ accessibilityHint: action.accessibilityHint,
16
+ disabled: action.disabled,
17
+ loading: action.loading,
18
+ onPress: action.onPress,
19
+ variant: action.variant ?? defaultVariant,
20
+ children: action.label
21
+ })
22
+ });
23
+ }
24
+ export function BottomActionBar({
25
+ primary,
26
+ secondary,
27
+ style
28
+ }) {
29
+ return /*#__PURE__*/_jsx(SafeAreaView, {
30
+ edges: ['bottom'],
31
+ style: [styles.safeArea, style],
32
+ children: /*#__PURE__*/_jsxs(View, {
33
+ style: styles.actions,
34
+ children: [secondary ? /*#__PURE__*/_jsx(ActionButton, {
35
+ action: secondary,
36
+ defaultVariant: "secondary"
37
+ }) : null, /*#__PURE__*/_jsx(ActionButton, {
38
+ action: primary,
39
+ defaultVariant: "primary"
40
+ })]
41
+ })
42
+ });
43
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+
3
+ export { BottomActionBar } from "./BottomActionBar.js";
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+
3
+ import { StyleSheet } from 'react-native';
4
+ import { uiTokens as token } from "../../ui/tokens.js";
5
+ export const styles = StyleSheet.create({
6
+ action: {
7
+ flex: 1
8
+ },
9
+ actions: {
10
+ flexDirection: 'row',
11
+ gap: token.space.s12,
12
+ paddingHorizontal: token.space.s16,
13
+ paddingTop: token.space.s8
14
+ },
15
+ safeArea: {
16
+ alignSelf: 'stretch',
17
+ backgroundColor: token.color.bgSecondary,
18
+ borderTopColor: token.color.separator,
19
+ borderTopWidth: 1,
20
+ paddingBottom: token.space.s8
21
+ }
22
+ });
@@ -0,0 +1,103 @@
1
+ "use strict";
2
+
3
+ import { ActivityIndicator, KeyboardAvoidingView, Modal, Platform, Pressable, ScrollView, Text, View } from 'react-native';
4
+ import { SafeAreaView } from 'react-native-safe-area-context';
5
+ import { uiTokens as token } from "../../ui/tokens.js";
6
+ import { styles } from "./styles.js";
7
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
8
+ export function BottomSheet({
9
+ cancelText = '取消',
10
+ children,
11
+ confirmDisabled = false,
12
+ confirmLoading = false,
13
+ confirmText = '确定',
14
+ contentContainerStyle,
15
+ header,
16
+ onCancel,
17
+ onClose,
18
+ onConfirm,
19
+ onDismiss,
20
+ scrollable = true,
21
+ title,
22
+ visible
23
+ }) {
24
+ const hasConfirmation = Boolean(onConfirm);
25
+ const confirmUnavailable = confirmDisabled || confirmLoading;
26
+ const content = scrollable ? /*#__PURE__*/_jsx(ScrollView, {
27
+ contentContainerStyle: [styles.content, contentContainerStyle],
28
+ keyboardShouldPersistTaps: "handled",
29
+ showsVerticalScrollIndicator: false,
30
+ style: styles.scrollView,
31
+ children: children
32
+ }) : /*#__PURE__*/_jsx(View, {
33
+ style: [styles.content, contentContainerStyle],
34
+ children: children
35
+ });
36
+ return /*#__PURE__*/_jsx(Modal, {
37
+ animationType: "slide",
38
+ onDismiss: onDismiss,
39
+ onRequestClose: onClose,
40
+ presentationStyle: "overFullScreen",
41
+ statusBarTranslucent: true,
42
+ transparent: true,
43
+ visible: visible,
44
+ children: /*#__PURE__*/_jsxs(KeyboardAvoidingView, {
45
+ accessibilityViewIsModal: true,
46
+ behavior: Platform.OS === 'ios' ? 'padding' : undefined,
47
+ style: styles.modalRoot,
48
+ children: [/*#__PURE__*/_jsx(Pressable, {
49
+ accessibilityLabel: `关闭${title}`,
50
+ accessibilityRole: "button",
51
+ onPress: onClose,
52
+ style: styles.backdrop
53
+ }), /*#__PURE__*/_jsxs(SafeAreaView, {
54
+ edges: ['bottom'],
55
+ style: styles.sheet,
56
+ children: [/*#__PURE__*/_jsx(View, {
57
+ style: styles.grabberArea,
58
+ children: /*#__PURE__*/_jsx(View, {
59
+ style: styles.grabber
60
+ })
61
+ }), header ?? /*#__PURE__*/_jsxs(View, {
62
+ style: styles.header,
63
+ children: [hasConfirmation ? /*#__PURE__*/_jsx(Pressable, {
64
+ accessibilityRole: "button",
65
+ onPress: onCancel ?? onClose,
66
+ style: ({
67
+ pressed
68
+ }) => [styles.action, pressed && styles.pressed],
69
+ children: /*#__PURE__*/_jsx(Text, {
70
+ style: styles.cancelText,
71
+ children: cancelText
72
+ })
73
+ }) : /*#__PURE__*/_jsx(View, {
74
+ style: styles.action
75
+ }), /*#__PURE__*/_jsx(Text, {
76
+ accessibilityRole: "header",
77
+ numberOfLines: 1,
78
+ style: styles.title,
79
+ children: title
80
+ }), /*#__PURE__*/_jsx(Pressable, {
81
+ accessibilityRole: "button",
82
+ accessibilityState: {
83
+ busy: confirmLoading,
84
+ disabled: hasConfirmation && confirmUnavailable
85
+ },
86
+ disabled: hasConfirmation && confirmUnavailable,
87
+ onPress: onConfirm ?? onClose,
88
+ style: ({
89
+ pressed
90
+ }) => [styles.action, styles.actionEnd, hasConfirmation && confirmUnavailable && styles.disabled, pressed && styles.pressed],
91
+ children: confirmLoading ? /*#__PURE__*/_jsx(ActivityIndicator, {
92
+ color: token.color.tintDefault,
93
+ size: "small"
94
+ }) : /*#__PURE__*/_jsx(Text, {
95
+ style: styles.confirmText,
96
+ children: hasConfirmation ? confirmText : '关闭'
97
+ })
98
+ })]
99
+ }), content]
100
+ })]
101
+ })
102
+ });
103
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+
3
+ export { BottomSheet } from "./BottomSheet.js";
@@ -0,0 +1,84 @@
1
+ "use strict";
2
+
3
+ import { StyleSheet } from 'react-native';
4
+ import { uiTokens as token } from "../../ui/tokens.js";
5
+ export const styles = StyleSheet.create({
6
+ action: {
7
+ alignItems: 'flex-start',
8
+ justifyContent: 'center',
9
+ minHeight: token.size.minTouch,
10
+ minWidth: token.size.minTouch,
11
+ paddingHorizontal: token.space.s16
12
+ },
13
+ actionEnd: {
14
+ alignItems: 'flex-end'
15
+ },
16
+ backdrop: {
17
+ bottom: 0,
18
+ left: 0,
19
+ position: 'absolute',
20
+ right: 0,
21
+ top: 0
22
+ },
23
+ cancelText: {
24
+ color: token.color.labelSecondary,
25
+ ...token.type.subheadline
26
+ },
27
+ confirmText: {
28
+ color: token.color.tintPressed,
29
+ ...token.type.subheadline,
30
+ fontWeight: '600'
31
+ },
32
+ content: {
33
+ gap: token.space.s12,
34
+ paddingBottom: token.space.s16,
35
+ paddingHorizontal: token.space.s16
36
+ },
37
+ disabled: {
38
+ opacity: token.opacity.disabled
39
+ },
40
+ grabber: {
41
+ backgroundColor: token.color.labelTertiary,
42
+ borderRadius: token.radius.capsule,
43
+ height: token.size.bottomSheetGrabberHeight,
44
+ opacity: token.opacity.disabled,
45
+ width: token.size.bottomSheetGrabberWidth
46
+ },
47
+ grabberArea: {
48
+ alignItems: 'center',
49
+ minHeight: token.space.s20,
50
+ paddingTop: token.space.s8
51
+ },
52
+ header: {
53
+ alignItems: 'center',
54
+ flexDirection: 'row',
55
+ minHeight: token.size.minTouch
56
+ },
57
+ modalRoot: {
58
+ backgroundColor: token.color.overlayScrim,
59
+ flex: 1,
60
+ justifyContent: 'flex-end'
61
+ },
62
+ pressed: {
63
+ opacity: token.opacity.pressed
64
+ },
65
+ scrollView: {
66
+ flexShrink: 1
67
+ },
68
+ sheet: {
69
+ alignSelf: 'center',
70
+ backgroundColor: token.color.bgSecondary,
71
+ borderTopLeftRadius: token.radius.large,
72
+ borderTopRightRadius: token.radius.large,
73
+ maxHeight: '86%',
74
+ maxWidth: token.size.bottomSheetMaxWidth,
75
+ overflow: 'hidden',
76
+ width: '100%'
77
+ },
78
+ title: {
79
+ color: token.color.labelPrimary,
80
+ flex: 1,
81
+ textAlign: 'center',
82
+ ...token.type.headline
83
+ }
84
+ });
@@ -0,0 +1,38 @@
1
+ "use strict";
2
+
3
+ import { ActivityIndicator, Pressable, Text } from 'react-native';
4
+ import { uiTokens as token } from "../../ui/tokens.js";
5
+ import { styles } from "./styles.js";
6
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
7
+ export function Button({
8
+ accessibilityState,
9
+ children,
10
+ disabled = false,
11
+ loading = false,
12
+ style,
13
+ variant = 'primary',
14
+ ...pressableProps
15
+ }) {
16
+ const isDisabled = disabled || loading;
17
+ const spinnerColor = variant === 'secondary' ? token.color.tintDefault : token.color.onTint;
18
+ return /*#__PURE__*/_jsxs(Pressable, {
19
+ ...pressableProps,
20
+ accessibilityRole: "button",
21
+ accessibilityState: {
22
+ ...accessibilityState,
23
+ busy: loading,
24
+ disabled: isDisabled
25
+ },
26
+ disabled: isDisabled,
27
+ style: ({
28
+ pressed
29
+ }) => [styles.button, variant === 'primary' && styles.primary, variant === 'secondary' && styles.secondary, variant === 'destructive' && styles.destructive, isDisabled && styles.disabled, pressed && !isDisabled && styles.pressed, style],
30
+ children: [loading ? /*#__PURE__*/_jsx(ActivityIndicator, {
31
+ color: spinnerColor,
32
+ size: "small"
33
+ }) : null, /*#__PURE__*/_jsx(Text, {
34
+ style: [styles.label, variant === 'secondary' && styles.secondaryLabel, isDisabled && styles.disabledLabel],
35
+ children: children
36
+ })]
37
+ });
38
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+
3
+ export { Button } from "./Button.js";