@beweco/aurora-ui 0.1.56 → 0.1.58

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 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";
@@ -2059,13 +2109,15 @@ var MenuNavList = React.forwardRef(function (_a, ref) {
2059
2109
  }
2060
2110
  }, [onSelect]);
2061
2111
  // Renders a sub-item (text-only, hierarchy line, pill selected state).
2062
- // Aplicamos estilos de selección por key porque el Listbox anidado puede no inyectar data-selected.
2112
+ // Estilos de selección aplicados por isSelected en classNames (no solo por CSS externo) para que
2113
+ // funcionen igual con el paquete publicado en npm: evita que el CSS de la app pise o que el
2114
+ // build no incluya la regla .menu-nav-list__sub-item[data-menu-subitem-selected="true"].
2063
2115
  var renderSubItem = React.useCallback(function (item, parentKey) {
2064
2116
  var _a;
2065
2117
  item.href; var itemProps = __rest(item, ["href"]);
2066
2118
  var isSelected = item.key === selectedKey;
2067
2119
  return (React.createElement(react.ListboxItem, __assign({}, itemProps, { key: item.key, textValue: item.title, title: item.title, startContent: null, endContent: (_a = item.endContent) !== null && _a !== void 0 ? _a : null, "aria-selected": isSelected, "data-menu-subitem-selected": isSelected ? "true" : "false", classNames: {
2068
- base: react.cn("min-h-9 rounded-large px-3 py-2 menu-nav-list__sub-item", "text-default-500 data-[hover=true]:text-default-700", "data-[selected=true]:bg-default-100 data-[selected=true]:text-foreground data-[selected=true]:font-semibold"),
2120
+ base: react.cn("min-h-9 rounded-large px-3 py-2 menu-nav-list__sub-item", "text-default-500 data-[hover=true]:text-default-700", "data-[selected=true]:bg-default-100 data-[selected=true]:text-foreground data-[selected=true]:font-semibold", isSelected && "bg-primary-100 font-semibold text-primary"),
2069
2121
  }, onPress: function () { return handleItemPress(item); } })));
2070
2122
  }, [handleItemPress, selectedKey]);
2071
2123
  // Renders the item displayed inside the Popover when the menu is collapsed.
