yet-another-react-lightbox 1.11.1 → 1.12.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.
@@ -1,21 +1,21 @@
1
1
  import * as React from "react";
2
- import { cssClass, cssVar, isDefined, makeUseContext } from "../core/utils.js";
2
+ import { clsx, cssClass, cssVar, isDefined, makeUseContext } from "../core/utils.js";
3
3
  import { useEvents } from "../core/contexts/Events.js";
4
4
  import { createModule } from "../core/index.js";
5
5
  const defaultTextAlign = "start";
6
6
  const defaultMaxLines = 3;
7
- const cls = (className) => cssClass(`slide_${className}`);
7
+ const cssPrefix = (className) => cssClass(`slide_${className}`);
8
8
  const hasTitle = (slide) => "title" in slide ? typeof slide.title === "string" : false;
9
9
  const hasDescription = (slide) => "description" in slide ? typeof slide.description === "string" : false;
10
10
  const CaptionsContext = React.createContext(null);
11
11
  const useCaptions = makeUseContext("useCaptions", "CaptionsContext", CaptionsContext);
12
12
  const Title = ({ title }) => {
13
13
  const { toolbarWidth } = useCaptions();
14
- return (React.createElement("div", { className: cls(`title_container`) },
15
- React.createElement("div", { className: cls("title"), ...(toolbarWidth ? { style: { [cssVar("toolbar_width")]: `${toolbarWidth}px` } } : null) }, title)));
14
+ return (React.createElement("div", { className: clsx(cssPrefix("captions_container"), cssPrefix("title_container")) },
15
+ React.createElement("div", { className: cssPrefix("title"), ...(toolbarWidth ? { style: { [cssVar("toolbar_width")]: `${toolbarWidth}px` } } : null) }, title)));
16
16
  };
17
- const Description = ({ description, align, maxLines }) => (React.createElement("div", { className: cls("description_container") },
18
- React.createElement("div", { className: cls("description"), ...(align !== defaultTextAlign || maxLines !== defaultMaxLines
17
+ const Description = ({ description, align, maxLines }) => (React.createElement("div", { className: clsx(cssPrefix("captions_container"), cssPrefix("description_container")) },
18
+ React.createElement("div", { className: cssPrefix("description"), ...(align !== defaultTextAlign || maxLines !== defaultMaxLines
19
19
  ? {
20
20
  style: {
21
21
  [cssVar("slide_description_text_align")]: align,
@@ -1,27 +1,24 @@
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
+ transform: translateZ(0);
9
+ }
1
10
  .yarl__slide_title {
2
- font-family: Arial, "Helvetica Neue", Helvetica, sans-serif;
3
- font-size: 1.25rem;
4
- font-weight: 700;
11
+ font-size: var(--yarl__slide_title_font_size, 125%);
12
+ font-weight: var(--yarl__slide_title_font_weight, bolder);
5
13
  max-width: calc(100% - var(--yarl__toolbar_width, 0px));
6
14
  overflow: hidden;
7
15
  text-overflow: ellipsis;
8
16
  white-space: nowrap;
9
17
  }
10
18
  .yarl__slide_title_container {
11
- position: absolute;
12
- left: 0;
13
- right: 0;
14
- top: 0;
15
- padding: 16px;
16
- background: rgba(0, 0, 0, 0.5);
17
- -webkit-transform: translateZ(0);
18
- transform: translateZ(0);
19
+ top: var(--yarl__slide_title_container_top, 0);
19
20
  }
20
21
  .yarl__slide_description {
21
- font-family: Arial, "Helvetica Neue", Helvetica, sans-serif;
22
- font-size: 1rem;
23
- line-height: 1.2;
24
- font-weight: 500;
25
22
  overflow: hidden;
26
23
  -webkit-hyphens: auto;
27
24
  hyphens: auto;
@@ -31,12 +28,5 @@
31
28
  text-align: var(--yarl__slide_description_text_align, start);
32
29
  }
33
30
  .yarl__slide_description_container {
34
- position: absolute;
35
- left: 0;
36
- right: 0;
37
- bottom: 0;
38
- padding: 16px;
39
- background: rgba(0, 0, 0, 0.5);
40
- -webkit-transform: translateZ(0);
41
- transform: translateZ(0);
31
+ bottom: var(--yarl__slide_description_container_bottom, 0);
42
32
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "yet-another-react-lightbox",
3
- "version": "1.11.1",
3
+ "version": "1.12.0",
4
4
  "description": "Modern React lightbox component",
5
5
  "author": "Igor Danchenko",
6
6
  "license": "MIT",