@redneckz/wildless-cms-uni-blocks 0.8.12 → 0.8.13

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.
@@ -365,18 +365,11 @@
365
365
  const BlockWrapper = JSX(({ className = '', version = 'primary', block, tag = 'section', role, children }) => {
366
366
  const Tag = tag;
367
367
  const ref = useBlockIntersectionObserver(block);
368
- const [isVisible, setVisible] = useState(true);
368
+ const [isHidden, setHidden] = useState(false);
369
369
  useEffect(() => defaultEventBus.subscribe('tab', (event) => {
370
- if (event.type === 'group') {
371
- setVisible(!block?.labels?.length ||
372
- !event.label ||
373
- Boolean(block?.labels?.includes(event.label)));
374
- }
375
- else {
376
- setVisible(true);
377
- }
370
+ setHidden(Boolean(event.type === 'group' && event.label && block?.labels?.includes(event.label)));
378
371
  }), [block]);
379
- return isVisible ? (jsx(Tag, { className: style('group', blockStyles[version], className), ...(version ? { 'data-ver': version } : {}), ...(block?.anchor ? { id: block.anchor, ref } : {}), role: role, children: children })) : null;
372
+ return (jsx(Tag, { className: style('group', blockStyles[version], isHidden ? 'hidden' : '', className), ...(version ? { 'data-ver': version } : {}), ...(block?.anchor ? { id: block.anchor, ref } : {}), role: role, children: children }));
380
373
  });
381
374
 
382
375
  const styles$4 = {
@@ -4108,16 +4101,11 @@
4108
4101
  const Tabs = JSX((props) => {
4109
4102
  const { className = '', tabs, showCounter, isSticky, tabsMode, ...rest } = props;
4110
4103
  const [currentTab, setCurrentTab] = useState(tabs ? tabs[0] : undefined);
4111
- useEffect(() => defaultEventBus.subscribe('tab', (event) => {
4112
- const tab = tabs?.find(checkTab(event));
4113
- if (event.type === 'link' && tab) {
4114
- setCurrentTab(tab);
4104
+ useEffect(() => {
4105
+ if (currentTab?.type === 'group') {
4106
+ defaultEventBus.subject('tab', { type: currentTab.type, label: currentTab.ref });
4115
4107
  }
4116
- return [];
4117
- }), [tabs]);
4118
- useEffect(() => currentTab?.type === 'group'
4119
- ? defaultEventBus.subject('tab', { type: currentTab.type, label: currentTab.ref })
4120
- : undefined, [currentTab]);
4108
+ }, [currentTab]);
4121
4109
  const handleClick = useCallback((selectedTab) => {
4122
4110
  if (selectedTab?.type === 'group') {
4123
4111
  defaultEventBus.fire('tab', { type: selectedTab.type, label: selectedTab.ref });
@@ -4131,7 +4119,6 @@
4131
4119
  ...rest,
4132
4120
  }))) }));
4133
4121
  });
4134
- const checkTab = (event) => (_) => _.type === 'link' && _.href === `#${event.label}`;
4135
4122
 
4136
4123
  const DIVIDER_CLASSES = 'border-main-divider border border-t-0 border-x-0';
4137
4124
  const FIRST_CELL_CLASSES = 'w-[354px] flex-shrink-0';
@@ -4541,7 +4528,7 @@
4541
4528
  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" }) }));
4542
4529
  }
4543
4530
 
4544
- const packageVersion = "0.8.12";
4531
+ const packageVersion = "0.8.13";
4545
4532
 
4546
4533
  exports.Blocks = Blocks;
4547
4534
  exports.ContentPage = ContentPage;