@elementos-development/alchemy-ui 0.1.26 → 0.1.28
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/index.cjs +21 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.mts +3 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.js +21 -1
- package/dist/index.js.map +1 -1
- package/dist/testing.cjs.map +1 -1
- package/dist/testing.d.mts +3 -5
- package/dist/testing.d.ts +3 -5
- package/dist/testing.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -2938,10 +2938,24 @@ var Sidebar = ({
|
|
|
2938
2938
|
collapsible = false,
|
|
2939
2939
|
collapsed: controlledCollapsed,
|
|
2940
2940
|
onCollapsedChange,
|
|
2941
|
+
restoreFocusRef,
|
|
2941
2942
|
sx
|
|
2942
2943
|
}) => {
|
|
2943
2944
|
const [internalCollapsed, setInternalCollapsed] = React41.useState(false);
|
|
2944
2945
|
const isCollapsed = controlledCollapsed ?? internalCollapsed;
|
|
2946
|
+
const isTemporary = variant === "temporary";
|
|
2947
|
+
const handleDrawerClose = React41.useCallback(
|
|
2948
|
+
(_event, _reason) => {
|
|
2949
|
+
if (isTemporary && document.activeElement instanceof HTMLElement) {
|
|
2950
|
+
document.activeElement.blur();
|
|
2951
|
+
}
|
|
2952
|
+
onClose?.();
|
|
2953
|
+
},
|
|
2954
|
+
[isTemporary, onClose]
|
|
2955
|
+
);
|
|
2956
|
+
const handleDrawerExited = React41.useCallback(() => {
|
|
2957
|
+
restoreFocusRef?.current?.focus({ preventScroll: true });
|
|
2958
|
+
}, [restoreFocusRef]);
|
|
2945
2959
|
const handleToggle = () => {
|
|
2946
2960
|
const next = !isCollapsed;
|
|
2947
2961
|
setInternalCollapsed(next);
|
|
@@ -3089,7 +3103,13 @@ var Sidebar = ({
|
|
|
3089
3103
|
{
|
|
3090
3104
|
variant,
|
|
3091
3105
|
open,
|
|
3092
|
-
onClose,
|
|
3106
|
+
onClose: isTemporary ? handleDrawerClose : onClose,
|
|
3107
|
+
ModalProps: isTemporary && restoreFocusRef ? { disableRestoreFocus: true } : void 0,
|
|
3108
|
+
slotProps: isTemporary && restoreFocusRef ? {
|
|
3109
|
+
transition: {
|
|
3110
|
+
onExited: handleDrawerExited
|
|
3111
|
+
}
|
|
3112
|
+
} : void 0,
|
|
3093
3113
|
sx: {
|
|
3094
3114
|
width: currentWidth,
|
|
3095
3115
|
flexShrink: 0,
|