@redneckz/wildless-cms-uni-blocks 0.14.139 → 0.14.140

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 (90) hide show
  1. package/bin/migration-scripts/0.14.138.js +69 -0
  2. package/bundle/blocks.schema.json +1 -1
  3. package/bundle/bundle.umd.js +54 -66
  4. package/bundle/bundle.umd.min.js +1 -1
  5. package/bundle/ui-kit/BaseTile/BaseTile.d.ts +2 -2
  6. package/dist/components/Blocks.js +0 -2
  7. package/dist/components/Blocks.js.map +1 -1
  8. package/dist/components/Blocks.mobile.js +0 -2
  9. package/dist/components/Blocks.mobile.js.map +1 -1
  10. package/dist/ui-kit/BaseTile/BaseTile.d.ts +2 -2
  11. package/dist/ui-kit/BaseTile/BaseTile.js +5 -2
  12. package/dist/ui-kit/BaseTile/BaseTile.js.map +1 -1
  13. package/dist/ui-kit/Unit/Unit.js +1 -1
  14. package/dist/ui-kit/Unit/Unit.js.map +1 -1
  15. package/lib/common.css +1 -1
  16. package/lib/components/Blocks.js +0 -2
  17. package/lib/components/Blocks.js.map +1 -1
  18. package/lib/components/Blocks.mobile.js +0 -2
  19. package/lib/components/Blocks.mobile.js.map +1 -1
  20. package/lib/ui-kit/BaseTile/BaseTile.d.ts +2 -2
  21. package/lib/ui-kit/BaseTile/BaseTile.js +5 -2
  22. package/lib/ui-kit/BaseTile/BaseTile.js.map +1 -1
  23. package/lib/ui-kit/Unit/Unit.js +1 -1
  24. package/lib/ui-kit/Unit/Unit.js.map +1 -1
  25. package/mobile/bundle/bundle.umd.js +54 -66
  26. package/mobile/bundle/bundle.umd.min.js +1 -1
  27. package/mobile/bundle/ui-kit/BaseTile/BaseTile.d.ts +2 -2
  28. package/mobile/dist/components/Blocks.js +0 -2
  29. package/mobile/dist/components/Blocks.js.map +1 -1
  30. package/mobile/dist/ui-kit/BaseTile/BaseTile.d.ts +2 -2
  31. package/mobile/dist/ui-kit/BaseTile/BaseTile.js +5 -2
  32. package/mobile/dist/ui-kit/BaseTile/BaseTile.js.map +1 -1
  33. package/mobile/dist/ui-kit/Unit/Unit.js +1 -1
  34. package/mobile/dist/ui-kit/Unit/Unit.js.map +1 -1
  35. package/mobile/lib/common.css +1 -1
  36. package/mobile/lib/components/Blocks.js +0 -2
  37. package/mobile/lib/components/Blocks.js.map +1 -1
  38. package/mobile/lib/ui-kit/BaseTile/BaseTile.d.ts +2 -2
  39. package/mobile/lib/ui-kit/BaseTile/BaseTile.js +5 -2
  40. package/mobile/lib/ui-kit/BaseTile/BaseTile.js.map +1 -1
  41. package/mobile/lib/ui-kit/Unit/Unit.js +1 -1
  42. package/mobile/lib/ui-kit/Unit/Unit.js.map +1 -1
  43. package/mobile/src/components/Blocks.ts +0 -2
  44. package/mobile/src/ui-kit/BaseTile/BaseTile.tsx +14 -2
  45. package/mobile/src/ui-kit/Unit/Unit.tsx +1 -1
  46. package/package.json +1 -1
  47. package/src/components/Blocks.mobile.ts +0 -2
  48. package/src/components/Blocks.ts +0 -2
  49. package/src/ui-kit/BaseTile/BaseTile.tsx +14 -2
  50. package/src/ui-kit/Unit/Unit.tsx +1 -1
  51. package/bundle/components/Bonus/Bonus.d.ts +0 -5
  52. package/bundle/components/Bonus/BonusContent.d.ts +0 -47
  53. package/dist/components/Bonus/Bonus.d.ts +0 -5
  54. package/dist/components/Bonus/Bonus.js +0 -23
  55. package/dist/components/Bonus/Bonus.js.map +0 -1
  56. package/dist/components/Bonus/BonusContent.d.ts +0 -47
  57. package/dist/components/Bonus/BonusContent.js +0 -2
  58. package/dist/components/Bonus/BonusContent.js.map +0 -1
  59. package/lib/components/Bonus/Bonus.d.ts +0 -5
  60. package/lib/components/Bonus/Bonus.fixture.d.ts +0 -8
  61. package/lib/components/Bonus/Bonus.fixture.mobile.d.ts +0 -8
  62. package/lib/components/Bonus/Bonus.js +0 -21
  63. package/lib/components/Bonus/Bonus.js.map +0 -1
  64. package/lib/components/Bonus/BonusContent.d.ts +0 -47
  65. package/lib/components/Bonus/BonusContent.js +0 -2
  66. package/lib/components/Bonus/BonusContent.js.map +0 -1
  67. package/mobile/bundle/components/Bonus/Bonus.d.ts +0 -5
  68. package/mobile/bundle/components/Bonus/BonusContent.d.ts +0 -47
  69. package/mobile/dist/components/Bonus/Bonus.d.ts +0 -5
  70. package/mobile/dist/components/Bonus/Bonus.js +0 -23
  71. package/mobile/dist/components/Bonus/Bonus.js.map +0 -1
  72. package/mobile/dist/components/Bonus/BonusContent.d.ts +0 -47
  73. package/mobile/dist/components/Bonus/BonusContent.js +0 -2
  74. package/mobile/dist/components/Bonus/BonusContent.js.map +0 -1
  75. package/mobile/lib/components/Bonus/Bonus.d.ts +0 -5
  76. package/mobile/lib/components/Bonus/Bonus.js +0 -21
  77. package/mobile/lib/components/Bonus/Bonus.js.map +0 -1
  78. package/mobile/lib/components/Bonus/BonusContent.d.ts +0 -47
  79. package/mobile/lib/components/Bonus/BonusContent.js +0 -2
  80. package/mobile/lib/components/Bonus/BonusContent.js.map +0 -1
  81. package/mobile/src/components/Bonus/Bonus.example.json +0 -13
  82. package/mobile/src/components/Bonus/Bonus.tsx +0 -80
  83. package/mobile/src/components/Bonus/Bonus.ui.json +0 -29
  84. package/mobile/src/components/Bonus/BonusContent.ts +0 -55
  85. package/src/components/Bonus/Bonus.example.json +0 -13
  86. package/src/components/Bonus/Bonus.fixture.mobile.tsx +0 -72
  87. package/src/components/Bonus/Bonus.fixture.tsx +0 -72
  88. package/src/components/Bonus/Bonus.tsx +0 -80
  89. package/src/components/Bonus/Bonus.ui.json +0 -29
  90. package/src/components/Bonus/BonusContent.ts +0 -55
