@redneckz/wildless-cms-uni-blocks 0.3.4 → 0.3.5

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 (175) hide show
  1. package/bundle/blocks.schema.json +1 -1
  2. package/bundle/bundle.umd.js +8 -8
  3. package/bundle/bundle.umd.min.js +1 -1
  4. package/dist/components/Accordion/utils/isActiveHandler.js +1 -1
  5. package/dist/components/Accordion/utils/isActiveHandler.js.map +1 -1
  6. package/dist/components/Blocks.mobile.d.ts +3 -1
  7. package/dist/components/Blocks.mobile.js +5 -1
  8. package/dist/components/Blocks.mobile.js.map +1 -1
  9. package/dist/components/ContentPage/ContentPage.js +2 -2
  10. package/dist/components/ContentPage/ContentPage.js.map +1 -1
  11. package/dist/components/ContentPage/isBlockInRegistry.d.ts +1 -2
  12. package/dist/components/ContentPage/isBlockInRegistry.js +2 -2
  13. package/dist/components/ContentPage/isBlockInRegistry.js.map +1 -1
  14. package/dist/components/ContentPage/normalizeBlock.d.ts +1 -1
  15. package/dist/components/ContentPage/normalizePage.js +1 -1
  16. package/dist/components/ContentPage/normalizePage.js.map +1 -1
  17. package/dist/components/ContentPage/normalizePage.mobile.js +1 -1
  18. package/dist/components/ContentPage/normalizePage.mobile.js.map +1 -1
  19. package/dist/components/Headline/HeadlineContent.d.ts +1 -1
  20. package/dist/components/MobileAppTile/MobileAppTileContent.d.ts +1 -1
  21. package/dist/components/Placeholder/Placeholder.js +8 -3
  22. package/dist/components/Placeholder/Placeholder.js.map +1 -1
  23. package/dist/components/Placeholder/PlaceholderContent.d.ts +2 -1
  24. package/dist/components/ProductBlock/ProductBlockContent.d.ts +1 -1
  25. package/dist/components/ProductTile/ProductTileContent.d.ts +1 -1
  26. package/dist/components/PromoTile/PromoTileContent.d.ts +1 -1
  27. package/dist/components/Tile/TileContent.d.ts +1 -1
  28. package/dist/types.d.ts +1 -1
  29. package/dist/ui-kit/Description/Description.d.ts +4 -1
  30. package/dist/ui-kit/Description/Description.js.map +1 -1
  31. package/{lib/ui-kit/Description/DescriptionProps.d.ts → dist/ui-kit/Description/DescriptionContent.d.ts} +0 -3
  32. package/dist/ui-kit/Description/{DescriptionProps.js → DescriptionContent.js} +1 -1
  33. package/dist/ui-kit/Description/DescriptionContent.js.map +1 -0
  34. package/lib/common.css +1 -1
  35. package/lib/components/Accordion/utils/isActiveHandler.js +1 -1
  36. package/lib/components/Accordion/utils/isActiveHandler.js.map +1 -1
  37. package/lib/components/Blocks.mobile.d.ts +3 -1
  38. package/lib/components/Blocks.mobile.js +5 -1
  39. package/lib/components/Blocks.mobile.js.map +1 -1
  40. package/lib/components/ContentPage/ContentPage.js +2 -2
  41. package/lib/components/ContentPage/ContentPage.js.map +1 -1
  42. package/lib/components/ContentPage/isBlockInRegistry.d.ts +1 -2
  43. package/lib/components/ContentPage/isBlockInRegistry.js +2 -2
  44. package/lib/components/ContentPage/isBlockInRegistry.js.map +1 -1
  45. package/lib/components/ContentPage/normalizeBlock.d.ts +1 -1
  46. package/lib/components/ContentPage/normalizePage.js +1 -1
  47. package/lib/components/ContentPage/normalizePage.js.map +1 -1
  48. package/lib/components/ContentPage/normalizePage.mobile.js +1 -1
  49. package/lib/components/ContentPage/normalizePage.mobile.js.map +1 -1
  50. package/lib/components/Headline/HeadlineContent.d.ts +1 -1
  51. package/lib/components/MobileAppTile/MobileAppTileContent.d.ts +1 -1
  52. package/lib/components/Placeholder/Placeholder.fixture.mobile.d.ts +2 -0
  53. package/lib/components/Placeholder/Placeholder.js +9 -4
  54. package/lib/components/Placeholder/Placeholder.js.map +1 -1
  55. package/lib/components/Placeholder/PlaceholderContent.d.ts +2 -1
  56. package/lib/components/ProductBlock/ProductBlockContent.d.ts +1 -1
  57. package/lib/components/ProductTile/ProductTileContent.d.ts +1 -1
  58. package/lib/components/PromoTile/PromoTileContent.d.ts +1 -1
  59. package/lib/components/Tile/TileContent.d.ts +1 -1
  60. package/lib/types.d.ts +1 -1
  61. package/lib/ui-kit/Description/Description.d.ts +4 -1
  62. package/lib/ui-kit/Description/Description.js.map +1 -1
  63. package/{mobile/dist/ui-kit/Description/DescriptionProps.d.ts → lib/ui-kit/Description/DescriptionContent.d.ts} +0 -3
  64. package/lib/ui-kit/Description/DescriptionContent.js +2 -0
  65. package/lib/ui-kit/Description/DescriptionContent.js.map +1 -0
  66. package/mobile/bundle/bundle.umd.js +203 -201
  67. package/mobile/bundle/bundle.umd.min.js +1 -1
  68. package/mobile/dist/components/Accordion/utils/isActiveHandler.js +1 -1
  69. package/mobile/dist/components/Accordion/utils/isActiveHandler.js.map +1 -1
  70. package/mobile/dist/components/Blocks.d.ts +3 -1
  71. package/mobile/dist/components/Blocks.js +5 -1
  72. package/mobile/dist/components/Blocks.js.map +1 -1
  73. package/mobile/dist/components/ContentPage/ContentPage.js +2 -2
  74. package/mobile/dist/components/ContentPage/ContentPage.js.map +1 -1
  75. package/mobile/dist/components/ContentPage/isBlockInRegistry.d.ts +1 -2
  76. package/mobile/dist/components/ContentPage/isBlockInRegistry.js +2 -2
  77. package/mobile/dist/components/ContentPage/isBlockInRegistry.js.map +1 -1
  78. package/mobile/dist/components/ContentPage/normalizePage.js +1 -1
  79. package/mobile/dist/components/ContentPage/normalizePage.js.map +1 -1
  80. package/mobile/dist/components/Headline/HeadlineContent.d.ts +1 -1
  81. package/mobile/dist/components/MobileAppTile/MobileAppTileContent.d.ts +1 -1
  82. package/mobile/dist/components/Placeholder/Placeholder.d.ts +1 -1
  83. package/mobile/dist/components/Placeholder/Placeholder.js +8 -3
  84. package/mobile/dist/components/Placeholder/Placeholder.js.map +1 -1
  85. package/mobile/dist/components/Placeholder/PlaceholderContent.d.ts +2 -1
  86. package/mobile/dist/components/ProductBlock/ProductBlockContent.d.ts +1 -1
  87. package/mobile/dist/components/ProductTile/ProductTileContent.d.ts +1 -1
  88. package/mobile/dist/components/PromoTile/PromoTileContent.d.ts +1 -1
  89. package/mobile/dist/components/Tile/TileContent.d.ts +1 -1
  90. package/mobile/dist/types.d.ts +1 -1
  91. package/mobile/dist/ui-kit/Description/Description.d.ts +4 -1
  92. package/mobile/dist/ui-kit/Description/Description.js.map +1 -1
  93. package/mobile/{lib/ui-kit/Description/DescriptionProps.d.ts → dist/ui-kit/Description/DescriptionContent.d.ts} +0 -3
  94. package/mobile/dist/ui-kit/Description/{DescriptionProps.js → DescriptionContent.js} +1 -1
  95. package/mobile/dist/ui-kit/Description/DescriptionContent.js.map +1 -0
  96. package/mobile/lib/components/Accordion/utils/isActiveHandler.js +1 -1
  97. package/mobile/lib/components/Accordion/utils/isActiveHandler.js.map +1 -1
  98. package/mobile/lib/components/Blocks.d.ts +3 -1
  99. package/mobile/lib/components/Blocks.js +5 -1
  100. package/mobile/lib/components/Blocks.js.map +1 -1
  101. package/mobile/lib/components/ContentPage/ContentPage.js +2 -2
  102. package/mobile/lib/components/ContentPage/ContentPage.js.map +1 -1
  103. package/mobile/lib/components/ContentPage/isBlockInRegistry.d.ts +1 -2
  104. package/mobile/lib/components/ContentPage/isBlockInRegistry.js +2 -2
  105. package/mobile/lib/components/ContentPage/isBlockInRegistry.js.map +1 -1
  106. package/mobile/lib/components/ContentPage/normalizePage.js +1 -1
  107. package/mobile/lib/components/ContentPage/normalizePage.js.map +1 -1
  108. package/mobile/lib/components/Headline/HeadlineContent.d.ts +1 -1
  109. package/mobile/lib/components/MobileAppTile/MobileAppTileContent.d.ts +1 -1
  110. package/mobile/lib/components/Placeholder/Placeholder.d.ts +1 -1
  111. package/mobile/lib/components/Placeholder/Placeholder.js +9 -4
  112. package/mobile/lib/components/Placeholder/Placeholder.js.map +1 -1
  113. package/mobile/lib/components/Placeholder/PlaceholderContent.d.ts +2 -1
  114. package/mobile/lib/components/ProductBlock/ProductBlockContent.d.ts +1 -1
  115. package/mobile/lib/components/ProductTile/ProductTileContent.d.ts +1 -1
  116. package/mobile/lib/components/PromoTile/PromoTileContent.d.ts +1 -1
  117. package/mobile/lib/components/Tile/TileContent.d.ts +1 -1
  118. package/mobile/lib/types.d.ts +1 -1
  119. package/mobile/lib/ui-kit/Description/Description.d.ts +4 -1
  120. package/mobile/lib/ui-kit/Description/Description.js.map +1 -1
  121. package/{dist/ui-kit/Description/DescriptionProps.d.ts → mobile/lib/ui-kit/Description/DescriptionContent.d.ts} +0 -3
  122. package/mobile/lib/ui-kit/Description/DescriptionContent.js +2 -0
  123. package/mobile/lib/ui-kit/Description/DescriptionContent.js.map +1 -0
  124. package/mobile/src/components/Accordion/utils/isActiveHandler.ts +1 -2
  125. package/mobile/src/components/Blocks.ts +5 -1
  126. package/mobile/src/components/ContentPage/ContentPage.page.json +37 -43
  127. package/mobile/src/components/ContentPage/ContentPage.tsx +2 -2
  128. package/mobile/src/components/ContentPage/isBlockInRegistry.ts +2 -4
  129. package/mobile/src/components/ContentPage/normalizePage.ts +4 -1
  130. package/mobile/src/components/Headline/HeadlineContent.ts +1 -1
  131. package/mobile/src/components/MobileAppTile/MobileAppTileContent.ts +1 -1
  132. package/mobile/src/components/Placeholder/Placeholder.tsx +36 -14
  133. package/mobile/src/components/Placeholder/PlaceholderContent.ts +2 -1
  134. package/mobile/src/components/ProductBlock/ProductBlockContent.ts +1 -1
  135. package/mobile/src/components/ProductTile/ProductTileContent.ts +1 -1
  136. package/mobile/src/components/PromoTile/PromoTileContent.ts +1 -1
  137. package/mobile/src/components/Tile/TileContent.ts +1 -1
  138. package/mobile/src/types.ts +1 -1
  139. package/mobile/src/ui-kit/Description/Description.tsx +5 -1
  140. package/mobile/src/ui-kit/Description/{DescriptionProps.ts → DescriptionContent.ts} +0 -4
  141. package/package.json +1 -1
  142. package/src/components/Accordion/utils/isActiveHandler.ts +1 -2
  143. package/src/components/Blocks.mobile.ts +5 -1
  144. package/src/components/ContentPage/ContentPage.page.json +37 -43
  145. package/src/components/ContentPage/ContentPage.tsx +2 -2
  146. package/src/components/ContentPage/isBlockInRegistry.ts +2 -4
  147. package/src/components/ContentPage/normalizePage.mobile.ts +4 -1
  148. package/src/components/ContentPage/normalizePage.ts +1 -1
  149. package/src/components/Headline/HeadlineContent.ts +1 -1
  150. package/src/components/MobileAppTile/MobileAppTileContent.ts +1 -1
  151. package/src/components/Placeholder/Placeholder.fixture.mobile.tsx +9 -0
  152. package/src/components/Placeholder/Placeholder.tsx +35 -8
  153. package/src/components/Placeholder/PlaceholderContent.ts +2 -1
  154. package/src/components/ProductBlock/ProductBlock.fixture.mobile.tsx +6 -0
  155. package/src/components/ProductBlock/ProductBlockContent.ts +1 -1
  156. package/src/components/ProductGallery/ProductGallery.fixture.mobile.tsx +8 -0
  157. package/src/components/ProductTile/ProductTileContent.ts +1 -1
  158. package/src/components/PromoTile/PromoTileContent.ts +1 -1
  159. package/src/components/Tile/TileContent.ts +1 -1
  160. package/src/types.ts +1 -1
  161. package/src/ui-kit/Description/Description.tsx +5 -1
  162. package/src/ui-kit/Description/{DescriptionProps.ts → DescriptionContent.ts} +0 -4
  163. package/dist/components/Placeholder/Placeholder.mobile.d.ts +0 -6
  164. package/dist/components/Placeholder/Placeholder.mobile.js +0 -15
  165. package/dist/components/Placeholder/Placeholder.mobile.js.map +0 -1
  166. package/dist/ui-kit/Description/DescriptionProps.js.map +0 -1
  167. package/lib/components/Placeholder/Placeholder.mobile.d.ts +0 -6
  168. package/lib/components/Placeholder/Placeholder.mobile.js +0 -13
  169. package/lib/components/Placeholder/Placeholder.mobile.js.map +0 -1
  170. package/lib/ui-kit/Description/DescriptionProps.js +0 -2
  171. package/lib/ui-kit/Description/DescriptionProps.js.map +0 -1
  172. package/mobile/dist/ui-kit/Description/DescriptionProps.js.map +0 -1
  173. package/mobile/lib/ui-kit/Description/DescriptionProps.js +0 -2
  174. package/mobile/lib/ui-kit/Description/DescriptionProps.js.map +0 -1
  175. package/src/components/Placeholder/Placeholder.mobile.tsx +0 -35
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@redneckz/wildless-cms-uni-blocks",
3
- "version": "0.3.4",
3
+ "version": "0.3.5",
4
4
  "private": false,
