yet-another-react-lightbox 3.30.0 → 3.30.1
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.d.ts +1 -1
- package/dist/index.js +9 -5
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -87,7 +87,7 @@ declare function useEventCallback<Args extends unknown[], Return>(fn: (...args:
|
|
|
87
87
|
declare function setRef<T>(ref: React.MutableRefObject<T | null> | ((instance: T | null) => void) | null | undefined, value: T | null): void;
|
|
88
88
|
declare function useForkRef<InstanceA, InstanceB>(refA: React.Ref<InstanceA> | null | undefined, refB: React.Ref<InstanceB> | null | undefined): React.Ref<InstanceA & InstanceB> | null;
|
|
89
89
|
|
|
90
|
-
declare const useLayoutEffect: typeof React.
|
|
90
|
+
declare const useLayoutEffect: typeof React.useEffect;
|
|
91
91
|
|
|
92
92
|
declare function useLoseFocus(focus: () => void, disabled?: boolean): {
|
|
93
93
|
onFocus: () => void;
|
package/dist/index.js
CHANGED
|
@@ -739,14 +739,18 @@ const LightboxRoot = React.forwardRef(function LightboxRoot({ className, childre
|
|
|
739
739
|
const nodeRef = React.useRef(null);
|
|
740
740
|
const [isRTL, setIsRTL] = React.useState(false);
|
|
741
741
|
const { trackFocusWithin } = useA11yContext();
|
|
742
|
-
const detectRTL =
|
|
743
|
-
if (
|
|
744
|
-
|
|
742
|
+
const detectRTL = useEventCallback(() => {
|
|
743
|
+
if (nodeRef.current) {
|
|
744
|
+
const rtl = window.getComputedStyle(nodeRef.current).direction === "rtl";
|
|
745
|
+
if (rtl !== isRTL) {
|
|
746
|
+
setIsRTL(rtl);
|
|
747
|
+
}
|
|
745
748
|
}
|
|
746
|
-
}
|
|
749
|
+
});
|
|
750
|
+
React.useEffect(detectRTL);
|
|
747
751
|
return (React.createElement(DocumentContextProvider, { nodeRef: nodeRef },
|
|
748
752
|
React.createElement(RTLContextProvider, { isRTL: isRTL },
|
|
749
|
-
React.createElement("div", { ref: useForkRef(
|
|
753
|
+
React.createElement("div", { ref: useForkRef(ref, nodeRef), className: clsx(cssClass("root"), className), ...trackFocusWithin(onFocus, onBlur), ...rest }, children))));
|
|
750
754
|
});
|
|
751
755
|
|
|
752
756
|
var SwipeState;
|