@redneckz/wildless-cms-uni-blocks 0.13.5 → 0.13.6

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 (127) hide show
  1. package/bundle/blocks.schema.json +1 -1
  2. package/bundle/bundle.umd.js +59 -40
  3. package/bundle/bundle.umd.min.js +1 -1
  4. package/bundle/components/ButtonsBlock/ButtonsBlockContent.d.ts +2 -0
  5. package/bundle/components/CarouselProductCard/CarouselProductCardContent.d.ts +2 -4
  6. package/bundle/components/CarouselRecommendationCard/CarouselRecommendationCardContent.d.ts +2 -4
  7. package/bundle/components/Header/HeaderSubMenu.d.ts +1 -1
  8. package/bundle/components/LinkDocs/LinkDocsContent.d.ts +2 -5
  9. package/bundle/components/ParagraphBlock/ParagraphBlockContent.d.ts +3 -3
  10. package/bundle/icons/IconName.d.ts +4 -2
  11. package/bundle/model/HeadlineType.d.ts +1 -1
  12. package/bundle/ui-kit/DialogManager/useDialogsList.d.ts +7 -0
  13. package/cosmos-static/icons/CourtHouseIcon.svg +1 -0
  14. package/dist/components/ButtonsBlock/ButtonsBlock.js +9 -1
  15. package/dist/components/ButtonsBlock/ButtonsBlock.js.map +1 -1
  16. package/dist/components/ButtonsBlock/ButtonsBlockContent.d.ts +2 -0
  17. package/dist/components/CarouselProductCard/CarouselProductCardContent.d.ts +2 -4
  18. package/dist/components/CarouselRecommendationCard/CarouselRecommendationCardContent.d.ts +2 -4
  19. package/dist/components/Header/HeaderSubMenu.d.ts +1 -1
  20. package/dist/components/Header/HeaderSubMenu.js +4 -4
  21. package/dist/components/Header/HeaderSubMenu.js.map +1 -1
  22. package/dist/components/LinkDocs/LinkDocsContent.d.ts +2 -5
  23. package/dist/components/ParagraphBlock/ParagraphBlockContent.d.ts +3 -3
  24. package/dist/icons/IconName.d.ts +4 -2
  25. package/dist/icons/IconName.js +2 -0
  26. package/dist/icons/IconName.js.map +1 -1
  27. package/dist/model/HeadlineType.d.ts +1 -1
  28. package/dist/ui-kit/DialogManager/DialogManager.js +9 -29
  29. package/dist/ui-kit/DialogManager/DialogManager.js.map +1 -1
  30. package/dist/ui-kit/DialogManager/useDialogsList.d.ts +7 -0
  31. package/dist/ui-kit/DialogManager/useDialogsList.js +37 -0
  32. package/dist/ui-kit/DialogManager/useDialogsList.js.map +1 -0
  33. package/lib/components/ButtonsBlock/ButtonsBlock.js +9 -1
  34. package/lib/components/ButtonsBlock/ButtonsBlock.js.map +1 -1
  35. package/lib/components/ButtonsBlock/ButtonsBlockContent.d.ts +2 -0
  36. package/lib/components/CarouselProductCard/CarouselProductCardContent.d.ts +2 -4
  37. package/lib/components/CarouselRecommendationCard/CarouselRecommendationCardContent.d.ts +2 -4
  38. package/lib/components/Header/HeaderSubMenu.d.ts +1 -1
  39. package/lib/components/Header/HeaderSubMenu.js +4 -4
  40. package/lib/components/Header/HeaderSubMenu.js.map +1 -1
  41. package/lib/components/LinkDocs/LinkDocsContent.d.ts +2 -5
  42. package/lib/components/ParagraphBlock/ParagraphBlockContent.d.ts +3 -3
  43. package/lib/icons/IconName.d.ts +4 -2
  44. package/lib/icons/IconName.js +2 -0
  45. package/lib/icons/IconName.js.map +1 -1
  46. package/lib/model/HeadlineType.d.ts +1 -1
  47. package/lib/ui-kit/DialogManager/DialogManager.js +9 -29
  48. package/lib/ui-kit/DialogManager/DialogManager.js.map +1 -1
  49. package/lib/ui-kit/DialogManager/useDialogsList.d.ts +7 -0
  50. package/lib/ui-kit/DialogManager/useDialogsList.js +34 -0
  51. package/lib/ui-kit/DialogManager/useDialogsList.js.map +1 -0
  52. package/mobile/bundle/bundle.umd.js +29 -10
  53. package/mobile/bundle/bundle.umd.min.js +1 -1
  54. package/mobile/bundle/components/ButtonsBlock/ButtonsBlockContent.d.ts +2 -0
  55. package/mobile/bundle/components/CarouselProductCard/CarouselProductCardContent.d.ts +2 -4
  56. package/mobile/bundle/components/CarouselRecommendationCard/CarouselRecommendationCardContent.d.ts +2 -4
  57. package/mobile/bundle/components/Header/HeaderSubMenu.d.ts +1 -1
  58. package/mobile/bundle/components/LinkDocs/LinkDocsContent.d.ts +2 -5
  59. package/mobile/bundle/components/ParagraphBlock/ParagraphBlockContent.d.ts +3 -3
  60. package/mobile/bundle/icons/IconName.d.ts +4 -2
  61. package/mobile/bundle/model/HeadlineType.d.ts +1 -1
  62. package/mobile/bundle/ui-kit/DialogManager/useDialogsList.d.ts +7 -0
  63. package/mobile/dist/components/ButtonsBlock/ButtonsBlock.js +9 -1
  64. package/mobile/dist/components/ButtonsBlock/ButtonsBlock.js.map +1 -1
  65. package/mobile/dist/components/ButtonsBlock/ButtonsBlockContent.d.ts +2 -0
  66. package/mobile/dist/components/CarouselProductCard/CarouselProductCardContent.d.ts +2 -4
  67. package/mobile/dist/components/CarouselRecommendationCard/CarouselRecommendationCardContent.d.ts +2 -4
  68. package/mobile/dist/components/Header/HeaderSubMenu.d.ts +1 -1
  69. package/mobile/dist/components/Header/HeaderSubMenu.js +4 -4
  70. package/mobile/dist/components/Header/HeaderSubMenu.js.map +1 -1
  71. package/mobile/dist/components/LinkDocs/LinkDocsContent.d.ts +2 -5
  72. package/mobile/dist/components/ParagraphBlock/ParagraphBlockContent.d.ts +3 -3
  73. package/mobile/dist/icons/IconName.d.ts +4 -2
  74. package/mobile/dist/icons/IconName.js +2 -0
  75. package/mobile/dist/icons/IconName.js.map +1 -1
  76. package/mobile/dist/model/HeadlineType.d.ts +1 -1
  77. package/mobile/dist/ui-kit/DialogManager/DialogManager.js +9 -29
  78. package/mobile/dist/ui-kit/DialogManager/DialogManager.js.map +1 -1
  79. package/mobile/dist/ui-kit/DialogManager/useDialogsList.d.ts +7 -0
  80. package/mobile/dist/ui-kit/DialogManager/useDialogsList.js +37 -0
  81. package/mobile/dist/ui-kit/DialogManager/useDialogsList.js.map +1 -0
  82. package/mobile/lib/components/ButtonsBlock/ButtonsBlock.js +9 -1
  83. package/mobile/lib/components/ButtonsBlock/ButtonsBlock.js.map +1 -1
  84. package/mobile/lib/components/ButtonsBlock/ButtonsBlockContent.d.ts +2 -0
  85. package/mobile/lib/components/CarouselProductCard/CarouselProductCardContent.d.ts +2 -4
  86. package/mobile/lib/components/CarouselRecommendationCard/CarouselRecommendationCardContent.d.ts +2 -4
  87. package/mobile/lib/components/Header/HeaderSubMenu.d.ts +1 -1
  88. package/mobile/lib/components/Header/HeaderSubMenu.js +4 -4
  89. package/mobile/lib/components/Header/HeaderSubMenu.js.map +1 -1
  90. package/mobile/lib/components/LinkDocs/LinkDocsContent.d.ts +2 -5
  91. package/mobile/lib/components/ParagraphBlock/ParagraphBlockContent.d.ts +3 -3
  92. package/mobile/lib/icons/IconName.d.ts +4 -2
  93. package/mobile/lib/icons/IconName.js +2 -0
  94. package/mobile/lib/icons/IconName.js.map +1 -1
  95. package/mobile/lib/model/HeadlineType.d.ts +1 -1
  96. package/mobile/lib/ui-kit/DialogManager/DialogManager.js +9 -29
  97. package/mobile/lib/ui-kit/DialogManager/DialogManager.js.map +1 -1
  98. package/mobile/lib/ui-kit/DialogManager/useDialogsList.d.ts +7 -0
  99. package/mobile/lib/ui-kit/DialogManager/useDialogsList.js +34 -0
  100. package/mobile/lib/ui-kit/DialogManager/useDialogsList.js.map +1 -0
  101. package/mobile/src/components/ButtonsBlock/ButtonsBlock.tsx +22 -5
  102. package/mobile/src/components/ButtonsBlock/ButtonsBlockContent.ts +2 -0
  103. package/mobile/src/components/CarouselProductCard/CarouselProductCardContent.ts +7 -4
  104. package/mobile/src/components/CarouselRecommendationCard/CarouselRecommendationCardContent.ts +3 -4
  105. package/mobile/src/components/Header/HeaderSubMenu.tsx +17 -15
  106. package/mobile/src/components/Headline/Headline.example.json +1 -1
  107. package/mobile/src/components/LinkDocs/LinkDocsContent.ts +3 -5
  108. package/mobile/src/components/ParagraphBlock/ParagraphBlockContent.ts +9 -8
  109. package/mobile/src/icons/CourtHouseIcon.svg +1 -0
  110. package/mobile/src/icons/IconName.ts +4 -4
  111. package/mobile/src/model/HeadlineType.ts +1 -1
  112. package/mobile/src/ui-kit/DialogManager/DialogManager.tsx +9 -34
  113. package/mobile/src/ui-kit/DialogManager/useDialogsList.ts +50 -0
  114. package/package.json +1 -1
  115. package/src/components/ButtonsBlock/ButtonsBlock.tsx +22 -5
  116. package/src/components/ButtonsBlock/ButtonsBlockContent.ts +2 -0
  117. package/src/components/CarouselProductCard/CarouselProductCardContent.ts +7 -4
  118. package/src/components/CarouselRecommendationCard/CarouselRecommendationCardContent.ts +3 -4
  119. package/src/components/Header/HeaderSubMenu.tsx +17 -15
  120. package/src/components/Headline/Headline.example.json +1 -1
  121. package/src/components/LinkDocs/LinkDocsContent.ts +3 -5
  122. package/src/components/ParagraphBlock/ParagraphBlockContent.ts +9 -8
  123. package/src/icons/CourtHouseIcon.svg +1 -0
  124. package/src/icons/IconName.ts +4 -1
  125. package/src/model/HeadlineType.ts +1 -1
  126. package/src/ui-kit/DialogManager/DialogManager.tsx +9 -34
  127. package/src/ui-kit/DialogManager/useDialogsList.ts +50 -0
