@sanity/ui 1.8.1 → 1.8.3
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/dist/index.esm.js +45 -17
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +45 -17
- package/dist/index.js.map +1 -1
- package/package.json +15 -15
- package/src/primitives/_selectable/style.ts +1 -0
- package/src/primitives/button/__workshop__/sanityUploadButton.tsx +2 -1
- package/src/primitives/card/styles.ts +1 -0
- package/src/primitives/popover/constants.ts +15 -1
- package/src/primitives/popover/popover.tsx +3 -1
- package/src/primitives/select/styles.ts +1 -0
- package/src/primitives/tooltip/constants.ts +16 -0
- package/src/primitives/tooltip/tooltip.tsx +3 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sanity/ui",
|
|
3
|
-
"version": "1.8.
|
|
3
|
+
"version": "1.8.3",
|
|
4
4
|
"sideEffects": false,
|
|
5
5
|
"types": "./dist/index.d.ts",
|
|
6
6
|
"source": "./src/index.ts",
|
|
@@ -53,40 +53,40 @@
|
|
|
53
53
|
"@sanity/color": "^2.2.5",
|
|
54
54
|
"@sanity/icons": "^2.4.1",
|
|
55
55
|
"csstype": "^3.1.2",
|
|
56
|
-
"framer-motion": "^10.16.
|
|
56
|
+
"framer-motion": "^10.16.2",
|
|
57
57
|
"react-refractor": "^2.1.7"
|
|
58
58
|
},
|
|
59
59
|
"devDependencies": {
|
|
60
|
-
"@babel/core": "^7.22.
|
|
61
|
-
"@babel/preset-env": "^7.22.
|
|
60
|
+
"@babel/core": "^7.22.11",
|
|
61
|
+
"@babel/preset-env": "^7.22.14",
|
|
62
62
|
"@babel/preset-react": "^7.22.5",
|
|
63
|
-
"@babel/preset-typescript": "^7.22.
|
|
63
|
+
"@babel/preset-typescript": "^7.22.11",
|
|
64
64
|
"@commitlint/cli": "^17.7.1",
|
|
65
65
|
"@commitlint/config-conventional": "^17.7.0",
|
|
66
66
|
"@juggle/resize-observer": "^3.4.0",
|
|
67
67
|
"@sanity/pkg-utils": "^2.4.8",
|
|
68
|
-
"@sanity/semantic-release-preset": "^4.1.
|
|
68
|
+
"@sanity/semantic-release-preset": "^4.1.4",
|
|
69
69
|
"@sanity/ui-workshop": "^1.2.11",
|
|
70
70
|
"@testing-library/dom": "^9.3.1",
|
|
71
71
|
"@testing-library/jest-dom": "^5.17.0",
|
|
72
72
|
"@testing-library/react": "^14.0.0",
|
|
73
73
|
"@types/jest": "^29.5.4",
|
|
74
74
|
"@types/jest-axe": "^3.5.5",
|
|
75
|
-
"@types/node": "^20.5.
|
|
75
|
+
"@types/node": "^20.5.9",
|
|
76
76
|
"@types/react": "^18.2.21",
|
|
77
77
|
"@types/react-dom": "^18.2.7",
|
|
78
78
|
"@types/react-is": "^18.2.1",
|
|
79
79
|
"@types/refractor": "^3.0.2",
|
|
80
80
|
"@types/testing-library__jest-dom": "^5.14.9",
|
|
81
|
-
"@typescript-eslint/eslint-plugin": "^6.
|
|
82
|
-
"@typescript-eslint/parser": "^6.
|
|
81
|
+
"@typescript-eslint/eslint-plugin": "^6.5.0",
|
|
82
|
+
"@typescript-eslint/parser": "^6.5.0",
|
|
83
83
|
"commitizen": "^4.3.0",
|
|
84
|
-
"cypress": "^
|
|
85
|
-
"cypress-real-events": "^1.10.
|
|
84
|
+
"cypress": "^13.1.0",
|
|
85
|
+
"cypress-real-events": "^1.10.1",
|
|
86
86
|
"cz-conventional-changelog": "^3.3.0",
|
|
87
87
|
"esbuild": "^0.19.2",
|
|
88
88
|
"esbuild-register": "^3.4.2",
|
|
89
|
-
"eslint": "^8.
|
|
89
|
+
"eslint": "^8.48.0",
|
|
90
90
|
"eslint-config-prettier": "^9.0.0",
|
|
91
91
|
"eslint-plugin-import": "^2.28.1",
|
|
92
92
|
"eslint-plugin-jsx-a11y": "^6.7.1",
|
|
@@ -101,17 +101,17 @@
|
|
|
101
101
|
"lint-staged": "^14.0.1",
|
|
102
102
|
"module-alias": "^2.2.3",
|
|
103
103
|
"npm-run-all": "^4.1.5",
|
|
104
|
-
"prettier": "^3.0.
|
|
104
|
+
"prettier": "^3.0.3",
|
|
105
105
|
"react": "^18.2.0",
|
|
106
106
|
"react-dom": "^18.2.0",
|
|
107
107
|
"react-is": "^18.2.0",
|
|
108
108
|
"refractor": "^4.8.1",
|
|
109
109
|
"rimraf": "^5.0.1",
|
|
110
|
-
"semantic-release": "^21.1.
|
|
110
|
+
"semantic-release": "^21.1.1",
|
|
111
111
|
"start-server-and-test": "^2.0.0",
|
|
112
112
|
"styled-components": "^6.0.7",
|
|
113
113
|
"tsconfig-paths": "^4.2.0",
|
|
114
|
-
"typescript": "^5.
|
|
114
|
+
"typescript": "^5.2.2"
|
|
115
115
|
},
|
|
116
116
|
"peerDependencies": {
|
|
117
117
|
"react": "^18",
|
|
@@ -4,7 +4,7 @@ import styled from 'styled-components'
|
|
|
4
4
|
|
|
5
5
|
const SanityUploadButton = styled(Button).attrs({forwardedAs: 'label'})`
|
|
6
6
|
& input {
|
|
7
|
-
|
|
7
|
+
appearance: none;
|
|
8
8
|
overflow: hidden;
|
|
9
9
|
overflow: clip;
|
|
10
10
|
top: 0;
|
|
@@ -14,6 +14,7 @@ const SanityUploadButton = styled(Button).attrs({forwardedAs: 'label'})`
|
|
|
14
14
|
opacity: 0;
|
|
15
15
|
position: absolute;
|
|
16
16
|
max-width: 0;
|
|
17
|
+
width: -webkit-fill-available;
|
|
17
18
|
width: stretch;
|
|
18
19
|
}
|
|
19
20
|
|
|
@@ -1,7 +1,21 @@
|
|
|
1
|
-
import {PopoverMargins} from '../../types'
|
|
1
|
+
import {Placement, PopoverMargins} from '../../types'
|
|
2
2
|
|
|
3
3
|
export const DEFAULT_POPOVER_DISTANCE = 4
|
|
4
4
|
export const DEFAULT_POPOVER_PADDING = 4
|
|
5
5
|
export const DEFAULT_POPOVER_ARROW_WIDTH = 27
|
|
6
6
|
export const DEFAULT_POPOVER_ARROW_HEIGHT = 11
|
|
7
7
|
export const DEFAULT_POPOVER_MARGINS: PopoverMargins = [0, 0, 0, 0]
|
|
8
|
+
export const DEFAULT_FALLBACK_PLACEMENTS: Record<Placement, Placement[]> = {
|
|
9
|
+
top: ['bottom', 'left', 'right'],
|
|
10
|
+
'top-start': ['bottom-start', 'left-start', 'right-start'],
|
|
11
|
+
'top-end': ['bottom-end', 'left-end', 'right-end'],
|
|
12
|
+
bottom: ['top', 'left', 'right'],
|
|
13
|
+
'bottom-start': ['top-start', 'left-start', 'right-start'],
|
|
14
|
+
'bottom-end': ['top-end', 'left-end', 'right-end'],
|
|
15
|
+
left: ['right', 'top', 'bottom'],
|
|
16
|
+
'left-start': ['right-start', 'top-start', 'bottom-start'],
|
|
17
|
+
'left-end': ['right-end', 'top-end', 'bottom-end'],
|
|
18
|
+
right: ['left', 'top', 'bottom'],
|
|
19
|
+
'right-start': ['left-start', 'top-start', 'bottom-start'],
|
|
20
|
+
'right-end': ['left-end', 'top-end', 'bottom-end'],
|
|
21
|
+
}
|
|
@@ -28,6 +28,7 @@ import {ResponsiveRadiusProps, ResponsiveShadowProps} from '../types'
|
|
|
28
28
|
import {
|
|
29
29
|
DEFAULT_POPOVER_DISTANCE,
|
|
30
30
|
DEFAULT_POPOVER_MARGINS,
|
|
31
|
+
DEFAULT_FALLBACK_PLACEMENTS,
|
|
31
32
|
DEFAULT_POPOVER_PADDING,
|
|
32
33
|
} from './constants'
|
|
33
34
|
import {size} from './floating-ui/size'
|
|
@@ -89,7 +90,8 @@ export const Popover = memo(
|
|
|
89
90
|
constrainSize = false,
|
|
90
91
|
content,
|
|
91
92
|
disabled,
|
|
92
|
-
fallbackPlacements
|
|
93
|
+
fallbackPlacements = props.fallbackPlacements ??
|
|
94
|
+
DEFAULT_FALLBACK_PLACEMENTS[props.placement ?? 'bottom'],
|
|
93
95
|
matchReferenceWidth,
|
|
94
96
|
floatingBoundary = props.boundaryElement ?? boundaryElementContext.element,
|
|
95
97
|
open,
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import {Placement} from '@floating-ui/react-dom'
|
|
2
|
+
|
|
3
|
+
export const DEFAULT_FALLBACK_PLACEMENTS: Record<Placement, Placement[]> = {
|
|
4
|
+
top: ['bottom', 'left', 'right'],
|
|
5
|
+
'top-start': ['bottom-start', 'left-start', 'right-start'],
|
|
6
|
+
'top-end': ['bottom-end', 'left-end', 'right-end'],
|
|
7
|
+
bottom: ['top', 'left', 'right'],
|
|
8
|
+
'bottom-start': ['top-start', 'left-start', 'right-start'],
|
|
9
|
+
'bottom-end': ['top-end', 'left-end', 'right-end'],
|
|
10
|
+
left: ['right', 'top', 'bottom'],
|
|
11
|
+
'left-start': ['right-start', 'top-start', 'bottom-start'],
|
|
12
|
+
'left-end': ['right-end', 'top-end', 'bottom-end'],
|
|
13
|
+
right: ['left', 'top', 'bottom'],
|
|
14
|
+
'right-start': ['left-start', 'top-start', 'bottom-start'],
|
|
15
|
+
'right-end': ['left-end', 'top-end', 'bottom-end'],
|
|
16
|
+
}
|
|
@@ -31,6 +31,7 @@ import {Placement} from '../../types'
|
|
|
31
31
|
import {Layer, LayerProps, Portal, useBoundaryElement} from '../../utils'
|
|
32
32
|
import {Card} from '../card'
|
|
33
33
|
import {Delay} from '../types'
|
|
34
|
+
import {DEFAULT_FALLBACK_PLACEMENTS} from './constants'
|
|
34
35
|
import {TooltipArrow} from './tooltipArrow'
|
|
35
36
|
import {useTooltipDelayGroup} from './tooltipDelayGroup'
|
|
36
37
|
|
|
@@ -78,7 +79,8 @@ export const Tooltip = forwardRef(function Tooltip(
|
|
|
78
79
|
children: childProp,
|
|
79
80
|
content,
|
|
80
81
|
disabled,
|
|
81
|
-
fallbackPlacements: fallbackPlacementsProp
|
|
82
|
+
fallbackPlacements: fallbackPlacementsProp = props.fallbackPlacements ??
|
|
83
|
+
DEFAULT_FALLBACK_PLACEMENTS[props.placement ?? 'bottom'],
|
|
82
84
|
padding,
|
|
83
85
|
placement: placementProp = 'bottom',
|
|
84
86
|
portal,
|