@sanity/ui 2.1.15-canary.6 → 2.3.0
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.d.mts +2 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.esm.js +2950 -2963
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +2950 -2962
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +2950 -2963
- package/dist/index.mjs.map +1 -1
- package/dist/theme.esm.js +478 -1283
- package/dist/theme.esm.js.map +1 -1
- package/dist/theme.js +478 -1283
- package/dist/theme.js.map +1 -1
- package/dist/theme.mjs +478 -1283
- package/dist/theme.mjs.map +1 -1
- package/package.json +48 -41
- package/src/core/hooks/useArrayProp.ts +10 -1
- package/src/core/primitives/card/__workshop__/props.tsx +2 -0
- package/src/core/primitives/card/card.tsx +3 -0
- package/src/core/primitives/card/styles.ts +2 -2
- package/src/core/primitives/card/types.ts +1 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sanity/ui",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.3.0",
|
|
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
|
+
"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"
|
|
@@ -93,9 +119,9 @@
|
|
|
93
119
|
"@commitlint/cli": "^19.3.0",
|
|
94
120
|
"@commitlint/config-conventional": "^19.2.2",
|
|
95
121
|
"@juggle/resize-observer": "^3.4.0",
|
|
96
|
-
"@sanity/pkg-utils": "6.8.
|
|
97
|
-
"@sanity/semantic-release-preset": "^4.1.
|
|
98
|
-
"@sanity/ui-workshop": "^2.0.
|
|
122
|
+
"@sanity/pkg-utils": "^6.8.19",
|
|
123
|
+
"@sanity/semantic-release-preset": "^4.1.8",
|
|
124
|
+
"@sanity/ui-workshop": "^2.0.15",
|
|
99
125
|
"@storybook/addon-a11y": "^8.0.8",
|
|
100
126
|
"@storybook/addon-docs": "^8.0.8",
|
|
101
127
|
"@storybook/addon-essentials": "^8.0.8",
|
|
@@ -112,7 +138,7 @@
|
|
|
112
138
|
"@storybook/theming": "^8.0.8",
|
|
113
139
|
"@testing-library/dom": "^10.1.0",
|
|
114
140
|
"@testing-library/jest-dom": "^5.17.0",
|
|
115
|
-
"@testing-library/react": "^
|
|
141
|
+
"@testing-library/react": "^16.0.0",
|
|
116
142
|
"@types/jest": "^29.5.12",
|
|
117
143
|
"@types/jest-axe": "^3.5.9",
|
|
118
144
|
"@types/node": "^20.12.7",
|
|
@@ -121,9 +147,8 @@
|
|
|
121
147
|
"@types/react-is": "^18.3.0",
|
|
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.
|
|
126
|
-
"babel-plugin-react-compiler": "0.0.0-experimental-938cd9a-20240601",
|
|
150
|
+
"@typescript-eslint/eslint-plugin": "^7.12.0",
|
|
151
|
+
"@typescript-eslint/parser": "^7.12.0",
|
|
127
152
|
"commitizen": "^4.3.0",
|
|
128
153
|
"cypress": "^13.10.0",
|
|
129
154
|
"cypress-real-events": "^1.12.0",
|
|
@@ -146,14 +171,14 @@
|
|
|
146
171
|
"lint-staged": "^14.0.1",
|
|
147
172
|
"module-alias": "^2.2.3",
|
|
148
173
|
"npm-run-all2": "^5.0.2",
|
|
149
|
-
"prettier": "^3.
|
|
174
|
+
"prettier": "^3.3.0",
|
|
150
175
|
"prettier-plugin-packagejson": "^2.5.0",
|
|
151
|
-
"react": "
|
|
152
|
-
"react-dom": "
|
|
153
|
-
"react-is": "
|
|
176
|
+
"react": "^18.3.1",
|
|
177
|
+
"react-dom": "^18.3.1",
|
|
178
|
+
"react-is": "^18.3.1",
|
|
154
179
|
"refractor": "^4.8.1",
|
|
155
180
|
"rimraf": "^5.0.5",
|
|
156
|
-
"semantic-release": "^
|
|
181
|
+
"semantic-release": "^24.0.0",
|
|
157
182
|
"start-server-and-test": "^2.0.3",
|
|
158
183
|
"storybook": "^8.0.8",
|
|
159
184
|
"styled-components": "^6.1.11",
|
|
@@ -163,11 +188,12 @@
|
|
|
163
188
|
"vite-tsconfig-paths": "^4.3.2"
|
|
164
189
|
},
|
|
165
190
|
"peerDependencies": {
|
|
166
|
-
"react": "
|
|
167
|
-
"react-dom": "
|
|
168
|
-
"react-is": "
|
|
169
|
-
"styled-components": "^6
|
|
191
|
+
"react": "^18",
|
|
192
|
+
"react-dom": "^18",
|
|
193
|
+
"react-is": "^18",
|
|
194
|
+
"styled-components": "^5.2 || ^6"
|
|
170
195
|
},
|
|
196
|
+
"packageManager": "pnpm@9.1.3",
|
|
171
197
|
"engines": {
|
|
172
198
|
"node": ">=14.0.0"
|
|
173
199
|
},
|
|
@@ -177,28 +203,9 @@
|
|
|
177
203
|
"esm.sh": {
|
|
178
204
|
"bundle": false
|
|
179
205
|
},
|
|
180
|
-
"
|
|
181
|
-
"
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
"cypress:dev": "run-p dev cypress:open",
|
|
185
|
-
"cypress:open": "cypress open",
|
|
186
|
-
"cypress:run": "cypress run",
|
|
187
|
-
"dev": "run-p storybook:dev workshop:dev",
|
|
188
|
-
"figma:pkg:build": "cd figma && pnpm build",
|
|
189
|
-
"format": "prettier --write --cache --ignore-unknown .",
|
|
190
|
-
"lint": "eslint . --ext .cjs,.js,.jsx,.mjs,.ts,.tsx",
|
|
191
|
-
"pkg:build": "pkg build --strict",
|
|
192
|
-
"pkg:check": "pkg --strict",
|
|
193
|
-
"release": "semantic-release",
|
|
194
|
-
"storybook:build": "storybook build",
|
|
195
|
-
"storybook:dev": "storybook dev -p 6006",
|
|
196
|
-
"test": "jest",
|
|
197
|
-
"test:browser": "start-server-and-test 'run-s workshop:build workshop:start' http://localhost:1337 'run-s cypress:run'",
|
|
198
|
-
"ts:check": "tsc",
|
|
199
|
-
"watch": "pkg watch --strict",
|
|
200
|
-
"workshop:build": "workshop build",
|
|
201
|
-
"workshop:dev": "workshop dev",
|
|
202
|
-
"workshop:start": "http-server -a localhost -c-0 -p 1337 -s -P http://localhost:1337/index.html? dist"
|
|
206
|
+
"pnpm": {
|
|
207
|
+
"overrides": {
|
|
208
|
+
"conventional-changelog-conventionalcommits": ">= 8.0.0"
|
|
209
|
+
}
|
|
203
210
|
}
|
|
204
|
-
}
|
|
211
|
+
}
|
|
@@ -12,5 +12,14 @@ export function useArrayProp<T extends ArrayPropPrimitive = ArrayPropPrimitive>(
|
|
|
12
12
|
val: T | T[] | undefined,
|
|
13
13
|
defaultVal?: T[],
|
|
14
14
|
): T[] {
|
|
15
|
-
|
|
15
|
+
// JSON.stringify is fast, but it's not faster than useMemo's referencial equality check
|
|
16
|
+
const __perf_hash__ = useMemo(() => JSON.stringify(val ?? defaultVal), [defaultVal, val])
|
|
17
|
+
|
|
18
|
+
return useMemo(
|
|
19
|
+
() => _getArrayProp(val, defaultVal),
|
|
20
|
+
|
|
21
|
+
// Improve performance: Keep object identify for a given hash of the value
|
|
22
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
23
|
+
[__perf_hash__],
|
|
24
|
+
)
|
|
16
25
|
}
|
|
@@ -12,6 +12,7 @@ export default function PropsStory() {
|
|
|
12
12
|
const as = useSelect('As', WORKSHOP_CARD_AS_OPTIONS, 'div', 'Props')
|
|
13
13
|
const border = useBoolean('Border', false, 'Props')
|
|
14
14
|
const checkered = useBoolean('Checkered', false, 'Props')
|
|
15
|
+
const muted = useBoolean('Muted', false, 'Props')
|
|
15
16
|
const padding = useSelect('Padding', WORKSHOP_SPACE_OPTIONS, 0, 'Props')
|
|
16
17
|
const radius = useSelect('Radius', WORKSHOP_RADIUS_OPTIONS, 0, 'Props')
|
|
17
18
|
const selected = useBoolean('Selected', false, 'Props')
|
|
@@ -24,6 +25,7 @@ export default function PropsStory() {
|
|
|
24
25
|
__unstable_checkered={checkered}
|
|
25
26
|
as={as}
|
|
26
27
|
border={border}
|
|
28
|
+
muted={muted}
|
|
27
29
|
onClick={useAction('onClick')}
|
|
28
30
|
padding={padding}
|
|
29
31
|
radius={radius}
|
|
@@ -36,6 +36,7 @@ export interface CardProps
|
|
|
36
36
|
* @beta
|
|
37
37
|
*/
|
|
38
38
|
__unstable_focusRing?: boolean
|
|
39
|
+
muted?: boolean
|
|
39
40
|
pressed?: boolean
|
|
40
41
|
scheme?: ThemeColorSchemeKey
|
|
41
42
|
tone?: CardTone
|
|
@@ -67,6 +68,7 @@ export const Card = forwardRef(function Card(
|
|
|
67
68
|
borderRight,
|
|
68
69
|
borderBottom,
|
|
69
70
|
borderLeft,
|
|
71
|
+
muted,
|
|
70
72
|
pressed,
|
|
71
73
|
radius = 0,
|
|
72
74
|
scheme,
|
|
@@ -96,6 +98,7 @@ export const Card = forwardRef(function Card(
|
|
|
96
98
|
$borderLeft={useArrayProp(borderLeft)}
|
|
97
99
|
$checkered={checkered}
|
|
98
100
|
$focusRing={focusRing}
|
|
101
|
+
$muted={muted}
|
|
99
102
|
$radius={useArrayProp(radius)}
|
|
100
103
|
$shadow={useArrayProp(shadow)}
|
|
101
104
|
$tone={tone}
|
|
@@ -49,7 +49,7 @@ export function cardBaseStyle(props: CardStyleProps & ThemeProps): ReturnType<ty
|
|
|
49
49
|
}
|
|
50
50
|
|
|
51
51
|
export function cardColorStyle(props: CardStyleProps & ThemeProps): ReturnType<typeof css> {
|
|
52
|
-
const {$checkered, $focusRing} = props
|
|
52
|
+
const {$checkered, $focusRing, $muted} = props
|
|
53
53
|
const {card, color, style} = getTheme_v2(props.theme)
|
|
54
54
|
const border = {width: card.border.width, color: 'var(--card-border-color)'}
|
|
55
55
|
|
|
@@ -58,7 +58,7 @@ export function cardColorStyle(props: CardStyleProps & ThemeProps): ReturnType<t
|
|
|
58
58
|
|
|
59
59
|
${_cardColorStyle(color, color, $checkered)}
|
|
60
60
|
|
|
61
|
-
background-color: var(--card-bg-color);
|
|
61
|
+
background-color: ${$muted ? 'var(--card-muted-bg-color)' : 'var(--card-bg-color)'};
|
|
62
62
|
color: var(--card-fg-color);
|
|
63
63
|
|
|
64
64
|
/* &:is(button) */
|