@sanity/ui 2.12.3 → 2.13.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sanity/ui",
3
- "version": "2.12.3",
3
+ "version": "2.13.0",
4
4
  "keywords": [
5
5
  "sanity",
6
6
  "ui",
@@ -120,14 +120,14 @@
120
120
  "@sanity/color": "^3.0.6",
121
121
  "@sanity/icons": "^3.5.7",
122
122
  "csstype": "^3.1.3",
123
- "framer-motion": "^12.4.1",
123
+ "framer-motion": "^12.4.2",
124
124
  "react-compiler-runtime": "19.0.0-beta-30d8a17-20250209",
125
125
  "react-refractor": "^2.2.0",
126
126
  "use-effect-event": "^1.0.2"
127
127
  },
128
128
  "devDependencies": {
129
- "@babel/core": "^7.26.7",
130
- "@babel/preset-env": "^7.26.7",
129
+ "@babel/core": "^7.26.8",
130
+ "@babel/preset-env": "^7.26.8",
131
131
  "@babel/preset-react": "^7.26.3",
132
132
  "@babel/preset-typescript": "^7.26.0",
133
133
  "@commitlint/cli": "^19.7.1",
@@ -135,21 +135,21 @@
135
135
  "@sanity/pkg-utils": "^6.13.4",
136
136
  "@sanity/prettier-config": "^1.0.3",
137
137
  "@sanity/semantic-release-preset": "^5.0.0",
138
- "@sanity/ui-workshop": "^2.0.26",
139
- "@storybook/addon-a11y": "^8.5.3",
140
- "@storybook/addon-docs": "^8.5.3",
141
- "@storybook/addon-essentials": "^8.5.3",
142
- "@storybook/addon-interactions": "^8.5.3",
143
- "@storybook/addon-links": "^8.5.3",
144
- "@storybook/addon-mdx-gfm": "^8.5.3",
145
- "@storybook/addon-storysource": "^8.5.3",
146
- "@storybook/addon-themes": "^8.5.3",
147
- "@storybook/blocks": "^8.5.3",
148
- "@storybook/manager-api": "^8.5.3",
149
- "@storybook/react": "^8.5.3",
150
- "@storybook/react-vite": "^8.5.3",
151
- "@storybook/test": "^8.5.3",
152
- "@storybook/theming": "^8.5.3",
138
+ "@sanity/ui-workshop": "^2.0.27",
139
+ "@storybook/addon-a11y": "^8.5.5",
140
+ "@storybook/addon-docs": "^8.5.5",
141
+ "@storybook/addon-essentials": "^8.5.5",
142
+ "@storybook/addon-interactions": "^8.5.5",
143
+ "@storybook/addon-links": "^8.5.5",
144
+ "@storybook/addon-mdx-gfm": "^8.5.5",
145
+ "@storybook/addon-storysource": "^8.5.5",
146
+ "@storybook/addon-themes": "^8.5.5",
147
+ "@storybook/blocks": "^8.5.5",
148
+ "@storybook/manager-api": "^8.5.5",
149
+ "@storybook/react": "^8.5.5",
150
+ "@storybook/react-vite": "^8.5.5",
151
+ "@storybook/test": "^8.5.5",
152
+ "@storybook/theming": "^8.5.5",
153
153
  "@testing-library/dom": "^10.4.0",
154
154
  "@testing-library/jest-dom": "^6.6.3",
155
155
  "@testing-library/react": "^16.2.0",
@@ -177,7 +177,7 @@
177
177
  "eslint-plugin-jsx-a11y": "^6.10.2",
178
178
  "eslint-plugin-react": "^7.37.4",
179
179
  "eslint-plugin-react-compiler": "19.0.0-beta-30d8a17-20250209",
180
- "eslint-plugin-react-hooks": "^5.1.0",
180
+ "eslint-plugin-react-hooks": "experimental",
181
181
  "eslint-plugin-storybook": "^0.11.2",
182
182
  "http-server": "^14.1.1",
183
183
  "husky": "^8.0.3",
@@ -187,15 +187,15 @@
187
187
  "lint-staged": "^14.0.1",
188
188
  "module-alias": "^2.2.3",
189
189
  "npm-run-all2": "^5.0.2",
190
- "prettier": "^3.4.2",
190
+ "prettier": "^3.5.0",
191
191
  "react": "^19.0.0",
192
192
  "react-dom": "^19.0.0",
193
193
  "react-is": "^19.0.0",
194
194
  "refractor": "^4.8.1",
195
195
  "rimraf": "^5.0.5",
196
- "semantic-release": "^24.2.1",
196
+ "semantic-release": "^24.2.2",
197
197
  "start-server-and-test": "^2.0.10",
198
- "storybook": "^8.5.3",
198
+ "storybook": "^8.5.5",
199
199
  "styled-components": "^6.1.15",
200
200
  "tsconfig-paths": "^4.2.0",
201
201
  "typescript": "5.7.3",
@@ -265,10 +265,11 @@ export const WORKSHOP_TEXT_SIZE_OPTIONS = {
265
265
  }
266
266
 
267
267
  export const WORKSHOP_TEXT_WEIGHT_OPTIONS: {[key: string]: ThemeFontWeightKey | ''} = {
268
- Regular: '',
269
- Medium: 'medium',
270
- Semibold: 'semibold',
271
- Bold: 'bold',
268
+ '(none)': '',
269
+ 'Regular': 'regular',
270
+ 'Medium': 'medium',
271
+ 'Semibold': 'semibold',
272
+ 'Bold': 'bold',
272
273
  }
273
274
 
274
275
  export const WORKSHOP_TOAST_STATUS_OPTIONS: {
@@ -66,7 +66,7 @@ export function useClickOutsideEvent(
66
66
  return () => {
67
67
  document.removeEventListener('mousedown', handleEvent)
68
68
  }
69
- }, [hasListener, onEvent])
69
+ }, [hasListener])
70
70
 
