@redneckz/wildless-cms-uni-blocks 0.3.75 → 0.3.77

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.
Files changed (158) hide show
  1. package/bundle/blocks.schema.json +1 -1
  2. package/bundle/bundle.umd.js +19 -21
  3. package/bundle/bundle.umd.min.js +1 -1
  4. package/dist/components/Accordion/AccordionContent.d.ts +4 -1
  5. package/dist/components/Calculator/renderRate.js +1 -1
  6. package/dist/components/Calculator/renderRate.js.map +1 -1
  7. package/dist/components/Catalog/Catalog.js +2 -2
  8. package/dist/components/Catalog/Catalog.js.map +1 -1
  9. package/dist/components/Catalog/CatalogContent.d.ts +1 -0
  10. package/dist/components/GroupBlock/GroupBlockContent.d.ts +2 -2
  11. package/dist/components/LinkDocs/LinkDocsContent.d.ts +10 -1
  12. package/dist/components/PictureText/PictureTextContent.d.ts +1 -0
  13. package/dist/components/ProductTile/ProductTile.js +7 -8
  14. package/dist/components/ProductTile/ProductTile.js.map +1 -1
  15. package/dist/components/StepsBlock/StepsBlock.js +3 -2
  16. package/dist/components/StepsBlock/StepsBlock.js.map +1 -1
  17. package/dist/components/StepsBlock/StepsBlock.mobile.js +2 -1
  18. package/dist/components/StepsBlock/StepsBlock.mobile.js.map +1 -1
  19. package/dist/components/StepsBlock/StepsBlockContent.d.ts +11 -0
  20. package/dist/model/Picture.d.ts +6 -0
  21. package/dist/ui-kit/BlocksList/BlocksListProps.d.ts +10 -10
  22. package/dist/ui-kit/Button/ButtonInner.js +2 -2
  23. package/dist/ui-kit/Button/ButtonInner.js.map +1 -1
  24. package/dist/ui-kit/Foldable/Foldable.js +1 -1
  25. package/dist/ui-kit/Foldable/Foldable.js.map +1 -1
  26. package/dist/ui-kit/Img/Img.js +2 -6
  27. package/dist/ui-kit/Img/Img.js.map +1 -1
  28. package/dist/utils/checkIsIconRenderable.d.ts +2 -0
  29. package/dist/utils/checkIsIconRenderable.js +5 -0
  30. package/dist/utils/checkIsIconRenderable.js.map +1 -0
  31. package/lib/common.css +1 -1
  32. package/lib/components/Accordion/AccordionContent.d.ts +4 -1
  33. package/lib/components/Calculator/renderRate.js +1 -1
  34. package/lib/components/Calculator/renderRate.js.map +1 -1
  35. package/lib/components/Catalog/Catalog.js +2 -2
  36. package/lib/components/Catalog/Catalog.js.map +1 -1
  37. package/lib/components/Catalog/CatalogContent.d.ts +1 -0
  38. package/lib/components/GroupBlock/GroupBlockContent.d.ts +2 -2
  39. package/lib/components/LinkDocs/LinkDocsContent.d.ts +10 -1
  40. package/lib/components/PictureText/PictureTextContent.d.ts +1 -0
  41. package/lib/components/ProductTile/ProductTile.js +7 -8
  42. package/lib/components/ProductTile/ProductTile.js.map +1 -1
  43. package/lib/components/StepsBlock/StepsBlock.js +3 -2
  44. package/lib/components/StepsBlock/StepsBlock.js.map +1 -1
  45. package/lib/components/StepsBlock/StepsBlock.mobile.js +2 -1
  46. package/lib/components/StepsBlock/StepsBlock.mobile.js.map +1 -1
  47. package/lib/components/StepsBlock/StepsBlockContent.d.ts +11 -0
  48. package/lib/model/Picture.d.ts +6 -0
  49. package/lib/ui-kit/BlocksList/BlocksListProps.d.ts +10 -10
  50. package/lib/ui-kit/Button/ButtonInner.js +2 -2
  51. package/lib/ui-kit/Button/ButtonInner.js.map +1 -1
  52. package/lib/ui-kit/Foldable/Foldable.js +1 -1
  53. package/lib/ui-kit/Foldable/Foldable.js.map +1 -1
  54. package/lib/ui-kit/Img/Img.js +2 -6
  55. package/lib/ui-kit/Img/Img.js.map +1 -1
  56. package/lib/utils/checkIsIconRenderable.d.ts +2 -0
  57. package/lib/utils/checkIsIconRenderable.js +2 -0
  58. package/lib/utils/checkIsIconRenderable.js.map +1 -0
  59. package/mobile/bundle/bundle.umd.js +5 -3
  60. package/mobile/bundle/bundle.umd.min.js +1 -1
  61. package/mobile/dist/components/Accordion/AccordionContent.d.ts +4 -1
  62. package/mobile/dist/components/Calculator/renderRate.js +1 -1
  63. package/mobile/dist/components/Calculator/renderRate.js.map +1 -1
  64. package/mobile/dist/components/Catalog/Catalog.js +2 -2
  65. package/mobile/dist/components/Catalog/Catalog.js.map +1 -1
  66. package/mobile/dist/components/Catalog/CatalogContent.d.ts +1 -0
  67. package/mobile/dist/components/GroupBlock/GroupBlockContent.d.ts +2 -2
  68. package/mobile/dist/components/LinkDocs/LinkDocsContent.d.ts +10 -1
  69. package/mobile/dist/components/PictureText/PictureTextContent.d.ts +1 -0
  70. package/mobile/dist/components/ProductTile/ProductTile.js +7 -8
  71. package/mobile/dist/components/ProductTile/ProductTile.js.map +1 -1
  72. package/mobile/dist/components/StepsBlock/StepsBlock.js +2 -1
  73. package/mobile/dist/components/StepsBlock/StepsBlock.js.map +1 -1
  74. package/mobile/dist/components/StepsBlock/StepsBlockContent.d.ts +11 -0
  75. package/mobile/dist/model/Picture.d.ts +6 -0
  76. package/mobile/dist/ui-kit/BlocksList/BlocksListProps.d.ts +10 -10
  77. package/mobile/dist/ui-kit/Button/ButtonInner.js +2 -2
  78. package/mobile/dist/ui-kit/Button/ButtonInner.js.map +1 -1
  79. package/mobile/dist/ui-kit/Foldable/Foldable.js +1 -1
  80. package/mobile/dist/ui-kit/Foldable/Foldable.js.map +1 -1
  81. package/mobile/dist/utils/checkIsIconRenderable.d.ts +2 -0
  82. package/mobile/dist/utils/checkIsIconRenderable.js +5 -0
  83. package/mobile/dist/utils/checkIsIconRenderable.js.map +1 -0
  84. package/mobile/lib/components/Accordion/AccordionContent.d.ts +4 -1
  85. package/mobile/lib/components/Calculator/renderRate.js +1 -1
  86. package/mobile/lib/components/Calculator/renderRate.js.map +1 -1
  87. package/mobile/lib/components/Catalog/Catalog.js +2 -2
  88. package/mobile/lib/components/Catalog/Catalog.js.map +1 -1
  89. package/mobile/lib/components/Catalog/CatalogContent.d.ts +1 -0
  90. package/mobile/lib/components/GroupBlock/GroupBlockContent.d.ts +2 -2
  91. package/mobile/lib/components/LinkDocs/LinkDocsContent.d.ts +10 -1
  92. package/mobile/lib/components/PictureText/PictureTextContent.d.ts +1 -0
  93. package/mobile/lib/components/ProductTile/ProductTile.js +7 -8
  94. package/mobile/lib/components/ProductTile/ProductTile.js.map +1 -1
  95. package/mobile/lib/components/StepsBlock/StepsBlock.js +2 -1
  96. package/mobile/lib/components/StepsBlock/StepsBlock.js.map +1 -1
  97. package/mobile/lib/components/StepsBlock/StepsBlockContent.d.ts +11 -0
  98. package/mobile/lib/model/Picture.d.ts +6 -0
  99. package/mobile/lib/ui-kit/BlocksList/BlocksListProps.d.ts +10 -10
  100. package/mobile/lib/ui-kit/Button/ButtonInner.js +2 -2
  101. package/mobile/lib/ui-kit/Button/ButtonInner.js.map +1 -1
  102. package/mobile/lib/ui-kit/Foldable/Foldable.js +1 -1
  103. package/mobile/lib/ui-kit/Foldable/Foldable.js.map +1 -1
  104. package/mobile/lib/utils/checkIsIconRenderable.d.ts +2 -0
  105. package/mobile/lib/utils/checkIsIconRenderable.js +2 -0
  106. package/mobile/lib/utils/checkIsIconRenderable.js.map +1 -0
  107. package/mobile/src/components/Accordion/Accordion.example.json +13 -6
  108. package/mobile/src/components/Accordion/AccordionContent.ts +4 -1
  109. package/mobile/src/components/Calculator/renderRate.tsx +1 -3
  110. package/mobile/src/components/Catalog/Catalog.tsx +2 -1
  111. package/mobile/src/components/Catalog/CatalogContent.ts +1 -0
  112. package/mobile/src/components/ContentPage/ContentPage.page.json +1 -1
  113. package/mobile/src/components/GroupBlock/GroupBlock.example.json +72 -3
  114. package/mobile/src/components/GroupBlock/GroupBlockContent.ts +2 -2
  115. package/mobile/src/components/LinkDocs/LinkDocsContent.ts +10 -1
  116. package/mobile/src/components/OtherProducts/OtherProducts.example.json +12 -6
  117. package/mobile/src/components/PictureText/PictureTextContent.ts +1 -0
  118. package/mobile/src/components/ProductBlock/ProductBlock.example.json +3 -10
  119. package/mobile/src/components/ProductTile/ProductTile.example.json +1 -2
  120. package/mobile/src/components/ProductTile/ProductTile.tsx +28 -30
  121. package/mobile/src/components/PromoTile/PromoTile.example.json +1 -2
  122. package/mobile/src/components/StepsBlock/StepsBlock.example.json +18 -3
  123. package/mobile/src/components/StepsBlock/StepsBlock.tsx +6 -1
  124. package/mobile/src/components/StepsBlock/StepsBlockContent.ts +11 -0
  125. package/mobile/src/components/Tile/Tile.example.json +2 -9
  126. package/mobile/src/model/Picture.ts +7 -0
  127. package/mobile/src/ui-kit/BlocksList/BlocksListProps.ts +42 -20
  128. package/mobile/src/ui-kit/Button/ButtonInner.tsx +2 -2
  129. package/mobile/src/ui-kit/Foldable/Foldable.tsx +1 -1
  130. package/mobile/src/utils/checkIsIconRenderable.tsx +3 -0
  131. package/package.json +2 -2
  132. package/src/components/Accordion/Accordion.example.json +13 -6
  133. package/src/components/Accordion/AccordionContent.ts +4 -1
  134. package/src/components/Calculator/renderRate.tsx +1 -3
  135. package/src/components/Catalog/Catalog.tsx +2 -1
  136. package/src/components/Catalog/CatalogContent.ts +1 -0
  137. package/src/components/ContentPage/ContentPage.page.json +1 -1
  138. package/src/components/GroupBlock/GroupBlock.example.json +72 -3
  139. package/src/components/GroupBlock/GroupBlockContent.ts +2 -2
  140. package/src/components/LinkDocs/LinkDocsContent.ts +10 -1
  141. package/src/components/OtherProducts/OtherProducts.example.json +12 -6
  142. package/src/components/PictureText/PictureTextContent.ts +1 -0
  143. package/src/components/ProductBlock/ProductBlock.example.json +3 -10
  144. package/src/components/ProductBlock/ProductBlock.fixture.tsx +2 -2
  145. package/src/components/ProductTile/ProductTile.example.json +1 -2
  146. package/src/components/ProductTile/ProductTile.tsx +28 -30
  147. package/src/components/PromoTile/PromoTile.example.json +1 -2
  148. package/src/components/StepsBlock/StepsBlock.example.json +18 -3
  149. package/src/components/StepsBlock/StepsBlock.mobile.tsx +6 -1
  150. package/src/components/StepsBlock/StepsBlock.tsx +19 -13
  151. package/src/components/StepsBlock/StepsBlockContent.ts +11 -0
  152. package/src/components/Tile/Tile.example.json +2 -9
  153. package/src/model/Picture.ts +7 -0
  154. package/src/ui-kit/BlocksList/BlocksListProps.ts +42 -20
  155. package/src/ui-kit/Button/ButtonInner.tsx +2 -2
  156. package/src/ui-kit/Foldable/Foldable.tsx +1 -1
  157. package/src/ui-kit/Img/Img.tsx +9 -16
  158. package/src/utils/checkIsIconRenderable.tsx +3 -0
