@lumx/react 3.11.3-alpha.1 → 3.11.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/index.js +10 -2
- package/index.js.map +1 -1
- package/package.json +3 -3
- package/src/components/popover/usePopoverStyle.tsx +10 -2
package/package.json
CHANGED
|
@@ -6,8 +6,8 @@
|
|
|
6
6
|
"url": "https://github.com/lumapps/design-system/issues"
|
|
7
7
|
},
|
|
8
8
|
"dependencies": {
|
|
9
|
-
"@lumx/core": "^3.11.3
|
|
10
|
-
"@lumx/icons": "^3.11.3
|
|
9
|
+
"@lumx/core": "^3.11.3",
|
|
10
|
+
"@lumx/icons": "^3.11.3",
|
|
11
11
|
"@popperjs/core": "^2.5.4",
|
|
12
12
|
"body-scroll-lock": "^3.1.5",
|
|
13
13
|
"classnames": "^2.3.2",
|
|
@@ -110,5 +110,5 @@
|
|
|
110
110
|
"build:storybook": "storybook build"
|
|
111
111
|
},
|
|
112
112
|
"sideEffects": false,
|
|
113
|
-
"version": "3.11.3
|
|
113
|
+
"version": "3.11.3"
|
|
114
114
|
}
|
|
@@ -141,10 +141,18 @@ export function usePopoverStyle({
|
|
|
141
141
|
if (!update || !popperElement || !anchorElement || !WINDOW?.ResizeObserver) {
|
|
142
142
|
return undefined;
|
|
143
143
|
}
|
|
144
|
-
|
|
144
|
+
let running: ReturnType<typeof setTimeout> | undefined;
|
|
145
|
+
function updateRateLimited() {
|
|
146
|
+
if (running) return;
|
|
147
|
+
update?.();
|
|
148
|
+
running = setTimeout(() => {
|
|
149
|
+
running = undefined;
|
|
150
|
+
}, 100);
|
|
151
|
+
}
|
|
152
|
+
updateRateLimited();
|
|
145
153
|
|
|
146
154
|
// On anchor or popover resize
|
|
147
|
-
const resizeObserver = new ResizeObserver(
|
|
155
|
+
const resizeObserver = new ResizeObserver(updateRateLimited);
|
|
148
156
|
resizeObserver.observe(anchorElement);
|
|
149
157
|
resizeObserver.observe(popperElement);
|
|
150
158
|
return () => {
|