@sanity/assist 1.0.9 → 1.0.11

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sanity/assist",
3
- "version": "1.0.9",
3
+ "version": "1.0.11",
4
4
  "description": "",
5
5
  "keywords": [
6
6
  "sanity",
@@ -53,7 +53,9 @@
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",
58
+ "react-is": "^18.2.0",
57
59
  "rxjs": "^7.8.0",
58
60
  "rxjs-exhaustmap-with-trailing": "^2.1.1"
59
61
  },
@@ -68,6 +70,7 @@
68
70
  "@types/styled-components": "^5.1.26",
69
71
  "@typescript-eslint/eslint-plugin": "^5.56.0",
70
72
  "@typescript-eslint/parser": "^5.56.0",
73
+ "date-fns": "^2.30.0",
71
74
  "eslint": "^8.36.0",
72
75
  "eslint-config-prettier": "^8.8.0",
73
76
  "eslint-config-sanity": "^6.0.0",
@@ -77,7 +80,6 @@
77
80
  "npm-run-all": "^4.1.5",
78
81
  "react": "^18.2.0",
79
82
  "react-dom": "^18.2.0",
80
- "react-is": "^18.2.0",
81
83
  "rimraf": "^4.4.0",
82
84
  "sanity": "^3.13.0",
83
85
  "semantic-release": "^21.0.5",
@@ -87,7 +89,8 @@
87
89
  },
88
90
  "peerDependencies": {
89
91
  "react": "^18",
90
- "sanity": "^3.13.0"
92
+ "sanity": "^3.13.0",
93
+ "styled-components": "^5.2"
91
94
  },
92
95
  "engines": {
93
96
  "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 {Delay} from '../components/Delay'
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
- <div>
21
- <Delay durationMs={200} ms={250}>
22
- <AssistAvatar state="active" />
23
- </Delay>
24
- </div>
20
+ <FadeInContent durationMs={300}>
21
+ <AssistAvatar state="active" />
22
+ </FadeInContent>
25
23
  </Tooltip>
26
24
  </Card>
27
25
  )
@@ -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
- }