@redneckz/wildless-cms-uni-blocks 0.14.255 → 0.14.257
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 +4 -4
- package/bundle/bundle.umd.min.js +1 -1
- package/bundle/components/StickyBottomMenu/StickyBottomMenuBurger.d.ts +2 -1
- package/bundle/components/StickyBottomMenu/useBurgerMenuDialog.d.ts +3 -0
- package/bundle/ui-kit/DialogManager/Dialog.d.ts +2 -0
- package/bundle/ui-kit/PopupManager/PopupAction.d.ts +2 -0
- package/dist/components/StickyBottomMenu/BurgerMenuDialog.js +1 -1
- package/dist/components/StickyBottomMenu/BurgerMenuDialog.js.map +1 -1
- package/dist/components/StickyBottomMenu/StickyBottomMenu.mobile.js +26 -28
- package/dist/components/StickyBottomMenu/StickyBottomMenu.mobile.js.map +1 -1
- package/dist/components/StickyBottomMenu/StickyBottomMenuBurger.d.ts +2 -1
- package/dist/components/StickyBottomMenu/StickyBottomMenuBurger.js.map +1 -1
- package/dist/components/StickyBottomMenu/useBurgerMenuDialog.d.ts +3 -0
- package/dist/components/StickyBottomMenu/useBurgerMenuDialog.js +1 -1
- package/dist/components/StickyBottomMenu/useBurgerMenuDialog.js.map +1 -1
- package/dist/ui-kit/DialogManager/Dialog.d.ts +2 -0
- package/dist/ui-kit/DialogManager/Dialog.js +2 -2
- package/dist/ui-kit/DialogManager/Dialog.js.map +1 -1
- package/dist/ui-kit/PopupManager/PopupAction.d.ts +2 -0
- package/dist/ui-kit/PopupManager/PopupManager.js +2 -1
- package/dist/ui-kit/PopupManager/PopupManager.js.map +1 -1
- package/lib/common.css +1 -1
- package/lib/components/StickyBottomMenu/BurgerMenuDialog.js +1 -1
- package/lib/components/StickyBottomMenu/BurgerMenuDialog.js.map +1 -1
- package/lib/components/StickyBottomMenu/StickyBottomMenu.mobile.js +26 -28
- package/lib/components/StickyBottomMenu/StickyBottomMenu.mobile.js.map +1 -1
- package/lib/components/StickyBottomMenu/StickyBottomMenuBurger.d.ts +2 -1
- package/lib/components/StickyBottomMenu/StickyBottomMenuBurger.js.map +1 -1
- package/lib/components/StickyBottomMenu/useBurgerMenuDialog.d.ts +3 -0
- package/lib/components/StickyBottomMenu/useBurgerMenuDialog.js +1 -1
- package/lib/components/StickyBottomMenu/useBurgerMenuDialog.js.map +1 -1
- package/lib/ui-kit/DialogManager/Dialog.d.ts +2 -0
- package/lib/ui-kit/DialogManager/Dialog.js +2 -2
- package/lib/ui-kit/DialogManager/Dialog.js.map +1 -1
- package/lib/ui-kit/PopupManager/PopupAction.d.ts +2 -0
- package/lib/ui-kit/PopupManager/PopupManager.js +2 -1
- package/lib/ui-kit/PopupManager/PopupManager.js.map +1 -1
- package/mobile/bundle/bundle.umd.js +37 -39
- package/mobile/bundle/bundle.umd.min.js +1 -1
- package/mobile/bundle/components/StickyBottomMenu/StickyBottomMenuBurger.d.ts +2 -1
- package/mobile/bundle/components/StickyBottomMenu/useBurgerMenuDialog.d.ts +3 -0
- package/mobile/bundle/ui-kit/DialogManager/Dialog.d.ts +2 -0
- package/mobile/bundle/ui-kit/PopupManager/PopupAction.d.ts +2 -0
- package/mobile/dist/components/StickyBottomMenu/BurgerMenuDialog.js +1 -1
- package/mobile/dist/components/StickyBottomMenu/BurgerMenuDialog.js.map +1 -1
- package/mobile/dist/components/StickyBottomMenu/StickyBottomMenu.js +26 -28
- package/mobile/dist/components/StickyBottomMenu/StickyBottomMenu.js.map +1 -1
- package/mobile/dist/components/StickyBottomMenu/StickyBottomMenuBurger.d.ts +2 -1
- package/mobile/dist/components/StickyBottomMenu/StickyBottomMenuBurger.js.map +1 -1
- package/mobile/dist/components/StickyBottomMenu/useBurgerMenuDialog.d.ts +3 -0
- package/mobile/dist/components/StickyBottomMenu/useBurgerMenuDialog.js +1 -1
- package/mobile/dist/components/StickyBottomMenu/useBurgerMenuDialog.js.map +1 -1
- package/mobile/dist/ui-kit/DialogManager/Dialog.d.ts +2 -0
- package/mobile/dist/ui-kit/DialogManager/Dialog.js +2 -2
- package/mobile/dist/ui-kit/DialogManager/Dialog.js.map +1 -1
- package/mobile/dist/ui-kit/PopupManager/PopupAction.d.ts +2 -0
- package/mobile/dist/ui-kit/PopupManager/PopupManager.js +2 -1
- package/mobile/dist/ui-kit/PopupManager/PopupManager.js.map +1 -1
- package/mobile/lib/common.css +1 -1
- package/mobile/lib/components/StickyBottomMenu/BurgerMenuDialog.js +1 -1
- package/mobile/lib/components/StickyBottomMenu/BurgerMenuDialog.js.map +1 -1
- package/mobile/lib/components/StickyBottomMenu/StickyBottomMenu.js +26 -28
- package/mobile/lib/components/StickyBottomMenu/StickyBottomMenu.js.map +1 -1
- package/mobile/lib/components/StickyBottomMenu/StickyBottomMenuBurger.d.ts +2 -1
- package/mobile/lib/components/StickyBottomMenu/StickyBottomMenuBurger.js.map +1 -1
- package/mobile/lib/components/StickyBottomMenu/useBurgerMenuDialog.d.ts +3 -0
- package/mobile/lib/components/StickyBottomMenu/useBurgerMenuDialog.js +1 -1
- package/mobile/lib/components/StickyBottomMenu/useBurgerMenuDialog.js.map +1 -1
- package/mobile/lib/ui-kit/DialogManager/Dialog.d.ts +2 -0
- package/mobile/lib/ui-kit/DialogManager/Dialog.js +2 -2
- package/mobile/lib/ui-kit/DialogManager/Dialog.js.map +1 -1
- package/mobile/lib/ui-kit/PopupManager/PopupAction.d.ts +2 -0
- package/mobile/lib/ui-kit/PopupManager/PopupManager.js +2 -1
- package/mobile/lib/ui-kit/PopupManager/PopupManager.js.map +1 -1
- package/mobile/src/components/StickyBottomMenu/BurgerMenuDialog.tsx +1 -0
- package/mobile/src/components/StickyBottomMenu/StickyBottomMenu.tsx +43 -43
- package/mobile/src/components/StickyBottomMenu/StickyBottomMenuBurger.tsx +2 -1
- package/mobile/src/components/StickyBottomMenu/useBurgerMenuDialog.tsx +4 -2
- package/mobile/src/ui-kit/DialogManager/Dialog.tsx +8 -2
- package/mobile/src/ui-kit/PopupManager/PopupAction.ts +2 -0
- package/mobile/src/ui-kit/PopupManager/PopupManager.tsx +2 -1
- package/package.json +1 -1
- package/src/components/StickyBottomMenu/BurgerMenuDialog.tsx +1 -0
- package/src/components/StickyBottomMenu/StickyBottomMenu.fixture.mobile.tsx +0 -2
- package/src/components/StickyBottomMenu/StickyBottomMenu.mobile.tsx +43 -43
- package/src/components/StickyBottomMenu/StickyBottomMenuBurger.tsx +2 -1
- package/src/components/StickyBottomMenu/useBurgerMenuDialog.tsx +4 -2
- package/src/ui-kit/DialogManager/Dialog.tsx +8 -2
- package/src/ui-kit/PopupManager/PopupAction.ts +2 -0
- package/src/ui-kit/PopupManager/PopupManager.tsx +2 -1
|
@@ -3,8 +3,8 @@ import { useCallback, useEffect, useRef, useState } from '@redneckz/uni-jsx/lib/
|
|
|
3
3
|
import { useBool } from '@redneckz/uni-jsx/lib/hooks/useBool';
|
|
4
4
|
import { useOutsideClick } from '@redneckz/uni-jsx/lib/hooks/useOutsideClick';
|
|
5
5
|
import { BlockWrapper } from '../../ui-kit/BlockWrapper.js';
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
6
|
+
import { Dialog } from '../../ui-kit/DialogManager/Dialog.js';
|
|
7
|
+
import { Heading } from '../../ui-kit/Heading/Heading.js';
|
|
8
8
|
import { UniBlock } from '../../UniBlock/UniBlock.js';
|
|
9
9
|
import { StickyBottomMenuBurger } from './StickyBottomMenuBurger.js';
|
|
10
10
|
import { StickyBottomMenuItem } from './StickyBottomMenuItem.js';
|
|
@@ -13,47 +13,41 @@ const EMPTY_MENU = [];
|
|
|
13
13
|
// eslint-disable-next-line max-lines-per-function
|
|
14
14
|
export const StickyBottomMenu = UniBlock(({ sticky, ...rest }) => {
|
|
15
15
|
const { menuItems = EMPTY_MENU } = sticky ?? {};
|
|
16
|
-
const [isBurgerMenuDialogOpen, { toggle, close }] = useBurgerMenuDialog(rest.options?.page?.sitemap ?? {});
|
|
17
|
-
const popup = usePopupManager();
|
|
16
|
+
const [isBurgerMenuDialogOpen, { toggle, close, openDialog }] = useBurgerMenuDialog(rest.options?.page?.sitemap ?? {});
|
|
18
17
|
const middleIdx = Math.floor(menuItems.length / 2);
|
|
19
18
|
const leftItems = menuItems.slice(0, middleIdx);
|
|
20
19
|
const rightItems = menuItems.slice(middleIdx);
|
|
21
20
|
const [activeIndex, setActiveIndex] = useState(-1);
|
|
22
21
|
const [currentItemPosition, setCurrentItemPosition] = useState('');
|
|
23
|
-
const [
|
|
24
|
-
const
|
|
25
|
-
|
|
22
|
+
const [popupDialogState, { setFalse: setPopupDialogClosed, setTrue: setPopupDialogOpened }] = useBool();
|
|
23
|
+
const closePopupDialog = useCallback(() => {
|
|
24
|
+
setPopupDialogClosed();
|
|
26
25
|
setActiveIndex(-1);
|
|
27
26
|
setCurrentItemPosition('');
|
|
28
|
-
|
|
29
|
-
}, [
|
|
27
|
+
close();
|
|
28
|
+
}, [close]);
|
|
30
29
|
const menuRef = useRef(null);
|
|
31
|
-
const
|
|
32
|
-
const
|
|
33
|
-
|
|
30
|
+
const popupDialogRef = useOutsideClick(closePopupDialog);
|
|
31
|
+
const openPopupDialog = useCallback((index, itemsPosition) => {
|
|
32
|
+
setPopupDialogOpened();
|
|
34
33
|
close();
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
top: -Math.max(globalThis.document?.documentElement?.clientHeight || 0, globalThis.innerHeight || 0) *
|
|
38
|
-
0.7 -
|
|
39
|
-
56,
|
|
40
|
-
left: menuDimensions?.left || 0,
|
|
41
|
-
width: menuDimensions?.width,
|
|
34
|
+
openDialog(_jsx(Dialog, { onClick: (e) => e.stopPropagation(), className: "mt-[20%]", onClose: closePopupDialog, head: _jsx("div", { className: "flex items-center", children: _jsx(Heading, { as: "h4", title: itemsPosition === 'left' ? leftItems[index].title : rightItems[index].title }) }), children: _jsx("div", { className: "bg-white pb-24 pt-1 text-l", ref: popupDialogRef }) }), {
|
|
35
|
+
id: itemsPosition === 'left' ? leftItems[index].title : rightItems[index].title,
|
|
42
36
|
});
|
|
43
|
-
}, [close,
|
|
37
|
+
}, [close, closePopupDialog]);
|
|
44
38
|
const handleMenuItemClick = useCallback((index, itemsPosition) => {
|
|
45
39
|
setCurrentItemPosition(itemsPosition);
|
|
46
40
|
setActiveIndex(index);
|
|
47
|
-
|
|
48
|
-
}, [
|
|
41
|
+
openPopupDialog(index, itemsPosition);
|
|
42
|
+
}, [openPopupDialog]);
|
|
49
43
|
useEffect(() => {
|
|
50
|
-
if (!
|
|
44
|
+
if (!popupDialogRef.current) {
|
|
51
45
|
return;
|
|
52
46
|
}
|
|
53
|
-
if (!
|
|
54
|
-
|
|
47
|
+
if (!popupDialogRef.current.shadowRoot) {
|
|
48
|
+
popupDialogRef.current?.attachShadow({ mode: 'open' });
|
|
55
49
|
}
|
|
56
|
-
const shadowRoot =
|
|
50
|
+
const shadowRoot = popupDialogRef.current.shadowRoot;
|
|
57
51
|
if (!shadowRoot) {
|
|
58
52
|
return;
|
|
59
53
|
}
|
|
@@ -63,8 +57,12 @@ export const StickyBottomMenu = UniBlock(({ sticky, ...rest }) => {
|
|
|
63
57
|
else {
|
|
64
58
|
shadowRoot.innerHTML = rightItems[activeIndex]?.__html || '';
|
|
65
59
|
}
|
|
66
|
-
}, [activeIndex, currentItemPosition,
|
|
67
|
-
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:
|
|
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 }))] }) }));
|
|
68
66
|
});
|
|
69
67
|
const renderMenuItem = (handleMenuItemClick, itemsPosition, currentActiveItem) => (_, i, arr) => {
|
|
70
68
|
return (_jsx(StickyBottomMenuItem, { item: _, isActive: arr[currentActiveItem.activeIndex]?.title === _?.title &&
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StickyBottomMenu.js","sourceRoot":"","sources":["../../../src/components/StickyBottomMenu/StickyBottomMenu.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AACvF,OAAO,EAAE,OAAO,EAAE,MAAM,qCAAqC,CAAC;AAC9D,OAAO,EAAE,eAAe,EAAE,MAAM,6CAA6C,CAAC;AAE9E,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AACzD,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"StickyBottomMenu.js","sourceRoot":"","sources":["../../../src/components/StickyBottomMenu/StickyBottomMenu.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AACvF,OAAO,EAAE,OAAO,EAAE,MAAM,qCAAqC,CAAC;AAC9D,OAAO,EAAE,eAAe,EAAE,MAAM,6CAA6C,CAAC;AAE9E,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AACzD,OAAO,EAAE,MAAM,EAAE,MAAM,mCAAmC,CAAC;AAC3D,OAAO,EAAE,OAAO,EAAE,MAAM,8BAA8B,CAAC;AACvD,OAAO,EAAE,QAAQ,EAAE,M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,EAAE,CAAC,CACnF,IACG,GACO,CAChB,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,MAAM,cAAc,GAClB,CACE,mBAAmE,EACnE,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,mBAAmB,CAAC,CAAC,EAAE,aAAa,CAAC,CAAC;QACxC,CAAC,IATI,CAAC,CAAC,KAAK,IAAI,MAAM,CAAC,CAAC,CAAC,CAUzB,CACH,CAAC;AACJ,CAAC,CAAC"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
import { type PreventableEvent } from '../../ui-kit/PreventableEvent';
|
|
1
2
|
interface StickyBottomMenuBurgerProps {
|
|
2
3
|
isActive?: boolean;
|
|
3
|
-
onClick?: () => void;
|
|
4
|
+
onClick?: (e: PreventableEvent) => void;
|
|
4
5
|
}
|
|
5
6
|
export declare const StickyBottomMenuBurger: import("@redneckz/uni-jsx").UNIComponent<StickyBottomMenuBurgerProps, any, any>;
|
|
6
7
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StickyBottomMenuBurger.js","sourceRoot":"","sources":["../../../src/components/StickyBottomMenu/StickyBottomMenuBurger.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AACxC,OAAO,EAAE,IAAI,EAAE,MAAM,wBAAwB,CAAC;
|
|
1
|
+
{"version":3,"file":"StickyBottomMenuBurger.js","sourceRoot":"","sources":["../../../src/components/StickyBottomMenu/StickyBottomMenuBurger.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AACxC,OAAO,EAAE,IAAI,EAAE,MAAM,wBAAwB,CAAC;AAE9C,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAO1C,MAAM,CAAC,MAAM,sBAAsB,GAAG,GAAG,CAA8B,CAAC,EAAE,QAAQ,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC,CAChG,kBACE,SAAS,EAAE,KAAK,CACd,QAAQ,CAAC,CAAC,CAAC,mBAAmB,CAAC,CAAC,CAAC,mBAAmB,EACpD,2EAA2E,CAC5E,EACD,OAAO,EAAE,OAAO,EAChB,IAAI,EAAC,QAAQ,aAEb,KAAC,IAAI,IAAC,SAAS,EAAC,SAAS,EAAC,IAAI,EAAC,YAAY,EAAC,WAAW,EAAE,QAAQ,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,OAAO,GAAI,gCAElF,CACV,CAAC,CAAC"}
|
|
@@ -1,7 +1,10 @@
|
|
|
1
|
+
import { type VNode } from '../../model/VNode';
|
|
2
|
+
import { type DialogOptions } from '../../ui-kit/DialogManager/useDialogManager';
|
|
1
3
|
import { type BurgerMenuDialogProps } from './BurgerMenuDialog';
|
|
2
4
|
export declare const BURGER_MENU_DIALOG_ID = "burgerMenuDialog";
|
|
3
5
|
export declare const useBurgerMenuDialog: (props: BurgerMenuDialogProps) => [boolean, {
|
|
4
6
|
open: () => void;
|
|
5
7
|
close: () => void;
|
|
6
8
|
toggle: () => void;
|
|
9
|
+
openDialog: (dialog: VNode, options: DialogOptions) => void;
|
|
7
10
|
}];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useBurgerMenuDialog.js","sourceRoot":"","sources":["../../../src/components/StickyBottomMenu/useBurgerMenuDialog.tsx"],"names":[],"mappings":";
|
|
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,EAS5B,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,IAAI,EAAE,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,CAAC,CAAC;AACjE,CAAC,CAAC"}
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { type VNode } from '../../model/VNode';
|
|
2
|
+
import { type PreventableEvent } from '../PreventableEvent';
|
|
2
3
|
export interface DialogProps {
|
|
3
4
|
className?: string;
|
|
4
5
|
head?: VNode;
|
|
5
6
|
onClose?: () => void;
|
|
7
|
+
onClick?: (e: PreventableEvent) => void;
|
|
6
8
|
}
|
|
7
9
|
export declare const Dialog: import("@redneckz/uni-jsx").UNIComponent<DialogProps, any, any>;
|
|
@@ -4,12 +4,12 @@ import { useCallback } from '@redneckz/uni-jsx/lib/hooks';
|
|
|
4
4
|
import { style } from '../../utils/style.js';
|
|
5
5
|
import { CloseButton } from './CloseButton.js';
|
|
6
6
|
import { useDialogManager } from './useDialogManager.js';
|
|
7
|
-
export const Dialog = JSX(({ className, head, children, onClose }) => {
|
|
7
|
+
export const Dialog = JSX(({ className, head, children, onClose, onClick }) => {
|
|
8
8
|
const { close } = useDialogManager();
|
|
9
9
|
const handleClose = useCallback(() => {
|
|
10
10
|
close();
|
|
11
11
|
onClose && onClose();
|
|
12
12
|
}, [onClose]);
|
|
13
|
-
return (_jsxs("div", { 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 })] }));
|
|
13
|
+
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 })] }));
|
|
14
14
|
});
|
|
15
15
|
//# sourceMappingURL=Dialog.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Dialog.js","sourceRoot":"","sources":["../../../src/ui-kit/DialogManager/Dialog.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AACxC,OAAO,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAC;AAE1D,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"Dialog.js","sourceRoot":"","sources":["../../../src/ui-kit/DialogManager/Dialog.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AACxC,OAAO,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAC;AAE1D,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAE1C,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAStD,MAAM,CAAC,MAAM,MAAM,GAAG,GAAG,CAAc,CAAC,EAAE,SAAS,EAAE,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,OAAO,EAAE,EAAE,EAAE;IACzF,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,wCAAwC,EAAE,SAAS,CAAC,EACrE,IAAI,EAAC,QAAQ,aAEb,eAAK,SAAS,EAAC,kCAAkC,aAC/C,KAAC,WAAW,IAAC,SAAS,EAAC,wBAAwB,EAAC,OAAO,EAAE,WAAW,GAAI,EACxE,cAAK,SAAS,EAAC,WAAW,YAAE,IAAI,GAAO,IACnC,EACN,cAAK,SAAS,EAAC,kBAAkB,YAAE,QAAQ,GAAO,IAC9C,CACP,CAAC;AACJ,CAAC,CAAC,CAAC"}
|
|
@@ -4,10 +4,12 @@ export interface PopupOptions {
|
|
|
4
4
|
top: number;
|
|
5
5
|
left: number;
|
|
6
6
|
width?: number;
|
|
7
|
+
fixed?: boolean;
|
|
7
8
|
}
|
|
8
9
|
export interface PopupOpenAction extends PopupOptions {
|
|
9
10
|
type: 'open' | 'update';
|
|
10
11
|
popup: VNode;
|
|
12
|
+
fixed?: boolean;
|
|
11
13
|
}
|
|
12
14
|
export interface PopupCloseAction {
|
|
13
15
|
type: 'close';
|
|
@@ -4,6 +4,7 @@ import { useCallback, useEffect, useState } from '@redneckz/uni-jsx/lib/hooks';
|
|
|
4
4
|
import { useEventListener } from '@redneckz/uni-jsx/lib/hooks/useEventListener';
|
|
5
5
|
import { defaultEventBus } from '../../EventBus/defaultEventBus.js';
|
|
6
6
|
import { assertUnreachable } from '../../utils/assertUnreachable.js';
|
|
7
|
+
import { style } from '../../utils/style.js';
|
|
7
8
|
export const PopupManager = JSX(() => {
|
|
8
9
|
const [popup, setPopup] = useState(null);
|
|
9
10
|
const close = useCallback(() => {
|
|
@@ -28,7 +29,7 @@ export const PopupManager = JSX(() => {
|
|
|
28
29
|
}
|
|
29
30
|
}, [close]);
|
|
30
31
|
useEventListener(globalThis.document, 'keydown', escapeHandler);
|
|
31
|
-
return popup ? (_jsx("div", { className:
|
|
32
|
+
return popup ? (_jsx("div", { className: style('z-50', popup.fixed ? 'fixed' : 'absolute'), style: {
|
|
32
33
|
left: `${popup.left}px`,
|
|
33
34
|
top: `${popup.top}px`,
|
|
34
35
|
...(popup.width ? { width: `${popup.width}px` } : {}),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PopupManager.js","sourceRoot":"","sources":["../../../src/ui-kit/PopupManager/PopupManager.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AACxC,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AAC/E,OAAO,EAAE,gBAAgB,EAAE,MAAM,8CAA8C,CAAC;AAChF,OAAO,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAC;AACjE,OAAO,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;
|
|
1
|
+
{"version":3,"file":"PopupManager.js","sourceRoot":"","sources":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CAAC,QAAQ,EAAE,SAAS,EAAE,aAAa,CAAC,CAAC;IAEhE,OAAO,KAAK,CAAC,CAAC,CAAC,CACb,cACE,SAAS,EAAE,KAAK,CAAC,MAAM,EAAE,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,UAAU,CAAC,EAC5D,KAAK,EAAE;YACL,IAAI,EAAE,GAAG,KAAK,CAAC,IAAI,IAAI;YACvB,GAAG,EAAE,GAAG,KAAK,CAAC,GAAG,IAAI;YACrB,GAAG,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,GAAG,KAAK,CAAC,KAAK,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;SACtD,EACD,IAAI,EAAC,QAAQ,YAEZ,KAAK,CAAC,KAAK,GACR,CACP,CAAC,CAAC,CAAC,IAAI,CAAC;AACX,CAAC,CAAC,CAAC"}
|
|
@@ -3,8 +3,8 @@ import { useBool } from '@redneckz/uni-jsx/lib/hooks/useBool';
|
|
|
3
3
|
import { useOutsideClick } from '@redneckz/uni-jsx/lib/hooks/useOutsideClick';
|
|
4
4
|
import { type StickyMenuItem } from '../../data/StickyMobileData';
|
|
5
5
|
import { BlockWrapper } from '../../ui-kit/BlockWrapper';
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
6
|
+
import { Dialog } from '../../ui-kit/DialogManager/Dialog';
|
|
7
|
+
import { Heading } from '../../ui-kit/Heading/Heading';
|
|
8
8
|
import { UniBlock } from '../../UniBlock/UniBlock';
|
|
9
9
|
import { StickyBottomMenuBurger } from './StickyBottomMenuBurger';
|
|
10
10
|
import { StickyBottomMenuItem } from './StickyBottomMenuItem';
|
|
@@ -21,10 +21,9 @@ interface CurrentActiveItem {
|
|
|
21
21
|
// eslint-disable-next-line max-lines-per-function
|
|
22
22
|
export const StickyBottomMenu = UniBlock<StickyBottomMenuProps>(({ sticky, ...rest }) => {
|
|
23
23
|
const { menuItems = EMPTY_MENU } = sticky ?? {};
|
|
24
|
-
const [isBurgerMenuDialogOpen, { toggle, close }] = useBurgerMenuDialog(
|
|
24
|
+
const [isBurgerMenuDialogOpen, { toggle, close, openDialog }] = useBurgerMenuDialog(
|
|
25
25
|
rest.options?.page?.sitemap ?? {},
|
|
26
26
|
);
|
|
27
|
-
const popup = usePopupManager();
|
|
28
27
|
|
|
29
28
|
const middleIdx = Math.floor(menuItems.length / 2);
|
|
30
29
|
const leftItems = menuItems.slice(0, middleIdx);
|
|
@@ -32,73 +31,67 @@ export const StickyBottomMenu = UniBlock<StickyBottomMenuProps>(({ sticky, ...re
|
|
|
32
31
|
|
|
33
32
|
const [activeIndex, setActiveIndex] = useState(-1);
|
|
34
33
|
const [currentItemPosition, setCurrentItemPosition] = useState<string>('');
|
|
35
|
-
const [
|
|
34
|
+
const [popupDialogState, { setFalse: setPopupDialogClosed, setTrue: setPopupDialogOpened }] =
|
|
35
|
+
useBool();
|
|
36
36
|
|
|
37
|
-
const
|
|
38
|
-
|
|
37
|
+
const closePopupDialog = useCallback(() => {
|
|
38
|
+
setPopupDialogClosed();
|
|
39
39
|
setActiveIndex(-1);
|
|
40
40
|
setCurrentItemPosition('');
|
|
41
|
-
|
|
42
|
-
}, [
|
|
41
|
+
close();
|
|
42
|
+
}, [close]);
|
|
43
43
|
|
|
44
44
|
const menuRef = useRef<HTMLDivElement | null>(null);
|
|
45
|
-
const
|
|
45
|
+
const popupDialogRef = useOutsideClick<HTMLDivElement>(closePopupDialog);
|
|
46
46
|
|
|
47
|
-
const
|
|
47
|
+
const openPopupDialog = useCallback(
|
|
48
48
|
(index: number, itemsPosition: string) => {
|
|
49
|
-
|
|
49
|
+
setPopupDialogOpened();
|
|
50
50
|
close();
|
|
51
|
-
const menuDimensions = menuRef?.current?.getBoundingClientRect();
|
|
52
51
|
|
|
53
|
-
|
|
54
|
-
<
|
|
52
|
+
openDialog(
|
|
53
|
+
<Dialog
|
|
55
54
|
onClick={(e) => e.stopPropagation()}
|
|
56
|
-
className="
|
|
55
|
+
className="mt-[20%]"
|
|
56
|
+
onClose={closePopupDialog}
|
|
57
|
+
head={
|
|
58
|
+
<div className="flex items-center">
|
|
59
|
+
<Heading
|
|
60
|
+
as="h4"
|
|
61
|
+
title={itemsPosition === 'left' ? leftItems[index].title : rightItems[index].title}
|
|
62
|
+
/>
|
|
63
|
+
</div>
|
|
64
|
+
}
|
|
57
65
|
>
|
|
58
|
-
<div className="
|
|
59
|
-
|
|
60
|
-
<CloseButton className="absolute top-0 right-0" onClose={closePopup} />
|
|
61
|
-
</div>
|
|
62
|
-
<div
|
|
63
|
-
className="bg-white text-l h-[70vh] overflow-y-auto no-scrollbar"
|
|
64
|
-
ref={popupRef}
|
|
65
|
-
></div>
|
|
66
|
-
</div>,
|
|
66
|
+
<div className="bg-white pb-24 pt-1 text-l" ref={popupDialogRef}></div>
|
|
67
|
+
</Dialog>,
|
|
67
68
|
{
|
|
68
|
-
|
|
69
|
-
-Math.max(
|
|
70
|
-
globalThis.document?.documentElement?.clientHeight || 0,
|
|
71
|
-
globalThis.innerHeight || 0,
|
|
72
|
-
) *
|
|
73
|
-
0.7 -
|
|
74
|
-
56,
|
|
75
|
-
left: menuDimensions?.left || 0,
|
|
76
|
-
width: menuDimensions?.width,
|
|
69
|
+
id: itemsPosition === 'left' ? leftItems[index].title : rightItems[index].title,
|
|
77
70
|
},
|
|
78
71
|
);
|
|
79
72
|
},
|
|
80
|
-
[close,
|
|
73
|
+
[close, closePopupDialog],
|
|
81
74
|
);
|
|
82
75
|
|
|
83
76
|
const handleMenuItemClick = useCallback(
|
|
84
77
|
(index: number, itemsPosition: string) => {
|
|
85
78
|
setCurrentItemPosition(itemsPosition);
|
|
86
79
|
setActiveIndex(index);
|
|
87
|
-
|
|
80
|
+
openPopupDialog(index, itemsPosition);
|
|
88
81
|
},
|
|
89
|
-
[
|
|
82
|
+
[openPopupDialog],
|
|
90
83
|
);
|
|
91
84
|
|
|
92
85
|
useEffect(() => {
|
|
93
|
-
if (!
|
|
86
|
+
if (!popupDialogRef.current) {
|
|
94
87
|
return;
|
|
95
88
|
}
|
|
96
89
|
|
|
97
|
-
if (!
|
|
98
|
-
|
|
90
|
+
if (!popupDialogRef.current.shadowRoot) {
|
|
91
|
+
popupDialogRef.current?.attachShadow({ mode: 'open' });
|
|
99
92
|
}
|
|
100
93
|
|
|
101
|
-
const shadowRoot =
|
|
94
|
+
const shadowRoot = popupDialogRef.current.shadowRoot;
|
|
102
95
|
if (!shadowRoot) {
|
|
103
96
|
return;
|
|
104
97
|
}
|
|
@@ -108,7 +101,7 @@ export const StickyBottomMenu = UniBlock<StickyBottomMenuProps>(({ sticky, ...re
|
|
|
108
101
|
} else {
|
|
109
102
|
shadowRoot.innerHTML = rightItems[activeIndex]?.__html || '';
|
|
110
103
|
}
|
|
111
|
-
}, [activeIndex, currentItemPosition,
|
|
104
|
+
}, [activeIndex, currentItemPosition, popupDialogState]);
|
|
112
105
|
|
|
113
106
|
return (
|
|
114
107
|
<BlockWrapper className="h-[74px] z-[100] relative" defaultPadding="p-0" {...rest}>
|
|
@@ -119,7 +112,14 @@ export const StickyBottomMenu = UniBlock<StickyBottomMenuProps>(({ sticky, ...re
|
|
|
119
112
|
{leftItems.map(
|
|
120
113
|
renderMenuItem(handleMenuItemClick, 'left', { activeIndex, currentItemPosition }),
|
|
121
114
|
)}
|
|
122
|
-
<StickyBottomMenuBurger
|
|
115
|
+
<StickyBottomMenuBurger
|
|
116
|
+
isActive={isBurgerMenuDialogOpen}
|
|
117
|
+
onClick={(e) => {
|
|
118
|
+
closePopupDialog();
|
|
119
|
+
e.stopPropagation();
|
|
120
|
+
toggle();
|
|
121
|
+
}}
|
|
122
|
+
/>
|
|
123
123
|
{rightItems.map(
|
|
124
124
|
renderMenuItem(handleMenuItemClick, 'right', { activeIndex, currentItemPosition }),
|
|
125
125
|
)}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { JSX } from '@redneckz/uni-jsx';
|
|
2
2
|
import { Icon } from '../../ui-kit/Icon/Icon';
|
|
3
|
+
import { type PreventableEvent } from '../../ui-kit/PreventableEvent';
|
|
3
4
|
import { style } from '../../utils/style';
|
|
4
5
|
|
|
5
6
|
interface StickyBottomMenuBurgerProps {
|
|
6
7
|
isActive?: boolean;
|
|
7
|
-
onClick?: () => void;
|
|
8
|
+
onClick?: (e: PreventableEvent) => void;
|
|
8
9
|
}
|
|
9
10
|
|
|
10
11
|
export const StickyBottomMenuBurger = JSX<StickyBottomMenuBurgerProps>(({ isActive, onClick }) => (
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
import { type VNode } from '../../model/VNode';
|
|
1
2
|
import { isDialogOpen } from '../../ui-kit/DialogManager/isDialogOpen';
|
|
2
|
-
import { useDialogManager } from '../../ui-kit/DialogManager/useDialogManager';
|
|
3
|
+
import { useDialogManager, type DialogOptions } from '../../ui-kit/DialogManager/useDialogManager';
|
|
3
4
|
import { useDialogsList } from '../../ui-kit/DialogManager/useDialogsList';
|
|
4
5
|
import { BurgerMenuDialog, type BurgerMenuDialogProps } from './BurgerMenuDialog';
|
|
5
6
|
|
|
@@ -13,6 +14,7 @@ export const useBurgerMenuDialog = (
|
|
|
13
14
|
open: () => void;
|
|
14
15
|
close: () => void;
|
|
15
16
|
toggle: () => void;
|
|
17
|
+
openDialog: (dialog: VNode, options: DialogOptions) => void;
|
|
16
18
|
},
|
|
17
19
|
] => {
|
|
18
20
|
const { open: openDialog, closeAll, close } = useDialogManager();
|
|
@@ -29,5 +31,5 @@ export const useBurgerMenuDialog = (
|
|
|
29
31
|
}
|
|
30
32
|
};
|
|
31
33
|
|
|
32
|
-
return [isBurgerMenuOpen, { open, close, toggle }];
|
|
34
|
+
return [isBurgerMenuOpen, { open, close, toggle, openDialog }];
|
|
33
35
|
};
|
|
@@ -2,6 +2,7 @@ import { JSX } from '@redneckz/uni-jsx';
|
|
|
2
2
|
import { useCallback } from '@redneckz/uni-jsx/lib/hooks';
|
|
3
3
|
import { type VNode } from '../../model/VNode';
|
|
4
4
|
import { style } from '../../utils/style';
|
|
5
|
+
import { type PreventableEvent } from '../PreventableEvent';
|
|
5
6
|
import { CloseButton } from './CloseButton';
|
|
6
7
|
import { useDialogManager } from './useDialogManager';
|
|
7
8
|
|
|
@@ -9,9 +10,10 @@ export interface DialogProps {
|
|
|
9
10
|
className?: string;
|
|
10
11
|
head?: VNode;
|
|
11
12
|
onClose?: () => void;
|
|
13
|
+
onClick?: (e: PreventableEvent) => void;
|
|
12
14
|
}
|
|
13
15
|
|
|
14
|
-
export const Dialog = JSX<DialogProps>(({ className, head, children, onClose }) => {
|
|
16
|
+
export const Dialog = JSX<DialogProps>(({ className, head, children, onClose, onClick }) => {
|
|
15
17
|
const { close } = useDialogManager();
|
|
16
18
|
|
|
17
19
|
const handleClose = useCallback(() => {
|
|
@@ -20,7 +22,11 @@ export const Dialog = JSX<DialogProps>(({ className, head, children, onClose })
|
|
|
20
22
|
}, [onClose]);
|
|
21
23
|
|
|
22
24
|
return (
|
|
23
|
-
<div
|
|
25
|
+
<div
|
|
26
|
+
onClick={onClick}
|
|
27
|
+
className={style('relative min-h-full bg-white pt-0 p-lg', className)}
|
|
28
|
+
role="dialog"
|
|
29
|
+
>
|
|
24
30
|
<div className="sticky py-xl top-0 bg-white z-10">
|
|
25
31
|
<CloseButton className="absolute top-0 right-0" onClose={handleClose} />
|
|
26
32
|
<div className="container">{head}</div>
|
|
@@ -6,11 +6,13 @@ export interface PopupOptions {
|
|
|
6
6
|
top: number;
|
|
7
7
|
left: number;
|
|
8
8
|
width?: number;
|
|
9
|
+
fixed?: boolean;
|
|
9
10
|
}
|
|
10
11
|
|
|
11
12
|
export interface PopupOpenAction extends PopupOptions {
|
|
12
13
|
type: 'open' | 'update';
|
|
13
14
|
popup: VNode;
|
|
15
|
+
fixed?: boolean;
|
|
14
16
|
}
|
|
15
17
|
|
|
16
18
|
export interface PopupCloseAction {
|
|
@@ -3,6 +3,7 @@ import { useCallback, useEffect, useState } from '@redneckz/uni-jsx/lib/hooks';
|
|
|
3
3
|
import { useEventListener } from '@redneckz/uni-jsx/lib/hooks/useEventListener';
|
|
4
4
|
import { defaultEventBus } from '../../EventBus/defaultEventBus';
|
|
5
5
|
import { assertUnreachable } from '../../utils/assertUnreachable';
|
|
6
|
+
import { style } from '../../utils/style';
|
|
6
7
|
import { type PopupOpenAction } from './PopupAction';
|
|
7
8
|
|
|
8
9
|
export const PopupManager = JSX(() => {
|
|
@@ -43,7 +44,7 @@ export const PopupManager = JSX(() => {
|
|
|
43
44
|
|
|
44
45
|
return popup ? (
|
|
45
46
|
<div
|
|
46
|
-
className=
|
|
47
|
+
className={style('z-50', popup.fixed ? 'fixed' : 'absolute')}
|
|
47
48
|
style={{
|
|
48
49
|
left: `${popup.left}px`,
|
|
49
50
|
top: `${popup.top}px`,
|
package/package.json
CHANGED
|
@@ -2,7 +2,6 @@ import '../../setup-fixture';
|
|
|
2
2
|
|
|
3
3
|
import { type BlockRendererOptions } from '../../BlockRenderer/BlockRendererOptions';
|
|
4
4
|
import { DialogManager } from '../../ui-kit/DialogManager/DialogManager';
|
|
5
|
-
import { PopupManager } from '../../ui-kit/PopupManager/PopupManager';
|
|
6
5
|
import { StickyBottomMenu } from './StickyBottomMenu';
|
|
7
6
|
|
|
8
7
|
const options = {
|
|
@@ -16,7 +15,6 @@ export default {
|
|
|
16
15
|
options={options}
|
|
17
16
|
sticky={{ $ref: '/wcms-resources/sticky-mobile-menu.json' }}
|
|
18
17
|
/>
|
|
19
|
-
<PopupManager />
|
|
20
18
|
<DialogManager />
|
|
21
19
|
</div>
|
|
22
20
|
),
|