@redneckz/wildless-cms-uni-blocks 0.14.875 → 0.14.876
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 +78 -46
- package/bundle/bundle.umd.min.js +1 -1
- package/bundle/components/Header/DropdownButton.d.ts +2 -0
- package/bundle/components/Header/DropdownMenu.d.ts +5 -2
- package/bundle/components/Header/HeaderMoreMenuItem.d.ts +9 -0
- package/bundle/components/Header/HeaderSubMenuItem.d.ts +3 -0
- package/bundle/components/Header/useDropdownSubMenu.d.ts +11 -0
- package/bundle/data/NavigationData.d.ts +1 -0
- package/dist/components/Header/DropdownButton.d.ts +2 -0
- package/dist/components/Header/DropdownButton.js +11 -0
- package/dist/components/Header/DropdownButton.js.map +1 -0
- package/dist/components/Header/DropdownMenu.d.ts +5 -2
- package/dist/components/Header/DropdownMenu.js +2 -36
- package/dist/components/Header/DropdownMenu.js.map +1 -1
- package/dist/components/Header/HeaderMoreMenuItem.d.ts +9 -0
- package/dist/components/Header/HeaderMoreMenuItem.js +27 -0
- package/dist/components/Header/HeaderMoreMenuItem.js.map +1 -0
- package/dist/components/Header/HeaderSubMenu.js +2 -2
- package/dist/components/Header/HeaderSubMenu.js.map +1 -1
- package/dist/components/Header/HeaderSubMenuItem.d.ts +3 -0
- package/dist/components/Header/HeaderSubMenuItem.js +19 -2
- package/dist/components/Header/HeaderSubMenuItem.js.map +1 -1
- package/dist/components/Header/HeaderTopMenu.js +2 -2
- package/dist/components/Header/HeaderTopMenu.js.map +1 -1
- package/dist/components/Header/useDropdownSubMenu.d.ts +11 -0
- package/dist/components/Header/useDropdownSubMenu.js +37 -0
- package/dist/components/Header/useDropdownSubMenu.js.map +1 -0
- package/dist/data/NavigationData.d.ts +1 -0
- package/lib/components/Header/DropdownButton.d.ts +2 -0
- package/lib/components/Header/DropdownButton.js +9 -0
- package/lib/components/Header/DropdownButton.js.map +1 -0
- package/lib/components/Header/DropdownMenu.d.ts +5 -2
- package/lib/components/Header/DropdownMenu.js +2 -37
- package/lib/components/Header/DropdownMenu.js.map +1 -1
- package/lib/components/Header/HeaderMoreMenuItem.d.ts +9 -0
- package/lib/components/Header/HeaderMoreMenuItem.js +25 -0
- package/lib/components/Header/HeaderMoreMenuItem.js.map +1 -0
- package/lib/components/Header/HeaderSubMenu.js +2 -2
- package/lib/components/Header/HeaderSubMenu.js.map +1 -1
- package/lib/components/Header/HeaderSubMenuItem.d.ts +3 -0
- package/lib/components/Header/HeaderSubMenuItem.js +20 -3
- package/lib/components/Header/HeaderSubMenuItem.js.map +1 -1
- package/lib/components/Header/HeaderTopMenu.js +2 -2
- package/lib/components/Header/HeaderTopMenu.js.map +1 -1
- package/lib/components/Header/useDropdownSubMenu.d.ts +11 -0
- package/lib/components/Header/useDropdownSubMenu.js +34 -0
- package/lib/components/Header/useDropdownSubMenu.js.map +1 -0
- package/lib/data/NavigationData.d.ts +1 -0
- package/mobile/bundle/bundle.umd.js +1 -1
- package/mobile/bundle/bundle.umd.min.js +1 -1
- package/mobile/bundle/components/Header/DropdownButton.d.ts +2 -0
- package/mobile/bundle/components/Header/DropdownMenu.d.ts +5 -2
- package/mobile/bundle/components/Header/HeaderMoreMenuItem.d.ts +9 -0
- package/mobile/bundle/components/Header/HeaderSubMenuItem.d.ts +3 -0
- package/mobile/bundle/components/Header/useDropdownSubMenu.d.ts +11 -0
- package/mobile/bundle/data/NavigationData.d.ts +1 -0
- package/mobile/dist/components/Header/DropdownButton.d.ts +2 -0
- package/mobile/dist/components/Header/DropdownButton.js +11 -0
- package/mobile/dist/components/Header/DropdownButton.js.map +1 -0
- package/mobile/dist/components/Header/DropdownMenu.d.ts +5 -2
- package/mobile/dist/components/Header/DropdownMenu.js +2 -36
- package/mobile/dist/components/Header/DropdownMenu.js.map +1 -1
- package/mobile/dist/components/Header/HeaderMoreMenuItem.d.ts +9 -0
- package/mobile/dist/components/Header/HeaderMoreMenuItem.js +27 -0
- package/mobile/dist/components/Header/HeaderMoreMenuItem.js.map +1 -0
- package/mobile/dist/components/Header/HeaderSubMenu.js +2 -2
- package/mobile/dist/components/Header/HeaderSubMenu.js.map +1 -1
- package/mobile/dist/components/Header/HeaderSubMenuItem.d.ts +3 -0
- package/mobile/dist/components/Header/HeaderSubMenuItem.js +19 -2
- package/mobile/dist/components/Header/HeaderSubMenuItem.js.map +1 -1
- package/mobile/dist/components/Header/HeaderTopMenu.js +2 -2
- package/mobile/dist/components/Header/HeaderTopMenu.js.map +1 -1
- package/mobile/dist/components/Header/useDropdownSubMenu.d.ts +11 -0
- package/mobile/dist/components/Header/useDropdownSubMenu.js +37 -0
- package/mobile/dist/components/Header/useDropdownSubMenu.js.map +1 -0
- package/mobile/dist/data/NavigationData.d.ts +1 -0
- package/mobile/lib/components/Header/DropdownButton.d.ts +2 -0
- package/mobile/lib/components/Header/DropdownButton.js +9 -0
- package/mobile/lib/components/Header/DropdownButton.js.map +1 -0
- package/mobile/lib/components/Header/DropdownMenu.d.ts +5 -2
- package/mobile/lib/components/Header/DropdownMenu.js +2 -37
- package/mobile/lib/components/Header/DropdownMenu.js.map +1 -1
- package/mobile/lib/components/Header/HeaderMoreMenuItem.d.ts +9 -0
- package/mobile/lib/components/Header/HeaderMoreMenuItem.js +25 -0
- package/mobile/lib/components/Header/HeaderMoreMenuItem.js.map +1 -0
- package/mobile/lib/components/Header/HeaderSubMenu.js +2 -2
- package/mobile/lib/components/Header/HeaderSubMenu.js.map +1 -1
- package/mobile/lib/components/Header/HeaderSubMenuItem.d.ts +3 -0
- package/mobile/lib/components/Header/HeaderSubMenuItem.js +20 -3
- package/mobile/lib/components/Header/HeaderSubMenuItem.js.map +1 -1
- package/mobile/lib/components/Header/HeaderTopMenu.js +2 -2
- package/mobile/lib/components/Header/HeaderTopMenu.js.map +1 -1
- package/mobile/lib/components/Header/useDropdownSubMenu.d.ts +11 -0
- package/mobile/lib/components/Header/useDropdownSubMenu.js +34 -0
- package/mobile/lib/components/Header/useDropdownSubMenu.js.map +1 -0
- package/mobile/lib/data/NavigationData.d.ts +1 -0
- package/mobile/src/components/Header/DropdownButton.tsx +26 -0
- package/mobile/src/components/Header/DropdownMenu.tsx +15 -85
- package/mobile/src/components/Header/HeaderMoreMenuItem.tsx +60 -0
- package/mobile/src/components/Header/HeaderSubMenu.tsx +3 -2
- package/mobile/src/components/Header/HeaderSubMenuItem.tsx +31 -5
- package/mobile/src/components/Header/HeaderTopMenu.tsx +3 -3
- package/mobile/src/components/Header/useDropdownSubMenu.tsx +48 -0
- package/mobile/src/data/NavigationData.ts +1 -0
- package/package.json +1 -1
- package/src/components/Header/DropdownButton.tsx +26 -0
- package/src/components/Header/DropdownMenu.tsx +15 -85
- package/src/components/Header/Header.fixture.tsx +4 -0
- package/src/components/Header/HeaderMoreMenuItem.tsx +60 -0
- package/src/components/Header/HeaderSubMenu.tsx +3 -2
- package/src/components/Header/HeaderSubMenuItem.tsx +31 -5
- package/src/components/Header/HeaderTopMenu.tsx +3 -3
- package/src/components/Header/useDropdownSubMenu.tsx +48 -0
- package/src/data/NavigationData.ts +1 -0
- package/src/icons/IconName.ts +4 -4
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
import { type ComponentType } from '../../model/ComponentType';
|
|
2
2
|
import { type LinkProps } from '../../model/LinkProps';
|
|
3
3
|
interface DropdownMenuProps extends ComponentType {
|
|
4
|
-
|
|
4
|
+
dropdownRef?: {
|
|
5
|
+
current: HTMLDivElement | null;
|
|
6
|
+
};
|
|
7
|
+
items?: LinkProps[];
|
|
5
8
|
activeItem?: LinkProps;
|
|
6
9
|
ariaLabel?: string;
|
|
7
10
|
}
|
|
8
|
-
export declare const DropdownMenu:
|
|
11
|
+
export declare const DropdownMenu: ({ dropdownRef, items, activeItem, ariaLabel, }: DropdownMenuProps) => any;
|
|
9
12
|
export declare const DropdownMenuItem: import("@redneckz/uni-jsx").UNIComponent<LinkProps & {
|
|
10
13
|
isActive?: boolean | undefined;
|
|
11
14
|
}, any, any>;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { type ComponentType } from '../../model/ComponentType';
|
|
2
|
+
import { type LinkProps } from '../../model/LinkProps';
|
|
3
|
+
interface HeaderMoreMenuItemProps extends ComponentType {
|
|
4
|
+
items: LinkProps[];
|
|
5
|
+
activeItem?: LinkProps;
|
|
6
|
+
ariaLabel?: string;
|
|
7
|
+
}
|
|
8
|
+
export declare const HeaderMoreMenuItem: import("@redneckz/uni-jsx").UNIComponent<HeaderMoreMenuItemProps, any, any>;
|
|
9
|
+
export {};
|
|
@@ -1,9 +1,12 @@
|
|
|
1
|
+
import { type NavigationLinkProps } from '../../data/NavigationData';
|
|
1
2
|
import { type IntersectionObserverOptions } from '../../hooks/useIntersectionObserver';
|
|
2
3
|
import { type ComponentType } from '../../model/ComponentType';
|
|
3
4
|
import { type LinkProps } from '../../model/LinkProps';
|
|
4
5
|
export interface HeaderSubMenuItemProps extends LinkProps, ComponentType {
|
|
5
6
|
active?: boolean;
|
|
7
|
+
activeItem?: LinkProps;
|
|
6
8
|
observerOptions?: IntersectionObserverOptions;
|
|
7
9
|
onVisibilityChange?: (isIntersecting: boolean) => void;
|
|
10
|
+
items?: NavigationLinkProps[];
|
|
8
11
|
}
|
|
9
12
|
export declare const HeaderSubMenuItem: import("@redneckz/uni-jsx").UNIComponent<HeaderSubMenuItemProps, any, any>;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { type LinkProps } from '../../model/LinkProps';
|
|
2
|
+
import type { OnCloseProps } from '../../model/OnCloseProps';
|
|
3
|
+
interface DropdownSubMenuOptions extends OnCloseProps {
|
|
4
|
+
isOpen?: boolean;
|
|
5
|
+
activeItem?: LinkProps;
|
|
6
|
+
items?: LinkProps[];
|
|
7
|
+
}
|
|
8
|
+
export declare function useDropdownSubMenu({ items, activeItem, onClose, isOpen }: DropdownSubMenuOptions): {
|
|
9
|
+
current: HTMLDivElement | null;
|
|
10
|
+
};
|
|
11
|
+
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
2
|
+
exports.DropdownButton = void 0;
|
|
3
|
+
const jsx_runtime_1 = require("@redneckz/uni-jsx/jsx-runtime");
|
|
4
|
+
const uni_jsx_1 = require("@redneckz/uni-jsx");
|
|
5
|
+
exports.DropdownButton = (0, uni_jsx_1.JSX)(({ onClick, children, ariaLabel }) => {
|
|
6
|
+
if (children) {
|
|
7
|
+
return children;
|
|
8
|
+
}
|
|
9
|
+
return ((0, jsx_runtime_1.jsx)("button", { type: "button", className: "flex justify-between items-center group/btn h-6 gap-2xs", "aria-label": ariaLabel, onClick: onClick, role: "button", "aria-labelledby": "labeldiv", children: Array.from({ length: 3 }, (_, i) => ((0, jsx_runtime_1.jsx)("div", { className: "w-[3px] h-[3px] rounded bg-primary-text group-hover/btn:bg-primary-hover group-data-transparent:bg-white" }, i))) }));
|
|
10
|
+
});
|
|
11
|
+
//# sourceMappingURL=DropdownButton.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DropdownButton.js","sourceRoot":"","sources":["../../../src/components/Header/DropdownButton.tsx"],"names":[],"mappings":";;;AAAA,+CAAwC;AAG3B,QAAA,cAAc,GAAG,IAAA,aAAG,EAAc,CAAC,EAAE,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,EAAE,EAAE;IAClF,IAAI,QAAQ,EAAE;QACZ,OAAO,QAAQ,CAAC;KACjB;IAED,OAAO,CACL,mCACE,IAAI,EAAC,QAAQ,EACb,SAAS,EAAC,yDAAyD,gBACvD,SAAS,EACrB,OAAO,EAAE,OAAO,EAChB,IAAI,EAAC,QAAQ,qBACG,UAAU,YAEzB,KAAK,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CACnC,gCAEE,SAAS,EAAC,0GAA0G,IAD/G,CAAC,CAEN,CACH,CAAC,GACK,CACV,CAAC;AACJ,CAAC,CAAC,CAAC"}
|
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
import { type ComponentType } from '../../model/ComponentType';
|
|
2
2
|
import { type LinkProps } from '../../model/LinkProps';
|
|
3
3
|
interface DropdownMenuProps extends ComponentType {
|
|
4
|
-
|
|
4
|
+
dropdownRef?: {
|
|
5
|
+
current: HTMLDivElement | null;
|
|
6
|
+
};
|
|
7
|
+
items?: LinkProps[];
|
|
5
8
|
activeItem?: LinkProps;
|
|
6
9
|
ariaLabel?: string;
|
|
7
10
|
}
|
|
8
|
-
export declare const DropdownMenu:
|
|
11
|
+
export declare const DropdownMenu: ({ dropdownRef, items, activeItem, ariaLabel, }: DropdownMenuProps) => any;
|
|
9
12
|
export declare const DropdownMenuItem: import("@redneckz/uni-jsx").UNIComponent<LinkProps & {
|
|
10
13
|
isActive?: boolean | undefined;
|
|
11
14
|
}, any, any>;
|
|
@@ -2,45 +2,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
2
2
|
exports.DropdownMenuItem = exports.DropdownMenu = 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 useBool_1 = require("@redneckz/uni-jsx/lib/hooks/useBool");
|
|
7
|
-
const useEventListener_1 = require("@redneckz/uni-jsx/lib/hooks/useEventListener");
|
|
8
|
-
const useOutsideClick_1 = require("@redneckz/uni-jsx/lib/hooks/useOutsideClick");
|
|
9
5
|
const useLink_1 = require("../../hooks/useLink");
|
|
10
6
|
const dataAttributes_1 = require("../../utils/dataAttributes");
|
|
11
7
|
const style_1 = require("../../utils/style");
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
const ref = (0, useOutsideClick_1.useOutsideClick)(setFalse);
|
|
15
|
-
const dropdownRef = (0, hooks_1.useRef)(null);
|
|
16
|
-
const changeDropdownPosition = (0, hooks_1.useCallback)(({ isOpened, buttonRef, menuRef }) => {
|
|
17
|
-
if (isOpened && buttonRef.current && menuRef.current) {
|
|
18
|
-
const dropdownRect = menuRef.current.getBoundingClientRect();
|
|
19
|
-
const dropdownButtonRect = buttonRef.current.getBoundingClientRect();
|
|
20
|
-
const newDropdownPosition = globalThis.innerWidth - dropdownRect.width;
|
|
21
|
-
if (dropdownRect.right >= globalThis.innerWidth) {
|
|
22
|
-
menuRef.current.style.left = `${newDropdownPosition}px`;
|
|
23
|
-
}
|
|
24
|
-
else if (dropdownButtonRect.left > dropdownRect.left) {
|
|
25
|
-
if (newDropdownPosition > dropdownButtonRect.left) {
|
|
26
|
-
menuRef.current.style.left = '';
|
|
27
|
-
}
|
|
28
|
-
else {
|
|
29
|
-
menuRef.current.style.left = `${newDropdownPosition}px`;
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
}, [isVisible]);
|
|
34
|
-
(0, useEventListener_1.useEventListener)(globalThis, 'resize', () => changeDropdownPosition({ isOpened: isVisible, buttonRef: ref, menuRef: dropdownRef }));
|
|
35
|
-
(0, hooks_1.useEffect)(() => {
|
|
36
|
-
changeDropdownPosition({ isOpened: isVisible, buttonRef: ref, menuRef: dropdownRef });
|
|
37
|
-
}, [isVisible]);
|
|
38
|
-
return ((0, jsx_runtime_1.jsxs)("div", { className: (0, style_1.style)(isVisible ? 'rounded-md shadow-blue-gray' : '', className), ref: ref, role: "navigation", children: [(0, jsx_runtime_1.jsx)("button", { type: "button", className: "group/btn flex justify-between items-center h-6", "aria-label": ariaLabel, onClick: toggle, role: "button", "aria-labelledby": "labeldiv", children: Array(3)
|
|
39
|
-
.fill(null)
|
|
40
|
-
.map((_, i) => ((0, jsx_runtime_1.jsx)("div", { className: "w-[3px] h-[3px] rounded mr-2xs bg-primary-text group-hover/btn:bg-primary-hover group-data-transparent:bg-white" }, String(i)))) }), (0, jsx_runtime_1.jsx)("div", { ref: dropdownRef, className: (0, style_1.style)('absolute flex flex-col rounded-md bg-white p-xl pb-xs w-56 z-40', {
|
|
41
|
-
hidden: !isVisible,
|
|
42
|
-
}), "aria-hidden": !isVisible, children: renderDropdownItems(items, activeItem) })] }));
|
|
43
|
-
});
|
|
8
|
+
const DropdownMenu = ({ dropdownRef, items = [], activeItem, ariaLabel, }) => ((0, jsx_runtime_1.jsx)("div", { ref: dropdownRef, className: "absolute flex flex-col rounded-md bg-white p-xl pb-xs w-56 z-40", "aria-label": ariaLabel, children: renderDropdownItems(items, activeItem) }));
|
|
9
|
+
exports.DropdownMenu = DropdownMenu;
|
|
44
10
|
exports.DropdownMenuItem = (0, uni_jsx_1.JSX)(({ isActive, ...rest }) => {
|
|
45
11
|
const link = (0, useLink_1.useLink)();
|
|
46
12
|
const { text, href, target, onClick } = link(rest);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DropdownMenu.js","sourceRoot":"","sources":["../../../src/components/Header/DropdownMenu.tsx"],"names":[],"mappings":";;;AAAA,+CAAwC;AACxC,
|
|
1
|
+
{"version":3,"file":"DropdownMenu.js","sourceRoot":"","sources":["../../../src/components/Header/DropdownMenu.tsx"],"names":[],"mappings":";;;AAAA,+CAAwC;AACxC,iDAA8C;AAG9C,+DAAkE;AAClE,6CAA0C;AASnC,MAAM,YAAY,GAAG,CAAC,EAC3B,WAAW,EACX,KAAK,GAAG,EAAE,EACV,UAAU,EACV,SAAS,GACS,EAAE,EAAE,CAAC,CACvB,gCACE,GAAG,EAAE,WAAW,EAChB,SAAS,EAAC,iEAAiE,gBAC/D,SAAS,YAEpB,mBAAmB,CAAC,KAAK,EAAE,UAAU,CAAC,GACnC,CACP,CAAC;AAbW,QAAA,YAAY,gBAavB;AAEW,QAAA,gBAAgB,GAAG,IAAA,aAAG,EAAqC,CAAC,EAAE,QAAQ,EAAE,GAAG,IAAI,EAAE,EAAE,EAAE;IAChG,MAAM,IAAI,GAAG,IAAA,iBAAO,GAAE,CAAC;IACvB,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,GAAG,IAAI,CAAC,IAAI,CAAC,CAAC;IAEnD,OAAO,CACL,8BACE,SAAS,EAAE,IAAA,aAAK,EAAC,gDAAgD,EAAE;YACjE,mBAAmB,EAAE,QAAQ;SAC9B,CAAC,EACF,IAAI,EAAE,IAAI,EACV,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,OAAO,EAChB,IAAI,EAAC,MAAM,KAEP,IAAA,qCAAoB,EAAC,IAAI,EAAE,IAAI,CAAC,YAEnC,IAAI,GACH,CACL,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,MAAM,mBAAmB,GAAG,CAAC,KAAkB,EAAE,UAAsB,EAAE,EAAE,CACzE,KAAK,EAAE,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC,EAAE,EAAE,CAAC,CACtB,uBAAC,wBAAgB,IAA+B,QAAQ,EAAE,IAAI,KAAK,UAAU,KAAM,IAAI,IAAhE,IAAI,EAAE,IAAI,IAAI,MAAM,CAAC,CAAC,CAAC,CAA6C,CAC5F,CAAC,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { type ComponentType } from '../../model/ComponentType';
|
|
2
|
+
import { type LinkProps } from '../../model/LinkProps';
|
|
3
|
+
interface HeaderMoreMenuItemProps extends ComponentType {
|
|
4
|
+
items: LinkProps[];
|
|
5
|
+
activeItem?: LinkProps;
|
|
6
|
+
ariaLabel?: string;
|
|
7
|
+
}
|
|
8
|
+
export declare const HeaderMoreMenuItem: import("@redneckz/uni-jsx").UNIComponent<HeaderMoreMenuItemProps, any, any>;
|
|
9
|
+
export {};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
2
|
+
exports.HeaderMoreMenuItem = void 0;
|
|
3
|
+
const jsx_runtime_1 = require("@redneckz/uni-jsx/jsx-runtime");
|
|
4
|
+
const uni_jsx_1 = require("@redneckz/uni-jsx");
|
|
5
|
+
const hooks_1 = require("@redneckz/uni-jsx/lib/hooks");
|
|
6
|
+
const useBool_1 = require("@redneckz/uni-jsx/lib/hooks/useBool");
|
|
7
|
+
const style_1 = require("../../utils/style");
|
|
8
|
+
const useDropdownSubMenu_1 = require("./useDropdownSubMenu");
|
|
9
|
+
exports.HeaderMoreMenuItem = (0, uni_jsx_1.JSX)(({ className = '', items, activeItem, ariaLabel = 'Меню' }) => {
|
|
10
|
+
const [isOpenDropdown, { setFalse, toggle }] = (0, useBool_1.useBool)(false);
|
|
11
|
+
const dropdownMenu = (0, useDropdownSubMenu_1.useDropdownSubMenu)({
|
|
12
|
+
items,
|
|
13
|
+
onClose: setFalse,
|
|
14
|
+
isOpen: isOpenDropdown,
|
|
15
|
+
activeItem,
|
|
16
|
+
});
|
|
17
|
+
(0, hooks_1.useEffect)(() => {
|
|
18
|
+
dropdownMenu.current?.addEventListener('mouseleave', setFalse);
|
|
19
|
+
return () => {
|
|
20
|
+
dropdownMenu.current?.removeEventListener('mouseleave', setFalse);
|
|
21
|
+
};
|
|
22
|
+
}, []);
|
|
23
|
+
return ((0, jsx_runtime_1.jsx)("div", { className: (0, style_1.style)(isOpenDropdown ? 'rounded-md shadow-blue-gray' : '', className), ref: dropdownMenu, role: "navigation", children: (0, jsx_runtime_1.jsx)("button", { type: "button", className: "group/btn flex justify-between items-center h-6", "aria-label": ariaLabel, onClick: toggle, role: "button", "aria-labelledby": "labeldiv", children: Array(3)
|
|
24
|
+
.fill(null)
|
|
25
|
+
.map((_, i) => ((0, jsx_runtime_1.jsx)("div", { className: "w-[3px] h-[3px] rounded mr-2xs bg-primary-text group-hover/btn:bg-primary-hover group-data-transparent:bg-white" }, String(i)))) }) }));
|
|
26
|
+
});
|
|
27
|
+
//# sourceMappingURL=HeaderMoreMenuItem.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"HeaderMoreMenuItem.js","sourceRoot":"","sources":["../../../src/components/Header/HeaderMoreMenuItem.tsx"],"names":[],"mappings":";;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H,CAAC,GACG,GACL,CACP,CAAC;AACJ,CAAC,CACF,CAAC"}
|
|
@@ -5,8 +5,8 @@ const uni_jsx_1 = require("@redneckz/uni-jsx");
|
|
|
5
5
|
const hooks_1 = require("@redneckz/uni-jsx/lib/hooks");
|
|
6
6
|
const useActiveRoute_1 = require("../../hooks/useActiveRoute");
|
|
7
7
|
const ProjectSettings_1 = require("../../ProjectSettings");
|
|
8
|
-
const DropdownMenu_1 = require("./DropdownMenu");
|
|
9
8
|
const HeaderChatBotButton_1 = require("./HeaderChatBotButton");
|
|
9
|
+
const HeaderMoreMenuItem_1 = require("./HeaderMoreMenuItem");
|
|
10
10
|
const HeaderSubMenuItem_1 = require("./HeaderSubMenuItem");
|
|
11
11
|
const InternetBankButton_1 = require("./InternetBankButton");
|
|
12
12
|
exports.HeaderSubMenu = (0, uni_jsx_1.JSX)(({ subItems = [], version, internetBankButton, dropdownMenuAriaLabel, chatBotAriaLabel }) => {
|
|
@@ -21,7 +21,7 @@ exports.HeaderSubMenu = (0, uni_jsx_1.JSX)(({ subItems = [], version, internetBa
|
|
|
21
21
|
? handleIntersectionActivation(index)
|
|
22
22
|
: handleIntersectionDeactivation(index));
|
|
23
23
|
}), [subItems]);
|
|
24
|
-
return ((0, jsx_runtime_1.jsxs)("nav", { className: "mt-s flex gap-s items-center justify-between", children: [(0, jsx_runtime_1.jsx)("div", { ref: subItemsListRef, className: "overflow-hidden whitespace-nowrap pb-s mt-xs space-x-lg", role: "menu", children: subItems.map((_, i) => ((0, jsx_runtime_1.jsx)(HeaderSubMenuItem_1.HeaderSubMenuItem, { className: visibleItemsCount - 1 < i ? 'invisible' : '', active: _ === activeSubItem, observerOptions: observerOptions, onVisibilityChange: subItemsVisibilityHandlers[i], data: _.dataHeader, ..._ }, String(i)))) }), dropDownMenuItems.length ? ((0, jsx_runtime_1.jsx)(
|
|
24
|
+
return ((0, jsx_runtime_1.jsxs)("nav", { className: "mt-s flex gap-s items-center justify-between", children: [(0, jsx_runtime_1.jsx)("div", { ref: subItemsListRef, className: "overflow-hidden whitespace-nowrap pb-s mt-xs space-x-lg", role: "menu", children: subItems.map((_, i) => ((0, jsx_runtime_1.jsx)(HeaderSubMenuItem_1.HeaderSubMenuItem, { className: visibleItemsCount - 1 < i ? 'invisible' : '', active: _ === activeSubItem, activeItem: activeSubItem, observerOptions: observerOptions, onVisibilityChange: subItemsVisibilityHandlers[i], data: _.dataHeader, ..._ }, String(i)))) }), dropDownMenuItems.length ? ((0, jsx_runtime_1.jsx)(HeaderMoreMenuItem_1.HeaderMoreMenuItem, { items: dropDownMenuItems, activeItem: activeSubItem, ariaLabel: dropdownMenuAriaLabel })) : null, ProjectSettings_1.projectSettings.CHAT_BOT ? ((0, jsx_runtime_1.jsx)(HeaderChatBotButton_1.HeaderChatBotButton, { version: version, iconVersion: iconVersion, ariaLabel: chatBotAriaLabel })) : null, (0, jsx_runtime_1.jsx)(InternetBankButton_1.InternetBankButton, { version: version, ...internetBankButton })] }));
|
|
25
25
|
});
|
|
26
26
|
const handleIntersectionActivation = (index) => (prev) => Math.max(prev, index + 1);
|
|
27
27
|
const handleIntersectionDeactivation = (index) => (prev) => Math.min(prev, index);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"HeaderSubMenu.js","sourceRoot":"","sources":["../../../src/components/Header/HeaderSubMenu.tsx"],"names":[],"mappings":";;;AAAA,+CAAwC;AACxC,uDAAwE;AAExE,+DAA4D;AAI5D,2DAAwD;AACxD
|
|
1
|
+
{"version":3,"file":"HeaderSubMenu.js","sourceRoot":"","sources":["../../../src/components/Header/HeaderSubMenu.tsx"],"names":[],"mappings":";;;AAAA,+CAAwC;AACxC,uDAAwE;AAExE,+DAA4D;AAI5D,2DAAwD;AACxD,+DAA4D;AAC5D,6DAA0D;AAE1D,2DAAwD;AACxD,6DAA0D;AAU7C,QAAA,aAAa,GAAG,IAAA,aAAG,EAC9B,CAAC,EAAE,QAAQ,GAAG,EAAE,EAAE,OAAO,EAAE,kBAAkB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B,UAAU,EAAE,aAAa,EACzB,eAAe,EAAE,eAAe,EAChC,kBAAkB,EAAE,0BAA0B,CAAC,CAAC,CAAC,EACjD,IAAI,EAAE,CAAC,CAAC,UAAU,KACd,CAAC,IAPA,MAAM,CAAC,CAAC,CAAC,CAQd,CACH,CAAC,GACE,EACL,iBAAiB,CAAC,MAAM,CAAC,CAAC,CAAC,CAC1B,uBAAC,uCAAkB,IACjB,KAAK,EAAE,iBAAiB,EACxB,UAAU,EAAE,aAAa,EACzB,SAAS,EAAE,qBAAqB,GAChC,CACH,CAAC,CAAC,CAAC,IAAI,EACP,iCAAe,CAAC,QAAQ,CAAC,CAAC,CAAC,CAC1B,uBAAC,yCAAmB,IAClB,OAAO,EAAE,OAAO,EAChB,WAAW,EAAE,WAAW,EACxB,SAAS,EAAE,gBAAgB,GAC3B,CACH,CAAC,CAAC,CAAC,IAAI,EACR,uBAAC,uCAAkB,IAAC,OAAO,EAAE,OAAO,KAAM,kBAAkB,GAAI,IAC5D,CACP,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,MAAM,4BAA4B,GAAG,CAAC,KAAa,EAAE,EAAE,CAAC,CAAC,IAAY,EAAE,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,EAAE,KAAK,GAAG,CAAC,CAAC,CAAC;AACpG,MAAM,8BAA8B,GAAG,CAAC,KAAa,EAAE,EAAE,CAAC,CAAC,IAAY,EAAE,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC"}
|
|
@@ -1,9 +1,12 @@
|
|
|
1
|
+
import { type NavigationLinkProps } from '../../data/NavigationData';
|
|
1
2
|
import { type IntersectionObserverOptions } from '../../hooks/useIntersectionObserver';
|
|
2
3
|
import { type ComponentType } from '../../model/ComponentType';
|
|
3
4
|
import { type LinkProps } from '../../model/LinkProps';
|
|
4
5
|
export interface HeaderSubMenuItemProps extends LinkProps, ComponentType {
|
|
5
6
|
active?: boolean;
|
|
7
|
+
activeItem?: LinkProps;
|
|
6
8
|
observerOptions?: IntersectionObserverOptions;
|
|
7
9
|
onVisibilityChange?: (isIntersecting: boolean) => void;
|
|
10
|
+
items?: NavigationLinkProps[];
|
|
8
11
|
}
|
|
9
12
|
export declare const HeaderSubMenuItem: import("@redneckz/uni-jsx").UNIComponent<HeaderSubMenuItemProps, any, any>;
|
|
@@ -3,9 +3,12 @@ exports.HeaderSubMenuItem = 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
5
|
const hooks_1 = require("@redneckz/uni-jsx/lib/hooks");
|
|
6
|
+
const useBool_1 = require("@redneckz/uni-jsx/lib/hooks/useBool");
|
|
6
7
|
const useIntersectionObserver_1 = require("../../hooks/useIntersectionObserver");
|
|
7
8
|
const HeaderItem_1 = require("../../ui-kit/HeaderItem/HeaderItem");
|
|
8
|
-
|
|
9
|
+
const useDropdownSubMenu_1 = require("./useDropdownSubMenu");
|
|
10
|
+
exports.HeaderSubMenuItem = (0, uni_jsx_1.JSX)(({ observerOptions, onVisibilityChange, children, className, items, activeItem, ...rest }) => {
|
|
11
|
+
const [isOpenDropdown, { setFalse, setTrue }] = (0, useBool_1.useBool)(false);
|
|
9
12
|
const observerCallback = (0, hooks_1.useCallback)((entries) => {
|
|
10
13
|
if (!entries.length || !onVisibilityChange) {
|
|
11
14
|
return;
|
|
@@ -15,6 +18,20 @@ exports.HeaderSubMenuItem = (0, uni_jsx_1.JSX)(({ observerOptions, onVisibilityC
|
|
|
15
18
|
onVisibilityChange(entry.isIntersecting);
|
|
16
19
|
}, [onVisibilityChange]);
|
|
17
20
|
const ref = (0, useIntersectionObserver_1.useIntersectionObserver)(observerCallback, observerOptions);
|
|
18
|
-
|
|
21
|
+
const dropdownMenu = (0, useDropdownSubMenu_1.useDropdownSubMenu)({
|
|
22
|
+
items,
|
|
23
|
+
onClose: setFalse,
|
|
24
|
+
isOpen: isOpenDropdown,
|
|
25
|
+
activeItem,
|
|
26
|
+
});
|
|
27
|
+
(0, hooks_1.useEffect)(() => {
|
|
28
|
+
dropdownMenu.current?.addEventListener('mouseenter', setTrue);
|
|
29
|
+
dropdownMenu.current?.addEventListener('mouseleave', setFalse);
|
|
30
|
+
return () => {
|
|
31
|
+
dropdownMenu.current?.addEventListener('mouseenter', setTrue);
|
|
32
|
+
dropdownMenu.current?.removeEventListener('mouseleave', setFalse);
|
|
33
|
+
};
|
|
34
|
+
}, []);
|
|
35
|
+
return ((0, jsx_runtime_1.jsx)("div", { className: "inline-block", ref: dropdownMenu, children: (0, jsx_runtime_1.jsx)("span", { ref: ref, className: className, role: "menuitem", children: (0, jsx_runtime_1.jsx)(HeaderItem_1.HeaderItem, { ...rest, children: children }) }) }));
|
|
19
36
|
});
|
|
20
37
|
//# sourceMappingURL=HeaderSubMenuItem.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"HeaderSubMenuItem.js","sourceRoot":"","sources":["../../../src/components/Header/HeaderSubMenuItem.tsx"],"names":[],"mappings":";;;AAAA,+CAAwC;AACxC,
|
|
1
|
+
{"version":3,"file":"HeaderSubMenuItem.js","sourceRoot":"","sources":["../../../src/components/Header/HeaderSubMenuItem.tsx"],"names":[],"mappings":";;;AAAA,+CAAwC;AACxC,uDAAqE;AACrE,iEAA8D;AAE9D,iFAG6C;AAG7C,mEAAgE;AAChE,6DAA0D;AAU7C,QAAA,iBAAiB,GAAG,IAAA,aAAG,EAClC,CAAC,EAAE,eAAe,EAAE,kBAAkB,EAAE,QAAQ,EAAE,SAAS,EAAE,KAAK,EAAE,UAAU,EAAE,GAAG,IAAI,EAAE,EAAE,EAAE;IAC3F,MAAM,CAAC,cAAc,EAAE,EAAE,QAAQ,EAAE,OAAO,EAAE,CAAC,GAAG,IAAA,iBAAO,EAAC,KAAK,CAAC,CAAC;IAE/D,MAAM,gBAAgB,GAAG,IAAA,mBAAW,EAClC,CAAC,OAAoC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|
|
4
4
|
const uni_jsx_1 = require("@redneckz/uni-jsx");
|
|
5
5
|
const hooks_1 = require("@redneckz/uni-jsx/lib/hooks");
|
|
6
6
|
const Logo_1 = require("../../ui-kit/Logo/Logo");
|
|
7
|
-
const
|
|
7
|
+
const HeaderMoreMenuItem_1 = require("./HeaderMoreMenuItem");
|
|
8
8
|
const HeaderSecondaryMenu_1 = require("./HeaderSecondaryMenu");
|
|
9
9
|
const HeaderTopMenuItem_1 = require("./HeaderTopMenuItem");
|
|
10
10
|
exports.HeaderTopMenu = (0, uni_jsx_1.JSX)(({ navigationItems = [], activeTopItem, dropdownMenuAriaLabel, version, headerData, search, bgColor, logo, }) => {
|
|
@@ -19,7 +19,7 @@ exports.HeaderTopMenu = (0, uni_jsx_1.JSX)(({ navigationItems = [], activeTopIte
|
|
|
19
19
|
}), [navigationItems]);
|
|
20
20
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
21
21
|
const { dataFooter, dataHeader, ...logoProps } = logo ?? {};
|
|
22
|
-
return ((0, jsx_runtime_1.jsxs)("div", { className: "flex items-center justify-between", children: [(0, jsx_runtime_1.jsx)(Logo_1.Logo, { className: "mr-3xl", bgColor: bgColor, logo: logoProps, data: dataHeader, showTitle: false }), (0, jsx_runtime_1.jsx)("div", { ref: topItemsListRef, className: "overflow-hidden min-w-40 pb-xs mt-xs", role: "menu", children: navigationItems.map((_, i) => ((0, jsx_runtime_1.jsx)(HeaderTopMenuItem_1.HeaderTopMenuItem, { className: visibleItemsCount - 1 < i ? 'invisible' : '', active: _ === activeTopItem, observerOptions: observerOptions, onVisibilityChange: topItemsVisibilityHandlers[i], data: _.dataHeader, ..._ }, String(i)))) }), dropDownMenuItems.length ? ((0, jsx_runtime_1.jsx)(
|
|
22
|
+
return ((0, jsx_runtime_1.jsxs)("div", { className: "flex items-center justify-between", children: [(0, jsx_runtime_1.jsx)(Logo_1.Logo, { className: "mr-3xl", bgColor: bgColor, logo: logoProps, data: dataHeader, showTitle: false }), (0, jsx_runtime_1.jsx)("div", { ref: topItemsListRef, className: "overflow-hidden min-w-40 pb-xs mt-xs", role: "menu", children: navigationItems.map((_, i) => ((0, jsx_runtime_1.jsx)(HeaderTopMenuItem_1.HeaderTopMenuItem, { className: visibleItemsCount - 1 < i ? 'invisible' : '', active: _ === activeTopItem, observerOptions: observerOptions, onVisibilityChange: topItemsVisibilityHandlers[i], data: _.dataHeader, ..._ }, String(i)))) }), dropDownMenuItems.length ? ((0, jsx_runtime_1.jsx)(HeaderMoreMenuItem_1.HeaderMoreMenuItem, { className: "mx-xs rounded-md shadow-blue-gray", items: dropDownMenuItems, activeItem: activeTopItem, ariaLabel: dropdownMenuAriaLabel })) : null, (0, jsx_runtime_1.jsx)(HeaderSecondaryMenu_1.HeaderSecondaryMenu, { version: version, className: "ml-auto", search: search, navigationItems: navigationItems, ...headerData })] }));
|
|
23
23
|
});
|
|
24
24
|
const handleIntersectionActivation = (index) => (prev) => Math.max(prev, index + 1);
|
|
25
25
|
const handleIntersectionDeactivation = (index) => (prev) => Math.min(prev, index);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"HeaderTopMenu.js","sourceRoot":"","sources":["../../../src/components/Header/HeaderTopMenu.tsx"],"names":[],"mappings":";;;AAAA,+CAAwC;AACxC,uDAAwE;AAUxE,iDAA8C;AAC9C,
|
|
1
|
+
{"version":3,"file":"HeaderTopMenu.js","sourceRoot":"","sources":["../../../src/components/Header/HeaderTopMenu.tsx"],"names":[],"mappings":";;;AAAA,+CAAwC;AACxC,uDAAwE;AAUxE,iDAA8C;AAC9C,6DAA0D;AAC1D,+DAA4D;AAC5D,2DAAwD;AAa3C,QAAA,aAAa,GAAG,IAAA,aAAG,EAC9B,CAAC,EACC,eAAe,GAAG,EAAE,EACpB,aAAa,EACb,qBAAqB,EACrB,OAAO,EACP,UAAU,EACV,MAAM,EACN,OAAO,EACP,IAAI,GACL,EAAE,EAAE;IACH,MAAM,CAAC,iBAAiB,EAAE,oBAAoB,C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C,kBAAkB,EAAE,0BAA0B,CAAC,CAAC,CAAC,EACjD,IAAI,EAAE,CAAC,CAAC,UAAU,KACd,CAAC,IANA,MAAM,CAAC,CAAC,CAAC,CAOd,CACH,CAAC,GACE,EACL,iBAAiB,CAAC,MAAM,CAAC,CAAC,CAAC,CAC1B,uBAAC,uCAAkB,IACjB,SAAS,EAAC,mCAAmC,EAC7C,KAAK,EAAE,iBAAiB,EACxB,UAAU,EAAE,aAAa,EACzB,SAAS,EAAE,qBAAqB,GAChC,CACH,CAAC,CAAC,CAAC,IAAI,EACR,uBAAC,yCAAmB,IAClB,OAAO,EAAE,OAAO,EAChB,SAAS,EAAC,SAAS,EACnB,MAAM,EAAE,MAAM,EACd,eAAe,EAAE,eAAe,KAC5B,UAAU,GACd,IACE,CACP,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,MAAM,4BAA4B,GAAG,CAAC,KAAa,EAAE,EAAE,CAAC,CAAC,IAAY,EAAE,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,EAAE,KAAK,GAAG,CAAC,CAAC,CAAC;AACpG,MAAM,8BAA8B,GAAG,CAAC,KAAa,EAAE,EAAE,CAAC,CAAC,IAAY,EAAE,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { type LinkProps } from '../../model/LinkProps';
|
|
2
|
+
import type { OnCloseProps } from '../../model/OnCloseProps';
|
|
3
|
+
interface DropdownSubMenuOptions extends OnCloseProps {
|
|
4
|
+
isOpen?: boolean;
|
|
5
|
+
activeItem?: LinkProps;
|
|
6
|
+
items?: LinkProps[];
|
|
7
|
+
}
|
|
8
|
+
export declare function useDropdownSubMenu({ items, activeItem, onClose, isOpen }: DropdownSubMenuOptions): {
|
|
9
|
+
current: HTMLDivElement | null;
|
|
10
|
+
};
|
|
11
|
+
export {};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
2
|
+
exports.useDropdownSubMenu = void 0;
|
|
3
|
+
const jsx_runtime_1 = require("@redneckz/uni-jsx/jsx-runtime");
|
|
4
|
+
const hooks_1 = require("@redneckz/uni-jsx/lib/hooks");
|
|
5
|
+
const useOutsideClick_1 = require("@redneckz/uni-jsx/lib/hooks/useOutsideClick");
|
|
6
|
+
const usePopupManager_1 = require("../../ui-kit/PopupManager/usePopupManager");
|
|
7
|
+
const DropdownMenu_1 = require("./DropdownMenu");
|
|
8
|
+
function useDropdownSubMenu({ items, activeItem, onClose, isOpen }) {
|
|
9
|
+
const popup = (0, usePopupManager_1.usePopupManager)();
|
|
10
|
+
(0, hooks_1.useEffect)(() => {
|
|
11
|
+
if (isOpen) {
|
|
12
|
+
popup.close();
|
|
13
|
+
}
|
|
14
|
+
}, [isOpen]);
|
|
15
|
+
const close = (0, hooks_1.useCallback)(() => {
|
|
16
|
+
popup.close();
|
|
17
|
+
onClose?.();
|
|
18
|
+
}, [onClose]);
|
|
19
|
+
const parentRef = (0, hooks_1.useRef)(null);
|
|
20
|
+
const popupRef = (0, useOutsideClick_1.useOutsideClick)(close);
|
|
21
|
+
(0, hooks_1.useEffect)(() => {
|
|
22
|
+
if (!isOpen || !parentRef.current || !items?.length) {
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
25
|
+
const parentElement = parentRef.current;
|
|
26
|
+
const { top, left, width, height } = parentElement.getBoundingClientRect();
|
|
27
|
+
popup.open({
|
|
28
|
+
popup: (0, jsx_runtime_1.jsx)(DropdownMenu_1.DropdownMenu, { dropdownRef: popupRef, items: items, activeItem: activeItem }),
|
|
29
|
+
top: top + window.scrollY + height,
|
|
30
|
+
left,
|
|
31
|
+
width,
|
|
32
|
+
});
|
|
33
|
+
}, [isOpen, items, close]);
|
|
34
|
+
return parentRef;
|
|
35
|
+
}
|
|
36
|
+
exports.useDropdownSubMenu = useDropdownSubMenu;
|
|
37
|
+
//# sourceMappingURL=useDropdownSubMenu.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AAG,MAAM,CAAC,OAAO,GAAG,MAAM;YAClC,IAAI;YACJ,KAAK;SACN,CAAC,CAAC;IACL,CAAC,EAAE,CAAC,MAAM,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC;IAE3B,OAAO,SAAS,CAAC;AACnB,CAAC;AAlCD,gDAkCC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { jsx as _jsx } from "@redneckz/uni-jsx/jsx-runtime";
|
|
2
|
+
import { JSX } from '@redneckz/uni-jsx';
|
|
3
|
+
export const DropdownButton = JSX(({ onClick, children, ariaLabel }) => {
|
|
4
|
+
if (children) {
|
|
5
|
+
return children;
|
|
6
|
+
}
|
|
7
|
+
return (_jsx("button", { type: "button", className: "flex justify-between items-center group/btn h-6 gap-2xs", "aria-label": ariaLabel, onClick: onClick, role: "button", "aria-labelledby": "labeldiv", children: Array.from({ length: 3 }, (_, i) => (_jsx("div", { className: "w-[3px] h-[3px] rounded bg-primary-text group-hover/btn:bg-primary-hover group-data-transparent:bg-white" }, i))) }));
|
|
8
|
+
});
|
|
9
|
+
//# sourceMappingURL=DropdownButton.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DropdownButton.js","sourceRoot":"","sources":["../../../src/components/Header/DropdownButton.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAGxC,MAAM,CAAC,MAAM,cAAc,GAAG,GAAG,CAAc,CAAC,EAAE,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,EAAE,EAAE;IAClF,IAAI,QAAQ,EAAE;QACZ,OAAO,QAAQ,CAAC;KACjB;IAED,OAAO,CACL,iBACE,IAAI,EAAC,QAAQ,EACb,SAAS,EAAC,yDAAyD,gBACvD,SAAS,EACrB,OAAO,EAAE,OAAO,EAChB,IAAI,EAAC,QAAQ,qBACG,UAAU,YAEzB,KAAK,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CACnC,cAEE,SAAS,EAAC,0GAA0G,IAD/G,CAAC,CAEN,CACH,CAAC,GACK,CACV,CAAC;AACJ,CAAC,CAAC,CAAC"}
|
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
import { type ComponentType } from '../../model/ComponentType';
|
|
2
2
|
import { type LinkProps } from '../../model/LinkProps';
|
|
3
3
|
interface DropdownMenuProps extends ComponentType {
|
|
4
|
-
|
|
4
|
+
dropdownRef?: {
|
|
5
|
+
current: HTMLDivElement | null;
|
|
6
|
+
};
|
|
7
|
+
items?: LinkProps[];
|
|
5
8
|
activeItem?: LinkProps;
|
|
6
9
|
ariaLabel?: string;
|
|
7
10
|
}
|
|
8
|
-
export declare const DropdownMenu:
|
|
11
|
+
export declare const DropdownMenu: ({ dropdownRef, items, activeItem, ariaLabel, }: DropdownMenuProps) => any;
|
|
9
12
|
export declare const DropdownMenuItem: import("@redneckz/uni-jsx").UNIComponent<LinkProps & {
|
|
10
13
|
isActive?: boolean | undefined;
|
|
11
14
|
}, any, any>;
|
|
@@ -1,44 +1,9 @@
|
|
|
1
|
-
import { jsx as _jsx
|
|
1
|
+
import { jsx as _jsx } from "@redneckz/uni-jsx/jsx-runtime";
|
|
2
2
|
import { JSX } from '@redneckz/uni-jsx';
|
|
3
|
-
import { useCallback, useEffect, useRef } from '@redneckz/uni-jsx/lib/hooks';
|
|
4
|
-
import { useBool } from '@redneckz/uni-jsx/lib/hooks/useBool';
|
|
5
|
-
import { useEventListener } from '@redneckz/uni-jsx/lib/hooks/useEventListener';
|
|
6
|
-
import { useOutsideClick } from '@redneckz/uni-jsx/lib/hooks/useOutsideClick';
|
|
7
3
|
import { useLink } from '../../hooks/useLink.js';
|
|
8
4
|
import { getAspectsAttributes } from '../../utils/dataAttributes.js';
|
|
9
5
|
import { style } from '../../utils/style.js';
|
|
10
|
-
export const DropdownMenu =
|
|
11
|
-
const [isVisible, { setFalse, toggle }] = useBool(false);
|
|
12
|
-
const ref = useOutsideClick(setFalse);
|
|
13
|
-
const dropdownRef = useRef(null);
|
|
14
|
-
const changeDropdownPosition = useCallback(({ isOpened, buttonRef, menuRef }) => {
|
|
15
|
-
if (isOpened && buttonRef.current && menuRef.current) {
|
|
16
|
-
const dropdownRect = menuRef.current.getBoundingClientRect();
|
|
17
|
-
const dropdownButtonRect = buttonRef.current.getBoundingClientRect();
|
|
18
|
-
const newDropdownPosition = globalThis.innerWidth - dropdownRect.width;
|
|
19
|
-
if (dropdownRect.right >= globalThis.innerWidth) {
|
|
20
|
-
menuRef.current.style.left = `${newDropdownPosition}px`;
|
|
21
|
-
}
|
|
22
|
-
else if (dropdownButtonRect.left > dropdownRect.left) {
|
|
23
|
-
if (newDropdownPosition > dropdownButtonRect.left) {
|
|
24
|
-
menuRef.current.style.left = '';
|
|
25
|
-
}
|
|
26
|
-
else {
|
|
27
|
-
menuRef.current.style.left = `${newDropdownPosition}px`;
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
}, [isVisible]);
|
|
32
|
-
useEventListener(globalThis, 'resize', () => changeDropdownPosition({ isOpened: isVisible, buttonRef: ref, menuRef: dropdownRef }));
|
|
33
|
-
useEffect(() => {
|
|
34
|
-
changeDropdownPosition({ isOpened: isVisible, buttonRef: ref, menuRef: dropdownRef });
|
|
35
|
-
}, [isVisible]);
|
|
36
|
-
return (_jsxs("div", { className: style(isVisible ? 'rounded-md shadow-blue-gray' : '', className), ref: ref, role: "navigation", children: [_jsx("button", { type: "button", className: "group/btn flex justify-between items-center h-6", "aria-label": ariaLabel, onClick: toggle, role: "button", "aria-labelledby": "labeldiv", children: Array(3)
|
|
37
|
-
.fill(null)
|
|
38
|
-
.map((_, i) => (_jsx("div", { className: "w-[3px] h-[3px] rounded mr-2xs bg-primary-text group-hover/btn:bg-primary-hover group-data-transparent:bg-white" }, String(i)))) }), _jsx("div", { ref: dropdownRef, className: style('absolute flex flex-col rounded-md bg-white p-xl pb-xs w-56 z-40', {
|
|
39
|
-
hidden: !isVisible,
|
|
40
|
-
}), "aria-hidden": !isVisible, children: renderDropdownItems(items, activeItem) })] }));
|
|
41
|
-
});
|
|
6
|
+
export const DropdownMenu = ({ dropdownRef, items = [], activeItem, ariaLabel, }) => (_jsx("div", { ref: dropdownRef, className: "absolute flex flex-col rounded-md bg-white p-xl pb-xs w-56 z-40", "aria-label": ariaLabel, children: renderDropdownItems(items, activeItem) }));
|
|
42
7
|
export const DropdownMenuItem = JSX(({ isActive, ...rest }) => {
|
|
43
8
|
const link = useLink();
|
|
44
9
|
const { text, href, target, onClick } = link(rest);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DropdownMenu.js","sourceRoot":"","sources":["../../../src/components/Header/DropdownMenu.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AACxC,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"DropdownMenu.js","sourceRoot":"","sources":["../../../src/components/Header/DropdownMenu.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AACxC,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAG9C,OAAO,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAC;AAClE,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAS1C,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,EAC3B,WAAW,EACX,KAAK,GAAG,EAAE,EACV,UAAU,EACV,SAAS,GACS,EAAE,EAAE,CAAC,CACvB,cACE,GAAG,EAAE,WAAW,EAChB,SAAS,EAAC,iEAAiE,gBAC/D,SAAS,YAEpB,mBAAmB,CAAC,KAAK,EAAE,UAAU,CAAC,GACnC,CACP,CAAC;AAEF,MAAM,CAAC,MAAM,gBAAgB,GAAG,GAAG,CAAqC,CAAC,EAAE,QAAQ,EAAE,GAAG,IAAI,EAAE,EAAE,EAAE;IAChG,MAAM,IAAI,GAAG,OAAO,EAAE,CAAC;IACvB,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,GAAG,IAAI,CAAC,IAAI,CAAC,CAAC;IAEnD,OAAO,CACL,YACE,SAAS,EAAE,KAAK,CAAC,gDAAgD,EAAE;YACjE,mBAAmB,EAAE,QAAQ;SAC9B,CAAC,EACF,IAAI,EAAE,IAAI,EACV,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,OAAO,EAChB,IAAI,EAAC,MAAM,KAEP,oBAAoB,CAAC,IAAI,EAAE,IAAI,CAAC,YAEnC,IAAI,GACH,CACL,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,MAAM,mBAAmB,GAAG,CAAC,KAAkB,EAAE,UAAsB,EAAE,EAAE,CACzE,KAAK,EAAE,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC,EAAE,EAAE,CAAC,CACtB,KAAC,gBAAgB,IAA+B,QAAQ,EAAE,IAAI,KAAK,UAAU,KAAM,IAAI,IAAhE,IAAI,EAAE,IAAI,IAAI,MAAM,CAAC,CAAC,CAAC,CAA6C,CAC5F,CAAC,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { type ComponentType } from '../../model/ComponentType';
|
|
2
|
+
import { type LinkProps } from '../../model/LinkProps';
|
|
3
|
+
interface HeaderMoreMenuItemProps extends ComponentType {
|
|
4
|
+
items: LinkProps[];
|
|
5
|
+
activeItem?: LinkProps;
|
|
6
|
+
ariaLabel?: string;
|
|
7
|
+
}
|
|
8
|
+
export declare const HeaderMoreMenuItem: import("@redneckz/uni-jsx").UNIComponent<HeaderMoreMenuItemProps, any, any>;
|
|
9
|
+
export {};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { jsx as _jsx } from "@redneckz/uni-jsx/jsx-runtime";
|
|
2
|
+
import { JSX } from '@redneckz/uni-jsx';
|
|
3
|
+
import { useEffect } from '@redneckz/uni-jsx/lib/hooks';
|
|
4
|
+
import { useBool } from '@redneckz/uni-jsx/lib/hooks/useBool';
|
|
5
|
+
import { style } from '../../utils/style.js';
|
|
6
|
+
import { useDropdownSubMenu } from './useDropdownSubMenu.js';
|
|
7
|
+
export const HeaderMoreMenuItem = JSX(({ className = '', items, activeItem, ariaLabel = 'Меню' }) => {
|
|
8
|
+
const [isOpenDropdown, { setFalse, toggle }] = useBool(false);
|
|
9
|
+
const dropdownMenu = useDropdownSubMenu({
|
|
10
|
+
items,
|
|
11
|
+
onClose: setFalse,
|
|
12
|
+
isOpen: isOpenDropdown,
|
|
13
|
+
activeItem,
|
|
14
|
+
});
|
|
15
|
+
useEffect(() => {
|
|
16
|
+
dropdownMenu.current?.addEventListener('mouseleave', setFalse);
|
|
17
|
+
return () => {
|
|
18
|
+
dropdownMenu.current?.removeEventListener('mouseleave', setFalse);
|
|
19
|
+
};
|
|
20
|
+
}, []);
|
|
21
|
+
return (_jsx("div", { className: style(isOpenDropdown ? 'rounded-md shadow-blue-gray' : '', className), ref: dropdownMenu, role: "navigation", children: _jsx("button", { type: "button", className: "group/btn flex justify-between items-center h-6", "aria-label": ariaLabel, onClick: toggle, role: "button", "aria-labelledby": "labeldiv", children: Array(3)
|
|
22
|
+
.fill(null)
|
|
23
|
+
.map((_, i) => (_jsx("div", { className: "w-[3px] h-[3px] rounded mr-2xs bg-primary-text group-hover/btn:bg-primary-hover group-data-transparent:bg-white" }, String(i)))) }) }));
|
|
24
|
+
});
|
|
25
|
+
//# sourceMappingURL=HeaderMoreMenuItem.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"HeaderMoreMenuItem.js","sourceRoot":"","sources":["../../../src/components/Header/HeaderMoreMenuItem.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AACxC,OAAO,EAAE,SAAS,EAAE,MAAM,6BAA6B,CAAC;AACxD,OAAO,EAAE,OAAO,EAAE,MAAM,qC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AAC,CAAC,CAEd,CACH,CAAC,GACG,GACL,CACP,CAAC;AACJ,CAAC,CACF,CAAC"}
|
|
@@ -3,8 +3,8 @@ import { JSX } from '@redneckz/uni-jsx';
|
|
|
3
3
|
import { useMemo, useRef, useState } from '@redneckz/uni-jsx/lib/hooks';
|
|
4
4
|
import { useActiveRoute } from '../../hooks/useActiveRoute.js';
|
|
5
5
|
import { projectSettings } from '../../ProjectSettings.js';
|
|
6
|
-
import { DropdownMenu } from './DropdownMenu.js';
|
|
7
6
|
import { HeaderChatBotButton } from './HeaderChatBotButton.js';
|
|
7
|
+
import { HeaderMoreMenuItem } from './HeaderMoreMenuItem.js';
|
|
8
8
|
import { HeaderSubMenuItem } from './HeaderSubMenuItem.js';
|
|
9
9
|
import { InternetBankButton } from './InternetBankButton.js';
|
|
10
10
|
export const HeaderSubMenu = JSX(({ subItems = [], version, internetBankButton, dropdownMenuAriaLabel, chatBotAriaLabel }) => {
|
|
@@ -19,7 +19,7 @@ export const HeaderSubMenu = JSX(({ subItems = [], version, internetBankButton,
|
|
|
19
19
|
? handleIntersectionActivation(index)
|
|
20
20
|
: handleIntersectionDeactivation(index));
|
|
21
21
|
}), [subItems]);
|
|
22
|
-
return (_jsxs("nav", { className: "mt-s flex gap-s items-center justify-between", children: [_jsx("div", { ref: subItemsListRef, className: "overflow-hidden whitespace-nowrap pb-s mt-xs space-x-lg", role: "menu", children: subItems.map((_, i) => (_jsx(HeaderSubMenuItem, { className: visibleItemsCount - 1 < i ? 'invisible' : '', active: _ === activeSubItem, observerOptions: observerOptions, onVisibilityChange: subItemsVisibilityHandlers[i], data: _.dataHeader, ..._ }, String(i)))) }), dropDownMenuItems.length ? (_jsx(
|
|
22
|
+
return (_jsxs("nav", { className: "mt-s flex gap-s items-center justify-between", children: [_jsx("div", { ref: subItemsListRef, className: "overflow-hidden whitespace-nowrap pb-s mt-xs space-x-lg", role: "menu", children: subItems.map((_, i) => (_jsx(HeaderSubMenuItem, { className: visibleItemsCount - 1 < i ? 'invisible' : '', active: _ === activeSubItem, activeItem: activeSubItem, observerOptions: observerOptions, onVisibilityChange: subItemsVisibilityHandlers[i], data: _.dataHeader, ..._ }, String(i)))) }), dropDownMenuItems.length ? (_jsx(HeaderMoreMenuItem, { items: dropDownMenuItems, activeItem: activeSubItem, ariaLabel: dropdownMenuAriaLabel })) : null, projectSettings.CHAT_BOT ? (_jsx(HeaderChatBotButton, { version: version, iconVersion: iconVersion, ariaLabel: chatBotAriaLabel })) : null, _jsx(InternetBankButton, { version: version, ...internetBankButton })] }));
|
|
23
23
|
});
|
|
24
24
|
const handleIntersectionActivation = (index) => (prev) => Math.max(prev, index + 1);
|
|
25
25
|
const handleIntersectionDeactivation = (index) => (prev) => Math.min(prev, index);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"HeaderSubMenu.js","sourceRoot":"","sources":["../../../src/components/Header/HeaderSubMenu.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AACxC,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AAExE,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAI5D,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"HeaderSubMenu.js","sourceRoot":"","sources":["../../../src/components/Header/HeaderSubMenu.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AACxC,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AAExE,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAI5D,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAE,kBAAkB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