@sanity/ui 4.0.0-static.2 → 4.0.0-static.21

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.
Files changed (74) hide show
  1. package/dist/css/index.css +2 -1
  2. package/dist/css/index.css.map +1 -0
  3. package/dist/css/index.d.ts +29 -1
  4. package/dist/css/index.js +17965 -50
  5. package/dist/css/index.js.map +1 -1
  6. package/dist/index.d.ts +1 -1
  7. package/dist/index.js +14 -16
  8. package/dist/index.js.map +1 -1
  9. package/package.json +38 -48
  10. package/src/core/components/autocomplete/__workshop__/custom.tsx +14 -1
  11. package/src/core/components/autocomplete/__workshop__/example.tsx +12 -1
  12. package/src/core/components/dialog/__workshop__/position.tsx +9 -1
  13. package/src/core/components/dialog/__workshop__/props.tsx +2 -0
  14. package/src/core/components/menu/__workshop__/menuButton.tsx +6 -1
  15. package/src/core/components/menu/__workshop__/tones.tsx +7 -1
  16. package/src/core/components/menu/menu.tsx +1 -1
  17. package/src/core/components/menu/menuButton.tsx +10 -5
  18. package/src/core/components/menu/menuContext.ts +1 -1
  19. package/src/core/components/menu/menuGroup.tsx +7 -4
  20. package/src/core/components/menu/menuItem.tsx +1 -1
  21. package/src/core/components/toast/__workshop__/toast.tsx +2 -0
  22. package/src/core/primitives/avatar/__workshop__/asButton.tsx +8 -1
  23. package/src/core/primitives/avatar/__workshop__/stack.tsx +5 -1
  24. package/src/core/primitives/badge/__workshop__/props.tsx +12 -1
  25. package/src/core/primitives/box/__workshop__/props.tsx +6 -1
  26. package/src/core/primitives/button/__workshop__/props.tsx +22 -0
  27. package/src/core/primitives/button/__workshop__/stacked.tsx +16 -0
  28. package/src/core/primitives/card/__workshop__/props.tsx +10 -0
  29. package/src/core/primitives/card/__workshop__/selected.tsx +1 -1
  30. package/src/core/primitives/card/card.tsx +2 -2
  31. package/src/core/primitives/code/__workshop__/props.tsx +6 -1
  32. package/src/core/primitives/container/__workshop__/example.tsx +6 -1
  33. package/src/core/primitives/flex/__workshop__/example.tsx +7 -1
  34. package/src/core/primitives/heading/__workshop__/plain.tsx +12 -1
  35. package/src/core/primitives/inline/__workshop__/plain.tsx +5 -1
  36. package/src/core/primitives/label/__workshop__/plain.tsx +15 -1
  37. package/src/core/primitives/popover/__workshop__/AlignedStory.tsx +13 -1
  38. package/src/core/primitives/popover/__workshop__/MatchReferenceWidthStory.tsx +2 -0
  39. package/src/core/primitives/popover/__workshop__/PlainStory.tsx +8 -0
  40. package/src/core/primitives/popover/__workshop__/SidePanelStory.tsx +7 -1
  41. package/src/core/primitives/popover/__workshop__/TestStory.tsx +6 -0
  42. package/src/core/primitives/popover/popover.tsx +0 -1
  43. package/src/core/primitives/select/__workshop__/plain.tsx +4 -0
  44. package/src/core/primitives/skeleton/__workshop__/delay.tsx +9 -1
  45. package/src/core/primitives/skeleton/__workshop__/skeleton.tsx +9 -1
  46. package/src/core/primitives/spinner/__workshop__/Props.tsx +6 -1
  47. package/src/core/primitives/stack/__workshop__/plain.tsx +4 -1
  48. package/src/core/primitives/text/__workshop__/colored.tsx +8 -1
  49. package/src/core/primitives/text/__workshop__/example.tsx +15 -1
  50. package/src/core/primitives/textArea/__workshop__/plain.tsx +8 -0
  51. package/src/core/primitives/textInput/__workshop__/plain.tsx +34 -4
  52. package/src/core/primitives/textInput/__workshop__/typed.tsx +7 -1
  53. package/src/core/primitives/textInput/textInput.tsx +1 -1
  54. package/src/core/primitives/tooltip/__workshop__/customPortal.tsx +2 -0
  55. package/src/core/primitives/tooltip/__workshop__/overflowingBoundary.tsx +2 -0
  56. package/src/core/primitives/tooltip/__workshop__/props.tsx +12 -0
  57. package/src/core/primitives/tooltip/__workshop__/resizableBoundary.tsx +5 -0
  58. package/src/css/primitives/avatar/avatar.css.ts +9 -5
  59. package/src/css/primitives/card/__workshop__/color.tsx +9 -1
  60. package/src/css/primitives/card/card.css.ts +10 -0
  61. package/src/css/theme/buildCSSTheme.ts +4 -0
  62. package/src/css/types.ts +4 -0
  63. package/src/css/vars.css.ts +4 -0
  64. package/dist/_chunks-cjs/refractor.cjs +0 -22
  65. package/dist/_chunks-cjs/refractor.cjs.map +0 -1
  66. package/dist/css/index.cjs +0 -966
  67. package/dist/css/index.cjs.map +0 -1
  68. package/dist/css/index.d.cts +0 -1370
  69. package/dist/index.cjs +0 -4515
  70. package/dist/index.cjs.map +0 -1
  71. package/dist/index.d.cts +0 -2521
  72. package/dist/theme.cjs +0 -870
  73. package/dist/theme.cjs.map +0 -1
  74. package/dist/theme.d.cts +0 -499
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sanity/ui",
3
- "version": "4.0.0-static.2",
3
+ "version": "4.0.0-static.21",
4
4
  "keywords": [
5
5
  "react",
6
6
  "ui",
@@ -20,32 +20,27 @@
20
20
  },
