yet-another-react-lightbox 1.13.2 → 1.14.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/core/components/IconButton.d.ts +1 -1
- package/dist/core/components/ImageSlide.js +5 -4
- package/dist/plugins/Thumbnails.d.ts +2 -0
- package/dist/plugins/Thumbnails.js +3 -1
- package/dist/plugins/thumbnails.css +1 -1
- package/dist/styles.css +2 -1
- package/dist/types.d.ts +6 -1
- package/package.json +1 -1
|
@@ -4,4 +4,4 @@ export declare type IconButtonProps = Omit<React.DetailedHTMLProps<React.ButtonH
|
|
|
4
4
|
icon: React.ElementType;
|
|
5
5
|
renderIcon?: () => React.ReactNode;
|
|
6
6
|
};
|
|
7
|
-
export declare const IconButton: React.ForwardRefExoticComponent<Pick<IconButtonProps, "icon" | "className" | "value" | "children" | "onPointerDown" | "onPointerMove" | "onPointerUp" | "onPointerLeave" | "onPointerCancel" | "onTouchStart" | "onTouchMove" | "onTouchEnd" | "onTouchCancel" | "onKeyDown" | "onKeyUp" | "onWheel" | "key" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "
|
|
7
|
+
export declare const IconButton: React.ForwardRefExoticComponent<Pick<IconButtonProps, "icon" | "hidden" | "color" | "style" | "translate" | "disabled" | "className" | "value" | "children" | "onPointerDown" | "onPointerMove" | "onPointerUp" | "onPointerLeave" | "onPointerCancel" | "onTouchStart" | "onTouchMove" | "onTouchEnd" | "onTouchCancel" | "onKeyDown" | "onKeyUp" | "onWheel" | "key" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "id" | "lang" | "placeholder" | "slot" | "spellCheck" | "tabIndex" | "title" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancelCapture" | "onTouchEndCapture" | "onTouchMoveCapture" | "onTouchStartCapture" | "onPointerDownCapture" | "onPointerMoveCapture" | "onPointerUpCapture" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "form" | "label" | "autoFocus" | "formAction" | "formEncType" | "formMethod" | "formNoValidate" | "formTarget" | "name" | "renderIcon"> & React.RefAttributes<HTMLButtonElement>>;
|
|
@@ -49,7 +49,10 @@ export const ImageSlide = ({ slide: image, offset, render, rect, imageFit, onCli
|
|
|
49
49
|
maxWidth: `min(${maxWidth}px, 100%)`,
|
|
50
50
|
maxHeight: `min(${maxHeight}px, 100%)`,
|
|
51
51
|
}
|
|
52
|
-
:
|
|
52
|
+
: {
|
|
53
|
+
maxWidth: "100%",
|
|
54
|
+
maxHeight: "100%",
|
|
55
|
+
};
|
|
53
56
|
const srcSet = (_g = image.srcSet) === null || _g === void 0 ? void 0 : _g.sort((a, b) => a.width - b.width).map((item) => `${item.src} ${item.width}w`).join(", ");
|
|
54
57
|
const estimateActualWidth = () => {
|
|
55
58
|
if (rect && !cover) {
|
|
@@ -62,9 +65,7 @@ export const ImageSlide = ({ slide: image, offset, render, rect, imageFit, onCli
|
|
|
62
65
|
}
|
|
63
66
|
return Number.MAX_VALUE;
|
|
64
67
|
};
|
|
65
|
-
const sizes = srcSet && rect && hasWindow()
|
|
66
|
-
? `${Math.ceil((Math.min(estimateActualWidth(), rect.width) / window.innerWidth) * 100)}vw`
|
|
67
|
-
: undefined;
|
|
68
|
+
const sizes = srcSet && rect && hasWindow() ? `${Math.round(Math.min(estimateActualWidth(), rect.width))}px` : undefined;
|
|
68
69
|
return (React.createElement(React.Fragment, null,
|
|
69
70
|
React.createElement("img", { ref: setImageRef, onLoad: onLoad, onError: onError, onClick: onClick, className: clsx(cssClass("slide_image"), cover && cssClass("slide_image_cover"), status !== SLIDE_STATUS_COMPLETE && cssClass("slide_image_loading")), draggable: false, alt: image.alt, style: style, sizes: sizes, srcSet: srcSet, src: image.src }),
|
|
70
71
|
status !== SLIDE_STATUS_COMPLETE && (React.createElement("div", { className: cssClass("slide_placeholder") },
|
|
@@ -9,6 +9,7 @@ const defaultThumbnailsProps = {
|
|
|
9
9
|
padding: 4,
|
|
10
10
|
gap: 16,
|
|
11
11
|
imageFit: "contain",
|
|
12
|
+
vignette: true,
|
|
12
13
|
};
|
|
13
14
|
const VideoThumbnailIcon = createIcon("VideoThumbnail", React.createElement("path", { d: "M10 16.5l6-4.5-6-4.5v9zM12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8z" }));
|
|
14
15
|
const UnknownThumbnailIcon = createIcon("UnknownThumbnail", React.createElement("path", { d: "M23 18V6c0-1.1-.9-2-2-2H3c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h18c1.1 0 2-.9 2-2zM8.5 12.5l2.5 3.01L14.5 11l4.5 6H5l3.5-4.5z" }));
|
|
@@ -170,7 +171,7 @@ export const ThumbnailsTrack = ({ container, startingIndex, slides, carousel, an
|
|
|
170
171
|
publish("prev", index - slideIndex);
|
|
171
172
|
}
|
|
172
173
|
};
|
|
173
|
-
const { width, height, border, borderRadius, padding, gap, imageFit } = thumbnails;
|
|
174
|
+
const { width, height, border, borderRadius, padding, gap, imageFit, vignette } = thumbnails;
|
|
174
175
|
return (React.createElement("div", { className: clsx(cssClass(cssPrefix("container")), cssClass("flex_center")), style: {
|
|
175
176
|
...(width !== defaultThumbnailsProps.width
|
|
176
177
|
? { [cssVar(cssThumbnailPrefix("width"))]: `${boxSize(thumbnails, width)}px` }
|
|
@@ -188,6 +189,7 @@ export const ThumbnailsTrack = ({ container, startingIndex, slides, carousel, an
|
|
|
188
189
|
? { [cssVar(cssThumbnailPrefix("padding"))]: `${padding}px` }
|
|
189
190
|
: null),
|
|
190
191
|
...(gap !== defaultThumbnailsProps.gap ? { [cssVar(cssThumbnailPrefix("gap"))]: `${gap}px` } : null),
|
|
192
|
+
...(!vignette ? { [cssVar(cssPrefix("vignette"))]: "none" } : null),
|
|
191
193
|
...styles.thumbnailsContainer,
|
|
192
194
|
} },
|
|
193
195
|
React.createElement("nav", { ref: track, style: styles.thumbnailsTrack, className: cssClass(cssPrefix("track")) }, items.map(({ slide, index: slideIndex, placeholder }) => {
|
package/dist/styles.css
CHANGED
package/dist/types.d.ts
CHANGED
|
@@ -46,9 +46,13 @@ export interface SlotType {
|
|
|
46
46
|
}
|
|
47
47
|
/** Customization slots */
|
|
48
48
|
export declare type Slot = SlotType[keyof SlotType];
|
|
49
|
+
/** Customization slot CSS properties */
|
|
50
|
+
interface SlotCSSProperties extends React.CSSProperties {
|
|
51
|
+
[key: `--yarl__${string}`]: string | number;
|
|
52
|
+
}
|
|
49
53
|
/** Customization slots styles */
|
|
50
54
|
export declare type SlotStyles = {
|
|
51
|
-
[key in Slot]?:
|
|
55
|
+
[key in Slot]?: SlotCSSProperties;
|
|
52
56
|
};
|
|
53
57
|
/** Carousel settings */
|
|
54
58
|
export interface CarouselSettings {
|
|
@@ -239,3 +243,4 @@ export declare type DeepNonNullable<T> = NonNullable<{
|
|
|
239
243
|
}>;
|
|
240
244
|
/** Lightbox external props */
|
|
241
245
|
export declare type LightboxExternalProps = DeepPartial<Partial<LightboxProps>, "carousel" | "animation" | "render" | "toolbar" | "controller" | "on">;
|
|
246
|
+
export {};
|