@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.
Files changed (146) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +2 -2
  3. package/dist/{types/src/index.d.ts → index.d.ts} +4450 -4398
  4. package/dist/{sanity-ui.esm.js → index.esm.js} +889 -2678
  5. package/dist/index.esm.js.map +1 -0
  6. package/dist/{sanity-ui.js → index.js} +883 -2688
  7. package/dist/index.js.map +1 -0
  8. package/package.json +114 -23
  9. package/src/components/autocomplete/__workshop__/constrainedHeight.tsx +2 -2
  10. package/src/components/autocomplete/__workshop__/example.tsx +1 -1
  11. package/src/components/autocomplete/__workshop__/index.ts +36 -32
  12. package/src/components/autocomplete/autocomplete.styles.tsx +22 -28
  13. package/src/components/autocomplete/autocomplete.tsx +1 -2
  14. package/src/components/autocomplete/constants.ts +3 -8
  15. package/src/components/breadcrumbs/__workshop__/index.ts +11 -7
  16. package/src/components/breadcrumbs/breadcrumbs.styles.ts +13 -18
  17. package/src/components/dialog/__workshop__/index.ts +13 -9
  18. package/src/components/dialog/dialog.tsx +53 -67
  19. package/src/components/hotkeys/__workshop__/index.ts +11 -3
  20. package/src/components/hotkeys/hotkeys.tsx +12 -16
  21. package/src/components/menu/__workshop__/index.ts +71 -67
  22. package/src/components/menu/menu.tsx +5 -7
  23. package/src/components/menu/menuButton.tsx +16 -14
  24. package/src/components/menu/menuDivider.ts +8 -10
  25. package/src/components/skeleton/__workshop__/index.ts +8 -4
  26. package/src/components/skeleton/skeleton.tsx +4 -6
  27. package/src/components/skeleton/styles.ts +13 -9
  28. package/src/components/skeleton/textSkeleton.tsx +12 -14
  29. package/src/components/tab/__workshop__/index.ts +11 -3
  30. package/src/components/toast/__workshop__/index.ts +16 -4
  31. package/src/components/toast/toast.tsx +6 -11
  32. package/src/components/toast/toastProvider.tsx +18 -22
  33. package/src/components/tree/__workshop__/basic.perf.ts +1 -14
  34. package/src/components/tree/__workshop__/basic.tsx +1 -1
  35. package/src/components/tree/__workshop__/index.ts +12 -8
  36. package/src/components/tree/style.ts +78 -76
  37. package/src/components/tree/treeItem.tsx +7 -12
  38. package/src/global.ts +6 -0
  39. package/src/hooks/useElementRect/__workshop__/index.ts +11 -3
  40. package/src/hooks/useMediaIndex/__workshop__/index.ts +11 -3
  41. package/src/primitives/_selectable/selectable.tsx +4 -7
  42. package/src/primitives/_selectable/style.ts +85 -82
  43. package/src/primitives/avatar/__workshop__/index.ts +16 -12
  44. package/src/primitives/avatar/avatar.tsx +9 -12
  45. package/src/primitives/avatar/avatarCounter.tsx +22 -24
  46. package/src/primitives/avatar/avatarStack.tsx +16 -14
  47. package/src/primitives/avatar/styles.ts +1 -1
  48. package/src/primitives/badge/__workshop__/index.ts +16 -12
  49. package/src/primitives/badge/__workshop__/tones.tsx +1 -1
  50. package/src/primitives/badge/badge.tsx +6 -5
  51. package/src/primitives/box/__workshop__/index.ts +16 -4
  52. package/src/primitives/box/box.tsx +21 -49
  53. package/src/primitives/button/__workshop__/index.ts +51 -47
  54. package/src/primitives/button/__workshop__/sanityUploadButton.tsx +19 -20
  55. package/src/primitives/button/__workshop__/styled1.tsx +6 -6
  56. package/src/primitives/button/button.tsx +20 -26
  57. package/src/primitives/button/styles.ts +30 -29
  58. package/src/primitives/card/__workshop__/index.ts +15 -11
  59. package/src/primitives/card/card.tsx +9 -25
  60. package/src/primitives/card/styles.ts +119 -114
  61. package/src/primitives/checkbox/__workshop__/index.ts +10 -6
  62. package/src/primitives/checkbox/checkbox.tsx +4 -4
  63. package/src/primitives/checkbox/styles.ts +71 -69
  64. package/src/primitives/code/__workshop__/index.ts +16 -12
  65. package/src/primitives/code/code.tsx +3 -5
  66. package/src/primitives/code/styles.ts +20 -18
  67. package/src/primitives/container/__workshop__/index.ts +5 -3
  68. package/src/primitives/container/container.tsx +5 -4
  69. package/src/primitives/flex/__workshop__/index.ts +8 -4
  70. package/src/primitives/flex/flex.tsx +7 -23
  71. package/src/primitives/grid/__workshop__/index.ts +7 -3
  72. package/src/primitives/grid/grid.tsx +4 -27
  73. package/src/primitives/heading/__workshop__/index.ts +16 -12
  74. package/src/primitives/heading/heading.tsx +10 -17
  75. package/src/primitives/heading/styles.ts +45 -36
  76. package/src/primitives/inline/__workshop__/index.ts +5 -3
  77. package/src/primitives/inline/inline.tsx +3 -5
  78. package/src/primitives/kbd/__workshop__/index.ts +5 -3
  79. package/src/primitives/kbd/kbd.tsx +12 -13
  80. package/src/primitives/label/__workshop__/index.ts +16 -12
  81. package/src/primitives/label/label.tsx +13 -18
  82. package/src/primitives/label/styles.ts +24 -18
  83. package/src/primitives/popover/__workshop__/PlainStory.tsx +0 -1
  84. package/src/primitives/popover/__workshop__/TestStory.tsx +0 -1
  85. package/src/primitives/popover/__workshop__/index.ts +36 -32
  86. package/src/primitives/popover/constants.ts +0 -3
  87. package/src/primitives/popover/floating-ui/size.ts +40 -25
  88. package/src/primitives/popover/popover.tsx +220 -196
  89. package/src/primitives/popover/popoverArrow.tsx +42 -48
  90. package/src/primitives/popover/popoverCard.tsx +12 -22
  91. package/src/primitives/radio/__workshop__/index.ts +8 -4
  92. package/src/primitives/radio/radio.tsx +3 -3
  93. package/src/primitives/radio/styles.ts +73 -73
  94. package/src/primitives/select/__workshop__/index.ts +8 -4
  95. package/src/primitives/select/select.tsx +9 -11
  96. package/src/primitives/select/styles.ts +77 -77
  97. package/src/primitives/spinner/__workshop__/index.ts +11 -7
  98. package/src/primitives/spinner/spinner.tsx +2 -5
  99. package/src/primitives/stack/__workshop__/index.ts +11 -7
  100. package/src/primitives/stack/stack.tsx +3 -5
  101. package/src/primitives/switch/__workshop__/index.ts +8 -4
  102. package/src/primitives/switch/styles.ts +119 -112
  103. package/src/primitives/switch/switch.tsx +6 -6
  104. package/src/primitives/text/__workshop__/index.ts +21 -17
  105. package/src/primitives/text/styles.ts +51 -45
  106. package/src/primitives/text/text.tsx +11 -16
  107. package/src/primitives/textArea/__workshop__/index.ts +11 -7
  108. package/src/primitives/textArea/textArea.tsx +15 -22
  109. package/src/primitives/textInput/__workshop__/index.ts +46 -42
  110. package/src/primitives/textInput/__workshop__/plain.tsx +2 -1
  111. package/src/primitives/textInput/textInput.tsx +50 -69
  112. package/src/primitives/tooltip/__workshop__/index.ts +11 -7
  113. package/src/primitives/tooltip/tooltip.tsx +3 -6
  114. package/src/primitives/tooltip/tooltipArrow.tsx +69 -59
  115. package/src/styles/border/borderStyle.ts +10 -18
  116. package/src/styles/box/boxStyle.ts +14 -18
  117. package/src/styles/flex/flexItemStyle.ts +7 -1
  118. package/src/styles/flex/flexStyle.ts +14 -9
  119. package/src/styles/grid/gridItemStyle.ts +18 -30
  120. package/src/styles/grid/gridStyle.ts +25 -33
  121. package/src/styles/helpers.ts +2 -2
  122. package/src/styles/index.ts +0 -1
  123. package/src/styles/input/textInputStyle.ts +127 -123
  124. package/src/styles/margin/marginStyle.ts +11 -10
  125. package/src/styles/margin/marginsStyle.test.ts +12 -10
  126. package/src/styles/padding/paddingStyle.test.ts +12 -10
  127. package/src/styles/padding/paddingStyle.ts +9 -10
  128. package/src/theme/__workshop__/index.ts +26 -22
  129. package/src/theme/{ThemeContext.ts → themeContext.ts} +0 -0
  130. package/src/utils/boundaryElement/__workshop__/index.ts +11 -7
  131. package/src/utils/elementQuery/__workshop__/index.ts +11 -7
  132. package/src/utils/layer/__workshop__/index.ts +21 -17
  133. package/src/utils/layer/layer.tsx +4 -6
  134. package/src/utils/portal/__workshop__/index.ts +11 -7
  135. package/src/utils/srOnly/srOnly.tsx +8 -10
  136. package/src/utils/virtualList/__workshop__/index.ts +26 -22
  137. package/src/utils/virtualList/virtualList.tsx +10 -14
  138. package/dist/sanity-ui.esm.js.map +0 -1
  139. package/dist/sanity-ui.js.map +0 -1
  140. package/src/__workshop__/color/overview.tsx +0 -101
  141. package/src/__workshop__/index.ts +0 -10
  142. package/src/icons/__workshop__/.eslintrc +0 -5
  143. package/src/icons/__workshop__/index.tsx +0 -6
  144. package/src/icons/__workshop__/overview.tsx +0 -76
  145. package/src/styles/compose.ts +0 -35
  146. 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-next.3+dc2d5edc",
