@indico-data/design-system 3.17.0 → 3.18.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.
- package/lib/components/floatUI/FloatUI.d.ts +1 -1
- package/lib/components/floatUI/types.d.ts +2 -0
- package/lib/index.d.ts +3 -1
- package/lib/index.esm.js +5 -3
- package/lib/index.esm.js.map +1 -1
- package/lib/index.js +5 -3
- package/lib/index.js.map +1 -1
- package/package.json +1 -1
- package/src/components/floatUI/FloatUI.stories.tsx +14 -0
- package/src/components/floatUI/FloatUI.tsx +5 -0
- package/src/components/floatUI/types.ts +2 -0
package/package.json
CHANGED
|
@@ -85,6 +85,20 @@ const meta: Meta<typeof FloatUI> = {
|
|
|
85
85
|
},
|
|
86
86
|
},
|
|
87
87
|
},
|
|
88
|
+
disableAutoUpdate: {
|
|
89
|
+
control: 'boolean',
|
|
90
|
+
description:
|
|
91
|
+
'Disables automatic position updates when the reference element moves. Escape hatch for very performance-critical scenarios.',
|
|
92
|
+
table: {
|
|
93
|
+
category: 'Props',
|
|
94
|
+
type: {
|
|
95
|
+
summary: 'boolean',
|
|
96
|
+
},
|
|
97
|
+
defaultValue: {
|
|
98
|
+
summary: 'false',
|
|
99
|
+
},
|
|
100
|
+
},
|
|
101
|
+
},
|
|
88
102
|
},
|
|
89
103
|
decorators: [
|
|
90
104
|
(Story: React.ComponentType) => (
|
|
@@ -13,6 +13,7 @@ import {
|
|
|
13
13
|
useDismiss,
|
|
14
14
|
ReferenceType,
|
|
15
15
|
VirtualElement,
|
|
16
|
+
autoUpdate,
|
|
16
17
|
} from '@floating-ui/react';
|
|
17
18
|
import { FloatUIProps } from './types';
|
|
18
19
|
|
|
@@ -32,6 +33,7 @@ export function FloatUI({
|
|
|
32
33
|
className,
|
|
33
34
|
hover = false,
|
|
34
35
|
onOpenChange,
|
|
36
|
+
disableAutoUpdate = false,
|
|
35
37
|
}: FloatUIProps) {
|
|
36
38
|
const [internalIsOpen, setInternalIsOpen] = useState(false);
|
|
37
39
|
|
|
@@ -65,6 +67,9 @@ export function FloatUI({
|
|
|
65
67
|
setIsOpen(isOpen);
|
|
66
68
|
onOpenChange?.(isOpen);
|
|
67
69
|
},
|
|
70
|
+
whileElementsMounted: disableAutoUpdate
|
|
71
|
+
? undefined
|
|
72
|
+
: (floatingOptions.whileElementsMounted ?? autoUpdate),
|
|
68
73
|
elements: {
|
|
69
74
|
reference: referenceElement as Element | null,
|
|
70
75
|
},
|
|
@@ -23,4 +23,6 @@ export type FloatUIProps = {
|
|
|
23
23
|
hover?: boolean;
|
|
24
24
|
/** Callback function to be called when the FloatUI is opened or closed. */
|
|
25
25
|
onOpenChange?: (isOpen: boolean) => void;
|
|
26
|
+
/** If true, disables automatic position updates when the reference element moves (e.g., due to layout shifts). Defaults to false. */
|
|
27
|
+
disableAutoUpdate?: boolean;
|
|
26
28
|
};
|