@indico-data/design-system 3.13.1 → 3.14.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 +8 -3
- package/lib/index.esm.js.map +1 -1
- package/lib/index.js +8 -3
- package/lib/index.js.map +1 -1
- package/package.json +1 -1
- package/src/components/floatUI/FloatUI.tsx +8 -2
- package/src/components/floatUI/__tests__/FloatUI.test.tsx +1 -1
- package/src/components/floatUI/types.ts +2 -0
package/lib/index.js
CHANGED
|
@@ -13851,7 +13851,7 @@ const defaultOptions$1 = {
|
|
|
13851
13851
|
placement: 'bottom-start',
|
|
13852
13852
|
middleware: [offset$2(5), flip$2(), shift$2()],
|
|
13853
13853
|
};
|
|
13854
|
-
function FloatUI({ children, ariaLabel, isOpen: controlledIsOpen, setIsOpen: controlledSetIsOpen, isPortal = false, portalOptions = {}, floatingOptions = defaultOptions$1, className, hover = false, }) {
|
|
13854
|
+
function FloatUI({ children, ariaLabel, isOpen: controlledIsOpen, setIsOpen: controlledSetIsOpen, isPortal = false, portalOptions = {}, floatingOptions = defaultOptions$1, className, hover = false, onOpenChange, }) {
|
|
13855
13855
|
const [internalIsOpen, setInternalIsOpen] = React.useState(false);
|
|
13856
13856
|
// Determine whether the component is controlled or uncontrolled
|
|
13857
13857
|
const isControlled = controlledIsOpen !== undefined && controlledSetIsOpen !== undefined;
|
|
@@ -13867,13 +13867,18 @@ function FloatUI({ children, ariaLabel, isOpen: controlledIsOpen, setIsOpen: con
|
|
|
13867
13867
|
if (!React.isValidElement(trigger) || !React.isValidElement(content)) {
|
|
13868
13868
|
throw new Error('Both children of FloatUI must be valid React elements.');
|
|
13869
13869
|
}
|
|
13870
|
-
const { refs, floatingStyles, context } = useFloating(Object.assign(Object.assign({}, floatingOptions), { open: isOpen, onOpenChange:
|
|
13870
|
+
const { refs, floatingStyles, context } = useFloating(Object.assign(Object.assign({}, floatingOptions), { open: isOpen, onOpenChange: (isOpen) => {
|
|
13871
|
+
setIsOpen(isOpen);
|
|
13872
|
+
onOpenChange === null || onOpenChange === void 0 ? void 0 : onOpenChange(isOpen);
|
|
13873
|
+
}, elements: {
|
|
13871
13874
|
reference: referenceElementRef.current,
|
|
13872
13875
|
} }));
|
|
13873
13876
|
// Can't call hooks conditionally so this enabled option is needed.
|
|
13874
13877
|
const click = useClick(context, { enabled: !hover });
|
|
13875
13878
|
const hoverHook = useHover(context, { enabled: hover });
|
|
13876
|
-
const dismiss = useDismiss(context
|
|
13879
|
+
const dismiss = useDismiss(context, {
|
|
13880
|
+
bubbles: true,
|
|
13881
|
+
});
|
|
13877
13882
|
const { getReferenceProps, getFloatingProps } = useInteractions([click, hoverHook, dismiss]);
|
|
13878
13883
|
const tooltipContent = (jsxRuntime.jsx("div", Object.assign({ ref: refs.setFloating }, getFloatingProps(), { style: floatingStyles, role: "dialog", "aria-label": ariaLabel, className: `floatui-container ${className}`, children: jsxRuntime.jsx("div", { ref: floatUIContentRef, className: "floatui-content", children: content }) })));
|
|
13879
13884
|
return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx("div", Object.assign({ ref: refs.setReference }, getReferenceProps(), { children: trigger })), isOpen &&
|