21
21
  "license": "MIT",
22
22
  "author": "Sanity.io <hello@sanity.io>",
23
- "sideEffects": false,
23
+ "sideEffects": [
24
+ "**/*.css"
25
+ ],
24
26
  "type": "module",
25
27
  "exports": {
26
28
  ".": {
27
29
  "source": "./exports/index.ts",
28
- "import": "./dist/index.js",
29
- "require": "./dist/index.cjs",
30
30
  "default": "./dist/index.js"
31
31
  },
32
32
  "./css": {
33
33
  "source": "./exports/css.ts",
34
- "import": "./dist/css/index.js",
35
- "require": "./dist/css/index.cjs",
36
34
  "default": "./dist/css/index.js"
37
35
  },
38
36
  "./css/index.css": "./dist/css/index.css",
39
37
  "./package.json": "./package.json",
40
38
  "./theme": {
41
39
  "source": "./exports/theme.ts",
42
- "import": "./dist/theme.js",
43
- "require": "./dist/theme.cjs",
44
40
  "default": "./dist/theme.js"
45
41
  }
46
42
  },
47
- "main": "./dist/index.cjs",
48
- "module": "./dist/index.js",
43
+ "main": "./dist/index.js",
49
44
  "types": "./dist/index.d.ts",
50
45
  "typesVersions": {
51
46
  "*": {
@@ -118,15 +113,13 @@
118
113
  "extends": "@sanity/semantic-release-preset"
119
114
  },
120
115
  "dependencies": {
121
- "@floating-ui/react-dom": "^2.1.4",
116
+ "@floating-ui/react-dom": "^2.1.5",
122
117
  "@juggle/resize-observer": "^3.4.0",
123
118
  "@sanity/color": "^3.0.6",
124
119
  "@sanity/icons": "^3.7.4",
125
- "@vanilla-extract/css": "^1.17.4",
126
120
  "@vanilla-extract/dynamic": "^2.1.5",
127
121
  "csstype": "^3.1.3",
128
- "framer-motion": "^12.23.9",
129
- "react-compiler-runtime": "19.1.0-rc.2",
122
+ "framer-motion": "^12.23.12",
130
123
  "react-refractor": "^4.0.0",
131
124
  "use-effect-event": "^2.0.3"
132
125
  },
@@ -137,68 +130,66 @@
137
130
  "@babel/preset-typescript": "^7.27.1",
138
131
  "@commitlint/cli": "^19.8.1",
139
132
  "@commitlint/config-conventional": "^19.8.1",
140
- "@eslint/js": "^9.31.0",
133
+ "@eslint/js": "^9.33.0",
141
134
  "@sanity/browserslist-config": "^1.0.5",
142
- "@sanity/pkg-utils": "^7.9.10",
135
+ "@sanity/pkg-utils": "^7.11.7",
143
136
  "@sanity/prettier-config": "^2.0.1",
144
137
  "@sanity/semantic-release-preset": "^5.0.0",
145
- "@sanity/ui-workshop": "^2.1.6",
146
- "@testing-library/dom": "^10.4.0",
147
- "@testing-library/jest-dom": "^6.6.3",
138
+ "@sanity/ui-workshop": "4.0.0-static.11",
139
+ "@testing-library/dom": "^10.4.1",
140
+ "@testing-library/jest-dom": "^6.6.4",
148
141
  "@testing-library/react": "^16.3.0",
149
142
  "@testing-library/user-event": "^14.6.1",
150
143
  "@types/node": "^24.0.3",
151
- "@types/react": "^19.1.8",
152
- "@types/react-dom": "^19.1.6",
144
+ "@types/react": "^19.1.9",
145
+ "@types/react-dom": "^19.1.7",
153
146
  "@types/react-is": "^19.0.0",
154
- "@vanilla-extract/rollup-plugin": "^1.3.17",
155
- "@vanilla-extract/vite-plugin": "^5.1.0",
156
- "@vitejs/plugin-react": "^4.7.0",
157
- "@vitest/browser": "^3.2.3",
158
- "autoprefixer": "^10.4.21",
147
+ "@vanilla-extract/css": "^1.17.4",
148
+ "@vanilla-extract/vite-plugin": "^5.1.1",
149
+ "@vitejs/plugin-react": "^5.0.0",
150
+ "@vitest/browser": "^3.2.4",
159
151
  "babel-plugin-react-compiler": "19.1.0-rc.2",
152
+ "browserslist-config-baseline": "^0.5.0",
160
153
  "cac": "^6.7.14",
161
154
  "commitizen": "^4.3.1",
162
- "cssnano": "^7.1.0",
163
155
  "cypress": "^13.17.0",
164
156
  "cypress-real-events": "^1.14.0",
165
157
  "cz-conventional-changelog": "^3.3.0",
166
158
  "dotenv-flow": "^4.1.0",
167
- "eslint": "^9.31.0",
159
+ "eslint": "^9.33.0",
168
160
  "eslint-config-prettier": "^10.1.8",
169
161
  "eslint-formatter-compact": "^8.40.0",
170
162
  "eslint-plugin-boundaries": "^5.0.1",
171
163
  "eslint-plugin-import": "^2.32.0",
172
164
  "eslint-plugin-jsx-a11y": "^6.10.2",
173
165
  "eslint-plugin-react": "^7.37.5",
174
- "eslint-plugin-react-hooks": "0.0.0-experimental-edac0dde-20250723",
166
+ "eslint-plugin-react-compiler": "19.1.0-rc.2",
167
+ "eslint-plugin-react-hooks": "0.0.0-experimental-66f09bd0-20250806",
175
168
  "eslint-plugin-react-refresh": "^0.4.20",
176
169
  "eslint-plugin-simple-import-sort": "^12.1.1",
177
- "eslint-plugin-storybook": "^9.0.11",
178
- "globals": "^16.2.0",
170
+ "eslint-plugin-storybook": "^9.1.1",
171
+ "globals": "^16.3.0",
179
172
  "husky": "^8.0.3",
180
- "lightningcss": "^1.30.1",
173
+ "jsdom": "^26.1.0",
181
174
  "lint-staged": "^14.0.1",
182
175
  "mkdirp": "^3.0.1",
183
176
  "npm-run-all2": "^8.0.4",
184
- "postcss": "^8.5.6",
185
- "postcss-preset-env": "^10.2.3",
186
- "prettier": "^3.5.3",
187
- "prettier-plugin-packagejson": "^2.5.15",
188
- "react": "^19.1.0",
189
- "react-dom": "^19.1.0",
190
- "react-is": "^19.1.0",
177
+ "prettier": "^3.6.2",
178
+ "prettier-plugin-packagejson": "^2.5.19",
179
+ "react": "^19.1.1",
180
+ "react-dom": "^19.1.1",
181
+ "react-is": "^19.1.1",
191
182
  "refractor": "^5.0.0",
192
183
  "rimraf": "^5.0.10",
193
184
  "semantic-release": "24.2.7",
194
- "start-server-and-test": "^2.0.11",
195
- "styled-components": "^6.1.17",
185
+ "start-server-and-test": "^2.0.13",
186
+ "styled-components": "^6.1.19",
196
187
  "tsconfig-paths": "^4.2.0",
197
- "typescript": "5.8.3",
198
- "typescript-eslint": "^8.38.0",
199
- "vite": "^6.3.5",
188
+ "typescript": "5.9.2",
189
+ "typescript-eslint": "^8.39.0",
190
+ "vite": "^7.1.1",
200
191
  "vite-tsconfig-paths": "^5.1.4",
201
- "vitest": "^3.2.3",
192
+ "vitest": "^3.2.4",
202
193
  "vitest-axe": "1.0.0-pre.5"
203
194
  },
