@neko-os/ui 0.0.4 → 0.0.6

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 (427) hide show
  1. package/dist/NekoUI.js +1 -1
  2. package/dist/abstractions/ActivityIndicator.js +1 -0
  3. package/dist/abstractions/ActivityIndicator.native.js +1 -0
  4. package/dist/abstractions/AnimatedView.js +1 -0
  5. package/dist/abstractions/AnimatedView.native.js +1 -0
  6. package/dist/abstractions/BKTouchableOpacity.js +0 -0
  7. package/dist/abstractions/DraggableSlideView.js +1 -0
  8. package/dist/abstractions/DraggableSlideView.native.js +1 -0
  9. package/dist/abstractions/HiddenInput.js +1 -0
  10. package/dist/abstractions/HiddenInput.native.js +1 -0
  11. package/dist/abstractions/Icon.js +1 -1
  12. package/dist/abstractions/Icon.native.js +1 -1
  13. package/dist/abstractions/Icon.web.js +1 -1
  14. package/dist/abstractions/Image.js +1 -0
  15. package/dist/abstractions/Image.native.js +1 -0
  16. package/dist/abstractions/Image.web.js +1 -0
  17. package/dist/abstractions/Platform.js +1 -0
  18. package/dist/abstractions/Platform.native.js +1 -0
  19. package/dist/abstractions/Platform.web.js +1 -0
  20. package/dist/abstractions/SafeAreaView.js +1 -0
  21. package/dist/abstractions/SafeAreaView.native.js +1 -0
  22. package/dist/abstractions/Switch.js +1 -0
  23. package/dist/abstractions/Switch.native.js +1 -0
  24. package/dist/abstractions/Table.js +1 -0
  25. package/dist/abstractions/Table.native.js +1 -0
  26. package/dist/abstractions/Text.js +1 -1
  27. package/dist/abstractions/TextInput.js +1 -0
  28. package/dist/abstractions/TextInput.native.js +1 -0
  29. package/dist/abstractions/TextInput.web.js +1 -0
  30. package/dist/abstractions/TouchableOpacity.js +1 -1
  31. package/dist/abstractions/TouchableOpacity.native.js +1 -0
  32. package/dist/abstractions/TouchableOpacity.web.js +1 -0
  33. package/dist/abstractions/View.js +1 -1
  34. package/dist/abstractions/helpers/componentSize.js +1 -0
  35. package/dist/abstractions/helpers/componentSize.native.js +1 -0
  36. package/dist/abstractions/helpers/transformStyle.js +1 -0
  37. package/dist/abstractions/helpers/transformStyle.native.js +1 -0
  38. package/dist/abstractions/helpers/windowWidth.js +1 -0
  39. package/dist/abstractions/helpers/windowWidth.native.js +1 -0
  40. package/dist/abstractions/helpers/windowWidth.web.js +1 -0
  41. package/dist/components/actions/Breadcrumb.js +1 -0
  42. package/dist/components/actions/Button.js +1 -0
  43. package/dist/components/actions/Dropdown.js +1 -0
  44. package/dist/components/actions/Link.js +1 -0
  45. package/dist/components/actions/index.js +1 -0
  46. package/dist/components/actions/menu/HorizontalMenu.js +1 -0
  47. package/dist/components/actions/menu/Menu.js +1 -0
  48. package/dist/components/actions/menu/SubmenuWrapper.js +1 -0
  49. package/dist/components/actions/menu/VerticalMenu.js +1 -0
  50. package/dist/components/animations/AnimatedView.js +1 -0
  51. package/dist/components/animations/DraggableSlideView.js +1 -0
  52. package/dist/components/animations/index.js +1 -0
  53. package/dist/components/calendar/DayPicker.js +1 -0
  54. package/dist/components/calendar/_helpers/calendarDays.js +1 -0
  55. package/dist/components/calendar/index.js +1 -0
  56. package/dist/components/feedback/index.js +1 -0
  57. package/dist/components/feedback/notifications/Notification.js +1 -0
  58. package/dist/components/feedback/notifications/NotificationsHandler.js +1 -0
  59. package/dist/components/form/Form.js +1 -0
  60. package/dist/components/form/FormGroup.js +1 -0
  61. package/dist/components/form/FormItem.js +1 -0
  62. package/dist/components/form/FormList.js +1 -0
  63. package/dist/components/form/FormWrapperComponent.js +1 -0
  64. package/dist/components/form/FormWrapperComponent.native.js +1 -0
  65. package/dist/components/form/SubmitButton.js +1 -0
  66. package/dist/{form → components/form}/index.js +1 -1
  67. package/dist/components/form/useNewForm.js +1 -0
  68. package/dist/components/form/useWatch.js +1 -0
  69. package/dist/components/helpers/LazyRender.js +1 -0
  70. package/dist/components/helpers/LazyRender.native.js +1 -0
  71. package/dist/components/helpers/Portal.js +1 -0
  72. package/dist/components/helpers/PortalHandler.js +1 -0
  73. package/dist/components/helpers/Responsive.js +1 -0
  74. package/dist/components/helpers/Separator.js +1 -0
  75. package/dist/components/helpers/VerticalView.js +1 -0
  76. package/dist/components/helpers/index.js +1 -0
  77. package/dist/components/index.js +1 -0
  78. package/dist/components/inputs/Checkbox.js +1 -0
  79. package/dist/components/inputs/InputWrapper.js +1 -0
  80. package/dist/components/inputs/Picker.js +1 -0
  81. package/dist/components/inputs/Radio.js +1 -0
  82. package/dist/components/inputs/Switch.js +1 -0
  83. package/dist/components/inputs/TextInput.js +1 -0
  84. package/dist/components/inputs/index.js +1 -0
  85. package/dist/components/layout/Layout.js +1 -0
  86. package/dist/components/layout/LayoutContent.js +1 -0
  87. package/dist/components/layout/LayoutHeader.js +1 -0
  88. package/dist/components/layout/LayoutSider.js +1 -0
  89. package/dist/components/layout/index.js +1 -0
  90. package/dist/components/presentation/Avatar.js +1 -0
  91. package/dist/components/presentation/AvatarLabel.js +1 -0
  92. package/dist/components/presentation/Badge.js +1 -0
  93. package/dist/components/presentation/ContentLabel.js +1 -0
  94. package/dist/components/presentation/Icon.js +1 -0
  95. package/dist/components/presentation/IconLabel.js +1 -0
  96. package/dist/components/presentation/Image.js +1 -0
  97. package/dist/components/presentation/LabelValue.js +1 -0
  98. package/dist/components/presentation/Result.js +1 -0
  99. package/dist/components/presentation/ResultBar.js +1 -0
  100. package/dist/components/presentation/Tag.js +1 -0
  101. package/dist/components/presentation/Tooltip.js +1 -0
  102. package/dist/components/presentation/index.js +1 -0
  103. package/dist/components/state/Loading.js +1 -0
  104. package/dist/components/state/LoadingView.js +1 -0
  105. package/dist/components/state/index.js +1 -0
  106. package/dist/components/structure/Accordion.js +1 -0
  107. package/dist/components/structure/AccordionGroup.js +1 -0
  108. package/dist/components/structure/Card.js +1 -0
  109. package/dist/components/structure/Col.js +1 -0
  110. package/dist/components/structure/Row.js +1 -0
  111. package/dist/components/structure/SafeAreaView.js +1 -0
  112. package/dist/components/structure/View.js +1 -0
  113. package/dist/components/structure/index.js +1 -0
  114. package/dist/components/structure/overlay/OverlayHandler.js +1 -0
  115. package/dist/components/structure/overlay/OverlayHandler.native.js +1 -0
  116. package/dist/components/structure/overlay/OverlayWrapper.js +1 -0
  117. package/dist/components/structure/overlay/calculatePosition.js +1 -0
  118. package/dist/components/structure/overlay/smartPlacement.js +1 -0
  119. package/dist/components/structure/popover/Popover.js +1 -0
  120. package/dist/components/structure/popover/Popover.native.js +1 -0
  121. package/dist/components/structure/popover/PopoverContent.js +1 -0
  122. package/dist/components/table/DataTable.js +1 -0
  123. package/dist/components/table/Pagination.js +1 -0
  124. package/dist/components/table/Table.js +1 -0
  125. package/dist/components/table/TableCol.js +1 -0
  126. package/dist/components/table/TableHeader.js +1 -0
  127. package/dist/components/table/TableHeaderRow.js +1 -0
  128. package/dist/components/table/TableRow.js +1 -0
  129. package/dist/components/table/index.js +1 -0
  130. package/dist/components/text/Text.js +1 -0
  131. package/dist/components/text/VerticalText.js +1 -0
  132. package/dist/components/text/index.js +1 -0
  133. package/dist/helpers/debounce.js +1 -0
  134. package/dist/helpers/index.js +1 -0
  135. package/dist/helpers/options.js +1 -0
  136. package/dist/helpers/random.js +1 -0
  137. package/dist/index.css +15 -0
  138. package/dist/index.js +1 -1
  139. package/dist/modifiers/alignConverter.js +1 -0
  140. package/dist/modifiers/animation.js +1 -0
  141. package/dist/modifiers/animations/animatedEffects.js +1 -0
  142. package/dist/modifiers/animations/animatedEffects.native.js +1 -0
  143. package/dist/modifiers/animations/animatedEffects.web.js +1 -0
  144. package/dist/modifiers/animations/fadeEffect.js +1 -0
  145. package/dist/modifiers/animations/fadeEffect.native.js +1 -0
  146. package/dist/modifiers/animations/slideEffect.js +1 -0
  147. package/dist/modifiers/animations/slideEffect.native.js +1 -0
  148. package/dist/modifiers/applyStyles.js +1 -0
  149. package/dist/modifiers/background.js +1 -1
  150. package/dist/modifiers/border.js +1 -1
  151. package/dist/modifiers/colorConverter.js +1 -0
  152. package/dist/modifiers/default.js +1 -0
  153. package/dist/modifiers/display.js +1 -0
  154. package/dist/modifiers/flex.js +1 -1
  155. package/dist/modifiers/flexWrapper.js +1 -1
  156. package/dist/modifiers/fullColor.js +1 -0
  157. package/dist/modifiers/grid.js +1 -0
  158. package/dist/modifiers/logger.js +1 -0
  159. package/dist/modifiers/margin.js +1 -1
  160. package/dist/modifiers/overflow.js +1 -0
  161. package/dist/modifiers/padding.js +1 -1
  162. package/dist/modifiers/position.js +1 -1
  163. package/dist/modifiers/responsiveConverter.js +1 -0
  164. package/dist/modifiers/shadow.js +1 -1
  165. package/dist/modifiers/size.js +1 -1
  166. package/dist/modifiers/sizeConverter.js +1 -0
  167. package/dist/modifiers/state.js +1 -0
  168. package/dist/modifiers/text.js +1 -1
  169. package/dist/modifiers/textConverter.js +1 -0
  170. package/dist/modifiers/themeComponent.js +1 -0
  171. package/dist/responsive/ResponsiveHandler.js +1 -0
  172. package/dist/responsive/index.js +1 -0
  173. package/dist/responsive/responsiveHooks.js +1 -0
  174. package/dist/theme/ThemeHandler.js +1 -1
  175. package/dist/theme/default/base.js +1 -1
  176. package/dist/theme/default/cyberpunkTheme.js +1 -1
  177. package/dist/theme/default/darkTheme.js +1 -1
  178. package/dist/theme/default/deepWoodsTheme.js +1 -1
  179. package/dist/theme/default/forestTheme.js +1 -1
  180. package/dist/theme/default/hackerTheme.js +1 -0
  181. package/dist/theme/default/lightTheme.js +1 -1
  182. package/dist/theme/default/midnightTheme.js +1 -1
  183. package/dist/theme/default/msdosTheme.js +1 -0
  184. package/dist/theme/default/oceanTheme.js +1 -1
  185. package/dist/theme/default/pastelTheme.js +1 -1
  186. package/dist/theme/default/sunsetTheme.js +1 -1
  187. package/dist/theme/default/themes.js +1 -1
  188. package/dist/theme/helpers/colorScale.js +1 -0
  189. package/dist/theme/helpers/contrastColor.js +1 -0
  190. package/dist/theme/helpers/dynamicColor.js +1 -0
  191. package/dist/theme/helpers/mergePreset.js +1 -0
  192. package/dist/theme/helpers/relatedScales.js +1 -0
  193. package/dist/theme/helpers/sizeScale.js +1 -1
  194. package/dist/theme/helpers/textScale.js +1 -0
  195. package/package.json +8 -4
  196. package/src/NekoUI.js +15 -1
  197. package/src/abstractions/ActivityIndicator.js +31 -0
  198. package/src/abstractions/ActivityIndicator.native.js +44 -0
  199. package/src/abstractions/AnimatedView.js +3 -0
  200. package/src/abstractions/AnimatedView.native.js +6 -0
  201. package/src/abstractions/BKTouchableOpacity.js +12 -0
  202. package/src/abstractions/DraggableSlideView.js +85 -0
  203. package/src/abstractions/DraggableSlideView.native.js +62 -0
  204. package/src/abstractions/HiddenInput.js +3 -0
  205. package/src/abstractions/HiddenInput.native.js +3 -0
  206. package/src/abstractions/Icon.js +4 -20
  207. package/src/abstractions/Icon.native.js +11 -2
  208. package/src/abstractions/Icon.web.js +11 -2
  209. package/src/abstractions/Image.js +12 -0
  210. package/src/abstractions/Image.native.js +7 -0
  211. package/src/abstractions/Image.web.js +7 -0
  212. package/src/abstractions/Platform.js +1 -0
  213. package/src/abstractions/Platform.native.js +3 -0
  214. package/src/abstractions/Platform.web.js +3 -0
  215. package/src/abstractions/SafeAreaView.js +3 -0
  216. package/src/abstractions/SafeAreaView.native.js +3 -0
  217. package/src/abstractions/Switch.js +97 -0
  218. package/src/abstractions/Switch.native.js +12 -0
  219. package/src/abstractions/Table.js +29 -0
  220. package/src/abstractions/Table.native.js +19 -0
  221. package/src/abstractions/Text.js +13 -2
  222. package/src/abstractions/TextInput.js +3 -0
  223. package/src/abstractions/TextInput.native.js +5 -0
  224. package/src/abstractions/TextInput.web.js +5 -0
  225. package/src/abstractions/TouchableOpacity.js +3 -11
  226. package/src/abstractions/TouchableOpacity.native.js +3 -0
  227. package/src/abstractions/TouchableOpacity.web.js +3 -0
  228. package/src/abstractions/View.js +2 -2
  229. package/src/abstractions/helpers/componentSize.js +13 -0
  230. package/src/abstractions/helpers/componentSize.native.js +12 -0
  231. package/src/abstractions/helpers/transformStyle.js +8 -0
  232. package/src/abstractions/helpers/transformStyle.native.js +3 -0
  233. package/src/abstractions/helpers/windowWidth.js +13 -0
  234. package/src/abstractions/helpers/windowWidth.native.js +6 -0
  235. package/src/abstractions/helpers/windowWidth.web.js +6 -0
  236. package/src/components/actions/Breadcrumb.js +47 -0
  237. package/src/components/actions/Button.js +67 -0
  238. package/src/components/actions/Dropdown.js +68 -0
  239. package/src/components/actions/Link.js +52 -0
  240. package/src/components/actions/index.js +5 -0
  241. package/src/components/actions/menu/HorizontalMenu.js +96 -0
  242. package/src/components/actions/menu/Menu.js +7 -0
  243. package/src/components/actions/menu/SubmenuWrapper.js +16 -0
  244. package/src/components/actions/menu/VerticalMenu.js +107 -0
  245. package/src/components/animations/AnimatedView.js +45 -0
  246. package/src/components/animations/DraggableSlideView.js +42 -0
  247. package/src/components/animations/index.js +2 -0
  248. package/src/components/calendar/DayPicker.js +91 -0
  249. package/src/components/calendar/_helpers/calendarDays.js +16 -0
  250. package/src/components/calendar/index.js +1 -0
  251. package/src/components/feedback/index.js +1 -0
  252. package/src/components/feedback/notifications/Notification.js +37 -0
  253. package/src/components/feedback/notifications/NotificationsHandler.js +65 -0
  254. package/src/components/form/Form.js +25 -0
  255. package/src/{form → components/form}/FormGroup.js +4 -4
  256. package/src/components/form/FormItem.js +56 -0
  257. package/src/{form → components/form}/FormList.js +47 -11
  258. package/src/components/form/FormWrapperComponent.js +43 -0
  259. package/src/components/form/FormWrapperComponent.native.js +5 -0
  260. package/src/components/form/SubmitButton.js +20 -0
  261. package/src/{form → components/form}/index.js +3 -1
  262. package/src/components/form/useNewForm.js +67 -0
  263. package/src/components/form/useWatch.js +70 -0
  264. package/src/components/helpers/LazyRender.js +55 -0
  265. package/src/components/helpers/LazyRender.native.js +58 -0
  266. package/src/components/helpers/Portal.js +21 -0
  267. package/src/components/helpers/PortalHandler.js +32 -0
  268. package/src/components/helpers/Responsive.js +18 -0
  269. package/src/components/helpers/Separator.js +45 -0
  270. package/src/components/helpers/VerticalView.js +34 -0
  271. package/src/components/helpers/index.js +6 -0
  272. package/src/components/index.js +13 -0
  273. package/src/components/inputs/Checkbox.js +56 -0
  274. package/src/components/inputs/InputWrapper.js +79 -0
  275. package/src/components/inputs/Picker.js +116 -0
  276. package/src/components/inputs/Radio.js +55 -0
  277. package/src/components/inputs/Switch.js +60 -0
  278. package/src/components/inputs/TextInput.js +22 -0
  279. package/src/components/inputs/index.js +6 -0
  280. package/src/components/layout/Layout.js +40 -0
  281. package/src/components/layout/LayoutContent.js +42 -0
  282. package/src/components/layout/LayoutHeader.js +69 -0
  283. package/src/components/layout/LayoutSider.js +64 -0
  284. package/src/components/layout/index.js +4 -0
  285. package/src/components/presentation/Avatar.js +79 -0
  286. package/src/components/presentation/AvatarLabel.js +58 -0
  287. package/src/components/presentation/Badge.js +90 -0
  288. package/src/components/presentation/ContentLabel.js +43 -0
  289. package/src/components/presentation/Icon.js +20 -0
  290. package/src/components/presentation/IconLabel.js +39 -0
  291. package/src/components/presentation/Image.js +33 -0
  292. package/src/components/presentation/LabelValue.js +49 -0
  293. package/src/components/presentation/Result.js +60 -0
  294. package/src/components/presentation/ResultBar.js +56 -0
  295. package/src/components/presentation/Tag.js +69 -0
  296. package/src/components/presentation/Tooltip.js +43 -0
  297. package/src/components/presentation/index.js +11 -0
  298. package/src/components/state/Loading.js +20 -0
  299. package/src/components/state/LoadingView.js +28 -0
  300. package/src/components/state/index.js +2 -0
  301. package/src/components/structure/Accordion.js +69 -0
  302. package/src/components/structure/AccordionGroup.js +35 -0
  303. package/src/components/structure/Card.js +45 -0
  304. package/src/components/structure/Col.js +22 -0
  305. package/src/components/structure/Row.js +42 -0
  306. package/src/components/structure/SafeAreaView.js +42 -0
  307. package/src/components/structure/View.js +42 -0
  308. package/src/components/structure/index.js +8 -0
  309. package/src/components/structure/overlay/OverlayHandler.js +70 -0
  310. package/src/components/structure/overlay/OverlayHandler.native.js +6 -0
  311. package/src/components/structure/overlay/OverlayWrapper.js +52 -0
  312. package/src/components/structure/overlay/calculatePosition.js +29 -0
  313. package/src/components/structure/overlay/smartPlacement.js +32 -0
  314. package/src/components/structure/popover/Popover.js +69 -0
  315. package/src/components/structure/popover/Popover.native.js +75 -0
  316. package/src/components/structure/popover/PopoverContent.js +18 -0
  317. package/src/components/table/DataTable.js +57 -0
  318. package/src/components/table/Pagination.js +128 -0
  319. package/src/components/table/Table.js +65 -0
  320. package/src/components/table/TableCol.js +67 -0
  321. package/src/components/table/TableHeader.js +69 -0
  322. package/src/components/table/TableHeaderRow.js +31 -0
  323. package/src/components/table/TableRow.js +30 -0
  324. package/src/components/table/index.js +7 -0
  325. package/src/components/text/Text.js +32 -0
  326. package/src/components/text/VerticalText.js +29 -0
  327. package/src/components/text/index.js +2 -0
  328. package/src/helpers/debounce.js +9 -0
  329. package/src/helpers/index.js +3 -0
  330. package/src/helpers/options.js +65 -0
  331. package/src/helpers/random.js +5 -0
  332. package/src/index.css +15 -0
  333. package/src/index.js +3 -5
  334. package/src/modifiers/alignConverter.js +11 -0
  335. package/src/modifiers/animation.js +18 -0
  336. package/src/modifiers/animations/animatedEffects.js +63 -0
  337. package/src/modifiers/animations/animatedEffects.native.js +53 -0
  338. package/src/modifiers/animations/animatedEffects.web.js +3 -0
  339. package/src/modifiers/animations/fadeEffect.js +43 -0
  340. package/src/modifiers/animations/fadeEffect.native.js +33 -0
  341. package/src/modifiers/animations/slideEffect.js +61 -0
  342. package/src/modifiers/animations/slideEffect.native.js +53 -0
  343. package/src/modifiers/applyStyles.js +7 -0
  344. package/src/modifiers/background.js +10 -7
  345. package/src/modifiers/border.js +40 -13
  346. package/src/modifiers/colorConverter.js +13 -0
  347. package/src/modifiers/default.js +9 -0
  348. package/src/modifiers/display.js +22 -0
  349. package/src/modifiers/flex.js +11 -8
  350. package/src/modifiers/flexWrapper.js +58 -14
  351. package/src/modifiers/fullColor.js +29 -0
  352. package/src/modifiers/grid.js +27 -0
  353. package/src/modifiers/logger.js +6 -0
  354. package/src/modifiers/margin.js +10 -7
  355. package/src/modifiers/overflow.js +23 -0
  356. package/src/modifiers/padding.js +10 -7
  357. package/src/modifiers/position.js +20 -9
  358. package/src/modifiers/responsiveConverter.js +19 -0
  359. package/src/modifiers/shadow.js +10 -7
  360. package/src/modifiers/size.js +18 -9
  361. package/src/modifiers/sizeConverter.js +12 -0
  362. package/src/modifiers/state.js +33 -0
  363. package/src/modifiers/text.js +14 -13
  364. package/src/modifiers/textConverter.js +12 -0
  365. package/src/modifiers/themeComponent.js +11 -0
  366. package/src/responsive/ResponsiveHandler.js +28 -0
  367. package/src/responsive/index.js +2 -0
  368. package/src/responsive/responsiveHooks.js +54 -0
  369. package/src/theme/ThemeHandler.js +31 -33
  370. package/src/theme/default/base.js +29 -17
  371. package/src/theme/default/cyberpunkTheme.js +1 -0
  372. package/src/theme/default/darkTheme.js +2 -1
  373. package/src/theme/default/deepWoodsTheme.js +1 -0
  374. package/src/theme/default/forestTheme.js +1 -0
  375. package/src/theme/default/hackerTheme.js +40 -0
  376. package/src/theme/default/lightTheme.js +1 -0
  377. package/src/theme/default/midnightTheme.js +1 -0
  378. package/src/theme/default/msdosTheme.js +40 -0
  379. package/src/theme/default/oceanTheme.js +1 -0
  380. package/src/theme/default/pastelTheme.js +1 -0
  381. package/src/theme/default/sunsetTheme.js +1 -0
  382. package/src/theme/default/themes.js +4 -0
  383. package/src/theme/helpers/colorScale.js +11 -0
  384. package/src/theme/helpers/contrastColor.js +20 -0
  385. package/src/theme/helpers/dynamicColor.js +32 -0
  386. package/src/theme/helpers/mergePreset.js +7 -0
  387. package/src/theme/helpers/relatedScales.js +34 -0
  388. package/src/theme/helpers/sizeScale.js +17 -4
  389. package/src/theme/helpers/textScale.js +15 -0
  390. package/dist/actions/Button.js +0 -1
  391. package/dist/actions/index.js +0 -1
  392. package/dist/form/Form.js +0 -1
  393. package/dist/form/FormGroup.js +0 -1
  394. package/dist/form/FormItem.js +0 -1
  395. package/dist/form/FormList.js +0 -1
  396. package/dist/form/FormWrapperComponent.js +0 -1
  397. package/dist/form/FormWrapperComponent.native.js +0 -1
  398. package/dist/form/useForm.js +0 -1
  399. package/dist/modifiers/fullColor.js.js +0 -1
  400. package/dist/presentation/Icon.js +0 -1
  401. package/dist/presentation/Tag.js +0 -1
  402. package/dist/presentation/index.js +0 -1
  403. package/dist/structure/Card.js +0 -1
  404. package/dist/structure/View.js +0 -1
  405. package/dist/structure/index.js +0 -1
  406. package/dist/text/Text.js +0 -1
  407. package/dist/text/index.js +0 -1
  408. package/dist/theme/default/base.native.js +0 -1
  409. package/dist/theme/default/base.web.js +0 -1
  410. package/src/actions/Button.js +0 -48
  411. package/src/actions/index.js +0 -1
  412. package/src/form/Form.js +0 -14
  413. package/src/form/FormItem.js +0 -34
  414. package/src/form/FormWrapperComponent.js +0 -8
  415. package/src/form/FormWrapperComponent.native.js +0 -5
  416. package/src/form/useForm.js +0 -65
  417. package/src/modifiers/fullColor.js.js +0 -30
  418. package/src/presentation/Icon.js +0 -14
  419. package/src/presentation/Tag.js +0 -32
  420. package/src/presentation/index.js +0 -2
  421. package/src/structure/Card.js +0 -36
  422. package/src/structure/View.js +0 -34
  423. package/src/structure/index.js +0 -2
  424. package/src/text/Text.js +0 -20
  425. package/src/text/index.js +0 -1
  426. package/src/theme/default/base.native.js +0 -58
  427. package/src/theme/default/base.web.js +0 -3
