@sanity/ui 2.12.4 → 2.13.1

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.
@@ -90,9 +90,10 @@ declare interface ButtonProps extends ResponsivePaddingProps, ResponsiveRadiusPr
90
90
  loading?: boolean
91
91
  selected?: boolean
92
92
  space?: number | number[]
93
- textAlign?: ButtonTextAlign
94
93
  muted?: boolean
95
94
  text?: React.ReactNode
95
+ textAlign?: ButtonTextAlign
96
+ textWeight?: ThemeFontWeightKey
96
97
  tone?: ButtonTone
97
98
  type?: 'button' | 'reset' | 'submit'
98
99
  width?: ButtonWidth
@@ -90,9 +90,10 @@ declare interface ButtonProps extends ResponsivePaddingProps, ResponsiveRadiusPr
90
90
  loading?: boolean
91
91
  selected?: boolean
92
92
  space?: number | number[]
93
- textAlign?: ButtonTextAlign
94
93
  muted?: boolean
95
94
  text?: React.ReactNode
95
+ textAlign?: ButtonTextAlign
96
+ textWeight?: ThemeFontWeightKey
96
97
  tone?: ButtonTone
97
98
  type?: 'button' | 'reset' | 'submit'
98
99
  width?: ButtonWidth
package/dist/index.d.mts CHANGED
@@ -537,9 +537,10 @@ export declare interface ButtonProps extends ResponsivePaddingProps, ResponsiveR
537
537
  loading?: boolean
538
538
  selected?: boolean
539
539
  space?: number | number[]
540
- textAlign?: ButtonTextAlign
541
540
  muted?: boolean
542
541
  text?: React.ReactNode
542
+ textAlign?: ButtonTextAlign
543
+ textWeight?: ThemeFontWeightKey_2
543
544
  tone?: ButtonTone
544
545
  type?: 'button' | 'reset' | 'submit'
545
546
  width?: ButtonWidth
package/dist/index.d.ts CHANGED
@@ -537,9 +537,10 @@ export declare interface ButtonProps extends ResponsivePaddingProps, ResponsiveR
537
537
  loading?: boolean
538
538
  selected?: boolean
539
539
  space?: number | number[]
540
- textAlign?: ButtonTextAlign
541
540
  muted?: boolean
542
541
  text?: React.ReactNode
542
+ textAlign?: ButtonTextAlign
543
+ textWeight?: ThemeFontWeightKey_2
543
544
  tone?: ButtonTone
544
545
  type?: 'button' | 'reset' | 'submit'
545
546
  width?: ButtonWidth
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sanity/ui",
3
- "version": "2.12.4",
3
+ "version": "2.13.1",
4
4
  "keywords": [
5
5
  "sanity",
6
6
  "ui",
@@ -120,7 +120,7 @@
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.2",
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"
@@ -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: {
@@ -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>