@redneckz/wildless-cms-uni-blocks 0.14.23 → 0.14.24

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 (92) hide show
  1. package/bin/migration-scripts/0.14.24.js +29 -0
  2. package/bundle/bundle.umd.js +25 -6
  3. package/bundle/bundle.umd.min.js +1 -1
  4. package/bundle/components/Tabs/Tabs.d.ts +1 -1
  5. package/bundle/hooks/useRouter.d.ts +1 -0
  6. package/bundle/ui-kit/TabsControl/TabItem.d.ts +1 -0
  7. package/dist/components/ApplicationForm/ApplicationFormGrantSupport.js +1 -1
  8. package/dist/components/ApplicationForm/ApplicationFormGrantSupport.js.map +1 -1
  9. package/dist/components/Calculator/Calculator.mobile.js +2 -1
  10. package/dist/components/Calculator/Calculator.mobile.js.map +1 -1
  11. package/dist/components/Calculator/Rate.js +1 -1
  12. package/dist/components/Calculator/Rate.js.map +1 -1
  13. package/dist/components/Tabs/Tabs.d.ts +1 -1
  14. package/dist/components/Tabs/Tabs.js +22 -3
  15. package/dist/components/Tabs/Tabs.js.map +1 -1
  16. package/dist/hooks/useRouter.d.ts +1 -0
  17. package/dist/hooks/useRouter.js +1 -0
  18. package/dist/hooks/useRouter.js.map +1 -1
  19. package/dist/setup-fixture.js +2 -1
  20. package/dist/setup-fixture.js.map +1 -1
  21. package/dist/ui-kit/TabsControl/TabItem.d.ts +1 -0
  22. package/dist/ui-kit/TabsControl/TabItem.js.map +1 -1
  23. package/lib/common.css +1 -1
  24. package/lib/components/ApplicationForm/ApplicationFormGrantSupport.js +1 -1
  25. package/lib/components/ApplicationForm/ApplicationFormGrantSupport.js.map +1 -1
  26. package/lib/components/Calculator/Calculator.mobile.js +2 -1
  27. package/lib/components/Calculator/Calculator.mobile.js.map +1 -1
  28. package/lib/components/Calculator/Rate.js +1 -1
  29. package/lib/components/Calculator/Rate.js.map +1 -1
  30. package/lib/components/Tabs/Tabs.d.ts +1 -1
  31. package/lib/components/Tabs/Tabs.js +22 -3
  32. package/lib/components/Tabs/Tabs.js.map +1 -1
  33. package/lib/hooks/useRouter.d.ts +1 -0
  34. package/lib/hooks/useRouter.js +1 -0
  35. package/lib/hooks/useRouter.js.map +1 -1
  36. package/lib/setup-fixture.js +2 -1
  37. package/lib/setup-fixture.js.map +1 -1
  38. package/lib/ui-kit/TabsControl/TabItem.d.ts +1 -0
  39. package/lib/ui-kit/TabsControl/TabItem.js.map +1 -1
  40. package/mobile/bundle/bundle.umd.js +26 -7
  41. package/mobile/bundle/bundle.umd.min.js +1 -1
  42. package/mobile/bundle/components/Tabs/Tabs.d.ts +1 -1
  43. package/mobile/bundle/hooks/useRouter.d.ts +1 -0
  44. package/mobile/bundle/ui-kit/TabsControl/TabItem.d.ts +1 -0
  45. package/mobile/dist/components/ApplicationForm/ApplicationFormGrantSupport.js +1 -1
  46. package/mobile/dist/components/ApplicationForm/ApplicationFormGrantSupport.js.map +1 -1
  47. package/mobile/dist/components/Calculator/Calculator.js +2 -1
  48. package/mobile/dist/components/Calculator/Calculator.js.map +1 -1
  49. package/mobile/dist/components/Calculator/Rate.js +1 -1
  50. package/mobile/dist/components/Calculator/Rate.js.map +1 -1
  51. package/mobile/dist/components/Tabs/Tabs.d.ts +1 -1
  52. package/mobile/dist/components/Tabs/Tabs.js +22 -3
  53. package/mobile/dist/components/Tabs/Tabs.js.map +1 -1
  54. package/mobile/dist/hooks/useRouter.d.ts +1 -0
  55. package/mobile/dist/hooks/useRouter.js +1 -0
  56. package/mobile/dist/hooks/useRouter.js.map +1 -1
  57. package/mobile/dist/setup-fixture.js +2 -1
  58. package/mobile/dist/setup-fixture.js.map +1 -1
  59. package/mobile/dist/ui-kit/TabsControl/TabItem.d.ts +1 -0
  60. package/mobile/dist/ui-kit/TabsControl/TabItem.js.map +1 -1
  61. package/mobile/lib/common.css +1 -1
  62. package/mobile/lib/components/ApplicationForm/ApplicationFormGrantSupport.js +1 -1
  63. package/mobile/lib/components/ApplicationForm/ApplicationFormGrantSupport.js.map +1 -1
  64. package/mobile/lib/components/Calculator/Calculator.js +2 -1
  65. package/mobile/lib/components/Calculator/Calculator.js.map +1 -1
  66. package/mobile/lib/components/Calculator/Rate.js +1 -1
  67. package/mobile/lib/components/Calculator/Rate.js.map +1 -1
  68. package/mobile/lib/components/Tabs/Tabs.d.ts +1 -1
  69. package/mobile/lib/components/Tabs/Tabs.js +22 -3
  70. package/mobile/lib/components/Tabs/Tabs.js.map +1 -1
  71. package/mobile/lib/hooks/useRouter.d.ts +1 -0
  72. package/mobile/lib/hooks/useRouter.js +1 -0
  73. package/mobile/lib/hooks/useRouter.js.map +1 -1
  74. package/mobile/lib/setup-fixture.js +2 -1
  75. package/mobile/lib/setup-fixture.js.map +1 -1
  76. package/mobile/lib/ui-kit/TabsControl/TabItem.d.ts +1 -0
  77. package/mobile/lib/ui-kit/TabsControl/TabItem.js.map +1 -1
  78. package/mobile/src/components/ApplicationForm/ApplicationFormGrantSupport.tsx +1 -0
  79. package/mobile/src/components/Calculator/Calculator.tsx +9 -1
  80. package/mobile/src/components/Calculator/Rate.tsx +1 -3
  81. package/mobile/src/components/Tabs/Tabs.tsx +28 -4
  82. package/mobile/src/hooks/useRouter.ts +2 -0
  83. package/mobile/src/setup-fixture.ts +2 -1
  84. package/mobile/src/ui-kit/TabsControl/TabItem.tsx +1 -0
  85. package/package.json +2 -2
  86. package/src/components/ApplicationForm/ApplicationFormGrantSupport.tsx +1 -0
  87. package/src/components/Calculator/Calculator.mobile.tsx +9 -1
  88. package/src/components/Calculator/Rate.tsx +1 -3
  89. package/src/components/Tabs/Tabs.tsx +28 -4
  90. package/src/hooks/useRouter.ts +2 -0
  91. package/src/setup-fixture.ts +2 -1
  92. package/src/ui-kit/TabsControl/TabItem.tsx +1 -0