@@ -0,0 +1,90 @@
1
+ import { pipe } from 'ramda'
2
+
3
+ import { AbsView } from '../../abstractions/View'
4
+ import { IconLabel } from './IconLabel'
5
+ import { View } from '../structure/View'
6
+ import { moveScale } from '../../theme/helpers/sizeScale'
7
+ import { useBackgroundModifier } from '../../modifiers/background'
8
+ import { useBorderModifier } from '../../modifiers/border'
9
+ import { useColorConverter } from '../../modifiers/colorConverter'
10
+ import { useDefaultModifier } from '../../modifiers/default'
11
+ import { useFlexWrapperModifier } from '../../modifiers/flexWrapper'
12
+ import { useFullColorModifier } from '../../modifiers/fullColor'
13
+ import { useMarginModifier } from '../../modifiers/margin'
14
+ import { usePaddingModifier } from '../../modifiers/padding'
15
+ import { usePositionModifier } from '../../modifiers/position'
16
+ import { useShadowModifier } from '../../modifiers/shadow'
17
+ import { useSizeConverter } from '../../modifiers/sizeConverter'
18
+ import { useSizeModifier } from '../../modifiers/size'
19
+ import { useThemeComponentModifier } from '../../modifiers/themeComponent'
20
+
21
+ const DOT_SIZE = 8
22
+ const DEFAULT_PROPS = ([{ sizeCode }, { dot, br }]) => {
23
+ sizeCode = !!dot ? DOT_SIZE : undefined
24
+
25
+ return {
26
+ paddingH: !dot && 5,
27
+ height: sizeCode,
28
+ minWidth: sizeCode,
29
+ round: br !== undefined ? false : true,
30
+ center: true,
31
+ border: 1,
32
+ }
33
+ }
34
+
35
+ function Badge(rootProps) {
36
+ const [{ fontColor, sizeCode }, formattedProps] = pipe(
37
+ useColorConverter('primary'),
38
+ useSizeConverter('spaces', 'md'),
39
+ useThemeComponentModifier('Badge'),
40
+ useDefaultModifier(DEFAULT_PROPS),
41
+ useFullColorModifier,
42
+ useSizeModifier,
43
+ usePositionModifier,
44
+ useFlexWrapperModifier,
45
+ useBackgroundModifier,
46
+ usePaddingModifier,
47
+ useMarginModifier,
48
+ useBorderModifier,
49
+ useShadowModifier
50
+ )([{}, rootProps])
51
+
52
+ let { label, value, dot, icon, invert, textProps, iconProps, limit = 99, ...props } = formattedProps
53
+ if (!!value && value > limit) label = `${limit}+`
54
+ label = label || value
55
+
56
+ let content = (
57
+ <IconLabel
58
+ center
59
+ color={fontColor}
60
+ size={moveScale(sizeCode, -2)}
61
+ label={label}
62
+ icon={icon}
63
+ invert={invert}
64
+ textProps={{ strong: true, ...textProps }}
65
+ iconProps={iconProps}
66
+ />
67
+ )
68
+
69
+ if (!!dot) content = false
70
+
71
+ return (
72
+ <AbsView className="neko-badge" {...props}>
73
+ {content}
74
+ </AbsView>
75
+ )
76
+ }
77
+
78
+ function BadgeWrapper({ children, dot, ...props }) {
79
+ if (!children) return <Badge dot={dot} {...props} />
80
+ if (!props.value && !props.label && !props.icon) return children
81
+
82
+ return (
83
+ <View className="neko-badge-wrapper" relative>
84
+ {children}
85
+ <Badge {...props} dot={dot} absolute top={dot ? -2 : -8} right={dot ? -5 : -12} />
86
+ </View>
87
+ )
88
+ }
89
+
90
+ export { BadgeWrapper as Badge }
@@ -0,0 +1,43 @@
1
+ import { pipe } from 'ramda'
2
+
3
+ import { Loading } from '../state/Loading'
4
+ import { Text } from '../text/Text'
5
+ import { View } from '../structure/View'
6
+ import { useColorConverter } from '../../modifiers/colorConverter'
7
+ import { useSizeConverter } from '../../modifiers/sizeConverter'
8
+ import { useThemeComponentModifier } from '../../modifiers/themeComponent'
9
+
10
+ const AUTO_GAP_SCALE = {
11
+ xxxs: 5,
12
+ xxs: 5,
13
+ xs: 5,
14
+ sm: 5,
15
+ md: 6,
16
+ lg: 7,
17
+ xl: 8,
18
+ xxl: 9,
19
+ xxxl: 10,
20
+ }
21
+
22
+ export function ContentLabel(rootProps) {
23
+ const [{ color, sizeCode }, formattedProps] = pipe(
24
+ useColorConverter(),
25
+ useSizeConverter('elementHeights', 'md'),
26
+ useThemeComponentModifier('ContentLabel') //
27
+ )([{}, rootProps])
28
+
29
+ let { loading, label, content, textProps, invert, gap, strong, ...props } = formattedProps
30
+ if (!!loading) content = <Loading size={sizeCode} color={color} />
31
+
32
+ return (
33
+ <View className="neko-content-label" row gap={gap || AUTO_GAP_SCALE[sizeCode] || 5} centerV {...props}>
34
+ {!invert && content}
35
+ {!!label && (
36
+ <Text color={color} size={sizeCode} strong={strong} {...textProps}>
37
+ {label}
38
+ </Text>
39
+ )}
40
+ {!!invert && content}
41
+ </View>
42
+ )
43
+ }
@@ -0,0 +1,20 @@
1
+ import { pipe } from 'ramda'
2
+
3
+ import { AbsIcon } from '../../abstractions/Icon'
4
+ import { useColorConverter } from '../../modifiers/colorConverter'
5
+ import { useMarginModifier } from '../../modifiers/margin'
6
+ import { usePositionModifier } from '../../modifiers/position'
7
+ import { useSizeConverter } from '../../modifiers/sizeConverter'
8
+ import { useThemeComponentModifier } from '../../modifiers/themeComponent'
9
+
10
+ export function Icon({ name, ...rootProps }) {
11
+ const [{ size, color }, props] = pipe(
12
+ useSizeConverter('icons', 'md'),
13
+ useColorConverter('text'),
14
+ useThemeComponentModifier('Icon'),
15
+ usePositionModifier, //
16
+ useMarginModifier
17
+ )([{}, rootProps])
18
+
19
+ return <AbsIcon className="neko-icon" name={name} color={color} size={size} {...props} />
20
+ }
@@ -0,0 +1,39 @@
1
+ import { pipe } from 'ramda'
2
+
3
+ import { ContentLabel } from './ContentLabel'
4
+ import { Icon } from './Icon'
5
+ import { moveScale } from '../../theme/helpers/sizeScale'
6
+ import { useColorConverter } from '../../modifiers/colorConverter'
7
+ import { useSizeConverter } from '../../modifiers/sizeConverter'
8
+ import { useThemeComponentModifier } from '../../modifiers/themeComponent'
9
+
10
+ export function IconLabel(rootProps) {
11
+ const [{ sizeCode, color }, formattedProps] = pipe(
12
+ useColorConverter(),
13
+ useSizeConverter('icons', 'md'),
14
+ useThemeComponentModifier('IconLabel') //
15
+ )([{}, rootProps])
16
+
17
+ const { icon, iconProps, iconColor, iconSize, moveIconSizeScale, ...props } = formattedProps
18
+
19
+ return (
20
+ <ContentLabel
21
+ className="neko-icon-label"
22
+ color={color}
23
+ size={sizeCode}
24
+ content={
25
+ !!icon && (
26
+ <Icon
27
+ name={icon}
28
+ size={iconSize || moveScale(sizeCode, moveIconSizeScale || -1)}
29
+ color={iconColor || color}
30
+ {...iconProps}
31
+ />
32
+ )
33
+ }
34
+ {...props}
35
+ />
36
+ )
37
+ }
38
+
39
+ export const IconText = IconLabel
@@ -0,0 +1,33 @@
1
+ import { pipe } from 'ramda'
2
+
3
+ import { AbsImage } from '../../abstractions/Image'
4
+ import { useBorderModifier } from '../../modifiers/border'
5
+ import { useDefaultModifier } from '../../modifiers/default'
6
+ import { useFlexModifier } from '../../modifiers/flex'
7
+ import { useMarginModifier } from '../../modifiers/margin'
8
+ import { usePositionModifier } from '../../modifiers/position'
9
+ import { useShadowModifier } from '../../modifiers/shadow'
10
+ import { useSizeModifier } from '../../modifiers/size'
11
+ import { useThemeComponentModifier } from '../../modifiers/themeComponent'
12
+
13
+ const DEFAULT_PROPS = {
14
+ width: '100%',
15
+ br: 'md',
16
+ }
17
+
18
+ export function Image({ name, ...rootProps }) {
19
+ const [{ size, color }, props] = pipe(
20
+ useThemeComponentModifier('Image'),
21
+ useDefaultModifier(DEFAULT_PROPS),
22
+ usePositionModifier, //
23
+ useMarginModifier,
24
+ useSizeModifier,
25
+ usePositionModifier,
26
+ useFlexModifier,
27
+ useMarginModifier,
28
+ useBorderModifier,
29
+ useShadowModifier
30
+ )([{}, rootProps])
31
+
32
+ return <AbsImage className="neko-image" name={name} color={color} size={size} {...props} />
33
+ }
@@ -0,0 +1,49 @@
1
+ import { pipe, is } from 'ramda'
2
+
3
+ import { IconLabel } from './IconLabel'
4
+ import { Text } from '../text/Text'
5
+ import { View } from '../structure/View'
6
+ import { moveScale } from '../../theme/helpers/sizeScale'
7
+ import { useDefaultModifier } from '../../modifiers/default'
8
+ import { useSizeConverter } from '../../modifiers/sizeConverter'
9
+ import { useThemeComponentModifier } from '../../modifiers/themeComponent'
10
+
11
+ const DEFAULT_PROPS = ([{ sizeCode }, { vertical, spread }]) => {
12
+ return {
13
+ row: !vertical,
14
+ centerV: !vertical,
15
+ justify: !!spread && 'space-between',
16
+ gap: !vertical ? moveScale(sizeCode, -1) : 0,
17
+ labelProps: {
18
+ size: moveScale(sizeCode, !vertical ? 0 : -2),
19
+ moveIconSizeScale: !vertical ? -1 : -2,
20
+ color: 'text3',
21
+ },
22
+ valueProps: {
23
+ size: sizeCode,
24
+ align: spread && 'right',
25
+ },
26
+ }
27
+ }
28
+
29
+ export function LabelValue({ children, ...rootProps }) {
30
+ const [{ sizeCode, color }, formattedProps] = pipe(
31
+ // useColorConverter(),
32
+ useSizeConverter('elementHeights', 'md'),
33
+ useThemeComponentModifier('Labelvalue'), //
34
+ useDefaultModifier(DEFAULT_PROPS)
35
+ )([{}, rootProps])
36
+
37
+ const { icon, label, iconColor, labelProps, value, valueProps, vertical, spread, ...props } = formattedProps
38
+ let separator = !vertical && !spread ? ':' : ''
39
+
40
+ let content = children || value
41
+ if (is(String, value)) content = <Text label={value} {...valueProps} />
42
+
43
+ return (
44
+ <View className="neko-label-value" {...props}>
45
+ <IconLabel label={label + separator} icon={icon} iconColor={iconColor} {...labelProps} />
46
+ {content}
47
+ </View>
48
+ )
49
+ }
@@ -0,0 +1,60 @@
1
+ import { Divider } from '../helpers/Separator'
2
+ import { Icon } from './Icon'
3
+ import { Text } from '../text/Text'
4
+ import { View } from '../structure/View'
5
+
6
+ export const RESULT_TYPES = {
7
+ error: {
8
+ icon: 'close-circle-fill',
9
+ color: 'red',
10
+ },
11
+
12
+ success: {
13
+ icon: 'checkbox-circle-fill',
14
+ color: 'green',
15
+ },
16
+
17
+ warning: {
18
+ icon: 'error-warning-fill',
19
+ color: 'yellow',
20
+ },
21
+
22
+ info: {
23
+ icon: 'information-2-fill',
24
+ color: 'blue',
25
+ },
26
+ }
27
+
28
+ export function Result({
29
+ type,
30
+ icon,
31
+ iconColor,
32
+ title,
33
+ description,
34
+ footer,
35
+ titleProps,
36
+ descriptionProps,
37
+ textProps,
38
+ iconProps,
39
+ ...props
40
+ }) {
41
+ const typeProps = RESULT_TYPES[type] || {}
42
+ icon = icon || typeProps.icon
43
+ iconColor = iconColor || typeProps.color || 'primary'
44
+
45
+ return (
46
+ <View className="neko-result" center padding="lg" {...props}>
47
+ <Icon name={icon} color={iconColor} size={42} primary {...iconProps} />
48
+ <Divider height={10} />
49
+ <Text h3 {...textProps} {...titleProps}>
50
+ {title}
51
+ </Text>
52
+ {!!description && (
53
+ <Text text3 sm {...textProps} {...descriptionProps}>
54
+ {description}
55
+ </Text>
56
+ )}
57
+ {!!footer && <View marginT="lg">{footer}</View>}
58
+ </View>
59
+ )
60
+ }
@@ -0,0 +1,56 @@
1
+ import { Card } from '../structure/Card'
2
+ import { Icon } from './Icon'
3
+ import { RESULT_TYPES } from './Result'
4
+ import { Text } from '../text/Text'
5
+ import { View } from '../structure/View'
6
+
7
+ export function ResultBar({
8
+ type,
9
+ icon,
10
+ iconColor,
11
+ title,
12
+ description,
13
+ rightContent,
14
+ titleProps,
15
+ descriptionProps,
16
+ textProps,
17
+ iconProps,
18
+ ...props
19
+ }) {
20
+ const typeProps = RESULT_TYPES[type] || {}
21
+ icon = icon || typeProps.icon
22
+ iconColor = iconColor || typeProps.color || 'primary'
23
+ const bg = typeProps.color ? typeProps.color + '_op10' : 'overlayBG'
24
+ const brColor = typeProps.color && typeProps.color + '_op30'
25
+
26
+ return (
27
+ <Card
28
+ className="neko-result"
29
+ row
30
+ gap="sm"
31
+ center
32
+ padding="sm"
33
+ br="sm"
34
+ bg={bg}
35
+ border
36
+ borderColor={brColor}
37
+ centerV
38
+ fullW
39
+ {...props}
40
+ >
41
+ {!!icon && <Icon name={icon} color={iconColor} size="lg" primary {...iconProps} />}
42
+
43
+ <View flex>
44
+ <Text sm strong {...textProps} {...titleProps}>
45
+ {title}
46
+ </Text>
47
+ {!!description && (
48
+ <Text text3 xs {...textProps} {...descriptionProps}>
49
+ {description}
50
+ </Text>
51
+ )}
52
+ </View>
53
+ {rightContent}
54
+ </Card>
55
+ )
56
+ }
@@ -0,0 +1,69 @@
1
+ import { pipe } from 'ramda'
2
+
3
+ import { AbsView } from '../../abstractions/View'
4
+ import { IconLabel } from './IconLabel'
5
+ import { View } from '../structure/View'
6
+ import { moveScale } from '../../theme/helpers/sizeScale'
7
+ import { useBackgroundModifier } from '../../modifiers/background'
8
+ import { useBorderModifier } from '../../modifiers/border'
9
+ import { useColorConverter } from '../../modifiers/colorConverter'
10
+ import { useDefaultModifier } from '../../modifiers/default'
11
+ import { useFlexModifier } from '../../modifiers/flex'
12
+ import { useFlexWrapperModifier } from '../../modifiers/flexWrapper'
13
+ import { useFullColorModifier } from '../../modifiers/fullColor'
14
+ import { useMarginModifier } from '../../modifiers/margin'
15
+ import { usePaddingModifier } from '../../modifiers/padding'
16
+ import { usePositionModifier } from '../../modifiers/position'
17
+ import { useSizeConverter } from '../../modifiers/sizeConverter'
18
+ import { useSizeModifier } from '../../modifiers/size'
19
+ import { useThemeComponentModifier } from '../../modifiers/themeComponent'
20
+
21
+ const DEFAULT_PROPS = ([{ sizeCode }]) => {
22
+ return {
23
+ paddingH: moveScale(sizeCode, -2),
24
+ padding: moveScale(sizeCode, -4),
25
+ outline: true,
26
+ br: 'xxxs',
27
+ border: 1,
28
+ center: true,
29
+ }
30
+ }
31
+
32
+ export function Tag(rootProps) {
33
+ const [{ fontColor, sizeCode }, formattedProps] = pipe(
34
+ useColorConverter('primary'),
35
+ useSizeConverter('elementHeights', 'md'),
36
+ useThemeComponentModifier('Tag'),
37
+ useDefaultModifier(DEFAULT_PROPS),
38
+ useFullColorModifier,
39
+ useSizeModifier,
40
+ usePositionModifier,
41
+ usePaddingModifier,
42
+ useMarginModifier,
43
+ useFlexModifier,
44
+ useFlexWrapperModifier,
45
+ useBackgroundModifier,
46
+ useBorderModifier
47
+ )([{}, rootProps])
48
+
49
+ const { loading, disabled, label, icon, textProps, iconProps, gap, invert, ...props } = formattedProps
50
+
51
+ return (
52
+ <View className="neko-tag" row disabled={disabled}>
53
+ <AbsView className="neko-tag-inner" {...props}>
54
+ <IconLabel
55
+ center
56
+ color={fontColor}
57
+ size={moveScale(sizeCode, -2)}
58
+ label={label}
59
+ icon={icon}
60
+ gap={gap}
61
+ invert={invert}
62
+ textProps={{ strong: true, ...textProps }}
63
+ iconProps={iconProps}
64
+ loading={loading}
65
+ />
66
+ </AbsView>
67
+ </View>
68
+ )
69
+ }
@@ -0,0 +1,43 @@
1
+ import { pipe } from 'ramda'
2
+
3
+ import { IconLabel } from './IconLabel'
4
+ import { Popover } from '../structure/popover/Popover'
5
+ import { useColorConverter } from '../../modifiers/colorConverter'
6
+ import { useFullColorModifier } from '../../modifiers/fullColor'
7
+ import { useSizeConverter } from '../../modifiers/sizeConverter'
8
+ import { useThemeComponentModifier } from '../../modifiers/themeComponent'
9
+
10
+ export function Tooltip(rootProps) {
11
+ const [{ loading, fontColor, sizeCode }, formattedProps] = pipe(
12
+ useColorConverter('overlayBG'),
13
+ useSizeConverter('text', 'md'),
14
+ useThemeComponentModifier('Tooltip'),
15
+ useFullColorModifier
16
+ )([{}, rootProps])
17
+
18
+ const { label, icon, textProps, iconProps, gap, invert, children, ...props } = formattedProps
19
+ if (!label && !icon) return children
20
+
21
+ return (
22
+ <Popover
23
+ className="neko-tooltip"
24
+ {...props}
25
+ content={
26
+ <IconLabel
27
+ center
28
+ color={fontColor}
29
+ size={sizeCode}
30
+ label={label}
31
+ icon={icon}
32
+ gap={gap}
33
+ invert={invert}
34
+ textProps={textProps}
35
+ iconProps={iconProps}
36
+ loading={loading}
37
+ />
38
+ }
39
+ >
40
+ {children}
41
+ </Popover>
42
+ )
43
+ }
@@ -0,0 +1,11 @@
1
+ export * from './Tag'
2
+ export * from './Icon'
3
+ export * from './IconLabel'
4
+ export * from './Result'
5
+ export * from './ResultBar'
6
+ export * from './Tooltip'
7
+ export * from './Badge'
8
+ export * from './Avatar'
9
+ export * from './AvatarLabel'
10
+ export * from './Image'
11
+ export * from './LabelValue'
@@ -0,0 +1,20 @@
1
+ import { pipe } from 'ramda'
2
+
3
+ import { AbsActivityIndicator } from '../../abstractions/ActivityIndicator'
4
+ import { useColorConverter } from '../../modifiers/colorConverter'
5
+ import { useMarginModifier } from '../../modifiers/margin'
6
+ import { usePaddingModifier } from '../../modifiers/padding'
7
+ import { useSizeConverter } from '../../modifiers/sizeConverter'
8
+ import { useThemeComponentModifier } from '../../modifiers/themeComponent'
9
+
10
+ export function Loading({ ...rootProps }) {
11
+ const [{ color, size }, props] = pipe(
12
+ useColorConverter('primary'),
13
+ useSizeConverter('icons', 'md'),
14
+ useThemeComponentModifier('Loading'),
15
+ usePaddingModifier,
16
+ useMarginModifier
17
+ )([{}, rootProps])
18
+
19
+ return <AbsActivityIndicator className="neko-loader" size={size} color={color} {...props} />
20
+ }
@@ -0,0 +1,28 @@
1
+ import { Loading } from './Loading'
2
+ import { View } from '../structure/View'
3
+
4
+ export function LoadingView({ active, children, size, color, replaceChildren, noWrapper, ...props }) {
5
+ if (!active && !!noWrapper) return children
6
+ if (!active) return <View {...props}>{children}</View>
7
+
8
+ const loader = <Loading size={size} color={color} />
9
+ if (!!replaceChildren && !!noWrapper) return loader
10
+ if (!!replaceChildren) {
11
+ return (
12
+ <View {...props} center>
13
+ {loader}
14
+ </View>
15
+ )
16
+ }
17
+
18
+ return (
19
+ <View className="neko-loading-view" relative {...props}>
20
+ {children}
21
+ <View className="neko-laoding-view-overlay" bg="bg_op90" absolute top={0} left={0} right={0} bottom={0} center>
22
+ {loader}
23
+ </View>
24
+ </View>
25
+ )
26
+ }
27
+
28
+ export const LoadingWrapper = LoadingView
@@ -0,0 +1,2 @@
1
+ export * from './Loading'
2
+ export * from './LoadingView'
@@ -0,0 +1,69 @@
1
+ import { pipe } from 'ramda'
2
+ import React from 'react'
3
+
4
+ import { AbsView } from '../../abstractions/View'
5
+ import { Card } from './Card'
6
+ import { Icon } from '../presentation/Icon'
7
+ import { Link } from '../actions/Link'
8
+ import { Text } from '../text/Text'
9
+ import { View } from './View'
10
+ import { moveScale } from '../../theme/helpers/sizeScale'
11
+ import { useDefaultModifier } from '../../modifiers/default'
12
+ import { useSizeConverter } from '../../modifiers/sizeConverter'
13
+ import { useThemeComponentModifier } from '../../modifiers/themeComponent'
14
+
15
+ const DEFAULT_PROPS = {
16
+ padding: 0,
17
+ br: 'xl',
18
+ bg: 'overlayBG',
19
+ hiddenOverflow: true,
20
+ }
21
+
22
+ export function Accordion({ children, title, open, onChange, ...rootProps }) {
23
+ const [{ sizeCode }, formattedProps] = pipe(
24
+ useSizeConverter('elementHeights', 'md'),
25
+ useThemeComponentModifier('Accordion'),
26
+ useDefaultModifier(DEFAULT_PROPS)
27
+ )([{}, rootProps])
28
+
29
+ const { contentProps, titleProps, headerProps, initOpen, ...props } = formattedProps
30
+
31
+ const [localOpen, setLocalOpen] = React.useState(initOpen)
32
+ open = open === undefined ? localOpen : open
33
+
34
+ const toggle = () => {
35
+ setLocalOpen(!open)
36
+ onChange?.(!open)
37
+ }
38
+
39
+ return (
40
+ <Card {...props}>
41
+ <Link
42
+ padding={sizeCode}
43
+ row
44
+ gap={moveScale(sizeCode, -2)}
45
+ borderB={open ? props.border || true : open}
46
+ borderColor={props.borderColor}
47
+ centerV
48
+ {...headerProps}
49
+ onPress={toggle}
50
+ >
51
+ <Icon name={!!open ? 'arrow-down-s-line' : 'arrow-right-s-line'} />
52
+ <Text flex {...titleProps}>
53
+ {title}
54
+ </Text>
55
+ </Link>
56
+ {!!open && (
57
+ <View padding={sizeCode} {...contentProps}>
58
+ {children}
59
+ </View>
60
+ )}
61
+ </Card>
62
+ )
63
+
64
+ return (
65
+ <AbsView className="neko-accordion" {...props}>
66
+ {children}
67
+ </AbsView>
68
+ )
69
+ }
@@ -0,0 +1,35 @@
1
+ import React from 'react'
2
+
3
+ import { Accordion } from './Accordion'
4
+ import { Card } from './Card'
5
+
6
+ export function AccordionsGroup({ items, contentProps, titleProps, headerProps, initOpen, open, onChange, ...props }) {
7
+ const [localOpen, setLocalOpen] = React.useState(initOpen)
8
+ open = open === undefined ? localOpen : open
9
+
10
+ const handleChange = (key) => {
11
+ const v = open === key ? null : key
12
+ setLocalOpen(v)
13
+ onChange?.(v)
14
+ }
15
+
16
+ if (!items?.length) return false
17
+
18
+ const sharedProps = { contentProps, titleProps, headerProps }
19
+
20
+ return (
21
+ <Card padding={0} {...props}>
22
+ {items.map(({ key, ...item }, index) => (
23
+ <Accordion
24
+ key={key || index}
25
+ {...sharedProps}
26
+ {...item}
27
+ br={0}
28
+ borderB={index < items.length - 1}
29
+ open={!!open && open === key}
30
+ onChange={() => handleChange(key)}
31
+ />
32
+ ))}
33
+ </Card>
34
+ )
35
+ }