@redneckz/wildless-cms-uni-blocks 0.14.245 → 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/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/mobile/bundle/EventBus/defaultEventBus.d.ts +2 -0
- package/mobile/bundle/bundle.umd.js +14 -4
- 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/lib/EventBus/defaultEventBus.d.ts +2 -0
- package/mobile/lib/EventBus/defaultEventBus.js.map +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/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/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
|
@@ -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';
|
|
@@ -8,6 +9,7 @@ interface GlobalEventMap {
|
|
|
8
9
|
dialog: DialogAction;
|
|
9
10
|
popup: PopupAction;
|
|
10
11
|
tab: TabActivationEvent;
|
|
12
|
+
fold: CarouselTariffsCardAction;
|
|
11
13
|
}
|
|
12
14
|
export declare const defaultEventBus: EventBus<GlobalEventMap>;
|
|
13
15
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"defaultEventBus.js","sourceRoot":"","sources":["../../src/EventBus/defaultEventBus.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"defaultEventBus.js","sourceRoot":"","sources":["../../src/EventBus/defaultEventBus.ts"],"names":[],"mappings":";;AAKA,yCAAsC;AAUzB,QAAA,eAAe,GAAG,IAAI,mBAAQ,EAAkB,CAAC"}
|
|
@@ -2,6 +2,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
2
2
|
exports.CarouselTariffsCard = void 0;
|
|
3
3
|
const jsx_runtime_1 = require("@redneckz/uni-jsx/jsx-runtime");
|
|
4
4
|
const uni_jsx_1 = require("@redneckz/uni-jsx");
|
|
5
|
+
const hooks_1 = require("@redneckz/uni-jsx/lib/hooks");
|
|
6
|
+
const defaultEventBus_1 = require("../../EventBus/defaultEventBus");
|
|
5
7
|
const BlockWrapper_1 = require("../../ui-kit/BlockWrapper");
|
|
6
8
|
const Foldable_1 = require("../../ui-kit/Foldable/Foldable");
|
|
7
9
|
const FoldableSection_1 = require("../../ui-kit/Foldable/FoldableSection");
|
|
@@ -12,12 +14,22 @@ const LinkButton_1 = require("../../ui-kit/LinkButton/LinkButton");
|
|
|
12
14
|
const isIcon_1 = require("../../utils/isIcon");
|
|
13
15
|
const style_1 = require("../../utils/style");
|
|
14
16
|
const renderCardInfo_1 = require("./renderCardInfo");
|
|
15
|
-
exports.CarouselTariffsCard = (0, uni_jsx_1.JSX)(({ className = '', title, align = 'text-center', icon, button, visibleCellsCount = 1, cardCells = [], ...rest }) => {
|
|
17
|
+
exports.CarouselTariffsCard = (0, uni_jsx_1.JSX)(({ className = '', title, align = 'text-center', icon, button, visibleCellsCount = 1, cardCells = [], options, ...rest }) => {
|
|
16
18
|
const cellsNode = cardCells.map(renderCardInfo_1.renderCardInfo);
|
|
17
19
|
const [visibleCells, hiddenCells] = visibleCellsCount > 0
|
|
18
20
|
? [cellsNode.slice(0, visibleCellsCount), cellsNode.slice(visibleCellsCount)]
|
|
19
21
|
: [cellsNode, []];
|
|
20
|
-
|
|
22
|
+
const [isVisible, setIsVisible] = (0, hooks_1.useState)(false);
|
|
23
|
+
(0, hooks_1.useEffect)(() => defaultEventBus_1.defaultEventBus.subscribe('fold', (event) => {
|
|
24
|
+
if (options?.parent !== undefined && event.parent === options?.parent) {
|
|
25
|
+
setIsVisible(event.isUnfolded);
|
|
26
|
+
}
|
|
27
|
+
}), []);
|
|
28
|
+
return ((0, jsx_runtime_1.jsxs)(BlockWrapper_1.BlockWrapper, { className: (0, style_1.style)('flex flex-col', className), defaultPadding: "p-2xl", ...rest, children: [(0, isIcon_1.isIcon)(icon) ? ((0, jsx_runtime_1.jsx)("div", { className: "self-center", children: (0, jsx_runtime_1.jsx)(Img_1.Img, { image: icon }) })) : null, title ? ((0, jsx_runtime_1.jsx)(Heading_1.Heading, { className: (0, style_1.style)('pt-xs', align), headingType: "h5", title: title })) : null, button?.text ? (0, jsx_runtime_1.jsx)(LinkButton_1.LinkButton, { className: "w-full mt-m mb-lg", ...button }) : null, hiddenCells.length ? ((0, jsx_runtime_1.jsx)(Foldable_1.Foldable, { renderFoldableSection: () => ((0, jsx_runtime_1.jsxs)("div", { children: [visibleCells, (0, jsx_runtime_1.jsx)(FoldableSection_1.FoldableSection, { isUnfolded: isVisible, children: hiddenCells })] })), renderFoldButton: cardCells.length > 1 ? renderFoldButton(isVisible, options?.parent) : null })) : ((0, jsx_runtime_1.jsx)("div", { children: visibleCells }))] }));
|
|
21
29
|
});
|
|
22
|
-
const renderFoldButton = (
|
|
30
|
+
const renderFoldButton = (isUnfolded, parent) => () => ((0, jsx_runtime_1.jsxs)("button", { className: "w-full cursor-pointer text-primary-main pt-lg flex justify-between items-center", onClick: () => {
|
|
31
|
+
if (parent !== undefined) {
|
|
32
|
+
defaultEventBus_1.defaultEventBus.fire('fold', { type: 'fold', isUnfolded: !isUnfolded, parent });
|
|
33
|
+
}
|
|
34
|
+
}, type: "button", children: [(0, jsx_runtime_1.jsx)("div", { children: isUnfolded ? 'Скрыть' : 'Подробнее о тарифе' }), (0, jsx_runtime_1.jsx)(Icon_1.Icon, { className: "text-primary-text", name: isUnfolded ? 'ArrowUpIcon' : 'ArrowDownIcon', width: "16", height: "16" })] }));
|
|
23
35
|
//# sourceMappingURL=CarouselTariffsCard.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CarouselTariffsCard.js","sourceRoot":"","sources":["../../../src/components/CarouselTariffsCard/CarouselTariffsCard.tsx"],"names":[],"mappings":";;;AAAA,+CAAwC;
|
|
1
|
+
{"version":3,"file":"CarouselTariffsCard.js","sourceRoot":"","sources":["../../../src/components/CarouselTariffsCard/CarouselTariffsCard.tsx"],"names":[],"mappings":";;;AAAA,+CAAwC;AACxC,uDAAkE;AAClE,oEAAiE;AAGjE,4DAAyD;AACzD,6DAA0D;AAC1D,2EAAwE;AACxE,0DAAuD;AACvD,iDAA8C;AAC9C,8CAA2C;AAC3C,mEAAgE;AAEhE,+CAA4C;AAC5C,6CAA0C;AAE1C,qDAAkD;AAMrC,QAAA,mBAAmB,GAAG,IAAA,aAAG,EACpC,CAAC,EACC,SAAS,GAAG,EAAE,EACd,KAAK,EACL,KAAK,GAAG,aAAa,EACrB,IAAI,EACJ,MAAM,EACN,iBAAiB,GAAG,CAAC,EACrB,SAAS,GAAG,EAAE,EACd,OAAO,EACP,GAAG,IAAI,EACR,EAAE,EAAE;IACH,MAAM,SAAS,GAAG,SAAS,CAAC,GAAG,CAAC,+BAAc,CAAC,CAAC;IAEhD,MAAM,CAAC,YAAY,EAAE,WAAW,CAAC,GAC/B,iBAAiB,GAAG,CAAC;QACnB,CAAC,CAAC,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,EAAE,iBAAiB,CAAC,EAAE,SAAS,CAAC,KAAK,CAAC,iBAAiB,CAAC,CAAC;QAC7E,CAAC,CAAC,CAAC,SAAS,EAAE,EAAE,CAAC,CAAC;IACtB,MAAM,CA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AC,CAAC,gBAAgB,CAAC,SAAS,EAAE,OAAO,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,IAAI,GAE5E,CACH,CAAC,CAAC,CAAC,CACF,0CAAM,YAAY,GAAO,CAC1B,IACY,CAChB,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,MAAM,gBAAgB,GAAG,CAAC,UAAoB,EAAE,MAAa,EAAE,EAAE,CAAC,GAAU,EAAE,CAC5E,CACE,oCACE,SAAS,EAAC,iFAAiF,EAC3F,OAAO,EAAE,GAAG,EAAE;QACZ,IAAI,MAAM,KAAK,SAAS,EAAE;YACxB,iCAAe,CAAC,IAAI,CAAC,MAAM,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,UAAU,EAAE,CAAC,UAAU,EAAE,MAAM,EAAE,CAAC,CAAC;SACjF;IACH,CAAC,EACD,IAAI,EAAC,QAAQ,aAEb,0CAAM,UAAU,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,oBAAoB,GAAO,EACzD,uBAAC,WAAI,IACH,SAAS,EAAC,mBAAmB,EAC7B,IAAI,EAAE,UAAU,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,eAAe,EAClD,KAAK,EAAC,IAAI,EACV,MAAM,EAAC,IAAI,GACX,IACK,CACV,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CarouselTariffsCardAction.js","sourceRoot":"","sources":["../../../src/components/CarouselTariffsCard/CarouselTariffsCardAction.ts"],"names":[],"mappings":""}
|
|
@@ -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';
|
|
@@ -8,6 +9,7 @@ interface GlobalEventMap {
|
|
|
8
9
|
dialog: DialogAction;
|
|
9
10
|
popup: PopupAction;
|
|
10
11
|
tab: TabActivationEvent;
|
|
12
|
+
fold: CarouselTariffsCardAction;
|
|
11
13
|
}
|
|
12
14
|
export declare const defaultEventBus: EventBus<GlobalEventMap>;
|
|
13
15
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"defaultEventBus.js","sourceRoot":"","sources":["../../src/EventBus/defaultEventBus.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"defaultEventBus.js","sourceRoot":"","sources":["../../src/EventBus/defaultEventBus.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAUtC,MAAM,CAAC,MAAM,eAAe,GAAG,IAAI,QAAQ,EAAkB,CAAC"}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "@redneckz/uni-jsx/jsx-runtime";
|
|
2
2
|
import { JSX } from '@redneckz/uni-jsx';
|
|
3
|
+
import { useEffect, useState } from '@redneckz/uni-jsx/lib/hooks';
|
|
4
|
+
import { defaultEventBus } from '../../EventBus/defaultEventBus.js';
|
|
3
5
|
import { BlockWrapper } from '../../ui-kit/BlockWrapper.js';
|
|
4
6
|
import { Foldable } from '../../ui-kit/Foldable/Foldable.js';
|
|
5
7
|
import { FoldableSection } from '../../ui-kit/Foldable/FoldableSection.js';
|
|
@@ -10,12 +12,22 @@ import { LinkButton } from '../../ui-kit/LinkButton/LinkButton.js';
|
|
|
10
12
|
import { isIcon } from '../../utils/isIcon.js';
|
|
11
13
|
import { style } from '../../utils/style.js';
|
|
12
14
|
import { renderCardInfo } from './renderCardInfo.js';
|
|
13
|
-
export const CarouselTariffsCard = JSX(({ className = '', title, align = 'text-center', icon, button, visibleCellsCount = 1, cardCells = [], ...rest }) => {
|
|
15
|
+
export const CarouselTariffsCard = JSX(({ className = '', title, align = 'text-center', icon, button, visibleCellsCount = 1, cardCells = [], options, ...rest }) => {
|
|
14
16
|
const cellsNode = cardCells.map(renderCardInfo);
|
|
15
17
|
const [visibleCells, hiddenCells] = visibleCellsCount > 0
|
|
16
18
|
? [cellsNode.slice(0, visibleCellsCount), cellsNode.slice(visibleCellsCount)]
|
|
17
19
|
: [cellsNode, []];
|
|
18
|
-
|
|
20
|
+
const [isVisible, setIsVisible] = useState(false);
|
|
21
|
+
useEffect(() => defaultEventBus.subscribe('fold', (event) => {
|
|
22
|
+
if (options?.parent !== undefined && event.parent === options?.parent) {
|
|
23
|
+
setIsVisible(event.isUnfolded);
|
|
24
|
+
}
|
|
25
|
+
}), []);
|
|
26
|
+
return (_jsxs(BlockWrapper, { className: style('flex flex-col', className), defaultPadding: "p-2xl", ...rest, children: [isIcon(icon) ? (_jsx("div", { className: "self-center", children: _jsx(Img, { image: icon }) })) : null, title ? (_jsx(Heading, { className: style('pt-xs', align), headingType: "h5", title: title })) : null, button?.text ? _jsx(LinkButton, { className: "w-full mt-m mb-lg", ...button }) : null, hiddenCells.length ? (_jsx(Foldable, { renderFoldableSection: () => (_jsxs("div", { children: [visibleCells, _jsx(FoldableSection, { isUnfolded: isVisible, children: hiddenCells })] })), renderFoldButton: cardCells.length > 1 ? renderFoldButton(isVisible, options?.parent) : null })) : (_jsx("div", { children: visibleCells }))] }));
|
|
19
27
|
});
|
|
20
|
-
const renderFoldButton = (
|
|
28
|
+
const renderFoldButton = (isUnfolded, parent) => () => (_jsxs("button", { className: "w-full cursor-pointer text-primary-main pt-lg flex justify-between items-center", onClick: () => {
|
|
29
|
+
if (parent !== undefined) {
|
|
30
|
+
defaultEventBus.fire('fold', { type: 'fold', isUnfolded: !isUnfolded, parent });
|
|
31
|
+
}
|
|
32
|
+
}, type: "button", children: [_jsx("div", { children: isUnfolded ? 'Скрыть' : 'Подробнее о тарифе' }), _jsx(Icon, { className: "text-primary-text", name: isUnfolded ? 'ArrowUpIcon' : 'ArrowDownIcon', width: "16", height: "16" })] }));
|
|
21
33
|
//# sourceMappingURL=CarouselTariffsCard.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CarouselTariffsCard.js","sourceRoot":"","sources":["../../../src/components/CarouselTariffsCard/CarouselTariffsCard.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"CarouselTariffsCard.js","sourceRoot":"","sources":["../../../src/components/CarouselTariffsCard/CarouselTariffsCard.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AACxC,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AAClE,OAAO,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAC;AAGjE,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AACzD,OAAO,EAAE,QAAQ,EAAE,MAAM,gCAAgC,CAAC;AAC1D,OAAO,EAAE,eAAe,EAAE,MAAM,uCAAuC,CAAC;AACxE,OAAO,EAAE,OAAO,EAAE,MAAM,8BAA8B,CAAC;AACvD,OAAO,EAAE,IAAI,EAAE,MAAM,wBAAwB,CAAC;AAC9C,OAAO,EAAE,GAAG,EAAE,MAAM,sBAAsB,CAAC;AAC3C,OAAO,EAAE,UAAU,EAAE,MAAM,oCAAoC,CAAC;AAEhE,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAC5C,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAE1C,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAMlD,MAAM,CAAC,MAAM,mBAAmB,GAAG,GAAG,CACpC,CAAC,EACC,SAAS,GAAG,EAAE,EACd,KAAK,EACL,KAAK,GAAG,aAAa,EACrB,IAAI,EACJ,MAAM,EACN,iBAAiB,GAAG,CAAC,EACrB,SAAS,GAAG,EAAE,EACd,OAAO,EACP,GAAG,IAAI,EACR,EAAE,EAAE;IACH,MAAM,SAAS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C,CAAC,CAAC,IAAI,EAC9E,WAAW,CAAC,MAAM,CAAC,CAAC,CAAC,CACpB,KAAC,QAAQ,IACP,qBAAqB,EAAE,GAAG,EAAE,CAAC,CAC3B,0BACG,YAAY,EACb,KAAC,eAAe,IAAC,UAAU,EAAE,SAAS,YAAG,WAAW,GAAmB,IACnE,CACP,EACD,gBAAgB,EACd,SAAS,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,gBAAgB,CAAC,SAAS,EAAE,OAAO,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,IAAI,GAE5E,CACH,CAAC,CAAC,CAAC,CACF,wBAAM,YAAY,GAAO,CAC1B,IACY,CAChB,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,MAAM,gBAAgB,GAAG,CAAC,UAAoB,EAAE,MAAa,EAAE,EAAE,CAAC,GAAU,EAAE,CAC5E,CACE,kBACE,SAAS,EAAC,iFAAiF,EAC3F,OAAO,EAAE,GAAG,EAAE;QACZ,IAAI,MAAM,KAAK,SAAS,EAAE;YACxB,eAAe,CAAC,IAAI,CAAC,MAAM,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,UAAU,EAAE,CAAC,UAAU,EAAE,MAAM,EAAE,CAAC,CAAC;SACjF;IACH,CAAC,EACD,IAAI,EAAC,QAAQ,aAEb,wBAAM,UAAU,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,oBAAoB,GAAO,EACzD,KAAC,IAAI,IACH,SAAS,EAAC,mBAAmB,EAC7B,IAAI,EAAE,UAAU,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,eAAe,EAClD,KAAK,EAAC,IAAI,EACV,MAAM,EAAC,IAAI,GACX,IACK,CACV,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CarouselTariffsCardAction.js","sourceRoot":"","sources":["../../../src/components/CarouselTariffsCard/CarouselTariffsCardAction.ts"],"names":[],"mappings":""}
|
|
@@ -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
|
+
);
|
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
|
+
);
|