@sanity/ui 4.0.0-static.15 → 4.0.0-static.17
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/css/index.css +1 -1
- package/dist/css/index.css.map +1 -1
- package/dist/css/index.d.ts +4 -0
- package/dist/css/index.js +5986 -5974
- package/dist/css/index.js.map +1 -1
- package/dist/index.js +9 -10
- package/dist/index.js.map +1 -1
- package/package.json +6 -15
- package/src/core/components/autocomplete/__workshop__/custom.tsx +14 -1
- package/src/core/components/autocomplete/__workshop__/example.tsx +12 -1
- package/src/core/components/dialog/__workshop__/position.tsx +9 -1
- package/src/core/components/dialog/__workshop__/props.tsx +2 -0
- package/src/core/components/menu/__workshop__/menuButton.tsx +6 -1
- package/src/core/components/menu/__workshop__/tones.tsx +7 -1
- package/src/core/components/toast/__workshop__/toast.tsx +2 -0
- package/src/core/primitives/avatar/__workshop__/asButton.tsx +8 -1
- package/src/core/primitives/avatar/__workshop__/stack.tsx +5 -1
- package/src/core/primitives/badge/__workshop__/props.tsx +12 -1
- package/src/core/primitives/box/__workshop__/props.tsx +6 -1
- package/src/core/primitives/button/__workshop__/props.tsx +22 -0
- package/src/core/primitives/button/__workshop__/stacked.tsx +16 -0
- package/src/core/primitives/card/__workshop__/props.tsx +10 -0
- package/src/core/primitives/card/__workshop__/selected.tsx +1 -1
- package/src/core/primitives/card/card.tsx +2 -2
- package/src/core/primitives/code/__workshop__/props.tsx +6 -1
- package/src/core/primitives/container/__workshop__/example.tsx +6 -1
- package/src/core/primitives/flex/__workshop__/example.tsx +7 -1
- package/src/core/primitives/heading/__workshop__/plain.tsx +12 -1
- package/src/core/primitives/inline/__workshop__/plain.tsx +5 -1
- package/src/core/primitives/label/__workshop__/plain.tsx +15 -1
- package/src/core/primitives/popover/__workshop__/AlignedStory.tsx +13 -1
- package/src/core/primitives/popover/__workshop__/MatchReferenceWidthStory.tsx +2 -0
- package/src/core/primitives/popover/__workshop__/PlainStory.tsx +8 -0
- package/src/core/primitives/popover/__workshop__/SidePanelStory.tsx +7 -1
- package/src/core/primitives/popover/__workshop__/TestStory.tsx +6 -0
- package/src/core/primitives/select/__workshop__/plain.tsx +4 -0
- package/src/core/primitives/skeleton/__workshop__/delay.tsx +9 -1
- package/src/core/primitives/skeleton/__workshop__/skeleton.tsx +9 -1
- package/src/core/primitives/spinner/__workshop__/Props.tsx +6 -1
- package/src/core/primitives/stack/__workshop__/plain.tsx +4 -1
- package/src/core/primitives/text/__workshop__/colored.tsx +8 -1
- package/src/core/primitives/text/__workshop__/example.tsx +15 -1
- package/src/core/primitives/textArea/__workshop__/plain.tsx +8 -0
- package/src/core/primitives/textInput/__workshop__/plain.tsx +34 -4
- package/src/core/primitives/textInput/__workshop__/typed.tsx +7 -1
- package/src/core/primitives/tooltip/__workshop__/customPortal.tsx +2 -0
- package/src/core/primitives/tooltip/__workshop__/overflowingBoundary.tsx +2 -0
- package/src/core/primitives/tooltip/__workshop__/props.tsx +12 -0
- package/src/core/primitives/tooltip/__workshop__/resizableBoundary.tsx +5 -0
- package/src/css/primitives/card/__workshop__/color.tsx +9 -1
- package/src/css/primitives/card/card.css.ts +10 -0
- package/src/css/theme/buildCSSTheme.ts +4 -0
- package/src/css/types.ts +4 -0
- package/src/css/vars.css.ts +4 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sanity/ui",
|
|
3
|
-
"version": "4.0.0-static.
|
|
3
|
+
"version": "4.0.0-static.17",
|
|
4
4
|
"keywords": [
|
|
5
5
|
"react",
|
|
6
6
|
"ui",
|
|
@@ -132,10 +132,10 @@
|
|
|
132
132
|
"@commitlint/config-conventional": "^19.8.1",
|
|
133
133
|
"@eslint/js": "^9.32.0",
|
|
134
134
|
"@sanity/browserslist-config": "^1.0.5",
|
|
135
|
-
"@sanity/pkg-utils": "^7.
|
|
135
|
+
"@sanity/pkg-utils": "^7.11.1",
|
|
136
136
|
"@sanity/prettier-config": "^2.0.1",
|
|
137
137
|
"@sanity/semantic-release-preset": "^5.0.0",
|
|
138
|
-
"@sanity/ui-workshop": "
|
|
138
|
+
"@sanity/ui-workshop": "4.0.0-static.6",
|
|
139
139
|
"@testing-library/dom": "^10.4.1",
|
|
140
140
|
"@testing-library/jest-dom": "^6.6.4",
|
|
141
141
|
"@testing-library/react": "^16.3.0",
|
|
@@ -148,13 +148,10 @@
|
|
|
148
148
|
"@vanilla-extract/vite-plugin": "^5.1.1",
|
|
149
149
|
"@vitejs/plugin-react": "^4.7.0",
|
|
150
150
|
"@vitest/browser": "^3.2.4",
|
|
151
|
-
"autoprefixer": "^10.4.21",
|
|
152
151
|
"babel-plugin-react-compiler": "19.1.0-rc.2",
|
|
153
|
-
"browserslist": "^
|
|
154
|
-
"browserslist-config-baseline": "^0.4.0",
|
|
152
|
+
"browserslist-config-baseline": "^0.5.0",
|
|
155
153
|
"cac": "^6.7.14",
|
|
156
154
|
"commitizen": "^4.3.1",
|
|
157
|
-
"cssnano": "^7.1.0",
|
|
158
155
|
"cypress": "^13.17.0",
|
|
159
156
|
"cypress-real-events": "^1.14.0",
|
|
160
157
|
"cz-conventional-changelog": "^3.3.0",
|
|
@@ -166,19 +163,17 @@
|
|
|
166
163
|
"eslint-plugin-import": "^2.32.0",
|
|
167
164
|
"eslint-plugin-jsx-a11y": "^6.10.2",
|
|
168
165
|
"eslint-plugin-react": "^7.37.5",
|
|
169
|
-
"eslint-plugin-react-
|
|
166
|
+
"eslint-plugin-react-compiler": "19.1.0-rc.2",
|
|
167
|
+
"eslint-plugin-react-hooks": "0.0.0-experimental-66f09bd0-20250806",
|
|
170
168
|
"eslint-plugin-react-refresh": "^0.4.20",
|
|
171
169
|
"eslint-plugin-simple-import-sort": "^12.1.1",
|
|
172
170
|
"eslint-plugin-storybook": "^9.1.1",
|
|
173
171
|
"globals": "^16.3.0",
|
|
174
172
|
"husky": "^8.0.3",
|
|
175
173
|
"jsdom": "^26.1.0",
|
|
176
|
-
"lightningcss": "^1.30.1",
|
|
177
174
|
"lint-staged": "^14.0.1",
|
|
178
175
|
"mkdirp": "^3.0.1",
|
|
179
176
|
"npm-run-all2": "^8.0.4",
|
|
180
|
-
"postcss": "^8.5.6",
|
|
181
|
-
"postcss-preset-env": "^10.2.4",
|
|
182
177
|
"prettier": "^3.6.2",
|
|
183
178
|
"prettier-plugin-packagejson": "^2.5.19",
|
|
184
179
|
"react": "^19.1.1",
|
|
@@ -214,7 +209,6 @@
|
|
|
214
209
|
"cypress"
|
|
215
210
|
],
|
|
216
211
|
"overrides": {
|
|
217
|
-
"@sanity/ui-workshop": "file:registry/sanity-ui-workshop-3.0.0-local.12.tgz",
|
|
218
212
|
"@types/react": "$@types/react",
|
|
219
213
|
"@types/react-dom": "$@types/react-dom",
|
|
220
214
|
"@types/react-is": "$@types/react-is",
|
|
@@ -222,9 +216,6 @@
|
|
|
222
216
|
"react": "$react",
|
|
223
217
|
"react-dom": "$react-dom",
|
|
224
218
|
"react-is": "$react-is"
|
|
225
|
-
},
|
|
226
|
-
"patchedDependencies": {
|
|
227
|
-
"@vanilla-extract/rollup-plugin": "patches/@vanilla-extract__rollup-plugin.patch"
|
|
228
219
|
}
|
|
229
220
|
},
|
|
230
221
|
"esm.sh": {
|
|
@@ -16,9 +16,12 @@ export default function CustomStory(): React.JSX.Element {
|
|
|
16
16
|
const data: ExampleOption[] = countries.map((d) => ({value: d.code, title: d.name}))
|
|
17
17
|
const border = useBoolean('Border', true)
|
|
18
18
|
const disabled = useBoolean('Disabled', false)
|
|
19
|
+
// @ts-expect-error - TODO: fix this
|
|
19
20
|
const fontSize = useSelect('Font size', WORKSHOP_TEXT_FONT_SIZE_OPTIONS, 2)
|
|
20
21
|
const openButton = useBoolean('Open button', true)
|
|
22
|
+
// @ts-expect-error - TODO: fix this
|
|
21
23
|
const padding = useSelect('Padding', WORKSHOP_SPACE_OPTIONS, 3)
|
|
24
|
+
// @ts-expect-error - TODO: fix this
|
|
22
25
|
const radius = useSelect('Radius', WORKSHOP_RADIUS_OPTIONS, 2)
|
|
23
26
|
const readOnly = useBoolean('Read only', false)
|
|
24
27
|
const [value, setValue] = useState('')
|
|
@@ -31,10 +34,17 @@ export default function CustomStory(): React.JSX.Element {
|
|
|
31
34
|
href="#"
|
|
32
35
|
key={option.value}
|
|
33
36
|
onClick={(event) => event.preventDefault()}
|
|
37
|
+
// @ts-expect-error - TODO: fix this
|
|
34
38
|
padding={padding}
|
|
39
|
+
// @ts-expect-error - TODO: fix this
|
|
35
40
|
radius={Math.max((radius ?? 0) - 1, 0) as Radius}
|
|
36
41
|
>
|
|
37
|
-
<Text
|
|
42
|
+
<Text
|
|
43
|
+
// @ts-expect-error - TODO: fix this
|
|
44
|
+
size={fontSize}
|
|
45
|
+
>
|
|
46
|
+
{option.title}
|
|
47
|
+
</Text>
|
|
38
48
|
</Card>
|
|
39
49
|
),
|
|
40
50
|
[fontSize, padding, radius],
|
|
@@ -63,13 +73,16 @@ export default function CustomStory(): React.JSX.Element {
|
|
|
63
73
|
border={border}
|
|
64
74
|
disabled={disabled}
|
|
65
75
|
filterOption={filterOption}
|
|
76
|
+
// @ts-expect-error - TODO: fix this
|
|
66
77
|
fontSize={fontSize}
|
|
67
78
|
id="custom"
|
|
68
79
|
onChange={setValue}
|
|
69
80
|
openButton={openButton}
|
|
70
81
|
options={options}
|
|
82
|
+
// @ts-expect-error - TODO: fix this
|
|
71
83
|
padding={padding}
|
|
72
84
|
placeholder="Search"
|
|
85
|
+
// @ts-expect-error - TODO: fix this
|
|
73
86
|
radius={radius}
|
|
74
87
|
readOnly={readOnly}
|
|
75
88
|
renderOption={renderOption}
|
|
@@ -32,14 +32,18 @@ const typingPerfTest: PerfTestProps<HTMLInputElement> = {
|
|
|
32
32
|
export default function ExampleStory(): React.JSX.Element {
|
|
33
33
|
const {ref, Wrapper} = usePerfTest(typingPerfTest)
|
|
34
34
|
|
|
35
|
+
// @ts-expect-error - TODO: fix this
|
|
35
36
|
const layoutTone = useSelect('Layout tone', WORKSHOP_CARD_TONE_OPTIONS)
|
|
36
37
|
const options = useMemo(() => countries.map((country) => ({value: country.code})), [])
|
|
37
38
|
const border = useBoolean('Border', true)
|
|
38
39
|
const customValidity = useText('Custom validity')
|
|
39
40
|
const disabled = useBoolean('Disabled', false)
|
|
41
|
+
// @ts-expect-error - TODO: fix this
|
|
40
42
|
const fontSize = useSelect('Font size', WORKSHOP_TEXT_FONT_SIZE_OPTIONS)
|
|
41
43
|
const openButton = useBoolean('Open button', false)
|
|
44
|
+
// @ts-expect-error - TODO: fix this
|
|
42
45
|
const padding = useSelect('Padding', WORKSHOP_SPACE_OPTIONS, 3)
|
|
46
|
+
// @ts-expect-error - TODO: fix this
|
|
43
47
|
const radius = useSelect('Radius', WORKSHOP_RADIUS_OPTIONS, 2)
|
|
44
48
|
const readOnly = useBoolean('Read only', false)
|
|
45
49
|
const [value, setValue] = useState('')
|
|
@@ -47,7 +51,11 @@ export default function ExampleStory(): React.JSX.Element {
|
|
|
47
51
|
const handleChange = useCallback((value: string) => setValue(value), [])
|
|
48
52
|
|
|
49
53
|
return (
|
|
50
|
-
<Card
|
|
54
|
+
<Card
|
|
55
|
+
height="fill"
|
|
56
|
+
// @ts-expect-error - TODO: fix this
|
|
57
|
+
tone={layoutTone}
|
|
58
|
+
>
|
|
51
59
|
<Container width={1}>
|
|
52
60
|
<Box paddingX={[4, 5, 6]} paddingY={[5, 6, 7]}>
|
|
53
61
|
<Stack gap={3}>
|
|
@@ -59,13 +67,16 @@ export default function ExampleStory(): React.JSX.Element {
|
|
|
59
67
|
border={border}
|
|
60
68
|
customValidity={customValidity}
|
|
61
69
|
disabled={disabled}
|
|
70
|
+
// @ts-expect-error - TODO: fix this
|
|
62
71
|
fontSize={fontSize}
|
|
63
72
|
onChange={handleChange}
|
|
64
73
|
id="default"
|
|
65
74
|
openButton={openButton}
|
|
66
75
|
options={options}
|
|
76
|
+
// @ts-expect-error - TODO: fix this
|
|
67
77
|
padding={padding}
|
|
68
78
|
placeholder="Search"
|
|
79
|
+
// @ts-expect-error - TODO: fix this
|
|
69
80
|
radius={radius}
|
|
70
81
|
readOnly={readOnly}
|
|
71
82
|
ref={ref}
|
|
@@ -6,6 +6,7 @@ import {WORKSHOP_DIALOG_POSITION_OPTIONS} from '$workshop'
|
|
|
6
6
|
|
|
7
7
|
export default function PositionStory(): React.JSX.Element {
|
|
8
8
|
const open = useBoolean('Open', true)
|
|
9
|
+
// @ts-expect-error - TODO: fix this
|
|
9
10
|
const position = useSelect('Position', WORKSHOP_DIALOG_POSITION_OPTIONS)
|
|
10
11
|
|
|
11
12
|
return (
|
|
@@ -22,7 +23,14 @@ export default function PositionStory(): React.JSX.Element {
|
|
|
22
23
|
</Stack>
|
|
23
24
|
|
|
24
25
|
<LayerProvider>
|
|
25
|
-
{open &&
|
|
26
|
+
{open && (
|
|
27
|
+
<Dialog
|
|
28
|
+
header="Position example"
|
|
29
|
+
id="position-example"
|
|
30
|
+
// @ts-expect-error - TODO: fix this
|
|
31
|
+
position={position}
|
|
32
|
+
/>
|
|
33
|
+
)}
|
|
26
34
|
</LayerProvider>
|
|
27
35
|
</Box>
|
|
28
36
|
</Box>
|
|
@@ -9,6 +9,7 @@ export default function PropsStory(): React.JSX.Element {
|
|
|
9
9
|
const header = useText('Header', 'Props example')
|
|
10
10
|
const onClickOutside = useBoolean('Close when click outside', false)
|
|
11
11
|
const hideCloseButton = useBoolean('Hide close button', false)
|
|
12
|
+
// @ts-expect-error - TODO: fix this
|
|
12
13
|
const width = useSelect('Width', WORKSHOP_CONTAINER_WIDTH_OPTIONS)
|
|
13
14
|
const [open, setOpen] = useState(false)
|
|
14
15
|
const buttonRef = useRef<HTMLButtonElement | null>(null)
|
|
@@ -37,6 +38,7 @@ export default function PropsStory(): React.JSX.Element {
|
|
|
37
38
|
onClickOutside={onClickOutside ? handleClose : undefined}
|
|
38
39
|
onClose={handleClose}
|
|
39
40
|
open={open}
|
|
41
|
+
// @ts-expect-error - TODO: fix this
|
|
40
42
|
width={width}
|
|
41
43
|
>
|
|
42
44
|
<Box padding={4}>
|
|
@@ -17,6 +17,7 @@ import {useMemo} from 'react'
|
|
|
17
17
|
import {WORKSHOP_CARD_TONE_OPTIONS} from '$workshop'
|
|
18
18
|
|
|
19
19
|
export default function MenuButtonStory(): React.JSX.Element {
|
|
20
|
+
// @ts-expect-error - TODO: fix this
|
|
20
21
|
const layoutTone = useSelect('Layout tone', WORKSHOP_CARD_TONE_OPTIONS, 'default')
|
|
21
22
|
const portal = useBoolean('Portal', false)
|
|
22
23
|
|
|
@@ -29,7 +30,11 @@ export default function MenuButtonStory(): React.JSX.Element {
|
|
|
29
30
|
)
|
|
30
31
|
|
|
31
32
|
return (
|
|
32
|
-
<Card
|
|
33
|
+
<Card
|
|
34
|
+
height="fill"
|
|
35
|
+
// @ts-expect-error - TODO: fix this
|
|
36
|
+
tone={layoutTone}
|
|
37
|
+
>
|
|
33
38
|
<Box padding={[4, 5, 6]}>
|
|
34
39
|
<Grid gridTemplateColumns={3} gap={2}>
|
|
35
40
|
<Button id="prev-button" mode="ghost" text="Prev" />
|
|
@@ -7,12 +7,18 @@ import {WORKSHOP_CARD_TONE_OPTIONS} from '$workshop'
|
|
|
7
7
|
|
|
8
8
|
export default function TonesStory(): React.JSX.Element {
|
|
9
9
|
const disabled = useBoolean('Disabled', false)
|
|
10
|
+
// @ts-expect-error - TODO: fix this
|
|
10
11
|
const parentTone = useSelect('Parent tone', WORKSHOP_CARD_TONE_OPTIONS, 'default')
|
|
11
12
|
|
|
12
13
|
return (
|
|
13
14
|
<LayerProvider>
|
|
14
15
|
<Box padding={[4, 5, 6]}>
|
|
15
|
-
<Card
|
|
16
|
+
<Card
|
|
17
|
+
radius={3}
|
|
18
|
+
shadow={3}
|
|
19
|
+
// @ts-expect-error - TODO: fix this
|
|
20
|
+
tone={parentTone}
|
|
21
|
+
>
|
|
16
22
|
<Menu>
|
|
17
23
|
{ELEMENT_TONES.map((tone) => (
|
|
18
24
|
<MenuItem disabled={disabled} icon={CubeIcon} key={tone} text={tone} tone={tone} />
|
|
@@ -6,6 +6,7 @@ import {WORKSHOP_TOAST_STATUS_OPTIONS} from '$workshop'
|
|
|
6
6
|
export default function ToastStory(): React.JSX.Element {
|
|
7
7
|
const closable = useBoolean('Closable', false)
|
|
8
8
|
const title = useString('Title', 'Toast title')
|
|
9
|
+
// @ts-expect-error - TODO: fix this
|
|
9
10
|
const status = useSelect('Status', WORKSHOP_TOAST_STATUS_OPTIONS)
|
|
10
11
|
const description = useText('Description')
|
|
11
12
|
const handleClose = useAction('onClose')
|
|
@@ -17,6 +18,7 @@ export default function ToastStory(): React.JSX.Element {
|
|
|
17
18
|
closable={closable}
|
|
18
19
|
description={description}
|
|
19
20
|
onClose={handleClose}
|
|
21
|
+
// @ts-expect-error - TODO: fix this
|
|
20
22
|
status={status}
|
|
21
23
|
title={title}
|
|
22
24
|
/>
|
|
@@ -4,11 +4,18 @@ import {useSelect} from '@sanity/ui-workshop'
|
|
|
4
4
|
import {WORKSHOP_AVATAR_SIZE_OPTIONS} from '$workshop'
|
|
5
5
|
|
|
6
6
|
export default function AsButtonStory(): React.JSX.Element {
|
|
7
|
+
// @ts-expect-error - TODO: fix this
|
|
7
8
|
const size = useSelect('Size', WORKSHOP_AVATAR_SIZE_OPTIONS, 1)
|
|
8
9
|
|
|
9
10
|
return (
|
|
10
11
|
<Flex align="center" height="fill" justify="center">
|
|
11
|
-
<Avatar
|
|
12
|
+
<Avatar
|
|
13
|
+
as="button"
|
|
14
|
+
color="purple"
|
|
15
|
+
initials="uq"
|
|
16
|
+
// @ts-expect-error - TODO: fix this
|
|
17
|
+
size={size}
|
|
18
|
+
/>
|
|
12
19
|
</Flex>
|
|
13
20
|
)
|
|
14
21
|
}
|
|
@@ -4,11 +4,15 @@ import {useSelect} from '@sanity/ui-workshop'
|
|
|
4
4
|
import {WORKSHOP_AVATAR_SIZE_OPTIONS} from '$workshop'
|
|
5
5
|
|
|
6
6
|
export default function StackStory(): React.JSX.Element {
|
|
7
|
+
// @ts-expect-error - TODO: fix this
|
|
7
8
|
const size = useSelect('Size', WORKSHOP_AVATAR_SIZE_OPTIONS, 1)
|
|
8
9
|
|
|
9
10
|
return (
|
|
10
11
|
<Flex align="center" height="fill" justify="center">
|
|
11
|
-
<AvatarStack
|
|
12
|
+
<AvatarStack
|
|
13
|
+
// @ts-expect-error - TODO: fix this
|
|
14
|
+
size={size}
|
|
15
|
+
>
|
|
12
16
|
<AvatarCounter count={2} />
|
|
13
17
|
<Avatar color="magenta" initials="uq" />
|
|
14
18
|
<Avatar
|
|
@@ -4,14 +4,25 @@ import {useAction, useSelect, useText} from '@sanity/ui-workshop'
|
|
|
4
4
|
import {WORKSHOP_BADGE_TONE_OPTIONS, WORKSHOP_SPACE_OPTIONS} from '$workshop'
|
|
5
5
|
|
|
6
6
|
export default function PropsStory(): React.JSX.Element {
|
|
7
|
+
// @ts-expect-error - TODO: fix this
|
|
7
8
|
const paddingX = useSelect('Padding X', WORKSHOP_SPACE_OPTIONS, 1)
|
|
9
|
+
// @ts-expect-error - TODO: fix this
|
|
8
10
|
const paddingY = useSelect('Padding Y', WORKSHOP_SPACE_OPTIONS, 1)
|
|
11
|
+
// @ts-expect-error - TODO: fix this
|
|
9
12
|
const tone = useSelect('Tone', WORKSHOP_BADGE_TONE_OPTIONS, 'default')
|
|
10
13
|
const textProp = useText('Text', 'Label')
|
|
11
14
|
|
|
12
15
|
return (
|
|
13
16
|
<Flex align="center" height="fill" justify="center">
|
|
14
|
-
<Badge
|
|
17
|
+
<Badge
|
|
18
|
+
onClick={useAction('onClick')}
|
|
19
|
+
// @ts-expect-error - TODO: fix this
|
|
20
|
+
paddingX={paddingX}
|
|
21
|
+
// @ts-expect-error - TODO: fix this
|
|
22
|
+
paddingY={paddingY}
|
|
23
|
+
// @ts-expect-error - TODO: fix this
|
|
24
|
+
tone={tone}
|
|
25
|
+
>
|
|
15
26
|
{textProp}
|
|
16
27
|
</Badge>
|
|
17
28
|
</Flex>
|
|
@@ -4,12 +4,17 @@ import {useAction, useSelect} from '@sanity/ui-workshop'
|
|
|
4
4
|
import {WORKSHOP_SPACE_OPTIONS} from '$workshop'
|
|
5
5
|
|
|
6
6
|
export default function PropsStory(): React.JSX.Element {
|
|
7
|
+
// @ts-expect-error - TODO: fix this
|
|
7
8
|
const padding = useSelect('Padding', WORKSHOP_SPACE_OPTIONS, 0)
|
|
8
9
|
|
|
9
10
|
return (
|
|
10
11
|
<Box padding={[4, 5, 6]}>
|
|
11
12
|
<Card border tone="inherit">
|
|
12
|
-
<Box
|
|
13
|
+
<Box
|
|
14
|
+
onClick={useAction('onClick')}
|
|
15
|
+
// @ts-expect-error - TODO: fix this
|
|
16
|
+
padding={padding}
|
|
17
|
+
>
|
|
13
18
|
<Text>
|
|
14
19
|
Box with <code>padding={padding}</code>
|
|
15
20
|
</Text>
|
|
@@ -15,39 +15,61 @@ import {
|
|
|
15
15
|
|
|
16
16
|
export default function ButtonStory(): React.JSX.Element {
|
|
17
17
|
const disabled = useBoolean('Disabled')
|
|
18
|
+
// @ts-expect-error - TODO: fix this
|
|
18
19
|
const fontSize = useSelect('Font size', WORKSHOP_TEXT_FONT_SIZE_OPTIONS)
|
|
20
|
+
// @ts-expect-error - TODO: fix this
|
|
19
21
|
const gap = useSelect('Gap', WORKSHOP_SPACE_OPTIONS)
|
|
22
|
+
// @ts-expect-error - TODO: fix this
|
|
20
23
|
const icon = useSelect('Icon', WORKSHOP_ICON_SYMBOL_OPTIONS)
|
|
24
|
+
// @ts-expect-error - TODO: fix this
|
|
21
25
|
const iconRight = useSelect('Icon (right)', WORKSHOP_ICON_SYMBOL_OPTIONS)
|
|
26
|
+
// @ts-expect-error - TODO: fix this
|
|
22
27
|
const justify = useSelect('Justify', WORKSHOP_FLEX_JUSTIFY_OPTIONS)
|
|
23
28
|
const loading = useBoolean('Loading')
|
|
29
|
+
// @ts-expect-error - TODO: fix this
|
|
24
30
|
const mode = useSelect('Mode', WORKSHOP_BUTTON_MODE_OPTIONS)
|
|
31
|
+
// @ts-expect-error - TODO: fix this
|
|
25
32
|
const paddingX = useSelect('Padding X', WORKSHOP_SPACE_OPTIONS)
|
|
33
|
+
// @ts-expect-error - TODO: fix this
|
|
26
34
|
const paddingY = useSelect('Padding Y', WORKSHOP_SPACE_OPTIONS)
|
|
27
35
|
const selected = useBoolean('Selected')
|
|
36
|
+
// @ts-expect-error - TODO: fix this
|
|
28
37
|
const tone = useSelect('Tone', WORKSHOP_BUTTON_TONE_OPTIONS)
|
|
38
|
+
// @ts-expect-error - TODO: fix this
|
|
29
39
|
const textAlign = useSelect('Text align', WORKSHOP_BUTTON_TEXT_ALIGN_OPTIONS)
|
|
30
40
|
const textProp = useText('Text', 'Label')
|
|
41
|
+
// @ts-expect-error - TODO: fix this
|
|
31
42
|
const textWeight = useSelect('Text weight', WORKSHOP_TEXT_WEIGHT_OPTIONS)
|
|
32
43
|
|
|
33
44
|
return (
|
|
34
45
|
<Flex align="center" height="fill" justify="center">
|
|
35
46
|
<Button
|
|
36
47
|
disabled={disabled}
|
|
48
|
+
// @ts-expect-error - TODO: fix this
|
|
37
49
|
fontSize={fontSize}
|
|
50
|
+
// @ts-expect-error - TODO: fix this
|
|
38
51
|
gap={gap}
|
|
52
|
+
// @ts-expect-error - TODO: fix this
|
|
39
53
|
icon={icon && icons[icon]}
|
|
54
|
+
// @ts-expect-error - TODO: fix this
|
|
40
55
|
iconRight={iconRight && icons[iconRight]}
|
|
56
|
+
// @ts-expect-error - TODO: fix this
|
|
41
57
|
justify={justify}
|
|
42
58
|
loading={loading}
|
|
59
|
+
// @ts-expect-error - TODO: fix this
|
|
43
60
|
mode={mode}
|
|
44
61
|
onClick={useAction('onClick')}
|
|
62
|
+
// @ts-expect-error - TODO: fix this
|
|
45
63
|
paddingX={paddingX}
|
|
64
|
+
// @ts-expect-error - TODO: fix this
|
|
46
65
|
paddingY={paddingY}
|
|
47
66
|
selected={selected}
|
|
67
|
+
// @ts-expect-error - TODO: fix this
|
|
48
68
|
textAlign={textAlign}
|
|
49
69
|
text={textProp}
|
|
70
|
+
// @ts-expect-error - TODO: fix this
|
|
50
71
|
textWeight={textWeight}
|
|
72
|
+
// @ts-expect-error - TODO: fix this
|
|
51
73
|
tone={tone}
|
|
52
74
|
/>
|
|
53
75
|
</Flex>
|
|
@@ -14,14 +14,22 @@ import {
|
|
|
14
14
|
export default function StackedStory(): React.JSX.Element {
|
|
15
15
|
const tones = Object.entries(WORKSHOP_BUTTON_TONE_OPTIONS)
|
|
16
16
|
const disabled = useBoolean('Disabled', false)
|
|
17
|
+
// @ts-expect-error - TODO: fix this
|
|
17
18
|
const fontSize = useSelect('Font size', WORKSHOP_TEXT_FONT_SIZE_OPTIONS, 2)
|
|
19
|
+
// @ts-expect-error - TODO: fix this
|
|
18
20
|
const gap = useSelect('Gap', WORKSHOP_SPACE_OPTIONS, 3)
|
|
21
|
+
// @ts-expect-error - TODO: fix this
|
|
19
22
|
const icon = useSelect('Icon', WORKSHOP_ICON_SYMBOL_OPTIONS, 'add-circle')
|
|
23
|
+
// @ts-expect-error - TODO: fix this
|
|
20
24
|
const iconRight = useSelect('Icon (right)', WORKSHOP_ICON_SYMBOL_OPTIONS)
|
|
25
|
+
// @ts-expect-error - TODO: fix this
|
|
21
26
|
const justify = useSelect('Justify', WORKSHOP_FLEX_JUSTIFY_OPTIONS, 'center')
|
|
27
|
+
// @ts-expect-error - TODO: fix this
|
|
22
28
|
const mode = useSelect('Mode', WORKSHOP_BUTTON_MODE_OPTIONS, 'default')
|
|
23
29
|
const onClick = useAction('onClick')
|
|
30
|
+
// @ts-expect-error - TODO: fix this
|
|
24
31
|
const paddingX = useSelect('Padding X', WORKSHOP_SPACE_OPTIONS, 3)
|
|
32
|
+
// @ts-expect-error - TODO: fix this
|
|
25
33
|
const paddingY = useSelect('Padding Y', WORKSHOP_SPACE_OPTIONS, 3)
|
|
26
34
|
const selected = useBoolean('Selected', false)
|
|
27
35
|
|
|
@@ -34,15 +42,23 @@ export default function StackedStory(): React.JSX.Element {
|
|
|
34
42
|
{tones.map(([title, tone]) => (
|
|
35
43
|
<Button
|
|
36
44
|
disabled={disabled}
|
|
45
|
+
// @ts-expect-error - TODO: fix this
|
|
37
46
|
fontSize={fontSize}
|
|
47
|
+
// @ts-expect-error - TODO: fix this
|
|
38
48
|
gap={gap}
|
|
49
|
+
// @ts-expect-error - TODO: fix this
|
|
39
50
|
icon={icon && icons[icon]}
|
|
51
|
+
// @ts-expect-error - TODO: fix this
|
|
40
52
|
iconRight={iconRight && icons[iconRight]}
|
|
53
|
+
// @ts-expect-error - TODO: fix this
|
|
41
54
|
justify={justify}
|
|
42
55
|
key={tone}
|
|
56
|
+
// @ts-expect-error - TODO: fix this
|
|
43
57
|
mode={mode}
|
|
44
58
|
onClick={onClick}
|
|
59
|
+
// @ts-expect-error - TODO: fix this
|
|
45
60
|
paddingX={paddingX}
|
|
61
|
+
// @ts-expect-error - TODO: fix this
|
|
46
62
|
paddingY={paddingY}
|
|
47
63
|
selected={selected}
|
|
48
64
|
text={title}
|
|
@@ -10,30 +10,40 @@ import {
|
|
|
10
10
|
} from '$workshop'
|
|
11
11
|
|
|
12
12
|
export default function PropsStory(): React.JSX.Element {
|
|
13
|
+
// @ts-expect-error - TODO: fix this
|
|
13
14
|
const as = useSelect('As', WORKSHOP_CARD_AS_OPTIONS, 'div')
|
|
14
15
|
const border = useBoolean('Border', false)
|
|
15
16
|
const checkered = useBoolean('Checkered', false)
|
|
16
17
|
const muted = useBoolean('Muted', false)
|
|
18
|
+
// @ts-expect-error - TODO: fix this
|
|
17
19
|
const padding = useSelect('Padding', WORKSHOP_SPACE_OPTIONS, 3)
|
|
18
20
|
const pressed = useBoolean('Pressed', false)
|
|
21
|
+
// @ts-expect-error - TODO: fix this
|
|
19
22
|
const radius = useSelect('Radius', WORKSHOP_RADIUS_OPTIONS, 0)
|
|
20
23
|
const selected = useBoolean('Selected', false)
|
|
24
|
+
// @ts-expect-error - TODO: fix this
|
|
21
25
|
const shadow = useSelect('Shadow', WORKSHOP_SHADOW_OPTIONS, 0)
|
|
26
|
+
// @ts-expect-error - TODO: fix this
|
|
22
27
|
const tone = useSelect('Tone', WORKSHOP_CARD_TONE_OPTIONS, 'default')
|
|
23
28
|
|
|
24
29
|
return (
|
|
25
30
|
<Flex align="center" height="fill" justify="center" padding={4} sizing="border">
|
|
26
31
|
<Card
|
|
27
32
|
__unstable_checkered={checkered}
|
|
33
|
+
// @ts-expect-error - TODO: fix this
|
|
28
34
|
as={as}
|
|
29
35
|
border={border}
|
|
30
36
|
muted={muted}
|
|
31
37
|
onClick={useAction('onClick')}
|
|
38
|
+
// @ts-expect-error - TODO: fix this
|
|
32
39
|
padding={padding}
|
|
33
40
|
pressed={pressed}
|
|
41
|
+
// @ts-expect-error - TODO: fix this
|
|
34
42
|
radius={radius}
|
|
35
43
|
selected={selected}
|
|
44
|
+
// @ts-expect-error - TODO: fix this
|
|
36
45
|
shadow={shadow}
|
|
46
|
+
// @ts-expect-error - TODO: fix this
|
|
37
47
|
tone={tone}
|
|
38
48
|
>
|
|
39
49
|
<Stack gap={3}>
|
|
@@ -47,7 +47,6 @@ export function Card<E extends CardElementType = typeof DEFAULT_CARD_ELEMENT>(
|
|
|
47
47
|
__unstable_focusRing: focusRing = false,
|
|
48
48
|
as = DEFAULT_CARD_ELEMENT,
|
|
49
49
|
className,
|
|
50
|
-
disabled,
|
|
51
50
|
pressed,
|
|
52
51
|
radius = 0,
|
|
53
52
|
scheme: schemeProp,
|
|
@@ -72,7 +71,8 @@ export function Card<E extends CardElementType = typeof DEFAULT_CARD_ELEMENT>(
|
|
|
72
71
|
tone,
|
|
73
72
|
})}
|
|
74
73
|
data-checkered={checkered ? '' : undefined}
|
|
75
|
-
|
|
74
|
+
// Extract the disabled prop without removing it from `...rest` so that the underlying <button> or <a> has `[disabled]` when needed
|
|
75
|
+
data-disabled={props.disabled ? '' : undefined}
|
|
76
76
|
data-focus-ring={focusRing ? '' : undefined}
|
|
77
77
|
data-pressed={pressed ? '' : undefined}
|
|
78
78
|
data-selected={selected ? '' : undefined}
|
|
@@ -6,11 +6,16 @@ import {WORKSHOP_CODE_LANGUAGE_OPTIONS, WORKSHOP_TEXT_FONT_SIZE_OPTIONS} from '$
|
|
|
6
6
|
export default function PropsStory(): React.JSX.Element {
|
|
7
7
|
const code = useText('Code', `console.log('Hello, world')`)
|
|
8
8
|
const language = useSelect('Language', WORKSHOP_CODE_LANGUAGE_OPTIONS, 'typescript')
|
|
9
|
+
// @ts-expect-error - TODO: fix this
|
|
9
10
|
const size = useSelect('Size', WORKSHOP_TEXT_FONT_SIZE_OPTIONS, 1)
|
|
10
11
|
|
|
11
12
|
return (
|
|
12
13
|
<Box padding={[4, 5, 6]}>
|
|
13
|
-
<Code
|
|
14
|
+
<Code
|
|
15
|
+
language={language}
|
|
16
|
+
// @ts-expect-error - TODO: fix this
|
|
17
|
+
size={size}
|
|
18
|
+
>
|
|
14
19
|
{code}
|
|
15
20
|
</Code>
|
|
16
21
|
</Box>
|
|
@@ -4,11 +4,16 @@ import {useAction, useSelect} from '@sanity/ui-workshop'
|
|
|
4
4
|
import {WORKSHOP_CONTAINER_WIDTH_OPTIONS} from '$workshop'
|
|
5
5
|
|
|
6
6
|
export default function PlainStory(): React.JSX.Element {
|
|
7
|
+
// @ts-expect-error - TODO: fix this
|
|
7
8
|
const width = useSelect('Width', WORKSHOP_CONTAINER_WIDTH_OPTIONS, 0)
|
|
8
9
|
|
|
9
10
|
return (
|
|
10
11
|
<Flex align="center" height="fill" justify="center" padding={[4, 5, 6]} sizing="border">
|
|
11
|
-
<Container
|
|
12
|
+
<Container
|
|
13
|
+
onClick={useAction('onClick')}
|
|
14
|
+
// @ts-expect-error - TODO: fix this
|
|
15
|
+
width={width}
|
|
16
|
+
>
|
|
12
17
|
<Card padding={4} shadow={1}>
|
|
13
18
|
<Text size={1}>
|
|
14
19
|
Container with <code>max-width={width}</code>
|
|
@@ -14,10 +14,16 @@ const DebugCard = styled(Card)`
|
|
|
14
14
|
`
|
|
15
15
|
|
|
16
16
|
export default function ExampleStory(): React.JSX.Element {
|
|
17
|
+
// @ts-expect-error - TODO: fix this
|
|
17
18
|
const direction = useSelect('Direction', WORKSHOP_FLEX_DIRECTION_OPTIONS, 'row')
|
|
18
19
|
|
|
19
20
|
return (
|
|
20
|
-
<Flex
|
|
21
|
+
<Flex
|
|
22
|
+
// @ts-expect-error - TODO: fix this
|
|
23
|
+
direction={direction}
|
|
24
|
+
height="fill"
|
|
25
|
+
style={{width: '100%'}}
|
|
26
|
+
>
|
|
21
27
|
<DebugCard flex={1}>
|
|
22
28
|
<Code size={1}>1</Code>
|
|
23
29
|
</DebugCard>
|
|
@@ -9,19 +9,30 @@ import {
|
|
|
9
9
|
|
|
10
10
|
export default function PlainStory(): React.JSX.Element {
|
|
11
11
|
const muted = useBoolean('Muted', false)
|
|
12
|
+
// @ts-expect-error - TODO: fix this
|
|
12
13
|
const size = useSelect('Size', WORKSHOP_HEADING_FONT_SIZE_OPTIONS, 2)
|
|
13
14
|
const textChild = useText('Text', 'Hello, world')
|
|
14
15
|
const textOverflow = useSelect(
|
|
15
16
|
'Text overflow',
|
|
17
|
+
// @ts-expect-error - TODO: fix this
|
|
16
18
|
WORKSHOP_TEXT_OVERFLOW_OPTIONS,
|
|
17
19
|
undefined,
|
|
18
20
|
'Props',
|
|
19
21
|
)
|
|
22
|
+
// @ts-expect-error - TODO: fix this
|
|
20
23
|
const weight = useSelect('Weight', WORKSHOP_FONT_WEIGHT_OPTIONS)
|
|
21
24
|
|
|
22
25
|
return (
|
|
23
26
|
<Flex align="center" height="fill" justify="center" padding={[4, 5, 6]} sizing="border">
|
|
24
|
-
<Heading
|
|
27
|
+
<Heading
|
|
28
|
+
muted={muted}
|
|
29
|
+
// @ts-expect-error - TODO: fix this
|
|
30
|
+
size={size}
|
|
31
|
+
// @ts-expect-error - TODO: fix this
|
|
32
|
+
textOverflow={textOverflow}
|
|
33
|
+
// @ts-expect-error - TODO: fix this
|
|
34
|
+
weight={weight}
|
|
35
|
+
>
|
|
25
36
|
{textChild}
|
|
26
37
|
</Heading>
|
|
27
38
|
</Flex>
|
|
@@ -6,7 +6,11 @@ import {WORKSHOP_SPACE_OPTIONS} from '$workshop'
|
|
|
6
6
|
export default function PlainStory(): React.JSX.Element {
|
|
7
7
|
return (
|
|
8
8
|
<Flex align="center" height="fill" justify="center" padding={[4, 5, 6]} sizing="border">
|
|
9
|
-
<Inline
|
|
9
|
+
<Inline
|
|
10
|
+
// @ts-expect-error - TODO: fix this
|
|
11
|
+
gap={useSelect('Gap', WORKSHOP_SPACE_OPTIONS, 0)}
|
|
12
|
+
onClick={useAction('onClick')}
|
|
13
|
+
>
|
|
10
14
|
<Card padding={1} shadow={1}>
|
|
11
15
|
<Text size={1}>Inline item</Text>
|
|
12
16
|
</Card>
|