@sanity/ui 1.0.0-beta.32 → 1.0.0-beta.34

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 (71) hide show
  1. package/LICENSE +1 -1
  2. package/dist/{types/src/index.d.ts → index.d.ts} +136 -68
  3. package/dist/{sanity-ui.esm.js → index.esm.js} +698 -1525
  4. package/dist/index.esm.js.map +1 -0
  5. package/dist/{sanity-ui.js → index.js} +697 -1539
  6. package/dist/index.js.map +1 -0
  7. package/package.json +112 -23
  8. package/src/components/autocomplete/__workshop__/example.tsx +1 -1
  9. package/src/components/autocomplete/__workshop__/index.ts +36 -32
  10. package/src/components/autocomplete/autocomplete.tsx +1 -2
  11. package/src/components/autocomplete/constants.ts +3 -8
  12. package/src/components/breadcrumbs/__workshop__/index.ts +11 -7
  13. package/src/components/dialog/__workshop__/index.ts +13 -9
  14. package/src/components/hotkeys/__workshop__/index.ts +11 -3
  15. package/src/components/menu/__workshop__/index.ts +71 -67
  16. package/src/components/menu/menuButton.tsx +16 -14
  17. package/src/components/skeleton/__workshop__/index.ts +8 -4
  18. package/src/components/tab/__workshop__/index.ts +11 -3
  19. package/src/components/toast/__workshop__/index.ts +16 -4
  20. package/src/components/tree/__workshop__/basic.perf.ts +1 -14
  21. package/src/components/tree/__workshop__/basic.tsx +1 -1
  22. package/src/components/tree/__workshop__/index.ts +12 -8
  23. package/src/hooks/useElementRect/__workshop__/index.ts +11 -3
  24. package/src/hooks/useMediaIndex/__workshop__/index.ts +11 -3
  25. package/src/primitives/avatar/__workshop__/index.ts +16 -12
  26. package/src/primitives/badge/__workshop__/index.ts +16 -12
  27. package/src/primitives/badge/__workshop__/tones.tsx +1 -1
  28. package/src/primitives/box/__workshop__/index.ts +16 -4
  29. package/src/primitives/button/__workshop__/index.ts +51 -47
  30. package/src/primitives/card/__workshop__/index.ts +15 -11
  31. package/src/primitives/checkbox/__workshop__/index.ts +10 -6
  32. package/src/primitives/code/__workshop__/index.ts +16 -12
  33. package/src/primitives/container/__workshop__/index.ts +5 -3
  34. package/src/primitives/flex/__workshop__/index.ts +8 -4
  35. package/src/primitives/grid/__workshop__/index.ts +7 -3
  36. package/src/primitives/heading/__workshop__/index.ts +16 -12
  37. package/src/primitives/inline/__workshop__/index.ts +5 -3
  38. package/src/primitives/kbd/__workshop__/index.ts +5 -3
  39. package/src/primitives/label/__workshop__/index.ts +16 -12
  40. package/src/primitives/popover/__workshop__/PlainStory.tsx +0 -1
  41. package/src/primitives/popover/__workshop__/TestStory.tsx +0 -1
  42. package/src/primitives/popover/__workshop__/index.ts +36 -32
  43. package/src/primitives/popover/constants.ts +0 -3
  44. package/src/primitives/popover/floating-ui/size.ts +40 -25
  45. package/src/primitives/popover/popover.tsx +54 -41
  46. package/src/primitives/popover/popoverCard.tsx +9 -16
  47. package/src/primitives/radio/__workshop__/index.ts +8 -4
  48. package/src/primitives/select/__workshop__/index.ts +8 -4
  49. package/src/primitives/spinner/__workshop__/index.ts +11 -7
  50. package/src/primitives/stack/__workshop__/index.ts +11 -7
  51. package/src/primitives/switch/__workshop__/index.ts +8 -4
  52. package/src/primitives/text/__workshop__/index.ts +21 -17
  53. package/src/primitives/textArea/__workshop__/index.ts +11 -7
  54. package/src/primitives/textInput/__workshop__/index.ts +46 -42
  55. package/src/primitives/textInput/__workshop__/plain.tsx +2 -1
  56. package/src/primitives/tooltip/__workshop__/index.ts +11 -7
  57. package/src/theme/__workshop__/index.ts +26 -22
  58. package/src/theme/{ThemeContext.ts → themeContext.ts} +0 -0
  59. package/src/utils/boundaryElement/__workshop__/index.ts +11 -7
  60. package/src/utils/elementQuery/__workshop__/index.ts +11 -7
  61. package/src/utils/layer/__workshop__/index.ts +21 -17
  62. package/src/utils/portal/__workshop__/index.ts +11 -7
  63. package/src/utils/virtualList/__workshop__/index.ts +26 -22
  64. package/dist/sanity-ui.esm.js.map +0 -1
  65. package/dist/sanity-ui.js.map +0 -1
  66. package/src/__workshop__/color/overview.tsx +0 -101
  67. package/src/__workshop__/index.ts +0 -10
  68. package/src/icons/__workshop__/.eslintrc +0 -5
  69. package/src/icons/__workshop__/index.tsx +0 -6
  70. package/src/icons/__workshop__/overview.tsx +0 -76
  71. package/src/utils/srOnly/__workshop__/.eslintrc +0 -5
