@redneckz/wildless-cms-uni-blocks 0.8.1 → 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.
- package/bundle/bundle.umd.js +9 -7
- package/bundle/bundle.umd.min.js +1 -1
- package/dist/components/Tabs/Tabs.js +1 -1
- package/dist/components/Tabs/Tabs.js.map +1 -1
- package/dist/ui-kit/SwipeListControl/SwipeListContainer.js +7 -5
- package/dist/ui-kit/SwipeListControl/SwipeListContainer.js.map +1 -1
- package/lib/components/Tabs/Tabs.js +1 -1
- package/lib/components/Tabs/Tabs.js.map +1 -1
- package/lib/ui-kit/SwipeListControl/SwipeListContainer.js +7 -5
- package/lib/ui-kit/SwipeListControl/SwipeListContainer.js.map +1 -1
- package/mobile/bundle/bundle.umd.js +8 -6
- package/mobile/bundle/bundle.umd.min.js +1 -1
- package/mobile/dist/components/Tabs/Tabs.js +1 -1
- package/mobile/dist/components/Tabs/Tabs.js.map +1 -1
- package/mobile/dist/ui-kit/SwipeListControl/SwipeListContainer.js +7 -5
- package/mobile/dist/ui-kit/SwipeListControl/SwipeListContainer.js.map +1 -1
- package/mobile/lib/components/Tabs/Tabs.js +1 -1
- package/mobile/lib/components/Tabs/Tabs.js.map +1 -1
- package/mobile/lib/ui-kit/SwipeListControl/SwipeListContainer.js +7 -5
- package/mobile/lib/ui-kit/SwipeListControl/SwipeListContainer.js.map +1 -1
- package/mobile/src/components/Tabs/Tabs.tsx +2 -2
- package/mobile/src/ui-kit/SwipeListControl/SwipeListContainer.tsx +9 -6
- package/package.json +1 -1
- package/src/components/Tabs/Tabs.tsx +2 -2
- package/src/ui-kit/SwipeListControl/SwipeListContainer.tsx +9 -6
|
@@ -5,6 +5,7 @@ import { mapChildren } from '../../utils/mapChildren.js';
|
|
|
5
5
|
import { style } from '../../utils/style.js';
|
|
6
6
|
import { SwipeListItem } from './SwipeListItem.js';
|
|
7
7
|
const childStyleMap = ['min-w-[100%]', 'min-w-[50%]', 'min-w-[33.33%]', 'min-w-[25%]'];
|
|
8
|
+
const DEFAULT_HEIGHT = '866px';
|
|
8
9
|
export const SwipeListContainer = JSX(({ className = '', containerRef, activeIndex, visibleItemCount = 0, gap = 0, padding = 0, listType = 'horizontal-list', snapAlign = 'snap-center', children, onVisibleItemsChange, onVisibleIndicesChange, }) => {
|
|
9
10
|
const observerOptions = {
|
|
10
11
|
sensitivity: 1,
|
|
@@ -23,10 +24,14 @@ export const SwipeListContainer = JSX(({ className = '', containerRef, activeInd
|
|
|
23
24
|
const isHorizontalList = listType === 'horizontal-list';
|
|
24
25
|
const containerStyle = {
|
|
25
26
|
...(isHorizontalList ? getContainerOffset(padding, additionPadding) : {}),
|
|
26
|
-
...(isVerticalList ?
|
|
27
|
+
...(isVerticalList ? { height: DEFAULT_HEIGHT } : {}),
|
|
27
28
|
gap: `${gap}px`,
|
|
28
29
|
};
|
|
29
|
-
|
|
30
|
+
const itemContainerStyle = {
|
|
31
|
+
...(isHorizontalList ? getContainerOffset(padding / 4) : {}),
|
|
32
|
+
maxHeight: DEFAULT_HEIGHT,
|
|
33
|
+
};
|
|
34
|
+
return (_jsx("div", { className: style('box-border overflow-auto no-scrollbar', listType, className), style: containerStyle, role: "list", ref: containerRef, children: mapChildren((child, idx) => (_jsx(SwipeListItem, { className: style(snapAlign, visibleItemCount ? childStyleMap[visibleItemCount - 1] : '', isVerticalList ? 'h-full' : ''), style: itemContainerStyle, activeIndex: activeIndex, idx: idx, observerOptions: observerOptions, onIntersection: handleIntersection, children: child }, String(idx))))(children) }));
|
|
30
35
|
});
|
|
31
36
|
// Styles used to compensate outer container padding to get rid of clipping effect
|
|
32
37
|
const getContainerOffset = (padding, additionalPadding = 0) => ({
|
|
@@ -39,7 +44,4 @@ const getVisibleIndices = (itemsVisibilityList) => itemsVisibilityList
|
|
|
39
44
|
.map((_, i) => [_, i])
|
|
40
45
|
.filter(([_]) => _ && _.intersectionRatio >= 0.9)
|
|
41
46
|
.map(([, i]) => i);
|
|
42
|
-
const getContainerHeight = (ref) => ({
|
|
43
|
-
height: ref?.current?.firstElementChild?.clientHeight || 0,
|
|
44
|
-
});
|
|
45
47
|
//# sourceMappingURL=SwipeListContainer.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SwipeListContainer.js","sourceRoot":"","sources":["../../../src/ui-kit/SwipeListControl/SwipeListContainer.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AACxC,OAAO,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,6BAA6B,CAAC;AAElE,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AACtD,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAG1C,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAoBhD,MAAM,aAAa,GAAG,CAAC,cAAc,EAAE,aAAa,EAAE,gBAAgB,EAAE,aAAa,CAAC,CAAC;AAEvF,MAAM,CAAC,MAAM,kBAAkB,GAAG,GAAG,CACnC,CAAC,EACC,SAAS,GAAG,EAAE,EACd,YAAY,EACZ,WAAW,EACX,gBAAgB,GAAG,CAAC,EACpB,GAAG,GAAG,CAAC,EACP,OAAO,GAAG,CAAC,EACX,QAAQ,GAAG,iBAAiB,EAC5B,SAAS,GAAG,aAAa,EACzB,QAAQ,EACR,oBAAoB,EACpB,sBAAsB,GACvB,EAAE,EAAE;IACH,MAAM,eAAe,GAAgC;QACnD,WAAW,EAAE,CAAC;QACd,OAAO,EAAE,YAAY;KACtB,CAAC;IAEF,MAAM,sBAAsB,GAAG,MAAM,CAAsB,EAAE,CAAC,CAAC;IAC/D,MAAM,kBAAkB,GAAG,WAAW,CACpC,CAAC,GAAW,EAAE,KAAgC,EAAE,EAAE;QAChD,MAAM,mBAAmB,GAAG,CAAC,GAAG,CAAC,sBAAsB,CAAC,OAAO,IAAI,EAAE,CAAC,CAAC,CAAC;QACxE,mBAAmB,CAAC,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,GAAG,OAAO,IAAI;IAC3B,YAAY,EAAE,GAAG,OAAO,GAAG,iBAAiB,IAAI;CACjD,CAAC,CAAC;AAEH,MAAM,iBAAiB,GAAG,CAAC,mBAAwC,EAAE,EAAE,CACrE,mBAAmB;KAChB,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,EAAmD,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;KACtE,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,iBAAiB,IAAI,GAAG,CAAC;KAChD,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC"}
|
|
@@ -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
|
);
|
|
@@ -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 ?
|
|
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={
|
|
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
|
@@ -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
|
);
|
|
@@ -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 ?
|
|
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={
|
|
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
|
-
});
|