@redneckz/wildless-cms-uni-blocks 0.14.262 → 0.14.263
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 +1 -1
- package/bundle/bundle.umd.min.js +1 -1
- package/bundle/components/StickyBottomMenu/StickyBottomMenuDialog.d.ts +9 -0
- package/bundle/components/StickyBottomMenu/useBottomMenuItemDialog.d.ts +19 -0
- package/bundle/components/StickyBottomMenu/useBurgerMenuDialog.d.ts +0 -1
- package/bundle/data/StickyMobileData.d.ts +2 -2
- package/dist/components/StickyBottomMenu/StickyBottomMenu.mobile.js +22 -42
- package/dist/components/StickyBottomMenu/StickyBottomMenu.mobile.js.map +1 -1
- package/dist/components/StickyBottomMenu/StickyBottomMenuDialog.d.ts +9 -0
- package/dist/components/StickyBottomMenu/StickyBottomMenuDialog.js +17 -0
- package/dist/components/StickyBottomMenu/StickyBottomMenuDialog.js.map +1 -0
- package/dist/components/StickyBottomMenu/useBottomMenuItemDialog.d.ts +19 -0
- package/dist/components/StickyBottomMenu/useBottomMenuItemDialog.js +15 -0
- package/dist/components/StickyBottomMenu/useBottomMenuItemDialog.js.map +1 -0
- package/dist/components/StickyBottomMenu/useBurgerMenuDialog.d.ts +0 -1
- package/dist/components/StickyBottomMenu/useBurgerMenuDialog.js +1 -1
- package/dist/components/StickyBottomMenu/useBurgerMenuDialog.js.map +1 -1
- package/dist/data/StickyMobileData.d.ts +2 -2
- package/lib/common.css +1 -1
- package/lib/components/StickyBottomMenu/StickyBottomMenu.mobile.js +23 -43
- package/lib/components/StickyBottomMenu/StickyBottomMenu.mobile.js.map +1 -1
- package/lib/components/StickyBottomMenu/StickyBottomMenuDialog.d.ts +9 -0
- package/lib/components/StickyBottomMenu/StickyBottomMenuDialog.js +15 -0
- package/lib/components/StickyBottomMenu/StickyBottomMenuDialog.js.map +1 -0
- package/lib/components/StickyBottomMenu/useBottomMenuItemDialog.d.ts +19 -0
- package/lib/components/StickyBottomMenu/useBottomMenuItemDialog.js +12 -0
- package/lib/components/StickyBottomMenu/useBottomMenuItemDialog.js.map +1 -0
- package/lib/components/StickyBottomMenu/useBurgerMenuDialog.d.ts +0 -1
- package/lib/components/StickyBottomMenu/useBurgerMenuDialog.js +1 -1
- package/lib/components/StickyBottomMenu/useBurgerMenuDialog.js.map +1 -1
- package/lib/data/StickyMobileData.d.ts +2 -2
- package/mobile/bundle/bundle.umd.js +49 -49
- package/mobile/bundle/bundle.umd.min.js +1 -1
- package/mobile/bundle/components/StickyBottomMenu/StickyBottomMenuDialog.d.ts +9 -0
- package/mobile/bundle/components/StickyBottomMenu/useBottomMenuItemDialog.d.ts +19 -0
- package/mobile/bundle/components/StickyBottomMenu/useBurgerMenuDialog.d.ts +0 -1
- package/mobile/bundle/data/StickyMobileData.d.ts +2 -2
- package/mobile/dist/components/StickyBottomMenu/StickyBottomMenu.js +22 -42
- package/mobile/dist/components/StickyBottomMenu/StickyBottomMenu.js.map +1 -1
- package/mobile/dist/components/StickyBottomMenu/StickyBottomMenuDialog.d.ts +9 -0
- package/mobile/dist/components/StickyBottomMenu/StickyBottomMenuDialog.js +17 -0
- package/mobile/dist/components/StickyBottomMenu/StickyBottomMenuDialog.js.map +1 -0
- package/mobile/dist/components/StickyBottomMenu/useBottomMenuItemDialog.d.ts +19 -0
- package/mobile/dist/components/StickyBottomMenu/useBottomMenuItemDialog.js +15 -0
- package/mobile/dist/components/StickyBottomMenu/useBottomMenuItemDialog.js.map +1 -0
- package/mobile/dist/components/StickyBottomMenu/useBurgerMenuDialog.d.ts +0 -1
- package/mobile/dist/components/StickyBottomMenu/useBurgerMenuDialog.js +1 -1
- package/mobile/dist/components/StickyBottomMenu/useBurgerMenuDialog.js.map +1 -1
- package/mobile/dist/data/StickyMobileData.d.ts +2 -2
- package/mobile/lib/common.css +1 -1
- package/mobile/lib/components/StickyBottomMenu/StickyBottomMenu.js +23 -43
- package/mobile/lib/components/StickyBottomMenu/StickyBottomMenu.js.map +1 -1
- package/mobile/lib/components/StickyBottomMenu/StickyBottomMenuDialog.d.ts +9 -0
- package/mobile/lib/components/StickyBottomMenu/StickyBottomMenuDialog.js +15 -0
- package/mobile/lib/components/StickyBottomMenu/StickyBottomMenuDialog.js.map +1 -0
- package/mobile/lib/components/StickyBottomMenu/useBottomMenuItemDialog.d.ts +19 -0
- package/mobile/lib/components/StickyBottomMenu/useBottomMenuItemDialog.js +12 -0
- package/mobile/lib/components/StickyBottomMenu/useBottomMenuItemDialog.js.map +1 -0
- package/mobile/lib/components/StickyBottomMenu/useBurgerMenuDialog.d.ts +0 -1
- package/mobile/lib/components/StickyBottomMenu/useBurgerMenuDialog.js +1 -1
- package/mobile/lib/components/StickyBottomMenu/useBurgerMenuDialog.js.map +1 -1
- package/mobile/lib/data/StickyMobileData.d.ts +2 -2
- package/mobile/src/components/StickyBottomMenu/StickyBottomMenu.tsx +27 -67
- package/mobile/src/components/StickyBottomMenu/StickyBottomMenuDialog.tsx +39 -0
- package/mobile/src/components/StickyBottomMenu/useBottomMenuItemDialog.tsx +54 -0
- package/mobile/src/components/StickyBottomMenu/useBurgerMenuDialog.tsx +1 -2
- package/mobile/src/data/StickyMobileData.ts +2 -2
- package/package.json +1 -1
- package/src/components/StickyBottomMenu/StickyBottomMenu.mobile.tsx +27 -67
- package/src/components/StickyBottomMenu/StickyBottomMenuDialog.tsx +39 -0
- package/src/components/StickyBottomMenu/useBottomMenuItemDialog.tsx +54 -0
- package/src/components/StickyBottomMenu/useBurgerMenuDialog.tsx +1 -2
- package/src/data/StickyMobileData.ts +2 -2
|
@@ -1,16 +1,13 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "@redneckz/uni-jsx/jsx-runtime";
|
|
2
|
-
import { useCallback,
|
|
3
|
-
import { useBool } from '@redneckz/uni-jsx/lib/hooks/useBool';
|
|
2
|
+
import { useCallback, useRef, useState } from '@redneckz/uni-jsx/lib/hooks';
|
|
4
3
|
import { useOutsideClick } from '@redneckz/uni-jsx/lib/hooks/useOutsideClick';
|
|
5
4
|
import { BlockWrapper } from '../../ui-kit/BlockWrapper.js';
|
|
6
|
-
import { Dialog } from '../../ui-kit/DialogManager/Dialog.js';
|
|
7
|
-
import { Heading } from '../../ui-kit/Heading/Heading.js';
|
|
8
5
|
import { UniBlock } from '../../UniBlock/UniBlock.js';
|
|
9
6
|
import { StickyBottomMenuBurger } from './StickyBottomMenuBurger.js';
|
|
10
7
|
import { StickyBottomMenuItem } from './StickyBottomMenuItem.js';
|
|
8
|
+
import { useBottomMenuItemDialog } from './useBottomMenuItemDialog.js';
|
|
11
9
|
import { useBurgerMenuDialog } from './useBurgerMenuDialog.js';
|
|
12
10
|
const EMPTY_MENU = [];
|
|
13
|
-
// eslint-disable-next-line max-lines-per-function
|
|
14
11
|
export const StickyBottomMenu = UniBlock(({ sticky, ...rest }) => {
|
|
15
12
|
const { menuItems = EMPTY_MENU } = sticky ?? {};
|
|
16
13
|
const [isBurgerMenuDialogOpen, { toggle, close, openDialog }] = useBurgerMenuDialog(rest.options?.page?.sitemap ?? {});
|
|
@@ -19,56 +16,39 @@ export const StickyBottomMenu = UniBlock(({ sticky, ...rest }) => {
|
|
|
19
16
|
const rightItems = menuItems.slice(middleIdx);
|
|
20
17
|
const [activeIndex, setActiveIndex] = useState(-1);
|
|
21
18
|
const [currentItemPosition, setCurrentItemPosition] = useState('');
|
|
22
|
-
const
|
|
23
|
-
const closePopupDialog = useCallback(() => {
|
|
24
|
-
setPopupDialogClosed();
|
|
19
|
+
const closeDialog = useCallback(() => {
|
|
25
20
|
setActiveIndex(-1);
|
|
26
21
|
setCurrentItemPosition('');
|
|
27
22
|
close();
|
|
28
23
|
}, [close]);
|
|
29
24
|
const menuRef = useRef(null);
|
|
30
|
-
const
|
|
31
|
-
const
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
25
|
+
const dialogRef = useOutsideClick(closeDialog);
|
|
26
|
+
const [{ openBottomMenuItemDialog }] = useBottomMenuItemDialog({
|
|
27
|
+
menuRef,
|
|
28
|
+
dialogRef,
|
|
29
|
+
closeDialog,
|
|
30
|
+
openDialog,
|
|
31
|
+
leftItems,
|
|
32
|
+
rightItems,
|
|
33
|
+
});
|
|
34
|
+
const handleMenuBurgerClick = useCallback((e) => {
|
|
35
|
+
closeDialog();
|
|
36
|
+
e.stopPropagation();
|
|
37
|
+
toggle();
|
|
38
|
+
}, [closeDialog, toggle]);
|
|
38
39
|
const handleMenuItemClick = useCallback((index, itemsPosition) => {
|
|
39
40
|
setCurrentItemPosition(itemsPosition);
|
|
40
41
|
setActiveIndex(index);
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
return;
|
|
46
|
-
}
|
|
47
|
-
if (!popupDialogRef.current.shadowRoot) {
|
|
48
|
-
popupDialogRef.current?.attachShadow({ mode: 'open' });
|
|
49
|
-
}
|
|
50
|
-
const shadowRoot = popupDialogRef.current.shadowRoot;
|
|
51
|
-
if (!shadowRoot) {
|
|
52
|
-
return;
|
|
53
|
-
}
|
|
54
|
-
if (currentItemPosition === 'left') {
|
|
55
|
-
shadowRoot.innerHTML = leftItems[activeIndex]?.__html || '';
|
|
56
|
-
}
|
|
57
|
-
else {
|
|
58
|
-
shadowRoot.innerHTML = rightItems[activeIndex]?.__html || '';
|
|
59
|
-
}
|
|
60
|
-
}, [activeIndex, currentItemPosition, popupDialogState]);
|
|
61
|
-
return (_jsx(BlockWrapper, { className: "h-[74px] z-[100] relative", defaultPadding: "p-0", ...rest, children: _jsxs("div", { ref: menuRef, className: "ml-auto container bg-white flex justify-center shadow-blue-gray", children: [leftItems.map(renderMenuItem(handleMenuItemClick, 'left', { activeIndex, currentItemPosition })), _jsx(StickyBottomMenuBurger, { isActive: isBurgerMenuDialogOpen, onClick: (e) => {
|
|
62
|
-
closePopupDialog();
|
|
63
|
-
e.stopPropagation();
|
|
64
|
-
toggle();
|
|
65
|
-
} }), rightItems.map(renderMenuItem(handleMenuItemClick, 'right', { activeIndex, currentItemPosition }))] }) }));
|
|
42
|
+
close();
|
|
43
|
+
openBottomMenuItemDialog(index, itemsPosition);
|
|
44
|
+
}, [close, openBottomMenuItemDialog]);
|
|
45
|
+
return (_jsx(BlockWrapper, { className: "h-[74px] z-[100] relative", defaultPadding: "p-0", ...rest, children: _jsxs("div", { ref: menuRef, className: "ml-auto container bg-white flex justify-center shadow-blue-gray", children: [leftItems.map(renderMenuItem(handleMenuItemClick, 'left', { activeIndex, currentItemPosition })), _jsx(StickyBottomMenuBurger, { isActive: isBurgerMenuDialogOpen, onClick: (e) => handleMenuBurgerClick(e) }), rightItems.map(renderMenuItem(handleMenuItemClick, 'right', { activeIndex, currentItemPosition }))] }) }));
|
|
66
46
|
});
|
|
67
|
-
const renderMenuItem = (
|
|
47
|
+
const renderMenuItem = (onClick, itemsPosition, currentActiveItem) => (_, i, arr) => {
|
|
68
48
|
return (_jsx(StickyBottomMenuItem, { item: _, isActive: arr[currentActiveItem.activeIndex]?.title === _?.title &&
|
|
69
49
|
currentActiveItem.currentItemPosition === itemsPosition, onClick: (e) => {
|
|
70
50
|
e.stopPropagation();
|
|
71
|
-
|
|
51
|
+
onClick(i, itemsPosition);
|
|
72
52
|
} }, _.title || String(i)));
|
|
73
53
|
};
|
|
74
54
|
//# sourceMappingURL=StickyBottomMenu.mobile.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StickyBottomMenu.mobile.js","sourceRoot":"","sources":["../../../src/components/StickyBottomMenu/StickyBottomMenu.mobile.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,WAAW,EAAE,
|
|
1
|
+
{"version":3,"file":"StickyBottomMenu.mobile.js","sourceRoot":"","sources":["../../../src/components/StickyBottomMenu/StickyBottomMenu.mobile.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AAC5E,OAAO,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B,CAAC,CAAC,CAAC,GACxC,EACD,UAAU,CAAC,GAAG,CACb,cAAc,CAAC,mBAAmB,EAAE,OAAO,EAAE,EAAE,WAAW,EAAE,mBAAmB,EAAE,CAAC,CACnF,IACG,GACO,CAChB,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,MAAM,cAAc,GAClB,CACE,OAAuD,EACvD,aAAqB,EACrB,iBAAoC,EACpC,EAAE,CACJ,CAAC,CAAiB,EAAE,CAAS,EAAE,GAAqB,EAAE,EAAE;IACtD,OAAO,CACL,KAAC,oBAAoB,IAEnB,IAAI,EAAE,CAAC,EACP,QAAQ,EACN,GAAG,CAAC,iBAAiB,CAAC,WAAW,CAAC,EAAE,KAAK,KAAK,CAAC,EAAE,KAAK;YACtD,iBAAiB,CAAC,mBAAmB,KAAK,aAAa,EAEzD,OAAO,EAAE,CAAC,CAAC,EAAE,EAAE;YACb,CAAC,CAAC,eAAe,EAAE,CAAC;YACpB,OAAO,CAAC,CAAC,EAAE,aAAa,CAAC,CAAC;QAC5B,CAAC,IATI,CAAC,CAAC,KAAK,IAAI,MAAM,CAAC,CAAC,CAAC,CAUzB,CACH,CAAC;AACJ,CAAC,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { type VNode } from '../../model/VNode';
|
|
2
|
+
import { type PreventableEvent } from '../../ui-kit/PreventableEvent';
|
|
3
|
+
export interface StickyBottomMenuDialogProps {
|
|
4
|
+
className?: string;
|
|
5
|
+
head?: VNode;
|
|
6
|
+
onClose?: () => void;
|
|
7
|
+
onClick?: (e: PreventableEvent) => void;
|
|
8
|
+
}
|
|
9
|
+
export declare const StickyBottomMenuDialog: import("@redneckz/uni-jsx").UNIComponent<StickyBottomMenuDialogProps, any, any>;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "@redneckz/uni-jsx/jsx-runtime";
|
|
2
|
+
import { JSX } from '@redneckz/uni-jsx';
|
|
3
|
+
import { useCallback } from '@redneckz/uni-jsx/lib/hooks';
|
|
4
|
+
import { CloseButton } from '../../ui-kit/DialogManager/CloseButton.js';
|
|
5
|
+
import { useDialogManager } from '../../ui-kit/DialogManager/useDialogManager.js';
|
|
6
|
+
import { style } from '../../utils/style.js';
|
|
7
|
+
export const StickyBottomMenuDialog = JSX(({ className, head, children, onClose, onClick }) => {
|
|
8
|
+
const { close } = useDialogManager();
|
|
9
|
+
const handleClose = useCallback(() => {
|
|
10
|
+
close();
|
|
11
|
+
onClose && onClose();
|
|
12
|
+
}, [onClose]);
|
|
13
|
+
return (_jsxs("div", { onClick: onClick, className: style('relative min-h-full bg-white p-0 rounded-xl mt-[20%]', className), role: "dialog", children: [_jsxs("div", { className: "sticky py-xl top-0 rounded-xl bg-white z-10", children: [_jsx(CloseButton, { className: "absolute top-1.5 right-0", onClose: handleClose }), _jsx("div", { className: "container", children: head })] }), _jsx("div", { className: "container pb-6xl", children: children })] }));
|
|
14
|
+
});
|
|
15
|
+
//# sourceMappingURL=StickyBottomMenuDialog.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"StickyBottomMenuDialog.js","sourceRoot":"","sources":["../../../src/components/StickyBottomMenu/StickyBottomMenuDialog.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AACxC,OAAO,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAC;AAE1D,OAAO,EAAE,WAAW,EAAE,MAAM,wCAAwC,CAAC;AACrE,OAAO,EAAE,gBAAgB,EAAE,MAAM,6CAA6C,CAAC;AAE/E,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAS1C,MAAM,CAAC,MAAM,sBAAsB,GAAG,GAAG,CACvC,CAAC,EAAE,SAAS,EAAE,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,OAAO,EAAE,EAAE,EAAE;IAClD,MAAM,EAAE,KAAK,EAAE,GAAG,gBAAgB,EAAE,CAAC;IAErC,MAAM,WAAW,GAAG,WAAW,CAAC,GAAG,EAAE;QACnC,KAAK,EAAE,CAAC;QACR,OAAO,IAAI,OAAO,EAAE,CAAC;IACvB,CAAC,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC;IAEd,OAAO,CACL,eACE,OAAO,EAAE,OAAO,EAChB,SAAS,EAAE,KAAK,CAAC,sDAAsD,EAAE,SAAS,CAAC,EACnF,IAAI,EAAC,QAAQ,aAEb,eAAK,SAAS,EAAC,6CAA6C,aAC1D,KAAC,WAAW,IAAC,SAAS,EAAC,0BAA0B,EAAC,OAAO,EAAE,WAAW,GAAI,EAC1E,cAAK,SAAS,EAAC,WAAW,YAAE,IAAI,GAAO,IACnC,EACN,cAAK,SAAS,EAAC,kBAAkB,YAAE,QAAQ,GAAO,IAC9C,CACP,CAAC;AACJ,CAAC,CACF,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { type StickyMenuItem } from '../../data/StickyMobileData';
|
|
2
|
+
import { type VNode } from '../../model/VNode';
|
|
3
|
+
import { type DialogOptions } from '../../ui-kit/DialogManager/useDialogManager';
|
|
4
|
+
interface BottomMenuItemDialog {
|
|
5
|
+
menuRef?: {
|
|
6
|
+
current: HTMLDivElement | null;
|
|
7
|
+
};
|
|
8
|
+
dialogRef?: {
|
|
9
|
+
current: HTMLDivElement | null;
|
|
10
|
+
};
|
|
11
|
+
closeDialog: () => void;
|
|
12
|
+
openDialog: (dialog: VNode, options: DialogOptions) => void;
|
|
13
|
+
leftItems: StickyMenuItem[];
|
|
14
|
+
rightItems: StickyMenuItem[];
|
|
15
|
+
}
|
|
16
|
+
export declare const useBottomMenuItemDialog: ({ menuRef, dialogRef, closeDialog, openDialog, leftItems, rightItems, }: BottomMenuItemDialog) => {
|
|
17
|
+
openBottomMenuItemDialog: (index: number, itemsPosition: string) => void;
|
|
18
|
+
}[];
|
|
19
|
+
export {};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { jsx as _jsx } from "@redneckz/uni-jsx/jsx-runtime";
|
|
2
|
+
import { Heading } from '../../ui-kit/Heading/Heading.js';
|
|
3
|
+
import { StickyBottomMenuDialog } from './StickyBottomMenuDialog.js';
|
|
4
|
+
export const useBottomMenuItemDialog = ({ menuRef, dialogRef, closeDialog, openDialog, leftItems, rightItems, }) => {
|
|
5
|
+
const openBottomMenuItemDialog = (index, itemsPosition) => {
|
|
6
|
+
const requiredArray = itemsPosition === 'left' ? leftItems : rightItems;
|
|
7
|
+
const menuDimensions = menuRef?.current?.getBoundingClientRect();
|
|
8
|
+
openDialog(_jsx(StickyBottomMenuDialog, { onClick: (e) => e.stopPropagation(), onClose: closeDialog, head: _jsx("div", { className: "flex items-center px-xl", children: _jsx(Heading, { as: "h4", title: requiredArray[index].title }) }), children: _jsx("div", { className: "bg-white pb-20 pt-1 text-l", ref: dialogRef, children: _jsx("iframe", { src: requiredArray[index]?.src, className: "min-h-[90vh]", width: menuDimensions?.width || 0 }) }) }), { id: itemsPosition === 'left' ? leftItems[index].title : rightItems[index].title });
|
|
9
|
+
};
|
|
10
|
+
return [{ openBottomMenuItemDialog }];
|
|
11
|
+
};
|
|
12
|
+
//# sourceMappingURL=useBottomMenuItemDialog.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useBottomMenuItemDialog.js","sourceRoot":"","sources":["../../../src/components/StickyBottomMenu/useBottomMenuItemDialog.tsx"],"names":[],"mappings":";AAGA,OAAO,EAAE,OAAO,EAAE,MAAM,8BAA8B,CAAC;AACvD,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAelE,MAAM,CAAC,MAAM,uBAAuB,GAAG,CAAC,EACtC,OAAO,EACP,SAAS,EACT,WAAW,EACX,UAAU,EACV,SAAS,EACT,UAAU,GACW,EAAE,EAAE;IACzB,MAAM,wBAAwB,GAAG,CAAC,KAAa,EAAE,aAAqB,EAAE,EAAE;QACxE,MAAM,aAAa,GAAG,aAAa,KAAK,MAAM,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,UAAU,CAAC;QACxE,MAAM,cAAc,GAAG,OAAO,EAAE,OAAO,EAAE,qBAAqB,EAAE,CAAC;QACjE,UAAU,CACR,KAAC,sBAAsB,IACrB,OAAO,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,eAAe,EAAE,EACnC,OAAO,EAAE,WAAW,EACpB,IAAI,EACF,cAAK,SAAS,EAAC,yBAAyB,YACtC,KAAC,OAAO,IAAC,EAAE,EAAC,IAAI,EAAC,KAAK,EAAE,aAAa,CAAC,KAAK,CAAC,CAAC,KAAK,GAAI,GAClD,YAGR,cAAK,SAAS,EAAC,4BAA4B,EAAC,GAAG,EAAE,SAAS,YACxD,iBACE,GAAG,EAAE,aAAa,CAAC,KAAK,CAAC,EAAE,GAAG,EAC9B,SAAS,EAAC,cAAc,EACxB,KAAK,EAAE,cAAc,EAAE,KAAK,IAAI,CAAC,GACjC,GACE,GACiB,EACzB,EAAE,EAAE,EAAE,aAAa,KAAK,MAAM,CAAC,CAAC,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,CACpF,CAAC;IACJ,CAAC,CAAC;IAEF,OAAO,CAAC,EAAE,wBAAwB,EAAE,CAAC,CAAC;AACxC,CAAC,CAAC"}
|
|
@@ -3,7 +3,6 @@ import { type DialogOptions } from '../../ui-kit/DialogManager/useDialogManager'
|
|
|
3
3
|
import { type BurgerMenuDialogProps } from './BurgerMenuDialog';
|
|
4
4
|
export declare const BURGER_MENU_DIALOG_ID = "burgerMenuDialog";
|
|
5
5
|
export declare const useBurgerMenuDialog: (props: BurgerMenuDialogProps) => [boolean, {
|
|
6
|
-
open: () => void;
|
|
7
6
|
close: () => void;
|
|
8
7
|
toggle: () => void;
|
|
9
8
|
openDialog: (dialog: VNode, options: DialogOptions) => void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useBurgerMenuDialog.js","sourceRoot":"","sources":["../../../src/components/StickyBottomMenu/useBurgerMenuDialog.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,YAAY,EAAE,MAAM,yCAAyC,CAAC;AACvE,OAAO,EAAE,gBAAgB,EAAsB,MAAM,6CAA6C,CAAC;AACnG,OAAO,EAAE,cAAc,EAAE,MAAM,2CAA2C,CAAC;AAC3E,OAAO,EAAE,gBAAgB,EAA8B,MAAM,oBAAoB,CAAC;AAElF,MAAM,CAAC,MAAM,qBAAqB,GAAG,kBAAkB,CAAC;AAExD,MAAM,CAAC,MAAM,mBAAmB,GAAG,CACjC,KAA4B,
|
|
1
|
+
{"version":3,"file":"useBurgerMenuDialog.js","sourceRoot":"","sources":["../../../src/components/StickyBottomMenu/useBurgerMenuDialog.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,YAAY,EAAE,MAAM,yCAAyC,CAAC;AACvE,OAAO,EAAE,gBAAgB,EAAsB,MAAM,6CAA6C,CAAC;AACnG,OAAO,EAAE,cAAc,EAAE,MAAM,2CAA2C,CAAC;AAC3E,OAAO,EAAE,gBAAgB,EAA8B,MAAM,oBAAoB,CAAC;AAElF,MAAM,CAAC,MAAM,qBAAqB,GAAG,kBAAkB,CAAC;AAExD,MAAM,CAAC,MAAM,mBAAmB,GAAG,CACjC,KAA4B,EAQ5B,EAAE;IACF,MAAM,EAAE,IAAI,EAAE,UAAU,EAAE,QAAQ,EAAE,KAAK,EAAE,GAAG,gBAAgB,EAAE,CAAC;IAEjE,MAAM,OAAO,GAAG,cAAc,EAAE,CAAC;IACjC,MAAM,gBAAgB,GAAG,YAAY,CAAC,qBAAqB,EAAE,OAAO,CAAC,CAAC;IAEtE,MAAM,IAAI,GAAG,GAAG,EAAE,CAAC,UAAU,CAAC,KAAC,gBAAgB,OAAK,KAAK,GAAI,EAAE,EAAE,EAAE,EAAE,qBAAqB,EAAE,CAAC,CAAC;IAC9F,MAAM,MAAM,GAAG,GAAG,EAAE;QAClB,IAAI,gBAAgB,EAAE;YACpB,QAAQ,EAAE,CAAC;SACZ;aAAM;YACL,IAAI,EAAE,CAAC;SACR;IACH,CAAC,CAAC;IAEF,OAAO,CAAC,gBAAgB,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,CAAC,CAAC;AAC3D,CAAC,CAAC"}
|
|
@@ -5,8 +5,8 @@ import { type Picture } from '../model/Picture';
|
|
|
5
5
|
export interface StickyMenuItem {
|
|
6
6
|
/** @title Название */
|
|
7
7
|
title?: string;
|
|
8
|
-
/** @title
|
|
9
|
-
|
|
8
|
+
/** @title Адрес страницы меню */
|
|
9
|
+
src?: string;
|
|
10
10
|
/** @title Иконка */
|
|
11
11
|
icon?: Picture;
|
|
12
12
|
}
|
|
@@ -4741,22 +4741,31 @@
|
|
|
4741
4741
|
};
|
|
4742
4742
|
const getIconSizeStyle = (size) => (size === 'normal' ? '38' : '24');
|
|
4743
4743
|
|
|
4744
|
+
const StickyBottomMenuBurger = JSX(({ isActive, onClick }) => (jsxs("button", { className: style(isActive ? 'text-primary-main' : 'text-primary-text', `w-10 m-4 flex justify-center items-center flex-col text-xs cursor-pointer`), onClick: onClick, type: "button", children: [jsx(Icon, { className: "w-6 h-6", name: "BurgerIcon", iconVersion: isActive ? 'color' : 'black' }), "\u041C\u0435\u043D\u044E"] })));
|
|
4745
|
+
|
|
4746
|
+
const StickyBottomMenuItem = JSX(({ isActive, item, onClick }) => {
|
|
4747
|
+
return (jsxs("div", { className: style(isActive ? 'text-primary-main' : 'text-primary-text', `w-10 m-4 flex justify-center items-center flex-col text-xs cursor-pointer`), title: item?.title || '', onClick: onClick, children: [jsx(Icon, { className: "w-6 h-6", name: item?.icon?.icon, iconVersion: isActive ? 'color' : 'black' }), item?.title || ''] }));
|
|
4748
|
+
});
|
|
4749
|
+
|
|
4744
4750
|
const CloseButton = JSX(({ className, onClose }) => (jsx("button", { className: style('flex justify-center items-center w-12 h-12 p-2xs bg-transparent border-none', className), onClick: onClose, title: "\u0417\u0430\u043A\u0440\u044B\u0442\u044C", type: "button", children: jsx(Img, { image: { icon: 'CloseIcon' }, width: "24", height: "24" }) })));
|
|
4745
4751
|
|
|
4746
|
-
const
|
|
4752
|
+
const StickyBottomMenuDialog = JSX(({ className, head, children, onClose, onClick }) => {
|
|
4747
4753
|
const { close } = useDialogManager();
|
|
4748
4754
|
const handleClose = useCallback(() => {
|
|
4749
4755
|
close();
|
|
4750
4756
|
onClose && onClose();
|
|
4751
4757
|
}, [onClose]);
|
|
4752
|
-
return (jsxs("div", { onClick: onClick, className: style('relative min-h-full bg-white
|
|
4758
|
+
return (jsxs("div", { onClick: onClick, className: style('relative min-h-full bg-white p-0 rounded-xl mt-[20%]', className), role: "dialog", children: [jsxs("div", { className: "sticky py-xl top-0 rounded-xl bg-white z-10", children: [jsx(CloseButton, { className: "absolute top-1.5 right-0", onClose: handleClose }), jsx("div", { className: "container", children: head })] }), jsx("div", { className: "container pb-6xl", children: children })] }));
|
|
4753
4759
|
});
|
|
4754
4760
|
|
|
4755
|
-
const
|
|
4756
|
-
|
|
4757
|
-
|
|
4758
|
-
|
|
4759
|
-
|
|
4761
|
+
const useBottomMenuItemDialog = ({ menuRef, dialogRef, closeDialog, openDialog, leftItems, rightItems, }) => {
|
|
4762
|
+
const openBottomMenuItemDialog = (index, itemsPosition) => {
|
|
4763
|
+
const requiredArray = itemsPosition === 'left' ? leftItems : rightItems;
|
|
4764
|
+
const menuDimensions = menuRef?.current?.getBoundingClientRect();
|
|
4765
|
+
openDialog(jsx(StickyBottomMenuDialog, { onClick: (e) => e.stopPropagation(), onClose: closeDialog, head: jsx("div", { className: "flex items-center px-xl", children: jsx(Heading, { as: "h4", title: requiredArray[index].title }) }), children: jsx("div", { className: "bg-white pb-20 pt-1 text-l", ref: dialogRef, children: jsx("iframe", { src: requiredArray[index]?.src, className: "min-h-[90vh]", width: menuDimensions?.width || 0 }) }) }), { id: itemsPosition === 'left' ? leftItems[index].title : rightItems[index].title });
|
|
4766
|
+
};
|
|
4767
|
+
return [{ openBottomMenuItemDialog }];
|
|
4768
|
+
};
|
|
4760
4769
|
|
|
4761
4770
|
const isDialogOpen = (id, dialogs) => Boolean(dialogs.find((item) => item.id === id, id));
|
|
4762
4771
|
|
|
@@ -4810,6 +4819,15 @@
|
|
|
4810
4819
|
return [activeIndex, items[activeIndex]];
|
|
4811
4820
|
}
|
|
4812
4821
|
|
|
4822
|
+
const Dialog = JSX(({ className, head, children, onClose, onClick }) => {
|
|
4823
|
+
const { close } = useDialogManager();
|
|
4824
|
+
const handleClose = useCallback(() => {
|
|
4825
|
+
close();
|
|
4826
|
+
onClose && onClose();
|
|
4827
|
+
}, [onClose]);
|
|
4828
|
+
return (jsxs("div", { onClick: onClick, className: style('relative min-h-full bg-white pt-0 p-lg', className), role: "dialog", children: [jsxs("div", { className: "sticky py-xl top-0 bg-white z-10", children: [jsx(CloseButton, { className: "absolute top-0 right-0", onClose: handleClose }), jsx("div", { className: "container", children: head })] }), jsx("div", { className: "container pb-6xl", children: children })] }));
|
|
4829
|
+
});
|
|
4830
|
+
|
|
4813
4831
|
const groupBy = (list, keyGetter) => {
|
|
4814
4832
|
const result = new Map();
|
|
4815
4833
|
for (const item of list) {
|
|
@@ -4984,11 +5002,10 @@
|
|
|
4984
5002
|
open();
|
|
4985
5003
|
}
|
|
4986
5004
|
};
|
|
4987
|
-
return [isBurgerMenuOpen, {
|
|
5005
|
+
return [isBurgerMenuOpen, { close, toggle, openDialog }];
|
|
4988
5006
|
};
|
|
4989
5007
|
|
|
4990
5008
|
const EMPTY_MENU = [];
|
|
4991
|
-
// eslint-disable-next-line max-lines-per-function
|
|
4992
5009
|
const StickyBottomMenu = UniBlock(({ sticky, ...rest }) => {
|
|
4993
5010
|
const { menuItems = EMPTY_MENU } = sticky ?? {};
|
|
4994
5011
|
const [isBurgerMenuDialogOpen, { toggle, close, openDialog }] = useBurgerMenuDialog(rest.options?.page?.sitemap ?? {});
|
|
@@ -4997,56 +5014,39 @@
|
|
|
4997
5014
|
const rightItems = menuItems.slice(middleIdx);
|
|
4998
5015
|
const [activeIndex, setActiveIndex] = useState(-1);
|
|
4999
5016
|
const [currentItemPosition, setCurrentItemPosition] = useState('');
|
|
5000
|
-
const
|
|
5001
|
-
const closePopupDialog = useCallback(() => {
|
|
5002
|
-
setPopupDialogClosed();
|
|
5017
|
+
const closeDialog = useCallback(() => {
|
|
5003
5018
|
setActiveIndex(-1);
|
|
5004
5019
|
setCurrentItemPosition('');
|
|
5005
5020
|
close();
|
|
5006
5021
|
}, [close]);
|
|
5007
5022
|
const menuRef = useRef(null);
|
|
5008
|
-
const
|
|
5009
|
-
const
|
|
5010
|
-
|
|
5011
|
-
|
|
5012
|
-
|
|
5013
|
-
|
|
5014
|
-
|
|
5015
|
-
|
|
5023
|
+
const dialogRef = useOutsideClick(closeDialog);
|
|
5024
|
+
const [{ openBottomMenuItemDialog }] = useBottomMenuItemDialog({
|
|
5025
|
+
menuRef,
|
|
5026
|
+
dialogRef,
|
|
5027
|
+
closeDialog,
|
|
5028
|
+
openDialog,
|
|
5029
|
+
leftItems,
|
|
5030
|
+
rightItems,
|
|
5031
|
+
});
|
|
5032
|
+
const handleMenuBurgerClick = useCallback((e) => {
|
|
5033
|
+
closeDialog();
|
|
5034
|
+
e.stopPropagation();
|
|
5035
|
+
toggle();
|
|
5036
|
+
}, [closeDialog, toggle]);
|
|
5016
5037
|
const handleMenuItemClick = useCallback((index, itemsPosition) => {
|
|
5017
5038
|
setCurrentItemPosition(itemsPosition);
|
|
5018
5039
|
setActiveIndex(index);
|
|
5019
|
-
|
|
5020
|
-
|
|
5021
|
-
|
|
5022
|
-
|
|
5023
|
-
|
|
5024
|
-
|
|
5025
|
-
if (!popupDialogRef.current.shadowRoot) {
|
|
5026
|
-
popupDialogRef.current?.attachShadow({ mode: 'open' });
|
|
5027
|
-
}
|
|
5028
|
-
const shadowRoot = popupDialogRef.current.shadowRoot;
|
|
5029
|
-
if (!shadowRoot) {
|
|
5030
|
-
return;
|
|
5031
|
-
}
|
|
5032
|
-
if (currentItemPosition === 'left') {
|
|
5033
|
-
shadowRoot.innerHTML = leftItems[activeIndex]?.__html || '';
|
|
5034
|
-
}
|
|
5035
|
-
else {
|
|
5036
|
-
shadowRoot.innerHTML = rightItems[activeIndex]?.__html || '';
|
|
5037
|
-
}
|
|
5038
|
-
}, [activeIndex, currentItemPosition, popupDialogState]);
|
|
5039
|
-
return (jsx(BlockWrapper, { className: "h-[74px] z-[100] relative", defaultPadding: "p-0", ...rest, children: jsxs("div", { ref: menuRef, className: "ml-auto container bg-white flex justify-center shadow-blue-gray", children: [leftItems.map(renderMenuItem(handleMenuItemClick, 'left', { activeIndex, currentItemPosition })), jsx(StickyBottomMenuBurger, { isActive: isBurgerMenuDialogOpen, onClick: (e) => {
|
|
5040
|
-
closePopupDialog();
|
|
5041
|
-
e.stopPropagation();
|
|
5042
|
-
toggle();
|
|
5043
|
-
} }), rightItems.map(renderMenuItem(handleMenuItemClick, 'right', { activeIndex, currentItemPosition }))] }) }));
|
|
5044
|
-
});
|
|
5045
|
-
const renderMenuItem = (handleMenuItemClick, itemsPosition, currentActiveItem) => (_, i, arr) => {
|
|
5040
|
+
close();
|
|
5041
|
+
openBottomMenuItemDialog(index, itemsPosition);
|
|
5042
|
+
}, [close, openBottomMenuItemDialog]);
|
|
5043
|
+
return (jsx(BlockWrapper, { className: "h-[74px] z-[100] relative", defaultPadding: "p-0", ...rest, children: jsxs("div", { ref: menuRef, className: "ml-auto container bg-white flex justify-center shadow-blue-gray", children: [leftItems.map(renderMenuItem(handleMenuItemClick, 'left', { activeIndex, currentItemPosition })), jsx(StickyBottomMenuBurger, { isActive: isBurgerMenuDialogOpen, onClick: (e) => handleMenuBurgerClick(e) }), rightItems.map(renderMenuItem(handleMenuItemClick, 'right', { activeIndex, currentItemPosition }))] }) }));
|
|
5044
|
+
});
|
|
5045
|
+
const renderMenuItem = (onClick, itemsPosition, currentActiveItem) => (_, i, arr) => {
|
|
5046
5046
|
return (jsx(StickyBottomMenuItem, { item: _, isActive: arr[currentActiveItem.activeIndex]?.title === _?.title &&
|
|
5047
5047
|
currentActiveItem.currentItemPosition === itemsPosition, onClick: (e) => {
|
|
5048
5048
|
e.stopPropagation();
|
|
5049
|
-
|
|
5049
|
+
onClick(i, itemsPosition);
|
|
5050
5050
|
} }, _.title || String(i)));
|
|
5051
5051
|
};
|
|
5052
5052
|
|
|
@@ -5640,7 +5640,7 @@
|
|
|
5640
5640
|
slots: () => [HEADER_SLOT, FOOTER_SLOT, STICKY_FOOTER_SLOT],
|
|
5641
5641
|
});
|
|
5642
5642
|
|
|
5643
|
-
const packageVersion = "0.14.
|
|
5643
|
+
const packageVersion = "0.14.262";
|
|
5644
5644
|
|
|
5645
5645
|
exports.Blocks = Blocks;
|
|
5646
5646
|
exports.ContentPage = ContentPage;
|