@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.
- package/dist/NekoUI.js +1 -1
- package/dist/abstractions/AnimatedView.js +1 -1
- package/dist/abstractions/BlurView.js +1 -0
- package/dist/abstractions/BlurView.native.js +1 -0
- package/dist/abstractions/GradientView.js +1 -0
- package/dist/abstractions/GradientView.native.js +1 -0
- package/dist/abstractions/Icon.native.js +1 -1
- package/dist/abstractions/ImageBackground.js +1 -0
- package/dist/abstractions/ImageBackground.native.js +1 -0
- package/dist/abstractions/ImageBackground.web.js +1 -0
- package/dist/abstractions/Pressable.js +1 -0
- package/dist/abstractions/Pressable.native.js +1 -0
- package/dist/abstractions/Pressable.web.js +1 -0
- package/dist/abstractions/ScrollView.js +1 -0
- package/dist/abstractions/ScrollView.native.js +1 -0
- package/dist/abstractions/TextInput.js +1 -1
- package/dist/components/actions/Button.js +1 -1
- package/dist/components/actions/Dropdown.js +1 -1
- package/dist/components/actions/Link.js +1 -1
- package/dist/components/actions/Pressable.js +1 -0
- package/dist/components/actions/index.js +1 -1
- package/dist/components/actions/menu/HorizontalMenu.js +1 -1
- package/dist/components/actions/menu/VerticalMenu.js +1 -1
- package/dist/components/animations/ReanimatedView.js +1 -0
- package/dist/components/calendar/CalendarNav.js +1 -0
- package/dist/components/calendar/WeekDaysBar.js +1 -0
- package/dist/components/calendar/_helpers/calendarDays.js +1 -1
- package/dist/components/calendar/_helpers/dateDisabled.js +1 -0
- package/dist/components/calendar/index.js +0 -1
- package/dist/components/feedback/alerter.js +1 -0
- package/dist/components/feedback/confirmer.js +1 -0
- package/dist/components/feedback/index.js +1 -1
- package/dist/components/feedback/notifications/Notification.js +1 -1
- package/dist/components/feedback/notifications/NotificationsHandler.js +1 -1
- package/dist/components/index.js +1 -1
- package/dist/components/inputs/DateInput.js +1 -0
- package/dist/components/inputs/InputWrapper.js +1 -1
- package/dist/components/inputs/LinkInput.js +1 -0
- package/dist/components/inputs/MaskInput.js +1 -0
- package/dist/components/inputs/TextInput.js +1 -1
- package/dist/components/inputs/_DateInput.native.js +1 -0
- package/dist/components/inputs/datePicker/DatePicker.js +1 -0
- package/dist/components/inputs/datePicker/DayPicker.js +1 -0
- package/dist/components/inputs/datePicker/MonthPicker.js +1 -0
- package/dist/components/inputs/datePicker/QuarterPicker.js +1 -0
- package/dist/components/inputs/datePicker/WeekPicker.js +1 -0
- package/dist/components/inputs/datePicker/YearPicker.js +1 -0
- package/dist/components/inputs/index.js +1 -1
- package/dist/components/list/ScrollView.js +1 -0
- package/dist/components/list/index.js +1 -0
- package/dist/components/presentation/ImageBackground.js +1 -0
- package/dist/components/presentation/Result.js +1 -1
- package/dist/components/presentation/index.js +1 -1
- package/dist/components/structure/Accordion.js +1 -1
- package/dist/components/structure/BlurView.js +1 -0
- package/dist/components/structure/GradientView.js +1 -0
- package/dist/components/structure/bottomDrawer/index.js +1 -0
- package/dist/components/structure/bottomDrawer/index.native.js +1 -0
- package/dist/components/structure/bottomDrawer/index.web.js +1 -0
- package/dist/components/structure/bottomDrawer/native/BottomDrawer.js +1 -0
- package/dist/components/structure/bottomDrawer/native/DrawerContext.js +1 -0
- package/dist/components/structure/bottomDrawer/native/DrawerHandle.js +1 -0
- package/dist/components/structure/bottomDrawer/native/DrawerScrollView.js +1 -0
- package/dist/components/structure/bottomDrawer/native/utils.js +1 -0
- package/dist/components/structure/bottomDrawer/web/BottomDrawer.js +1 -0
- package/dist/components/structure/drawer/Drawer.js +1 -0
- package/dist/components/structure/drawer/Drawer.native.js +1 -0
- package/dist/components/structure/drawer/index.js +1 -0
- package/dist/components/structure/index.js +1 -1
- package/dist/components/structure/modal/Modal.js +1 -0
- package/dist/components/structure/modal/Modal.native.js +1 -0
- package/dist/components/structure/modal/ModalBackdrop.js +1 -0
- package/dist/components/structure/modal/ModalContent.js +1 -0
- package/dist/components/structure/modal/ModalFooter.js +1 -0
- package/dist/components/structure/modal/ModalHeader.js +1 -0
- package/dist/components/structure/modal/handler/ModalsHandler.js +1 -0
- package/dist/components/structure/modal/index.js +1 -0
- package/dist/components/structure/overlay/OverlayWrapper.js +1 -1
- package/dist/components/structure/popover/Popover.js +1 -1
- package/dist/components/structure/popover/Popover.native.js +1 -1
- package/dist/modifiers/animations/animatedEffects.js +1 -1
- package/dist/modifiers/animations/animatedEffects.native.js +1 -1
- package/dist/modifiers/animations/fadeEffect.js +1 -1
- package/dist/modifiers/animations/scaleEffect.js +1 -0
- package/dist/modifiers/animations/scaleEffect.native.js +1 -0
- package/dist/modifiers/animations/slideEffect.js +1 -1
- package/dist/modifiers/background.js +1 -1
- package/dist/modifiers/cursor.js +1 -0
- package/dist/modifiers/display.js +1 -1
- package/dist/modifiers/hover.js +1 -0
- package/dist/modifiers/position.js +1 -1
- package/dist/modifiers/size.js +1 -1
- package/dist/modifiers/state.js +1 -1
- package/dist/responsive/responsiveHooks.js +1 -1
- package/dist/theme/default/blackTheme.js +1 -0
- package/dist/theme/default/cyberpunkTheme.js +1 -1
- package/dist/theme/default/darkTheme.js +1 -1
- package/dist/theme/default/deepWoodsTheme.js +1 -1
- package/dist/theme/default/forestTheme.js +1 -1
- package/dist/theme/default/hackerTheme.js +1 -1
- package/dist/theme/default/lightTheme.js +1 -1
- package/dist/theme/default/midnightTheme.js +1 -1
- package/dist/theme/default/msdosTheme.js +1 -1
- package/dist/theme/default/oceanTheme.js +1 -1
- package/dist/theme/default/pastelTheme.js +1 -1
- package/dist/theme/default/sunsetTheme.js +1 -1
- package/dist/theme/default/themes.js +1 -1
- package/package.json +11 -5
- package/src/NekoUI.js +6 -3
- package/src/abstractions/AnimatedView.js +3 -3
- package/src/abstractions/BlurView.js +43 -0
- package/src/abstractions/BlurView.native.js +39 -0
- package/src/abstractions/GradientView.js +5 -0
- package/src/abstractions/GradientView.native.js +32 -0
- package/src/abstractions/Icon.native.js +4 -2
- package/src/abstractions/ImageBackground.js +17 -0
- package/src/abstractions/ImageBackground.native.js +27 -0
- package/src/abstractions/ImageBackground.web.js +7 -0
- package/src/abstractions/Pressable.js +4 -0
- package/src/abstractions/Pressable.native.js +3 -0
- package/src/abstractions/Pressable.web.js +3 -0
- package/src/abstractions/ScrollView.js +3 -0
- package/src/abstractions/ScrollView.native.js +5 -0
- package/src/abstractions/TextInput.js +2 -2
- package/src/components/actions/Button.js +7 -0
- package/src/components/actions/Dropdown.js +2 -1
- package/src/components/actions/Link.js +16 -2
- package/src/components/actions/Pressable.js +38 -0
- package/src/components/actions/index.js +1 -0
- package/src/components/actions/menu/HorizontalMenu.js +2 -1
- package/src/components/actions/menu/VerticalMenu.js +4 -3
- package/src/components/animations/ReanimatedView.js +40 -0
- package/src/components/calendar/CalendarNav.js +67 -0
- package/src/components/calendar/WeekDaysBar.js +18 -0
- package/src/components/calendar/_helpers/calendarDays.js +1 -3
- package/src/components/calendar/_helpers/dateDisabled.js +24 -0
- package/src/components/calendar/index.js +1 -1
- package/src/components/feedback/alerter.js +31 -0
- package/src/components/feedback/confirmer.js +70 -0
- package/src/components/feedback/index.js +2 -0
- package/src/components/feedback/notifications/Notification.js +1 -1
- package/src/components/feedback/notifications/NotificationsHandler.js +3 -3
- package/src/components/index.js +1 -0
- package/src/components/inputs/DateInput.js +111 -0
- package/src/components/inputs/InputWrapper.js +18 -6
- package/src/components/inputs/LinkInput.js +17 -0
- package/src/components/inputs/MaskInput.js +67 -0
- package/src/components/inputs/TextInput.js +2 -2
- package/src/components/inputs/_DateInput.native.js +89 -0
- package/src/components/inputs/datePicker/DatePicker.js +24 -0
- package/src/components/inputs/datePicker/DayPicker.js +65 -0
- package/src/components/inputs/datePicker/MonthPicker.js +62 -0
- package/src/components/inputs/datePicker/QuarterPicker.js +65 -0
- package/src/components/inputs/datePicker/WeekPicker.js +74 -0
- package/src/components/inputs/datePicker/YearPicker.js +67 -0
- package/src/components/inputs/index.js +4 -0
- package/src/components/list/ScrollView.js +58 -0
- package/src/components/list/index.js +1 -0
- package/src/components/presentation/ImageBackground.js +38 -0
- package/src/components/presentation/Result.js +2 -2
- package/src/components/presentation/index.js +1 -0
- package/src/components/structure/Accordion.js +1 -1
- package/src/components/structure/BlurView.js +58 -0
- package/src/components/structure/GradientView.js +42 -0
- package/src/components/structure/bottomDrawer/index.js +1 -0
- package/src/components/structure/bottomDrawer/index.native.js +4 -0
- package/src/components/structure/bottomDrawer/index.web.js +4 -0
- package/src/components/structure/bottomDrawer/native/BottomDrawer.js +229 -0
- package/src/components/structure/bottomDrawer/native/DrawerContext.js +21 -0
- package/src/components/structure/bottomDrawer/native/DrawerHandle.js +12 -0
- package/src/components/structure/bottomDrawer/native/DrawerScrollView.js +83 -0
- package/src/components/structure/bottomDrawer/native/utils.js +58 -0
- package/src/components/structure/bottomDrawer/web/BottomDrawer.js +3 -0
- package/src/components/structure/drawer/Drawer.js +5 -0
- package/src/components/structure/drawer/Drawer.native.js +3 -0
- package/src/components/structure/drawer/index.js +1 -0
- package/src/components/structure/index.js +5 -0
- package/src/components/structure/modal/Modal.js +84 -0
- package/src/components/structure/modal/Modal.native.js +83 -0
- package/src/components/structure/modal/ModalBackdrop.js +58 -0
- package/src/components/structure/modal/ModalContent.js +28 -0
- package/src/components/structure/modal/ModalFooter.js +31 -0
- package/src/components/structure/modal/ModalHeader.js +50 -0
- package/src/components/structure/modal/handler/ModalsHandler.js +61 -0
- package/src/components/structure/modal/index.js +6 -0
- package/src/components/structure/overlay/OverlayWrapper.js +1 -1
- package/src/components/structure/popover/Popover.js +28 -2
- package/src/components/structure/popover/Popover.native.js +44 -15
- package/src/modifiers/animations/animatedEffects.js +2 -0
- package/src/modifiers/animations/animatedEffects.native.js +3 -1
- package/src/modifiers/animations/fadeEffect.js +4 -2
- package/src/modifiers/animations/scaleEffect.js +45 -0
- package/src/modifiers/animations/scaleEffect.native.js +33 -0
- package/src/modifiers/animations/slideEffect.js +3 -1
- package/src/modifiers/background.js +16 -4
- package/src/modifiers/cursor.js +21 -0
- package/src/modifiers/display.js +2 -2
- package/src/modifiers/hover.js +28 -0
- package/src/modifiers/position.js +24 -3
- package/src/modifiers/size.js +2 -1
- package/src/modifiers/state.js +1 -1
- package/src/responsive/responsiveHooks.js +7 -0
- package/src/theme/default/blackTheme.js +32 -0
- package/src/theme/default/cyberpunkTheme.js +1 -0
- package/src/theme/default/darkTheme.js +1 -0
- package/src/theme/default/deepWoodsTheme.js +1 -0
- package/src/theme/default/forestTheme.js +1 -0
- package/src/theme/default/hackerTheme.js +1 -0
- package/src/theme/default/lightTheme.js +1 -0
- package/src/theme/default/midnightTheme.js +1 -0
- package/src/theme/default/msdosTheme.js +1 -0
- package/src/theme/default/oceanTheme.js +1 -0
- package/src/theme/default/pastelTheme.js +2 -1
- package/src/theme/default/sunsetTheme.js +2 -1
- package/src/theme/default/themes.js +2 -0
- package/dist/components/calendar/DayPicker.js +0 -1
- 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
|
+
}
|
|
@@ -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}
|
|
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
|
-
|
|
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
|
+
}
|
|
@@ -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 = '
|
|
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={
|
|
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
|
|
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
|
-
|
|
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
|
+
}
|
|
@@ -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} />
|
package/src/components/index.js
CHANGED