@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.
Files changed (81) hide show
  1. package/dist/index.cjs +2 -2
  2. package/dist/index.cjs.map +1 -1
  3. package/dist/index.d.cts +48 -50
  4. package/dist/index.d.ts +48 -50
  5. package/dist/index.js +2 -2
  6. package/dist/index.js.map +1 -1
  7. package/package.json +22 -37
  8. package/src/components/auth/SignIn.tsx +1 -1
  9. package/src/components/box/CollapseHorizontal.tsx +1 -0
  10. package/src/components/box/ContentBox.tsx +1 -1
  11. package/src/components/box/ExpandOnMount.tsx +1 -1
  12. package/src/components/box/Expandable.tsx +6 -6
  13. package/src/components/box/FullSizeContainer.tsx +3 -3
  14. package/src/components/box/MobileFrame/index.tsx +1 -1
  15. package/src/components/button/DeleteButton.tsx +1 -1
  16. package/src/components/button/Toggle.tsx +1 -1
  17. package/src/components/button/ViewButton.tsx +1 -1
  18. package/src/components/feed/FeedContentPane.tsx +1 -1
  19. package/src/components/feed/MediaFeedBackground.tsx +1 -1
  20. package/src/components/feed/MediaFeedRefresh.tsx +1 -1
  21. package/src/components/feed/MediaFeedSwipeUp.tsx +1 -0
  22. package/src/components/feed/context.tsx +1 -1
  23. package/src/components/form/Condition.tsx +1 -1
  24. package/src/components/form/Field.tsx +1 -1
  25. package/src/components/form/Form.tsx +9 -6
  26. package/src/components/form/FormFooter.tsx +4 -3
  27. package/src/components/form/UploadProgress/index.tsx +1 -1
  28. package/src/components/form/input/Editable.tsx +62 -70
  29. package/src/components/form/input/InputSlider.tsx +1 -0
  30. package/src/components/form/input/OptionalTag.tsx +1 -1
  31. package/src/components/form/input/StandaloneInput.tsx +1 -1
  32. package/src/components/form/input/boolean/index.tsx +1 -1
  33. package/src/components/form/input/color/index.tsx +1 -1
  34. package/src/components/form/input/date/index.tsx +1 -1
  35. package/src/components/form/input/datetime/index.tsx +1 -1
  36. package/src/components/form/input/file.tsx +4 -4
  37. package/src/components/form/input/input.tsx +10 -6
  38. package/src/components/form/input/multipleSelect/index.tsx +3 -3
  39. package/src/components/form/input/number/index.tsx +1 -1
  40. package/src/components/form/input/select/index.tsx +10 -4
  41. package/src/components/form/input/socialMedia/index.tsx +8 -1
  42. package/src/components/form/input/text/index.tsx +1 -1
  43. package/src/components/form/input/text/textarea.tsx +1 -1
  44. package/src/components/form/input/time/index.tsx +1 -1
  45. package/src/components/form/view/file.tsx +1 -1
  46. package/src/components/form/view/index.tsx +1 -1
  47. package/src/components/form/view/multipleSelect.tsx +3 -3
  48. package/src/components/form/view/select.tsx +14 -7
  49. package/src/components/list/Body/InfiniteScrollGridBody.tsx +1 -1
  50. package/src/components/list/Body/InfiniteScrollListBody.tsx +1 -1
  51. package/src/components/list/Body/ListBody.tsx +1 -0
  52. package/src/components/list/Body/PagedGridBody.tsx +1 -1
  53. package/src/components/list/Body/PagedListBody.tsx +1 -1
  54. package/src/components/list/DataList.tsx +1 -0
  55. package/src/components/list/ListContainer.tsx +1 -0
  56. package/src/components/list/ListContent.tsx +1 -1
  57. package/src/components/list/ListCreate.tsx +1 -1
  58. package/src/components/list/ListFilters.tsx +1 -1
  59. package/src/components/list/ListFooter.tsx +1 -1
  60. package/src/components/list/ListHeader.tsx +1 -1
  61. package/src/components/list/ListItem/ListCell.tsx +7 -6
  62. package/src/components/list/ListItem/ListRow.tsx +7 -1
  63. package/src/components/list/ListItemView.tsx +1 -1
  64. package/src/components/list/ListSort.tsx +1 -1
  65. package/src/components/list/NoItems.tsx +1 -1
  66. package/src/components/loading/CircularProgress.tsx +1 -0
  67. package/src/components/loading/Loading.tsx +1 -1
  68. package/src/components/loading/LoadingImage.tsx +1 -1
  69. package/src/components/loading/LoadingSwitch.tsx +1 -1
  70. package/src/components/media/PlayButton.tsx +1 -0
  71. package/src/components/modal/DefaultModal.tsx +1 -1
  72. package/src/components/modal/DesktopModal.tsx +1 -0
  73. package/src/components/modal/MobileModal.tsx +1 -1
  74. package/src/components/nav/NavBar.tsx +1 -1
  75. package/src/components/overlay/ImageViewOverlay.tsx +1 -1
  76. package/src/components/overlay/MobileOverlay.tsx +1 -0
  77. package/src/components/text/GradientText/index.tsx +1 -0
  78. package/src/components/text/NumberTicker.tsx +1 -1
  79. package/src/components/theme/colorMode/DarkModeToggle.tsx +1 -1
  80. package/src/components/view/ErrorView.tsx +1 -0
  81. 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
