@sanity/ui 1.0.0-next.3 → 1.0.1
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/README.md +2 -2
- package/dist/{types/src/index.d.ts → index.d.ts} +4450 -4398
- package/dist/{sanity-ui.esm.js → index.esm.js} +889 -2678
- package/dist/index.esm.js.map +1 -0
- package/dist/{sanity-ui.js → index.js} +883 -2688
- package/dist/index.js.map +1 -0
- package/package.json +114 -23
- package/src/components/autocomplete/__workshop__/constrainedHeight.tsx +2 -2
- package/src/components/autocomplete/__workshop__/example.tsx +1 -1
- package/src/components/autocomplete/__workshop__/index.ts +36 -32
- package/src/components/autocomplete/autocomplete.styles.tsx +22 -28
- 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/breadcrumbs/breadcrumbs.styles.ts +13 -18
- package/src/components/dialog/__workshop__/index.ts +13 -9
- package/src/components/dialog/dialog.tsx +53 -67
- package/src/components/hotkeys/__workshop__/index.ts +11 -3
- package/src/components/hotkeys/hotkeys.tsx +12 -16
- package/src/components/menu/__workshop__/index.ts +71 -67
- package/src/components/menu/menu.tsx +5 -7
- package/src/components/menu/menuButton.tsx +16 -14
- package/src/components/menu/menuDivider.ts +8 -10
- package/src/components/skeleton/__workshop__/index.ts +8 -4
- package/src/components/skeleton/skeleton.tsx +4 -6
- package/src/components/skeleton/styles.ts +13 -9
- package/src/components/skeleton/textSkeleton.tsx +12 -14
- package/src/components/tab/__workshop__/index.ts +11 -3
- package/src/components/toast/__workshop__/index.ts +16 -4
- package/src/components/toast/toast.tsx +6 -11
- package/src/components/toast/toastProvider.tsx +18 -22
- 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/components/tree/style.ts +78 -76
- package/src/components/tree/treeItem.tsx +7 -12
- package/src/global.ts +6 -0
- package/src/hooks/useElementRect/__workshop__/index.ts +11 -3
- package/src/hooks/useMediaIndex/__workshop__/index.ts +11 -3
- package/src/primitives/_selectable/selectable.tsx +4 -7
- package/src/primitives/_selectable/style.ts +85 -82
- package/src/primitives/avatar/__workshop__/index.ts +16 -12
- package/src/primitives/avatar/avatar.tsx +9 -12
- package/src/primitives/avatar/avatarCounter.tsx +22 -24
- package/src/primitives/avatar/avatarStack.tsx +16 -14
- package/src/primitives/avatar/styles.ts +1 -1
- package/src/primitives/badge/__workshop__/index.ts +16 -12
- package/src/primitives/badge/__workshop__/tones.tsx +1 -1
- package/src/primitives/badge/badge.tsx +6 -5
- package/src/primitives/box/__workshop__/index.ts +16 -4
- package/src/primitives/box/box.tsx +21 -49
- package/src/primitives/button/__workshop__/index.ts +51 -47
- package/src/primitives/button/__workshop__/sanityUploadButton.tsx +19 -20
- package/src/primitives/button/__workshop__/styled1.tsx +6 -6
- package/src/primitives/button/button.tsx +20 -26
- package/src/primitives/button/styles.ts +30 -29
- package/src/primitives/card/__workshop__/index.ts +15 -11
- package/src/primitives/card/card.tsx +9 -25
- package/src/primitives/card/styles.ts +119 -114
- package/src/primitives/checkbox/__workshop__/index.ts +10 -6
- package/src/primitives/checkbox/checkbox.tsx +4 -4
- package/src/primitives/checkbox/styles.ts +71 -69
- package/src/primitives/code/__workshop__/index.ts +16 -12
- package/src/primitives/code/code.tsx +3 -5
- package/src/primitives/code/styles.ts +20 -18
- package/src/primitives/container/__workshop__/index.ts +5 -3
- package/src/primitives/container/container.tsx +5 -4
- package/src/primitives/flex/__workshop__/index.ts +8 -4
- package/src/primitives/flex/flex.tsx +7 -23
- package/src/primitives/grid/__workshop__/index.ts +7 -3
- package/src/primitives/grid/grid.tsx +4 -27
- package/src/primitives/heading/__workshop__/index.ts +16 -12
- package/src/primitives/heading/heading.tsx +10 -17
- package/src/primitives/heading/styles.ts +45 -36
- package/src/primitives/inline/__workshop__/index.ts +5 -3
- package/src/primitives/inline/inline.tsx +3 -5
- package/src/primitives/kbd/__workshop__/index.ts +5 -3
- package/src/primitives/kbd/kbd.tsx +12 -13
- package/src/primitives/label/__workshop__/index.ts +16 -12
- package/src/primitives/label/label.tsx +13 -18
- package/src/primitives/label/styles.ts +24 -18
- 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 +220 -196
- package/src/primitives/popover/popoverArrow.tsx +42 -48
- package/src/primitives/popover/popoverCard.tsx +12 -22
- package/src/primitives/radio/__workshop__/index.ts +8 -4
- package/src/primitives/radio/radio.tsx +3 -3
- package/src/primitives/radio/styles.ts +73 -73
- package/src/primitives/select/__workshop__/index.ts +8 -4
- package/src/primitives/select/select.tsx +9 -11
- package/src/primitives/select/styles.ts +77 -77
- package/src/primitives/spinner/__workshop__/index.ts +11 -7
- package/src/primitives/spinner/spinner.tsx +2 -5
- package/src/primitives/stack/__workshop__/index.ts +11 -7
- package/src/primitives/stack/stack.tsx +3 -5
- package/src/primitives/switch/__workshop__/index.ts +8 -4
- package/src/primitives/switch/styles.ts +119 -112
- package/src/primitives/switch/switch.tsx +6 -6
- package/src/primitives/text/__workshop__/index.ts +21 -17
- package/src/primitives/text/styles.ts +51 -45
- package/src/primitives/text/text.tsx +11 -16
- package/src/primitives/textArea/__workshop__/index.ts +11 -7
- package/src/primitives/textArea/textArea.tsx +15 -22
- package/src/primitives/textInput/__workshop__/index.ts +46 -42
- package/src/primitives/textInput/__workshop__/plain.tsx +2 -1
- package/src/primitives/textInput/textInput.tsx +50 -69
- package/src/primitives/tooltip/__workshop__/index.ts +11 -7
- package/src/primitives/tooltip/tooltip.tsx +3 -6
- package/src/primitives/tooltip/tooltipArrow.tsx +69 -59
- package/src/styles/border/borderStyle.ts +10 -18
- package/src/styles/box/boxStyle.ts +14 -18
- package/src/styles/flex/flexItemStyle.ts +7 -1
- package/src/styles/flex/flexStyle.ts +14 -9
- package/src/styles/grid/gridItemStyle.ts +18 -30
- package/src/styles/grid/gridStyle.ts +25 -33
- package/src/styles/helpers.ts +2 -2
- package/src/styles/index.ts +0 -1
- package/src/styles/input/textInputStyle.ts +127 -123
- package/src/styles/margin/marginStyle.ts +11 -10
- package/src/styles/margin/marginsStyle.test.ts +12 -10
- package/src/styles/padding/paddingStyle.test.ts +12 -10
- package/src/styles/padding/paddingStyle.ts +9 -10
- 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/layer/layer.tsx +4 -6
- package/src/utils/portal/__workshop__/index.ts +11 -7
- package/src/utils/srOnly/srOnly.tsx +8 -10
- package/src/utils/virtualList/__workshop__/index.ts +26 -22
- package/src/utils/virtualList/virtualList.tsx +10 -14
- 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/styles/compose.ts +0 -35
- 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.
|
|
3
|
+
"version": "1.0.1",
|
|
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,92 @@
|
|
|
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
|
+
"check:pkg": "pkg --strict",
|
|
28
|
+
"check:types": "tsc",
|
|
29
|
+
"clean": "rimraf .workshop dist",
|
|
30
|
+
"commit": "cz",
|
|
31
|
+
"cypress:dev": "run-p dev cypress:open",
|
|
32
|
+
"cypress:open": "cypress open",
|
|
33
|
+
"cypress:run": "cypress run",
|
|
34
|
+
"dev": "run-s workshop:dev",
|
|
35
|
+
"format": "prettier --write --cache --ignore-unknown .",
|
|
36
|
+
"lint": "eslint . --ext .cjs,.js,.jsx,.mjs,.ts,.tsx --quiet",
|
|
37
|
+
"prepare": "husky install",
|
|
38
|
+
"prepublishOnly": "pnpm build",
|
|
39
|
+
"release": "semantic-release",
|
|
30
40
|
"test": "jest",
|
|
31
|
-
"
|
|
32
|
-
"watch": "pkg watch"
|
|
41
|
+
"test:browser": "start-server-and-test 'run-s workshop:build workshop:start' http://localhost:1337 'run-s cypress:run'",
|
|
42
|
+
"watch": "pkg watch --strict",
|
|
43
|
+
"workshop:build": "node -r esbuild-register -r tsconfig-paths/register scripts/build",
|
|
44
|
+
"workshop:dev": "node -r esbuild-register -r tsconfig-paths/register scripts/dev",
|
|
45
|
+
"workshop:start": "http-server -a localhost -c-0 -p 1337 -s -P http://localhost:1337/index.html? dist"
|
|
33
46
|
},
|
|
34
47
|
"dependencies": {
|
|
35
48
|
"@floating-ui/react-dom": "^1.0.0",
|
|
36
|
-
"@sanity/color": "2.1.
|
|
37
|
-
"@sanity/icons": "
|
|
49
|
+
"@sanity/color": "^2.1.20",
|
|
50
|
+
"@sanity/icons": "^2.0.0",
|
|
51
|
+
"csstype": "^3.1.1",
|
|
38
52
|
"framer-motion": "^7.5.3",
|
|
39
53
|
"react-refractor": "^2.1.7"
|
|
40
54
|
},
|
|
41
55
|
"devDependencies": {
|
|
56
|
+
"@babel/core": "^7.20.2",
|
|
57
|
+
"@babel/preset-env": "^7.20.2",
|
|
58
|
+
"@babel/preset-react": "^7.18.6",
|
|
59
|
+
"@babel/preset-typescript": "^7.18.6",
|
|
60
|
+
"@commitlint/cli": "^17.3.0",
|
|
61
|
+
"@commitlint/config-conventional": "^17.3.0",
|
|
42
62
|
"@juggle/resize-observer": "^3.4.0",
|
|
63
|
+
"@sanity/pkg-utils": "^1.18.0",
|
|
64
|
+
"@sanity/semantic-release-preset": "^2.0.2",
|
|
65
|
+
"@sanity/ui-workshop": "^1.0.1",
|
|
66
|
+
"@testing-library/dom": "^8.19.0",
|
|
67
|
+
"@testing-library/jest-dom": "^5.16.5",
|
|
68
|
+
"@testing-library/react": "^13.4.0",
|
|
69
|
+
"@types/jest": "^29.2.3",
|
|
70
|
+
"@types/jest-axe": "^3.5.5",
|
|
71
|
+
"@types/node": "^18.11.9",
|
|
72
|
+
"@types/react": "^18.0.25",
|
|
73
|
+
"@types/react-dom": "^18.0.9",
|
|
74
|
+
"@types/react-is": "^17.0.3",
|
|
43
75
|
"@types/refractor": "^3.0.2",
|
|
76
|
+
"@types/styled-components": "^5.1.26",
|
|
77
|
+
"@types/testing-library__jest-dom": "^5.14.5",
|
|
78
|
+
"@typescript-eslint/eslint-plugin": "^5.44.0",
|
|
79
|
+
"@typescript-eslint/parser": "^5.44.0",
|
|
80
|
+
"commitizen": "^4.2.5",
|
|
81
|
+
"cypress": "^11.2.0",
|
|
82
|
+
"cypress-real-events": "^1.7.4",
|
|
83
|
+
"cz-conventional-changelog": "^3.3.0",
|
|
84
|
+
"esbuild": "^0.15.15",
|
|
85
|
+
"esbuild-register": "^3.4.1",
|
|
86
|
+
"eslint": "^8.28.0",
|
|
87
|
+
"eslint-config-prettier": "^8.5.0",
|
|
88
|
+
"eslint-plugin-import": "^2.26.0",
|
|
89
|
+
"eslint-plugin-jsx-a11y": "^6.6.1",
|
|
90
|
+
"eslint-plugin-prettier": "^4.2.1",
|
|
91
|
+
"eslint-plugin-react": "^7.31.11",
|
|
92
|
+
"eslint-plugin-react-hooks": "^4.6.0",
|
|
93
|
+
"http-server": "^14.1.1",
|
|
94
|
+
"husky": "^8.0.2",
|
|
95
|
+
"jest": "^29.3.1",
|
|
96
|
+
"jest-axe": "^7.0.0",
|
|
97
|
+
"jest-environment-jsdom": "^29.3.1",
|
|
98
|
+
"lint-staged": "^13.0.3",
|
|
99
|
+
"module-alias": "^2.2.2",
|
|
100
|
+
"npm-run-all": "^4.1.5",
|
|
101
|
+
"prettier": "^2.8.0",
|
|
44
102
|
"react": "^18.2.0",
|
|
45
103
|
"react-dom": "^18.2.0",
|
|
46
104
|
"react-is": "^18.2.0",
|
|
47
|
-
"
|
|
105
|
+
"rimraf": "^3.0.2",
|
|
106
|
+
"semantic-release": "^19.0.5",
|
|
107
|
+
"start-server-and-test": "^1.14.0",
|
|
108
|
+
"styled-components": "^5.3.6",
|
|
109
|
+
"tsconfig-paths": "^4.1.0",
|
|
110
|
+
"typescript": "^4.9.3"
|
|
48
111
|
},
|
|
49
112
|
"peerDependencies": {
|
|
50
113
|
"react": "^18",
|
|
@@ -52,12 +115,15 @@
|
|
|
52
115
|
"react-is": "^18",
|
|
53
116
|
"styled-components": "^5.2"
|
|
54
117
|
},
|
|
118
|
+
"engines": {
|
|
119
|
+
"node": ">=14.0.0"
|
|
120
|
+
},
|
|
55
121
|
"repository": {
|
|
56
122
|
"type": "git",
|
|
57
|
-
"url": "git+https://github.com/sanity-io/
|
|
123
|
+
"url": "git+https://github.com/sanity-io/ui.git"
|
|
58
124
|
},
|
|
59
125
|
"bugs": {
|
|
60
|
-
"url": "https://github.com/sanity-io/
|
|
126
|
+
"url": "https://github.com/sanity-io/ui/issues"
|
|
61
127
|
},
|
|
62
128
|
"keywords": [
|
|
63
129
|
"sanity",
|
|
@@ -66,8 +132,33 @@
|
|
|
66
132
|
],
|
|
67
133
|
"author": "Sanity.io <hello@sanity.io>",
|
|
68
134
|
"homepage": "https://www.sanity.io/",
|
|
135
|
+
"commitlint": {
|
|
136
|
+
"extends": [
|
|
137
|
+
"@commitlint/config-conventional"
|
|
138
|
+
]
|
|
139
|
+
},
|
|
140
|
+
"lint-staged": {
|
|
141
|
+
"*": [
|
|
142
|
+
"prettier --write --cache --ignore-unknown"
|
|
143
|
+
]
|
|
144
|
+
},
|
|
145
|
+
"packageManager": "pnpm@7.12.2",
|
|
69
146
|
"publishConfig": {
|
|
70
147
|
"access": "public"
|
|
71
148
|
},
|
|
72
|
-
"
|
|
149
|
+
"release": {
|
|
150
|
+
"extends": "@sanity/semantic-release-preset",
|
|
151
|
+
"branches": [
|
|
152
|
+
"+([0-9])?(.{+([0-9]),x}).x",
|
|
153
|
+
"main",
|
|
154
|
+
{
|
|
155
|
+
"name": "beta",
|
|
156
|
+
"prerelease": true
|
|
157
|
+
},
|
|
158
|
+
{
|
|
159
|
+
"name": "alpha",
|
|
160
|
+
"prerelease": true
|
|
161
|
+
}
|
|
162
|
+
]
|
|
163
|
+
}
|
|
73
164
|
}
|
|
@@ -95,7 +95,8 @@ function ConstrainedHeightExampleField({id, label}: {id: string; label: string})
|
|
|
95
95
|
constrainSize
|
|
96
96
|
matchReferenceWidth
|
|
97
97
|
open
|
|
98
|
-
|
|
98
|
+
overflow="auto"
|
|
99
|
+
placement="bottom-start"
|
|
99
100
|
radius={1}
|
|
100
101
|
ref={popoverRef}
|
|
101
102
|
referenceElement={inputElement}
|
|
@@ -118,7 +119,6 @@ function ConstrainedHeightExampleField({id, label}: {id: string; label: string})
|
|
|
118
119
|
openButton
|
|
119
120
|
options={options}
|
|
120
121
|
placeholder="Search"
|
|
121
|
-
// popover={{allowedAutoPlacements: ['bottom-start', 'top-start']}}
|
|
122
122
|
radius={1}
|
|
123
123
|
renderOption={renderOption}
|
|
124
124
|
renderPopover={renderPopover}
|
|
@@ -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
|
+
})
|
|
@@ -1,44 +1,38 @@
|
|
|
1
1
|
import {SpinnerIcon} from '@sanity/icons'
|
|
2
|
-
import {memo} from 'react'
|
|
3
2
|
import styled, {keyframes} from 'styled-components'
|
|
4
3
|
import {Box} from '../../primitives'
|
|
5
4
|
|
|
6
5
|
/**
|
|
7
6
|
* @internal
|
|
8
7
|
*/
|
|
9
|
-
export const Root =
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
})
|
|
13
|
-
)
|
|
8
|
+
export const Root = styled.div`
|
|
9
|
+
line-height: 0;
|
|
10
|
+
`
|
|
14
11
|
|
|
15
12
|
/**
|
|
16
13
|
* @internal
|
|
17
14
|
*/
|
|
18
|
-
export const ListBox =
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
})
|
|
26
|
-
)
|
|
15
|
+
export const ListBox = styled(Box)`
|
|
16
|
+
& > ul {
|
|
17
|
+
list-style: none;
|
|
18
|
+
padding: 0;
|
|
19
|
+
margin: 0;
|
|
20
|
+
}
|
|
21
|
+
`
|
|
27
22
|
|
|
28
|
-
const rotate = keyframes
|
|
29
|
-
from
|
|
30
|
-
transform:
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
}
|
|
23
|
+
const rotate = keyframes`
|
|
24
|
+
from {
|
|
25
|
+
transform: rotate(0deg);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
to {
|
|
29
|
+
transform: rotate(360deg);
|
|
30
|
+
}
|
|
31
|
+
`
|
|
36
32
|
|
|
37
33
|
/**
|
|
38
34
|
* @internal
|
|
39
35
|
*/
|
|
40
|
-
export const AnimatedSpinnerIcon =
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
`
|
|
44
|
-
)
|
|
36
|
+
export const AnimatedSpinnerIcon = styled(SpinnerIcon)`
|
|
37
|
+
animation: ${rotate} 500ms linear infinite;
|
|
38
|
+
`
|
|
@@ -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,22 +1,17 @@
|
|
|
1
|
-
import {memo} from 'react'
|
|
2
1
|
import styled from 'styled-components'
|
|
3
2
|
import {Button} from '../../primitives'
|
|
4
3
|
|
|
5
|
-
export const Root =
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
})
|
|
15
|
-
)
|
|
4
|
+
export const Root = styled.ol`
|
|
5
|
+
margin: 0;
|
|
6
|
+
padding: 0;
|
|
7
|
+
display: flex;
|
|
8
|
+
list-style: none;
|
|
9
|
+
align-items: center;
|
|
10
|
+
white-space: nowrap;
|
|
11
|
+
line-height: 0;
|
|
12
|
+
`
|
|
16
13
|
|
|
17
|
-
export const ExpandButton =
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
})
|
|
22
|
-
)
|
|
14
|
+
export const ExpandButton = styled(Button)`
|
|
15
|
+
appearance: none;
|
|
16
|
+
margin: -4px;
|
|
17
|
+
`
|
|
@@ -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,5 +1,5 @@
|
|
|
1
1
|
import {CloseIcon} from '@sanity/icons'
|
|
2
|
-
import {forwardRef,
|
|
2
|
+
import {forwardRef, useCallback, useEffect, useRef, useState} from 'react'
|
|
3
3
|
import styled from 'styled-components'
|
|
4
4
|
import {focusFirstDescendant, focusLastDescendant} from '../../helpers'
|
|
5
5
|
import {useArrayProp, useClickOutside, useForwardedRef, useGlobalKeyDown} from '../../hooks'
|
|
@@ -63,80 +63,66 @@ interface DialogCardProps extends ResponsiveWidthProps {
|
|
|
63
63
|
shadow: number | number[]
|
|
64
64
|
}
|
|
65
65
|
|
|
66
|
-
const Root =
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
responsiveDialogPositionStyle
|
|
71
|
-
)
|
|
66
|
+
const Root = styled(Layer)<ResponsiveDialogPositionStyleProps & ResponsivePaddingStyleProps>(
|
|
67
|
+
responsivePaddingStyle,
|
|
68
|
+
dialogStyle,
|
|
69
|
+
responsiveDialogPositionStyle
|
|
72
70
|
)
|
|
73
71
|
|
|
74
|
-
const DialogContainer =
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
})
|
|
85
|
-
)
|
|
72
|
+
const DialogContainer = styled(Container)`
|
|
73
|
+
&:not([hidden]) {
|
|
74
|
+
display: flex;
|
|
75
|
+
}
|
|
76
|
+
width: 100%;
|
|
77
|
+
height: 100%;
|
|
78
|
+
flex-direction: column;
|
|
79
|
+
align-items: center;
|
|
80
|
+
justify-content: center;
|
|
81
|
+
`
|
|
86
82
|
|
|
87
|
-
const DialogCardRoot =
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
})
|
|
97
|
-
)
|
|
83
|
+
const DialogCardRoot = styled(Card)`
|
|
84
|
+
&:not([hidden]) {
|
|
85
|
+
display: flex;
|
|
86
|
+
}
|
|
87
|
+
width: 100%;
|
|
88
|
+
min-height: 0;
|
|
89
|
+
max-height: 100%;
|
|
90
|
+
overflow: hidden;
|
|
91
|
+
`
|
|
98
92
|
|
|
99
|
-
const DialogLayout =
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
})
|
|
105
|
-
)
|
|
93
|
+
const DialogLayout = styled(Flex)`
|
|
94
|
+
flex: 1;
|
|
95
|
+
min-height: 0;
|
|
96
|
+
width: 100%;
|
|
97
|
+
`
|
|
106
98
|
|
|
107
|
-
const DialogHeader =
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
zIndex: 2,
|
|
99
|
+
const DialogHeader = styled(Card)`
|
|
100
|
+
position: relative;
|
|
101
|
+
z-index: 2;
|
|
111
102
|
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
)
|
|
103
|
+
&:after {
|
|
104
|
+
content: '';
|
|
105
|
+
display: block;
|
|
106
|
+
position: absolute;
|
|
107
|
+
left: 0;
|
|
108
|
+
right: 0;
|
|
109
|
+
bottom: -1px;
|
|
110
|
+
border-bottom: 1px solid var(--card-hairline-soft-color);
|
|
111
|
+
}
|
|
112
|
+
`
|
|
123
113
|
|
|
124
|
-
const DialogContent =
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
})
|
|
131
|
-
)
|
|
114
|
+
const DialogContent = styled(Box)`
|
|
115
|
+
position: relative;
|
|
116
|
+
z-index: 1;
|
|
117
|
+
overflow: auto;
|
|
118
|
+
outline: none;
|
|
119
|
+
`
|
|
132
120
|
|
|
133
|
-
const DialogFooter =
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
})
|
|
139
|
-
)
|
|
121
|
+
const DialogFooter = styled(Box)`
|
|
122
|
+
position: relative;
|
|
123
|
+
z-index: 3;
|
|
124
|
+
border-top: 1px solid var(--card-hairline-soft-color);
|
|
125
|
+
`
|
|
140
126
|
|
|
141
127
|
const DialogCard = forwardRef(function DialogCard(
|
|
142
128
|
props: DialogCardProps,
|
|
@@ -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
|
+
})
|