@neko-os/ui 0.0.6 → 0.0.8

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 (217) hide show
  1. package/dist/NekoUI.js +1 -1
  2. package/dist/abstractions/AnimatedView.js +1 -1
  3. package/dist/abstractions/BlurView.js +1 -0
  4. package/dist/abstractions/BlurView.native.js +1 -0
  5. package/dist/abstractions/GradientView.js +1 -0
  6. package/dist/abstractions/GradientView.native.js +1 -0
  7. package/dist/abstractions/Icon.native.js +1 -1
  8. package/dist/abstractions/ImageBackground.js +1 -0
  9. package/dist/abstractions/ImageBackground.native.js +1 -0
  10. package/dist/abstractions/ImageBackground.web.js +1 -0
  11. package/dist/abstractions/Pressable.js +1 -0
  12. package/dist/abstractions/Pressable.native.js +1 -0
  13. package/dist/abstractions/Pressable.web.js +1 -0
  14. package/dist/abstractions/ScrollView.js +1 -0
  15. package/dist/abstractions/ScrollView.native.js +1 -0
  16. package/dist/abstractions/TextInput.js +1 -1
  17. package/dist/components/actions/Button.js +1 -1
  18. package/dist/components/actions/Dropdown.js +1 -1
  19. package/dist/components/actions/Link.js +1 -1
  20. package/dist/components/actions/Pressable.js +1 -0
  21. package/dist/components/actions/index.js +1 -1
  22. package/dist/components/actions/menu/HorizontalMenu.js +1 -1
  23. package/dist/components/actions/menu/VerticalMenu.js +1 -1
  24. package/dist/components/animations/ReanimatedView.js +1 -0
  25. package/dist/components/calendar/CalendarNav.js +1 -0
  26. package/dist/components/calendar/WeekDaysBar.js +1 -0
  27. package/dist/components/calendar/_helpers/calendarDays.js +1 -1
  28. package/dist/components/calendar/_helpers/dateDisabled.js +1 -0
  29. package/dist/components/calendar/index.js +0 -1
  30. package/dist/components/feedback/alerter.js +1 -0
  31. package/dist/components/feedback/confirmer.js +1 -0
  32. package/dist/components/feedback/index.js +1 -1
  33. package/dist/components/feedback/notifications/Notification.js +1 -1
  34. package/dist/components/feedback/notifications/NotificationsHandler.js +1 -1
  35. package/dist/components/index.js +1 -1
  36. package/dist/components/inputs/DateInput.js +1 -0
  37. package/dist/components/inputs/InputWrapper.js +1 -1
  38. package/dist/components/inputs/LinkInput.js +1 -0
  39. package/dist/components/inputs/MaskInput.js +1 -0
  40. package/dist/components/inputs/TextInput.js +1 -1
  41. package/dist/components/inputs/_DateInput.native.js +1 -0
  42. package/dist/components/inputs/datePicker/DatePicker.js +1 -0
  43. package/dist/components/inputs/datePicker/DayPicker.js +1 -0
  44. package/dist/components/inputs/datePicker/MonthPicker.js +1 -0
  45. package/dist/components/inputs/datePicker/QuarterPicker.js +1 -0
  46. package/dist/components/inputs/datePicker/WeekPicker.js +1 -0
  47. package/dist/components/inputs/datePicker/YearPicker.js +1 -0
  48. package/dist/components/inputs/index.js +1 -1
  49. package/dist/components/list/ScrollView.js +1 -0
  50. package/dist/components/list/index.js +1 -0
  51. package/dist/components/presentation/ImageBackground.js +1 -0
  52. package/dist/components/presentation/Result.js +1 -1
  53. package/dist/components/presentation/index.js +1 -1
  54. package/dist/components/structure/Accordion.js +1 -1
  55. package/dist/components/structure/BlurView.js +1 -0
  56. package/dist/components/structure/GradientView.js +1 -0
  57. package/dist/components/structure/bottomDrawer/index.js +1 -0
  58. package/dist/components/structure/bottomDrawer/index.native.js +1 -0
  59. package/dist/components/structure/bottomDrawer/index.web.js +1 -0
  60. package/dist/components/structure/bottomDrawer/native/BottomDrawer.js +1 -0
  61. package/dist/components/structure/bottomDrawer/native/DrawerContext.js +1 -0
  62. package/dist/components/structure/bottomDrawer/native/DrawerHandle.js +1 -0
  63. package/dist/components/structure/bottomDrawer/native/DrawerScrollView.js +1 -0
  64. package/dist/components/structure/bottomDrawer/native/utils.js +1 -0
  65. package/dist/components/structure/bottomDrawer/web/BottomDrawer.js +1 -0
  66. package/dist/components/structure/drawer/Drawer.js +1 -0
  67. package/dist/components/structure/drawer/Drawer.native.js +1 -0
  68. package/dist/components/structure/drawer/index.js +1 -0
  69. package/dist/components/structure/index.js +1 -1
  70. package/dist/components/structure/modal/Modal.js +1 -0
  71. package/dist/components/structure/modal/Modal.native.js +1 -0
  72. package/dist/components/structure/modal/ModalBackdrop.js +1 -0
  73. package/dist/components/structure/modal/ModalContent.js +1 -0
  74. package/dist/components/structure/modal/ModalFooter.js +1 -0
  75. package/dist/components/structure/modal/ModalHeader.js +1 -0
  76. package/dist/components/structure/modal/handler/ModalsHandler.js +1 -0
  77. package/dist/components/structure/modal/index.js +1 -0
  78. package/dist/components/structure/overlay/OverlayWrapper.js +1 -1
  79. package/dist/components/structure/popover/Popover.js +1 -1
  80. package/dist/components/structure/popover/Popover.native.js +1 -1
  81. package/dist/modifiers/animations/animatedEffects.js +1 -1
  82. package/dist/modifiers/animations/animatedEffects.native.js +1 -1
  83. package/dist/modifiers/animations/fadeEffect.js +1 -1
  84. package/dist/modifiers/animations/scaleEffect.js +1 -0
  85. package/dist/modifiers/animations/scaleEffect.native.js +1 -0
  86. package/dist/modifiers/animations/slideEffect.js +1 -1
  87. package/dist/modifiers/background.js +1 -1
  88. package/dist/modifiers/cursor.js +1 -0
  89. package/dist/modifiers/display.js +1 -1
  90. package/dist/modifiers/hover.js +1 -0
  91. package/dist/modifiers/position.js +1 -1
  92. package/dist/modifiers/size.js +1 -1
  93. package/dist/modifiers/state.js +1 -1
  94. package/dist/responsive/responsiveHooks.js +1 -1
  95. package/dist/theme/default/blackTheme.js +1 -0
  96. package/dist/theme/default/cyberpunkTheme.js +1 -1
  97. package/dist/theme/default/darkTheme.js +1 -1
  98. package/dist/theme/default/deepWoodsTheme.js +1 -1
  99. package/dist/theme/default/forestTheme.js +1 -1
  100. package/dist/theme/default/hackerTheme.js +1 -1
  101. package/dist/theme/default/lightTheme.js +1 -1
  102. package/dist/theme/default/midnightTheme.js +1 -1
  103. package/dist/theme/default/msdosTheme.js +1 -1
  104. package/dist/theme/default/oceanTheme.js +1 -1
  105. package/dist/theme/default/pastelTheme.js +1 -1
  106. package/dist/theme/default/sunsetTheme.js +1 -1
  107. package/dist/theme/default/themes.js +1 -1
  108. package/package.json +11 -5
  109. package/src/NekoUI.js +6 -3
  110. package/src/abstractions/AnimatedView.js +3 -3
  111. package/src/abstractions/BlurView.js +43 -0
  112. package/src/abstractions/BlurView.native.js +39 -0
  113. package/src/abstractions/GradientView.js +5 -0
  114. package/src/abstractions/GradientView.native.js +32 -0
  115. package/src/abstractions/Icon.native.js +4 -2
  116. package/src/abstractions/ImageBackground.js +17 -0
  117. package/src/abstractions/ImageBackground.native.js +27 -0
  118. package/src/abstractions/ImageBackground.web.js +7 -0
  119. package/src/abstractions/Pressable.js +4 -0
  120. package/src/abstractions/Pressable.native.js +3 -0
  121. package/src/abstractions/Pressable.web.js +3 -0
  122. package/src/abstractions/ScrollView.js +3 -0
  123. package/src/abstractions/ScrollView.native.js +5 -0
  124. package/src/abstractions/TextInput.js +2 -2
  125. package/src/components/actions/Button.js +7 -0
  126. package/src/components/actions/Dropdown.js +2 -1
  127. package/src/components/actions/Link.js +16 -2
  128. package/src/components/actions/Pressable.js +38 -0
  129. package/src/components/actions/index.js +1 -0
  130. package/src/components/actions/menu/HorizontalMenu.js +2 -1
  131. package/src/components/actions/menu/VerticalMenu.js +4 -3
  132. package/src/components/animations/ReanimatedView.js +40 -0
  133. package/src/components/calendar/CalendarNav.js +67 -0
  134. package/src/components/calendar/WeekDaysBar.js +18 -0
  135. package/src/components/calendar/_helpers/calendarDays.js +1 -3
  136. package/src/components/calendar/_helpers/dateDisabled.js +24 -0
  137. package/src/components/calendar/index.js +1 -1
  138. package/src/components/feedback/alerter.js +31 -0
  139. package/src/components/feedback/confirmer.js +70 -0
  140. package/src/components/feedback/index.js +2 -0
  141. package/src/components/feedback/notifications/Notification.js +1 -1
  142. package/src/components/feedback/notifications/NotificationsHandler.js +3 -3
  143. package/src/components/index.js +1 -0
  144. package/src/components/inputs/DateInput.js +111 -0
  145. package/src/components/inputs/InputWrapper.js +18 -6
  146. package/src/components/inputs/LinkInput.js +17 -0
  147. package/src/components/inputs/MaskInput.js +67 -0
  148. package/src/components/inputs/TextInput.js +2 -2
  149. package/src/components/inputs/_DateInput.native.js +89 -0
  150. package/src/components/inputs/datePicker/DatePicker.js +24 -0
  151. package/src/components/inputs/datePicker/DayPicker.js +65 -0
  152. package/src/components/inputs/datePicker/MonthPicker.js +62 -0
  153. package/src/components/inputs/datePicker/QuarterPicker.js +65 -0
  154. package/src/components/inputs/datePicker/WeekPicker.js +74 -0
  155. package/src/components/inputs/datePicker/YearPicker.js +67 -0
  156. package/src/components/inputs/index.js +4 -0
  157. package/src/components/list/ScrollView.js +58 -0
  158. package/src/components/list/index.js +1 -0
  159. package/src/components/presentation/ImageBackground.js +38 -0
  160. package/src/components/presentation/Result.js +2 -2
  161. package/src/components/presentation/index.js +1 -0
  162. package/src/components/structure/Accordion.js +1 -1
  163. package/src/components/structure/BlurView.js +58 -0
  164. package/src/components/structure/GradientView.js +42 -0
  165. package/src/components/structure/bottomDrawer/index.js +1 -0
  166. package/src/components/structure/bottomDrawer/index.native.js +4 -0
  167. package/src/components/structure/bottomDrawer/index.web.js +4 -0
  168. package/src/components/structure/bottomDrawer/native/BottomDrawer.js +229 -0
  169. package/src/components/structure/bottomDrawer/native/DrawerContext.js +21 -0
  170. package/src/components/structure/bottomDrawer/native/DrawerHandle.js +12 -0
  171. package/src/components/structure/bottomDrawer/native/DrawerScrollView.js +83 -0
  172. package/src/components/structure/bottomDrawer/native/utils.js +58 -0
  173. package/src/components/structure/bottomDrawer/web/BottomDrawer.js +3 -0
  174. package/src/components/structure/drawer/Drawer.js +5 -0
  175. package/src/components/structure/drawer/Drawer.native.js +3 -0
  176. package/src/components/structure/drawer/index.js +1 -0
  177. package/src/components/structure/index.js +5 -0
  178. package/src/components/structure/modal/Modal.js +84 -0
  179. package/src/components/structure/modal/Modal.native.js +83 -0
  180. package/src/components/structure/modal/ModalBackdrop.js +58 -0
  181. package/src/components/structure/modal/ModalContent.js +28 -0
  182. package/src/components/structure/modal/ModalFooter.js +31 -0
  183. package/src/components/structure/modal/ModalHeader.js +50 -0
  184. package/src/components/structure/modal/handler/ModalsHandler.js +61 -0
  185. package/src/components/structure/modal/index.js +6 -0
  186. package/src/components/structure/overlay/OverlayWrapper.js +1 -1
  187. package/src/components/structure/popover/Popover.js +28 -2
  188. package/src/components/structure/popover/Popover.native.js +44 -15
  189. package/src/modifiers/animations/animatedEffects.js +2 -0
  190. package/src/modifiers/animations/animatedEffects.native.js +3 -1
  191. package/src/modifiers/animations/fadeEffect.js +4 -2
  192. package/src/modifiers/animations/scaleEffect.js +45 -0
  193. package/src/modifiers/animations/scaleEffect.native.js +33 -0
  194. package/src/modifiers/animations/slideEffect.js +3 -1
  195. package/src/modifiers/background.js +16 -4
  196. package/src/modifiers/cursor.js +21 -0
  197. package/src/modifiers/display.js +2 -2
  198. package/src/modifiers/hover.js +28 -0
  199. package/src/modifiers/position.js +24 -3
  200. package/src/modifiers/size.js +2 -1
  201. package/src/modifiers/state.js +1 -1
  202. package/src/responsive/responsiveHooks.js +7 -0
  203. package/src/theme/default/blackTheme.js +32 -0
  204. package/src/theme/default/cyberpunkTheme.js +1 -0
  205. package/src/theme/default/darkTheme.js +1 -0
  206. package/src/theme/default/deepWoodsTheme.js +1 -0
  207. package/src/theme/default/forestTheme.js +1 -0
  208. package/src/theme/default/hackerTheme.js +1 -0
  209. package/src/theme/default/lightTheme.js +1 -0
  210. package/src/theme/default/midnightTheme.js +1 -0
  211. package/src/theme/default/msdosTheme.js +1 -0
  212. package/src/theme/default/oceanTheme.js +1 -0
  213. package/src/theme/default/pastelTheme.js +2 -1
  214. package/src/theme/default/sunsetTheme.js +2 -1
  215. package/src/theme/default/themes.js +2 -0
  216. package/dist/components/calendar/DayPicker.js +0 -1
  217. package/src/components/calendar/DayPicker.js +0 -91