@@ -0,0 +1,29 @@
1
+ export const description = 'v0.14.24';
2
+
3
+ export default (uniPath, content) => {
4
+ if (!content?.blocks) {
5
+ return content;
6
+ }
7
+
8
+ for (const block of content.blocks) {
9
+ adjustTabsBlock(block);
10
+ }
11
+
12
+ return { ...content };
13
+ };
14
+
15
+ function adjustTabsBlock(block) {
16
+ if (block.blocks) {
17
+ for (const childBlock of block.blocks) {
18
+ adjustTabsBlock(childBlock);
19
+ }
20
+ }
21
+
22
+ if (!block?.content) {
23
+ return;
24
+ }
25
+
26
+ if (block?.type === 'Tabs' && !block.content.tabsMode) {
27
+ block.content.tabsMode = 'wideScreen';
28
+ }
29
+ }
@@ -567,6 +567,7 @@
567
567
  return useRouter._impl();
568
568
  }
569
569
  useRouter._impl = () => ({
570
+ isReady: false,
570
571
  href: globalThis.location?.href || '/',
571
572
  pathname: globalThis.location?.pathname || '/',
572
573
  query: {},
@@ -1153,7 +1154,7 @@
1153
1154
  version: button?.version,
1154
1155
  });
1155
1156
  const regionHref = regions?.find((_) => _.name === region.key)?.href;
