@chem-po/react-web 0.0.8 → 0.0.10
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/index.cjs +2 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +48 -50
- package/dist/index.d.ts +48 -50
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/package.json +22 -37
- package/src/components/auth/SignIn.tsx +1 -1
- package/src/components/box/CollapseHorizontal.tsx +1 -0
- package/src/components/box/ContentBox.tsx +1 -1
- package/src/components/box/ExpandOnMount.tsx +1 -1
- package/src/components/box/Expandable.tsx +6 -6
- package/src/components/box/FullSizeContainer.tsx +3 -3
- package/src/components/box/MobileFrame/index.tsx +1 -1
- package/src/components/button/DeleteButton.tsx +1 -1
- package/src/components/button/Toggle.tsx +1 -1
- package/src/components/button/ViewButton.tsx +1 -1
- package/src/components/feed/FeedContentPane.tsx +1 -1
- package/src/components/feed/MediaFeedBackground.tsx +1 -1
- package/src/components/feed/MediaFeedRefresh.tsx +1 -1
- package/src/components/feed/MediaFeedSwipeUp.tsx +1 -0
- package/src/components/feed/context.tsx +1 -1
- package/src/components/form/Condition.tsx +1 -1
- package/src/components/form/Field.tsx +1 -1
- package/src/components/form/Form.tsx +9 -6
- package/src/components/form/FormFooter.tsx +4 -3
- package/src/components/form/UploadProgress/index.tsx +1 -1
- package/src/components/form/input/Editable.tsx +62 -70
- package/src/components/form/input/InputSlider.tsx +1 -0
- package/src/components/form/input/OptionalTag.tsx +1 -1
- package/src/components/form/input/StandaloneInput.tsx +1 -1
- package/src/components/form/input/boolean/index.tsx +1 -1
- package/src/components/form/input/color/index.tsx +1 -1
- package/src/components/form/input/date/index.tsx +1 -1
- package/src/components/form/input/datetime/index.tsx +1 -1
- package/src/components/form/input/file.tsx +4 -4
- package/src/components/form/input/input.tsx +10 -6
- package/src/components/form/input/multipleSelect/index.tsx +3 -3
- package/src/components/form/input/number/index.tsx +1 -1
- package/src/components/form/input/select/index.tsx +10 -4
- package/src/components/form/input/socialMedia/index.tsx +8 -1
- package/src/components/form/input/text/index.tsx +1 -1
- package/src/components/form/input/text/textarea.tsx +1 -1
- package/src/components/form/input/time/index.tsx +1 -1
- package/src/components/form/view/file.tsx +1 -1
- package/src/components/form/view/index.tsx +1 -1
- package/src/components/form/view/multipleSelect.tsx +3 -3
- package/src/components/form/view/select.tsx +14 -7
- package/src/components/list/Body/InfiniteScrollGridBody.tsx +1 -1
- package/src/components/list/Body/InfiniteScrollListBody.tsx +1 -1
- package/src/components/list/Body/ListBody.tsx +1 -0
- package/src/components/list/Body/PagedGridBody.tsx +1 -1
- package/src/components/list/Body/PagedListBody.tsx +1 -1
- package/src/components/list/DataList.tsx +1 -0
- package/src/components/list/ListContainer.tsx +1 -0
- package/src/components/list/ListContent.tsx +1 -1
- package/src/components/list/ListCreate.tsx +1 -1
- package/src/components/list/ListFilters.tsx +1 -1
- package/src/components/list/ListFooter.tsx +1 -1
- package/src/components/list/ListHeader.tsx +1 -1
- package/src/components/list/ListItem/ListCell.tsx +7 -6
- package/src/components/list/ListItem/ListRow.tsx +7 -1
- package/src/components/list/ListItemView.tsx +1 -1
- package/src/components/list/ListSort.tsx +1 -1
- package/src/components/list/NoItems.tsx +1 -1
- package/src/components/loading/CircularProgress.tsx +1 -0
- package/src/components/loading/Loading.tsx +1 -1
- package/src/components/loading/LoadingImage.tsx +1 -1
- package/src/components/loading/LoadingSwitch.tsx +1 -1
- package/src/components/media/PlayButton.tsx +1 -0
- package/src/components/modal/DefaultModal.tsx +1 -1
- package/src/components/modal/DesktopModal.tsx +1 -0
- package/src/components/modal/MobileModal.tsx +1 -1
- package/src/components/nav/NavBar.tsx +1 -1
- package/src/components/overlay/ImageViewOverlay.tsx +1 -1
- package/src/components/overlay/MobileOverlay.tsx +1 -0
- package/src/components/text/GradientText/index.tsx +1 -0
- package/src/components/text/NumberTicker.tsx +1 -1
- package/src/components/theme/colorMode/DarkModeToggle.tsx +1 -1
- package/src/components/view/ErrorView.tsx +1 -0
- package/src/components/view/RedirectView.tsx +1 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Flex, FlexProps, Text, VStack } from '@chakra-ui/react'
|
|
2
2
|
import { FieldType, InputRef } from '@chem-po/core'
|
|
3
3
|
import { Field, TypedField } from '@chem-po/react'
|
|
4
|
-
import { ForwardedRef, forwardRef, ForwardRefExoticComponent, useMemo } from 'react'
|
|
4
|
+
import React, { ForwardedRef, forwardRef, ForwardRefExoticComponent, useMemo } from 'react'
|
|
5
5
|
import { BooleanComponent } from './boolean'
|
|
6
6
|
import { ColorComponent } from './color'
|
|
7
7
|
import { DateInput } from './date'
|
|
@@ -50,7 +50,7 @@ const InputBase = <T extends Field>(props: FieldProps<T>, ref: ForwardedRef<Inpu
|
|
|
50
50
|
if (active) return 'rgba(0,0,0,0.7)'
|
|
51
51
|
return 'rgba(0,0,0,0.3)'
|
|
52
52
|
}, [error, active, touched])
|
|
53
|
-
const { _type, optional, label } = field
|
|
53
|
+
const { _type, optional, label: Label } = field
|
|
54
54
|
const showPlaceholder = useMemo(
|
|
55
55
|
() => _type === 'multipleSelect' || (!!value && _type !== 'file' && _type !== 'boolean'),
|
|
56
56
|
[value, _type],
|
|
@@ -84,10 +84,14 @@ const InputBase = <T extends Field>(props: FieldProps<T>, ref: ForwardedRef<Inpu
|
|
|
84
84
|
pb={pb}
|
|
85
85
|
transition="all 500ms"
|
|
86
86
|
pt={showPlaceholder && !inEditable ? 4 : 0}>
|
|
87
|
-
{
|
|
88
|
-
|
|
89
|
-
{
|
|
90
|
-
|
|
87
|
+
{Label && !inEditable ? (
|
|
88
|
+
typeof Label === 'string' ? (
|
|
89
|
+
<Text color="gray.800" fontSize="sm" px={2}>
|
|
90
|
+
{Label}
|
|
91
|
+
</Text>
|
|
92
|
+
) : (
|
|
93
|
+
<Label />
|
|
94
|
+
)
|
|
91
95
|
) : null}
|
|
92
96
|
<Flex width="100%" borderRadius={4} py={0.5} overflow="hidden" {...styles}>
|
|
93
97
|
<Component ref={ref} {...props} />
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { Box, Button, Flex, Text, useColorMode } from '@chakra-ui/react'
|
|
2
2
|
import { InputRef } from '@chem-po/core'
|
|
3
3
|
import { MultipleSelectField } from '@chem-po/react'
|
|
4
|
-
import { forwardRef, useImperativeHandle } from 'react'
|
|
4
|
+
import React, { forwardRef, useImperativeHandle } from 'react'
|
|
5
5
|
import { FieldProps } from '../types'
|
|
6
6
|
|
|
7
7
|
export const MultipleSelectComponent = forwardRef<InputRef, FieldProps<MultipleSelectField>>(
|
|
8
8
|
({ field, input, inEditable }, ref) => {
|
|
9
|
-
const { options, renderOption, getOptionKey } = field
|
|
9
|
+
const { options, renderOption: RenderOption, getOptionKey } = field
|
|
10
10
|
const { onChange, value, onFocus, onBlur } = input
|
|
11
11
|
const { colorMode } = useColorMode()
|
|
12
12
|
useImperativeHandle(ref, () => ({
|
|
@@ -34,7 +34,7 @@ export const MultipleSelectComponent = forwardRef<InputRef, FieldProps<MultipleS
|
|
|
34
34
|
onChange(value?.includes(o) ? value.filter(v => v !== o) : [...(value ?? []), o])
|
|
35
35
|
}}
|
|
36
36
|
_hover={{ opacity: 0.8 }}>
|
|
37
|
-
{
|
|
37
|
+
<RenderOption value={o} colorMode={colorMode} isSelected={!!value?.includes(o)} />
|
|
38
38
|
</Button>
|
|
39
39
|
</Box>
|
|
40
40
|
))}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { useColorModeValue } from '@chakra-ui/react'
|
|
2
2
|
import { InputRef } from '@chem-po/core'
|
|
3
3
|
import { CurrencyAmountField, NumberField } from '@chem-po/react'
|
|
4
|
-
import { ForwardedRef, forwardRef, useImperativeHandle, useRef, useState } from 'react'
|
|
4
|
+
import React, { ForwardedRef, forwardRef, useImperativeHandle, useRef, useState } from 'react'
|
|
5
5
|
import CurrencyInput from 'react-currency-input-field'
|
|
6
6
|
import { InputSlider } from '../InputSlider'
|
|
7
7
|
import { useInputImperativeHandle } from '../hooks/useInputImperativeHandle'
|
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
} from '@chakra-ui/react'
|
|
12
12
|
import { InputRef } from '@chem-po/core'
|
|
13
13
|
import { SelectField } from '@chem-po/react'
|
|
14
|
-
import { forwardRef, useImperativeHandle, useMemo } from 'react'
|
|
14
|
+
import React, { forwardRef, useImperativeHandle, useMemo } from 'react'
|
|
15
15
|
import { FieldProps } from '../types'
|
|
16
16
|
|
|
17
17
|
const DefaultRenderOption = (value: any) => {
|
|
@@ -34,7 +34,7 @@ export const SelectComponent = forwardRef<InputRef, FieldProps<SelectField>>(
|
|
|
34
34
|
},
|
|
35
35
|
}))
|
|
36
36
|
|
|
37
|
-
const
|
|
37
|
+
const RenderOption = customRender ?? DefaultRenderOption
|
|
38
38
|
|
|
39
39
|
return (
|
|
40
40
|
<Popover strategy="fixed" placement="bottom" matchWidth isOpen={active} onClose={onBlur}>
|
|
@@ -49,7 +49,13 @@ export const SelectComponent = forwardRef<InputRef, FieldProps<SelectField>>(
|
|
|
49
49
|
}}
|
|
50
50
|
variant="unstyled"
|
|
51
51
|
position="relative">
|
|
52
|
-
<Box>
|
|
52
|
+
<Box>
|
|
53
|
+
{selected ? (
|
|
54
|
+
<RenderOption value={selected} colorMode={colorMode} isSelected={true} />
|
|
55
|
+
) : (
|
|
56
|
+
<Text opacity={0.7}>{placeholder}</Text>
|
|
57
|
+
)}
|
|
58
|
+
</Box>
|
|
53
59
|
</Button>
|
|
54
60
|
</PopoverTrigger>
|
|
55
61
|
<PopoverContent w="100%" overflowY="auto" maxH="300px">
|
|
@@ -68,7 +74,7 @@ export const SelectComponent = forwardRef<InputRef, FieldProps<SelectField>>(
|
|
|
68
74
|
_dark={{
|
|
69
75
|
_hover: { bg: 'whiteAlpha.100' },
|
|
70
76
|
}}>
|
|
71
|
-
{
|
|
77
|
+
<RenderOption value={o} colorMode={colorMode} isSelected={o === selected} />
|
|
72
78
|
</Button>
|
|
73
79
|
))}
|
|
74
80
|
</PopoverBody>
|
|
@@ -14,7 +14,14 @@ import {
|
|
|
14
14
|
|
|
15
15
|
import { getHandle, InputRef, SocialMediaSites } from '@chem-po/core'
|
|
16
16
|
import { SocialMediaField } from '@chem-po/react'
|
|
17
|
-
import
|
|
17
|
+
import React, {
|
|
18
|
+
FC,
|
|
19
|
+
ForwardedRef,
|
|
20
|
+
forwardRef,
|
|
21
|
+
useCallback,
|
|
22
|
+
useImperativeHandle,
|
|
23
|
+
useMemo,
|
|
24
|
+
} from 'react'
|
|
18
25
|
import { FieldProps } from '../types'
|
|
19
26
|
|
|
20
27
|
const facebookLogo = '/icons/facebook.svg'
|
|
@@ -2,7 +2,7 @@ import { ViewIcon, ViewOffIcon } from '@chakra-ui/icons'
|
|
|
2
2
|
import { Flex, IconButton, Input } from '@chakra-ui/react'
|
|
3
3
|
import { InputRef } from '@chem-po/core'
|
|
4
4
|
import { TextField } from '@chem-po/react'
|
|
5
|
-
import { forwardRef, useImperativeHandle, useRef, useState } from 'react'
|
|
5
|
+
import React, { forwardRef, useImperativeHandle, useRef, useState } from 'react'
|
|
6
6
|
import { FieldProps } from '../types'
|
|
7
7
|
import { TextAreaComponent } from './textarea'
|
|
8
8
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { InputRef } from '@chem-po/core'
|
|
2
2
|
import { TextField, useTextColor } from '@chem-po/react'
|
|
3
|
-
import { ForwardedRef, forwardRef, useImperativeHandle, useRef } from 'react'
|
|
3
|
+
import React, { ForwardedRef, forwardRef, useImperativeHandle, useRef } from 'react'
|
|
4
4
|
import TextareaAutosize from 'react-textarea-autosize'
|
|
5
5
|
import { FieldProps } from '../types'
|
|
6
6
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Input } from '@chakra-ui/react'
|
|
2
2
|
import { InputRef } from '@chem-po/core'
|
|
3
3
|
import { TimeField } from '@chem-po/react'
|
|
4
|
-
import { forwardRef, useImperativeHandle } from 'react'
|
|
4
|
+
import React, { forwardRef, useImperativeHandle } from 'react'
|
|
5
5
|
import { FieldProps } from '../types'
|
|
6
6
|
// import '../input.css'
|
|
7
7
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Box, Flex, Text } from '@chakra-ui/react'
|
|
2
2
|
import { ImageViewOptions } from '@chem-po/core'
|
|
3
3
|
import { FileField } from '@chem-po/react'
|
|
4
|
-
import { CSSProperties, useMemo } from 'react'
|
|
4
|
+
import React, { CSSProperties, useMemo } from 'react'
|
|
5
5
|
import { ExpandOnMount } from '../../box/ExpandOnMount'
|
|
6
6
|
import { FileView } from '../input/file'
|
|
7
7
|
|
|
@@ -2,7 +2,7 @@ import { Flex, Text } from '@chakra-ui/react'
|
|
|
2
2
|
|
|
3
3
|
import { formatField } from '@chem-po/core'
|
|
4
4
|
import { Field } from '@chem-po/react'
|
|
5
|
-
import { CSSProperties, useMemo } from 'react'
|
|
5
|
+
import React, { CSSProperties, useMemo } from 'react'
|
|
6
6
|
import { FileFieldView } from './file'
|
|
7
7
|
import { MultipleSelectFieldView } from './multipleSelect'
|
|
8
8
|
import { SelectFieldView } from './select'
|
|
@@ -2,7 +2,7 @@ import { Box, Text } from '@chakra-ui/react'
|
|
|
2
2
|
|
|
3
3
|
import { Flex, useColorMode } from '@chakra-ui/react'
|
|
4
4
|
import { MultipleSelectField } from '@chem-po/react'
|
|
5
|
-
import { CSSProperties } from 'react'
|
|
5
|
+
import React, { CSSProperties } from 'react'
|
|
6
6
|
|
|
7
7
|
export const MultipleSelectFieldView = ({
|
|
8
8
|
field,
|
|
@@ -15,7 +15,7 @@ export const MultipleSelectFieldView = ({
|
|
|
15
15
|
noLabel?: boolean
|
|
16
16
|
style?: CSSProperties
|
|
17
17
|
}) => {
|
|
18
|
-
const { placeholder, renderOption } = field
|
|
18
|
+
const { placeholder, renderOption: RenderOption } = field
|
|
19
19
|
const { colorMode } = useColorMode()
|
|
20
20
|
return (
|
|
21
21
|
<Flex maxW="100%" flexFlow="row wrap" align="center" style={style}>
|
|
@@ -27,7 +27,7 @@ export const MultipleSelectFieldView = ({
|
|
|
27
27
|
{value ? (
|
|
28
28
|
value.map((v: any) => (
|
|
29
29
|
<Box key={field.getOptionKey ? field.getOptionKey(v) : v} p={0.5}>
|
|
30
|
-
{
|
|
30
|
+
<RenderOption value={v} colorMode={colorMode} isSelected={true} />
|
|
31
31
|
</Box>
|
|
32
32
|
))
|
|
33
33
|
) : (
|
|
@@ -1,25 +1,32 @@
|
|
|
1
1
|
import { Flex, Text, useColorMode } from '@chakra-ui/react'
|
|
2
2
|
import { SelectField } from '@chem-po/react'
|
|
3
|
-
import { CSSProperties } from 'react'
|
|
3
|
+
import React, { CSSProperties } from 'react'
|
|
4
4
|
|
|
5
|
+
const stringifyValue = (value: any) => {
|
|
6
|
+
if (typeof value === 'string') return value
|
|
7
|
+
if (typeof value === 'number') return value.toString()
|
|
8
|
+
if (typeof value === 'boolean') return value.toString()
|
|
9
|
+
return JSON.stringify(value)
|
|
10
|
+
}
|
|
5
11
|
const DefaultRenderOption = (value: any) => {
|
|
6
|
-
|
|
12
|
+
// TODO: maybe handle non-string values more gracefully
|
|
13
|
+
return <Text>{stringifyValue(value)}</Text>
|
|
7
14
|
}
|
|
8
15
|
|
|
9
|
-
export const SelectFieldView = ({
|
|
16
|
+
export const SelectFieldView = <F extends SelectField>({
|
|
10
17
|
field,
|
|
11
18
|
value,
|
|
12
19
|
noLabel,
|
|
13
20
|
style,
|
|
14
21
|
}: {
|
|
15
|
-
field:
|
|
16
|
-
value:
|
|
22
|
+
field: F
|
|
23
|
+
value: F['defaultValue']
|
|
17
24
|
noLabel?: boolean
|
|
18
25
|
style?: CSSProperties
|
|
19
26
|
}) => {
|
|
20
27
|
const { placeholder, renderOption: customRender } = field
|
|
21
28
|
const { colorMode } = useColorMode()
|
|
22
|
-
const
|
|
29
|
+
const RenderOption = customRender ?? DefaultRenderOption
|
|
23
30
|
return (
|
|
24
31
|
<Flex align="center" style={style}>
|
|
25
32
|
{noLabel ? null : (
|
|
@@ -27,7 +34,7 @@ export const SelectFieldView = ({
|
|
|
27
34
|
{placeholder}
|
|
28
35
|
</Text>
|
|
29
36
|
)}
|
|
30
|
-
{value ?
|
|
37
|
+
{value ? <RenderOption value={value} colorMode={colorMode} isSelected={true} /> : 'None'}
|
|
31
38
|
</Flex>
|
|
32
39
|
)
|
|
33
40
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { useColorMode } from '@chakra-ui/react'
|
|
2
2
|
import { AnyObject, WithId } from '@chem-po/core'
|
|
3
3
|
import { ListGridOptions, useDataList, useFullSize, usePaginatedList } from '@chem-po/react'
|
|
4
|
-
import { useCallback, useEffect, useMemo, useRef } from 'react'
|
|
4
|
+
import React, { useCallback, useEffect, useMemo, useRef } from 'react'
|
|
5
5
|
import {
|
|
6
6
|
FixedSizeGrid,
|
|
7
7
|
GridOnItemsRenderedProps,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { useColorMode } from '@chakra-ui/react'
|
|
2
2
|
import { AnyObject, WithId } from '@chem-po/core'
|
|
3
3
|
import { useDataList, useFullSize, usePaginatedList } from '@chem-po/react'
|
|
4
|
-
import { useCallback, useEffect, useMemo, useRef } from 'react'
|
|
4
|
+
import React, { useCallback, useEffect, useMemo, useRef } from 'react'
|
|
5
5
|
import { FixedSizeList, VariableSizeGrid, VariableSizeList } from 'react-window'
|
|
6
6
|
import InfiniteLoader from 'react-window-infinite-loader'
|
|
7
7
|
import { ListItemProps, ListRow } from '../ListItem/ListRow'
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { useColorMode } from '@chakra-ui/react'
|
|
2
2
|
import { AnyObject, BaseComponent, ItemPreviewProps, ListGridOptions } from '@chem-po/core'
|
|
3
3
|
import { useDataList, useFullSize, usePaginatedList } from '@chem-po/react'
|
|
4
|
-
import { memo, useEffect, useMemo, useRef } from 'react'
|
|
4
|
+
import React, { memo, useEffect, useMemo, useRef } from 'react'
|
|
5
5
|
import { FixedSizeGrid, VariableSizeGrid } from 'react-window'
|
|
6
6
|
import { GridItemProps, ListCell } from '../ListItem/ListCell'
|
|
7
7
|
import { NoItemsRow } from '../NoItems'
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useColorMode } from '@chakra-ui/react'
|
|
2
2
|
import { useDataList, useFullSize, usePaginatedList } from '@chem-po/react'
|
|
3
|
-
import { memo, useCallback, useEffect, useMemo, useRef } from 'react'
|
|
3
|
+
import React, { memo, useCallback, useEffect, useMemo, useRef } from 'react'
|
|
4
4
|
import { FixedSizeList, VariableSizeList } from 'react-window'
|
|
5
5
|
import { ListItemProps, ListRow } from '../ListItem/ListRow'
|
|
6
6
|
import { NoItemsRow } from '../NoItems'
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Box } from '@chakra-ui/react'
|
|
2
2
|
import { AnyObject } from '@chem-po/core'
|
|
3
3
|
import { useDataList, useFullSize, usePaginatedList } from '@chem-po/react'
|
|
4
|
-
import { useCallback, useMemo, useState } from 'react'
|
|
4
|
+
import React, { useCallback, useMemo, useState } from 'react'
|
|
5
5
|
import { LoadingOverlay } from '../loading'
|
|
6
6
|
import { ListBody } from './Body/ListBody'
|
|
7
7
|
import { ListCreate } from './ListCreate'
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { CloseIcon } from '@chakra-ui/icons'
|
|
2
2
|
import { Flex, IconButton, Text } from '@chakra-ui/react'
|
|
3
3
|
import { FieldMap, useBackendBase, useDataList, usePaginatedList } from '@chem-po/react'
|
|
4
|
-
import { useCallback } from 'react'
|
|
4
|
+
import React, { useCallback } from 'react'
|
|
5
5
|
import { Form } from '../form'
|
|
6
6
|
import { DesktopModal } from '../modal'
|
|
7
7
|
|
|
@@ -19,7 +19,7 @@ import {
|
|
|
19
19
|
|
|
20
20
|
import { AnyObject, isFilterGroup, QueryFilter } from '@chem-po/core'
|
|
21
21
|
import { FilterPreset, FilterPresetGroup, useDataList, useScreen } from '@chem-po/react'
|
|
22
|
-
import { useMemo } from 'react'
|
|
22
|
+
import React, { useMemo } from 'react'
|
|
23
23
|
import { useBorderColor } from '../../hooks'
|
|
24
24
|
import { filterMatchesPreset } from './utils'
|
|
25
25
|
|
|
@@ -17,7 +17,7 @@ import {
|
|
|
17
17
|
import { toPlural } from '@chem-po/core'
|
|
18
18
|
import { useDataList, usePaginatedList } from '@chem-po/react'
|
|
19
19
|
import useResizeObserver from '@react-hook/resize-observer'
|
|
20
|
-
import { useCallback, useMemo, useRef } from 'react'
|
|
20
|
+
import React, { useCallback, useMemo, useRef } from 'react'
|
|
21
21
|
import { useBorderColor } from '../../hooks'
|
|
22
22
|
import { ExpandOnMount } from '../box'
|
|
23
23
|
import { DataListFooterProps } from './types'
|
|
@@ -13,7 +13,7 @@ import {
|
|
|
13
13
|
import { getHasAccess, toPlural } from '@chem-po/core'
|
|
14
14
|
import { useAuth, useDataList } from '@chem-po/react'
|
|
15
15
|
import useResizeObserver from '@react-hook/resize-observer'
|
|
16
|
-
import { useCallback, useMemo, useRef } from 'react'
|
|
16
|
+
import React, { useCallback, useMemo, useRef } from 'react'
|
|
17
17
|
import { useBorderColor } from '../../hooks/ui/useBorderColor'
|
|
18
18
|
import { Toggle, ToggleOption } from '../button/Toggle'
|
|
19
19
|
import { PresetFilters } from './ListFilters'
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Flex } from '@chakra-ui/react'
|
|
2
2
|
import { AnyObject, ColorMode, DBItem } from '@chem-po/core'
|
|
3
3
|
import { DataList, ListGridOptions } from '@chem-po/react'
|
|
4
|
+
import React from 'react'
|
|
4
5
|
import { GridChildComponentProps } from 'react-window'
|
|
5
6
|
|
|
6
7
|
export interface GridItemProps<T extends AnyObject> {
|
|
@@ -37,12 +38,12 @@ export const ListCell = <T extends AnyObject>({
|
|
|
37
38
|
px={1}
|
|
38
39
|
py={0.25}
|
|
39
40
|
key={itemIdx}>
|
|
40
|
-
|
|
41
|
-
index
|
|
42
|
-
item
|
|
43
|
-
refetch
|
|
44
|
-
colorMode
|
|
45
|
-
|
|
41
|
+
<Render
|
|
42
|
+
index={itemIdx}
|
|
43
|
+
item={item}
|
|
44
|
+
refetch={refetch ? () => refetch(item._id) : undefined}
|
|
45
|
+
colorMode={colorMode}
|
|
46
|
+
/>
|
|
46
47
|
</Flex>
|
|
47
48
|
)
|
|
48
49
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Flex } from '@chakra-ui/react'
|
|
2
2
|
import { AnyObject, ColorMode, DBItem } from '@chem-po/core'
|
|
3
3
|
import { DataList } from '@chem-po/react'
|
|
4
|
+
import React from 'react'
|
|
4
5
|
import { ListChildComponentProps } from 'react-window'
|
|
5
6
|
|
|
6
7
|
export interface ListItemProps<T extends AnyObject = AnyObject> {
|
|
@@ -32,7 +33,12 @@ export const ListRow = <T extends AnyObject>({
|
|
|
32
33
|
}}
|
|
33
34
|
style={style}
|
|
34
35
|
key={index}>
|
|
35
|
-
|
|
36
|
+
<Render
|
|
37
|
+
index={index}
|
|
38
|
+
item={item}
|
|
39
|
+
refetch={refetch ? () => refetch(item._id) : undefined}
|
|
40
|
+
colorMode={colorMode}
|
|
41
|
+
/>
|
|
36
42
|
</Flex>
|
|
37
43
|
)
|
|
38
44
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Text, useColorMode, useColorModeValue } from '@chakra-ui/react'
|
|
2
2
|
import { AnyObject, DBItem } from '@chem-po/core'
|
|
3
3
|
import { useDataList, usePaginatedList } from '@chem-po/react'
|
|
4
|
-
import { useEffect, useMemo, useState } from 'react'
|
|
4
|
+
import React, { useEffect, useMemo, useState } from 'react'
|
|
5
5
|
import { DefaultModal } from '../modal'
|
|
6
6
|
|
|
7
7
|
export const ListItemView = () => {
|
|
@@ -2,7 +2,7 @@ import { ArrowDownIcon, ArrowUpIcon } from '@chakra-ui/icons'
|
|
|
2
2
|
import { Button, HStack, Text, useColorMode } from '@chakra-ui/react'
|
|
3
3
|
import { SortDirection } from '@chem-po/core'
|
|
4
4
|
import { SortPreset, useDataList } from '@chem-po/react'
|
|
5
|
-
import { useMemo } from 'react'
|
|
5
|
+
import React, { useMemo } from 'react'
|
|
6
6
|
import { CollapseHorizontal } from '../box/CollapseHorizontal'
|
|
7
7
|
|
|
8
8
|
const SortButton = ({ preset }: { preset: SortPreset }) => {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Flex, Text } from '@chakra-ui/react'
|
|
2
2
|
import { toPlural } from '@chem-po/core'
|
|
3
3
|
import { useDataList, usePaginatedList } from '@chem-po/react'
|
|
4
|
-
import { useMemo } from 'react'
|
|
4
|
+
import React, { useMemo } from 'react'
|
|
5
5
|
import { Loading } from '../loading'
|
|
6
6
|
|
|
7
7
|
export const NoItemsRow = () => {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Center, CenterProps, HStack, StackProps, Text, useColorModeValue } from '@chakra-ui/react'
|
|
2
2
|
import { ThemedAsset, useAppAssets } from '@chem-po/react'
|
|
3
3
|
import { LottieOptions, useLottie } from 'lottie-react'
|
|
4
|
-
import { useEffect, useMemo } from 'react'
|
|
4
|
+
import React, { useEffect, useMemo } from 'react'
|
|
5
5
|
import { ContentBox } from '../box/ContentBox'
|
|
6
6
|
// import loadingAnimation from './circles_loading.json'
|
|
7
7
|
// import loadingAnimationLight from './circles_loading_light.json'
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { BoxProps, Center, IconButton, Image, ImageProps } from '@chakra-ui/react'
|
|
2
2
|
import { useMounted } from '@chem-po/react'
|
|
3
|
-
import { SyntheticEvent, useCallback, useEffect, useRef, useState } from 'react'
|
|
3
|
+
import React, { SyntheticEvent, useCallback, useEffect, useRef, useState } from 'react'
|
|
4
4
|
import { ImageViewOverlay } from '../overlay/ImageViewOverlay'
|
|
5
5
|
import { LoadingLogo } from './Loading'
|
|
6
6
|
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { ButtonProps, Center, IconButton, Image } from '@chakra-ui/react'
|
|
2
2
|
import { SpotifyTrack, WithId } from '@chem-po/core'
|
|
3
3
|
import { usePlaylist } from '@chem-po/react'
|
|
4
|
+
import React from 'react'
|
|
4
5
|
import { useActiveMedia, usePlayer } from '../../store/usePlayer'
|
|
5
6
|
|
|
6
7
|
export const PlayButton = ({
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Flex, useColorModeValue } from '@chakra-ui/react'
|
|
2
2
|
import { useMobileFrame } from '@chem-po/react'
|
|
3
|
-
import { useEffect, useRef, useState } from 'react'
|
|
3
|
+
import React, { useEffect, useRef, useState } from 'react'
|
|
4
4
|
import { MobileOverlay } from '../overlay/MobileOverlay'
|
|
5
5
|
import { DefaultModalProps } from './type'
|
|
6
6
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Button, Flex, Image, useColorModeValue } from '@chakra-ui/react'
|
|
2
2
|
import { palette } from '@chem-po/core'
|
|
3
3
|
import { useViews, View } from '@chem-po/react'
|
|
4
|
-
import { PropsWithChildren, useMemo } from 'react'
|
|
4
|
+
import React, { PropsWithChildren, useMemo } from 'react'
|
|
5
5
|
import { Link, useLocation } from 'react-router-dom'
|
|
6
6
|
|
|
7
7
|
export const NAV_BAR_HEIGHT = 50
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { CloseIcon } from '@chakra-ui/icons'
|
|
2
2
|
import { Center, IconButton, Image, Modal, ModalContent, ModalOverlay } from '@chakra-ui/react'
|
|
3
3
|
import { useScreen } from '@chem-po/react'
|
|
4
|
-
import { SyntheticEvent, useCallback, useMemo, useState } from 'react'
|
|
4
|
+
import React, { SyntheticEvent, useCallback, useMemo, useState } from 'react'
|
|
5
5
|
import { LoadingLogo } from '../loading/Loading'
|
|
6
6
|
|
|
7
7
|
export const ImageViewOverlay = ({ src, onClose }: { src: string; onClose: () => void }) => {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { MoonIcon, SunIcon } from '@chakra-ui/icons'
|
|
2
2
|
import { Flex, FlexProps, IconButton, useColorMode, useColorModeValue } from '@chakra-ui/react'
|
|
3
|
-
|
|
3
|
+
import React from 'react'
|
|
4
4
|
export const DarkModeToggle = () => {
|
|
5
5
|
const { colorMode, toggleColorMode } = useColorMode()
|
|
6
6
|
const bg = useColorModeValue('gray.200', 'whiteAlpha.200')
|
|
@@ -7,7 +7,7 @@ import { CircularProgress } from '../loading/CircularProgress'
|
|
|
7
7
|
import { Loading } from '../loading/Loading'
|
|
8
8
|
|
|
9
9
|
export const RedirectView: React.FC<{ loading?: boolean }> = ({ loading }) => {
|
|
10
|
-
const timer = useRef<
|
|
10
|
+
const timer = useRef<ReturnType<typeof setTimeout> | null>(null)
|
|
11
11
|
const authLoading = useAuth(s => s.loading)
|
|
12
12
|
|
|
13
13
|
const navigate = useNavigate()
|