@@ -365,6 +365,54 @@
365
365
  return (jsxs(BlockWrapper, { className: style(isEmbedded ? '@container-normal' : '', className), defaultPadding: isEmbedded ? '' : 'p-6xl', version: version, isTheme: isTheme, ...rest, children: [title ? (jsx(Heading, { className: style('whitespace-pre-wrap', align), ...versionStyle?.title, as: as || versionStyle?.title.as, title: title })) : null, description ? (jsx(Paragraph, { size: versionStyle.descriptionSize, font: versionStyle.descriptionWeight, align: align, ...descriptionStyle, children: description })) : null] }));
366
366
  });
367
367
 
368
+ const DEFAULT_SLOT_NAME = null;
369
+
370
+ const defaultBlockDecorator = ({ blockClassName, block, render }) => render({ blockClassName, block });
371
+
372
+ const DEFAULT_ANCESTORS = [];
373
+ const defaultStyle = 'col-span-12';
374
+ function renderBlock$1(block, options, { className, ...extraProps } = {}) {
375
+ const { key, blockDecorator = defaultBlockDecorator, blocksRegistry = {}, ancestors = DEFAULT_ANCESTORS, } = options;
376
+ const { type } = block;
377
+ if (!(type && type in blocksRegistry)) {
378
+ console.warn(`No block with "${type}" is registered`);
379
+ }
380
+ const BlockComponent = type && blocksRegistry[type];
381
+ return blockDecorator({
382
+ blockClassName: style(block.style?.length ? block.style : defaultStyle, className),
383
+ block,
384
+ ancestors,
385
+ // Adjusted by decorator block and blockClassName
386
+ render: ({ block: adjustedBlock, blockClassName: adjustedBlockClassName }) => {
387
+ const { content } = adjustedBlock;
388
+ return BlockComponent ? (jsx(BlockComponent, { className: adjustedBlockClassName, block: block, options: options, ...content, ...extraProps }, key)) : null;
389
+ },
390
+ }, key);
391
+ }
392
+
393
+ const EMPTY_ANCESTORS = [];
394
+ const renderBlocksList = (blocks, { key, ancestors = EMPTY_ANCESTORS, slotName = DEFAULT_SLOT_NAME, extraProps, renderProps = renderBlock$1, ...options }) => {
395
+ const renderChildBlock = extraProps
396
+ ? (childBlock, childOptions) => renderBlock$1(childBlock, childOptions, extraProps)
397
+ : renderProps;
398
+ return (blocks || []).map((_, i) => renderChildBlock(_, {
399
+ ...options,
400
+ key: `${key ? key : _.type}-${i}`,
401
+ ancestors: options.parent
402
+ ? [...(ancestors || EMPTY_ANCESTORS), [options.parent, slotName]]
403
+ : ancestors,
404
+ }, i));
405
+ };
406
+
407
+ function renderChildren({ block, options, children, extraProps, renderProps, }) {
408
+ if (children) {
409
+ return children;
410
+ }
411
+ return block && options
412
+ ? renderBlocksList(block.blocks, { ...options, parent: block, extraProps, renderProps })
413
+ : null;
414
+ }
415
+
368
416
  function useRouter() {
369
417
  return useRouter._impl();
370
418
  }