@@ -1434,7 +1434,15 @@
1434
1434
 
1435
1435
  const BusinessBlock = JSX(({ className, title, cards, ...rest }) => (jsxs(BlockWrapper, { className: className, defaultPadding: "p-6xl space-y-3xl", ...rest, children: [jsx(Heading, { headingType: "h3", title: title, className: "text-center" }), jsx("div", { className: "flex gap-lg", children: cards?.length ? cards.map((_, i) => jsx(BusinessCard, { ..._ }, String(i))) : null })] })));
1436
1436
 
1437
- const ButtonsBlock = JSX(({ buttons, className, ...rest }) => (jsx(BlockWrapper, { className: style('!bg-transparent', className), defaultPadding: "p-0", ...rest, children: renderButtonsSection(buttons) })));
1437
+ const alignStyleMap = {
1438
+ start: 'justify-start',
1439
+ center: 'justify-center',
1440
+ end: 'justify-end',
1441
+ };
1442
+ const ButtonsBlock = JSX(({ buttons, className = '', align, ...rest }) => {
1443
+ const alignStyle = align ? style('flex', alignStyleMap[align]) : '';
1444
+ return (jsx(BlockWrapper, { className: style('!bg-transparent', alignStyle, className), defaultPadding: "p-0", ...rest, children: renderButtonsSection(buttons) }));
1445
+ });
1438
1446
 
