@sanity/assist 1.0.9 → 1.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.esm.js +4449 -2334
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +4463 -2333
- package/dist/index.js.map +1 -1
- package/package.json +6 -2
- package/src/components/FadeInContent.tsx +33 -0
- package/src/presence/AiFieldPresence.tsx +4 -6
- package/src/components/Delay.tsx +0 -25
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sanity/assist",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.10",
|
|
4
4
|
"description": "",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"sanity",
|
|
@@ -53,6 +53,7 @@
|
|
|
53
53
|
"@sanity/icons": "^2.4.0",
|
|
54
54
|
"@sanity/incompatible-plugin": "^1.0.4",
|
|
55
55
|
"@sanity/ui": "^1.6.0",
|
|
56
|
+
"date-fns": "^2.30.0",
|
|
56
57
|
"react-fast-compare": "^3.2.1",
|
|
57
58
|
"rxjs": "^7.8.0",
|
|
58
59
|
"rxjs-exhaustmap-with-trailing": "^2.1.1"
|
|
@@ -68,6 +69,7 @@
|
|
|
68
69
|
"@types/styled-components": "^5.1.26",
|
|
69
70
|
"@typescript-eslint/eslint-plugin": "^5.56.0",
|
|
70
71
|
"@typescript-eslint/parser": "^5.56.0",
|
|
72
|
+
"date-fns": "^2.30.0",
|
|
71
73
|
"eslint": "^8.36.0",
|
|
72
74
|
"eslint-config-prettier": "^8.8.0",
|
|
73
75
|
"eslint-config-sanity": "^6.0.0",
|
|
@@ -87,7 +89,9 @@
|
|
|
87
89
|
},
|
|
88
90
|
"peerDependencies": {
|
|
89
91
|
"react": "^18",
|
|
90
|
-
"
|
|
92
|
+
"react-is": "^18.2.0",
|
|
93
|
+
"sanity": "^3.13.0",
|
|
94
|
+
"styled-components": "^5.2"
|
|
91
95
|
},
|
|
92
96
|
"engines": {
|
|
93
97
|
"node": ">=14"
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import {ReactElement, ReactNode} from 'react'
|
|
2
|
+
import styled, {keyframes} from 'styled-components'
|
|
3
|
+
|
|
4
|
+
const fadeIn = keyframes`
|
|
5
|
+
0% {
|
|
6
|
+
opacity: 0;
|
|
7
|
+
transform: scale(0.75);
|
|
8
|
+
}
|
|
9
|
+
40% {
|
|
10
|
+
opacity: 0;
|
|
11
|
+
transform: scale(0.75);
|
|
12
|
+
}
|
|
13
|
+
100% {
|
|
14
|
+
opacity: 1;
|
|
15
|
+
transform: scale(1);
|
|
16
|
+
}
|
|
17
|
+
`
|
|
18
|
+
|
|
19
|
+
const FadeInDiv = styled.div`
|
|
20
|
+
animation-name: ${fadeIn};
|
|
21
|
+
animation-timing-function: ease-in-out;
|
|
22
|
+
`
|
|
23
|
+
|
|
24
|
+
export function FadeInContent({
|
|
25
|
+
children,
|
|
26
|
+
durationMs = 250,
|
|
27
|
+
}: {
|
|
28
|
+
children?: ReactNode
|
|
29
|
+
ms?: number
|
|
30
|
+
durationMs?: number
|
|
31
|
+
}): ReactElement {
|
|
32
|
+
return <FadeInDiv style={{animationDuration: `${durationMs}ms`}}>{children}</FadeInDiv>
|
|
33
|
+
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// eslint-disable-next-line react/no-unused-prop-types
|
|
2
2
|
import {FormNodePresence} from 'sanity'
|
|
3
3
|
import {Card, Flex, Text, Tooltip} from '@sanity/ui'
|
|
4
|
-
import {
|
|
4
|
+
import {FadeInContent} from '../components/FadeInContent'
|
|
5
5
|
import {AssistAvatar} from './AssistAvatar'
|
|
6
6
|
|
|
7
7
|
export function AiFieldPresence(props: {presence: FormNodePresence}) {
|
|
@@ -17,11 +17,9 @@ export function AiFieldPresence(props: {presence: FormNodePresence}) {
|
|
|
17
17
|
</Card>
|
|
18
18
|
}
|
|
19
19
|
>
|
|
20
|
-
<
|
|
21
|
-
<
|
|
22
|
-
|
|
23
|
-
</Delay>
|
|
24
|
-
</div>
|
|
20
|
+
<FadeInContent durationMs={300}>
|
|
21
|
+
<AssistAvatar state="active" />
|
|
22
|
+
</FadeInContent>
|
|
25
23
|
</Tooltip>
|
|
26
24
|
</Card>
|
|
27
25
|
)
|
package/src/components/Delay.tsx
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import {motion} from 'framer-motion'
|
|
2
|
-
import {ReactElement, ReactNode} from 'react'
|
|
3
|
-
|
|
4
|
-
export function Delay({
|
|
5
|
-
children,
|
|
6
|
-
ms = 1000,
|
|
7
|
-
durationMs = 250,
|
|
8
|
-
}: {
|
|
9
|
-
children?: ReactNode
|
|
10
|
-
ms?: number
|
|
11
|
-
durationMs?: number
|
|
12
|
-
}): ReactElement {
|
|
13
|
-
return (
|
|
14
|
-
<motion.div
|
|
15
|
-
initial={{opacity: 0, scale: 0.75}}
|
|
16
|
-
animate={{opacity: 1, scale: 1}}
|
|
17
|
-
transition={{
|
|
18
|
-
delay: ms / 1000,
|
|
19
|
-
duration: durationMs / 1000,
|
|
20
|
-
}}
|
|
21
|
-
>
|
|
22
|
-
{children}
|
|
23
|
-
</motion.div>
|
|
24
|
-
)
|
|
25
|
-
}
|