infinity-ui-elements 1.8.44 → 1.8.45
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/dist/components/SidePanel/SidePanel.d.ts.map +1 -1
- package/dist/index.esm.js +25 -5
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +25 -5
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SidePanel.d.ts","sourceRoot":"","sources":["../../../src/components/SidePanel/SidePanel.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAM/B,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAEhD,MAAM,WAAW,cAAc;IAC7B;;OAEG;IACH,MAAM,EAAE,OAAO,CAAC;IAChB;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;OAEG;IACH,SAAS,CAAC,EAAE,QAAQ,GAAG,KAAK,CAAC,SAAS,CAAC;IACvC;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;OAEG;IACH,MAAM,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACzB;;OAEG;IACH,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;IAC5B;;OAEG;IACH,KAAK,CAAC,EAAE,OAAO,GAAG,QAAQ,GAAG,OAAO,GAAG,QAAQ,GAAG,MAAM,CAAC;IACzD;;OAEG;IACH,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B;;OAEG;IACH,aAAa,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAChC;;OAEG;IACH,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B;;OAEG;IACH,aAAa,CAAC,EAAE,O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AE,OAAO,CAAC;IAC1B;;OAEG;IACH,aAAa,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAChC;;OAEG;IACH,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B;;OAEG;IACH,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;OAEG;IACH,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B;;OAEG;IACH,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB;;OAEG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB;;OAEG;IACH,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB;;OAEG;IACH,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;OAEG;IACH,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B;AAED,QAAA,MAAM,SAAS,uFA2Pd,CAAC;AAIF,OAAO,EAAE,SAAS,EAAE,CAAC"}
|
package/dist/index.esm.js
CHANGED
|
@@ -3803,6 +3803,8 @@ SearchableDropdown.displayName = "SearchableDropdown";
|
|
|
3803
3803
|
const SidePanel = React.forwardRef(({ isOpen, onClose, title, titleIcon, description, footer, children, position = "right", width = "medium", showCloseButton = true, headerActions, closeOnOverlayClick = true, closeOnEscape = true, className, contentClassName, headerClassName, bodyClassName, footerClassName, overlayClassName, ariaLabel, ariaDescribedBy, }, ref) => {
|
|
3804
3804
|
const panelRef = React.useRef(null);
|
|
3805
3805
|
const contentRef = ref || panelRef;
|
|
3806
|
+
const [isVisible, setIsVisible] = React.useState(false);
|
|
3807
|
+
const [shouldRender, setShouldRender] = React.useState(false);
|
|
3806
3808
|
// Width configurations
|
|
3807
3809
|
const widthConfig = {
|
|
3808
3810
|
small: "w-80",
|
|
@@ -3810,15 +3812,33 @@ const SidePanel = React.forwardRef(({ isOpen, onClose, title, titleIcon, descrip
|
|
|
3810
3812
|
large: "w-[32rem]",
|
|
3811
3813
|
xlarge: "w-[40rem]",
|
|
3812
3814
|
};
|
|
3815
|
+
// Handle mounting and unmounting with animation
|
|
3816
|
+
React.useEffect(() => {
|
|
3817
|
+
if (isOpen) {
|
|
3818
|
+
setShouldRender(true);
|
|
3819
|
+
// Small delay to trigger animation
|
|
3820
|
+
requestAnimationFrame(() => {
|
|
3821
|
+
setIsVisible(true);
|
|
3822
|
+
});
|
|
3823
|
+
}
|
|
3824
|
+
else {
|
|
3825
|
+
setIsVisible(false);
|
|
3826
|
+
// Wait for animation to complete before unmounting
|
|
3827
|
+
const timer = setTimeout(() => {
|
|
3828
|
+
setShouldRender(false);
|
|
3829
|
+
}, 300); // Match animation duration
|
|
3830
|
+
return () => clearTimeout(timer);
|
|
3831
|
+
}
|
|
3832
|
+
}, [isOpen]);
|
|
3813
3833
|
// Position-based classes
|
|
3814
3834
|
const positionClasses = {
|
|
3815
3835
|
left: {
|
|
3816
3836
|
container: "justify-start",
|
|
3817
|
-
panel:
|
|
3837
|
+
panel: isVisible ? "animate-slide-in-left" : "animate-slide-out-left",
|
|
3818
3838
|
},
|
|
3819
3839
|
right: {
|
|
3820
3840
|
container: "justify-end",
|
|
3821
|
-
panel:
|
|
3841
|
+
panel: isVisible ? "animate-slide-in-right" : "animate-slide-out-right",
|
|
3822
3842
|
},
|
|
3823
3843
|
};
|
|
3824
3844
|
// Handle escape key
|
|
@@ -3851,14 +3871,14 @@ const SidePanel = React.forwardRef(({ isOpen, onClose, title, titleIcon, descrip
|
|
|
3851
3871
|
onClose();
|
|
3852
3872
|
}
|
|
3853
3873
|
};
|
|
3854
|
-
// Don't render if not open
|
|
3855
|
-
if (!
|
|
3874
|
+
// Don't render if not open and animation is complete
|
|
3875
|
+
if (!shouldRender)
|
|
3856
3876
|
return null;
|
|
3857
3877
|
const hasHeader = title || description;
|
|
3858
3878
|
const widthClass = width in widthConfig
|
|
3859
3879
|
? widthConfig[width]
|
|
3860
3880
|
: width;
|
|
3861
|
-
return (jsxs("div", { className: cn("fixed inset-0 z-10000 flex
|
|
3881
|
+
return (jsxs("div", { className: cn("fixed inset-0 z-10000 flex p-4", positionClasses[position].container, className), role: "dialog", "aria-modal": "true", "aria-label": ariaLabel || title, "aria-describedby": ariaDescribedBy, children: [jsx("div", { className: cn("absolute inset-0 bg-black/50 backdrop-blur-sm transition-opacity duration-300", isVisible ? "opacity-100" : "opacity-0", overlayClassName), onClick: handleOverlayClick, "aria-hidden": "true" }), jsxs("div", { ref: contentRef, className: cn("relative bg-white shadow-2xl transition-transform duration-300 ease-out rounded-large", "flex flex-col max-w-full h-full overflow-hidden", widthClass, positionClasses[position].panel, contentClassName), children: [hasHeader && (jsxs("div", { className: cn("flex items-center justify-between gap-4 px-7 py-5 shrink-0 border-b border-surface-outline-neutral-subtle", headerClassName), children: [jsxs("div", { className: "flex items-center gap-3 flex-1 min-w-0", children: [titleIcon && (jsx("div", { className: "flex items-center justify-center shrink-0", children: typeof titleIcon === "string" ? (jsx(Icon, { name: titleIcon, size: 20 })) : (titleIcon) })), jsxs("div", { className: "flex flex-col flex-1 min-w-0", children: [title && (jsx(Text, { as: "h2", variant: "body", size: "large", weight: "semibold", color: "default", className: "truncate", children: title })), description && (jsx(Text, { as: "p", variant: "body", size: "small", weight: "regular", color: "subtle", className: "mt-0.5", children: description }))] })] }), jsxs("div", { className: "flex items-center gap-2 shrink-0", children: [headerActions, showCloseButton && onClose && (jsx(IconButton, { icon: "close", onClick: onClose, color: "neutral", size: "small", "aria-label": "Close side panel" }))] })] })), !hasHeader && showCloseButton && onClose && (jsx("div", { className: "absolute top-4 right-4 z-10", children: jsx(IconButton, { icon: "close", onClick: onClose, color: "neutral", size: "small", "aria-label": "Close side panel" }) })), jsx("div", { className: cn("flex-1 overflow-y-auto px-6", hasHeader ? "py-6" : "pt-6 pb-4", !footer && "pb-6", bodyClassName), children: children }), footer && (jsxs("div", { className: "flex flex-col shrink-0", children: [jsx(Divider, { thickness: "thin", variant: "muted" }), jsx("div", { className: cn("flex items-center justify-end gap-3 px-6 py-4", footerClassName), children: footer })] }))] })] }));
|
|
3862
3882
|
});
|
|
3863
3883
|
SidePanel.displayName = "SidePanel";
|
|
3864
3884
|
|