yet-another-react-lightbox 1.2.1 → 1.3.0
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/README.md +4 -6
- package/dist/Lightbox.d.ts +5 -47
- package/dist/Lightbox.js +3 -4
- package/dist/index.d.ts +2 -0
- package/dist/index.js +2 -0
- package/dist/types.d.ts +18 -2
- package/dist/types.js +18 -2
- package/package.json +6 -5
package/README.md
CHANGED
|
@@ -8,11 +8,9 @@ Modern lightbox component for React.
|
|
|
8
8
|
[](https://bundlephobia.com/package/yet-another-react-lightbox)
|
|
9
9
|
[](LICENSE)
|
|
10
10
|
|
|
11
|
-
Coming soon...
|
|
12
|
-
|
|
13
11
|
## Documentation
|
|
14
12
|
|
|
15
|
-
|
|
13
|
+
[https://yet-another-react-lightbox.vercel.app/](https://yet-another-react-lightbox.vercel.app/)
|
|
16
14
|
|
|
17
15
|
## Installation
|
|
18
16
|
|
|
@@ -30,10 +28,10 @@ yarn add yet-another-react-lightbox
|
|
|
30
28
|
|
|
31
29
|
```javascript
|
|
32
30
|
import * as React from "react";
|
|
33
|
-
import
|
|
31
|
+
import Lightbox from "yet-another-react-lightbox";
|
|
34
32
|
import "yet-another-react-lightbox/styles.css";
|
|
35
33
|
|
|
36
|
-
const
|
|
34
|
+
const App = () => {
|
|
37
35
|
const [open, setOpen] = React.useState(false);
|
|
38
36
|
|
|
39
37
|
return (
|
|
@@ -55,7 +53,7 @@ const Page = () => {
|
|
|
55
53
|
);
|
|
56
54
|
};
|
|
57
55
|
|
|
58
|
-
export default
|
|
56
|
+
export default App;
|
|
59
57
|
```
|
|
60
58
|
|
|
61
59
|
## License
|
package/dist/Lightbox.d.ts
CHANGED
|
@@ -1,49 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
3
|
-
declare
|
|
4
|
-
|
|
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
|
-
};
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { LightboxProps } from "./types.js";
|
|
3
|
+
declare type DeepPartial<T, K extends keyof T> = Omit<T, K> & {
|
|
4
|
+
[P in keyof Pick<T, K>]?: Partial<Pick<T, K>[P]>;
|
|
41
5
|
};
|
|
42
|
-
declare
|
|
43
|
-
declare type MakePartial<T> = T extends object ? Partial<T> : T;
|
|
44
|
-
declare type NestedPartial<T extends object> = {
|
|
45
|
-
[P in keyof T]?: MakePartial<T[P]>;
|
|
46
|
-
};
|
|
47
|
-
declare type NestedOptional<T, K extends keyof T> = Omit<T, K> & NestedPartial<Pick<T, K>>;
|
|
48
|
-
export declare const Lightbox: (props: NestedOptional<LightboxComponentProps<typeof LightboxComponent>, "carousel" | "animation">) => JSX.Element;
|
|
6
|
+
export declare const Lightbox: (props: DeepPartial<Partial<LightboxProps>, "carousel" | "animation" | "render" | "toolbar" | "on">) => JSX.Element;
|
|
49
7
|
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/index.d.ts
CHANGED
package/dist/index.js
CHANGED
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,
|
package/package.json
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "yet-another-react-lightbox",
|
|
3
|
-
"version": "1.
|
|
4
|
-
"description": "Modern lightbox component
|
|
3
|
+
"version": "1.3.0",
|
|
4
|
+
"description": "Modern React lightbox component",
|
|
5
5
|
"author": "Igor Danchenko",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"type": "module",
|
|
8
|
+
"main": "dist/index.js",
|
|
8
9
|
"exports": {
|
|
9
10
|
".": "./dist/index.js",
|
|
10
11
|
"./core": "./dist/core/index.js",
|
|
@@ -81,8 +82,8 @@
|
|
|
81
82
|
"@types/jest": "^27.5.1",
|
|
82
83
|
"@types/react": "^18.0.9",
|
|
83
84
|
"@types/react-dom": "^18.0.5",
|
|
84
|
-
"@typescript-eslint/eslint-plugin": "^5.
|
|
85
|
-
"@typescript-eslint/parser": "^5.
|
|
85
|
+
"@typescript-eslint/eslint-plugin": "^5.27.0",
|
|
86
|
+
"@typescript-eslint/parser": "^5.27.0",
|
|
86
87
|
"autoprefixer": "^10.4.7",
|
|
87
88
|
"eslint": "^8.16.0",
|
|
88
89
|
"eslint-config-airbnb": "^19.0.4",
|
|
@@ -96,7 +97,7 @@
|
|
|
96
97
|
"husky": "^8.0.1",
|
|
97
98
|
"jest": "^28.1.0",
|
|
98
99
|
"jest-environment-jsdom": "^28.1.0",
|
|
99
|
-
"lint-staged": "^12.4.
|
|
100
|
+
"lint-staged": "^12.4.3",
|
|
100
101
|
"npm-run-all": "^4.1.5",
|
|
101
102
|
"postcss": "^8.4.14",
|
|
102
103
|
"postcss-cli": "^9.1.0",
|