@beweco/aurora-ui 0.1.56 → 0.1.57
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/index.cjs.js +60 -2
- package/dist/index.esm.js +60 -3
- package/dist/types/components/menu/Menu.d.ts.map +1 -1
- package/dist/types/components/menu/Menu.types.d.ts +7 -1
- package/dist/types/components/menu/Menu.types.d.ts.map +1 -1
- package/dist/types/components/menu/get-selected-key-from-path.d.ts +8 -0
- package/dist/types/components/menu/get-selected-key-from-path.d.ts.map +1 -0
- package/dist/types/components/menu/index.d.ts +1 -0
- package/dist/types/components/menu/index.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs.js
CHANGED
|
@@ -1974,6 +1974,56 @@ var ImagePreview = function (_a) {
|
|
|
1974
1974
|
: undefined, role: isClickable ? "button" : undefined, tabIndex: isClickable ? 0 : undefined, "aria-label": isClickable ? t.clickableImageAriaLabel : undefined }), showRemoveButton && onRemove && (jsxRuntime.jsx("button", { type: "button", onClick: function () { return handleRemove(image.id || "", index); }, "aria-label": t.removeButtonAriaLabel, className: "\n\t\t\t\t\t\t\t\t\tabsolute -top-2 -right-2 \n\t\t\t\t\t\t\t\t\tp-1 rounded-full \n\t\t\t\t\t\t\t\t\tbg-danger-500 hover:bg-danger-600 \n\t\t\t\t\t\t\t\t\ttext-white \n\t\t\t\t\t\t\t\t\tcursor-pointer \n\t\t\t\t\t\t\t\t\ttransition-colors\n\t\t\t\t\t\t\t\t\tfocus:outline-none \n\t\t\t\t\t\t\t\t\tfocus:ring-2 \n\t\t\t\t\t\t\t\t\tfocus:ring-danger-400 \n\t\t\t\t\t\t\t\t\tfocus:ring-offset-2\n\t\t\t\t\t\t\t\t", children: jsxRuntime.jsx(IconComponent, { size: size === "micro" ? "sm" : "md", icon: "solar:trash-bin-minimalistic-outline" }) }))] }) }, image.id || index)); }) }));
|
|
1975
1975
|
};
|
|
1976
1976
|
|
|
1977
|
+
/** Normalize path for comparison: single leading slash, no trailing slash. */
|
|
1978
|
+
function normalizePath(path) {
|
|
1979
|
+
var p = path.replace(/\/+$/, "").trim();
|
|
1980
|
+
return p && !p.startsWith("/") ? "/".concat(p) : p || "/";
|
|
1981
|
+
}
|
|
1982
|
+
/** True when pathname matches href (exact or sub-route). */
|
|
1983
|
+
function pathMatches(href, pathname) {
|
|
1984
|
+
var h = normalizePath(href);
|
|
1985
|
+
var p = normalizePath(pathname);
|
|
1986
|
+
return p === h || p.startsWith("".concat(h, "/"));
|
|
1987
|
+
}
|
|
1988
|
+
/**
|
|
1989
|
+
* Walks the menu tree and returns the key of the item whose href matches the pathname.
|
|
1990
|
+
* Prefers the most specific match (nested items over parents).
|
|
1991
|
+
* Used when the consumer passes selectedPath instead of selectedKey.
|
|
1992
|
+
*/
|
|
1993
|
+
function walkItems(pathname, list) {
|
|
1994
|
+
var _a;
|
|
1995
|
+
for (var _i = 0, list_1 = list; _i < list_1.length; _i++) {
|
|
1996
|
+
var item = list_1[_i];
|
|
1997
|
+
if ((_a = item.items) === null || _a === void 0 ? void 0 : _a.length) {
|
|
1998
|
+
// Prefer match in children first (e.g. /catalog/products -> catalog-products, not catalog)
|
|
1999
|
+
var found = walkItems(pathname, item.items);
|
|
2000
|
+
if (found)
|
|
2001
|
+
return found;
|
|
2002
|
+
}
|
|
2003
|
+
if (item.href && pathMatches(item.href, pathname)) {
|
|
2004
|
+
return item.key;
|
|
2005
|
+
}
|
|
2006
|
+
}
|
|
2007
|
+
return undefined;
|
|
2008
|
+
}
|
|
2009
|
+
/**
|
|
2010
|
+
* Returns the menu item key that matches the current pathname.
|
|
2011
|
+
* Supports the structure used by Menu: items can be sections (each with .items) or flat.
|
|
2012
|
+
* For nested items (e.g. Catálogo > Productos), returns the sub-item key.
|
|
2013
|
+
*/
|
|
2014
|
+
function getSelectedKeyFromPath(pathname, items) {
|
|
2015
|
+
var _a;
|
|
2016
|
+
var normalizedPath = normalizePath(pathname);
|
|
2017
|
+
for (var _i = 0, items_1 = items; _i < items_1.length; _i++) {
|
|
2018
|
+
var section = items_1[_i];
|
|
2019
|
+
var list = (_a = section.items) !== null && _a !== void 0 ? _a : [section];
|
|
2020
|
+
var found = walkItems(normalizedPath, list);
|
|
2021
|
+
if (found)
|
|
2022
|
+
return found;
|
|
2023
|
+
}
|
|
2024
|
+
return undefined;
|
|
2025
|
+
}
|
|
2026
|
+
|
|
1977
2027
|
exports.EnumMenuNavListItem = void 0;
|
|
1978
2028
|
(function (EnumMenuNavListItem) {
|
|
1979
2029
|
EnumMenuNavListItem["Nest"] = "nest";
|
|
@@ -2152,6 +2202,13 @@ var MenuComponent = React.memo(function Menu(_a) {
|
|
|
2152
2202
|
var _f = React.useState(false), isCollapsed = _f[0], setIsCollapsed = _f[1];
|
|
2153
2203
|
var _g = React.useState(false), logoError = _g[0], setLogoError = _g[1];
|
|
2154
2204
|
var t = __assign(__assign({}, DEFAULT_TRANSLATIONS$3), translations);
|
|
2205
|
+
var selectedKey = React.useMemo(function () {
|
|
2206
|
+
var _a, _b, _c;
|
|
2207
|
+
if (menuItems.selectedPath) {
|
|
2208
|
+
return ((_b = (_a = getSelectedKeyFromPath(menuItems.selectedPath, menuItems.items)) !== null && _a !== void 0 ? _a : menuItems.selectedKey) !== null && _b !== void 0 ? _b : "");
|
|
2209
|
+
}
|
|
2210
|
+
return (_c = menuItems.selectedKey) !== null && _c !== void 0 ? _c : "";
|
|
2211
|
+
}, [menuItems.selectedPath, menuItems.selectedKey, menuItems.items]);
|
|
2155
2212
|
var commerceName = (typeof (commerceInfo === null || commerceInfo === void 0 ? void 0 : commerceInfo.name) === "string" && commerceInfo.name.trim()) ||
|
|
2156
2213
|
t.notDefinedLabel;
|
|
2157
2214
|
var userName = (typeof (userInfo === null || userInfo === void 0 ? void 0 : userInfo.name) === "string" && userInfo.name.trim()) ||
|
|
@@ -2207,13 +2264,13 @@ var MenuComponent = React.memo(function Menu(_a) {
|
|
|
2207
2264
|
(_a = menuItems.onSelect) === null || _a === void 0 ? void 0 : _a.call(menuItems, key, href, "bottomBar");
|
|
2208
2265
|
}, [onOpenSidebarChange, menuItems.onSelect]);
|
|
2209
2266
|
var showBottomBar = (mobileBottomBarGroupKey && bottomBarItems.length > 0) || showNativeMenu;
|
|
2210
|
-
return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [showBottomBar && (jsxRuntime.jsx(MenuMobileBottomBar, { items: bottomBarItems, selectedKey:
|
|
2267
|
+
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 })), jsxRuntime.jsx("button", { type: "button", "aria-label": t.closeSidebarAriaLabel, className: "menu-overlay ".concat(isOpenSidebar ? "menu-overlay--open" : ""), onClick: handleSidebarClose, tabIndex: isOpenSidebar ? 0 : -1 }), jsxRuntime.jsx("div", { className: "container__menu ".concat(isCollapsed
|
|
2211
2268
|
? "container__menu--collapsed"
|
|
2212
2269
|
: "container__menu--expanded", " ").concat(isOpenSidebar ? "container__menu--mobile-open" : ""), "aria-hidden": !isOpenSidebar, children: jsxRuntime.jsxs("div", { className: "content__menu", children: [jsxRuntime.jsxs("div", { className: "content__menu--header", style: {
|
|
2213
2270
|
flexDirection: isCollapsed ? "column-reverse" : "row",
|
|
2214
2271
|
}, children: [jsxRuntime.jsxs("div", { className: "flex flex-row items-center justify-center ".concat(isCollapsed ? "gap-0" : "gap-2"), children: [jsxRuntime.jsx("div", { className: "flex h-8 w-8 shrink-0 items-center justify-center overflow-hidden rounded-full bg-foreground text-background", children: hasValidLogo ? (jsxRuntime.jsx("img", { src: commerceInfo.logo, alt: "".concat(t.logoAlt, " ").concat(commerceName), className: "h-full w-full object-cover", onError: function () { return setLogoError(true); } })) : (jsxRuntime.jsx(IconComponent, { icon: "solar:buildings-2-outline", size: "sm", className: "shrink-0", "aria-hidden": true })) }), jsxRuntime.jsx("span", { className: "collapsible-item text-small font-bold truncate min-w-0", children: commerceName })] }), jsxRuntime.jsxs("div", { className: "flex items-center", children: [jsxRuntime.jsx(IconComponent, { icon: "material-symbols-light:close", size: "lg", className: "cursor-pointer block sm:hidden", onClick: handleSidebarClose }), jsxRuntime.jsx(IconComponent, { icon: isCollapsed
|
|
2215
2272
|
? "solar:alt-arrow-right-outline"
|
|
2216
|
-
: "solar:alt-arrow-left-outline", size: "lg", className: "hidden sm:block cursor-pointer", onClick: handleCollapseToggle })] })] }), jsxRuntime.jsx(react.Spacer, { y: 6 }), jsxRuntime.jsxs("div", { className: "content__menu--user ".concat(isCollapsed ? "gap-0" : "gap-3"), children: [jsxRuntime.jsx(react.Avatar, { size: "md", 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" }), jsxRuntime.jsxs("div", { className: "collapsible-item flex min-w-0 flex-col overflow-hidden", children: [jsxRuntime.jsx("p", { className: "text-small font-medium text-default-900 truncate", children: userName }), jsxRuntime.jsx("p", { className: "text-tiny text-default-400 truncate", children: userRole })] })] }), jsxRuntime.jsx("div", { className: "".concat(!isCollapsed ? "flex-1" : "h-full", " min-h-0 py-6"), children: jsxRuntime.jsx("div", { className: "h-full overflow-y-auto pr-6 -mr-6 [&::-webkit-scrollbar]:hidden [-ms-overflow-style:none] [scrollbar-width:none]", children: jsxRuntime.jsx(MenuNavList, { defaultSelectedKey:
|
|
2273
|
+
: "solar:alt-arrow-left-outline", size: "lg", className: "hidden sm:block cursor-pointer", onClick: handleCollapseToggle })] })] }), jsxRuntime.jsx(react.Spacer, { y: 6 }), jsxRuntime.jsxs("div", { className: "content__menu--user ".concat(isCollapsed ? "gap-0" : "gap-3"), children: [jsxRuntime.jsx(react.Avatar, { size: "md", 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" }), jsxRuntime.jsxs("div", { className: "collapsible-item flex min-w-0 flex-col overflow-hidden", children: [jsxRuntime.jsx("p", { className: "text-small font-medium text-default-900 truncate", children: userName }), jsxRuntime.jsx("p", { className: "text-tiny text-default-400 truncate", children: userRole })] })] }), jsxRuntime.jsx("div", { className: "".concat(!isCollapsed ? "flex-1" : "h-full", " min-h-0 py-6"), children: jsxRuntime.jsx("div", { className: "h-full overflow-y-auto pr-6 -mr-6 [&::-webkit-scrollbar]:hidden [-ms-overflow-style:none] [scrollbar-width:none]", children: jsxRuntime.jsx(MenuNavList, { defaultSelectedKey: selectedKey, items: menuItems.items, isCollapsed: isCollapsed, onSelect: handleMenuSelect }, selectedKey) }) }), 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: helpTitle })) }) })] }) })] }));
|
|
2217
2274
|
});
|
|
2218
2275
|
|
|
2219
2276
|
var StepIndicator = function (_a) {
|
|
@@ -5825,6 +5882,7 @@ exports.Wizard = Wizard;
|
|
|
5825
5882
|
exports.WizardNavigation = WizardNavigation;
|
|
5826
5883
|
exports.WizardSidebar = WizardSidebar;
|
|
5827
5884
|
exports.defaultTranslations = defaultTranslations$4;
|
|
5885
|
+
exports.getSelectedKeyFromPath = getSelectedKeyFromPath;
|
|
5828
5886
|
exports.sizeMap = sizeMap;
|
|
5829
5887
|
exports.themeColors = themeColors;
|
|
5830
5888
|
exports.useAuraToast = useAuraToast;
|
package/dist/index.esm.js
CHANGED
|
@@ -1975,6 +1975,56 @@ var ImagePreview = function (_a) {
|
|
|
1975
1975
|
: undefined, role: isClickable ? "button" : undefined, tabIndex: isClickable ? 0 : undefined, "aria-label": isClickable ? t.clickableImageAriaLabel : undefined }), showRemoveButton && onRemove && (jsx("button", { type: "button", onClick: function () { return handleRemove(image.id || "", index); }, "aria-label": t.removeButtonAriaLabel, className: "\n\t\t\t\t\t\t\t\t\tabsolute -top-2 -right-2 \n\t\t\t\t\t\t\t\t\tp-1 rounded-full \n\t\t\t\t\t\t\t\t\tbg-danger-500 hover:bg-danger-600 \n\t\t\t\t\t\t\t\t\ttext-white \n\t\t\t\t\t\t\t\t\tcursor-pointer \n\t\t\t\t\t\t\t\t\ttransition-colors\n\t\t\t\t\t\t\t\t\tfocus:outline-none \n\t\t\t\t\t\t\t\t\tfocus:ring-2 \n\t\t\t\t\t\t\t\t\tfocus:ring-danger-400 \n\t\t\t\t\t\t\t\t\tfocus:ring-offset-2\n\t\t\t\t\t\t\t\t", children: jsx(IconComponent, { size: size === "micro" ? "sm" : "md", icon: "solar:trash-bin-minimalistic-outline" }) }))] }) }, image.id || index)); }) }));
|
|
1976
1976
|
};
|
|
1977
1977
|
|
|
1978
|
+
/** Normalize path for comparison: single leading slash, no trailing slash. */
|
|
1979
|
+
function normalizePath(path) {
|
|
1980
|
+
var p = path.replace(/\/+$/, "").trim();
|
|
1981
|
+
return p && !p.startsWith("/") ? "/".concat(p) : p || "/";
|
|
1982
|
+
}
|
|
1983
|
+
/** True when pathname matches href (exact or sub-route). */
|
|
1984
|
+
function pathMatches(href, pathname) {
|
|
1985
|
+
var h = normalizePath(href);
|
|
1986
|
+
var p = normalizePath(pathname);
|
|
1987
|
+
return p === h || p.startsWith("".concat(h, "/"));
|
|
1988
|
+
}
|
|
1989
|
+
/**
|
|
1990
|
+
* Walks the menu tree and returns the key of the item whose href matches the pathname.
|
|
1991
|
+
* Prefers the most specific match (nested items over parents).
|
|
1992
|
+
* Used when the consumer passes selectedPath instead of selectedKey.
|
|
1993
|
+
*/
|
|
1994
|
+
function walkItems(pathname, list) {
|
|
1995
|
+
var _a;
|
|
1996
|
+
for (var _i = 0, list_1 = list; _i < list_1.length; _i++) {
|
|
1997
|
+
var item = list_1[_i];
|
|
1998
|
+
if ((_a = item.items) === null || _a === void 0 ? void 0 : _a.length) {
|
|
1999
|
+
// Prefer match in children first (e.g. /catalog/products -> catalog-products, not catalog)
|
|
2000
|
+
var found = walkItems(pathname, item.items);
|
|
2001
|
+
if (found)
|
|
2002
|
+
return found;
|
|
2003
|
+
}
|
|
2004
|
+
if (item.href && pathMatches(item.href, pathname)) {
|
|
2005
|
+
return item.key;
|
|
2006
|
+
}
|
|
2007
|
+
}
|
|
2008
|
+
return undefined;
|
|
2009
|
+
}
|
|
2010
|
+
/**
|
|
2011
|
+
* Returns the menu item key that matches the current pathname.
|
|
2012
|
+
* Supports the structure used by Menu: items can be sections (each with .items) or flat.
|
|
2013
|
+
* For nested items (e.g. Catálogo > Productos), returns the sub-item key.
|
|
2014
|
+
*/
|
|
2015
|
+
function getSelectedKeyFromPath(pathname, items) {
|
|
2016
|
+
var _a;
|
|
2017
|
+
var normalizedPath = normalizePath(pathname);
|
|
2018
|
+
for (var _i = 0, items_1 = items; _i < items_1.length; _i++) {
|
|
2019
|
+
var section = items_1[_i];
|
|
2020
|
+
var list = (_a = section.items) !== null && _a !== void 0 ? _a : [section];
|
|
2021
|
+
var found = walkItems(normalizedPath, list);
|
|
2022
|
+
if (found)
|
|
2023
|
+
return found;
|
|
2024
|
+
}
|
|
2025
|
+
return undefined;
|
|
2026
|
+
}
|
|
2027
|
+
|
|
1978
2028
|
var EnumMenuNavListItem;
|
|
1979
2029
|
(function (EnumMenuNavListItem) {
|
|
1980
2030
|
EnumMenuNavListItem["Nest"] = "nest";
|
|
@@ -2153,6 +2203,13 @@ var MenuComponent = React.memo(function Menu(_a) {
|
|
|
2153
2203
|
var _f = React.useState(false), isCollapsed = _f[0], setIsCollapsed = _f[1];
|
|
2154
2204
|
var _g = React.useState(false), logoError = _g[0], setLogoError = _g[1];
|
|
2155
2205
|
var t = __assign(__assign({}, DEFAULT_TRANSLATIONS$3), translations);
|
|
2206
|
+
var selectedKey = React.useMemo(function () {
|
|
2207
|
+
var _a, _b, _c;
|
|
2208
|
+
if (menuItems.selectedPath) {
|
|
2209
|
+
return ((_b = (_a = getSelectedKeyFromPath(menuItems.selectedPath, menuItems.items)) !== null && _a !== void 0 ? _a : menuItems.selectedKey) !== null && _b !== void 0 ? _b : "");
|
|
2210
|
+
}
|
|
2211
|
+
return (_c = menuItems.selectedKey) !== null && _c !== void 0 ? _c : "";
|
|
2212
|
+
}, [menuItems.selectedPath, menuItems.selectedKey, menuItems.items]);
|
|
2156
2213
|
var commerceName = (typeof (commerceInfo === null || commerceInfo === void 0 ? void 0 : commerceInfo.name) === "string" && commerceInfo.name.trim()) ||
|
|
2157
2214
|
t.notDefinedLabel;
|
|
2158
2215
|
var userName = (typeof (userInfo === null || userInfo === void 0 ? void 0 : userInfo.name) === "string" && userInfo.name.trim()) ||
|
|
@@ -2208,13 +2265,13 @@ var MenuComponent = React.memo(function Menu(_a) {
|
|
|
2208
2265
|
(_a = menuItems.onSelect) === null || _a === void 0 ? void 0 : _a.call(menuItems, key, href, "bottomBar");
|
|
2209
2266
|
}, [onOpenSidebarChange, menuItems.onSelect]);
|
|
2210
2267
|
var showBottomBar = (mobileBottomBarGroupKey && bottomBarItems.length > 0) || showNativeMenu;
|
|
2211
|
-
return (jsxs(Fragment, { children: [showBottomBar && (jsx(MenuMobileBottomBar, { items: bottomBarItems, selectedKey:
|
|
2268
|
+
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 })), jsx("button", { type: "button", "aria-label": t.closeSidebarAriaLabel, className: "menu-overlay ".concat(isOpenSidebar ? "menu-overlay--open" : ""), onClick: handleSidebarClose, tabIndex: isOpenSidebar ? 0 : -1 }), jsx("div", { className: "container__menu ".concat(isCollapsed
|
|
2212
2269
|
? "container__menu--collapsed"
|
|
2213
2270
|
: "container__menu--expanded", " ").concat(isOpenSidebar ? "container__menu--mobile-open" : ""), "aria-hidden": !isOpenSidebar, children: jsxs("div", { className: "content__menu", children: [jsxs("div", { className: "content__menu--header", style: {
|
|
2214
2271
|
flexDirection: isCollapsed ? "column-reverse" : "row",
|
|
2215
2272
|
}, children: [jsxs("div", { className: "flex flex-row items-center justify-center ".concat(isCollapsed ? "gap-0" : "gap-2"), children: [jsx("div", { className: "flex h-8 w-8 shrink-0 items-center justify-center overflow-hidden rounded-full bg-foreground text-background", children: hasValidLogo ? (jsx("img", { src: commerceInfo.logo, alt: "".concat(t.logoAlt, " ").concat(commerceName), className: "h-full w-full object-cover", onError: function () { return setLogoError(true); } })) : (jsx(IconComponent, { icon: "solar:buildings-2-outline", size: "sm", className: "shrink-0", "aria-hidden": true })) }), jsx("span", { className: "collapsible-item text-small font-bold truncate min-w-0", children: commerceName })] }), jsxs("div", { className: "flex items-center", children: [jsx(IconComponent, { icon: "material-symbols-light:close", size: "lg", className: "cursor-pointer block sm:hidden", onClick: handleSidebarClose }), jsx(IconComponent, { icon: isCollapsed
|
|
2216
2273
|
? "solar:alt-arrow-right-outline"
|
|
2217
|
-
: "solar:alt-arrow-left-outline", size: "lg", className: "hidden sm:block cursor-pointer", onClick: handleCollapseToggle })] })] }), jsx(Spacer, { y: 6 }), jsxs("div", { className: "content__menu--user ".concat(isCollapsed ? "gap-0" : "gap-3"), children: [jsx(Avatar, { size: "md", 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" }), jsxs("div", { className: "collapsible-item flex min-w-0 flex-col overflow-hidden", children: [jsx("p", { className: "text-small font-medium text-default-900 truncate", children: userName }), jsx("p", { className: "text-tiny text-default-400 truncate", children: userRole })] })] }), jsx("div", { className: "".concat(!isCollapsed ? "flex-1" : "h-full", " min-h-0 py-6"), children: jsx("div", { className: "h-full overflow-y-auto pr-6 -mr-6 [&::-webkit-scrollbar]:hidden [-ms-overflow-style:none] [scrollbar-width:none]", children: jsx(MenuNavList, { defaultSelectedKey:
|
|
2274
|
+
: "solar:alt-arrow-left-outline", size: "lg", className: "hidden sm:block cursor-pointer", onClick: handleCollapseToggle })] })] }), jsx(Spacer, { y: 6 }), jsxs("div", { className: "content__menu--user ".concat(isCollapsed ? "gap-0" : "gap-3"), children: [jsx(Avatar, { size: "md", 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" }), jsxs("div", { className: "collapsible-item flex min-w-0 flex-col overflow-hidden", children: [jsx("p", { className: "text-small font-medium text-default-900 truncate", children: userName }), jsx("p", { className: "text-tiny text-default-400 truncate", children: userRole })] })] }), jsx("div", { className: "".concat(!isCollapsed ? "flex-1" : "h-full", " min-h-0 py-6"), children: jsx("div", { className: "h-full overflow-y-auto pr-6 -mr-6 [&::-webkit-scrollbar]:hidden [-ms-overflow-style:none] [scrollbar-width:none]", children: jsx(MenuNavList, { defaultSelectedKey: selectedKey, items: menuItems.items, isCollapsed: isCollapsed, onSelect: handleMenuSelect }, selectedKey) }) }), 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: helpTitle })) }) })] }) })] }));
|
|
2218
2275
|
});
|
|
2219
2276
|
|
|
2220
2277
|
var StepIndicator = function (_a) {
|
|
@@ -5749,4 +5806,4 @@ var NavigationLoadingProvider = function (_a) {
|
|
|
5749
5806
|
return (jsxs(NavigationLoadingContext.Provider, { value: value, children: [children, jsx(NavigationLoadingOverlay, { isVisible: isVisible })] }));
|
|
5750
5807
|
};
|
|
5751
5808
|
|
|
5752
|
-
export { AccordionList, AddHolidayForm, AnalyticsCard, AuraAutocomplete, AuraTable, AuraToastProvider, BreadcrumbsComponent, Button, Card, Chip, ColorPicker, ColorSelector, ContentCarousel, DEFAULT_PREDEFINED_COLORS, DatePicker, DateRangePicker, DateSelector, DrawerFilters, EnumMenuNavListItem, GlobalToast, H1, H2, H3, H4, HeaderComponent, HolidayType, IconComponent, ImagePreview, Input, Kanban, KanbanCard, KanbanColumn, MenuComponent, Modal, ModalBody, ModalContent, ModalFooter, ModalHeader, MultiStepWizard, NavigationLoadingContext, NavigationLoadingOverlay, NavigationLoadingProvider, P, Pagination, Phone, PromotionalBanner, RangeFilter, RowSteps, ScheduleRow, SearchInput, Select, SocialMediaBar, SocialMediaCarousel, SocialMediaPreview, StepIndicator, Switch as SwitchComponent, TagsFilter, Textarea, ThemeContext, ThemePicker, ThemeProvider, TimeInput as TimeInputComponent, ToastContext, TwoColumnLayoutAgent, UploadFile, VerticalSteps, WhatsAppPreview, Wizard, WizardNavigation, WizardSidebar, defaultTranslations$4 as defaultTranslations, sizeMap, themeColors, useAuraToast, useMediaQuery, useNavigationLoading, useThemeContext };
|
|
5809
|
+
export { AccordionList, AddHolidayForm, AnalyticsCard, AuraAutocomplete, AuraTable, AuraToastProvider, BreadcrumbsComponent, Button, Card, Chip, ColorPicker, ColorSelector, ContentCarousel, DEFAULT_PREDEFINED_COLORS, DatePicker, DateRangePicker, DateSelector, DrawerFilters, EnumMenuNavListItem, GlobalToast, H1, H2, H3, H4, HeaderComponent, HolidayType, IconComponent, ImagePreview, Input, Kanban, KanbanCard, KanbanColumn, MenuComponent, Modal, ModalBody, ModalContent, ModalFooter, ModalHeader, MultiStepWizard, NavigationLoadingContext, NavigationLoadingOverlay, NavigationLoadingProvider, P, Pagination, Phone, PromotionalBanner, RangeFilter, RowSteps, ScheduleRow, SearchInput, Select, SocialMediaBar, SocialMediaCarousel, SocialMediaPreview, StepIndicator, Switch as SwitchComponent, TagsFilter, Textarea, ThemeContext, ThemePicker, ThemeProvider, TimeInput as TimeInputComponent, ToastContext, TwoColumnLayoutAgent, UploadFile, VerticalSteps, WhatsAppPreview, Wizard, WizardNavigation, WizardSidebar, defaultTranslations$4 as defaultTranslations, getSelectedKeyFromPath, sizeMap, themeColors, useAuraToast, useMediaQuery, useNavigationLoading, useThemeContext };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Menu.d.ts","sourceRoot":"","sources":["../../../../src/components/menu/Menu.tsx"],"names":[],"mappings":"AAKA,OAAO,KAA+B,MAAM,OAAO,CAAC;AACpD,OAAO,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"Menu.d.ts","sourceRoot":"","sources":["../../../../src/components/menu/Menu.tsx"],"names":[],"mappings":"AAKA,OAAO,KAA+B,MAAM,OAAO,CAAC;AACpD,OAAO,aAAa,CAAC;AAIrB,OAAO,KAAK,EACX,kBAAkB,EAElB,MAAM,cAAc,CAAC;AActB;;;GAGG;AACH,eAAO,MAAM,aAAa,EAAE,KAAK,CAAC,EAAE,CAAC,kBAAkB,CAsPtD,CAAC"}
|
|
@@ -31,7 +31,13 @@ export interface MenuComponentProps {
|
|
|
31
31
|
};
|
|
32
32
|
menuItems: {
|
|
33
33
|
items: MenuNavListItem[];
|
|
34
|
-
|
|
34
|
+
/**
|
|
35
|
+
* Ruta actual (p. ej. location.pathname). La librería calcula la key seleccionada
|
|
36
|
+
* comparando con los href de los ítems. Preferido frente a selectedKey.
|
|
37
|
+
*/
|
|
38
|
+
selectedPath?: string;
|
|
39
|
+
/** Key del ítem seleccionado. Si se pasa selectedPath, se ignora y se deriva internamente. */
|
|
40
|
+
selectedKey?: string;
|
|
35
41
|
/**
|
|
36
42
|
* Se invoca al seleccionar un ítem. En móvil, si `source === 'bottomBar'` la app no debe abrir
|
|
37
43
|
* el menú lateral (solo el botón hamburguesa debe abrirlo) para evitar parpadeos.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Menu.types.d.ts","sourceRoot":"","sources":["../../../../src/components/menu/Menu.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,6CAA6C,CAAC;AAEnF;;;GAGG;AACH,MAAM,MAAM,yBAAyB,GAAG;IACvC,wEAAwE;IACxE,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,2DAA2D;IAC3D,qBAAqB,CAAC,EAAE,MAAM,CAAC;IAC/B,6DAA6D;IAC7D,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,2EAA2E;IAC3E,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,8FAA8F;IAC9F,eAAe,CAAC,EAAE,MAAM,CAAC;CACzB,CAAC;AAEF,MAAM,WAAW,kBAAkB;IAClC,YAAY,EAAE;QACb,IAAI,EAAE,MAAM,CAAC;QACb,IAAI,EAAE,MAAM,CAAC;KACb,CAAC;IACF,QAAQ,EAAE;QACT,MAAM,EAAE,MAAM,CAAC;QACf,IAAI,EAAE,MAAM,CAAC;QACb,IAAI,EAAE,MAAM,CAAC;KACb,CAAC;IACF,UAAU,EAAE;QACX,KAAK,EAAE,MAAM,CAAC;QACd,QAAQ,EAAE,MAAM,CAAC;KACjB,CAAC;IACF,SAAS,EAAE;QACV,KAAK,EAAE,eAAe,EAAE,CAAC;QACzB,WAAW,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"Menu.types.d.ts","sourceRoot":"","sources":["../../../../src/components/menu/Menu.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,6CAA6C,CAAC;AAEnF;;;GAGG;AACH,MAAM,MAAM,yBAAyB,GAAG;IACvC,wEAAwE;IACxE,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,2DAA2D;IAC3D,qBAAqB,CAAC,EAAE,MAAM,CAAC;IAC/B,6DAA6D;IAC7D,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,2EAA2E;IAC3E,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,8FAA8F;IAC9F,eAAe,CAAC,EAAE,MAAM,CAAC;CACzB,CAAC;AAEF,MAAM,WAAW,kBAAkB;IAClC,YAAY,EAAE;QACb,IAAI,EAAE,MAAM,CAAC;QACb,IAAI,EAAE,MAAM,CAAC;KACb,CAAC;IACF,QAAQ,EAAE;QACT,MAAM,EAAE,MAAM,CAAC;QACf,IAAI,EAAE,MAAM,CAAC;QACb,IAAI,EAAE,MAAM,CAAC;KACb,CAAC;IACF,UAAU,EAAE;QACX,KAAK,EAAE,MAAM,CAAC;QACd,QAAQ,EAAE,MAAM,CAAC;KACjB,CAAC;IACF,SAAS,EAAE;QACV,KAAK,EAAE,eAAe,EAAE,CAAC;QACzB;;;WAGG;QACH,YAAY,CAAC,EAAE,MAAM,CAAC;QACtB,8FAA8F;QAC9F,WAAW,CAAC,EAAE,MAAM,CAAC;QACrB;;;WAGG;QACH,QAAQ,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,SAAS,GAAG,WAAW,KAAK,IAAI,CAAC;KAClF,CAAC;IACF,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,mBAAmB,CAAC,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC;IAC9C;;;;OAIG;IACH,uBAAuB,CAAC,EAAE,MAAM,CAAC;IACjC;;;;OAIG;IACH,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB;;;OAGG;IACH,YAAY,CAAC,EAAE,yBAAyB,CAAC;CACzC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { MenuNavListItem } from "./_internal/menu-nav-list/MenuNavList.types";
|
|
2
|
+
/**
|
|
3
|
+
* Returns the menu item key that matches the current pathname.
|
|
4
|
+
* Supports the structure used by Menu: items can be sections (each with .items) or flat.
|
|
5
|
+
* For nested items (e.g. Catálogo > Productos), returns the sub-item key.
|
|
6
|
+
*/
|
|
7
|
+
export declare function getSelectedKeyFromPath(pathname: string, items: MenuNavListItem[]): string | undefined;
|
|
8
|
+
//# sourceMappingURL=get-selected-key-from-path.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-selected-key-from-path.d.ts","sourceRoot":"","sources":["../../../../src/components/menu/get-selected-key-from-path.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,6CAA6C,CAAC;AAqCnF;;;;GAIG;AACH,wBAAgB,sBAAsB,CACrC,QAAQ,EAAE,MAAM,EAChB,KAAK,EAAE,eAAe,EAAE,GACtB,MAAM,GAAG,SAAS,CAQpB"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export { MenuComponent } from "./Menu";
|
|
2
|
+
export { getSelectedKeyFromPath } from "./get-selected-key-from-path";
|
|
2
3
|
export type { MenuComponentProps, MenuComponentTranslations, } from "./Menu.types";
|
|
3
4
|
export { EnumMenuNavListItem } from "./_internal/menu-nav-list/MenuNavList.types";
|
|
4
5
|
export type { MenuNavListItem } from "./_internal/menu-nav-list/MenuNavList.types";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/menu/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,QAAQ,CAAC;AACvC,YAAY,EACX,kBAAkB,EAClB,yBAAyB,GACzB,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,mBAAmB,EAAE,MAAM,6CAA6C,CAAC;AAClF,YAAY,EAAE,eAAe,EAAE,MAAM,6CAA6C,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/menu/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,QAAQ,CAAC;AACvC,OAAO,EAAE,sBAAsB,EAAE,MAAM,8BAA8B,CAAC;AACtE,YAAY,EACX,kBAAkB,EAClB,yBAAyB,GACzB,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,mBAAmB,EAAE,MAAM,6CAA6C,CAAC;AAClF,YAAY,EAAE,eAAe,EAAE,MAAM,6CAA6C,CAAC"}
|