@@ -2152,6 +2204,13 @@ var MenuComponent = React.memo(function Menu(_a) {
2152
2204
  var _f = React.useState(false), isCollapsed = _f[0], setIsCollapsed = _f[1];
2153
2205
  var _g = React.useState(false), logoError = _g[0], setLogoError = _g[1];
2154
2206
  var t = __assign(__assign({}, DEFAULT_TRANSLATIONS$3), translations);
2207
+ var selectedKey = React.useMemo(function () {
2208
+ var _a, _b, _c;
2209
+ if (menuItems.selectedPath) {
2210
+ return ((_b = (_a = getSelectedKeyFromPath(menuItems.selectedPath, menuItems.items)) !== null && _a !== void 0 ? _a : menuItems.selectedKey) !== null && _b !== void 0 ? _b : "");
2211
+ }
2212
+ return (_c = menuItems.selectedKey) !== null && _c !== void 0 ? _c : "";
2213
+ }, [menuItems.selectedPath, menuItems.selectedKey, menuItems.items]);
2155
2214
  var commerceName = (typeof (commerceInfo === null || commerceInfo === void 0 ? void 0 : commerceInfo.name) === "string" && commerceInfo.name.trim()) ||
2156
2215
  t.notDefinedLabel;
2157
2216
  var userName = (typeof (userInfo === null || userInfo === void 0 ? void 0 : userInfo.name) === "string" && userInfo.name.trim()) ||
@@ -2207,13 +2266,13 @@ var MenuComponent = React.memo(function Menu(_a) {
2207
2266
  (_a = menuItems.onSelect) === null || _a === void 0 ? void 0 : _a.call(menuItems, key, href, "bottomBar");
2208
2267
  }, [onOpenSidebarChange, menuItems.onSelect]);
2209
2268
  var showBottomBar = (mobileBottomBarGroupKey && bottomBarItems.length > 0) || showNativeMenu;
2210
- return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [showBottomBar && (jsxRuntime.jsx(MenuMobileBottomBar, { items: bottomBarItems, selectedKey: menuItems.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
2269
+ 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
2270
  ? "container__menu--collapsed"
2212
2271
  : "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
2272
  flexDirection: isCollapsed ? "column-reverse" : "row",
2214
2273
  }, 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
2274
  ? "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: menuItems.selectedKey, items: menuItems.items, isCollapsed: isCollapsed, onSelect: handleMenuSelect }, menuItems.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 })) }) })] }) })] }));
2275
+ : "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
2276
  });
2218
2277
 
2219
2278
  var StepIndicator = function (_a) {
@@ -5825,6 +5884,7 @@ exports.Wizard = Wizard;
5825
5884
  exports.WizardNavigation = WizardNavigation;
5826
5885
  exports.WizardSidebar = WizardSidebar;
5827
5886
  exports.defaultTranslations = defaultTranslations$4;
5887
+ exports.getSelectedKeyFromPath = getSelectedKeyFromPath;
5828
5888
  exports.sizeMap = sizeMap;
5829
5889
  exports.themeColors = themeColors;
5830
5890
  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";
@@ -2060,13 +2110,15 @@ var MenuNavList = React.forwardRef(function (_a, ref) {
2060
2110
  }
2061
2111
  }, [onSelect]);
2062
2112
  // Renders a sub-item (text-only, hierarchy line, pill selected state).
2063
- // Aplicamos estilos de selección por key porque el Listbox anidado puede no inyectar data-selected.
2113
+ // Estilos de selección aplicados por isSelected en classNames (no solo por CSS externo) para que
2114
+ // funcionen igual con el paquete publicado en npm: evita que el CSS de la app pise o que el
2115
+ // build no incluya la regla .menu-nav-list__sub-item[data-menu-subitem-selected="true"].
2064
2116
  var renderSubItem = React.useCallback(function (item, parentKey) {
2065
2117
  var _a;
2066
2118
  item.href; var itemProps = __rest(item, ["href"]);
2067
2119
  var isSelected = item.key === selectedKey;
2068
2120
  return (createElement(ListboxItem, __assign({}, itemProps, { key: item.key, textValue: item.title, title: item.title, startContent: null, endContent: (_a = item.endContent) !== null && _a !== void 0 ? _a : null, "aria-selected": isSelected, "data-menu-subitem-selected": isSelected ? "true" : "false", classNames: {
2069
- base: cn("min-h-9 rounded-large px-3 py-2 menu-nav-list__sub-item", "text-default-500 data-[hover=true]:text-default-700", "data-[selected=true]:bg-default-100 data-[selected=true]:text-foreground data-[selected=true]:font-semibold"),
2121
+ base: cn("min-h-9 rounded-large px-3 py-2 menu-nav-list__sub-item", "text-default-500 data-[hover=true]:text-default-700", "data-[selected=true]:bg-default-100 data-[selected=true]:text-foreground data-[selected=true]:font-semibold", isSelected && "bg-primary-100 font-semibold text-primary"),
2070
2122
  }, onPress: function () { return handleItemPress(item); } })));
2071
2123
  }, [handleItemPress, selectedKey]);
2072
2124
  // Renders the item displayed inside the Popover when the menu is collapsed.
@@ -2153,6 +2205,13 @@ var MenuComponent = React.memo(function Menu(_a) {
2153
2205
  var _f = React.useState(false), isCollapsed = _f[0], setIsCollapsed = _f[1];
2154
2206
  var _g = React.useState(false), logoError = _g[0], setLogoError = _g[1];
2155
2207
  var t = __assign(__assign({}, DEFAULT_TRANSLATIONS$3), translations);
2208
+ var selectedKey = React.useMemo(function () {
2209
+ var _a, _b, _c;
2210
+ if (menuItems.selectedPath) {
2211
+ return ((_b = (_a = getSelectedKeyFromPath(menuItems.selectedPath, menuItems.items)) !== null && _a !== void 0 ? _a : menuItems.selectedKey) !== null && _b !== void 0 ? _b : "");
2212
+ }
2213
+ return (_c = menuItems.selectedKey) !== null && _c !== void 0 ? _c : "";
2214
+ }, [menuItems.selectedPath, menuItems.selectedKey, menuItems.items]);
2156
2215
  var commerceName = (typeof (commerceInfo === null || commerceInfo === void 0 ? void 0 : commerceInfo.name) === "string" && commerceInfo.name.trim()) ||
2157
2216
  t.notDefinedLabel;
2158
2217
  var userName = (typeof (userInfo === null || userInfo === void 0 ? void 0 : userInfo.name) === "string" && userInfo.name.trim()) ||
@@ -2208,13 +2267,13 @@ var MenuComponent = React.memo(function Menu(_a) {
2208
2267
  (_a = menuItems.onSelect) === null || _a === void 0 ? void 0 : _a.call(menuItems, key, href, "bottomBar");
2209
2268
  }, [onOpenSidebarChange, menuItems.onSelect]);
2210
2269
  var showBottomBar = (mobileBottomBarGroupKey && bottomBarItems.length > 0) || showNativeMenu;
2211
- return (jsxs(Fragment, { children: [showBottomBar && (jsx(MenuMobileBottomBar, { items: bottomBarItems, selectedKey: menuItems.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
2270
+ 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
2271
  ? "container__menu--collapsed"
2213
2272
  : "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
2273
  flexDirection: isCollapsed ? "column-reverse" : "row",
2215
2274
  }, 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
2275
  ? "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: menuItems.selectedKey, items: menuItems.items, isCollapsed: isCollapsed, onSelect: handleMenuSelect }, menuItems.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 })) }) })] }) })] }));
2276
+ : "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
2277
  });
2219
2278
 
2220
2279
  var StepIndicator = function (_a) {
@@ -5749,4 +5808,4 @@ var NavigationLoadingProvider = function (_a) {
5749
5808
  return (jsxs(NavigationLoadingContext.Provider, { value: value, children: [children, jsx(NavigationLoadingOverlay, { isVisible: isVisible })] }));
5750
5809
  };
5751
5810
 
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 };
5811
+ 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;AAGrB,OAAO,KAAK,EACX,kBAAkB,EAElB,MAAM,cAAc,CAAC;AActB;;;GAGG;AACH,eAAO,MAAM,aAAa,EAAE,KAAK,CAAC,EAAE,CAAC,kBAAkB,CA2OtD,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
- selectedKey: string;
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;QACpB;;;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"}
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"}
@@ -1 +1 @@
1
- {"version":3,"file":"MenuNavList.d.ts","sourceRoot":"","sources":["../../../../../../src/components/menu/_internal/menu-nav-list/MenuNavList.tsx"],"names":[],"mappings":"AAWA,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAG5D;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,WAAW,mGA2ZvB,CAAC"}
1
+ {"version":3,"file":"MenuNavList.d.ts","sourceRoot":"","sources":["../../../../../../src/components/menu/_internal/menu-nav-list/MenuNavList.tsx"],"names":[],"mappings":"AAWA,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAG5D;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,WAAW,mGA6ZvB,CAAC"}
@@ -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"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@beweco/aurora-ui",
3
- "version": "0.1.56",
3
+ "version": "0.1.58",
4
4
  "description": "Bewe Aurora UI Component Library",
5
5
  "main": "./dist/index.cjs.js",
6
6
  "module": "./dist/index.esm.js",