package/package.json CHANGED
@@ -1,19 +1,20 @@
1
1
  {
2
2
  "name": "@sanity/ui",
3
- "version": "1.0.0-beta.32",
3
+ "version": "1.0.0-beta.34",
4
4
  "sideEffects": false,
5
- "types": "./dist/types/src/index.d.ts",
5
+ "types": "./dist/index.d.ts",
6
6
  "source": "./src/index.ts",
7
- "module": "./dist/sanity-ui.esm.js",
8
- "main": "./dist/sanity-ui.js",
7
+ "module": "./dist/index.esm.js",
8
+ "main": "./dist/index.js",
9
9
  "exports": {
10
10
  ".": {
11
- "types": "./dist/types/src/index.d.ts",
11
+ "types": "./dist/index.d.ts",
12
12
  "source": "./src/index.ts",
13
- "import": "./dist/sanity-ui.esm.js",
14
- "require": "./dist/sanity-ui.js",
15
- "default": "./dist/sanity-ui.esm.js"
16
- }
13
+ "import": "./dist/index.esm.js",
14
+ "require": "./dist/index.js",
15
+ "default": "./dist/index.esm.js"
16
+ },
17
+ "./package.json": "./package.json"
17
18
  },
18
19
  "files": [
19
20
  "dist",
@@ -21,30 +22,90 @@
21
22
  ],
22
23
  "license": "MIT",
23
24
  "scripts": {
24
- "build": "pkg build",
25
- "check:package": "pkg --strict",
26
- "clean": "rimraf dist",
27
- "lint": "eslint . --ext .js,.jsx,.mjs,.ts,.tsx --quiet",
28
- "postbuild": "run-s check:package",
29
- "prebuild": "run-s clean",
25
+ "build": "run-s clean build:pkg check:pkg",
26
+ "build:pkg": "pkg build --strict",
27
+ "build:workshop": "node scripts/build",
28
+ "check:pkg": "pkg --strict",
29
+ "check:types": "tsc",
30
+ "clean": "rimraf .workshop dist",
31
+ "commit": "cz",
32
+ "cypress:open": "cypress open",
33
+ "cypress:run": "cypress run",
34
+ "dev": "node scripts/dev",
35
+ "dev:cypress": "run-p dev cypress:open",
36
+ "format": "prettier --write --cache --ignore-unknown .",
37
+ "lint": "eslint . --ext .cjs,.js,.jsx,.mjs,.ts,.tsx --quiet",
38
+ "prepare": "husky install",
39
+ "prepublishOnly": "pnpm build",
40
+ "release": "semantic-release",
41
+ "start:workshop": "http-server -a localhost -c-0 -p 1337 -s -P http://localhost:1337/index.html? .workshop/dist",
30
42
  "test": "jest",
31
- "type-check": "tsc --build",
32
- "watch": "pkg watch"
43
+ "test:browser": "start-server-and-test 'run-s build:workshop start:workshop' http://localhost:1337 'run-s cypress:run'",
44
+ "watch": "pkg watch --strict"
33
45
  },
