@neko-os/ui 0.0.13 → 0.2.0
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/FlatList.native.js +1 -1
- package/dist/abstractions/KeyboardAvoidingView.js +1 -0
- package/dist/abstractions/KeyboardAvoidingView.native.js +1 -0
- package/dist/abstractions/ScrollView.native.js +1 -1
- package/dist/components/actions/ActionsDrawer.js +1 -0
- package/dist/components/actions/Button.js +1 -1
- package/dist/components/actions/FloatingMenu.js +1 -0
- package/dist/components/actions/index.js +1 -1
- package/dist/components/animations/AnimatedTopBar.js +1 -0
- package/dist/components/animations/AnimatedTopBar.native.js +1 -0
- package/dist/components/animations/AnimatedTopBar.web.js +1 -0
- package/dist/components/animations/ParallaxHeader.js +1 -0
- package/dist/components/animations/ParallaxHeader.native.js +1 -0
- package/dist/components/animations/ParallaxHeader.web.js +1 -0
- package/dist/components/animations/ReanimatedScrollHandler.js +1 -0
- package/dist/components/animations/ReanimatedScrollHandler.native.js +1 -0
- package/dist/components/animations/ReanimatedScrollHandler.web.js +1 -0
- package/dist/components/animations/index.js +1 -1
- package/dist/components/feedback/alerter.js +1 -1
- package/dist/components/feedback/confirmer.js +1 -1
- package/dist/components/form/FormItem.js +1 -1
- package/dist/components/form/FormList.js +1 -1
- package/dist/components/form/SubmitButton.js +1 -1
- package/dist/components/form/index.js +1 -1
- package/dist/components/form/useNewForm.js +1 -1
- package/dist/components/form/validation/defaultMessages.js +1 -0
- package/dist/components/form/validation/index.js +1 -0
- package/dist/components/form/validation/normalizeRules.js +1 -0
- package/dist/components/form/validation/shouldValidateOn.js +1 -0
- package/dist/components/form/validation/validateRules.js +1 -0
- package/dist/components/form/validation/validators.js +1 -0
- package/dist/components/index.js +1 -1
- package/dist/components/inputs/InputWrapper.js +1 -1
- package/dist/components/inputs/NumberInput.js +1 -1
- package/dist/components/inputs/Picker.js +1 -1
- package/dist/components/inputs/Select.js +1 -1
- package/dist/components/modals/bottomDrawer/index.js +1 -0
- package/dist/components/modals/bottomDrawer/index.native.js +1 -0
- package/dist/components/modals/bottomDrawer/index.web.js +1 -0
- package/dist/components/modals/bottomDrawer/native/BottomDrawer.js +1 -0
- package/dist/components/modals/bottomDrawer/native/DrawerContext.js +1 -0
- package/dist/components/modals/bottomDrawer/native/DrawerHandle.js +1 -0
- package/dist/components/modals/bottomDrawer/native/DrawerScrollView.js +1 -0
- package/dist/components/modals/bottomDrawer/native/createDrawerScrollComponent.js +1 -0
- package/dist/components/modals/bottomDrawer/web/BottomDrawer.js +1 -0
- package/dist/components/modals/drawer/Drawer.js +1 -0
- package/dist/components/modals/index.js +1 -0
- package/dist/components/modals/modal/Modal.js +1 -0
- package/dist/components/modals/modal/Modal.native.js +1 -0
- package/dist/components/modals/modal/ModalBackdrop.js +1 -0
- package/dist/components/modals/modal/ModalContent.js +1 -0
- package/dist/components/modals/modal/ModalFooter.js +1 -0
- package/dist/components/modals/modal/ModalHeader.js +1 -0
- package/dist/components/modals/modal/handler/ModalsHandler.js +1 -0
- package/dist/components/modals/router/ModalRoute.js +1 -0
- package/dist/components/modals/router/ModalsRouter.js +1 -0
- package/dist/components/modals/router/ModalsRouterContext.js +1 -0
- package/dist/components/modals/router/index.js +1 -0
- package/dist/components/modals/router/useAllModalsParams.js +1 -0
- package/dist/components/modals/router/useModalParams.js +1 -0
- package/dist/components/modals/router/useModalsNavigation.js +1 -0
- package/dist/components/modals/router/useUpdateModalContainer.js +1 -0
- package/dist/components/presentation/Avatar.js +1 -1
- package/dist/components/presentation/AvatarLabel.js +1 -1
- package/dist/components/presentation/LabelValue.js +1 -1
- package/dist/components/presentation/Result.js +1 -1
- package/dist/components/presentation/Tooltip.js +1 -1
- package/dist/components/sections/Section.js +1 -0
- package/dist/components/sections/SectionItem.js +1 -0
- package/dist/components/sections/SectionItemDropdown.js +1 -0
- package/dist/components/sections/SectionItemLink.js +1 -0
- package/dist/components/sections/index.js +1 -0
- package/dist/components/state/StatePresenter.js +1 -0
- package/dist/components/state/index.js +1 -1
- package/dist/components/structure/BlurView.js +1 -1
- package/dist/components/structure/KeyboardAvoidingView.js +1 -0
- package/dist/components/structure/TopBar.js +1 -0
- package/dist/components/structure/index.js +1 -1
- package/dist/components/structure/popover/Popover.js +1 -1
- package/dist/components/structure/popover/Popover.native.js +1 -1
- package/dist/components/structure/popover/Popover_BU.js +1 -1
- package/dist/components/text/DateText.js +1 -0
- package/dist/components/text/index.js +1 -1
- package/dist/components/theme/ThemePicker.js +1 -1
- package/dist/components/theme/ThemePickerDrawer.js +1 -1
- package/dist/helpers/index.js +1 -1
- package/dist/helpers/storage.js +1 -1
- package/dist/responsive/responsiveHooks.js +1 -1
- package/dist/theme/ThemeHandler.js +1 -1
- package/dist/theme/default/base.js +1 -1
- package/dist/theme/default/blackTheme.js +1 -1
- package/dist/theme/default/cyberpunkTheme.js +1 -1
- package/dist/theme/default/darkTheme.js +1 -1
- package/dist/theme/default/hackerTheme.js +1 -1
- package/dist/theme/default/lightTheme.js +1 -1
- package/dist/theme/default/paperTheme.js +1 -1
- package/dist/theme/default/themes.js +1 -1
- package/package.json +1 -1
- package/src/NekoUI.js +1 -1
- package/src/abstractions/FlatList.native.js +2 -1
- package/src/abstractions/KeyboardAvoidingView.js +3 -0
- package/src/abstractions/KeyboardAvoidingView.native.js +3 -0
- package/src/abstractions/ScrollView.native.js +2 -2
- package/src/components/actions/ActionsDrawer.js +68 -0
- package/src/components/actions/Button.js +2 -1
- package/src/components/actions/FloatingMenu.js +39 -0
- package/src/components/actions/index.js +2 -0
- package/src/components/animations/AnimatedTopBar.js +10 -0
- package/src/components/animations/AnimatedTopBar.native.js +34 -0
- package/src/components/animations/AnimatedTopBar.web.js +1 -0
- package/src/components/animations/ParallaxHeader.js +9 -0
- package/src/components/animations/ParallaxHeader.native.js +32 -0
- package/src/components/animations/ParallaxHeader.web.js +32 -0
- package/src/components/animations/ReanimatedScrollHandler.js +8 -0
- package/src/components/animations/ReanimatedScrollHandler.native.js +24 -0
- package/src/components/animations/ReanimatedScrollHandler.web.js +1 -0
- package/src/components/animations/index.js +3 -0
- package/src/components/feedback/alerter.js +1 -1
- package/src/components/feedback/confirmer.js +1 -1
- package/src/components/form/FormItem.js +42 -5
- package/src/components/form/FormList.js +23 -4
- package/src/components/form/SubmitButton.js +4 -2
- package/src/components/form/index.js +1 -0
- package/src/components/form/useNewForm.js +108 -15
- package/src/components/form/validation/defaultMessages.js +20 -0
- package/src/components/form/validation/index.js +5 -0
- package/src/components/form/validation/normalizeRules.js +22 -0
- package/src/components/form/validation/shouldValidateOn.js +21 -0
- package/src/components/form/validation/validateRules.js +83 -0
- package/src/components/form/validation/validators.js +82 -0
- package/src/components/index.js +2 -0
- package/src/components/inputs/InputWrapper.js +1 -1
- package/src/components/inputs/NumberInput.js +6 -5
- package/src/components/inputs/Picker.js +3 -2
- package/src/components/inputs/Select.js +31 -15
- package/src/components/modals/bottomDrawer/index.js +3 -0
- package/src/components/{structure → modals}/bottomDrawer/index.native.js +2 -1
- package/src/components/{structure → modals}/bottomDrawer/index.web.js +2 -1
- package/src/components/{structure → modals}/bottomDrawer/native/BottomDrawer.js +15 -21
- package/src/components/{structure → modals}/bottomDrawer/native/DrawerHandle.js +1 -1
- package/src/components/modals/bottomDrawer/native/DrawerScrollView.js +5 -0
- package/src/components/modals/bottomDrawer/native/createDrawerScrollComponent.js +131 -0
- package/src/components/modals/index.js +4 -0
- package/src/components/{structure → modals}/modal/Modal.native.js +1 -1
- package/src/components/{structure → modals}/modal/ModalBackdrop.js +1 -1
- package/src/components/{structure → modals}/modal/ModalContent.js +1 -1
- package/src/components/{structure → modals}/modal/ModalFooter.js +1 -1
- package/src/components/{structure → modals}/modal/ModalHeader.js +1 -1
- package/src/components/modals/router/ModalRoute.js +15 -0
- package/src/components/modals/router/ModalsRouter.js +120 -0
- package/src/components/modals/router/ModalsRouterContext.js +16 -0
- package/src/components/modals/router/index.js +6 -0
- package/src/components/modals/router/useAllModalsParams.js +6 -0
- package/src/components/modals/router/useModalParams.js +6 -0
- package/src/components/modals/router/useModalsNavigation.js +6 -0
- package/src/components/modals/router/useUpdateModalContainer.js +6 -0
- package/src/components/presentation/Avatar.js +2 -2
- package/src/components/presentation/AvatarLabel.js +2 -0
- package/src/components/presentation/LabelValue.js +7 -5
- package/src/components/presentation/Result.js +2 -2
- package/src/components/presentation/Tooltip.js +1 -1
- package/src/components/sections/Section.js +50 -0
- package/src/components/sections/SectionItem.js +24 -0
- package/src/components/sections/SectionItemDropdown.js +68 -0
- package/src/components/sections/SectionItemLink.js +33 -0
- package/src/components/sections/index.js +4 -0
- package/src/components/state/StatePresenter.js +41 -0
- package/src/components/state/index.js +1 -0
- package/src/components/structure/BlurView.js +1 -0
- package/src/components/structure/KeyboardAvoidingView.js +52 -0
- package/src/components/structure/TopBar.js +45 -0
- package/src/components/structure/index.js +2 -3
- package/src/components/structure/popover/Popover.js +1 -1
- package/src/components/structure/popover/Popover.native.js +1 -1
- package/src/components/structure/popover/Popover_BU.js +1 -1
- package/src/components/text/DateText.js +11 -0
- package/src/components/text/index.js +1 -0
- package/src/components/theme/ThemePicker.js +1 -2
- package/src/components/theme/ThemePickerDrawer.js +3 -4
- package/src/helpers/index.js +1 -0
- package/src/helpers/storage.js +32 -9
- package/src/responsive/responsiveHooks.js +6 -0
- package/src/theme/ThemeHandler.js +6 -3
- package/src/theme/default/base.js +16 -4
- package/src/theme/default/blackTheme.js +33 -21
- package/src/theme/default/cyberpunkTheme.js +24 -22
- package/src/theme/default/darkTheme.js +1 -0
- package/src/theme/default/hackerTheme.js +40 -19
- package/src/theme/default/lightTheme.js +1 -0
- package/src/theme/default/paperTheme.js +14 -0
- package/src/theme/default/themes.js +0 -9
- package/dist/components/structure/bottomDrawer/index.js +0 -1
- package/dist/components/structure/bottomDrawer/index.native.js +0 -1
- package/dist/components/structure/bottomDrawer/index.web.js +0 -1
- package/dist/components/structure/bottomDrawer/native/BottomDrawer.js +0 -1
- package/dist/components/structure/bottomDrawer/native/DrawerContext.js +0 -1
- package/dist/components/structure/bottomDrawer/native/DrawerHandle.js +0 -1
- package/dist/components/structure/bottomDrawer/native/DrawerScrollView.js +0 -1
- package/dist/components/structure/bottomDrawer/web/BottomDrawer.js +0 -1
- package/dist/components/structure/drawer/Drawer.js +0 -1
- package/dist/components/structure/modal/Modal.js +0 -1
- package/dist/components/structure/modal/Modal.native.js +0 -1
- package/dist/components/structure/modal/ModalBackdrop.js +0 -1
- package/dist/components/structure/modal/ModalContent.js +0 -1
- package/dist/components/structure/modal/ModalFooter.js +0 -1
- package/dist/components/structure/modal/ModalHeader.js +0 -1
- package/dist/components/structure/modal/handler/ModalsHandler.js +0 -1
- package/dist/theme/default/deepWoodsTheme.js +0 -1
- package/dist/theme/default/forestTheme.js +0 -1
- package/dist/theme/default/midnightTheme.js +0 -1
- package/dist/theme/default/msdosTheme.js +0 -1
- package/dist/theme/default/oceanTheme.js +0 -1
- package/dist/theme/default/pastelTheme.js +0 -1
- package/dist/theme/default/sunsetTheme.js +0 -1
- package/src/components/structure/bottomDrawer/index.js +0 -1
- package/src/components/structure/bottomDrawer/native/DrawerScrollView.js +0 -83
- package/src/theme/default/deepWoodsTheme.js +0 -34
- package/src/theme/default/forestTheme.js +0 -34
- package/src/theme/default/midnightTheme.js +0 -34
- package/src/theme/default/msdosTheme.js +0 -55
- package/src/theme/default/oceanTheme.js +0 -34
- package/src/theme/default/pastelTheme.js +0 -34
- package/src/theme/default/sunsetTheme.js +0 -35
- /package/dist/components/{structure → modals}/bottomDrawer/native/utils.js +0 -0
- /package/dist/components/{structure → modals}/drawer/Drawer.native.js +0 -0
- /package/dist/components/{structure → modals}/drawer/Drawer.web.js +0 -0
- /package/dist/components/{structure → modals}/drawer/index.js +0 -0
- /package/dist/components/{structure → modals}/modal/index.js +0 -0
- /package/src/components/{structure → modals}/bottomDrawer/native/DrawerContext.js +0 -0
- /package/src/components/{structure → modals}/bottomDrawer/native/utils.js +0 -0
- /package/src/components/{structure → modals}/bottomDrawer/web/BottomDrawer.js +0 -0
- /package/src/components/{structure → modals}/drawer/Drawer.js +0 -0
- /package/src/components/{structure → modals}/drawer/Drawer.native.js +0 -0
- /package/src/components/{structure → modals}/drawer/Drawer.web.js +0 -0
- /package/src/components/{structure → modals}/drawer/index.js +0 -0
- /package/src/components/{structure → modals}/modal/Modal.js +0 -0
- /package/src/components/{structure → modals}/modal/handler/ModalsHandler.js +0 -0
- /package/src/components/{structure → modals}/modal/index.js +0 -0
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { useEffect } from 'react'
|
|
2
|
+
|
|
3
|
+
import { useModalsRouterContext } from './ModalsRouterContext'
|
|
4
|
+
|
|
5
|
+
export function ModalRoute({ name, component, type = 'modal', ...containerProps }) {
|
|
6
|
+
const { registerRoute, unregisterRoute } = useModalsRouterContext()
|
|
7
|
+
|
|
8
|
+
useEffect(() => {
|
|
9
|
+
if (!name || !registerRoute) return
|
|
10
|
+
registerRoute(name, { component, type, containerProps })
|
|
11
|
+
return () => unregisterRoute?.(name)
|
|
12
|
+
}, [name])
|
|
13
|
+
|
|
14
|
+
return null
|
|
15
|
+
}
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
import React, { useCallback, useMemo, useRef, useState } from 'react'
|
|
2
|
+
|
|
3
|
+
import { BottomDrawer } from '../bottomDrawer'
|
|
4
|
+
import { Drawer } from '../drawer'
|
|
5
|
+
import { Modal } from '../modal/Modal'
|
|
6
|
+
import { ModalRouteContext, ModalsRouterContext, ModalsStackContext } from './ModalsRouterContext'
|
|
7
|
+
|
|
8
|
+
const CONTAINERS = {
|
|
9
|
+
modal: Modal,
|
|
10
|
+
drawer: Drawer,
|
|
11
|
+
bottomDrawer: BottomDrawer,
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export function ModalsRouter({ children }) {
|
|
15
|
+
const [stack, setStack] = useState([])
|
|
16
|
+
const [renderStack, setRenderStack] = useState([])
|
|
17
|
+
const [containerOverrides, setContainerOverrides] = useState({})
|
|
18
|
+
const keyRef = useRef(0)
|
|
19
|
+
const routesRef = useRef({})
|
|
20
|
+
|
|
21
|
+
const registerRoute = useCallback((name, config) => {
|
|
22
|
+
routesRef.current[name] = config
|
|
23
|
+
}, [])
|
|
24
|
+
|
|
25
|
+
const unregisterRoute = useCallback((name) => {
|
|
26
|
+
delete routesRef.current[name]
|
|
27
|
+
}, [])
|
|
28
|
+
|
|
29
|
+
const updateContainerProps = useCallback((key, props) => {
|
|
30
|
+
setContainerOverrides((prev) => ({
|
|
31
|
+
...prev,
|
|
32
|
+
[key]: { ...prev[key], ...props },
|
|
33
|
+
}))
|
|
34
|
+
}, [])
|
|
35
|
+
|
|
36
|
+
const push = useCallback((path, params) => {
|
|
37
|
+
const key = ++keyRef.current
|
|
38
|
+
const entry = { key, path, params }
|
|
39
|
+
setStack((prev) => [...prev, entry])
|
|
40
|
+
setRenderStack((prev) => [...prev, { ...entry, open: true }])
|
|
41
|
+
}, [])
|
|
42
|
+
|
|
43
|
+
const closeByKey = useCallback((key) => {
|
|
44
|
+
setStack((prev) => prev.filter((e) => e.key !== key))
|
|
45
|
+
setRenderStack((prev) => prev.map((e) => (e.key === key ? { ...e, open: false } : e)))
|
|
46
|
+
setTimeout(() => {
|
|
47
|
+
setRenderStack((prev) => prev.filter((e) => e.key !== key))
|
|
48
|
+
}, 600)
|
|
49
|
+
}, [])
|
|
50
|
+
|
|
51
|
+
const goBack = useCallback(() => {
|
|
52
|
+
setStack((prev) => {
|
|
53
|
+
if (prev.length === 0) return prev
|
|
54
|
+
const last = prev[prev.length - 1]
|
|
55
|
+
setRenderStack((rs) => rs.map((e) => (e.key === last.key ? { ...e, open: false } : e)))
|
|
56
|
+
setTimeout(() => {
|
|
57
|
+
setRenderStack((rs) => rs.filter((e) => e.key !== last.key))
|
|
58
|
+
}, 600)
|
|
59
|
+
return prev.slice(0, -1)
|
|
60
|
+
})
|
|
61
|
+
}, [])
|
|
62
|
+
|
|
63
|
+
const closeAll = useCallback(() => {
|
|
64
|
+
setStack([])
|
|
65
|
+
setRenderStack((prev) => {
|
|
66
|
+
const closing = prev.map((e) => ({ ...e, open: false }))
|
|
67
|
+
setTimeout(() => {
|
|
68
|
+
setRenderStack([])
|
|
69
|
+
}, 600)
|
|
70
|
+
return closing
|
|
71
|
+
})
|
|
72
|
+
}, [])
|
|
73
|
+
|
|
74
|
+
// Static — never changes, so consumers like useModalsNavigation
|
|
75
|
+
// and ModalRoute don't re-render when the stack changes
|
|
76
|
+
const actionsValue = useMemo(
|
|
77
|
+
() => ({ push, goBack, closeAll, registerRoute, unregisterRoute }),
|
|
78
|
+
[push, goBack, closeAll, registerRoute, unregisterRoute]
|
|
79
|
+
)
|
|
80
|
+
|
|
81
|
+
// Dynamic — only useAllModalsParams subscribes to this
|
|
82
|
+
const stackValue = useMemo(() => ({ stack }), [stack])
|
|
83
|
+
|
|
84
|
+
// Nest modals inside each other so each RN Modal presents from
|
|
85
|
+
// the previous modal's view controller (required for iOS stacking).
|
|
86
|
+
// Context providers go INSIDE Container children so they survive
|
|
87
|
+
// the Portal teleport on web (Portal re-mounts content at PortalHandler level).
|
|
88
|
+
const nestedModals = renderStack.reduceRight((inner, entry) => {
|
|
89
|
+
const route = routesRef.current[entry.path]
|
|
90
|
+
if (!route) return inner
|
|
91
|
+
|
|
92
|
+
const Container = CONTAINERS[route.type] || Modal
|
|
93
|
+
const Component = route.component
|
|
94
|
+
|
|
95
|
+
const overrides = containerOverrides[entry.key]
|
|
96
|
+
const updateContainer = (props) => updateContainerProps(entry.key, props)
|
|
97
|
+
|
|
98
|
+
return (
|
|
99
|
+
<Container key={entry.key} open={entry.open} onClose={() => closeByKey(entry.key)} {...route.containerProps} {...overrides}>
|
|
100
|
+
<ModalsRouterContext.Provider value={actionsValue}>
|
|
101
|
+
<ModalsStackContext.Provider value={stackValue}>
|
|
102
|
+
<ModalRouteContext.Provider value={{ params: entry.params, path: entry.path, key: entry.key, updateContainer }}>
|
|
103
|
+
<Component />
|
|
104
|
+
{inner}
|
|
105
|
+
</ModalRouteContext.Provider>
|
|
106
|
+
</ModalsStackContext.Provider>
|
|
107
|
+
</ModalsRouterContext.Provider>
|
|
108
|
+
</Container>
|
|
109
|
+
)
|
|
110
|
+
}, null)
|
|
111
|
+
|
|
112
|
+
return (
|
|
113
|
+
<ModalsRouterContext.Provider value={actionsValue}>
|
|
114
|
+
<ModalsStackContext.Provider value={stackValue}>
|
|
115
|
+
{children}
|
|
116
|
+
{nestedModals}
|
|
117
|
+
</ModalsStackContext.Provider>
|
|
118
|
+
</ModalsRouterContext.Provider>
|
|
119
|
+
)
|
|
120
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
|
|
3
|
+
// Static context — actions that never change (push, goBack, etc.)
|
|
4
|
+
const ModalsRouterContext = React.createContext(null)
|
|
5
|
+
export const useModalsRouterContext = () => React.useContext(ModalsRouterContext) || {}
|
|
6
|
+
export { ModalsRouterContext }
|
|
7
|
+
|
|
8
|
+
// Dynamic context — stack data that changes on push/goBack
|
|
9
|
+
const ModalsStackContext = React.createContext(null)
|
|
10
|
+
export const useModalsStackContext = () => React.useContext(ModalsStackContext) || {}
|
|
11
|
+
export { ModalsStackContext }
|
|
12
|
+
|
|
13
|
+
// Per-entry context — params for each rendered modal
|
|
14
|
+
const ModalRouteContext = React.createContext(null)
|
|
15
|
+
export const useModalRouteContext = () => React.useContext(ModalRouteContext) || {}
|
|
16
|
+
export { ModalRouteContext }
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { ModalsRouter } from './ModalsRouter'
|
|
2
|
+
export { ModalRoute } from './ModalRoute'
|
|
3
|
+
export { useModalsNavigation } from './useModalsNavigation'
|
|
4
|
+
export { useModalParams } from './useModalParams'
|
|
5
|
+
export { useAllModalsParams } from './useAllModalsParams'
|
|
6
|
+
export { useUpdateModalContainer } from './useUpdateModalContainer'
|
|
@@ -54,7 +54,7 @@ export function Avatar(rootProps) {
|
|
|
54
54
|
useOverflowModifier
|
|
55
55
|
)([{}, rootProps])
|
|
56
56
|
|
|
57
|
-
let { initials, name, icon, src, invert, textProps, iconProps, ...props } = formattedProps
|
|
57
|
+
let { initials, name, icon, src, invert, textProps, iconProps, iconSize, ...props } = formattedProps
|
|
58
58
|
initials = initials || getInitials(name)
|
|
59
59
|
|
|
60
60
|
let content = (
|
|
@@ -66,7 +66,7 @@ export function Avatar(rootProps) {
|
|
|
66
66
|
icon={icon}
|
|
67
67
|
invert={invert}
|
|
68
68
|
textProps={{ strong: true, ...textProps }}
|
|
69
|
-
iconProps={iconProps}
|
|
69
|
+
iconProps={{ size: iconSize, ...iconProps }}
|
|
70
70
|
/>
|
|
71
71
|
)
|
|
72
72
|
if (!!src) content = <Image br={0} src={src} width={sizeCode} height={sizeCode} />
|
|
@@ -26,6 +26,7 @@ export function AvatarLabel(rootProps) {
|
|
|
26
26
|
avatarProps,
|
|
27
27
|
moveAvatarSizeScale,
|
|
28
28
|
avatarSize,
|
|
29
|
+
iconSize,
|
|
29
30
|
...props
|
|
30
31
|
} = formattedProps
|
|
31
32
|
const hasAvatar = !!name || !!initials || !!src
|
|
@@ -47,6 +48,7 @@ export function AvatarLabel(rootProps) {
|
|
|
47
48
|
dynamicColor={dynamicColor}
|
|
48
49
|
square={square}
|
|
49
50
|
marginH={2}
|
|
51
|
+
iconSize={iconSize}
|
|
50
52
|
{...avatarProps}
|
|
51
53
|
/>
|
|
52
54
|
}
|
|
@@ -4,11 +4,12 @@ import { IconLabel } from './IconLabel'
|
|
|
4
4
|
import { Text } from '../text/Text'
|
|
5
5
|
import { View } from '../structure/View'
|
|
6
6
|
import { moveScale } from '../../theme/helpers/sizeScale'
|
|
7
|
+
import { useColorConverter } from '../../modifiers/colorConverter'
|
|
7
8
|
import { useDefaultModifier } from '../../modifiers/default'
|
|
8
9
|
import { useSizeConverter } from '../../modifiers/sizeConverter'
|
|
9
10
|
import { useThemeComponentModifier } from '../../modifiers/themeComponent'
|
|
10
11
|
|
|
11
|
-
const DEFAULT_PROPS = ([{ sizeCode }, { vertical, spread }]) => {
|
|
12
|
+
const DEFAULT_PROPS = ([{ sizeCode, color }, { vertical, spread }]) => {
|
|
12
13
|
return {
|
|
13
14
|
row: !vertical,
|
|
14
15
|
centerV: !vertical,
|
|
@@ -17,7 +18,7 @@ const DEFAULT_PROPS = ([{ sizeCode }, { vertical, spread }]) => {
|
|
|
17
18
|
labelProps: {
|
|
18
19
|
size: moveScale(sizeCode, !vertical ? 0 : -2),
|
|
19
20
|
moveIconSizeScale: !vertical ? -1 : -2,
|
|
20
|
-
color: 'text3',
|
|
21
|
+
color: color || 'text3',
|
|
21
22
|
},
|
|
22
23
|
valueProps: {
|
|
23
24
|
size: sizeCode,
|
|
@@ -28,17 +29,18 @@ const DEFAULT_PROPS = ([{ sizeCode }, { vertical, spread }]) => {
|
|
|
28
29
|
|
|
29
30
|
export function LabelValue({ children, ...rootProps }) {
|
|
30
31
|
const [{ sizeCode, color }, formattedProps] = pipe(
|
|
31
|
-
|
|
32
|
+
useColorConverter(),
|
|
32
33
|
useSizeConverter('elementHeights', 'md'),
|
|
33
34
|
useThemeComponentModifier('Labelvalue'), //
|
|
34
35
|
useDefaultModifier(DEFAULT_PROPS)
|
|
35
36
|
)([{}, rootProps])
|
|
36
37
|
|
|
37
|
-
const { icon, label, iconColor, labelProps, value, valueProps, vertical, spread, ...props } =
|
|
38
|
+
const { icon, label, iconColor, labelProps, value, valueColor, valueProps, vertical, spread, ...props } =
|
|
39
|
+
formattedProps
|
|
38
40
|
let separator = !vertical && !spread ? ':' : ''
|
|
39
41
|
|
|
40
42
|
let content = children || value
|
|
41
|
-
if (is(String, value)) content = <Text label={value} {...valueProps} />
|
|
43
|
+
if (is(String, value)) content = <Text label={value} color={valueColor || color} {...valueProps} />
|
|
42
44
|
|
|
43
45
|
return (
|
|
44
46
|
<View className="neko-label-value" {...props}>
|
|
@@ -46,11 +46,11 @@ export function Result({
|
|
|
46
46
|
<View className="neko-result" center padding="lg" {...props}>
|
|
47
47
|
{!!icon && <Icon name={icon} color={iconColor} size={42} primary {...iconProps} />}
|
|
48
48
|
{!!icon && <Divider height={10} />}
|
|
49
|
-
<Text h4 {...textProps} {...titleProps}>
|
|
49
|
+
<Text h4 center {...textProps} {...titleProps}>
|
|
50
50
|
{title}
|
|
51
51
|
</Text>
|
|
52
52
|
{!!description && (
|
|
53
|
-
<Text text3 sm marginT="sm" {...textProps} {...descriptionProps}>
|
|
53
|
+
<Text text3 sm marginT="sm" center {...textProps} {...descriptionProps}>
|
|
54
54
|
{description}
|
|
55
55
|
</Text>
|
|
56
56
|
)}
|
|
@@ -10,7 +10,7 @@ import { useThemeComponentModifier } from '../../modifiers/themeComponent'
|
|
|
10
10
|
export function Tooltip(rootProps) {
|
|
11
11
|
const [{ loading, fontColor, sizeCode }, formattedProps] = pipe(
|
|
12
12
|
useColorConverter('overlayBG'),
|
|
13
|
-
useSizeConverter('text', '
|
|
13
|
+
useSizeConverter('text', 'sm'),
|
|
14
14
|
useThemeComponentModifier('Tooltip'),
|
|
15
15
|
useFullColorModifier
|
|
16
16
|
)([{}, rootProps])
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { pipe } from 'ramda'
|
|
2
|
+
import React from 'react'
|
|
3
|
+
|
|
4
|
+
import { Divider } from '../helpers/Separator'
|
|
5
|
+
import { Text } from '../text'
|
|
6
|
+
import { View } from '../structure'
|
|
7
|
+
import { useDefaultModifier } from '../../modifiers/default'
|
|
8
|
+
import { useThemeComponentModifier } from '../../modifiers/themeComponent'
|
|
9
|
+
|
|
10
|
+
const DEFAULT_PROPS = {
|
|
11
|
+
marginH: 'md',
|
|
12
|
+
bg: 'overlayBG',
|
|
13
|
+
br: 'md',
|
|
14
|
+
titleProps: {
|
|
15
|
+
strong: true,
|
|
16
|
+
text4: true,
|
|
17
|
+
sm: true,
|
|
18
|
+
marginB: 'sm',
|
|
19
|
+
paddingH: 'md',
|
|
20
|
+
},
|
|
21
|
+
dividerProps: {
|
|
22
|
+
line: true,
|
|
23
|
+
height: 1,
|
|
24
|
+
},
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export function Section({ children, title, ...rootProps }) {
|
|
28
|
+
const [{}, formattedProps] = pipe(
|
|
29
|
+
useThemeComponentModifier('Section'), //
|
|
30
|
+
useDefaultModifier(DEFAULT_PROPS)
|
|
31
|
+
)([{}, rootProps])
|
|
32
|
+
|
|
33
|
+
const { titleProps, dividerProps, ...props } = formattedProps
|
|
34
|
+
|
|
35
|
+
const childArray = React.Children.toArray(children)
|
|
36
|
+
|
|
37
|
+
return (
|
|
38
|
+
<View>
|
|
39
|
+
{!!title && <Text marginH={props.marginH} {...titleProps} label={title} />}
|
|
40
|
+
<View className="neko-section" {...props}>
|
|
41
|
+
{childArray.map((child, i) => (
|
|
42
|
+
<React.Fragment key={child.key}>
|
|
43
|
+
{child}
|
|
44
|
+
{i < childArray.length - 1 && <Divider {...dividerProps} />}
|
|
45
|
+
</React.Fragment>
|
|
46
|
+
))}
|
|
47
|
+
</View>
|
|
48
|
+
</View>
|
|
49
|
+
)
|
|
50
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { pipe } from 'ramda'
|
|
2
|
+
|
|
3
|
+
import { LabelValue } from '../presentation'
|
|
4
|
+
import { useColorConverter } from '../../modifiers/colorConverter'
|
|
5
|
+
import { useDefaultModifier } from '../../modifiers/default'
|
|
6
|
+
import { useThemeComponentModifier } from '../../modifiers/themeComponent'
|
|
7
|
+
|
|
8
|
+
const DEFAULT_PROPS = {
|
|
9
|
+
paddingH: 'md',
|
|
10
|
+
paddingV: 'sm',
|
|
11
|
+
minH: 'md',
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export function SectionItem({ ...rootProps }) {
|
|
15
|
+
const [{ color }, formattedProps] = pipe(
|
|
16
|
+
useColorConverter(),
|
|
17
|
+
useThemeComponentModifier('SectionItem'), //
|
|
18
|
+
useDefaultModifier(DEFAULT_PROPS)
|
|
19
|
+
)([{}, rootProps])
|
|
20
|
+
|
|
21
|
+
const { ...props } = formattedProps
|
|
22
|
+
|
|
23
|
+
return <LabelValue spread className="neko-section-item" color={color} {...props} />
|
|
24
|
+
}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { pipe } from 'ramda'
|
|
2
|
+
|
|
3
|
+
import { IconLabel } from '../presentation'
|
|
4
|
+
import { Link } from '../actions'
|
|
5
|
+
import { Menu } from '../actions/menu/Menu'
|
|
6
|
+
import { Popover } from '../structure/popover/Popover'
|
|
7
|
+
import { ScrollView } from '../list'
|
|
8
|
+
import { SectionItem } from './SectionItem'
|
|
9
|
+
import { useColorConverter } from '../../modifiers/colorConverter'
|
|
10
|
+
import { useDefaultModifier } from '../../modifiers/default'
|
|
11
|
+
import { useResponsiveValue } from '../../responsive'
|
|
12
|
+
import { useThemeComponentModifier } from '../../modifiers/themeComponent'
|
|
13
|
+
|
|
14
|
+
const DEFAULT_PROPS = {
|
|
15
|
+
paddingV: 'sm',
|
|
16
|
+
minH: 'md',
|
|
17
|
+
icon: 'arrow-down-s-fill',
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export function SectionItemDropdown({ children, value, valueLabel, items, onChange, ...rootProps }) {
|
|
21
|
+
const [{ color }, formattedProps] = pipe(
|
|
22
|
+
useColorConverter(),
|
|
23
|
+
useThemeComponentModifier('SectionItemDropdown'),
|
|
24
|
+
useDefaultModifier(DEFAULT_PROPS)
|
|
25
|
+
)([{}, rootProps])
|
|
26
|
+
|
|
27
|
+
let { icon, iconLabelProps, trigger = 'click', placement, popoverProps, useBottomDrawer, ...props } = formattedProps
|
|
28
|
+
|
|
29
|
+
useBottomDrawer = useResponsiveValue(useBottomDrawer || { native: true, sm: true, md: true })
|
|
30
|
+
|
|
31
|
+
return (
|
|
32
|
+
<Popover
|
|
33
|
+
useParentMinWidth
|
|
34
|
+
placement={placement || 'bottomRight'}
|
|
35
|
+
trigger={trigger}
|
|
36
|
+
padding={0}
|
|
37
|
+
contentProps={{ padding: 0 }}
|
|
38
|
+
useBottomDrawer={useBottomDrawer}
|
|
39
|
+
{...popoverProps}
|
|
40
|
+
renderContent={({ onClose }) => {
|
|
41
|
+
const handleChange = (...params) => {
|
|
42
|
+
if (onChange) onChange(...params)
|
|
43
|
+
onClose()
|
|
44
|
+
}
|
|
45
|
+
return (
|
|
46
|
+
<ScrollView>
|
|
47
|
+
<Menu
|
|
48
|
+
vertical
|
|
49
|
+
items={items}
|
|
50
|
+
onChange={handleChange}
|
|
51
|
+
linkPaddingH={useBottomDrawer ? 'md' : 'sm'}
|
|
52
|
+
linkMinHeight={useBottomDrawer ? 'xl' : 'md'}
|
|
53
|
+
withDivider={useBottomDrawer}
|
|
54
|
+
/>
|
|
55
|
+
</ScrollView>
|
|
56
|
+
)
|
|
57
|
+
}}
|
|
58
|
+
>
|
|
59
|
+
<Link className="neko-section-item-dropdown">
|
|
60
|
+
<SectionItem color={color} {...props}>
|
|
61
|
+
{children || (
|
|
62
|
+
<IconLabel gap={2} invert color={color} {...iconLabelProps} label={valueLabel || value} icon={icon} />
|
|
63
|
+
)}
|
|
64
|
+
</SectionItem>
|
|
65
|
+
</Link>
|
|
66
|
+
</Popover>
|
|
67
|
+
)
|
|
68
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { pipe } from 'ramda'
|
|
2
|
+
|
|
3
|
+
import { IconLabel } from '../presentation'
|
|
4
|
+
import { Link } from '../actions'
|
|
5
|
+
import { SectionItem } from './SectionItem'
|
|
6
|
+
import { useColorConverter } from '../../modifiers/colorConverter'
|
|
7
|
+
import { useDefaultModifier } from '../../modifiers/default'
|
|
8
|
+
import { useThemeComponentModifier } from '../../modifiers/themeComponent'
|
|
9
|
+
|
|
10
|
+
const DEFAULT_PROPS = {
|
|
11
|
+
icon: 'md',
|
|
12
|
+
paddingV: 'sm',
|
|
13
|
+
minH: 'md',
|
|
14
|
+
icon: 'arrow-right-s-line',
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export function SectionItemLink({ children, value, onPress, ...rootProps }) {
|
|
18
|
+
const [{ color }, formattedProps] = pipe(
|
|
19
|
+
useColorConverter(),
|
|
20
|
+
useThemeComponentModifier('SectionItemLink'), //
|
|
21
|
+
useDefaultModifier(DEFAULT_PROPS)
|
|
22
|
+
)([{}, rootProps])
|
|
23
|
+
|
|
24
|
+
const { icon, iconLabelProps, ...props } = formattedProps
|
|
25
|
+
|
|
26
|
+
return (
|
|
27
|
+
<Link className="neko-section-item-link" onPress={onPress}>
|
|
28
|
+
<SectionItem color={color} {...props}>
|
|
29
|
+
{children || <IconLabel gap={2} invert color={color} {...iconLabelProps} label={value} icon={icon} />}
|
|
30
|
+
</SectionItem>
|
|
31
|
+
</Link>
|
|
32
|
+
)
|
|
33
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { Loading } from './Loading'
|
|
2
|
+
import { Result } from '../presentation'
|
|
3
|
+
import { View } from '../structure'
|
|
4
|
+
|
|
5
|
+
export function StatePresenter({
|
|
6
|
+
loading,
|
|
7
|
+
error,
|
|
8
|
+
empty,
|
|
9
|
+
errorTitle = 'Something went wrong',
|
|
10
|
+
errorDescription,
|
|
11
|
+
emptyTitle = 'No results',
|
|
12
|
+
emptyDescription,
|
|
13
|
+
children,
|
|
14
|
+
...props
|
|
15
|
+
}) {
|
|
16
|
+
if (loading) {
|
|
17
|
+
return (
|
|
18
|
+
<View flex center {...props}>
|
|
19
|
+
<Loading />
|
|
20
|
+
</View>
|
|
21
|
+
)
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
if (error) {
|
|
25
|
+
return (
|
|
26
|
+
<View flex center {...props}>
|
|
27
|
+
<Result type="error" title={errorTitle} description={errorDescription || error.message} />
|
|
28
|
+
</View>
|
|
29
|
+
)
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
if (empty) {
|
|
33
|
+
return (
|
|
34
|
+
<View flex center {...props}>
|
|
35
|
+
<Result type="empty" title={emptyTitle} description={emptyDescription} />
|
|
36
|
+
</View>
|
|
37
|
+
)
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
return children
|
|
41
|
+
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { pipe } from 'ramda'
|
|
2
|
+
|
|
3
|
+
import { AbsKeyboardAvoidingView } from '../../abstractions/KeyboardAvoidingView'
|
|
4
|
+
import { Platform } from '../../abstractions/Platform'
|
|
5
|
+
import { useSafeAreaInsets } from '../../abstractions/helpers/useSafeAreaInsets'
|
|
6
|
+
import { useAnimationModifier } from '../../modifiers/animation'
|
|
7
|
+
import { useBackgroundModifier } from '../../modifiers/background'
|
|
8
|
+
import { useBorderModifier } from '../../modifiers/border'
|
|
9
|
+
import { useCursorModifier } from '../../modifiers/cursor'
|
|
10
|
+
import { useDisplayModifier } from '../../modifiers/display'
|
|
11
|
+
import { useFlexModifier } from '../../modifiers/flex'
|
|
12
|
+
import { useFlexWrapperModifier } from '../../modifiers/flexWrapper'
|
|
13
|
+
import { useMarginModifier } from '../../modifiers/margin'
|
|
14
|
+
import { useOverflowModifier } from '../../modifiers/overflow'
|
|
15
|
+
import { usePaddingModifier } from '../../modifiers/padding'
|
|
16
|
+
import { usePositionModifier } from '../../modifiers/position'
|
|
17
|
+
import { useShadowModifier } from '../../modifiers/shadow'
|
|
18
|
+
import { useSizeModifier } from '../../modifiers/size'
|
|
19
|
+
import { useStateModifier } from '../../modifiers/state'
|
|
20
|
+
import { useThemeComponentModifier } from '../../modifiers/themeComponent'
|
|
21
|
+
|
|
22
|
+
export function KeyboardAvoidingView({ children, keyboardVerticalOffset = 0, ...rootProps }) {
|
|
23
|
+
const { bottom } = useSafeAreaInsets()
|
|
24
|
+
|
|
25
|
+
const [_, props] = pipe(
|
|
26
|
+
useThemeComponentModifier('KeyboardAvoidingView'),
|
|
27
|
+
useFlexWrapperModifier,
|
|
28
|
+
useDisplayModifier,
|
|
29
|
+
useCursorModifier,
|
|
30
|
+
useAnimationModifier,
|
|
31
|
+
useStateModifier,
|
|
32
|
+
useSizeModifier,
|
|
33
|
+
usePositionModifier,
|
|
34
|
+
useOverflowModifier,
|
|
35
|
+
usePaddingModifier,
|
|
36
|
+
useMarginModifier,
|
|
37
|
+
useFlexModifier,
|
|
38
|
+
useBackgroundModifier,
|
|
39
|
+
useBorderModifier,
|
|
40
|
+
useShadowModifier
|
|
41
|
+
)([{}, rootProps])
|
|
42
|
+
|
|
43
|
+
return (
|
|
44
|
+
<AbsKeyboardAvoidingView
|
|
45
|
+
behavior={Platform.OS === 'ios' ? 'padding' : 'height'}
|
|
46
|
+
keyboardVerticalOffset={keyboardVerticalOffset + bottom}
|
|
47
|
+
{...props}
|
|
48
|
+
>
|
|
49
|
+
{children}
|
|
50
|
+
</AbsKeyboardAvoidingView>
|
|
51
|
+
)
|
|
52
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { Text } from '../text'
|
|
2
|
+
import { View } from './View'
|
|
3
|
+
import { useResponsiveConverter } from '../../modifiers/responsiveConverter'
|
|
4
|
+
import { useSafeAreaInsets } from '../../abstractions/helpers/useSafeAreaInsets'
|
|
5
|
+
|
|
6
|
+
export function TopBar({ right, left, WrapperView, children, ...rootProps }) {
|
|
7
|
+
const { top: safeTop } = useSafeAreaInsets()
|
|
8
|
+
|
|
9
|
+
const [_, props] = useResponsiveConverter([])([{}, rootProps])
|
|
10
|
+
let { useSafeArea = true, title, subtitle } = props
|
|
11
|
+
|
|
12
|
+
const hasContent = !!title || !!subtitle || !!children || !!right || !!left
|
|
13
|
+
|
|
14
|
+
WrapperView = WrapperView || View
|
|
15
|
+
|
|
16
|
+
return (
|
|
17
|
+
<WrapperView paddingT={useSafeArea && safeTop} {...props}>
|
|
18
|
+
{!!hasContent && (
|
|
19
|
+
<View minH="md" centerV row paddingH="md" paddingV="sm" gap="sm" fullW>
|
|
20
|
+
<View flex={1} toLeft>
|
|
21
|
+
{left}
|
|
22
|
+
</View>
|
|
23
|
+
|
|
24
|
+
<View center flex={3}>
|
|
25
|
+
{children || (
|
|
26
|
+
<Text center h6 numberOfLines={1}>
|
|
27
|
+
{title}
|
|
28
|
+
</Text>
|
|
29
|
+
)}
|
|
30
|
+
|
|
31
|
+
{subtitle && (
|
|
32
|
+
<Text center xs numberOfLines={1}>
|
|
33
|
+
{subtitle}
|
|
34
|
+
</Text>
|
|
35
|
+
)}
|
|
36
|
+
</View>
|
|
37
|
+
|
|
38
|
+
<View flex={1} toRight>
|
|
39
|
+
{right}
|
|
40
|
+
</View>
|
|
41
|
+
</View>
|
|
42
|
+
)}
|
|
43
|
+
</WrapperView>
|
|
44
|
+
)
|
|
45
|
+
}
|
|
@@ -7,8 +7,7 @@ export * from './SafeAreaView'
|
|
|
7
7
|
export * from './Card'
|
|
8
8
|
export * from './Row'
|
|
9
9
|
export * from './Col'
|
|
10
|
-
export * from './modal'
|
|
11
|
-
export * from './drawer'
|
|
12
|
-
export * from './bottomDrawer'
|
|
13
10
|
export * from './popover/Popover'
|
|
14
11
|
export * from './Segment'
|
|
12
|
+
export * from './TopBar'
|
|
13
|
+
export * from './KeyboardAvoidingView'
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
2
|
|
|
3
|
-
import { BottomDrawer } from '
|
|
3
|
+
import { BottomDrawer } from '../../modals/bottomDrawer'
|
|
4
4
|
import { PopoverContent } from './PopoverContent'
|
|
5
5
|
import { useRegisterOverlay } from '../overlay/OverlayHandler'
|
|
6
6
|
import { useResponsiveValue } from '../../../responsive'
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Modal, TouchableWithoutFeedback } from 'react-native'
|
|
2
2
|
import React from 'react'
|
|
3
3
|
|
|
4
|
-
import { BottomDrawer } from '
|
|
4
|
+
import { BottomDrawer } from '../../modals/bottomDrawer'
|
|
5
5
|
import { PopoverContent } from './PopoverContent'
|
|
6
6
|
import { View } from '../View'
|
|
7
7
|
import { calculatePosition } from '../overlay/calculatePosition'
|