5
5
  "license": "MIT",
6
6
  "author": "ЦК",
@@ -5,8 +5,7 @@ export const isActiveHandler = ({ context, blocks }) => {
5
5
  const hasContent = blocks?.length;
6
6
  const icon: IconName = isActive ? 'MinusIcon' : 'PlusIcon';
7
7
 
8
- const getContentBlock = ({ target }) =>
9
- target.tagName === 'BUTTON' ? target.nextSibling : target.parentNode.nextSibling;
8
+ const getContentBlock = ({ currentTarget }) => currentTarget.nextSibling;
10
9
 
11
10
  const handleToggle = (e: MouseEvent) => {
12
11
  if (!hasContent) {
@@ -1,8 +1,10 @@
1
+ import { Accordion } from './Accordion/Accordion';
1
2
  import { ExchangeRateTile } from './ExchangeRateTile/ExchangeRateTile';
2
3
  import { Footer } from './Footer/Footer';
3
4
  import { Header } from './Header/Header';
4
5
  import { Headline } from './Headline/Headline';
5
6
  import { LinkDocs } from './LinkDocs/LinkDocs';
7
+ import { MobileAppTile } from './MobileAppTile/MobileAppTile';
6
8
  import { Placeholder } from './Placeholder/Placeholder';
7
9
  import { ProductBlock } from './ProductBlock/ProductBlock';
8
10
  import { ProductGallery } from './ProductGallery/ProductGallery';
@@ -10,14 +12,16 @@ import { StepsBlock } from './StepsBlock/StepsBlock';
10
12
  import { TextBlock } from './TextBlock/TextBlock';
11
13
 
12
14
  export const Blocks = {
15
+ Accordion,
13
16
  ExchangeRateTile,
14
17
  Footer,
15
18
  Header,
16
19
  Headline,
17
20
  LinkDocs,
21
+ MobileAppTile,
18
22
  Placeholder,
19
23
  ProductBlock,
20
24
  ProductGallery,
21
- TextBlock,
22
25
  StepsBlock,
26
+ TextBlock,
23
27
  };
@@ -83,7 +83,13 @@
83
83
  "size": {
84
84
  "width": 280,
85
85
  "height": 280
86
- }
86
+ },
87
+ "sources": [
88
+ {
89
+ "src": "money-1.png 1x, money-1-2x.png 2x",
90
+ "format": "png"
91
+ }
92
+ ]
87
93
  }
88
94
  }
