@chem-po/react-web 0.0.30 → 0.0.31
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.js +2 -2
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
- package/src/components/form/input/select/index.tsx +13 -4
- package/src/components/loading/LoadingImage.tsx +7 -2
- package/src/components/modal/DesktopModal.tsx +12 -8
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@chem-po/react-web",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.31",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -16,8 +16,8 @@
|
|
|
16
16
|
"author": "",
|
|
17
17
|
"license": "ISC",
|
|
18
18
|
"dependencies": {
|
|
19
|
-
"@chem-po/core": "0.0.
|
|
20
|
-
"@chem-po/react": "0.0.
|
|
19
|
+
"@chem-po/core": "0.0.31",
|
|
20
|
+
"@chem-po/react": "0.0.31",
|
|
21
21
|
"@chakra-ui/anatomy": "^2.3.4",
|
|
22
22
|
"@chakra-ui/icons": "^2.2.4",
|
|
23
23
|
"@chakra-ui/react": "^2.10.7",
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
Button,
|
|
3
3
|
Popover,
|
|
4
|
-
PopoverArrow,
|
|
5
4
|
PopoverBody,
|
|
6
5
|
PopoverContent,
|
|
7
6
|
PopoverTrigger,
|
|
@@ -9,7 +8,7 @@ import {
|
|
|
9
8
|
useColorMode,
|
|
10
9
|
} from '@chakra-ui/react'
|
|
11
10
|
import { InputRef, RenderSelectOptionProps } from '@chem-po/core'
|
|
12
|
-
import { SelectField } from '@chem-po/react'
|
|
11
|
+
import { SelectField, useBackgroundColor } from '@chem-po/react'
|
|
13
12
|
import React, { forwardRef, useImperativeHandle, useMemo } from 'react'
|
|
14
13
|
import { useInputStyles } from '../hooks/useInputStyles'
|
|
15
14
|
import { InputContainer } from '../shared/InputContainer'
|
|
@@ -31,6 +30,7 @@ export const SelectComponent = forwardRef<InputRef, FieldProps<SelectField>>(
|
|
|
31
30
|
onBlur()
|
|
32
31
|
},
|
|
33
32
|
}))
|
|
33
|
+
const menuBg = useBackgroundColor(150)
|
|
34
34
|
|
|
35
35
|
const DefaultRenderOption = (props: RenderSelectOptionProps) => {
|
|
36
36
|
return <Text style={text}>{props.option.label}</Text>
|
|
@@ -66,7 +66,13 @@ export const SelectComponent = forwardRef<InputRef, FieldProps<SelectField>>(
|
|
|
66
66
|
</InputContainer>
|
|
67
67
|
</Button>
|
|
68
68
|
</PopoverTrigger>
|
|
69
|
-
<PopoverContent
|
|
69
|
+
<PopoverContent
|
|
70
|
+
w="100%"
|
|
71
|
+
overflowY="auto"
|
|
72
|
+
maxH="300px"
|
|
73
|
+
bg={menuBg}
|
|
74
|
+
border="none"
|
|
75
|
+
boxShadow="0 0 8px rgba(0, 0, 0, 0.3)">
|
|
70
76
|
<PopoverBody p={0}>
|
|
71
77
|
{options.map(o => (
|
|
72
78
|
<Button
|
|
@@ -78,6 +84,10 @@ export const SelectComponent = forwardRef<InputRef, FieldProps<SelectField>>(
|
|
|
78
84
|
onChange(o.value)
|
|
79
85
|
onBlur()
|
|
80
86
|
}}
|
|
87
|
+
display="flex"
|
|
88
|
+
justifyContent="flex-start"
|
|
89
|
+
alignItems="center"
|
|
90
|
+
px={3}
|
|
81
91
|
_hover={{ bg: 'blackAlpha.100' }}
|
|
82
92
|
_dark={{
|
|
83
93
|
_hover: { bg: 'whiteAlpha.100' },
|
|
@@ -92,7 +102,6 @@ export const SelectComponent = forwardRef<InputRef, FieldProps<SelectField>>(
|
|
|
92
102
|
</Button>
|
|
93
103
|
))}
|
|
94
104
|
</PopoverBody>
|
|
95
|
-
<PopoverArrow />
|
|
96
105
|
</PopoverContent>
|
|
97
106
|
</Popover>
|
|
98
107
|
)
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { BoxProps, Center, IconButton, Image, ImageProps } from '@chakra-ui/react'
|
|
2
|
-
import { useMounted } from '@chem-po/react'
|
|
2
|
+
import { useColorModeValue, useMounted } from '@chem-po/react'
|
|
3
3
|
import React, { SyntheticEvent, useCallback, useEffect, useRef, useState } from 'react'
|
|
4
4
|
import { ImageViewOverlay } from '../overlay/ImageViewOverlay'
|
|
5
5
|
import { LoadingLogo } from './Loading'
|
|
@@ -52,6 +52,11 @@ export const LoadingImage = ({
|
|
|
52
52
|
if (src) setPrevSrc(src)
|
|
53
53
|
}, [src, prevSrc])
|
|
54
54
|
|
|
55
|
+
const fullViewButtonFilter = useColorModeValue(
|
|
56
|
+
'none',
|
|
57
|
+
'brightness(300%) drop-shadow(1px 1px 3px #00000066)',
|
|
58
|
+
)
|
|
59
|
+
|
|
55
60
|
const loading = imageLoading || !!loadingOverride
|
|
56
61
|
return (
|
|
57
62
|
<Center
|
|
@@ -97,7 +102,7 @@ export const LoadingImage = ({
|
|
|
97
102
|
height="20px"
|
|
98
103
|
src="/icons/open_in_full.svg"
|
|
99
104
|
opacity={0.8}
|
|
100
|
-
filter=
|
|
105
|
+
filter={fullViewButtonFilter}
|
|
101
106
|
/>
|
|
102
107
|
}
|
|
103
108
|
onClick={() => setViewing(true)}
|
|
@@ -1,12 +1,16 @@
|
|
|
1
1
|
import { Box, Modal, ModalContent, ModalOverlay } from '@chakra-ui/react'
|
|
2
|
+
import { useBackgroundColor } from '@chem-po/react'
|
|
2
3
|
import React from 'react'
|
|
3
4
|
import { DefaultModalProps } from './type'
|
|
4
5
|
|
|
5
|
-
export const DesktopModal = ({ children, isOpen, contentProps, ...props }: DefaultModalProps) =>
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
<
|
|
9
|
-
<
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
6
|
+
export const DesktopModal = ({ children, isOpen, contentProps, ...props }: DefaultModalProps) => {
|
|
7
|
+
const bg = useBackgroundColor(100)
|
|
8
|
+
return (
|
|
9
|
+
<Modal scrollBehavior="inside" isCentered isOpen={isOpen} {...props}>
|
|
10
|
+
<ModalOverlay />
|
|
11
|
+
<ModalContent position="relative" overflowY="auto" bg={bg} {...contentProps}>
|
|
12
|
+
<Box>{children}</Box>
|
|
13
|
+
</ModalContent>
|
|
14
|
+
</Modal>
|
|
15
|
+
)
|
|
16
|
+
}
|