@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.
Files changed (54) hide show
  1. package/bundle/EventBus/defaultEventBus.d.ts +2 -0
  2. package/bundle/bundle.umd.js +14 -4
  3. package/bundle/bundle.umd.min.js +1 -1
  4. package/bundle/components/CarouselTariffsCard/CarouselTariffsCardAction.d.ts +6 -0
  5. package/dist/EventBus/defaultEventBus.d.ts +2 -0
  6. package/dist/EventBus/defaultEventBus.js.map +1 -1
  7. package/dist/components/CarouselTariffsCard/CarouselTariffsCard.js +15 -3
  8. package/dist/components/CarouselTariffsCard/CarouselTariffsCard.js.map +1 -1
  9. package/dist/components/CarouselTariffsCard/CarouselTariffsCardAction.d.ts +6 -0
  10. package/dist/components/CarouselTariffsCard/CarouselTariffsCardAction.js +2 -0
  11. package/dist/components/CarouselTariffsCard/CarouselTariffsCardAction.js.map +1 -0
  12. package/dist/components/Footer/Footer.mobile.js +1 -7
  13. package/dist/components/Footer/Footer.mobile.js.map +1 -1
  14. package/lib/EventBus/defaultEventBus.d.ts +2 -0
  15. package/lib/EventBus/defaultEventBus.js.map +1 -1
  16. package/lib/components/CarouselTariffsCard/CarouselTariffsCard.js +15 -3
  17. package/lib/components/CarouselTariffsCard/CarouselTariffsCard.js.map +1 -1
  18. package/lib/components/CarouselTariffsCard/CarouselTariffsCardAction.d.ts +6 -0
  19. package/lib/components/CarouselTariffsCard/CarouselTariffsCardAction.js +2 -0
  20. package/lib/components/CarouselTariffsCard/CarouselTariffsCardAction.js.map +1 -0
  21. package/lib/components/Footer/Footer.mobile.js +1 -7
  22. package/lib/components/Footer/Footer.mobile.js.map +1 -1
  23. package/mobile/bundle/EventBus/defaultEventBus.d.ts +2 -0
  24. package/mobile/bundle/bundle.umd.js +17 -11
  25. package/mobile/bundle/bundle.umd.min.js +1 -1
  26. package/mobile/bundle/components/CarouselTariffsCard/CarouselTariffsCardAction.d.ts +6 -0
  27. package/mobile/dist/EventBus/defaultEventBus.d.ts +2 -0
  28. package/mobile/dist/EventBus/defaultEventBus.js.map +1 -1
  29. package/mobile/dist/components/CarouselTariffsCard/CarouselTariffsCard.js +15 -3
  30. package/mobile/dist/components/CarouselTariffsCard/CarouselTariffsCard.js.map +1 -1
  31. package/mobile/dist/components/CarouselTariffsCard/CarouselTariffsCardAction.d.ts +6 -0
  32. package/mobile/dist/components/CarouselTariffsCard/CarouselTariffsCardAction.js +2 -0
  33. package/mobile/dist/components/CarouselTariffsCard/CarouselTariffsCardAction.js.map +1 -0
  34. package/mobile/dist/components/Footer/Footer.js +1 -7
  35. package/mobile/dist/components/Footer/Footer.js.map +1 -1
  36. package/mobile/lib/EventBus/defaultEventBus.d.ts +2 -0
  37. package/mobile/lib/EventBus/defaultEventBus.js.map +1 -1
  38. package/mobile/lib/common.css +1 -1
  39. package/mobile/lib/components/CarouselTariffsCard/CarouselTariffsCard.js +15 -3
  40. package/mobile/lib/components/CarouselTariffsCard/CarouselTariffsCard.js.map +1 -1
  41. package/mobile/lib/components/CarouselTariffsCard/CarouselTariffsCardAction.d.ts +6 -0
  42. package/mobile/lib/components/CarouselTariffsCard/CarouselTariffsCardAction.js +2 -0
  43. package/mobile/lib/components/CarouselTariffsCard/CarouselTariffsCardAction.js.map +1 -0
  44. package/mobile/lib/components/Footer/Footer.js +1 -7
  45. package/mobile/lib/components/Footer/Footer.js.map +1 -1
  46. package/mobile/src/EventBus/defaultEventBus.ts +2 -0
  47. package/mobile/src/components/CarouselTariffsCard/CarouselTariffsCard.tsx +40 -19
  48. package/mobile/src/components/CarouselTariffsCard/CarouselTariffsCardAction.ts +6 -0
  49. package/mobile/src/components/Footer/Footer.tsx +6 -19
  50. package/package.json +1 -1
  51. package/src/EventBus/defaultEventBus.ts +2 -0
  52. package/src/components/CarouselTariffsCard/CarouselTariffsCard.tsx +40 -19
  53. package/src/components/CarouselTariffsCard/CarouselTariffsCardAction.ts +6 -0
  54. 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={({ isUnfolded }) => (
66
+ renderFoldableSection={() => (
53
67
  <div>
54
68
  {visibleCells}
55
- <FoldableSection isUnfolded={isUnfolded}>{hiddenCells}</FoldableSection>
69
+ <FoldableSection isUnfolded={isVisible}>{hiddenCells}</FoldableSection>
56
70
  </div>
57
71
  )}
58
- renderFoldButton={cardCells.length > 1 ? renderFoldButton : null}
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 = ({ isUnfolded, onToggle }: FoldablePartProps): VNode => (
69
- <button
70
- className="w-full cursor-pointer text-primary-main pt-lg flex justify-between items-center"
71
- onClick={onToggle}
72
- type="button"
73
- >
74
- <div>{isUnfolded ? 'Скрыть' : 'Подробнее о тарифе'}</div>
75
- <Icon
76
- className="text-primary-text"
77
- name={isUnfolded ? 'ArrowUpIcon' : 'ArrowDownIcon'}
78
- width="16"
79
- height="16"
80
- />
81
- </button>
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
+ );
@@ -0,0 +1,6 @@
1
+ import { type Slot } from './../../model/ContentPageDef';
2
+ export type CarouselTariffsCardAction = {
3
+ type: 'fold';
4
+ isUnfolded: boolean;
5
+ parent: Slot;
6
+ };
@@ -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
- <div className="flex flex-col gap-4 mb-xs">{mobileApps?.map(renderButton)}</div>
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,6 +1,6 @@
1
1
  {
2
2
  "name": "@redneckz/wildless-cms-uni-blocks",
3
- "version": "0.14.244",
3
+ "version": "0.14.246",
4
4
  "private": false,
5
5
  "license": "MIT",
6
6
  "author": "ЦК",
@@ -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={({ isUnfolded }) => (
66
+ renderFoldableSection={() => (
53
67
  <div>
54
68
  {visibleCells}
55
- <FoldableSection isUnfolded={isUnfolded}>{hiddenCells}</FoldableSection>
69
+ <FoldableSection isUnfolded={isVisible}>{hiddenCells}</FoldableSection>
56
70
  </div>
57
71
  )}
58
- renderFoldButton={cardCells.length > 1 ? renderFoldButton : null}
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 = ({ isUnfolded, onToggle }: FoldablePartProps): VNode => (
69
- <button
70
- className="w-full cursor-pointer text-primary-main pt-lg flex justify-between items-center"
71
- onClick={onToggle}
72
- type="button"
73
- >
74
- <div>{isUnfolded ? 'Скрыть' : 'Подробнее о тарифе'}</div>
75
- <Icon
76
- className="text-primary-text"
77
- name={isUnfolded ? 'ArrowUpIcon' : 'ArrowDownIcon'}
78
- width="16"
79
- height="16"
80
- />
81
- </button>
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
+ );
@@ -0,0 +1,6 @@
1
+ import { type Slot } from './../../model/ContentPageDef';
2
+ export type CarouselTariffsCardAction = {
3
+ type: 'fold';
4
+ isUnfolded: boolean;
5
+ parent: Slot;
6
+ };
@@ -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
- <div className="flex flex-col gap-4 mb-xs">{mobileApps?.map(renderButton)}</div>
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
- };