1156
- return (jsxs("div", { className: "container space-y-s @xl:space-y-lg", children: [regions ? (jsx(SelectControl, { label: "\u0412\u0430\u0448 \u0440\u0435\u0433\u0438\u043E\u043D", placeholder: "\u0412\u044B\u0431\u0435\u0440\u0438\u0442\u0435 \u0440\u0435\u0433\u0438\u043E\u043D", options: regions.map(({ name = '' }) => ({ key: name })), value: region, onChange: setRegion })) : null, regionHref ? (jsx("div", { className: "text-center", children: jsx(Button, { href: regionHref, target: "_blank", className: style('p-m w-full @xl:w-auto', buttonStyle), children: button?.text ? button.text : 'Перейти' }) })) : null] }));
1157
+ return (jsxs("div", { className: "container space-y-s @xl:space-y-lg", children: [regions ? (jsx(SelectControl, { label: "\u0412\u0430\u0448 \u0440\u0435\u0433\u0438\u043E\u043D", placeholder: "\u0412\u044B\u0431\u0435\u0440\u0438\u0442\u0435 \u0440\u0435\u0433\u0438\u043E\u043D", isSearch: true, options: regions.map(({ name = '' }) => ({ key: name })), value: region, onChange: setRegion })) : null, regionHref ? (jsx("div", { className: "text-center", children: jsx(Button, { href: regionHref, target: "_blank", className: style('p-m w-full @xl:w-auto', buttonStyle), children: button?.text ? button.text : 'Перейти' }) })) : null] }));
1157
1158
  });
1158
1159
 
1159
1160
  const sourcesComparator = (a, b) => a?.media && b?.media ? a.media - b.media : 0;
@@ -1577,7 +1578,7 @@
1577
1578
 
1578
1579
  const renderFootnote = (text) => text ? (jsx(Paragraph, { size: "text-s", font: "font-light", color: "text-secondary-text", children: text })) : null;
1579
1580
 
1580
- const Rate = JSX(({ rate, title = 'Ставка', unit, depositeName, isShowDepositeName, fractionDigits = 2 }) => (jsxs("div", { children: [jsx(Text, { size: "text-l", font: "font-light", color: "text-secondary-text", children: title }), jsxs("div", { className: "relative", children: [jsxs("div", { className: "flex justify-start gradient-color-text", children: [jsx("span", { className: "font-mohave text-title-huge pr-xl -mt-m tracking-[-15px]", children: String(rate.toFixed(fractionDigits)).replace('.', ',') }), unit ? jsx("span", { className: "text-7xl", children: unit }) : null] }), depositeName && isShowDepositeName ? (jsx("div", { className: "absolute bottom-7 w-full text-center whitespace-nowrap", children: depositeName })) : null] })] })));
1581
+ const Rate = JSX(({ rate, title = 'Ставка', unit, depositeName, isShowDepositeName, fractionDigits = 2 }) => (jsxs("div", { children: [jsx(Text, { size: "text-l", font: "font-light", color: "text-secondary-text", children: title }), jsxs("div", { className: "relative", children: [jsxs("div", { className: "flex justify-start gradient-color-text", children: [jsx("span", { className: "font-mohave text-title-huge pr-xl -mt-m tracking-[-15px]", children: String(rate.toFixed(fractionDigits)).replace('.', ',') }), unit ? jsx("span", { className: "text-7xl", children: unit }) : null] }), depositeName && isShowDepositeName ? (jsx("div", { className: "absolute bottom-2 w-full text-left whitespace-nowrap", children: depositeName })) : null] })] })));
1581
1582
 
1582
1583
  const UnknownRate = JSX(({ title = 'Ставка', isUnavailableByTerm = false }) => (jsxs("div", { className: "space-y-s", children: [jsx(Text, { size: "text-l", font: "font-light", color: "text-secondary-text", children: title }), jsx(Icon, { className: "w-10 h-10 @5xl:h-auto @5xl:w-40", name: "PercentIcon" }), jsx("div", { className: "w-64", children: isUnavailableByTerm ? (jsxs(Paragraph, { size: "text-xl", font: "font-light", color: "text-primary-text", children: ["\u041F\u0440\u043E\u0446\u0435\u043D\u0442\u043D\u0430\u044F \u0441\u0442\u0430\u0432\u043A\u0430 \u0434\u043B\u044F \u0441\u0440\u043E\u043A\u0430 ", jsx("strong", { children: "1-30 \u0434\u043D\u0435\u0439" }), " \u0443\u0441\u0442\u0430\u043D\u0430\u0432\u043B\u0438\u0432\u0430\u0435\u0442\u0441\u044F \u043F\u0440\u0438 \u043E\u0431\u0440\u0430\u0449\u0435\u043D\u0438\u0438 \u0432 \u0411\u0430\u043D\u043A"] })) : (jsx(Paragraph, { size: "text-xl", font: "font-light", color: "text-primary-text", children: "\u0412\u044B\u0431\u0435\u0440\u0438\u0442\u0435 \u0434\u0440\u0443\u0433\u0443\u044E \u0441\u0443\u043C\u043C\u0443 \u0438\u043B\u0438 \u0441\u0440\u043E\u043A" })) })] })));