@@ -0,0 +1,27 @@
1
+ import { pick } from 'ramda'
2
+ import { ImageBackground as RNImageBackground } from 'react-native'
3
+
4
+ import { AbsView } from './View'
5
+
6
+ const allBorderRadiusProps = [
7
+ 'borderRadius',
8
+ 'borderTopLeftRadius',
9
+ 'borderTopRightRadius',
10
+ 'borderBottomLeftRadius',
11
+ 'borderBottomRightRadius',
12
+ 'borderTopStartRadius',
13
+ 'borderTopEndRadius',
14
+ 'borderBottomStartRadius',
15
+ 'borderBottomEndRadius',
16
+ ]
17
+
18
+ export function AbsImageBackground({ src, source, resizeMode = 'cover', style, children, ...props }) {
19
+ if (!source && !!src) source = { uri: src }
20
+ const imageStyle = pick(allBorderRadiusProps, style)
21
+
22
+ return (
23
+ <RNImageBackground source={source} resizeMode={resizeMode} style={style} imageStyle={imageStyle} {...props}>
24
+ {children}
25
+ </RNImageBackground>
26
+ )
27
+ }
@@ -0,0 +1,7 @@
1
+ import { ImageBackground as RNImageBackground } from 'react-native'
2
+
3
+ export function AbsImageBackground({ src, source, resizeMode = 'cover', ...props }) {
4
+ if (!source && !!src) source = { uri: src }
5
+
6
+ return <RNImageBackground source={source} resizeMode={resizeMode} {...props} />
7
+ }
@@ -0,0 +1,4 @@
1
+ export function AbsPressable({ link, onPress, onClick, ...props }) {
2
+ const Component = link ? 'a' : 'button'
3
+ return <Component onClick={onClick || onPress} {...props} />
4
+ }
@@ -0,0 +1,3 @@
1
+ import { Pressable as RNPressable } from 'react-native'
2
+
3
+ export const AbsPressable = RNPressable
@@ -0,0 +1,3 @@
1
+ import { Pressable as RNPressable } from 'react-native'
2
+
3
+ export const AbsPressable = RNPressable
@@ -0,0 +1,3 @@
1
+ import { AbsView } from './View'
2
+
3
+ export const AbsScrollView = AbsView
@@ -0,0 +1,5 @@
1
+ import { ScrollView } from 'react-native'
2
+
3
+ export const AbsScrollView = ({ style: { height, width, ...style }, ...props }) => {
4
+ return <ScrollView height={height} width={width} {...props} contentContainerStyle={style} />
5
+ }
@@ -1,3 +1,3 @@
1
- export function AbsTextInput(props) {
2
- return <input type="text" {...props} />
1
+ export function AbsTextInput({ onChange, ...props }) {
2
+ return <input type="text" onChange={(e) => onChange?.(e?.target?.value, e)} {...props} />
3
3
  }
@@ -5,11 +5,13 @@ import { IconLabel } from '../presentation/IconLabel'
5
5
  import { useBackgroundModifier } from '../../modifiers/background'
6
6
  import { useBorderModifier } from '../../modifiers/border'
7
7
  import { useColorConverter } from '../../modifiers/colorConverter'
8
+ import { useCursorModifier } from '../../modifiers/cursor'
8
9
  import { useDefaultModifier } from '../../modifiers/default'
9
10
  import { useDisplayModifier } from '../../modifiers/display'
10
11
  import { useFlexModifier } from '../../modifiers/flex'
11
12
  import { useFlexWrapperModifier } from '../../modifiers/flexWrapper'
12
13
  import { useFullColorModifier } from '../../modifiers/fullColor'
14
+ import { useHoverConverter } from '../../modifiers/hover'
13
15
  import { useMarginModifier } from '../../modifiers/margin'
14
16
  import { usePaddingModifier } from '../../modifiers/padding'
15
17
  import { usePositionModifier } from '../../modifiers/position'
@@ -25,6 +27,9 @@ const DEFAULT_PROPS = ([{ sizeCode }]) => ({
25
27
  br: sizeCode,
26
28
  border: 1,
27
29
  center: true,
30
+ hover: {
31
+ opacity: 0.7,
32
+ },
28
33
  })
29
34
 
30
35
  export function Button(rootProps) {
@@ -33,6 +38,8 @@ export function Button(rootProps) {
33
38
  useSizeConverter('elementHeights', 'md'),
34
39
  useThemeComponentModifier('Button'),
35
40
  useDefaultModifier(DEFAULT_PROPS),
41
+ useHoverConverter,
42
+ useCursorModifier,
36
43
  useFullColorModifier,
37
44
  useDisplayModifier,
38
45
  useStateModifier,
@@ -41,13 +41,14 @@ export function Dropdown({ items, ...rootProps }) {
41
41
  placement="bottomLeft"
42
42
  trigger={trigger}
43
43
  padding="xs"
44
+ useBottomDrawer={{ native: true, sm: true, md: true }}
44
45
  {...popoverProps}
45
46
  renderContent={({ onClose }) => {
46
47
  const handleChange = (...params) => {
47
48
  if (onChange) onChange(...params)
48
49
  onClose()
49
50
  }
50
- return <Menu vertical items={items} gap={0} onChange={handleChange} linkPaddingH="xs" />
51
+ return <Menu vertical items={items} onChange={handleChange} linkPaddingH="xs" />
51
52
  }}
52
53
  >
53
54
  {children || (
@@ -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}
44
+ marginV={-4}
45
45
  borderColor={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,4 @@ export * from './layout'
11
11
  export * from './table'
12
12
  export * from './feedback'
13
13
  export * from './calendar'
14
+ export * from './list'