89
95
  },
@@ -1312,22 +1318,18 @@
1312
1318
  "label": "Accordion label 1",
1313
1319
  "blocks": [
1314
1320
  {
1315
- "type": "TextBlock",
1316
- "data": {
1317
- "title": "Title",
1318
- "description": "Lorem ipsum dolor sit amet consectetur adipisicing elit. Doloremque minima odio soluta cupiditate pariatur, labore molestias quas necessitatibus nesciunt in praesentium accusamus provident sequi maiores autem. Voluptas quam neque iste?",
1319
- "blockVersion": "secondary-light",
1320
- "iconVersion": "small"
1321
- }
1321
+ "accordionBlockType": "TextBlock",
1322
+ "title": "Title",
1323
+ "description": "Lorem ipsum dolor sit amet consectetur adipisicing elit. Doloremque minima odio soluta cupiditate pariatur, labore molestias quas necessitatibus nesciunt in praesentium accusamus provident sequi maiores autem. Voluptas quam neque iste?",
1324
+ "blockVersion": "secondary-light",
1325
+ "iconVersion": "small"
1322
1326
  },
1323
1327
  {
1324
- "type": "TextBlock",
1325
- "data": {
1326
- "title": "Title",
1327
- "description": "Lorem ipsum dolor sit amet consectetur adipisicing elit. Doloremque minima odio soluta cupiditate pariatur, labore molestias quas necessitatibus nesciunt in praesentium accusamus provident sequi maiores autem. Voluptas quam neque iste?",
1328
- "blockVersion": "secondary-light",
1329
- "iconVersion": "small"
1330
- }
1328
+ "accordionBlockType": "TextBlock",
1329
+ "title": "Title",
1330
+ "description": "Lorem ipsum dolor sit amet consectetur adipisicing elit. Doloremque minima odio soluta cupiditate pariatur, labore molestias quas necessitatibus nesciunt in praesentium accusamus provident sequi maiores autem. Voluptas quam neque iste?",
1331
+ "blockVersion": "secondary-light",
1332
+ "iconVersion": "small"
1331
1333
  }
1332
1334
  ]