1439
1447
  const useCarouselControls = (props, initialIndex = 0) => {
1440
1448
  const { itemCount, visibleItemCount } = props;
@@ -3623,15 +3631,6 @@
3623
3631
  return (jsxs("div", { className: style('flex items-center gap-lg', className), children: [jsx(TopItem, { flat: true, href: "#", text: currentLocation?.name, onClick: openLocationDialog }), officesLink ? jsx(TopItem, { flat: true, href: officesLink, text: "\u041E\u0444\u0438\u0441\u044B \u0438 \u0431\u0430\u043D\u043A\u043E\u043C\u0430\u0442\u044B" }) : null, jsx(HeaderSecondaryMenuButton, { image: { icon: 'LoupeIcon', iconVersion }, ariaLabel: "\u041F\u043E\u0438\u0441\u043A", onClick: openSearchDialog })] }));
3624
3632
  });
3625
3633
 
3626
- const isHrefActive = (router) => ({ href }) => withoutQuery(isURL(href) ? router.href : router.pathname).startsWith(withoutQuery(href));
3627
-
3628
- const findActiveSubItem = (router) => (items = []) => {
3629
- const possibleActiveSubItems = items?.filter(isHrefActive(router));
3630
- return possibleActiveSubItems?.length
3631
- ? maxBy((_) => _.href?.length || 0)(possibleActiveSubItems) // More specific item with max length
3632
- : undefined;
3633
- };
3634
-
3635
3634
  const DropdownMenu = JSX(({ className = '', items, activeItem }) => {
3636
3635
  const link = useLink();
3637
3636
  const [visible, setVisible] = useState(false);
@@ -3646,26 +3645,6 @@
3646
3645
  }) })] }));
