@sanity/ui 1.0.0-next.3 → 1.0.0

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 (144) 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} +888 -2678
  5. package/dist/index.esm.js.map +1 -0
  6. package/dist/{sanity-ui.js → index.js} +882 -2688
  7. package/dist/index.js.map +1 -0
  8. package/package.json +112 -23
  9. package/src/components/autocomplete/__workshop__/example.tsx +1 -1
  10. package/src/components/autocomplete/__workshop__/index.ts +36 -32
  11. package/src/components/autocomplete/autocomplete.styles.tsx +22 -28
  12. package/src/components/autocomplete/autocomplete.tsx +1 -2
  13. package/src/components/autocomplete/constants.ts +3 -8
  14. package/src/components/breadcrumbs/__workshop__/index.ts +11 -7
  15. package/src/components/breadcrumbs/breadcrumbs.styles.ts +13 -18
  16. package/src/components/dialog/__workshop__/index.ts +13 -9
  17. package/src/components/dialog/dialog.tsx +53 -67
  18. package/src/components/hotkeys/__workshop__/index.ts +11 -3
  19. package/src/components/hotkeys/hotkeys.tsx +12 -16
  20. package/src/components/menu/__workshop__/index.ts +71 -67
  21. package/src/components/menu/menu.tsx +5 -7
  22. package/src/components/menu/menuButton.tsx +16 -14
  23. package/src/components/menu/menuDivider.ts +8 -10
  24. package/src/components/skeleton/__workshop__/index.ts +8 -4
  25. package/src/components/skeleton/skeleton.tsx +4 -6
  26. package/src/components/skeleton/styles.ts +13 -9
  27. package/src/components/skeleton/textSkeleton.tsx +12 -14
  28. package/src/components/tab/__workshop__/index.ts +11 -3
  29. package/src/components/toast/__workshop__/index.ts +16 -4
  30. package/src/components/toast/toast.tsx +6 -11
  31. package/src/components/toast/toastProvider.tsx +18 -22
  32. package/src/components/tree/__workshop__/basic.perf.ts +1 -14
  33. package/src/components/tree/__workshop__/basic.tsx +1 -1
  34. package/src/components/tree/__workshop__/index.ts +12 -8
  35. package/src/components/tree/style.ts +78 -76
  36. package/src/components/tree/treeItem.tsx +7 -12
  37. package/src/hooks/useElementRect/__workshop__/index.ts +11 -3
  38. package/src/hooks/useMediaIndex/__workshop__/index.ts +11 -3
  39. package/src/primitives/_selectable/selectable.tsx +4 -7
  40. package/src/primitives/_selectable/style.ts +85 -82
  41. package/src/primitives/avatar/__workshop__/index.ts +16 -12
  42. package/src/primitives/avatar/avatar.tsx +9 -12
  43. package/src/primitives/avatar/avatarCounter.tsx +22 -24
  44. package/src/primitives/avatar/avatarStack.tsx +16 -14
  45. package/src/primitives/avatar/styles.ts +1 -1
  46. package/src/primitives/badge/__workshop__/index.ts +16 -12
  47. package/src/primitives/badge/__workshop__/tones.tsx +1 -1
  48. package/src/primitives/badge/badge.tsx +6 -5
  49. package/src/primitives/box/__workshop__/index.ts +16 -4
  50. package/src/primitives/box/box.tsx +21 -49
  51. package/src/primitives/button/__workshop__/index.ts +51 -47
  52. package/src/primitives/button/__workshop__/sanityUploadButton.tsx +19 -20
  53. package/src/primitives/button/__workshop__/styled1.tsx +6 -6
  54. package/src/primitives/button/button.tsx +20 -26
  55. package/src/primitives/button/styles.ts +30 -29
  56. package/src/primitives/card/__workshop__/index.ts +15 -11
  57. package/src/primitives/card/card.tsx +9 -25
  58. package/src/primitives/card/styles.ts +119 -114
  59. package/src/primitives/checkbox/__workshop__/index.ts +10 -6
  60. package/src/primitives/checkbox/checkbox.tsx +4 -4
  61. package/src/primitives/checkbox/styles.ts +71 -69
  62. package/src/primitives/code/__workshop__/index.ts +16 -12
  63. package/src/primitives/code/code.tsx +3 -5
  64. package/src/primitives/code/styles.ts +20 -18
  65. package/src/primitives/container/__workshop__/index.ts +5 -3
  66. package/src/primitives/container/container.tsx +5 -4
  67. package/src/primitives/flex/__workshop__/index.ts +8 -4
  68. package/src/primitives/flex/flex.tsx +7 -23
  69. package/src/primitives/grid/__workshop__/index.ts +7 -3
  70. package/src/primitives/grid/grid.tsx +4 -27
  71. package/src/primitives/heading/__workshop__/index.ts +16 -12
  72. package/src/primitives/heading/heading.tsx +10 -17
  73. package/src/primitives/heading/styles.ts +45 -36
  74. package/src/primitives/inline/__workshop__/index.ts +5 -3
  75. package/src/primitives/inline/inline.tsx +3 -5
  76. package/src/primitives/kbd/__workshop__/index.ts +5 -3
  77. package/src/primitives/kbd/kbd.tsx +12 -13
  78. package/src/primitives/label/__workshop__/index.ts +16 -12
  79. package/src/primitives/label/label.tsx +13 -18
  80. package/src/primitives/label/styles.ts +24 -18
  81. package/src/primitives/popover/__workshop__/PlainStory.tsx +0 -1
  82. package/src/primitives/popover/__workshop__/TestStory.tsx +0 -1
  83. package/src/primitives/popover/__workshop__/index.ts +36 -32
  84. package/src/primitives/popover/constants.ts +0 -3
  85. package/src/primitives/popover/floating-ui/size.ts +40 -25
  86. package/src/primitives/popover/popover.tsx +220 -196
  87. package/src/primitives/popover/popoverArrow.tsx +42 -48
  88. package/src/primitives/popover/popoverCard.tsx +12 -22
  89. package/src/primitives/radio/__workshop__/index.ts +8 -4
  90. package/src/primitives/radio/radio.tsx +3 -3
  91. package/src/primitives/radio/styles.ts +73 -73
  92. package/src/primitives/select/__workshop__/index.ts +8 -4
  93. package/src/primitives/select/select.tsx +9 -11
  94. package/src/primitives/select/styles.ts +77 -77
  95. package/src/primitives/spinner/__workshop__/index.ts +11 -7
  96. package/src/primitives/spinner/spinner.tsx +2 -5
  97. package/src/primitives/stack/__workshop__/index.ts +11 -7
  98. package/src/primitives/stack/stack.tsx +3 -5
  99. package/src/primitives/switch/__workshop__/index.ts +8 -4
  100. package/src/primitives/switch/styles.ts +119 -112
  101. package/src/primitives/switch/switch.tsx +6 -6
  102. package/src/primitives/text/__workshop__/index.ts +21 -17
  103. package/src/primitives/text/styles.ts +51 -45
  104. package/src/primitives/text/text.tsx +11 -16
  105. package/src/primitives/textArea/__workshop__/index.ts +11 -7
  106. package/src/primitives/textArea/textArea.tsx +15 -22
  107. package/src/primitives/textInput/__workshop__/index.ts +46 -42
  108. package/src/primitives/textInput/__workshop__/plain.tsx +2 -1
  109. package/src/primitives/textInput/textInput.tsx +49 -69
  110. package/src/primitives/tooltip/__workshop__/index.ts +11 -7
  111. package/src/primitives/tooltip/tooltip.tsx +3 -6
  112. package/src/primitives/tooltip/tooltipArrow.tsx +69 -59
  113. package/src/styles/border/borderStyle.ts +10 -18
  114. package/src/styles/box/boxStyle.ts +14 -18
  115. package/src/styles/flex/flexItemStyle.ts +7 -1
  116. package/src/styles/flex/flexStyle.ts +14 -9
  117. package/src/styles/grid/gridItemStyle.ts +18 -30
  118. package/src/styles/grid/gridStyle.ts +25 -33
  119. package/src/styles/helpers.ts +2 -2
  120. package/src/styles/index.ts +0 -1
  121. package/src/styles/input/textInputStyle.ts +127 -123
  122. package/src/styles/margin/marginStyle.ts +11 -10
  123. package/src/styles/margin/marginsStyle.test.ts +12 -10
  124. package/src/styles/padding/paddingStyle.test.ts +12 -10
  125. package/src/styles/padding/paddingStyle.ts +9 -10
  126. package/src/theme/__workshop__/index.ts +26 -22
  127. package/src/theme/{ThemeContext.ts → themeContext.ts} +0 -0
  128. package/src/utils/boundaryElement/__workshop__/index.ts +11 -7
  129. package/src/utils/elementQuery/__workshop__/index.ts +11 -7
  130. package/src/utils/layer/__workshop__/index.ts +21 -17
  131. package/src/utils/layer/layer.tsx +4 -6
  132. package/src/utils/portal/__workshop__/index.ts +11 -7
  133. package/src/utils/srOnly/srOnly.tsx +8 -10
  134. package/src/utils/virtualList/__workshop__/index.ts +26 -22
  135. package/src/utils/virtualList/virtualList.tsx +10 -14
  136. package/dist/sanity-ui.esm.js.map +0 -1
  137. package/dist/sanity-ui.js.map +0 -1
  138. package/src/__workshop__/color/overview.tsx +0 -101
  139. package/src/__workshop__/index.ts +0 -10
  140. package/src/icons/__workshop__/.eslintrc +0 -5
  141. package/src/icons/__workshop__/index.tsx +0 -6
  142. package/src/icons/__workshop__/overview.tsx +0 -76
  143. package/src/styles/compose.ts +0 -35
  144. 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.0",
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-next.3+dc2d5edc",
37
- "@sanity/icons": "1.3.9-next.3+dc2d5edc",
48
+ "@sanity/color": "^2.1.20",
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.9",
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": "dc2d5edccec2ac27f362f14447b40ea5b187bd00"
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
+ })
@@ -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
+ })
@@ -1,4 +1,4 @@
1
- import {forwardRef, memo} from 'react'
1
+ import {forwardRef} from 'react'
2
2
  import styled from 'styled-components'
3
3
  import {useArrayProp} from '../../hooks'
4
4
  import {Inline, KBD} from '../../primitives'
@@ -14,22 +14,18 @@ export interface HotkeysProps {
14
14
  keys?: string[]
15
15
  }
16
16
 
17
- const Root = memo(
18
- styled.kbd({
19
- '&:not([hidden])': {
20
- display: 'block',
21
- },
22
- font: 'inherit',
23
- })
24
- )
17
+ const Root = styled.kbd`
18
+ &:not([hidden]) {
19
+ display: block;
20
+ }
21
+ font: inherit;
22
+ `
25
23
 
26
- const Key = memo(
27
- styled(KBD)({
28
- '&:not([hidden])': {
29
- display: 'block',
30
- },
31
- })
32
- )
24
+ const Key = styled(KBD)`
25
+ &:not([hidden]) {
26
+ display: block;
27
+ }
28
+ `
33
29
 
34
30
  /**
35
31
  * @public