mimir-ui-kit 1.15.0 → 1.15.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1 @@
1
+ ._picture_9zemz_2,._image_9zemz_3{display:block;width:100%;height:auto}._loading_9zemz_9{filter:blur(20px);transition:.3s filter ease}
@@ -5,6 +5,10 @@ type TProps = ComponentProps<'img'> & {
5
5
  * Дополнительный класс к компоненту
6
6
  */
7
7
  className?: string;
8
+ /**
9
+ * Дополнительный класс к контейнеру picture
10
+ */
11
+ pictureClassName?: string;
8
12
  /**
9
13
  * Компонент, который буде показываться, пока идет загрузка изображения
10
14
  */
@@ -13,6 +17,14 @@ type TProps = ComponentProps<'img'> & {
13
17
  * Компонент, который буде показываться, если произошла ошибка при загрузке изображения
14
18
  */
15
19
  errorFallback?: ReactElement;
20
+ /**
21
+ * Изображение для десктопной версии
22
+ */
23
+ desktopImage?: string;
24
+ /**
25
+ * Изображение для мобильной версии
26
+ */
27
+ mobileImage?: string;
16
28
  };
17
29
  /**
18
30
  * Компонент для отображения изображения с возможность показа загрузки и ошибки
@@ -1,10 +1,23 @@
1
- import { jsx } from "react/jsx-runtime";
1
+ import { jsxs, jsx } from "react/jsx-runtime";
2
+ import { c as classNames } from "../../index-CweZ_OcN.js";
2
3
  import { memo, useState, useLayoutEffect } from "react";
4
+ import { EMediaQuery, EMinMediaQuery } from "../../hooks/useMediaQuery/constants.js";
5
+ import '../../assets/Image.css';const picture = "_picture_9zemz_2";
6
+ const image = "_image_9zemz_3";
7
+ const loading = "_loading_9zemz_9";
8
+ const cls = {
9
+ picture,
10
+ image,
11
+ loading
12
+ };
3
13
  const AppImage = memo((props) => {
4
14
  const {
5
15
  className,
6
16
  src,
7
17
  alt = "image",
18
+ desktopImage,
19
+ mobileImage,
20
+ pictureClassName,
8
21
  errorFallback,
9
22
  fallback,
10
23
  ...otherProps
@@ -13,7 +26,7 @@ const AppImage = memo((props) => {
13
26
  const [hasError, setHasError] = useState(false);
14
27
  useLayoutEffect(() => {
15
28
  const img = new Image();
16
- img.src = src ?? "";
29
+ img.src = src ?? desktopImage ?? mobileImage ?? "";
17
30
  img.onload = () => {
18
31
  setIsLoading(false);
19
32
  };
@@ -21,26 +34,40 @@ const AppImage = memo((props) => {
21
34
  setIsLoading(false);
22
35
  setHasError(true);
23
36
  };
24
- }, [src]);
37
+ }, [src, desktopImage, mobileImage]);
25
38
  if (isLoading && fallback) {
26
39
  return fallback;
27
40
  }
28
41
  if (hasError && errorFallback) {
29
42
  return errorFallback;
30
43
  }
31
- return /* @__PURE__ */ jsx(
32
- "img",
44
+ return /* @__PURE__ */ jsxs(
45
+ "picture",
33
46
  {
34
- ...otherProps,
35
- style: {
36
- display: "block",
37
- filter: `${isLoading ? "blur(20px)" : ""}`,
38
- transition: ".3s filter ease"
39
- },
40
- className,
41
- loading: "lazy",
42
- src,
43
- alt
47
+ className: classNames(cls.picture, pictureClassName, {
48
+ [cls.loading]: isLoading
49
+ }),
50
+ children: [
51
+ mobileImage && /* @__PURE__ */ jsx("source", { srcSet: mobileImage, media: EMediaQuery.S }),
52
+ desktopImage && /* @__PURE__ */ jsx("source", { srcSet: desktopImage, media: EMinMediaQuery.S }),
53
+ /* @__PURE__ */ jsx(
54
+ "img",
55
+ {
56
+ ...otherProps,
57
+ style: {
58
+ display: "block",
59
+ filter: `${isLoading ? "blur(20px)" : ""}`,
60
+ transition: ".3s filter ease"
61
+ },
62
+ className: classNames(cls.image, className, {
63
+ [cls.loading]: isLoading
64
+ }),
65
+ loading: "lazy",
66
+ src,
67
+ alt
68
+ }
69
+ )
70
+ ]
44
71
  }
45
72
  );
46
73
  });
