yet-another-react-lightbox
Advanced tools
Comparing version 1.3.1 to 1.3.2
@@ -45,4 +45,6 @@ import * as React from "react"; | ||
var _a; | ||
(_a = containerRef.current) === null || _a === void 0 ? void 0 : _a.focus(); | ||
}, [containerRef]); | ||
if (refs.current.props.controller.focus) { | ||
(_a = containerRef.current) === null || _a === void 0 ? void 0 : _a.focus(); | ||
} | ||
}, [containerRef, refs]); | ||
React.useEffect(() => { | ||
@@ -49,0 +51,0 @@ var _a, _b; |
@@ -28,5 +28,5 @@ import * as React from "react"; | ||
export const Lightbox = (props) => { | ||
const { carousel, animation, render, toolbar, on, ...restProps } = props; | ||
const { carousel: defaultCarousel, animation: defaultAnimation, render: defaultRender, toolbar: defaultToolbar, on: defaultOn, ...restDefaultProps } = LightboxDefaultProps; | ||
return (React.createElement(LightboxComponent, { carousel: { ...defaultCarousel, ...carousel }, animation: { ...defaultAnimation, ...animation }, render: { ...defaultRender, ...render }, toolbar: { ...defaultToolbar, ...toolbar }, on: { ...defaultOn, ...on }, ...restDefaultProps, ...restProps })); | ||
const { carousel, animation, render, toolbar, controller, on, ...restProps } = props; | ||
const { carousel: defaultCarousel, animation: defaultAnimation, render: defaultRender, toolbar: defaultToolbar, controller: defaultController, on: defaultOn, ...restDefaultProps } = LightboxDefaultProps; | ||
return (React.createElement(LightboxComponent, { carousel: { ...defaultCarousel, ...carousel }, animation: { ...defaultAnimation, ...animation }, render: { ...defaultRender, ...render }, toolbar: { ...defaultToolbar, ...toolbar }, controller: { ...defaultController, ...controller }, on: { ...defaultOn, ...on }, ...restDefaultProps, ...restProps })); | ||
}; |
@@ -6,3 +6,3 @@ import * as React from "react"; | ||
const Inline = ({ augment, replace, remove }) => { | ||
augment(({ toolbar: { buttons, ...restToolbar }, open, close, ...restProps }) => ({ | ||
augment(({ toolbar: { buttons, ...restToolbar }, open, close, controller: { focus, ...restController }, ...restProps }) => ({ | ||
open: true, | ||
@@ -15,2 +15,3 @@ close: () => { }, | ||
inline: { style: { width: "100%", height: "100%" } }, | ||
controller: { focus: false, ...restController }, | ||
...restProps, | ||
@@ -17,0 +18,0 @@ })); |
@@ -16,3 +16,3 @@ import * as React from "react"; | ||
export declare type Slide = SlideTypes[keyof SlideTypes]; | ||
export interface Carousel { | ||
export interface CarouselSettings { | ||
finite: boolean; | ||
@@ -23,6 +23,9 @@ preload: number; | ||
} | ||
export interface Animation { | ||
export interface AnimationSettings { | ||
fade: number; | ||
swipe: number; | ||
} | ||
export interface ControllerSettings { | ||
focus: boolean; | ||
} | ||
export interface Render { | ||
@@ -54,5 +57,6 @@ slide?: (slide: Slide) => React.ReactNode; | ||
plugins: Plugin[]; | ||
toolbar: Toolbar; | ||
carousel: Carousel; | ||
animation: Animation; | ||
toolbar: ToolbarSettings; | ||
carousel: CarouselSettings; | ||
animation: AnimationSettings; | ||
controller: ControllerSettings; | ||
on: Callbacks; | ||
@@ -92,2 +96,5 @@ } | ||
}>>; | ||
controller: PropTypes.Validator<PropTypes.InferProps<{ | ||
focus: PropTypes.Validator<boolean>; | ||
}>>; | ||
on: PropTypes.Validator<PropTypes.InferProps<{ | ||
@@ -108,6 +115,7 @@ view: PropTypes.Requireable<(...args: any[]) => any>; | ||
plugins: Plugin[]; | ||
toolbar: Toolbar; | ||
toolbar: ToolbarSettings; | ||
labels: Labels; | ||
animation: Animation; | ||
carousel: Carousel; | ||
animation: AnimationSettings; | ||
carousel: CarouselSettings; | ||
controller: ControllerSettings; | ||
on: Callbacks; | ||
@@ -118,3 +126,3 @@ }; | ||
}; | ||
export interface Toolbar { | ||
export interface ToolbarSettings { | ||
buttons: ("close" | React.ReactNode)[]; | ||
@@ -121,0 +129,0 @@ } |
@@ -47,2 +47,5 @@ import PropTypes from "prop-types"; | ||
}).isRequired, | ||
controller: PropTypes.shape({ | ||
focus: PropTypes.bool.isRequired, | ||
}).isRequired, | ||
on: PropTypes.shape({ | ||
@@ -75,3 +78,6 @@ view: PropTypes.func, | ||
}, | ||
controller: { | ||
focus: true, | ||
}, | ||
on: {}, | ||
}; |
{ | ||
"name": "yet-another-react-lightbox", | ||
"version": "1.3.1", | ||
"version": "1.3.2", | ||
"description": "Modern React lightbox component", | ||
@@ -5,0 +5,0 @@ "author": "Igor Danchenko", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
77653
1709