denwa-web-shared 1.0.33 → 1.0.35

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.
@@ -278,6 +278,12 @@ const preparePageParam = (page) => {
278
278
  }
279
279
  return 1;
280
280
  };
281
+ const isNotEmptyHtml = (html) => {
282
+ return !!html && html !== '<p class="content-paragraph" ></p>';
283
+ };
284
+ const createCityLink = (city, href) => {
285
+ return `/${city}${href}`;
286
+ };
281
287
  function r(e) {
282
288
  var t, f, n = "";
283
289
  if ("string" == typeof e || "number" == typeof e) n += e;
@@ -6770,65 +6776,57 @@ const BasePicture = ({
6770
6776
  loading = "lazy",
6771
6777
  ...pictureProps
6772
6778
  }) => {
6773
- const {
6774
- image1x,
6775
- image2x,
6776
- image1xWebp,
6777
- image2xWebp,
6778
- image1xAvif,
6779
- image2xAvif,
6780
- mobileImage1x,
6781
- mobileImage2x,
6782
- mobileImage1xWebp,
6783
- mobileImage2xWebp,
6784
- mobileImage1xAvif,
6785
- mobileImage2xAvif
6786
- } = data;
6787
6779
  return /* @__PURE__ */ jsxRuntime.jsxs("picture", { ...pictureProps, children: [
6788
- !!mobileImage1xAvif && /* @__PURE__ */ jsxRuntime.jsx(
6780
+ !!(data == null ? void 0 : data.mobileImage1xAvif) && /* @__PURE__ */ jsxRuntime.jsx(
6789
6781
  "source",
6790
6782
  {
6791
- srcSet: `${mobileImage1xAvif} 1x${mobileImage2xAvif ? `, ${mobileImage2xAvif} 2x` : ""}`,
6783
+ srcSet: `${data == null ? void 0 : data.mobileImage1xAvif} 1x${(data == null ? void 0 : data.mobileImage2xAvif) ? `, ${data == null ? void 0 : data.mobileImage2xAvif} 2x` : ""}`,
6792
6784
  media: `(max-width: ${mobileMaxWidth}px)`,
6793
6785
  type: "image/avif"
6794
6786
  }
6795
6787
  ),
6796
- !!mobileImage1xWebp && /* @__PURE__ */ jsxRuntime.jsx(
6788
+ !!(data == null ? void 0 : data.mobileImage1xWebp) && /* @__PURE__ */ jsxRuntime.jsx(
6797
6789
  "source",
6798
6790
  {
6799
- srcSet: `${mobileImage1xWebp} 1x${mobileImage2xWebp ? `, ${mobileImage2xWebp} 2x` : ""}`,
6791
+ srcSet: `${data == null ? void 0 : data.mobileImage1xWebp} 1x${(data == null ? void 0 : data.mobileImage2xWebp) ? `, ${data == null ? void 0 : data.mobileImage2xWebp} 2x` : ""}`,
6800
6792
  media: `(max-width: ${mobileMaxWidth}px)`,
6801
6793
  type: "image/webp"
6802
6794
  }
6803
6795
  ),
6804
- !!mobileImage1x && /* @__PURE__ */ jsxRuntime.jsx(
6796
+ !!(data == null ? void 0 : data.mobileImage1x) && /* @__PURE__ */ jsxRuntime.jsx(
6805
6797
  "source",
6806
6798
  {
6807
- srcSet: `${mobileImage1x} 1x${mobileImage2x ? `, ${mobileImage2x} 2x` : ""}`,
6799
+ srcSet: `${data == null ? void 0 : data.mobileImage1x} 1x${(data == null ? void 0 : data.mobileImage2x) ? `, ${data == null ? void 0 : data.mobileImage2x} 2x` : ""}`,
6808
6800
  media: `(max-width: ${mobileMaxWidth}px)`,
6809
6801
  type
6810
6802
  }
6811
6803
  ),
6812
- !!image1xAvif && /* @__PURE__ */ jsxRuntime.jsx(
6804
+ !!(data == null ? void 0 : data.image1xAvif) && /* @__PURE__ */ jsxRuntime.jsx(
6813
6805
  "source",
6814
6806
  {
6815
- srcSet: `${image1xAvif} 1x${image2xAvif ? `, ${image2xAvif} 2x` : ""}`,
6807
+ srcSet: `${data == null ? void 0 : data.image1xAvif} 1x${(data == null ? void 0 : data.image2xAvif) ? `, ${data == null ? void 0 : data.image2xAvif} 2x` : ""}`,
6816
6808
  type: "image/avif"
6817
6809
  }
6818
6810
  ),
6819
- !!image1xWebp && /* @__PURE__ */ jsxRuntime.jsx(
6811
+ !!(data == null ? void 0 : data.image1xWebp) && /* @__PURE__ */ jsxRuntime.jsx(
6820
6812
  "source",
6821
6813
  {
6822
- srcSet: `${image1xWebp} 1x${image2xWebp ? `, ${image2xWebp} 2x` : ""}`,
6814
+ srcSet: `${data == null ? void 0 : data.image1xWebp} 1x${(data == null ? void 0 : data.image2xWebp) ? `, ${data == null ? void 0 : data.image2xWebp} 2x` : ""}`,
6823
6815
  type: "image/webp"
6824
6816
  }
6825
6817
  ),
6826
- !!image1x && /* @__PURE__ */ jsxRuntime.jsx("source", { srcSet: `${image1x} 1x${image2x ? `, ${image2x} 2x` : ""}`, type }),
6818
+ !!(data == null ? void 0 : data.image1x) && /* @__PURE__ */ jsxRuntime.jsx(
6819
+ "source",
6820
+ {
6821
+ srcSet: `${data == null ? void 0 : data.image1x} 1x${(data == null ? void 0 : data.image2x) ? `, ${data == null ? void 0 : data.image2x} 2x` : ""}`,
6822
+ type
6823
+ }
6824
+ ),
6827
6825
  /* @__PURE__ */ jsxRuntime.jsx(
6828
6826
  "img",
6829
6827
  {
6830
6828
  ...imgProps,
6831
- src: image1x,
6829
+ src: data == null ? void 0 : data.image1x,
6832
6830
  alt,
6833
6831
  loading,
6834
6832
  decoding: loading === "eager" ? "sync" : "async",
@@ -6845,6 +6843,7 @@ exports.checkCorrectFileObject = checkCorrectFileObject;
6845
6843
  exports.checkCorrectImageObject = checkCorrectImageObject;
6846
6844
  exports.cn = cn;
6847
6845
  exports.convertPhoneMask = convertPhoneMask;
6846
+ exports.createCityLink = createCityLink;
6848
6847
  exports.generatePaginationArray = generatePaginationArray;
6849
6848
  exports.getByKey = getByKey;
6850
6849
  exports.getImagePrefix = getImagePrefix;
@@ -6852,6 +6851,7 @@ exports.getNumberFormatter = getNumberFormatter;
6852
6851
  exports.getSubdomain = getSubdomain;
6853
6852
  exports.getUploadFileUrl = getUploadFileUrl;
6854
6853
  exports.getUploadImageUrl = getUploadImageUrl;
6854
+ exports.isNotEmptyHtml = isNotEmptyHtml;
6855
6855
  exports.parseStringToKeyValue = parseStringToKeyValue;
6856
6856
  exports.prepareColor = prepareColor;
6857
6857
  exports.prepareLocalMetaData = prepareLocalMetaData;
@@ -276,6 +276,12 @@ const preparePageParam = (page) => {
276
276
  }
277
277
  return 1;
278
278
  };
279
+ const isNotEmptyHtml = (html) => {
280
+ return !!html && html !== '<p class="content-paragraph" ></p>';
281
+ };
282
+ const createCityLink = (city, href) => {
283
+ return `/${city}${href}`;
284
+ };
279
285
  function r(e) {
280
286
  var t, f, n = "";
281
287
  if ("string" == typeof e || "number" == typeof e) n += e;
@@ -6768,65 +6774,57 @@ const BasePicture = ({
6768
6774
  loading = "lazy",
6769
6775
  ...pictureProps
6770
6776
  }) => {
6771
- const {
6772
- image1x,
6773
- image2x,
6774
- image1xWebp,
6775
- image2xWebp,
6776
- image1xAvif,
6777
- image2xAvif,
6778
- mobileImage1x,
6779
- mobileImage2x,
6780
- mobileImage1xWebp,
6781
- mobileImage2xWebp,
6782
- mobileImage1xAvif,
6783
- mobileImage2xAvif
6784
- } = data;
6785
6777
  return /* @__PURE__ */ jsxs("picture", { ...pictureProps, children: [
6786
- !!mobileImage1xAvif && /* @__PURE__ */ jsx(
6778
+ !!(data == null ? void 0 : data.mobileImage1xAvif) && /* @__PURE__ */ jsx(
6787
6779
  "source",
6788
6780
  {
6789
- srcSet: `${mobileImage1xAvif} 1x${mobileImage2xAvif ? `, ${mobileImage2xAvif} 2x` : ""}`,
6781
+ srcSet: `${data == null ? void 0 : data.mobileImage1xAvif} 1x${(data == null ? void 0 : data.mobileImage2xAvif) ? `, ${data == null ? void 0 : data.mobileImage2xAvif} 2x` : ""}`,
6790
6782
  media: `(max-width: ${mobileMaxWidth}px)`,
6791
6783
  type: "image/avif"
6792
6784
  }
6793
6785
  ),
6794
- !!mobileImage1xWebp && /* @__PURE__ */ jsx(
6786
+ !!(data == null ? void 0 : data.mobileImage1xWebp) && /* @__PURE__ */ jsx(
6795
6787
  "source",
6796
6788
  {
6797
- srcSet: `${mobileImage1xWebp} 1x${mobileImage2xWebp ? `, ${mobileImage2xWebp} 2x` : ""}`,
6789
+ srcSet: `${data == null ? void 0 : data.mobileImage1xWebp} 1x${(data == null ? void 0 : data.mobileImage2xWebp) ? `, ${data == null ? void 0 : data.mobileImage2xWebp} 2x` : ""}`,
6798
6790
  media: `(max-width: ${mobileMaxWidth}px)`,
6799
6791
  type: "image/webp"
6800
6792
  }
6801
6793
  ),
6802
- !!mobileImage1x && /* @__PURE__ */ jsx(
6794
+ !!(data == null ? void 0 : data.mobileImage1x) && /* @__PURE__ */ jsx(
6803
6795
  "source",
6804
6796
  {
6805
- srcSet: `${mobileImage1x} 1x${mobileImage2x ? `, ${mobileImage2x} 2x` : ""}`,
6797
+ srcSet: `${data == null ? void 0 : data.mobileImage1x} 1x${(data == null ? void 0 : data.mobileImage2x) ? `, ${data == null ? void 0 : data.mobileImage2x} 2x` : ""}`,
6806
6798
  media: `(max-width: ${mobileMaxWidth}px)`,
6807
6799
  type
6808
6800
  }
6809
6801
  ),
6810
- !!image1xAvif && /* @__PURE__ */ jsx(
6802
+ !!(data == null ? void 0 : data.image1xAvif) && /* @__PURE__ */ jsx(
6811
6803
  "source",
6812
6804
  {
6813
- srcSet: `${image1xAvif} 1x${image2xAvif ? `, ${image2xAvif} 2x` : ""}`,
6805
+ srcSet: `${data == null ? void 0 : data.image1xAvif} 1x${(data == null ? void 0 : data.image2xAvif) ? `, ${data == null ? void 0 : data.image2xAvif} 2x` : ""}`,
6814
6806
  type: "image/avif"
6815
6807
  }
6816
6808
  ),
6817
- !!image1xWebp && /* @__PURE__ */ jsx(
6809
+ !!(data == null ? void 0 : data.image1xWebp) && /* @__PURE__ */ jsx(
6818
6810
  "source",
6819
6811
  {
6820
- srcSet: `${image1xWebp} 1x${image2xWebp ? `, ${image2xWebp} 2x` : ""}`,
6812
+ srcSet: `${data == null ? void 0 : data.image1xWebp} 1x${(data == null ? void 0 : data.image2xWebp) ? `, ${data == null ? void 0 : data.image2xWebp} 2x` : ""}`,
6821
6813
  type: "image/webp"
6822
6814
  }
6823
6815
  ),
6824
- !!image1x && /* @__PURE__ */ jsx("source", { srcSet: `${image1x} 1x${image2x ? `, ${image2x} 2x` : ""}`, type }),
6816
+ !!(data == null ? void 0 : data.image1x) && /* @__PURE__ */ jsx(
6817
+ "source",
6818
+ {
6819
+ srcSet: `${data == null ? void 0 : data.image1x} 1x${(data == null ? void 0 : data.image2x) ? `, ${data == null ? void 0 : data.image2x} 2x` : ""}`,
6820
+ type
6821
+ }
6822
+ ),
6825
6823
  /* @__PURE__ */ jsx(
6826
6824
  "img",
6827
6825
  {
6828
6826
  ...imgProps,
6829
- src: image1x,
6827
+ src: data == null ? void 0 : data.image1x,
6830
6828
  alt,
6831
6829
  loading,
6832
6830
  decoding: loading === "eager" ? "sync" : "async",
@@ -6844,6 +6842,7 @@ export {
6844
6842
  checkCorrectImageObject,
6845
6843
  cn,
6846
6844
  convertPhoneMask,
6845
+ createCityLink,
6847
6846
  generatePaginationArray,
6848
6847
  getByKey,
6849
6848
  getImagePrefix,
@@ -6851,6 +6850,7 @@ export {
6851
6850
  getSubdomain,
6852
6851
  getUploadFileUrl,
6853
6852
  getUploadImageUrl,
6853
+ isNotEmptyHtml,
6854
6854
  parseStringToKeyValue,
6855
6855
  prepareColor,
6856
6856
  prepareLocalMetaData,
@@ -134,3 +134,14 @@ export declare const arrayToKeyValueObject: <T extends string>(arr: T[]) => Reco
134
134
  * @param page - Номер страницы
135
135
  */
136
136
  export declare const preparePageParam: (page: string | number | undefined) => number;
137
+ /**
138
+ * @description Проверка html на пустоту
139
+ * @param html - Html разметка редактора
140
+ */
141
+ export declare const isNotEmptyHtml: (html: string | null | undefined) => boolean;
142
+ /**
143
+ * @description Подстановка города в путь ссылки
144
+ * @param city - Город
145
+ * @param href - Ссылка
146
+ */
147
+ export declare const createCityLink: (city: string, href: string) => string;
@@ -2,8 +2,8 @@ import { DetailedHTMLProps, FC, HTMLAttributes, ImgHTMLAttributes } from 'react'
2
2
  import { ImageType } from '../types';
3
3
  export interface BasePictureProps extends DetailedHTMLProps<HTMLAttributes<HTMLPictureElement>, HTMLPictureElement> {
4
4
  imgProps?: DetailedHTMLProps<ImgHTMLAttributes<HTMLImageElement>, HTMLImageElement>;
5
- data: PictureData;
6
- type: ImageType;
5
+ data: PictureData | undefined;
6
+ type: ImageType | undefined;
7
7
  alt: string;
8
8
  mobileMaxWidth?: number;
9
9
  loading?: 'eager' | 'lazy';
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "denwa-web-shared",
3
3
  "private": false,
4
- "version": "1.0.33",
4
+ "version": "1.0.35",
5
5
  "type": "module",
6
6
  "author": "Denwa",
7
7
  "main": "dist/denwa-web-shared.cjs.js",