@redneckz/wildless-cms-uni-blocks 0.14.874 → 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 +127 -93
- 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/bundle/ui-kit/FormField/Fields/ApplicationDateField.d.ts +2 -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/dist/ui-kit/FormField/Fields/ApplicationDateField.d.ts +2 -0
- package/dist/ui-kit/FormField/Fields/ApplicationDateField.js +7 -0
- package/dist/ui-kit/FormField/Fields/ApplicationDateField.js.map +1 -0
- package/dist/ui-kit/FormField/getField.js +2 -2
- package/dist/ui-kit/FormField/getField.js.map +1 -1
- 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/lib/ui-kit/FormField/Fields/ApplicationDateField.d.ts +2 -0
- package/lib/ui-kit/FormField/Fields/ApplicationDateField.js +5 -0
- package/lib/ui-kit/FormField/Fields/ApplicationDateField.js.map +1 -0
- package/lib/ui-kit/FormField/getField.js +2 -2
- package/lib/ui-kit/FormField/getField.js.map +1 -1
- package/mobile/bundle/bundle.umd.js +50 -48
- 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/bundle/ui-kit/FormField/Fields/ApplicationDateField.d.ts +2 -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/dist/ui-kit/FormField/Fields/ApplicationDateField.d.ts +2 -0
- package/mobile/dist/ui-kit/FormField/Fields/ApplicationDateField.js +7 -0
- package/mobile/dist/ui-kit/FormField/Fields/ApplicationDateField.js.map +1 -0
- package/mobile/dist/ui-kit/FormField/getField.js +2 -2
- package/mobile/dist/ui-kit/FormField/getField.js.map +1 -1
- 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/lib/ui-kit/FormField/Fields/ApplicationDateField.d.ts +2 -0
- package/mobile/lib/ui-kit/FormField/Fields/ApplicationDateField.js +5 -0
- package/mobile/lib/ui-kit/FormField/Fields/ApplicationDateField.js.map +1 -0
- package/mobile/lib/ui-kit/FormField/getField.js +2 -2
- package/mobile/lib/ui-kit/FormField/getField.js.map +1 -1
- 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/mobile/src/ui-kit/FormField/Fields/ApplicationDateField.tsx +7 -0
- package/mobile/src/ui-kit/FormField/getField.tsx +2 -4
- 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
- package/src/ui-kit/FormField/Fields/ApplicationDateField.tsx +7 -0
- package/src/ui-kit/FormField/getField.tsx +2 -4
|
@@ -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,qCAAqC,CAAC;AAG9D,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAC1C,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAQ1D,MAAM,CAAC,MAAM,kBAAkB,GAAG,GAAG,CACnC,CAAC,EAAE,SAAS,GAAG,EAAE,EAAE,KAAK,EAAE,UAAU,EAAE,SAAS,GAAG,MAAM,EAAE,EAAE,EAAE;IAC5D,MAAM,CAAC,cAAc,EAAE,EAAE,QAAQ,EAAE,MAAM,EAAE,CAAC,GAAG,OAAO,CAAC,KAAK,CAAC,CAAC;IAE9D,MAAM,YAAY,GAAG,kBAAkB,CAAC;QACtC,KAAK;QACL,OAAO,EAAE,QAAQ;QACjB,MAAM,EAAE,cAAc;QACtB,UAAU;KACX,CAAC,CAAC;IAEH,SAAS,CAAC,GAAG,EAAE;QACb,YAAY,CAAC,OAAO,EAAE,gBAAgB,CAAC,YAAY,EAAE,QAAQ,CAAC,CAAC;QAE/D,OAAO,GAAG,EAAE;YACV,YAAY,CAAC,OAAO,EAAE,mBAAmB,CAAC,YAAY,EAAE,QAAQ,CAAC,CAAC;QACpE,CAAC,CAAC;IACJ,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,OAAO,CACL,cACE,SAAS,EAAE,KAAK,CAAC,cAAc,CAAC,CAAC,CAAC,6BAA6B,CAAC,CAAC,CAAC,EAAE,EAAE,SAAS,CAAC,EAChF,GAAG,EAAE,YAAY,EACjB,IAAI,EAAC,YAAY,YAEjB,iBACE,IAAI,EAAC,QAAQ,EACb,SAAS,EAAC,iDAAiD,gBAC/C,SAAS,EACrB,OAAO,EAAE,MAAM,EACf,IAAI,EAAC,QAAQ,qBACG,UAAU,YAEzB,KAAK,CAAC,CAAC,CAAC;iBACN,IAAI,CAAC,IAAI,CAAC;iBACV,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CACb,cAEE,SAAS,EAAC,iHAAiH,IADtH,MAAM,CAAC,CAAC,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,EAAE,MAAM,sBAAsB,CAAC;AAE1D,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAU1D,MAAM,CAAC,MAAM,aAAa,GAAG,GAAG,CAC9B,CAAC,EAAE,QAAQ,GAAG,EAAE,EAAE,OAAO,EAAE,kBAAkB,EAAE,qBAAqB,EAAE,gBAAgB,EAAE,EAAE,EAAE;IAC1F,MAAM,WAAW,GAAgB,OAAO,KAAK,aAAa,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC;IAE/E,MAAM,CAAC,EAAE,aAAa,CAAC,GAAG,cAAc,CAAC,QAAQ,CAAC,CAAC;IAEnD,MAAM,CAAC,iBAAiB,EAAE,oBAAo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U,EAAE,aAAa,EACzB,SAAS,EAAE,qBAAqB,GAChC,CACH,CAAC,CAAC,CAAC,IAAI,EACP,eAAe,CAAC,QAAQ,CAAC,CAAC,CAAC,CAC1B,KAAC,mBAAmB,IAClB,OAAO,EAAE,OAAO,EAChB,WAAW,EAAE,WAAW,EACxB,SAAS,EAAE,gBAAgB,GAC3B,CACH,CAAC,CAAC,CAAC,IAAI,EACR,KAAC,kBAAkB,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>;
|
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
import { jsx as _jsx } from "@redneckz/uni-jsx/jsx-runtime";
|
|
2
2
|
import { JSX } from '@redneckz/uni-jsx';
|
|
3
|
-
import { useCallback } from '@redneckz/uni-jsx/lib/hooks';
|
|
3
|
+
import { useCallback, useEffect } from '@redneckz/uni-jsx/lib/hooks';
|
|
4
|
+
import { useBool } from '@redneckz/uni-jsx/lib/hooks/useBool';
|
|
4
5
|
import { useIntersectionObserver, } from '../../hooks/useIntersectionObserver.js';
|
|
5
6
|
import { HeaderItem } from '../../ui-kit/HeaderItem/HeaderItem.js';
|
|
6
|
-
|
|
7
|
+
import { useDropdownSubMenu } from './useDropdownSubMenu.js';
|
|
8
|
+
export const HeaderSubMenuItem = JSX(({ observerOptions, onVisibilityChange, children, className, items, activeItem, ...rest }) => {
|
|
9
|
+
const [isOpenDropdown, { setFalse, setTrue }] = useBool(false);
|
|
7
10
|
const observerCallback = useCallback((entries) => {
|
|
8
11
|
if (!entries.length || !onVisibilityChange) {
|
|
9
12
|
return;
|
|
@@ -13,6 +16,20 @@ export const HeaderSubMenuItem = JSX(({ observerOptions, onVisibilityChange, chi
|
|
|
13
16
|
onVisibilityChange(entry.isIntersecting);
|
|
14
17
|
}, [onVisibilityChange]);
|
|
15
18
|
const ref = useIntersectionObserver(observerCallback, observerOptions);
|
|
16
|
-
|
|
19
|
+
const dropdownMenu = useDropdownSubMenu({
|
|
20
|
+
items,
|
|
21
|
+
onClose: setFalse,
|
|
22
|
+
isOpen: isOpenDropdown,
|
|
23
|
+
activeItem,
|
|
24
|
+
});
|
|
25
|
+
useEffect(() => {
|
|
26
|
+
dropdownMenu.current?.addEventListener('mouseenter', setTrue);
|
|
27
|
+
dropdownMenu.current?.addEventListener('mouseleave', setFalse);
|
|
28
|
+
return () => {
|
|
29
|
+
dropdownMenu.current?.addEventListener('mouseenter', setTrue);
|
|
30
|
+
dropdownMenu.current?.removeEventListener('mouseleave', setFalse);
|
|
31
|
+
};
|
|
32
|
+
}, []);
|
|
33
|
+
return (_jsx("div", { className: "inline-block", ref: dropdownMenu, children: _jsx("span", { ref: ref, className: className, role: "menuitem", children: _jsx(HeaderItem, { ...rest, children: children }) }) }));
|
|
17
34
|
});
|
|
18
35
|
//# sourceMappingURL=HeaderSubMenuItem.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"HeaderSubMenuItem.js","sourceRoot":"","sources":["../../../src/components/Header/HeaderSubMenuItem.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AACxC,OAAO,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAC;
|
|
1
|
+
{"version":3,"file":"HeaderSubMenuItem.js","sourceRoot":"","sources":["../../../src/components/Header/HeaderSubMenuItem.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AACxC,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,6BAA6B,CAAC;AACrE,OAAO,EAAE,OAAO,EAAE,MAAM,qCAAqC,CAAC;AAE9D,OAAO,EACL,uBAAuB,GAExB,MAAM,qCAAqC,CAAC;AAG7C,OAAO,EAAE,UAAU,EAAE,MAAM,oCAAoC,CAAC;AAChE,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAU1D,MAAM,CAAC,MAAM,iBAAiB,GAAG,GAAG,CAClC,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,OAAO,CAAC,KAAK,CAAC,CAAC;IAE/D,MAAM,gBAAgB,GAAG,WAAW,CAClC,CAAC,OAAoC,EAAE,EAAE;QACvC,IAAI,CAAC,OAAO,CAAC,MAAM,IAAI,CAAC,kBAAkB,EAAE;YAC1C,OAAO;SACR;QAED,2CAA2C;QAC3C,MAAM,KAAK,GAAG,OAAO,CAAC,OAAO,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;QAE1C,kBAAkB,CAAC,KAAK,CAAC,cAAc,CAAC,CAAC;IAC3C,CAAC,EACD,CAAC,kBAAkB,CAAC,CACrB,CAAC;IACF,MAAM,GAAG,GAAG,uBAAuB,CAAkB,gBAAgB,EAAE,eAAe,CAAC,CAAC;IAExF,MAAM,YAAY,GAAG,kBAAkB,CAAC;QACtC,KAAK;QACL,OAAO,EAAE,QAAQ;QACjB,MAAM,EAAE,cAAc;QACtB,UAAU;KACX,CAAC,CAAC;IAEH,SAAS,CAAC,GAAG,EAAE;QACb,YAAY,CAAC,OAAO,EAAE,gBAAgB,CAAC,YAAY,EAAE,OAAO,CAAC,CAAC;QAC9D,YAAY,CAAC,OAAO,EAAE,gBAAgB,CAAC,YAAY,EAAE,QAAQ,CAAC,CAAC;QAE/D,OAAO,GAAG,EAAE;YACV,YAAY,CAAC,OAAO,EAAE,gBAAgB,CAAC,YAAY,EAAE,OAAO,CAAC,CAAC;YAC9D,YAAY,CAAC,OAAO,EAAE,mBAAmB,CAAC,YAAY,EAAE,QAAQ,CAAC,CAAC;QACpE,CAAC,CAAC;IACJ,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,OAAO,CACL,cAAK,SAAS,EAAC,cAAc,EAAC,GAAG,EAAE,YAAY,YAC7C,eAAM,GAAG,EAAE,GAAG,EAAE,SAAS,EAAE,SAAS,EAAE,IAAI,EAAC,UAAU,YACnD,KAAC,UAAU,OAAK,IAAI,YAAG,QAAQ,GAAc,GACxC,GACH,CACP,CAAC;AACJ,CAAC,CACF,CAAC"}
|
|
@@ -2,7 +2,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "@redneckz/uni-jsx/jsx-runtime";
|
|
|
2
2
|
import { JSX } from '@redneckz/uni-jsx';
|
|
3
3
|
import { useMemo, useRef, useState } from '@redneckz/uni-jsx/lib/hooks';
|
|
4
4
|
import { Logo } from '../../ui-kit/Logo/Logo.js';
|
|
5
|
-
import {
|
|
5
|
+
import { HeaderMoreMenuItem } from './HeaderMoreMenuItem.js';
|
|
6
6
|
import { HeaderSecondaryMenu } from './HeaderSecondaryMenu.js';
|
|
7
7
|
import { HeaderTopMenuItem } from './HeaderTopMenuItem.js';
|
|
8
8
|
export const HeaderTopMenu = JSX(({ navigationItems = [], activeTopItem, dropdownMenuAriaLabel, version, headerData, search, bgColor, logo, }) => {
|
|
@@ -17,7 +17,7 @@ export const HeaderTopMenu = JSX(({ navigationItems = [], activeTopItem, dropdow
|
|
|
17
17
|
}), [navigationItems]);
|
|
18
18
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
19
19
|
const { dataFooter, dataHeader, ...logoProps } = logo ?? {};
|
|
20
|
-
return (_jsxs("div", { className: "flex items-center justify-between", children: [_jsx(Logo, { className: "mr-3xl", bgColor: bgColor, logo: logoProps, data: dataHeader, showTitle: false }), _jsx("div", { ref: topItemsListRef, className: "overflow-hidden min-w-40 pb-xs mt-xs", role: "menu", children: navigationItems.map((_, i) => (_jsx(HeaderTopMenuItem, { className: visibleItemsCount - 1 < i ? 'invisible' : '', active: _ === activeTopItem, observerOptions: observerOptions, onVisibilityChange: topItemsVisibilityHandlers[i], data: _.dataHeader, ..._ }, String(i)))) }), dropDownMenuItems.length ? (_jsx(
|
|
20
|
+
return (_jsxs("div", { className: "flex items-center justify-between", children: [_jsx(Logo, { className: "mr-3xl", bgColor: bgColor, logo: logoProps, data: dataHeader, showTitle: false }), _jsx("div", { ref: topItemsListRef, className: "overflow-hidden min-w-40 pb-xs mt-xs", role: "menu", children: navigationItems.map((_, i) => (_jsx(HeaderTopMenuItem, { className: visibleItemsCount - 1 < i ? 'invisible' : '', active: _ === activeTopItem, observerOptions: observerOptions, onVisibilityChange: topItemsVisibilityHandlers[i], data: _.dataHeader, ..._ }, String(i)))) }), dropDownMenuItems.length ? (_jsx(HeaderMoreMenuItem, { className: "mx-xs rounded-md shadow-blue-gray", items: dropDownMenuItems, activeItem: activeTopItem, ariaLabel: dropdownMenuAriaLabel })) : null, _jsx(HeaderSecondaryMenu, { version: version, className: "ml-auto", search: search, navigationItems: navigationItems, ...headerData })] }));
|
|
21
21
|
});
|
|
22
22
|
const handleIntersectionActivation = (index) => (prev) => Math.max(prev, index + 1);
|
|
23
23
|
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,OAAO,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AACxC,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AAUxE,OAAO,EAAE,IAAI,EAAE,MAAM,wBAAwB,CAAC;AAC9C,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"HeaderTopMenu.js","sourceRoot":"","sources":["../../../src/components/Header/HeaderTopMenu.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AACxC,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AAUxE,OAAO,EAAE,IAAI,EAAE,MAAM,wBAAwB,CAAC;AAC9C,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAaxD,MAAM,CAAC,MAAM,aAAa,GAAG,GAAG,CAC9B,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,CAAC,GAAG,QAAQ,CAAC,eAAe,CAAC,MAAM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C,CAAC,UAAU,KACd,CAAC,IANA,MAAM,CAAC,CAAC,CAAC,CAOd,CACH,CAAC,GACE,EACL,iBAAiB,CAAC,MAAM,CAAC,CAAC,CAAC,CAC1B,KAAC,kBAAkB,IACjB,SAAS,EAAC,mCAAmC,EAC7C,KAAK,EAAE,iBAAiB,EACxB,UAAU,EAAE,aAAa,EACzB,SAAS,EAAE,qBAAqB,GAChC,CACH,CAAC,CAAC,CAAC,IAAI,EACR,KAAC,mBAAmB,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,34 @@
|
|
|
1
|
+
import { jsx as _jsx } from "@redneckz/uni-jsx/jsx-runtime";
|
|
2
|
+
import { useCallback, useEffect, useRef } from '@redneckz/uni-jsx/lib/hooks';
|
|
3
|
+
import { useOutsideClick } from '@redneckz/uni-jsx/lib/hooks/useOutsideClick';
|
|
4
|
+
import { usePopupManager } from '../../ui-kit/PopupManager/usePopupManager.js';
|
|
5
|
+
import { DropdownMenu } from './DropdownMenu.js';
|
|
6
|
+
export function useDropdownSubMenu({ items, activeItem, onClose, isOpen }) {
|
|
7
|
+
const popup = usePopupManager();
|
|
8
|
+
useEffect(() => {
|
|
9
|
+
if (isOpen) {
|
|
10
|
+
popup.close();
|
|
11
|
+
}
|
|
12
|
+
}, [isOpen]);
|
|
13
|
+
const close = useCallback(() => {
|
|
14
|
+
popup.close();
|
|
15
|
+
onClose?.();
|
|
16
|
+
}, [onClose]);
|
|
17
|
+
const parentRef = useRef(null);
|
|
18
|
+
const popupRef = useOutsideClick(close);
|
|
19
|
+
useEffect(() => {
|
|
20
|
+
if (!isOpen || !parentRef.current || !items?.length) {
|
|
21
|
+
return;
|
|
22
|
+
}
|
|
23
|
+
const parentElement = parentRef.current;
|
|
24
|
+
const { top, left, width, height } = parentElement.getBoundingClientRect();
|
|
25
|
+
popup.open({
|
|
26
|
+
popup: _jsx(DropdownMenu, { dropdownRef: popupRef, items: items, activeItem: activeItem }),
|
|
27
|
+
top: top + window.scrollY + height,
|
|
28
|
+
left,
|
|
29
|
+
width,
|
|
30
|
+
});
|
|
31
|
+
}, [isOpen, items, close]);
|
|
32
|
+
return parentRef;
|
|
33
|
+
}
|
|
34
|
+
//# sourceMappingURL=useDropdownSubMenu.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useDropdownSubMenu.js","sourceRoot":"","sources":["../../../src/components/Header/useDropdownSubMenu.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,6BAA6B,CAAC;AAC7E,OAAO,EAAE,eAAe,EAAE,MAAM,6CAA6C,CAAC;AAG9E,OAAO,EAAE,eAAe,EAAE,MA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AS,CAAC;AACnB,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { jsx as _jsx } from "@redneckz/uni-jsx/jsx-runtime";
|
|
2
|
+
import { JSX } from '@redneckz/uni-jsx';
|
|
3
|
+
import { InputControl } from '../../Input/InputControl.js';
|
|
4
|
+
export const ApplicationDateField = JSX(({ field, input }) => (_jsx(InputControl, { label: "\u0414\u0430\u0442\u0430 \u0438 \u0432\u0440\u0435\u043C\u044F \u043E\u0431\u0440\u0430\u0449\u0435\u043D\u0438\u044F \u0432 \u0411\u0430\u043D\u043A", ...field(input?.name ?? '') })));
|
|
5
|
+
//# sourceMappingURL=ApplicationDateField.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ApplicationDateField.js","sourceRoot":"","sources":["../../../../src/ui-kit/FormField/Fields/ApplicationDateField.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AACxC,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAGxD,MAAM,CAAC,MAAM,oBAAoB,GAAG,GAAG,CAAmB,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC,CAC9E,KAAC,YAAY,IAAC,KAAK,EAAC,uJAA+B,KAAK,KAAK,CAAC,KAAK,EAAE,IAAI,IAAI,EAAE,CAAC,GAAI,CACrF,CAAC,CAAC"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { jsx as _jsx } from "@redneckz/uni-jsx/jsx-runtime";
|
|
2
|
-
import { InputControl } from '../Input/InputControl.js';
|
|
3
2
|
import { AcquiringField } from './Fields/AcquiringField.js';
|
|
4
3
|
import { AddressBranchField } from './Fields/AddressBranchField.js';
|
|
5
4
|
import { AmountField } from './Fields/AmountField.js';
|
|
6
5
|
import { AnnualRevenueField } from './Fields/AnnualRevenueField.js';
|
|
6
|
+
import { ApplicationDateField } from './Fields/ApplicationDateField.js';
|
|
7
7
|
import { ApplierTypeField } from './Fields/ApplierTypeField.js';
|
|
8
8
|
import { BankEmpoleeField } from './Fields/BankEmpoleeField.js';
|
|
9
9
|
import { BirthdayField } from './Fields/BirthdayField.js';
|
|
@@ -61,7 +61,7 @@ const InputsMap = {
|
|
|
61
61
|
serviceDirection: ServiceDirectionField,
|
|
62
62
|
bankEmpolee: BankEmpoleeField,
|
|
63
63
|
secondaryPhone: SecondaryPhoneField,
|
|
64
|
-
applicationDate:
|
|
64
|
+
applicationDate: ApplicationDateField,
|
|
65
65
|
region: (props) => getPremium(props?.params?.typeForm) ? (_jsx(RegionPremiumField, { ...props })) : (_jsx(RegionField, { ...props })),
|
|
66
66
|
consentToReceiveMaterials: ConsentToReceiveMaterialsField,
|
|
67
67
|
sufferedFrom: SufferedFromField,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getField.js","sourceRoot":"","sources":["../../../src/ui-kit/FormField/getField.tsx"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"getField.js","sourceRoot":"","sources":["../../../src/ui-kit/FormField/getField.tsx"],"names":[],"mappings":";AAKA,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AACzD,OAAO,EAAE,kBAAkB,EAAE,MAAM,6BAA6B,CAAC;AACjE,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACnD,OAAO,EAAE,kBAAkB,EAAE,MAAM,6BAA6B,CAAC;AACjE,OAAO,EAAE,oBAAoB,EAAE,MAAM,+BAA+B,CAAC;AACrE,OAAO,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAC7D,OAAO,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAC7D,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AACvD,OAAO,EAAE,oBAAoB,EAAE,MAAM,+BAA+B,CAAC;AACrE,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AACrD,OAAO,EAAE,uBA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B;IAC/C,kBAAkB,EAAE,uBAAuB;IAC3C,WAAW,EAAE,gBAAgB;IAC7B,OAAO,EAAE,YAAY;IACrB,IAAI,EAAE,SAAS;IACf,UAAU,EAAE,eAAe;IAC3B,QAAQ,EAAE,aAAa;IACvB,KAAK,EAAE,UAAU;IACjB,KAAK,EAAE,UAAU;IACjB,GAAG,EAAE,QAAQ;IACb,OAAO,EAAE,YAAY;CACtB,CAAC;AAEF,MAAM,CAAC,MAAM,QAAQ,GACnB,CACE,KAA+B,EAC/B,MAA4B,EAC5B,iBAAwC,EAAE,EAC1C,EAAE,CACJ,CAAC,KAAQ,EAAE,CAAS,EAAE,EAAE;IACtB,MAAM,cAAc,GAAG;QACrB,GAAG,SAAS;QACZ,GAAG,cAAc;KAClB,CAAC;IAEF,MAAM,SAAS,GAAG,cAAc,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC;IAErD,OAAO,iBAAiB,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC,IAAI,SAAS,CAAC,CAAC,CAAC,CACxD,wBACE,KAAC,SAAS,IAAC,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,GAAI,IADjD,CAAC,CAEL,CACP,CAAC,CAAC,CAAC,IAAI,CAAC;AACX,CAAC,CAAC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { JSX } from '@redneckz/uni-jsx';
|
|
2
|
+
import { type ButtonProps } from '../../ui-kit/Button/Button';
|
|
3
|
+
|
|
4
|
+
export const DropdownButton = JSX<ButtonProps>(({ onClick, children, ariaLabel }) => {
|
|
5
|
+
if (children) {
|
|
6
|
+
return children;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
return (
|
|
10
|
+
<button
|
|
11
|
+
type="button"
|
|
12
|
+
className="flex justify-between items-center group/btn h-6 gap-2xs"
|
|
13
|
+
aria-label={ariaLabel}
|
|
14
|
+
onClick={onClick}
|
|
15
|
+
role="button"
|
|
16
|
+
aria-labelledby="labeldiv"
|
|
17
|
+
>
|
|
18
|
+
{Array.from({ length: 3 }, (_, i) => (
|
|
19
|
+
<div
|
|
20
|
+
key={i}
|
|
21
|
+
className="w-[3px] h-[3px] rounded bg-primary-text group-hover/btn:bg-primary-hover group-data-transparent:bg-white"
|
|
22
|
+
/>
|
|
23
|
+
))}
|
|
24
|
+
</button>
|
|
25
|
+
);
|
|
26
|
+
});
|
|
@@ -1,8 +1,4 @@
|
|
|
1
1
|
import { JSX } from '@redneckz/uni-jsx';
|
|
2
|
-
import { useCallback, useEffect, useRef } from '@redneckz/uni-jsx/lib/hooks';
|
|
3
|
-
import { useBool } from '@redneckz/uni-jsx/lib/hooks/useBool';
|
|
4
|
-
import { useEventListener } from '@redneckz/uni-jsx/lib/hooks/useEventListener';
|
|
5
|
-
import { useOutsideClick } from '@redneckz/uni-jsx/lib/hooks/useOutsideClick';
|
|
6
2
|
import { useLink } from '../../hooks/useLink';
|
|
7
3
|
import { type ComponentType } from '../../model/ComponentType';
|
|
8
4
|
import { type LinkProps } from '../../model/LinkProps';
|
|
@@ -10,91 +6,25 @@ import { getAspectsAttributes } from '../../utils/dataAttributes';
|
|
|
10
6
|
import { style } from '../../utils/style';
|
|
11
7
|
|
|
12
8
|
interface DropdownMenuProps extends ComponentType {
|
|
13
|
-
|
|
9
|
+
dropdownRef?: { current: HTMLDivElement | null };
|
|
10
|
+
items?: LinkProps[];
|
|
14
11
|
activeItem?: LinkProps;
|
|
15
12
|
ariaLabel?: string;
|
|
16
13
|
}
|
|
17
14
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
const ref = useOutsideClick<HTMLDivElement>(setFalse);
|
|
32
|
-
const dropdownRef = useRef<HTMLDivElement | null>(null);
|
|
33
|
-
|
|
34
|
-
const changeDropdownPosition = useCallback(
|
|
35
|
-
({ isOpened, buttonRef, menuRef }: ChangeDropdownPositionParams) => {
|
|
36
|
-
if (isOpened && buttonRef.current && menuRef.current) {
|
|
37
|
-
const dropdownRect = menuRef.current.getBoundingClientRect();
|
|
38
|
-
const dropdownButtonRect = buttonRef.current.getBoundingClientRect();
|
|
39
|
-
const newDropdownPosition = globalThis.innerWidth - dropdownRect.width;
|
|
40
|
-
|
|
41
|
-
if (dropdownRect.right >= globalThis.innerWidth) {
|
|
42
|
-
menuRef.current.style.left = `${newDropdownPosition}px`;
|
|
43
|
-
} else if (dropdownButtonRect.left > dropdownRect.left) {
|
|
44
|
-
if (newDropdownPosition > dropdownButtonRect.left) {
|
|
45
|
-
menuRef.current.style.left = '';
|
|
46
|
-
} else {
|
|
47
|
-
menuRef.current.style.left = `${newDropdownPosition}px`;
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
},
|
|
52
|
-
[isVisible],
|
|
53
|
-
);
|
|
54
|
-
|
|
55
|
-
useEventListener(globalThis, 'resize', () =>
|
|
56
|
-
changeDropdownPosition({ isOpened: isVisible, buttonRef: ref, menuRef: dropdownRef }),
|
|
57
|
-
);
|
|
58
|
-
|
|
59
|
-
useEffect(() => {
|
|
60
|
-
changeDropdownPosition({ isOpened: isVisible, buttonRef: ref, menuRef: dropdownRef });
|
|
61
|
-
}, [isVisible]);
|
|
62
|
-
|
|
63
|
-
return (
|
|
64
|
-
<div
|
|
65
|
-
className={style(isVisible ? 'rounded-md shadow-blue-gray' : '', className)}
|
|
66
|
-
ref={ref}
|
|
67
|
-
role="navigation"
|
|
68
|
-
>
|
|
69
|
-
<button
|
|
70
|
-
type="button"
|
|
71
|
-
className="group/btn flex justify-between items-center h-6"
|
|
72
|
-
aria-label={ariaLabel}
|
|
73
|
-
onClick={toggle}
|
|
74
|
-
role="button"
|
|
75
|
-
aria-labelledby="labeldiv"
|
|
76
|
-
>
|
|
77
|
-
{Array(3)
|
|
78
|
-
.fill(null)
|
|
79
|
-
.map((_, i) => (
|
|
80
|
-
<div
|
|
81
|
-
key={String(i)}
|
|
82
|
-
className="w-[3px] h-[3px] rounded mr-2xs bg-primary-text group-hover/btn:bg-primary-hover group-data-transparent:bg-white"
|
|
83
|
-
/>
|
|
84
|
-
))}
|
|
85
|
-
</button>
|
|
86
|
-
<div
|
|
87
|
-
ref={dropdownRef}
|
|
88
|
-
className={style('absolute flex flex-col rounded-md bg-white p-xl pb-xs w-56 z-40', {
|
|
89
|
-
hidden: !isVisible,
|
|
90
|
-
})}
|
|
91
|
-
aria-hidden={!isVisible}
|
|
92
|
-
>
|
|
93
|
-
{renderDropdownItems(items, activeItem)}
|
|
94
|
-
</div>
|
|
95
|
-
</div>
|
|
96
|
-
);
|
|
97
|
-
},
|
|
15
|
+
export const DropdownMenu = ({
|
|
16
|
+
dropdownRef,
|
|
17
|
+
items = [],
|
|
18
|
+
activeItem,
|
|
19
|
+
ariaLabel,
|
|
20
|
+
}: DropdownMenuProps) => (
|
|
21
|
+
<div
|
|
22
|
+
ref={dropdownRef}
|
|
23
|
+
className="absolute flex flex-col rounded-md bg-white p-xl pb-xs w-56 z-40"
|
|
24
|
+
aria-label={ariaLabel}
|
|
25
|
+
>
|
|
26
|
+
{renderDropdownItems(items, activeItem)}
|
|
27
|
+
</div>
|
|
98
28
|
);
|
|
99
29
|
|
|
100
30
|
export const DropdownMenuItem = JSX<LinkProps & { isActive?: boolean }>(({ isActive, ...rest }) => {
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { JSX } from '@redneckz/uni-jsx';
|
|
2
|
+
import { useEffect } from '@redneckz/uni-jsx/lib/hooks';
|
|
3
|
+
import { useBool } from '@redneckz/uni-jsx/lib/hooks/useBool';
|
|
4
|
+
import { type ComponentType } from '../../model/ComponentType';
|
|
5
|
+
import { type LinkProps } from '../../model/LinkProps';
|
|
6
|
+
import { style } from '../../utils/style';
|
|
7
|
+
import { useDropdownSubMenu } from './useDropdownSubMenu';
|
|
8
|
+
|
|
9
|
+
interface HeaderMoreMenuItemProps extends ComponentType {
|
|
10
|
+
items: LinkProps[];
|
|
11
|
+
activeItem?: LinkProps;
|
|
12
|
+
ariaLabel?: string;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export const HeaderMoreMenuItem = JSX<HeaderMoreMenuItemProps>(
|
|
16
|
+
({ className = '', items, activeItem, ariaLabel = 'Меню' }) => {
|
|
17
|
+
const [isOpenDropdown, { setFalse, toggle }] = useBool(false);
|
|
18
|
+
|
|
19
|
+
const dropdownMenu = useDropdownSubMenu({
|
|
20
|
+
items,
|
|
21
|
+
onClose: setFalse,
|
|
22
|
+
isOpen: isOpenDropdown,
|
|
23
|
+
activeItem,
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
useEffect(() => {
|
|
27
|
+
dropdownMenu.current?.addEventListener('mouseleave', setFalse);
|
|
28
|
+
|
|
29
|
+
return () => {
|
|
30
|
+
dropdownMenu.current?.removeEventListener('mouseleave', setFalse);
|
|
31
|
+
};
|
|
32
|
+
}, []);
|
|
33
|
+
|
|
34
|
+
return (
|
|
35
|
+
<div
|
|
36
|
+
className={style(isOpenDropdown ? 'rounded-md shadow-blue-gray' : '', className)}
|
|
37
|
+
ref={dropdownMenu}
|
|
38
|
+
role="navigation"
|
|
39
|
+
>
|
|
40
|
+
<button
|
|
41
|
+
type="button"
|
|
42
|
+
className="group/btn flex justify-between items-center h-6"
|
|
43
|
+
aria-label={ariaLabel}
|
|
44
|
+
onClick={toggle}
|
|
45
|
+
role="button"
|
|
46
|
+
aria-labelledby="labeldiv"
|
|
47
|
+
>
|
|
48
|
+
{Array(3)
|
|
49
|
+
.fill(null)
|
|
50
|
+
.map((_, i) => (
|
|
51
|
+
<div
|
|
52
|
+
key={String(i)}
|
|
53
|
+
className="w-[3px] h-[3px] rounded mr-2xs bg-primary-text group-hover/btn:bg-primary-hover group-data-transparent:bg-white"
|
|
54
|
+
/>
|
|
55
|
+
))}
|
|
56
|
+
</button>
|
|
57
|
+
</div>
|
|
58
|
+
);
|
|
59
|
+
},
|
|
60
|
+
);
|
|
@@ -6,8 +6,8 @@ import { type IntersectionObserverOptions } from '../../hooks/useIntersectionObs
|
|
|
6
6
|
import { type BlockVersion } from '../../model/BlockVersion';
|
|
7
7
|
import { type IconVersion } from '../../model/IconVersion';
|
|
8
8
|
import { projectSettings } from '../../ProjectSettings';
|
|
9
|
-
import { DropdownMenu } from './DropdownMenu';
|
|
10
9
|
import { HeaderChatBotButton } from './HeaderChatBotButton';
|
|
10
|
+
import { HeaderMoreMenuItem } from './HeaderMoreMenuItem';
|
|
11
11
|
import { type InternetButtonProps } from './HeaderProps';
|
|
12
12
|
import { HeaderSubMenuItem } from './HeaderSubMenuItem';
|
|
13
13
|
import { InternetBankButton } from './InternetBankButton';
|
|
@@ -56,6 +56,7 @@ export const HeaderSubMenu = JSX<HeaderSubMenuProps>(
|
|
|
56
56
|
key={String(i)}
|
|
57
57
|
className={visibleItemsCount - 1 < i ? 'invisible' : ''}
|
|
58
58
|
active={_ === activeSubItem}
|
|
59
|
+
activeItem={activeSubItem}
|
|
59
60
|
observerOptions={observerOptions}
|
|
60
61
|
onVisibilityChange={subItemsVisibilityHandlers[i]}
|
|
61
62
|
data={_.dataHeader}
|
|
@@ -64,7 +65,7 @@ export const HeaderSubMenu = JSX<HeaderSubMenuProps>(
|
|
|
64
65
|
))}
|
|
65
66
|
</div>
|
|
66
67
|
{dropDownMenuItems.length ? (
|
|
67
|
-
<
|
|
68
|
+
<HeaderMoreMenuItem
|
|
68
69
|
items={dropDownMenuItems}
|
|
69
70
|
activeItem={activeSubItem}
|
|
70
71
|
ariaLabel={dropdownMenuAriaLabel}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { JSX } from '@redneckz/uni-jsx';
|
|
2
|
-
import { useCallback } from '@redneckz/uni-jsx/lib/hooks';
|
|
2
|
+
import { useCallback, useEffect } from '@redneckz/uni-jsx/lib/hooks';
|
|
3
|
+
import { useBool } from '@redneckz/uni-jsx/lib/hooks/useBool';
|
|
4
|
+
import { type NavigationLinkProps } from '../../data/NavigationData';
|
|
3
5
|
import {
|
|
4
6
|
useIntersectionObserver,
|
|
5
7
|
type IntersectionObserverOptions,
|
|
@@ -7,15 +9,20 @@ import {
|
|
|
7
9
|
import { type ComponentType } from '../../model/ComponentType';
|
|
8
10
|
import { type LinkProps } from '../../model/LinkProps';
|
|
9
11
|
import { HeaderItem } from '../../ui-kit/HeaderItem/HeaderItem';
|
|
12
|
+
import { useDropdownSubMenu } from './useDropdownSubMenu';
|
|
10
13
|
|
|
11
14
|
export interface HeaderSubMenuItemProps extends LinkProps, ComponentType {
|
|
12
15
|
active?: boolean;
|
|
16
|
+
activeItem?: LinkProps;
|
|
13
17
|
observerOptions?: IntersectionObserverOptions;
|
|
14
18
|
onVisibilityChange?: (isIntersecting: boolean) => void;
|
|
19
|
+
items?: NavigationLinkProps[];
|
|
15
20
|
}
|
|
16
21
|
|
|
17
22
|
export const HeaderSubMenuItem = JSX<HeaderSubMenuItemProps>(
|
|
18
|
-
({ observerOptions, onVisibilityChange, children, className, ...rest }) => {
|
|
23
|
+
({ observerOptions, onVisibilityChange, children, className, items, activeItem, ...rest }) => {
|
|
24
|
+
const [isOpenDropdown, { setFalse, setTrue }] = useBool(false);
|
|
25
|
+
|
|
19
26
|
const observerCallback = useCallback(
|
|
20
27
|
(entries: IntersectionObserverEntry[]) => {
|
|
21
28
|
if (!entries.length || !onVisibilityChange) {
|
|
@@ -31,10 +38,29 @@ export const HeaderSubMenuItem = JSX<HeaderSubMenuItemProps>(
|
|
|
31
38
|
);
|
|
32
39
|
const ref = useIntersectionObserver<HTMLSpanElement>(observerCallback, observerOptions);
|
|
33
40
|
|
|
41
|
+
const dropdownMenu = useDropdownSubMenu({
|
|
42
|
+
items,
|
|
43
|
+
onClose: setFalse,
|
|
44
|
+
isOpen: isOpenDropdown,
|
|
45
|
+
activeItem,
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
useEffect(() => {
|
|
49
|
+
dropdownMenu.current?.addEventListener('mouseenter', setTrue);
|
|
50
|
+
dropdownMenu.current?.addEventListener('mouseleave', setFalse);
|
|
51
|
+
|
|
52
|
+
return () => {
|
|
53
|
+
dropdownMenu.current?.addEventListener('mouseenter', setTrue);
|
|
54
|
+
dropdownMenu.current?.removeEventListener('mouseleave', setFalse);
|
|
55
|
+
};
|
|
56
|
+
}, []);
|
|
57
|
+
|
|
34
58
|
return (
|
|
35
|
-
<
|
|
36
|
-
<
|
|
37
|
-
|
|
59
|
+
<div className="inline-block" ref={dropdownMenu}>
|
|
60
|
+
<span ref={ref} className={className} role="menuitem">
|
|
61
|
+
<HeaderItem {...rest}>{children}</HeaderItem>
|
|
62
|
+
</span>
|
|
63
|
+
</div>
|
|
38
64
|
);
|
|
39
65
|
},
|
|
40
66
|
);
|
|
@@ -10,7 +10,7 @@ import { type BlockVersion } from '../../model/BlockVersion';
|
|
|
10
10
|
import { type ComponentType } from '../../model/ComponentType';
|
|
11
11
|
import { type LogoType } from '../../model/LogoType';
|
|
12
12
|
import { Logo } from '../../ui-kit/Logo/Logo';
|
|
13
|
-
import {
|
|
13
|
+
import { HeaderMoreMenuItem } from './HeaderMoreMenuItem';
|
|
14
14
|
import { HeaderSecondaryMenu } from './HeaderSecondaryMenu';
|
|
15
15
|
import { HeaderTopMenuItem } from './HeaderTopMenuItem';
|
|
16
16
|
|
|
@@ -80,8 +80,8 @@ export const HeaderTopMenu = JSX<HeaderMenuProps>(
|
|
|
80
80
|
))}
|
|
81
81
|
</div>
|
|
82
82
|
{dropDownMenuItems.length ? (
|
|
83
|
-
<
|
|
84
|
-
className="mx-xs"
|
|
83
|
+
<HeaderMoreMenuItem
|
|
84
|
+
className="mx-xs rounded-md shadow-blue-gray"
|
|
85
85
|
items={dropDownMenuItems}
|
|
86
86
|
activeItem={activeTopItem}
|
|
87
87
|
ariaLabel={dropdownMenuAriaLabel}
|