@indico-data/design-system 3.13.0 → 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 +9 -4
- package/lib/index.esm.js.map +1 -1
- package/lib/index.js +9 -4
- package/lib/index.js.map +1 -1
- package/package.json +10 -11
- 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/src/components/table/components/HorizontalStickyHeader.tsx +1 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { FloatUIProps } from './types';
|
|
2
|
-
export declare function FloatUI({ children, ariaLabel, isOpen: controlledIsOpen, setIsOpen: controlledSetIsOpen, isPortal, portalOptions, floatingOptions, className, hover, }: FloatUIProps): import("react/jsx-runtime").JSX.Element;
|
|
2
|
+
export declare function FloatUI({ children, ariaLabel, isOpen: controlledIsOpen, setIsOpen: controlledSetIsOpen, isPortal, portalOptions, floatingOptions, className, hover, onOpenChange, }: FloatUIProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -20,4 +20,6 @@ export type FloatUIProps = {
|
|
|
20
20
|
setIsOpen?: React.Dispatch<React.SetStateAction<boolean>>;
|
|
21
21
|
/** If true, opens on hover instead of click. Defaults to false. */
|
|
22
22
|
hover?: boolean;
|
|
23
|
+
/** Callback function to be called when the FloatUI is opened or closed. */
|
|
24
|
+
onOpenChange?: (isOpen: boolean) => void;
|
|
23
25
|
};
|
package/lib/index.d.ts
CHANGED
|
@@ -760,9 +760,11 @@ type FloatUIProps = {
|
|
|
760
760
|
setIsOpen?: React.Dispatch<React.SetStateAction<boolean>>;
|
|
761
761
|
/** If true, opens on hover instead of click. Defaults to false. */
|
|
762
762
|
hover?: boolean;
|
|
763
|
+
/** Callback function to be called when the FloatUI is opened or closed. */
|
|
764
|
+
onOpenChange?: (isOpen: boolean) => void;
|
|
763
765
|
};
|
|
764
766
|
|
|
765
|
-
declare function FloatUI({ children, ariaLabel, isOpen: controlledIsOpen, setIsOpen: controlledSetIsOpen, isPortal, portalOptions, floatingOptions, className, hover, }: FloatUIProps): react_jsx_runtime.JSX.Element;
|
|
767
|
+
declare function FloatUI({ children, ariaLabel, isOpen: controlledIsOpen, setIsOpen: controlledSetIsOpen, isPortal, portalOptions, floatingOptions, className, hover, onOpenChange, }: FloatUIProps): react_jsx_runtime.JSX.Element;
|
|
766
768
|
|
|
767
769
|
type MenuProps = {
|
|
768
770
|
children: React$1.ReactNode;
|
package/lib/index.esm.js
CHANGED
|
@@ -5630,7 +5630,7 @@ const HorizontalStickyHeader = ({ children, position, onPinColumn, isPinned = fa
|
|
|
5630
5630
|
});
|
|
5631
5631
|
calculateWidth();
|
|
5632
5632
|
}, [position, isPinned, pinnedColumnIds]);
|
|
5633
|
-
return (jsxs("div", { className: "table__header-cell", "data-testid": `sticky-column-${position}`, children: [jsx(Button$1, { "data-testid": `sticky-header-pin-button-${position}`, variant: "link", size: "sm", iconLeft: "pin", onClick: onPinColumn, ariaLabel: isPinned ? 'Unpin column' : 'Pin column', className: `table__column--${isPinned ? 'is-pinned' : 'is-not-pinned'} table__column__pin-action` }), jsx("div", { className: "table__header-content", children: children })] }));
|
|
5633
|
+
return (jsxs("div", { className: "table__header-cell", "data-testid": `sticky-column-${position}`, children: [jsx(Button$1, { "data-testid": `sticky-header-pin-button-${position}`, variant: "link", size: "sm", iconLeft: "pin", onClick: () => onPinColumn === null || onPinColumn === void 0 ? void 0 : onPinColumn(`sticky-column-${position}`), ariaLabel: isPinned ? 'Unpin column' : 'Pin column', className: `table__column--${isPinned ? 'is-pinned' : 'is-not-pinned'} table__column__pin-action` }), jsx("div", { className: "table__header-content", children: children })] }));
|
|
5634
5634
|
};
|
|
5635
5635
|
|
|
5636
5636
|
const processColumns = (columns, pinnedColumnIds, togglePinnedColumn) => {
|
|
@@ -13826,7 +13826,7 @@ const defaultOptions$1 = {
|
|
|
13826
13826
|
placement: 'bottom-start',
|
|
13827
13827
|
middleware: [offset$2(5), flip$2(), shift$2()],
|
|
13828
13828
|
};
|
|
13829
|
-
function FloatUI({ children, ariaLabel, isOpen: controlledIsOpen, setIsOpen: controlledSetIsOpen, isPortal = false, portalOptions = {}, floatingOptions = defaultOptions$1, className, hover = false, }) {
|
|
13829
|
+
function FloatUI({ children, ariaLabel, isOpen: controlledIsOpen, setIsOpen: controlledSetIsOpen, isPortal = false, portalOptions = {}, floatingOptions = defaultOptions$1, className, hover = false, onOpenChange, }) {
|
|
13830
13830
|
const [internalIsOpen, setInternalIsOpen] = useState(false);
|
|
13831
13831
|
// Determine whether the component is controlled or uncontrolled
|
|
13832
13832
|
const isControlled = controlledIsOpen !== undefined && controlledSetIsOpen !== undefined;
|
|
@@ -13842,13 +13842,18 @@ function FloatUI({ children, ariaLabel, isOpen: controlledIsOpen, setIsOpen: con
|
|
|
13842
13842
|
if (!isValidElement(trigger) || !isValidElement(content)) {
|
|
13843
13843
|
throw new Error('Both children of FloatUI must be valid React elements.');
|
|
13844
13844
|
}
|
|
13845
|
-
const { refs, floatingStyles, context } = useFloating(Object.assign(Object.assign({}, floatingOptions), { open: isOpen, onOpenChange:
|
|
13845
|
+
const { refs, floatingStyles, context } = useFloating(Object.assign(Object.assign({}, floatingOptions), { open: isOpen, onOpenChange: (isOpen) => {
|
|
13846
|
+
setIsOpen(isOpen);
|
|
13847
|
+
onOpenChange === null || onOpenChange === void 0 ? void 0 : onOpenChange(isOpen);
|
|
13848
|
+
}, elements: {
|
|
13846
13849
|
reference: referenceElementRef.current,
|
|
13847
13850
|
} }));
|
|
13848
13851
|
// Can't call hooks conditionally so this enabled option is needed.
|
|
13849
13852
|
const click = useClick(context, { enabled: !hover });
|
|
13850
13853
|
const hoverHook = useHover(context, { enabled: hover });
|
|
13851
|
-
const dismiss = useDismiss(context
|
|
13854
|
+
const dismiss = useDismiss(context, {
|
|
13855
|
+
bubbles: true,
|
|
13856
|
+
});
|
|
13852
13857
|
const { getReferenceProps, getFloatingProps } = useInteractions([click, hoverHook, dismiss]);
|
|
13853
13858
|
const tooltipContent = (jsx("div", Object.assign({ ref: refs.setFloating }, getFloatingProps(), { style: floatingStyles, role: "dialog", "aria-label": ariaLabel, className: `floatui-container ${className}`, children: jsx("div", { ref: floatUIContentRef, className: "floatui-content", children: content }) })));
|
|
13854
13859
|
return (jsxs(Fragment, { children: [jsx("div", Object.assign({ ref: refs.setReference }, getReferenceProps(), { children: trigger })), isOpen &&
|