@redneckz/wildless-cms-uni-blocks 0.14.256 → 0.14.258
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 +3 -3
- 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/dist/components/StickyBottomMenu/ActiveSubMenuItem.js +1 -1
- package/dist/components/StickyBottomMenu/ActiveSubMenuItem.js.map +1 -1
- package/dist/components/StickyBottomMenu/BurgerMenuDialog.js +8 -3
- package/dist/components/StickyBottomMenu/BurgerMenuDialog.js.map +1 -1
- package/dist/components/StickyBottomMenu/StickyBottomMenu.mobile.js +26 -29
- 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/lib/common.css +1 -1
- package/lib/components/StickyBottomMenu/ActiveSubMenuItem.js +1 -1
- package/lib/components/StickyBottomMenu/ActiveSubMenuItem.js.map +1 -1
- package/lib/components/StickyBottomMenu/BurgerMenuDialog.js +8 -3
- package/lib/components/StickyBottomMenu/BurgerMenuDialog.js.map +1 -1
- package/lib/components/StickyBottomMenu/StickyBottomMenu.mobile.js +26 -29
- 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/LocationDialog/renderForeignOffices.d.ts +0 -1
- package/lib/ui-kit/LocationDialog/renderRegion.d.ts +0 -1
- package/lib/ui-kit/LocationDialog/renderRegionGroup.d.ts +0 -1
- package/mobile/bundle/bundle.umd.js +162 -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/dist/components/StickyBottomMenu/ActiveSubMenuItem.js +1 -1
- package/mobile/dist/components/StickyBottomMenu/ActiveSubMenuItem.js.map +1 -1
- package/mobile/dist/components/StickyBottomMenu/BurgerMenuDialog.js +8 -3
- package/mobile/dist/components/StickyBottomMenu/BurgerMenuDialog.js.map +1 -1
- package/mobile/dist/components/StickyBottomMenu/StickyBottomMenu.js +26 -29
- 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/lib/common.css +1 -1
- package/mobile/lib/components/StickyBottomMenu/ActiveSubMenuItem.js +1 -1
- package/mobile/lib/components/StickyBottomMenu/ActiveSubMenuItem.js.map +1 -1
- package/mobile/lib/components/StickyBottomMenu/BurgerMenuDialog.js +8 -3
- package/mobile/lib/components/StickyBottomMenu/BurgerMenuDialog.js.map +1 -1
- package/mobile/lib/components/StickyBottomMenu/StickyBottomMenu.js +26 -29
- 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/src/components/StickyBottomMenu/ActiveSubMenuItem.tsx +1 -1
- package/mobile/src/components/StickyBottomMenu/BurgerMenuDialog.tsx +34 -3
- package/mobile/src/components/StickyBottomMenu/StickyBottomMenu.tsx +43 -44
- 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/package.json +1 -1
- package/src/components/StickyBottomMenu/ActiveSubMenuItem.tsx +1 -1
- package/src/components/StickyBottomMenu/BurgerMenuDialog.tsx +34 -3
- package/src/components/StickyBottomMenu/StickyBottomMenu.fixture.mobile.tsx +0 -2
- package/src/components/StickyBottomMenu/StickyBottomMenu.mobile.tsx +43 -44
- 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
|
@@ -3,10 +3,13 @@ import { useCallback, useEffect, useMemo, useState } from '@redneckz/uni-jsx/lib
|
|
|
3
3
|
import { type RefObject } from 'react';
|
|
4
4
|
import { type SitemapData } from '../../data/SitemapData';
|
|
5
5
|
import { useActiveRoute } from '../../hooks/useActiveRoute';
|
|
6
|
+
import { useLocation } from '../../hooks/useLocation';
|
|
7
|
+
import { type Region } from '../../hooks/useRegions';
|
|
6
8
|
import { type LinkProps } from '../../model/LinkProps';
|
|
7
9
|
import { Dialog } from '../../ui-kit/DialogManager/Dialog';
|
|
8
10
|
import { Heading } from '../../ui-kit/Heading/Heading';
|
|
9
11
|
import { Img } from '../../ui-kit/Img/Img';
|
|
12
|
+
import { useLocationDialog } from '../../ui-kit/LocationDialog/useLocationDialog';
|
|
10
13
|
import { SwipeListContainer } from '../../ui-kit/SwipeListControl/SwipeListContainer';
|
|
11
14
|
import { useSwipeListScroll } from '../../ui-kit/SwipeListControl/useSwipeListScroll';
|
|
12
15
|
import { style } from '../../utils/style';
|
|
@@ -18,7 +21,10 @@ export interface BurgerMenuDialogProps extends SitemapData {
|
|
|
18
21
|
}
|
|
19
22
|
|
|
20
23
|
export const BurgerMenuDialog = JSX<BurgerMenuDialogProps>((props) => {
|
|
21
|
-
const { topItems, officesLink } = props;
|
|
24
|
+
const { topItems, defaultLocation, officesLink } = props;
|
|
25
|
+
|
|
26
|
+
const [location] = useLocation(defaultLocation);
|
|
27
|
+
const locationDialog = useLocationDialog(props);
|
|
22
28
|
|
|
23
29
|
const [containerRef, scroll] = useSwipeListScroll<HTMLDivElement>({
|
|
24
30
|
itemCount: topItems?.length ?? 0,
|
|
@@ -42,6 +48,7 @@ export const BurgerMenuDialog = JSX<BurgerMenuDialogProps>((props) => {
|
|
|
42
48
|
|
|
43
49
|
return (
|
|
44
50
|
<Dialog
|
|
51
|
+
onClick={(e) => e.stopPropagation()}
|
|
45
52
|
head={
|
|
46
53
|
<div className="flex items-center">
|
|
47
54
|
<Heading as="h4" title="Меню" />
|
|
@@ -69,6 +76,7 @@ export const BurgerMenuDialog = JSX<BurgerMenuDialogProps>((props) => {
|
|
|
69
76
|
<div className="relative grow">
|
|
70
77
|
{renderActiveSubMenu(activeMenuSubItems, activeRoute?.href)}
|
|
71
78
|
{renderOfficeLink(officesLink)}
|
|
79
|
+
{renderLocation(location, () => locationDialog.open())}
|
|
72
80
|
</div>
|
|
73
81
|
</div>
|
|
74
82
|
</Dialog>
|
|
@@ -90,7 +98,7 @@ const renderOfficeLink = (officesLink?: string) =>
|
|
|
90
98
|
<a
|
|
91
99
|
className={style(
|
|
92
100
|
'text-primary-text',
|
|
93
|
-
`
|
|
101
|
+
`p-4 text-h5 font-light flex justify-between cursor-pointer`,
|
|
94
102
|
'shadow-main-black',
|
|
95
103
|
'rounded-xl',
|
|
96
104
|
)}
|
|
@@ -98,7 +106,7 @@ const renderOfficeLink = (officesLink?: string) =>
|
|
|
98
106
|
rel="noopener noreferrer"
|
|
99
107
|
aria-label="Отделения и банкоматы"
|
|
100
108
|
>
|
|
101
|
-
<span
|
|
109
|
+
<span>Офисы и банкоматы</span>
|
|
102
110
|
<Img
|
|
103
111
|
image={{ icon: 'ArrowRightIcon', iconVersion: 'color' }}
|
|
104
112
|
width="24"
|
|
@@ -108,3 +116,26 @@ const renderOfficeLink = (officesLink?: string) =>
|
|
|
108
116
|
</a>
|
|
109
117
|
</div>
|
|
110
118
|
) : null;
|
|
119
|
+
|
|
120
|
+
const renderLocation = (location: Region, onClick?: () => void) => (
|
|
121
|
+
<div
|
|
122
|
+
className={style(
|
|
123
|
+
'text-primary-text',
|
|
124
|
+
`p-4 text-h5 font-light flex justify-between cursor-pointer`,
|
|
125
|
+
'shadow-main-black',
|
|
126
|
+
'rounded-xl',
|
|
127
|
+
'mt-3',
|
|
128
|
+
)}
|
|
129
|
+
onClick={onClick}
|
|
130
|
+
>
|
|
131
|
+
<div className="flex flex-col items-start">
|
|
132
|
+
<span>Ваша локация - {location.name}</span>
|
|
133
|
+
</div>
|
|
134
|
+
<Img
|
|
135
|
+
image={{ icon: 'ArrowRightIcon', iconVersion: 'color' }}
|
|
136
|
+
width="24"
|
|
137
|
+
height="24"
|
|
138
|
+
className="text-secondary-text opacity-30"
|
|
139
|
+
/>
|
|
140
|
+
</div>
|
|
141
|
+
);
|
|
@@ -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
|
),
|
|
@@ -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,74 +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.3 -
|
|
74
|
-
134,
|
|
75
|
-
left: menuDimensions?.left || 0,
|
|
76
|
-
width: menuDimensions?.width,
|
|
77
|
-
fixed: true,
|
|
69
|
+
id: itemsPosition === 'left' ? leftItems[index].title : rightItems[index].title,
|
|
78
70
|
},
|
|
79
71
|
);
|
|
80
72
|
},
|
|
81
|
-
[close,
|
|
73
|
+
[close, closePopupDialog],
|
|
82
74
|
);
|
|
83
75
|
|
|
84
76
|
const handleMenuItemClick = useCallback(
|
|
85
77
|
(index: number, itemsPosition: string) => {
|
|
86
78
|
setCurrentItemPosition(itemsPosition);
|
|
87
79
|
setActiveIndex(index);
|
|
88
|
-
|
|
80
|
+
openPopupDialog(index, itemsPosition);
|
|
89
81
|
},
|
|
90
|
-
[
|
|
82
|
+
[openPopupDialog],
|
|
91
83
|
);
|
|
92
84
|
|
|
93
85
|
useEffect(() => {
|
|
94
|
-
if (!
|
|
86
|
+
if (!popupDialogRef.current) {
|
|
95
87
|
return;
|
|
96
88
|
}
|
|
97
89
|
|
|
98
|
-
if (!
|
|
99
|
-
|
|
90
|
+
if (!popupDialogRef.current.shadowRoot) {
|
|
91
|
+
popupDialogRef.current?.attachShadow({ mode: 'open' });
|
|
100
92
|
}
|
|
101
93
|
|
|
102
|
-
const shadowRoot =
|
|
94
|
+
const shadowRoot = popupDialogRef.current.shadowRoot;
|
|
103
95
|
if (!shadowRoot) {
|
|
104
96
|
return;
|
|
105
97
|
}
|
|
@@ -109,7 +101,7 @@ export const StickyBottomMenu = UniBlock<StickyBottomMenuProps>(({ sticky, ...re
|
|
|
109
101
|
} else {
|
|
110
102
|
shadowRoot.innerHTML = rightItems[activeIndex]?.__html || '';
|
|
111
103
|
}
|
|
112
|
-
}, [activeIndex, currentItemPosition,
|
|
104
|
+
}, [activeIndex, currentItemPosition, popupDialogState]);
|
|
113
105
|
|
|
114
106
|
return (
|
|
115
107
|
<BlockWrapper className="h-[74px] z-[100] relative" defaultPadding="p-0" {...rest}>
|
|
@@ -120,7 +112,14 @@ export const StickyBottomMenu = UniBlock<StickyBottomMenuProps>(({ sticky, ...re
|
|
|
120
112
|
{leftItems.map(
|
|
121
113
|
renderMenuItem(handleMenuItemClick, 'left', { activeIndex, currentItemPosition }),
|
|
122
114
|
)}
|
|
123
|
-
<StickyBottomMenuBurger
|
|
115
|
+
<StickyBottomMenuBurger
|
|
116
|
+
isActive={isBurgerMenuDialogOpen}
|
|
117
|
+
onClick={(e) => {
|
|
118
|
+
closePopupDialog();
|
|
119
|
+
e.stopPropagation();
|
|
120
|
+
toggle();
|
|
121
|
+
}}
|
|
122
|
+
/>
|
|
124
123
|
{rightItems.map(
|
|
125
124
|
renderMenuItem(handleMenuItemClick, 'right', { activeIndex, currentItemPosition }),
|
|
126
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>
|