@neko-os/ui 0.0.7 → 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 +8 -3
- 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 -94
|
@@ -3,6 +3,7 @@ import { useSharedValue } from 'react-native-reanimated'
|
|
|
3
3
|
import React from 'react'
|
|
4
4
|
|
|
5
5
|
import { useFadeEffect } from './fadeEffect'
|
|
6
|
+
import { useScaleEffect } from './scaleEffect'
|
|
6
7
|
import { useSlideEffect } from './slideEffect'
|
|
7
8
|
|
|
8
9
|
export function useAnimatedEffects([values, { open = true, onClose, lazy = false, unmountOnClose = false, ...props }]) {
|
|
@@ -32,7 +33,8 @@ export function useAnimatedEffects([values, { open = true, onClose, lazy = false
|
|
|
32
33
|
|
|
33
34
|
return pipe(
|
|
34
35
|
useFadeEffect, //
|
|
35
|
-
useSlideEffect
|
|
36
|
+
useSlideEffect,
|
|
37
|
+
useScaleEffect
|
|
36
38
|
)([
|
|
37
39
|
{
|
|
38
40
|
...values,
|
|
@@ -16,10 +16,12 @@ export function useFadeEffect([values, { fade, ...props }]) {
|
|
|
16
16
|
if (!fade) return
|
|
17
17
|
|
|
18
18
|
if (open) {
|
|
19
|
-
|
|
19
|
+
setOpacity(0)
|
|
20
20
|
|
|
21
21
|
requestAnimationFrame(() => {
|
|
22
|
-
|
|
22
|
+
requestAnimationFrame(() => {
|
|
23
|
+
setOpacity(1)
|
|
24
|
+
})
|
|
23
25
|
})
|
|
24
26
|
} else {
|
|
25
27
|
setOpacity(0)
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
|
|
3
|
+
const DEFAULT_EFFECT = { duration: 300, initialScale: 0 }
|
|
4
|
+
|
|
5
|
+
export function useScaleEffect([values, { scale, ...props }]) {
|
|
6
|
+
if (scale === true) scale = DEFAULT_EFFECT
|
|
7
|
+
if (!!scale) scale = { ...DEFAULT_EFFECT, ...scale }
|
|
8
|
+
const { duration, initialScale } = scale || {}
|
|
9
|
+
const { open, useRegisterEffect, useAddTransition } = values
|
|
10
|
+
const [transform, setTransform] = React.useState(`scale(${initialScale})`)
|
|
11
|
+
|
|
12
|
+
useRegisterEffect(scale)
|
|
13
|
+
useAddTransition(scale, `transform ${duration}ms ease-in-out`)
|
|
14
|
+
|
|
15
|
+
React.useEffect(() => {
|
|
16
|
+
if (!scale) return
|
|
17
|
+
|
|
18
|
+
if (open) {
|
|
19
|
+
setTransform(`scale(${initialScale})`)
|
|
20
|
+
|
|
21
|
+
requestAnimationFrame(() => {
|
|
22
|
+
requestAnimationFrame(() => {
|
|
23
|
+
setTransform('scale(1)')
|
|
24
|
+
})
|
|
25
|
+
})
|
|
26
|
+
} else {
|
|
27
|
+
setTransform(`scale(${initialScale})`)
|
|
28
|
+
}
|
|
29
|
+
}, [open])
|
|
30
|
+
|
|
31
|
+
if (!scale) return [values, props]
|
|
32
|
+
|
|
33
|
+
const style = { transform }
|
|
34
|
+
|
|
35
|
+
return [
|
|
36
|
+
values,
|
|
37
|
+
{
|
|
38
|
+
...props,
|
|
39
|
+
style: {
|
|
40
|
+
...props.style,
|
|
41
|
+
...style,
|
|
42
|
+
},
|
|
43
|
+
},
|
|
44
|
+
]
|
|
45
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { useSharedValue, withTiming, useAnimatedStyle } from 'react-native-reanimated'
|
|
2
|
+
import React from 'react'
|
|
3
|
+
|
|
4
|
+
const DEFAULT_EFFECT = { duration: 300, initialScale: 0 }
|
|
5
|
+
|
|
6
|
+
export function useScaleEffect([values, { scale, ...props }]) {
|
|
7
|
+
if (scale === true) scale = DEFAULT_EFFECT
|
|
8
|
+
if (!!scale) scale = { ...DEFAULT_EFFECT, ...scale }
|
|
9
|
+
const { duration, initialScale } = scale || {}
|
|
10
|
+
const { open, useRegisterEffect } = values
|
|
11
|
+
const scaleValue = useSharedValue(initialScale)
|
|
12
|
+
|
|
13
|
+
useRegisterEffect(scale)
|
|
14
|
+
|
|
15
|
+
React.useEffect(() => {
|
|
16
|
+
if (!scale) return
|
|
17
|
+
|
|
18
|
+
if (open) {
|
|
19
|
+
scaleValue.value = initialScale
|
|
20
|
+
scaleValue.value = withTiming(1, { duration })
|
|
21
|
+
} else {
|
|
22
|
+
scaleValue.value = withTiming(initialScale, { duration })
|
|
23
|
+
}
|
|
24
|
+
}, [open])
|
|
25
|
+
|
|
26
|
+
const animatedStyle = useAnimatedStyle(() => {
|
|
27
|
+
return { transform: [{ scale: scaleValue.value }] }
|
|
28
|
+
})
|
|
29
|
+
|
|
30
|
+
if (!scale) return [values, props]
|
|
31
|
+
|
|
32
|
+
return [values, { ...props, animatedStyles: [...props.animatedStyles, animatedStyle] }]
|
|
33
|
+
}
|
|
@@ -37,7 +37,9 @@ export function useSlideEffect([values, { slide, ...props }]) {
|
|
|
37
37
|
setTransform(initialValue)
|
|
38
38
|
|
|
39
39
|
requestAnimationFrame(() => {
|
|
40
|
-
|
|
40
|
+
requestAnimationFrame(() => {
|
|
41
|
+
setTransform('translateY(0)')
|
|
42
|
+
})
|
|
41
43
|
})
|
|
42
44
|
} else {
|
|
43
45
|
setTransform(initialValue)
|
|
@@ -1,16 +1,28 @@
|
|
|
1
|
+
import { is } from 'ramda'
|
|
2
|
+
|
|
1
3
|
import { clearProps } from './_helpers'
|
|
2
4
|
import { useGetColor } from '../theme/ThemeHandler'
|
|
3
5
|
|
|
4
6
|
export function useBackgroundModifier([values, props]) {
|
|
5
7
|
const getColor = useGetColor()
|
|
6
|
-
let { bg, background, backgroundColor, ...restProps } = props
|
|
8
|
+
let { bg, colors, background, backgroundColor, ...restProps } = props
|
|
9
|
+
let gradientColors = []
|
|
10
|
+
|
|
11
|
+
if (is(Array, bg) || !!colors?.length) {
|
|
12
|
+
colors = colors || bg || []
|
|
13
|
+
gradientColors = colors.map(getColor)
|
|
14
|
+
const angle = restProps.angle || 45
|
|
15
|
+
background = `linear-gradient(${angle}deg, ${gradientColors.join(', ')})`
|
|
16
|
+
} else {
|
|
17
|
+
backgroundColor = getColor(bg ?? background ?? backgroundColor)
|
|
18
|
+
}
|
|
7
19
|
|
|
8
|
-
|
|
20
|
+
const pointerEvents = props.pointerEvents
|
|
9
21
|
|
|
10
|
-
const style = clearProps({ backgroundColor })
|
|
22
|
+
const style = clearProps({ background, backgroundColor, pointerEvents })
|
|
11
23
|
|
|
12
24
|
return [
|
|
13
|
-
values,
|
|
25
|
+
{ gradientColors, ...values },
|
|
14
26
|
{
|
|
15
27
|
...restProps,
|
|
16
28
|
style: {
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { clearProps } from './_helpers'
|
|
2
|
+
|
|
3
|
+
export function useCursorModifier([values, props]) {
|
|
4
|
+
let { pointer, cursor, move, ...restProps } = props
|
|
5
|
+
|
|
6
|
+
if (pointer === true) cursor = 'pointer'
|
|
7
|
+
if (move === true) cursor = 'move'
|
|
8
|
+
|
|
9
|
+
const style = clearProps({ cursor })
|
|
10
|
+
|
|
11
|
+
return [
|
|
12
|
+
values,
|
|
13
|
+
{
|
|
14
|
+
...restProps,
|
|
15
|
+
style: {
|
|
16
|
+
...props.style,
|
|
17
|
+
...style,
|
|
18
|
+
},
|
|
19
|
+
},
|
|
20
|
+
]
|
|
21
|
+
}
|
package/src/modifiers/display.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { clearProps } from './_helpers'
|
|
2
2
|
|
|
3
3
|
export function useDisplayModifier([values, props]) {
|
|
4
|
-
let {
|
|
4
|
+
let { opacity, hidden, display, inline, block, ...restProps } = props
|
|
5
5
|
|
|
6
6
|
if (!!hidden) display = 'hidden'
|
|
7
7
|
if (!!inline) display = 'inline'
|
|
8
8
|
if (!!block) display = 'block'
|
|
9
9
|
|
|
10
|
-
const style = clearProps({ display, opacity
|
|
10
|
+
const style = clearProps({ display, opacity })
|
|
11
11
|
|
|
12
12
|
return [
|
|
13
13
|
values,
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
|
|
3
|
+
export function useHoverConverter([values, props]) {
|
|
4
|
+
const [isHover, setIsHover] = React.useState(false)
|
|
5
|
+
let { hover, onMouseEnter, onMouseLeave, ...restProps } = props
|
|
6
|
+
|
|
7
|
+
const handleMouseEnter = () => {
|
|
8
|
+
setIsHover(true)
|
|
9
|
+
onMouseEnter?.()
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
const handleMouseLeave = () => {
|
|
13
|
+
setIsHover(false)
|
|
14
|
+
onMouseLeave?.()
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
if (!isHover) hover = {}
|
|
18
|
+
|
|
19
|
+
return [
|
|
20
|
+
{ ...values, isHover },
|
|
21
|
+
{
|
|
22
|
+
...restProps,
|
|
23
|
+
onMouseEnter: handleMouseEnter,
|
|
24
|
+
onMouseLeave: handleMouseLeave,
|
|
25
|
+
...hover,
|
|
26
|
+
},
|
|
27
|
+
]
|
|
28
|
+
}
|
|
@@ -2,14 +2,35 @@ import { Platform } from '../abstractions/Platform'
|
|
|
2
2
|
import { clearProps } from './_helpers'
|
|
3
3
|
|
|
4
4
|
export function usePositionModifier([values, props]) {
|
|
5
|
-
let {
|
|
5
|
+
let {
|
|
6
|
+
position,
|
|
7
|
+
absolute,
|
|
8
|
+
absoluteFill,
|
|
9
|
+
fixedFill,
|
|
10
|
+
relative,
|
|
11
|
+
fixed,
|
|
12
|
+
sticky,
|
|
13
|
+
top,
|
|
14
|
+
bottom,
|
|
15
|
+
left,
|
|
16
|
+
right,
|
|
17
|
+
zIndex,
|
|
18
|
+
...restProps
|
|
19
|
+
} = props
|
|
6
20
|
|
|
7
21
|
if (!zIndex && !!absolute) zIndex = 10
|
|
8
|
-
if (absolute) position = 'absolute'
|
|
22
|
+
if (absolute || absoluteFill) position = 'absolute'
|
|
9
23
|
if (relative) position = 'relative'
|
|
10
|
-
if (fixed) position = 'fixed'
|
|
24
|
+
if (fixed || fixedFill) position = 'fixed'
|
|
11
25
|
if (sticky) position = 'sticky'
|
|
12
26
|
|
|
27
|
+
if (absoluteFill || fixedFill) {
|
|
28
|
+
top = 0
|
|
29
|
+
bottom = 0
|
|
30
|
+
left = 0
|
|
31
|
+
right = 0
|
|
32
|
+
}
|
|
33
|
+
|
|
13
34
|
if (Platform.OS !== 'web' && ['fixed', 'sticky'].includes(position)) {
|
|
14
35
|
position = 'absolute'
|
|
15
36
|
}
|
package/src/modifiers/size.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { Platform } from '../abstractions/Platform'
|
|
1
2
|
import { clearProps } from './_helpers'
|
|
2
3
|
import { useGetElementHeight } from '../theme/ThemeHandler'
|
|
3
4
|
|
|
@@ -38,7 +39,7 @@ export function useSizeModifier([values, props]) {
|
|
|
38
39
|
if (span) width = (span / 24) * 100 + '%'
|
|
39
40
|
|
|
40
41
|
if (fullWidth || fullW) width = '100%'
|
|
41
|
-
if (fullHeight || fullH) height = '100%'
|
|
42
|
+
if ((fullHeight || fullH) && Platform.OS === 'web') height = '100%'
|
|
42
43
|
|
|
43
44
|
let aspectRatio = ratio
|
|
44
45
|
if (!!square) aspectRatio = 1
|
package/src/modifiers/state.js
CHANGED
|
@@ -3,7 +3,7 @@ import { clearProps } from './_helpers'
|
|
|
3
3
|
export function useStateModifier([values, props]) {
|
|
4
4
|
let { disabled, loading, onClick, onPress, onChange, ...restProps } = props
|
|
5
5
|
|
|
6
|
-
let cursor =
|
|
6
|
+
let cursor = undefined
|
|
7
7
|
let opacity = props.opacity
|
|
8
8
|
|
|
9
9
|
if (!!disabled) {
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { is } from 'ramda'
|
|
2
2
|
import React from 'react'
|
|
3
3
|
|
|
4
|
+
import { Platform } from '../abstractions/Platform'
|
|
4
5
|
import { useBreakpoints } from '../theme/ThemeHandler'
|
|
5
6
|
import { useResponsive } from '../responsive/ResponsiveHandler'
|
|
6
7
|
|
|
@@ -10,6 +11,12 @@ export function useGetResponsiveValue() {
|
|
|
10
11
|
|
|
11
12
|
return React.useCallback(
|
|
12
13
|
(value) => {
|
|
14
|
+
const isNative = value?.native !== undefined && Platform.OS !== 'web'
|
|
15
|
+
if (isNative) return value?.native
|
|
16
|
+
|
|
17
|
+
const isWeb = value?.web !== undefined && Platform.OS === 'web'
|
|
18
|
+
if (isWeb) return value?.web
|
|
19
|
+
|
|
13
20
|
const isObj = is(Object, value)
|
|
14
21
|
|
|
15
22
|
if (!isObj) return value
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { mergeDeepRight } from 'ramda'
|
|
2
|
+
import { BASE_THEME } from './base'
|
|
3
|
+
|
|
4
|
+
export const DEFAULT_BLACK_THEME = mergeDeepRight(BASE_THEME, {
|
|
5
|
+
colors: {
|
|
6
|
+
primary: '#818DF9',
|
|
7
|
+
text: '#FFFFFF',
|
|
8
|
+
text2: '#E0E0E0',
|
|
9
|
+
text3: '#B0B0B0',
|
|
10
|
+
text4: '#8A8A8A',
|
|
11
|
+
|
|
12
|
+
bg: '#0f0f0f',
|
|
13
|
+
overlayBG: '#000000',
|
|
14
|
+
backdrop: '#1f1f1f',
|
|
15
|
+
shadow: 'rgba(216, 210, 203, 0.1)',
|
|
16
|
+
divider: '#383E44',
|
|
17
|
+
|
|
18
|
+
blue: '#4DA3FF',
|
|
19
|
+
yellow: '#FFD93B',
|
|
20
|
+
green: '#4CAF50',
|
|
21
|
+
purple: '#9B59B6',
|
|
22
|
+
orange: '#FF7F50',
|
|
23
|
+
cyan: '#00BCD4',
|
|
24
|
+
red: '#E74C3C',
|
|
25
|
+
navy: '#34495E',
|
|
26
|
+
indigo: '#5C6BC0',
|
|
27
|
+
gray: '#9E9E9E',
|
|
28
|
+
brown: '#8D6E63',
|
|
29
|
+
lylac: '#B39DDB',
|
|
30
|
+
pink: '#F48FB1',
|
|
31
|
+
},
|
|
32
|
+
})
|
|
@@ -11,8 +11,9 @@ export const PASTEL_DREAM_THEME = mergeDeepRight(BASE_THEME, {
|
|
|
11
11
|
|
|
12
12
|
bg: '#FFF7FA',
|
|
13
13
|
overlayBG: '#FFFFFF',
|
|
14
|
+
backdrop: '#4B4453',
|
|
14
15
|
shadow: 'rgba(39, 45, 52, 0.15)',
|
|
15
|
-
divider: '
|
|
16
|
+
divider: '#f0f0f0',
|
|
16
17
|
|
|
17
18
|
blue: '#A5B4FC',
|
|
18
19
|
yellow: '#FDE68A',
|
|
@@ -12,8 +12,9 @@ export const SUNSET_GLOW_THEME = mergeDeepRight(BASE_THEME, {
|
|
|
12
12
|
|
|
13
13
|
bg: '#FFF5E6',
|
|
14
14
|
overlayBG: '#FFFFFF',
|
|
15
|
+
backdrop: '#331E0A',
|
|
15
16
|
shadow: 'rgba(39, 45, 52, 0.15)',
|
|
16
|
-
divider: '
|
|
17
|
+
divider: '#f0f0f0',
|
|
17
18
|
|
|
18
19
|
blue: '#3B82F6',
|
|
19
20
|
yellow: '#FBBF24',
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { CYBERPUNK_DARK_THEME } from './cyberpunkTheme'
|
|
2
2
|
import { DEEP_WOODS_DARK_THEME } from './deepWoodsTheme'
|
|
3
|
+
import { DEFAULT_BLACK_THEME } from './blackTheme'
|
|
3
4
|
import { DEFAULT_DARK_THEME } from './darkTheme'
|
|
4
5
|
import { DEFAULT_LIGHT_THEME } from './lightTheme'
|
|
5
6
|
import { DEFAULT_MATRIX_THEME } from './hackerTheme'
|
|
@@ -13,6 +14,7 @@ import { SUNSET_GLOW_THEME } from './sunsetTheme'
|
|
|
13
14
|
export const DEFAULT_THEMES = {
|
|
14
15
|
light: DEFAULT_LIGHT_THEME,
|
|
15
16
|
dark: DEFAULT_DARK_THEME,
|
|
17
|
+
black: DEFAULT_BLACK_THEME,
|
|
16
18
|
pastel: PASTEL_DREAM_THEME,
|
|
17
19
|
midnight: MIDNIGHT_NEON_THEME,
|
|
18
20
|
sunset: SUNSET_GLOW_THEME,
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import _slicedToArray from"@babel/runtime/helpers/slicedToArray";import _objectWithoutProperties from"@babel/runtime/helpers/objectWithoutProperties";var _jsxFileName="/Users/christianstorch/Apps/nekoapps/libs/neko-ui/src/components/calendar/DayPicker.js";var _excluded=["initialValue","value","onChange","min","max","onCheckDisabled"];import React from'react';import dayjs from'dayjs';import{Col}from"../structure/Col";import{Grid}from"../structure/Row";import{Icon}from"../presentation/Icon";import{Link}from"../actions/Link";import{Text}from"../text/Text";import{View}from"../structure/View";import{useCalendarDays}from"./_helpers/calendarDays";import{jsx as _jsx,jsxs as _jsxs}from"react/jsx-runtime";export function DayPicker(_ref){var _this=this;var initialValue=_ref.initialValue,value=_ref.value,onChange=_ref.onChange,min=_ref.min,max=_ref.max,onCheckDisabled=_ref.onCheckDisabled,props=_objectWithoutProperties(_ref,_excluded);var _React$useState=React.useState(dayjs(initialValue)),_React$useState2=_slicedToArray(_React$useState,2),localValue=_React$useState2[0],setLocalValue=_React$useState2[1];value=value===undefined?localValue:value;var handleChange=function handleChange(v){setLocalValue(v);onChange==null?void 0:onChange(v);};var _React$useState3=React.useState(function(){return initialValue?dayjs(initialValue).startOf('month'):dayjs().startOf('month');}),_React$useState4=_slicedToArray(_React$useState3,2),currentMonth=_React$useState4[0],setCurrentMonth=_React$useState4[1];var prevMonth=function prevMonth(){return setCurrentMonth(function(m){return m.subtract(1,'month');});};var nextMonth=function nextMonth(){return setCurrentMonth(function(m){return m.add(1,'month');});};var prevYear=function prevYear(){return setCurrentMonth(function(m){return m.subtract(1,'year');});};var nextYear=function nextYear(){return setCurrentMonth(function(m){return m.add(1,'year');});};var _useCalendarDays=useCalendarDays(currentMonth),weekdayLabels=_useCalendarDays.weekdayLabels,cells=_useCalendarDays.cells;return _jsxs(View,Object.assign({className:"neko-day-picker",width:250},props,{children:[_jsxs(View,{className:"neko-date-picker-header",row:true,centerV:true,gap:"xxs",height:30,children:[_jsx(Link,{onPress:prevYear,"aria-label":"Previous year",padding:"xxs",paddingL:0,children:_jsx(Icon,{name:"arrow-left-double-line"})}),_jsx(Link,{onPress:prevMonth,"aria-label":"Previous month",padding:"xxs",children:_jsx(Icon,{name:"arrow-left-s-line"})}),_jsx(Text,{center:true,flex:true,children:currentMonth.format('MMM YYYY')}),_jsx(Link,{onPress:nextMonth,"aria-label":"Next month",padding:"xxs",children:_jsx(Icon,{name:"arrow-right-s-line"})}),_jsx(Link,{onPress:nextYear,"aria-label":"Next year",padding:"xxs",paddingR:0,children:_jsx(Icon,{name:"arrow-right-double-line"})})]}),_jsx(View,{className:"neko-day-picker-week",row:true,center:true,gap:"sm",children:weekdayLabels.map(function(w){return _jsx(View,{flex:true,height:30,center:true,children:_jsx(Text,{center:true,sm:true,text4:true,children:w})},w);})}),_jsx(Grid,{className:"neko-day-picker-days",colSpan:24/7,gap:"sm",children:cells.map(function(day,i){var dateVal=currentMonth.date(day);var isActive=!!day&&dateVal.isSame(value,'day');var disabled=!!min&&dateVal.isBefore(min)||!!max&&dateVal.isAfter(max)||(onCheckDisabled==null?void 0:onCheckDisabled(dateVal));return _jsx(Col,{className:"day-cell",center:true,children:_jsx(Link,{ratio:1,width:30,center:true,br:"md",onPress:function onPress(){return!!day&&handleChange(dateVal);},bg:isActive&&'primary',disabled:disabled,children:_jsx(Text,{sm:true,text2:true,center:true,strong:isActive,children:day||''})})},day?dateVal.format('YYYYMMDD'):i);})})]}));}
|
|
@@ -1,94 +0,0 @@
|
|
|
1
|
-
import React from 'react'
|
|
2
|
-
import dayjs from 'dayjs'
|
|
3
|
-
|
|
4
|
-
import { Col } from '../structure/Col'
|
|
5
|
-
import { Grid } from '../structure/Row'
|
|
6
|
-
import { Icon } from '../presentation/Icon'
|
|
7
|
-
import { Link } from '../actions/Link'
|
|
8
|
-
import { Text } from '../text/Text'
|
|
9
|
-
import { View } from '../structure/View'
|
|
10
|
-
import { useCalendarDays } from './_helpers/calendarDays'
|
|
11
|
-
|
|
12
|
-
export function DayPicker({ initialValue, value, onChange, min, max, onCheckDisabled, ...props }) {
|
|
13
|
-
const [localValue, setLocalValue] = React.useState(dayjs(initialValue))
|
|
14
|
-
value = value === undefined ? localValue : value
|
|
15
|
-
const handleChange = (v) => {
|
|
16
|
-
setLocalValue(v)
|
|
17
|
-
onChange?.(v)
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
const [currentMonth, setCurrentMonth] = React.useState(() =>
|
|
21
|
-
initialValue ? dayjs(initialValue).startOf('month') : dayjs().startOf('month')
|
|
22
|
-
)
|
|
23
|
-
|
|
24
|
-
const prevMonth = () => setCurrentMonth((m) => m.subtract(1, 'month'))
|
|
25
|
-
const nextMonth = () => setCurrentMonth((m) => m.add(1, 'month'))
|
|
26
|
-
|
|
27
|
-
const prevYear = () => setCurrentMonth((m) => m.subtract(1, 'year'))
|
|
28
|
-
const nextYear = () => setCurrentMonth((m) => m.add(1, 'year'))
|
|
29
|
-
|
|
30
|
-
const { weekdayLabels, cells } = useCalendarDays(currentMonth)
|
|
31
|
-
|
|
32
|
-
return (
|
|
33
|
-
<View className="neko-day-picker" width={250} {...props}>
|
|
34
|
-
<View className="neko-date-picker-header" row centerV gap="xxs" height={30}>
|
|
35
|
-
<Link onPress={prevYear} aria-label="Previous year" padding="xxs" paddingL={0}>
|
|
36
|
-
<Icon name="arrow-left-double-line" />
|
|
37
|
-
</Link>
|
|
38
|
-
|
|
39
|
-
<Link onPress={prevMonth} aria-label="Previous month" padding="xxs">
|
|
40
|
-
<Icon name="arrow-left-s-line" />
|
|
41
|
-
</Link>
|
|
42
|
-
|
|
43
|
-
<Text center flex>
|
|
44
|
-
{currentMonth.format('MMM YYYY')}
|
|
45
|
-
</Text>
|
|
46
|
-
|
|
47
|
-
<Link onPress={nextMonth} aria-label="Next month" padding="xxs">
|
|
48
|
-
<Icon name="arrow-right-s-line" />
|
|
49
|
-
</Link>
|
|
50
|
-
|
|
51
|
-
<Link onPress={nextYear} aria-label="Next year" padding="xxs" paddingR={0}>
|
|
52
|
-
<Icon name="arrow-right-double-line" />
|
|
53
|
-
</Link>
|
|
54
|
-
</View>
|
|
55
|
-
|
|
56
|
-
<View className="neko-day-picker-week" row center gap="sm">
|
|
57
|
-
{weekdayLabels.map((w) => (
|
|
58
|
-
<View key={w} flex height={30} center>
|
|
59
|
-
<Text center sm text4>
|
|
60
|
-
{w}
|
|
61
|
-
</Text>
|
|
62
|
-
</View>
|
|
63
|
-
))}
|
|
64
|
-
</View>
|
|
65
|
-
|
|
66
|
-
<Grid className="neko-day-picker-days" colSpan={24 / 7} gap="sm">
|
|
67
|
-
{cells.map((day, i) => {
|
|
68
|
-
const dateVal = currentMonth.date(day)
|
|
69
|
-
const isActive = !!day && dateVal.isSame(value, 'day')
|
|
70
|
-
const disabled =
|
|
71
|
-
(!!min && dateVal.isBefore(min)) || (!!max && dateVal.isAfter(max)) || onCheckDisabled?.(dateVal)
|
|
72
|
-
|
|
73
|
-
return (
|
|
74
|
-
<Col key={day ? dateVal.format('YYYYMMDD') : i} className="day-cell" center>
|
|
75
|
-
<Link
|
|
76
|
-
ratio={1}
|
|
77
|
-
width={30}
|
|
78
|
-
center
|
|
79
|
-
br="md"
|
|
80
|
-
onPress={() => !!day && handleChange(dateVal)}
|
|
81
|
-
bg={isActive && 'primary'}
|
|
82
|
-
disabled={disabled}
|
|
83
|
-
>
|
|
84
|
-
<Text sm text2 center strong={isActive}>
|
|
85
|
-
{day || ''}
|
|
86
|
-
</Text>
|
|
87
|
-
</Link>
|
|
88
|
-
</Col>
|
|
89
|
-
)
|
|
90
|
-
})}
|
|
91
|
-
</Grid>
|
|
92
|
-
</View>
|
|
93
|
-
)
|
|
94
|
-
}
|