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

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,14 @@
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' &&
371
+ event.label &&
372
+ block?.labels?.length &&
373
+ !block.labels.includes(event.label)));
378
374
  }), [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;
375
+ 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
376
  });
381
377
 
382
378
  const styles$4 = {
@@ -4108,16 +4104,11 @@
4108
4104
  const Tabs = JSX((props) => {
4109
4105
  const { className = '', tabs, showCounter, isSticky, tabsMode, ...rest } = props;
4110
4106
  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);
4107
+ useEffect(() => {
4108
+ if (currentTab?.type === 'group') {
4109
+ defaultEventBus.subject('tab', { type: currentTab.type, label: currentTab.ref });
4115
4110
  }
4116
- return [];
4117
- }), [tabs]);
4118
- useEffect(() => currentTab?.type === 'group'
4119
- ? defaultEventBus.subject('tab', { type: currentTab.type, label: currentTab.ref })
4120
- : undefined, [currentTab]);
4111
+ }, [currentTab]);
4121
4112
  const handleClick = useCallback((selectedTab) => {
4122
4113
  if (selectedTab?.type === 'group') {
4123
4114
  defaultEventBus.fire('tab', { type: selectedTab.type, label: selectedTab.ref });
@@ -4131,7 +4122,6 @@
4131
4122
  ...rest,
4132
4123
  }))) }));
4133
4124
  });
4134
- const checkTab = (event) => (_) => _.type === 'link' && _.href === `#${event.label}`;
4135
4125
 
4136
4126
  const DIVIDER_CLASSES = 'border-main-divider border border-t-0 border-x-0';
4137
4127
  const FIRST_CELL_CLASSES = 'w-[354px] flex-shrink-0';
@@ -4541,7 +4531,7 @@
4541
4531
  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
4532
  }
4543
4533
 
4544
- const packageVersion = "0.8.12";
4534
+ const packageVersion = "0.8.14";
4545
4535
 
4546
4536
  exports.Blocks = Blocks;
4547
4537
  exports.ContentPage = ContentPage;