@beweco/aurora-ui 0.6.76-qa.144 → 0.6.76-qa.158
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/dist/assets/css/styles.css +1 -1
- package/dist/index.cjs.js +59 -7
- package/dist/index.esm.js +59 -7
- package/dist/types/components/menu-claw/MenuClaw.d.ts.map +1 -1
- package/dist/types/components/menu-claw/MenuClaw.types.d.ts +36 -0
- package/dist/types/components/menu-claw/MenuClaw.types.d.ts.map +1 -1
- package/dist/types/components/menu-claw/_internal/menu-claw-history/MenuClawHistoryPanel.d.ts +2 -1
- package/dist/types/components/menu-claw/_internal/menu-claw-history/MenuClawHistoryPanel.d.ts.map +1 -1
- package/dist/types/components/menu-claw/_internal/menu-claw-history/MenuClawHistoryPanel.types.d.ts +12 -0
- package/dist/types/components/menu-claw/_internal/menu-claw-history/MenuClawHistoryPanel.types.d.ts.map +1 -1
- package/dist/types/components/menu-claw/_internal/menu-claw-history/menuClawHistoryLoadMore.d.ts +21 -0
- package/dist/types/components/menu-claw/_internal/menu-claw-history/menuClawHistoryLoadMore.d.ts.map +1 -0
- package/package.json +1 -1
package/dist/index.cjs.js
CHANGED
|
@@ -4430,9 +4430,32 @@ var MenuComponent = React.memo(function Menu(_a) {
|
|
|
4430
4430
|
: "solar:alt-arrow-left-outline", size: "lg", className: "hidden sm:block cursor-pointer", onClick: handleCollapseToggle })] })] }), jsxRuntime.jsx(react.Spacer, { y: 6 }), onUserInfoClick ? (jsxRuntime.jsx("button", { type: "button", onClick: handleUserInfoClick, className: "content__menu--user w-full text-left cursor-pointer rounded-large border-none bg-transparent transition-colors hover:bg-default/40 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-focus ".concat(isCollapsed ? "gap-0" : "gap-3"), children: userInfoContent })) : (jsxRuntime.jsx("div", { className: "content__menu--user ".concat(isCollapsed ? "gap-0" : "gap-3"), children: userInfoContent })), jsxRuntime.jsxs("div", { className: "".concat(!isCollapsed ? "flex-1" : "h-full", " min-h-0 py-6 relative"), children: [!isCollapsed && showScrollArrows && (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [scrollState.canScrollUp && (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx("div", { className: "menu-scroll-fade menu-scroll-fade--up", "aria-hidden": "true" }), jsxRuntime.jsx("button", { type: "button", "aria-label": t.scrollUpAriaLabel, className: "menu-scroll-chevron menu-scroll-chevron--up", onClick: handleScrollUp, children: jsxRuntime.jsx(IconComponent, { icon: "solar:alt-arrow-up-outline", size: "md", "aria-hidden": true }) })] })), scrollState.canScrollDown && (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx("div", { className: "menu-scroll-fade menu-scroll-fade--down", "aria-hidden": "true" }), jsxRuntime.jsx("button", { type: "button", "aria-label": t.scrollDownAriaLabel, className: "menu-scroll-chevron menu-scroll-chevron--down", onClick: handleScrollDown, children: jsxRuntime.jsx(IconComponent, { icon: "solar:alt-arrow-down-outline", size: "md", "aria-hidden": true }) })] }))] })), jsxRuntime.jsx("div", { ref: scrollContainerRef, className: "h-full overflow-y-auto pr-6 -mr-6 [&::-webkit-scrollbar]:hidden [-ms-overflow-style:none] [scrollbar-width:none] select-none ".concat(isDraggingScroll ? "cursor-grabbing" : ""), onMouseDown: handleScrollAreaMouseDown, children: jsxRuntime.jsx(MenuNavList, { defaultSelectedKey: selectedKey, items: menuItems.items, isCollapsed: isCollapsed, onSelect: handleMenuSelect }, selectedKey) })] }), helpSection ? (jsxRuntime.jsx("div", { className: "mt-auto flex flex-col justify-center items-center", children: jsxRuntime.jsx(react.Button, { fullWidth: true, className: " text-default-500 data-[hover=true]:text-default-600", startContent: jsxRuntime.jsx(IconComponent, { className: "text-default-500", icon: "solar:info-circle-line-duotone", size: "md" }), variant: "light", onPress: handleHelpClick, isIconOnly: isCollapsed, children: !isCollapsed && (jsxRuntime.jsx("span", { className: "collapsible-item truncate", children: helpSection.title })) }) })) : null] }) })] }));
|
|
4431
4431
|
});
|
|
4432
4432
|
|
|
4433
|
+
/**
|
|
4434
|
+
* «Cargar más» solo se ofrece si hay otra página, alguien que pueda pedirla y la lista
|
|
4435
|
+
* ya enseña todo lo recibido (desplegada, o sin ítems plegados tras «Ver más»).
|
|
4436
|
+
*/
|
|
4437
|
+
function isLoadMoreVisible(_a) {
|
|
4438
|
+
var hasMore = _a.hasMore, hasOnLoadMore = _a.hasOnLoadMore, isExpanded = _a.isExpanded, hasHiddenItems = _a.hasHiddenItems;
|
|
4439
|
+
return hasMore && hasOnLoadMore && (isExpanded || !hasHiddenItems);
|
|
4440
|
+
}
|
|
4441
|
+
/**
|
|
4442
|
+
* Pulsación de «Cargar más». Con una página en vuelo no hace nada: el botón no usa
|
|
4443
|
+
* `disabled` nativo (perdería el foco del teclado), así que la guarda vive aquí.
|
|
4444
|
+
* Si no, despliega la lista y pide la página, para que lo nuevo no quede tras «Ver más».
|
|
4445
|
+
*/
|
|
4446
|
+
function pressLoadMore(_a) {
|
|
4447
|
+
var isLoadingMore = _a.isLoadingMore, onLoadMore = _a.onLoadMore, expand = _a.expand;
|
|
4448
|
+
if (isLoadingMore) {
|
|
4449
|
+
return;
|
|
4450
|
+
}
|
|
4451
|
+
expand();
|
|
4452
|
+
onLoadMore();
|
|
4453
|
+
}
|
|
4454
|
+
|
|
4433
4455
|
/**
|
|
4434
4456
|
* Sección de historial de conversaciones: botón de nueva conversación + lista de
|
|
4435
|
-
* entradas recientes con "ver más"
|
|
4457
|
+
* entradas recientes con "ver más" y, si el consumidor tiene más páginas,
|
|
4458
|
+
* "cargar más".
|
|
4436
4459
|
*
|
|
4437
4460
|
* La lista tiene **scroll interno propio** (`flex-1 min-h-0 overflow-y-auto`) y
|
|
4438
4461
|
* la sección está acotada en altura, para que crecer el historial no arrastre ni
|
|
@@ -4442,10 +4465,19 @@ var MenuComponent = React.memo(function Menu(_a) {
|
|
|
4442
4465
|
* `rounded-lg`/`rounded-xl` — que es justo lo que difiere del menú compartido.
|
|
4443
4466
|
*/
|
|
4444
4467
|
var MenuClawHistoryPanel = React.memo(function MenuClawHistoryPanel(_a) {
|
|
4445
|
-
var items = _a.items, initialVisibleCount = _a.initialVisibleCount, onNewConversation = _a.onNewConversation, isCollapsed = _a.isCollapsed, title = _a.title, newLabel = _a.newLabel, showMoreLabel = _a.showMoreLabel, showLessLabel = _a.showLessLabel, onBeforeSelect = _a.onBeforeSelect;
|
|
4468
|
+
var items = _a.items, initialVisibleCount = _a.initialVisibleCount, onNewConversation = _a.onNewConversation, hasMore = _a.hasMore, onLoadMore = _a.onLoadMore, isLoadingMore = _a.isLoadingMore, loadMoreLabel = _a.loadMoreLabel, isCollapsed = _a.isCollapsed, title = _a.title, newLabel = _a.newLabel, showMoreLabel = _a.showMoreLabel, showLessLabel = _a.showLessLabel, newsLabel = _a.newsLabel, collapsedNewsLabel = _a.collapsedNewsLabel, onBeforeSelect = _a.onBeforeSelect;
|
|
4446
4469
|
var _b = React.useState(false), isExpanded = _b[0], setIsExpanded = _b[1];
|
|
4447
4470
|
var visibleItems = React.useMemo(function () { return (isExpanded ? items : items.slice(0, initialVisibleCount)); }, [isExpanded, items, initialVisibleCount]);
|
|
4448
4471
|
var hasHiddenItems = items.length > initialVisibleCount;
|
|
4472
|
+
// Punto agregado del lateral comprimido: cuenta TODOS los ítems recibidos, también
|
|
4473
|
+
// los plegados tras «Ver más» (comprimido no hay lista que desplegar).
|
|
4474
|
+
var hasAnyNews = React.useMemo(function () { return items.some(function (item) { return item.hasNews === true; }); }, [items]);
|
|
4475
|
+
// Expandido pero plegado: una novedad detrás de «Ver más» se señala en el botón, para
|
|
4476
|
+
// que no quede a la vista solo en el agregado del lateral comprimido.
|
|
4477
|
+
var hasHiddenNews = React.useMemo(function () {
|
|
4478
|
+
return !isExpanded &&
|
|
4479
|
+
items.slice(initialVisibleCount).some(function (item) { return item.hasNews === true; });
|
|
4480
|
+
}, [isExpanded, items, initialVisibleCount]);
|
|
4449
4481
|
var handleToggleExpand = React.useCallback(function () {
|
|
4450
4482
|
setIsExpanded(function (prev) { return !prev; });
|
|
4451
4483
|
}, []);
|
|
@@ -4464,11 +4496,23 @@ var MenuClawHistoryPanel = React.memo(function MenuClawHistoryPanel(_a) {
|
|
|
4464
4496
|
if (isCollapsed && !onNewConversation) {
|
|
4465
4497
|
return null;
|
|
4466
4498
|
}
|
|
4467
|
-
return (jsxRuntime.jsxs("div", { className: "flex max-h-[40%] min-h-0 flex-col gap-2 pb-3", children: [onNewConversation ? (jsxRuntime.jsxs("button", { type: "button", title: newLabel, onClick: onNewConversation, className: react.cn("flex h-9 shrink-0 items-center gap-3 rounded-xl bg-foreground px-2 text-small font-medium text-background transition-opacity hover:opacity-90", "focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-focus", isCollapsed && "justify-center"), children: [jsxRuntime.
|
|
4499
|
+
return (jsxRuntime.jsxs("div", { className: "flex max-h-[40%] min-h-0 flex-col gap-2 pb-3", children: [onNewConversation ? (jsxRuntime.jsxs("button", { type: "button", title: newLabel, onClick: onNewConversation, className: react.cn("flex h-9 shrink-0 items-center gap-3 rounded-xl bg-foreground px-2 text-small font-medium text-background transition-opacity hover:opacity-90", "focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-focus", isCollapsed && "justify-center"), children: [jsxRuntime.jsxs("span", { className: "relative flex h-5 w-5 shrink-0 items-center justify-center", children: [jsxRuntime.jsx(IconComponent, { icon: "solar:pen-new-square-linear", size: "md", "aria-hidden": true }), isCollapsed && hasAnyNews ? (jsxRuntime.jsx("span", { "data-history-news-aggregate": "", "aria-hidden": "true", className: "absolute -right-1 -top-1 h-2.5 w-2.5 rounded-full bg-primary ring-2 ring-background" })) : null] }), isCollapsed && hasAnyNews ? (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx("span", { className: "sr-only", children: newLabel }), jsxRuntime.jsx("span", { className: "sr-only", children: collapsedNewsLabel })] })) : null, !isCollapsed ? (jsxRuntime.jsx("span", { className: "menu-claw-collapsible truncate", children: newLabel })) : null] })) : null, !isCollapsed && items.length > 0 ? (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx("p", { className: "shrink-0 px-2 pb-1 pt-2 text-tiny font-medium uppercase tracking-wide text-default-400", children: title }), jsxRuntime.jsx("ul", { "aria-label": title, className: "flex min-h-0 flex-1 flex-col gap-0.5 overflow-y-auto [&::-webkit-scrollbar]:hidden [-ms-overflow-style:none] [scrollbar-width:none]", children: visibleItems.map(function (item) { return (jsxRuntime.jsx("li", { children: jsxRuntime.jsxs("button", { type: "button", disabled: item.disabled, "aria-disabled": item.disabled, title: item.title, onClick: function () { return handleItemPress(item); }, className: react.cn("flex min-h-9 w-full items-center gap-3 rounded-lg px-2 py-1.5 text-left text-small text-default-600 transition-colors", "focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-focus", item.disabled
|
|
4468
4500
|
? "cursor-not-allowed opacity-50"
|
|
4469
|
-
: "hover:bg-default-100"), children: [jsxRuntime.jsx("span", { className: "flex h-5 w-5 shrink-0 items-center justify-center text-default-400", children: jsxRuntime.jsx(IconComponent, { icon: "solar:chat-round-dots-linear", size: "md", "aria-hidden": true }) }), jsxRuntime.jsxs("span", { className: "flex min-w-0 flex-col", children: [jsxRuntime.jsx("span", { className: "truncate", children: item.title }), item.meta ? (jsxRuntime.jsx("span", { className: "truncate text-tiny text-default-400", children: item.meta })) : null] })] }) }, item.id)); }) }), hasHiddenItems ? (jsxRuntime.jsxs("button", { type: "button", onClick: handleToggleExpand, "aria-expanded": isExpanded, className: "flex w-full shrink-0 items-center gap-1.5 rounded-lg px-2 py-2 text-tiny font-medium text-default-500 transition-colors hover:bg-default-100 hover:text-default-700 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-focus", children: [jsxRuntime.jsx(IconComponent, { icon: isExpanded
|
|
4501
|
+
: "hover:bg-default-100"), children: [jsxRuntime.jsx("span", { className: "flex h-5 w-5 shrink-0 items-center justify-center text-default-400", children: jsxRuntime.jsx(IconComponent, { icon: "solar:chat-round-dots-linear", size: "md", "aria-hidden": true }) }), jsxRuntime.jsxs("span", { className: "flex min-w-0 flex-1 flex-col", children: [jsxRuntime.jsx("span", { className: "truncate", children: item.title }), item.meta ? (jsxRuntime.jsx("span", { className: "truncate text-tiny text-default-400", children: item.meta })) : null] }), item.hasNews === true ? (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx("span", { "data-history-news-dot": "", "aria-hidden": "true", className: "h-2 w-2 shrink-0 rounded-full bg-primary" }), jsxRuntime.jsx("span", { className: "sr-only", children: newsLabel })] })) : null] }) }, item.id)); }) }), hasHiddenItems ? (jsxRuntime.jsxs("button", { type: "button", onClick: handleToggleExpand, "aria-expanded": isExpanded, className: "flex w-full shrink-0 items-center gap-1.5 rounded-lg px-2 py-2 text-tiny font-medium text-default-500 transition-colors hover:bg-default-100 hover:text-default-700 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-focus", children: [jsxRuntime.jsx(IconComponent, { icon: isExpanded
|
|
4470
4502
|
? "solar:alt-arrow-up-linear"
|
|
4471
|
-
: "solar:alt-arrow-down-linear", size: "sm", "aria-hidden": true }), isExpanded ? showLessLabel : showMoreLabel
|
|
4503
|
+
: "solar:alt-arrow-down-linear", size: "sm", "aria-hidden": true }), isExpanded ? showLessLabel : showMoreLabel, hasHiddenNews ? (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx("span", { "data-history-news-hidden": "", "aria-hidden": "true", className: "h-2 w-2 shrink-0 rounded-full bg-primary" }), jsxRuntime.jsx("span", { className: "sr-only", children: newsLabel })] })) : null] })) : null, onLoadMore &&
|
|
4504
|
+
isLoadMoreVisible({
|
|
4505
|
+
hasMore: hasMore,
|
|
4506
|
+
hasOnLoadMore: true,
|
|
4507
|
+
isExpanded: isExpanded,
|
|
4508
|
+
hasHiddenItems: hasHiddenItems,
|
|
4509
|
+
}) ? (jsxRuntime.jsxs("button", { type: "button", onClick: function () {
|
|
4510
|
+
return pressLoadMore({
|
|
4511
|
+
isLoadingMore: isLoadingMore,
|
|
4512
|
+
onLoadMore: onLoadMore,
|
|
4513
|
+
expand: function () { return setIsExpanded(true); },
|
|
4514
|
+
});
|
|
4515
|
+
}, "aria-disabled": isLoadingMore, "aria-busy": isLoadingMore, className: "flex w-full shrink-0 items-center gap-1.5 rounded-lg px-2 py-2 text-tiny font-medium text-default-500 transition-colors hover:bg-default-100 hover:text-default-700 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-focus aria-disabled:cursor-not-allowed aria-disabled:opacity-50", children: [jsxRuntime.jsx(IconComponent, { icon: "solar:add-circle-linear", size: "sm", "aria-hidden": true }), loadMoreLabel] })) : null] })) : null] }));
|
|
4472
4516
|
});
|
|
4473
4517
|
|
|
4474
4518
|
/** ¿Está la key seleccionada en este ítem o en cualquiera de sus descendientes? */
|
|
@@ -4533,6 +4577,9 @@ var DEFAULT_TRANSLATIONS$7 = {
|
|
|
4533
4577
|
historyNewLabel: "Nueva conversación",
|
|
4534
4578
|
historyShowMoreLabel: "Ver más",
|
|
4535
4579
|
historyShowLessLabel: "Ver menos",
|
|
4580
|
+
historyLoadMoreLabel: "Cargar más",
|
|
4581
|
+
historyNewsLabel: "Con novedades",
|
|
4582
|
+
historyCollapsedNewsLabel: "Hay conversaciones con novedades",
|
|
4536
4583
|
};
|
|
4537
4584
|
/** Ítems del historial visibles antes de pulsar "ver más". */
|
|
4538
4585
|
var DEFAULT_HISTORY_VISIBLE_COUNT = 5;
|
|
@@ -4592,7 +4639,12 @@ var MenuClaw = React.memo(function MenuClaw(_a) {
|
|
|
4592
4639
|
var initialVisibleCount = typeof rawCount === "number" && Number.isFinite(rawCount) && rawCount > 0
|
|
4593
4640
|
? Math.floor(rawCount)
|
|
4594
4641
|
: DEFAULT_HISTORY_VISIBLE_COUNT;
|
|
4595
|
-
return {
|
|
4642
|
+
return {
|
|
4643
|
+
items: items,
|
|
4644
|
+
initialVisibleCount: initialVisibleCount,
|
|
4645
|
+
hasMore: (history === null || history === void 0 ? void 0 : history.hasMore) === true,
|
|
4646
|
+
isLoadingMore: (history === null || history === void 0 ? void 0 : history.isLoadingMore) === true,
|
|
4647
|
+
};
|
|
4596
4648
|
}, [history]);
|
|
4597
4649
|
var bottomBarItems = React.useMemo(function () {
|
|
4598
4650
|
if (!mobileBottomBarGroupKey) {
|
|
@@ -4637,7 +4689,7 @@ var MenuClaw = React.memo(function MenuClaw(_a) {
|
|
|
4637
4689
|
var showBottomBar = (mobileBottomBarGroupKey && bottomBarItems.length > 0) || showNativeMenu;
|
|
4638
4690
|
return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [showBottomBar ? (jsxRuntime.jsx(MenuMobileBottomBar, { items: bottomBarItems, selectedKey: selectedKey, onSelect: handleBottomBarSelect, onMenuPress: handleSidebarOpen, menuLabel: t.menuLabel, navAriaLabel: t.mobileNavAriaLabel, forceVisible: showNativeMenu && bottomBarItems.length === 0 })) : null, jsxRuntime.jsx("button", { type: "button", "aria-label": t.closeSidebarAriaLabel, className: "menu-claw-overlay ".concat(isOpenSidebar ? "menu-claw-overlay--open" : ""), onClick: handleSidebarClose, tabIndex: isOpenSidebar ? 0 : -1 }), jsxRuntime.jsx("div", { className: react.cn("menu-claw", collapsed ? "menu-claw--collapsed" : "menu-claw--expanded", isOpenSidebar && "menu-claw--mobile-open"), "aria-hidden": !isOpenSidebar, children: jsxRuntime.jsxs("div", { className: "menu-claw__content", children: [jsxRuntime.jsxs("div", { className: react.cn("flex items-center", collapsed ? "justify-center" : "justify-end"), children: [jsxRuntime.jsx(IconComponent, { icon: "material-symbols-light:close", size: "lg", className: "block cursor-pointer sm:hidden", onClick: handleSidebarClose }), jsxRuntime.jsx("button", { type: "button", "aria-label": t.toggleSidebarAriaLabel, onClick: handleCollapseToggle, className: "hidden h-7 w-7 shrink-0 cursor-pointer items-center justify-center rounded-lg text-default-500 transition-colors hover:bg-default-100 sm:flex", children: jsxRuntime.jsx(IconComponent, { icon: collapsed
|
|
4639
4691
|
? "solar:alt-arrow-right-linear"
|
|
4640
|
-
: "solar:alt-arrow-left-linear", size: "md", "aria-hidden": true }) })] }), jsxRuntime.jsxs("div", { className: react.cn("flex items-center py-3", collapsed ? "justify-center gap-0" : "gap-3"), children: [jsxRuntime.jsx(react.Avatar, { size: "sm", src: ((_b = userInfo === null || userInfo === void 0 ? void 0 : userInfo.avatar) === null || _b === void 0 ? void 0 : _b.trim()) || undefined, color: !((_c = userInfo === null || userInfo === void 0 ? void 0 : userInfo.avatar) === null || _c === void 0 ? void 0 : _c.trim()) ? "warning" : "default", name: userName, className: "shrink-0" }), !collapsed ? (jsxRuntime.jsxs("div", { className: "menu-claw-collapsible flex min-w-0 flex-col overflow-hidden", children: [jsxRuntime.jsx("p", { className: "truncate text-small font-semibold text-foreground", children: userName }), jsxRuntime.jsx("p", { className: "truncate text-tiny text-default-400", children: userRole })] })) : null] }), jsxRuntime.jsx(MenuClawHistoryPanel, { items: historyConfig.items, initialVisibleCount: historyConfig.initialVisibleCount, onNewConversation: history === null || history === void 0 ? void 0 : history.onNewConversation, isCollapsed: collapsed, title: t.historyTitle, newLabel: t.historyNewLabel, showMoreLabel: t.historyShowMoreLabel, showLessLabel: t.historyShowLessLabel, onBeforeSelect: handleSidebarClose }), jsxRuntime.jsx("nav", { className: "flex min-h-0 flex-1 flex-col overflow-y-auto [&::-webkit-scrollbar]:hidden [-ms-overflow-style:none] [scrollbar-width:none]", children: menuItems.items.map(function (group) {
|
|
4692
|
+
: "solar:alt-arrow-left-linear", size: "md", "aria-hidden": true }) })] }), jsxRuntime.jsxs("div", { className: react.cn("flex items-center py-3", collapsed ? "justify-center gap-0" : "gap-3"), children: [jsxRuntime.jsx(react.Avatar, { size: "sm", src: ((_b = userInfo === null || userInfo === void 0 ? void 0 : userInfo.avatar) === null || _b === void 0 ? void 0 : _b.trim()) || undefined, color: !((_c = userInfo === null || userInfo === void 0 ? void 0 : userInfo.avatar) === null || _c === void 0 ? void 0 : _c.trim()) ? "warning" : "default", name: userName, className: "shrink-0" }), !collapsed ? (jsxRuntime.jsxs("div", { className: "menu-claw-collapsible flex min-w-0 flex-col overflow-hidden", children: [jsxRuntime.jsx("p", { className: "truncate text-small font-semibold text-foreground", children: userName }), jsxRuntime.jsx("p", { className: "truncate text-tiny text-default-400", children: userRole })] })) : null] }), jsxRuntime.jsx(MenuClawHistoryPanel, { items: historyConfig.items, initialVisibleCount: historyConfig.initialVisibleCount, onNewConversation: history === null || history === void 0 ? void 0 : history.onNewConversation, hasMore: historyConfig.hasMore, onLoadMore: history === null || history === void 0 ? void 0 : history.onLoadMore, isLoadingMore: historyConfig.isLoadingMore, isCollapsed: collapsed, title: t.historyTitle, newLabel: t.historyNewLabel, showMoreLabel: t.historyShowMoreLabel, showLessLabel: t.historyShowLessLabel, loadMoreLabel: t.historyLoadMoreLabel, newsLabel: t.historyNewsLabel, collapsedNewsLabel: t.historyCollapsedNewsLabel, onBeforeSelect: handleSidebarClose }), jsxRuntime.jsx("nav", { className: "flex min-h-0 flex-1 flex-col overflow-y-auto [&::-webkit-scrollbar]:hidden [-ms-overflow-style:none] [scrollbar-width:none]", children: menuItems.items.map(function (group) {
|
|
4641
4693
|
var _a;
|
|
4642
4694
|
return (jsxRuntime.jsxs("div", { className: "mb-2", children: [group.title && !collapsed ? (jsxRuntime.jsx("p", { className: "px-2 pb-1 pt-2 text-tiny font-medium uppercase tracking-wide text-default-400", children: group.title })) : null, jsxRuntime.jsx("ul", { className: "flex flex-col gap-0.5", children: ((_a = group.items) !== null && _a !== void 0 ? _a : []).map(function (item) { return (jsxRuntime.jsx(MenuClawNavItem, { item: item, selectedKey: selectedKey, isCollapsed: collapsed, onSelect: handleMenuSelect }, item.key)); }) })] }, group.key));
|
|
4643
4695
|
}) }), helpSection ? (jsxRuntime.jsx("div", { className: "mt-auto flex flex-col items-center justify-center", children: jsxRuntime.jsx(react.Button, { fullWidth: true, className: "text-default-500 data-[hover=true]:text-default-600", startContent: jsxRuntime.jsx(IconComponent, { className: "text-default-500", icon: "solar:info-circle-line-duotone", size: "md" }), variant: "light", onPress: handleHelpClick, isIconOnly: collapsed, children: !collapsed ? (jsxRuntime.jsx("span", { className: "menu-claw-collapsible truncate", children: helpSection.title })) : null }) })) : null] }) })] }));
|
package/dist/index.esm.js
CHANGED
|
@@ -4431,9 +4431,32 @@ var MenuComponent = React.memo(function Menu(_a) {
|
|
|
4431
4431
|
: "solar:alt-arrow-left-outline", size: "lg", className: "hidden sm:block cursor-pointer", onClick: handleCollapseToggle })] })] }), jsx(Spacer, { y: 6 }), onUserInfoClick ? (jsx("button", { type: "button", onClick: handleUserInfoClick, className: "content__menu--user w-full text-left cursor-pointer rounded-large border-none bg-transparent transition-colors hover:bg-default/40 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-focus ".concat(isCollapsed ? "gap-0" : "gap-3"), children: userInfoContent })) : (jsx("div", { className: "content__menu--user ".concat(isCollapsed ? "gap-0" : "gap-3"), children: userInfoContent })), jsxs("div", { className: "".concat(!isCollapsed ? "flex-1" : "h-full", " min-h-0 py-6 relative"), children: [!isCollapsed && showScrollArrows && (jsxs(Fragment, { children: [scrollState.canScrollUp && (jsxs(Fragment, { children: [jsx("div", { className: "menu-scroll-fade menu-scroll-fade--up", "aria-hidden": "true" }), jsx("button", { type: "button", "aria-label": t.scrollUpAriaLabel, className: "menu-scroll-chevron menu-scroll-chevron--up", onClick: handleScrollUp, children: jsx(IconComponent, { icon: "solar:alt-arrow-up-outline", size: "md", "aria-hidden": true }) })] })), scrollState.canScrollDown && (jsxs(Fragment, { children: [jsx("div", { className: "menu-scroll-fade menu-scroll-fade--down", "aria-hidden": "true" }), jsx("button", { type: "button", "aria-label": t.scrollDownAriaLabel, className: "menu-scroll-chevron menu-scroll-chevron--down", onClick: handleScrollDown, children: jsx(IconComponent, { icon: "solar:alt-arrow-down-outline", size: "md", "aria-hidden": true }) })] }))] })), jsx("div", { ref: scrollContainerRef, className: "h-full overflow-y-auto pr-6 -mr-6 [&::-webkit-scrollbar]:hidden [-ms-overflow-style:none] [scrollbar-width:none] select-none ".concat(isDraggingScroll ? "cursor-grabbing" : ""), onMouseDown: handleScrollAreaMouseDown, children: jsx(MenuNavList, { defaultSelectedKey: selectedKey, items: menuItems.items, isCollapsed: isCollapsed, onSelect: handleMenuSelect }, selectedKey) })] }), helpSection ? (jsx("div", { className: "mt-auto flex flex-col justify-center items-center", children: jsx(Button$1, { fullWidth: true, className: " text-default-500 data-[hover=true]:text-default-600", startContent: jsx(IconComponent, { className: "text-default-500", icon: "solar:info-circle-line-duotone", size: "md" }), variant: "light", onPress: handleHelpClick, isIconOnly: isCollapsed, children: !isCollapsed && (jsx("span", { className: "collapsible-item truncate", children: helpSection.title })) }) })) : null] }) })] }));
|
|
4432
4432
|
});
|
|
4433
4433
|
|
|
4434
|
+
/**
|
|
4435
|
+
* «Cargar más» solo se ofrece si hay otra página, alguien que pueda pedirla y la lista
|
|
4436
|
+
* ya enseña todo lo recibido (desplegada, o sin ítems plegados tras «Ver más»).
|
|
4437
|
+
*/
|
|
4438
|
+
function isLoadMoreVisible(_a) {
|
|
4439
|
+
var hasMore = _a.hasMore, hasOnLoadMore = _a.hasOnLoadMore, isExpanded = _a.isExpanded, hasHiddenItems = _a.hasHiddenItems;
|
|
4440
|
+
return hasMore && hasOnLoadMore && (isExpanded || !hasHiddenItems);
|
|
4441
|
+
}
|
|
4442
|
+
/**
|
|
4443
|
+
* Pulsación de «Cargar más». Con una página en vuelo no hace nada: el botón no usa
|
|
4444
|
+
* `disabled` nativo (perdería el foco del teclado), así que la guarda vive aquí.
|
|
4445
|
+
* Si no, despliega la lista y pide la página, para que lo nuevo no quede tras «Ver más».
|
|
4446
|
+
*/
|
|
4447
|
+
function pressLoadMore(_a) {
|
|
4448
|
+
var isLoadingMore = _a.isLoadingMore, onLoadMore = _a.onLoadMore, expand = _a.expand;
|
|
4449
|
+
if (isLoadingMore) {
|
|
4450
|
+
return;
|
|
4451
|
+
}
|
|
4452
|
+
expand();
|
|
4453
|
+
onLoadMore();
|
|
4454
|
+
}
|
|
4455
|
+
|
|
4434
4456
|
/**
|
|
4435
4457
|
* Sección de historial de conversaciones: botón de nueva conversación + lista de
|
|
4436
|
-
* entradas recientes con "ver más"
|
|
4458
|
+
* entradas recientes con "ver más" y, si el consumidor tiene más páginas,
|
|
4459
|
+
* "cargar más".
|
|
4437
4460
|
*
|
|
4438
4461
|
* La lista tiene **scroll interno propio** (`flex-1 min-h-0 overflow-y-auto`) y
|
|
4439
4462
|
* la sección está acotada en altura, para que crecer el historial no arrastre ni
|
|
@@ -4443,10 +4466,19 @@ var MenuComponent = React.memo(function Menu(_a) {
|
|
|
4443
4466
|
* `rounded-lg`/`rounded-xl` — que es justo lo que difiere del menú compartido.
|
|
4444
4467
|
*/
|
|
4445
4468
|
var MenuClawHistoryPanel = React.memo(function MenuClawHistoryPanel(_a) {
|
|
4446
|
-
var items = _a.items, initialVisibleCount = _a.initialVisibleCount, onNewConversation = _a.onNewConversation, isCollapsed = _a.isCollapsed, title = _a.title, newLabel = _a.newLabel, showMoreLabel = _a.showMoreLabel, showLessLabel = _a.showLessLabel, onBeforeSelect = _a.onBeforeSelect;
|
|
4469
|
+
var items = _a.items, initialVisibleCount = _a.initialVisibleCount, onNewConversation = _a.onNewConversation, hasMore = _a.hasMore, onLoadMore = _a.onLoadMore, isLoadingMore = _a.isLoadingMore, loadMoreLabel = _a.loadMoreLabel, isCollapsed = _a.isCollapsed, title = _a.title, newLabel = _a.newLabel, showMoreLabel = _a.showMoreLabel, showLessLabel = _a.showLessLabel, newsLabel = _a.newsLabel, collapsedNewsLabel = _a.collapsedNewsLabel, onBeforeSelect = _a.onBeforeSelect;
|
|
4447
4470
|
var _b = React.useState(false), isExpanded = _b[0], setIsExpanded = _b[1];
|
|
4448
4471
|
var visibleItems = useMemo(function () { return (isExpanded ? items : items.slice(0, initialVisibleCount)); }, [isExpanded, items, initialVisibleCount]);
|
|
4449
4472
|
var hasHiddenItems = items.length > initialVisibleCount;
|
|
4473
|
+
// Punto agregado del lateral comprimido: cuenta TODOS los ítems recibidos, también
|
|
4474
|
+
// los plegados tras «Ver más» (comprimido no hay lista que desplegar).
|
|
4475
|
+
var hasAnyNews = useMemo(function () { return items.some(function (item) { return item.hasNews === true; }); }, [items]);
|
|
4476
|
+
// Expandido pero plegado: una novedad detrás de «Ver más» se señala en el botón, para
|
|
4477
|
+
// que no quede a la vista solo en el agregado del lateral comprimido.
|
|
4478
|
+
var hasHiddenNews = useMemo(function () {
|
|
4479
|
+
return !isExpanded &&
|
|
4480
|
+
items.slice(initialVisibleCount).some(function (item) { return item.hasNews === true; });
|
|
4481
|
+
}, [isExpanded, items, initialVisibleCount]);
|
|
4450
4482
|
var handleToggleExpand = useCallback(function () {
|
|
4451
4483
|
setIsExpanded(function (prev) { return !prev; });
|
|
4452
4484
|
}, []);
|
|
@@ -4465,11 +4497,23 @@ var MenuClawHistoryPanel = React.memo(function MenuClawHistoryPanel(_a) {
|
|
|
4465
4497
|
if (isCollapsed && !onNewConversation) {
|
|
4466
4498
|
return null;
|
|
4467
4499
|
}
|
|
4468
|
-
return (jsxs("div", { className: "flex max-h-[40%] min-h-0 flex-col gap-2 pb-3", children: [onNewConversation ? (jsxs("button", { type: "button", title: newLabel, onClick: onNewConversation, className: cn("flex h-9 shrink-0 items-center gap-3 rounded-xl bg-foreground px-2 text-small font-medium text-background transition-opacity hover:opacity-90", "focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-focus", isCollapsed && "justify-center"), children: [
|
|
4500
|
+
return (jsxs("div", { className: "flex max-h-[40%] min-h-0 flex-col gap-2 pb-3", children: [onNewConversation ? (jsxs("button", { type: "button", title: newLabel, onClick: onNewConversation, className: cn("flex h-9 shrink-0 items-center gap-3 rounded-xl bg-foreground px-2 text-small font-medium text-background transition-opacity hover:opacity-90", "focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-focus", isCollapsed && "justify-center"), children: [jsxs("span", { className: "relative flex h-5 w-5 shrink-0 items-center justify-center", children: [jsx(IconComponent, { icon: "solar:pen-new-square-linear", size: "md", "aria-hidden": true }), isCollapsed && hasAnyNews ? (jsx("span", { "data-history-news-aggregate": "", "aria-hidden": "true", className: "absolute -right-1 -top-1 h-2.5 w-2.5 rounded-full bg-primary ring-2 ring-background" })) : null] }), isCollapsed && hasAnyNews ? (jsxs(Fragment, { children: [jsx("span", { className: "sr-only", children: newLabel }), jsx("span", { className: "sr-only", children: collapsedNewsLabel })] })) : null, !isCollapsed ? (jsx("span", { className: "menu-claw-collapsible truncate", children: newLabel })) : null] })) : null, !isCollapsed && items.length > 0 ? (jsxs(Fragment, { children: [jsx("p", { className: "shrink-0 px-2 pb-1 pt-2 text-tiny font-medium uppercase tracking-wide text-default-400", children: title }), jsx("ul", { "aria-label": title, className: "flex min-h-0 flex-1 flex-col gap-0.5 overflow-y-auto [&::-webkit-scrollbar]:hidden [-ms-overflow-style:none] [scrollbar-width:none]", children: visibleItems.map(function (item) { return (jsx("li", { children: jsxs("button", { type: "button", disabled: item.disabled, "aria-disabled": item.disabled, title: item.title, onClick: function () { return handleItemPress(item); }, className: cn("flex min-h-9 w-full items-center gap-3 rounded-lg px-2 py-1.5 text-left text-small text-default-600 transition-colors", "focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-focus", item.disabled
|
|
4469
4501
|
? "cursor-not-allowed opacity-50"
|
|
4470
|
-
: "hover:bg-default-100"), children: [jsx("span", { className: "flex h-5 w-5 shrink-0 items-center justify-center text-default-400", children: jsx(IconComponent, { icon: "solar:chat-round-dots-linear", size: "md", "aria-hidden": true }) }), jsxs("span", { className: "flex min-w-0 flex-col", children: [jsx("span", { className: "truncate", children: item.title }), item.meta ? (jsx("span", { className: "truncate text-tiny text-default-400", children: item.meta })) : null] })] }) }, item.id)); }) }), hasHiddenItems ? (jsxs("button", { type: "button", onClick: handleToggleExpand, "aria-expanded": isExpanded, className: "flex w-full shrink-0 items-center gap-1.5 rounded-lg px-2 py-2 text-tiny font-medium text-default-500 transition-colors hover:bg-default-100 hover:text-default-700 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-focus", children: [jsx(IconComponent, { icon: isExpanded
|
|
4502
|
+
: "hover:bg-default-100"), children: [jsx("span", { className: "flex h-5 w-5 shrink-0 items-center justify-center text-default-400", children: jsx(IconComponent, { icon: "solar:chat-round-dots-linear", size: "md", "aria-hidden": true }) }), jsxs("span", { className: "flex min-w-0 flex-1 flex-col", children: [jsx("span", { className: "truncate", children: item.title }), item.meta ? (jsx("span", { className: "truncate text-tiny text-default-400", children: item.meta })) : null] }), item.hasNews === true ? (jsxs(Fragment, { children: [jsx("span", { "data-history-news-dot": "", "aria-hidden": "true", className: "h-2 w-2 shrink-0 rounded-full bg-primary" }), jsx("span", { className: "sr-only", children: newsLabel })] })) : null] }) }, item.id)); }) }), hasHiddenItems ? (jsxs("button", { type: "button", onClick: handleToggleExpand, "aria-expanded": isExpanded, className: "flex w-full shrink-0 items-center gap-1.5 rounded-lg px-2 py-2 text-tiny font-medium text-default-500 transition-colors hover:bg-default-100 hover:text-default-700 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-focus", children: [jsx(IconComponent, { icon: isExpanded
|
|
4471
4503
|
? "solar:alt-arrow-up-linear"
|
|
4472
|
-
: "solar:alt-arrow-down-linear", size: "sm", "aria-hidden": true }), isExpanded ? showLessLabel : showMoreLabel
|
|
4504
|
+
: "solar:alt-arrow-down-linear", size: "sm", "aria-hidden": true }), isExpanded ? showLessLabel : showMoreLabel, hasHiddenNews ? (jsxs(Fragment, { children: [jsx("span", { "data-history-news-hidden": "", "aria-hidden": "true", className: "h-2 w-2 shrink-0 rounded-full bg-primary" }), jsx("span", { className: "sr-only", children: newsLabel })] })) : null] })) : null, onLoadMore &&
|
|
4505
|
+
isLoadMoreVisible({
|
|
4506
|
+
hasMore: hasMore,
|
|
4507
|
+
hasOnLoadMore: true,
|
|
4508
|
+
isExpanded: isExpanded,
|
|
4509
|
+
hasHiddenItems: hasHiddenItems,
|
|
4510
|
+
}) ? (jsxs("button", { type: "button", onClick: function () {
|
|
4511
|
+
return pressLoadMore({
|
|
4512
|
+
isLoadingMore: isLoadingMore,
|
|
4513
|
+
onLoadMore: onLoadMore,
|
|
4514
|
+
expand: function () { return setIsExpanded(true); },
|
|
4515
|
+
});
|
|
4516
|
+
}, "aria-disabled": isLoadingMore, "aria-busy": isLoadingMore, className: "flex w-full shrink-0 items-center gap-1.5 rounded-lg px-2 py-2 text-tiny font-medium text-default-500 transition-colors hover:bg-default-100 hover:text-default-700 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-focus aria-disabled:cursor-not-allowed aria-disabled:opacity-50", children: [jsx(IconComponent, { icon: "solar:add-circle-linear", size: "sm", "aria-hidden": true }), loadMoreLabel] })) : null] })) : null] }));
|
|
4473
4517
|
});
|
|
4474
4518
|
|
|
4475
4519
|
/** ¿Está la key seleccionada en este ítem o en cualquiera de sus descendientes? */
|
|
@@ -4534,6 +4578,9 @@ var DEFAULT_TRANSLATIONS$7 = {
|
|
|
4534
4578
|
historyNewLabel: "Nueva conversación",
|
|
4535
4579
|
historyShowMoreLabel: "Ver más",
|
|
4536
4580
|
historyShowLessLabel: "Ver menos",
|
|
4581
|
+
historyLoadMoreLabel: "Cargar más",
|
|
4582
|
+
historyNewsLabel: "Con novedades",
|
|
4583
|
+
historyCollapsedNewsLabel: "Hay conversaciones con novedades",
|
|
4537
4584
|
};
|
|
4538
4585
|
/** Ítems del historial visibles antes de pulsar "ver más". */
|
|
4539
4586
|
var DEFAULT_HISTORY_VISIBLE_COUNT = 5;
|
|
@@ -4593,7 +4640,12 @@ var MenuClaw = React.memo(function MenuClaw(_a) {
|
|
|
4593
4640
|
var initialVisibleCount = typeof rawCount === "number" && Number.isFinite(rawCount) && rawCount > 0
|
|
4594
4641
|
? Math.floor(rawCount)
|
|
4595
4642
|
: DEFAULT_HISTORY_VISIBLE_COUNT;
|
|
4596
|
-
return {
|
|
4643
|
+
return {
|
|
4644
|
+
items: items,
|
|
4645
|
+
initialVisibleCount: initialVisibleCount,
|
|
4646
|
+
hasMore: (history === null || history === void 0 ? void 0 : history.hasMore) === true,
|
|
4647
|
+
isLoadingMore: (history === null || history === void 0 ? void 0 : history.isLoadingMore) === true,
|
|
4648
|
+
};
|
|
4597
4649
|
}, [history]);
|
|
4598
4650
|
var bottomBarItems = useMemo(function () {
|
|
4599
4651
|
if (!mobileBottomBarGroupKey) {
|
|
@@ -4638,7 +4690,7 @@ var MenuClaw = React.memo(function MenuClaw(_a) {
|
|
|
4638
4690
|
var showBottomBar = (mobileBottomBarGroupKey && bottomBarItems.length > 0) || showNativeMenu;
|
|
4639
4691
|
return (jsxs(Fragment, { children: [showBottomBar ? (jsx(MenuMobileBottomBar, { items: bottomBarItems, selectedKey: selectedKey, onSelect: handleBottomBarSelect, onMenuPress: handleSidebarOpen, menuLabel: t.menuLabel, navAriaLabel: t.mobileNavAriaLabel, forceVisible: showNativeMenu && bottomBarItems.length === 0 })) : null, jsx("button", { type: "button", "aria-label": t.closeSidebarAriaLabel, className: "menu-claw-overlay ".concat(isOpenSidebar ? "menu-claw-overlay--open" : ""), onClick: handleSidebarClose, tabIndex: isOpenSidebar ? 0 : -1 }), jsx("div", { className: cn("menu-claw", collapsed ? "menu-claw--collapsed" : "menu-claw--expanded", isOpenSidebar && "menu-claw--mobile-open"), "aria-hidden": !isOpenSidebar, children: jsxs("div", { className: "menu-claw__content", children: [jsxs("div", { className: cn("flex items-center", collapsed ? "justify-center" : "justify-end"), children: [jsx(IconComponent, { icon: "material-symbols-light:close", size: "lg", className: "block cursor-pointer sm:hidden", onClick: handleSidebarClose }), jsx("button", { type: "button", "aria-label": t.toggleSidebarAriaLabel, onClick: handleCollapseToggle, className: "hidden h-7 w-7 shrink-0 cursor-pointer items-center justify-center rounded-lg text-default-500 transition-colors hover:bg-default-100 sm:flex", children: jsx(IconComponent, { icon: collapsed
|
|
4640
4692
|
? "solar:alt-arrow-right-linear"
|
|
4641
|
-
: "solar:alt-arrow-left-linear", size: "md", "aria-hidden": true }) })] }), jsxs("div", { className: cn("flex items-center py-3", collapsed ? "justify-center gap-0" : "gap-3"), children: [jsx(Avatar, { size: "sm", src: ((_b = userInfo === null || userInfo === void 0 ? void 0 : userInfo.avatar) === null || _b === void 0 ? void 0 : _b.trim()) || undefined, color: !((_c = userInfo === null || userInfo === void 0 ? void 0 : userInfo.avatar) === null || _c === void 0 ? void 0 : _c.trim()) ? "warning" : "default", name: userName, className: "shrink-0" }), !collapsed ? (jsxs("div", { className: "menu-claw-collapsible flex min-w-0 flex-col overflow-hidden", children: [jsx("p", { className: "truncate text-small font-semibold text-foreground", children: userName }), jsx("p", { className: "truncate text-tiny text-default-400", children: userRole })] })) : null] }), jsx(MenuClawHistoryPanel, { items: historyConfig.items, initialVisibleCount: historyConfig.initialVisibleCount, onNewConversation: history === null || history === void 0 ? void 0 : history.onNewConversation, isCollapsed: collapsed, title: t.historyTitle, newLabel: t.historyNewLabel, showMoreLabel: t.historyShowMoreLabel, showLessLabel: t.historyShowLessLabel, onBeforeSelect: handleSidebarClose }), jsx("nav", { className: "flex min-h-0 flex-1 flex-col overflow-y-auto [&::-webkit-scrollbar]:hidden [-ms-overflow-style:none] [scrollbar-width:none]", children: menuItems.items.map(function (group) {
|
|
4693
|
+
: "solar:alt-arrow-left-linear", size: "md", "aria-hidden": true }) })] }), jsxs("div", { className: cn("flex items-center py-3", collapsed ? "justify-center gap-0" : "gap-3"), children: [jsx(Avatar, { size: "sm", src: ((_b = userInfo === null || userInfo === void 0 ? void 0 : userInfo.avatar) === null || _b === void 0 ? void 0 : _b.trim()) || undefined, color: !((_c = userInfo === null || userInfo === void 0 ? void 0 : userInfo.avatar) === null || _c === void 0 ? void 0 : _c.trim()) ? "warning" : "default", name: userName, className: "shrink-0" }), !collapsed ? (jsxs("div", { className: "menu-claw-collapsible flex min-w-0 flex-col overflow-hidden", children: [jsx("p", { className: "truncate text-small font-semibold text-foreground", children: userName }), jsx("p", { className: "truncate text-tiny text-default-400", children: userRole })] })) : null] }), jsx(MenuClawHistoryPanel, { items: historyConfig.items, initialVisibleCount: historyConfig.initialVisibleCount, onNewConversation: history === null || history === void 0 ? void 0 : history.onNewConversation, hasMore: historyConfig.hasMore, onLoadMore: history === null || history === void 0 ? void 0 : history.onLoadMore, isLoadingMore: historyConfig.isLoadingMore, isCollapsed: collapsed, title: t.historyTitle, newLabel: t.historyNewLabel, showMoreLabel: t.historyShowMoreLabel, showLessLabel: t.historyShowLessLabel, loadMoreLabel: t.historyLoadMoreLabel, newsLabel: t.historyNewsLabel, collapsedNewsLabel: t.historyCollapsedNewsLabel, onBeforeSelect: handleSidebarClose }), jsx("nav", { className: "flex min-h-0 flex-1 flex-col overflow-y-auto [&::-webkit-scrollbar]:hidden [-ms-overflow-style:none] [scrollbar-width:none]", children: menuItems.items.map(function (group) {
|
|
4642
4694
|
var _a;
|
|
4643
4695
|
return (jsxs("div", { className: "mb-2", children: [group.title && !collapsed ? (jsx("p", { className: "px-2 pb-1 pt-2 text-tiny font-medium uppercase tracking-wide text-default-400", children: group.title })) : null, jsx("ul", { className: "flex flex-col gap-0.5", children: ((_a = group.items) !== null && _a !== void 0 ? _a : []).map(function (item) { return (jsx(MenuClawNavItem, { item: item, selectedKey: selectedKey, isCollapsed: collapsed, onSelect: handleMenuSelect }, item.key)); }) })] }, group.key));
|
|
4644
4696
|
}) }), helpSection ? (jsx("div", { className: "mt-auto flex flex-col items-center justify-center", children: jsx(Button$1, { fullWidth: true, className: "text-default-500 data-[hover=true]:text-default-600", startContent: jsx(IconComponent, { className: "text-default-500", icon: "solar:info-circle-line-duotone", size: "md" }), variant: "light", onPress: handleHelpClick, isIconOnly: collapsed, children: !collapsed ? (jsx("span", { className: "menu-claw-collapsible truncate", children: helpSection.title })) : null }) })) : null] }) })] }));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MenuClaw.d.ts","sourceRoot":"","sources":["../../../../src/components/menu-claw/MenuClaw.tsx"],"names":[],"mappings":"AACA,OAAO,KAA+B,MAAM,OAAO,CAAC;AACpD,OAAO,iBAAiB,CAAC;AAIzB,OAAO,KAAK,EAAE,aAAa,EAAwB,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"MenuClaw.d.ts","sourceRoot":"","sources":["../../../../src/components/menu-claw/MenuClaw.tsx"],"names":[],"mappings":"AACA,OAAO,KAA+B,MAAM,OAAO,CAAC;AACpD,OAAO,iBAAiB,CAAC;AAIzB,OAAO,KAAK,EAAE,aAAa,EAAwB,MAAM,kBAAkB,CAAC;AAsB5E;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,eAAO,MAAM,QAAQ,EAAE,KAAK,CAAC,EAAE,CAAC,aAAa,CAiS3C,CAAC"}
|
|
@@ -19,6 +19,16 @@ export interface MenuClawHistoryItem {
|
|
|
19
19
|
disabled?: boolean;
|
|
20
20
|
/** Se invoca al activar el ítem. No se llama si `disabled` es `true`. */
|
|
21
21
|
onSelect?: () => void;
|
|
22
|
+
/**
|
|
23
|
+
* La conversación tiene una novedad que el usuario aún no ha visto (p. ej. una
|
|
24
|
+
* tarea terminada). Con `true`, la fila pinta un punto con el color primario
|
|
25
|
+
* (`--heroui-primary`, el de la agencia) y un texto solo para lectores de pantalla
|
|
26
|
+
* (`translations.historyNewsLabel`). Con el lateral comprimido, si algún ítem lo
|
|
27
|
+
* trae, el icono de la sección lleva un punto agregado
|
|
28
|
+
* (`translations.historyCollapsedNewsLabel`). Ausente = sin punto.
|
|
29
|
+
* @default false
|
|
30
|
+
*/
|
|
31
|
+
hasNews?: boolean;
|
|
22
32
|
}
|
|
23
33
|
/**
|
|
24
34
|
* Sección de historial. Va integrada de serie en `MenuClaw` (no es opt-in),
|
|
@@ -37,6 +47,23 @@ export interface MenuClawHistory {
|
|
|
37
47
|
* Si se proporciona, se muestra el botón de nueva conversación sobre la lista.
|
|
38
48
|
*/
|
|
39
49
|
onNewConversation?: () => void;
|
|
50
|
+
/**
|
|
51
|
+
* `true` si el consumidor puede traer más entradas de las ya listadas (hay otra
|
|
52
|
+
* página en el servidor). Con `onLoadMore`, pinta «Cargar más» al final de la lista
|
|
53
|
+
* —cuando no quedan ítems plegados tras «Ver más»—. Sin esta prop, nada cambia.
|
|
54
|
+
* @default false
|
|
55
|
+
*/
|
|
56
|
+
hasMore?: boolean;
|
|
57
|
+
/**
|
|
58
|
+
* Pide la página siguiente. Sin esta prop no se pinta «Cargar más» aunque `hasMore`
|
|
59
|
+
* sea `true`: no se promete una página que nadie puede pedir.
|
|
60
|
+
*/
|
|
61
|
+
onLoadMore?: () => void;
|
|
62
|
+
/**
|
|
63
|
+
* Página siguiente en vuelo: «Cargar más» queda desactivado y con `aria-busy`.
|
|
64
|
+
* @default false
|
|
65
|
+
*/
|
|
66
|
+
isLoadingMore?: boolean;
|
|
40
67
|
}
|
|
41
68
|
/**
|
|
42
69
|
* Traducciones de MenuClaw. Todas opcionales para permitir traducciones
|
|
@@ -61,6 +88,15 @@ export type MenuClawTranslations = {
|
|
|
61
88
|
historyShowMoreLabel?: string;
|
|
62
89
|
/** Etiqueta del botón que vuelve a plegar el historial */
|
|
63
90
|
historyShowLessLabel?: string;
|
|
91
|
+
/** Etiqueta del botón que pide la página siguiente del historial */
|
|
92
|
+
historyLoadMoreLabel?: string;
|
|
93
|
+
/** Texto para lectores de pantalla de una conversación con novedad (`hasNews`) */
|
|
94
|
+
historyNewsLabel?: string;
|
|
95
|
+
/**
|
|
96
|
+
* Texto para lectores de pantalla del punto agregado del lateral comprimido,
|
|
97
|
+
* cuando alguna conversación tiene novedad
|
|
98
|
+
*/
|
|
99
|
+
historyCollapsedNewsLabel?: string;
|
|
64
100
|
};
|
|
65
101
|
export interface MenuClawProps {
|
|
66
102
|
userInfo: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MenuClaw.types.d.ts","sourceRoot":"","sources":["../../../../src/components/menu-claw/MenuClaw.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,mDAAmD,CAAC;AAEzF,YAAY,EAAE,eAAe,EAAE,CAAC;AAEhC;;;GAGG;AACH,MAAM,WAAW,mBAAmB;IACnC,wEAAwE;IACxE,EAAE,EAAE,MAAM,CAAC;IACX,uDAAuD;IACvD,KAAK,EAAE,MAAM,CAAC;IACd,2EAA2E;IAC3E,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;;;OAIG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,yEAAyE;IACzE,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAC;
|
|
1
|
+
{"version":3,"file":"MenuClaw.types.d.ts","sourceRoot":"","sources":["../../../../src/components/menu-claw/MenuClaw.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,mDAAmD,CAAC;AAEzF,YAAY,EAAE,eAAe,EAAE,CAAC;AAEhC;;;GAGG;AACH,MAAM,WAAW,mBAAmB;IACnC,wEAAwE;IACxE,EAAE,EAAE,MAAM,CAAC;IACX,uDAAuD;IACvD,KAAK,EAAE,MAAM,CAAC;IACd,2EAA2E;IAC3E,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;;;OAIG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,yEAAyE;IACzE,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAC;IACtB;;;;;;;;OAQG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;CAClB;AAED;;;GAGG;AACH,MAAM,WAAW,eAAe;IAC/B,yDAAyD;IACzD,KAAK,EAAE,mBAAmB,EAAE,CAAC;IAC7B;;;;OAIG;IACH,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B;;OAEG;IACH,iBAAiB,CAAC,EAAE,MAAM,IAAI,CAAC;IAC/B;;;;;OAKG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB;;;OAGG;IACH,UAAU,CAAC,EAAE,MAAM,IAAI,CAAC;IACxB;;;OAGG;IACH,aAAa,CAAC,EAAE,OAAO,CAAC;CACxB;AAED;;;GAGG;AACH,MAAM,MAAM,oBAAoB,GAAG;IAClC,gEAAgE;IAChE,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,mEAAmE;IACnE,qBAAqB,CAAC,EAAE,MAAM,CAAC;IAC/B,6DAA6D;IAC7D,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,4DAA4D;IAC5D,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,sEAAsE;IACtE,sBAAsB,CAAC,EAAE,MAAM,CAAC;IAChC,wCAAwC;IACxC,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,+CAA+C;IAC/C,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,uEAAuE;IACvE,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,0DAA0D;IAC1D,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,oEAAoE;IACpE,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,kFAAkF;IAClF,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B;;;OAGG;IACH,yBAAyB,CAAC,EAAE,MAAM,CAAC;CACnC,CAAC;AAEF,MAAM,WAAW,aAAa;IAC7B,QAAQ,EAAE;QACT,MAAM,EAAE,MAAM,CAAC;QACf,IAAI,EAAE,MAAM,CAAC;QACb,IAAI,EAAE,MAAM,CAAC;KACb,CAAC;IACF;;;OAGG;IACH,UAAU,CAAC,EAAE;QACZ,KAAK,EAAE,MAAM,CAAC;QACd,QAAQ,EAAE,MAAM,CAAC;KACjB,CAAC;IACF,SAAS,EAAE;QACV,KAAK,EAAE,eAAe,EAAE,CAAC;QACzB;;;;WAIG;QACH,YAAY,CAAC,EAAE,MAAM,CAAC;QACtB,sEAAsE;QACtE,WAAW,CAAC,EAAE,MAAM,CAAC;QACrB;;;WAGG;QACH,QAAQ,CAAC,EAAE,CACV,GAAG,EAAE,MAAM,EACX,IAAI,CAAC,EAAE,MAAM,EACb,MAAM,CAAC,EAAE,SAAS,GAAG,WAAW,KAC5B,IAAI,CAAC;KACV,CAAC;IACF,uDAAuD;IACvD,OAAO,EAAE,eAAe,CAAC;IACzB,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,mBAAmB,CAAC,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC;IAC9C;;;;OAIG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB;;;;;OAKG;IACH,iBAAiB,CAAC,EAAE,CAAC,SAAS,EAAE,OAAO,KAAK,IAAI,CAAC;IACjD;;;;OAIG;IACH,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B;;;OAGG;IACH,uBAAuB,CAAC,EAAE,MAAM,CAAC;IACjC;;;;OAIG;IACH,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,iEAAiE;IACjE,YAAY,CAAC,EAAE,oBAAoB,CAAC;CACpC"}
|
package/dist/types/components/menu-claw/_internal/menu-claw-history/MenuClawHistoryPanel.d.ts
CHANGED
|
@@ -2,7 +2,8 @@ import React from "react";
|
|
|
2
2
|
import type { MenuClawHistoryPanelProps } from "./MenuClawHistoryPanel.types";
|
|
3
3
|
/**
|
|
4
4
|
* Sección de historial de conversaciones: botón de nueva conversación + lista de
|
|
5
|
-
* entradas recientes con "ver más"
|
|
5
|
+
* entradas recientes con "ver más" y, si el consumidor tiene más páginas,
|
|
6
|
+
* "cargar más".
|
|
6
7
|
*
|
|
7
8
|
* La lista tiene **scroll interno propio** (`flex-1 min-h-0 overflow-y-auto`) y
|
|
8
9
|
* la sección está acotada en altura, para que crecer el historial no arrastre ni
|
package/dist/types/components/menu-claw/_internal/menu-claw-history/MenuClawHistoryPanel.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MenuClawHistoryPanel.d.ts","sourceRoot":"","sources":["../../../../../../src/components/menu-claw/_internal/menu-claw-history/MenuClawHistoryPanel.tsx"],"names":[],"mappings":"AACA,OAAO,KAA+B,MAAM,OAAO,CAAC;AAGpD,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,8BAA8B,CAAC;
|
|
1
|
+
{"version":3,"file":"MenuClawHistoryPanel.d.ts","sourceRoot":"","sources":["../../../../../../src/components/menu-claw/_internal/menu-claw-history/MenuClawHistoryPanel.tsx"],"names":[],"mappings":"AACA,OAAO,KAA+B,MAAM,OAAO,CAAC;AAGpD,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,8BAA8B,CAAC;AAG9E;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,oBAAoB,EAAE,KAAK,CAAC,EAAE,CAAC,yBAAyB,CAgOlE,CAAC"}
|
package/dist/types/components/menu-claw/_internal/menu-claw-history/MenuClawHistoryPanel.types.d.ts
CHANGED
|
@@ -6,6 +6,14 @@ export type MenuClawHistoryPanelProps = {
|
|
|
6
6
|
initialVisibleCount: number;
|
|
7
7
|
/** Si se proporciona, se muestra el botón de nueva conversación sobre la lista. */
|
|
8
8
|
onNewConversation?: () => void;
|
|
9
|
+
/** Hay otra página en el servidor (ver `MenuClawHistory.hasMore`). */
|
|
10
|
+
hasMore: boolean;
|
|
11
|
+
/** Pide la página siguiente; sin ella no se pinta «Cargar más». */
|
|
12
|
+
onLoadMore?: () => void;
|
|
13
|
+
/** Página siguiente en vuelo: botón desactivado y `aria-busy`. */
|
|
14
|
+
isLoadingMore: boolean;
|
|
15
|
+
/** Etiqueta del botón que pide la página siguiente. */
|
|
16
|
+
loadMoreLabel: string;
|
|
9
17
|
/** Lateral comprimido: solo el botón de nueva conversación, en modo icono. */
|
|
10
18
|
isCollapsed: boolean;
|
|
11
19
|
/** Título de la sección. */
|
|
@@ -16,6 +24,10 @@ export type MenuClawHistoryPanelProps = {
|
|
|
16
24
|
showMoreLabel: string;
|
|
17
25
|
/** Etiqueta del botón que vuelve a plegar la lista. */
|
|
18
26
|
showLessLabel: string;
|
|
27
|
+
/** Texto para lectores de pantalla de una fila con novedad (`hasNews`). */
|
|
28
|
+
newsLabel: string;
|
|
29
|
+
/** Texto para lectores de pantalla del punto agregado del lateral comprimido. */
|
|
30
|
+
collapsedNewsLabel: string;
|
|
19
31
|
/**
|
|
20
32
|
* Se invoca antes del `onSelect` del ítem, para que el menú cierre el lateral
|
|
21
33
|
* en móvil igual que hace con los ítems de navegación.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MenuClawHistoryPanel.types.d.ts","sourceRoot":"","sources":["../../../../../../src/components/menu-claw/_internal/menu-claw-history/MenuClawHistoryPanel.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAEhE,MAAM,MAAM,yBAAyB,GAAG;IACvC,yDAAyD;IACzD,KAAK,EAAE,mBAAmB,EAAE,CAAC;IAC7B,sDAAsD;IACtD,mBAAmB,EAAE,MAAM,CAAC;IAC5B,mFAAmF;IACnF,iBAAiB,CAAC,EAAE,MAAM,IAAI,CAAC;IAC/B,8EAA8E;IAC9E,WAAW,EAAE,OAAO,CAAC;IACrB,4BAA4B;IAC5B,KAAK,EAAE,MAAM,CAAC;IACd,gDAAgD;IAChD,QAAQ,EAAE,MAAM,CAAC;IACjB,0DAA0D;IAC1D,aAAa,EAAE,MAAM,CAAC;IACtB,uDAAuD;IACvD,aAAa,EAAE,MAAM,CAAC;IACtB;;;OAGG;IACH,cAAc,CAAC,EAAE,MAAM,IAAI,CAAC;CAC5B,CAAC"}
|
|
1
|
+
{"version":3,"file":"MenuClawHistoryPanel.types.d.ts","sourceRoot":"","sources":["../../../../../../src/components/menu-claw/_internal/menu-claw-history/MenuClawHistoryPanel.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAEhE,MAAM,MAAM,yBAAyB,GAAG;IACvC,yDAAyD;IACzD,KAAK,EAAE,mBAAmB,EAAE,CAAC;IAC7B,sDAAsD;IACtD,mBAAmB,EAAE,MAAM,CAAC;IAC5B,mFAAmF;IACnF,iBAAiB,CAAC,EAAE,MAAM,IAAI,CAAC;IAC/B,sEAAsE;IACtE,OAAO,EAAE,OAAO,CAAC;IACjB,mEAAmE;IACnE,UAAU,CAAC,EAAE,MAAM,IAAI,CAAC;IACxB,kEAAkE;IAClE,aAAa,EAAE,OAAO,CAAC;IACvB,uDAAuD;IACvD,aAAa,EAAE,MAAM,CAAC;IACtB,8EAA8E;IAC9E,WAAW,EAAE,OAAO,CAAC;IACrB,4BAA4B;IAC5B,KAAK,EAAE,MAAM,CAAC;IACd,gDAAgD;IAChD,QAAQ,EAAE,MAAM,CAAC;IACjB,0DAA0D;IAC1D,aAAa,EAAE,MAAM,CAAC;IACtB,uDAAuD;IACvD,aAAa,EAAE,MAAM,CAAC;IACtB,2EAA2E;IAC3E,SAAS,EAAE,MAAM,CAAC;IAClB,iFAAiF;IACjF,kBAAkB,EAAE,MAAM,CAAC;IAC3B;;;OAGG;IACH,cAAc,CAAC,EAAE,MAAM,IAAI,CAAC;CAC5B,CAAC"}
|
package/dist/types/components/menu-claw/_internal/menu-claw-history/menuClawHistoryLoadMore.d.ts
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* «Cargar más» solo se ofrece si hay otra página, alguien que pueda pedirla y la lista
|
|
3
|
+
* ya enseña todo lo recibido (desplegada, o sin ítems plegados tras «Ver más»).
|
|
4
|
+
*/
|
|
5
|
+
export declare function isLoadMoreVisible({ hasMore, hasOnLoadMore, isExpanded, hasHiddenItems, }: {
|
|
6
|
+
hasMore: boolean;
|
|
7
|
+
hasOnLoadMore: boolean;
|
|
8
|
+
isExpanded: boolean;
|
|
9
|
+
hasHiddenItems: boolean;
|
|
10
|
+
}): boolean;
|
|
11
|
+
/**
|
|
12
|
+
* Pulsación de «Cargar más». Con una página en vuelo no hace nada: el botón no usa
|
|
13
|
+
* `disabled` nativo (perdería el foco del teclado), así que la guarda vive aquí.
|
|
14
|
+
* Si no, despliega la lista y pide la página, para que lo nuevo no quede tras «Ver más».
|
|
15
|
+
*/
|
|
16
|
+
export declare function pressLoadMore({ isLoadingMore, onLoadMore, expand, }: {
|
|
17
|
+
isLoadingMore: boolean;
|
|
18
|
+
onLoadMore: () => void;
|
|
19
|
+
expand: () => void;
|
|
20
|
+
}): void;
|
|
21
|
+
//# sourceMappingURL=menuClawHistoryLoadMore.d.ts.map
|
package/dist/types/components/menu-claw/_internal/menu-claw-history/menuClawHistoryLoadMore.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"menuClawHistoryLoadMore.d.ts","sourceRoot":"","sources":["../../../../../../src/components/menu-claw/_internal/menu-claw-history/menuClawHistoryLoadMore.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,EACjC,OAAO,EACP,aAAa,EACb,UAAU,EACV,cAAc,GACd,EAAE;IACF,OAAO,EAAE,OAAO,CAAC;IACjB,aAAa,EAAE,OAAO,CAAC;IACvB,UAAU,EAAE,OAAO,CAAC;IACpB,cAAc,EAAE,OAAO,CAAC;CACxB,GAAG,OAAO,CAEV;AAED;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,EAC7B,aAAa,EACb,UAAU,EACV,MAAM,GACN,EAAE;IACF,aAAa,EAAE,OAAO,CAAC;IACvB,UAAU,EAAE,MAAM,IAAI,CAAC;IACvB,MAAM,EAAE,MAAM,IAAI,CAAC;CACnB,GAAG,IAAI,CAMP"}
|