3647
3646
  });
3648
3647
 
3649
- const HeaderItem = JSX(({ className = '', active, dataItemName, children, ...rest }) => {
3650
- const link = useLink();
3651
- const { href, target, text, onClick } = link(rest);
3652
- return (jsxs("a", { className: style('relative inline-block bg-transparent text-center no-underline', className), href: href, target: target, "data-item-name": dataItemName, onClick: onClick, children: [jsx("span", { className: getTextStyle(active), children: text || children }), active ? (jsx("div", { className: "absolute left-0 right-0 -bottom-3 h-0.5 bg-primary-main group-data-transparent:bg-transparent" })) : null] }));
3653
- });
3654
- const getTextStyle = (active = false) => style('font-sans text-l font-light', active ? 'text-primary-main' : 'text-primary-text hover:text-primary-main', 'group-data-transparent:text-white group-data-transparent:hover:text-primary-hover');
3655
-
3656
- const HeaderSubMenuItem = JSX(({ observerOptions, onVisibilityChange, children, className, ...rest }) => {
3657
- const observerCallback = useCallback((entries) => {
3658
- if (!entries.length || !onVisibilityChange) {
3659
- return;
3660
- }
3661
- // Assumption about entries order (by time)
3662
- const entry = entries[entries.length - 1];
3663
- onVisibilityChange(entry.isIntersecting);
3664
- }, [onVisibilityChange]);
3665
- const ref = useIntersectionObserver(observerCallback, observerOptions);
3666
- return (jsx("span", { ref: ref, className: className, children: jsx(HeaderItem, { ...rest, children: children }) }));
3667
- });
3668
-
3669
3648
  const getNS = (_) => globalThis[_];
3670
3649
  function useExternalNS(namespaceName, url) {
3671
3650
  const [externalNS, setExternalNS] = useState();
@@ -3721,12 +3700,41 @@
3721
3700
  });
3722
3701
  const renderChatBotButton = ({ className, iconVersion, onClick }) => (jsx(HeaderSecondaryMenuButton, { className: style(CHAT_BUTTON_EXTERNAL_NAME, className), image: { icon: 'HeadphonesIcon', iconVersion }, ariaLabel: "\u0427\u0430\u0442", onClick: onClick, buttonSize: "large", isGrayBg: true }));
