@sanity/ui 2.1.4-canary.0 → 2.1.4
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 +1 -3
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +1 -3
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1 -3
- package/dist/index.mjs.map +1 -1
- package/package.json +37 -35
- package/src/core/components/dialog/dialog.tsx +2 -2
- package/src/core/components/toast/toastProvider.tsx +2 -4
- package/src/core/hooks/useDelayedState.ts +2 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sanity/ui",
|
|
3
|
-
"version": "2.1.4
|
|
3
|
+
"version": "2.1.4",
|
|
4
4
|
"keywords": [
|
|
5
5
|
"sanity",
|
|
6
6
|
"ui",
|
|
@@ -51,6 +51,32 @@
|
|
|
51
51
|
"src",
|
|
52
52
|
"theme.js"
|
|
53
53
|
],
|
|
54
|
+
"scripts": {
|
|
55
|
+
"build": "run-s clean pkg:build pkg:check figma:pkg:build",
|
|
56
|
+
"clean": "rimraf .workshop dist",
|
|
57
|
+
"commit": "cz",
|
|
58
|
+
"cypress:dev": "run-p dev cypress:open",
|
|
59
|
+
"cypress:open": "cypress open",
|
|
60
|
+
"cypress:run": "cypress run",
|
|
61
|
+
"dev": "run-p storybook:dev workshop:dev",
|
|
62
|
+
"figma:pkg:build": "cd figma && pnpm build",
|
|
63
|
+
"format": "prettier --write --cache --ignore-unknown .",
|
|
64
|
+
"lint": "eslint . --ext .cjs,.js,.jsx,.mjs,.ts,.tsx --quiet",
|
|
65
|
+
"pkg:build": "pkg build --strict",
|
|
66
|
+
"pkg:check": "pkg --strict",
|
|
67
|
+
"prepare": "husky install",
|
|
68
|
+
"prepublishOnly": "pnpm build",
|
|
69
|
+
"release": "semantic-release",
|
|
70
|
+
"storybook:build": "storybook build",
|
|
71
|
+
"storybook:dev": "storybook dev -p 6006",
|
|
72
|
+
"test": "jest",
|
|
73
|
+
"test:browser": "start-server-and-test 'run-s workshop:build workshop:start' http://localhost:1337 'run-s cypress:run'",
|
|
74
|
+
"ts:check": "tsc",
|
|
75
|
+
"watch": "pkg watch --strict",
|
|
76
|
+
"workshop:build": "workshop build",
|
|
77
|
+
"workshop:dev": "workshop dev",
|
|
78
|
+
"workshop:start": "http-server -a localhost -c-0 -p 1337 -s -P http://localhost:1337/index.html? dist"
|
|
79
|
+
},
|
|
54
80
|
"commitlint": {
|
|
55
81
|
"extends": [
|
|
56
82
|
"@commitlint/config-conventional"
|
|
@@ -90,8 +116,8 @@
|
|
|
90
116
|
"@babel/preset-env": "^7.24.4",
|
|
91
117
|
"@babel/preset-react": "^7.24.1",
|
|
92
118
|
"@babel/preset-typescript": "^7.24.1",
|
|
93
|
-
"@commitlint/cli": "^19.2.
|
|
94
|
-
"@commitlint/config-conventional": "^19.
|
|
119
|
+
"@commitlint/cli": "^19.2.2",
|
|
120
|
+
"@commitlint/config-conventional": "^19.2.2",
|
|
95
121
|
"@juggle/resize-observer": "^3.4.0",
|
|
96
122
|
"@sanity/pkg-utils": "^6.6.6",
|
|
97
123
|
"@sanity/semantic-release-preset": "^4.1.7",
|
|
@@ -115,14 +141,14 @@
|
|
|
115
141
|
"@testing-library/react": "^14.3.1",
|
|
116
142
|
"@types/jest": "^29.5.12",
|
|
117
143
|
"@types/jest-axe": "^3.5.9",
|
|
118
|
-
"@types/node": "^20.
|
|
119
|
-
"@types/react": "^18.2.
|
|
144
|
+
"@types/node": "^20.12.7",
|
|
145
|
+
"@types/react": "^18.2.79",
|
|
120
146
|
"@types/react-dom": "^18.2.25",
|
|
121
147
|
"@types/react-is": "^18.2.4",
|
|
122
148
|
"@types/refractor": "^3.4.1",
|
|
123
149
|
"@types/testing-library__jest-dom": "^5.14.9",
|
|
124
|
-
"@typescript-eslint/eslint-plugin": "^7.
|
|
125
|
-
"@typescript-eslint/parser": "^7.
|
|
150
|
+
"@typescript-eslint/eslint-plugin": "^7.7.0",
|
|
151
|
+
"@typescript-eslint/parser": "^7.7.0",
|
|
126
152
|
"commitizen": "^4.3.0",
|
|
127
153
|
"cypress": "^13.7.3",
|
|
128
154
|
"cypress-real-events": "^1.12.0",
|
|
@@ -150,14 +176,14 @@
|
|
|
150
176
|
"react-dom": "^18.2.0",
|
|
151
177
|
"react-is": "^18.2.0",
|
|
152
178
|
"refractor": "^4.8.1",
|
|
153
|
-
"rimraf": "^5.0.
|
|
179
|
+
"rimraf": "^5.0.5",
|
|
154
180
|
"semantic-release": "^23.0.8",
|
|
155
181
|
"start-server-and-test": "^2.0.3",
|
|
156
182
|
"storybook": "^8.0.8",
|
|
157
183
|
"styled-components": "^6.1.8",
|
|
158
184
|
"tsconfig-paths": "^4.2.0",
|
|
159
185
|
"typescript": "5.4.5",
|
|
160
|
-
"vite": "^5.2.
|
|
186
|
+
"vite": "^5.2.9",
|
|
161
187
|
"vite-tsconfig-paths": "^4.3.2"
|
|
162
188
|
},
|
|
163
189
|
"peerDependencies": {
|
|
@@ -166,7 +192,7 @@
|
|
|
166
192
|
"react-is": "^18",
|
|
167
193
|
"styled-components": "^5.2 || ^6"
|
|
168
194
|
},
|
|
169
|
-
"packageManager": "pnpm@
|
|
195
|
+
"packageManager": "pnpm@9.0.1",
|
|
170
196
|
"engines": {
|
|
171
197
|
"node": ">=14.0.0"
|
|
172
198
|
},
|
|
@@ -175,29 +201,5 @@
|
|
|
175
201
|
},
|
|
176
202
|
"esm.sh": {
|
|
177
203
|
"bundle": false
|
|
178
|
-
},
|
|
179
|
-
"scripts": {
|
|
180
|
-
"build": "run-s clean pkg:build pkg:check figma:pkg:build",
|
|
181
|
-
"clean": "rimraf .workshop dist",
|
|
182
|
-
"commit": "cz",
|
|
183
|
-
"cypress:dev": "run-p dev cypress:open",
|
|
184
|
-
"cypress:open": "cypress open",
|
|
185
|
-
"cypress:run": "cypress run",
|
|
186
|
-
"dev": "run-p storybook:dev workshop:dev",
|
|
187
|
-
"figma:pkg:build": "cd figma && pnpm build",
|
|
188
|
-
"format": "prettier --write --cache --ignore-unknown .",
|
|
189
|
-
"lint": "eslint . --ext .cjs,.js,.jsx,.mjs,.ts,.tsx --quiet",
|
|
190
|
-
"pkg:build": "pkg build --strict",
|
|
191
|
-
"pkg:check": "pkg --strict",
|
|
192
|
-
"release": "semantic-release",
|
|
193
|
-
"storybook:build": "storybook build",
|
|
194
|
-
"storybook:dev": "storybook dev -p 6006",
|
|
195
|
-
"test": "jest",
|
|
196
|
-
"test:browser": "start-server-and-test 'run-s workshop:build workshop:start' http://localhost:1337 'run-s cypress:run'",
|
|
197
|
-
"ts:check": "tsc",
|
|
198
|
-
"watch": "pkg watch --strict",
|
|
199
|
-
"workshop:build": "workshop build",
|
|
200
|
-
"workshop:dev": "workshop dev",
|
|
201
|
-
"workshop:start": "http-server -a localhost -c-0 -p 1337 -s -P http://localhost:1337/index.html? dist"
|
|
202
204
|
}
|
|
203
|
-
}
|
|
205
|
+
}
|
|
@@ -369,7 +369,7 @@ export const Dialog = forwardRef(function Dialog(
|
|
|
369
369
|
|
|
370
370
|
const labelId = `${id}_label`
|
|
371
371
|
|
|
372
|
-
const rootClickTimeoutRef = useRef<
|
|
372
|
+
const rootClickTimeoutRef = useRef<NodeJS.Timeout>()
|
|
373
373
|
|
|
374
374
|
// If the resulting active element (a.k.a. focused element) is not withing scope when clicking
|
|
375
375
|
// within the dialog, then we want to focus the previously interactive element in the dialog instead.
|
|
@@ -379,7 +379,7 @@ export const Dialog = forwardRef(function Dialog(
|
|
|
379
379
|
clearTimeout(rootClickTimeoutRef.current)
|
|
380
380
|
}
|
|
381
381
|
|
|
382
|
-
rootClickTimeoutRef.current =
|
|
382
|
+
rootClickTimeoutRef.current = setTimeout(() => {
|
|
383
383
|
const activeElement = document.activeElement
|
|
384
384
|
|
|
385
385
|
if (activeElement && !isTargetWithinScope(boundaryElement, portalElement, activeElement)) {
|
|
@@ -53,7 +53,7 @@ let toastId = 0
|
|
|
53
53
|
export function ToastProvider(props: ToastProviderProps): React.ReactElement {
|
|
54
54
|
const {children, padding = 4, paddingX, paddingY, zOffset} = props
|
|
55
55
|
const [state, _setState] = useState<ToastState>([])
|
|
56
|
-
const toastsRef = useRef<{[key: string]: {timeoutId:
|
|
56
|
+
const toastsRef = useRef<{[key: string]: {timeoutId: NodeJS.Timeout}}>({})
|
|
57
57
|
const mounted = useMounted()
|
|
58
58
|
const prefersReducedMotion = usePrefersReducedMotion()
|
|
59
59
|
const variants = useMemo<Variants>(
|
|
@@ -129,9 +129,7 @@ export function ToastProvider(props: ToastProviderProps): React.ReactElement {
|
|
|
129
129
|
delete toastsRef.current[id]
|
|
130
130
|
}
|
|
131
131
|
|
|
132
|
-
toastsRef.current[id] = {
|
|
133
|
-
timeoutId: (setTimeout as typeof window.setTimeout)(dismiss, duration),
|
|
134
|
-
}
|
|
132
|
+
toastsRef.current[id] = {timeoutId: setTimeout(dismiss, duration)}
|
|
135
133
|
|
|
136
134
|
return id
|
|
137
135
|
}
|
|
@@ -8,7 +8,7 @@ export function useDelayedState<S>(
|
|
|
8
8
|
initialState: S | (() => S),
|
|
9
9
|
): [S, (nextState: SetStateAction<S>, delay?: number) => void] {
|
|
10
10
|
const [state, setState] = useState(initialState)
|
|
11
|
-
const delayedAction = useRef<
|
|
11
|
+
const delayedAction = useRef<NodeJS.Timeout | undefined>()
|
|
12
12
|
|
|
13
13
|
const onStateChange = useCallback((nextState: SetStateAction<S>, delay?: number) => {
|
|
14
14
|
const action = () => {
|
|
@@ -22,7 +22,7 @@ export function useDelayedState<S>(
|
|
|
22
22
|
}
|
|
23
23
|
|
|
24
24
|
if (!delay) return action()
|
|
25
|
-
delayedAction.current =
|
|
25
|
+
delayedAction.current = setTimeout(action, delay)
|
|
26
26
|
}, [])
|
|
27
27
|
|
|
28
28
|
return [state, onStateChange]
|