@redneckz/wildless-cms-uni-blocks 0.8.0 → 0.8.2

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 (35) hide show
  1. package/bundle/bundle.umd.js +21 -23
  2. package/bundle/bundle.umd.min.js +1 -1
  3. package/dist/components/Tabs/Tabs.js +1 -1
  4. package/dist/components/Tabs/Tabs.js.map +1 -1
  5. package/dist/hooks/useLink.js +8 -13
  6. package/dist/hooks/useLink.js.map +1 -1
  7. package/dist/ui-kit/SwipeListControl/SwipeListContainer.js +7 -5
  8. package/dist/ui-kit/SwipeListControl/SwipeListContainer.js.map +1 -1
  9. package/lib/components/Tabs/Tabs.js +1 -1
  10. package/lib/components/Tabs/Tabs.js.map +1 -1
  11. package/lib/hooks/useLink.js +8 -13
  12. package/lib/hooks/useLink.js.map +1 -1
  13. package/lib/ui-kit/SwipeListControl/SwipeListContainer.js +7 -5
  14. package/lib/ui-kit/SwipeListControl/SwipeListContainer.js.map +1 -1
  15. package/mobile/bundle/bundle.umd.js +20 -22
  16. package/mobile/bundle/bundle.umd.min.js +1 -1
  17. package/mobile/dist/components/Tabs/Tabs.js +1 -1
  18. package/mobile/dist/components/Tabs/Tabs.js.map +1 -1
  19. package/mobile/dist/hooks/useLink.js +8 -13
  20. package/mobile/dist/hooks/useLink.js.map +1 -1
  21. package/mobile/dist/ui-kit/SwipeListControl/SwipeListContainer.js +7 -5
  22. package/mobile/dist/ui-kit/SwipeListControl/SwipeListContainer.js.map +1 -1
  23. package/mobile/lib/components/Tabs/Tabs.js +1 -1
  24. package/mobile/lib/components/Tabs/Tabs.js.map +1 -1
  25. package/mobile/lib/hooks/useLink.js +8 -13
  26. package/mobile/lib/hooks/useLink.js.map +1 -1
  27. package/mobile/lib/ui-kit/SwipeListControl/SwipeListContainer.js +7 -5
  28. package/mobile/lib/ui-kit/SwipeListControl/SwipeListContainer.js.map +1 -1
  29. package/mobile/src/components/Tabs/Tabs.tsx +2 -2
  30. package/mobile/src/hooks/useLink.ts +8 -14
  31. package/mobile/src/ui-kit/SwipeListControl/SwipeListContainer.tsx +9 -6
  32. package/package.json +1 -1
  33. package/src/components/Tabs/Tabs.tsx +2 -2
  34. package/src/hooks/useLink.ts +8 -14
  35. package/src/ui-kit/SwipeListControl/SwipeListContainer.tsx +9 -6
