yet-another-react-lightbox 3.0.0 → 3.2.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 +1 -0
- package/dist/core/components/Icons.d.ts +4 -0
- package/dist/core/components/Icons.js +17 -4
- package/dist/core/consts.d.ts +2 -0
- package/dist/core/consts.js +2 -0
- package/dist/core/modules/Controller.d.ts +5 -1
- package/dist/core/modules/Controller.js +1 -1
- package/dist/plugins/captions/Captions.d.ts +1 -1
- package/dist/plugins/captions/Captions.js +16 -8
- package/dist/plugins/captions/CaptionsButton.d.ts +2 -0
- package/dist/plugins/captions/CaptionsButton.js +16 -0
- package/dist/plugins/captions/CaptionsContext.d.ts +5 -0
- package/dist/plugins/captions/CaptionsContext.js +16 -0
- package/dist/plugins/captions/Description.d.ts +3 -3
- package/dist/plugins/captions/Description.js +8 -4
- package/dist/plugins/captions/Title.d.ts +3 -3
- package/dist/plugins/captions/Title.js +11 -3
- package/dist/plugins/captions/index.d.ts +21 -0
- package/dist/plugins/captions/props.d.ts +10 -0
- package/dist/plugins/captions/props.js +6 -0
- package/dist/plugins/counter/Counter.d.ts +5 -0
- package/dist/plugins/counter/Counter.js +14 -0
- package/dist/plugins/counter/counter.css +16 -0
- package/dist/plugins/counter/index.d.ts +9 -0
- package/dist/plugins/counter/index.js +2 -0
- package/dist/plugins/fullscreen/FullscreenButton.js +1 -1
- package/dist/plugins/index.d.ts +1 -0
- package/dist/plugins/index.js +1 -0
- package/dist/plugins/slideshow/SlideshowButton.js +1 -1
- package/dist/plugins/thumbnails/Thumbnails.js +15 -6
- package/dist/plugins/thumbnails/ThumbnailsButton.d.ts +2 -0
- package/dist/plugins/thumbnails/ThumbnailsButton.js +16 -0
- package/dist/plugins/thumbnails/ThumbnailsContext.d.ts +6 -0
- package/dist/plugins/thumbnails/ThumbnailsContext.js +24 -0
- package/dist/plugins/thumbnails/ThumbnailsTrack.d.ts +0 -2
- package/dist/plugins/thumbnails/ThumbnailsTrack.js +3 -0
- package/dist/plugins/thumbnails/index.d.ts +21 -1
- package/dist/plugins/thumbnails/props.d.ts +6 -0
- package/dist/plugins/thumbnails/props.js +1 -0
- package/dist/plugins/video/index.d.ts +0 -9
- package/dist/plugins/video/index.js +0 -1
- package/dist/plugins/zoom/ZoomButton.js +1 -1
- package/package.json +9 -1
- package/dist/plugins/thumbnails/ThumbnailsContainer.d.ts +0 -4
- package/dist/plugins/thumbnails/ThumbnailsContainer.js +0 -14
package/README.md
CHANGED
|
@@ -129,6 +129,7 @@ The following plugins come bundled in the package:
|
|
|
129
129
|
|
|
130
130
|
- [Captions](https://yet-another-react-lightbox.com/plugins/captions) - adds support for slide title and
|
|
131
131
|
description
|
|
132
|
+
- [Counter](https://yet-another-react-lightbox.com/plugins/counter) - adds slides counter
|
|
132
133
|
- [Fullscreen](https://yet-another-react-lightbox.com/plugins/fullscreen) - adds support for fullscreen mode
|
|
133
134
|
- [Inline](https://yet-another-react-lightbox.com/plugins/inline) - adds support for inline rendering mode
|
|
134
135
|
- [Slideshow](https://yet-another-react-lightbox.com/plugins/slideshow) - adds slideshow autoplay feature
|
|
@@ -3,6 +3,10 @@ export declare function createIcon(name: string, glyph: React.ReactNode): {
|
|
|
3
3
|
(props: React.SVGProps<SVGSVGElement>): JSX.Element;
|
|
4
4
|
displayName: string;
|
|
5
5
|
};
|
|
6
|
+
export declare function createIconDisabled(name: string, glyph: React.ReactNode): {
|
|
7
|
+
(props: React.SVGProps<SVGSVGElement>): JSX.Element;
|
|
8
|
+
displayName: string;
|
|
9
|
+
};
|
|
6
10
|
export declare const CloseIcon: {
|
|
7
11
|
(props: React.SVGProps<SVGSVGElement>): JSX.Element;
|
|
8
12
|
displayName: string;
|
|
@@ -1,11 +1,24 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
+
function svgIcon(name, children) {
|
|
3
|
+
const icon = (props) => (React.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", width: "24", height: "24", "aria-hidden": "true", focusable: "false", ...props }, children));
|
|
4
|
+
icon.displayName = name;
|
|
5
|
+
return icon;
|
|
6
|
+
}
|
|
2
7
|
export function createIcon(name, glyph) {
|
|
3
|
-
|
|
4
|
-
React.createElement("
|
|
8
|
+
return svgIcon(name, React.createElement("g", { fill: "currentColor" },
|
|
9
|
+
React.createElement("path", { d: "M0 0h24v24H0z", fill: "none" }),
|
|
10
|
+
glyph));
|
|
11
|
+
}
|
|
12
|
+
export function createIconDisabled(name, glyph) {
|
|
13
|
+
return svgIcon(name, React.createElement(React.Fragment, null,
|
|
14
|
+
React.createElement("defs", null,
|
|
15
|
+
React.createElement("mask", { id: "strike" },
|
|
16
|
+
React.createElement("path", { d: "M0 0h24v24H0z", fill: "white" }),
|
|
17
|
+
React.createElement("path", { d: "M0 0L24 24", stroke: "black", strokeWidth: 4 }))),
|
|
18
|
+
React.createElement("path", { d: "M0.70707 2.121320L21.878680 23.292883", stroke: "currentColor", strokeWidth: 2 }),
|
|
19
|
+
React.createElement("g", { fill: "currentColor", mask: "url(#strike)" },
|
|
5
20
|
React.createElement("path", { d: "M0 0h24v24H0z", fill: "none" }),
|
|
6
21
|
glyph)));
|
|
7
|
-
icon.displayName = name;
|
|
8
|
-
return icon;
|
|
9
22
|
}
|
|
10
23
|
export const CloseIcon = createIcon("Close", React.createElement("path", { d: "M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z" }));
|
|
11
24
|
export const PreviousIcon = createIcon("Previous", React.createElement("path", { d: "M15.41 7.41L14 6l-6 6 6 6 1.41-1.41L10.83 12z" }));
|
package/dist/core/consts.d.ts
CHANGED
|
@@ -5,6 +5,8 @@ export declare const MODULE_NO_SCROLL = "no-scroll";
|
|
|
5
5
|
export declare const MODULE_PORTAL = "portal";
|
|
6
6
|
export declare const MODULE_ROOT = "root";
|
|
7
7
|
export declare const MODULE_TOOLBAR = "toolbar";
|
|
8
|
+
export declare const PLUGIN_CAPTIONS = "captions";
|
|
9
|
+
export declare const PLUGIN_COUNTER = "counter";
|
|
8
10
|
export declare const PLUGIN_FULLSCREEN = "fullscreen";
|
|
9
11
|
export declare const PLUGIN_INLINE = "inline";
|
|
10
12
|
export declare const PLUGIN_SLIDESHOW = "slideshow";
|
package/dist/core/consts.js
CHANGED
|
@@ -5,6 +5,8 @@ export const MODULE_NO_SCROLL = "no-scroll";
|
|
|
5
5
|
export const MODULE_PORTAL = "portal";
|
|
6
6
|
export const MODULE_ROOT = "root";
|
|
7
7
|
export const MODULE_TOOLBAR = "toolbar";
|
|
8
|
+
export const PLUGIN_CAPTIONS = "captions";
|
|
9
|
+
export const PLUGIN_COUNTER = "counter";
|
|
8
10
|
export const PLUGIN_FULLSCREEN = "fullscreen";
|
|
9
11
|
export const PLUGIN_INLINE = "inline";
|
|
10
12
|
export const PLUGIN_SLIDESHOW = "slideshow";
|
|
@@ -2,13 +2,17 @@ import * as React from "react";
|
|
|
2
2
|
import { Callback, ComponentProps, ContainerRect, ControllerRef, NavigationAction } from "../../types.js";
|
|
3
3
|
import { SubscribeSensors } from "../hooks/index.js";
|
|
4
4
|
import { LightboxStateSwipeAction } from "../contexts/index.js";
|
|
5
|
-
import { ACTION_CLOSE, ACTION_NEXT, ACTION_PREV, ACTION_SWIPE } from "../consts.js";
|
|
5
|
+
import { ACTION_CLOSE, ACTION_NEXT, ACTION_PREV, ACTION_SWIPE, ACTIVE_SLIDE_COMPLETE, ACTIVE_SLIDE_ERROR, ACTIVE_SLIDE_LOADING, ACTIVE_SLIDE_PLAYING } from "../consts.js";
|
|
6
6
|
declare module "../index.js" {
|
|
7
7
|
interface EventTypes {
|
|
8
8
|
[ACTION_PREV]: NavigationAction | void;
|
|
9
9
|
[ACTION_NEXT]: NavigationAction | void;
|
|
10
10
|
[ACTION_SWIPE]: LightboxStateSwipeAction;
|
|
11
11
|
[ACTION_CLOSE]: void;
|
|
12
|
+
[ACTIVE_SLIDE_LOADING]: void;
|
|
13
|
+
[ACTIVE_SLIDE_PLAYING]: void;
|
|
14
|
+
[ACTIVE_SLIDE_COMPLETE]: void;
|
|
15
|
+
[ACTIVE_SLIDE_ERROR]: void;
|
|
12
16
|
}
|
|
13
17
|
}
|
|
14
18
|
export type ControllerContextType = Pick<ControllerRef, "prev" | "next" | "close"> & {
|
|
@@ -4,7 +4,7 @@ import { cleanup, clsx, computeSlideRect, cssClass, cssVar, makeComposePrefix, m
|
|
|
4
4
|
import { useAnimation, useContainerRect, useDelay, useEventCallback, useForkRef, useRTL, useSensors, } from "../hooks/index.js";
|
|
5
5
|
import { useEvents, useLightboxState } from "../contexts/index.js";
|
|
6
6
|
import { SwipeState, usePointerSwipe, usePreventSwipeNavigation, useWheelSwipe } from "./controller/index.js";
|
|
7
|
-
import { ACTION_CLOSE, ACTION_NEXT, ACTION_PREV, ACTION_SWIPE, CLASS_FLEX_CENTER, EVENT_ON_KEY_UP, MODULE_CONTROLLER, VK_ESCAPE, } from "../consts.js";
|
|
7
|
+
import { ACTION_CLOSE, ACTION_NEXT, ACTION_PREV, ACTION_SWIPE, ACTIVE_SLIDE_COMPLETE, ACTIVE_SLIDE_ERROR, ACTIVE_SLIDE_LOADING, ACTIVE_SLIDE_PLAYING, CLASS_FLEX_CENTER, EVENT_ON_KEY_UP, MODULE_CONTROLLER, VK_ESCAPE, } from "../consts.js";
|
|
8
8
|
const cssContainerPrefix = makeComposePrefix("container");
|
|
9
9
|
export const ControllerContext = React.createContext(null);
|
|
10
10
|
export const useController = makeUseContext("useController", "ControllerContext", ControllerContext);
|
|
@@ -1,20 +1,28 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
-
import {
|
|
3
|
-
import { Description } from "./Description.js";
|
|
2
|
+
import { createModule, PLUGIN_CAPTIONS } from "../../core/index.js";
|
|
4
3
|
import { Title } from "./Title.js";
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
import { Description } from "./Description.js";
|
|
5
|
+
import { CaptionsButton } from "./CaptionsButton.js";
|
|
6
|
+
import { CaptionsContextProvider } from "./CaptionsContext.js";
|
|
7
|
+
import { resolveCaptionsProps } from "./props.js";
|
|
8
|
+
export function Captions({ augment, addModule }) {
|
|
9
|
+
augment(({ render: { slideFooter: renderFooter, ...restRender }, toolbar: { buttons, ...restToolbar }, captions: captionsProps, ...restProps }) => {
|
|
10
|
+
const captions = resolveCaptionsProps(captionsProps);
|
|
7
11
|
return {
|
|
8
12
|
render: {
|
|
9
13
|
slideFooter: ({ slide }) => (React.createElement(React.Fragment, null, renderFooter === null || renderFooter === void 0 ? void 0 :
|
|
10
14
|
renderFooter({ slide }),
|
|
11
|
-
slide.title && React.createElement(Title, {
|
|
12
|
-
slide.description && React.createElement(Description, {
|
|
15
|
+
slide.title && React.createElement(Title, { title: slide.title }),
|
|
16
|
+
slide.description && React.createElement(Description, { description: slide.description }))),
|
|
13
17
|
...restRender,
|
|
14
18
|
},
|
|
15
|
-
|
|
16
|
-
|
|
19
|
+
toolbar: {
|
|
20
|
+
buttons: [...(captions.showToggle ? [React.createElement(CaptionsButton, { key: PLUGIN_CAPTIONS })] : []), ...buttons],
|
|
21
|
+
...restToolbar,
|
|
22
|
+
},
|
|
23
|
+
captions,
|
|
17
24
|
...restProps,
|
|
18
25
|
};
|
|
19
26
|
});
|
|
27
|
+
addModule(createModule(PLUGIN_CAPTIONS, CaptionsContextProvider));
|
|
20
28
|
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { createIcon, createIconDisabled, IconButton, label, useLightboxProps } from "../../core/index.js";
|
|
3
|
+
import { useCaptions } from "./CaptionsContext.js";
|
|
4
|
+
const captionsIcon = () => (React.createElement(React.Fragment, null,
|
|
5
|
+
React.createElement("path", { strokeWidth: 2, stroke: "currentColor", strokeLinejoin: "round", fill: "none", d: "M3 5l18 0l0 14l-18 0l0-14z" }),
|
|
6
|
+
React.createElement("path", { d: "M7 15h3c.55 0 1-.45 1-1v-1H9.5v.5h-2v-3h2v.5H11v-1c0-.55-.45-1-1-1H7c-.55 0-1 .45-1 1v4c0 .55.45 1 1 1zm7 0h3c.55 0 1-.45 1-1v-1h-1.5v.5h-2v-3h2v.5H18v-1c0-.55-.45-1-1-1h-3c-.55 0-1 .45-1 1v4c0 .55.45 1 1 1z" })));
|
|
7
|
+
const CaptionsVisible = createIcon("CaptionsVisible", captionsIcon());
|
|
8
|
+
const CaptionsHidden = createIconDisabled("CaptionsVisible", captionsIcon());
|
|
9
|
+
export function CaptionsButton() {
|
|
10
|
+
const { visible, show, hide } = useCaptions();
|
|
11
|
+
const { render, labels } = useLightboxProps();
|
|
12
|
+
if (render.buttonCaptions) {
|
|
13
|
+
return React.createElement(React.Fragment, null, render.buttonCaptions({ visible, show, hide }));
|
|
14
|
+
}
|
|
15
|
+
return (React.createElement(IconButton, { label: label(labels, visible ? "Hide captions" : "Show captions"), icon: visible ? CaptionsVisible : CaptionsHidden, renderIcon: visible ? render.iconCaptionsVisible : render.iconCaptionsHidden, onClick: visible ? hide : show }));
|
|
16
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { CaptionsRef, ComponentProps } from "../../types.js";
|
|
3
|
+
export declare const CaptionsContext: React.Context<CaptionsRef | null>;
|
|
4
|
+
export declare const useCaptions: () => CaptionsRef;
|
|
5
|
+
export declare function CaptionsContextProvider({ captions, children }: ComponentProps): JSX.Element;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { makeUseContext } from "../../core/index.js";
|
|
3
|
+
import { resolveCaptionsProps } from "./props.js";
|
|
4
|
+
export const CaptionsContext = React.createContext(null);
|
|
5
|
+
export const useCaptions = makeUseContext("useCaptions", "CaptionsContext", CaptionsContext);
|
|
6
|
+
export function CaptionsContextProvider({ captions, children }) {
|
|
7
|
+
const { ref } = resolveCaptionsProps(captions);
|
|
8
|
+
const [visible, setVisible] = React.useState(true);
|
|
9
|
+
const context = React.useMemo(() => ({
|
|
10
|
+
visible,
|
|
11
|
+
show: () => setVisible(true),
|
|
12
|
+
hide: () => setVisible(false),
|
|
13
|
+
}), [visible]);
|
|
14
|
+
React.useImperativeHandle(ref, () => context, [context]);
|
|
15
|
+
return React.createElement(CaptionsContext.Provider, { value: context }, children);
|
|
16
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import {
|
|
3
|
-
export type DescriptionProps =
|
|
4
|
-
export declare function Description({ description
|
|
2
|
+
import { Slide } from "../../types.js";
|
|
3
|
+
export type DescriptionProps = Pick<Slide, "description">;
|
|
4
|
+
export declare function Description({ description }: DescriptionProps): JSX.Element | null;
|
|
@@ -1,10 +1,14 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import { clsx, cssVar, useLightboxProps } from "../../core/index.js";
|
|
3
|
-
import { defaultCaptionsProps, resolveCaptionsProps } from "./props.js";
|
|
4
3
|
import { cssPrefix } from "./utils.js";
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
4
|
+
import { defaultCaptionsProps, useCaptionsProps } from "./props.js";
|
|
5
|
+
import { useCaptions } from "./CaptionsContext.js";
|
|
6
|
+
export function Description({ description }) {
|
|
7
|
+
const { descriptionTextAlign, descriptionMaxLines } = useCaptionsProps();
|
|
8
|
+
const { styles } = useLightboxProps();
|
|
9
|
+
const { visible } = useCaptions();
|
|
10
|
+
if (!visible)
|
|
11
|
+
return null;
|
|
8
12
|
return (React.createElement("div", { style: styles.captionsDescriptionContainer, className: clsx(cssPrefix("captions_container"), cssPrefix("description_container")) },
|
|
9
13
|
React.createElement("div", { className: cssPrefix("description"), style: {
|
|
10
14
|
...(descriptionTextAlign !== defaultCaptionsProps.descriptionTextAlign ||
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import {
|
|
3
|
-
export type TitleProps = Pick<
|
|
4
|
-
export declare function Title({ title
|
|
2
|
+
import { Slide } from "../../types.js";
|
|
3
|
+
export type TitleProps = Pick<Slide, "title">;
|
|
4
|
+
export declare function Title({ title }: TitleProps): JSX.Element | null;
|
|
@@ -1,8 +1,16 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
-
import { clsx, cssVar, useController } from "../../core/index.js";
|
|
2
|
+
import { clsx, cssVar, useController, useLightboxProps } from "../../core/index.js";
|
|
3
3
|
import { cssPrefix } from "./utils.js";
|
|
4
|
-
|
|
4
|
+
import { useCaptions } from "./CaptionsContext.js";
|
|
5
|
+
export function Title({ title }) {
|
|
5
6
|
const { toolbarWidth } = useController();
|
|
7
|
+
const { styles } = useLightboxProps();
|
|
8
|
+
const { visible } = useCaptions();
|
|
9
|
+
if (!visible)
|
|
10
|
+
return null;
|
|
6
11
|
return (React.createElement("div", { style: styles.captionsTitleContainer, className: clsx(cssPrefix("captions_container"), cssPrefix("title_container")) },
|
|
7
|
-
React.createElement("div", {
|
|
12
|
+
React.createElement("div", { className: cssPrefix("title"), style: {
|
|
13
|
+
...(toolbarWidth ? { [cssVar("toolbar_width")]: `${toolbarWidth}px` } : null),
|
|
14
|
+
...styles.captionsTitle,
|
|
15
|
+
} }, title)));
|
|
8
16
|
}
|
|
@@ -11,6 +11,10 @@ declare module "../../types.js" {
|
|
|
11
11
|
interface LightboxProps {
|
|
12
12
|
/** Captions plugin settings */
|
|
13
13
|
captions?: {
|
|
14
|
+
/** Captions plugin ref */
|
|
15
|
+
ref?: React.ForwardedRef<CaptionsRef>;
|
|
16
|
+
/** if `true`, show Captions Toggle button in the toolbar */
|
|
17
|
+
showToggle?: boolean;
|
|
14
18
|
/** description text alignment */
|
|
15
19
|
descriptionTextAlign?: TextAlignment;
|
|
16
20
|
/** maximum number of lines to display in the description section */
|
|
@@ -27,5 +31,22 @@ declare module "../../types.js" {
|
|
|
27
31
|
/** captions description container customization slot */
|
|
28
32
|
captionsDescriptionContainer: "captionsDescriptionContainer";
|
|
29
33
|
}
|
|
34
|
+
interface Render {
|
|
35
|
+
/** render custom Captions Visible icon */
|
|
36
|
+
iconCaptionsVisible?: RenderFunction;
|
|
37
|
+
/** render custom Captions Hidden icon */
|
|
38
|
+
iconCaptionsHidden?: RenderFunction;
|
|
39
|
+
/** render custom Captions button */
|
|
40
|
+
buttonCaptions?: RenderFunction<CaptionsRef>;
|
|
41
|
+
}
|
|
42
|
+
/** Captions plugin ref */
|
|
43
|
+
interface CaptionsRef {
|
|
44
|
+
/** if `true`, captions are visible */
|
|
45
|
+
visible: boolean;
|
|
46
|
+
/** show captions */
|
|
47
|
+
show: Callback;
|
|
48
|
+
/** hide captions */
|
|
49
|
+
hide: Callback;
|
|
50
|
+
}
|
|
30
51
|
}
|
|
31
52
|
export default Captions;
|
|
@@ -1,9 +1,19 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
1
2
|
import { LightboxProps } from "../../types.js";
|
|
2
3
|
export declare const defaultCaptionsProps: {
|
|
3
4
|
descriptionTextAlign: "start";
|
|
4
5
|
descriptionMaxLines: number;
|
|
6
|
+
showToggle: boolean;
|
|
5
7
|
};
|
|
6
8
|
export declare const resolveCaptionsProps: (captions: LightboxProps["captions"]) => {
|
|
9
|
+
ref?: import("react").ForwardedRef<import("../../types.js").CaptionsRef> | undefined;
|
|
10
|
+
showToggle: boolean;
|
|
11
|
+
descriptionTextAlign: import("../../types.js").TextAlignment;
|
|
12
|
+
descriptionMaxLines: number;
|
|
13
|
+
};
|
|
14
|
+
export declare function useCaptionsProps(): {
|
|
15
|
+
ref?: import("react").ForwardedRef<import("../../types.js").CaptionsRef> | undefined;
|
|
16
|
+
showToggle: boolean;
|
|
7
17
|
descriptionTextAlign: import("../../types.js").TextAlignment;
|
|
8
18
|
descriptionMaxLines: number;
|
|
9
19
|
};
|
|
@@ -1,8 +1,14 @@
|
|
|
1
|
+
import { useLightboxProps } from "../../core/index.js";
|
|
1
2
|
export const defaultCaptionsProps = {
|
|
2
3
|
descriptionTextAlign: "start",
|
|
3
4
|
descriptionMaxLines: 3,
|
|
5
|
+
showToggle: false,
|
|
4
6
|
};
|
|
5
7
|
export const resolveCaptionsProps = (captions) => ({
|
|
6
8
|
...defaultCaptionsProps,
|
|
7
9
|
...captions,
|
|
8
10
|
});
|
|
11
|
+
export function useCaptionsProps() {
|
|
12
|
+
const { captions } = useLightboxProps();
|
|
13
|
+
return resolveCaptionsProps(captions);
|
|
14
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { ComponentProps, PluginProps } from "../../types.js";
|
|
3
|
+
export declare function CounterComponent({ counter: { className, ...rest } }: ComponentProps): JSX.Element | null;
|
|
4
|
+
/** Counter plugin */
|
|
5
|
+
export declare function Counter({ addChild }: PluginProps): void;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { clsx, createModule, cssClass, MODULE_CONTROLLER, PLUGIN_COUNTER, useLightboxState } from "../../core/index.js";
|
|
3
|
+
export function CounterComponent({ counter: { className, ...rest } = {} }) {
|
|
4
|
+
const { slides, currentIndex } = useLightboxState().state;
|
|
5
|
+
if (slides.length === 0)
|
|
6
|
+
return null;
|
|
7
|
+
return (React.createElement("div", { className: clsx(cssClass("counter"), className), ...rest },
|
|
8
|
+
currentIndex + 1,
|
|
9
|
+
" / ",
|
|
10
|
+
slides.length));
|
|
11
|
+
}
|
|
12
|
+
export function Counter({ addChild }) {
|
|
13
|
+
addChild(MODULE_CONTROLLER, createModule(PLUGIN_COUNTER, CounterComponent));
|
|
14
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
.yarl__counter {
|
|
2
|
+
position: var(--yarl__counter_position, absolute);
|
|
3
|
+
top: var(--yarl__counter_top, 0);
|
|
4
|
+
left: var(--yarl__counter_left, 0);
|
|
5
|
+
bottom: var(--yarl__counter_bottom, unset);
|
|
6
|
+
right: var(--yarl__counter_right, unset);
|
|
7
|
+
color: var(--yarl__counter_color, var(--yarl__color_button, rgba(255, 255, 255, 0.8)));
|
|
8
|
+
-webkit-filter: var(--yarl__counter_filter, drop-shadow(2px 2px 2px rgba(0, 0, 0, 0.8)));
|
|
9
|
+
filter: var(--yarl__counter_filter, drop-shadow(2px 2px 2px rgba(0, 0, 0, 0.8)));
|
|
10
|
+
margin: var(--yarl__counter_margin, var(--yarl__toolbar_padding, 8px));
|
|
11
|
+
padding: var(--yarl__counter_padding, var(--yarl__button_padding, 8px));
|
|
12
|
+
line-height: var(--yarl__counter_line_height, var(--yarl__icon_size, 32px));
|
|
13
|
+
-webkit-user-select: var(--yarl__counter_user_select, none);
|
|
14
|
+
-moz-user-select: var(--yarl__counter_user_select, none);
|
|
15
|
+
user-select: var(--yarl__counter_user_select, none);
|
|
16
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { Counter } from "./Counter.js";
|
|
3
|
+
declare module "../../types.js" {
|
|
4
|
+
interface LightboxProps {
|
|
5
|
+
/** HTML div element attributes to be passed to the Counter plugin container */
|
|
6
|
+
counter?: React.HTMLAttributes<HTMLDivElement>;
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
export default Counter;
|
|
@@ -12,5 +12,5 @@ export function FullscreenButton() {
|
|
|
12
12
|
if (render.buttonFullscreen) {
|
|
13
13
|
return React.createElement(React.Fragment, null, (_a = render.buttonFullscreen) === null || _a === void 0 ? void 0 : _a.call(render, { fullscreen, disabled, enter, exit }));
|
|
14
14
|
}
|
|
15
|
-
return (React.createElement(IconButton, { disabled: disabled, label:
|
|
15
|
+
return (React.createElement(IconButton, { disabled: disabled, label: label(labels, fullscreen ? "Exit Fullscreen" : "Enter Fullscreen"), icon: fullscreen ? ExitFullscreenIcon : EnterFullscreenIcon, renderIcon: fullscreen ? render.iconExitFullscreen : render.iconEnterFullscreen, onClick: fullscreen ? exit : enter }));
|
|
16
16
|
}
|
package/dist/plugins/index.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export { default as Captions } from "./captions/index.js";
|
|
2
|
+
export { default as Counter } from "./counter/index.js";
|
|
2
3
|
export { default as Fullscreen } from "./fullscreen/index.js";
|
|
3
4
|
export { default as Inline } from "./inline/index.js";
|
|
4
5
|
export { default as Slideshow } from "./slideshow/index.js";
|
package/dist/plugins/index.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export { default as Captions } from "./captions/index.js";
|
|
2
|
+
export { default as Counter } from "./counter/index.js";
|
|
2
3
|
export { default as Fullscreen } from "./fullscreen/index.js";
|
|
3
4
|
export { default as Inline } from "./inline/index.js";
|
|
4
5
|
export { default as Slideshow } from "./slideshow/index.js";
|
|
@@ -10,5 +10,5 @@ export function SlideshowButton() {
|
|
|
10
10
|
if (render.buttonSlideshow) {
|
|
11
11
|
return React.createElement(React.Fragment, null, render.buttonSlideshow({ playing, disabled, play, pause }));
|
|
12
12
|
}
|
|
13
|
-
return (React.createElement(IconButton, { label:
|
|
13
|
+
return (React.createElement(IconButton, { label: label(labels, playing ? "Pause" : "Play"), icon: playing ? PauseIcon : PlayIcon, renderIcon: playing ? render.iconSlideshowPause : render.iconSlideshowPlay, onClick: playing ? pause : play, disabled: disabled, ...focusListeners }));
|
|
14
14
|
}
|
|
@@ -1,12 +1,21 @@
|
|
|
1
|
+
import * as React from "react";
|
|
1
2
|
import { createModule, MODULE_CONTROLLER, PLUGIN_FULLSCREEN, PLUGIN_THUMBNAILS } from "../../core/index.js";
|
|
2
3
|
import { resolveThumbnailsProps } from "./props.js";
|
|
3
|
-
import {
|
|
4
|
+
import { ThumbnailsContextProvider } from "./ThumbnailsContext.js";
|
|
5
|
+
import { ThumbnailsButton } from "./ThumbnailsButton.js";
|
|
4
6
|
export function Thumbnails({ augment, contains, append, addParent }) {
|
|
5
|
-
augment(({ thumbnails, ...restProps }) =>
|
|
6
|
-
thumbnails
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
7
|
+
augment(({ thumbnails: thumbnailsProps, toolbar: { buttons, ...restToolbar }, ...restProps }) => {
|
|
8
|
+
const thumbnails = resolveThumbnailsProps(thumbnailsProps);
|
|
9
|
+
return {
|
|
10
|
+
toolbar: {
|
|
11
|
+
buttons: [...(thumbnails.showToggle ? [React.createElement(ThumbnailsButton, { key: PLUGIN_THUMBNAILS })] : []), ...buttons],
|
|
12
|
+
...restToolbar,
|
|
13
|
+
},
|
|
14
|
+
thumbnails,
|
|
15
|
+
...restProps,
|
|
16
|
+
};
|
|
17
|
+
});
|
|
18
|
+
const module = createModule(PLUGIN_THUMBNAILS, ThumbnailsContextProvider);
|
|
10
19
|
if (contains(PLUGIN_FULLSCREEN)) {
|
|
11
20
|
append(PLUGIN_FULLSCREEN, module);
|
|
12
21
|
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { createIcon, createIconDisabled, IconButton, label, useLightboxProps } from "../../core/index.js";
|
|
3
|
+
import { useThumbnails } from "./ThumbnailsContext.js";
|
|
4
|
+
const thumbnailsIcon = () => (React.createElement(React.Fragment, null,
|
|
5
|
+
React.createElement("path", { strokeWidth: 2, stroke: "currentColor", strokeLinejoin: "round", fill: "none", d: "M3 5l18 0l0 14l-18 0l0-14z" }),
|
|
6
|
+
React.createElement("path", { d: "M5 14h4v3h-4zM10 14h4v3h-4zM15 14h4v3h-4z" })));
|
|
7
|
+
const ThumbnailsVisible = createIcon("ThumbnailsVisible", thumbnailsIcon());
|
|
8
|
+
const ThumbnailsHidden = createIconDisabled("ThumbnailsHidden", thumbnailsIcon());
|
|
9
|
+
export function ThumbnailsButton() {
|
|
10
|
+
const { visible, show, hide } = useThumbnails();
|
|
11
|
+
const { render, labels } = useLightboxProps();
|
|
12
|
+
if (render.buttonThumbnails) {
|
|
13
|
+
return React.createElement(React.Fragment, null, render.buttonThumbnails({ visible, show, hide }));
|
|
14
|
+
}
|
|
15
|
+
return (React.createElement(IconButton, { label: label(labels, visible ? "Hide thumbnails" : "Show thumbnails"), icon: visible ? ThumbnailsVisible : ThumbnailsHidden, renderIcon: visible ? render.iconThumbnailsVisible : render.iconThumbnailsHidden, onClick: visible ? hide : show }));
|
|
16
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { ComponentProps, ThumbnailsRef } from "../../types.js";
|
|
3
|
+
export declare const ThumbnailsContext: React.Context<ThumbnailsRef | null>;
|
|
4
|
+
export declare const useThumbnails: () => ThumbnailsRef;
|
|
5
|
+
/** Thumbnails plugin component */
|
|
6
|
+
export declare function ThumbnailsContextProvider({ children, ...props }: ComponentProps): JSX.Element;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { clsx, cssClass, LightboxPropsProvider, makeUseContext } from "../../core/index.js";
|
|
3
|
+
import { cssPrefix } from "./utils.js";
|
|
4
|
+
import { ThumbnailsTrack } from "./ThumbnailsTrack.js";
|
|
5
|
+
import { resolveThumbnailsProps } from "./props.js";
|
|
6
|
+
export const ThumbnailsContext = React.createContext(null);
|
|
7
|
+
export const useThumbnails = makeUseContext("useThumbnails", "ThumbnailsContext", ThumbnailsContext);
|
|
8
|
+
export function ThumbnailsContextProvider({ children, ...props }) {
|
|
9
|
+
const [visible, setVisible] = React.useState(true);
|
|
10
|
+
const containerRef = React.useRef(null);
|
|
11
|
+
const { ref, position } = resolveThumbnailsProps(props.thumbnails);
|
|
12
|
+
const context = React.useMemo(() => ({
|
|
13
|
+
visible,
|
|
14
|
+
show: () => setVisible(true),
|
|
15
|
+
hide: () => setVisible(false),
|
|
16
|
+
}), [visible]);
|
|
17
|
+
React.useImperativeHandle(ref, () => context, [context]);
|
|
18
|
+
return (React.createElement(LightboxPropsProvider, { ...props },
|
|
19
|
+
React.createElement(ThumbnailsContext.Provider, { value: context },
|
|
20
|
+
React.createElement("div", { ref: containerRef, className: clsx(cssClass(cssPrefix()), cssClass(cssPrefix(`${position}`))) },
|
|
21
|
+
["start", "top"].includes(position) && React.createElement(ThumbnailsTrack, { containerRef: containerRef }),
|
|
22
|
+
React.createElement("div", { className: cssClass(cssPrefix("wrapper")) }, children),
|
|
23
|
+
["end", "bottom"].includes(position) && React.createElement(ThumbnailsTrack, { containerRef: containerRef })))));
|
|
24
|
+
}
|
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
-
import { DeepNonNullable, LightboxProps } from "../../types.js";
|
|
3
|
-
export type ThumbnailsInternal = DeepNonNullable<LightboxProps["thumbnails"]>;
|
|
4
2
|
export type ThumbnailsTrackProps = {
|
|
5
3
|
containerRef: React.RefObject<HTMLDivElement>;
|
|
6
4
|
};
|
|
@@ -3,6 +3,7 @@ import { ACTION_NEXT, ACTION_PREV, ACTION_SWIPE, CLASS_FLEX_CENTER, cleanup, cls
|
|
|
3
3
|
import { cssPrefix, cssThumbnailPrefix } from "./utils.js";
|
|
4
4
|
import { Thumbnail } from "./Thumbnail.js";
|
|
5
5
|
import { defaultThumbnailsProps, useThumbnailsProps } from "./props.js";
|
|
6
|
+
import { useThumbnails } from "./ThumbnailsContext.js";
|
|
6
7
|
function isHorizontal(position) {
|
|
7
8
|
return ["top", "bottom"].includes(position);
|
|
8
9
|
}
|
|
@@ -11,6 +12,7 @@ function boxSize(thumbnails, dimension, includeGap) {
|
|
|
11
12
|
}
|
|
12
13
|
export function ThumbnailsTrack({ containerRef }) {
|
|
13
14
|
const track = React.useRef(null);
|
|
15
|
+
const { visible } = useThumbnails();
|
|
14
16
|
const { carousel, styles } = useLightboxProps();
|
|
15
17
|
const { slides, globalIndex, animation } = useLightboxState().state;
|
|
16
18
|
const { publish, subscribe } = useEvents();
|
|
@@ -93,6 +95,7 @@ export function ThumbnailsTrack({ containerRef }) {
|
|
|
93
95
|
}
|
|
94
96
|
};
|
|
95
97
|
return (React.createElement("div", { className: clsx(cssClass(cssPrefix("container")), cssClass(CLASS_FLEX_CENTER)), style: {
|
|
98
|
+
...(!visible ? { display: "none" } : null),
|
|
96
99
|
...(width !== defaultThumbnailsProps.width
|
|
97
100
|
? { [cssVar(cssThumbnailPrefix("width"))]: `${boxSize(thumbnails, width)}px` }
|
|
98
101
|
: null),
|
|
@@ -1,9 +1,12 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
1
2
|
import { Thumbnails } from "./Thumbnails.js";
|
|
2
3
|
type Position = "top" | "bottom" | "start" | "end";
|
|
3
4
|
declare module "../../types.js" {
|
|
4
5
|
interface LightboxProps {
|
|
5
6
|
/** Thumbnails plugin settings */
|
|
6
7
|
thumbnails?: {
|
|
8
|
+
/** Thumbnails plugin ref */
|
|
9
|
+
ref?: React.ForwardedRef<ThumbnailsRef>;
|
|
7
10
|
/** thumbnails position */
|
|
8
11
|
position?: Position;
|
|
9
12
|
/** thumbnail width */
|
|
@@ -20,13 +23,21 @@ declare module "../../types.js" {
|
|
|
20
23
|
gap?: number;
|
|
21
24
|
/** `object-fit` setting */
|
|
22
25
|
imageFit?: ImageFit;
|
|
23
|
-
/** vignette effect on the edges of the thumbnails track */
|
|
26
|
+
/** if `true`, show the vignette effect on the edges of the thumbnails track */
|
|
24
27
|
vignette?: boolean;
|
|
28
|
+
/** if `true`, show the Toggle Thumbnails button in the toolbar */
|
|
29
|
+
showToggle?: boolean;
|
|
25
30
|
};
|
|
26
31
|
}
|
|
27
32
|
interface Render {
|
|
28
33
|
/** render custom thumbnail */
|
|
29
34
|
thumbnail?: RenderFunction<RenderThumbnailProps>;
|
|
35
|
+
/** render custom Thumbnails Visible icon */
|
|
36
|
+
iconThumbnailsVisible?: RenderFunction;
|
|
37
|
+
/** render custom Thumbnails Hidden icon */
|
|
38
|
+
iconThumbnailsHidden?: RenderFunction;
|
|
39
|
+
/** render custom Thumbnails button */
|
|
40
|
+
buttonThumbnails?: RenderFunction<ThumbnailsRef>;
|
|
30
41
|
}
|
|
31
42
|
/** `render.thumbnail` render function props */
|
|
32
43
|
type RenderThumbnailProps = {
|
|
@@ -43,5 +54,14 @@ declare module "../../types.js" {
|
|
|
43
54
|
/** thumbnails container customization slot */
|
|
44
55
|
thumbnailsContainer: "thumbnailsContainer";
|
|
45
56
|
}
|
|
57
|
+
/** Thumbnails plugin ref */
|
|
58
|
+
interface ThumbnailsRef {
|
|
59
|
+
/** if `true`, thumbnails are visible */
|
|
60
|
+
visible: boolean;
|
|
61
|
+
/** show thumbnails */
|
|
62
|
+
show: Callback;
|
|
63
|
+
/** hide thuumbnails */
|
|
64
|
+
hide: Callback;
|
|
65
|
+
}
|
|
46
66
|
}
|
|
47
67
|
export default Thumbnails;
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
1
2
|
import { LightboxProps } from "../../types.js";
|
|
2
3
|
export declare const defaultThumbnailsProps: {
|
|
4
|
+
ref: null;
|
|
3
5
|
position: "bottom";
|
|
4
6
|
width: number;
|
|
5
7
|
height: number;
|
|
@@ -11,6 +13,7 @@ export declare const defaultThumbnailsProps: {
|
|
|
11
13
|
vignette: boolean;
|
|
12
14
|
};
|
|
13
15
|
export declare const resolveThumbnailsProps: (thumbnails: LightboxProps["thumbnails"]) => {
|
|
16
|
+
ref: import("react").ForwardedRef<import("../../types.js").ThumbnailsRef>;
|
|
14
17
|
position: "end" | "start" | "bottom" | "top";
|
|
15
18
|
width: number;
|
|
16
19
|
height: number;
|
|
@@ -20,8 +23,10 @@ export declare const resolveThumbnailsProps: (thumbnails: LightboxProps["thumbna
|
|
|
20
23
|
gap: number;
|
|
21
24
|
imageFit: import("../../types.js").ImageFit;
|
|
22
25
|
vignette: boolean;
|
|
26
|
+
showToggle?: boolean | undefined;
|
|
23
27
|
};
|
|
24
28
|
export declare function useThumbnailsProps(): {
|
|
29
|
+
ref: import("react").ForwardedRef<import("../../types.js").ThumbnailsRef>;
|
|
25
30
|
position: "end" | "start" | "bottom" | "top";
|
|
26
31
|
width: number;
|
|
27
32
|
height: number;
|
|
@@ -31,4 +36,5 @@ export declare function useThumbnailsProps(): {
|
|
|
31
36
|
gap: number;
|
|
32
37
|
imageFit: import("../../types.js").ImageFit;
|
|
33
38
|
vignette: boolean;
|
|
39
|
+
showToggle?: boolean | undefined;
|
|
34
40
|
};
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { Video } from "./Video.js";
|
|
2
|
-
import { ACTIVE_SLIDE_COMPLETE, ACTIVE_SLIDE_ERROR, ACTIVE_SLIDE_LOADING, ACTIVE_SLIDE_PLAYING } from "../../core/consts.js";
|
|
3
2
|
declare module "../../types.js" {
|
|
4
3
|
interface SlideTypes {
|
|
5
4
|
/** video slide type */
|
|
@@ -46,12 +45,4 @@ declare module "../../types.js" {
|
|
|
46
45
|
video?: Pick<SlideVideo, "autoPlay" | "controls" | "controlsList" | "crossOrigin" | "preload" | "loop" | "muted" | "playsInline" | "disablePictureInPicture" | "disableRemotePlayback">;
|
|
47
46
|
}
|
|
48
47
|
}
|
|
49
|
-
declare module "../../core/index.js" {
|
|
50
|
-
interface EventTypes {
|
|
51
|
-
[ACTIVE_SLIDE_LOADING]: void;
|
|
52
|
-
[ACTIVE_SLIDE_PLAYING]: void;
|
|
53
|
-
[ACTIVE_SLIDE_COMPLETE]: void;
|
|
54
|
-
[ACTIVE_SLIDE_ERROR]: void;
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
48
|
export default Video;
|
|
@@ -19,7 +19,7 @@ export const ZoomButton = React.forwardRef(({ zoomIn, onLoseFocus }, ref) => {
|
|
|
19
19
|
wasEnabled.current = true;
|
|
20
20
|
}
|
|
21
21
|
}, [disabled, onLoseFocus]);
|
|
22
|
-
return (React.createElement(IconButton, { ref: ref, disabled: disabled, label: label(labels, zoomIn ? "Zoom in" : "Zoom out"), icon: zoomIn ? ZoomInIcon : ZoomOutIcon, renderIcon: zoomIn ? render.iconZoomIn : render.iconZoomOut, onClick:
|
|
22
|
+
return (React.createElement(IconButton, { ref: ref, disabled: disabled, label: label(labels, zoomIn ? "Zoom in" : "Zoom out"), icon: zoomIn ? ZoomInIcon : ZoomOutIcon, renderIcon: zoomIn ? render.iconZoomIn : render.iconZoomOut, onClick: zoomIn ? zoomInCallback : zoomOutCallback, onFocus: () => {
|
|
23
23
|
wasFocused.current = true;
|
|
24
24
|
}, onBlur: () => {
|
|
25
25
|
wasFocused.current = false;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "yet-another-react-lightbox",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.2.0",
|
|
4
4
|
"description": "Modern React lightbox component",
|
|
5
5
|
"author": "Igor Danchenko",
|
|
6
6
|
"license": "MIT",
|
|
@@ -25,6 +25,11 @@
|
|
|
25
25
|
"types": "./dist/plugins/captions/index.d.ts",
|
|
26
26
|
"default": "./dist/plugins/captions/index.js"
|
|
27
27
|
},
|
|
28
|
+
"./plugins/counter.css": "./dist/plugins/counter/counter.css",
|
|
29
|
+
"./plugins/counter": {
|
|
30
|
+
"types": "./dist/plugins/counter/index.d.ts",
|
|
31
|
+
"default": "./dist/plugins/counter/index.js"
|
|
32
|
+
},
|
|
28
33
|
"./plugins/fullscreen": {
|
|
29
34
|
"types": "./dist/plugins/fullscreen/index.d.ts",
|
|
30
35
|
"default": "./dist/plugins/fullscreen/index.js"
|
|
@@ -66,6 +71,9 @@
|
|
|
66
71
|
"plugins/captions": [
|
|
67
72
|
"dist/plugins/captions/index.d.ts"
|
|
68
73
|
],
|
|
74
|
+
"plugins/counter": [
|
|
75
|
+
"dist/plugins/counter/index.d.ts"
|
|
76
|
+
],
|
|
69
77
|
"plugins/fullscreen": [
|
|
70
78
|
"dist/plugins/fullscreen/index.d.ts"
|
|
71
79
|
],
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import * as React from "react";
|
|
2
|
-
import { clsx, cssClass, LightboxPropsProvider } from "../../core/index.js";
|
|
3
|
-
import { cssPrefix } from "./utils.js";
|
|
4
|
-
import { ThumbnailsTrack } from "./ThumbnailsTrack.js";
|
|
5
|
-
import { resolveThumbnailsProps } from "./props.js";
|
|
6
|
-
export function ThumbnailsContainer({ children, ...props }) {
|
|
7
|
-
const containerRef = React.useRef(null);
|
|
8
|
-
const { position } = resolveThumbnailsProps(props.thumbnails);
|
|
9
|
-
return (React.createElement(LightboxPropsProvider, { ...props },
|
|
10
|
-
React.createElement("div", { ref: containerRef, className: clsx(cssClass(cssPrefix()), cssClass(cssPrefix(`${position}`))) },
|
|
11
|
-
["start", "top"].includes(position) && React.createElement(ThumbnailsTrack, { containerRef: containerRef }),
|
|
12
|
-
React.createElement("div", { className: cssClass(cssPrefix("wrapper")) }, children),
|
|
13
|
-
["end", "bottom"].includes(position) && React.createElement(ThumbnailsTrack, { containerRef: containerRef }))));
|
|
14
|
-
}
|