elseware-ui 2.26.0 → 2.26.1
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/build/index.d.ts +1 -1
- package/build/index.es.js +135 -1
- package/build/index.js +141 -0
- package/package.json +1 -1
package/build/index.d.ts
CHANGED
package/build/index.es.js
CHANGED
|
@@ -146224,6 +146224,140 @@ function WorldMapCountryTable(_a) {
|
|
|
146224
146224
|
return (jsx(DataViewTable, { title: title, data: finalData, columns: columns, sortOptions: sortOptions, sortConfig: sortConfig, searchPlaceholder: "Search countries...", defaultPageSize: 6 }));
|
|
146225
146225
|
}
|
|
146226
146226
|
|
|
146227
|
+
function BoxNavItem(_a) {
|
|
146228
|
+
var icon = _a.icon, name = _a.name, to = _a.to, selected = _a.selected, onClick = _a.onClick;
|
|
146229
|
+
var normalizedTo = to.startsWith("/") ? to : "/".concat(to);
|
|
146230
|
+
var handleClick = function (e) {
|
|
146231
|
+
if (onClick)
|
|
146232
|
+
onClick(e, normalizedTo);
|
|
146233
|
+
};
|
|
146234
|
+
return (jsxs("button", __assign$1({ type: "button", onClick: handleClick, "aria-current": selected ? "page" : undefined, className: classnames("w-full min-w-[80px] flex flex-col items-center justify-center py-3 text-center", "hover:text-secondary-700 hover:bg-gray-300/10 hover:cursor-pointer", selected ? "text-eui-secondary-700 bg-gray-300/10" : "text-gray-400", "eui-theme-transition") }, { children: [jsx("div", __assign$1({ className: "text-xl" }, { children: icon })), jsx("span", __assign$1({ className: "text-[11px]" }, { children: name }))] })));
|
|
146235
|
+
}
|
|
146236
|
+
|
|
146237
|
+
function BoxNav(_a) {
|
|
146238
|
+
var _b = _a.data, data = _b === void 0 ? [] : _b, currentPath = _a.currentPath, onNavigate = _a.onNavigate, navigate = _a.navigate;
|
|
146239
|
+
var pathname = currentPath !== null && currentPath !== void 0 ? currentPath : (typeof window !== "undefined" ? window.location.pathname : "");
|
|
146240
|
+
var current = (pathname.split("/")[1] || "").replace(/^\//, "");
|
|
146241
|
+
var handleNavigate = function (to) {
|
|
146242
|
+
if (onNavigate) {
|
|
146243
|
+
onNavigate(to);
|
|
146244
|
+
}
|
|
146245
|
+
else if (navigate) {
|
|
146246
|
+
navigate(to);
|
|
146247
|
+
}
|
|
146248
|
+
else if (typeof window !== "undefined") {
|
|
146249
|
+
window.location.href = to; // fallback for non-router usage
|
|
146250
|
+
}
|
|
146251
|
+
};
|
|
146252
|
+
return (jsx("div", __assign$1({ className: "flex justify-between" }, { children: data.map(function (item, index) {
|
|
146253
|
+
var normalized = (item.to || "").replace(/^\//, "");
|
|
146254
|
+
var to = normalized ? "/".concat(normalized) : "/";
|
|
146255
|
+
var selected = normalized === current;
|
|
146256
|
+
return (jsx(BoxNavItem, { icon: item.icon, name: item.name, to: to, selected: selected, onClick: function (_, dest) { return handleNavigate(dest); } }, item.to || item.name || index));
|
|
146257
|
+
}) })));
|
|
146258
|
+
}
|
|
146259
|
+
|
|
146260
|
+
var TNContext = function (_a) {
|
|
146261
|
+
var icon = _a.icon, name = _a.name, badge = _a.badge;
|
|
146262
|
+
return (jsxs(Fragment$3, { children: [icon && (jsx("div", __assign$1({ className: "text-base text-gray-500 dark:text-gray-400" }, { children: icon }))), jsx("div", __assign$1({ className: "flex-1" }, { children: name })), badge && jsx("div", { children: badge })] }));
|
|
146263
|
+
};
|
|
146264
|
+
|
|
146265
|
+
var TNItem = function (_a) {
|
|
146266
|
+
var icon = _a.icon, name = _a.name, selected = _a.selected, onClick = _a.onClick;
|
|
146267
|
+
return (jsx("button", __assign$1({ onClick: onClick, className: cn$1("flex items-center gap-2 px-4 py-2 text-sm font-medium", "transition-all duration-200", "text-gray-400", "hover:text-eui-secondary-700", "hover:bg-gray-300/10", selected && ["text-eui-secondary-700", "bg-gray-300/10"]) }, { children: jsx(TNContext, { icon: icon, name: name }) })));
|
|
146268
|
+
};
|
|
146269
|
+
|
|
146270
|
+
var TNDropdownItem = function (_a) {
|
|
146271
|
+
var icon = _a.icon, name = _a.name, badge = _a.badge, to = _a.to, navigate = _a.navigate, onClick = _a.onClick, className = _a.className;
|
|
146272
|
+
var handle = function (e) {
|
|
146273
|
+
if (to) {
|
|
146274
|
+
navigate ? navigate(to) : (window.location.href = to);
|
|
146275
|
+
return;
|
|
146276
|
+
}
|
|
146277
|
+
onClick === null || onClick === void 0 ? void 0 : onClick(e);
|
|
146278
|
+
};
|
|
146279
|
+
return (jsx("div", __assign$1({ onClick: handle, className: cn$1("flex items-center gap-3 px-3 py-3 cursor-pointer border-b border-gray-200 dark:border-gray-700/40", "text-sm font-medium", "text-gray-600 dark:text-gray-400", "hover:bg-gray-100 dark:hover:bg-gray-700/50", "hover:text-gray-900 dark:hover:text-gray-300", "transition-colors duration-200", className) }, { children: jsx(TNContext, { icon: icon, name: name, badge: badge }) })));
|
|
146280
|
+
};
|
|
146281
|
+
|
|
146282
|
+
var TNDropdownTitle = function (_a) {
|
|
146283
|
+
var name = _a.name, className = _a.className;
|
|
146284
|
+
return (jsx("div", __assign$1({ className: cn$1("px-3 py-4 text-xs font-semibold uppercase tracking-wide", "text-gray-500 dark:text-gray-600", className) }, { children: name })));
|
|
146285
|
+
};
|
|
146286
|
+
|
|
146287
|
+
var TNDropdownGroup = function (_a) {
|
|
146288
|
+
var name = _a.name, icon = _a.icon, badge = _a.badge, items = _a.items, navigate = _a.navigate, className = _a.className;
|
|
146289
|
+
var _b = useState(true), open = _b[0], setOpen = _b[1];
|
|
146290
|
+
return (jsxs("div", { children: [jsxs("div", __assign$1({ onClick: function () { return setOpen(function (p) { return !p; }); }, className: cn$1("flex items-center justify-between px-3 py-3 cursor-pointer border-b border-green-900/40", "text-sm font-semibold", "text-gray-900 dark:text-gray-400", "bg-gradient-to-r", "from-gray-100 to-transparent", "dark:from-green-900/30 dark:to-transparent", "hover:from-gray-200 dark:hover:from-green-900/50", "transition-all duration-200", className) }, { children: [jsx("div", __assign$1({ className: "flex items-center gap-3" }, { children: jsx(TNContext, { icon: icon, name: name, badge: badge }) })), jsx(BsChevronDown, { className: cn$1("text-xs transition-transform duration-200", open && "rotate-180") })] })), open && (jsx("div", __assign$1({ className: "ml-2 border-l border-gray-200 dark:border-gray-700 pl-1" }, { children: items.map(function (item, i) {
|
|
146291
|
+
if (item.type === "title") {
|
|
146292
|
+
return jsx(TNDropdownTitle, __assign$1({}, item), i);
|
|
146293
|
+
}
|
|
146294
|
+
if (item.type === "group") {
|
|
146295
|
+
return jsx(TNDropdownGroup, __assign$1({}, item, { navigate: navigate }), i);
|
|
146296
|
+
}
|
|
146297
|
+
return jsx(TNDropdownItem, __assign$1({}, item, { navigate: navigate }), i);
|
|
146298
|
+
}) })))] }));
|
|
146299
|
+
};
|
|
146300
|
+
|
|
146301
|
+
var TNDropdown = function (_a) {
|
|
146302
|
+
var items = _a.items, navigate = _a.navigate, components = _a.components;
|
|
146303
|
+
var Item = (components === null || components === void 0 ? void 0 : components.dropdownItem) || TNDropdownItem;
|
|
146304
|
+
var Group = (components === null || components === void 0 ? void 0 : components.dropdownGroup) || TNDropdownGroup;
|
|
146305
|
+
var Title = (components === null || components === void 0 ? void 0 : components.dropdownTitle) || TNDropdownTitle;
|
|
146306
|
+
return (jsx("div", __assign$1({ className: cn$1("absolute top-full left-0 z-50", "bg-white dark:bg-gray-950", "border border-gray-200 dark:border-gray-800", "shadow-lg", "min-w-[260px]", "w-max", "max-w-[90vw]", "overflow-auto") }, { children: jsx("div", __assign$1({ className: "py-0" }, { children: items.map(function (item, i) {
|
|
146307
|
+
if (item.type === "title")
|
|
146308
|
+
return jsx(Title, __assign$1({}, item), i);
|
|
146309
|
+
if (item.type === "group")
|
|
146310
|
+
return (jsx(Group, __assign$1({}, item, { navigate: navigate, components: components }), i));
|
|
146311
|
+
return jsx(Item, __assign$1({}, item, { navigate: navigate }), i);
|
|
146312
|
+
}) })) })));
|
|
146313
|
+
};
|
|
146314
|
+
|
|
146315
|
+
var TNGroup = function (_a) {
|
|
146316
|
+
var icon = _a.icon, name = _a.name, items = _a.items, navigate = _a.navigate, columns = _a.columns, components = _a.components;
|
|
146317
|
+
var _b = useState(false), open = _b[0], setOpen = _b[1];
|
|
146318
|
+
var timeoutRef = useRef(null);
|
|
146319
|
+
var handleEnter = function () {
|
|
146320
|
+
if (timeoutRef.current)
|
|
146321
|
+
clearTimeout(timeoutRef.current);
|
|
146322
|
+
setOpen(true);
|
|
146323
|
+
};
|
|
146324
|
+
var handleLeave = function () {
|
|
146325
|
+
timeoutRef.current = setTimeout(function () {
|
|
146326
|
+
setOpen(false);
|
|
146327
|
+
}, 150);
|
|
146328
|
+
};
|
|
146329
|
+
var Dropdown = (components === null || components === void 0 ? void 0 : components.dropdown) || TNDropdown;
|
|
146330
|
+
return (jsxs("div", __assign$1({ className: "relative flex items-center", onMouseEnter: handleEnter, onMouseLeave: handleLeave }, { children: [jsx("div", __assign$1({ className: cn$1("flex items-center", "border border-transparent", "transition-all duration-200", "hover:text-eui-secondary-700", "hover:bg-gray-300/10", open && ["text-eui-secondary-700", "bg-gray-300/10"]) }, { children: jsx(TNItem, { icon: icon, name: name }) })), jsx("div", __assign$1({ className: "absolute top-full left-0 -mt-[1px]" }, { children: open && (jsx(Dropdown, { items: items, navigate: navigate, columns: columns, components: components })) }))] })));
|
|
146331
|
+
};
|
|
146332
|
+
|
|
146333
|
+
var TopNav = function (_a) {
|
|
146334
|
+
var _b = _a.items, items = _b === void 0 ? [] : _b, currentPath = _a.currentPath, navigate = _a.navigate, components = _a.components;
|
|
146335
|
+
var pathname = currentPath !== null && currentPath !== void 0 ? currentPath : (typeof window !== "undefined" ? window.location.pathname : "");
|
|
146336
|
+
var current = pathname.split("/")[1];
|
|
146337
|
+
var resolved = {
|
|
146338
|
+
item: (components === null || components === void 0 ? void 0 : components.item) || TNItem,
|
|
146339
|
+
group: (components === null || components === void 0 ? void 0 : components.group) || TNGroup,
|
|
146340
|
+
};
|
|
146341
|
+
var handleNavigate = function (to) {
|
|
146342
|
+
if (!to)
|
|
146343
|
+
return;
|
|
146344
|
+
navigate ? navigate(to) : (window.location.href = to);
|
|
146345
|
+
};
|
|
146346
|
+
var renderNode = function (node, index) {
|
|
146347
|
+
var _a;
|
|
146348
|
+
if (node.type === "item") {
|
|
146349
|
+
var Component = node.component || resolved.item;
|
|
146350
|
+
return (jsx(Component, { icon: node.icon, name: node.name, selected: (_a = node.to) === null || _a === void 0 ? void 0 : _a.includes(current), onClick: function () { return handleNavigate(node.to); } }, node.key || index));
|
|
146351
|
+
}
|
|
146352
|
+
if (node.type === "group") {
|
|
146353
|
+
var Component = node.component || resolved.group;
|
|
146354
|
+
return (jsx(Component, { icon: node.icon, name: node.name, items: node.items, navigate: navigate, columns: node.columns, components: components }, node.key || index));
|
|
146355
|
+
}
|
|
146356
|
+
return null;
|
|
146357
|
+
};
|
|
146358
|
+
return jsx("div", __assign$1({ className: "flex items-center gap-2" }, { children: items.map(renderNode) }));
|
|
146359
|
+
};
|
|
146360
|
+
|
|
146227
146361
|
var useDrawer = function (defaultVisibility) {
|
|
146228
146362
|
if (defaultVisibility === void 0) { defaultVisibility = true; }
|
|
146229
146363
|
var _a = useState(defaultVisibility), show = _a[0], setShow = _a[1];
|
|
@@ -146300,4 +146434,4 @@ function EUIDevLayout(_a) {
|
|
|
146300
146434
|
} }, { children: jsx(GenericLayout, { children: jsxs(Layout, { children: [header, jsx(Content$2, __assign$1({ styles: "pt-[60px]" }, { children: jsx(ContentArea, __assign$1({ enablePadding: true }, { children: children })) })), footer] }) }) })));
|
|
146301
146435
|
}
|
|
146302
146436
|
|
|
146303
|
-
export { Accordion, AsyncComponentWrapper, Avatar, Backdrop, Badge, BarChart, Block, BlockGroup, Brand, Breadcrumb, BreadcrumbItem, Button$2 as Button, Card, CardContent, CardFooter, CardHeader, Chapter, Checkbox, Chip, CloudinaryImage, CloudinaryProvider, CloudinaryVideo, Content$2 as Content, ContentArea, DataView$3 as DataView, DataViewTable, DateSelector, DefaultLayout, Drawer, DrawerToggler, EUIDevLayout, EUIProvider, Flag, Flex, FlexCol, FlexRow, Footer, FooterNav, FooterNavGroup, FooterNavItem, FooterNavItemContext, FooterNavItemTitle, Form, FormResponse, GenericLayout, GlowWrapper, Graph, GraphEdge, GraphNode, GraphRenderer, Grid, Header, HeaderNav, HeaderNavGroup, HeaderNavItem, HeaderNavItemContext, HeaderNavItemTitle, HomeLayout, Image$1 as Image, ImageInput, Info, Input, InputFile, InputLabel, InputList, InputListGroup, InputResponse, Layout, LineChart, Link, List, ListItem, MarkdownEditor, MarkdownViewer, Menu, MenuGroup, MenuItem, MenuItemTitle, Modal, MotionSurface, MultiImageInput, Paragraph, PieChart, PriceTag, ProgressBar, Quote, Radio, RouteTab, RouteTabs, Section, Select$2 as Select, ShapeSwitch, ShowMore, Sidebar, SidebarLayout, SidemenuLayout, Skeleton, Slider, StarRating, StarRatingDistribution, StarRatingInput, Switch, Table, Tag, Tags, TextArea, ThemeContext, ThemeProvider, ThemeSwitch, TitleBanner, Toast, Tooltip$1 as Tooltip, Transition$1 as Transition, TransitionDropdown, TransitionFadeIn, Typography, UnderConstructionBanner, ValueBadge, WorldMap, WorldMapCountryTable, YoutubeVideoPlayer, cn$1 as cn, createForceLayout, createGridLayout, createTreeLayout, getCurrencySymbol, getLayout, isRenderFn, registerLayout, resolveWithGlobal, sendToast, useClickOutside, useCloudinaryConfig, useCurrentTheme, useDrawer, useEUIConfig, useIsMobile, useModal, useTheme };
|
|
146437
|
+
export { Accordion, AsyncComponentWrapper, Avatar, Backdrop, Badge, BarChart, Block, BlockGroup, BoxNav, BoxNavItem, Brand, Breadcrumb, BreadcrumbItem, Button$2 as Button, Card, CardContent, CardFooter, CardHeader, Chapter, Checkbox, Chip, CloudinaryImage, CloudinaryProvider, CloudinaryVideo, Content$2 as Content, ContentArea, DataView$3 as DataView, DataViewTable, DateSelector, DefaultLayout, Drawer, DrawerToggler, EUIDevLayout, EUIProvider, Flag, Flex, FlexCol, FlexRow, Footer, FooterNav, FooterNavGroup, FooterNavItem, FooterNavItemContext, FooterNavItemTitle, Form, FormResponse, GenericLayout, GlowWrapper, Graph, GraphEdge, GraphNode, GraphRenderer, Grid, Header, HeaderNav, HeaderNavGroup, HeaderNavItem, HeaderNavItemContext, HeaderNavItemTitle, HomeLayout, Image$1 as Image, ImageInput, Info, Input, InputFile, InputLabel, InputList, InputListGroup, InputResponse, Layout, LineChart, Link, List, ListItem, MarkdownEditor, MarkdownViewer, Menu, MenuGroup, MenuItem, MenuItemTitle, Modal, MotionSurface, MultiImageInput, Paragraph, PieChart, PriceTag, ProgressBar, Quote, Radio, RouteTab, RouteTabs, Section, Select$2 as Select, ShapeSwitch, ShowMore, Sidebar, SidebarLayout, SidemenuLayout, Skeleton, Slider, StarRating, StarRatingDistribution, StarRatingInput, Switch, TNDropdown, TNDropdownItem, TNDropdownTitle, TNGroup, Table, Tag, Tags, TextArea, ThemeContext, ThemeProvider, ThemeSwitch, TitleBanner, Toast, Tooltip$1 as Tooltip, TopNav, Transition$1 as Transition, TransitionDropdown, TransitionFadeIn, Typography, UnderConstructionBanner, ValueBadge, WorldMap, WorldMapCountryTable, YoutubeVideoPlayer, cn$1 as cn, createForceLayout, createGridLayout, createTreeLayout, getCurrencySymbol, getLayout, isRenderFn, registerLayout, resolveWithGlobal, sendToast, useClickOutside, useCloudinaryConfig, useCurrentTheme, useDrawer, useEUIConfig, useIsMobile, useModal, useTheme };
|
package/build/index.js
CHANGED
|
@@ -146251,6 +146251,140 @@ function WorldMapCountryTable(_a) {
|
|
|
146251
146251
|
return (jsxRuntime.jsx(DataViewTable, { title: title, data: finalData, columns: columns, sortOptions: sortOptions, sortConfig: sortConfig, searchPlaceholder: "Search countries...", defaultPageSize: 6 }));
|
|
146252
146252
|
}
|
|
146253
146253
|
|
|
146254
|
+
function BoxNavItem(_a) {
|
|
146255
|
+
var icon = _a.icon, name = _a.name, to = _a.to, selected = _a.selected, onClick = _a.onClick;
|
|
146256
|
+
var normalizedTo = to.startsWith("/") ? to : "/".concat(to);
|
|
146257
|
+
var handleClick = function (e) {
|
|
146258
|
+
if (onClick)
|
|
146259
|
+
onClick(e, normalizedTo);
|
|
146260
|
+
};
|
|
146261
|
+
return (jsxRuntime.jsxs("button", __assign$1({ type: "button", onClick: handleClick, "aria-current": selected ? "page" : undefined, className: classnames("w-full min-w-[80px] flex flex-col items-center justify-center py-3 text-center", "hover:text-secondary-700 hover:bg-gray-300/10 hover:cursor-pointer", selected ? "text-eui-secondary-700 bg-gray-300/10" : "text-gray-400", "eui-theme-transition") }, { children: [jsxRuntime.jsx("div", __assign$1({ className: "text-xl" }, { children: icon })), jsxRuntime.jsx("span", __assign$1({ className: "text-[11px]" }, { children: name }))] })));
|
|
146262
|
+
}
|
|
146263
|
+
|
|
146264
|
+
function BoxNav(_a) {
|
|
146265
|
+
var _b = _a.data, data = _b === void 0 ? [] : _b, currentPath = _a.currentPath, onNavigate = _a.onNavigate, navigate = _a.navigate;
|
|
146266
|
+
var pathname = currentPath !== null && currentPath !== void 0 ? currentPath : (typeof window !== "undefined" ? window.location.pathname : "");
|
|
146267
|
+
var current = (pathname.split("/")[1] || "").replace(/^\//, "");
|
|
146268
|
+
var handleNavigate = function (to) {
|
|
146269
|
+
if (onNavigate) {
|
|
146270
|
+
onNavigate(to);
|
|
146271
|
+
}
|
|
146272
|
+
else if (navigate) {
|
|
146273
|
+
navigate(to);
|
|
146274
|
+
}
|
|
146275
|
+
else if (typeof window !== "undefined") {
|
|
146276
|
+
window.location.href = to; // fallback for non-router usage
|
|
146277
|
+
}
|
|
146278
|
+
};
|
|
146279
|
+
return (jsxRuntime.jsx("div", __assign$1({ className: "flex justify-between" }, { children: data.map(function (item, index) {
|
|
146280
|
+
var normalized = (item.to || "").replace(/^\//, "");
|
|
146281
|
+
var to = normalized ? "/".concat(normalized) : "/";
|
|
146282
|
+
var selected = normalized === current;
|
|
146283
|
+
return (jsxRuntime.jsx(BoxNavItem, { icon: item.icon, name: item.name, to: to, selected: selected, onClick: function (_, dest) { return handleNavigate(dest); } }, item.to || item.name || index));
|
|
146284
|
+
}) })));
|
|
146285
|
+
}
|
|
146286
|
+
|
|
146287
|
+
var TNContext = function (_a) {
|
|
146288
|
+
var icon = _a.icon, name = _a.name, badge = _a.badge;
|
|
146289
|
+
return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [icon && (jsxRuntime.jsx("div", __assign$1({ className: "text-base text-gray-500 dark:text-gray-400" }, { children: icon }))), jsxRuntime.jsx("div", __assign$1({ className: "flex-1" }, { children: name })), badge && jsxRuntime.jsx("div", { children: badge })] }));
|
|
146290
|
+
};
|
|
146291
|
+
|
|
146292
|
+
var TNItem = function (_a) {
|
|
146293
|
+
var icon = _a.icon, name = _a.name, selected = _a.selected, onClick = _a.onClick;
|
|
146294
|
+
return (jsxRuntime.jsx("button", __assign$1({ onClick: onClick, className: cn$1("flex items-center gap-2 px-4 py-2 text-sm font-medium", "transition-all duration-200", "text-gray-400", "hover:text-eui-secondary-700", "hover:bg-gray-300/10", selected && ["text-eui-secondary-700", "bg-gray-300/10"]) }, { children: jsxRuntime.jsx(TNContext, { icon: icon, name: name }) })));
|
|
146295
|
+
};
|
|
146296
|
+
|
|
146297
|
+
var TNDropdownItem = function (_a) {
|
|
146298
|
+
var icon = _a.icon, name = _a.name, badge = _a.badge, to = _a.to, navigate = _a.navigate, onClick = _a.onClick, className = _a.className;
|
|
146299
|
+
var handle = function (e) {
|
|
146300
|
+
if (to) {
|
|
146301
|
+
navigate ? navigate(to) : (window.location.href = to);
|
|
146302
|
+
return;
|
|
146303
|
+
}
|
|
146304
|
+
onClick === null || onClick === void 0 ? void 0 : onClick(e);
|
|
146305
|
+
};
|
|
146306
|
+
return (jsxRuntime.jsx("div", __assign$1({ onClick: handle, className: cn$1("flex items-center gap-3 px-3 py-3 cursor-pointer border-b border-gray-200 dark:border-gray-700/40", "text-sm font-medium", "text-gray-600 dark:text-gray-400", "hover:bg-gray-100 dark:hover:bg-gray-700/50", "hover:text-gray-900 dark:hover:text-gray-300", "transition-colors duration-200", className) }, { children: jsxRuntime.jsx(TNContext, { icon: icon, name: name, badge: badge }) })));
|
|
146307
|
+
};
|
|
146308
|
+
|
|
146309
|
+
var TNDropdownTitle = function (_a) {
|
|
146310
|
+
var name = _a.name, className = _a.className;
|
|
146311
|
+
return (jsxRuntime.jsx("div", __assign$1({ className: cn$1("px-3 py-4 text-xs font-semibold uppercase tracking-wide", "text-gray-500 dark:text-gray-600", className) }, { children: name })));
|
|
146312
|
+
};
|
|
146313
|
+
|
|
146314
|
+
var TNDropdownGroup = function (_a) {
|
|
146315
|
+
var name = _a.name, icon = _a.icon, badge = _a.badge, items = _a.items, navigate = _a.navigate, className = _a.className;
|
|
146316
|
+
var _b = React.useState(true), open = _b[0], setOpen = _b[1];
|
|
146317
|
+
return (jsxRuntime.jsxs("div", { children: [jsxRuntime.jsxs("div", __assign$1({ onClick: function () { return setOpen(function (p) { return !p; }); }, className: cn$1("flex items-center justify-between px-3 py-3 cursor-pointer border-b border-green-900/40", "text-sm font-semibold", "text-gray-900 dark:text-gray-400", "bg-gradient-to-r", "from-gray-100 to-transparent", "dark:from-green-900/30 dark:to-transparent", "hover:from-gray-200 dark:hover:from-green-900/50", "transition-all duration-200", className) }, { children: [jsxRuntime.jsx("div", __assign$1({ className: "flex items-center gap-3" }, { children: jsxRuntime.jsx(TNContext, { icon: icon, name: name, badge: badge }) })), jsxRuntime.jsx(BsChevronDown, { className: cn$1("text-xs transition-transform duration-200", open && "rotate-180") })] })), open && (jsxRuntime.jsx("div", __assign$1({ className: "ml-2 border-l border-gray-200 dark:border-gray-700 pl-1" }, { children: items.map(function (item, i) {
|
|
146318
|
+
if (item.type === "title") {
|
|
146319
|
+
return jsxRuntime.jsx(TNDropdownTitle, __assign$1({}, item), i);
|
|
146320
|
+
}
|
|
146321
|
+
if (item.type === "group") {
|
|
146322
|
+
return jsxRuntime.jsx(TNDropdownGroup, __assign$1({}, item, { navigate: navigate }), i);
|
|
146323
|
+
}
|
|
146324
|
+
return jsxRuntime.jsx(TNDropdownItem, __assign$1({}, item, { navigate: navigate }), i);
|
|
146325
|
+
}) })))] }));
|
|
146326
|
+
};
|
|
146327
|
+
|
|
146328
|
+
var TNDropdown = function (_a) {
|
|
146329
|
+
var items = _a.items, navigate = _a.navigate, components = _a.components;
|
|
146330
|
+
var Item = (components === null || components === void 0 ? void 0 : components.dropdownItem) || TNDropdownItem;
|
|
146331
|
+
var Group = (components === null || components === void 0 ? void 0 : components.dropdownGroup) || TNDropdownGroup;
|
|
146332
|
+
var Title = (components === null || components === void 0 ? void 0 : components.dropdownTitle) || TNDropdownTitle;
|
|
146333
|
+
return (jsxRuntime.jsx("div", __assign$1({ className: cn$1("absolute top-full left-0 z-50", "bg-white dark:bg-gray-950", "border border-gray-200 dark:border-gray-800", "shadow-lg", "min-w-[260px]", "w-max", "max-w-[90vw]", "overflow-auto") }, { children: jsxRuntime.jsx("div", __assign$1({ className: "py-0" }, { children: items.map(function (item, i) {
|
|
146334
|
+
if (item.type === "title")
|
|
146335
|
+
return jsxRuntime.jsx(Title, __assign$1({}, item), i);
|
|
146336
|
+
if (item.type === "group")
|
|
146337
|
+
return (jsxRuntime.jsx(Group, __assign$1({}, item, { navigate: navigate, components: components }), i));
|
|
146338
|
+
return jsxRuntime.jsx(Item, __assign$1({}, item, { navigate: navigate }), i);
|
|
146339
|
+
}) })) })));
|
|
146340
|
+
};
|
|
146341
|
+
|
|
146342
|
+
var TNGroup = function (_a) {
|
|
146343
|
+
var icon = _a.icon, name = _a.name, items = _a.items, navigate = _a.navigate, columns = _a.columns, components = _a.components;
|
|
146344
|
+
var _b = React.useState(false), open = _b[0], setOpen = _b[1];
|
|
146345
|
+
var timeoutRef = React.useRef(null);
|
|
146346
|
+
var handleEnter = function () {
|
|
146347
|
+
if (timeoutRef.current)
|
|
146348
|
+
clearTimeout(timeoutRef.current);
|
|
146349
|
+
setOpen(true);
|
|
146350
|
+
};
|
|
146351
|
+
var handleLeave = function () {
|
|
146352
|
+
timeoutRef.current = setTimeout(function () {
|
|
146353
|
+
setOpen(false);
|
|
146354
|
+
}, 150);
|
|
146355
|
+
};
|
|
146356
|
+
var Dropdown = (components === null || components === void 0 ? void 0 : components.dropdown) || TNDropdown;
|
|
146357
|
+
return (jsxRuntime.jsxs("div", __assign$1({ className: "relative flex items-center", onMouseEnter: handleEnter, onMouseLeave: handleLeave }, { children: [jsxRuntime.jsx("div", __assign$1({ className: cn$1("flex items-center", "border border-transparent", "transition-all duration-200", "hover:text-eui-secondary-700", "hover:bg-gray-300/10", open && ["text-eui-secondary-700", "bg-gray-300/10"]) }, { children: jsxRuntime.jsx(TNItem, { icon: icon, name: name }) })), jsxRuntime.jsx("div", __assign$1({ className: "absolute top-full left-0 -mt-[1px]" }, { children: open && (jsxRuntime.jsx(Dropdown, { items: items, navigate: navigate, columns: columns, components: components })) }))] })));
|
|
146358
|
+
};
|
|
146359
|
+
|
|
146360
|
+
var TopNav = function (_a) {
|
|
146361
|
+
var _b = _a.items, items = _b === void 0 ? [] : _b, currentPath = _a.currentPath, navigate = _a.navigate, components = _a.components;
|
|
146362
|
+
var pathname = currentPath !== null && currentPath !== void 0 ? currentPath : (typeof window !== "undefined" ? window.location.pathname : "");
|
|
146363
|
+
var current = pathname.split("/")[1];
|
|
146364
|
+
var resolved = {
|
|
146365
|
+
item: (components === null || components === void 0 ? void 0 : components.item) || TNItem,
|
|
146366
|
+
group: (components === null || components === void 0 ? void 0 : components.group) || TNGroup,
|
|
146367
|
+
};
|
|
146368
|
+
var handleNavigate = function (to) {
|
|
146369
|
+
if (!to)
|
|
146370
|
+
return;
|
|
146371
|
+
navigate ? navigate(to) : (window.location.href = to);
|
|
146372
|
+
};
|
|
146373
|
+
var renderNode = function (node, index) {
|
|
146374
|
+
var _a;
|
|
146375
|
+
if (node.type === "item") {
|
|
146376
|
+
var Component = node.component || resolved.item;
|
|
146377
|
+
return (jsxRuntime.jsx(Component, { icon: node.icon, name: node.name, selected: (_a = node.to) === null || _a === void 0 ? void 0 : _a.includes(current), onClick: function () { return handleNavigate(node.to); } }, node.key || index));
|
|
146378
|
+
}
|
|
146379
|
+
if (node.type === "group") {
|
|
146380
|
+
var Component = node.component || resolved.group;
|
|
146381
|
+
return (jsxRuntime.jsx(Component, { icon: node.icon, name: node.name, items: node.items, navigate: navigate, columns: node.columns, components: components }, node.key || index));
|
|
146382
|
+
}
|
|
146383
|
+
return null;
|
|
146384
|
+
};
|
|
146385
|
+
return jsxRuntime.jsx("div", __assign$1({ className: "flex items-center gap-2" }, { children: items.map(renderNode) }));
|
|
146386
|
+
};
|
|
146387
|
+
|
|
146254
146388
|
var useDrawer = function (defaultVisibility) {
|
|
146255
146389
|
if (defaultVisibility === void 0) { defaultVisibility = true; }
|
|
146256
146390
|
var _a = React.useState(defaultVisibility), show = _a[0], setShow = _a[1];
|
|
@@ -146335,6 +146469,8 @@ exports.Badge = Badge;
|
|
|
146335
146469
|
exports.BarChart = BarChart;
|
|
146336
146470
|
exports.Block = Block;
|
|
146337
146471
|
exports.BlockGroup = BlockGroup;
|
|
146472
|
+
exports.BoxNav = BoxNav;
|
|
146473
|
+
exports.BoxNavItem = BoxNavItem;
|
|
146338
146474
|
exports.Brand = Brand;
|
|
146339
146475
|
exports.Breadcrumb = Breadcrumb;
|
|
146340
146476
|
exports.BreadcrumbItem = BreadcrumbItem;
|
|
@@ -146429,6 +146565,10 @@ exports.StarRating = StarRating;
|
|
|
146429
146565
|
exports.StarRatingDistribution = StarRatingDistribution;
|
|
146430
146566
|
exports.StarRatingInput = StarRatingInput;
|
|
146431
146567
|
exports.Switch = Switch;
|
|
146568
|
+
exports.TNDropdown = TNDropdown;
|
|
146569
|
+
exports.TNDropdownItem = TNDropdownItem;
|
|
146570
|
+
exports.TNDropdownTitle = TNDropdownTitle;
|
|
146571
|
+
exports.TNGroup = TNGroup;
|
|
146432
146572
|
exports.Table = Table;
|
|
146433
146573
|
exports.Tag = Tag;
|
|
146434
146574
|
exports.Tags = Tags;
|
|
@@ -146439,6 +146579,7 @@ exports.ThemeSwitch = ThemeSwitch;
|
|
|
146439
146579
|
exports.TitleBanner = TitleBanner;
|
|
146440
146580
|
exports.Toast = Toast;
|
|
146441
146581
|
exports.Tooltip = Tooltip$1;
|
|
146582
|
+
exports.TopNav = TopNav;
|
|
146442
146583
|
exports.Transition = Transition$1;
|
|
146443
146584
|
exports.TransitionDropdown = TransitionDropdown;
|
|
146444
146585
|
exports.TransitionFadeIn = TransitionFadeIn;
|