34
46
  "dependencies": {
35
47
  "@floating-ui/react-dom": "^1.0.0",
36
- "@sanity/color": "2.1.19-beta.3",
37
- "@sanity/icons": "1.3.9-beta.3",
48
+ "@sanity/color": "3.0.0-beta.1",
49
+ "@sanity/icons": "^2.0.0",
50
+ "csstype": "^3.1.1",
38
51
  "framer-motion": "^7.5.3",
39
52
  "react-refractor": "^2.1.7"
40
53
  },
41
54
  "devDependencies": {
55
+ "@babel/core": "^7.20.2",
56
+ "@babel/preset-env": "^7.20.2",
57
+ "@babel/preset-react": "^7.18.6",
58
+ "@babel/preset-typescript": "^7.18.6",
59
+ "@commitlint/cli": "^17.3.0",
60
+ "@commitlint/config-conventional": "^17.3.0",
42
61
  "@juggle/resize-observer": "^3.4.0",
62
+ "@sanity/pkg-utils": "^1.18.0",
63
+ "@sanity/semantic-release-preset": "^2.0.2",
64
+ "@sanity/ui-workshop": "1.0.0-beta.6",
65
+ "@testing-library/dom": "^8.19.0",
66
+ "@testing-library/jest-dom": "^5.16.5",
67
+ "@testing-library/react": "^13.4.0",
68
+ "@types/jest": "^29.2.3",
69
+ "@types/jest-axe": "^3.5.5",
70
+ "@types/node": "^18.11.9",
71
+ "@types/react": "^18.0.25",
72
+ "@types/react-dom": "^18.0.9",
73
+ "@types/react-is": "^17.0.3",
43
74
  "@types/refractor": "^3.0.2",
75
+ "@types/styled-components": "^5.1.26",
76
+ "@types/testing-library__jest-dom": "^5.14.5",
77
+ "@typescript-eslint/eslint-plugin": "^5.44.0",
78
+ "@typescript-eslint/parser": "^5.44.0",
79
+ "commitizen": "^4.2.5",
80
+ "cypress": "^11.2.0",
81
+ "cypress-real-events": "^1.7.4",
82
+ "cz-conventional-changelog": "^3.3.0",
83
+ "esbuild": "^0.15.15",
84
+ "esbuild-register": "^3.4.1",
85
+ "eslint": "^8.28.0",
86
+ "eslint-config-prettier": "^8.5.0",
87
+ "eslint-plugin-import": "^2.26.0",
88
+ "eslint-plugin-jsx-a11y": "^6.6.1",
89
+ "eslint-plugin-prettier": "^4.2.1",
90
+ "eslint-plugin-react": "^7.31.11",
91
+ "eslint-plugin-react-hooks": "^4.6.0",
92
+ "http-server": "^14.1.1",
93
+ "husky": "^8.0.2",
94
+ "jest": "^29.3.1",
95
+ "jest-axe": "^7.0.0",
96
+ "jest-environment-jsdom": "^29.3.1",
97
+ "lint-staged": "^13.0.3",
98
+ "module-alias": "^2.2.2",
99
+ "npm-run-all": "^4.1.5",
100
+ "prettier": "^2.8.0",
44
101
  "react": "^18.2.0",
45
102
  "react-dom": "^18.2.0",
46
103
  "react-is": "^18.2.0",
47
- "styled-components": "^5.3.6"
104
+ "rimraf": "^3.0.2",
105
+ "semantic-release": "^19.0.5",
106
+ "start-server-and-test": "^1.14.0",
107
+ "styled-components": "^5.3.6",
108
+ "typescript": "^4.9.3"
48
109
  },
