@sanity/ui 2.12.4 → 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/dist/_chunks-cjs/_visual-editing.js +13 -12
- package/dist/_chunks-cjs/_visual-editing.js.map +1 -1
- package/dist/_chunks-es/_visual-editing.mjs +13 -12
- package/dist/_chunks-es/_visual-editing.mjs.map +1 -1
- package/dist/_legacy/_visual-editing.esm.js +13 -12
- package/dist/_legacy/_visual-editing.esm.js.map +1 -1
- package/dist/_visual-editing.d.mts +2 -1
- package/dist/_visual-editing.d.ts +2 -1
- package/dist/index.d.mts +2 -1
- package/dist/index.d.ts +2 -1
- package/package.json +1 -1
- package/src/core/__workshop__/constants.ts +5 -4
- package/src/core/primitives/button/__workshop__/props.tsx +4 -0
- package/src/core/primitives/button/button.tsx +5 -2
|
@@ -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
|
@@ -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
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
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>
|