1333
1335
  },
@@ -1335,22 +1337,18 @@
1335
1337
  "label": "Accordion label 2",
1336
1338
  "blocks": [
1337
1339
  {
1338
- "type": "TextBlock",
1339
- "data": {
1340
- "title": "Title",
1341
- "description": "Lorem ipsum dolor sit amet consectetur adipisicing elit. Doloremque minima odio soluta cupiditate pariatur, labore molestias quas necessitatibus nesciunt in praesentium accusamus provident sequi maiores autem. Voluptas quam neque iste?",
1342
- "blockVersion": "secondary-light",
1343
- "iconVersion": "small"
1344
- }
1340
+ "accordionBlockType": "TextBlock",
1341
+ "title": "Title",
1342
+ "description": "Lorem ipsum dolor sit amet consectetur adipisicing elit. Doloremque minima odio soluta cupiditate pariatur, labore molestias quas necessitatibus nesciunt in praesentium accusamus provident sequi maiores autem. Voluptas quam neque iste?",
1343
+ "blockVersion": "secondary-light",
1344
+ "iconVersion": "small"
1345
1345
  },
1346
1346
  {
1347
- "type": "TextBlock",
1348
- "data": {
1349
- "title": "Title",
1350
- "description": "Lorem ipsum dolor sit amet consectetur adipisicing elit. Doloremque minima odio soluta cupiditate pariatur, labore molestias quas necessitatibus nesciunt in praesentium accusamus provident sequi maiores autem. Voluptas quam neque iste?",
1351
- "blockVersion": "secondary-light",
1352
- "iconVersion": "small"
1353
- }
1347
+ "accordionBlockType": "TextBlock",
1348
+ "title": "Title",
1349
+ "description": "Lorem ipsum dolor sit amet consectetur adipisicing elit. Doloremque minima odio soluta cupiditate pariatur, labore molestias quas necessitatibus nesciunt in praesentium accusamus provident sequi maiores autem. Voluptas quam neque iste?",
1350
+ "blockVersion": "secondary-light",
1351
+ "iconVersion": "small"
1354
1352
  }
1355
1353
  ]
1356
1354
  },
@@ -1358,22 +1356,18 @@
1358
1356
  "label": "Accordion label 3",
