@alfalab/core-components-gallery 5.2.13 → 5.3.1
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-50136800.d.ts +38 -0
- package/Component.js +4 -4
- package/buttons-a2be6d97.d.ts +336 -0
- package/{buttons-a0cf7676.js → buttons-a2be6d97.js} +5 -5
- package/components/header/Component.js +2 -2
- package/components/header/buttons.js +2 -2
- package/components/header/index.css +6 -6
- package/components/header/index.js +2 -2
- 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 +13 -13
- package/components/image-viewer/component.js +1 -1
- package/components/image-viewer/index.css +19 -19
- package/components/image-viewer/index.js +1 -1
- package/components/image-viewer/slide.js +1 -1
- package/components/index.js +3 -3
- package/components/navigation-bar/Component.js +1 -1
- package/components/navigation-bar/index.css +6 -6
- package/cssm/Component-50136800.d.ts +38 -0
- package/cssm/Component.js +1 -1
- package/cssm/components/header/Component.js +1 -1
- package/cssm/components/header/buttons.js +4 -4
- package/cssm/components/header/index.js +1 -1
- package/cssm/components/index.js +1 -1
- package/cssm/index-50136800.d.ts +11 -0
- package/cssm/index-72dda473.d.ts +12 -0
- package/cssm/index-ebda875c.d.ts +35 -0
- package/cssm/index.js +1 -1
- package/cssm/types-83e2bd9e.d.ts +113 -0
- package/cssm/typings-9211a437.d.ts +95 -0
- package/esm/Component-50136800.d.ts +38 -0
- package/esm/Component.js +4 -4
- package/esm/buttons-83f36b01.d.ts +336 -0
- package/esm/{buttons-8138e150.js → buttons-83f36b01.js} +5 -5
- package/esm/components/header/Component.js +2 -2
- package/esm/components/header/buttons.js +2 -2
- package/esm/components/header/index.css +6 -6
- package/esm/components/header/index.js +2 -2
- 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 +13 -13
- package/esm/components/image-viewer/component.js +1 -1
- package/esm/components/image-viewer/index.css +19 -19
- package/esm/components/image-viewer/index.js +1 -1
- package/esm/components/image-viewer/slide.js +1 -1
- package/esm/components/index.js +3 -3
- package/esm/components/navigation-bar/Component.js +1 -1
- package/esm/components/navigation-bar/index.css +6 -6
- package/esm/index-50136800.d.ts +11 -0
- package/esm/index-72dda473.d.ts +12 -0
- package/esm/index-ebda875c.d.ts +35 -0
- package/esm/index.css +3 -3
- package/esm/index.js +3 -3
- package/esm/{slide-7040503f.js → slide-a481ee16.js} +1 -1
- package/esm/types-83e2bd9e.d.ts +113 -0
- package/esm/typings-9211a437.d.ts +95 -0
- package/index-50136800.d.ts +11 -0
- package/index-72dda473.d.ts +12 -0
- package/index-ebda875c.d.ts +35 -0
- package/index.css +3 -3
- package/index.js +3 -3
- package/modern/Component-50136800.d.ts +38 -0
- package/modern/Component.js +4 -4
- package/modern/buttons-fa6480fa.d.ts +336 -0
- package/modern/{buttons-c69fcb71.js → buttons-fa6480fa.js} +5 -5
- package/modern/components/header/Component.js +2 -2
- package/modern/components/header/buttons.js +2 -2
- package/modern/components/header/index.css +6 -6
- package/modern/components/header/index.js +2 -2
- 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 +13 -13
- package/modern/components/image-viewer/component.js +1 -1
- package/modern/components/image-viewer/index.css +19 -19
- package/modern/components/image-viewer/index.js +1 -1
- package/modern/components/image-viewer/slide.js +1 -1
- package/modern/components/index.js +3 -3
- package/modern/components/navigation-bar/Component.js +1 -1
- package/modern/components/navigation-bar/index.css +6 -6
- package/modern/index-50136800.d.ts +11 -0
- package/modern/index-72dda473.d.ts +12 -0
- package/modern/index-ebda875c.d.ts +35 -0
- package/modern/index.css +3 -3
- package/modern/index.js +3 -3
- package/modern/{slide-b249a536.js → slide-ef1f690b.js} +1 -1
- package/modern/types-83e2bd9e.d.ts +113 -0
- package/modern/typings-9211a437.d.ts +95 -0
- package/package.json +5 -5
- package/{slide-97bdc786.js → slide-610e04e2.js} +1 -1
- package/src/Component.tsx +185 -0
- package/src/components/header/Component.tsx +86 -0
- package/src/components/header/buttons.tsx +78 -0
- package/src/components/header/index.module.css +30 -0
- package/src/components/header/index.tsx +1 -0
- package/src/components/header-info-block/Component.tsx +47 -0
- package/src/components/header-info-block/index.module.css +29 -0
- package/src/components/header-info-block/index.ts +1 -0
- package/src/components/image-preview/Component.tsx +88 -0
- package/src/components/image-preview/index.module.css +68 -0
- package/src/components/image-preview/index.tsx +1 -0
- package/src/components/image-preview/paths.ts +5 -0
- package/src/components/image-viewer/component.tsx +232 -0
- package/src/components/image-viewer/index.module.css +126 -0
- package/src/components/image-viewer/index.ts +1 -0
- package/src/components/image-viewer/paths.ts +5 -0
- package/src/components/image-viewer/slide.tsx +113 -0
- package/src/components/index.ts +4 -0
- package/src/components/navigation-bar/Component.tsx +96 -0
- package/src/components/navigation-bar/index.module.css +31 -0
- package/src/components/navigation-bar/index.ts +1 -0
- package/src/context.ts +47 -0
- package/src/index.module.css +17 -0
- package/src/index.ts +2 -0
- package/src/types.ts +13 -0
- package/src/utils/constants.ts +10 -0
- package/src/utils/index.ts +3 -0
- package/src/utils/split-filename.ts +17 -0
- package/src/utils/utils.ts +18 -0
- package/types-83e2bd9e.d.ts +113 -0
- package/typings-9211a437.d.ts +95 -0
- package/buttons-a0cf7676.d.ts +0 -11
- package/esm/buttons-8138e150.d.ts +0 -11
- package/modern/buttons-c69fcb71.d.ts +0 -11
- /package/esm/{slide-7040503f.d.ts → slide-a481ee16.d.ts} +0 -0
- /package/modern/{slide-b249a536.d.ts → slide-ef1f690b.d.ts} +0 -0
- /package/{slide-97bdc786.d.ts → slide-610e04e2.d.ts} +0 -0
package/src/types.ts
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export 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
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
const SEPARATION_POSITION_SHIFT = 3;
|
|
2
|
+
|
|
3
|
+
export function splitFilename(filename: string): [string, string] {
|
|
4
|
+
const dotPosition = filename.lastIndexOf('.');
|
|
5
|
+
|
|
6
|
+
let head = filename;
|
|
7
|
+
let tail = '';
|
|
8
|
+
|
|
9
|
+
const splitPosition = dotPosition - SEPARATION_POSITION_SHIFT;
|
|
10
|
+
|
|
11
|
+
if (splitPosition > 0) {
|
|
12
|
+
head = filename.slice(0, splitPosition);
|
|
13
|
+
tail = filename.slice(splitPosition);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
return [head, tail];
|
|
17
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { GalleryImage, ImageMeta } from '../types';
|
|
2
|
+
|
|
3
|
+
export const PLACEHOLDER_WIDTH = 400;
|
|
4
|
+
export const PLACEHOLDER_HEIGHT = 300;
|
|
5
|
+
|
|
6
|
+
export const getImageKey = ({ name = '', src }: GalleryImage, index: number): string =>
|
|
7
|
+
`${name}-${index}-${src}`;
|
|
8
|
+
|
|
9
|
+
export const getImageAlt = ({ alt, name }: GalleryImage, index: number): string =>
|
|
10
|
+
alt || name || `Изображение ${index + 1}`;
|
|
11
|
+
|
|
12
|
+
export const isSmallImage = (meta?: ImageMeta) => {
|
|
13
|
+
if (!meta) {
|
|
14
|
+
return false;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
return meta.width < PLACEHOLDER_WIDTH && meta.height < PLACEHOLDER_HEIGHT;
|
|
18
|
+
};
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { ReactNode } from "react";
|
|
4
|
+
import { CloserProps } from "./index-ebda875c";
|
|
5
|
+
type NavigationBarProps = {
|
|
6
|
+
/**
|
|
7
|
+
* Контент шапки
|
|
8
|
+
*/
|
|
9
|
+
children?: ReactNode;
|
|
10
|
+
/**
|
|
11
|
+
* Заголовок шапки
|
|
12
|
+
*/
|
|
13
|
+
title?: string;
|
|
14
|
+
/**
|
|
15
|
+
* Подзаголовок (доступен только в мобильной версии)
|
|
16
|
+
*/
|
|
17
|
+
subtitle?: string;
|
|
18
|
+
/**
|
|
19
|
+
* Размер заголовка (compact доступен только в мобильной версии)
|
|
20
|
+
*/
|
|
21
|
+
titleSize?: 'default' | 'compact';
|
|
22
|
+
/**
|
|
23
|
+
* Доп. класс для аддонов
|
|
24
|
+
*/
|
|
25
|
+
addonClassName?: string;
|
|
26
|
+
/**
|
|
27
|
+
* Слот слева
|
|
28
|
+
*/
|
|
29
|
+
leftAddons?: ReactNode;
|
|
30
|
+
/**
|
|
31
|
+
* Слот справа
|
|
32
|
+
*/
|
|
33
|
+
rightAddons?: ReactNode;
|
|
34
|
+
/**
|
|
35
|
+
* Дополнительный класс для closer
|
|
36
|
+
*/
|
|
37
|
+
closerClassName?: string;
|
|
38
|
+
/**
|
|
39
|
+
* Слот снизу
|
|
40
|
+
*/
|
|
41
|
+
bottomAddons?: ReactNode;
|
|
42
|
+
/**
|
|
43
|
+
* Наличие компонента крестика
|
|
44
|
+
*/
|
|
45
|
+
hasCloser?: boolean;
|
|
46
|
+
/**
|
|
47
|
+
* Наличие кнопки "Назад"
|
|
48
|
+
*/
|
|
49
|
+
hasBackButton?: boolean;
|
|
50
|
+
/**
|
|
51
|
+
* Дополнительный класс для правого аддона
|
|
52
|
+
*/
|
|
53
|
+
backButtonClassName?: string;
|
|
54
|
+
/**
|
|
55
|
+
* Дополнительный класс
|
|
56
|
+
*/
|
|
57
|
+
className?: string;
|
|
58
|
+
/**
|
|
59
|
+
* Дополнительный класс для контента
|
|
60
|
+
*/
|
|
61
|
+
contentClassName?: string;
|
|
62
|
+
/**
|
|
63
|
+
* Дополнительный класс для нижнего аддона
|
|
64
|
+
*/
|
|
65
|
+
bottomAddonsClassName?: string;
|
|
66
|
+
/**
|
|
67
|
+
* Выравнивание заголовка
|
|
68
|
+
*/
|
|
69
|
+
align?: 'left' | 'center';
|
|
70
|
+
/**
|
|
71
|
+
* Обрезать ли заголовок
|
|
72
|
+
*/
|
|
73
|
+
trim?: boolean;
|
|
74
|
+
/**
|
|
75
|
+
* Фиксирует шапку
|
|
76
|
+
*/
|
|
77
|
+
sticky?: boolean;
|
|
78
|
+
/**
|
|
79
|
+
* Идентификатор для систем автоматизированного тестирования
|
|
80
|
+
*/
|
|
81
|
+
dataTestId?: string;
|
|
82
|
+
/**
|
|
83
|
+
* Фоновое изображение
|
|
84
|
+
*/
|
|
85
|
+
imageUrl?: string;
|
|
86
|
+
/**
|
|
87
|
+
* Иконка closer.
|
|
88
|
+
*/
|
|
89
|
+
closerIcon?: React.ElementType;
|
|
90
|
+
/**
|
|
91
|
+
* Обработчик закрытия
|
|
92
|
+
*/
|
|
93
|
+
onClose?: CloserProps['onClose'];
|
|
94
|
+
/**
|
|
95
|
+
* обработчик клика по кнопке "назад"
|
|
96
|
+
*/
|
|
97
|
+
onBack?: () => void;
|
|
98
|
+
/**
|
|
99
|
+
* Вид шапки - мобильный или десктоп
|
|
100
|
+
*/
|
|
101
|
+
view: 'desktop' | 'mobile';
|
|
102
|
+
/**
|
|
103
|
+
* Ссылка на родительскую ноду overflow: auto
|
|
104
|
+
*/
|
|
105
|
+
scrollableParentRef?: React.RefObject<HTMLDivElement>;
|
|
106
|
+
};
|
|
107
|
+
type ContentParams = {
|
|
108
|
+
extraClassName?: string;
|
|
109
|
+
wrapperRef?: React.RefObject<HTMLDivElement>;
|
|
110
|
+
style?: React.CSSProperties;
|
|
111
|
+
hidden?: boolean;
|
|
112
|
+
};
|
|
113
|
+
export { NavigationBarProps, ContentParams };
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import { AnchorHTMLAttributes, ButtonHTMLAttributes, ElementType, ReactNode } from 'react';
|
|
2
|
+
type StyleColors = {
|
|
3
|
+
default: {
|
|
4
|
+
[key: string]: string;
|
|
5
|
+
};
|
|
6
|
+
inverted: {
|
|
7
|
+
[key: string]: string;
|
|
8
|
+
};
|
|
9
|
+
};
|
|
10
|
+
type ComponentProps = {
|
|
11
|
+
/**
|
|
12
|
+
* Тип кнопки
|
|
13
|
+
* @default secondary
|
|
14
|
+
*/
|
|
15
|
+
view?: 'accent' | 'primary' | 'secondary' | 'tertiary' | 'outlined' | 'filled' | 'transparent' | 'link' | 'ghost';
|
|
16
|
+
/**
|
|
17
|
+
* Слот слева
|
|
18
|
+
*/
|
|
19
|
+
leftAddons?: ReactNode;
|
|
20
|
+
/**
|
|
21
|
+
* Слот справа
|
|
22
|
+
*/
|
|
23
|
+
rightAddons?: ReactNode;
|
|
24
|
+
/**
|
|
25
|
+
* Размер компонента
|
|
26
|
+
* @default m
|
|
27
|
+
*/
|
|
28
|
+
size?: 'xxs' | 'xs' | 's' | 'm' | 'l' | 'xl';
|
|
29
|
+
/**
|
|
30
|
+
* Растягивает компонент на ширину контейнера
|
|
31
|
+
* @default false
|
|
32
|
+
*/
|
|
33
|
+
block?: boolean;
|
|
34
|
+
/**
|
|
35
|
+
* Дополнительный класс
|
|
36
|
+
*/
|
|
37
|
+
className?: string;
|
|
38
|
+
/**
|
|
39
|
+
* Дополнительный класс для спиннера
|
|
40
|
+
*/
|
|
41
|
+
spinnerClassName?: string;
|
|
42
|
+
/**
|
|
43
|
+
* Выводит ссылку в виде кнопки
|
|
44
|
+
*/
|
|
45
|
+
href?: string;
|
|
46
|
+
/**
|
|
47
|
+
* Позволяет использовать кастомный компонент для кнопки (например Link из роутера)
|
|
48
|
+
*/
|
|
49
|
+
Component?: ElementType;
|
|
50
|
+
/**
|
|
51
|
+
* Идентификатор для систем автоматизированного тестирования
|
|
52
|
+
*/
|
|
53
|
+
dataTestId?: string;
|
|
54
|
+
/**
|
|
55
|
+
* Показать лоадер
|
|
56
|
+
* @default false
|
|
57
|
+
*/
|
|
58
|
+
loading?: boolean;
|
|
59
|
+
/**
|
|
60
|
+
* Не переносить текст кнопки на новую строку
|
|
61
|
+
* @default false
|
|
62
|
+
*/
|
|
63
|
+
nowrap?: boolean;
|
|
64
|
+
/**
|
|
65
|
+
* Набор цветов для компонента
|
|
66
|
+
*/
|
|
67
|
+
colors?: 'default' | 'inverted';
|
|
68
|
+
/**
|
|
69
|
+
* Дочерние элементы.
|
|
70
|
+
*/
|
|
71
|
+
children?: ReactNode;
|
|
72
|
+
/**
|
|
73
|
+
* Основные стили компонента.
|
|
74
|
+
*/
|
|
75
|
+
styles: {
|
|
76
|
+
[key: string]: string;
|
|
77
|
+
};
|
|
78
|
+
/**
|
|
79
|
+
* Стили компонента для default и inverted режима.
|
|
80
|
+
*/
|
|
81
|
+
colorStylesMap: StyleColors;
|
|
82
|
+
};
|
|
83
|
+
type AnchorBaseButtonProps = ComponentProps & AnchorHTMLAttributes<HTMLAnchorElement>;
|
|
84
|
+
type NativeBaseButtonProps = ComponentProps & ButtonHTMLAttributes<HTMLButtonElement>;
|
|
85
|
+
type BaseButtonProps = Partial<AnchorBaseButtonProps | NativeBaseButtonProps>;
|
|
86
|
+
type AnchorButtonProps = Omit<BaseButtonProps, 'styles' | 'colorStylesMap'> & AnchorHTMLAttributes<HTMLAnchorElement>;
|
|
87
|
+
type NativeButtonProps = Omit<BaseButtonProps, 'styles' | 'colorStylesMap'> & ButtonHTMLAttributes<HTMLButtonElement>;
|
|
88
|
+
type ButtonProps = Partial<AnchorButtonProps | NativeButtonProps> & {
|
|
89
|
+
/**
|
|
90
|
+
* Контрольная точка, с нее начинается desktop версия
|
|
91
|
+
* @default 1024
|
|
92
|
+
*/
|
|
93
|
+
breakpoint?: number;
|
|
94
|
+
};
|
|
95
|
+
export { StyleColors, ComponentProps, AnchorBaseButtonProps, NativeBaseButtonProps, BaseButtonProps, AnchorButtonProps, NativeButtonProps, ButtonProps };
|
package/buttons-a0cf7676.d.ts
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { FC, MutableRefObject } from 'react';
|
|
2
|
-
import { IconButtonProps } from "@alfalab/core-components-icon-button";
|
|
3
|
-
type Props = Omit<IconButtonProps, 'icon' | 'colors'> & {
|
|
4
|
-
buttonRef?: MutableRefObject<HTMLButtonElement | null>;
|
|
5
|
-
download?: string | boolean;
|
|
6
|
-
};
|
|
7
|
-
declare const Fullscreen: FC<Props>;
|
|
8
|
-
declare const ExitFullscreen: FC<Props>;
|
|
9
|
-
declare const Download: FC<Props>;
|
|
10
|
-
declare const Exit: FC<Props>;
|
|
11
|
-
export { Fullscreen, ExitFullscreen, Download, Exit };
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { FC, MutableRefObject } from 'react';
|
|
2
|
-
import { IconButtonProps } from "@alfalab/core-components-icon-button";
|
|
3
|
-
type Props = Omit<IconButtonProps, 'icon' | 'colors'> & {
|
|
4
|
-
buttonRef?: MutableRefObject<HTMLButtonElement | null>;
|
|
5
|
-
download?: string | boolean;
|
|
6
|
-
};
|
|
7
|
-
declare const Fullscreen: FC<Props>;
|
|
8
|
-
declare const ExitFullscreen: FC<Props>;
|
|
9
|
-
declare const Download: FC<Props>;
|
|
10
|
-
declare const Exit: FC<Props>;
|
|
11
|
-
export { Fullscreen, ExitFullscreen, Download, Exit };
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { FC, MutableRefObject } from 'react';
|
|
2
|
-
import { IconButtonProps } from "@alfalab/core-components-icon-button";
|
|
3
|
-
type Props = Omit<IconButtonProps, 'icon' | 'colors'> & {
|
|
4
|
-
buttonRef?: MutableRefObject<HTMLButtonElement | null>;
|
|
5
|
-
download?: string | boolean;
|
|
6
|
-
};
|
|
7
|
-
declare const Fullscreen: FC<Props>;
|
|
8
|
-
declare const ExitFullscreen: FC<Props>;
|
|
9
|
-
declare const Download: FC<Props>;
|
|
10
|
-
declare const Exit: FC<Props>;
|
|
11
|
-
export { Fullscreen, ExitFullscreen, Download, Exit };
|
|
File without changes
|
|
File without changes
|
|
File without changes
|