@redneckz/wildless-cms-uni-blocks 0.6.31 → 0.6.32
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.
- package/bin/migration-scripts/0.6.32.js +26 -0
- package/bundle/blocks.schema.json +1 -1
- package/bundle/bundle.umd.js +137 -102
- package/bundle/bundle.umd.min.js +1 -1
- package/bundle/components/CarouselLinks/CarouselLinks.d.ts +5 -0
- package/bundle/components/CarouselLinks/CarouselLinksContent.d.ts +9 -0
- package/bundle/components/ContactsBlock/ContactsBlockContent.d.ts +11 -20
- package/bundle/components/StepsBlock/renderStepContent.d.ts +1 -1
- package/bundle/icons/IconName.d.ts +6 -4
- package/bundle/model/HeadlineType.d.ts +2 -2
- package/bundle/ui-kit/LinkButton/LinkButton.d.ts +5 -0
- package/bundle/utils/sliceArray.d.ts +1 -0
- package/cosmos-static/icons/ArrowRightIcon.svg +1 -0
- package/dist/components/Blocks.js +2 -0
- package/dist/components/Blocks.js.map +1 -1
- package/dist/components/CarouselLinks/CarouselLinks.d.ts +5 -0
- package/dist/components/CarouselLinks/CarouselLinks.js +20 -0
- package/dist/components/CarouselLinks/CarouselLinks.js.map +1 -0
- package/dist/components/CarouselLinks/CarouselLinksContent.d.ts +9 -0
- package/dist/components/CarouselLinks/CarouselLinksContent.js +2 -0
- package/dist/components/CarouselLinks/CarouselLinksContent.js.map +1 -0
- package/dist/components/ContactsBlock/ContactsBlock.js +5 -9
- package/dist/components/ContactsBlock/ContactsBlock.js.map +1 -1
- package/dist/components/ContactsBlock/ContactsBlockContent.d.ts +11 -20
- package/dist/components/Headline/constants.js +6 -0
- package/dist/components/Headline/constants.js.map +1 -1
- package/dist/components/StepsBlock/renderStepContent.d.ts +1 -1
- package/dist/icons/IconName.d.ts +6 -4
- package/dist/icons/IconName.js +4 -2
- package/dist/icons/IconName.js.map +1 -1
- package/dist/model/HeadlineType.d.ts +2 -2
- package/dist/ui-kit/LinkButton/LinkButton.d.ts +5 -0
- package/dist/ui-kit/LinkButton/LinkButton.js +16 -0
- package/dist/ui-kit/LinkButton/LinkButton.js.map +1 -0
- package/dist/utils/sliceArray.d.ts +1 -0
- package/dist/utils/sliceArray.js +15 -0
- package/dist/utils/sliceArray.js.map +1 -0
- package/lib/common.css +1 -1
- package/lib/components/Blocks.js +2 -0
- package/lib/components/Blocks.js.map +1 -1
- package/lib/components/CarouselLinks/CarouselLinks.d.ts +5 -0
- package/lib/components/CarouselLinks/CarouselLinks.fixture.d.ts +5 -0
- package/lib/components/CarouselLinks/CarouselLinks.js +18 -0
- package/lib/components/CarouselLinks/CarouselLinks.js.map +1 -0
- package/lib/components/CarouselLinks/CarouselLinksContent.d.ts +9 -0
- package/lib/components/CarouselLinks/CarouselLinksContent.js +2 -0
- package/lib/components/CarouselLinks/CarouselLinksContent.js.map +1 -0
- package/lib/components/ContactsBlock/ContactsBlock.js +5 -9
- package/lib/components/ContactsBlock/ContactsBlock.js.map +1 -1
- package/lib/components/ContactsBlock/ContactsBlockContent.d.ts +11 -20
- package/lib/components/Headline/constants.js +6 -0
- package/lib/components/Headline/constants.js.map +1 -1
- package/lib/components/StepsBlock/renderStepContent.d.ts +1 -1
- package/lib/icons/IconName.d.ts +6 -4
- package/lib/icons/IconName.js +4 -2
- package/lib/icons/IconName.js.map +1 -1
- package/lib/model/HeadlineType.d.ts +2 -2
- package/lib/ui-kit/LinkButton/LinkButton.d.ts +5 -0
- package/lib/ui-kit/LinkButton/LinkButton.fixture.d.ts +5 -0
- package/lib/ui-kit/LinkButton/LinkButton.js +14 -0
- package/lib/ui-kit/LinkButton/LinkButton.js.map +1 -0
- package/lib/utils/sliceArray.d.ts +1 -0
- package/lib/utils/sliceArray.js +12 -0
- package/lib/utils/sliceArray.js.map +1 -0
- package/mobile/bundle/bundle.umd.js +1 -1
- package/mobile/bundle/bundle.umd.min.js +1 -1
- package/mobile/bundle/components/CarouselLinks/CarouselLinks.d.ts +5 -0
- package/mobile/bundle/components/CarouselLinks/CarouselLinksContent.d.ts +9 -0
- package/mobile/bundle/components/ContactsBlock/ContactsBlockContent.d.ts +11 -20
- package/mobile/bundle/components/StepsBlock/renderStepContent.d.ts +1 -1
- package/mobile/bundle/icons/IconName.d.ts +6 -4
- package/mobile/bundle/model/HeadlineType.d.ts +2 -2
- package/mobile/bundle/ui-kit/LinkButton/LinkButton.d.ts +5 -0
- package/mobile/bundle/utils/sliceArray.d.ts +1 -0
- package/mobile/dist/components/CarouselLinks/CarouselLinks.d.ts +5 -0
- package/mobile/dist/components/CarouselLinks/CarouselLinks.js +20 -0
- package/mobile/dist/components/CarouselLinks/CarouselLinks.js.map +1 -0
- package/mobile/dist/components/CarouselLinks/CarouselLinksContent.d.ts +9 -0
- package/mobile/dist/components/CarouselLinks/CarouselLinksContent.js +2 -0
- package/mobile/dist/components/CarouselLinks/CarouselLinksContent.js.map +1 -0
- package/mobile/dist/components/ContactsBlock/ContactsBlock.js +5 -9
- package/mobile/dist/components/ContactsBlock/ContactsBlock.js.map +1 -1
- package/mobile/dist/components/ContactsBlock/ContactsBlockContent.d.ts +11 -20
- package/mobile/dist/components/Headline/constants.js +6 -0
- package/mobile/dist/components/Headline/constants.js.map +1 -1
- package/mobile/dist/components/StepsBlock/renderStepContent.d.ts +1 -1
- package/mobile/dist/icons/IconName.d.ts +6 -4
- package/mobile/dist/icons/IconName.js +4 -2
- package/mobile/dist/icons/IconName.js.map +1 -1
- package/mobile/dist/model/HeadlineType.d.ts +2 -2
- package/mobile/dist/ui-kit/LinkButton/LinkButton.d.ts +5 -0
- package/mobile/dist/ui-kit/LinkButton/LinkButton.js +16 -0
- package/mobile/dist/ui-kit/LinkButton/LinkButton.js.map +1 -0
- package/mobile/dist/utils/sliceArray.d.ts +1 -0
- package/mobile/dist/utils/sliceArray.js +15 -0
- package/mobile/dist/utils/sliceArray.js.map +1 -0
- package/mobile/lib/components/CarouselLinks/CarouselLinks.d.ts +5 -0
- package/mobile/lib/components/CarouselLinks/CarouselLinks.js +18 -0
- package/mobile/lib/components/CarouselLinks/CarouselLinks.js.map +1 -0
- package/mobile/lib/components/CarouselLinks/CarouselLinksContent.d.ts +9 -0
- package/mobile/lib/components/CarouselLinks/CarouselLinksContent.js +2 -0
- package/mobile/lib/components/CarouselLinks/CarouselLinksContent.js.map +1 -0
- package/mobile/lib/components/ContactsBlock/ContactsBlock.js +5 -9
- package/mobile/lib/components/ContactsBlock/ContactsBlock.js.map +1 -1
- package/mobile/lib/components/ContactsBlock/ContactsBlockContent.d.ts +11 -20
- package/mobile/lib/components/Headline/constants.js +6 -0
- package/mobile/lib/components/Headline/constants.js.map +1 -1
- package/mobile/lib/components/StepsBlock/renderStepContent.d.ts +1 -1
- package/mobile/lib/icons/IconName.d.ts +6 -4
- package/mobile/lib/icons/IconName.js +4 -2
- package/mobile/lib/icons/IconName.js.map +1 -1
- package/mobile/lib/model/HeadlineType.d.ts +2 -2
- package/mobile/lib/ui-kit/LinkButton/LinkButton.d.ts +5 -0
- package/mobile/lib/ui-kit/LinkButton/LinkButton.js +14 -0
- package/mobile/lib/ui-kit/LinkButton/LinkButton.js.map +1 -0
- package/mobile/lib/utils/sliceArray.d.ts +1 -0
- package/mobile/lib/utils/sliceArray.js +12 -0
- package/mobile/lib/utils/sliceArray.js.map +1 -0
- package/mobile/src/components/CarouselLinks/CarouselLinks.example.json +55 -0
- package/mobile/src/components/CarouselLinks/CarouselLinks.json +8 -0
- package/mobile/src/components/CarouselLinks/CarouselLinks.tsx +61 -0
- package/mobile/src/components/CarouselLinks/CarouselLinksContent.ts +10 -0
- package/mobile/src/components/ContactsBlock/ContactsBlock.example.json +22 -18
- package/mobile/src/components/ContactsBlock/ContactsBlock.tsx +25 -35
- package/mobile/src/components/ContactsBlock/ContactsBlockContent.ts +12 -22
- package/mobile/src/components/Headline/constants.ts +6 -0
- package/mobile/src/components/StepsBlock/renderStepContent.tsx +1 -1
- package/mobile/src/icons/ArrowLeftIcon.svg +1 -1
- package/mobile/src/icons/ArrowRightIcon.svg +1 -0
- package/mobile/src/icons/ArrowUpIcon.svg +1 -1
- package/mobile/src/icons/IconName.ts +4 -4
- package/mobile/src/model/HeadlineType.ts +2 -2
- package/mobile/src/ui-kit/LinkButton/LinkButton.tsx +42 -0
- package/mobile/src/utils/sliceArray.ts +15 -0
- package/package.json +2 -2
- package/src/components/Blocks.ts +2 -0
- package/src/components/CarouselLinks/CarouselLinks.example.json +55 -0
- package/src/components/CarouselLinks/CarouselLinks.fixture.tsx +28 -0
- package/src/components/CarouselLinks/CarouselLinks.json +8 -0
- package/src/components/CarouselLinks/CarouselLinks.tsx +61 -0
- package/src/components/CarouselLinks/CarouselLinksContent.ts +10 -0
- package/src/components/ContactsBlock/ContactsBlock.example.json +22 -18
- package/src/components/ContactsBlock/ContactsBlock.fixture.tsx +21 -15
- package/src/components/ContactsBlock/ContactsBlock.tsx +25 -35
- package/src/components/ContactsBlock/ContactsBlockContent.ts +12 -22
- package/src/components/Headline/constants.ts +6 -0
- package/src/components/StepsBlock/renderStepContent.tsx +1 -1
- package/src/icons/ArrowLeftIcon.svg +1 -1
- package/src/icons/ArrowRightIcon.svg +1 -0
- package/src/icons/ArrowUpIcon.svg +1 -1
- package/src/icons/IconName.ts +6 -327
- package/src/model/HeadlineType.ts +2 -2
- package/src/ui-kit/LinkButton/LinkButton.fixture.tsx +9 -0
- package/src/ui-kit/LinkButton/LinkButton.tsx +42 -0
- package/src/utils/sliceArray.ts +15 -0
package/bundle/bundle.umd.js
CHANGED
|
@@ -450,43 +450,52 @@
|
|
|
450
450
|
AccordionItem.childrenTypes = [];
|
|
451
451
|
const FoldButton$1 = JSX(({ label, icon, onClick }) => (jsxs("button", { className: "border-none bg-transparent px-0 pt-5 pb-3.5 flex justify-between text-left w-full font-sans text-h6 group cursor-pointer", onClick: onClick, children: [jsx("span", { className: "text-xl font-medium pr-2.5", children: label }), jsx(ImgInner, { image: icon, className: "text-primary-main flex-shrink-0", width: "24", height: "24", asSVG: true })] })));
|
|
452
452
|
|
|
453
|
-
const
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
};
|
|
453
|
+
const Description = JSX((props) => {
|
|
454
|
+
const { className = '', description } = props;
|
|
455
|
+
return jsx("div", { className: `${className}`, children: description });
|
|
456
|
+
});
|
|
457
457
|
|
|
458
|
-
const
|
|
459
|
-
|
|
460
|
-
|
|
458
|
+
const LINK_CLASS_NAME = `absolute border border-primary-main ml-3 px-6 py-5
|
|
459
|
+
text-l-light bg-white text-primary-text flex w-[316px]
|
|
460
|
+
justify-between items-center group-hover:text-primary-main z-10`;
|
|
461
|
+
const LINK_BORDER_CLASS_NAME = 'bg-transparent border-white border h-[70px] absolute w-[316px] top-0';
|
|
462
|
+
const LinkButton = JSX(({ text, href = '', target = '', className = '' }) => {
|
|
463
|
+
if (!text) {
|
|
464
|
+
return null;
|
|
465
|
+
}
|
|
466
|
+
return (jsxs("div", { className: `relative group cursor-pointer w-[328px] h-[82px] ${className}`, children: [jsxs("a", { className: LINK_CLASS_NAME, role: "link", href: href, target: target, children: [jsx("div", { className: "p-0.5", children: text }), jsx("div", { className: "w-6 h-6", children: jsx(ImgInner, { className: "w-4 h-4 min-w-4 min-h-4 rounded-full box-border brightness-0 group-hover:brightness-100", image: { icon: 'ArrowRightIcon', iconVersion: 'black' }, imageClassName: "group-hover:text-primary-main", width: "24", height: "24", asSVG: true }) })] }), jsx("div", { className: `${LINK_BORDER_CLASS_NAME} mx-1.5 mt-1.5` }), jsx("div", { className: `${LINK_BORDER_CLASS_NAME} mt-3 mr-3` })] }));
|
|
461
467
|
});
|
|
462
468
|
|
|
463
|
-
const
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
secondary: 'bg-white/30 text-black',
|
|
474
|
-
};
|
|
475
|
-
const BenefitsBlock = JSX(({ className = '', title, benefitList, version = 'primary', ...rest }) => (jsxs(BlockWrapper, { className: `font-sans text-primary-text p-12 flex flex-col items-center ${className} ${VersionStyleMap[version]}`, ...rest, children: [title ? (jsx(Heading, { headingType: "h3", as: "h2", className: `max-w-[47rem] text-center ${benefitsTextStyleMap[version]}`, title: title })) : null, benefitList?.length ? (jsx("div", { className: "flex flex-wrap w-full justify-center gap-x-20 mt-8", children: benefitList.map(renderStep(version)) })) : null] })));
|
|
476
|
-
const renderStep = (version) => (benefit, i) => {
|
|
477
|
-
const description = benefit.description;
|
|
478
|
-
return (jsxs("div", { className: "flex items-center basis-1/2 max-w-[500px] mb-14", children: [benefit?.icon?.icon ? (jsx(ImgInner, { className: `w-[50px] h-[50px] min-w-[50px] p-3 rounded-full ${benefitsIconStyleMap[version]}`, image: getIconWithVersion(benefit.icon, version), asSVG: true })) : null, benefit?.icon?.src ? jsx(ImgInner, { image: benefit.icon }) : null, jsxs("div", { className: "ml-5", children: [benefit?.label ? (jsx("h3", { className: `text-h6 m-0 ${benefitsTextStyleMap[version]}`, children: benefit.label })) : null, renderDescription$3(description, version)] })] }, String(i)));
|
|
479
|
-
};
|
|
480
|
-
const renderDescription$3 = (description, version) => {
|
|
481
|
-
const benefitType = description?.benefitType || null;
|
|
482
|
-
return description && benefitType ? (jsx("div", { className: `text-l-light mt-2 ${benefitsDescriptionStyleMap[version]}`, children: benefitType === 'list'
|
|
483
|
-
? renderListBenefit(description)
|
|
484
|
-
: renderTextBenefit(description) })) : null;
|
|
469
|
+
const sliceArray = (items, size) => {
|
|
470
|
+
const result = items.reduce((resultArray, item, index) => {
|
|
471
|
+
const chunkIndex = Math.floor(index / (size - 1));
|
|
472
|
+
if (!resultArray[chunkIndex]) {
|
|
473
|
+
resultArray[chunkIndex] = [item];
|
|
474
|
+
}
|
|
475
|
+
resultArray[chunkIndex].push(item);
|
|
476
|
+
return resultArray;
|
|
477
|
+
}, []);
|
|
478
|
+
return result;
|
|
485
479
|
};
|
|
486
|
-
|
|
487
|
-
const
|
|
488
|
-
const
|
|
489
|
-
|
|
480
|
+
|
|
481
|
+
const useCarouselControls = ({ itemsCount, visibleItemCount = itemsCount, isCyclic, }) => {
|
|
482
|
+
const [activeIndex, setActiveIndex] = useState(0);
|
|
483
|
+
const inc = useCallback(() => setActiveIndex((_) => (isCyclic ? (_ + 1) % itemsCount : Math.min(_ + 1, itemsCount - 1))), [isCyclic, itemsCount]);
|
|
484
|
+
const dec = useCallback(() => setActiveIndex((_) => (isCyclic ? (itemsCount + _ - 1) % itemsCount : Math.max(_ - 1, 0))), [isCyclic, itemsCount]);
|
|
485
|
+
const isScrollAvailable = itemsCount > visibleItemCount;
|
|
486
|
+
const isCyclicAndScrollAvailable = isCyclic && isScrollAvailable;
|
|
487
|
+
const canInc = isCyclicAndScrollAvailable ||
|
|
488
|
+
(isScrollAvailable && itemsCount - activeIndex > visibleItemCount);
|
|
489
|
+
const canDec = isCyclicAndScrollAvailable || Boolean(isScrollAvailable && activeIndex > 0);
|
|
490
|
+
return [
|
|
491
|
+
activeIndex,
|
|
492
|
+
{
|
|
493
|
+
inc,
|
|
494
|
+
dec,
|
|
495
|
+
canInc,
|
|
496
|
+
canDec,
|
|
497
|
+
},
|
|
498
|
+
];
|
|
490
499
|
};
|
|
491
500
|
|
|
492
501
|
const isURL = (href) => href?.includes('//');
|
|
@@ -640,6 +649,90 @@
|
|
|
640
649
|
const RegularButton = JSX(({ className = '', href, rel, target, ariaLabel, version, rounded, onClick, children }) => (jsx("a", { className: getRegularButtonClasses({ className, version, rounded }), href: href, rel: rel, target: target, "aria-label": ariaLabel, role: href ? 'link' : 'button', onClick: onClick, children: children })));
|
|
641
650
|
const DisabledButton = JSX(({ className, ariaLabel, version, rounded, children }) => (jsx("div", { role: "button", "aria-disabled": "true", "aria-label": ariaLabel, tabIndex: -1, className: getDisabledButtonClasses({ className, rounded, version }), children: children })));
|
|
642
651
|
|
|
652
|
+
const ArrowButton = JSX(({ className, disabled, ...rest }) => (jsx(Button, { rounded: true, className: `group shadow-[0_4px_25px_rgba(0,0,0,0.07)] w-12 h-12 min-h-12 max-h-12 flex items-center justify-center ${disabled
|
|
653
|
+
? 'bg-secondary-light text-secondary-text'
|
|
654
|
+
: 'bg-white text-primary-text hover:text-primary-main'} ${className || ''}`, disabled: disabled, ...rest, children: jsx(ImgInner, { className: "w-4 h-4 min-w-4 min-h-4 rounded-full box-border", image: { icon: 'ArrowLeftIcon', iconVersion: 'black' }, imageClassName: "group-hover:text-primary-main", width: "16", height: "16", asSVG: true }) })));
|
|
655
|
+
|
|
656
|
+
function renderArrows({ handler, isShown, btnClass, className = '', isDisabled = false, }) {
|
|
657
|
+
return (jsxs("div", { children: [isShown[0] || isDisabled ? (jsx(ArrowButton, { className: `absolute z-10 ${btnClass[0]} ${className}`, onClick: handler[0], ariaLabel: "\u041F\u0440\u043E\u043B\u0438\u0441\u0442\u0430\u0442\u044C \u0432\u043B\u0435\u0432\u043E", "data-block-control": "scroll-left", disabled: !isShown[0] })) : null, isShown[1] || isDisabled ? (jsx(ArrowButton, { className: `absolute z-10 rotate-180 ${btnClass[1]} ${className}`, onClick: handler[1], ariaLabel: "\u041F\u0440\u043E\u043B\u0438\u0441\u0442\u0430\u0442\u044C \u0432\u043F\u0440\u0430\u0432\u043E", "data-block-control": "scroll-right", disabled: !isShown[1] })) : null] }));
|
|
658
|
+
}
|
|
659
|
+
|
|
660
|
+
const CarouselContainer = JSX(({ children, activeItem, cardFullViewCount, cardWidth }) => {
|
|
661
|
+
const cardFullViewStyles = cardFullViewCount === 1
|
|
662
|
+
? `translateX(-${activeItem}00%)`
|
|
663
|
+
: `translateX(-${activeItem * Number(cardWidth)}px)`;
|
|
664
|
+
return (jsx("div", { className: "w-auto flex flex-1 duration-1000", style: { transform: `${cardFullViewStyles}` }, role: "list", children: children }));
|
|
665
|
+
});
|
|
666
|
+
|
|
667
|
+
const Carousel = JSX(({ cardFullViewCount = 1, children, cardWidth = '1007', className = '', isBlur = true, isCyclic = false, block, ...rest }) => {
|
|
668
|
+
const blurClasses = isBlur ? 'absolute top-0 bottom-0 w-[84px]' : '';
|
|
669
|
+
const { blocks: childBlocks } = block || {};
|
|
670
|
+
const childBlocksLength = childBlocks !== undefined ? childBlocks.length : 0;
|
|
671
|
+
const isScrollAvailable = childBlocksLength > cardFullViewCount;
|
|
672
|
+
const [activeIndex, controls] = useCarouselControls({
|
|
673
|
+
itemsCount: childBlocksLength,
|
|
674
|
+
visibleItemCount: cardFullViewCount,
|
|
675
|
+
isCyclic,
|
|
676
|
+
});
|
|
677
|
+
const { inc, dec, canDec, canInc } = controls;
|
|
678
|
+
return (jsxs(BlockWrapper, { className: `box-border h-full relative font-sans flex flex-col justify-center overflow-hidden ${className}`, ...rest, children: [jsx(CarouselContainer, { activeItem: activeIndex, cardFullViewCount: cardFullViewCount, cardWidth: cardWidth, children: children }), isScrollAvailable ? (jsx("div", { children: renderArrows({
|
|
679
|
+
handler: [dec, inc],
|
|
680
|
+
isShown: [canDec, canInc],
|
|
681
|
+
btnClass: ['left-8', 'right-8'],
|
|
682
|
+
className: 'top-1/2 z-10',
|
|
683
|
+
}) })) : null, isScrollAvailable ? (jsxs("div", { children: [jsx("div", { className: `${blurClasses} left-0 bg-opacity-from-white` }), jsx("div", { className: `${blurClasses} right-0 bg-opacity-to-white` })] })) : null] }));
|
|
684
|
+
});
|
|
685
|
+
Carousel.childrenTypes = ['CarouselCard', 'CarouselTariffsCard'];
|
|
686
|
+
|
|
687
|
+
const MAX_LINKS_COUNT = 12;
|
|
688
|
+
const CarouselLinks = JSX(({ additionalDescription, block, description, links, title, className = '', ...rest }) => {
|
|
689
|
+
return (jsxs(BlockWrapper, { className: `bg-primary-main flex w-full p-10 overflow-hidden justify-between font-sans ${className}`, ...rest, children: [jsxs("div", { className: "flex flex-col max-w-96 pr-9 text-white text-xl-light", children: [title ? jsx(Heading, { title: title, as: "h1", headingType: "h0", className: "pb-0.5" }) : null, description ? (jsx(Description, { description: description, className: "text-xl-light pt-5" })) : null, additionalDescription ? (jsx(Description, { description: additionalDescription, className: "pt-6" })) : null] }), links?.length ? renderLinks(links) : null] }));
|
|
690
|
+
});
|
|
691
|
+
const renderLinks = (links, block) => {
|
|
692
|
+
const slicedLinks = sliceArray(links, MAX_LINKS_COUNT);
|
|
693
|
+
const slides = slicedLinks.map((slide) => (jsx("div", { className: "w-[672px] min-w-[672px] ml-20 mr-20 flex flex-wrap self-start", children: slide.map((link, index) => (jsx(LinkButton, { className: "m-1", ...link }, String(index)))) })));
|
|
694
|
+
return (jsx(Carousel, { className: "min-w-[832px] w-[832px]", isBlur: false, cardFullViewCount: 1, cardWidth: '832', isCyclic: true, block: { type: 'Carousel', blocks: slides }, children: slides }));
|
|
695
|
+
};
|
|
696
|
+
|
|
697
|
+
const VersionStyleMap = {
|
|
698
|
+
primary: 'bg-white text-primary-text',
|
|
699
|
+
secondary: 'bg-primary-main text-white',
|
|
700
|
+
};
|
|
701
|
+
|
|
702
|
+
const getIconWithVersion = (icon, version = 'primary') => ({
|
|
703
|
+
...icon,
|
|
704
|
+
iconVersion: icon?.iconVersion ?? (version === 'secondary' ? 'white' : 'color'),
|
|
705
|
+
});
|
|
706
|
+
|
|
707
|
+
const benefitsTextStyleMap = {
|
|
708
|
+
primary: '',
|
|
709
|
+
secondary: 'text-white',
|
|
710
|
+
};
|
|
711
|
+
const benefitsDescriptionStyleMap = {
|
|
712
|
+
primary: 'text-secondary-text',
|
|
713
|
+
secondary: 'text-white opacity-80',
|
|
714
|
+
};
|
|
715
|
+
const benefitsIconStyleMap = {
|
|
716
|
+
primary: 'bg-main-divider text-primary-main',
|
|
717
|
+
secondary: 'bg-white/30 text-black',
|
|
718
|
+
};
|
|
719
|
+
const BenefitsBlock = JSX(({ className = '', title, benefitList, version = 'primary', ...rest }) => (jsxs(BlockWrapper, { className: `font-sans text-primary-text p-12 flex flex-col items-center ${className} ${VersionStyleMap[version]}`, ...rest, children: [title ? (jsx(Heading, { headingType: "h3", as: "h2", className: `max-w-[47rem] text-center ${benefitsTextStyleMap[version]}`, title: title })) : null, benefitList?.length ? (jsx("div", { className: "flex flex-wrap w-full justify-center gap-x-20 mt-8", children: benefitList.map(renderStep(version)) })) : null] })));
|
|
720
|
+
const renderStep = (version) => (benefit, i) => {
|
|
721
|
+
const description = benefit.description;
|
|
722
|
+
return (jsxs("div", { className: "flex items-center basis-1/2 max-w-[500px] mb-14", children: [benefit?.icon?.icon ? (jsx(ImgInner, { className: `w-[50px] h-[50px] min-w-[50px] p-3 rounded-full ${benefitsIconStyleMap[version]}`, image: getIconWithVersion(benefit.icon, version), asSVG: true })) : null, benefit?.icon?.src ? jsx(ImgInner, { image: benefit.icon }) : null, jsxs("div", { className: "ml-5", children: [benefit?.label ? (jsx("h3", { className: `text-h6 m-0 ${benefitsTextStyleMap[version]}`, children: benefit.label })) : null, renderDescription$3(description, version)] })] }, String(i)));
|
|
723
|
+
};
|
|
724
|
+
const renderDescription$3 = (description, version) => {
|
|
725
|
+
const benefitType = description?.benefitType || null;
|
|
726
|
+
return description && benefitType ? (jsx("div", { className: `text-l-light mt-2 ${benefitsDescriptionStyleMap[version]}`, children: benefitType === 'list'
|
|
727
|
+
? renderListBenefit(description)
|
|
728
|
+
: renderTextBenefit(description) })) : null;
|
|
729
|
+
};
|
|
730
|
+
const renderTextBenefit = (description) => description?.name || null;
|
|
731
|
+
const renderListBenefit = (description) => {
|
|
732
|
+
const listStyleType = description?.bullets ? 'list-disc pl-6' : '';
|
|
733
|
+
return description?.items && description.items.length > 0 ? (jsx("ul", { className: listStyleType, children: description.items.map((_, i) => (jsx("li", { children: _ }, `benefitListItem-${i}`))) })) : null;
|
|
734
|
+
};
|
|
735
|
+
|
|
643
736
|
const ButtonSection = JSX(({ className = '', buttons }) => buttons && buttons?.length ? (jsx("div", { className: className, children: buttons.map((button, index) => renderButton({ button, index })) })) : null);
|
|
644
737
|
function renderButton({ button, buttonClassName, index }) {
|
|
645
738
|
const { icon, iconRight, version, ...rest } = button;
|
|
@@ -656,11 +749,6 @@
|
|
|
656
749
|
return jsx(ImgInner, { image: { ...icon }, width: iconWidth, height: "24", asSVG: true });
|
|
657
750
|
};
|
|
658
751
|
|
|
659
|
-
const Description = JSX((props) => {
|
|
660
|
-
const { className = '', description } = props;
|
|
661
|
-
return jsx("div", { className: `${className}`, children: description });
|
|
662
|
-
});
|
|
663
|
-
|
|
664
752
|
const HEADLINE_BLOCK_STYLE_MAPS = {
|
|
665
753
|
transparent: {
|
|
666
754
|
background: 'bg-transparent',
|
|
@@ -709,6 +797,12 @@
|
|
|
709
797
|
headingType: 'h4',
|
|
710
798
|
as: 'h4',
|
|
711
799
|
},
|
|
800
|
+
XS: {
|
|
801
|
+
descriptionFont: 'text-l-light',
|
|
802
|
+
gap: 'gap-2',
|
|
803
|
+
headingType: 'h5',
|
|
804
|
+
as: 'h5',
|
|
805
|
+
},
|
|
712
806
|
};
|
|
713
807
|
const HEADLINE_SMALL_VERSION = {
|
|
714
808
|
H6: 'text-h6',
|
|
@@ -760,14 +854,6 @@
|
|
|
760
854
|
|
|
761
855
|
const BusinessBlock = JSX(({ className = '', title, cards, ...rest }) => (jsxs(BlockWrapper, { className: `font-sans bg-white p-[50px] pb-9 ${className}`, ...rest, children: [jsx(Heading, { headingType: "h3", title: title, className: "text-center mb-8" }), jsx("div", { className: "flex gap-5", children: cards?.length ? cards.map((_, i) => jsx(BusinessCard, { ..._ }, String(i))) : null })] })));
|
|
762
856
|
|
|
763
|
-
const ArrowButton = JSX(({ className, disabled, ...rest }) => (jsx(Button, { rounded: true, className: `group shadow-[0_4px_25px_rgba(0,0,0,0.07)] w-12 h-12 min-h-12 max-h-12 flex items-center justify-center ${disabled
|
|
764
|
-
? 'bg-secondary-light text-secondary-text'
|
|
765
|
-
: 'bg-white text-primary-text hover:text-primary-main'} ${className || ''}`, disabled: disabled, ...rest, children: jsx(ImgInner, { className: "w-4 h-4 min-w-4 min-h-4 rounded-full box-border", image: { icon: 'ArrowLeftIcon', iconVersion: 'black' }, imageClassName: "group-hover:text-primary-main", width: "16", height: "16", asSVG: true }) })));
|
|
766
|
-
|
|
767
|
-
function renderArrows({ handler, isShown, btnClass, className = '', isDisabled = false, }) {
|
|
768
|
-
return (jsxs("div", { children: [isShown[0] || isDisabled ? (jsx(ArrowButton, { className: `absolute z-10 ${btnClass[0]} ${className}`, onClick: handler[0], ariaLabel: "\u041F\u0440\u043E\u043B\u0438\u0441\u0442\u0430\u0442\u044C \u0432\u043B\u0435\u0432\u043E", "data-block-control": "scroll-left", disabled: !isShown[0] })) : null, isShown[1] || isDisabled ? (jsx(ArrowButton, { className: `absolute z-10 rotate-180 ${btnClass[1]} ${className}`, onClick: handler[1], ariaLabel: "\u041F\u0440\u043E\u043B\u0438\u0441\u0442\u0430\u0442\u044C \u0432\u043F\u0440\u0430\u0432\u043E", "data-block-control": "scroll-right", disabled: !isShown[1] })) : null] }));
|
|
769
|
-
}
|
|
770
|
-
|
|
771
857
|
const addSpacesBetweenNumbers = (number) => new Intl.NumberFormat('ru-RU', { maximumSignificantDigits: 3 }).format(number);
|
|
772
858
|
|
|
773
859
|
const CalculatorValueBlock = JSX(({ title, value, postfix = '', prefix, className = '' }) => {
|
|
@@ -1242,53 +1328,6 @@
|
|
|
1242
1328
|
return (jsxs(BlockWrapper, { className: `p-[50px] flex flex-col items-center font-sans bg-white ${className}`, ...rest, children: [title ? jsx(Heading, { className: "max-w-[684px] pb-9", headingType: "h2", title: title }) : null, jsxs("form", { className: "w-[468px]", method: "POST", action: FORM_URL, children: [jsx(CurrencyInput, { name: AMOUNT_KEY, value: value, onChange: setValue, valid: value === '' || !isDisabled, placeholder: placeholder, label: label }), button?.text ? (jsx("button", { type: "submit", className: `w-full p-4 mt-6 ${buttonStyle} `, disabled: isDisabled, ...link(button), children: button.text })) : null] })] }));
|
|
1243
1329
|
});
|
|
1244
1330
|
|
|
1245
|
-
const useCarouselControls = ({ itemsCount, visibleItemCount = itemsCount, isCyclic, }) => {
|
|
1246
|
-
const [activeIndex, setActiveIndex] = useState(0);
|
|
1247
|
-
const inc = useCallback(() => setActiveIndex((_) => (isCyclic ? (_ + 1) % itemsCount : Math.min(_ + 1, itemsCount - 1))), [isCyclic, itemsCount]);
|
|
1248
|
-
const dec = useCallback(() => setActiveIndex((_) => (isCyclic ? (itemsCount + _ - 1) % itemsCount : Math.max(_ - 1, 0))), [isCyclic, itemsCount]);
|
|
1249
|
-
const isScrollAvailable = itemsCount > visibleItemCount;
|
|
1250
|
-
const isCyclicAndScrollAvailable = isCyclic && isScrollAvailable;
|
|
1251
|
-
const canInc = isCyclicAndScrollAvailable ||
|
|
1252
|
-
(isScrollAvailable && itemsCount - activeIndex > visibleItemCount);
|
|
1253
|
-
const canDec = isCyclicAndScrollAvailable || Boolean(isScrollAvailable && activeIndex > 0);
|
|
1254
|
-
return [
|
|
1255
|
-
activeIndex,
|
|
1256
|
-
{
|
|
1257
|
-
inc,
|
|
1258
|
-
dec,
|
|
1259
|
-
canInc,
|
|
1260
|
-
canDec,
|
|
1261
|
-
},
|
|
1262
|
-
];
|
|
1263
|
-
};
|
|
1264
|
-
|
|
1265
|
-
const CarouselContainer = JSX(({ children, activeItem, cardFullViewCount, cardWidth }) => {
|
|
1266
|
-
const cardFullViewStyles = cardFullViewCount === 1
|
|
1267
|
-
? `translateX(-${activeItem}00%)`
|
|
1268
|
-
: `translateX(-${activeItem * Number(cardWidth)}px)`;
|
|
1269
|
-
return (jsx("div", { className: "w-auto flex flex-1 duration-1000", style: { transform: `${cardFullViewStyles}` }, role: "list", children: children }));
|
|
1270
|
-
});
|
|
1271
|
-
|
|
1272
|
-
const Carousel = JSX(({ cardFullViewCount = 1, children, cardWidth = '1007', className = '', isBlur = true, isCyclic = false, block, ...rest }) => {
|
|
1273
|
-
const blurClasses = isBlur ? 'absolute top-0 bottom-0 w-[84px]' : '';
|
|
1274
|
-
const { blocks: childBlocks } = block || {};
|
|
1275
|
-
const childBlocksLength = childBlocks !== undefined ? childBlocks.length : 0;
|
|
1276
|
-
const isScrollAvailable = childBlocksLength > cardFullViewCount;
|
|
1277
|
-
const [activeIndex, controls] = useCarouselControls({
|
|
1278
|
-
itemsCount: childBlocksLength,
|
|
1279
|
-
visibleItemCount: cardFullViewCount,
|
|
1280
|
-
isCyclic,
|
|
1281
|
-
});
|
|
1282
|
-
const { inc, dec, canDec, canInc } = controls;
|
|
1283
|
-
return (jsxs(BlockWrapper, { className: `box-border h-full relative font-sans flex flex-col justify-center overflow-hidden ${className}`, ...rest, children: [jsx(CarouselContainer, { activeItem: activeIndex, cardFullViewCount: cardFullViewCount, cardWidth: cardWidth, children: children }), isScrollAvailable ? (jsx("div", { children: renderArrows({
|
|
1284
|
-
handler: [dec, inc],
|
|
1285
|
-
isShown: [canDec, canInc],
|
|
1286
|
-
btnClass: ['left-8', 'right-8'],
|
|
1287
|
-
className: 'top-1/2 z-10',
|
|
1288
|
-
}) })) : null, isScrollAvailable ? (jsxs("div", { children: [jsx("div", { className: `${blurClasses} left-0 bg-opacity-from-white` }), jsx("div", { className: `${blurClasses} right-0 bg-opacity-to-white` })] })) : null] }));
|
|
1289
|
-
});
|
|
1290
|
-
Carousel.childrenTypes = ['CarouselCard', 'CarouselTariffsCard'];
|
|
1291
|
-
|
|
1292
1331
|
const BLOCK_CLASSES = 'absolute border border-solid border-main-stroke w-[100%] h-[100%]';
|
|
1293
1332
|
const CARD_STYLE_MAP = {
|
|
1294
1333
|
normal: 'min-w-[100%] justify-center items-center my-7 col-span-12',
|
|
@@ -1414,16 +1453,11 @@
|
|
|
1414
1453
|
});
|
|
1415
1454
|
const renderShowMoreToggleButton = ({ isShowAllRow, onClick, }) => (jsx("div", { className: "pr-[50px]", children: jsxs("div", { className: "flex w-full", children: [jsx("div", { className: FIRST_CELL_CLASSES$1 }), jsx("button", { onClick: onClick, className: "mt-5 flex-1 border-main-stroke border-solid border text-primary-text bg-white hover:border-primary-main hover:text-primary-main", children: jsx("div", { className: "font-sans text-xs-light font-medium py-3", children: !isShowAllRow ? 'Показать все параметры' : 'Скрыть' }) })] }) }));
|
|
1416
1455
|
|
|
1417
|
-
const contactsBlockStyleMap = {
|
|
1418
|
-
primary: 'bg-white',
|
|
1419
|
-
secondary: 'bg-primary-main text-white',
|
|
1420
|
-
};
|
|
1421
1456
|
const ContactsBlock = JSX(({ className = '', contacts, info, version = 'secondary', ...rest }) => {
|
|
1422
|
-
return (jsxs(BlockWrapper, { className: `${
|
|
1457
|
+
return (jsxs(BlockWrapper, { className: `${VersionStyleMap[version]} flex p-[50px] ${className}`, ...rest, children: [info?.length ? renderBlocks(info, version) : null, contacts?.length ? renderBlocks(contacts, version) : null] }));
|
|
1423
1458
|
});
|
|
1424
|
-
const
|
|
1425
|
-
const
|
|
1426
|
-
const renderContactsColumn = ({ contactsColumn, index }) => contactsColumn ? (jsx("div", { className: "flex flex-col grow basis-0 pr-11", children: contactsColumn.map(({ title, description, additionalDescription }, key) => (jsxs("div", { className: "pr-11 last:pr-0 last:mt-5", children: [jsx(Heading, { as: "h5", headingType: "h5", title: title }), jsx(Description, { className: "text-l-light mt-2.5", description: description }), additionalDescription ? (jsx(Description, { className: "text-m-light mt-1.5 opacity-80", description: additionalDescription })) : null] }, String(key)))) }, String(index))) : null;
|
|
1459
|
+
const renderBlocks = (info, version) => (jsx("div", { className: "flex grow basis-0", children: info.map((column, index) => renderBlocksColumn({ column, index, version })) }));
|
|
1460
|
+
const renderBlocksColumn = ({ column, index, version }) => column ? (jsx("div", { className: "flex flex-col grow basis-0 pr-11 last:pr-0", children: column.map(({ title = '', description, additionalDescription, button }, key) => (jsxs("div", { className: "mt-6 first:mt-0", children: [jsx(Headline, { className: "!p-0", title: title, description: description, headlineVersion: "XS", align: "left", bgColorHeadline: version }), additionalDescription ? (jsx(Description, { className: "text-m-light mt-1.5 opacity-80", description: additionalDescription })) : null, button ? jsx(Button, { className: "mt-6", ...button }) : null] }, String(key)))) }, `col-${String(index)}`)) : null;
|
|
1427
1461
|
|
|
1428
1462
|
const renderErrorContent = (error) => {
|
|
1429
1463
|
if (error?.errorContentType === 'Image' && error?.image) {
|
|
@@ -3547,6 +3581,7 @@
|
|
|
3547
3581
|
const Blocks = {
|
|
3548
3582
|
Accordion,
|
|
3549
3583
|
AccordionItem,
|
|
3584
|
+
CarouselLinks,
|
|
3550
3585
|
BenefitsBlock,
|
|
3551
3586
|
BusinessBlock,
|
|
3552
3587
|
Bonus,
|
|
@@ -3698,7 +3733,7 @@
|
|
|
3698
3733
|
return (jsx("div", { className: "flex items-end absolute bottom-0 right-0 h-full pointer-events-none", children: jsx(LikeControl, { className: "rounded-tl-lg sticky bottom-0 pointer-events-auto" }) }));
|
|
3699
3734
|
}
|
|
3700
3735
|
|
|
3701
|
-
const packageVersion = "0.6.
|
|
3736
|
+
const packageVersion = "0.6.32";
|
|
3702
3737
|
|
|
3703
3738
|
exports.Blocks = Blocks;
|
|
3704
3739
|
exports.ContentPage = ContentPage;
|