@ozen-ui/kit 0.77.0 → 0.78.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/__inner__/cjs/components/DrawerNext/types.d.ts +2 -1
- package/__inner__/cjs/components/ImageBase/ImageBase.css +24 -0
- package/__inner__/cjs/components/ImageBase/ImageBase.d.ts +4 -0
- package/__inner__/cjs/components/ImageBase/ImageBase.js +46 -0
- package/__inner__/cjs/components/ImageBase/components/ImageBasePicture/ImageBasePicture.d.ts +3 -0
- package/__inner__/cjs/components/ImageBase/components/ImageBasePicture/ImageBasePicture.js +21 -0
- package/__inner__/cjs/components/ImageBase/components/ImageBasePicture/index.d.ts +2 -0
- package/__inner__/cjs/components/ImageBase/components/ImageBasePicture/index.js +5 -0
- package/__inner__/cjs/components/ImageBase/components/ImageBasePicture/types.d.ts +7 -0
- package/__inner__/cjs/components/ImageBase/components/ImageBasePicture/types.js +2 -0
- package/__inner__/cjs/components/ImageBase/components/index.d.ts +1 -0
- package/__inner__/cjs/components/ImageBase/components/index.js +4 -0
- package/__inner__/cjs/components/ImageBase/constants.d.ts +1 -0
- package/__inner__/cjs/components/ImageBase/constants.js +4 -0
- package/__inner__/cjs/components/ImageBase/entities/aspectRatio.d.ts +1 -0
- package/__inner__/cjs/components/ImageBase/entities/aspectRatio.js +2 -0
- package/__inner__/cjs/components/ImageBase/entities/imageRef.d.ts +2 -0
- package/__inner__/cjs/components/ImageBase/entities/imageRef.js +2 -0
- package/__inner__/cjs/components/ImageBase/entities/index.d.ts +3 -0
- package/__inner__/cjs/components/ImageBase/entities/index.js +6 -0
- package/__inner__/cjs/components/ImageBase/entities/source.d.ts +7 -0
- package/__inner__/cjs/components/ImageBase/entities/source.js +2 -0
- package/__inner__/cjs/components/ImageBase/hooks/index.d.ts +1 -0
- package/__inner__/cjs/components/ImageBase/hooks/index.js +4 -0
- package/__inner__/cjs/components/ImageBase/hooks/useImageBaseStatus.d.ts +7 -0
- package/__inner__/cjs/components/ImageBase/hooks/useImageBaseStatus.js +36 -0
- package/__inner__/cjs/components/ImageBase/index.d.ts +5 -0
- package/__inner__/cjs/components/ImageBase/index.js +8 -0
- package/__inner__/cjs/components/ImageBase/modules/ImageBaseLoader/ImageBaseLoader.d.ts +4 -0
- package/__inner__/cjs/components/ImageBase/modules/ImageBaseLoader/ImageBaseLoader.js +13 -0
- package/__inner__/cjs/components/ImageBase/modules/ImageBaseLoader/index.d.ts +2 -0
- package/__inner__/cjs/components/ImageBase/modules/ImageBaseLoader/index.js +5 -0
- package/__inner__/cjs/components/ImageBase/modules/ImageBaseLoader/types.d.ts +2 -0
- package/__inner__/cjs/components/ImageBase/modules/ImageBaseLoader/types.js +2 -0
- package/__inner__/cjs/components/ImageBase/modules/index.d.ts +1 -0
- package/__inner__/cjs/components/ImageBase/modules/index.js +4 -0
- package/__inner__/cjs/components/ImageBase/types.d.ts +26 -0
- package/__inner__/cjs/components/ImageBase/types.js +2 -0
- package/__inner__/cjs/components/StepperVertical/modules/StepperVerticalStep/StepperVerticalStep.css +1 -1
- package/__inner__/esm/components/DrawerNext/types.d.ts +2 -1
- package/__inner__/esm/components/ImageBase/ImageBase.css +24 -0
- package/__inner__/esm/components/ImageBase/ImageBase.d.ts +4 -0
- package/__inner__/esm/components/ImageBase/ImageBase.js +43 -0
- package/__inner__/esm/components/ImageBase/components/ImageBasePicture/ImageBasePicture.d.ts +3 -0
- package/__inner__/esm/components/ImageBase/components/ImageBasePicture/ImageBasePicture.js +17 -0
- package/__inner__/esm/components/ImageBase/components/ImageBasePicture/index.d.ts +2 -0
- package/__inner__/esm/components/ImageBase/components/ImageBasePicture/index.js +2 -0
- package/__inner__/esm/components/ImageBase/components/ImageBasePicture/types.d.ts +7 -0
- package/__inner__/esm/components/ImageBase/components/ImageBasePicture/types.js +1 -0
- package/__inner__/esm/components/ImageBase/components/index.d.ts +1 -0
- package/__inner__/esm/components/ImageBase/components/index.js +1 -0
- package/__inner__/esm/components/ImageBase/constants.d.ts +1 -0
- package/__inner__/esm/components/ImageBase/constants.js +1 -0
- package/__inner__/esm/components/ImageBase/entities/aspectRatio.d.ts +1 -0
- package/__inner__/esm/components/ImageBase/entities/aspectRatio.js +1 -0
- package/__inner__/esm/components/ImageBase/entities/imageRef.d.ts +2 -0
- package/__inner__/esm/components/ImageBase/entities/imageRef.js +1 -0
- package/__inner__/esm/components/ImageBase/entities/index.d.ts +3 -0
- package/__inner__/esm/components/ImageBase/entities/index.js +3 -0
- package/__inner__/esm/components/ImageBase/entities/source.d.ts +7 -0
- package/__inner__/esm/components/ImageBase/entities/source.js +1 -0
- package/__inner__/esm/components/ImageBase/hooks/index.d.ts +1 -0
- package/__inner__/esm/components/ImageBase/hooks/index.js +1 -0
- package/__inner__/esm/components/ImageBase/hooks/useImageBaseStatus.d.ts +7 -0
- package/__inner__/esm/components/ImageBase/hooks/useImageBaseStatus.js +32 -0
- package/__inner__/esm/components/ImageBase/index.d.ts +5 -0
- package/__inner__/esm/components/ImageBase/index.js +5 -0
- package/__inner__/esm/components/ImageBase/modules/ImageBaseLoader/ImageBaseLoader.d.ts +4 -0
- package/__inner__/esm/components/ImageBase/modules/ImageBaseLoader/ImageBaseLoader.js +9 -0
- package/__inner__/esm/components/ImageBase/modules/ImageBaseLoader/index.d.ts +2 -0
- package/__inner__/esm/components/ImageBase/modules/ImageBaseLoader/index.js +2 -0
- package/__inner__/esm/components/ImageBase/modules/ImageBaseLoader/types.d.ts +2 -0
- package/__inner__/esm/components/ImageBase/modules/ImageBaseLoader/types.js +1 -0
- package/__inner__/esm/components/ImageBase/modules/index.d.ts +1 -0
- package/__inner__/esm/components/ImageBase/modules/index.js +1 -0
- package/__inner__/esm/components/ImageBase/types.d.ts +26 -0
- package/__inner__/esm/components/ImageBase/types.js +1 -0
- package/__inner__/esm/components/StepperVertical/modules/StepperVerticalStep/StepperVerticalStep.css +1 -1
- package/package.json +5 -4
|
@@ -27,4 +27,5 @@ export type DrawerDeviceTypeProps<DeviceType extends DrawerDeviceType | undefine
|
|
|
27
27
|
/** Тип устройства */
|
|
28
28
|
deviceType?: undefined;
|
|
29
29
|
});
|
|
30
|
-
export type
|
|
30
|
+
export type DrawerOmittedProps<OmittingKeys extends keyof DrawerBaseProps | ''> = Omit<DrawerDeviceTypeProps<'mobile'>, OmittingKeys> | Omit<DrawerDeviceTypeProps<'desktop'>, OmittingKeys> | Omit<DrawerDeviceTypeProps<undefined>, OmittingKeys>;
|
|
31
|
+
export type DrawerProps = DrawerOmittedProps<''>;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
.ImageBase {
|
|
2
|
+
position: relative;
|
|
3
|
+
inline-size: 100%;
|
|
4
|
+
overflow: hidden;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
.ImageBase-Image {
|
|
8
|
+
position: absolute;
|
|
9
|
+
display: block;
|
|
10
|
+
inline-size: 100%;
|
|
11
|
+
block-size: 100%;
|
|
12
|
+
object-fit: contain;
|
|
13
|
+
object-position: center;
|
|
14
|
+
opacity: 1;
|
|
15
|
+
transition: var(--transition-default) opacity ease-in;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
.ImageBase-Loader, .ImageBase-Placeholder {
|
|
19
|
+
position: absolute;
|
|
20
|
+
inset-block-start: 0;
|
|
21
|
+
inset-inline-start: 0;
|
|
22
|
+
inline-size: 100%;
|
|
23
|
+
block-size: 100%;
|
|
24
|
+
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import './ImageBase.css';
|
|
2
|
+
import type { ImageBaseBaseProps } from './types';
|
|
3
|
+
export declare const cnImageBase: import("@bem-react/classname").ClassNameFormatter;
|
|
4
|
+
export declare const ImageBase: import("../../utils").PolymorphicComponentWithRef<ImageBaseBaseProps, "div", "as">;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ImageBase = exports.cnImageBase = void 0;
|
|
4
|
+
var tslib_1 = require("tslib");
|
|
5
|
+
require("./ImageBase.css");
|
|
6
|
+
var react_1 = tslib_1.__importDefault(require("react"));
|
|
7
|
+
var logger_1 = require("@ozen-ui/logger");
|
|
8
|
+
var framer_motion_1 = require("framer-motion");
|
|
9
|
+
var utils_1 = require("../../utils");
|
|
10
|
+
var components_1 = require("./components");
|
|
11
|
+
var constants_1 = require("./constants");
|
|
12
|
+
var hooks_1 = require("./hooks");
|
|
13
|
+
var modules_1 = require("./modules");
|
|
14
|
+
exports.cnImageBase = (0, utils_1.cn)('ImageBase');
|
|
15
|
+
exports.ImageBase = (0, utils_1.polymorphicComponentWithRef)(function (_a, ref) {
|
|
16
|
+
var className = _a.className, src = _a.src, _b = _a.as, Tag = _b === void 0 ? constants_1.IMAGE_BASE_DEFAULT_ELEMENT : _b, alt = _a.alt, placeholder = _a.placeholder, _c = _a.loading, loading = _c === void 0 ? 'lazy' : _c, _d = _a.loader, loader = _d === void 0 ? react_1.default.createElement(modules_1.ImageBaseLoader, null) : _d, style = _a.style, _e = _a.decoding, decoding = _e === void 0 ? 'async' : _e, aspectRatio = _a.aspectRatio, sources = _a.sources, pictureRef = _a.pictureRef, imgRef = _a.imgRef, other = tslib_1.__rest(_a, ["className", "src", "as", "alt", "placeholder", "loading", "loader", "style", "decoding", "aspectRatio", "sources", "pictureRef", "imgRef"]);
|
|
17
|
+
var _f = (0, hooks_1.useImageBaseStatus)(src), onLoad = _f.onLoad, onError = _f.onError, isError = _f.isError, isLoading = _f.isLoading;
|
|
18
|
+
var paddingBottom = (function () {
|
|
19
|
+
if (!aspectRatio) {
|
|
20
|
+
return undefined;
|
|
21
|
+
}
|
|
22
|
+
var _a = tslib_1.__read(aspectRatio.split('x'), 2), width = _a[0], height = _a[1];
|
|
23
|
+
if (!width || !height) {
|
|
24
|
+
logger_1.logger.error("\u041D\u0435\u0432\u0435\u0440\u043D\u043E \u043F\u0435\u0440\u0435\u0434\u0430\u043D \"aspectRatio\", \u043E\u043D \u0434\u043E\u043B\u0436\u0435\u043D \u0431\u044B\u0442\u044C \u0432 \u0444\u043E\u0440\u043C\u0430\u0442\u0435 `${number}x${number}`");
|
|
25
|
+
return undefined;
|
|
26
|
+
}
|
|
27
|
+
return "".concat((Number.parseFloat(height) / Number.parseFloat(width)) * 100, "%");
|
|
28
|
+
})();
|
|
29
|
+
var isShowPlaceholder = !!placeholder && (isError || !src);
|
|
30
|
+
var isShowLoader = isLoading && !isShowPlaceholder && !!src;
|
|
31
|
+
return (react_1.default.createElement(Tag, tslib_1.__assign({}, other, { ref: ref, role: "img", className: (0, exports.cnImageBase)('', className), style: tslib_1.__assign(tslib_1.__assign({}, style), { paddingBlockEnd: paddingBottom }) }),
|
|
32
|
+
react_1.default.createElement(framer_motion_1.AnimatePresence, null, isShowLoader && (react_1.default.createElement(framer_motion_1.motion.div, { className: (0, exports.cnImageBase)('Loader'), initial: "hidden", animate: "visible", exit: "hidden", variants: {
|
|
33
|
+
visible: { opacity: 1 },
|
|
34
|
+
hidden: { opacity: 0 },
|
|
35
|
+
} }, loader))),
|
|
36
|
+
react_1.default.createElement(framer_motion_1.AnimatePresence, null, isShowPlaceholder && (react_1.default.createElement(framer_motion_1.motion.div, { className: (0, exports.cnImageBase)('Placeholder'), initial: "hidden", animate: "visible", exit: "hidden", variants: {
|
|
37
|
+
visible: { opacity: 1 },
|
|
38
|
+
hidden: { opacity: 0 },
|
|
39
|
+
} }, placeholder))),
|
|
40
|
+
src && (react_1.default.createElement(components_1.ImageBasePicture, { ref: pictureRef, sources: sources },
|
|
41
|
+
react_1.default.createElement(framer_motion_1.motion.img, { key: src, ref: imgRef, className: (0, exports.cnImageBase)('Image'), onLoad: onLoad, onError: onError, alt: alt, src: src, decoding: decoding, loading: loading, initial: "hidden", animate: isShowLoader || isShowPlaceholder ? 'hidden' : 'visible', variants: {
|
|
42
|
+
visible: { opacity: 1 },
|
|
43
|
+
hidden: { opacity: 0 },
|
|
44
|
+
} })))));
|
|
45
|
+
});
|
|
46
|
+
exports.ImageBase.displayName = 'ImageBase';
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ImageBasePicture = void 0;
|
|
4
|
+
var tslib_1 = require("tslib");
|
|
5
|
+
var react_1 = tslib_1.__importStar(require("react"));
|
|
6
|
+
var utils_1 = require("../../../../utils");
|
|
7
|
+
exports.ImageBasePicture = (0, react_1.forwardRef)(function (_a, ref) {
|
|
8
|
+
var children = _a.children, sources = _a.sources;
|
|
9
|
+
if (sources) {
|
|
10
|
+
return (react_1.default.createElement("picture", { ref: ref },
|
|
11
|
+
sources.map(function (sourceInfo) {
|
|
12
|
+
if ((0, utils_1.isString)(sourceInfo)) {
|
|
13
|
+
return react_1.default.createElement("source", { key: sourceInfo, srcSet: sourceInfo });
|
|
14
|
+
}
|
|
15
|
+
return (react_1.default.createElement("source", { key: sourceInfo.srcSet, srcSet: sourceInfo.srcSet, type: sourceInfo.type, media: sourceInfo.media }));
|
|
16
|
+
}),
|
|
17
|
+
children));
|
|
18
|
+
}
|
|
19
|
+
return children;
|
|
20
|
+
});
|
|
21
|
+
exports.ImageBasePicture.displayName = 'ImageBasePicture';
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { ComponentRef, ReactNode } from 'react';
|
|
2
|
+
import type { ImageBaseSources } from '../../entities';
|
|
3
|
+
export type ImageBasePictureRef = ComponentRef<'picture'>;
|
|
4
|
+
export type ImageBasePictureProps = {
|
|
5
|
+
children: ReactNode;
|
|
6
|
+
sources: ImageBaseSources | undefined;
|
|
7
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './ImageBasePicture';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const IMAGE_BASE_DEFAULT_ELEMENT = "div";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type ImageBaseAspectRatio = `${number}x${number}`;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
var tslib_1 = require("tslib");
|
|
4
|
+
tslib_1.__exportStar(require("./aspectRatio"), exports);
|
|
5
|
+
tslib_1.__exportStar(require("./imageRef"), exports);
|
|
6
|
+
tslib_1.__exportStar(require("./source"), exports);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './useImageBaseStatus';
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useImageBaseStatus = void 0;
|
|
4
|
+
var tslib_1 = require("tslib");
|
|
5
|
+
var react_1 = require("react");
|
|
6
|
+
var useStoredValue_1 = require("../../../hooks/useStoredValue");
|
|
7
|
+
var useImageBaseStatus = function (src) {
|
|
8
|
+
var lastFinishedSrc = (0, useStoredValue_1.useStoredValue)(null);
|
|
9
|
+
var _a = tslib_1.__read((0, react_1.useState)(src ? 'loading' : 'error'), 2), status = _a[0], setStatus = _a[1];
|
|
10
|
+
var onLoad = function () {
|
|
11
|
+
setStatus('loaded');
|
|
12
|
+
lastFinishedSrc.current = src;
|
|
13
|
+
};
|
|
14
|
+
var onError = function () {
|
|
15
|
+
setStatus('error');
|
|
16
|
+
lastFinishedSrc.current = src;
|
|
17
|
+
};
|
|
18
|
+
var isError = status === 'error';
|
|
19
|
+
var isLoaded = status === 'loaded';
|
|
20
|
+
var isLoading = status === 'loading';
|
|
21
|
+
(0, react_1.useEffect)(function () {
|
|
22
|
+
var isAlreadyFinished = lastFinishedSrc.current === src;
|
|
23
|
+
if (isAlreadyFinished) {
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
setStatus('loading');
|
|
27
|
+
}, [src]);
|
|
28
|
+
return {
|
|
29
|
+
onLoad: onLoad,
|
|
30
|
+
onError: onError,
|
|
31
|
+
isError: isError,
|
|
32
|
+
isLoaded: isLoaded,
|
|
33
|
+
isLoading: isLoading,
|
|
34
|
+
};
|
|
35
|
+
};
|
|
36
|
+
exports.useImageBaseStatus = useImageBaseStatus;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
var tslib_1 = require("tslib");
|
|
4
|
+
tslib_1.__exportStar(require("./entities"), exports);
|
|
5
|
+
tslib_1.__exportStar(require("./modules"), exports);
|
|
6
|
+
tslib_1.__exportStar(require("./constants"), exports);
|
|
7
|
+
tslib_1.__exportStar(require("./ImageBase"), exports);
|
|
8
|
+
tslib_1.__exportStar(require("./types"), exports);
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { ImageBaseLoaderProps } from './types';
|
|
3
|
+
export declare const cnImageBaseLoader: import("@bem-react/classname").ClassNameFormatter;
|
|
4
|
+
export declare const ImageBaseLoader: ({ className, ...other }: ImageBaseLoaderProps) => React.JSX.Element;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ImageBaseLoader = exports.cnImageBaseLoader = void 0;
|
|
4
|
+
var tslib_1 = require("tslib");
|
|
5
|
+
var react_1 = tslib_1.__importDefault(require("react"));
|
|
6
|
+
var utils_1 = require("../../../../utils");
|
|
7
|
+
var Skeleton_1 = require("../../../Skeleton");
|
|
8
|
+
exports.cnImageBaseLoader = (0, utils_1.cn)('ImageBaseLoader');
|
|
9
|
+
var ImageBaseLoader = function (_a) {
|
|
10
|
+
var className = _a.className, other = tslib_1.__rest(_a, ["className"]);
|
|
11
|
+
return (react_1.default.createElement(Skeleton_1.Skeleton, tslib_1.__assign({ variant: "rectangular", className: (0, exports.cnImageBaseLoader)('', className), height: "100%" }, other)));
|
|
12
|
+
};
|
|
13
|
+
exports.ImageBaseLoader = ImageBaseLoader;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './ImageBaseLoader';
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { ComponentPropsWithRef, ComponentRef, ElementType, ForwardedRef, ReactNode } from 'react';
|
|
2
|
+
import type { ExtendableComponentPropsWithRef } from '../../types';
|
|
3
|
+
import type { PolymorphicComponentPropsWithRef } from '../../utils';
|
|
4
|
+
import type { ImageBasePictureRef } from './components';
|
|
5
|
+
import type { IMAGE_BASE_DEFAULT_ELEMENT } from './constants';
|
|
6
|
+
import type { ImageBaseAspectRatio, ImageBaseImageRef, ImageBaseSources } from './entities';
|
|
7
|
+
export type ImageBaseBaseProps = ExtendableComponentPropsWithRef<{
|
|
8
|
+
/** Путь к картинке */
|
|
9
|
+
src: string;
|
|
10
|
+
/** Компонент, который отображается при ошибке загрузки изображения */
|
|
11
|
+
placeholder?: ReactNode;
|
|
12
|
+
/** Компонент, который отображается при загрузке изображения */
|
|
13
|
+
loader?: ReactNode;
|
|
14
|
+
/** Соотношения сторон изображения */
|
|
15
|
+
aspectRatio?: ImageBaseAspectRatio | null;
|
|
16
|
+
/** HTML-sources */
|
|
17
|
+
sources?: ImageBaseSources;
|
|
18
|
+
/** Ref изображения */
|
|
19
|
+
imgRef?: ForwardedRef<ImageBaseImageRef>;
|
|
20
|
+
/** Ref picture-элемента */
|
|
21
|
+
pictureRef?: ForwardedRef<ImageBasePictureRef>;
|
|
22
|
+
/** Идентификатор компонента для тестов */
|
|
23
|
+
'data-testid'?: string;
|
|
24
|
+
} & Pick<ComponentPropsWithRef<'img'>, 'alt' | 'loading' | 'decoding'>, 'div'>;
|
|
25
|
+
export type ImageBaseRef<As extends ElementType = typeof IMAGE_BASE_DEFAULT_ELEMENT> = ComponentRef<As>;
|
|
26
|
+
export type ImageBaseProps<As extends ElementType = typeof IMAGE_BASE_DEFAULT_ELEMENT> = PolymorphicComponentPropsWithRef<ImageBaseBaseProps, As>;
|
package/__inner__/cjs/components/StepperVertical/modules/StepperVerticalStep/StepperVerticalStep.css
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
.StepperVerticalStep {
|
|
2
2
|
--stepper-vertical-indicator-icon-size: 24px;
|
|
3
|
-
--stepper-vertical-indicator-icon-inset-top: var(--spacing-
|
|
3
|
+
--stepper-vertical-indicator-icon-inset-top: var(--spacing-xs);
|
|
4
4
|
--stepper-vertical-indicator-color-non-current: transparent;
|
|
5
5
|
--stepper-vertical-indicator-color-current: transparent;
|
|
6
6
|
--stepper-vertical-indicator-color: var(--stepper-vertical-indicator-color-non-current);
|
|
@@ -27,4 +27,5 @@ export type DrawerDeviceTypeProps<DeviceType extends DrawerDeviceType | undefine
|
|
|
27
27
|
/** Тип устройства */
|
|
28
28
|
deviceType?: undefined;
|
|
29
29
|
});
|
|
30
|
-
export type
|
|
30
|
+
export type DrawerOmittedProps<OmittingKeys extends keyof DrawerBaseProps | ''> = Omit<DrawerDeviceTypeProps<'mobile'>, OmittingKeys> | Omit<DrawerDeviceTypeProps<'desktop'>, OmittingKeys> | Omit<DrawerDeviceTypeProps<undefined>, OmittingKeys>;
|
|
31
|
+
export type DrawerProps = DrawerOmittedProps<''>;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
.ImageBase {
|
|
2
|
+
position: relative;
|
|
3
|
+
inline-size: 100%;
|
|
4
|
+
overflow: hidden;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
.ImageBase-Image {
|
|
8
|
+
position: absolute;
|
|
9
|
+
display: block;
|
|
10
|
+
inline-size: 100%;
|
|
11
|
+
block-size: 100%;
|
|
12
|
+
object-fit: contain;
|
|
13
|
+
object-position: center;
|
|
14
|
+
opacity: 1;
|
|
15
|
+
transition: var(--transition-default) opacity ease-in;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
.ImageBase-Loader, .ImageBase-Placeholder {
|
|
19
|
+
position: absolute;
|
|
20
|
+
inset-block-start: 0;
|
|
21
|
+
inset-inline-start: 0;
|
|
22
|
+
inline-size: 100%;
|
|
23
|
+
block-size: 100%;
|
|
24
|
+
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import './ImageBase.css';
|
|
2
|
+
import type { ImageBaseBaseProps } from './types';
|
|
3
|
+
export declare const cnImageBase: import("@bem-react/classname").ClassNameFormatter;
|
|
4
|
+
export declare const ImageBase: import("../../utils").PolymorphicComponentWithRef<ImageBaseBaseProps, "div", "as">;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { __assign, __read, __rest } from "tslib";
|
|
2
|
+
import './ImageBase.css';
|
|
3
|
+
import React from 'react';
|
|
4
|
+
import { logger } from '@ozen-ui/logger';
|
|
5
|
+
import { AnimatePresence, motion } from 'framer-motion';
|
|
6
|
+
import { cn, polymorphicComponentWithRef } from '../../utils';
|
|
7
|
+
import { ImageBasePicture } from './components';
|
|
8
|
+
import { IMAGE_BASE_DEFAULT_ELEMENT } from './constants';
|
|
9
|
+
import { useImageBaseStatus } from './hooks';
|
|
10
|
+
import { ImageBaseLoader } from './modules';
|
|
11
|
+
export var cnImageBase = cn('ImageBase');
|
|
12
|
+
export var ImageBase = polymorphicComponentWithRef(function (_a, ref) {
|
|
13
|
+
var className = _a.className, src = _a.src, _b = _a.as, Tag = _b === void 0 ? IMAGE_BASE_DEFAULT_ELEMENT : _b, alt = _a.alt, placeholder = _a.placeholder, _c = _a.loading, loading = _c === void 0 ? 'lazy' : _c, _d = _a.loader, loader = _d === void 0 ? React.createElement(ImageBaseLoader, null) : _d, style = _a.style, _e = _a.decoding, decoding = _e === void 0 ? 'async' : _e, aspectRatio = _a.aspectRatio, sources = _a.sources, pictureRef = _a.pictureRef, imgRef = _a.imgRef, other = __rest(_a, ["className", "src", "as", "alt", "placeholder", "loading", "loader", "style", "decoding", "aspectRatio", "sources", "pictureRef", "imgRef"]);
|
|
14
|
+
var _f = useImageBaseStatus(src), onLoad = _f.onLoad, onError = _f.onError, isError = _f.isError, isLoading = _f.isLoading;
|
|
15
|
+
var paddingBottom = (function () {
|
|
16
|
+
if (!aspectRatio) {
|
|
17
|
+
return undefined;
|
|
18
|
+
}
|
|
19
|
+
var _a = __read(aspectRatio.split('x'), 2), width = _a[0], height = _a[1];
|
|
20
|
+
if (!width || !height) {
|
|
21
|
+
logger.error("\u041D\u0435\u0432\u0435\u0440\u043D\u043E \u043F\u0435\u0440\u0435\u0434\u0430\u043D \"aspectRatio\", \u043E\u043D \u0434\u043E\u043B\u0436\u0435\u043D \u0431\u044B\u0442\u044C \u0432 \u0444\u043E\u0440\u043C\u0430\u0442\u0435 `${number}x${number}`");
|
|
22
|
+
return undefined;
|
|
23
|
+
}
|
|
24
|
+
return "".concat((Number.parseFloat(height) / Number.parseFloat(width)) * 100, "%");
|
|
25
|
+
})();
|
|
26
|
+
var isShowPlaceholder = !!placeholder && (isError || !src);
|
|
27
|
+
var isShowLoader = isLoading && !isShowPlaceholder && !!src;
|
|
28
|
+
return (React.createElement(Tag, __assign({}, other, { ref: ref, role: "img", className: cnImageBase('', className), style: __assign(__assign({}, style), { paddingBlockEnd: paddingBottom }) }),
|
|
29
|
+
React.createElement(AnimatePresence, null, isShowLoader && (React.createElement(motion.div, { className: cnImageBase('Loader'), initial: "hidden", animate: "visible", exit: "hidden", variants: {
|
|
30
|
+
visible: { opacity: 1 },
|
|
31
|
+
hidden: { opacity: 0 },
|
|
32
|
+
} }, loader))),
|
|
33
|
+
React.createElement(AnimatePresence, null, isShowPlaceholder && (React.createElement(motion.div, { className: cnImageBase('Placeholder'), initial: "hidden", animate: "visible", exit: "hidden", variants: {
|
|
34
|
+
visible: { opacity: 1 },
|
|
35
|
+
hidden: { opacity: 0 },
|
|
36
|
+
} }, placeholder))),
|
|
37
|
+
src && (React.createElement(ImageBasePicture, { ref: pictureRef, sources: sources },
|
|
38
|
+
React.createElement(motion.img, { key: src, ref: imgRef, className: cnImageBase('Image'), onLoad: onLoad, onError: onError, alt: alt, src: src, decoding: decoding, loading: loading, initial: "hidden", animate: isShowLoader || isShowPlaceholder ? 'hidden' : 'visible', variants: {
|
|
39
|
+
visible: { opacity: 1 },
|
|
40
|
+
hidden: { opacity: 0 },
|
|
41
|
+
} })))));
|
|
42
|
+
});
|
|
43
|
+
ImageBase.displayName = 'ImageBase';
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import React, { forwardRef } from 'react';
|
|
2
|
+
import { isString } from '../../../../utils';
|
|
3
|
+
export var ImageBasePicture = forwardRef(function (_a, ref) {
|
|
4
|
+
var children = _a.children, sources = _a.sources;
|
|
5
|
+
if (sources) {
|
|
6
|
+
return (React.createElement("picture", { ref: ref },
|
|
7
|
+
sources.map(function (sourceInfo) {
|
|
8
|
+
if (isString(sourceInfo)) {
|
|
9
|
+
return React.createElement("source", { key: sourceInfo, srcSet: sourceInfo });
|
|
10
|
+
}
|
|
11
|
+
return (React.createElement("source", { key: sourceInfo.srcSet, srcSet: sourceInfo.srcSet, type: sourceInfo.type, media: sourceInfo.media }));
|
|
12
|
+
}),
|
|
13
|
+
children));
|
|
14
|
+
}
|
|
15
|
+
return children;
|
|
16
|
+
});
|
|
17
|
+
ImageBasePicture.displayName = 'ImageBasePicture';
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { ComponentRef, ReactNode } from 'react';
|
|
2
|
+
import type { ImageBaseSources } from '../../entities';
|
|
3
|
+
export type ImageBasePictureRef = ComponentRef<'picture'>;
|
|
4
|
+
export type ImageBasePictureProps = {
|
|
5
|
+
children: ReactNode;
|
|
6
|
+
sources: ImageBaseSources | undefined;
|
|
7
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './ImageBasePicture';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './ImageBasePicture';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const IMAGE_BASE_DEFAULT_ELEMENT = "div";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export var IMAGE_BASE_DEFAULT_ELEMENT = 'div';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type ImageBaseAspectRatio = `${number}x${number}`;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './useImageBaseStatus';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './useImageBaseStatus';
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { __read } from "tslib";
|
|
2
|
+
import { useEffect, useState } from 'react';
|
|
3
|
+
import { useStoredValue } from '../../../hooks/useStoredValue';
|
|
4
|
+
export var useImageBaseStatus = function (src) {
|
|
5
|
+
var lastFinishedSrc = useStoredValue(null);
|
|
6
|
+
var _a = __read(useState(src ? 'loading' : 'error'), 2), status = _a[0], setStatus = _a[1];
|
|
7
|
+
var onLoad = function () {
|
|
8
|
+
setStatus('loaded');
|
|
9
|
+
lastFinishedSrc.current = src;
|
|
10
|
+
};
|
|
11
|
+
var onError = function () {
|
|
12
|
+
setStatus('error');
|
|
13
|
+
lastFinishedSrc.current = src;
|
|
14
|
+
};
|
|
15
|
+
var isError = status === 'error';
|
|
16
|
+
var isLoaded = status === 'loaded';
|
|
17
|
+
var isLoading = status === 'loading';
|
|
18
|
+
useEffect(function () {
|
|
19
|
+
var isAlreadyFinished = lastFinishedSrc.current === src;
|
|
20
|
+
if (isAlreadyFinished) {
|
|
21
|
+
return;
|
|
22
|
+
}
|
|
23
|
+
setStatus('loading');
|
|
24
|
+
}, [src]);
|
|
25
|
+
return {
|
|
26
|
+
onLoad: onLoad,
|
|
27
|
+
onError: onError,
|
|
28
|
+
isError: isError,
|
|
29
|
+
isLoaded: isLoaded,
|
|
30
|
+
isLoading: isLoading,
|
|
31
|
+
};
|
|
32
|
+
};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { ImageBaseLoaderProps } from './types';
|
|
3
|
+
export declare const cnImageBaseLoader: import("@bem-react/classname").ClassNameFormatter;
|
|
4
|
+
export declare const ImageBaseLoader: ({ className, ...other }: ImageBaseLoaderProps) => React.JSX.Element;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { __assign, __rest } from "tslib";
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { cn } from '../../../../utils';
|
|
4
|
+
import { Skeleton } from '../../../Skeleton';
|
|
5
|
+
export var cnImageBaseLoader = cn('ImageBaseLoader');
|
|
6
|
+
export var ImageBaseLoader = function (_a) {
|
|
7
|
+
var className = _a.className, other = __rest(_a, ["className"]);
|
|
8
|
+
return (React.createElement(Skeleton, __assign({ variant: "rectangular", className: cnImageBaseLoader('', className), height: "100%" }, other)));
|
|
9
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './ImageBaseLoader';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './ImageBaseLoader';
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { ComponentPropsWithRef, ComponentRef, ElementType, ForwardedRef, ReactNode } from 'react';
|
|
2
|
+
import type { ExtendableComponentPropsWithRef } from '../../types';
|
|
3
|
+
import type { PolymorphicComponentPropsWithRef } from '../../utils';
|
|
4
|
+
import type { ImageBasePictureRef } from './components';
|
|
5
|
+
import type { IMAGE_BASE_DEFAULT_ELEMENT } from './constants';
|
|
6
|
+
import type { ImageBaseAspectRatio, ImageBaseImageRef, ImageBaseSources } from './entities';
|
|
7
|
+
export type ImageBaseBaseProps = ExtendableComponentPropsWithRef<{
|
|
8
|
+
/** Путь к картинке */
|
|
9
|
+
src: string;
|
|
10
|
+
/** Компонент, который отображается при ошибке загрузки изображения */
|
|
11
|
+
placeholder?: ReactNode;
|
|
12
|
+
/** Компонент, который отображается при загрузке изображения */
|
|
13
|
+
loader?: ReactNode;
|
|
14
|
+
/** Соотношения сторон изображения */
|
|
15
|
+
aspectRatio?: ImageBaseAspectRatio | null;
|
|
16
|
+
/** HTML-sources */
|
|
17
|
+
sources?: ImageBaseSources;
|
|
18
|
+
/** Ref изображения */
|
|
19
|
+
imgRef?: ForwardedRef<ImageBaseImageRef>;
|
|
20
|
+
/** Ref picture-элемента */
|
|
21
|
+
pictureRef?: ForwardedRef<ImageBasePictureRef>;
|
|
22
|
+
/** Идентификатор компонента для тестов */
|
|
23
|
+
'data-testid'?: string;
|
|
24
|
+
} & Pick<ComponentPropsWithRef<'img'>, 'alt' | 'loading' | 'decoding'>, 'div'>;
|
|
25
|
+
export type ImageBaseRef<As extends ElementType = typeof IMAGE_BASE_DEFAULT_ELEMENT> = ComponentRef<As>;
|
|
26
|
+
export type ImageBaseProps<As extends ElementType = typeof IMAGE_BASE_DEFAULT_ELEMENT> = PolymorphicComponentPropsWithRef<ImageBaseBaseProps, As>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/__inner__/esm/components/StepperVertical/modules/StepperVerticalStep/StepperVerticalStep.css
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
.StepperVerticalStep {
|
|
2
2
|
--stepper-vertical-indicator-icon-size: 24px;
|
|
3
|
-
--stepper-vertical-indicator-icon-inset-top: var(--spacing-
|
|
3
|
+
--stepper-vertical-indicator-icon-inset-top: var(--spacing-xs);
|
|
4
4
|
--stepper-vertical-indicator-color-non-current: transparent;
|
|
5
5
|
--stepper-vertical-indicator-color-current: transparent;
|
|
6
6
|
--stepper-vertical-indicator-color: var(--stepper-vertical-indicator-color-non-current);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ozen-ui/kit",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.78.0",
|
|
4
4
|
"description": "React component library",
|
|
5
5
|
"files": [
|
|
6
6
|
"*"
|
|
@@ -29,9 +29,10 @@
|
|
|
29
29
|
"react-popper": "^2.3.0",
|
|
30
30
|
"react-transition-group": "^4.4.5",
|
|
31
31
|
"tslib": "^2.6.3",
|
|
32
|
-
"
|
|
33
|
-
"@ozen-ui/
|
|
34
|
-
"@ozen-ui/
|
|
32
|
+
"framer-motion": "^12.23.12",
|
|
33
|
+
"@ozen-ui/fonts": "0.78.0",
|
|
34
|
+
"@ozen-ui/logger": "0.78.0",
|
|
35
|
+
"@ozen-ui/icons": "0.78.0"
|
|
35
36
|
},
|
|
36
37
|
"devDependencies": {
|
|
37
38
|
"@types/lodash.isequal": "^4.5.0"
|