yet-another-react-lightbox 3.5.4 → 3.7.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 +3 -3
- package/dist/index.d.ts +240 -4
- package/dist/index.js +1368 -4
- package/dist/plugins/captions/captions.css +1 -33
- package/dist/plugins/captions/captions.css.d.ts +2 -0
- package/dist/plugins/captions/index.d.ts +8 -4
- package/dist/plugins/captions/index.js +104 -3
- package/dist/plugins/counter/counter.css +1 -16
- package/dist/plugins/counter/counter.css.d.ts +2 -0
- package/dist/plugins/counter/index.d.ts +8 -3
- package/dist/plugins/counter/index.js +18 -2
- package/dist/plugins/download/index.d.ts +6 -3
- package/dist/plugins/download/index.js +90 -3
- package/dist/plugins/fullscreen/index.d.ts +8 -4
- package/dist/plugins/fullscreen/index.js +128 -3
- package/dist/plugins/index.d.ts +9 -9
- package/dist/plugins/index.js +9 -9
- package/dist/plugins/inline/index.d.ts +8 -3
- package/dist/plugins/inline/index.js +26 -2
- package/dist/plugins/slideshow/index.d.ts +8 -4
- package/dist/plugins/slideshow/index.js +113 -3
- package/dist/plugins/thumbnails/index.d.ts +7 -4
- package/dist/plugins/thumbnails/index.js +261 -3
- package/dist/plugins/thumbnails/thumbnails.css +1 -139
- package/dist/plugins/thumbnails/thumbnails.css.d.ts +2 -0
- package/dist/plugins/video/index.d.ts +7 -2
- package/dist/plugins/video/index.js +109 -2
- package/dist/plugins/zoom/index.d.ts +7 -4
- package/dist/plugins/zoom/index.js +500 -3
- package/dist/styles.css +1 -281
- package/dist/styles.css.d.ts +2 -0
- package/dist/types.d.ts +125 -47
- package/dist/types.js +51 -1
- package/package.json +34 -10
- package/dist/Lightbox.d.ts +0 -4
- package/dist/Lightbox.js +0 -46
- package/dist/core/components/IconButton.d.ts +0 -7
- package/dist/core/components/IconButton.js +0 -8
- package/dist/core/components/Icons.d.ts +0 -29
- package/dist/core/components/Icons.js +0 -27
- package/dist/core/components/ImageSlide.d.ts +0 -13
- package/dist/core/components/ImageSlide.js +0 -68
- package/dist/core/components/index.d.ts +0 -3
- package/dist/core/components/index.js +0 -3
- package/dist/core/config.d.ts +0 -7
- package/dist/core/config.js +0 -93
- package/dist/core/consts.d.ts +0 -50
- package/dist/core/consts.js +0 -49
- package/dist/core/contexts/Events.d.ts +0 -17
- package/dist/core/contexts/Events.js +0 -29
- package/dist/core/contexts/LightboxProps.d.ts +0 -6
- package/dist/core/contexts/LightboxProps.js +0 -7
- package/dist/core/contexts/LightboxState.d.ts +0 -27
- package/dist/core/contexts/LightboxState.js +0 -49
- package/dist/core/contexts/Timeouts.d.ts +0 -8
- package/dist/core/contexts/Timeouts.js +0 -32
- package/dist/core/contexts/index.d.ts +0 -4
- package/dist/core/contexts/index.js +0 -4
- package/dist/core/hooks/index.d.ts +0 -11
- package/dist/core/hooks/index.js +0 -11
- package/dist/core/hooks/useAnimation.d.ts +0 -15
- package/dist/core/hooks/useAnimation.js +0 -57
- package/dist/core/hooks/useContainerRect.d.ts +0 -7
- package/dist/core/hooks/useContainerRect.js +0 -36
- package/dist/core/hooks/useDelay.d.ts +0 -1
- package/dist/core/hooks/useDelay.js +0 -10
- package/dist/core/hooks/useEventCallback.d.ts +0 -1
- package/dist/core/hooks/useEventCallback.js +0 -9
- package/dist/core/hooks/useForkRef.d.ts +0 -3
- package/dist/core/hooks/useForkRef.js +0 -17
- package/dist/core/hooks/useLayoutEffect.d.ts +0 -2
- package/dist/core/hooks/useLayoutEffect.js +0 -3
- package/dist/core/hooks/useLoseFocus.d.ts +0 -4
- package/dist/core/hooks/useLoseFocus.js +0 -19
- package/dist/core/hooks/useMotionPreference.d.ts +0 -1
- package/dist/core/hooks/useMotionPreference.js +0 -13
- package/dist/core/hooks/useRTL.d.ts +0 -1
- package/dist/core/hooks/useRTL.js +0 -9
- package/dist/core/hooks/useSensors.d.ts +0 -14
- package/dist/core/hooks/useSensors.js +0 -38
- package/dist/core/hooks/useThrottle.d.ts +0 -1
- package/dist/core/hooks/useThrottle.js +0 -16
- package/dist/core/index.d.ts +0 -7
- package/dist/core/index.js +0 -7
- package/dist/core/modules/Carousel.d.ts +0 -4
- package/dist/core/modules/Carousel.js +0 -72
- package/dist/core/modules/Controller.d.ts +0 -31
- package/dist/core/modules/Controller.js +0 -215
- package/dist/core/modules/Navigation.d.ts +0 -13
- package/dist/core/modules/Navigation.js +0 -35
- package/dist/core/modules/NoScroll.d.ts +0 -4
- package/dist/core/modules/NoScroll.js +0 -52
- package/dist/core/modules/Portal.d.ts +0 -4
- package/dist/core/modules/Portal.js +0 -92
- package/dist/core/modules/Root.d.ts +0 -4
- package/dist/core/modules/Root.js +0 -7
- package/dist/core/modules/Toolbar.d.ts +0 -4
- package/dist/core/modules/Toolbar.js +0 -25
- package/dist/core/modules/controller/index.d.ts +0 -8
- package/dist/core/modules/controller/index.js +0 -9
- package/dist/core/modules/controller/usePointerSwipe.d.ts +0 -2
- package/dist/core/modules/controller/usePointerSwipe.js +0 -72
- package/dist/core/modules/controller/usePreventSwipeNavigation.d.ts +0 -3
- package/dist/core/modules/controller/usePreventSwipeNavigation.js +0 -20
- package/dist/core/modules/controller/useWheelSwipe.d.ts +0 -3
- package/dist/core/modules/controller/useWheelSwipe.js +0 -92
- package/dist/core/modules/index.d.ts +0 -7
- package/dist/core/modules/index.js +0 -7
- package/dist/core/utils.d.ts +0 -36
- package/dist/core/utils.js +0 -70
- package/dist/plugins/captions/Captions.d.ts +0 -3
- package/dist/plugins/captions/Captions.js +0 -25
- package/dist/plugins/captions/CaptionsButton.d.ts +0 -2
- package/dist/plugins/captions/CaptionsButton.js +0 -16
- package/dist/plugins/captions/CaptionsContext.d.ts +0 -5
- package/dist/plugins/captions/CaptionsContext.js +0 -16
- package/dist/plugins/captions/Description.d.ts +0 -4
- package/dist/plugins/captions/Description.js +0 -27
- package/dist/plugins/captions/Title.d.ts +0 -4
- package/dist/plugins/captions/Title.js +0 -16
- package/dist/plugins/captions/props.d.ts +0 -19
- package/dist/plugins/captions/props.js +0 -14
- package/dist/plugins/captions/utils.d.ts +0 -1
- package/dist/plugins/captions/utils.js +0 -2
- package/dist/plugins/counter/Counter.d.ts +0 -5
- package/dist/plugins/counter/Counter.js +0 -14
- package/dist/plugins/download/Download.d.ts +0 -2
- package/dist/plugins/download/Download.js +0 -9
- package/dist/plugins/download/DownloadButton.d.ts +0 -2
- package/dist/plugins/download/DownloadButton.js +0 -19
- package/dist/plugins/download/FileSaver.d.ts +0 -1
- package/dist/plugins/download/FileSaver.js +0 -60
- package/dist/plugins/fullscreen/Fullscreen.d.ts +0 -3
- package/dist/plugins/fullscreen/Fullscreen.js +0 -13
- package/dist/plugins/fullscreen/FullscreenButton.d.ts +0 -3
- package/dist/plugins/fullscreen/FullscreenButton.js +0 -16
- package/dist/plugins/fullscreen/FullscreenContext.d.ts +0 -5
- package/dist/plugins/fullscreen/FullscreenContext.js +0 -93
- package/dist/plugins/fullscreen/props.d.ts +0 -10
- package/dist/plugins/fullscreen/props.js +0 -8
- package/dist/plugins/inline/Inline.d.ts +0 -3
- package/dist/plugins/inline/Inline.js +0 -18
- package/dist/plugins/inline/InlineContainer.d.ts +0 -4
- package/dist/plugins/inline/InlineContainer.js +0 -5
- package/dist/plugins/slideshow/Slideshow.d.ts +0 -3
- package/dist/plugins/slideshow/Slideshow.js +0 -13
- package/dist/plugins/slideshow/SlideshowButton.d.ts +0 -2
- package/dist/plugins/slideshow/SlideshowButton.js +0 -14
- package/dist/plugins/slideshow/SlideshowContext.d.ts +0 -5
- package/dist/plugins/slideshow/SlideshowContext.js +0 -79
- package/dist/plugins/slideshow/props.d.ts +0 -12
- package/dist/plugins/slideshow/props.js +0 -9
- package/dist/plugins/thumbnails/Thumbnail.d.ts +0 -15
- package/dist/plugins/thumbnails/Thumbnail.js +0 -51
- package/dist/plugins/thumbnails/Thumbnails.d.ts +0 -3
- package/dist/plugins/thumbnails/Thumbnails.js +0 -22
- package/dist/plugins/thumbnails/ThumbnailsButton.d.ts +0 -2
- package/dist/plugins/thumbnails/ThumbnailsButton.js +0 -16
- package/dist/plugins/thumbnails/ThumbnailsContext.d.ts +0 -6
- package/dist/plugins/thumbnails/ThumbnailsContext.js +0 -24
- package/dist/plugins/thumbnails/ThumbnailsTrack.d.ts +0 -5
- package/dist/plugins/thumbnails/ThumbnailsTrack.js +0 -141
- package/dist/plugins/thumbnails/props.d.ts +0 -40
- package/dist/plugins/thumbnails/props.js +0 -21
- package/dist/plugins/thumbnails/utils.d.ts +0 -2
- package/dist/plugins/thumbnails/utils.js +0 -4
- package/dist/plugins/video/Video.d.ts +0 -3
- package/dist/plugins/video/Video.js +0 -21
- package/dist/plugins/video/VideoSlide.d.ts +0 -8
- package/dist/plugins/video/VideoSlide.js +0 -74
- package/dist/plugins/video/props.d.ts +0 -29
- package/dist/plugins/video/props.js +0 -13
- package/dist/plugins/zoom/ResponsiveImage.d.ts +0 -11
- package/dist/plugins/zoom/ResponsiveImage.js +0 -58
- package/dist/plugins/zoom/Zoom.d.ts +0 -3
- package/dist/plugins/zoom/Zoom.js +0 -18
- package/dist/plugins/zoom/ZoomButton.d.ts +0 -8
- package/dist/plugins/zoom/ZoomButton.js +0 -27
- package/dist/plugins/zoom/ZoomButtonsGroup.d.ts +0 -2
- package/dist/plugins/zoom/ZoomButtonsGroup.js +0 -22
- package/dist/plugins/zoom/ZoomController.d.ts +0 -12
- package/dist/plugins/zoom/ZoomController.js +0 -17
- package/dist/plugins/zoom/ZoomToolbarControl.d.ts +0 -2
- package/dist/plugins/zoom/ZoomToolbarControl.js +0 -12
- package/dist/plugins/zoom/ZoomWrapper.d.ts +0 -5
- package/dist/plugins/zoom/ZoomWrapper.js +0 -36
- package/dist/plugins/zoom/hooks/index.d.ts +0 -6
- package/dist/plugins/zoom/hooks/index.js +0 -6
- package/dist/plugins/zoom/hooks/useZoomAnimation.d.ts +0 -2
- package/dist/plugins/zoom/hooks/useZoomAnimation.js +0 -39
- package/dist/plugins/zoom/hooks/useZoomCallback.d.ts +0 -1
- package/dist/plugins/zoom/hooks/useZoomCallback.js +0 -12
- package/dist/plugins/zoom/hooks/useZoomImageRect.d.ts +0 -5
- package/dist/plugins/zoom/hooks/useZoomImageRect.js +0 -41
- package/dist/plugins/zoom/hooks/useZoomProps.d.ts +0 -13
- package/dist/plugins/zoom/hooks/useZoomProps.js +0 -6
- package/dist/plugins/zoom/hooks/useZoomSensors.d.ts +0 -3
- package/dist/plugins/zoom/hooks/useZoomSensors.js +0 -154
- package/dist/plugins/zoom/hooks/useZoomState.d.ts +0 -12
- package/dist/plugins/zoom/hooks/useZoomState.js +0 -63
- package/dist/plugins/zoom/props.d.ts +0 -25
- package/dist/plugins/zoom/props.js +0 -15
- package/dist/props.d.ts +0 -2
- package/dist/props.js +0 -38
|
@@ -1,33 +1 @@
|
|
|
1
|
-
.yarl__slide_captions_container {
|
|
2
|
-
position: absolute;
|
|
3
|
-
left: var(--yarl__slide_captions_container_left, 0);
|
|
4
|
-
right: var(--yarl__slide_captions_container_right, 0);
|
|
5
|
-
padding: var(--yarl__slide_captions_container_padding, 16px);
|
|
6
|
-
background: var(--yarl__slide_captions_container_background, rgba(0, 0, 0, 0.5));
|
|
7
|
-
-webkit-transform: translateZ(0);
|
|
8
|
-
}
|
|
9
|
-
.yarl__slide_title {
|
|
10
|
-
color: var(--yarl__slide_title_color, #fff);
|
|
11
|
-
font-size: var(--yarl__slide_title_font_size, 125%);
|
|
12
|
-
font-weight: var(--yarl__slide_title_font_weight, bolder);
|
|
13
|
-
max-width: calc(100% - var(--yarl__toolbar_width, 0px));
|
|
14
|
-
overflow: hidden;
|
|
15
|
-
text-overflow: ellipsis;
|
|
16
|
-
white-space: nowrap;
|
|
17
|
-
}
|
|
18
|
-
.yarl__slide_title_container {
|
|
19
|
-
top: var(--yarl__slide_title_container_top, 0);
|
|
20
|
-
}
|
|
21
|
-
.yarl__slide_description {
|
|
22
|
-
overflow: hidden;
|
|
23
|
-
-webkit-hyphens: auto;
|
|
24
|
-
hyphens: auto;
|
|
25
|
-
display: -webkit-box;
|
|
26
|
-
-webkit-box-orient: vertical;
|
|
27
|
-
-webkit-line-clamp: var(--yarl__slide_description_max_lines, 3);
|
|
28
|
-
text-align: var(--yarl__slide_description_text_align, start);
|
|
29
|
-
color: var(--yarl__slide_description_color, #fff);
|
|
30
|
-
}
|
|
31
|
-
.yarl__slide_description_container {
|
|
32
|
-
bottom: var(--yarl__slide_description_container_bottom, 0);
|
|
33
|
-
}
|
|
1
|
+
.yarl__slide_captions_container{background:var(--yarl__slide_captions_container_background,rgba(0,0,0,.5));left:var(--yarl__slide_captions_container_left,0);padding:var(--yarl__slide_captions_container_padding,16px);position:absolute;right:var(--yarl__slide_captions_container_right,0);-webkit-transform:translateZ(0)}.yarl__slide_title{color:var(--yarl__slide_title_color,#fff);font-size:var(--yarl__slide_title_font_size,125%);font-weight:var(--yarl__slide_title_font_weight,bolder);max-width:calc(100% - var(--yarl__toolbar_width, 0px));overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.yarl__slide_title_container{top:var(--yarl__slide_title_container_top,0)}.yarl__slide_description{-webkit-box-orient:vertical;-webkit-line-clamp:var(--yarl__slide_description_max_lines,3);color:var(--yarl__slide_description_color,#fff);display:-webkit-box;-webkit-hyphens:auto;hyphens:auto;overflow:hidden;text-align:var(--yarl__slide_description_text_align,start)}.yarl__slide_description_container{bottom:var(--yarl__slide_description_container_bottom,0)}
|
|
@@ -1,6 +1,9 @@
|
|
|
1
|
-
import * as React from
|
|
2
|
-
import { PLUGIN_CAPTIONS } from
|
|
3
|
-
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { PluginProps, PLUGIN_CAPTIONS } from '../../types.js';
|
|
3
|
+
|
|
4
|
+
/** Captions plugin */
|
|
5
|
+
declare function Captions({ augment, addModule }: PluginProps): void;
|
|
6
|
+
|
|
4
7
|
declare module "../../types.js" {
|
|
5
8
|
type TextAlignment = "start" | "end" | "center";
|
|
6
9
|
interface GenericSlide {
|
|
@@ -53,4 +56,5 @@ declare module "../../types.js" {
|
|
|
53
56
|
hide: Callback;
|
|
54
57
|
}
|
|
55
58
|
}
|
|
56
|
-
|
|
59
|
+
|
|
60
|
+
export { Captions as default };
|
|
@@ -1,3 +1,104 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
|
|
1
|
+
import { cssClass, useLightboxProps, makeUseContext, useController, clsx, cssVar, createIcon, createIconDisabled, IconButton, addToolbarButton, createModule } from '../../index.js';
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import { PLUGIN_CAPTIONS } from '../../types.js';
|
|
4
|
+
|
|
5
|
+
const cssPrefix = (className) => cssClass(`slide_${className}`);
|
|
6
|
+
|
|
7
|
+
const defaultCaptionsProps = {
|
|
8
|
+
descriptionTextAlign: "start",
|
|
9
|
+
descriptionMaxLines: 3,
|
|
10
|
+
showToggle: false,
|
|
11
|
+
};
|
|
12
|
+
const resolveCaptionsProps = (captions) => ({
|
|
13
|
+
...defaultCaptionsProps,
|
|
14
|
+
...captions,
|
|
15
|
+
});
|
|
16
|
+
function useCaptionsProps() {
|
|
17
|
+
const { captions } = useLightboxProps();
|
|
18
|
+
return resolveCaptionsProps(captions);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
const CaptionsContext = React.createContext(null);
|
|
22
|
+
const useCaptions = makeUseContext("useCaptions", "CaptionsContext", CaptionsContext);
|
|
23
|
+
function CaptionsContextProvider({ captions, children }) {
|
|
24
|
+
const { ref } = resolveCaptionsProps(captions);
|
|
25
|
+
const [visible, setVisible] = React.useState(true);
|
|
26
|
+
const context = React.useMemo(() => ({
|
|
27
|
+
visible,
|
|
28
|
+
show: () => setVisible(true),
|
|
29
|
+
hide: () => setVisible(false),
|
|
30
|
+
}), [visible]);
|
|
31
|
+
React.useImperativeHandle(ref, () => context, [context]);
|
|
32
|
+
return React.createElement(CaptionsContext.Provider, { value: context }, children);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
function Title({ title }) {
|
|
36
|
+
const { toolbarWidth } = useController();
|
|
37
|
+
const { styles } = useLightboxProps();
|
|
38
|
+
const { visible } = useCaptions();
|
|
39
|
+
if (!visible)
|
|
40
|
+
return null;
|
|
41
|
+
return (React.createElement("div", { style: styles.captionsTitleContainer, className: clsx(cssPrefix("captions_container"), cssPrefix("title_container")) },
|
|
42
|
+
React.createElement("div", { className: cssPrefix("title"), style: {
|
|
43
|
+
...(toolbarWidth ? { [cssVar("toolbar_width")]: `${toolbarWidth}px` } : null),
|
|
44
|
+
...styles.captionsTitle,
|
|
45
|
+
} }, title)));
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
function Description({ description }) {
|
|
49
|
+
const { descriptionTextAlign, descriptionMaxLines } = useCaptionsProps();
|
|
50
|
+
const { styles } = useLightboxProps();
|
|
51
|
+
const { visible } = useCaptions();
|
|
52
|
+
if (!visible)
|
|
53
|
+
return null;
|
|
54
|
+
return (React.createElement("div", { style: styles.captionsDescriptionContainer, className: clsx(cssPrefix("captions_container"), cssPrefix("description_container")) },
|
|
55
|
+
React.createElement("div", { className: cssPrefix("description"), style: {
|
|
56
|
+
...(descriptionTextAlign !== defaultCaptionsProps.descriptionTextAlign ||
|
|
57
|
+
descriptionMaxLines !== defaultCaptionsProps.descriptionMaxLines
|
|
58
|
+
? {
|
|
59
|
+
[cssVar("slide_description_text_align")]: descriptionTextAlign,
|
|
60
|
+
[cssVar("slide_description_max_lines")]: descriptionMaxLines,
|
|
61
|
+
}
|
|
62
|
+
: null),
|
|
63
|
+
...styles.captionsDescription,
|
|
64
|
+
} }, typeof description === "string"
|
|
65
|
+
? description
|
|
66
|
+
.split("\n")
|
|
67
|
+
.flatMap((line, index) => [...(index > 0 ? [React.createElement("br", { key: index })] : []), line])
|
|
68
|
+
: description)));
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
const captionsIcon = () => (React.createElement(React.Fragment, null,
|
|
72
|
+
React.createElement("path", { strokeWidth: 2, stroke: "currentColor", strokeLinejoin: "round", fill: "none", d: "M3 5l18 0l0 14l-18 0l0-14z" }),
|
|
73
|
+
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" })));
|
|
74
|
+
const CaptionsVisible = createIcon("CaptionsVisible", captionsIcon());
|
|
75
|
+
const CaptionsHidden = createIconDisabled("CaptionsVisible", captionsIcon());
|
|
76
|
+
function CaptionsButton() {
|
|
77
|
+
const { visible, show, hide } = useCaptions();
|
|
78
|
+
const { render } = useLightboxProps();
|
|
79
|
+
if (render.buttonCaptions) {
|
|
80
|
+
return React.createElement(React.Fragment, null, render.buttonCaptions({ visible, show, hide }));
|
|
81
|
+
}
|
|
82
|
+
return (React.createElement(IconButton, { label: visible ? "Hide captions" : "Show captions", icon: visible ? CaptionsVisible : CaptionsHidden, renderIcon: visible ? render.iconCaptionsVisible : render.iconCaptionsHidden, onClick: visible ? hide : show }));
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
function Captions({ augment, addModule }) {
|
|
86
|
+
augment(({ captions: captionsProps, render: { slideFooter: renderFooter, ...restRender }, toolbar, ...restProps }) => {
|
|
87
|
+
const captions = resolveCaptionsProps(captionsProps);
|
|
88
|
+
return {
|
|
89
|
+
render: {
|
|
90
|
+
slideFooter: ({ slide }) => (React.createElement(React.Fragment, null, renderFooter === null || renderFooter === void 0 ? void 0 :
|
|
91
|
+
renderFooter({ slide }),
|
|
92
|
+
slide.title && React.createElement(Title, { title: slide.title }),
|
|
93
|
+
slide.description && React.createElement(Description, { description: slide.description }))),
|
|
94
|
+
...restRender,
|
|
95
|
+
},
|
|
96
|
+
toolbar: addToolbarButton(toolbar, PLUGIN_CAPTIONS, captions.showToggle ? React.createElement(CaptionsButton, null) : null),
|
|
97
|
+
captions,
|
|
98
|
+
...restProps,
|
|
99
|
+
};
|
|
100
|
+
});
|
|
101
|
+
addModule(createModule(PLUGIN_CAPTIONS, CaptionsContextProvider));
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
export { Captions as default };
|
|
@@ -1,16 +1 @@
|
|
|
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
|
-
}
|
|
1
|
+
.yarl__counter{bottom:var(--yarl__counter_bottom,unset);color:var(--yarl__counter_color,var(--yarl__color_button,hsla(0,0%,100%,.8)));-webkit-filter:var(--yarl__counter_filter,drop-shadow(2px 2px 2px rgba(0,0,0,.8)));filter:var(--yarl__counter_filter,drop-shadow(2px 2px 2px rgba(0,0,0,.8)));left:var(--yarl__counter_left,0);line-height:var(--yarl__counter_line_height,var(--yarl__icon_size,32px));margin:var(--yarl__counter_margin,var(--yarl__toolbar_padding,8px));padding:var(--yarl__counter_padding,var(--yarl__button_padding,8px));position:var(--yarl__counter_position,absolute);right:var(--yarl__counter_right,unset);top:var(--yarl__counter_top,0);-webkit-user-select:var(--yarl__counter_user_select,none);-moz-user-select:var(--yarl__counter_user_select,none);user-select:var(--yarl__counter_user_select,none)}
|
|
@@ -1,9 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { PluginProps } from '../../types.js';
|
|
3
|
+
|
|
4
|
+
/** Counter plugin */
|
|
5
|
+
declare function Counter({ addChild }: PluginProps): void;
|
|
6
|
+
|
|
3
7
|
declare module "../../types.js" {
|
|
4
8
|
interface LightboxProps {
|
|
5
9
|
/** HTML div element attributes to be passed to the Counter plugin container */
|
|
6
10
|
counter?: React.HTMLAttributes<HTMLDivElement>;
|
|
7
11
|
}
|
|
8
12
|
}
|
|
9
|
-
|
|
13
|
+
|
|
14
|
+
export { Counter as default };
|
|
@@ -1,2 +1,18 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { useLightboxState, clsx, cssClass, createModule } from '../../index.js';
|
|
3
|
+
import { MODULE_CONTROLLER, PLUGIN_COUNTER } from '../../types.js';
|
|
4
|
+
|
|
5
|
+
function CounterComponent({ counter: { className, ...rest } = {} }) {
|
|
6
|
+
const { slides, currentIndex } = useLightboxState();
|
|
7
|
+
if (slides.length === 0)
|
|
8
|
+
return null;
|
|
9
|
+
return (React.createElement("div", { className: clsx(cssClass("counter"), className), ...rest },
|
|
10
|
+
currentIndex + 1,
|
|
11
|
+
" / ",
|
|
12
|
+
slides.length));
|
|
13
|
+
}
|
|
14
|
+
function Counter({ addChild }) {
|
|
15
|
+
addChild(MODULE_CONTROLLER, createModule(PLUGIN_COUNTER, CounterComponent));
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export { Counter as default };
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
import { PLUGIN_DOWNLOAD } from
|
|
2
|
-
|
|
1
|
+
import { PluginProps, PLUGIN_DOWNLOAD } from '../../types.js';
|
|
2
|
+
|
|
3
|
+
declare function Download({ augment }: PluginProps): void;
|
|
4
|
+
|
|
3
5
|
declare module "../../types.js" {
|
|
4
6
|
interface GenericSlide {
|
|
5
7
|
/** download url */
|
|
@@ -24,4 +26,5 @@ declare module "../../types.js" {
|
|
|
24
26
|
[PLUGIN_DOWNLOAD]: null;
|
|
25
27
|
}
|
|
26
28
|
}
|
|
27
|
-
|
|
29
|
+
|
|
30
|
+
export { Download as default };
|
|
@@ -1,3 +1,90 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
|
|
1
|
+
import { createIcon, useLightboxProps, useLightboxState, isImageSlide, IconButton, addToolbarButton } from '../../index.js';
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import { PLUGIN_DOWNLOAD } from '../../types.js';
|
|
4
|
+
|
|
5
|
+
function download(url, name) {
|
|
6
|
+
const xhr = new XMLHttpRequest();
|
|
7
|
+
xhr.open("GET", url);
|
|
8
|
+
xhr.responseType = "blob";
|
|
9
|
+
xhr.onload = () => {
|
|
10
|
+
saveAs(xhr.response, name);
|
|
11
|
+
};
|
|
12
|
+
xhr.onerror = () => {
|
|
13
|
+
console.error("Failed to download file");
|
|
14
|
+
};
|
|
15
|
+
xhr.send();
|
|
16
|
+
}
|
|
17
|
+
function corsEnabled(url) {
|
|
18
|
+
const xhr = new XMLHttpRequest();
|
|
19
|
+
xhr.open("HEAD", url, false);
|
|
20
|
+
try {
|
|
21
|
+
xhr.send();
|
|
22
|
+
}
|
|
23
|
+
catch (e) {
|
|
24
|
+
}
|
|
25
|
+
return xhr.status >= 200 && xhr.status <= 299;
|
|
26
|
+
}
|
|
27
|
+
function click(link) {
|
|
28
|
+
try {
|
|
29
|
+
link.dispatchEvent(new MouseEvent("click"));
|
|
30
|
+
}
|
|
31
|
+
catch (e) {
|
|
32
|
+
const event = document.createEvent("MouseEvents");
|
|
33
|
+
event.initMouseEvent("click", true, true, window, 0, 0, 0, 80, 20, false, false, false, false, 0, null);
|
|
34
|
+
link.dispatchEvent(event);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
function saveAs(source, name) {
|
|
38
|
+
const link = document.createElement("a");
|
|
39
|
+
link.rel = "noopener";
|
|
40
|
+
link.download = name || "";
|
|
41
|
+
if (!link.download) {
|
|
42
|
+
link.target = "_blank";
|
|
43
|
+
}
|
|
44
|
+
if (typeof source === "string") {
|
|
45
|
+
link.href = source;
|
|
46
|
+
if (link.origin !== window.location.origin) {
|
|
47
|
+
if (corsEnabled(link.href)) {
|
|
48
|
+
download(source, name);
|
|
49
|
+
}
|
|
50
|
+
else {
|
|
51
|
+
link.target = "_blank";
|
|
52
|
+
click(link);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
else {
|
|
56
|
+
click(link);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
else {
|
|
60
|
+
link.href = URL.createObjectURL(source);
|
|
61
|
+
setTimeout(() => URL.revokeObjectURL(link.href), 30000);
|
|
62
|
+
setTimeout(() => click(link), 0);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
const DownloadIcon = createIcon("DownloadIcon", React.createElement("path", { d: "M18 15v3H6v-3H4v3c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2v-3h-2zm-1-4-1.41-1.41L13 12.17V4h-2v8.17L8.41 9.59 7 11l5 5 5-5z" }));
|
|
67
|
+
function DownloadButton() {
|
|
68
|
+
const { render, on } = useLightboxProps();
|
|
69
|
+
const { currentSlide, currentIndex } = useLightboxState();
|
|
70
|
+
if (render.buttonDownload) {
|
|
71
|
+
return React.createElement(React.Fragment, null, render.buttonDownload());
|
|
72
|
+
}
|
|
73
|
+
const downloadUrl = (currentSlide === null || currentSlide === void 0 ? void 0 : currentSlide.downloadUrl) || (currentSlide && isImageSlide(currentSlide) ? currentSlide.src : undefined);
|
|
74
|
+
return (React.createElement(IconButton, { label: "Download", icon: DownloadIcon, renderIcon: render.iconDownload, disabled: !downloadUrl, onClick: () => {
|
|
75
|
+
var _a;
|
|
76
|
+
if (downloadUrl) {
|
|
77
|
+
saveAs(downloadUrl, currentSlide === null || currentSlide === void 0 ? void 0 : currentSlide.downloadFilename);
|
|
78
|
+
(_a = on.download) === null || _a === void 0 ? void 0 : _a.call(on, { index: currentIndex });
|
|
79
|
+
}
|
|
80
|
+
} }));
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
function Download({ augment }) {
|
|
84
|
+
augment(({ toolbar, ...restProps }) => ({
|
|
85
|
+
toolbar: addToolbarButton(toolbar, PLUGIN_DOWNLOAD, React.createElement(DownloadButton, null)),
|
|
86
|
+
...restProps,
|
|
87
|
+
}));
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
export { Download as default };
|
|
@@ -1,6 +1,9 @@
|
|
|
1
|
-
import * as React from
|
|
2
|
-
import { PLUGIN_FULLSCREEN } from
|
|
3
|
-
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { PluginProps, PLUGIN_FULLSCREEN } from '../../types.js';
|
|
3
|
+
|
|
4
|
+
/** Fullscreen plugin */
|
|
5
|
+
declare function Fullscreen({ augment, contains, addParent }: PluginProps): void;
|
|
6
|
+
|
|
4
7
|
declare module "../../types.js" {
|
|
5
8
|
interface LightboxProps {
|
|
6
9
|
/** Fullscreen plugin settings */
|
|
@@ -52,4 +55,5 @@ declare global {
|
|
|
52
55
|
msRequestFullscreen?: () => void;
|
|
53
56
|
}
|
|
54
57
|
}
|
|
55
|
-
|
|
58
|
+
|
|
59
|
+
export { Fullscreen as default };
|
|
@@ -1,3 +1,128 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
|
|
1
|
+
import { makeUseContext, useLayoutEffect, useEventCallback, clsx, cssClass, createIcon, useLightboxProps, IconButton, addToolbarButton, createModule } from '../../index.js';
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import { PLUGIN_FULLSCREEN, CLASS_FULLSIZE, PLUGIN_THUMBNAILS, MODULE_CONTROLLER } from '../../types.js';
|
|
4
|
+
|
|
5
|
+
const defaultFullscreenProps = {
|
|
6
|
+
auto: false,
|
|
7
|
+
ref: null,
|
|
8
|
+
};
|
|
9
|
+
const resolveFullscreenProps = (fullscreen) => ({
|
|
10
|
+
...defaultFullscreenProps,
|
|
11
|
+
...fullscreen,
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
const FullscreenContext = React.createContext(null);
|
|
15
|
+
const useFullscreen = makeUseContext("useFullscreen", "FullscreenContext", FullscreenContext);
|
|
16
|
+
function FullscreenContextProvider({ fullscreen: fullscreenProps, children }) {
|
|
17
|
+
const { auto, ref } = resolveFullscreenProps(fullscreenProps);
|
|
18
|
+
const containerRef = React.useRef(null);
|
|
19
|
+
const [fullscreen, setFullscreen] = React.useState(false);
|
|
20
|
+
const [disabled, setDisabled] = React.useState();
|
|
21
|
+
useLayoutEffect(() => {
|
|
22
|
+
var _a, _b, _c, _d;
|
|
23
|
+
setDisabled(!((_d = (_c = (_b = (_a = document.fullscreenEnabled) !== null && _a !== void 0 ? _a : document.webkitFullscreenEnabled) !== null && _b !== void 0 ? _b : document.mozFullScreenEnabled) !== null && _c !== void 0 ? _c : document.msFullscreenEnabled) !== null && _d !== void 0 ? _d : false));
|
|
24
|
+
}, []);
|
|
25
|
+
const getFullscreenElement = React.useCallback(() => {
|
|
26
|
+
var _a, _b, _c;
|
|
27
|
+
return (_c = (_b = (_a = document.fullscreenElement) !== null && _a !== void 0 ? _a : document.webkitFullscreenElement) !== null && _b !== void 0 ? _b : document.mozFullScreenElement) !== null && _c !== void 0 ? _c : document.msFullscreenElement;
|
|
28
|
+
}, []);
|
|
29
|
+
const enter = React.useCallback(() => {
|
|
30
|
+
const container = containerRef.current;
|
|
31
|
+
if (container) {
|
|
32
|
+
try {
|
|
33
|
+
if (container.requestFullscreen) {
|
|
34
|
+
container.requestFullscreen().catch(() => { });
|
|
35
|
+
}
|
|
36
|
+
else if (container.webkitRequestFullscreen) {
|
|
37
|
+
container.webkitRequestFullscreen();
|
|
38
|
+
}
|
|
39
|
+
else if (container.mozRequestFullScreen) {
|
|
40
|
+
container.mozRequestFullScreen();
|
|
41
|
+
}
|
|
42
|
+
else if (container.msRequestFullscreen) {
|
|
43
|
+
container.msRequestFullscreen();
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
catch (err) {
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}, []);
|
|
50
|
+
const exit = React.useCallback(() => {
|
|
51
|
+
if (getFullscreenElement()) {
|
|
52
|
+
try {
|
|
53
|
+
if (document.exitFullscreen) {
|
|
54
|
+
document.exitFullscreen().catch(() => { });
|
|
55
|
+
}
|
|
56
|
+
else if (document.webkitExitFullscreen) {
|
|
57
|
+
document.webkitExitFullscreen();
|
|
58
|
+
}
|
|
59
|
+
else if (document.mozCancelFullScreen) {
|
|
60
|
+
document.mozCancelFullScreen();
|
|
61
|
+
}
|
|
62
|
+
else if (document.msExitFullscreen) {
|
|
63
|
+
document.msExitFullscreen();
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
catch (err) {
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
}, [getFullscreenElement]);
|
|
70
|
+
const fullscreenChangeListener = React.useCallback(() => {
|
|
71
|
+
if (getFullscreenElement() === containerRef.current) {
|
|
72
|
+
setFullscreen(true);
|
|
73
|
+
}
|
|
74
|
+
else {
|
|
75
|
+
setFullscreen(false);
|
|
76
|
+
}
|
|
77
|
+
}, [getFullscreenElement]);
|
|
78
|
+
React.useEffect(() => {
|
|
79
|
+
const events = ["fullscreenchange", "webkitfullscreenchange", "mozfullscreenchange", "MSFullscreenChange"];
|
|
80
|
+
events.forEach((event) => {
|
|
81
|
+
document.addEventListener(event, fullscreenChangeListener);
|
|
82
|
+
});
|
|
83
|
+
return () => {
|
|
84
|
+
events.forEach((event) => {
|
|
85
|
+
document.removeEventListener(event, fullscreenChangeListener);
|
|
86
|
+
});
|
|
87
|
+
};
|
|
88
|
+
}, [fullscreenChangeListener]);
|
|
89
|
+
const handleAutoFullscreen = useEventCallback(() => { var _a; return (_a = (auto ? enter : null)) === null || _a === void 0 ? void 0 : _a(); });
|
|
90
|
+
React.useEffect(() => {
|
|
91
|
+
handleAutoFullscreen();
|
|
92
|
+
return () => exit();
|
|
93
|
+
}, [handleAutoFullscreen, exit]);
|
|
94
|
+
const context = React.useMemo(() => ({
|
|
95
|
+
fullscreen,
|
|
96
|
+
disabled,
|
|
97
|
+
enter,
|
|
98
|
+
exit,
|
|
99
|
+
}), [fullscreen, disabled, enter, exit]);
|
|
100
|
+
React.useImperativeHandle(ref, () => context, [context]);
|
|
101
|
+
return (React.createElement("div", { ref: containerRef, className: clsx(cssClass(PLUGIN_FULLSCREEN), cssClass(CLASS_FULLSIZE)) },
|
|
102
|
+
React.createElement(FullscreenContext.Provider, { value: context }, children)));
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
const EnterFullscreenIcon = createIcon("EnterFullscreen", React.createElement("path", { d: "M7 14H5v5h5v-2H7v-3zm-2-4h2V7h3V5H5v5zm12 7h-3v2h5v-5h-2v3zM14 5v2h3v3h2V5h-5z" }));
|
|
106
|
+
const ExitFullscreenIcon = createIcon("ExitFullscreen", React.createElement("path", { d: "M5 16h3v3h2v-5H5v2zm3-8H5v2h5V5H8v3zm6 11h2v-3h3v-2h-5v5zm2-11V5h-2v5h5V8h-3z" }));
|
|
107
|
+
function FullscreenButton() {
|
|
108
|
+
var _a;
|
|
109
|
+
const { fullscreen, disabled, enter, exit } = useFullscreen();
|
|
110
|
+
const { render } = useLightboxProps();
|
|
111
|
+
if (disabled)
|
|
112
|
+
return null;
|
|
113
|
+
if (render.buttonFullscreen) {
|
|
114
|
+
return React.createElement(React.Fragment, null, (_a = render.buttonFullscreen) === null || _a === void 0 ? void 0 : _a.call(render, { fullscreen, disabled, enter, exit }));
|
|
115
|
+
}
|
|
116
|
+
return (React.createElement(IconButton, { disabled: disabled, label: fullscreen ? "Exit Fullscreen" : "Enter Fullscreen", icon: fullscreen ? ExitFullscreenIcon : EnterFullscreenIcon, renderIcon: fullscreen ? render.iconExitFullscreen : render.iconEnterFullscreen, onClick: fullscreen ? exit : enter }));
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
function Fullscreen({ augment, contains, addParent }) {
|
|
120
|
+
augment(({ fullscreen, toolbar, ...restProps }) => ({
|
|
121
|
+
toolbar: addToolbarButton(toolbar, PLUGIN_FULLSCREEN, React.createElement(FullscreenButton, null)),
|
|
122
|
+
fullscreen: resolveFullscreenProps(fullscreen),
|
|
123
|
+
...restProps,
|
|
124
|
+
}));
|
|
125
|
+
addParent(contains(PLUGIN_THUMBNAILS) ? PLUGIN_THUMBNAILS : MODULE_CONTROLLER, createModule(PLUGIN_FULLSCREEN, FullscreenContextProvider));
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
export { Fullscreen as default };
|
package/dist/plugins/index.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
export { default as Captions } from
|
|
2
|
-
export { default as Counter } from
|
|
3
|
-
export { default as Download } from
|
|
4
|
-
export { default as Fullscreen } from
|
|
5
|
-
export { default as Inline } from
|
|
6
|
-
export { default as Slideshow } from
|
|
7
|
-
export { default as Thumbnails } from
|
|
8
|
-
export { default as Video } from
|
|
9
|
-
export { default as Zoom } from
|
|
1
|
+
export { default as Captions } from './captions/index.js';
|
|
2
|
+
export { default as Counter } from './counter/index.js';
|
|
3
|
+
export { default as Download } from './download/index.js';
|
|
4
|
+
export { default as Fullscreen } from './fullscreen/index.js';
|
|
5
|
+
export { default as Inline } from './inline/index.js';
|
|
6
|
+
export { default as Slideshow } from './slideshow/index.js';
|
|
7
|
+
export { default as Thumbnails } from './thumbnails/index.js';
|
|
8
|
+
export { default as Video } from './video/index.js';
|
|
9
|
+
export { default as Zoom } from './zoom/index.js';
|
package/dist/plugins/index.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
export { default as Captions } from
|
|
2
|
-
export { default as Counter } from
|
|
3
|
-
export { default as Download } from
|
|
4
|
-
export { default as Fullscreen } from
|
|
5
|
-
export { default as Inline } from
|
|
6
|
-
export { default as Slideshow } from
|
|
7
|
-
export { default as Thumbnails } from
|
|
8
|
-
export { default as Video } from
|
|
9
|
-
export { default as Zoom } from
|
|
1
|
+
export { default as Captions } from './captions/index.js';
|
|
2
|
+
export { default as Counter } from './counter/index.js';
|
|
3
|
+
export { default as Download } from './download/index.js';
|
|
4
|
+
export { default as Fullscreen } from './fullscreen/index.js';
|
|
5
|
+
export { default as Inline } from './inline/index.js';
|
|
6
|
+
export { default as Slideshow } from './slideshow/index.js';
|
|
7
|
+
export { default as Thumbnails } from './thumbnails/index.js';
|
|
8
|
+
export { default as Video } from './video/index.js';
|
|
9
|
+
export { default as Zoom } from './zoom/index.js';
|
|
@@ -1,9 +1,14 @@
|
|
|
1
|
-
import * as React from
|
|
2
|
-
import {
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { PluginProps } from '../../types.js';
|
|
3
|
+
|
|
4
|
+
/** Inline plugin */
|
|
5
|
+
declare function Inline({ augment, replace, remove }: PluginProps): void;
|
|
6
|
+
|
|
3
7
|
declare module "../../types.js" {
|
|
4
8
|
interface LightboxProps {
|
|
5
9
|
/** HTML div element attributes to be passed to the Inline plugin container */
|
|
6
10
|
inline?: React.HTMLAttributes<HTMLDivElement>;
|
|
7
11
|
}
|
|
8
12
|
}
|
|
9
|
-
|
|
13
|
+
|
|
14
|
+
export { Inline as default };
|
|
@@ -1,2 +1,26 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import { clsx, cssClass, createModule } from '../../index.js';
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import { ACTION_CLOSE, MODULE_NO_SCROLL, MODULE_PORTAL, PLUGIN_INLINE } from '../../types.js';
|
|
4
|
+
|
|
5
|
+
function InlineContainer({ inline: { className, ...rest } = {}, children }) {
|
|
6
|
+
return (React.createElement("div", { className: clsx(cssClass("root"), cssClass("relative"), className), ...rest }, children));
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
function Inline({ augment, replace, remove }) {
|
|
10
|
+
augment(({ toolbar: { buttons, ...restToolbar }, open, close, controller: { focus, aria, touchAction, ...restController }, className, ...restProps }) => ({
|
|
11
|
+
open: true,
|
|
12
|
+
close: () => { },
|
|
13
|
+
toolbar: {
|
|
14
|
+
buttons: buttons.filter((button) => button !== ACTION_CLOSE),
|
|
15
|
+
...restToolbar,
|
|
16
|
+
},
|
|
17
|
+
inline: { style: { width: "100%", height: "100%" }, className },
|
|
18
|
+
controller: { focus: false, aria: true, touchAction: "pan-y", ...restController },
|
|
19
|
+
className,
|
|
20
|
+
...restProps,
|
|
21
|
+
}));
|
|
22
|
+
remove(MODULE_NO_SCROLL);
|
|
23
|
+
replace(MODULE_PORTAL, createModule(PLUGIN_INLINE, InlineContainer));
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export { Inline as default };
|
|
@@ -1,6 +1,9 @@
|
|
|
1
|
-
import * as React from
|
|
2
|
-
import { PLUGIN_SLIDESHOW } from
|
|
3
|
-
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { PluginProps, PLUGIN_SLIDESHOW } from '../../types.js';
|
|
3
|
+
|
|
4
|
+
/** Slideshow plugin */
|
|
5
|
+
declare function Slideshow({ augment, addModule }: PluginProps): void;
|
|
6
|
+
|
|
4
7
|
declare module "../../types.js" {
|
|
5
8
|
interface LightboxProps {
|
|
6
9
|
/** Slideshow plugin settings */
|
|
@@ -42,4 +45,5 @@ declare module "../../types.js" {
|
|
|
42
45
|
pause: Callback;
|
|
43
46
|
}
|
|
44
47
|
}
|
|
45
|
-
|
|
48
|
+
|
|
49
|
+
export { Slideshow as default };
|