@@ -10,6 +10,12 @@ export interface Img {
10
10
  title?: string;
11
11
  }
12
12
 
13
+ /**
14
+ * @title Брейкпоинт
15
+ * @enumNames ["1919px и меньше", "1439px и меньше", "1279px и меньше"]
16
+ */
17
+ export type MediaQuery = '(max-width: 1919px)' | '(max-width: 1439px)' | '(max-width: 1279px)';
18
+
13
19
  export interface ImgSource {
14
20
  /** @title Иконка */
15
21
  icon?: IconName;
@@ -20,6 +26,7 @@ export interface ImgSource {
20
26
  format?: 'jpeg' | 'jpg' | 'png' | 'gif' | 'webp' | 'heif' | 'avif';
21
27
  /** @hidden */
22
28
  options?: Record<string, any>;
29
+ media?: MediaQuery;
23
30
  /** @title Размер изображения */
24
31
  size?: {
25
32
  /** @title Ширина */
@@ -27,71 +27,93 @@ export interface BlocksCommonProps {
27
27
 
28
28
  /**
29
29
  * @title Заголовок
30
- * @default {"blockListType": "Headline"}
31
30
  */
32
31
  export type HeadlineBlockListDef = HeadlineContent &
33
- BlocksCommonProps & { blockListType: 'Headline' };
32
+ BlocksCommonProps & {
33
+ /** @default Headline */
34
+ blockListType: 'Headline';
35
+ };
34
36
 
35
37
  /**
36
38
  * @title Список документов
37
- * @default {"blockListType": "LinkDocs"}
38
39
  */
39
40
  export type LinkDocsBlockListDef = LinkDocsContent &
40
- BlocksCommonProps & { blockListType: 'LinkDocs' };
41
+ BlocksCommonProps & {
42
+ /** @default LinkDocs */
43
+ blockListType: 'LinkDocs';
44
+ };
41
45
 
42
46
  /**
43
47
  * @title Текстовый блок
44
- * @default {"blockListType": "TextBlock"}
45
48
  */
46
49
  export type TextBlockBlockListDef = TextBlockContent &
47
- BlocksCommonProps & { blockListType: 'TextBlock' };
50
+ BlocksCommonProps & {
51
+ /** @default TextBlock */
52
+ blockListType: 'TextBlock';
53
+ };
48
54
 
49
55
  /**
50
56
  * @title Картинка с текстом
51
- * @default {"blockListType": "PictureText"}
52
57
  */
53
58
  export type PictureTextBlockListDef = PictureTextContent &
54
- BlocksCommonProps & { blockListType: 'PictureText' };
59
+ BlocksCommonProps & {
60
+ /** @default PictureText */
61
+ blockListType: 'PictureText';
62
+ };
55
63
 
56
64
  /**
57
65
  * @title Продуктовый блок
58
- * @default {"blockListType": "ProductBlock"}
59
66
  */
60
67
  export type ProductBlockBlockListDef = ProductBlockContent &
61
- BlocksCommonProps & { blockListType: 'ProductBlock' };
68
+ BlocksCommonProps & {
69
+ /** @default ProductBlock */
70
+ blockListType: 'ProductBlock';
71
+ };
62
72
 
63
73
  /**
64
74
  * @title Плитка
65
- * @default {"blockListType": "Tile"}
66
75
  */
67
- export type TileBlockListDef = TileContent & BlocksCommonProps & { blockListType: 'Tile' };
76
+ export type TileBlockListDef = TileContent &
77
+ BlocksCommonProps & {
78
+ /** @default Tile */
79
+ blockListType: 'Tile';
80
+ };
68
81
 
69
82
  /**
70
83
  * @title Продуктовая плитка
71
- * @default {"blockListType": "ProductTile"}
72
84
  */
73
85
  export type ProductTileBlockListDef = ProductTileContent &
74
- BlocksCommonProps & { blockListType: 'ProductTile' };
86
+ BlocksCommonProps & {
87
+ /** @default ProductTile */
88
+ blockListType: 'ProductTile';
89
+ };
75
90
 
76
91
  /**
77
92
  * @title Галерея
78
- * @default {"blockListType": "Gallery"}
79
93
  */
80
- export type GalleryBlockListDef = GalleryContent & BlocksCommonProps & { blockListType: 'Gallery' };
94
+ export type GalleryBlockListDef = GalleryContent &
95
+ BlocksCommonProps & {
96
+ /** @default Gallery */
97
+ blockListType: 'Gallery';
98
+ };
81
99
 
82
100
  /**
83
101
  * @title Мини-галлерея
84
- * @default {"blockListType": "MiniGallery"}
85
102
  */
86
103
  export type MiniGalleryBlockListDef = MiniGalleryContent &
87
- BlocksCommonProps & { blockListType: 'MiniGallery' };
104
+ BlocksCommonProps & {
105
+ /** @default MiniGallery */
106
+ blockListType: 'MiniGallery';
107
+ };
88
108
 
89
109
  /**
90
110
  * @title Список ссылок
91
- * @default {"blockListType": "LinkList"}
92
111
  */
93
112
  export type LinkListBlockListDef = LinkListContent &
94
- BlocksCommonProps & { blockListType: 'LinkList' };
113
+ BlocksCommonProps & {
114
+ /** @default LinkList */
115
+ blockListType: 'LinkList';
116
+ };
95
117
 
96
118
  /**
97
119
  * @title Содержимое блока
@@ -15,7 +15,7 @@ export const ButtonInner = JSX<ButtonInnerProps>((props) => {
15
15
  {isWithText(props) ? (
16
16
  <div>
17
17
  <div className="text-m-2xs font-light text-left">{aboveText}</div>
18
- <div className="text-button text-left">{text}</div>
18
+ <div className="text-base text-left">{text}</div>
19
19
  </div>
20
20
  ) : null}
21
21
  {appendRight ? appendRight : null}
@@ -30,7 +30,7 @@ const getButtonStyle = (props: ButtonInnerProps) => {
30
30
  return '';
31
31
  }
32
32
 
33
- const withTextStyle = `px-8 gap-2 ${aboveText ? 'py-2' : 'py-[18px]'}`;
33
+ const withTextStyle = `px-9 gap-2 ${aboveText ? 'py-2' : 'py-4'}`;
34
34
 
35
35
  return [
36
36
  'flex items-center justify-center',
@@ -59,7 +59,7 @@ export const Foldable = JSX<FoldableProps>(
59
59
  onClick={handleToggle}
60
60
  >
61
61
  <span className="pr-3">{isActive ? 'Скрыть' : foldButtonLabel}</span>
62
- {icon && <Icon name={icon} iconVersion="white" width="20" height="20" asSVG />}
62
+ {icon ? <Icon name={icon} iconVersion="white" width="20" height="20" asSVG /> : null}
63
63
  </button>
64
64
  ) : null}
65
65
  </div>
@@ -43,8 +43,14 @@ export const ImgAsPicture = JSX<ImageProps<Picture>>(
43
43
  return (
44
44
  <picture className={`flex-none ${className}`}>
45
45
  {image?.sources?.length
46
- ? image.sources.map(({ src, format }, index) => (
47
- <source key={`${index}_${src}`} srcSet={src} type={formatToMimeType(format)} />
46
+ ? image.sources.map(({ src, format, media, size }, index) => (
47
+ <source
48
+ key={`${index}_${src}`}
49
+ srcSet={src}
50
+ type={formatToMimeType(format)}
51
+ media={media}
52
+ {...size}
53
+ />
48
54
  ))
49
55
  : null}
50
56
  {renderImg(image, imageClassName)}
@@ -54,23 +60,10 @@ export const ImgAsPicture = JSX<ImageProps<Picture>>(
54
60
  );
55
61
 
56
62
  const renderImg = (image: Picture, imageClassName = '') => {
57
- const style = {
58
- width: image.size?.width ? `${image.size?.width}px` : '100%',
59
- height: image.size?.height ? `${image.size?.height}px` : '100%',
60
- };
61
63
  const title = image.title || '';
62
64
  const alt = image.alt || image.title;
63
65
 
64
- return (
65
- <img
66
- src={image.src}
67
- className={imageClassName}
68
- alt={alt}
69
- title={title}
70
- style={style}
71
- {...image.size}
72
- />
73
- );
66
+ return <img src={image.src} className={imageClassName} alt={alt} title={title} {...image.size} />;
74
67
  };
75
68
 
76
69
  export function formatToMimeType(format: ImgSource['format']): string | undefined {
@@ -0,0 +1,3 @@
1
+ import type { Picture } from '../model/Picture';
2
+
3
+ export const checkIsIconRenderable = (icon?: Picture) => Boolean(icon?.icon || icon?.src);