@neko-os/ui 0.0.5 → 0.0.7
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 +9 -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 +94 -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
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { pipe } from 'ramda'
|
|
2
|
+
import React from 'react'
|
|
3
|
+
|
|
4
|
+
import { AbsView } from '../../abstractions/View'
|
|
5
|
+
import { getElementSize } from '../../abstractions/helpers/componentSize'
|
|
6
|
+
import { useBackgroundModifier } from '../../modifiers/background'
|
|
7
|
+
import { useBorderModifier } from '../../modifiers/border'
|
|
8
|
+
import { useDefaultModifier } from '../../modifiers/default'
|
|
9
|
+
import { useFlexModifier } from '../../modifiers/flex'
|
|
10
|
+
import { useFlexWrapperModifier } from '../../modifiers/flexWrapper'
|
|
11
|
+
import { useLayout } from './Layout'
|
|
12
|
+
import { useMarginModifier } from '../../modifiers/margin'
|
|
13
|
+
import { useOverflowModifier } from '../../modifiers/overflow'
|
|
14
|
+
import { usePaddingModifier } from '../../modifiers/padding'
|
|
15
|
+
import { usePositionModifier } from '../../modifiers/position'
|
|
16
|
+
import { useShadowModifier } from '../../modifiers/shadow'
|
|
17
|
+
import { useSizeModifier } from '../../modifiers/size'
|
|
18
|
+
import { useThemeComponentModifier } from '../../modifiers/themeComponent'
|
|
19
|
+
|
|
20
|
+
const DEFAULT_PROPS = ([{}, { sticky }]) => ({
|
|
21
|
+
bg: 'overlayBG',
|
|
22
|
+
fullW: true,
|
|
23
|
+
row: true,
|
|
24
|
+
centerV: true,
|
|
25
|
+
padding: 'md',
|
|
26
|
+
top: 0,
|
|
27
|
+
left: 0,
|
|
28
|
+
right: 0,
|
|
29
|
+
zIndex: sticky ? 90 : undefined,
|
|
30
|
+
})
|
|
31
|
+
|
|
32
|
+
export function LayoutHeader({ children, ...rootProps }) {
|
|
33
|
+
const [_, props] = pipe(
|
|
34
|
+
useThemeComponentModifier('LayoutHeader'),
|
|
35
|
+
useDefaultModifier(DEFAULT_PROPS),
|
|
36
|
+
useSizeModifier, //
|
|
37
|
+
usePositionModifier,
|
|
38
|
+
useOverflowModifier,
|
|
39
|
+
usePaddingModifier,
|
|
40
|
+
useMarginModifier,
|
|
41
|
+
useFlexWrapperModifier,
|
|
42
|
+
useFlexModifier,
|
|
43
|
+
useBackgroundModifier,
|
|
44
|
+
useBorderModifier,
|
|
45
|
+
useShadowModifier
|
|
46
|
+
)([{}, rootProps])
|
|
47
|
+
|
|
48
|
+
const { registerHeader, unregisterHeader } = useLayout()
|
|
49
|
+
const headerRef = React.useRef(null)
|
|
50
|
+
const headerHeightRef = React.useRef(null)
|
|
51
|
+
|
|
52
|
+
React.useLayoutEffect(() => {
|
|
53
|
+
if (headerRef.current && !!rootProps.sticky) {
|
|
54
|
+
getElementSize(headerRef, ({ height }) => {
|
|
55
|
+
headerHeightRef.current = height
|
|
56
|
+
registerHeader?.(height)
|
|
57
|
+
})
|
|
58
|
+
return () => unregisterHeader?.(headerHeightRef.current)
|
|
59
|
+
}
|
|
60
|
+
}, [])
|
|
61
|
+
|
|
62
|
+
return (
|
|
63
|
+
<>
|
|
64
|
+
<AbsView className="neko-layout-header" {...props} ref={headerRef}>
|
|
65
|
+
{children}
|
|
66
|
+
</AbsView>
|
|
67
|
+
</>
|
|
68
|
+
)
|
|
69
|
+
}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { pipe } from 'ramda'
|
|
2
|
+
import React from 'react'
|
|
3
|
+
|
|
4
|
+
import { AbsView } from '../../abstractions/View'
|
|
5
|
+
import { getElementSize } from '../../abstractions/helpers/componentSize'
|
|
6
|
+
import { useBackgroundModifier } from '../../modifiers/background'
|
|
7
|
+
import { useBorderModifier } from '../../modifiers/border'
|
|
8
|
+
import { useDefaultModifier } from '../../modifiers/default'
|
|
9
|
+
import { useFlexModifier } from '../../modifiers/flex'
|
|
10
|
+
import { useFlexWrapperModifier } from '../../modifiers/flexWrapper'
|
|
11
|
+
import { useLayout } from './Layout'
|
|
12
|
+
import { useMarginModifier } from '../../modifiers/margin'
|
|
13
|
+
import { useOverflowModifier } from '../../modifiers/overflow'
|
|
14
|
+
import { usePaddingModifier } from '../../modifiers/padding'
|
|
15
|
+
import { usePositionModifier } from '../../modifiers/position'
|
|
16
|
+
import { useShadowModifier } from '../../modifiers/shadow'
|
|
17
|
+
import { useSizeModifier } from '../../modifiers/size'
|
|
18
|
+
import { useThemeComponentModifier } from '../../modifiers/themeComponent'
|
|
19
|
+
|
|
20
|
+
const DEFAULT_PROPS =
|
|
21
|
+
(layoutSize, headerSpace) =>
|
|
22
|
+
([{}, { sticky }]) => ({
|
|
23
|
+
top: headerSpace || 0,
|
|
24
|
+
bottom: 0,
|
|
25
|
+
maxHeight: !!sticky ? '100vh' : undefined,
|
|
26
|
+
paddingB: !!sticky ? headerSpace : undefined,
|
|
27
|
+
})
|
|
28
|
+
|
|
29
|
+
export function LayoutSider({ children, ...rootProps }) {
|
|
30
|
+
const { layoutSize, layoutHeaderSpace, registerSider, unregisterHeader } = useLayout()
|
|
31
|
+
|
|
32
|
+
const [_, props] = pipe(
|
|
33
|
+
useThemeComponentModifier('LayoutSider'),
|
|
34
|
+
useDefaultModifier(DEFAULT_PROPS(layoutSize, layoutHeaderSpace)),
|
|
35
|
+
useSizeModifier, //
|
|
36
|
+
usePositionModifier,
|
|
37
|
+
useOverflowModifier,
|
|
38
|
+
usePaddingModifier,
|
|
39
|
+
useMarginModifier,
|
|
40
|
+
useFlexWrapperModifier,
|
|
41
|
+
useFlexModifier,
|
|
42
|
+
useBackgroundModifier,
|
|
43
|
+
useBorderModifier,
|
|
44
|
+
useShadowModifier
|
|
45
|
+
)([{}, rootProps])
|
|
46
|
+
|
|
47
|
+
const siderRef = React.useRef(null)
|
|
48
|
+
const [siderWidth, setSiderWidth] = React.useState(rootProps.width || 0)
|
|
49
|
+
|
|
50
|
+
React.useLayoutEffect(() => {
|
|
51
|
+
getElementSize(siderRef, ({ width }) => setSiderWidth(width))
|
|
52
|
+
}, [])
|
|
53
|
+
|
|
54
|
+
return (
|
|
55
|
+
<>
|
|
56
|
+
{rootProps.fixed && (
|
|
57
|
+
<AbsView className="neko-layout-sider-empty-space" style={{ width: siderWidth, height: '100%' }} />
|
|
58
|
+
)}
|
|
59
|
+
<AbsView className="neko-layout-sider" {...props} ref={siderRef}>
|
|
60
|
+
{children}
|
|
61
|
+
</AbsView>
|
|
62
|
+
</>
|
|
63
|
+
)
|
|
64
|
+
}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { pipe } from 'ramda'
|
|
2
|
+
|
|
3
|
+
import { AbsView } from '../../abstractions/View'
|
|
4
|
+
import { IconLabel } from './IconLabel'
|
|
5
|
+
import { Image } from './Image'
|
|
6
|
+
import { getDynamicColor } from '../../theme/helpers/dynamicColor'
|
|
7
|
+
import { getInitials } from '../../helpers'
|
|
8
|
+
import { moveScale } from '../../theme/helpers/sizeScale'
|
|
9
|
+
import { useBackgroundModifier } from '../../modifiers/background'
|
|
10
|
+
import { useBorderModifier } from '../../modifiers/border'
|
|
11
|
+
import { useColorConverter } from '../../modifiers/colorConverter'
|
|
12
|
+
import { useDefaultModifier } from '../../modifiers/default'
|
|
13
|
+
import { useFlexWrapperModifier } from '../../modifiers/flexWrapper'
|
|
14
|
+
import { useFullColorModifier } from '../../modifiers/fullColor'
|
|
15
|
+
import { useMarginModifier } from '../../modifiers/margin'
|
|
16
|
+
import { useOverflowModifier } from '../../modifiers/overflow'
|
|
17
|
+
import { usePaddingModifier } from '../../modifiers/padding'
|
|
18
|
+
import { usePositionModifier } from '../../modifiers/position'
|
|
19
|
+
import { useShadowModifier } from '../../modifiers/shadow'
|
|
20
|
+
import { useSizeConverter } from '../../modifiers/sizeConverter'
|
|
21
|
+
import { useSizeModifier } from '../../modifiers/size'
|
|
22
|
+
import { useThemeComponentModifier } from '../../modifiers/themeComponent'
|
|
23
|
+
|
|
24
|
+
const DEFAULT_PROPS = ([{ sizeCode }, { round, square, src, dynamicColor, color }]) => {
|
|
25
|
+
return {
|
|
26
|
+
padding: !!src ? undefined : 1,
|
|
27
|
+
height: sizeCode,
|
|
28
|
+
width: sizeCode,
|
|
29
|
+
ratio: 1,
|
|
30
|
+
br: !!square ? moveScale(sizeCode, -2) || sizeCode : undefined,
|
|
31
|
+
round: !square,
|
|
32
|
+
center: true,
|
|
33
|
+
border: !!src ? undefined : 1,
|
|
34
|
+
overflow: 'hidden',
|
|
35
|
+
color: dynamicColor !== undefined ? getDynamicColor(dynamicColor) : color,
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export function Avatar(rootProps) {
|
|
40
|
+
const [{ fontColor, sizeCode }, formattedProps] = pipe(
|
|
41
|
+
useSizeConverter('elementHeights', 'md'),
|
|
42
|
+
useThemeComponentModifier('Avatar'),
|
|
43
|
+
useDefaultModifier(DEFAULT_PROPS),
|
|
44
|
+
useColorConverter('text3'),
|
|
45
|
+
useFullColorModifier,
|
|
46
|
+
useSizeModifier,
|
|
47
|
+
usePositionModifier,
|
|
48
|
+
useFlexWrapperModifier,
|
|
49
|
+
useBackgroundModifier,
|
|
50
|
+
usePaddingModifier,
|
|
51
|
+
useMarginModifier,
|
|
52
|
+
useBorderModifier,
|
|
53
|
+
useShadowModifier,
|
|
54
|
+
useOverflowModifier
|
|
55
|
+
)([{}, rootProps])
|
|
56
|
+
|
|
57
|
+
let { initials, name, icon, src, invert, textProps, iconProps, ...props } = formattedProps
|
|
58
|
+
initials = initials || getInitials(name)
|
|
59
|
+
|
|
60
|
+
let content = (
|
|
61
|
+
<IconLabel
|
|
62
|
+
center
|
|
63
|
+
color={fontColor}
|
|
64
|
+
size={sizeCode}
|
|
65
|
+
label={!icon && initials}
|
|
66
|
+
icon={icon}
|
|
67
|
+
invert={invert}
|
|
68
|
+
textProps={{ strong: true, ...textProps }}
|
|
69
|
+
iconProps={iconProps}
|
|
70
|
+
/>
|
|
71
|
+
)
|
|
72
|
+
if (!!src) content = <Image br={0} src={src} width={sizeCode} height={sizeCode} />
|
|
73
|
+
|
|
74
|
+
return (
|
|
75
|
+
<AbsView className="neko-avatar" {...props}>
|
|
76
|
+
{content}
|
|
77
|
+
</AbsView>
|
|
78
|
+
)
|
|
79
|
+
}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { pipe } from 'ramda'
|
|
2
|
+
|
|
3
|
+
import { Avatar } from './Avatar'
|
|
4
|
+
import { ContentLabel } from './ContentLabel'
|
|
5
|
+
import { moveScale } from '../../theme/helpers/sizeScale'
|
|
6
|
+
import { useColorConverter } from '../../modifiers/colorConverter'
|
|
7
|
+
import { useSizeConverter } from '../../modifiers/sizeConverter'
|
|
8
|
+
import { useThemeComponentModifier } from '../../modifiers/themeComponent'
|
|
9
|
+
|
|
10
|
+
export function AvatarLabel(rootProps) {
|
|
11
|
+
const [{ sizeCode, color }, formattedProps] = pipe(
|
|
12
|
+
useColorConverter(),
|
|
13
|
+
useSizeConverter('elementHeights', 'md'),
|
|
14
|
+
useThemeComponentModifier('AvatarLabel') //
|
|
15
|
+
)([{}, rootProps])
|
|
16
|
+
|
|
17
|
+
const {
|
|
18
|
+
icon,
|
|
19
|
+
label,
|
|
20
|
+
name,
|
|
21
|
+
initials,
|
|
22
|
+
src,
|
|
23
|
+
avatarColor,
|
|
24
|
+
square,
|
|
25
|
+
dynamicColor,
|
|
26
|
+
avatarProps,
|
|
27
|
+
moveAvatarSizeScale,
|
|
28
|
+
avatarSize,
|
|
29
|
+
...props
|
|
30
|
+
} = formattedProps
|
|
31
|
+
const hasAvatar = !!name || !!initials || !!src
|
|
32
|
+
|
|
33
|
+
return (
|
|
34
|
+
<ContentLabel
|
|
35
|
+
className="neko-avatar-label"
|
|
36
|
+
label={label || name}
|
|
37
|
+
color={color}
|
|
38
|
+
size={sizeCode}
|
|
39
|
+
content={
|
|
40
|
+
<Avatar
|
|
41
|
+
name={name || label}
|
|
42
|
+
initials={initials}
|
|
43
|
+
icon={icon}
|
|
44
|
+
src={src}
|
|
45
|
+
size={avatarSize || moveScale(sizeCode, moveAvatarSizeScale || -1)}
|
|
46
|
+
color={avatarColor || color}
|
|
47
|
+
dynamicColor={dynamicColor}
|
|
48
|
+
square={square}
|
|
49
|
+
marginH={2}
|
|
50
|
+
{...avatarProps}
|
|
51
|
+
/>
|
|
52
|
+
}
|
|
53
|
+
{...props}
|
|
54
|
+
/>
|
|
55
|
+
)
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
export const AvatarText = AvatarLabel
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { pipe } from 'ramda'
|
|
2
|
+
|
|
3
|
+
import { AbsView } from '../../abstractions/View'
|
|
4
|
+
import { IconLabel } from './IconLabel'
|
|
5
|
+
import { View } from '../structure/View'
|
|
6
|
+
import { moveScale } from '../../theme/helpers/sizeScale'
|
|
7
|
+
import { useBackgroundModifier } from '../../modifiers/background'
|
|
8
|
+
import { useBorderModifier } from '../../modifiers/border'
|
|
9
|
+
import { useColorConverter } from '../../modifiers/colorConverter'
|
|
10
|
+
import { useDefaultModifier } from '../../modifiers/default'
|
|
11
|
+
import { useFlexWrapperModifier } from '../../modifiers/flexWrapper'
|
|
12
|
+
import { useFullColorModifier } from '../../modifiers/fullColor'
|
|
13
|
+
import { useMarginModifier } from '../../modifiers/margin'
|
|
14
|
+
import { usePaddingModifier } from '../../modifiers/padding'
|
|
15
|
+
import { usePositionModifier } from '../../modifiers/position'
|
|
16
|
+
import { useShadowModifier } from '../../modifiers/shadow'
|
|
17
|
+
import { useSizeConverter } from '../../modifiers/sizeConverter'
|
|
18
|
+
import { useSizeModifier } from '../../modifiers/size'
|
|
19
|
+
import { useThemeComponentModifier } from '../../modifiers/themeComponent'
|
|
20
|
+
|
|
21
|
+
const DOT_SIZE = 8
|
|
22
|
+
const DEFAULT_PROPS = ([{ sizeCode }, { dot, br }]) => {
|
|
23
|
+
sizeCode = !!dot ? DOT_SIZE : undefined
|
|
24
|
+
|
|
25
|
+
return {
|
|
26
|
+
paddingH: !dot && 5,
|
|
27
|
+
height: sizeCode,
|
|
28
|
+
minWidth: sizeCode,
|
|
29
|
+
round: br !== undefined ? false : true,
|
|
30
|
+
center: true,
|
|
31
|
+
border: 1,
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
function Badge(rootProps) {
|
|
36
|
+
const [{ fontColor, sizeCode }, formattedProps] = pipe(
|
|
37
|
+
useColorConverter('primary'),
|
|
38
|
+
useSizeConverter('spaces', 'md'),
|
|
39
|
+
useThemeComponentModifier('Badge'),
|
|
40
|
+
useDefaultModifier(DEFAULT_PROPS),
|
|
41
|
+
useFullColorModifier,
|
|
42
|
+
useSizeModifier,
|
|
43
|
+
usePositionModifier,
|
|
44
|
+
useFlexWrapperModifier,
|
|
45
|
+
useBackgroundModifier,
|
|
46
|
+
usePaddingModifier,
|
|
47
|
+
useMarginModifier,
|
|
48
|
+
useBorderModifier,
|
|
49
|
+
useShadowModifier
|
|
50
|
+
)([{}, rootProps])
|
|
51
|
+
|
|
52
|
+
let { label, value, dot, icon, invert, textProps, iconProps, limit = 99, ...props } = formattedProps
|
|
53
|
+
if (!!value && value > limit) label = `${limit}+`
|
|
54
|
+
label = label || value
|
|
55
|
+
|
|
56
|
+
let content = (
|
|
57
|
+
<IconLabel
|
|
58
|
+
center
|
|
59
|
+
color={fontColor}
|
|
60
|
+
size={moveScale(sizeCode, -2)}
|
|
61
|
+
label={label}
|
|
62
|
+
icon={icon}
|
|
63
|
+
invert={invert}
|
|
64
|
+
textProps={{ strong: true, ...textProps }}
|
|
65
|
+
iconProps={iconProps}
|
|
66
|
+
/>
|
|
67
|
+
)
|
|
68
|
+
|
|
69
|
+
if (!!dot) content = false
|
|
70
|
+
|
|
71
|
+
return (
|
|
72
|
+
<AbsView className="neko-badge" {...props}>
|
|
73
|
+
{content}
|
|
74
|
+
</AbsView>
|
|
75
|
+
)
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
function BadgeWrapper({ children, dot, ...props }) {
|
|
79
|
+
if (!children) return <Badge dot={dot} {...props} />
|
|
80
|
+
if (!props.value && !props.label && !props.icon) return children
|
|
81
|
+
|
|
82
|
+
return (
|
|
83
|
+
<View className="neko-badge-wrapper" relative>
|
|
84
|
+
{children}
|
|
85
|
+
<Badge {...props} dot={dot} absolute top={dot ? -2 : -8} right={dot ? -5 : -12} />
|
|
86
|
+
</View>
|
|
87
|
+
)
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
export { BadgeWrapper as Badge }
|
|
@@ -1,24 +1,42 @@
|
|
|
1
1
|
import { pipe } from 'ramda'
|
|
2
2
|
|
|
3
|
+
import { Loading } from '../state/Loading'
|
|
3
4
|
import { Text } from '../text/Text'
|
|
4
5
|
import { View } from '../structure/View'
|
|
5
6
|
import { useColorConverter } from '../../modifiers/colorConverter'
|
|
7
|
+
import { useSizeConverter } from '../../modifiers/sizeConverter'
|
|
6
8
|
import { useThemeComponentModifier } from '../../modifiers/themeComponent'
|
|
7
9
|
|
|
10
|
+
const AUTO_GAP_SCALE = {
|
|
11
|
+
xxxs: 5,
|
|
12
|
+
xxs: 5,
|
|
13
|
+
xs: 5,
|
|
14
|
+
sm: 5,
|
|
15
|
+
md: 6,
|
|
16
|
+
lg: 7,
|
|
17
|
+
xl: 8,
|
|
18
|
+
xxl: 9,
|
|
19
|
+
xxxl: 10,
|
|
20
|
+
}
|
|
21
|
+
|
|
8
22
|
export function ContentLabel(rootProps) {
|
|
9
|
-
const [{ color }, formattedProps] = pipe(
|
|
23
|
+
const [{ color, sizeCode }, formattedProps] = pipe(
|
|
10
24
|
useColorConverter(),
|
|
25
|
+
useSizeConverter('elementHeights', 'md'),
|
|
11
26
|
useThemeComponentModifier('ContentLabel') //
|
|
12
27
|
)([{}, rootProps])
|
|
13
28
|
|
|
14
|
-
|
|
29
|
+
let { loading, label, content, textProps, invert, gap, strong, ...props } = formattedProps
|
|
30
|
+
if (!!loading) content = <Loading size={sizeCode} color={color} />
|
|
15
31
|
|
|
16
32
|
return (
|
|
17
|
-
<View className="neko-content-label" row gap={gap} centerV {...props}>
|
|
33
|
+
<View className="neko-content-label" row gap={gap || AUTO_GAP_SCALE[sizeCode] || 5} centerV {...props}>
|
|
18
34
|
{!invert && content}
|
|
19
|
-
|
|
20
|
-
{
|
|
21
|
-
|
|
35
|
+
{!!label && (
|
|
36
|
+
<Text color={color} size={sizeCode} strong={strong} {...textProps}>
|
|
37
|
+
{label}
|
|
38
|
+
</Text>
|
|
39
|
+
)}
|
|
22
40
|
{!!invert && content}
|
|
23
41
|
</View>
|
|
24
42
|
)
|
|
@@ -2,6 +2,7 @@ import { pipe } from 'ramda'
|
|
|
2
2
|
|
|
3
3
|
import { ContentLabel } from './ContentLabel'
|
|
4
4
|
import { Icon } from './Icon'
|
|
5
|
+
import { moveScale } from '../../theme/helpers/sizeScale'
|
|
5
6
|
import { useColorConverter } from '../../modifiers/colorConverter'
|
|
6
7
|
import { useSizeConverter } from '../../modifiers/sizeConverter'
|
|
7
8
|
import { useThemeComponentModifier } from '../../modifiers/themeComponent'
|
|
@@ -13,14 +14,23 @@ export function IconLabel(rootProps) {
|
|
|
13
14
|
useThemeComponentModifier('IconLabel') //
|
|
14
15
|
)([{}, rootProps])
|
|
15
16
|
|
|
16
|
-
const { icon, iconProps, ...props } = formattedProps
|
|
17
|
+
const { icon, iconProps, iconColor, iconSize, moveIconSizeScale, ...props } = formattedProps
|
|
17
18
|
|
|
18
19
|
return (
|
|
19
20
|
<ContentLabel
|
|
20
21
|
className="neko-icon-label"
|
|
21
22
|
color={color}
|
|
22
23
|
size={sizeCode}
|
|
23
|
-
content={
|
|
24
|
+
content={
|
|
25
|
+
!!icon && (
|
|
26
|
+
<Icon
|
|
27
|
+
name={icon}
|
|
28
|
+
size={iconSize || moveScale(sizeCode, moveIconSizeScale || -1)}
|
|
29
|
+
color={iconColor || color}
|
|
30
|
+
{...iconProps}
|
|
31
|
+
/>
|
|
32
|
+
)
|
|
33
|
+
}
|
|
24
34
|
{...props}
|
|
25
35
|
/>
|
|
26
36
|
)
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { pipe } from 'ramda'
|
|
2
|
+
|
|
3
|
+
import { AbsImage } from '../../abstractions/Image'
|
|
4
|
+
import { useBorderModifier } from '../../modifiers/border'
|
|
5
|
+
import { useDefaultModifier } from '../../modifiers/default'
|
|
6
|
+
import { useFlexModifier } from '../../modifiers/flex'
|
|
7
|
+
import { useMarginModifier } from '../../modifiers/margin'
|
|
8
|
+
import { usePositionModifier } from '../../modifiers/position'
|
|
9
|
+
import { useShadowModifier } from '../../modifiers/shadow'
|
|
10
|
+
import { useSizeModifier } from '../../modifiers/size'
|
|
11
|
+
import { useThemeComponentModifier } from '../../modifiers/themeComponent'
|
|
12
|
+
|
|
13
|
+
const DEFAULT_PROPS = {
|
|
14
|
+
width: '100%',
|
|
15
|
+
br: 'md',
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export function Image({ name, ...rootProps }) {
|
|
19
|
+
const [{ size, color }, props] = pipe(
|
|
20
|
+
useThemeComponentModifier('Image'),
|
|
21
|
+
useDefaultModifier(DEFAULT_PROPS),
|
|
22
|
+
usePositionModifier, //
|
|
23
|
+
useMarginModifier,
|
|
24
|
+
useSizeModifier,
|
|
25
|
+
usePositionModifier,
|
|
26
|
+
useFlexModifier,
|
|
27
|
+
useMarginModifier,
|
|
28
|
+
useBorderModifier,
|
|
29
|
+
useShadowModifier
|
|
30
|
+
)([{}, rootProps])
|
|
31
|
+
|
|
32
|
+
return <AbsImage className="neko-image" name={name} color={color} size={size} {...props} />
|
|
33
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { pipe, is } from 'ramda'
|
|
2
|
+
|
|
3
|
+
import { IconLabel } from './IconLabel'
|
|
4
|
+
import { Text } from '../text/Text'
|
|
5
|
+
import { View } from '../structure/View'
|
|
6
|
+
import { moveScale } from '../../theme/helpers/sizeScale'
|
|
7
|
+
import { useDefaultModifier } from '../../modifiers/default'
|
|
8
|
+
import { useSizeConverter } from '../../modifiers/sizeConverter'
|
|
9
|
+
import { useThemeComponentModifier } from '../../modifiers/themeComponent'
|
|
10
|
+
|
|
11
|
+
const DEFAULT_PROPS = ([{ sizeCode }, { vertical, spread }]) => {
|
|
12
|
+
return {
|
|
13
|
+
row: !vertical,
|
|
14
|
+
centerV: !vertical,
|
|
15
|
+
justify: !!spread && 'space-between',
|
|
16
|
+
gap: !vertical ? moveScale(sizeCode, -1) : 0,
|
|
17
|
+
labelProps: {
|
|
18
|
+
size: moveScale(sizeCode, !vertical ? 0 : -2),
|
|
19
|
+
moveIconSizeScale: !vertical ? -1 : -2,
|
|
20
|
+
color: 'text3',
|
|
21
|
+
},
|
|
22
|
+
valueProps: {
|
|
23
|
+
size: sizeCode,
|
|
24
|
+
align: spread && 'right',
|
|
25
|
+
},
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export function LabelValue({ children, ...rootProps }) {
|
|
30
|
+
const [{ sizeCode, color }, formattedProps] = pipe(
|
|
31
|
+
// useColorConverter(),
|
|
32
|
+
useSizeConverter('elementHeights', 'md'),
|
|
33
|
+
useThemeComponentModifier('Labelvalue'), //
|
|
34
|
+
useDefaultModifier(DEFAULT_PROPS)
|
|
35
|
+
)([{}, rootProps])
|
|
36
|
+
|
|
37
|
+
const { icon, label, iconColor, labelProps, value, valueProps, vertical, spread, ...props } = formattedProps
|
|
38
|
+
let separator = !vertical && !spread ? ':' : ''
|
|
39
|
+
|
|
40
|
+
let content = children || value
|
|
41
|
+
if (is(String, value)) content = <Text label={value} {...valueProps} />
|
|
42
|
+
|
|
43
|
+
return (
|
|
44
|
+
<View className="neko-label-value" {...props}>
|
|
45
|
+
<IconLabel label={label + separator} icon={icon} iconColor={iconColor} {...labelProps} />
|
|
46
|
+
{content}
|
|
47
|
+
</View>
|
|
48
|
+
)
|
|
49
|
+
}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { Divider } from '../helpers/Separator'
|
|
2
|
+
import { Icon } from './Icon'
|
|
3
|
+
import { Text } from '../text/Text'
|
|
4
|
+
import { View } from '../structure/View'
|
|
5
|
+
|
|
6
|
+
export const RESULT_TYPES = {
|
|
7
|
+
error: {
|
|
8
|
+
icon: 'close-circle-fill',
|
|
9
|
+
color: 'red',
|
|
10
|
+
},
|
|
11
|
+
|
|
12
|
+
success: {
|
|
13
|
+
icon: 'checkbox-circle-fill',
|
|
14
|
+
color: 'green',
|
|
15
|
+
},
|
|
16
|
+
|
|
17
|
+
warning: {
|
|
18
|
+
icon: 'error-warning-fill',
|
|
19
|
+
color: 'yellow',
|
|
20
|
+
},
|
|
21
|
+
|
|
22
|
+
info: {
|
|
23
|
+
icon: 'information-2-fill',
|
|
24
|
+
color: 'blue',
|
|
25
|
+
},
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export function Result({
|
|
29
|
+
type,
|
|
30
|
+
icon,
|
|
31
|
+
iconColor,
|
|
32
|
+
title,
|
|
33
|
+
description,
|
|
34
|
+
footer,
|
|
35
|
+
titleProps,
|
|
36
|
+
descriptionProps,
|
|
37
|
+
textProps,
|
|
38
|
+
iconProps,
|
|
39
|
+
...props
|
|
40
|
+
}) {
|
|
41
|
+
const typeProps = RESULT_TYPES[type] || {}
|
|
42
|
+
icon = icon || typeProps.icon
|
|
43
|
+
iconColor = iconColor || typeProps.color || 'primary'
|
|
44
|
+
|
|
45
|
+
return (
|
|
46
|
+
<View className="neko-result" center padding="lg" {...props}>
|
|
47
|
+
<Icon name={icon} color={iconColor} size={42} primary {...iconProps} />
|
|
48
|
+
<Divider height={10} />
|
|
49
|
+
<Text h3 {...textProps} {...titleProps}>
|
|
50
|
+
{title}
|
|
51
|
+
</Text>
|
|
52
|
+
{!!description && (
|
|
53
|
+
<Text text3 sm {...textProps} {...descriptionProps}>
|
|
54
|
+
{description}
|
|
55
|
+
</Text>
|
|
56
|
+
)}
|
|
57
|
+
{!!footer && <View marginT="lg">{footer}</View>}
|
|
58
|
+
</View>
|
|
59
|
+
)
|
|
60
|
+
}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { Card } from '../structure/Card'
|
|
2
|
+
import { Icon } from './Icon'
|
|
3
|
+
import { RESULT_TYPES } from './Result'
|
|
4
|
+
import { Text } from '../text/Text'
|
|
5
|
+
import { View } from '../structure/View'
|
|
6
|
+
|
|
7
|
+
export function ResultBar({
|
|
8
|
+
type,
|
|
9
|
+
icon,
|
|
10
|
+
iconColor,
|
|
11
|
+
title,
|
|
12
|
+
description,
|
|
13
|
+
rightContent,
|
|
14
|
+
titleProps,
|
|
15
|
+
descriptionProps,
|
|
16
|
+
textProps,
|
|
17
|
+
iconProps,
|
|
18
|
+
...props
|
|
19
|
+
}) {
|
|
20
|
+
const typeProps = RESULT_TYPES[type] || {}
|
|
21
|
+
icon = icon || typeProps.icon
|
|
22
|
+
iconColor = iconColor || typeProps.color || 'primary'
|
|
23
|
+
const bg = typeProps.color ? typeProps.color + '_op10' : 'overlayBG'
|
|
24
|
+
const brColor = typeProps.color && typeProps.color + '_op30'
|
|
25
|
+
|
|
26
|
+
return (
|
|
27
|
+
<Card
|
|
28
|
+
className="neko-result"
|
|
29
|
+
row
|
|
30
|
+
gap="sm"
|
|
31
|
+
center
|
|
32
|
+
padding="sm"
|
|
33
|
+
br="sm"
|
|
34
|
+
bg={bg}
|
|
35
|
+
border
|
|
36
|
+
borderColor={brColor}
|
|
37
|
+
centerV
|
|
38
|
+
fullW
|
|
39
|
+
{...props}
|
|
40
|
+
>
|
|
41
|
+
{!!icon && <Icon name={icon} color={iconColor} size="lg" primary {...iconProps} />}
|
|
42
|
+
|
|
43
|
+
<View flex>
|
|
44
|
+
<Text sm strong {...textProps} {...titleProps}>
|
|
45
|
+
{title}
|
|
46
|
+
</Text>
|
|
47
|
+
{!!description && (
|
|
48
|
+
<Text text3 xs {...textProps} {...descriptionProps}>
|
|
49
|
+
{description}
|
|
50
|
+
</Text>
|
|
51
|
+
)}
|
|
52
|
+
</View>
|
|
53
|
+
{rightContent}
|
|
54
|
+
</Card>
|
|
55
|
+
)
|
|
56
|
+
}
|