@@ -631,22 +679,24 @@
631
679
  center: '@xl:self-center',
632
680
  end: '@xl:self-end',
633
681
  };
634
- const BaseTile = JSX(({ className, version = 'primary', defaultPadding, padding = '', title = '', insetTitle = '', buttons, leftImage, rightImage, imageAlign, isImageAlwaysOnRight = false, isImageSecondary = false, backwardButton, children, }) => {
682
+ const BaseTile = JSX(({ className, version = 'primary', defaultPadding, padding = '', title = '', insetTitle = '', buttons, leftImage, rightImage, imageAlign, isImageAlwaysOnRight = false, isImageSecondary = false, backwardButton, children, ...rest }) => {
635
683
  const router = useRouter();
636
684
  const handleClick = useCallback((ev) => {
637
685
  ev?.preventDefault();
638
686
  router.back();
639
687
  }, []);
640
688
  return (jsxs("div", { className: getStyle(padding, defaultPadding, className), children: [backwardButton ? renderBackwardButton(version, handleClick) : null, title ? jsx("div", { className: "relative h-full", children: title }) : null, jsxs("div", { className: style('grow relative flex flex-col @xl:flex-row gap-3xl w-full', leftImage ? 'self-start @xl:w-auto' : ''), children: [renderImageContainer(leftImage, { imageAlign, className: 'mx-auto' }), jsxs("div", { className: style('grid gap-3xl', rightImage ? '@xl:grid-cols-2' : '', leftImage ? '' : 'grow', 'h-full', //? fix issue https://github.com/redneckz/temp_wcms/issues/1254
641
- 'auto-rows-[max-content_1fr]'), children: [jsxs("div", { className: "grow space-y-lg min-w-fit", children: [insetTitle, children] }), renderImageContainer(rightImage, {
689
+ 'auto-rows-[max-content_1fr]'), children: [jsxs("div", { className: "grow space-y-lg min-w-fit", children: [insetTitle, children] }), renderUnitBlock(renderChildren({ ...rest, extraProps: { className: '@container-normal' } })), renderImageContainer(rightImage, {
642
690
  className: style('@xl:justify-self-end @xl:col-start-2', buttons ? rowSpanStyle(isImageAlwaysOnRight) : '', positionStyle(isImageAlwaysOnRight), imageSecondaryStyle(isImageSecondary)),
643
691
  imageAlign,
644
692
  }), renderButtons(buttons)] })] })] }));
645
693
  });
694
+ BaseTile.childrenTypes = ['UnitBlock'];
646
695
  const getStyle = (padding = '', defaultPadding = '', className = '') => style('relative flex flex-col gap-3xl overflow-hidden', padding || defaultPadding, className);
647
696
  const rowSpanStyle = (isImageAlwaysOnRight) => isImageAlwaysOnRight ? 'row-span-2' : '@xl:row-span-2';
648
697
  const positionStyle = (isImageAlwaysOnRight) => isImageAlwaysOnRight ? 'col-start-2 self-center' : '';
649
698
  const renderButtons = (buttons) => buttons ? jsx("div", { className: "self-end", children: buttons }) : null;
699
+ const renderUnitBlock = (unitBlock) => unitBlock && unitBlock?.length ? (jsx("div", { className: "flex items-start justify-end", children: unitBlock })) : null;
650
700
  const renderImageContainer = (image, { className, imageAlign }) => image ? (jsx("div", { className: style('shrink-1/2 justify-self-center', imageAlign && imageAlignmentMap[imageAlign], className), children: image })) : null;
651
701
  const imageSecondaryStyle = (isImageSecondary) => isImageSecondary ? 'hidden @xl:block' : '';
652
702
 
@@ -1966,19 +2016,6 @@
1966
2016
  const BenefitsBlock = JSX(({ className = '', title, benefitList, ...rest }) => (jsxs(BlockWrapper, { className: className, defaultPadding: "p-6xl", ...rest, children: [title ? jsx(Heading, { headingType: "h3", as: "h2", className: AlignStyles, title: title }) : null, benefitList?.length ? (jsx("div", { className: "flex flex-col @md:flex-row flex-wrap w-full @md:justify-center mt-xl gap-5xl", role: "list", children: benefitList.map(renderBenefit) })) : null] })));
1967
2017
  const renderBenefit = ({ label, description, items, icon, iconBgVersion, isDotted = false }, i) => (jsxs("div", { className: "flex gap-m items-center @md:basis-1/2 @md:max-w-[500px]", role: "listitem", children: [icon?.icon ? (jsx(RoundedIcon, { className: "shrink-0", defaultIconSize: defaultIconSize, iconBgVersion: iconBgVersion || '', ...icon })) : null, icon?.src ? jsx(Img, { className: "shrink-0", image: icon }) : null, label ? (jsxs("div", { className: "@sm:h-full space-y-xs", children: [jsx(Heading, { headingType: "h6", children: label }), jsx(Text, { size: "text-l", color: "text-secondary-text group-data-secondary:text-white/80", font: "font-light", children: description }), jsx(List, { dotClassName: "bg-secondary-text", listItemSize: "S", items: items, isDotted: isDotted })] })) : null] }, String(i)));
1968
2018
 
1969
- const Bonus = JSX(({ className = '', title, description, bonusItems = [], align = AlignStyles, ...rest }) => (jsx(BlockWrapper, { className: className, defaultPadding: "p-6xl", ...rest, children: jsxs("div", { className: "container", children: [jsx(Headline, { className: "mb-xl", isEmbedded: true, title: title, description: description, headlineVersion: "M", align: align }), jsx("div", { className: "flex flex-wrap gap-3xl gap-x-m w-full", children: bonusItems.length > 0
1970
- ? bonusItems.map((_, i) => (jsxs("div", { className: "w-full @xl:w-[48%] sm:space-y-xs flex flex-col grow p-xl sm:p-m border border-gray", children: [jsx("div", { className: "grow", children: jsx(Headline, { title: _?.title, description: _?.description, headlineVersion: "S", isEmbedded: true, align: "text-left" }) }), jsxs("div", { className: "flex justify-center sm:justify-between sm:items-end", children: [jsx("div", { className: "hidden sm:block", children: renderButtonsSection(_?.buttons) }), _.bonusItemContent?.bonusType
1971
- ? renderBonusItemContent(_.bonusItemContent)
1972
- : null] })] }, String(i))))
1973
- : null })] }) })));
1974
- const renderBonusItemContent = (bonusItemContent) => bonusItemContent.bonusType === 'count'
1975
- ? renderBonusCount(bonusItemContent)
1976
- : renderBonusImage(bonusItemContent);
1977
- const renderBonusCount = (_) => (jsxs("div", { className: "w-full pt-default @xl:mt-s @xl:mb-4 flex justify-center sm:justify-end items-end", children: [_.bonusCount ? (
1978
- // -mb-10 добавлен для выравнивания bonusCount относительно bonusName, тк шрифт font-mohave неправильно высчитывает line-height
1979
- jsx("div", { className: "shrink-0 -mb-6 @xl:-mb-4", children: jsx("span", { className: "font-mohave text-title-large sm:text-title-extra gradient-color-text", children: _.bonusCount }) })) : null, _.bonusName ? (jsx("div", { className: "shrink-0 gradient-color-text", children: jsx(Text, { size: "text-h2", children: _.bonusName }) })) : null] }));
1980
- const renderBonusImage = (_) => _.image ? jsx(Img, { className: "min-w-12 p-xs rounded-icon shrink-0", image: _.image }) : null;
1981
-
1982
2019
  const bonusBenefitStyles = 'items-center';
1983
2020
 
1984
2021
  const renderBonusBenefit = (cardTextAlign) => ({ icon, title, description }, i) => (jsxs("div", { className: style('flex flex-col gap-1', bonusBenefitStyles, !description && !title ? 'justify-center' : ''), children: [title ? (jsx(Text, { size: "text-h6", font: "font-normal", align: cardTextAlign, children: title })) : null, icon ? jsx(Img, { image: icon, height: "180", className: "w-auto mx-auto" }) : null, description ? (jsx(Text, { size: "text-h6", font: "font-normal", align: cardTextAlign, children: description })) : null] }, String(i)));
@@ -3073,54 +3110,6 @@
3073
3110
 
3074
3111
  const ITEMS_GAP = 16;
3075
3112
 
3076
- const defaultBlockDecorator = ({ blockClassName, block, render }) => render({ blockClassName, block });
3077
-
3078
- const DEFAULT_ANCESTORS = [];
3079
- const defaultStyle = 'col-span-12';
3080
- function renderBlock$1(block, options, { className, ...extraProps } = {}) {
3081
- const { key, blockDecorator = defaultBlockDecorator, blocksRegistry = {}, ancestors = DEFAULT_ANCESTORS, } = options;
3082
- const { type } = block;
3083
- if (!(type && type in blocksRegistry)) {
3084
- console.warn(`No block with "${type}" is registered`);
3085
- }
3086
- const BlockComponent = type && blocksRegistry[type];
3087
- return blockDecorator({
3088
- blockClassName: style(block.style?.length ? block.style : defaultStyle, className),
3089
- block,
3090
- ancestors,
3091
- // Adjusted by decorator block and blockClassName
3092
- render: ({ block: adjustedBlock, blockClassName: adjustedBlockClassName }) => {
3093
- const { content } = adjustedBlock;
3094
- return BlockComponent ? (jsx(BlockComponent, { className: adjustedBlockClassName, block: block, options: options, ...content, ...extraProps }, key)) : null;
3095
- },
3096
- }, key);
3097
- }
3098
-
3099
- const DEFAULT_SLOT_NAME = null;
3100
-
3101
- const EMPTY_ANCESTORS = [];
3102
- const renderBlocksList = (blocks, { key, ancestors = EMPTY_ANCESTORS, slotName = DEFAULT_SLOT_NAME, extraProps, renderProps = renderBlock$1, ...options }) => {
3103
- const renderChildBlock = extraProps
3104
- ? (childBlock, childOptions) => renderBlock$1(childBlock, childOptions, extraProps)
3105
- : renderProps;
3106
- return (blocks || []).map((_, i) => renderChildBlock(_, {
3107
- ...options,
3108
- key: `${key ? key : _.type}-${i}`,
3109
- ancestors: options.parent
3110
- ? [...(ancestors || EMPTY_ANCESTORS), [options.parent, slotName]]
3111
- : ancestors,
3112
- }, i));
3113
- };
3114
-
3115
- function renderChildren({ block, options, children, extraProps, renderProps, }) {
3116
- if (children) {
3117
- return children;
3118
- }
3119
- return block && options
3120
- ? renderBlocksList(block.blocks, { ...options, parent: block, extraProps, renderProps })
3121
- : null;
3122
- }
3123
-
3124
3113
  const getBorderStyle = (showBorder = false) => showBorder
3125
3114
  ? 'border border-solid border-gray group-data-secondary:border-white/50 group-data-gray:border-main-divider'
3126
3115
  : '';
@@ -5746,7 +5735,7 @@
5746
5735
  const renderIcon = () => (jsx("div", { className: `rounded-full h-4 w-4 text-center text-xs font-light bg-primary-main text-white group-data-secondary:bg-white group-data-secondary:text-primary-main`, children: "i" }));
5747
5736
  const renderDescription = (description) => (jsx(Paragraph, { size: "text-s", font: "font-light", color: "text-secondary-text group-data-secondary:text-white", children: description }));
5748
5737
 
5749
- const Unit = JSX(({ prefix, unit, suffix }) => (jsxs("div", { className: "w-full pt-default flex items-end", children: [prefix ? (jsx("div", { className: "gradient-color-text", children: jsx(Text, { size: "text-h2", children: prefix }) })) : null, unit ? (
5738
+ const Unit = JSX(({ prefix, unit, suffix }) => (jsxs("div", { className: "w-full flex items-end", children: [prefix ? (jsx("div", { className: "gradient-color-text", children: jsx(Text, { size: "text-h2", children: prefix }) })) : null, unit ? (
5750
5739
  // -mb-n добавлен для выравнивания unit относительно prefix и suffix, тк шрифт font-mohave неправильно высчитывает line-height
5751
5740
  jsx("div", { className: "-mb-6 @xl:-mb-4", children: jsx("span", { className: "font-mohave text-title-large sm:text-title-extra gradient-color-text", children: unit }) })) : null, suffix ? (jsx("div", { className: "gradient-color-text", children: jsx(Text, { size: "text-h2", children: suffix }) })) : null] })));
5752
5741
 
@@ -5787,7 +5776,6 @@
5787
5776
  AdTile,
5788
5777
  ApplicationForm,
5789
5778
  BenefitsBlock,
5790
- Bonus,
5791
5779
  BonusBenefitsBlock,
5792
5780
  ButtonsBlock,
5793
5781
  Calculator,
@@ -6012,7 +6000,7 @@
6012
6000
  return (jsx("div", { className: "flex items-end absolute bottom-0 right-0 h-full pointer-events-none", children: jsx(LikeControl, { className: "rounded-tl-3xl sticky bottom-0 pointer-events-auto" }) }));
6013
6001
  }
6014
6002
 
6015
- const packageVersion = "0.14.138";
6003
+ const packageVersion = "0.14.139";
6016
6004
 
6017
6005
  exports.Blocks = Blocks;
6018
6006
  exports.ContentPage = ContentPage;