@redneckz/wildless-cms-uni-blocks 0.14.244 → 0.14.246
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/EventBus/defaultEventBus.d.ts +2 -0
- package/bundle/bundle.umd.js +14 -4
- package/bundle/bundle.umd.min.js +1 -1
- package/bundle/components/CarouselTariffsCard/CarouselTariffsCardAction.d.ts +6 -0
- package/dist/EventBus/defaultEventBus.d.ts +2 -0
- package/dist/EventBus/defaultEventBus.js.map +1 -1
- package/dist/components/CarouselTariffsCard/CarouselTariffsCard.js +15 -3
- package/dist/components/CarouselTariffsCard/CarouselTariffsCard.js.map +1 -1
- package/dist/components/CarouselTariffsCard/CarouselTariffsCardAction.d.ts +6 -0
- package/dist/components/CarouselTariffsCard/CarouselTariffsCardAction.js +2 -0
- package/dist/components/CarouselTariffsCard/CarouselTariffsCardAction.js.map +1 -0
- package/dist/components/Footer/Footer.mobile.js +1 -7
- package/dist/components/Footer/Footer.mobile.js.map +1 -1
- package/lib/EventBus/defaultEventBus.d.ts +2 -0
- package/lib/EventBus/defaultEventBus.js.map +1 -1
- package/lib/components/CarouselTariffsCard/CarouselTariffsCard.js +15 -3
- package/lib/components/CarouselTariffsCard/CarouselTariffsCard.js.map +1 -1
- package/lib/components/CarouselTariffsCard/CarouselTariffsCardAction.d.ts +6 -0
- package/lib/components/CarouselTariffsCard/CarouselTariffsCardAction.js +2 -0
- package/lib/components/CarouselTariffsCard/CarouselTariffsCardAction.js.map +1 -0
- package/lib/components/Footer/Footer.mobile.js +1 -7
- package/lib/components/Footer/Footer.mobile.js.map +1 -1
- package/mobile/bundle/EventBus/defaultEventBus.d.ts +2 -0
- package/mobile/bundle/bundle.umd.js +17 -11
- package/mobile/bundle/bundle.umd.min.js +1 -1
- package/mobile/bundle/components/CarouselTariffsCard/CarouselTariffsCardAction.d.ts +6 -0
- package/mobile/dist/EventBus/defaultEventBus.d.ts +2 -0
- package/mobile/dist/EventBus/defaultEventBus.js.map +1 -1
- package/mobile/dist/components/CarouselTariffsCard/CarouselTariffsCard.js +15 -3
- package/mobile/dist/components/CarouselTariffsCard/CarouselTariffsCard.js.map +1 -1
- package/mobile/dist/components/CarouselTariffsCard/CarouselTariffsCardAction.d.ts +6 -0
- package/mobile/dist/components/CarouselTariffsCard/CarouselTariffsCardAction.js +2 -0
- package/mobile/dist/components/CarouselTariffsCard/CarouselTariffsCardAction.js.map +1 -0
- package/mobile/dist/components/Footer/Footer.js +1 -7
- package/mobile/dist/components/Footer/Footer.js.map +1 -1
- package/mobile/lib/EventBus/defaultEventBus.d.ts +2 -0
- package/mobile/lib/EventBus/defaultEventBus.js.map +1 -1
- package/mobile/lib/common.css +1 -1
- package/mobile/lib/components/CarouselTariffsCard/CarouselTariffsCard.js +15 -3
- package/mobile/lib/components/CarouselTariffsCard/CarouselTariffsCard.js.map +1 -1
- package/mobile/lib/components/CarouselTariffsCard/CarouselTariffsCardAction.d.ts +6 -0
- package/mobile/lib/components/CarouselTariffsCard/CarouselTariffsCardAction.js +2 -0
- package/mobile/lib/components/CarouselTariffsCard/CarouselTariffsCardAction.js.map +1 -0
- package/mobile/lib/components/Footer/Footer.js +1 -7
- package/mobile/lib/components/Footer/Footer.js.map +1 -1
- package/mobile/src/EventBus/defaultEventBus.ts +2 -0
- package/mobile/src/components/CarouselTariffsCard/CarouselTariffsCard.tsx +40 -19
- package/mobile/src/components/CarouselTariffsCard/CarouselTariffsCardAction.ts +6 -0
- package/mobile/src/components/Footer/Footer.tsx +6 -19
- package/package.json +1 -1
- package/src/EventBus/defaultEventBus.ts +2 -0
- package/src/components/CarouselTariffsCard/CarouselTariffsCard.tsx +40 -19
- package/src/components/CarouselTariffsCard/CarouselTariffsCardAction.ts +6 -0
- package/src/components/Footer/Footer.mobile.tsx +6 -19
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { JSX } from '@redneckz/uni-jsx';
|
|
2
|
+
import { useEffect, useState } from '@redneckz/uni-jsx/lib/hooks';
|
|
3
|
+
import { defaultEventBus } from '../../EventBus/defaultEventBus';
|
|
4
|
+
import { type Slot } from '../../model/ContentPageDef';
|
|
2
5
|
import { type VNode } from '../../model/VNode';
|
|
3
6
|
import { BlockWrapper } from '../../ui-kit/BlockWrapper';
|
|
4
7
|
import { Foldable } from '../../ui-kit/Foldable/Foldable';
|
|
5
|
-
import { type FoldablePartProps } from '../../ui-kit/Foldable/FoldablePartProps';
|
|
6
8
|
import { FoldableSection } from '../../ui-kit/Foldable/FoldableSection';
|
|
7
9
|
import { Heading } from '../../ui-kit/Heading/Heading';
|
|
8
10
|
import { Icon } from '../../ui-kit/Icon/Icon';
|
|
@@ -27,6 +29,7 @@ export const CarouselTariffsCard = JSX<CarouselTariffsCardProps>(
|
|
|
27
29
|
button,
|
|
28
30
|
visibleCellsCount = 1,
|
|
29
31
|
cardCells = [],
|
|
32
|
+
options,
|
|
30
33
|
...rest
|
|
31
34
|
}) => {
|
|
32
35
|
const cellsNode = cardCells.map(renderCardInfo);
|
|
@@ -35,6 +38,17 @@ export const CarouselTariffsCard = JSX<CarouselTariffsCardProps>(
|
|
|
35
38
|
visibleCellsCount > 0
|
|
36
39
|
? [cellsNode.slice(0, visibleCellsCount), cellsNode.slice(visibleCellsCount)]
|
|
37
40
|
: [cellsNode, []];
|
|
41
|
+
const [isVisible, setIsVisible] = useState(false);
|
|
42
|
+
|
|
43
|
+
useEffect(
|
|
44
|
+
() =>
|
|
45
|
+
defaultEventBus.subscribe('fold', (event) => {
|
|
46
|
+
if (options?.parent !== undefined && event.parent === options?.parent) {
|
|
47
|
+
setIsVisible(event.isUnfolded);
|
|
48
|
+
}
|
|
49
|
+
}),
|
|
50
|
+
[],
|
|
51
|
+
);
|
|
38
52
|
|
|
39
53
|
return (
|
|
40
54
|
<BlockWrapper className={style('flex flex-col', className)} defaultPadding="p-2xl" {...rest}>
|
|
@@ -49,13 +63,15 @@ export const CarouselTariffsCard = JSX<CarouselTariffsCardProps>(
|
|
|
49
63
|
{button?.text ? <LinkButton className="w-full mt-m mb-lg" {...button} /> : null}
|
|
50
64
|
{hiddenCells.length ? (
|
|
51
65
|
<Foldable
|
|
52
|
-
renderFoldableSection={(
|
|
66
|
+
renderFoldableSection={() => (
|
|
53
67
|
<div>
|
|
54
68
|
{visibleCells}
|
|
55
|
-
<FoldableSection isUnfolded={
|
|
69
|
+
<FoldableSection isUnfolded={isVisible}>{hiddenCells}</FoldableSection>
|
|
56
70
|
</div>
|
|
57
71
|
)}
|
|
58
|
-
renderFoldButton={
|
|
72
|
+
renderFoldButton={
|
|
73
|
+
cardCells.length > 1 ? renderFoldButton(isVisible, options?.parent) : null
|
|
74
|
+
}
|
|
59
75
|
/>
|
|
60
76
|
) : (
|
|
61
77
|
<div>{visibleCells}</div>
|
|
@@ -65,18 +81,23 @@ export const CarouselTariffsCard = JSX<CarouselTariffsCardProps>(
|
|
|
65
81
|
},
|
|
66
82
|
);
|
|
67
83
|
|
|
68
|
-
const renderFoldButton = (
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
84
|
+
const renderFoldButton = (isUnfolded?: boolean, parent?: Slot) => (): VNode =>
|
|
85
|
+
(
|
|
86
|
+
<button
|
|
87
|
+
className="w-full cursor-pointer text-primary-main pt-lg flex justify-between items-center"
|
|
88
|
+
onClick={() => {
|
|
89
|
+
if (parent !== undefined) {
|
|
90
|
+
defaultEventBus.fire('fold', { type: 'fold', isUnfolded: !isUnfolded, parent });
|
|
91
|
+
}
|
|
92
|
+
}}
|
|
93
|
+
type="button"
|
|
94
|
+
>
|
|
95
|
+
<div>{isUnfolded ? 'Скрыть' : 'Подробнее о тарифе'}</div>
|
|
96
|
+
<Icon
|
|
97
|
+
className="text-primary-text"
|
|
98
|
+
name={isUnfolded ? 'ArrowUpIcon' : 'ArrowDownIcon'}
|
|
99
|
+
width="16"
|
|
100
|
+
height="16"
|
|
101
|
+
/>
|
|
102
|
+
</button>
|
|
103
|
+
);
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import { useCallback } from '@redneckz/uni-jsx/lib/hooks';
|
|
2
2
|
import { type TopMenuItemProps } from '../../data/SitemapData';
|
|
3
|
-
import { type LinkProps } from '../../model/LinkProps';
|
|
4
3
|
import { BlockWrapper } from '../../ui-kit/BlockWrapper';
|
|
5
|
-
import { LinkButton } from '../../ui-kit/LinkButton/LinkButton';
|
|
6
4
|
import { Text } from '../../ui-kit/Text/Text';
|
|
7
5
|
import { UniBlock } from '../../UniBlock/UniBlock';
|
|
8
6
|
import { appendSlash } from '../../utils/appendSlash';
|
|
@@ -10,7 +8,6 @@ import { mapCookie } from '../../utils/mapCookie';
|
|
|
10
8
|
import { RollupItem } from '../RollupItem/RollupItem';
|
|
11
9
|
import { Contacts } from './Contacts';
|
|
12
10
|
import { COOKIE_REPLACE } from './cookieReplaceData';
|
|
13
|
-
import { findIconByHref } from './findIconByHref';
|
|
14
11
|
import { type FooterProps } from './FooterProps';
|
|
15
12
|
import { HorizontalNavigation } from './HorizontalNavigation';
|
|
16
13
|
import { HorizontalNavigationLink } from './HorizontalNavigationLink';
|
|
@@ -45,7 +42,12 @@ export const Footer = UniBlock<FooterProps>(({ className, footer, ...rest }) =>
|
|
|
45
42
|
Соцсети
|
|
46
43
|
</SocialMedia>
|
|
47
44
|
<div className="mb-xl">
|
|
48
|
-
<
|
|
45
|
+
<SocialMedia
|
|
46
|
+
className="mb-m"
|
|
47
|
+
media={mobileApps}
|
|
48
|
+
stretched={true}
|
|
49
|
+
showButtonText={false}
|
|
50
|
+
/>
|
|
49
51
|
<Text size="text-s" font="font-light" color="text-secondary-text">
|
|
50
52
|
Мобильное приложение
|
|
51
53
|
</Text>
|
|
@@ -83,18 +85,3 @@ const renderTopItems = (topItems: TopMenuItemProps[] | undefined) =>
|
|
|
83
85
|
<LinkList items={item.items} basePath={appendSlash(item.href)} />
|
|
84
86
|
</RollupItem>
|
|
85
87
|
));
|
|
86
|
-
|
|
87
|
-
const renderButton = ({ href = '/', text }: LinkProps, i: number) => {
|
|
88
|
-
const { label } = findIconByHref(href);
|
|
89
|
-
|
|
90
|
-
return (
|
|
91
|
-
<LinkButton
|
|
92
|
-
key={String(i)}
|
|
93
|
-
className="w-full"
|
|
94
|
-
text={text || label}
|
|
95
|
-
version="secondary"
|
|
96
|
-
href={href}
|
|
97
|
-
target="_blank"
|
|
98
|
-
/>
|
|
99
|
-
);
|
|
100
|
-
};
|
package/package.json
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { type CarouselTariffsCardAction } from '../components/CarouselTariffsCard/CarouselTariffsCardAction';
|
|
1
2
|
import { type TabActivationEvent } from '../components/Tabs/TabActivationEvent';
|
|
2
3
|
import { type Region } from '../hooks/useRegions';
|
|
3
4
|
import { type DialogAction } from '../ui-kit/DialogManager/DialogAction';
|
|
@@ -9,6 +10,7 @@ interface GlobalEventMap {
|
|
|
9
10
|
dialog: DialogAction;
|
|
10
11
|
popup: PopupAction;
|
|
11
12
|
tab: TabActivationEvent;
|
|
13
|
+
fold: CarouselTariffsCardAction;
|
|
12
14
|
}
|
|
13
15
|
|
|
14
16
|
export const defaultEventBus = new EventBus<GlobalEventMap>();
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { JSX } from '@redneckz/uni-jsx';
|
|
2
|
+
import { useEffect, useState } from '@redneckz/uni-jsx/lib/hooks';
|
|
3
|
+
import { defaultEventBus } from '../../EventBus/defaultEventBus';
|
|
4
|
+
import { type Slot } from '../../model/ContentPageDef';
|
|
2
5
|
import { type VNode } from '../../model/VNode';
|
|
3
6
|
import { BlockWrapper } from '../../ui-kit/BlockWrapper';
|
|
4
7
|
import { Foldable } from '../../ui-kit/Foldable/Foldable';
|
|
5
|
-
import { type FoldablePartProps } from '../../ui-kit/Foldable/FoldablePartProps';
|
|
6
8
|
import { FoldableSection } from '../../ui-kit/Foldable/FoldableSection';
|
|
7
9
|
import { Heading } from '../../ui-kit/Heading/Heading';
|
|
8
10
|
import { Icon } from '../../ui-kit/Icon/Icon';
|
|
@@ -27,6 +29,7 @@ export const CarouselTariffsCard = JSX<CarouselTariffsCardProps>(
|
|
|
27
29
|
button,
|
|
28
30
|
visibleCellsCount = 1,
|
|
29
31
|
cardCells = [],
|
|
32
|
+
options,
|
|
30
33
|
...rest
|
|
31
34
|
}) => {
|
|
32
35
|
const cellsNode = cardCells.map(renderCardInfo);
|
|
@@ -35,6 +38,17 @@ export const CarouselTariffsCard = JSX<CarouselTariffsCardProps>(
|
|
|
35
38
|
visibleCellsCount > 0
|
|
36
39
|
? [cellsNode.slice(0, visibleCellsCount), cellsNode.slice(visibleCellsCount)]
|
|
37
40
|
: [cellsNode, []];
|
|
41
|
+
const [isVisible, setIsVisible] = useState(false);
|
|
42
|
+
|
|
43
|
+
useEffect(
|
|
44
|
+
() =>
|
|
45
|
+
defaultEventBus.subscribe('fold', (event) => {
|
|
46
|
+
if (options?.parent !== undefined && event.parent === options?.parent) {
|
|
47
|
+
setIsVisible(event.isUnfolded);
|
|
48
|
+
}
|
|
49
|
+
}),
|
|
50
|
+
[],
|
|
51
|
+
);
|
|
38
52
|
|
|
39
53
|
return (
|
|
40
54
|
<BlockWrapper className={style('flex flex-col', className)} defaultPadding="p-2xl" {...rest}>
|
|
@@ -49,13 +63,15 @@ export const CarouselTariffsCard = JSX<CarouselTariffsCardProps>(
|
|
|
49
63
|
{button?.text ? <LinkButton className="w-full mt-m mb-lg" {...button} /> : null}
|
|
50
64
|
{hiddenCells.length ? (
|
|
51
65
|
<Foldable
|
|
52
|
-
renderFoldableSection={(
|
|
66
|
+
renderFoldableSection={() => (
|
|
53
67
|
<div>
|
|
54
68
|
{visibleCells}
|
|
55
|
-
<FoldableSection isUnfolded={
|
|
69
|
+
<FoldableSection isUnfolded={isVisible}>{hiddenCells}</FoldableSection>
|
|
56
70
|
</div>
|
|
57
71
|
)}
|
|
58
|
-
renderFoldButton={
|
|
72
|
+
renderFoldButton={
|
|
73
|
+
cardCells.length > 1 ? renderFoldButton(isVisible, options?.parent) : null
|
|
74
|
+
}
|
|
59
75
|
/>
|
|
60
76
|
) : (
|
|
61
77
|
<div>{visibleCells}</div>
|
|
@@ -65,18 +81,23 @@ export const CarouselTariffsCard = JSX<CarouselTariffsCardProps>(
|
|
|
65
81
|
},
|
|
66
82
|
);
|
|
67
83
|
|
|
68
|
-
const renderFoldButton = (
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
84
|
+
const renderFoldButton = (isUnfolded?: boolean, parent?: Slot) => (): VNode =>
|
|
85
|
+
(
|
|
86
|
+
<button
|
|
87
|
+
className="w-full cursor-pointer text-primary-main pt-lg flex justify-between items-center"
|
|
88
|
+
onClick={() => {
|
|
89
|
+
if (parent !== undefined) {
|
|
90
|
+
defaultEventBus.fire('fold', { type: 'fold', isUnfolded: !isUnfolded, parent });
|
|
91
|
+
}
|
|
92
|
+
}}
|
|
93
|
+
type="button"
|
|
94
|
+
>
|
|
95
|
+
<div>{isUnfolded ? 'Скрыть' : 'Подробнее о тарифе'}</div>
|
|
96
|
+
<Icon
|
|
97
|
+
className="text-primary-text"
|
|
98
|
+
name={isUnfolded ? 'ArrowUpIcon' : 'ArrowDownIcon'}
|
|
99
|
+
width="16"
|
|
100
|
+
height="16"
|
|
101
|
+
/>
|
|
102
|
+
</button>
|
|
103
|
+
);
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import { useCallback } from '@redneckz/uni-jsx/lib/hooks';
|
|
2
2
|
import { type TopMenuItemProps } from '../../data/SitemapData';
|
|
3
|
-
import { type LinkProps } from '../../model/LinkProps';
|
|
4
3
|
import { BlockWrapper } from '../../ui-kit/BlockWrapper';
|
|
5
|
-
import { LinkButton } from '../../ui-kit/LinkButton/LinkButton';
|
|
6
4
|
import { Text } from '../../ui-kit/Text/Text';
|
|
7
5
|
import { UniBlock } from '../../UniBlock/UniBlock';
|
|
8
6
|
import { appendSlash } from '../../utils/appendSlash';
|
|
@@ -10,7 +8,6 @@ import { mapCookie } from '../../utils/mapCookie';
|
|
|
10
8
|
import { RollupItem } from '../RollupItem/RollupItem';
|
|
11
9
|
import { Contacts } from './Contacts';
|
|
12
10
|
import { COOKIE_REPLACE } from './cookieReplaceData';
|
|
13
|
-
import { findIconByHref } from './findIconByHref';
|
|
14
11
|
import { type FooterProps } from './FooterProps';
|
|
15
12
|
import { HorizontalNavigation } from './HorizontalNavigation';
|
|
16
13
|
import { HorizontalNavigationLink } from './HorizontalNavigationLink';
|
|
@@ -45,7 +42,12 @@ export const Footer = UniBlock<FooterProps>(({ className, footer, ...rest }) =>
|
|
|
45
42
|
Соцсети
|
|
46
43
|
</SocialMedia>
|
|
47
44
|
<div className="mb-xl">
|
|
48
|
-
<
|
|
45
|
+
<SocialMedia
|
|
46
|
+
className="mb-m"
|
|
47
|
+
media={mobileApps}
|
|
48
|
+
stretched={true}
|
|
49
|
+
showButtonText={false}
|
|
50
|
+
/>
|
|
49
51
|
<Text size="text-s" font="font-light" color="text-secondary-text">
|
|
50
52
|
Мобильное приложение
|
|
51
53
|
</Text>
|
|
@@ -83,18 +85,3 @@ const renderTopItems = (topItems: TopMenuItemProps[] | undefined) =>
|
|
|
83
85
|
<LinkList items={item.items} basePath={appendSlash(item.href)} />
|
|
84
86
|
</RollupItem>
|
|
85
87
|
));
|
|
86
|
-
|
|
87
|
-
const renderButton = ({ href = '/', text }: LinkProps, i: number) => {
|
|
88
|
-
const { label } = findIconByHref(href);
|
|
89
|
-
|
|
90
|
-
return (
|
|
91
|
-
<LinkButton
|
|
92
|
-
key={String(i)}
|
|
93
|
-
className="w-full"
|
|
94
|
-
text={text || label}
|
|
95
|
-
version="secondary"
|
|
96
|
-
href={href}
|
|
97
|
-
target="_blank"
|
|
98
|
-
/>
|
|
99
|
-
);
|
|
100
|
-
};
|