3723
3702
 
3703
+ const HeaderItem = JSX(({ className = '', active, dataItemName, children, ...rest }) => {
3704
+ const link = useLink();
3705
+ const { href, target, text, onClick } = link(rest);
3706
+ return (jsxs("a", { className: style('relative inline-block bg-transparent text-center no-underline', className), href: href, target: target, "data-item-name": dataItemName, onClick: onClick, children: [jsx("span", { className: getTextStyle(active), children: text || children }), active ? (jsx("div", { className: "absolute left-0 right-0 -bottom-3 h-0.5 bg-primary-main group-data-transparent:bg-transparent" })) : null] }));
3707
+ });
3708
+ const getTextStyle = (active = false) => style('font-sans text-l font-light', active ? 'text-primary-main' : 'text-primary-text hover:text-primary-main', 'group-data-transparent:text-white group-data-transparent:hover:text-primary-hover');
3709
+
3710
+ const HeaderSubMenuItem = JSX(({ observerOptions, onVisibilityChange, children, className, ...rest }) => {
3711
+ const observerCallback = useCallback((entries) => {
3712
+ if (!entries.length || !onVisibilityChange) {
3713
+ return;
3714
+ }
3715
+ // Assumption about entries order (by time)
3716
+ const entry = entries[entries.length - 1];
3717
+ onVisibilityChange(entry.isIntersecting);
3718
+ }, [onVisibilityChange]);
3719
+ const ref = useIntersectionObserver(observerCallback, observerOptions);
3720
+ return (jsx("span", { ref: ref, className: className, children: jsx(HeaderItem, { ...rest, children: children }) }));
3721
+ });
3722
+
3724
3723
  const BUTTON_STYLE = {
3725
3724
  default: 'px-lg bg-main-divider rounded hover:text-primary-main',
3726
3725
  transparent: 'text-white hover:text-primary-hover',
3727
3726
  };
3728
3727
  const InternetBankButton = JSX(({ version, internetBankUrl }) => internetBankUrl ? (jsx(Button, { href: internetBankUrl, ariaLabel: "\u0418\u043D\u0442\u0435\u0440\u043D\u0435\u0442-\u0431\u0430\u043D\u043A", target: "_blank", className: style('py-s ml-s text-l font-light whitespace-nowrap hover:text-primary-main', BUTTON_STYLE[version === 'transparent' ? 'transparent' : 'default']), children: "\u0418\u043D\u0442\u0435\u0440\u043D\u0435\u0442-\u0431\u0430\u043D\u043A" })) : null);
3729
3728
 
3729
+ const isHrefActive = (router) => ({ href }) => withoutQuery(isURL(href) ? router.href : router.pathname).startsWith(withoutQuery(href));
3730
+
3731
+ const findActiveSubItem = (router) => (items = []) => {
3732
+ const possibleActiveSubItems = items?.filter(isHrefActive(router));
3733
+ return possibleActiveSubItems?.length
3734
+ ? maxBy((_) => _.href?.length || 0)(possibleActiveSubItems) // More specific item with max length
3735
+ : undefined;
3736
+ };
3737
+
3730
3738
  const HeaderSubMenu = JSX(({ subItems = [], version, internetBankUrl }) => {
3731
3739
  const iconVersion = version === 'transparent' ? 'white' : 'black';
3732
3740
  const router = useRouter();
@@ -3740,7 +3748,7 @@
3740
3748
  ? handleIntersectionActivation(index)
3741
3749
  : handleIntersectionDeactivation(index));
3742
3750
  }), [subItems]);
