@alfalab/core-components-gallery 5.6.7 → 5.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/Component.js +1 -1
- package/{buttons-7413eb9c.js → buttons-40c120f8.js} +1 -1
- package/components/header/Component.js +1 -1
- package/components/header/buttons.js +1 -1
- package/components/header/index.css +6 -6
- package/components/header-info-block/Component.js +1 -1
- package/components/header-info-block/index.css +5 -5
- package/components/image-preview/Component.js +1 -1
- package/components/image-preview/index.css +14 -14
- package/components/image-viewer/component.js +1 -1
- package/components/image-viewer/index.css +19 -19
- package/components/image-viewer/slide.js +1 -1
- package/components/navigation-bar/Component.js +1 -1
- package/components/navigation-bar/index.css +6 -6
- package/esm/Component.js +1 -1
- package/esm/{buttons-c6111bd9.js → buttons-b8760d69.js} +1 -1
- package/esm/components/header/Component.js +1 -1
- package/esm/components/header/buttons.js +1 -1
- package/esm/components/header/index.css +6 -6
- package/esm/components/header-info-block/Component.js +1 -1
- package/esm/components/header-info-block/index.css +5 -5
- package/esm/components/image-preview/Component.js +1 -1
- package/esm/components/image-preview/index.css +14 -14
- package/esm/components/image-viewer/component.js +1 -1
- package/esm/components/image-viewer/index.css +19 -19
- package/esm/components/image-viewer/slide.js +1 -1
- package/esm/components/navigation-bar/Component.js +1 -1
- package/esm/components/navigation-bar/index.css +6 -6
- package/esm/index.css +3 -3
- package/esm/{slide-31fa8c5e.js → slide-065b3427.js} +1 -1
- package/index.css +3 -3
- package/modern/Component.js +1 -1
- package/modern/{buttons-719896b0.js → buttons-a2360885.js} +1 -1
- package/modern/components/header/Component.js +1 -1
- package/modern/components/header/buttons.js +1 -1
- package/modern/components/header/index.css +6 -6
- package/modern/components/header-info-block/Component.js +1 -1
- package/modern/components/header-info-block/index.css +5 -5
- package/modern/components/image-preview/Component.js +1 -1
- package/modern/components/image-preview/index.css +14 -14
- package/modern/components/image-viewer/component.js +1 -1
- package/modern/components/image-viewer/index.css +19 -19
- package/modern/components/image-viewer/slide.js +1 -1
- package/modern/components/navigation-bar/Component.js +1 -1
- package/modern/components/navigation-bar/index.css +6 -6
- package/modern/index.css +3 -3
- package/modern/{slide-1d1c0510.js → slide-025330a5.js} +1 -1
- package/moderncssm/Component.d.ts +36 -0
- package/moderncssm/Component.js +119 -0
- package/moderncssm/components/header/Component.d.ts +3 -0
- package/moderncssm/components/header/Component.js +41 -0
- package/moderncssm/components/header/buttons.d.ts +11 -0
- package/moderncssm/components/header/buttons.js +18 -0
- package/moderncssm/components/header/index.d.ts +1 -0
- package/moderncssm/components/header/index.js +1 -0
- package/moderncssm/components/header/index.module.css +29 -0
- package/moderncssm/components/header-info-block/Component.d.ts +7 -0
- package/moderncssm/components/header-info-block/Component.js +15 -0
- package/moderncssm/components/header-info-block/index.d.ts +1 -0
- package/moderncssm/components/header-info-block/index.js +1 -0
- package/moderncssm/components/header-info-block/index.module.css +29 -0
- package/moderncssm/components/image-preview/Component.d.ts +11 -0
- package/moderncssm/components/image-preview/Component.js +47 -0
- package/moderncssm/components/image-preview/index.d.ts +1 -0
- package/moderncssm/components/image-preview/index.js +1 -0
- package/moderncssm/components/image-preview/index.module.css +77 -0
- package/moderncssm/components/image-preview/paths.d.ts +5 -0
- package/moderncssm/components/image-preview/paths.js +6 -0
- package/moderncssm/components/image-viewer/component.d.ts +3 -0
- package/moderncssm/components/image-viewer/component.js +110 -0
- package/moderncssm/components/image-viewer/index.d.ts +1 -0
- package/moderncssm/components/image-viewer/index.js +1 -0
- package/moderncssm/components/image-viewer/index.module.css +129 -0
- package/moderncssm/components/image-viewer/paths.d.ts +5 -0
- package/moderncssm/components/image-viewer/paths.js +6 -0
- package/moderncssm/components/image-viewer/slide.d.ts +16 -0
- package/moderncssm/components/image-viewer/slide.js +35 -0
- package/moderncssm/components/index.d.ts +4 -0
- package/moderncssm/components/index.js +4 -0
- package/moderncssm/components/navigation-bar/Component.d.ts +3 -0
- package/moderncssm/components/navigation-bar/Component.js +61 -0
- package/moderncssm/components/navigation-bar/index.d.ts +1 -0
- package/moderncssm/components/navigation-bar/index.js +1 -0
- package/moderncssm/components/navigation-bar/index.module.css +30 -0
- package/moderncssm/context.d.ts +24 -0
- package/moderncssm/context.js +25 -0
- package/moderncssm/index.d.ts +2 -0
- package/moderncssm/index.js +4 -0
- package/moderncssm/index.module.css +17 -0
- package/moderncssm/types.d.ts +13 -0
- package/moderncssm/types.js +1 -0
- package/moderncssm/utils/constants.d.ts +11 -0
- package/moderncssm/utils/constants.js +12 -0
- package/moderncssm/utils/index.d.ts +3 -0
- package/moderncssm/utils/index.js +3 -0
- package/moderncssm/utils/split-filename.d.ts +2 -0
- package/moderncssm/utils/split-filename.js +14 -0
- package/moderncssm/utils/utils.d.ts +7 -0
- package/moderncssm/utils/utils.js +12 -0
- package/package.json +7 -7
- package/{slide-c6551b6d.js → slide-9fe3e3d9.js} +1 -1
- package/src/components/header/index.module.css +1 -1
- package/src/components/header-info-block/index.module.css +1 -1
- package/src/components/image-preview/index.module.css +1 -1
- package/src/components/image-viewer/index.module.css +1 -1
- package/src/components/navigation-bar/index.module.css +1 -1
- package/src/index.module.css +1 -1
- /package/{buttons-7413eb9c.d.ts → buttons-40c120f8.d.ts} +0 -0
- /package/esm/{buttons-c6111bd9.d.ts → buttons-b8760d69.d.ts} +0 -0
- /package/esm/{slide-31fa8c5e.d.ts → slide-065b3427.d.ts} +0 -0
- /package/modern/{buttons-719896b0.d.ts → buttons-a2360885.d.ts} +0 -0
- /package/modern/{slide-1d1c0510.d.ts → slide-025330a5.d.ts} +0 -0
- /package/{slide-c6551b6d.d.ts → slide-9fe3e3d9.d.ts} +0 -0
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import SwiperCore from 'swiper';
|
|
3
|
+
import { GalleryImage, ImageMeta } from "./types";
|
|
4
|
+
type GalleryContext = {
|
|
5
|
+
singleSlide: boolean;
|
|
6
|
+
currentSlideIndex: number;
|
|
7
|
+
images: GalleryImage[];
|
|
8
|
+
imagesMeta: ImageMeta[];
|
|
9
|
+
fullScreen: boolean;
|
|
10
|
+
initialSlide: number;
|
|
11
|
+
setFullScreen: (fullScreen: boolean) => void;
|
|
12
|
+
setImageMeta: (meta: ImageMeta, index: number) => void;
|
|
13
|
+
slideTo: (index: number) => void;
|
|
14
|
+
slideNext: () => void;
|
|
15
|
+
slidePrev: () => void;
|
|
16
|
+
getSwiper: () => SwiperCore | undefined;
|
|
17
|
+
setSwiper: (swiper: SwiperCore) => void;
|
|
18
|
+
onClose: () => void;
|
|
19
|
+
setCurrentSlideIndex?: (index: number) => void;
|
|
20
|
+
getCurrentImage: () => GalleryImage | undefined;
|
|
21
|
+
getCurrentImageMeta: () => ImageMeta | undefined;
|
|
22
|
+
};
|
|
23
|
+
declare const GalleryContext: import("react").Context<GalleryContext>;
|
|
24
|
+
export { GalleryContext };
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { createContext } from 'react';
|
|
2
|
+
|
|
3
|
+
const mockFn = () => undefined;
|
|
4
|
+
// eslint-disable-next-line @typescript-eslint/no-redeclare
|
|
5
|
+
const GalleryContext = createContext({
|
|
6
|
+
singleSlide: false,
|
|
7
|
+
currentSlideIndex: 0,
|
|
8
|
+
images: [],
|
|
9
|
+
imagesMeta: [],
|
|
10
|
+
fullScreen: false,
|
|
11
|
+
initialSlide: 0,
|
|
12
|
+
setFullScreen: mockFn,
|
|
13
|
+
setImageMeta: mockFn,
|
|
14
|
+
slideTo: mockFn,
|
|
15
|
+
slideNext: mockFn,
|
|
16
|
+
slidePrev: mockFn,
|
|
17
|
+
getSwiper: mockFn,
|
|
18
|
+
setSwiper: mockFn,
|
|
19
|
+
onClose: mockFn,
|
|
20
|
+
setCurrentSlideIndex: mockFn,
|
|
21
|
+
getCurrentImage: mockFn,
|
|
22
|
+
getCurrentImageMeta: mockFn,
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
export { GalleryContext };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/* */
|
|
2
|
+
|
|
3
|
+
.container {
|
|
4
|
+
display: flex;
|
|
5
|
+
flex-direction: column;
|
|
6
|
+
justify-content: space-between;
|
|
7
|
+
height: 100%;
|
|
8
|
+
width: 100%;
|
|
9
|
+
background-color: var(--color-static-neutral-0-inverted);
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
.modal {
|
|
13
|
+
flex-grow: 1;
|
|
14
|
+
width: 100%;
|
|
15
|
+
height: 100%;
|
|
16
|
+
background: transparent;
|
|
17
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
declare const TestIds: {
|
|
2
|
+
ACTIVE_IMAGE: string;
|
|
3
|
+
PREV_SLIDE_BUTTON: string;
|
|
4
|
+
NEXT_SLIDE_BUTTON: string;
|
|
5
|
+
CLOSE_BUTTON: string;
|
|
6
|
+
FULLSCREEN_BUTTON: string;
|
|
7
|
+
EXIT_FULLSCREEN_BUTTON: string;
|
|
8
|
+
DOWNLOAD_BUTTON: string;
|
|
9
|
+
NAVIGATION_BAR: string;
|
|
10
|
+
};
|
|
11
|
+
export { TestIds };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
const TestIds = {
|
|
2
|
+
ACTIVE_IMAGE: 'active-image',
|
|
3
|
+
PREV_SLIDE_BUTTON: 'prev-slide-button',
|
|
4
|
+
NEXT_SLIDE_BUTTON: 'next-slide-button',
|
|
5
|
+
CLOSE_BUTTON: 'close-button',
|
|
6
|
+
FULLSCREEN_BUTTON: 'fullscreen-button',
|
|
7
|
+
EXIT_FULLSCREEN_BUTTON: 'exit-fullscreen-button',
|
|
8
|
+
DOWNLOAD_BUTTON: 'download-button',
|
|
9
|
+
NAVIGATION_BAR: 'navigation-bar',
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
export { TestIds };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
const SEPARATION_POSITION_SHIFT = 3;
|
|
2
|
+
function splitFilename(filename) {
|
|
3
|
+
const dotPosition = filename.lastIndexOf('.');
|
|
4
|
+
let head = filename;
|
|
5
|
+
let tail = '';
|
|
6
|
+
const splitPosition = dotPosition - SEPARATION_POSITION_SHIFT;
|
|
7
|
+
if (splitPosition > 0) {
|
|
8
|
+
head = filename.slice(0, splitPosition);
|
|
9
|
+
tail = filename.slice(splitPosition);
|
|
10
|
+
}
|
|
11
|
+
return [head, tail];
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export { splitFilename };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { GalleryImage, ImageMeta } from "../types";
|
|
2
|
+
declare const PLACEHOLDER_WIDTH = 400;
|
|
3
|
+
declare const PLACEHOLDER_HEIGHT = 300;
|
|
4
|
+
declare const getImageKey: ({ name, src }: GalleryImage, index: number) => string;
|
|
5
|
+
declare const getImageAlt: ({ alt, name }: GalleryImage, index: number) => string;
|
|
6
|
+
declare const isSmallImage: (meta?: ImageMeta) => boolean;
|
|
7
|
+
export { PLACEHOLDER_WIDTH, PLACEHOLDER_HEIGHT, getImageKey, getImageAlt, isSmallImage };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
const PLACEHOLDER_WIDTH = 400;
|
|
2
|
+
const PLACEHOLDER_HEIGHT = 300;
|
|
3
|
+
const getImageKey = ({ name = '', src }, index) => `${name}-${index}-${src}`;
|
|
4
|
+
const getImageAlt = ({ alt, name }, index) => alt || name || `Изображение ${index + 1}`;
|
|
5
|
+
const isSmallImage = (meta) => {
|
|
6
|
+
if (!meta) {
|
|
7
|
+
return false;
|
|
8
|
+
}
|
|
9
|
+
return meta.width < PLACEHOLDER_WIDTH && meta.height < PLACEHOLDER_HEIGHT;
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
export { PLACEHOLDER_HEIGHT, PLACEHOLDER_WIDTH, getImageAlt, getImageKey, isSmallImage };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@alfalab/core-components-gallery",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.7.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"keywords": [],
|
|
6
6
|
"license": "MIT",
|
|
@@ -14,10 +14,10 @@
|
|
|
14
14
|
"react": "^16.9.0 || ^17.0.1 || ^18.0.0"
|
|
15
15
|
},
|
|
16
16
|
"dependencies": {
|
|
17
|
-
"@alfalab/core-components-base-modal": "^5.
|
|
18
|
-
"@alfalab/core-components-icon-button": "^6.
|
|
19
|
-
"@alfalab/core-components-tooltip": "^7.
|
|
20
|
-
"@alfalab/core-components-typography": "^4.
|
|
17
|
+
"@alfalab/core-components-base-modal": "^5.8.0",
|
|
18
|
+
"@alfalab/core-components-icon-button": "^6.8.0",
|
|
19
|
+
"@alfalab/core-components-tooltip": "^7.4.0",
|
|
20
|
+
"@alfalab/core-components-typography": "^4.10.0",
|
|
21
21
|
"@alfalab/hooks": "^1.13.0",
|
|
22
22
|
"@alfalab/icons-glyph": "^2.139.0",
|
|
23
23
|
"classnames": "^2.3.1",
|
|
@@ -25,6 +25,6 @@
|
|
|
25
25
|
"swiper": "^6.8.2",
|
|
26
26
|
"tslib": "^2.4.0"
|
|
27
27
|
},
|
|
28
|
-
"themesVersion": "13.0
|
|
29
|
-
"varsVersion": "9.
|
|
28
|
+
"themesVersion": "13.1.0",
|
|
29
|
+
"varsVersion": "9.12.0"
|
|
30
30
|
}
|
|
@@ -12,7 +12,7 @@ function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'defau
|
|
|
12
12
|
var React__default = /*#__PURE__*/_interopDefaultCompat(React);
|
|
13
13
|
var cn__default = /*#__PURE__*/_interopDefaultCompat(cn);
|
|
14
14
|
|
|
15
|
-
var styles = {"component":"
|
|
15
|
+
var styles = {"component":"gallery__component_s8p2x","swiper":"gallery__swiper_s8p2x","singleSlide":"gallery__singleSlide_s8p2x","hidden":"gallery__hidden_s8p2x","slide":"gallery__slide_s8p2x","slideLoading":"gallery__slideLoading_s8p2x","image":"gallery__image_s8p2x","smallImage":"gallery__smallImage_s8p2x","verticalImageFit":"gallery__verticalImageFit_s8p2x","horizontalImageFit":"gallery__horizontalImageFit_s8p2x","arrow":"gallery__arrow_s8p2x","focused":"gallery__focused_s8p2x","placeholder":"gallery__placeholder_s8p2x","brokenImgWrapper":"gallery__brokenImgWrapper_s8p2x","brokenImgIcon":"gallery__brokenImgIcon_s8p2x","fullScreenImage":"gallery__fullScreenImage_s8p2x"};
|
|
16
16
|
require('./components/image-viewer/index.css')
|
|
17
17
|
|
|
18
18
|
var SlideInner = function (_a) {
|
package/src/index.module.css
CHANGED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|