@sanity/ui 2.8.1 → 2.8.2
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 +15 -6
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +15 -6
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +15 -6
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -3
- package/src/core/components/dialog/dialog.tsx +12 -9
- package/src/core/components/menu/menu.tsx +7 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sanity/ui",
|
|
3
|
-
"version": "2.8.
|
|
3
|
+
"version": "2.8.2",
|
|
4
4
|
"keywords": [
|
|
5
5
|
"sanity",
|
|
6
6
|
"ui",
|
|
@@ -161,7 +161,7 @@
|
|
|
161
161
|
"eslint-plugin-boundaries": "^4.2.2",
|
|
162
162
|
"eslint-plugin-import": "^2.29.1",
|
|
163
163
|
"eslint-plugin-jsx-a11y": "^6.9.0",
|
|
164
|
-
"eslint-plugin-prettier": "^5.1
|
|
164
|
+
"eslint-plugin-prettier": "^5.2.1",
|
|
165
165
|
"eslint-plugin-react": "^7.34.4",
|
|
166
166
|
"eslint-plugin-react-compiler": "0.0.0-experimental-a97cca1-20240529",
|
|
167
167
|
"eslint-plugin-react-hooks": "^4.6.2",
|
|
@@ -183,7 +183,7 @@
|
|
|
183
183
|
"semantic-release": "^24.0.0",
|
|
184
184
|
"start-server-and-test": "^2.0.4",
|
|
185
185
|
"storybook": "^8.2.4",
|
|
186
|
-
"styled-components": "^6.1.
|
|
186
|
+
"styled-components": "^6.1.12",
|
|
187
187
|
"tsconfig-paths": "^4.2.0",
|
|
188
188
|
"typescript": "5.5.3",
|
|
189
189
|
"vite": "^5.3.4",
|
|
@@ -216,18 +216,21 @@ const DialogCard = forwardRef(function DialogCard(
|
|
|
216
216
|
)
|
|
217
217
|
|
|
218
218
|
useClickOutside(
|
|
219
|
-
(
|
|
220
|
-
|
|
219
|
+
useCallback(
|
|
220
|
+
(event) => {
|
|
221
|
+
if (!isTopLayer || !onClickOutside) return
|
|
221
222
|
|
|
222
|
-
|
|
223
|
+
const target = event.target as Node | null
|
|
223
224
|
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
225
|
+
if (target && !isTargetWithinScope(boundaryElement, portalElement, target)) {
|
|
226
|
+
// Ignore clicks outside of the scope
|
|
227
|
+
return
|
|
228
|
+
}
|
|
228
229
|
|
|
229
|
-
|
|
230
|
-
|
|
230
|
+
onClickOutside()
|
|
231
|
+
},
|
|
232
|
+
[boundaryElement, isTopLayer, onClickOutside, portalElement],
|
|
233
|
+
),
|
|
231
234
|
[rootElement],
|
|
232
235
|
)
|
|
233
236
|
|
|
@@ -93,7 +93,13 @@ export const Menu = forwardRef(function Menu(
|
|
|
93
93
|
}, [activeIndex, onItemSelect])
|
|
94
94
|
|
|
95
95
|
// Close menu when clicking outside
|
|
96
|
-
useClickOutside(
|
|
96
|
+
useClickOutside(
|
|
97
|
+
useCallback(
|
|
98
|
+
(event) => isTopLayer && onClickOutside && onClickOutside(event),
|
|
99
|
+
[isTopLayer, onClickOutside],
|
|
100
|
+
),
|
|
101
|
+
[rootElement],
|
|
102
|
+
)
|
|
97
103
|
|
|
98
104
|
// Close menu when pressing Escape
|
|
99
105
|
useGlobalKeyDown(
|