@neko-os/ui 0.0.7 → 0.0.9

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 (274) hide show
  1. package/dist/NekoUI.js +1 -1
  2. package/dist/abstractions/ActivityIndicator.native.js +1 -1
  3. package/dist/abstractions/ActivityIndicator.web.js +1 -0
  4. package/dist/abstractions/AnimatedView.js +1 -1
  5. package/dist/abstractions/BlurView.js +1 -0
  6. package/dist/abstractions/BlurView.native.js +1 -0
  7. package/dist/abstractions/BlurView.web.js +1 -0
  8. package/dist/abstractions/FlatList.js +1 -0
  9. package/dist/abstractions/FlatList.native.js +1 -0
  10. package/dist/abstractions/FlatList.web.js +1 -0
  11. package/dist/abstractions/GradientView.js +1 -0
  12. package/dist/abstractions/GradientView.native.js +1 -0
  13. package/dist/abstractions/Icon.native.js +1 -1
  14. package/dist/abstractions/ImageBackground.js +1 -0
  15. package/dist/abstractions/ImageBackground.native.js +1 -0
  16. package/dist/abstractions/ImageBackground.web.js +1 -0
  17. package/dist/abstractions/Pressable.js +1 -0
  18. package/dist/abstractions/Pressable.native.js +1 -0
  19. package/dist/abstractions/Pressable.web.js +1 -0
  20. package/dist/abstractions/ScrollView.js +1 -0
  21. package/dist/abstractions/ScrollView.native.js +1 -0
  22. package/dist/abstractions/ScrollView.web.js +1 -0
  23. package/dist/abstractions/TextInput.js +1 -1
  24. package/dist/abstractions/helpers/storage.js +1 -0
  25. package/dist/abstractions/helpers/storage.native.js +1 -0
  26. package/dist/components/actions/Button.js +1 -1
  27. package/dist/components/actions/Dropdown.js +1 -1
  28. package/dist/components/actions/Link.js +1 -1
  29. package/dist/components/actions/Pressable.js +1 -0
  30. package/dist/components/actions/index.js +1 -1
  31. package/dist/components/actions/menu/HorizontalMenu.js +1 -1
  32. package/dist/components/actions/menu/VerticalMenu.js +1 -1
  33. package/dist/components/animations/ReanimatedView.js +1 -0
  34. package/dist/components/calendar/CalendarNav.js +1 -0
  35. package/dist/components/calendar/WeekDaysBar.js +1 -0
  36. package/dist/components/calendar/_helpers/calendarDays.js +1 -1
  37. package/dist/components/calendar/_helpers/dateDisabled.js +1 -0
  38. package/dist/components/calendar/index.js +0 -1
  39. package/dist/components/feedback/alerter.js +1 -0
  40. package/dist/components/feedback/confirmer.js +1 -0
  41. package/dist/components/feedback/index.js +1 -1
  42. package/dist/components/feedback/notifications/Notification.js +1 -1
  43. package/dist/components/feedback/notifications/NotificationsHandler.js +1 -1
  44. package/dist/components/index.js +1 -1
  45. package/dist/components/inputs/DateInput.js +1 -0
  46. package/dist/components/inputs/InputWrapper.js +1 -1
  47. package/dist/components/inputs/LinkInput.js +1 -0
  48. package/dist/components/inputs/MaskInput.js +1 -0
  49. package/dist/components/inputs/TextInput.js +1 -1
  50. package/dist/components/inputs/_DateInput.native.js +1 -0
  51. package/dist/components/inputs/datePicker/DatePicker.js +1 -0
  52. package/dist/components/inputs/datePicker/DayPicker.js +1 -0
  53. package/dist/components/inputs/datePicker/MonthPicker.js +1 -0
  54. package/dist/components/inputs/datePicker/QuarterPicker.js +1 -0
  55. package/dist/components/inputs/datePicker/WeekPicker.js +1 -0
  56. package/dist/components/inputs/datePicker/YearPicker.js +1 -0
  57. package/dist/components/inputs/index.js +1 -1
  58. package/dist/components/layout/Layout.js +1 -1
  59. package/dist/components/list/FlatList.js +1 -0
  60. package/dist/components/list/ScrollView.js +1 -0
  61. package/dist/components/list/index.js +1 -0
  62. package/dist/components/presentation/ImageBackground.js +1 -0
  63. package/dist/components/presentation/Result.js +1 -1
  64. package/dist/components/presentation/index.js +1 -1
  65. package/dist/components/state/LoadingView.js +1 -1
  66. package/dist/components/structure/Accordion.js +1 -1
  67. package/dist/components/structure/BlurView.js +1 -0
  68. package/dist/components/structure/GradientView.js +1 -0
  69. package/dist/components/structure/View.js +1 -1
  70. package/dist/components/structure/bottomDrawer/index.js +1 -0
  71. package/dist/components/structure/bottomDrawer/index.native.js +1 -0
  72. package/dist/components/structure/bottomDrawer/index.web.js +1 -0
  73. package/dist/components/structure/bottomDrawer/native/BottomDrawer.js +1 -0
  74. package/dist/components/structure/bottomDrawer/native/DrawerContext.js +1 -0
  75. package/dist/components/structure/bottomDrawer/native/DrawerHandle.js +1 -0
  76. package/dist/components/structure/bottomDrawer/native/DrawerScrollView.js +1 -0
  77. package/dist/components/structure/bottomDrawer/native/utils.js +1 -0
  78. package/dist/components/structure/bottomDrawer/web/BottomDrawer.js +1 -0
  79. package/dist/components/structure/drawer/Drawer.js +1 -0
  80. package/dist/components/structure/drawer/Drawer.native.js +1 -0
  81. package/dist/components/structure/drawer/index.js +1 -0
  82. package/dist/components/structure/index.js +1 -1
  83. package/dist/components/structure/modal/Modal.js +1 -0
  84. package/dist/components/structure/modal/Modal.native.js +1 -0
  85. package/dist/components/structure/modal/ModalBackdrop.js +1 -0
  86. package/dist/components/structure/modal/ModalContent.js +1 -0
  87. package/dist/components/structure/modal/ModalFooter.js +1 -0
  88. package/dist/components/structure/modal/ModalHeader.js +1 -0
  89. package/dist/components/structure/modal/handler/ModalsHandler.js +1 -0
  90. package/dist/components/structure/modal/index.js +1 -0
  91. package/dist/components/structure/overlay/OverlayWrapper.js +1 -1
  92. package/dist/components/structure/popover/Popover.js +1 -1
  93. package/dist/components/structure/popover/Popover.native.js +1 -1
  94. package/dist/components/theme/ThemePicker.js +1 -0
  95. package/dist/components/theme/ThemePickerDrawer.js +1 -0
  96. package/dist/components/theme/ThemeStatusBar.js +1 -0
  97. package/dist/components/theme/ThemeStatusBar.native.js +1 -0
  98. package/dist/components/theme/ThemeThumb.js +1 -0
  99. package/dist/components/theme/index.js +1 -0
  100. package/dist/helpers/index.js +1 -1
  101. package/dist/helpers/storage.js +1 -0
  102. package/dist/modifiers/animations/animatedEffects.js +1 -1
  103. package/dist/modifiers/animations/animatedEffects.native.js +1 -1
  104. package/dist/modifiers/animations/fadeEffect.js +1 -1
  105. package/dist/modifiers/animations/scaleEffect.js +1 -0
  106. package/dist/modifiers/animations/scaleEffect.native.js +1 -0
  107. package/dist/modifiers/animations/slideEffect.js +1 -1
  108. package/dist/modifiers/background.js +1 -1
  109. package/dist/modifiers/cursor.js +1 -0
  110. package/dist/modifiers/display.js +1 -1
  111. package/dist/modifiers/fullColor.js +1 -1
  112. package/dist/modifiers/hover.js +1 -0
  113. package/dist/modifiers/position.js +1 -1
  114. package/dist/modifiers/size.js +1 -1
  115. package/dist/modifiers/state.js +1 -1
  116. package/dist/responsive/responsiveHooks.js +1 -1
  117. package/dist/theme/ThemeHandler.js +1 -1
  118. package/dist/theme/default/base.js +1 -1
  119. package/dist/theme/default/blackTheme.js +1 -0
  120. package/dist/theme/default/cyberpunkTheme.js +1 -1
  121. package/dist/theme/default/darkTheme.js +1 -1
  122. package/dist/theme/default/deepWoodsTheme.js +1 -1
  123. package/dist/theme/default/forestTheme.js +1 -1
  124. package/dist/theme/default/hackerTheme.js +1 -1
  125. package/dist/theme/default/lightTheme.js +1 -1
  126. package/dist/theme/default/midnightTheme.js +1 -1
  127. package/dist/theme/default/msdosTheme.js +1 -1
  128. package/dist/theme/default/oceanTheme.js +1 -1
  129. package/dist/theme/default/paperTheme.js +1 -0
  130. package/dist/theme/default/pastelTheme.js +1 -1
  131. package/dist/theme/default/sunsetTheme.js +1 -1
  132. package/dist/theme/default/themes.js +1 -1
  133. package/dist/theme/format/formatTheme.js +1 -1
  134. package/dist/theme/helpers/contrastColor.js +1 -1
  135. package/package.json +8 -3
  136. package/src/NekoUI.js +18 -3
  137. package/src/abstractions/ActivityIndicator.native.js +3 -4
  138. package/src/abstractions/ActivityIndicator.web.js +43 -0
  139. package/src/abstractions/AnimatedView.js +3 -3
  140. package/src/abstractions/BlurView.js +43 -0
  141. package/src/abstractions/BlurView.native.js +39 -0
  142. package/src/abstractions/BlurView.web.js +39 -0
  143. package/src/abstractions/FlatList.js +39 -0
  144. package/src/abstractions/FlatList.native.js +32 -0
  145. package/src/abstractions/FlatList.web.js +3 -0
  146. package/src/abstractions/GradientView.js +5 -0
  147. package/src/abstractions/GradientView.native.js +32 -0
  148. package/src/abstractions/Icon.native.js +4 -2
  149. package/src/abstractions/ImageBackground.js +17 -0
  150. package/src/abstractions/ImageBackground.native.js +27 -0
  151. package/src/abstractions/ImageBackground.web.js +7 -0
  152. package/src/abstractions/Pressable.js +4 -0
  153. package/src/abstractions/Pressable.native.js +3 -0
  154. package/src/abstractions/Pressable.web.js +3 -0
  155. package/src/abstractions/ScrollView.js +3 -0
  156. package/src/abstractions/ScrollView.native.js +5 -0
  157. package/src/abstractions/ScrollView.web.js +3 -0
  158. package/src/abstractions/Text.web.js +15 -0
  159. package/src/abstractions/TextInput.js +2 -2
  160. package/src/abstractions/helpers/storage.js +32 -0
  161. package/src/abstractions/helpers/storage.native.js +34 -0
  162. package/src/components/actions/Button.js +8 -0
  163. package/src/components/actions/Dropdown.js +18 -2
  164. package/src/components/actions/Link.js +16 -2
  165. package/src/components/actions/Pressable.js +38 -0
  166. package/src/components/actions/index.js +1 -0
  167. package/src/components/actions/menu/HorizontalMenu.js +2 -1
  168. package/src/components/actions/menu/VerticalMenu.js +5 -4
  169. package/src/components/animations/ReanimatedView.js +40 -0
  170. package/src/components/calendar/CalendarNav.js +67 -0
  171. package/src/components/calendar/WeekDaysBar.js +18 -0
  172. package/src/components/calendar/_helpers/calendarDays.js +1 -3
  173. package/src/components/calendar/_helpers/dateDisabled.js +24 -0
  174. package/src/components/calendar/index.js +1 -1
  175. package/src/components/feedback/alerter.js +31 -0
  176. package/src/components/feedback/confirmer.js +70 -0
  177. package/src/components/feedback/index.js +2 -0
  178. package/src/components/feedback/notifications/Notification.js +1 -1
  179. package/src/components/feedback/notifications/NotificationsHandler.js +3 -3
  180. package/src/components/index.js +2 -0
  181. package/src/components/inputs/DateInput.js +111 -0
  182. package/src/components/inputs/InputWrapper.js +18 -6
  183. package/src/components/inputs/LinkInput.js +17 -0
  184. package/src/components/inputs/MaskInput.js +67 -0
  185. package/src/components/inputs/TextInput.js +2 -2
  186. package/src/components/inputs/_DateInput.native.js +89 -0
  187. package/src/components/inputs/datePicker/DatePicker.js +24 -0
  188. package/src/components/inputs/datePicker/DayPicker.js +65 -0
  189. package/src/components/inputs/datePicker/MonthPicker.js +62 -0
  190. package/src/components/inputs/datePicker/QuarterPicker.js +65 -0
  191. package/src/components/inputs/datePicker/WeekPicker.js +74 -0
  192. package/src/components/inputs/datePicker/YearPicker.js +67 -0
  193. package/src/components/inputs/index.js +4 -0
  194. package/src/components/layout/Layout.js +1 -1
  195. package/src/components/list/FlatList.js +54 -0
  196. package/src/components/list/ScrollView.js +58 -0
  197. package/src/components/list/index.js +2 -0
  198. package/src/components/presentation/ImageBackground.js +38 -0
  199. package/src/components/presentation/Result.js +2 -2
  200. package/src/components/presentation/index.js +1 -0
  201. package/src/components/state/LoadingView.js +10 -1
  202. package/src/components/structure/Accordion.js +1 -1
  203. package/src/components/structure/BlurView.js +58 -0
  204. package/src/components/structure/GradientView.js +42 -0
  205. package/src/components/structure/View.js +2 -0
  206. package/src/components/structure/bottomDrawer/index.js +1 -0
  207. package/src/components/structure/bottomDrawer/index.native.js +4 -0
  208. package/src/components/structure/bottomDrawer/index.web.js +4 -0
  209. package/src/components/structure/bottomDrawer/native/BottomDrawer.js +242 -0
  210. package/src/components/structure/bottomDrawer/native/DrawerContext.js +21 -0
  211. package/src/components/structure/bottomDrawer/native/DrawerHandle.js +12 -0
  212. package/src/components/structure/bottomDrawer/native/DrawerScrollView.js +83 -0
  213. package/src/components/structure/bottomDrawer/native/utils.js +58 -0
  214. package/src/components/structure/bottomDrawer/web/BottomDrawer.js +3 -0
  215. package/src/components/structure/drawer/Drawer.js +5 -0
  216. package/src/components/structure/drawer/Drawer.native.js +3 -0
  217. package/src/components/structure/drawer/index.js +1 -0
  218. package/src/components/structure/index.js +5 -0
  219. package/src/components/structure/modal/Modal.js +84 -0
  220. package/src/components/structure/modal/Modal.native.js +83 -0
  221. package/src/components/structure/modal/ModalBackdrop.js +58 -0
  222. package/src/components/structure/modal/ModalContent.js +28 -0
  223. package/src/components/structure/modal/ModalFooter.js +31 -0
  224. package/src/components/structure/modal/ModalHeader.js +50 -0
  225. package/src/components/structure/modal/handler/ModalsHandler.js +61 -0
  226. package/src/components/structure/modal/index.js +6 -0
  227. package/src/components/structure/overlay/OverlayWrapper.js +1 -1
  228. package/src/components/structure/popover/Popover.js +37 -2
  229. package/src/components/structure/popover/Popover.native.js +46 -16
  230. package/src/components/theme/ThemePicker.js +49 -0
  231. package/src/components/theme/ThemePickerDrawer.js +13 -0
  232. package/src/components/theme/ThemeStatusBar.js +3 -0
  233. package/src/components/theme/ThemeStatusBar.native.js +9 -0
  234. package/src/components/theme/ThemeThumb.js +98 -0
  235. package/src/components/theme/index.js +3 -0
  236. package/src/helpers/index.js +1 -0
  237. package/src/helpers/storage.js +54 -0
  238. package/src/modifiers/animations/animatedEffects.js +2 -0
  239. package/src/modifiers/animations/animatedEffects.native.js +3 -1
  240. package/src/modifiers/animations/fadeEffect.js +4 -2
  241. package/src/modifiers/animations/scaleEffect.js +45 -0
  242. package/src/modifiers/animations/scaleEffect.native.js +33 -0
  243. package/src/modifiers/animations/slideEffect.js +3 -1
  244. package/src/modifiers/background.js +16 -4
  245. package/src/modifiers/cursor.js +21 -0
  246. package/src/modifiers/display.js +2 -2
  247. package/src/modifiers/fullColor.js +2 -2
  248. package/src/modifiers/hover.js +28 -0
  249. package/src/modifiers/position.js +24 -3
  250. package/src/modifiers/size.js +2 -1
  251. package/src/modifiers/state.js +1 -1
  252. package/src/responsive/responsiveHooks.js +7 -0
  253. package/src/theme/ThemeHandler.js +18 -2
  254. package/src/theme/default/base.js +6 -6
  255. package/src/theme/default/blackTheme.js +35 -0
  256. package/src/theme/default/cyberpunkTheme.js +4 -1
  257. package/src/theme/default/darkTheme.js +4 -1
  258. package/src/theme/default/deepWoodsTheme.js +5 -2
  259. package/src/theme/default/forestTheme.js +4 -1
  260. package/src/theme/default/hackerTheme.js +4 -1
  261. package/src/theme/default/lightTheme.js +4 -1
  262. package/src/theme/default/midnightTheme.js +4 -1
  263. package/src/theme/default/msdosTheme.js +19 -4
  264. package/src/theme/default/oceanTheme.js +5 -2
  265. package/src/theme/default/paperTheme.js +35 -0
  266. package/src/theme/default/pastelTheme.js +5 -2
  267. package/src/theme/default/sunsetTheme.js +7 -4
  268. package/src/theme/default/themes.js +9 -10
  269. package/src/theme/format/formatTheme.js +9 -3
  270. package/src/theme/helpers/contrastColor.js +49 -11
  271. package/dist/abstractions/TouchableOpacity.web.js +0 -1
  272. package/dist/components/calendar/DayPicker.js +0 -1
  273. package/src/abstractions/TouchableOpacity.web.js +0 -3
  274. package/src/components/calendar/DayPicker.js +0 -94
