@redneckz/wildless-cms-uni-blocks 0.14.151 → 0.14.153
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/bundle/bundle.umd.js +31 -12
- package/bundle/bundle.umd.min.js +1 -1
- package/bundle/components/TabsLayout/TabsLayoutRedirectSection.d.ts +6 -0
- package/bundle/components/TabsLayout/useScrollToTab.d.ts +2 -0
- package/dist/components/TabsLayout/TabsLayout.js +5 -6
- package/dist/components/TabsLayout/TabsLayout.js.map +1 -1
- package/dist/components/TabsLayout/TabsLayoutRedirectSection.d.ts +6 -0
- package/dist/components/TabsLayout/TabsLayoutRedirectSection.js +27 -0
- package/dist/components/TabsLayout/TabsLayoutRedirectSection.js.map +1 -0
- package/dist/components/TabsLayout/useScrollToTab.d.ts +2 -0
- package/dist/components/TabsLayout/useScrollToTab.js +17 -0
- package/dist/components/TabsLayout/useScrollToTab.js.map +1 -0
- package/lib/components/TabsLayout/TabsLayout.js +6 -7
- package/lib/components/TabsLayout/TabsLayout.js.map +1 -1
- package/lib/components/TabsLayout/TabsLayoutRedirectSection.d.ts +6 -0
- package/lib/components/TabsLayout/TabsLayoutRedirectSection.js +25 -0
- package/lib/components/TabsLayout/TabsLayoutRedirectSection.js.map +1 -0
- package/lib/components/TabsLayout/useScrollToTab.d.ts +2 -0
- package/lib/components/TabsLayout/useScrollToTab.js +14 -0
- package/lib/components/TabsLayout/useScrollToTab.js.map +1 -0
- package/mobile/bundle/bundle.umd.js +31 -12
- package/mobile/bundle/bundle.umd.min.js +1 -1
- package/mobile/bundle/components/TabsLayout/TabsLayoutRedirectSection.d.ts +6 -0
- package/mobile/bundle/components/TabsLayout/useScrollToTab.d.ts +2 -0
- package/mobile/dist/components/TabsLayout/TabsLayout.js +5 -6
- package/mobile/dist/components/TabsLayout/TabsLayout.js.map +1 -1
- package/mobile/dist/components/TabsLayout/TabsLayoutRedirectSection.d.ts +6 -0
- package/mobile/dist/components/TabsLayout/TabsLayoutRedirectSection.js +27 -0
- package/mobile/dist/components/TabsLayout/TabsLayoutRedirectSection.js.map +1 -0
- package/mobile/dist/components/TabsLayout/useScrollToTab.d.ts +2 -0
- package/mobile/dist/components/TabsLayout/useScrollToTab.js +17 -0
- package/mobile/dist/components/TabsLayout/useScrollToTab.js.map +1 -0
- package/mobile/lib/components/TabsLayout/TabsLayout.js +6 -7
- package/mobile/lib/components/TabsLayout/TabsLayout.js.map +1 -1
- package/mobile/lib/components/TabsLayout/TabsLayoutRedirectSection.d.ts +6 -0
- package/mobile/lib/components/TabsLayout/TabsLayoutRedirectSection.js +25 -0
- package/mobile/lib/components/TabsLayout/TabsLayoutRedirectSection.js.map +1 -0
- package/mobile/lib/components/TabsLayout/useScrollToTab.d.ts +2 -0
- package/mobile/lib/components/TabsLayout/useScrollToTab.js +14 -0
- package/mobile/lib/components/TabsLayout/useScrollToTab.js.map +1 -0
- package/mobile/src/components/TabsLayout/TabsLayout.tsx +6 -7
- package/mobile/src/components/TabsLayout/TabsLayoutRedirectSection.tsx +32 -0
- package/mobile/src/components/TabsLayout/useScrollToTab.ts +16 -0
- package/mobile/src/components/UnitBlock/UnitBlock.example.json +7 -1
- package/mobile/src/components/UnitBlock/UnitBlock.ui.json +1 -1
- package/package.json +1 -1
- package/src/components/TabsLayout/TabsLayout.tsx +6 -7
- package/src/components/TabsLayout/TabsLayoutRedirectSection.tsx +32 -0
- package/src/components/TabsLayout/useScrollToTab.ts +16 -0
- package/src/components/UnitBlock/UnitBlock.example.json +7 -1
- package/src/components/UnitBlock/UnitBlock.ui.json +1 -1
- package/bundle/components/TabsLayout/TabsLayoutRedirectTab.d.ts +0 -6
- package/dist/components/TabsLayout/TabsLayoutRedirectTab.d.ts +0 -6
- package/dist/components/TabsLayout/TabsLayoutRedirectTab.js +0 -17
- package/dist/components/TabsLayout/TabsLayoutRedirectTab.js.map +0 -1
- package/lib/components/TabsLayout/TabsLayoutRedirectTab.d.ts +0 -6
- package/lib/components/TabsLayout/TabsLayoutRedirectTab.js +0 -15
- package/lib/components/TabsLayout/TabsLayoutRedirectTab.js.map +0 -1
- package/mobile/bundle/components/TabsLayout/TabsLayoutRedirectTab.d.ts +0 -6
- package/mobile/dist/components/TabsLayout/TabsLayoutRedirectTab.d.ts +0 -6
- package/mobile/dist/components/TabsLayout/TabsLayoutRedirectTab.js +0 -17
- package/mobile/dist/components/TabsLayout/TabsLayoutRedirectTab.js.map +0 -1
- package/mobile/lib/components/TabsLayout/TabsLayoutRedirectTab.d.ts +0 -6
- package/mobile/lib/components/TabsLayout/TabsLayoutRedirectTab.js +0 -15
- package/mobile/lib/components/TabsLayout/TabsLayoutRedirectTab.js.map +0 -1
- package/mobile/src/components/TabsLayout/TabsLayoutRedirectTab.tsx +0 -26
- package/src/components/TabsLayout/TabsLayoutRedirectTab.tsx +0 -26
package/bundle/bundle.umd.js
CHANGED
|
@@ -5711,29 +5711,48 @@
|
|
|
5711
5711
|
}, width: "24", height: "24" })) : null, jsxs("div", { className: "border-0", children: [tab?.title ? jsx("div", { className: buttonClassNames.title, children: tab.title }) : null, tab?.description ? jsx("div", { className: buttonClassNames.desc, children: tab.description }) : null] })] }));
|
|
5712
5712
|
});
|
|
5713
5713
|
|
|
5714
|
-
const REDIRECT_DELAY = 0.
|
|
5715
|
-
const
|
|
5714
|
+
const REDIRECT_DELAY = 0.8 * 1000;
|
|
5715
|
+
const TabsLayoutRedirectSection = JSX(({ tab }) => {
|
|
5716
5716
|
const link = useLink();
|
|
5717
|
-
|
|
5718
|
-
|
|
5719
|
-
onClick()
|
|
5720
|
-
|
|
5717
|
+
const { onClick } = link({
|
|
5718
|
+
...tab,
|
|
5719
|
+
onClick: () => {
|
|
5720
|
+
/**
|
|
5721
|
+
* In the current implementation of useLink, there is no follow-by-link method,
|
|
5722
|
+
* and default routing won't work if the link is external.
|
|
5723
|
+
*/
|
|
5724
|
+
if (tab.href && !isLocalURL(tab.href)) {
|
|
5725
|
+
globalThis.location.href = tab.href;
|
|
5726
|
+
}
|
|
5727
|
+
},
|
|
5728
|
+
});
|
|
5729
|
+
useDebouncedEffect(onClick, [], REDIRECT_DELAY);
|
|
5721
5730
|
return jsx(Shimmer, { className: "col-span-12 p-xl", size: 5 });
|
|
5722
5731
|
});
|
|
5723
5732
|
|
|
5733
|
+
const useScrollToTab = (activeTabIndex, scroll) => {
|
|
5734
|
+
const [initState, { setTrue: setInitStateTrue }] = useBool(false);
|
|
5735
|
+
useEffect(() => {
|
|
5736
|
+
scroll.scrollTo(activeTabIndex, {
|
|
5737
|
+
behavior: initState ? 'smooth' : 'auto',
|
|
5738
|
+
block: 'nearest',
|
|
5739
|
+
inline: 'center',
|
|
5740
|
+
});
|
|
5741
|
+
!initState && setInitStateTrue();
|
|
5742
|
+
}, [activeTabIndex, initState]);
|
|
5743
|
+
};
|
|
5744
|
+
|
|
5724
5745
|
const TabsLayout = JSX(({ className = '', tabs = [], block, tabAlign, ...rest }) => {
|
|
5725
5746
|
const [activeTabIndex, setActiveTabIndex] = useState(getInitSelectedIndex(tabs));
|
|
5726
5747
|
const slotName = getSlotName(tabs[activeTabIndex], activeTabIndex);
|
|
5727
5748
|
const itemCount = tabs.length;
|
|
5728
5749
|
const [activeSlideIndex, { inc: incActiveSlideIndex, dec: decActiveSlideIndex }] = useCarouselControls({ itemCount }, activeTabIndex);
|
|
5729
5750
|
const [containerRef, scroll] = useSwipeListScroll({ itemCount });
|
|
5730
|
-
|
|
5731
|
-
|
|
5732
|
-
}, []);
|
|
5733
|
-
return (jsxs(BlockWrapper, { className: style(className), defaultPadding: "p-0", ...rest, children: [jsxs("div", { className: "relative border-b-8 border-primary-main", children: [jsx(SwipeListContainer, { itemClassName: "flex", containerRef: containerRef, snapAlign: "snap-end", gap: 8, onVisibleIndicesChange: scroll.handleVisibleIndicesChange, children: tabs.map(renderTabButton(activeTabIndex, setActiveTabIndex, tabAlign)) }), jsx(CarouselScrollButtons, { scroll: scroll, arrowsPadded: true, onScrollLeft: decActiveSlideIndex, onScrollRight: incActiveSlideIndex, activeIndex: activeSlideIndex, itemCount: itemCount })] }), jsx("div", { className: "space-y-px @5xl:space-y-0 @5xl:grid @5xl:grid-cols-12 @5xl:gap-2xs", children: tabs[activeTabIndex]?.href ? (jsx(TabsLayoutRedirectTab, { tab: tabs[activeTabIndex] })) : (renderBlocksList(block?.slots?.[slotName], { ...rest?.options, slotName })) })] }));
|
|
5751
|
+
useScrollToTab(activeTabIndex, scroll);
|
|
5752
|
+
return (jsxs(BlockWrapper, { className: style(className), defaultPadding: "p-0", ...rest, children: [jsxs("div", { className: "relative border-b-8 border-primary-main", children: [jsx(SwipeListContainer, { itemClassName: "flex", containerRef: containerRef, snapAlign: "snap-end", gap: 8, onVisibleIndicesChange: scroll.handleVisibleIndicesChange, children: tabs.map(renderTabButton(activeTabIndex, setActiveTabIndex, tabAlign)) }), jsx(CarouselScrollButtons, { scroll: scroll, arrowsPadded: true, onScrollLeft: decActiveSlideIndex, onScrollRight: incActiveSlideIndex, activeIndex: activeSlideIndex, itemCount: itemCount })] }), jsx("div", { className: "space-y-px @5xl:space-y-0 @5xl:grid @5xl:grid-cols-12 @5xl:gap-2xs", children: tabs[activeTabIndex]?.href ? (jsx(TabsLayoutRedirectSection, { tab: tabs[activeTabIndex] })) : (renderBlocksList(block?.slots?.[slotName], { ...rest?.options, slotName })) })] }));
|
|
5734
5753
|
});
|
|
5735
5754
|
TabsLayout.slots = ({ tabs }) => tabs?.filter((_) => !_.href).map(getSlotName) || [];
|
|
5736
|
-
TabsLayout.childrenTypes = { exclude: ['TabsLayout'] };
|
|
5755
|
+
TabsLayout.childrenTypes = { exclude: ['TabsLayout'] }; //TODO: fix this on wcms
|
|
5737
5756
|
const getSlotName = (tab, index) => tab?.title || `Слот №${index}`;
|
|
5738
5757
|
const getInitSelectedIndex = (tabs) => tabs.reduce((selectedIndex, tab, i) => (tab.selected ? i : selectedIndex), 0);
|
|
5739
5758
|
const renderTabButton = (activeTabIndex, onClick, tabAlign = 'start') => (tab, i) => (jsx(TabsLayoutButton, { className: alignTabStyle[tabAlign], tab: tab, isActive: activeTabIndex === i, onClick: () => onClick(i) }, String(i)));
|
|
@@ -6172,7 +6191,7 @@
|
|
|
6172
6191
|
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" }) }));
|
|
6173
6192
|
}
|
|
6174
6193
|
|
|
6175
|
-
const packageVersion = "0.14.
|
|
6194
|
+
const packageVersion = "0.14.152";
|
|
6176
6195
|
|
|
6177
6196
|
exports.Blocks = Blocks;
|
|
6178
6197
|
exports.ContentPage = ContentPage;
|