49
110
  "peerDependencies": {
50
111
  "react": "^18",
@@ -52,12 +113,15 @@
52
113
  "react-is": "^18",
53
114
  "styled-components": "^5.2"
54
115
  },
116
+ "engines": {
117
+ "node": ">=14.0.0"
118
+ },
55
119
  "repository": {
56
120
  "type": "git",
57
- "url": "git+https://github.com/sanity-io/design.git"
121
+ "url": "git+https://github.com/sanity-io/ui.git"
58
122
  },
59
123
  "bugs": {
60
- "url": "https://github.com/sanity-io/design/issues"
124
+ "url": "https://github.com/sanity-io/ui/issues"
61
125
  },
62
126
  "keywords": [
63
127
  "sanity",
@@ -66,8 +130,33 @@
66
130
  ],
67
131
  "author": "Sanity.io <hello@sanity.io>",
68
132
  "homepage": "https://www.sanity.io/",
133
+ "commitlint": {
134
+ "extends": [
135
+ "@commitlint/config-conventional"
136
+ ]
137
+ },
138
+ "lint-staged": {
139
+ "*": [
140
+ "prettier --write --cache --ignore-unknown"
141
+ ]
142
+ },
143
+ "packageManager": "pnpm@7.12.2",
69
144
  "publishConfig": {
70
145
  "access": "public"
71
146
  },
72
- "gitHead": "4b884675a828c6aad24f80390a96af14e8084ddc"
147
+ "release": {
148
+ "extends": "@sanity/semantic-release-preset",
149
+ "branches": [
150
+ "+([0-9])?(.{+([0-9]),x}).x",
151
+ "main",
152
+ {
153
+ "name": "beta",
154
+ "prerelease": true
155
+ },
156
+ {
157
+ "name": "alpha",
158
+ "prerelease": true
159
+ }
160
+ ]
161
+ }
73
162
  }
@@ -1,6 +1,6 @@
1
1
  import {Autocomplete, Box, Card, Container, Stack, Text} from '@sanity/ui'
2
2
  import {useBoolean, useSelect, useText} from '@sanity/ui-workshop'
3
- import {PerfTestProps, usePerfTest} from '@sanity/ui-workshop'
3
+ import {PerfTestProps, usePerfTest} from '@sanity/ui-workshop/plugin-perf'
4
4
  import {fireEvent} from '@testing-library/dom'
5
5
  import {useCallback, useMemo, useState} from 'react'