3
+ "version": "1.0.1",
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,92 @@
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
+ "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
- "type-check": "tsc --build",
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.19-next.3+dc2d5edc",
37
- "@sanity/icons": "1.3.9-next.3+dc2d5edc",
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
- "styled-components": "^5.3.6"
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/design.git"
123
+ "url": "git+https://github.com/sanity-io/ui.git"
58
124
  },
59
125
  "bugs": {
60
- "url": "https://github.com/sanity-io/design/issues"
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
- "gitHead": "dc2d5edccec2ac27f362f14447b40ea5b187bd00"
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
- placement="bottom"
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('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
+ })
@@ -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 = memo(
10
- styled.div({
11
- lineHeight: 0,
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 = memo(
19
- styled(Box)({
20
- '& > ul': {
21
- listStyle: 'none',
22
- padding: 0,
23
- margin: 0,
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: 'rotate(0deg)',
31
- },
32
- to: {
33
- transform: 'rotate(360deg)',
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 = memo(
41
- styled(SpinnerIcon)`
42
- animation: ${rotate} 500ms linear infinite;
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, 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,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 = memo(
6
- styled.ol({
7
- margin: 0,
8
- padding: 0,
9
- display: 'flex',
10
- listStyle: 'none',
11
- alignItems: 'center',
12
- whiteSpace: 'nowrap',
13
- lineHeight: 0,
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 = memo(
18
- styled(Button)({
19
- appearance: 'none',
20
- margin: '-4px',
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('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,5 +1,5 @@
1
1
  import {CloseIcon} from '@sanity/icons'
2
- import {forwardRef, memo, useCallback, useEffect, useRef, useState} from 'react'
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 = memo(
67
- styled(Layer)<ResponsiveDialogPositionStyleProps & ResponsivePaddingStyleProps>(
68
- responsivePaddingStyle,
69
- dialogStyle,
70
- responsiveDialogPositionStyle
71
- )
66
+ const Root = styled(Layer)<ResponsiveDialogPositionStyleProps & ResponsivePaddingStyleProps>(
67
+ responsivePaddingStyle,
68
+ dialogStyle,
69
+ responsiveDialogPositionStyle
72
70
  )
73
71
 
74
- const DialogContainer = memo(
75
- styled(Container)({
76
- '&:not([hidden])': {
77
- display: 'flex',
78
- },
79
- width: '100%',
80
- height: '100%',
81
- flexDirection: 'column',
82
- alignItems: 'center',
83
- justifyContent: 'center',
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 = memo(
88
- styled(Card)({
89
- '&:not([hidden])': {
90
- display: 'flex',
91
- },
92
- width: '100%',
93
- minHeight: 0,
94
- maxHeight: '100%',
95
- overflow: 'hidden',
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 = memo(
100
- styled(Flex)({
101
- flex: 1,
102
- minHeight: 0,
103
- width: '100%',
104
- })
105
- )
93
+ const DialogLayout = styled(Flex)`
94
+ flex: 1;
95
+ min-height: 0;
96
+ width: 100%;
97
+ `
106
98
 
107
- const DialogHeader = memo(
108
- styled(Card)({
109
- position: 'relative',
110
- zIndex: 2,
99
+ const DialogHeader = styled(Card)`
100
+ position: relative;
101
+ z-index: 2;
111
102
 
112
- '&:after': {
113
- content: '""',
114
- display: 'block',
115
- position: 'absolute',
116
- left: 0,
117
- right: 0,
118
- bottom: '-1px',
119
- borderBottom: '1px solid var(--card-hairline-soft-color)',
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 = memo(
125
- styled(Box)({
126
- position: 'relative',
127
- zIndex: 1,
128
- overflow: 'auto',
129
- outline: 'none',
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 = memo(
134
- styled(Box)({
135
- position: 'relative',
136
- zIndex: 3,
137
- borderTop: '1px solid var(--card-hairline-soft-color)',
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('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
+ })