- {label && !inEditable ? (
88
- <Text color="gray.800" fontSize="sm" px={2}>
89
- {label}
90
- </Text>
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
- {renderOption(o, colorMode, !!value?.includes(o))}
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 renderOption = customRender ?? DefaultRenderOption
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>{selected ? renderOption(selected, colorMode, true) : placeholder}</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
- {renderOption(o, colorMode, o === selected)}
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 { FC, ForwardedRef, forwardRef, useCallback, useImperativeHandle, useMemo } from 'react'
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
- {renderOption(v, colorMode, true)}
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
- return <Text>{typeof value === 'string' ? value : JSON.stringify(value)}</Text>
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: SelectField
16
- value: any
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 renderOption = customRender ?? DefaultRenderOption
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 ? renderOption(value, colorMode, true) : 'None'}
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,4 +1,5 @@
1
1
  import { useDataList } from '@chem-po/react'
2
+ import React from 'react'
2
3
  import { InfiniteScrollGridBody } from './InfiniteScrollGridBody'
3
4
  import { InfiniteScrollListBody } from './InfiniteScrollListBody'
4
5
  import { PagedGridBody } from './PagedGridBody'
@@ -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'
@@ -5,6 +5,7 @@ import {
5
5
  useDataListData,
6
6
  usePaginatedQuery,
7
7
  } from '@chem-po/react'
8
+ import React from 'react'
8
9
  import { ListContainer } from './ListContainer'
9
10
  import { ListContent } from './ListContent'
10
11
  import { ListViewProps } from './types'
@@ -1,5 +1,6 @@
1
1
  import { Flex, FlexProps } from '@chakra-ui/react'
2
2
  import { useMounted } from '@chem-po/react'
3
+ import React from 'react'
3
4
  import { FullSizeProvider } from '../box'
4
5
 
5
6
  export const ListContainer = (props: FlexProps) => {
@@ -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
- {Render({
41
- index: itemIdx,
42
- item,
43
- refetch: refetch ? () => refetch(item._id) : undefined,
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
- {Render({ index, item, refetch: refetch ? () => refetch(item._id) : undefined, colorMode })}
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 = () => {
@@ -3,6 +3,7 @@ import {
3
3
  CircularProgress as Orig,
4
4
  useColorModeValue,
5
5
  } from '@chakra-ui/react'
6
+ import React from 'react'
6
7
 
7
8
  export const CircularProgress = (props: CircularProgressProps) => {
8
9
  const color = useColorModeValue('gray.400', 'gray.400')
@@ -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,5 +1,5 @@
1
1
  import { Center, Flex, Switch, Text, useToast } from '@chakra-ui/react'
2
- import { useCallback, useState } from 'react'
2
+ import React, { useCallback, useState } from 'react'
3
3
  import { Loading } from './Loading'
4
4
 
5
5
  export const LoadingSwitch = ({
@@ -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,5 +1,5 @@
1
1
  import { useScreen } from '@chem-po/react'
2
- import { useMemo } from 'react'
2
+ import React, { useMemo } from 'react'
3
3
  import { DesktopModal } from './DesktopModal'
4
4
  import { useForceMobile } from './ForceMobile'
5
5
  import { MobileModal } from './MobileModal'
@@ -1,4 +1,5 @@
1
1
  import { Box, Modal, ModalContent, ModalOverlay } from '@chakra-ui/react'
2
+ import React from 'react'
2
3
  import { DefaultModalProps } from './type'
3
4
 
4
5
  export const DesktopModal = ({ children, isOpen, contentProps, ...props }: DefaultModalProps) => (
@@ -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,5 +1,6 @@
1
1
  import { Flex, FlexProps, Portal } from '@chakra-ui/react'
2
2
  import { useMobileFrame } from '@chem-po/react'
3
+ import React from 'react'
3
4
 
4
5
  export const MobileOverlay = (props: FlexProps) => {
5
6
  const { overlayRef } = useMobileFrame()
@@ -1,4 +1,5 @@
1
1
  import { Box, BoxProps, Text, TextProps } from '@chakra-ui/react'
2
+ import React from 'react'
2
3
  import './styles.css'
3
4
 
4
5
  export const GradientText = ({
@@ -1,4 +1,4 @@
1
- import { useEffect, useRef } from 'react'
1
+ import React, { useEffect, useRef } from 'react'
2
2
 
3
3
  export const NumberTicker = ({ value, duration = 30 }: { value: number; duration?: number }) => {
4
4
  const spanRef = useRef<HTMLSpanElement>(null)
@@ -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')
@@ -1,4 +1,5 @@
1
1
  import { Flex, Text, useColorModeValue } from '@chakra-ui/react'
2
+ import React from 'react'
2
3
  import { ContentBox } from '../box/ContentBox'
3
4
 
4
5
  export const ErrorView = ({ message }: { message?: string }) => {
@@ -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<any>()
10
+ const timer = useRef<ReturnType<typeof setTimeout> | null>(null)
11
11
  const authLoading = useAuth(s => s.loading)
12
12
 
13
13
  const navigate = useNavigate()