1359
1357
  "blocks": [
1360
1358
  {
1361
- "type": "TextBlock",
1362
- "data": {
1363
- "title": "Title",
1364
- "description": "Lorem ipsum dolor sit amet consectetur adipisicing elit. Doloremque minima odio soluta cupiditate pariatur, labore molestias quas necessitatibus nesciunt in praesentium accusamus provident sequi maiores autem. Voluptas quam neque iste?",
1365
- "blockVersion": "secondary-light",
1366
- "iconVersion": "small"
1367
- }
1359
+ "accordionBlockType": "TextBlock",
1360
+ "title": "Title",
1361
+ "description": "Lorem ipsum dolor sit amet consectetur adipisicing elit. Doloremque minima odio soluta cupiditate pariatur, labore molestias quas necessitatibus nesciunt in praesentium accusamus provident sequi maiores autem. Voluptas quam neque iste?",
1362
+ "blockVersion": "secondary-light",
1363
+ "iconVersion": "small"
1368
1364
  },
1369
1365
  {
1370
- "type": "TextBlock",
1371
- "data": {
1372
- "title": "Title",
1373
- "description": "Lorem ipsum dolor sit amet consectetur adipisicing elit. Doloremque minima odio soluta cupiditate pariatur, labore molestias quas necessitatibus nesciunt in praesentium accusamus provident sequi maiores autem. Voluptas quam neque iste?",
1374
- "blockVersion": "secondary-light",
1375
- "iconVersion": "small"
1376
- }
1366
+ "accordionBlockType": "TextBlock",
1367
+ "title": "Title",
1368
+ "description": "Lorem ipsum dolor sit amet consectetur adipisicing elit. Doloremque minima odio soluta cupiditate pariatur, labore molestias quas necessitatibus nesciunt in praesentium accusamus provident sequi maiores autem. Voluptas quam neque iste?",
1369
+ "blockVersion": "secondary-light",
1370
+ "iconVersion": "small"
1377
1371
  }
1378
1372
  ]
1379
1373
  }