@@ -7,9 +7,12 @@ import { useAnimationModifier } from '../../modifiers/animation'
7
7
  import { useBackgroundModifier } from '../../modifiers/background'
8
8
  import { useBorderModifier } from '../../modifiers/border'
9
9
  import { useColorConverter } from '../../modifiers/colorConverter'
10
+ import { useCursorModifier } from '../../modifiers/cursor'
11
+ import { useDefaultModifier } from '../../modifiers/default'
10
12
  import { useDisplayModifier } from '../../modifiers/display'
11
13
  import { useFlexModifier } from '../../modifiers/flex'
12
14
  import { useFlexWrapperModifier } from '../../modifiers/flexWrapper'
15
+ import { useHoverConverter } from '../../modifiers/hover'
13
16
  import { useMarginModifier } from '../../modifiers/margin'
14
17
  import { usePaddingModifier } from '../../modifiers/padding'
15
18
  import { usePositionModifier } from '../../modifiers/position'
@@ -17,11 +20,22 @@ import { useSizeModifier } from '../../modifiers/size'
17
20
  import { useStateModifier } from '../../modifiers/state'
18
21
  import { useThemeComponentModifier } from '../../modifiers/themeComponent'
19
22
 
23
+ const DEFAULT_PROPS = {
24
+ pointer: true, //
25
+ hover: {
26
+ br: 'md',
27
+ bg: 'text4_op10',
28
+ },
29
+ }
30
+
20
31
  export function Link({ label, children, href, target, ...rootProps }) {
21
- const [{ loading, color: color }, props] = pipe(
22
- useThemeComponentModifier('Link'),
32
+ const [{ isHover, loading, color: color }, props] = pipe(
33
+ useDefaultModifier(DEFAULT_PROPS),
34
+ useHoverConverter,
23
35
  useBackgroundModifier,
24
36
  useColorConverter('primary'),
37
+ useThemeComponentModifier('Link'),
38
+ useCursorModifier,
25
39
  useAnimationModifier,
26
40
  useSizeModifier, //
27
41
  useFlexWrapperModifier,
@@ -0,0 +1,38 @@
1
+ import { pipe } from 'ramda'
2
+
3
+ import { AbsPressable } from '../../abstractions/Pressable'
4
+ import { useAnimationModifier } from '../../modifiers/animation'
5
+ import { useBackgroundModifier } from '../../modifiers/background'
6
+ import { useBorderModifier } from '../../modifiers/border'
7
+ import { useDisplayModifier } from '../../modifiers/display'
8
+ import { useFlexModifier } from '../../modifiers/flex'
9
+ import { useFlexWrapperModifier } from '../../modifiers/flexWrapper'
10
+ import { useMarginModifier } from '../../modifiers/margin'
11
+ import { usePaddingModifier } from '../../modifiers/padding'
12
+ import { usePositionModifier } from '../../modifiers/position'
13
+ import { useSizeModifier } from '../../modifiers/size'
14
+ import { useStateModifier } from '../../modifiers/state'
15
+ import { useThemeComponentModifier } from '../../modifiers/themeComponent'
16
+
17
+ export function Pressable({ children, href, target, ...rootProps }) {
18
+ const [{}, props] = pipe(
19
+ useThemeComponentModifier('Pressable'),
20
+ useBackgroundModifier,
21
+ useAnimationModifier,
22
+ useSizeModifier, //
23
+ useFlexWrapperModifier,
24
+ useDisplayModifier,
25
+ useStateModifier,
26
+ useBorderModifier,
27
+ usePositionModifier,
28
+ usePaddingModifier,
29
+ useMarginModifier,
30
+ useFlexModifier
31
+ )([{}, rootProps])
32
+
33
+ return (
34
+ <AbsPressable className="neko-pressable" link target={target} href={!props.disabled && href} {...props}>
35
+ {children}
36
+ </AbsPressable>
37
+ )
38
+ }
@@ -1,5 +1,6 @@
1
1
  export * from './Button'
2
2
  export * from './Link'
3
+ export * from './Pressable'
3
4
  export * from './Dropdown'
4
5
  export * from './Breadcrumb'
5
6
  export * from './menu/Menu'
@@ -66,7 +66,7 @@ export function HorizontalMenu(rootProps) {
66
66
  useThemeComponentModifier('HorizontalMenu') //
67
67
  )([{}, rootProps])
68
68
 
69
- let { gap = 'sm', height = 50, items, onChange, onChangeIndex, ...props } = formattedProps
69
+ let { gap = 'sm', height = 50, items, onChange, onChangeIndex, activeIndex, ...props } = formattedProps
70
70
 
71
71
  const handlePress = React.useCallback(
72
72
  (item, index) => {
@@ -88,6 +88,7 @@ export function HorizontalMenu(rootProps) {
88
88
  color={color}
89
89
  sizeCode={sizeCode}
90
90
  index={index}
91
+ activeIndex={activeIndex}
91
92
  {...props}
92
93
  />
93
94
  ))}
@@ -15,7 +15,7 @@ import { useThemeComponentModifier } from '../../../modifiers/themeComponent'
15
15
  function LinkItem({
16
16
  item,
17
17
  linkPaddingH = 'md',
18
- linkPaddingV = 'xs',
18
+ linkPaddingV = 'sm',
19
19
  handlePress,
20
20
  linkProps,
21
21
  activeIndex,
@@ -41,14 +41,15 @@ function LinkItem({
41
41
  paddingV={linkPaddingV}
42
42
  marginR={3}
43
43
  borderL={3}
44
- marginV={!!active && -4}
45
- borderColor={active ? activeColor : 'transparent'}
44
+ marginV={-4}
45
+ brColor={active ? activeColor : 'transparent'}
46
46
  bg={bg}
47
47
  transition="border-color 0.5s ease, background 0.3s ease"
48
+ hover={{ br: 0 }}
48
49
  {...linkProps}
49
50
  onPress={() => handlePress(item, index)}
50
51
  >
51
- <IconText paddingV={active && 4} color={active ? activeColor : color} fullW size={sizeCode} {...childProps} />
52
+ <IconText addingV={active && 4} color={active ? activeColor : color} fullW size={sizeCode} {...childProps} />
52
53
  </Link>
53
54
  </SubmenuWrapper>
54
55
  )
@@ -0,0 +1,40 @@
1
+ import { pipe } from 'ramda'
2
+
3
+ import { AbsAnimatedView } from '../../abstractions/AnimatedView'
4
+ import { useBackgroundModifier } from '../../modifiers/background'
5
+ import { useBorderModifier } from '../../modifiers/border'
6
+ import { useDisplayModifier } from '../../modifiers/display'
7
+ import { useFlexModifier } from '../../modifiers/flex'
8
+ import { useFlexWrapperModifier } from '../../modifiers/flexWrapper'
9
+ import { useMarginModifier } from '../../modifiers/margin'
10
+ import { useOverflowModifier } from '../../modifiers/overflow'
11
+ import { usePaddingModifier } from '../../modifiers/padding'
12
+ import { usePositionModifier } from '../../modifiers/position'
13
+ import { useShadowModifier } from '../../modifiers/shadow'
14
+ import { useSizeModifier } from '../../modifiers/size'
15
+ import { useStateModifier } from '../../modifiers/state'
16
+ import { useThemeComponentModifier } from '../../modifiers/themeComponent'
17
+
18
+ export function ReanimatedView({ children, ...rootProps }) {
19
+ const [{}, props] = pipe(
20
+ useThemeComponentModifier('ReanimatedView'),
21
+ useFlexWrapperModifier,
22
+ useDisplayModifier,
23
+ useStateModifier,
24
+ useSizeModifier,
25
+ usePositionModifier,
26
+ useOverflowModifier,
27
+ usePaddingModifier,
28
+ useMarginModifier,
29
+ useFlexModifier,
30
+ useBackgroundModifier,
31
+ useBorderModifier,
32
+ useShadowModifier
33
+ )([{}, rootProps])
34
+
35
+ return (
36
+ <AbsAnimatedView className="neko-reanimated-view" {...props}>
37
+ {children}
38
+ </AbsAnimatedView>
39
+ )
40
+ }
@@ -0,0 +1,67 @@
1
+ import { Icon } from '../presentation/Icon'
2
+ import { Link } from '../actions/Link'
3
+ import { Text } from '../text/Text'
4
+ import { View } from '../structure/View'
5
+
6
+ export function CalendarNav({ value, onChange, level, ...props }) {
7
+ const prevMonth = () => onChange((m) => m.subtract(1, 'month'))
8
+ const nextMonth = () => onChange((m) => m.add(1, 'month'))
9
+
10
+ const prevYear = () => onChange((m) => m.subtract(1, 'year'))
11
+ const nextYear = () => onChange((m) => m.add(1, 'year'))
12
+
13
+ const prevDecade = () => onChange((m) => m.subtract(10, 'year'))
14
+ const nextDecade = () => onChange((m) => m.add(10, 'year'))
15
+
16
+ const showMonth = level !== 'year'
17
+
18
+ if (level === 'decade') {
19
+ const year = value.year()
20
+
21
+ return (
22
+ <View className="neko-calendar-nav" row centerV gap="xxs" height={30} {...props}>
23
+ <Link onPress={prevDecade} aria-label="Previous decade" padding="xxs" paddingL={0}>
24
+ <Icon name="arrow-left-double-line" />
25
+ </Link>
26
+
27
+ <Text center flex>
28
+ {year}-{year + 9}
29
+ </Text>
30
+
31
+ <Link onPress={nextDecade} aria-label="Next decade" padding="xxs" paddingR={0}>
32
+ <Icon name="arrow-right-double-line" />
33
+ </Link>
34
+ </View>
35
+ )
36
+ }
37
+
38
+ return (
39
+ <View className="neko-calendar-nav" row centerV gap="xxs" height={30} {...props}>
40
+ <Link onPress={prevYear} aria-label="Previous year" padding="xxs" paddingL={0}>
41
+ <Icon name="arrow-left-double-line" />
42
+ </Link>
43
+
44
+ {showMonth && (
45
+ <Link onPress={prevMonth} aria-label="Previous month" padding="xxs">
46
+ <Icon name="arrow-left-s-line" />
47
+ </Link>
48
+ )}
49
+
50
+ <View center flex gap="xxs" row>
51
+ {showMonth && <Text center>{value.format?.('MMM')}</Text>}
52
+
53
+ <Text center>{value.format?.('YYYY')}</Text>
54
+ </View>
55
+
56
+ {showMonth && (
57
+ <Link onPress={nextMonth} aria-label="Next month" padding="xxs">
58
+ <Icon name="arrow-right-s-line" />
59
+ </Link>
60
+ )}
61
+
62
+ <Link onPress={nextYear} aria-label="Next year" padding="xxs" paddingR={0}>
63
+ <Icon name="arrow-right-double-line" />
64
+ </Link>
65
+ </View>
66
+ )
67
+ }
@@ -0,0 +1,18 @@
1
+ import { Text } from '../text/Text'
2
+ import { View } from '../structure/View'
3
+
4
+ const weekdayLabels = ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat']
5
+
6
+ export function WeekDaysBar() {
7
+ return (
8
+ <View className="neko-week-days-bar" row center gap="sm">
9
+ {weekdayLabels.map((w) => (
10
+ <View key={w} flex height={30} center>
11
+ <Text center sm text4>
12
+ {w}
13
+ </Text>
14
+ </View>
15
+ ))}
16
+ </View>
17
+ )
18
+ }
@@ -9,8 +9,6 @@ export function useCalendarDays(currentMonth) {
9
9
  const days = Array.from({ length: daysInMonth }, (_, i) => i + 1)
10
10
  const cells = [...blanks, ...days]
11
11
 
12
- const weekdayLabels = ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat']
13
-
14
- return { weekdayLabels, cells }
12
+ return { cells }
15
13
  }, [currentMonth.month(), currentMonth.year()])
16
14
  }
@@ -0,0 +1,24 @@
1
+ import { is } from 'ramda'
2
+ import dayjs from 'dayjs'
3
+
4
+ export function isDateDisabled(date, { min, max, onCheckDisabled } = {}) {
5
+ const dateVal = !!date && dayjs(date)
6
+ if (!dateVal || !dateVal.isValid()) return true
7
+ if (!!min && dateVal.isBefore(min)) return true
8
+ if (!!max && dateVal.isAfter(max)) return true
9
+ return onCheckDisabled?.(dateVal) || false
10
+ }
11
+
12
+ export function isValidDate(v, format, validations = {}) {
13
+ if (v === null || v === '') return true
14
+
15
+ let dateVal = dayjs(v)
16
+
17
+ if (is(String, v)) {
18
+ if (v.length !== format.length) return false
19
+ dateVal = dayjs(v, format, true)
20
+ if (!dateVal.isValid()) return false
21
+ }
22
+
23
+ return !isDateDisabled(v, validations)
24
+ }
@@ -1 +1 @@
1
- export * from './DayPicker'
1
+ // export * from './DayPicker'
@@ -0,0 +1,31 @@
1
+ import { is } from 'ramda'
2
+
3
+ import { Button } from '../actions'
4
+ import { Result } from '../presentation'
5
+ import { useModalOpener } from '../structure/modal'
6
+
7
+ export function useAlerter() {
8
+ const { open } = useModalOpener()
9
+
10
+ const alert = (data, type) => {
11
+ if (is(String, data)) data = { title: data }
12
+ const { width, closeLabel, hideClose, ...resultProps } = data || {}
13
+
14
+ open(({ onClose }) => ({
15
+ content: <Result {...resultProps} type={type} padding={0} paddingT="lg" paddingB="sm" />,
16
+ footer: !hideClose && (
17
+ <Button sm label={closeLabel || 'Close'} outline color="text_op40" onPress={onClose} fullW />
18
+ ),
19
+ footerProps: { borderT: false },
20
+ width: width || 350,
21
+ }))
22
+ }
23
+
24
+ return {
25
+ alert,
26
+ info: (data) => alert(data, 'info'),
27
+ error: (data) => alert(data, 'error'),
28
+ warning: (data) => alert(data, 'warning'),
29
+ success: (data) => alert(data, 'success'),
30
+ }
31
+ }
@@ -0,0 +1,70 @@
1
+ import { is } from 'ramda'
2
+ import React from 'react'
3
+
4
+ import { Button } from '../actions'
5
+ import { RESULT_TYPES } from '../presentation/Result'
6
+ import { Result } from '../presentation'
7
+ import { View } from '../structure/View'
8
+ import { useModalOpener } from '../structure/modal'
9
+
10
+ function Footer({ cancelLabel, confirmLabel, onConfirm, type, onClose }) {
11
+ const [loading, setLoading] = React.useState(false)
12
+ const color = RESULT_TYPES[type]?.color || 'primary'
13
+
14
+ return (
15
+ <View row gap="sm" centerV>
16
+ <Button sm label={cancelLabel || 'Cancel'} outline color="text_op40" onPress={onClose} flex disabled={loading} />
17
+ <Button
18
+ disabled={loading}
19
+ loading={loading}
20
+ sm
21
+ label={confirmLabel || 'Confirm'}
22
+ color={color}
23
+ onPress={() => {
24
+ setLoading(true)
25
+ Promise.resolve(onConfirm?.())
26
+ .then((result) => {
27
+ if (result !== false) {
28
+ onClose()
29
+ }
30
+ })
31
+ .finally(() => {
32
+ setLoading(false)
33
+ })
34
+ }}
35
+ flex
36
+ />
37
+ </View>
38
+ )
39
+ }
40
+
41
+ export function useConfirmer() {
42
+ const { open } = useModalOpener()
43
+
44
+ const confirm = (data, type) => {
45
+ const { width, cancelLabel, confirmLabel, onConfirm, ...resultProps } = data || {}
46
+
47
+ open(({ onClose }) => ({
48
+ content: <Result {...resultProps} type={type} padding={0} paddingT="lg" paddingB="sm" />,
49
+ footer: (
50
+ <Footer
51
+ cancelLabel={cancelLabel}
52
+ confirmLabel={confirmLabel}
53
+ onConfirm={onConfirm}
54
+ type={type}
55
+ onClose={onClose}
56
+ />
57
+ ),
58
+ footerProps: { borderT: false },
59
+ width: width || 350,
60
+ }))
61
+ }
62
+
63
+ return {
64
+ confirm,
65
+ info: (data) => confirm(data, 'info'),
66
+ error: (data) => confirm(data, 'error'),
67
+ warning: (data) => confirm(data, 'warning'),
68
+ success: (data) => confirm(data, 'success'),
69
+ }
70
+ }
@@ -1 +1,3 @@
1
1
  export * from './notifications/NotificationsHandler'
2
+ export * from './alerter'
3
+ export * from './confirmer'
@@ -18,7 +18,7 @@ export function Notification({ time, ...props }) {
18
18
  className="neko-notification"
19
19
  slide={{ from: 'right' }}
20
20
  fade
21
- zIndex={120}
21
+ zIndex={520}
22
22
  maxWidth="100%"
23
23
  bg="overlayBG"
24
24
  br="sm"
@@ -20,8 +20,8 @@ export function useNotifier() {
20
20
 
21
21
  if (is(String, data)) data = { title: data }
22
22
 
23
- const timerId = setTimeout(() => remove(key), time)
24
- add(key, { ...data, type, opts, timerId, time })
23
+ const timerId = setTimeout(() => remove?.(key), time)
24
+ add?.(key, { ...data, type, opts, timerId, time })
25
25
  }
26
26
 
27
27
  return {
@@ -52,7 +52,7 @@ export function NotificationsHandler({ children }) {
52
52
  {children}
53
53
 
54
54
  {!!messages.length && (
55
- <View fixed top={0} right={0} padding="md" width={width} maxWidth="100%" pointerEvents="box-none">
55
+ <View fixed top={0} right={0} padding="md" width={width} maxWidth="100%" pointerEvents="box-none" zIndex={600}>
56
56
  <SafeAreaView gap="xs">
57
57
  {messages.map(({ key, ...item }) => (
58
58
  <Notification key={key} {...item} />
@@ -11,3 +11,5 @@ export * from './layout'
11
11
  export * from './table'
12
12
  export * from './feedback'
13
13
  export * from './calendar'
14
+ export * from './list'
15
+ export * from './theme'
@@ -0,0 +1,111 @@
1
+ import React from 'react'
2
+ import advancedFormat from 'dayjs/esm/plugin/advancedFormat'
3
+ import dayjs from 'dayjs'
4
+ import weekOfYear from 'dayjs/esm/plugin/weekOfYear'
5
+
6
+ import { LinkInput } from './LinkInput'
7
+ import { View } from '../structure/View'
8
+ import { useResponsiveValue } from '../../responsive'
9
+
10
+ dayjs.extend(advancedFormat)
11
+ dayjs.extend(weekOfYear)
12
+
13
+ import { DatePicker } from './datePicker/DatePicker'
14
+ import { MaskInput } from './MaskInput'
15
+ import { Popover } from '../structure/popover/Popover'
16
+ import { isValidDate } from '../calendar/_helpers/dateDisabled'
17
+
18
+ export function getDateInputDefaultFormat(type) {
19
+ switch (type) {
20
+ case 'year':
21
+ return 'YYYY'
22
+ case 'quarter':
23
+ return 'YYYY-Q'
24
+ case 'month':
25
+ return 'YYYY-MM'
26
+ case 'week':
27
+ return 'YYYY-ww'
28
+ default:
29
+ return 'YYYY-MM-DD'
30
+ }
31
+ }
32
+
33
+ export function DateInput({
34
+ value,
35
+ onChange,
36
+ min,
37
+ max,
38
+ onCheckDisabled,
39
+ placement,
40
+ type = 'day',
41
+ format,
42
+ useBottomDrawer = { native: true, sm: true, md: true },
43
+ ...props
44
+ }) {
45
+ useBottomDrawer = useResponsiveValue(useBottomDrawer)
46
+ format = format || getDateInputDefaultFormat(type)
47
+ if (value === '') value = undefined
48
+ const [inputValue, setInputValue] = React.useState('')
49
+ const [localValue, setLocalValue] = React.useState(value)
50
+
51
+ value = value || localValue
52
+
53
+ const validations = { min, max, onCheckDisabled }
54
+
55
+ const handleChange = (v) => {
56
+ if (!isValidDate(v, format, validations)) return
57
+ v = !!v ? dayjs(v) : null
58
+ setLocalValue(v)
59
+ onChange?.(v)
60
+ }
61
+
62
+ const handleChangeInput = (v) => {
63
+ setInputValue(v)
64
+ if (!isValidDate(v, format, validations)) return
65
+ handleChange(v)
66
+ }
67
+
68
+ const onBlur = () => {
69
+ if (isValidDate(inputValue, format, validations)) return
70
+ handleChange(null)
71
+ setInputValue('')
72
+ }
73
+
74
+ React.useEffect(() => {
75
+ setInputValue(!!value ? dayjs(value).format(format) : '')
76
+ }, [value])
77
+
78
+ const Input = useBottomDrawer ? LinkInput : MaskInput
79
+
80
+ return (
81
+ <Popover
82
+ trigger="click"
83
+ placement={placement || 'bottomLeft'}
84
+ snapPoints={[350]}
85
+ useBottomDrawer={useBottomDrawer}
86
+ renderContent={({ onClose }) => (
87
+ <View flex centerH>
88
+ <DatePicker
89
+ value={value}
90
+ onChange={(v) => {
91
+ handleChange(v)
92
+ onClose()
93
+ }}
94
+ {...validations}
95
+ type={type}
96
+ />
97
+ </View>
98
+ )}
99
+ >
100
+ <Input
101
+ value={inputValue}
102
+ onChange={handleChangeInput}
103
+ suffixIcon="calendar-line"
104
+ suffixIconColor="text4"
105
+ onBlur={onBlur}
106
+ mask={format.replace(/[DMYQwW]/gi, '9')}
107
+ {...props}
108
+ />
109
+ </Popover>
110
+ )
111
+ }
@@ -19,10 +19,23 @@ const DEFAULT_PROPS = {
19
19
  gap: 'sm',
20
20
  }
21
21
 
22
- export function InputWrapper({ prefix, suffix, prefixIcon, suffixIcon, loading, error, children, ...rootProps }) {
22
+ export function InputWrapper({
23
+ prefix,
24
+ suffix,
25
+ prefixIcon,
26
+ prefixIconColor,
27
+ suffixIcon,
28
+ suffixIconColor,
29
+ loading,
30
+ error,
31
+ children,
32
+ ref,
33
+ ...rootProps
34
+ }) {
23
35
  const [hover, setHover] = React.useState(false)
24
- const inputRef = React.useRef()
25
- const [{ size, sizeCode, onChange }, props] = pipe(
36
+ const fallbackInputRef = React.useRef()
37
+ const inputRef = ref || fallbackInputRef
38
+ const [{ size, sizeCode }, props] = pipe(
26
39
  useSizeConverter('elementHeights', 'md'),
27
40
  useThemeComponentModifier('InputWrapper'),
28
41
  useDefaultModifier(DEFAULT_PROPS)
@@ -34,8 +47,8 @@ export function InputWrapper({ prefix, suffix, prefixIcon, suffixIcon, loading,
34
47
 
35
48
  if (!!prefix && is(String, prefix)) prefix = <Text>{prefix}</Text>
36
49
  if (!!suffix && is(String, suffix)) suffix = <Text>{suffix}</Text>
37
- if (!prefix && !!prefixIcon) prefix = <Icon name={prefixIcon} size={sizeCode} />
38
- if (!suffix && !!suffixIcon) suffix = <Icon name={suffixIcon} size={sizeCode} />
50
+ if (!prefix && !!prefixIcon) prefix = <Icon name={prefixIcon} size={sizeCode} color={prefixIconColor} />
51
+ if (!suffix && !!suffixIcon) suffix = <Icon name={suffixIcon} size={sizeCode} color={suffixIconColor} />
39
52
  if (!prefix && !!error) suffix = <Icon name="close-circle-fill" size={sizeCode} red />
40
53
  if (!!loading) suffix = <Loading size={sizeCode} />
41
54
 
@@ -46,7 +59,6 @@ export function InputWrapper({ prefix, suffix, prefixIcon, suffixIcon, loading,
46
59
  const childWithProps = React.cloneElement(child, {
47
60
  ...child.props,
48
61
  ref: inputRef,
49
- onChange: child.props.onChange || onChange,
50
62
  })
51
63
 
52
64
  return (
@@ -0,0 +1,17 @@
1
+ import { InputWrapper } from './InputWrapper'
2
+ import { Link } from '../actions/Link'
3
+ import { Text } from '../text/Text'
4
+ import { View } from '../structure/View'
5
+ import { useColors } from '../../theme/ThemeHandler'
6
+
7
+ export function LinkInput({ onPress, onClick, placeholder, value, disabled, ...props }) {
8
+ return (
9
+ <Link onPress={!props.loading ? onPress || onClick : undefined} flex fullW centerV disabled={disabled}>
10
+ <InputWrapper {...props}>
11
+ <View centerV flex fullW>
12
+ <Text color={!!value ? 'text' : 'text_op30'} label={value || placeholder} />
13
+ </View>
14
+ </InputWrapper>
15
+ </Link>
16
+ )
17
+ }