@@ -21,6 +21,8 @@ type TProps = {
21
21
  */
22
22
  images?: {
23
23
  image?: string;
24
+ imageDesktop?: string;
25
+ imageMobile?: string;
24
26
  url?: string;
25
27
  id?: number;
26
28
  }[];
@@ -323,7 +323,7 @@ const Slider = ({
323
323
  swiperClassName,
324
324
  slideClassName,
325
325
  imageClassName,
326
- delay = 3e3
326
+ delay = 3e5
327
327
  }) => {
328
328
  const progressBar = useRef(null);
329
329
  const swiperRef = useRef(null);
@@ -401,7 +401,9 @@ const Slider = ({
401
401
  AppImage,
402
402
  {
403
403
  className: classNames(cls.image, imageClassName),
404
- src: img.image
404
+ src: img.image,
405
+ desktopImage: img.imageDesktop,
406
+ mobileImage: img.imageMobile
405
407
  }
406
408
  )
407
409
  },
@@ -1,4 +1,4 @@
1
- export { useMediaQuery, EMediaQuery } from './useMediaQuery';
1
+ export { useMediaQuery, EMediaQuery, EMinMediaQuery } from './useMediaQuery';
2
2
  export { useLockBodyScroll } from './useLockBodyScroll';
3
3
  export { useInterval } from './useInterval';
4
4
  export { useTimer } from './useTimer';
@@ -1,11 +1,12 @@
1
1
  import { useMediaQuery } from "./useMediaQuery/useMediaQuery.js";
2
- import { EMediaQuery } from "./useMediaQuery/constants.js";
2
+ import { EMediaQuery, EMinMediaQuery } from "./useMediaQuery/constants.js";
3
3
  import { useLockBodyScroll } from "./useLockBodyScroll/useLockBodyScroll.js";
4
4
  import { useInterval } from "./useInterval/useInterval.js";
5
5
  import { useTimer } from "./useTimer/index.js";
6
6
  import { useCopyToClipboard } from "./useCopyToClipboard/useCopyToClipboard.js";
7
7
  export {
8
8
  EMediaQuery,
9
+ EMinMediaQuery,
9
10
  useCopyToClipboard,
10
11
  useInterval,
11
12
  useLockBodyScroll,
@@ -8,3 +8,13 @@ export declare enum EMediaQuery {
8
8
  XL = "(max-width: 1440px)",
9
9
  XXL = "(max-width: 1920px)"
10
10
  }
11
+ export declare enum EMinMediaQuery {
12
+ XSS = "(min-width: 375px)",
13
+ XS = "(min-width: 600px)",
14
+ XS1 = "(min-width: 767px)",
15
+ S = "(min-width: 768px)",
16
+ M = "(min-width: 960px)",
17
+ L = "(min-width: 1280px)",
18
+ XL = "(min-width: 1440px)",
19
+ XXL = "(min-width: 1920px)"
20
+ }
@@ -9,6 +9,18 @@ var EMediaQuery = /* @__PURE__ */ ((EMediaQuery2) => {
9
9
  EMediaQuery2["XXL"] = "(max-width: 1920px)";
10
10
  return EMediaQuery2;
11
11
  })(EMediaQuery || {});
12
+ var EMinMediaQuery = /* @__PURE__ */ ((EMinMediaQuery2) => {
13
+ EMinMediaQuery2["XSS"] = "(min-width: 375px)";
14
+ EMinMediaQuery2["XS"] = "(min-width: 600px)";
15
+ EMinMediaQuery2["XS1"] = "(min-width: 767px)";
16
+ EMinMediaQuery2["S"] = "(min-width: 768px)";
17
+ EMinMediaQuery2["M"] = "(min-width: 960px)";
18
+ EMinMediaQuery2["L"] = "(min-width: 1280px)";
19
+ EMinMediaQuery2["XL"] = "(min-width: 1440px)";
20
+ EMinMediaQuery2["XXL"] = "(min-width: 1920px)";
21
+ return EMinMediaQuery2;
22
+ })(EMinMediaQuery || {});
12
23
  export {
13
- EMediaQuery
24
+ EMediaQuery,
25
+ EMinMediaQuery
14
26
  };
@@ -1,2 +1,2 @@
1
1
  export { useMediaQuery } from './useMediaQuery';
2
- export { EMediaQuery } from './constants';
2
+ export { EMediaQuery, EMinMediaQuery } from './constants';
@@ -1,6 +1,7 @@
1
1
  import { useMediaQuery } from "./useMediaQuery.js";
2
- import { EMediaQuery } from "./constants.js";
2
+ import { EMediaQuery, EMinMediaQuery } from "./constants.js";
3
3
  export {
4
4
  EMediaQuery,
5
+ EMinMediaQuery,
5
6
  useMediaQuery
6
7
  };
package/dist/index.js CHANGED
@@ -38,7 +38,7 @@ import { EToastPosition, EToastVariant } from "./components/Toasts/constants.js"
38
38
  import { UploaderPhotos } from "./components/UploaderPhotos/UploaderPhotos.js";
39
39
  import { Uploader } from "./components/Uploader/Uploader.js";
40
40
  import { useMediaQuery } from "./hooks/useMediaQuery/useMediaQuery.js";
41
- import { EMediaQuery } from "./hooks/useMediaQuery/constants.js";
41
+ import { EMediaQuery, EMinMediaQuery } from "./hooks/useMediaQuery/constants.js";
42
42
  import { useLockBodyScroll } from "./hooks/useLockBodyScroll/useLockBodyScroll.js";
43
43
  import { useInterval } from "./hooks/useInterval/useInterval.js";
44
44
  import { useTimer } from "./hooks/useTimer/index.js";
@@ -62,6 +62,7 @@ import './assets/index.css';export {
62
62
  EInputVariant,
63
63
  EMediaQuery,
64
64
  EMergedButtonVariantRound,
65
+ EMinMediaQuery,
65
66
  ESelectSearchSize,
66
67
  EStepsPrimaryColor,
67
68
  EStepsSecondaryColor,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "mimir-ui-kit",
3
3
  "private": false,
4
- "version": "1.15.0",
4
+ "version": "1.15.1",
5
5
  "type": "module",
6
6
  "exports": {
7
7
  ".": {