@@ -88,11 +88,11 @@ function renderBlock(
88
88
  i: number,
89
89
  ) {
90
90
  const { type } = block;
91
- if (!(type in blocksRegistry)) {
91
+ if (!(type && type in blocksRegistry)) {
92
92
  console.warn(`No block with "${type}" is registered`);
93
93
  }
94
94
 
95
- const BlockComponent = blocksRegistry[type] || Placeholder;
95
+ const BlockComponent = blocksRegistry[type || 'Placeholder'] || Placeholder;
96
96
  return blockDecorator(
97
97
  {
98
98
  blockClassName: style2className(block.style),
@@ -1,5 +1,3 @@
1
- import { BlockDef } from '../../types';
2
-
3
- export function isBlockInRegistry<T>(block: BlockDef, registry: Record<string, T>) {
4
- return block.type in registry;
1
+ export function isBlockInRegistry<T>(blockType: string | undefined, registry: Record<string, T>) {
2
+ return (blockType || '') in registry;
5
3
  }
@@ -32,6 +32,9 @@ export function normalizePage(
32
32
 
33
33
  function getMobileBlocks(blocks?: BlockDef[]) {
34
34
  return blocks
35
- ?.filter((block) => isBlockInRegistry(block, Blocks) && !block.mobile?.hidden)
35
+ ?.filter(
36
+ (block) =>
37
+ isBlockInRegistry(block?.type || block?.mobile?.type, Blocks) && !block.mobile?.hidden,
38
+ )
36
39
  .map(normalizeBlock);
37
40
  }
@@ -31,5 +31,5 @@ export function normalizePage<T extends ContentPageDef | undefined | null>(
31
31
  }
32
32
 
33
33
  function getDesktopBlocks(blocks?: BlockDef[]) {
34
- return blocks?.filter((block) => isBlockInRegistry(block, Blocks)).map(normalizeBlock);
34
+ return blocks?.filter((block) => isBlockInRegistry(block?.type, Blocks)).map(normalizeBlock);
35
35
  }
@@ -1,5 +1,5 @@
1
1
  import type { BgColorVersion } from '../../model/BgColorVersion';
2
- import type { DescriptionContent } from '../../ui-kit/Description/DescriptionProps';
2
+ import type { DescriptionContent } from '../../ui-kit/Description/DescriptionContent';
3
3
  import type { HeadingContent } from '../../ui-kit/Heading/HeadingContent';
4
4
  import type { ImageContent } from '../../ui-kit/Img/ImgProps';
5
5
  import type { AlignType } from '../BaseTile/BaseTileProps';
@@ -1,5 +1,5 @@
1
1
  import type { ButtonContent } from '../../ui-kit/Button/ButtonProps';
2
- import type { DescriptionContent } from '../../ui-kit/Description/DescriptionProps';
2
+ import type { DescriptionContent } from '../../ui-kit/Description/DescriptionContent';
3
3
  import type { HeadingContent } from '../../ui-kit/Heading/HeadingContent';
4
4
 
5
5
  /**
@@ -0,0 +1,9 @@
1
+ import { context } from '../../setup-fixture';
2
+
3
+ import { Placeholder } from './Placeholder';
4
+
5
+ export default (
6
+ <div className="container grid grid-cols-12">
7
+ <Placeholder className="col-span-12" context={context} title="Неизвестный блок" />
8
+ </div>
9
+ );
@@ -1,7 +1,12 @@
1
1
  import { JSX } from '@redneckz/uni-jsx';
2
2
  import type { PlaceholderContent } from '../../components/Placeholder/PlaceholderContent';
3
- import { Tile } from '../Tile/Tile';
4
3
  import type { UniBlockProps } from '../../types';
4
+ import { Description } from '../../ui-kit/Description/Description';
5
+ import { Heading } from '../../ui-kit/Heading/Heading';
6
+ import { BaseTile } from '../BaseTile/BaseTile';
7
+ import { getTileHeadingType } from '../BaseTile/getTileHeadingType';
8
+ import { getTileMinHeight } from '../BaseTile/getTileMinHeight';
9
+ import { getTileRightPadding } from '../BaseTile/getTileRightPadding';
5
10
 
6
11
  export interface PlaceholderProps extends PlaceholderContent, UniBlockProps {
7
12
  className?: string;
@@ -9,13 +14,35 @@ export interface PlaceholderProps extends PlaceholderContent, UniBlockProps {
9
14
 
10
15
  const GOLDEN_RATIO = 1.618;
11
16
 
12
- export const Placeholder = JSX<PlaceholderProps>(({ className, context, title }) => {
13
- return (
14
- <Tile className={className} context={context} title={title} description="Блок в разработке...">
15
- <figure className="m-0 min-w-[600px]">{renderShimmer()}</figure>
16
- </Tile>
17
- );
18
- });
17
+ export const Placeholder = JSX<PlaceholderProps>(
18
+ ({ className, context, title, description = 'Блок в разработке...' }) => {
19
+ return (
20
+ <section
21
+ className={`bg-white text-primary-text font-sans p-9 box-border ${className} ${getTileRightPadding(
22
+ className,
23
+ )} ${getTileMinHeight(className)} `}
24
+ >
25
+ <BaseTile
26
+ context={context}
27
+ title={
28
+ title ? (
29
+ <Heading
30
+ headingType={getTileHeadingType(className)}
31
+ title={title}
32
+ className={`whitespace-pre-wrap max-w-[600px]`}
33
+ />
34
+ ) : null
35
+ }
36
+ >
37
+ {description ? (
38
+ <Description className="mt-4 max-w-[600px]" description={description} />
39
+ ) : null}
40
+ <figure className="m-0 min-w-[600px]">{renderShimmer()}</figure>
41
+ </BaseTile>
42
+ </section>
43
+ );
44
+ },
45
+ );
19
46
 
20
47
  const renderShimmer = (size = 3) =>
21
48
  goldenSequence(100, size)
@@ -1,6 +1,7 @@
1
+ import type { DescriptionContent } from '../../ui-kit/Description/DescriptionContent';
1
2
  import type { HeadingContent } from '../../ui-kit/Heading/HeadingContent';
2
3
 
3
4
  /**
4
5
  * @hidden
5
6
  */
6
- export type PlaceholderContent = HeadingContent;
7
+ export type PlaceholderContent = HeadingContent & DescriptionContent;
@@ -10,6 +10,12 @@ const image: Picture = {
10
10
  width: 280,
11
11
  height: 280,
12
12
  },
13
+ sources: [
14
+ {
15
+ src: 'money-1.png 1x, money-1-2x.png 2x',
16
+ format: 'png',
17
+ },
18
+ ],
13
19
  };
14
20
 
15
21
  export default {
@@ -1,7 +1,7 @@
1
1
  import type { BlockVersion } from '../../model/BlockVersion';
2
2
  import type { LinkProps } from '../../model/LinkProps';
3
3
  import type { ButtonContent } from '../../ui-kit/Button/ButtonProps';
4
- import type { DescriptionContent } from '../../ui-kit/Description/DescriptionProps';
4
+ import type { DescriptionContent } from '../../ui-kit/Description/DescriptionContent';
5
5
  import type { HeadingContent, HeadingTypeContent } from '../../ui-kit/Heading/HeadingContent';
6
6
  import type { ImageContent } from '../../ui-kit/Img/ImgProps';
7
7
  import type { ListContent } from '../../ui-kit/List/ListContent';
@@ -10,11 +10,18 @@ const moneyImage: Picture = {
10
10
  height: 280,
11
11
  },
12
12
  alt: 'Варианты потребительского кредита',
13
+ sources: [
14
+ {
15
+ src: 'money-1.png 1x, money-1-2x.png 2x',
16
+ format: 'png',
17
+ },
18
+ ],
13
19
  };
14
20
 
15
21
  const worker: Picture = {
16
22
  src: 'money-2.png',
17
23
  format: 'webp',
24
+ alt: 'Варианты потребительского кредита',
18
25
  size: {
19
26
  width: 280,
20
27
  height: 280,
@@ -24,6 +31,7 @@ const worker: Picture = {
24
31
  const creditCard: Picture = {
25
32
  src: 'credit-card-1.png',
26
33
  format: 'webp',
34
+ alt: 'Варианты потребительского кредита',
27
35
  size: {
28
36
  width: 280,
29
37
  height: 280,
@@ -1,6 +1,6 @@
1
1
  import type { BlockVersion } from '../../model/BlockVersion';
2
2
  import type { ButtonContent } from '../../ui-kit/Button/ButtonProps';
3
- import type { DescriptionContent } from '../../ui-kit/Description/DescriptionProps';
3
+ import type { DescriptionContent } from '../../ui-kit/Description/DescriptionContent';
4
4
  import type { HeadingContent } from '../../ui-kit/Heading/HeadingContent';
5
5
  import type { ImageContent } from '../../ui-kit/Img/ImgProps';
6
6
  import type { TextBenefit } from '../BenefitsBlock/BenefitsBlockContent';
@@ -1,6 +1,6 @@
1
1
  import type { BlockVersion } from '../../model/BlockVersion';
2
2
  import type { ButtonContent } from '../../ui-kit/Button/ButtonProps';
3
- import type { DescriptionContent } from '../../ui-kit/Description/DescriptionProps';
3
+ import type { DescriptionContent } from '../../ui-kit/Description/DescriptionContent';
4
4
  import type { HeadingContent } from '../../ui-kit/Heading/HeadingContent';
5
5
 
6
6
  /**
@@ -1,6 +1,6 @@
1
1
  import type { BlockVersion } from '../../model/BlockVersion';
2
2
  import type { ButtonContent } from '../../ui-kit/Button/ButtonProps';
3
- import type { DescriptionContent } from '../../ui-kit/Description/DescriptionProps';
3
+ import type { DescriptionContent } from '../../ui-kit/Description/DescriptionContent';
4
4
  import type { HeadingContent } from '../../ui-kit/Heading/HeadingContent';
5
5
  import type { ImageContent } from '../../ui-kit/Img/ImgProps';
6
6
  import type { ListContent } from '../../ui-kit/List/ListContent';
package/src/types.ts CHANGED
@@ -5,7 +5,7 @@ import type { BlockVersion } from './model/BlockVersion';
5
5
  export type ColorPalette = 'pc' | 'bc' | 'eo' | 'eo2' | 'eo3' | 'eo4';
6
6
 
7
7
  export interface BaseBlockDef {
8
- type: string;
8
+ type?: string;
9
9
  style?: string[];
10
10
  content?: BlockContent;
11
11
  version?: BlockVersion;
@@ -1,5 +1,9 @@
1
1
  import { JSX } from '@redneckz/uni-jsx';
2
- import { DescriptionProps } from './DescriptionProps';
2
+ import { DescriptionContent } from './DescriptionContent';
3
+
4
+ export interface DescriptionProps extends DescriptionContent {
5
+ className?: string;
6
+ }
3
7
 
4
8
  export const Description = JSX<DescriptionProps>((props) => {
5
9
  const { className, description } = props;
@@ -2,7 +2,3 @@ export interface DescriptionContent {
2
2
  /** @title Описание */
3
3
  description?: string;
4
4
  }
5
-
6
- export interface DescriptionProps extends DescriptionContent {
7
- className?: string;
8
- }
@@ -1,6 +0,0 @@
1
- import type { UniBlockProps } from '../../types';
2
- import type { PlaceholderContent } from './PlaceholderContent';
3
- export interface PlaceholderProps extends PlaceholderContent, UniBlockProps {
4
- className?: string;
5
- }
6
- export declare const Placeholder: (props: import("@redneckz/uni-jsx").PropsWithChildren<PlaceholderProps, any>, context?: any) => any;
@@ -1,15 +0,0 @@
1
- Object.defineProperty(exports, "__esModule", { value: true });
2
- exports.Placeholder = void 0;
3
- const jsx_runtime_1 = require("@redneckz/uni-jsx/jsx-runtime");
4
- const uni_jsx_1 = require("@redneckz/uni-jsx");
5
- const Tile_1 = require("../Tile/Tile");
6
- const GOLDEN_RATIO = 1.618;
7
- exports.Placeholder = (0, uni_jsx_1.JSX)(({ className = '', context, title }) => {
8
- return ((0, jsx_runtime_1.jsx)(Tile_1.Tile, { className: `pr-0 min-h-0 ${className}`, context: context, title: title, description: "\u0411\u043B\u043E\u043A \u0432 \u0440\u0430\u0437\u0440\u0430\u0431\u043E\u0442\u043A\u0435...", children: (0, jsx_runtime_1.jsx)("figure", { className: "m-0", children: renderShimmer() }) }));
9
- });
10
- const renderShimmer = (size = 3) => goldenSequence(100, size)
11
- .map((_) => Math.floor(_))
12
- .map(renderShimmerItem);
13
- const renderShimmerItem = (width = 100, index) => ((0, jsx_runtime_1.jsx)("div", { style: { width: `${width}%` }, className: "h-4 mt-2 bg-secondary-light" }, String(index)));
14
- const goldenSequence = (first, size) => [first].concat(size > 0 ? goldenSequence(first / GOLDEN_RATIO, size - 1) : []);
15
- //# sourceMappingURL=Placeholder.mobile.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Placeholder.mobile.js","sourceRoot":"","sources":["../../../src/components/Placeholder/Placeholder.mobile.tsx"],"names":[],"mappings":";;;AAAA,+CAAwC;AAExC,uCAAoC;AAOpC,MAAM,YAAY,GAAG,KAAK,CAAC;AAEd,QAAA,WAAW,GAAG,IAAA,aAAG,EAAmB,CAAC,EAAE,SAAS,GAAG,EAAE,EAAE,OAAO,EAAE,KAAK,EAAE,EAAE,EAAE;IACtF,OAAO,CACL,uBAAC,WAAI,IACH,SAAS,EAAE,gBAAgB,SAAS,EAAE,EACtC,OAAO,EAAE,OAAO,EAChB,KAAK,EAAE,KAAK,EACZ,WAAW,EAAC,iGAAsB,YAElC,mCAAQ,SAAS,EAAC,KAAK,YAAE,aAAa,EAAE,GAAU,GAC7C,CACR,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,MAAM,aAAa,GAAG,CAAC,IAAI,GAAG,CAAC,EAAE,EAAE,CACjC,cAAc,CAAC,GAAG,EAAE,IAAI,CAAC;KACtB,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;KACzB,GAAG,CAAC,iBAAiB,CAAC,CAAC;AAE5B,MAAM,iBAAiB,GAAG,CAAC,KAAK,GAAG,GAAG,EAAE,KAAa,EAAE,EAAE,CAAC,CACxD,gCAAyB,KAAK,EAAE,EAAE,KAAK,EAAE,GAAG,KAAK,GAAG,EAAE,EAAE,SAAS,EAAC,6BAA6B,IAArF,MAAM,CAAC,KAAK,CAAC,CAA2E,CACnG,CAAC;AAEF,MAAM,cAAc,GAAG,CAAC,KAAa,EAAE,IAAY,EAAY,EAAE,CAC/D,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,IAAI,GAAG,CAAC,CAAC,CAAC,CAAC,cAAc,CAAC,KAAK,GAAG,YAAY,EAAE,IAAI,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"DescriptionProps.js","sourceRoot":"","sources":["../../../src/ui-kit/Description/DescriptionProps.ts"],"names":[],"mappings":""}
@@ -1,6 +0,0 @@
1
- import type { UniBlockProps } from '../../types';
2
- import type { PlaceholderContent } from './PlaceholderContent';
3
- export interface PlaceholderProps extends PlaceholderContent, UniBlockProps {
4
- className?: string;
5
- }
6
- export declare const Placeholder: (props: import("@redneckz/uni-jsx").PropsWithChildren<PlaceholderProps, any>, context?: any) => any;
@@ -1,13 +0,0 @@
1
- import { jsx as _jsx } from "@redneckz/uni-jsx/jsx-runtime";
2
- import { JSX } from '@redneckz/uni-jsx';
3
- import { Tile } from '../Tile/Tile.js';
4
- const GOLDEN_RATIO = 1.618;
5
- export const Placeholder = JSX(({ className = '', context, title }) => {
6
- return (_jsx(Tile, { className: `pr-0 min-h-0 ${className}`, context: context, title: title, description: "\u0411\u043B\u043E\u043A \u0432 \u0440\u0430\u0437\u0440\u0430\u0431\u043E\u0442\u043A\u0435...", children: _jsx("figure", { className: "m-0", children: renderShimmer() }) }));
7
- });
8
- const renderShimmer = (size = 3) => goldenSequence(100, size)
9
- .map((_) => Math.floor(_))
10
- .map(renderShimmerItem);
11
- const renderShimmerItem = (width = 100, index) => (_jsx("div", { style: { width: `${width}%` }, className: "h-4 mt-2 bg-secondary-light" }, String(index)));
12
- const goldenSequence = (first, size) => [first].concat(size > 0 ? goldenSequence(first / GOLDEN_RATIO, size - 1) : []);
13
- //# sourceMappingURL=Placeholder.mobile.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Placeholder.mobile.js","sourceRoot":"","sources":["../../../src/components/Placeholder/Placeholder.mobile.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAExC,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAOpC,MAAM,YAAY,GAAG,KAAK,CAAC;AAE3B,MAAM,CAAC,MAAM,WAAW,GAAG,GAAG,CAAmB,CAAC,EAAE,SAAS,GAAG,EAAE,EAAE,OAAO,EAAE,KAAK,EAAE,EAAE,EAAE;IACtF,OAAO,CACL,KAAC,IAAI,IACH,SAAS,EAAE,gBAAgB,SAAS,EAAE,EACtC,OAAO,EAAE,OAAO,EAChB,KAAK,EAAE,KAAK,EACZ,WAAW,EAAC,iGAAsB,YAElC,iBAAQ,SAAS,EAAC,KAAK,YAAE,aAAa,EAAE,GAAU,GAC7C,CACR,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,MAAM,aAAa,GAAG,CAAC,IAAI,GAAG,CAAC,EAAE,EAAE,CACjC,cAAc,CAAC,GAAG,EAAE,IAAI,CAAC;KACtB,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;KACzB,GAAG,CAAC,iBAAiB,CAAC,CAAC;AAE5B,MAAM,iBAAiB,GAAG,CAAC,KAAK,GAAG,GAAG,EAAE,KAAa,EAAE,EAAE,CAAC,CACxD,cAAyB,KAAK,EAAE,EAAE,KAAK,EAAE,GAAG,KAAK,GAAG,EAAE,EAAE,SAAS,EAAC,6BAA6B,IAArF,MAAM,CAAC,KAAK,CAAC,CAA2E,CACnG,CAAC;AAEF,MAAM,cAAc,GAAG,CAAC,KAAa,EAAE,IAAY,EAAY,EAAE,CAC/D,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,IAAI,GAAG,CAAC,CAAC,CAAC,CAAC,cAAc,CAAC,KAAK,GAAG,YAAY,EAAE,IAAI,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC"}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=DescriptionProps.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"DescriptionProps.js","sourceRoot":"","sources":["../../../src/ui-kit/Description/DescriptionProps.ts"],"names":[],"mappings":""}
@@ -1 +0,0 @@
1
- {"version":3,"file":"DescriptionProps.js","sourceRoot":"","sources":["../../../src/ui-kit/Description/DescriptionProps.ts"],"names":[],"mappings":""}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=DescriptionProps.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"DescriptionProps.js","sourceRoot":"","sources":["../../../src/ui-kit/Description/DescriptionProps.ts"],"names":[],"mappings":""}
@@ -1,35 +0,0 @@
1
- import { JSX } from '@redneckz/uni-jsx';
2
- import type { UniBlockProps } from '../../types';
3
- import { Tile } from '../Tile/Tile';
4
- import type { PlaceholderContent } from './PlaceholderContent';
5
-
6
- export interface PlaceholderProps extends PlaceholderContent, UniBlockProps {
7
- className?: string;
8
- }
9
-
10
- const GOLDEN_RATIO = 1.618;
11
-
12
- export const Placeholder = JSX<PlaceholderProps>(({ className = '', context, title }) => {
13
- return (
14
- <Tile
15
- className={`pr-0 min-h-0 ${className}`}
16
- context={context}
17
- title={title}
18
- description="Блок в разработке..."
19
- >
20
- <figure className="m-0">{renderShimmer()}</figure>
21
- </Tile>
22
- );
23
- });
24
-
25
- const renderShimmer = (size = 3) =>
26
- goldenSequence(100, size)
27
- .map((_) => Math.floor(_))
28
- .map(renderShimmerItem);
29
-
30
- const renderShimmerItem = (width = 100, index: number) => (
31
- <div key={String(index)} style={{ width: `${width}%` }} className="h-4 mt-2 bg-secondary-light" />
32
- );
33
-
34
- const goldenSequence = (first: number, size: number): number[] =>
35
- [first].concat(size > 0 ? goldenSequence(first / GOLDEN_RATIO, size - 1) : []);