yet-another-react-lightbox 1.2.2 → 1.2.3
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/Lightbox.d.ts +3 -43
- package/dist/Lightbox.js +3 -4
- package/dist/types.d.ts +18 -2
- package/dist/types.js +18 -2
- package/package.json +1 -1
package/dist/Lightbox.d.ts
CHANGED
|
@@ -1,49 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
3
|
-
declare const LightboxComponent: {
|
|
4
|
-
(props: LightboxProps & typeof LightboxDefaultProps): JSX.Element | null;
|
|
5
|
-
propTypes: {
|
|
6
|
-
open: import("prop-types").Validator<boolean>;
|
|
7
|
-
close: import("prop-types").Validator<(...args: any[]) => any>;
|
|
8
|
-
index: import("prop-types").Validator<number>;
|
|
9
|
-
slides: import("prop-types").Validator<any[]>;
|
|
10
|
-
render: import("prop-types").Validator<import("prop-types").InferProps<{}>>;
|
|
11
|
-
plugins: import("prop-types").Validator<((...args: any[]) => any)[]>;
|
|
12
|
-
toolbar: import("prop-types").Validator<import("prop-types").InferProps<{
|
|
13
|
-
buttons: import("prop-types").Validator<(string | number | boolean | import("prop-types").ReactElementLike | import("prop-types").ReactNodeArray | null | undefined)[]>;
|
|
14
|
-
}>>;
|
|
15
|
-
labels: import("prop-types").Validator<import("prop-types").InferProps<{}>>;
|
|
16
|
-
carousel: import("prop-types").Validator<import("prop-types").InferProps<{
|
|
17
|
-
finite: import("prop-types").Validator<boolean>;
|
|
18
|
-
preload: import("prop-types").Validator<number>;
|
|
19
|
-
padding: import("prop-types").Validator<string | number>;
|
|
20
|
-
spacing: import("prop-types").Validator<string | number>;
|
|
21
|
-
}>>;
|
|
22
|
-
animation: import("prop-types").Validator<import("prop-types").InferProps<{
|
|
23
|
-
fade: import("prop-types").Validator<number>;
|
|
24
|
-
swipe: import("prop-types").Validator<number>;
|
|
25
|
-
}>>;
|
|
26
|
-
on: import("prop-types").Validator<import("prop-types").InferProps<{}>>;
|
|
27
|
-
};
|
|
28
|
-
defaultProps: {
|
|
29
|
-
open: boolean;
|
|
30
|
-
close: () => void;
|
|
31
|
-
index: number;
|
|
32
|
-
slides: import("./types.js").Slide[];
|
|
33
|
-
render: import("./types.js").Render;
|
|
34
|
-
plugins: import("./types.js").Plugin[];
|
|
35
|
-
toolbar: import("./types.js").Toolbar;
|
|
36
|
-
labels: import("./types.js").Labels;
|
|
37
|
-
animation: import("./types.js").Animation;
|
|
38
|
-
carousel: import("./types.js").Carousel;
|
|
39
|
-
on: import("./types.js").Callbacks;
|
|
40
|
-
};
|
|
41
|
-
};
|
|
42
|
-
declare type LightboxComponentProps<T> = T extends React.ComponentType<infer P> | React.Component<infer P> ? JSX.LibraryManagedAttributes<T, P> : never;
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { LightboxProps } from "./types.js";
|
|
43
3
|
declare type MakePartial<T> = T extends object ? Partial<T> : T;
|
|
44
4
|
declare type NestedPartial<T extends object> = {
|
|
45
5
|
[P in keyof T]?: MakePartial<T[P]>;
|
|
46
6
|
};
|
|
47
7
|
declare type NestedOptional<T, K extends keyof T> = Omit<T, K> & NestedPartial<Pick<T, K>>;
|
|
48
|
-
export declare const Lightbox: (props: NestedOptional<
|
|
8
|
+
export declare const Lightbox: (props: NestedOptional<Partial<LightboxProps>, "carousel" | "animation" | "render" | "toolbar" | "on">) => JSX.Element;
|
|
49
9
|
export {};
|
package/dist/Lightbox.js
CHANGED
|
@@ -24,9 +24,8 @@ const LightboxComponent = (props) => {
|
|
|
24
24
|
return React.createElement(React.Fragment, null, renderNode(createNode(CoreModule, config), augmentedProps));
|
|
25
25
|
};
|
|
26
26
|
LightboxComponent.propTypes = LightboxPropTypes;
|
|
27
|
-
LightboxComponent.defaultProps = LightboxDefaultProps;
|
|
28
27
|
export const Lightbox = (props) => {
|
|
29
|
-
const { carousel, animation, ...restProps } = props;
|
|
30
|
-
const { carousel: defaultCarousel, animation: defaultAnimation, ...restDefaultProps } = LightboxDefaultProps;
|
|
31
|
-
return (React.createElement(LightboxComponent, { carousel: { ...defaultCarousel, ...carousel }, animation: { ...defaultAnimation, ...animation }, ...restDefaultProps, ...restProps }));
|
|
28
|
+
const { carousel, animation, render, toolbar, on, ...restProps } = props;
|
|
29
|
+
const { carousel: defaultCarousel, animation: defaultAnimation, render: defaultRender, toolbar: defaultToolbar, on: defaultOn, ...restDefaultProps } = LightboxDefaultProps;
|
|
30
|
+
return (React.createElement(LightboxComponent, { carousel: { ...defaultCarousel, ...carousel }, animation: { ...defaultAnimation, ...animation }, render: { ...defaultRender, ...render }, toolbar: { ...defaultToolbar, ...toolbar }, on: { ...defaultOn, ...on }, ...restDefaultProps, ...restProps }));
|
|
32
31
|
};
|
package/dist/types.d.ts
CHANGED
|
@@ -60,7 +60,17 @@ export declare const LightboxPropTypes: {
|
|
|
60
60
|
close: PropTypes.Validator<(...args: any[]) => any>;
|
|
61
61
|
index: PropTypes.Validator<number>;
|
|
62
62
|
slides: PropTypes.Validator<any[]>;
|
|
63
|
-
render: PropTypes.Validator<PropTypes.InferProps<{
|
|
63
|
+
render: PropTypes.Validator<PropTypes.InferProps<{
|
|
64
|
+
slide: PropTypes.Requireable<(...args: any[]) => any>;
|
|
65
|
+
iconPrev: PropTypes.Requireable<(...args: any[]) => any>;
|
|
66
|
+
iconNext: PropTypes.Requireable<(...args: any[]) => any>;
|
|
67
|
+
iconClose: PropTypes.Requireable<(...args: any[]) => any>;
|
|
68
|
+
iconLoading: PropTypes.Requireable<(...args: any[]) => any>;
|
|
69
|
+
iconError: PropTypes.Requireable<(...args: any[]) => any>;
|
|
70
|
+
buttonPrev: PropTypes.Requireable<(...args: any[]) => any>;
|
|
71
|
+
buttonNext: PropTypes.Requireable<(...args: any[]) => any>;
|
|
72
|
+
buttonClose: PropTypes.Requireable<(...args: any[]) => any>;
|
|
73
|
+
}>>;
|
|
64
74
|
plugins: PropTypes.Validator<((...args: any[]) => any)[]>;
|
|
65
75
|
toolbar: PropTypes.Validator<PropTypes.InferProps<{
|
|
66
76
|
buttons: PropTypes.Validator<(string | number | boolean | PropTypes.ReactElementLike | PropTypes.ReactNodeArray | null | undefined)[]>;
|
|
@@ -76,7 +86,13 @@ export declare const LightboxPropTypes: {
|
|
|
76
86
|
fade: PropTypes.Validator<number>;
|
|
77
87
|
swipe: PropTypes.Validator<number>;
|
|
78
88
|
}>>;
|
|
79
|
-
on: PropTypes.Validator<PropTypes.InferProps<{
|
|
89
|
+
on: PropTypes.Validator<PropTypes.InferProps<{
|
|
90
|
+
view: PropTypes.Requireable<(...args: any[]) => any>;
|
|
91
|
+
entering: PropTypes.Requireable<(...args: any[]) => any>;
|
|
92
|
+
entered: PropTypes.Requireable<(...args: any[]) => any>;
|
|
93
|
+
exiting: PropTypes.Requireable<(...args: any[]) => any>;
|
|
94
|
+
exited: PropTypes.Requireable<(...args: any[]) => any>;
|
|
95
|
+
}>>;
|
|
80
96
|
};
|
|
81
97
|
export declare const LightboxDefaultProps: {
|
|
82
98
|
open: boolean;
|
package/dist/types.js
CHANGED
|
@@ -18,7 +18,17 @@ export const LightboxPropTypes = {
|
|
|
18
18
|
close: PropTypes.func.isRequired,
|
|
19
19
|
index: PropTypes.number.isRequired,
|
|
20
20
|
slides: PropTypes.arrayOf(PropTypes.oneOfType(SlideTypesPropTypes).isRequired).isRequired,
|
|
21
|
-
render: PropTypes.shape({
|
|
21
|
+
render: PropTypes.shape({
|
|
22
|
+
slide: PropTypes.func,
|
|
23
|
+
iconPrev: PropTypes.func,
|
|
24
|
+
iconNext: PropTypes.func,
|
|
25
|
+
iconClose: PropTypes.func,
|
|
26
|
+
iconLoading: PropTypes.func,
|
|
27
|
+
iconError: PropTypes.func,
|
|
28
|
+
buttonPrev: PropTypes.func,
|
|
29
|
+
buttonNext: PropTypes.func,
|
|
30
|
+
buttonClose: PropTypes.func,
|
|
31
|
+
}).isRequired,
|
|
22
32
|
plugins: PropTypes.arrayOf(PropTypes.func.isRequired).isRequired,
|
|
23
33
|
toolbar: PropTypes.shape({
|
|
24
34
|
buttons: PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf(["close"]), PropTypes.node])).isRequired,
|
|
@@ -34,7 +44,13 @@ export const LightboxPropTypes = {
|
|
|
34
44
|
fade: PropTypes.number.isRequired,
|
|
35
45
|
swipe: PropTypes.number.isRequired,
|
|
36
46
|
}).isRequired,
|
|
37
|
-
on: PropTypes.shape({
|
|
47
|
+
on: PropTypes.shape({
|
|
48
|
+
view: PropTypes.func,
|
|
49
|
+
entering: PropTypes.func,
|
|
50
|
+
entered: PropTypes.func,
|
|
51
|
+
exiting: PropTypes.func,
|
|
52
|
+
exited: PropTypes.func,
|
|
53
|
+
}).isRequired,
|
|
38
54
|
};
|
|
39
55
|
export const LightboxDefaultProps = {
|
|
40
56
|
open: false,
|