@sanity/ui 2.8.13-canary.1 → 2.8.14
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/_chunks-cjs/getTheme_v2.js +28 -84
- package/dist/_chunks-cjs/getTheme_v2.js.map +1 -1
- package/dist/_chunks-es/getTheme_v2.mjs +28 -84
- package/dist/_chunks-es/getTheme_v2.mjs.map +1 -1
- package/dist/_legacy/getTheme_v2.esm.js +28 -84
- package/dist/_legacy/getTheme_v2.esm.js.map +1 -1
- package/dist/index.esm.js +2912 -2971
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +2914 -2972
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +2912 -2971
- package/dist/index.mjs.map +1 -1
- package/dist/theme.esm.js +450 -1198
- package/dist/theme.esm.js.map +1 -1
- package/dist/theme.js +450 -1198
- package/dist/theme.js.map +1 -1
- package/dist/theme.mjs +450 -1198
- package/dist/theme.mjs.map +1 -1
- package/package.json +34 -27
- package/src/core/components/dialog/dialog.tsx +1 -1
- package/src/core/components/menu/useMenuController.ts +21 -18
- package/src/theme/defaults/colorTokens.ts +2 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sanity/ui",
|
|
3
|
-
"version": "2.8.
|
|
3
|
+
"version": "2.8.14",
|
|
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",
|
|
65
|
+
"pkg:build": "pkg build --strict",
|
|
66
|
+
"pkg:check": "pkg --strict",
|
|
67
|
+
"prepare": "husky install",
|
|
68
|
+
"prepack": "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"
|
|
@@ -84,7 +110,6 @@
|
|
|
84
110
|
"@sanity/icons": "^3.4.0",
|
|
85
111
|
"csstype": "^3.1.3",
|
|
86
112
|
"framer-motion": "11.0.8",
|
|
87
|
-
"react-compiler-runtime": "19.0.0-beta-6fc168f-20241025",
|
|
88
113
|
"react-refractor": "^2.2.0",
|
|
89
114
|
"use-effect-event": "^1.0.2"
|
|
90
115
|
},
|
|
@@ -173,37 +198,19 @@
|
|
|
173
198
|
"react-is": "^18",
|
|
174
199
|
"styled-components": "^5.2 || ^6"
|
|
175
200
|
},
|
|
201
|
+
"packageManager": "pnpm@9.12.3",
|
|
176
202
|
"engines": {
|
|
177
203
|
"node": ">=14.0.0"
|
|
178
204
|
},
|
|
179
205
|
"publishConfig": {
|
|
180
206
|
"access": "public"
|
|
181
207
|
},
|
|
208
|
+
"pnpm": {
|
|
209
|
+
"overrides": {
|
|
210
|
+
"conventional-changelog-conventionalcommits": ">= 8.0.0"
|
|
211
|
+
}
|
|
212
|
+
},
|
|
182
213
|
"esm.sh": {
|
|
183
214
|
"bundle": false
|
|
184
|
-
},
|
|
185
|
-
"scripts": {
|
|
186
|
-
"build": "run-s clean pkg:build pkg:check figma:pkg:build",
|
|
187
|
-
"clean": "rimraf .workshop dist",
|
|
188
|
-
"commit": "cz",
|
|
189
|
-
"cypress:dev": "run-p dev cypress:open",
|
|
190
|
-
"cypress:open": "cypress open",
|
|
191
|
-
"cypress:run": "cypress run",
|
|
192
|
-
"dev": "run-p storybook:dev workshop:dev",
|
|
193
|
-
"figma:pkg:build": "cd figma && pnpm build",
|
|
194
|
-
"format": "prettier --write --cache --ignore-unknown .",
|
|
195
|
-
"lint": "eslint . --ext .cjs,.js,.jsx,.mjs,.ts,.tsx",
|
|
196
|
-
"pkg:build": "pkg build --strict",
|
|
197
|
-
"pkg:check": "pkg --strict",
|
|
198
|
-
"release": "semantic-release",
|
|
199
|
-
"storybook:build": "storybook build",
|
|
200
|
-
"storybook:dev": "storybook dev -p 6006",
|
|
201
|
-
"test": "jest",
|
|
202
|
-
"test:browser": "start-server-and-test 'run-s workshop:build workshop:start' http://localhost:1337 'run-s cypress:run'",
|
|
203
|
-
"ts:check": "tsc",
|
|
204
|
-
"watch": "pkg watch --strict",
|
|
205
|
-
"workshop:build": "workshop build",
|
|
206
|
-
"workshop:dev": "workshop dev",
|
|
207
|
-
"workshop:start": "http-server -a localhost -c-0 -p 1337 -s -P http://localhost:1337/index.html? dist"
|
|
208
215
|
}
|
|
209
|
-
}
|
|
216
|
+
}
|
|
@@ -241,7 +241,7 @@ const DialogCard = forwardRef(function DialogCard(
|
|
|
241
241
|
<DialogLayout direction="column">
|
|
242
242
|
{showHeader && (
|
|
243
243
|
<DialogHeader>
|
|
244
|
-
<Flex align="
|
|
244
|
+
<Flex align="flex-start" padding={3}>
|
|
245
245
|
<Box flex={1} padding={2}>
|
|
246
246
|
{header && (
|
|
247
247
|
<Text id={labelId} size={1} weight="semibold">
|
|
@@ -36,28 +36,31 @@ export function useMenuController(props: {
|
|
|
36
36
|
activeIndexRef.current = nextActiveIndex
|
|
37
37
|
}, [])
|
|
38
38
|
|
|
39
|
-
const mount = (
|
|
40
|
-
|
|
39
|
+
const mount = useCallback(
|
|
40
|
+
(element: HTMLElement | null, selected?: boolean): (() => void) => {
|
|
41
|
+
if (!element) return () => undefined
|
|
41
42
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
43
|
+
if (elementsRef.current.indexOf(element) === -1) {
|
|
44
|
+
elementsRef.current.push(element)
|
|
45
|
+
_sortElements(rootElementRef.current, elementsRef.current)
|
|
46
|
+
}
|
|
46
47
|
|
|
47
|
-
|
|
48
|
-
|
|
48
|
+
if (selected) {
|
|
49
|
+
const selectedIndex = elementsRef.current.indexOf(element)
|
|
49
50
|
|
|
50
|
-
|
|
51
|
-
|
|
51
|
+
setActiveIndex(selectedIndex)
|
|
52
|
+
}
|
|
52
53
|
|
|
53
|
-
|
|
54
|
-
|
|
54
|
+
return () => {
|
|
55
|
+
const idx = elementsRef.current.indexOf(element)
|
|
55
56
|
|
|
56
|
-
|
|
57
|
-
|
|
57
|
+
if (idx > -1) {
|
|
58
|
+
elementsRef.current.splice(idx, 1)
|
|
59
|
+
}
|
|
58
60
|
}
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
+
},
|
|
62
|
+
[rootElementRef, setActiveIndex],
|
|
63
|
+
)
|
|
61
64
|
|
|
62
65
|
const handleKeyDown = useCallback(
|
|
63
66
|
(event: React.KeyboardEvent<HTMLDivElement>) => {
|
|
@@ -167,7 +170,7 @@ export function useMenuController(props: {
|
|
|
167
170
|
[setActiveIndex],
|
|
168
171
|
)
|
|
169
172
|
|
|
170
|
-
const handleItemMouseLeave = () => {
|
|
173
|
+
const handleItemMouseLeave = useCallback(() => {
|
|
171
174
|
// Set the active index to -2 to deactivate all menu items
|
|
172
175
|
// when the user moves the mouse away from the menu item.
|
|
173
176
|
// We avoid using -1 because it would focus the first menu item,
|
|
@@ -175,7 +178,7 @@ export function useMenuController(props: {
|
|
|
175
178
|
// between two menu items or a menu divider.
|
|
176
179
|
setActiveIndex(-2)
|
|
177
180
|
rootElementRef.current?.focus()
|
|
178
|
-
}
|
|
181
|
+
}, [rootElementRef, setActiveIndex])
|
|
179
182
|
|
|
180
183
|
// Set focus on the currently active element
|
|
181
184
|
useEffect(() => {
|
|
@@ -427,7 +427,7 @@ export const defaultColorTokens: ThemeColorTokens = {
|
|
|
427
427
|
'*': {
|
|
428
428
|
_blend: ['multiply', 'screen'],
|
|
429
429
|
bg: ['white', 'black'],
|
|
430
|
-
border: ['200', '
|
|
430
|
+
border: ['200', '700'],
|
|
431
431
|
fg: ['black', '200'],
|
|
432
432
|
muted: {
|
|
433
433
|
bg: ['50', '950'],
|
|
@@ -443,6 +443,7 @@ export const defaultColorTokens: ThemeColorTokens = {
|
|
|
443
443
|
fg: ['800', '200'],
|
|
444
444
|
},
|
|
445
445
|
'disabled': {
|
|
446
|
+
bg: ['50', '950'],
|
|
446
447
|
fg: ['400', '600'],
|
|
447
448
|
border: ['100', '900'],
|
|
448
449
|
placeholder: ['200', '800 50%'],
|