@geneui/components 3.0.0-next-e06ec94-05082025 → 3.0.0-next-c7054cd-07082025
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/Navigation.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React__default, { useRef, useEffect,
|
|
1
|
+
import React__default, { useState, useRef, useEffect, isValidElement, cloneElement, useContext, Fragment } from 'react';
|
|
2
2
|
import { c as classNames } from './index-ce02421b.js';
|
|
3
3
|
import { _ as _objectWithoutProperties, a as _extends } from './ActivityRecent-b88e2ba8.js';
|
|
4
4
|
import { S as SvgThreeDotsHorizontal } from './ThreeDotsHorizontal-479c2b4b.js';
|
|
@@ -77,8 +77,8 @@ typeof SuppressedError === "function" ? SuppressedError : function (error, suppr
|
|
|
77
77
|
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
78
78
|
};
|
|
79
79
|
|
|
80
|
-
const NavigationItem = ({ title, children, onClick, disabled, selected, depth, Icon, path }) => {
|
|
81
|
-
const [isNavItemOpen, setIsNavItemOpen] =
|
|
80
|
+
const NavigationItem = ({ title, children, onClick, disabled, selected, depth, Icon, path, render }) => {
|
|
81
|
+
const [isNavItemOpen, setIsNavItemOpen] = useState(false);
|
|
82
82
|
const textRef = useRef(null);
|
|
83
83
|
const isTruncated = useEllipsisDetection(textRef, [title]);
|
|
84
84
|
const onClickHandler = () => {
|
|
@@ -92,23 +92,41 @@ const NavigationItem = ({ title, children, onClick, disabled, selected, depth, I
|
|
|
92
92
|
return;
|
|
93
93
|
setIsNavItemOpen(selected);
|
|
94
94
|
}, [title, selected]);
|
|
95
|
+
const itemContent = (React__default.createElement(React__default.Fragment, null,
|
|
96
|
+
Icon && React__default.createElement(Icon, { className: "navigationItem__icon", size: 20 }),
|
|
97
|
+
React__default.createElement(Tooltip, { text: title, isVisible: isTruncated },
|
|
98
|
+
React__default.createElement(Text, { as: "span", variant: "labelMediumMedium", className: "menu__title ellipsis-text", ref: textRef }, title)),
|
|
99
|
+
children && (React__default.createElement(SvgChevronRight, { className: classNames("navigationItem__chevron", {
|
|
100
|
+
navigationItem__chevron_open: isNavItemOpen
|
|
101
|
+
}), size: 20 }))));
|
|
102
|
+
const propsToApply = {
|
|
103
|
+
"aria-expanded": children ? isNavItemOpen : undefined,
|
|
104
|
+
disabled,
|
|
105
|
+
className: classNames("navigationItem__button", `navigationItem__button_shift_${depth}`, {
|
|
106
|
+
navigationItem__button_disabled: disabled,
|
|
107
|
+
navigationItem__button_selected: selected,
|
|
108
|
+
navigationItem__button_pointer_none: selected && !children,
|
|
109
|
+
navigationItem__button_selected_noChildren: !children && selected,
|
|
110
|
+
navigationItem__button_render: render && path
|
|
111
|
+
}),
|
|
112
|
+
onClick: onClickHandler
|
|
113
|
+
};
|
|
114
|
+
const linkData = { path, title, isActive: selected, hasChildren: !!children, isDisabled: disabled };
|
|
115
|
+
const interactiveElement = (() => {
|
|
116
|
+
if (render && path) {
|
|
117
|
+
const renderedElement = render(linkData);
|
|
118
|
+
if (isValidElement(renderedElement)) {
|
|
119
|
+
return cloneElement(renderedElement, Object.assign({}, propsToApply), itemContent);
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
return (React__default.createElement("button", Object.assign({ type: "button" }, propsToApply), itemContent));
|
|
123
|
+
})();
|
|
95
124
|
return (React__default.createElement("div", { className: "navigationItem" },
|
|
96
|
-
|
|
97
|
-
navigationItem__button_disabled: disabled,
|
|
98
|
-
navigationItem__button_selected: selected,
|
|
99
|
-
navigationItem__button_pointer_none: selected && !children,
|
|
100
|
-
navigationItem__button_selected_noChildren: !children && selected
|
|
101
|
-
}), onClick: onClickHandler },
|
|
102
|
-
Icon && React__default.createElement(Icon, { className: "navigationItem__icon", size: 20 }),
|
|
103
|
-
React__default.createElement(Tooltip, { text: title, isVisible: isTruncated },
|
|
104
|
-
React__default.createElement(Text, { as: "span", variant: "labelMediumMedium", className: "menu__title ellipsis-text", ref: textRef }, title)),
|
|
105
|
-
children && (React__default.createElement(SvgChevronRight, { className: classNames("navigationItem__chevron", {
|
|
106
|
-
navigationItem__chevron_open: isNavItemOpen
|
|
107
|
-
}), size: 20 }))),
|
|
125
|
+
interactiveElement,
|
|
108
126
|
isNavItemOpen && children));
|
|
109
127
|
};
|
|
110
128
|
|
|
111
|
-
const NavigationColItem = ({ Icon, selected, disabled, title, onClick, index, onMouseEnter, propsForPopover = {}, opened, path, isVisible, hasChildren, currentSelected }) => {
|
|
129
|
+
const NavigationColItem = ({ Icon, selected, disabled, title, onClick, index, onMouseEnter, propsForPopover = {}, opened, path, isVisible, hasChildren, currentSelected, render }) => {
|
|
112
130
|
const textRef = useRef(null);
|
|
113
131
|
const isTruncated = useEllipsisDetection(textRef, [title]);
|
|
114
132
|
const onClickHandler = (activeIndex) => {
|
|
@@ -121,20 +139,39 @@ const NavigationColItem = ({ Icon, selected, disabled, title, onClick, index, on
|
|
|
121
139
|
onMouseEnter(activeIndex);
|
|
122
140
|
}
|
|
123
141
|
};
|
|
142
|
+
const propsToApply = Object.assign(Object.assign({}, propsForPopover), { "aria-label": title, disabled: disabled || !isVisible, className: classNames("navigation__iconButton", {
|
|
143
|
+
navigation__iconButton_selected: selected,
|
|
144
|
+
navigation__iconButton_currentSelected: currentSelected && !selected && opened,
|
|
145
|
+
navigation__iconButton_pointer_none: selected && !hasChildren,
|
|
146
|
+
navigation__iconButton_disabled: disabled
|
|
147
|
+
}), onClick: () => onClickHandler(index || 0), onMouseEnter: () => onMouseEnterHandler(index || 0) });
|
|
148
|
+
const linkData = {
|
|
149
|
+
path,
|
|
150
|
+
title,
|
|
151
|
+
Icon,
|
|
152
|
+
isActive: selected,
|
|
153
|
+
hasChildren,
|
|
154
|
+
isDisabled: disabled
|
|
155
|
+
};
|
|
156
|
+
const interactiveElement = (() => {
|
|
157
|
+
if (render && path) {
|
|
158
|
+
const renderedElement = render(linkData);
|
|
159
|
+
if (isValidElement(renderedElement)) {
|
|
160
|
+
return cloneElement(renderedElement, Object.assign({}, propsToApply), Icon && React__default.createElement(Icon, null));
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
return (React__default.createElement("button", Object.assign({ type: "button" }, propsToApply), Icon && React__default.createElement(Icon, null)));
|
|
164
|
+
})();
|
|
124
165
|
return (React__default.createElement("div", { className: "navigation__listItem" },
|
|
125
|
-
|
|
126
|
-
navigation__iconButton_selected: selected,
|
|
127
|
-
navigation__iconButton_currentSelected: currentSelected && !selected && opened,
|
|
128
|
-
navigation__iconButton_pointer_none: selected && !hasChildren,
|
|
129
|
-
navigation__iconButton_disabled: disabled
|
|
130
|
-
}), onClick: () => onClickHandler(index), onMouseEnter: () => onMouseEnterHandler(index) }, propsForPopover), Icon && React__default.createElement(Icon, null)),
|
|
166
|
+
interactiveElement,
|
|
131
167
|
title && (React__default.createElement(Tooltip, { text: title, isVisible: isTruncated },
|
|
132
168
|
React__default.createElement(Text, { as: "p", variant: "captionMediumMedium", className: "navigation__listItemText ellipsis-text", ref: textRef }, title)))));
|
|
133
169
|
};
|
|
134
170
|
|
|
135
|
-
var css_248z = ".navigation{display:flex;height:100%;width:100%}.navigation__list{display:flex;height:100%;width:var(--guit-sem-dimension-width-3xlarge)}.navigation__listWrapper{align-items:center;border-inline-end:var(--guit-ref-border-width-thin) var(--guit-ref-border-style-solid) var(--guit-sem-color-border-neutral-2);display:flex;flex-direction:column;overflow:hidden;padding:var(--guit-ref-spacing-xsmall) var(--guit-ref-spacing-xsmall) var(--guit-ref-spacing-2xlarge) var(--guit-ref-spacing-xsmall);width:100%}.navigation__listWrapper>.navigation__listItem{margin-block:var(--guit-ref-spacing-xsmall)}.navigation__listItems{display:flex;flex-flow:column wrap;gap:var(--guit-ref-spacing-xsmall);max-width:var(--guit-sem-dimension-height-xlarge);min-height:0}.navigation__listItem{align-items:center;display:flex;flex-direction:column;width:100%}.navigation__addButton{align-items:center;display:flex;flex:0 0 auto;flex-direction:column;height:var(--guit-sem-dimension-height-large);margin-top:auto;width:var(--guit-sem-dimension-width-large)}.navigation__listItemText{color:var(--guit-sem-color-foreground-neutral-1);max-width:100%;-webkit-user-select:none;user-select:none}.navigation__iconButton{border-radius:var(--guit-ref-radius-3xsmall);height:var(--guit-sem-dimension-height-large);padding:var(--guit-ref-spacing-xsmall);width:var(--guit-sem-dimension-width-large)}.navigation__iconButton_selected{background-color:var(--guit-sem-color-background-selected-2);color:var(--guit-sem-color-foreground-inverse)}.navigation__iconButton_currentSelected{background-color:var(--guit-sem-color-background-neutral-1-pressed)}.navigation__iconButton_disabled{background-color:var(--guit-sem-color-background-neutral-1);pointer-events:none}.navigation__iconButton_disabled,.navigation__iconButton_disabled+.navigation__listItemText{color:var(--guit-sem-color-foreground-disabled)}.navigation__iconButton_pointer_none{pointer-events:none}.navigation__iconButton:not(.navigation__iconButton_selected,.navigation__iconButton_disabled){color:var(--guit-sem-color-foreground-neutral-2)}.navigation__iconButton:not(.navigation__iconButton_selected,.navigation__iconButton_disabled):hover{background-color:var(--guit-sem-color-background-neutral-1-hover)}.navigation__iconButton:not(.navigation__iconButton_selected,.navigation__iconButton_disabled):active{background-color:var(--guit-sem-color-background-neutral-1-pressed)}.navigation__divider{flex:0 0 auto}.navigation__menu{border-inline-end:var(--guit-ref-border-width-thin) var(--guit-ref-border-style-solid) var(--guit-sem-color-border-neutral-2);display:flex;height:100%;width:20rem}.navigation__menu_wrapper{height:100%;padding:var(--guit-ref-spacing-3xsmall) var(--guit-ref-spacing-xsmall)}.navigationItem,.navigation__menu_wrapper{display:flex;flex-direction:column;gap:var(--guit-ref-spacing-3xsmall);width:100%}.navigationItem__button{border-radius:var(--guit-ref-radius-3xsmall);display:flex;gap:var(--guit-ref-spacing-xsmall);padding:var(--guit-ref-spacing-xsmall) var(--guit-ref-spacing-xsmall) var(--guit-ref-spacing-xsmall) var(--guit-ref-spacing-medium);width:100%}.navigationItem__button:hover{background-color:var(--guit-sem-color-background-neutral-1-hover)}.navigationItem__button:active{background-color:var(--guit-sem-color-background-neutral-1-pressed)}.navigationItem__button_selected{color:var(--guit-sem-color-foreground-selected)}.navigationItem__button_selected_noChildren{background:var(--guit-sem-color-background-neutral-3);color:var(--guit-sem-color-foreground-accent-blue)}.navigationItem__button_pointer_none{pointer-events:none}.navigationItem__button_disabled{background-color:var(--guit-sem-color-background-neutral-1);color:var(--guit-sem-color-foreground-disabled);pointer-events:none}.navigationItem__button_shift_1{padding-inline-start:var(--guit-ref-spacing-5xlarge)}.navigationItem__button_shift_2{padding-inline-start:var(--guit-ref-spacing-8xlarge)}.navigationItem__button_shift_3{padding-inline-start:var(--guit-ref-spacing-9xlarge)}.navigationItem__button_shift_4{padding-inline-start:var(--guit-ref-spacing-10xlarge)}.navigationItem__chevron{margin-left:auto}.navigationItem__chevron_open{transform:rotate(90deg)}";
|
|
171
|
+
var css_248z = ".navigation{display:flex;height:100%;width:100%}.navigation__list{display:flex;height:100%;width:var(--guit-sem-dimension-width-3xlarge)}.navigation__listWrapper{align-items:center;border-inline-end:var(--guit-ref-border-width-thin) var(--guit-ref-border-style-solid) var(--guit-sem-color-border-neutral-2);display:flex;flex-direction:column;overflow:hidden;padding:var(--guit-ref-spacing-xsmall) var(--guit-ref-spacing-xsmall) var(--guit-ref-spacing-2xlarge) var(--guit-ref-spacing-xsmall);width:100%}.navigation__listWrapper>.navigation__listItem{margin-block:var(--guit-ref-spacing-xsmall)}.navigation__listItems{display:flex;flex-flow:column wrap;gap:var(--guit-ref-spacing-xsmall);max-width:var(--guit-sem-dimension-height-xlarge);min-height:0}.navigation__listItem{align-items:center;display:flex;flex-direction:column;width:100%}.navigation__addButton{align-items:center;display:flex;flex:0 0 auto;flex-direction:column;height:var(--guit-sem-dimension-height-large);margin-top:auto;width:var(--guit-sem-dimension-width-large)}.navigation__listItemText{color:var(--guit-sem-color-foreground-neutral-1);max-width:100%;-webkit-user-select:none;user-select:none}.navigation__iconButton{border-radius:var(--guit-ref-radius-3xsmall);height:var(--guit-sem-dimension-height-large);padding:var(--guit-ref-spacing-xsmall);width:var(--guit-sem-dimension-width-large)}.navigation__iconButton_selected{background-color:var(--guit-sem-color-background-selected-2);color:var(--guit-sem-color-foreground-inverse)}.navigation__iconButton_currentSelected{background-color:var(--guit-sem-color-background-neutral-1-pressed)}.navigation__iconButton_disabled{background-color:var(--guit-sem-color-background-neutral-1);pointer-events:none}.navigation__iconButton_disabled,.navigation__iconButton_disabled+.navigation__listItemText{color:var(--guit-sem-color-foreground-disabled)}.navigation__iconButton_pointer_none{pointer-events:none}.navigation__iconButton:not(.navigation__iconButton_selected,.navigation__iconButton_disabled){color:var(--guit-sem-color-foreground-neutral-2)}.navigation__iconButton:not(.navigation__iconButton_selected,.navigation__iconButton_disabled):hover{background-color:var(--guit-sem-color-background-neutral-1-hover)}.navigation__iconButton:not(.navigation__iconButton_selected,.navigation__iconButton_disabled):active{background-color:var(--guit-sem-color-background-neutral-1-pressed)}.navigation__divider{flex:0 0 auto}.navigation__menu{border-inline-end:var(--guit-ref-border-width-thin) var(--guit-ref-border-style-solid) var(--guit-sem-color-border-neutral-2);display:flex;height:100%;width:20rem}.navigation__menu_wrapper{height:100%;padding:var(--guit-ref-spacing-3xsmall) var(--guit-ref-spacing-xsmall)}.navigationItem,.navigation__menu_wrapper{display:flex;flex-direction:column;gap:var(--guit-ref-spacing-3xsmall);width:100%}.navigationItem__button{border-radius:var(--guit-ref-radius-3xsmall);display:flex;gap:var(--guit-ref-spacing-xsmall);padding:var(--guit-ref-spacing-xsmall) var(--guit-ref-spacing-xsmall) var(--guit-ref-spacing-xsmall) var(--guit-ref-spacing-medium);width:100%}.navigationItem__button_render{color:inherit}.navigationItem__button:hover{background-color:var(--guit-sem-color-background-neutral-1-hover)}.navigationItem__button:active{background-color:var(--guit-sem-color-background-neutral-1-pressed)}.navigationItem__button_selected{color:var(--guit-sem-color-foreground-selected)}.navigationItem__button_selected_noChildren{background:var(--guit-sem-color-background-neutral-3);color:var(--guit-sem-color-foreground-accent-blue)}.navigationItem__button_pointer_none{pointer-events:none}.navigationItem__button_disabled{background-color:var(--guit-sem-color-background-neutral-1);color:var(--guit-sem-color-foreground-disabled);pointer-events:none}.navigationItem__button_shift_1{padding-inline-start:var(--guit-ref-spacing-5xlarge)}.navigationItem__button_shift_2{padding-inline-start:var(--guit-ref-spacing-8xlarge)}.navigationItem__button_shift_3{padding-inline-start:var(--guit-ref-spacing-9xlarge)}.navigationItem__button_shift_4{padding-inline-start:var(--guit-ref-spacing-10xlarge)}.navigationItem__chevron{margin-left:auto}.navigationItem__chevron_open{transform:rotate(90deg)}";
|
|
136
172
|
styleInject(css_248z);
|
|
137
173
|
|
|
174
|
+
const ELEMENT_HEIGHT = 62;
|
|
138
175
|
const findPath = (navigationData, targetPath, currentPath = []) => {
|
|
139
176
|
for (let i = 0; i < navigationData.length; i++) {
|
|
140
177
|
const item = navigationData[i];
|
|
@@ -154,20 +191,20 @@ const hasDataAndChildren = (data, index) => {
|
|
|
154
191
|
var _a, _b;
|
|
155
192
|
return !!(data && index !== null && ((_a = data[index]) === null || _a === void 0 ? void 0 : _a.children) && ((_b = data[index].children) === null || _b === void 0 ? void 0 : _b.length) > 0);
|
|
156
193
|
};
|
|
157
|
-
const NavMenuContent = ({ data, depth = 0, onClick, activePathIndex }) => {
|
|
194
|
+
const NavMenuContent = ({ data, depth = 0, onClick, activePathIndex, render }) => {
|
|
158
195
|
var _a;
|
|
159
196
|
if (!data)
|
|
160
197
|
return null;
|
|
161
198
|
return (_a = data.children) === null || _a === void 0 ? void 0 : _a.map((item, index) => {
|
|
162
199
|
const itemKey = `${item.title}-${item.path}`;
|
|
163
200
|
return (React__default.createElement(Fragment, { key: itemKey },
|
|
164
|
-
React__default.createElement(NavigationItem, { title: item.title, path: item.path, depth: depth, Icon: item.Icon, onClick: onClick, disabled: item.disabled, selected: index === (activePathIndex === null || activePathIndex === void 0 ? void 0 : activePathIndex[0]) }, item.children && (React__default.createElement(NavMenuContent, { data: item, depth: depth + 1, onClick: onClick, activePathIndex: activePathIndex === null || activePathIndex === void 0 ? void 0 : activePathIndex.slice(1) })))));
|
|
201
|
+
React__default.createElement(NavigationItem, { title: item.title, path: item.path, depth: depth, Icon: item.Icon, onClick: onClick, disabled: item.disabled, selected: index === (activePathIndex === null || activePathIndex === void 0 ? void 0 : activePathIndex[0]), render: render }, item.children && (React__default.createElement(NavMenuContent, { data: item, depth: depth + 1, onClick: onClick, activePathIndex: activePathIndex === null || activePathIndex === void 0 ? void 0 : activePathIndex.slice(1), render: render })))));
|
|
165
202
|
});
|
|
166
203
|
};
|
|
167
204
|
/**
|
|
168
205
|
* Navigation is a vertical component that appears on the left side of a user interface. It provides users with quick access to key features.
|
|
169
206
|
*/
|
|
170
|
-
const Navigation = ({ className, open, navigationData = [], activePath, onClick, navigationCreateData, onNavigationCreateDataClick, moreMenuTitle = "More" }) => {
|
|
207
|
+
const Navigation = ({ className, open, navigationData = [], activePath, onClick, navigationCreateData, onNavigationCreateDataClick, moreMenuTitle = "More", render }) => {
|
|
171
208
|
const [currentDataIndex, setCurrentDataIndex] = useState(null);
|
|
172
209
|
const [hoverDataIndex, setHoverDataIndex] = useState(null);
|
|
173
210
|
const [forceOpen, setForceOpen] = useState(false);
|
|
@@ -213,11 +250,11 @@ const Navigation = ({ className, open, navigationData = [], activePath, onClick,
|
|
|
213
250
|
setMenuData(menuSliceData);
|
|
214
251
|
}, [maxVisibleItems, clonedNavigationData]);
|
|
215
252
|
useEffect(() => {
|
|
216
|
-
|
|
217
|
-
|
|
253
|
+
const navColRefCurrent = navColRef.current;
|
|
254
|
+
if (navColRefCurrent) {
|
|
255
|
+
const { scrollWidth, offsetWidth } = navColRefCurrent;
|
|
218
256
|
if (scrollWidth > offsetWidth) {
|
|
219
|
-
const containerHeight =
|
|
220
|
-
const ELEMENT_HEIGHT = 62;
|
|
257
|
+
const containerHeight = navColRefCurrent.offsetHeight;
|
|
221
258
|
const maxVisibleItemsWithGap = Math.floor(containerHeight / ELEMENT_HEIGHT);
|
|
222
259
|
setMaxVisibleItems(maxVisibleItemsWithGap);
|
|
223
260
|
}
|
|
@@ -312,14 +349,14 @@ const Navigation = ({ className, open, navigationData = [], activePath, onClick,
|
|
|
312
349
|
React__default.createElement("div", { className: "navigation__listWrapper" },
|
|
313
350
|
React__default.createElement("div", { className: "navigation__listItems", ref: navColRef }, clonedNavigationData === null || clonedNavigationData === void 0 ? void 0 : clonedNavigationData.map((item, index) => {
|
|
314
351
|
return (React__default.createElement(Fragment, { key: `${item.title}-${item.path}` },
|
|
315
|
-
React__default.createElement(NavigationColItem, { isVisible: index < maxVisibleItems, Icon: item.Icon, title: item.title, onClick: onNavigationColItemClick, index: index, path: item.path, opened: forceOpen, currentSelected: currentDataIndex === index, selected: index === (activePathIndex === null || activePathIndex === void 0 ? void 0 : activePathIndex[0]), onMouseEnter: onMouseEnterHandler, disabled: item.disabled, propsForPopover: hoverDataIndex === index ? propsForPopover : {}, hasChildren: item.children && item.children.length > 0 }),
|
|
352
|
+
React__default.createElement(NavigationColItem, { isVisible: index < maxVisibleItems, Icon: item.Icon, title: item.title, onClick: onNavigationColItemClick, index: index, path: item.path, opened: forceOpen, currentSelected: currentDataIndex === index, selected: index === (activePathIndex === null || activePathIndex === void 0 ? void 0 : activePathIndex[0]), onMouseEnter: onMouseEnterHandler, disabled: item.disabled, propsForPopover: hoverDataIndex === index ? propsForPopover : {}, hasChildren: item.children && item.children.length > 0, render: render }),
|
|
316
353
|
hoverDataIndex !== null && item.children && item.children.length > 0 && (React__default.createElement(Popover, { setProps: setPropsForPopover, size: "small", position: "right-top", withArrow: true, trigger: "hover", margin: 20, disableReposition: false, ref: popoverRef },
|
|
317
354
|
React__default.createElement(PopoverBody, { withPadding: false },
|
|
318
355
|
React__default.createElement("div", { className: "navigation__menu_wrapper" },
|
|
319
356
|
React__default.createElement(NavMenuContent, { data: clonedNavigationData[hoverDataIndex], onClick: onItemClickHandler, activePathIndex: activePathIndex &&
|
|
320
357
|
hoverDataIndex === activePathIndex[0]
|
|
321
358
|
? activePathIndex.slice(1)
|
|
322
|
-
: null })))))));
|
|
359
|
+
: null, render: render })))))));
|
|
323
360
|
})),
|
|
324
361
|
clonedNavigationData.length > maxVisibleItems && (React__default.createElement(React__default.Fragment, null,
|
|
325
362
|
React__default.createElement(NavigationColItem, { Icon: SvgThreeDotsHorizontal, title: moreMenuTitle, isVisible: true, propsForPopover: menuPropsForPopover }),
|
|
@@ -339,7 +376,7 @@ const Navigation = ({ className, open, navigationData = [], activePath, onClick,
|
|
|
339
376
|
React__default.createElement("div", { className: "navigation__menu_wrapper" },
|
|
340
377
|
React__default.createElement(NavMenuContent, { data: clonedNavigationData[currentDataIndex], onClick: onItemClickHandler, activePathIndex: activePathIndex && currentDataIndex === activePathIndex[0]
|
|
341
378
|
? activePathIndex.slice(1)
|
|
342
|
-
: null })))))))));
|
|
379
|
+
: null, render: render })))))))));
|
|
343
380
|
};
|
|
344
381
|
|
|
345
382
|
export { Navigation as default };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { FC } from "react";
|
|
1
|
+
import { FC, ReactNode } from "react";
|
|
2
2
|
import { IMenuItemProps } from "@components/molecules/Menu";
|
|
3
3
|
import "./Navigation.scss";
|
|
4
4
|
export interface INavigationData {
|
|
@@ -43,6 +43,17 @@ interface INavigationProps {
|
|
|
43
43
|
* Optional custom title for the "More" menu.
|
|
44
44
|
*/
|
|
45
45
|
moreMenuTitle?: string;
|
|
46
|
+
/**
|
|
47
|
+
* Custom render function for navigation links.
|
|
48
|
+
*/
|
|
49
|
+
render?: (linkData: {
|
|
50
|
+
path?: string;
|
|
51
|
+
title?: string;
|
|
52
|
+
isActive?: boolean;
|
|
53
|
+
hasChildren?: boolean;
|
|
54
|
+
isDisabled?: boolean;
|
|
55
|
+
Icon?: FC;
|
|
56
|
+
}) => ReactNode;
|
|
46
57
|
}
|
|
47
58
|
export declare const findPath: (navigationData: INavigationData[], targetPath: string, currentPath?: number[]) => number[] | null;
|
|
48
59
|
/**
|
|
@@ -1,14 +1,16 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { FC, ReactNode } from "react";
|
|
2
2
|
import { IconProps } from "@geneui/icons";
|
|
3
|
+
import { INavigationProps } from "../Navigation";
|
|
3
4
|
interface INavigationItemProps {
|
|
4
5
|
title: string;
|
|
5
|
-
children?:
|
|
6
|
+
children?: ReactNode;
|
|
6
7
|
onClick?: (path: string) => void;
|
|
7
8
|
disabled?: boolean;
|
|
8
9
|
selected?: boolean;
|
|
9
10
|
depth: number;
|
|
10
11
|
Icon?: FC<IconProps>;
|
|
11
12
|
path?: string;
|
|
13
|
+
render?: INavigationProps["render"];
|
|
12
14
|
}
|
|
13
15
|
declare const NavigationItem: FC<INavigationItemProps>;
|
|
14
16
|
export { INavigationItemProps, NavigationItem as default };
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { FC } from "react";
|
|
2
2
|
import { IconProps } from "@geneui/icons";
|
|
3
|
+
import { INavigationProps } from "../Navigation";
|
|
3
4
|
interface INavigationColItemProps {
|
|
4
5
|
Icon?: FC<IconProps>;
|
|
5
6
|
selected?: boolean;
|
|
@@ -14,6 +15,7 @@ interface INavigationColItemProps {
|
|
|
14
15
|
isVisible?: boolean;
|
|
15
16
|
hasChildren?: boolean;
|
|
16
17
|
currentSelected?: boolean;
|
|
18
|
+
render?: INavigationProps["render"];
|
|
17
19
|
}
|
|
18
20
|
declare const NavigationColItem: FC<INavigationColItemProps>;
|
|
19
21
|
export { INavigationColItemProps, NavigationColItem as default };
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@geneui/components",
|
|
3
3
|
"description": "The Gene UI components library designed for BI tools",
|
|
4
|
-
"version": "3.0.0-next-
|
|
4
|
+
"version": "3.0.0-next-c7054cd-07082025",
|
|
5
5
|
"author": "SoftConstruct",
|
|
6
6
|
"homepage": "https://github.com/softconstruct/gene-ui-components#readme",
|
|
7
7
|
"repository": {
|