yet-another-react-lightbox 3.10.1 → 3.11.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/dist/index.js CHANGED
@@ -1143,7 +1143,7 @@ function CarouselSlide({ slide, offset }) {
1143
1143
  const containerRef = React.useRef(null);
1144
1144
  const { currentIndex } = useLightboxState();
1145
1145
  const { slideRect, close } = useController();
1146
- const { render, carousel: { imageFit, imageProps }, on: { click: onClick }, controller: { closeOnBackdropClick }, } = useLightboxProps();
1146
+ const { render, carousel: { imageFit, imageProps }, on: { click: onClick }, controller: { closeOnBackdropClick }, styles: { slide: style }, } = useLightboxProps();
1147
1147
  const renderSlide = () => {
1148
1148
  var _a, _b, _c, _d;
1149
1149
  let rendered = (_a = render.slide) === null || _a === void 0 ? void 0 : _a.call(render, { slide, offset, rect: slideRect });
@@ -1167,10 +1167,11 @@ function CarouselSlide({ slide, offset }) {
1167
1167
  close();
1168
1168
  }
1169
1169
  };
1170
- return (React.createElement("div", { ref: containerRef, className: clsx(cssClass(cssSlidePrefix()), offset === 0 && cssClass(cssSlidePrefix("current")), cssClass(CLASS_FLEX_CENTER)), onClick: handleBackdropClick }, renderSlide()));
1170
+ return (React.createElement("div", { ref: containerRef, className: clsx(cssClass(cssSlidePrefix()), offset === 0 && cssClass(cssSlidePrefix("current")), cssClass(CLASS_FLEX_CENTER)), onClick: handleBackdropClick, style: style }, renderSlide()));
1171
1171
  }
1172
1172
  function Placeholder() {
1173
- return React.createElement("div", { className: cssClass("slide") });
1173
+ const style = useLightboxProps().styles.slide;
1174
+ return React.createElement("div", { className: cssClass("slide"), style: style });
1174
1175
  }
1175
1176
  function Carousel({ carousel: { finite, preload, padding, spacing } }) {
1176
1177
  const { slides, currentIndex, globalIndex } = useLightboxState();
@@ -10,6 +10,8 @@ declare module "yet-another-react-lightbox" {
10
10
  }
11
11
  /** Video slide attributes */
12
12
  interface SlideVideo extends GenericSlide {
13
+ /** video slide type */
14
+ type: "video";
13
15
  /** video placeholder image */
14
16
  poster?: string;
15
17
  /** video width in pixels */
@@ -94,8 +94,9 @@ function Video({ augment }) {
94
94
  augment(({ render: { slide: renderSlide, ...restRender }, video, ...restProps }) => ({
95
95
  render: {
96
96
  slide: ({ slide, offset, rect }) => {
97
+ var _a;
97
98
  if (isVideoSlide(slide)) {
98
- return (React.createElement(VideoSlide, { key: `${slide.sources.map((source) => source.src).join(" ")}`, slide: slide, offset: offset }));
99
+ return (React.createElement(VideoSlide, { key: `${(_a = slide.sources) === null || _a === void 0 ? void 0 : _a.map((source) => source.src).join(" ")}`, slide: slide, offset: offset }));
99
100
  }
100
101
  return renderSlide === null || renderSlide === void 0 ? void 0 : renderSlide({ slide, offset, rect });
101
102
  },
package/dist/types.d.ts CHANGED
@@ -102,6 +102,8 @@ interface GenericSlide {
102
102
  }
103
103
  /** Image slide properties */
104
104
  interface SlideImage extends GenericSlide {
105
+ /** image slide type */
106
+ type?: "image";
105
107
  /** image URL */
106
108
  src: string;
107
109
  /** image 'alt' attribute */
@@ -159,6 +161,8 @@ interface SlotType {
159
161
  root: "root";
160
162
  /** lightbox container customization slot */
161
163
  container: "container";
164
+ /** lightbox slide customization slot */
165
+ slide: "slide";
162
166
  /** lightbox button customization slot */
163
167
  button: "button";
164
168
  /** lightbox icon customization slot */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "yet-another-react-lightbox",
3
- "version": "3.10.1",
3
+ "version": "3.11.0",
4
4
  "description": "Modern React lightbox component",
5
5
  "author": "Igor Danchenko",
6
6
  "license": "MIT",