1583
1584
 
@@ -5126,25 +5127,43 @@
5126
5127
  }
5127
5128
  };
5128
5129
 
5130
+ const TAB_QUERY_PARAM_KEY = 'tab';
5129
5131
  const Tabs = JSX(({ className = '', isSticky, tabs = [], tabsMode, ...rest }) => {
5132
+ const router = useRouter();
5133
+ const { isReady } = router;
5130
5134
  const tabsControlItems = useMemo(() => tabs.map(normalizeTab), [tabs]);
5131
5135
  const [activeTabIndex, setActiveTabIndex] = useState(0);
5132
5136
  useEffect(() => {
5133
5137
  if (!tabs || !tabs[0]) {
5134
5138
  return;
5135
5139
  }
5136
- fireTabEvent(tabs[0]);
5137
- }, []);
5140
+ const defaultTabIndex = router.query[TAB_QUERY_PARAM_KEY]
5141
+ ? tabs.findIndex((_) => _.type === 'group' && _.ref === router.query[TAB_QUERY_PARAM_KEY]) || 0
5142
+ : 0;
5143
+ setActiveTabIndex(defaultTabIndex);
5144
+ fireTabEvent(tabs[defaultTabIndex]);
5145
+ }, [isReady]);
5138
5146
  useEffect(() => {
5139
5147
  const activeTab = tabs[activeTabIndex];
5140
5148
  if (activeTab?.type === 'group') {
5141
5149
  defaultEventBus.subject('tab', { type: activeTab.type, label: activeTab.ref });
5142
5150
  }
5143
5151
  }, [tabs, activeTabIndex]);
5152
+ const updateUrlSearchTabParam = (_) => {
5153
+ const searchParams = new URLSearchParams(router.query);
5154
+ if (_.name) {
5155
+ searchParams.set(TAB_QUERY_PARAM_KEY, _.name);
5156
+ }
5157
+ else {
5158
+ searchParams.delete(TAB_QUERY_PARAM_KEY);
5159
+ }
5160
+ router.replace(`${router.pathname}?${searchParams}`, '', { scroll: false });
5161
+ };
5144
5162
  const handleChange = useCallback((_) => {
5145
5163
  const index = tabsControlItems.indexOf(_);
5146
5164
  setActiveTabIndex(index);
5147
5165
  fireTabEvent(tabs[index]);
5166
+ updateUrlSearchTabParam(_);
5148
5167
  }, [tabs, tabsControlItems]);
5149
5168
  return (jsx(BlockWrapper, { className: style(isSticky ? 'sticky top-1 z-20' : '', className), defaultPadding: "p-0", ...rest, children: renderTabs({
5150
5169
  items: tabsControlItems,
@@ -5161,7 +5180,7 @@
5161
5180
  defaultEventBus.fire('tab', { type: tab.type, label: tab.href });
5162
5181
  }
5163
5182
  };
5164
- const normalizeTab = (_) => (_?.type === 'group' ? { text: _.title } : _);
5183
+ const normalizeTab = (_) => _?.type === 'group' ? { text: _.title, name: _.ref } : _;
5165
5184
 
5166
5185
  const dividerStyle = '@4xl:border-main-divider @4xl:border-b';
5167
5186
  const firstCellStyle = 'w-80 flex-shrink-0';
@@ -5661,7 +5680,7 @@
5661
5680
  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" }) }));
5662
5681
  }
5663
5682
 
5664
- const packageVersion = "0.14.23";
5683
+ const packageVersion = "0.14.24";
5665
5684
 
5666
5685
  exports.Blocks = Blocks;
5667
5686
  exports.ContentPage = ContentPage;