@indico-data/design-system 3.14.1 → 3.15.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/index.esm.js +3 -1
- package/lib/index.esm.js.map +1 -1
- package/lib/index.js +3 -1
- package/lib/index.js.map +1 -1
- package/package.json +1 -1
- package/src/components/floatUI/FloatUI.tsx +5 -1
package/lib/index.esm.js
CHANGED
|
@@ -13827,6 +13827,7 @@ const defaultOptions$1 = {
|
|
|
13827
13827
|
middleware: [offset$2(5), flip$2(), shift$2()],
|
|
13828
13828
|
};
|
|
13829
13829
|
function FloatUI({ children, ariaLabel, isOpen: controlledIsOpen, setIsOpen: controlledSetIsOpen, isPortal = false, portalOptions = {}, floatingOptions = defaultOptions$1, className, hover = false, onOpenChange, }) {
|
|
13830
|
+
var _a;
|
|
13830
13831
|
const [internalIsOpen, setInternalIsOpen] = useState(false);
|
|
13831
13832
|
// Determine whether the component is controlled or uncontrolled
|
|
13832
13833
|
const isControlled = controlledIsOpen !== undefined && controlledSetIsOpen !== undefined;
|
|
@@ -13842,11 +13843,12 @@ function FloatUI({ children, ariaLabel, isOpen: controlledIsOpen, setIsOpen: con
|
|
|
13842
13843
|
if (!isValidElement(trigger) || !isValidElement(content)) {
|
|
13843
13844
|
throw new Error('Both children of FloatUI must be valid React elements.');
|
|
13844
13845
|
}
|
|
13846
|
+
const referenceElement = ((_a = floatingOptions.elements) === null || _a === void 0 ? void 0 : _a.reference) || referenceElementRef.current;
|
|
13845
13847
|
const { refs, floatingStyles, context } = useFloating(Object.assign(Object.assign({}, floatingOptions), { open: isOpen, onOpenChange: (isOpen) => {
|
|
13846
13848
|
setIsOpen(isOpen);
|
|
13847
13849
|
onOpenChange === null || onOpenChange === void 0 ? void 0 : onOpenChange(isOpen);
|
|
13848
13850
|
}, elements: {
|
|
13849
|
-
reference:
|
|
13851
|
+
reference: referenceElement,
|
|
13850
13852
|
} }));
|
|
13851
13853
|
// Can't call hooks conditionally so this enabled option is needed.
|
|
13852
13854
|
const click = useClick(context, { enabled: !hover });
|