71
71
  useDebugValue(listener ? 'MouseDown On' : 'MouseDown Off')
72
72
  }
@@ -13,5 +13,5 @@ export function useGlobalKeyDown(onKeyDown: (event: KeyboardEvent) => void): voi
13
13
  window.addEventListener('keydown', handler)
14
14
 
15
15
  return () => window.removeEventListener('keydown', handler)
16
- }, [handleKeyDown])
16
+ }, [])
17
17
  }
@@ -9,6 +9,7 @@ import {
9
9
  WORKSHOP_ICON_SYMBOL_OPTIONS,
10
10
  WORKSHOP_TEXT_SIZE_OPTIONS,
11
11
  WORKSHOP_SPACE_OPTIONS,
12
+ WORKSHOP_TEXT_WEIGHT_OPTIONS,
12
13
  } from '../../../__workshop__/constants'
13
14
 
14
15
  export default function ButtonStory() {
@@ -26,6 +27,8 @@ export default function ButtonStory() {
26
27
  const textAlign =
27
28
  useSelect('Text align', WORKSHOP_BUTTON_TEXT_ALIGN_OPTIONS, undefined, 'Props') || undefined
28
29
  const textProp = useText('Text', 'Label', 'Props')
30
+ const textWeight =
31
+ useSelect('Text weight', WORKSHOP_TEXT_WEIGHT_OPTIONS, '', 'Props') || undefined
29
32
 
30
33
  return (
31
34
  <Flex align="center" height="fill" justify="center">
@@ -43,6 +46,7 @@ export default function ButtonStory() {
43
46
  space={space}
44
47
  textAlign={textAlign}
45
48
  text={textProp}
49
+ textWeight={textWeight}
46
50
  tone={tone}
47
51
  />
48
52
  </Flex>
@@ -1,3 +1,4 @@
1
+ import {ThemeFontWeightKey} from '@sanity/ui/theme'
1
2
  import {forwardRef, isValidElement, useMemo} from 'react'
2
3
  import {isValidElementType} from 'react-is'
3
4
  import {styled} from 'styled-components'
@@ -29,9 +30,10 @@ export interface ButtonProps extends ResponsivePaddingProps, ResponsiveRadiusPro
29
30
  loading?: boolean
30
31
  selected?: boolean
31
32
  space?: number | number[]
32
- textAlign?: ButtonTextAlign
33
33
  muted?: boolean
34
34
  text?: React.ReactNode
35
+ textAlign?: ButtonTextAlign
36
+ textWeight?: ThemeFontWeightKey
35
37
  tone?: ButtonTone
36
38
  type?: 'button' | 'reset' | 'submit'
37
39
  width?: ButtonWidth
@@ -85,6 +87,7 @@ export const Button = forwardRef(function Button(
85
87
  space: spaceProp = 3,
86
88
  text,
87
89
  textAlign,
90
+ textWeight,
88
91
  tone = 'default',
89
92
  type = 'button',
90
93
  muted = false,
@@ -155,7 +158,7 @@ export const Button = forwardRef(function Button(
155
158
  align={textAlign}
156
159
  size={fontSize}
157
160
  textOverflow="ellipsis"
158
- weight={button.textWeight}
161
+ weight={textWeight ?? button.textWeight}
159
162
  >
160
163
  {text}
161
164
  </Text>
@@ -449,5 +449,5 @@ function useCloseOnMouseLeave({
449
449
  window.addEventListener('mousemove', handleMouseMove)
450
450
 
451
451
  return () => window.removeEventListener('mousemove', handleMouseMove)
452
- }, [onMouseMove, showTooltip])
452
+ }, [showTooltip])
453
453
  }