3743
- return (jsxs("nav", { className: "relative mt-s flex items-center justify-between", children: [jsx("div", { ref: subItemsListRef, className: "overflow-hidden whitespace-nowrap pb-s mt-xs space-x-3xl", children: subItems.map((_, i) => (jsx(HeaderSubMenuItem, { className: visibleItemsCount - 1 < i ? 'invisible' : '', active: _ === activeSubItem, observerOptions: observerOptions, onVisibilityChange: subItemsVisibilityHandlers[i], ..._ }, String(i)))) }), dropDownMenuItems.length ? (jsx(DropdownMenu, { className: "relative w-auto z-40", items: dropDownMenuItems, activeItem: activeSubItem })) : null, projectSettings.CHAT_BOT ? (jsx(HeaderChatBotButton, { className: "ml-4xl", iconVersion: iconVersion, chat: projectSettings.CHAT_BOT })) : null, jsx(InternetBankButton, { version: version, internetBankUrl: internetBankUrl })] }));
3751
+ return (jsxs("nav", { className: "relative mt-s flex items-center justify-between", children: [jsx("div", { ref: subItemsListRef, className: "overflow-hidden whitespace-nowrap pb-s mt-xs space-x-3xl", children: subItems.map((_, i) => (jsx(HeaderSubMenuItem, { className: visibleItemsCount - 1 < i ? 'invisible' : '', active: _ === activeSubItem, observerOptions: observerOptions, onVisibilityChange: subItemsVisibilityHandlers[i], ..._ }, String(i)))) }), dropDownMenuItems.length ? (jsx(DropdownMenu, { className: "relative w-auto z-40", items: dropDownMenuItems, activeItem: activeSubItem })) : null, jsxs("div", { className: "flex", children: [projectSettings.CHAT_BOT ? (jsx(HeaderChatBotButton, { className: "ml-4xl", iconVersion: iconVersion, chat: projectSettings.CHAT_BOT })) : null, jsx(InternetBankButton, { version: version, internetBankUrl: internetBankUrl })] })] }));
3744
3752
  });
3745
3753
  const handleIntersectionActivation = (index) => (prev) => Math.max(prev, index + 1);
3746
3754
  const handleIntersectionDeactivation = (index) => (prev) => Math.min(prev, index);
@@ -5104,19 +5112,16 @@
5104
5112
  throw new Error(x);
5105
5113
  }
5106
5114
 
5107
- const DialogManager = JSX(() => {
5115
+ const useDialogsList = ({ onCloseAll, onClose, } = {}) => {
5108
5116
  const [dialogs, { push, pop, clear }] = useList();
5109
5117
  const closeAll = useCallback(() => {
5110
- for (const _ of dialogs) {
5111
- _.onClose && _.onClose();
5112
- }
5118
+ onCloseAll && onCloseAll(dialogs);
5113
5119
  clear();
5114
- }, [dialogs]);
5120
+ }, [dialogs, onCloseAll]);
5115
5121
  const close = useCallback(() => {
5116
- const _ = dialogs[dialogs.length - 1];
5117
- _?.onClose && _.onClose();
5122
+ onClose && onClose(dialogs[dialogs.length - 1]);
5118
5123
  pop();
5119
- }, [dialogs]);
5124
+ }, [dialogs, onClose]);
5120
5125
  useEffect(() => defaultEventBus.subscribe('dialog', (action) => {
5121
5126
  switch (action.type) {
5122
5127
  case 'open':
@@ -5134,6 +5139,20 @@
5134
5139
  assertUnreachable(action);
5135
5140
  }
5136
5141
  }), [closeAll, close]);
5142
+ return dialogs;
5143
+ };
5144
+
5145
+ const DialogManager = JSX(() => {
5146
+ const handleCloseAll = useCallback((dialogs) => {
5147
+ for (const _ of dialogs) {
5148
+ _?.onClose && _.onClose();
5149
+ }
5150
+ }, []);
5151
+ const handleClose = useCallback((_) => {
5152
+ _?.onClose && _.onClose();
5153
+ }, []);
5154
+ const dialogs = useDialogsList({ onCloseAll: handleCloseAll, onClose: handleClose });
5155
+ const { close } = useDialogManager();
5137
5156
  useEffect(() => {
5138
5157
  const handleEscape = ({ key }) => {
5139
5158
  if (key === 'Escape') {
@@ -5215,7 +5234,7 @@
5215
5234
  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" }) }));
5216
5235
  }
5217
5236
 
5218
- const packageVersion = "0.13.5";
5237
+ const packageVersion = "0.13.6";
5219
5238
 
5220
5239
  exports.Blocks = Blocks;
5221
5240
  exports.ContentPage = ContentPage;