@sanity/ui 1.7.6 → 1.7.8
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.cjs.mjs +0 -1
- package/dist/index.esm.js +34 -24
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +33 -23
- package/dist/index.js.map +1 -1
- package/package.json +25 -26
- package/src/primitives/tooltip/tooltip.tsx +22 -11
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sanity/ui",
|
|
3
|
-
"version": "1.7.
|
|
3
|
+
"version": "1.7.8",
|
|
4
4
|
"sideEffects": false,
|
|
5
5
|
"types": "./dist/index.d.ts",
|
|
6
6
|
"source": "./src/index.ts",
|
|
@@ -12,8 +12,7 @@
|
|
|
12
12
|
"source": "./src/index.ts",
|
|
13
13
|
"require": "./dist/index.js",
|
|
14
14
|
"node": {
|
|
15
|
-
"import": "./dist/index.cjs.mjs"
|
|
16
|
-
"require": "./dist/index.js"
|
|
15
|
+
"import": "./dist/index.cjs.mjs"
|
|
17
16
|
},
|
|
18
17
|
"import": "./dist/index.esm.js",
|
|
19
18
|
"default": "./dist/index.esm.js"
|
|
@@ -53,56 +52,56 @@
|
|
|
53
52
|
"@sanity/color": "^2.2.5",
|
|
54
53
|
"@sanity/icons": "^2.4.1",
|
|
55
54
|
"csstype": "^3.1.2",
|
|
56
|
-
"framer-motion": "^10.
|
|
55
|
+
"framer-motion": "^10.15.2",
|
|
57
56
|
"react-refractor": "^2.1.7"
|
|
58
57
|
},
|
|
59
58
|
"devDependencies": {
|
|
60
|
-
"@babel/core": "^7.22.
|
|
61
|
-
"@babel/preset-env": "^7.22.
|
|
59
|
+
"@babel/core": "^7.22.10",
|
|
60
|
+
"@babel/preset-env": "^7.22.10",
|
|
62
61
|
"@babel/preset-react": "^7.22.5",
|
|
63
62
|
"@babel/preset-typescript": "^7.22.5",
|
|
64
|
-
"@commitlint/cli": "^17.
|
|
65
|
-
"@commitlint/config-conventional": "^17.
|
|
63
|
+
"@commitlint/cli": "^17.7.1",
|
|
64
|
+
"@commitlint/config-conventional": "^17.7.0",
|
|
66
65
|
"@juggle/resize-observer": "^3.4.0",
|
|
67
|
-
"@sanity/pkg-utils": "^2.
|
|
68
|
-
"@sanity/semantic-release-preset": "^4.1.
|
|
69
|
-
"@sanity/ui-workshop": "^1.2.
|
|
66
|
+
"@sanity/pkg-utils": "^2.4.5",
|
|
67
|
+
"@sanity/semantic-release-preset": "^4.1.3",
|
|
68
|
+
"@sanity/ui-workshop": "^1.2.9",
|
|
70
69
|
"@testing-library/dom": "^9.3.1",
|
|
71
70
|
"@testing-library/jest-dom": "^5.17.0",
|
|
72
71
|
"@testing-library/react": "^14.0.0",
|
|
73
72
|
"@types/jest": "^29.5.3",
|
|
74
73
|
"@types/jest-axe": "^3.5.5",
|
|
75
|
-
"@types/node": "^20.
|
|
76
|
-
"@types/react": "^18.2.
|
|
74
|
+
"@types/node": "^20.5.0",
|
|
75
|
+
"@types/react": "^18.2.20",
|
|
77
76
|
"@types/react-dom": "^18.2.7",
|
|
78
77
|
"@types/react-is": "^18.2.1",
|
|
79
78
|
"@types/refractor": "^3.0.2",
|
|
80
79
|
"@types/styled-components": "^5.1.26",
|
|
81
80
|
"@types/testing-library__jest-dom": "^5.14.9",
|
|
82
|
-
"@typescript-eslint/eslint-plugin": "^6.
|
|
83
|
-
"@typescript-eslint/parser": "^6.
|
|
81
|
+
"@typescript-eslint/eslint-plugin": "^6.3.0",
|
|
82
|
+
"@typescript-eslint/parser": "^6.3.0",
|
|
84
83
|
"commitizen": "^4.3.0",
|
|
85
|
-
"cypress": "^12.17.
|
|
86
|
-
"cypress-real-events": "^1.
|
|
84
|
+
"cypress": "^12.17.3",
|
|
85
|
+
"cypress-real-events": "^1.10.0",
|
|
87
86
|
"cz-conventional-changelog": "^3.3.0",
|
|
88
|
-
"esbuild": "^0.
|
|
87
|
+
"esbuild": "^0.19.2",
|
|
89
88
|
"esbuild-register": "^3.4.2",
|
|
90
|
-
"eslint": "^8.
|
|
91
|
-
"eslint-config-prettier": "^8.
|
|
92
|
-
"eslint-plugin-import": "^2.
|
|
89
|
+
"eslint": "^8.47.0",
|
|
90
|
+
"eslint-config-prettier": "^8.10.0",
|
|
91
|
+
"eslint-plugin-import": "^2.28.0",
|
|
93
92
|
"eslint-plugin-jsx-a11y": "^6.7.1",
|
|
94
93
|
"eslint-plugin-prettier": "^5.0.0",
|
|
95
|
-
"eslint-plugin-react": "^7.33.
|
|
94
|
+
"eslint-plugin-react": "^7.33.1",
|
|
96
95
|
"eslint-plugin-react-hooks": "^4.6.0",
|
|
97
96
|
"http-server": "^14.1.1",
|
|
98
97
|
"husky": "^8.0.3",
|
|
99
|
-
"jest": "^29.6.
|
|
98
|
+
"jest": "^29.6.2",
|
|
100
99
|
"jest-axe": "^8.0.0",
|
|
101
|
-
"jest-environment-jsdom": "^29.6.
|
|
102
|
-
"lint-staged": "^13.
|
|
100
|
+
"jest-environment-jsdom": "^29.6.2",
|
|
101
|
+
"lint-staged": "^13.3.0",
|
|
103
102
|
"module-alias": "^2.2.3",
|
|
104
103
|
"npm-run-all": "^4.1.5",
|
|
105
|
-
"prettier": "^3.0.
|
|
104
|
+
"prettier": "^3.0.1",
|
|
106
105
|
"react": "^18.2.0",
|
|
107
106
|
"react-dom": "^18.2.0",
|
|
108
107
|
"react-is": "^18.2.0",
|
|
@@ -8,6 +8,7 @@ import {
|
|
|
8
8
|
useFloating,
|
|
9
9
|
Middleware,
|
|
10
10
|
RootBoundary,
|
|
11
|
+
size,
|
|
11
12
|
} from '@floating-ui/react-dom'
|
|
12
13
|
import {
|
|
13
14
|
cloneElement,
|
|
@@ -90,12 +91,25 @@ export const Tooltip = forwardRef(function Tooltip(
|
|
|
90
91
|
fallbackPlacements,
|
|
91
92
|
padding: 4,
|
|
92
93
|
rootBoundary,
|
|
94
|
+
mainAxis: false,
|
|
93
95
|
}),
|
|
94
96
|
)
|
|
95
97
|
|
|
96
98
|
// Define distance between reference and floating element
|
|
97
99
|
ret.push(offset({mainAxis: 3}))
|
|
98
100
|
|
|
101
|
+
// Set width and height on the floating element
|
|
102
|
+
ret.push(
|
|
103
|
+
size({
|
|
104
|
+
apply({availableWidth, availableHeight, elements}) {
|
|
105
|
+
Object.assign(elements.floating.style, {
|
|
106
|
+
maxWidth: `${availableWidth - 4 * 2}px`, // the padding is `4px`
|
|
107
|
+
maxHeight: `${availableHeight - 4 * 2}px`, // the padding is `4px`
|
|
108
|
+
})
|
|
109
|
+
},
|
|
110
|
+
}),
|
|
111
|
+
)
|
|
112
|
+
|
|
99
113
|
// Shift the tooltip so its sits with the boundary eleement
|
|
100
114
|
ret.push(
|
|
101
115
|
shift({
|
|
@@ -111,21 +125,12 @@ export const Tooltip = forwardRef(function Tooltip(
|
|
|
111
125
|
return ret
|
|
112
126
|
}, [boundaryElement, fallbackPlacements])
|
|
113
127
|
|
|
114
|
-
const {
|
|
128
|
+
const {floatingStyles, placement, middlewareData, refs, update} = useFloating({
|
|
115
129
|
middleware,
|
|
116
130
|
placement: placementProp,
|
|
117
131
|
whileElementsMounted: autoUpdate,
|
|
118
132
|
})
|
|
119
133
|
|
|
120
|
-
const rootStyle: CSSProperties = useMemo(
|
|
121
|
-
() => ({
|
|
122
|
-
position: strategy,
|
|
123
|
-
top: y ?? 0,
|
|
124
|
-
left: x ?? 0,
|
|
125
|
-
}),
|
|
126
|
-
[strategy, x, y],
|
|
127
|
-
)
|
|
128
|
-
|
|
129
134
|
const staticSide = placement && FLOATING_STATIC_SIDES[placement.split('-')[0]]
|
|
130
135
|
|
|
131
136
|
const arrowX = middlewareData.arrow?.x
|
|
@@ -238,7 +243,13 @@ export const Tooltip = forwardRef(function Tooltip(
|
|
|
238
243
|
if (disabled) return child
|
|
239
244
|
|
|
240
245
|
const root = (
|
|
241
|
-
<Root
|
|
246
|
+
<Root
|
|
247
|
+
data-ui="Tooltip"
|
|
248
|
+
{...restProps}
|
|
249
|
+
ref={setFloating}
|
|
250
|
+
style={floatingStyles}
|
|
251
|
+
zOffset={zOffset}
|
|
252
|
+
>
|
|
242
253
|
<Card
|
|
243
254
|
data-ui="Tooltip__card"
|
|
244
255
|
data-placement={placement}
|