@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.
- package/LICENSE +1 -1
- package/dist/{types/src/index.d.ts → index.d.ts} +136 -68
- package/dist/{sanity-ui.esm.js → index.esm.js} +698 -1525
- package/dist/index.esm.js.map +1 -0
- package/dist/{sanity-ui.js → index.js} +697 -1539
- package/dist/index.js.map +1 -0
- package/package.json +112 -23
- package/src/components/autocomplete/__workshop__/example.tsx +1 -1
- package/src/components/autocomplete/__workshop__/index.ts +36 -32
- package/src/components/autocomplete/autocomplete.tsx +1 -2
- package/src/components/autocomplete/constants.ts +3 -8
- package/src/components/breadcrumbs/__workshop__/index.ts +11 -7
- package/src/components/dialog/__workshop__/index.ts +13 -9
- package/src/components/hotkeys/__workshop__/index.ts +11 -3
- package/src/components/menu/__workshop__/index.ts +71 -67
- package/src/components/menu/menuButton.tsx +16 -14
- package/src/components/skeleton/__workshop__/index.ts +8 -4
- package/src/components/tab/__workshop__/index.ts +11 -3
- package/src/components/toast/__workshop__/index.ts +16 -4
- package/src/components/tree/__workshop__/basic.perf.ts +1 -14
- package/src/components/tree/__workshop__/basic.tsx +1 -1
- package/src/components/tree/__workshop__/index.ts +12 -8
- package/src/hooks/useElementRect/__workshop__/index.ts +11 -3
- package/src/hooks/useMediaIndex/__workshop__/index.ts +11 -3
- package/src/primitives/avatar/__workshop__/index.ts +16 -12
- package/src/primitives/badge/__workshop__/index.ts +16 -12
- package/src/primitives/badge/__workshop__/tones.tsx +1 -1
- package/src/primitives/box/__workshop__/index.ts +16 -4
- package/src/primitives/button/__workshop__/index.ts +51 -47
- package/src/primitives/card/__workshop__/index.ts +15 -11
- package/src/primitives/checkbox/__workshop__/index.ts +10 -6
- package/src/primitives/code/__workshop__/index.ts +16 -12
- package/src/primitives/container/__workshop__/index.ts +5 -3
- package/src/primitives/flex/__workshop__/index.ts +8 -4
- package/src/primitives/grid/__workshop__/index.ts +7 -3
- package/src/primitives/heading/__workshop__/index.ts +16 -12
- package/src/primitives/inline/__workshop__/index.ts +5 -3
- package/src/primitives/kbd/__workshop__/index.ts +5 -3
- package/src/primitives/label/__workshop__/index.ts +16 -12
- package/src/primitives/popover/__workshop__/PlainStory.tsx +0 -1
- package/src/primitives/popover/__workshop__/TestStory.tsx +0 -1
- package/src/primitives/popover/__workshop__/index.ts +36 -32
- package/src/primitives/popover/constants.ts +0 -3
- package/src/primitives/popover/floating-ui/size.ts +40 -25
- package/src/primitives/popover/popover.tsx +54 -41
- package/src/primitives/popover/popoverCard.tsx +9 -16
- package/src/primitives/radio/__workshop__/index.ts +8 -4
- package/src/primitives/select/__workshop__/index.ts +8 -4
- package/src/primitives/spinner/__workshop__/index.ts +11 -7
- package/src/primitives/stack/__workshop__/index.ts +11 -7
- package/src/primitives/switch/__workshop__/index.ts +8 -4
- package/src/primitives/text/__workshop__/index.ts +21 -17
- package/src/primitives/textArea/__workshop__/index.ts +11 -7
- package/src/primitives/textInput/__workshop__/index.ts +46 -42
- package/src/primitives/textInput/__workshop__/plain.tsx +2 -1
- package/src/primitives/tooltip/__workshop__/index.ts +11 -7
- package/src/theme/__workshop__/index.ts +26 -22
- package/src/theme/{ThemeContext.ts → themeContext.ts} +0 -0
- package/src/utils/boundaryElement/__workshop__/index.ts +11 -7
- package/src/utils/elementQuery/__workshop__/index.ts +11 -7
- package/src/utils/layer/__workshop__/index.ts +21 -17
- package/src/utils/portal/__workshop__/index.ts +11 -7
- package/src/utils/virtualList/__workshop__/index.ts +26 -22
- package/dist/sanity-ui.esm.js.map +0 -1
- package/dist/sanity-ui.js.map +0 -1
- package/src/__workshop__/color/overview.tsx +0 -101
- package/src/__workshop__/index.ts +0 -10
- package/src/icons/__workshop__/.eslintrc +0 -5
- package/src/icons/__workshop__/index.tsx +0 -6
- package/src/icons/__workshop__/overview.tsx +0 -76
- 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.
|
|
3
|
+
"version": "1.0.0-beta.34",
|
|
4
4
|
"sideEffects": false,
|
|
5
|
-
"types": "./dist/
|
|
5
|
+
"types": "./dist/index.d.ts",
|
|
6
6
|
"source": "./src/index.ts",
|
|
7
|
-
"module": "./dist/
|
|
8
|
-
"main": "./dist/
|
|
7
|
+
"module": "./dist/index.esm.js",
|
|
8
|
+
"main": "./dist/index.js",
|
|
9
9
|
"exports": {
|
|
10
10
|
".": {
|
|
11
|
-
"types": "./dist/
|
|
11
|
+
"types": "./dist/index.d.ts",
|
|
12
12
|
"source": "./src/index.ts",
|
|
13
|
-
"import": "./dist/
|
|
14
|
-
"require": "./dist/
|
|
15
|
-
"default": "./dist/
|
|
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
|
|
25
|
-
"
|
|
26
|
-
"
|
|
27
|
-
"
|
|
28
|
-
"
|
|
29
|
-
"
|
|
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
|
-
"
|
|
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": "
|
|
37
|
-
"@sanity/icons": "
|
|
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
|
-
"
|
|
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/
|
|
121
|
+
"url": "git+https://github.com/sanity-io/ui.git"
|
|
58
122
|
},
|
|
59
123
|
"bugs": {
|
|
60
|
-
"url": "https://github.com/sanity-io/
|
|
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
|
-
"
|
|
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(
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
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
|
|
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
|
|
23
|
+
export const AUTOCOMPLETE_POPOVER_PLACEMENT: Placement = 'bottom-start'
|
|
24
24
|
|
|
25
25
|
/**
|
|
26
26
|
* @internal
|
|
27
27
|
*/
|
|
28
|
-
export const
|
|
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(
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
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(
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
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(
|
|
5
|
-
|
|
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(
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
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:
|
|
232
|
-
|
|
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
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
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}
|
|
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(
|
|
5
|
-
|
|
6
|
-
|
|
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(
|
|
5
|
-
|
|
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(
|
|
5
|
-
|
|
6
|
-
|
|
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
|
+
})
|