@neko-os/ui 0.0.5 → 0.0.6
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/ActivityIndicator.js +1 -0
- package/dist/abstractions/ActivityIndicator.native.js +1 -0
- package/dist/abstractions/AnimatedView.js +1 -0
- package/dist/abstractions/AnimatedView.native.js +1 -0
- package/dist/abstractions/DraggableSlideView.js +1 -0
- package/dist/abstractions/DraggableSlideView.native.js +1 -0
- package/dist/abstractions/Icon.js +1 -1
- package/dist/abstractions/Image.js +1 -0
- package/dist/abstractions/Image.native.js +1 -0
- package/dist/abstractions/Image.web.js +1 -0
- package/dist/abstractions/Platform.js +1 -0
- package/dist/abstractions/Platform.native.js +1 -0
- package/dist/abstractions/Platform.web.js +1 -0
- package/dist/abstractions/SafeAreaView.js +1 -0
- package/dist/abstractions/SafeAreaView.native.js +1 -0
- package/dist/abstractions/Table.js +1 -0
- package/dist/abstractions/Table.native.js +1 -0
- package/dist/abstractions/Text.js +1 -1
- package/dist/abstractions/TextInput.js +1 -0
- package/dist/abstractions/TextInput.native.js +1 -0
- package/dist/abstractions/TextInput.web.js +1 -0
- package/dist/abstractions/View.js +1 -1
- package/dist/abstractions/helpers/componentSize.js +1 -0
- package/dist/abstractions/helpers/componentSize.native.js +1 -0
- package/dist/abstractions/helpers/transformStyle.js +1 -0
- package/dist/abstractions/helpers/transformStyle.native.js +1 -0
- package/dist/components/actions/Breadcrumb.js +1 -0
- package/dist/components/actions/Button.js +1 -1
- package/dist/components/actions/Dropdown.js +1 -0
- package/dist/components/actions/Link.js +1 -1
- package/dist/components/actions/index.js +1 -1
- package/dist/components/actions/menu/HorizontalMenu.js +1 -0
- package/dist/components/actions/menu/Menu.js +1 -0
- package/dist/components/actions/menu/SubmenuWrapper.js +1 -0
- package/dist/components/actions/menu/VerticalMenu.js +1 -0
- package/dist/components/animations/AnimatedView.js +1 -0
- package/dist/components/animations/DraggableSlideView.js +1 -0
- package/dist/components/animations/index.js +1 -0
- package/dist/components/calendar/DayPicker.js +1 -0
- package/dist/components/calendar/_helpers/calendarDays.js +1 -0
- package/dist/components/calendar/index.js +1 -0
- package/dist/components/feedback/index.js +1 -0
- package/dist/components/feedback/notifications/Notification.js +1 -0
- package/dist/components/feedback/notifications/NotificationsHandler.js +1 -0
- package/dist/components/form/Form.js +1 -1
- package/dist/components/form/FormGroup.js +1 -1
- package/dist/components/form/FormItem.js +1 -1
- package/dist/components/form/FormList.js +1 -1
- package/dist/components/form/FormWrapperComponent.js +1 -1
- package/dist/components/form/FormWrapperComponent.native.js +1 -1
- package/dist/components/form/SubmitButton.js +1 -0
- package/dist/components/form/index.js +1 -1
- package/dist/components/form/useNewForm.js +1 -0
- package/dist/components/form/useWatch.js +1 -0
- package/dist/components/helpers/LazyRender.js +1 -0
- package/dist/components/helpers/LazyRender.native.js +1 -0
- package/dist/components/helpers/Portal.js +1 -0
- package/dist/components/helpers/PortalHandler.js +1 -0
- package/dist/components/helpers/Responsive.js +1 -1
- package/dist/components/helpers/Separator.js +1 -1
- package/dist/components/helpers/VerticalView.js +1 -0
- package/dist/components/helpers/index.js +1 -1
- package/dist/components/index.js +1 -1
- package/dist/components/inputs/Checkbox.js +1 -0
- package/dist/components/inputs/InputWrapper.js +1 -0
- package/dist/components/inputs/Picker.js +1 -0
- package/dist/components/inputs/Radio.js +1 -0
- package/dist/components/inputs/Switch.js +1 -0
- package/dist/components/inputs/TextInput.js +1 -0
- package/dist/components/inputs/index.js +1 -0
- package/dist/components/layout/Layout.js +1 -0
- package/dist/components/layout/LayoutContent.js +1 -0
- package/dist/components/layout/LayoutHeader.js +1 -0
- package/dist/components/layout/LayoutSider.js +1 -0
- package/dist/components/layout/index.js +1 -0
- package/dist/components/presentation/Avatar.js +1 -0
- package/dist/components/presentation/AvatarLabel.js +1 -0
- package/dist/components/presentation/Badge.js +1 -0
- package/dist/components/presentation/ContentLabel.js +1 -1
- package/dist/components/presentation/IconLabel.js +1 -1
- package/dist/components/presentation/Image.js +1 -0
- package/dist/components/presentation/LabelValue.js +1 -0
- package/dist/components/presentation/Result.js +1 -0
- package/dist/components/presentation/ResultBar.js +1 -0
- package/dist/components/presentation/Tag.js +1 -1
- package/dist/components/presentation/Tooltip.js +1 -0
- package/dist/components/presentation/index.js +1 -1
- package/dist/components/state/Loading.js +1 -0
- package/dist/components/state/LoadingView.js +1 -0
- package/dist/components/state/index.js +1 -0
- package/dist/components/structure/Accordion.js +1 -0
- package/dist/components/structure/AccordionGroup.js +1 -0
- package/dist/components/structure/Card.js +1 -1
- package/dist/components/structure/Col.js +1 -0
- package/dist/components/structure/Row.js +1 -0
- package/dist/components/structure/SafeAreaView.js +1 -0
- package/dist/components/structure/View.js +1 -1
- package/dist/components/structure/index.js +1 -1
- package/dist/components/structure/overlay/OverlayHandler.js +1 -0
- package/dist/components/structure/overlay/OverlayHandler.native.js +1 -0
- package/dist/components/structure/overlay/OverlayWrapper.js +1 -0
- package/dist/components/structure/overlay/calculatePosition.js +1 -0
- package/dist/components/structure/overlay/smartPlacement.js +1 -0
- package/dist/components/structure/popover/Popover.js +1 -0
- package/dist/components/structure/popover/Popover.native.js +1 -0
- package/dist/components/structure/popover/PopoverContent.js +1 -0
- package/dist/components/table/DataTable.js +1 -0
- package/dist/components/table/Pagination.js +1 -0
- package/dist/components/table/Table.js +1 -0
- package/dist/components/table/TableCol.js +1 -0
- package/dist/components/table/TableHeader.js +1 -0
- package/dist/components/table/TableHeaderRow.js +1 -0
- package/dist/components/table/TableRow.js +1 -0
- package/dist/components/table/index.js +1 -0
- package/dist/components/text/Text.js +1 -1
- package/dist/components/text/VerticalText.js +1 -0
- package/dist/components/text/index.js +1 -1
- package/dist/helpers/debounce.js +1 -0
- package/dist/helpers/index.js +1 -1
- package/dist/helpers/options.js +1 -0
- package/dist/helpers/random.js +1 -0
- package/dist/index.css +10 -0
- package/dist/index.js +1 -1
- package/dist/modifiers/alignConverter.js +1 -0
- package/dist/modifiers/animation.js +1 -0
- package/dist/modifiers/animations/animatedEffects.js +1 -0
- package/dist/modifiers/animations/animatedEffects.native.js +1 -0
- package/dist/modifiers/animations/animatedEffects.web.js +1 -0
- package/dist/modifiers/animations/fadeEffect.js +1 -0
- package/dist/modifiers/animations/fadeEffect.native.js +1 -0
- package/dist/modifiers/animations/slideEffect.js +1 -0
- package/dist/modifiers/animations/slideEffect.native.js +1 -0
- package/dist/modifiers/applyStyles.js +1 -0
- package/dist/modifiers/border.js +1 -1
- package/dist/modifiers/display.js +1 -1
- package/dist/modifiers/flex.js +1 -1
- package/dist/modifiers/flexWrapper.js +1 -1
- package/dist/modifiers/fullColor.js +1 -1
- package/dist/modifiers/grid.js +1 -0
- package/dist/modifiers/overflow.js +1 -0
- package/dist/modifiers/position.js +1 -1
- package/dist/modifiers/responsiveConverter.js +1 -0
- package/dist/modifiers/size.js +1 -1
- package/dist/modifiers/state.js +1 -0
- package/dist/responsive/ResponsiveHandler.js +1 -0
- package/dist/responsive/index.js +1 -0
- package/dist/responsive/responsiveHooks.js +1 -0
- package/dist/theme/ThemeHandler.js +1 -1
- package/dist/theme/default/base.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/msdosTheme.js +1 -1
- package/dist/theme/helpers/contrastColor.js +1 -0
- package/dist/theme/helpers/dynamicColor.js +1 -0
- package/dist/theme/helpers/relatedScales.js +1 -1
- package/dist/theme/helpers/sizeScale.js +1 -1
- package/dist/theme/helpers/textScale.js +1 -1
- package/package.json +8 -4
- package/src/NekoUI.js +15 -1
- package/src/abstractions/ActivityIndicator.js +31 -0
- package/src/abstractions/ActivityIndicator.native.js +44 -0
- package/src/abstractions/AnimatedView.js +3 -0
- package/src/abstractions/AnimatedView.native.js +6 -0
- package/src/abstractions/DraggableSlideView.js +85 -0
- package/src/abstractions/DraggableSlideView.native.js +62 -0
- package/src/abstractions/Icon.js +4 -42
- package/src/abstractions/Image.js +12 -0
- package/src/abstractions/Image.native.js +7 -0
- package/src/abstractions/Image.web.js +7 -0
- package/src/abstractions/Platform.js +1 -0
- package/src/abstractions/Platform.native.js +3 -0
- package/src/abstractions/Platform.web.js +3 -0
- package/src/abstractions/SafeAreaView.js +3 -0
- package/src/abstractions/SafeAreaView.native.js +3 -0
- package/src/abstractions/Table.js +29 -0
- package/src/abstractions/Table.native.js +19 -0
- package/src/abstractions/Text.js +13 -2
- package/src/abstractions/TextInput.js +3 -0
- package/src/abstractions/TextInput.native.js +5 -0
- package/src/abstractions/TextInput.web.js +5 -0
- package/src/abstractions/View.js +2 -2
- package/src/abstractions/helpers/componentSize.js +13 -0
- package/src/abstractions/helpers/componentSize.native.js +12 -0
- package/src/abstractions/helpers/transformStyle.js +8 -0
- package/src/abstractions/helpers/transformStyle.native.js +3 -0
- package/src/components/actions/Breadcrumb.js +47 -0
- package/src/components/actions/Button.js +8 -3
- package/src/components/actions/Dropdown.js +68 -0
- package/src/components/actions/Link.js +21 -8
- package/src/components/actions/index.js +3 -0
- package/src/components/actions/menu/HorizontalMenu.js +96 -0
- package/src/components/actions/menu/Menu.js +7 -0
- package/src/components/actions/menu/SubmenuWrapper.js +16 -0
- package/src/components/actions/menu/VerticalMenu.js +107 -0
- package/src/components/animations/AnimatedView.js +45 -0
- package/src/components/animations/DraggableSlideView.js +42 -0
- package/src/components/animations/index.js +2 -0
- package/src/components/calendar/DayPicker.js +91 -0
- package/src/components/calendar/_helpers/calendarDays.js +16 -0
- package/src/components/calendar/index.js +1 -0
- package/src/components/feedback/index.js +1 -0
- package/src/components/feedback/notifications/Notification.js +37 -0
- package/src/components/feedback/notifications/NotificationsHandler.js +65 -0
- package/src/components/form/Form.js +15 -4
- package/src/components/form/FormGroup.js +4 -4
- package/src/components/form/FormItem.js +30 -8
- package/src/components/form/FormList.js +45 -9
- package/src/components/form/FormWrapperComponent.js +37 -2
- package/src/components/form/FormWrapperComponent.native.js +2 -2
- package/src/components/form/SubmitButton.js +20 -0
- package/src/components/form/index.js +3 -2
- package/src/components/form/useNewForm.js +67 -0
- package/src/components/form/useWatch.js +70 -0
- package/src/components/helpers/LazyRender.js +55 -0
- package/src/components/helpers/LazyRender.native.js +58 -0
- package/src/components/helpers/Portal.js +21 -0
- package/src/components/helpers/PortalHandler.js +32 -0
- package/src/components/helpers/Responsive.js +1 -1
- package/src/components/helpers/Separator.js +10 -14
- package/src/components/helpers/VerticalView.js +34 -0
- package/src/components/helpers/index.js +4 -0
- package/src/components/index.js +7 -0
- package/src/components/inputs/Checkbox.js +56 -0
- package/src/components/inputs/InputWrapper.js +79 -0
- package/src/components/inputs/Picker.js +116 -0
- package/src/components/inputs/Radio.js +55 -0
- package/src/components/inputs/Switch.js +60 -0
- package/src/components/inputs/TextInput.js +22 -0
- package/src/components/inputs/index.js +6 -0
- package/src/components/layout/Layout.js +40 -0
- package/src/components/layout/LayoutContent.js +42 -0
- package/src/components/layout/LayoutHeader.js +69 -0
- package/src/components/layout/LayoutSider.js +64 -0
- package/src/components/layout/index.js +4 -0
- package/src/components/presentation/Avatar.js +79 -0
- package/src/components/presentation/AvatarLabel.js +58 -0
- package/src/components/presentation/Badge.js +90 -0
- package/src/components/presentation/ContentLabel.js +24 -6
- package/src/components/presentation/IconLabel.js +12 -2
- package/src/components/presentation/Image.js +33 -0
- package/src/components/presentation/LabelValue.js +49 -0
- package/src/components/presentation/Result.js +60 -0
- package/src/components/presentation/ResultBar.js +56 -0
- package/src/components/presentation/Tag.js +8 -11
- package/src/components/presentation/Tooltip.js +43 -0
- package/src/components/presentation/index.js +8 -0
- package/src/components/state/Loading.js +20 -0
- package/src/components/state/LoadingView.js +28 -0
- package/src/components/state/index.js +2 -0
- package/src/components/structure/Accordion.js +69 -0
- package/src/components/structure/AccordionGroup.js +35 -0
- package/src/components/structure/Card.js +4 -1
- package/src/components/structure/Col.js +22 -0
- package/src/components/structure/Row.js +42 -0
- package/src/components/structure/SafeAreaView.js +42 -0
- package/src/components/structure/View.js +9 -3
- package/src/components/structure/index.js +6 -0
- package/src/components/structure/overlay/OverlayHandler.js +70 -0
- package/src/components/structure/overlay/OverlayHandler.native.js +6 -0
- package/src/components/structure/overlay/OverlayWrapper.js +52 -0
- package/src/components/structure/overlay/calculatePosition.js +29 -0
- package/src/components/structure/overlay/smartPlacement.js +32 -0
- package/src/components/structure/popover/Popover.js +69 -0
- package/src/components/structure/popover/Popover.native.js +75 -0
- package/src/components/structure/popover/PopoverContent.js +18 -0
- package/src/components/table/DataTable.js +57 -0
- package/src/components/table/Pagination.js +128 -0
- package/src/components/table/Table.js +65 -0
- package/src/components/table/TableCol.js +67 -0
- package/src/components/table/TableHeader.js +69 -0
- package/src/components/table/TableHeaderRow.js +31 -0
- package/src/components/table/TableRow.js +30 -0
- package/src/components/table/index.js +7 -0
- package/src/components/text/Text.js +4 -0
- package/src/components/text/VerticalText.js +29 -0
- package/src/components/text/index.js +1 -0
- package/src/helpers/debounce.js +9 -0
- package/src/helpers/index.js +2 -1
- package/src/helpers/options.js +65 -0
- package/src/helpers/random.js +5 -0
- package/src/index.css +10 -0
- package/src/index.js +1 -0
- package/src/modifiers/alignConverter.js +11 -0
- package/src/modifiers/animation.js +18 -0
- package/src/modifiers/animations/animatedEffects.js +63 -0
- package/src/modifiers/animations/animatedEffects.native.js +53 -0
- package/src/modifiers/animations/animatedEffects.web.js +3 -0
- package/src/modifiers/animations/fadeEffect.js +43 -0
- package/src/modifiers/animations/fadeEffect.native.js +33 -0
- package/src/modifiers/animations/slideEffect.js +61 -0
- package/src/modifiers/animations/slideEffect.native.js +53 -0
- package/src/modifiers/applyStyles.js +7 -0
- package/src/modifiers/border.js +30 -6
- package/src/modifiers/display.js +3 -5
- package/src/modifiers/flex.js +1 -1
- package/src/modifiers/flexWrapper.js +48 -7
- package/src/modifiers/fullColor.js +5 -5
- package/src/modifiers/grid.js +27 -0
- package/src/modifiers/overflow.js +23 -0
- package/src/modifiers/position.js +10 -2
- package/src/modifiers/responsiveConverter.js +19 -0
- package/src/modifiers/size.js +10 -4
- package/src/modifiers/state.js +33 -0
- package/src/responsive/ResponsiveHandler.js +28 -0
- package/src/responsive/index.js +2 -0
- package/src/responsive/responsiveHooks.js +54 -0
- package/src/theme/ThemeHandler.js +1 -1
- package/src/theme/default/base.js +22 -22
- package/src/theme/default/darkTheme.js +2 -2
- package/src/theme/default/hackerTheme.js +8 -0
- package/src/theme/default/lightTheme.js +1 -1
- package/src/theme/default/msdosTheme.js +1 -1
- package/src/theme/helpers/contrastColor.js +20 -0
- package/src/theme/helpers/dynamicColor.js +32 -0
- package/src/theme/helpers/relatedScales.js +6 -6
- package/src/theme/helpers/sizeScale.js +7 -2
- package/src/theme/helpers/textScale.js +1 -1
- package/dist/components/form/inputs/Checkbox.js +0 -1
- package/dist/components/form/inputs/Radio.js +0 -1
- package/dist/components/form/inputs/Switch.js +0 -1
- package/dist/components/form/inputs/index.js +0 -1
- package/dist/components/form/useForm.js +0 -1
- package/dist/helpers/responsive.js +0 -1
- package/src/components/form/inputs/Checkbox.js +0 -42
- package/src/components/form/inputs/Radio.js +0 -42
- package/src/components/form/inputs/Switch.js +0 -44
- package/src/components/form/inputs/index.js +0 -3
- package/src/components/form/useForm.js +0 -65
- package/src/helpers/responsive.js +0 -54
- /package/dist/abstractions/{windowWidth.js → helpers/windowWidth.js} +0 -0
- /package/dist/abstractions/{windowWidth.native.js → helpers/windowWidth.native.js} +0 -0
- /package/dist/abstractions/{windowWidth.web.js → helpers/windowWidth.web.js} +0 -0
- /package/src/abstractions/{windowWidth.js → helpers/windowWidth.js} +0 -0
- /package/src/abstractions/{windowWidth.native.js → helpers/windowWidth.native.js} +0 -0
- /package/src/abstractions/{windowWidth.web.js → helpers/windowWidth.web.js} +0 -0
package/src/helpers/index.js
CHANGED
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { is, propEq } from 'ramda'
|
|
2
|
+
import React from 'react'
|
|
3
|
+
|
|
4
|
+
function formatOptions(options) {
|
|
5
|
+
if (!options?.length) return options
|
|
6
|
+
return options.map((option) => {
|
|
7
|
+
if (is(String, option) || is(Number, option)) {
|
|
8
|
+
return { label: option, value: option }
|
|
9
|
+
}
|
|
10
|
+
return option
|
|
11
|
+
})
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export function useOptions(optionsOrFetch, { limit } = {}) {
|
|
15
|
+
const isLazy = !is(Array, optionsOrFetch)
|
|
16
|
+
const [loading, setLoading] = React.useState(isLazy)
|
|
17
|
+
const [options, setOptions] = React.useState([])
|
|
18
|
+
const [page, setPage] = React.useState(1)
|
|
19
|
+
const [done, setDone] = React.useState(!isLazy)
|
|
20
|
+
|
|
21
|
+
const isFirstLoad = page === 1 && !options?.length && loading
|
|
22
|
+
const isRefetching = page === 1 && !!options.length && loading
|
|
23
|
+
const isFetchingMore = page > 1 && !!options.length && loading
|
|
24
|
+
|
|
25
|
+
const handleGetOptions = (page = 1) => {
|
|
26
|
+
setDone(false)
|
|
27
|
+
setPage(page)
|
|
28
|
+
setLoading(true)
|
|
29
|
+
optionsOrFetch(optionsOrFetch, page)
|
|
30
|
+
.then((result) => {
|
|
31
|
+
if (result?.length < limit) setDone(true)
|
|
32
|
+
let newOptions = []
|
|
33
|
+
if (page > 1) newOptions = options
|
|
34
|
+
setOptions([...newOptions, ...result])
|
|
35
|
+
})
|
|
36
|
+
.finally(() => setLoading(false))
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
const fetchMore = () => {
|
|
40
|
+
const newPage = (page || 1) + 1
|
|
41
|
+
handleGetOptions(newPage)
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
React.useEffect(() => {
|
|
45
|
+
if (isLazy) handleGetOptions()
|
|
46
|
+
}, [limit])
|
|
47
|
+
|
|
48
|
+
return {
|
|
49
|
+
options: formatOptions(isLazy ? options : optionsOrFetch),
|
|
50
|
+
handleGetOptions,
|
|
51
|
+
fetchMore,
|
|
52
|
+
done,
|
|
53
|
+
page,
|
|
54
|
+
done,
|
|
55
|
+
limit,
|
|
56
|
+
loading,
|
|
57
|
+
isFirstLoad,
|
|
58
|
+
isRefetching,
|
|
59
|
+
isFetchingMore,
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
export function findOptionByValue(options, value) {
|
|
64
|
+
return options.find(propEq('value', value))
|
|
65
|
+
}
|
package/src/index.css
CHANGED
|
@@ -28,6 +28,7 @@ body {
|
|
|
28
28
|
a,
|
|
29
29
|
button {
|
|
30
30
|
cursor: pointer;
|
|
31
|
+
text-decoration: none;
|
|
31
32
|
}
|
|
32
33
|
|
|
33
34
|
.neko-wave-click-effect {
|
|
@@ -71,3 +72,12 @@ button {
|
|
|
71
72
|
transform: scale(1.3);
|
|
72
73
|
}
|
|
73
74
|
}
|
|
75
|
+
|
|
76
|
+
@keyframes spin {
|
|
77
|
+
0% {
|
|
78
|
+
transform: rotate(0deg);
|
|
79
|
+
}
|
|
80
|
+
100% {
|
|
81
|
+
transform: rotate(360deg);
|
|
82
|
+
}
|
|
83
|
+
}
|
package/src/index.js
CHANGED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export function useAlignConverter(defaultValue) {
|
|
2
|
+
return ([values, props]) => {
|
|
3
|
+
let align = props.align
|
|
4
|
+
if (!align && props.center) align = 'center'
|
|
5
|
+
if (!align && props.toRight) align = 'right'
|
|
6
|
+
if (!align && props.toLeft) align = 'left'
|
|
7
|
+
if (!align) align = defaultValue
|
|
8
|
+
|
|
9
|
+
return [{ align }, { ...props, align }]
|
|
10
|
+
}
|
|
11
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { clearProps } from './_helpers'
|
|
2
|
+
|
|
3
|
+
export function useAnimationModifier([values, props]) {
|
|
4
|
+
let { transition, ...restProps } = props
|
|
5
|
+
|
|
6
|
+
const style = clearProps({ transition })
|
|
7
|
+
|
|
8
|
+
return [
|
|
9
|
+
values,
|
|
10
|
+
{
|
|
11
|
+
...restProps,
|
|
12
|
+
style: {
|
|
13
|
+
...props.style,
|
|
14
|
+
...style,
|
|
15
|
+
},
|
|
16
|
+
},
|
|
17
|
+
]
|
|
18
|
+
}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { pipe } from 'ramda'
|
|
2
|
+
import React from 'react'
|
|
3
|
+
|
|
4
|
+
import { useApplyStyles } from '../applyStyles'
|
|
5
|
+
import { useFadeEffect } from './fadeEffect'
|
|
6
|
+
import { useSlideEffect } from './slideEffect'
|
|
7
|
+
|
|
8
|
+
export function useAnimatedEffects([values, { open, onClose, lazy = false, unmountOnClose = false, ...props }]) {
|
|
9
|
+
const unmountTimerRef = React.useRef()
|
|
10
|
+
const [totalDuration, setTotalDuration] = React.useState(0)
|
|
11
|
+
const [transform, setTransform] = React.useState('')
|
|
12
|
+
const [transitions, setTransitions] = React.useState([])
|
|
13
|
+
const [hasOpened, setHasOpened] = React.useState(open || !lazy)
|
|
14
|
+
const [render, setRender] = React.useState(open || !lazy)
|
|
15
|
+
|
|
16
|
+
const useRegisterEffect = (effect) => {
|
|
17
|
+
React.useEffect(() => {
|
|
18
|
+
if (!effect?.duration) return
|
|
19
|
+
setTotalDuration((v) => (v > effect.duration ? v : effect.duration))
|
|
20
|
+
}, [])
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
const useAddTransition = (effect, transition) => {
|
|
24
|
+
React.useEffect(() => {
|
|
25
|
+
if (!effect?.duration) return
|
|
26
|
+
|
|
27
|
+
setTransitions((v) => [...v, transition])
|
|
28
|
+
}, [])
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
React.useEffect(() => {
|
|
32
|
+
if (open) {
|
|
33
|
+
clearTimeout(unmountTimerRef?.current)
|
|
34
|
+
setHasOpened(true)
|
|
35
|
+
setRender(true)
|
|
36
|
+
} else if (unmountOnClose) {
|
|
37
|
+
unmountTimerRef.current = setTimeout(() => setRender(false), totalDuration)
|
|
38
|
+
}
|
|
39
|
+
}, [open])
|
|
40
|
+
|
|
41
|
+
return pipe(
|
|
42
|
+
useFadeEffect, //
|
|
43
|
+
useSlideEffect,
|
|
44
|
+
useApplyStyles({ transition: transitions.join(',') })
|
|
45
|
+
)([
|
|
46
|
+
{
|
|
47
|
+
...values,
|
|
48
|
+
useRegisterEffect,
|
|
49
|
+
useAddTransition,
|
|
50
|
+
open,
|
|
51
|
+
onClose,
|
|
52
|
+
lazy,
|
|
53
|
+
unmountOnClose,
|
|
54
|
+
transform,
|
|
55
|
+
setTransform,
|
|
56
|
+
hasOpened,
|
|
57
|
+
setHasOpened,
|
|
58
|
+
render,
|
|
59
|
+
setRender,
|
|
60
|
+
},
|
|
61
|
+
props,
|
|
62
|
+
])
|
|
63
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { pipe } from 'ramda'
|
|
2
|
+
import { useSharedValue } from 'react-native-reanimated'
|
|
3
|
+
import React from 'react'
|
|
4
|
+
|
|
5
|
+
import { useFadeEffect } from './fadeEffect'
|
|
6
|
+
import { useSlideEffect } from './slideEffect'
|
|
7
|
+
|
|
8
|
+
export function useAnimatedEffects([values, { open = true, onClose, lazy = false, unmountOnClose = false, ...props }]) {
|
|
9
|
+
const unmountTimerRef = React.useRef()
|
|
10
|
+
const [totalDuration, setTotalDuration] = React.useState(0)
|
|
11
|
+
const [hasOpened, setHasOpened] = React.useState(open || !lazy)
|
|
12
|
+
const [render, setRender] = React.useState(open || !lazy)
|
|
13
|
+
|
|
14
|
+
const useRegisterEffect = (effect) => {
|
|
15
|
+
React.useEffect(() => {
|
|
16
|
+
if (!effect?.duration) return
|
|
17
|
+
setTotalDuration((v) => (v > effect.duration ? v : effect.duration))
|
|
18
|
+
}, [])
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
const translate = useSharedValue(0)
|
|
22
|
+
|
|
23
|
+
React.useEffect(() => {
|
|
24
|
+
if (open) {
|
|
25
|
+
clearTimeout(unmountTimerRef?.current)
|
|
26
|
+
setHasOpened(true)
|
|
27
|
+
setRender(true)
|
|
28
|
+
} else if (unmountOnClose) {
|
|
29
|
+
unmountTimerRef.current = setTimeout(() => setRender(false), totalDuration)
|
|
30
|
+
}
|
|
31
|
+
}, [open])
|
|
32
|
+
|
|
33
|
+
return pipe(
|
|
34
|
+
useFadeEffect, //
|
|
35
|
+
useSlideEffect
|
|
36
|
+
)([
|
|
37
|
+
{
|
|
38
|
+
...values,
|
|
39
|
+
animatedStyles: [],
|
|
40
|
+
useRegisterEffect,
|
|
41
|
+
useAddTransition: () => {},
|
|
42
|
+
open,
|
|
43
|
+
onClose,
|
|
44
|
+
lazy,
|
|
45
|
+
unmountOnClose,
|
|
46
|
+
hasOpened,
|
|
47
|
+
setHasOpened,
|
|
48
|
+
render,
|
|
49
|
+
setRender,
|
|
50
|
+
},
|
|
51
|
+
{ ...props, animatedStyles: [] },
|
|
52
|
+
])
|
|
53
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
|
|
3
|
+
const DEFAULT_EFFECT = { duration: 300 }
|
|
4
|
+
|
|
5
|
+
export function useFadeEffect([values, { fade, ...props }]) {
|
|
6
|
+
if (fade === true) fade = DEFAULT_EFFECT
|
|
7
|
+
if (!!fade) fade = { ...DEFAULT_EFFECT, ...fade }
|
|
8
|
+
const { duration } = fade || {}
|
|
9
|
+
const { open, useRegisterEffect, useAddTransition } = values
|
|
10
|
+
const [opacity, setOpacity] = React.useState(0)
|
|
11
|
+
|
|
12
|
+
useRegisterEffect(fade)
|
|
13
|
+
useAddTransition(fade, `opacity ${duration}ms ease-in-out`)
|
|
14
|
+
|
|
15
|
+
React.useEffect(() => {
|
|
16
|
+
if (!fade) return
|
|
17
|
+
|
|
18
|
+
if (open) {
|
|
19
|
+
// setOpacity(0)
|
|
20
|
+
|
|
21
|
+
requestAnimationFrame(() => {
|
|
22
|
+
setOpacity(1)
|
|
23
|
+
})
|
|
24
|
+
} else {
|
|
25
|
+
setOpacity(0)
|
|
26
|
+
}
|
|
27
|
+
}, [open])
|
|
28
|
+
|
|
29
|
+
if (!fade) return [values, props]
|
|
30
|
+
|
|
31
|
+
const style = { opacity }
|
|
32
|
+
|
|
33
|
+
return [
|
|
34
|
+
values,
|
|
35
|
+
{
|
|
36
|
+
...props,
|
|
37
|
+
style: {
|
|
38
|
+
...props.style,
|
|
39
|
+
...style,
|
|
40
|
+
},
|
|
41
|
+
},
|
|
42
|
+
]
|
|
43
|
+
}
|
|
@@ -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 }
|
|
5
|
+
|
|
6
|
+
export function useFadeEffect([values, { fade, ...props }]) {
|
|
7
|
+
if (fade === true) fade = DEFAULT_EFFECT
|
|
8
|
+
if (!!fade) fade = { ...DEFAULT_EFFECT, ...fade }
|
|
9
|
+
const { duration } = fade || {}
|
|
10
|
+
const { open, useRegisterEffect } = values
|
|
11
|
+
const opacity = useSharedValue(0)
|
|
12
|
+
|
|
13
|
+
useRegisterEffect(fade)
|
|
14
|
+
|
|
15
|
+
React.useEffect(() => {
|
|
16
|
+
if (!fade) return
|
|
17
|
+
|
|
18
|
+
if (open) {
|
|
19
|
+
opacity.value = 0
|
|
20
|
+
opacity.value = withTiming(1, { duration })
|
|
21
|
+
} else {
|
|
22
|
+
opacity.value = withTiming(0, { duration })
|
|
23
|
+
}
|
|
24
|
+
}, [open])
|
|
25
|
+
|
|
26
|
+
const animatedStyle = useAnimatedStyle(() => {
|
|
27
|
+
return { opacity: opacity.value }
|
|
28
|
+
})
|
|
29
|
+
|
|
30
|
+
if (!fade) return [values, props]
|
|
31
|
+
|
|
32
|
+
return [values, { ...props, animatedStyles: [...props.animatedStyles, animatedStyle] }]
|
|
33
|
+
}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
|
|
3
|
+
const DEFAULT_EFFECT = { duration: 400, from: 'top' }
|
|
4
|
+
|
|
5
|
+
export function useSlideEffect([values, { slide, ...props }]) {
|
|
6
|
+
if (slide === true) slide = DEFAULT_EFFECT
|
|
7
|
+
if (!!slide) slide = { ...DEFAULT_EFFECT, ...slide }
|
|
8
|
+
const { duration, from, distance } = slide || {}
|
|
9
|
+
const { open, useRegisterEffect, useAddTransition } = values
|
|
10
|
+
|
|
11
|
+
const initialValue = React.useMemo(() => {
|
|
12
|
+
const w = window.innerWidth
|
|
13
|
+
const h = window.innerHeight
|
|
14
|
+
|
|
15
|
+
switch (from) {
|
|
16
|
+
case 'left':
|
|
17
|
+
return `translateX(-${distance || w}px)`
|
|
18
|
+
case 'right':
|
|
19
|
+
return `translateX(${distance || w}px)`
|
|
20
|
+
case 'top':
|
|
21
|
+
return `translateY(-${distance || h}px)`
|
|
22
|
+
case 'bottom':
|
|
23
|
+
return `translateY(${distance || h}px)`
|
|
24
|
+
default:
|
|
25
|
+
return `translateX(-${distance || w}px)`
|
|
26
|
+
}
|
|
27
|
+
}, [distance, from])
|
|
28
|
+
|
|
29
|
+
const [transform, setTransform] = React.useState(initialValue)
|
|
30
|
+
|
|
31
|
+
useRegisterEffect(slide)
|
|
32
|
+
useAddTransition(slide, `transform ${duration}ms ease-in-out`)
|
|
33
|
+
|
|
34
|
+
React.useLayoutEffect(() => {
|
|
35
|
+
if (!slide) return
|
|
36
|
+
if (open) {
|
|
37
|
+
setTransform(initialValue)
|
|
38
|
+
|
|
39
|
+
requestAnimationFrame(() => {
|
|
40
|
+
setTransform('translateY(0)')
|
|
41
|
+
})
|
|
42
|
+
} else {
|
|
43
|
+
setTransform(initialValue)
|
|
44
|
+
}
|
|
45
|
+
}, [open])
|
|
46
|
+
|
|
47
|
+
if (!slide) return [values, props]
|
|
48
|
+
|
|
49
|
+
const style = { transform }
|
|
50
|
+
|
|
51
|
+
return [
|
|
52
|
+
values,
|
|
53
|
+
{
|
|
54
|
+
...props,
|
|
55
|
+
style: {
|
|
56
|
+
...props.style,
|
|
57
|
+
...style,
|
|
58
|
+
},
|
|
59
|
+
},
|
|
60
|
+
]
|
|
61
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { Dimensions } from 'react-native'
|
|
2
|
+
import { useSharedValue, withTiming, useAnimatedStyle } from 'react-native-reanimated'
|
|
3
|
+
import React from 'react'
|
|
4
|
+
|
|
5
|
+
const DEFAULT_EFFECT = { duration: 400, from: 'top' }
|
|
6
|
+
const { width, height } = Dimensions.get('window')
|
|
7
|
+
|
|
8
|
+
export function useSlideEffect([values, { slide, ...props }]) {
|
|
9
|
+
if (slide === true) slide = DEFAULT_EFFECT
|
|
10
|
+
if (!!slide) slide = { ...DEFAULT_EFFECT, ...slide }
|
|
11
|
+
const { duration, from, distance } = slide || {}
|
|
12
|
+
const { open, useRegisterEffect } = values
|
|
13
|
+
|
|
14
|
+
useRegisterEffect(slide)
|
|
15
|
+
|
|
16
|
+
const initialValue = React.useMemo(() => {
|
|
17
|
+
switch (from) {
|
|
18
|
+
case 'left':
|
|
19
|
+
return -(distance || width)
|
|
20
|
+
case 'right':
|
|
21
|
+
return distance || width
|
|
22
|
+
case 'top':
|
|
23
|
+
return -(distance || height)
|
|
24
|
+
case 'bottom':
|
|
25
|
+
return distance || height
|
|
26
|
+
default:
|
|
27
|
+
return -(distance || width)
|
|
28
|
+
}
|
|
29
|
+
}, [from, distance, width, height])
|
|
30
|
+
|
|
31
|
+
const translate = useSharedValue(open ? 0 : initialValue)
|
|
32
|
+
|
|
33
|
+
React.useEffect(() => {
|
|
34
|
+
if (!slide) return
|
|
35
|
+
|
|
36
|
+
if (open) {
|
|
37
|
+
translate.value = initialValue
|
|
38
|
+
translate.value = withTiming(0, { duration })
|
|
39
|
+
} else {
|
|
40
|
+
translate.value = withTiming(initialValue, { duration })
|
|
41
|
+
}
|
|
42
|
+
}, [open])
|
|
43
|
+
|
|
44
|
+
const animatedStyle = useAnimatedStyle(() => {
|
|
45
|
+
const transform =
|
|
46
|
+
from === 'left' || from === 'right' ? [{ translateX: translate.value }] : [{ translateY: translate.value }]
|
|
47
|
+
return { transform }
|
|
48
|
+
})
|
|
49
|
+
|
|
50
|
+
if (!slide) return [values, props]
|
|
51
|
+
|
|
52
|
+
return [values, { ...props, animatedStyles: [...props.animatedStyles, animatedStyle] }]
|
|
53
|
+
}
|
package/src/modifiers/border.js
CHANGED
|
@@ -16,23 +16,44 @@ export function useBorderModifier([values, props]) {
|
|
|
16
16
|
borderRadiusR,
|
|
17
17
|
borderRadius,
|
|
18
18
|
borderStyle,
|
|
19
|
-
|
|
19
|
+
borderT,
|
|
20
|
+
borderB,
|
|
21
|
+
borderL,
|
|
22
|
+
borderR,
|
|
23
|
+
border,
|
|
20
24
|
borderColor,
|
|
21
25
|
brColor,
|
|
22
26
|
round,
|
|
23
27
|
...restProps
|
|
24
28
|
} = props
|
|
25
29
|
|
|
26
|
-
if (round) br = 1000
|
|
30
|
+
if (!!round) br = 1000
|
|
31
|
+
|
|
27
32
|
const borderTopRightRadius = getRadius(brT ?? borderRadiusT ?? brR ?? borderRadiusR ?? borderRadius ?? br)
|
|
28
33
|
const borderTopLeftRadius = getRadius(brT ?? borderRadiusT ?? brL ?? borderRadiusL ?? borderRadius ?? br)
|
|
29
34
|
const borderBottomRightRadius = getRadius(brB ?? borderRadiusB ?? brR ?? borderRadiusR ?? borderRadius ?? br)
|
|
30
35
|
const borderBottomLeftRadius = getRadius(brB ?? borderRadiusB ?? brL ?? borderRadiusL ?? borderRadius ?? br)
|
|
31
36
|
|
|
32
|
-
if (!!borderColor || brColor) borderColor = getColor(brColor ?? borderColor)
|
|
33
|
-
|
|
34
37
|
borderStyle = borderStyle
|
|
35
|
-
|
|
38
|
+
|
|
39
|
+
if (border === true) border = 1
|
|
40
|
+
if (borderT === true) borderT = 1
|
|
41
|
+
if (borderR === true) borderR = 1
|
|
42
|
+
if (borderB === true) borderB = 1
|
|
43
|
+
if (borderL === true) borderL = 1
|
|
44
|
+
const borderTopWidth = borderT || border || 0
|
|
45
|
+
const borderBottomWidth = borderB || border || 0
|
|
46
|
+
const borderLeftWidth = borderL || border || 0
|
|
47
|
+
const borderRightWidth = borderR || border || 0
|
|
48
|
+
const hasBorder = borderTopWidth || borderBottomWidth || borderLeftWidth || borderRightWidth
|
|
49
|
+
|
|
50
|
+
if (!!hasBorder) {
|
|
51
|
+
borderStyle = 'solid'
|
|
52
|
+
if (!borderColor && !brColor) brColor = 'divider'
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
if (!!borderColor || !!brColor) borderColor = getColor(borderColor ?? brColor)
|
|
56
|
+
|
|
36
57
|
const style = clearProps({
|
|
37
58
|
borderStyle,
|
|
38
59
|
borderTopRightRadius,
|
|
@@ -40,7 +61,10 @@ export function useBorderModifier([values, props]) {
|
|
|
40
61
|
borderBottomRightRadius,
|
|
41
62
|
borderBottomLeftRadius,
|
|
42
63
|
borderColor,
|
|
43
|
-
|
|
64
|
+
borderTopWidth,
|
|
65
|
+
borderBottomWidth,
|
|
66
|
+
borderLeftWidth,
|
|
67
|
+
borderRightWidth,
|
|
44
68
|
})
|
|
45
69
|
|
|
46
70
|
return [
|
package/src/modifiers/display.js
CHANGED
|
@@ -1,13 +1,11 @@
|
|
|
1
1
|
import { clearProps } from './_helpers'
|
|
2
2
|
|
|
3
3
|
export function useDisplayModifier([values, props]) {
|
|
4
|
-
let { cursor, opacity,
|
|
4
|
+
let { cursor, opacity, hidden, display, inline, block, ...restProps } = props
|
|
5
5
|
|
|
6
6
|
if (!!hidden) display = 'hidden'
|
|
7
|
-
if (!!
|
|
8
|
-
|
|
9
|
-
cursor = 'not-allowed'
|
|
10
|
-
}
|
|
7
|
+
if (!!inline) display = 'inline'
|
|
8
|
+
if (!!block) display = 'block'
|
|
11
9
|
|
|
12
10
|
const style = clearProps({ display, opacity, cursor })
|
|
13
11
|
|
package/src/modifiers/flex.js
CHANGED
|
@@ -3,25 +3,66 @@ import { useGetSpace } from '../theme/ThemeHandler'
|
|
|
3
3
|
|
|
4
4
|
export function useFlexWrapperModifier([values, props]) {
|
|
5
5
|
const getSpace = useGetSpace()
|
|
6
|
-
let {
|
|
6
|
+
let {
|
|
7
|
+
justify,
|
|
8
|
+
align,
|
|
9
|
+
center,
|
|
10
|
+
centerV,
|
|
11
|
+
centerH,
|
|
12
|
+
toRight,
|
|
13
|
+
toBottom,
|
|
14
|
+
toLeft,
|
|
15
|
+
toTop,
|
|
16
|
+
direction,
|
|
17
|
+
row,
|
|
18
|
+
wrap,
|
|
19
|
+
gap,
|
|
20
|
+
noGap,
|
|
21
|
+
...restProps
|
|
22
|
+
} = props
|
|
7
23
|
|
|
24
|
+
let flexDirection = direction || (row ? 'row' : 'column')
|
|
8
25
|
let justifyContent = justify
|
|
9
26
|
let alignItems = align
|
|
10
|
-
let flexDirection = direction || 'column'
|
|
11
27
|
let flexWrap
|
|
28
|
+
|
|
12
29
|
gap = getSpace(gap)
|
|
30
|
+
if (noGap) gap = undefined
|
|
31
|
+
|
|
32
|
+
const isRow = flexDirection === 'row'
|
|
33
|
+
const mainAxis = isRow ? 'horizontal' : 'vertical'
|
|
34
|
+
const crossAxis = isRow ? 'vertical' : 'horizontal'
|
|
13
35
|
|
|
14
36
|
if (center) {
|
|
15
37
|
justifyContent = 'center'
|
|
16
38
|
alignItems = 'center'
|
|
17
39
|
} else {
|
|
18
|
-
if (centerH)
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
40
|
+
if (centerH) {
|
|
41
|
+
if (mainAxis === 'horizontal') justifyContent = 'center'
|
|
42
|
+
else alignItems = 'center'
|
|
43
|
+
}
|
|
44
|
+
if (centerV) {
|
|
45
|
+
if (mainAxis === 'vertical') justifyContent = 'center'
|
|
46
|
+
else alignItems = 'center'
|
|
47
|
+
}
|
|
48
|
+
if (toRight) {
|
|
49
|
+
if (mainAxis === 'horizontal') justifyContent = 'flex-end'
|
|
50
|
+
else alignItems = 'flex-end'
|
|
51
|
+
}
|
|
52
|
+
if (toLeft) {
|
|
53
|
+
if (mainAxis === 'horizontal') justifyContent = 'flex-start'
|
|
54
|
+
else alignItems = 'flex-start'
|
|
55
|
+
}
|
|
56
|
+
if (toBottom) {
|
|
57
|
+
if (mainAxis === 'vertical') justifyContent = 'flex-end'
|
|
58
|
+
else alignItems = 'flex-end'
|
|
59
|
+
}
|
|
60
|
+
if (toTop) {
|
|
61
|
+
if (mainAxis === 'vertical') justifyContent = 'flex-start'
|
|
62
|
+
else alignItems = 'flex-start'
|
|
63
|
+
}
|
|
22
64
|
}
|
|
23
65
|
|
|
24
|
-
if (row) flexDirection = 'row'
|
|
25
66
|
if (wrap) flexWrap = 'wrap'
|
|
26
67
|
|
|
27
68
|
const style = clearProps({
|
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
import tinycolor from 'tinycolor2'
|
|
2
2
|
|
|
3
|
+
import { getContrastColor } from '../theme/helpers/contrastColor'
|
|
3
4
|
import { useGetColor } from '../theme/ThemeHandler'
|
|
4
5
|
|
|
5
|
-
export function useFullColorModifier([{ color, ...values }, { outline, ...props }]) {
|
|
6
|
+
export function useFullColorModifier([{ color, ...values }, { outline, fill, ...props }]) {
|
|
6
7
|
const getColor = useGetColor()
|
|
7
8
|
|
|
8
9
|
let bg = color
|
|
9
10
|
const bgObj = tinycolor(getColor(bg))
|
|
10
11
|
let borderColor = color
|
|
11
12
|
let fontColor = 'text'
|
|
12
|
-
let fontColorObj = tinycolor(getColor('text'))
|
|
13
13
|
|
|
14
|
-
if (!!outline) {
|
|
14
|
+
if (!!outline && fill !== true) {
|
|
15
15
|
bg = 'transparent'
|
|
16
16
|
fontColor = color
|
|
17
|
-
} else
|
|
18
|
-
fontColor = 'overlayBG'
|
|
17
|
+
} else {
|
|
18
|
+
fontColor = getContrastColor(bgObj, [getColor('text'), getColor('overlayBG')])
|
|
19
19
|
}
|
|
20
20
|
|
|
21
21
|
return [
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { useGetSpace } from '../theme/ThemeHandler'
|
|
2
|
+
|
|
3
|
+
export function useGridModifier([values, props]) {
|
|
4
|
+
const getSpace = useGetSpace()
|
|
5
|
+
|
|
6
|
+
let { gap, gapV, gapH, ...restProps } = props
|
|
7
|
+
|
|
8
|
+
gap = getSpace(gap)
|
|
9
|
+
gapV = getSpace(gapV)
|
|
10
|
+
gapH = getSpace(gapH)
|
|
11
|
+
let childPaddingV, childPaddingH
|
|
12
|
+
if (gap || gapV) childPaddingV = (gapV ?? gap) / 2
|
|
13
|
+
if (gap || gapH) childPaddingH = (gapH ?? gap) / 2
|
|
14
|
+
|
|
15
|
+
const childPaddingProps = { paddingV: childPaddingV, paddingH: childPaddingH }
|
|
16
|
+
|
|
17
|
+
return [
|
|
18
|
+
{ ...values, gap, childPaddingProps },
|
|
19
|
+
{
|
|
20
|
+
row: true,
|
|
21
|
+
wrap: true,
|
|
22
|
+
marginV: -childPaddingV,
|
|
23
|
+
marginH: -childPaddingH,
|
|
24
|
+
...restProps,
|
|
25
|
+
},
|
|
26
|
+
]
|
|
27
|
+
}
|