Skip to content

Commit bc943ec

Browse files
🤖 Merge PR DefinitelyTyped#74394 fslightbox-react 2.0 by @piotrzdziarski
1 parent 207087f commit bc943ec

3 files changed

Lines changed: 30 additions & 20 deletions

File tree

types/fslightbox-react/fslightbox-react-tests.tsx

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@ import FsLightbox from "fslightbox-react";
22
import * as React from "react";
33

44
class Test extends React.Component {
5-
handleEvent = (instance: FsLightbox) => {};
5+
handleEvent = (instance: any) => {};
6+
handleSourceLoadEvent = (instance: any, source: any, index: number) => {};
67

78
render() {
89
return (
@@ -24,6 +25,11 @@ class Test extends React.Component {
2425
type="image"
2526
types={[null, "video", "youtube"]}
2627
thumbs={[null, "yt.jpg", "bbbunny.jpg", "vimeo.jpg"]}
28+
thumbsIcon={
29+
<svg xmlns="http://www.w3.org/2000/svg" width="28px" height="28px" viewBox="00 430.118 430.118">
30+
<path d="M0 0 H119.054 V119.054 H0 V0 z M158.946 0 H278 V119.054 H158.946 V0 z M158.946 158.946 H278 V278 H158.946 V158.946 z M0 158.946 H119.054 V278 H0 V158.946 z" />
31+
</svg>
32+
}
2733
thumbsIcons={[
2834
null,
2935
<svg xmlns="http://www.w3.org/2000/svg" width="28px" height="28px" viewBox="00 430.118 430.118">
@@ -39,6 +45,7 @@ class Test extends React.Component {
3945
captions={[<h2>Caption 1</h2>, "Caption 2", "Caption 3"]}
4046
customAttributes={[null, { poster: "bbbunny.jpg" }]}
4147
showThumbsOnMount={false}
48+
showThumbsWithCaptions={true}
4249
disableThumbs={false}
4350
openOnMount={false}
4451
autoplay
@@ -48,34 +55,35 @@ class Test extends React.Component {
4855
exitFullscreenOnClose={false}
4956
slideDistance={0.5}
5057
slideshowTime={10000}
58+
sourceMargin={0.2}
5159
UIFadeOutTime={10000}
5260
zoomIncrement={0.5}
5361
onInit={this.handleEvent}
5462
onOpen={this.handleEvent}
5563
onShow={this.handleEvent}
5664
onClose={this.handleEvent}
65+
onSourceLoad={this.handleSourceLoadEvent}
5766
onSlideChange={this.handleEvent}
5867
maxYoutubeVideoDimensions={{ width: 400, height: 300 }}
5968
initialAnimation="example-initial-animation"
6069
slideChangeAnimation="example-slide-change-animation"
6170
svg={{
6271
toolbarButtons: {
6372
thumbs: {
73+
class: "new-thumbs-btn",
6474
viewBox: "0 0 278 278",
65-
width: "17px",
66-
height: "17px",
6775
d: "M0 0 H119.054 V119.054 H0 V0 z M158.946 0 H278 V119.054 H158.946 V0 z M158.946 158.946 H278 V278 H158.946 V158.946 z M0 158.946 H119.054 V278 H0 V158.946 z",
6876
title: "Preview",
6977
},
7078
zoomIn: {
71-
width: "20px",
79+
title: "Bigger",
7280
},
7381
zoomOut: {
74-
height: "20px",
82+
class: "new-zoom-out",
7583
},
7684
slideshow: {
7785
start: {
78-
width: "20px",
86+
d: "M 1",
7987
},
8088
pause: {
8189
viewBox: "0 0 31 31",
@@ -90,12 +98,12 @@ class Test extends React.Component {
9098
},
9199
},
92100
close: {
93-
height: "32px",
101+
d: "M 0",
94102
},
95103
},
96104
slideButtons: {
97105
previous: {
98-
width: "40px",
106+
viewBox: "0 0 40 40",
99107
},
100108
next: {
101109
title: "Next",

types/fslightbox-react/index.d.ts

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,9 @@ declare namespace FsLightbox {
99
}
1010

1111
interface ToolbarButtonProps {
12+
class?: string;
1213
viewBox?: string;
1314
d?: string;
14-
width?: string;
15-
height?: string;
1615
title?: string;
1716
}
1817

@@ -32,15 +31,15 @@ declare namespace FsLightbox {
3231

3332
// slide number controlling
3433
slide?: number | undefined;
35-
source?: string | undefined;
3634
sourceIndex?: number | undefined;
3735

3836
// events
39-
onOpen?: ((instance: FsLightbox) => void) | undefined;
40-
onClose?: ((instance: FsLightbox) => void) | undefined;
41-
onInit?: ((instance: FsLightbox) => void) | undefined;
42-
onShow?: ((instance: FsLightbox) => void) | undefined;
43-
onSlideChange?: ((instance: FsLightbox) => void) | undefined; // pro feature
37+
onOpen?: ((instance: any) => void) | undefined;
38+
onClose?: ((instance: any) => void) | undefined;
39+
onInit?: ((instance: any) => void) | undefined;
40+
onShow?: ((instance: any) => void) | undefined;
41+
onSourceLoad?: ((instance: any, source: any, index: number) => void) | undefined;
42+
onSlideChange?: ((instance: any) => void) | undefined; // pro feature
4443

4544
// types
4645
disableLocalStorage?: boolean | undefined;
@@ -53,6 +52,7 @@ declare namespace FsLightbox {
5352

5453
// thumbs
5554
thumbs?: Array<string | null> | undefined; // pro feature
55+
thumbsIcon?: React.JSX.Element | undefined; // pro feature
5656
thumbsIcons?: Array<React.JSX.Element | null> | undefined; // pro feature
5757

5858
// animations
@@ -66,9 +66,11 @@ declare namespace FsLightbox {
6666
disableSlideSwiping?: boolean | undefined;
6767
loadOnlyCurrentSource?: boolean | undefined;
6868
showThumbsOnMount?: boolean | undefined; // pro feature
69+
showThumbsWithCaptions?: boolean | undefined; // pro feature
6970
disableThumbs?: boolean | undefined; // pro feature
7071
slideDistance?: number | undefined;
7172
slideshowTime?: number | undefined; // pro feature
73+
sourceMargin?: number | undefined;
7274
UIFadeOutTime?: number | false | undefined; // pro feature
7375
zoomIncrement?: number | undefined; // pro feature
7476
openOnMount?: boolean | undefined;
@@ -98,6 +100,6 @@ declare namespace FsLightbox {
98100
}
99101
}
100102

101-
declare class FsLightbox extends React.Component<FsLightbox.FsLightboxProps> {}
102-
103-
export = FsLightbox;
103+
declare const FsLightbox : React.FC<FsLightbox.FsLightboxProps>
104+
export = FsLightbox
105+

types/fslightbox-react/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"private": true,
33
"name": "@types/fslightbox-react",
4-
"version": "1.8.9999",
4+
"version": "2.0.9999",
55
"projects": [
66
"https://fslightbox.com/"
77
],

0 commit comments

Comments
 (0)