@@ -27,6 +27,8 @@ interface SwipeListContainerProps extends SwipeContainerProps {
27
27
 
28
28
  const childStyleMap = ['min-w-[100%]', 'min-w-[50%]', 'min-w-[33.33%]', 'min-w-[25%]'];
29
29
 
30
+ const DEFAULT_HEIGHT = '866px';
31
+
30
32
  export const SwipeListContainer = JSX<SwipeListContainerProps>(
31
33
  ({
32
34
  className = '',
@@ -65,9 +67,13 @@ export const SwipeListContainer = JSX<SwipeListContainerProps>(
65
67
  const isHorizontalList = listType === 'horizontal-list';
66
68
  const containerStyle = {
67
69
  ...(isHorizontalList ? getContainerOffset(padding, additionPadding) : {}),
68
- ...(isVerticalList ? getContainerHeight(containerRef) : {}),
70
+ ...(isVerticalList ? { height: DEFAULT_HEIGHT } : {}),
69
71
  gap: `${gap}px`,
70
72
  };
73
+ const itemContainerStyle = {
74
+ ...(isHorizontalList ? getContainerOffset(padding / 4) : {}),
75
+ maxHeight: DEFAULT_HEIGHT,
76
+ };
71
77
 
72
78
  return (
73
79
  <div
@@ -82,8 +88,9 @@ export const SwipeListContainer = JSX<SwipeListContainerProps>(
82
88
  className={style(
83
89
  snapAlign,
84
90
  visibleItemCount ? childStyleMap[visibleItemCount - 1] : '',
91
+ isVerticalList ? 'h-full' : '',
85
92
  )}
86
- style={isHorizontalList ? getContainerOffset(padding / 4) : {}}
93
+ style={itemContainerStyle}
87
94
  activeIndex={activeIndex}
88
95
  idx={idx}
89
96
  observerOptions={observerOptions}
@@ -110,7 +117,3 @@ const getVisibleIndices = (itemsVisibilityList: ItemsVisibilityList) =>
110
117
  .map((_, i): [IntersectionObserverEntry | undefined, number] => [_, i])
111
118
  .filter(([_]) => _ && _.intersectionRatio >= 0.9)
112
119
  .map(([, i]) => i);
113
-
114
- const getContainerHeight = (ref?: { current: HTMLDivElement | null }) => ({
115
- height: ref?.current?.firstElementChild?.clientHeight || 0,
116
- });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@redneckz/wildless-cms-uni-blocks",
3
- "version": "0.8.0",
3
+ "version": "0.8.2",
4
4
  "private": false,
5
5
  "license": "MIT",
6
6
  "author": "ЦК",
@@ -2,10 +2,10 @@ import { JSX } from '@redneckz/uni-jsx';
2
2
  import { useCallback, useEffect, useState } from '@redneckz/uni-jsx/lib/hooks';
3
3
  import { EventBus } from '../../EventBus/EventBus';
4
4
  import type { UniBlockProps } from '../../model/JSXBlock';
5
- import type { TabData, TabsContent } from './TabsContent';
6
5
  import { BlockWrapper } from '../../ui-kit/BlockWrapper';
7
6
  import { renderTab } from './renderTab';
8
7
  import { ScrollableTabs } from './ScrollableTabs';
8
+ import type { TabData, TabsContent } from './TabsContent';
9
9
 
10
10
  export interface TabActivationEvent {
11
11
  type?: TabData['type'];
@@ -35,7 +35,7 @@ export const Tabs = JSX<TabsBlockProps>((props) => {
35
35
  useEffect(
36
36
  () =>
37
37
  currentTab?.type === 'group'
38
- ? EventBus.inst.subject('tab', { label: currentTab.ref })
38
+ ? EventBus.inst.subject('tab', { type: currentTab.type, label: currentTab.ref })
39
39
  : undefined,
40
40
  [currentTab],
41
41
  );
@@ -1,6 +1,5 @@
1
1
  import type { LinkProps, Target } from '../model/LinkProps';
2
2
  import { useBlockRouter } from '../services/BlockRouter/useBlockRouter';
3
- import { adjustHref } from '../utils/adjustHref';
4
3
  import { isHash, isLocalURL } from '../utils/url';
5
4
  import { handlerDecorator } from './handlerDecorator';
6
5
  import { useRouter } from './useRouter';
@@ -31,18 +30,13 @@ export function useLink(): <L extends Partial<LinkProps & ClickHandler>>(
31
30
  }
32
31
  };
33
32
 
34
- return (props) => {
35
- const href = adjustHref(props.href);
33
+ return (props) => ({
34
+ ...props,
35
+ 'aria-label': props.text,
36
+ onClick: handlerDecorator((ev?: { preventDefault: () => void }) => {
37
+ props.onClick && props.onClick(ev);
36
38
 
37
- return {
38
- ...props,
39
- href,
40
- 'aria-label': props.text,
41
- onClick: handlerDecorator((ev?: { preventDefault: () => void }) => {
42
- props.onClick && props.onClick(ev);
43
-
44
- handleLocalURL(href, props.target)(ev);
45
- }, props),
46
- };
47
- };
39
+ handleLocalURL(props.href, props.target)(ev);
40
+ }, props),
41
+ });
48
42
  }
@@ -27,6 +27,8 @@ interface SwipeListContainerProps extends SwipeContainerProps {
27
27
 
28
28
  const childStyleMap = ['min-w-[100%]', 'min-w-[50%]', 'min-w-[33.33%]', 'min-w-[25%]'];
29
29
 
30
+ const DEFAULT_HEIGHT = '866px';
31
+
30
32
  export const SwipeListContainer = JSX<SwipeListContainerProps>(
31
33
  ({
32
34
  className = '',
@@ -65,9 +67,13 @@ export const SwipeListContainer = JSX<SwipeListContainerProps>(
65
67
  const isHorizontalList = listType === 'horizontal-list';
66
68
  const containerStyle = {
67
69
  ...(isHorizontalList ? getContainerOffset(padding, additionPadding) : {}),
68
- ...(isVerticalList ? getContainerHeight(containerRef) : {}),
70
+ ...(isVerticalList ? { height: DEFAULT_HEIGHT } : {}),
69
71
  gap: `${gap}px`,
70
72
  };
73
+ const itemContainerStyle = {
74
+ ...(isHorizontalList ? getContainerOffset(padding / 4) : {}),
75
+ maxHeight: DEFAULT_HEIGHT,
76
+ };
71
77
 
72
78
  return (
73
79
  <div
@@ -82,8 +88,9 @@ export const SwipeListContainer = JSX<SwipeListContainerProps>(
82
88
  className={style(
83
89
  snapAlign,
84
90
  visibleItemCount ? childStyleMap[visibleItemCount - 1] : '',
91
+ isVerticalList ? 'h-full' : '',
85
92
  )}
86
- style={isHorizontalList ? getContainerOffset(padding / 4) : {}}
93
+ style={itemContainerStyle}
87
94
  activeIndex={activeIndex}
88
95
  idx={idx}
89
96
  observerOptions={observerOptions}
@@ -110,7 +117,3 @@ const getVisibleIndices = (itemsVisibilityList: ItemsVisibilityList) =>
110
117
  .map((_, i): [IntersectionObserverEntry | undefined, number] => [_, i])
111
118
  .filter(([_]) => _ && _.intersectionRatio >= 0.9)
112
119
  .map(([, i]) => i);
113
-
114
- const getContainerHeight = (ref?: { current: HTMLDivElement | null }) => ({
115
- height: ref?.current?.firstElementChild?.clientHeight || 0,
116
- });