@page-speed/lightbox 0.2.0 → 0.2.2
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/components/Layouts/HorizontalShowcaseLayout.d.ts +21 -0
- package/dist/components/Layouts/VerticalPeekLayout.d.ts +25 -0
- package/dist/components/LightboxThumbnails.d.ts +20 -0
- package/dist/components/index.d.ts +3 -0
- package/dist/components/index.js +21658 -18112
- package/dist/core/index.js +5 -0
- package/dist/hooks/index.js +5 -0
- package/dist/hooks/useGalleryState.d.ts +3 -0
- package/dist/index.cjs +21652 -18079
- package/dist/index.js +21658 -18112
- package/dist/renderers/index.js +21186 -17988
- package/dist/types.d.ts +34 -1
- package/package.json +2 -2
package/dist/core/index.js
CHANGED
|
@@ -9,6 +9,8 @@ function useGalleryState({
|
|
|
9
9
|
Math.max(0, Math.min(initialIndex, items.length - 1))
|
|
10
10
|
);
|
|
11
11
|
const currentItem = items[currentIndex] ?? null;
|
|
12
|
+
const prevItem = currentIndex > 0 ? items[currentIndex - 1] : null;
|
|
13
|
+
const nextItem = currentIndex < items.length - 1 ? items[currentIndex + 1] : null;
|
|
12
14
|
const goToIndex = useCallback(
|
|
13
15
|
(index) => {
|
|
14
16
|
if (index < 0 || index >= items.length) return;
|
|
@@ -24,8 +26,11 @@ function useGalleryState({
|
|
|
24
26
|
goToIndex(currentIndex - 1);
|
|
25
27
|
}, [currentIndex, goToIndex]);
|
|
26
28
|
return {
|
|
29
|
+
items,
|
|
27
30
|
currentIndex,
|
|
28
31
|
currentItem,
|
|
32
|
+
prevItem,
|
|
33
|
+
nextItem,
|
|
29
34
|
goToIndex,
|
|
30
35
|
next,
|
|
31
36
|
prev,
|
package/dist/hooks/index.js
CHANGED
|
@@ -9,6 +9,8 @@ function useGalleryState({
|
|
|
9
9
|
Math.max(0, Math.min(initialIndex, items.length - 1))
|
|
10
10
|
);
|
|
11
11
|
const currentItem = items[currentIndex] ?? null;
|
|
12
|
+
const prevItem = currentIndex > 0 ? items[currentIndex - 1] : null;
|
|
13
|
+
const nextItem = currentIndex < items.length - 1 ? items[currentIndex + 1] : null;
|
|
12
14
|
const goToIndex = useCallback(
|
|
13
15
|
(index) => {
|
|
14
16
|
if (index < 0 || index >= items.length) return;
|
|
@@ -24,8 +26,11 @@ function useGalleryState({
|
|
|
24
26
|
goToIndex(currentIndex - 1);
|
|
25
27
|
}, [currentIndex, goToIndex]);
|
|
26
28
|
return {
|
|
29
|
+
items,
|
|
27
30
|
currentIndex,
|
|
28
31
|
currentItem,
|
|
32
|
+
prevItem,
|
|
33
|
+
nextItem,
|
|
29
34
|
goToIndex,
|
|
30
35
|
next,
|
|
31
36
|
prev,
|
|
@@ -4,8 +4,11 @@ export declare function useGalleryState({ items, initialIndex, onSelect, }: {
|
|
|
4
4
|
initialIndex?: number;
|
|
5
5
|
onSelect?: (index: number) => void;
|
|
6
6
|
}): {
|
|
7
|
+
items: LightboxItem[];
|
|
7
8
|
currentIndex: number;
|
|
8
9
|
currentItem: LightboxItem;
|
|
10
|
+
prevItem: LightboxItem | null;
|
|
11
|
+
nextItem: LightboxItem | null;
|
|
9
12
|
goToIndex: (index: number) => void;
|
|
10
13
|
next: () => void;
|
|
11
14
|
prev: () => void;
|