6
6
  import {
@@ -1,35 +1,39 @@
1
1
  import {defineScope} from '@sanity/ui-workshop'
2
2
  import {lazy} from 'react'
3
3
 
4
- export default defineScope('components/autocomplete', 'Autocomplete', [
5
- {
6
- name: 'example',
7
- title: 'Example',
8
- component: lazy(() => import('./example')),
9
- },
10
- {
11
- name: 'custom',
12
- title: 'Custom',
13
- component: lazy(() => import('./custom')),
14
- },
15
- {
16
- name: 'async',
17
- title: 'Async',
18
- component: lazy(() => import('./async')),
19
- },
20
- {
21
- name: 'constrained-height',
22
- title: 'Constrained height',
23
- component: lazy(() => import('./constrainedHeight')),
24
- },
25
- {
26
- name: 'focus-and-blur',
27
- title: 'Focus and blur',
28
- component: lazy(() => import('./focusAndBlur')),
29
- },
30
- {
31
- name: 'fullscreen',
32
- title: 'Fullscreen',
33
- component: lazy(() => import('./fullscreen')),
34
- },
35
- ])
4
+ export default defineScope({
5
+ name: 'components/autocomplete',
6
+ title: 'Autocomplete',
7
+ stories: [
8
+ {
9
+ name: 'example',
10
+ title: 'Example',
11
+ component: lazy(() => import('./example')),
12
+ },
13
+ {
14
+ name: 'custom',
15
+ title: 'Custom',
16
+ component: lazy(() => import('./custom')),
17
+ },
18
+ {
19
+ name: 'async',
20
+ title: 'Async',
21
+ component: lazy(() => import('./async')),
22
+ },
23
+ {
24
+ name: 'constrained-height',
25
+ title: 'Constrained height',
26
+ component: lazy(() => import('./constrainedHeight')),
27
+ },
28
+ {
29
+ name: 'focus-and-blur',
30
+ title: 'Focus and blur',
31
+ component: lazy(() => import('./focusAndBlur')),
32
+ },
33
+ {
34
+ name: 'fullscreen',
35
+ title: 'Fullscreen',
36
+ component: lazy(() => import('./fullscreen')),
37
+ },
38
+ ],
39
+ })
@@ -37,7 +37,6 @@ import {autocompleteReducer} from './autocompleteReducer'
37
37
  import {
38
38
  AUTOCOMPLETE_LISTBOX_IGNORE_KEYS,
39
39
  AUTOCOMPLETE_POPOVER_FALLBACK_PLACEMENTS,
40
- AUTOCOMPLETE_POPOVER_MARGINS,
41
40
  AUTOCOMPLETE_POPOVER_PLACEMENT,
42
41
  } from './constants'
43
42
  import {AutocompleteOpenButtonProps, BaseAutocompleteOption} from './types'
@@ -641,7 +640,6 @@ const InnerAutocomplete = forwardRef(function InnerAutocomplete<
641
640
 
642
641
  return (
643
642
  <Popover
644
- __unstable_margins={AUTOCOMPLETE_POPOVER_MARGINS}
645
643
  arrow={false}
646
644
  constrainSize
647
645
  content={content}
@@ -650,6 +648,7 @@ const InnerAutocomplete = forwardRef(function InnerAutocomplete<
650
648
  onMouseEnter={handlePopoverMouseEnter}
651
649
  onMouseLeave={handlePopoverMouseLeave}
652
650
  open={expanded}
651
+ overflow="auto"
653
652
  placement={AUTOCOMPLETE_POPOVER_PLACEMENT}
654
653
  portal
655
654
  radius={radius}
@@ -1,4 +1,4 @@
1
- import {Placement, PopoverMargins} from '../../types'
1
+ import {Placement} from '../../types'
2
2
 
3
3
  /**
4
4
  * @internal
@@ -20,14 +20,9 @@ export const AUTOCOMPLETE_LISTBOX_IGNORE_KEYS = [
20
20
  /**
21
21
  * @internal
22
22
  */
23
- export const AUTOCOMPLETE_POPOVER_MARGINS: PopoverMargins = [0, 1, 0, 0]
23
+ export const AUTOCOMPLETE_POPOVER_PLACEMENT: Placement = 'bottom-start'
24
24
 
25
25
  /**
26
26
  * @internal
27
27
  */
28
- export const AUTOCOMPLETE_POPOVER_PLACEMENT: Placement = 'bottom'
29
-
30
- /**
31
- * @internal
32
- */
33
- export const AUTOCOMPLETE_POPOVER_FALLBACK_PLACEMENTS: Placement[] = ['bottom', 'top']
28
+ export const AUTOCOMPLETE_POPOVER_FALLBACK_PLACEMENTS: Placement[] = ['bottom-start', 'top-start']
@@ -1,10 +1,14 @@
1
1
  import {defineScope} from '@sanity/ui-workshop'
2
2
  import {lazy} from 'react'
3
3
 
4
- export default defineScope('components/breadcrumbs', 'Breadcrumbs', [
5
- {
6
- name: 'example',
7
- title: 'Example',
8
- component: lazy(() => import('./example')),
9
- },
10
- ])
4
+ export default defineScope({
5
+ name: 'components/breadcrumbs',
6
+ title: 'Breadcrumbs',
7
+ stories: [
8
+ {
9
+ name: 'example',
10
+ title: 'Example',
11
+ component: lazy(() => import('./example')),
12
+ },
13
+ ],
14
+ })
@@ -1,12 +1,16 @@
1
1
  import {defineScope} from '@sanity/ui-workshop'
2
2
  import {lazy} from 'react'
3
3
 
4
- export default defineScope('components/dialog', 'Dialog', [
5
- {name: 'props', title: 'Props', component: lazy(() => import('./props'))},
6
- {name: 'nested', title: 'Nested', component: lazy(() => import('./nested'))},
7
- {name: 'on-scroll', title: 'On scroll', component: lazy(() => import('./onScroll'))},
8
- {name: 'layering', title: 'Layering', component: lazy(() => import('./layering'))},
9
- {name: 'position', title: 'Position', component: lazy(() => import('./position'))},
10
- {name: 'provider', title: 'Provider', component: lazy(() => import('./provider'))},
11
- {name: 'auto-focus', title: 'AutoFocus', component: lazy(() => import('./autoFocus'))},
12
- ])
4
+ export default defineScope({
5
+ name: 'components/dialog',
6
+ title: 'Dialog',
7
+ stories: [
8
+ {name: 'props', title: 'Props', component: lazy(() => import('./props'))},
9
+ {name: 'nested', title: 'Nested', component: lazy(() => import('./nested'))},
10
+ {name: 'on-scroll', title: 'On scroll', component: lazy(() => import('./onScroll'))},
11
+ {name: 'layering', title: 'Layering', component: lazy(() => import('./layering'))},
12
+ {name: 'position', title: 'Position', component: lazy(() => import('./position'))},
13
+ {name: 'provider', title: 'Provider', component: lazy(() => import('./provider'))},
14
+ {name: 'auto-focus', title: 'AutoFocus', component: lazy(() => import('./autoFocus'))},
15
+ ],
16
+ })
@@ -1,6 +1,14 @@
1
1
  import {defineScope} from '@sanity/ui-workshop'
2
2
  import {lazy} from 'react'
3
3
 
4
- export default defineScope('components/hotkeys', 'Hotkeys', [
5
- {name: 'plain', title: 'Plain', component: lazy(() => import('./plain'))},
6
- ])
4
+ export default defineScope({
5
+ name: 'components/hotkeys',
6
+ title: 'Hotkeys',
7
+ stories: [
8
+ {
9
+ name: 'plain',
10
+ title: 'Plain',
11
+ component: lazy(() => import('./plain')),
12
+ },
13
+ ],
14
+ })
@@ -1,70 +1,74 @@
1
1
  import {defineScope} from '@sanity/ui-workshop'
2
2
  import {lazy} from 'react'
3
3
 
4
- export default defineScope('components/menu', 'Menu', [
5
- {
6
- name: 'menu-button',
7
- title: 'MenuButton',
8
- component: lazy(() => import('./menuButton')),
9
- },
10
- {
11
- name: 'nested-menu-items',
12
- title: 'Nested MenuItems',
13
- component: lazy(() => import('./nestedMenu')),
14
- },
15
- {
16
- name: 'custom-menu-item',
17
- title: 'Custom MenuItem',
18
- component: lazy(() => import('./customMenuItem')),
19
- },
20
- {
21
- name: 'groups',
22
- title: 'Groups',
23
- component: lazy(() => import('./groups')),
24
- },
25
- {
26
- name: 'menu-group-right',
27
- title: 'Menu group (right)',
28
- component: lazy(() => import('./menuGroupRight')),
29
- },
30
- {
31
- name: 'tones',
32
- title: 'Tones',
33
- component: lazy(() => import('./tones')),
34
- },
35
- {
36
- name: 'selected-item',
37
- title: 'Selected item',
38
- component: lazy(() => import('./selectedItem')),
39
- },
40
- {
41
- name: 'closable',
42
- title: 'Closeable',
43
- component: lazy(() => import('./closableMenuButton')),
44
- },
45
- {
46
- name: 'without-arrow',
47
- title: 'Without arrow',
48
- component: lazy(() => import('./withoutArrow')),
49
- },
50
- {
51
- name: 'constrained-in-boundary',
52
- title: 'Constrained in boundary',
53
- component: lazy(() => import('./constrainedInBoundary')),
54
- },
55
- {
56
- name: 'as-component',
57
- title: 'As component',
58
- component: lazy(() => import('./asComponent')),
59
- },
60
- {
61
- name: 'disable-focus-on-close',
62
- title: 'Disable focus on close',
63
- component: lazy(() => import('./disableFocusOnClose')),
64
- },
65
- {
66
- name: 'menu-button-with-on-close',
67
- title: 'MenuButton with on close',
68
- component: lazy(() => import('./onCloseMenuButton')),
69
- },
70
- ])
4
+ export default defineScope({
5
+ name: 'components/menu',
6
+ title: 'Menu',
7
+ stories: [
8
+ {
9
+ name: 'menu-button',
10
+ title: 'MenuButton',
11
+ component: lazy(() => import('./menuButton')),
12
+ },
13
+ {
14
+ name: 'nested-menu-items',
15
+ title: 'Nested MenuItems',
16
+ component: lazy(() => import('./nestedMenu')),
17
+ },
18
+ {
19
+ name: 'custom-menu-item',
20
+ title: 'Custom MenuItem',
21
+ component: lazy(() => import('./customMenuItem')),
22
+ },
23
+ {
24
+ name: 'groups',
25
+ title: 'Groups',
26
+ component: lazy(() => import('./groups')),
27
+ },
28
+ {
29
+ name: 'menu-group-right',
30
+ title: 'Menu group (right)',
31
+ component: lazy(() => import('./menuGroupRight')),
32
+ },
33
+ {
34
+ name: 'tones',
35
+ title: 'Tones',
36
+ component: lazy(() => import('./tones')),
37
+ },
38
+ {
39
+ name: 'selected-item',
40
+ title: 'Selected item',
41
+ component: lazy(() => import('./selectedItem')),
42
+ },
43
+ {
44
+ name: 'closable',
45
+ title: 'Closeable',
46
+ component: lazy(() => import('./closableMenuButton')),
47
+ },
48
+ {
49
+ name: 'without-arrow',
50
+ title: 'Without arrow',
51
+ component: lazy(() => import('./withoutArrow')),
52
+ },
53
+ {
54
+ name: 'constrained-in-boundary',
55
+ title: 'Constrained in boundary',
56
+ component: lazy(() => import('./constrainedInBoundary')),
57
+ },
58
+ {
59
+ name: 'as-component',
60
+ title: 'As component',
61
+ component: lazy(() => import('./asComponent')),
62
+ },
63
+ {
64
+ name: 'disable-focus-on-close',
65
+ title: 'Disable focus on close',
66
+ component: lazy(() => import('./disableFocusOnClose')),
67
+ },
68
+ {
69
+ name: 'menu-button-with-on-close',
70
+ title: 'MenuButton with on close',
71
+ component: lazy(() => import('./onCloseMenuButton')),
72
+ },
73
+ ],
74
+ })
@@ -228,28 +228,30 @@ export const MenuButton = forwardRef(function MenuButton(
228
228
  [buttonProp, handleButtonClick, handleButtonKeyDown, id, open, setButtonRef]
229
229
  )
230
230
 
231
- const popoverProps: PopoverProps = useMemo(() => {
232
- return {
231
+ const popoverProps: MenuButtonProps['popover'] = useMemo(
232
+ () => ({
233
233
  boundaryElement: deprecated_boundaryElement,
234
+ overflow: 'auto',
234
235
  placement: deprecated_placement,
235
236
  portal: deprecated_portal,
236
- radius: deprecated_popoverRadius,
237
237
  preventOverflow: deprecated_preventOverflow,
238
+ radius: deprecated_popoverRadius,
238
239
  scheme: deprecated_popoverScheme,
239
240
  ...(popover || {}),
240
- }
241
- }, [
242
- deprecated_boundaryElement,
243
- deprecated_preventOverflow,
244
- deprecated_placement,
245
- popover,
246
- deprecated_popoverRadius,
247
- deprecated_portal,
248
- deprecated_popoverScheme,
249
- ])
241
+ }),
242
+ [
243
+ deprecated_boundaryElement,
244
+ deprecated_placement,
245
+ deprecated_popoverRadius,
246
+ deprecated_popoverScheme,
247
+ deprecated_portal,
248
+ deprecated_preventOverflow,
249
+ popover,
250
+ ]
251
+ )
250
252
 
251
253
  return (
252
- <Popover {...popoverProps} content={menu} data-ui="MenuButton__popover" open={open}>
254
+ <Popover data-ui="MenuButton__popover" {...popoverProps} content={menu} open={open}>
253
255
  {button || <></>}
254
256
  </Popover>
255
257
  )
@@ -1,7 +1,11 @@
1
1
  import {defineScope} from '@sanity/ui-workshop'
2
2
  import {lazy} from 'react'
3
3
 
4
- export default defineScope('components/skeleton', 'Skeleton', [
5
- {name: 'skeleton', title: 'Skeleton', component: lazy(() => import('./skeleton'))},
6
- {name: 'skeleton-delay', title: 'Skeleton delay', component: lazy(() => import('./delay'))},
7
- ])
4
+ export default defineScope({
5
+ name: 'components/skeleton',
6
+ title: 'Skeleton',
7
+ stories: [
8
+ {name: 'skeleton', title: 'Skeleton', component: lazy(() => import('./skeleton'))},
9
+ {name: 'skeleton-delay', title: 'Skeleton delay', component: lazy(() => import('./delay'))},
10
+ ],
11
+ })
@@ -1,6 +1,14 @@
1
1
  import {defineScope} from '@sanity/ui-workshop'
2
2
  import {lazy} from 'react'
3
3
 
4
- export default defineScope('components/tab', 'Tab', [
5
- {name: 'example', title: 'Example', component: lazy(() => import('./example'))},
6
- ])
4
+ export default defineScope({
5
+ name: 'components/tab',
6
+ title: 'Tab',
7
+ stories: [
8
+ {
9
+ name: 'example',
10
+ title: 'Example',
11
+ component: lazy(() => import('./example')),
12
+ },
13
+ ],
14
+ })
@@ -1,7 +1,19 @@
1
1
  import {defineScope} from '@sanity/ui-workshop'
2
2
  import {lazy} from 'react'
3
3
 
4
- export default defineScope('components/toast', 'Toast', [
5
- {name: 'toast', title: 'Toast', component: lazy(() => import('./toast'))},
6
- {name: 'hook', title: 'Hook', component: lazy(() => import('./hook'))},
7
- ])
4
+ export default defineScope({
5
+ name: 'components/toast',
6
+ title: 'Toast',
7
+ stories: [
8
+ {
9
+ name: 'toast',
10
+ title: 'Toast',
11
+ component: lazy(() => import('./toast')),
12
+ },
13
+ {
14
+ name: 'hook',
15
+ title: 'Hook',
16
+ component: lazy(() => import('./hook')),
17
+ },
18
+ ],
19
+ })