204
195
  "peerDependencies": {
@@ -206,9 +197,9 @@
206
197
  "react-dom": "^19",
207
198
  "react-is": "^19"
208
199
  },
209
- "packageManager": "pnpm@10.12.1",
200
+ "packageManager": "pnpm@10.14.0",
210
201
  "engines": {
211
- "node": ">=20.19"
202
+ "node": ">=20.19 <22 || >=22.12"
212
203
  },
213
204
  "publishConfig": {
214
205
  "access": "public"
@@ -218,7 +209,6 @@
218
209
  "cypress"
219
210
  ],
220
211
  "overrides": {
221
- "@sanity/ui-workshop": "file:registry/sanity-ui-workshop-3.0.0-local.12.tgz",
222
212
  "@types/react": "$@types/react",
223
213
  "@types/react-dom": "$@types/react-dom",
224
214
  "@types/react-is": "$@types/react-is",
@@ -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 size={fontSize}>{option.title}</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 height="fill" tone={layoutTone}>
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 && <Dialog header="Position example" id="position-example" position={position} />}
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 height="fill" tone={layoutTone}>
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 radius={3} shadow={3} tone={parentTone}>
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} />
@@ -19,7 +19,7 @@ export type MenuOwnProps = PaddingStyleProps & {
19
19
  'gap'?: ResponsiveProp<Space>
20
20
  'onClickOutside'?: (event: MouseEvent) => void
21
21
  'onEscape'?: () => void
22
- 'onItemClick'?: () => void
22
+ 'onItemClick'?: (event: React.MouseEvent<HTMLButtonElement>) => void
23
23
  'onItemSelect'?: (index: number) => void
24
24
  'originElement'?: HTMLElement | null
25
25
  'registerElement'?: (el: HTMLElement) => () => void
@@ -159,11 +159,16 @@ export function MenuButton(props: MenuButtonProps): React.JSX.Element {
159
159
  [menuElements],
160
160
  )
161
161
 
162
- const handleItemClick = useCallback(() => {
163
- setOpen(false)
164
- if (disableRestoreFocusOnClose) return
165
- if (buttonElement) buttonElement.focus()
166
- }, [buttonElement, disableRestoreFocusOnClose])
162
+ const handleItemClick = useCallback(
163
+ (e: ReactMouseEvent<HTMLButtonElement>) => {
164
+ if (e.defaultPrevented) return
165
+
166
+ setOpen(false)
167
+ if (disableRestoreFocusOnClose) return
168
+ if (buttonElement) buttonElement.focus()
169
+ },
170
+ [buttonElement, disableRestoreFocusOnClose],
171
+ )
167
172
 
168
173
  const registerElement = useCallback((el: HTMLElement) => {
169
174
  setChildMenuElements((els) => els.concat([el]))
@@ -9,7 +9,7 @@ export interface MenuContextValue {
9
9
  mount: (element: HTMLElement | null, selected?: boolean) => () => void
10
10
  onClickOutside?: (event: MouseEvent) => void
11
11
  onEscape?: () => void
12
- onItemClick?: () => void
12
+ onItemClick?: (event: ReactMouseEvent<HTMLButtonElement>) => void
13
13
  onItemMouseEnter?: (event: ReactMouseEvent<HTMLElement>) => void
14
14
  onItemMouseLeave?: (event: ReactMouseEvent<HTMLElement>) => void
15
15
  registerElement?: (el: HTMLElement) => () => void
@@ -127,10 +127,13 @@ export function MenuGroup<E extends MenuGroupElementType = typeof DEFAULT_MENU_G
127
127
  [onClick],
128
128
  )
129
129
 
130
- const handleChildItemClick = useCallback(() => {
131
- setOpen(false)
132
- onItemClick?.()
133
- }, [onItemClick])
130
+ const handleChildItemClick = useCallback(
131
+ (e: MouseEvent<HTMLButtonElement>) => {
132
+ setOpen(false)
133
+ onItemClick?.(e)
134
+ },
135
+ [onItemClick],
136
+ )
134
137
 
135
138
  const handleMenuMouseEnter = useCallback(() => setWithinMenu(true), [])
136
139
 
@@ -104,7 +104,7 @@ export function MenuItem<E extends MenuItemElementType = typeof DEFAULT_MENU_ITE
104
104
  (event: MouseEvent<HTMLButtonElement>) => {
105
105
  if (disabled) return
106
106
  if (onClick) onClick(event)
107
- if (onItemClick) onItemClick()
107
+ if (onItemClick) onItemClick(event)
108
108
  },
109
109
  [disabled, onClick, onItemClick],
110
110
  )
@@ -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 as="button" color="purple" initials="uq" size={size} />
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 size={size}>
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 onClick={useAction('onClick')} paddingX={paddingX} paddingY={paddingY} tone={tone}>
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 onClick={useAction('onClick')} padding={padding}>
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}