@beweco/aurora-ui 0.1.58 → 0.1.60
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 -5
- package/dist/index.esm.js +59 -5
- package/dist/types/components/menu/Menu.d.ts.map +1 -1
- package/dist/types/components/menu/_internal/menu-nav-list/MenuNavList.d.ts.map +1 -1
- package/package.json +1 -1
- package/dist/types/components/menu/sidebar-items.d.ts +0 -3
- package/dist/types/components/menu/sidebar-items.d.ts.map +0 -1
package/dist/index.cjs.js
CHANGED
|
@@ -2108,16 +2108,13 @@ var MenuNavList = React.forwardRef(function (_a, ref) {
|
|
|
2108
2108
|
document.activeElement.blur();
|
|
2109
2109
|
}
|
|
2110
2110
|
}, [onSelect]);
|
|
2111
|
-
// Renders a sub-item (text-only, hierarchy line
|
|
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"].
|
|
2111
|
+
// Renders a sub-item (text-only, hierarchy line). Estilos de selección vía clase .selected en Menu.scss.
|
|
2115
2112
|
var renderSubItem = React.useCallback(function (item, parentKey) {
|
|
2116
2113
|
var _a;
|
|
2117
2114
|
item.href; var itemProps = __rest(item, ["href"]);
|
|
2118
2115
|
var isSelected = item.key === selectedKey;
|
|
2119
2116
|
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: {
|
|
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",
|
|
2117
|
+
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", isSelected && "selected"),
|
|
2121
2118
|
}, onPress: function () { return handleItemPress(item); } })));
|
|
2122
2119
|
}, [handleItemPress, selectedKey]);
|
|
2123
2120
|
// Renders the item displayed inside the Popover when the menu is collapsed.
|
|
@@ -2266,6 +2263,63 @@ var MenuComponent = React.memo(function Menu(_a) {
|
|
|
2266
2263
|
(_a = menuItems.onSelect) === null || _a === void 0 ? void 0 : _a.call(menuItems, key, href, "bottomBar");
|
|
2267
2264
|
}, [onOpenSidebarChange, menuItems.onSelect]);
|
|
2268
2265
|
var showBottomBar = (mobileBottomBarGroupKey && bottomBarItems.length > 0) || showNativeMenu;
|
|
2266
|
+
// Drag-to-scroll: clic sostenido + arrastre en el área de scroll del menú
|
|
2267
|
+
var scrollContainerRef = React.useRef(null);
|
|
2268
|
+
var dragStateRef = React.useRef({ startY: 0, startScrollTop: 0, isDragging: false, prevClientY: 0 });
|
|
2269
|
+
var _h = React.useState(false); _h[0]; var setIsDraggingScroll = _h[1];
|
|
2270
|
+
var handleScrollAreaMouseMove = React.useCallback(function (e) {
|
|
2271
|
+
var el = scrollContainerRef.current;
|
|
2272
|
+
if (!el)
|
|
2273
|
+
return;
|
|
2274
|
+
var state = dragStateRef.current;
|
|
2275
|
+
var dy = e.clientY - state.startY;
|
|
2276
|
+
if (!state.isDragging && Math.abs(dy) > 5) {
|
|
2277
|
+
state.isDragging = true;
|
|
2278
|
+
state.prevClientY = e.clientY;
|
|
2279
|
+
setIsDraggingScroll(true);
|
|
2280
|
+
}
|
|
2281
|
+
if (state.isDragging) {
|
|
2282
|
+
el.scrollTop += state.prevClientY - e.clientY;
|
|
2283
|
+
state.prevClientY = e.clientY;
|
|
2284
|
+
}
|
|
2285
|
+
}, []);
|
|
2286
|
+
var handleScrollAreaMouseUp = React.useCallback(function () {
|
|
2287
|
+
var wasDragging = dragStateRef.current.isDragging;
|
|
2288
|
+
document.removeEventListener("mousemove", handleScrollAreaMouseMove);
|
|
2289
|
+
document.removeEventListener("mouseup", handleScrollAreaMouseUp);
|
|
2290
|
+
dragStateRef.current.isDragging = false;
|
|
2291
|
+
setIsDraggingScroll(false);
|
|
2292
|
+
if (wasDragging) {
|
|
2293
|
+
var preventClick_1 = function (e) {
|
|
2294
|
+
e.preventDefault();
|
|
2295
|
+
e.stopPropagation();
|
|
2296
|
+
document.removeEventListener("click", preventClick_1, true);
|
|
2297
|
+
};
|
|
2298
|
+
document.addEventListener("click", preventClick_1, true);
|
|
2299
|
+
setTimeout(function () { return document.removeEventListener("click", preventClick_1, true); }, 50);
|
|
2300
|
+
}
|
|
2301
|
+
}, [handleScrollAreaMouseMove]);
|
|
2302
|
+
React.useCallback(function (e) {
|
|
2303
|
+
if (e.button !== 0)
|
|
2304
|
+
return;
|
|
2305
|
+
var el = scrollContainerRef.current;
|
|
2306
|
+
if (!el)
|
|
2307
|
+
return;
|
|
2308
|
+
dragStateRef.current = {
|
|
2309
|
+
startY: e.clientY,
|
|
2310
|
+
startScrollTop: el.scrollTop,
|
|
2311
|
+
isDragging: false,
|
|
2312
|
+
prevClientY: e.clientY,
|
|
2313
|
+
};
|
|
2314
|
+
document.addEventListener("mousemove", handleScrollAreaMouseMove);
|
|
2315
|
+
document.addEventListener("mouseup", handleScrollAreaMouseUp);
|
|
2316
|
+
}, [handleScrollAreaMouseMove, handleScrollAreaMouseUp]);
|
|
2317
|
+
React.useEffect(function () {
|
|
2318
|
+
return function () {
|
|
2319
|
+
document.removeEventListener("mousemove", handleScrollAreaMouseMove);
|
|
2320
|
+
document.removeEventListener("mouseup", handleScrollAreaMouseUp);
|
|
2321
|
+
};
|
|
2322
|
+
}, [handleScrollAreaMouseMove, handleScrollAreaMouseUp]);
|
|
2269
2323
|
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
|
|
2270
2324
|
? "container__menu--collapsed"
|
|
2271
2325
|
: "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: {
|
package/dist/index.esm.js
CHANGED
|
@@ -2109,16 +2109,13 @@ var MenuNavList = React.forwardRef(function (_a, ref) {
|
|
|
2109
2109
|
document.activeElement.blur();
|
|
2110
2110
|
}
|
|
2111
2111
|
}, [onSelect]);
|
|
2112
|
-
// Renders a sub-item (text-only, hierarchy line
|
|
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"].
|
|
2112
|
+
// Renders a sub-item (text-only, hierarchy line). Estilos de selección vía clase .selected en Menu.scss.
|
|
2116
2113
|
var renderSubItem = React.useCallback(function (item, parentKey) {
|
|
2117
2114
|
var _a;
|
|
2118
2115
|
item.href; var itemProps = __rest(item, ["href"]);
|
|
2119
2116
|
var isSelected = item.key === selectedKey;
|
|
2120
2117
|
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: {
|
|
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",
|
|
2118
|
+
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", isSelected && "selected"),
|
|
2122
2119
|
}, onPress: function () { return handleItemPress(item); } })));
|
|
2123
2120
|
}, [handleItemPress, selectedKey]);
|
|
2124
2121
|
// Renders the item displayed inside the Popover when the menu is collapsed.
|
|
@@ -2267,6 +2264,63 @@ var MenuComponent = React.memo(function Menu(_a) {
|
|
|
2267
2264
|
(_a = menuItems.onSelect) === null || _a === void 0 ? void 0 : _a.call(menuItems, key, href, "bottomBar");
|
|
2268
2265
|
}, [onOpenSidebarChange, menuItems.onSelect]);
|
|
2269
2266
|
var showBottomBar = (mobileBottomBarGroupKey && bottomBarItems.length > 0) || showNativeMenu;
|
|
2267
|
+
// Drag-to-scroll: clic sostenido + arrastre en el área de scroll del menú
|
|
2268
|
+
var scrollContainerRef = useRef(null);
|
|
2269
|
+
var dragStateRef = useRef({ startY: 0, startScrollTop: 0, isDragging: false, prevClientY: 0 });
|
|
2270
|
+
var _h = React.useState(false); _h[0]; var setIsDraggingScroll = _h[1];
|
|
2271
|
+
var handleScrollAreaMouseMove = useCallback(function (e) {
|
|
2272
|
+
var el = scrollContainerRef.current;
|
|
2273
|
+
if (!el)
|
|
2274
|
+
return;
|
|
2275
|
+
var state = dragStateRef.current;
|
|
2276
|
+
var dy = e.clientY - state.startY;
|
|
2277
|
+
if (!state.isDragging && Math.abs(dy) > 5) {
|
|
2278
|
+
state.isDragging = true;
|
|
2279
|
+
state.prevClientY = e.clientY;
|
|
2280
|
+
setIsDraggingScroll(true);
|
|
2281
|
+
}
|
|
2282
|
+
if (state.isDragging) {
|
|
2283
|
+
el.scrollTop += state.prevClientY - e.clientY;
|
|
2284
|
+
state.prevClientY = e.clientY;
|
|
2285
|
+
}
|
|
2286
|
+
}, []);
|
|
2287
|
+
var handleScrollAreaMouseUp = useCallback(function () {
|
|
2288
|
+
var wasDragging = dragStateRef.current.isDragging;
|
|
2289
|
+
document.removeEventListener("mousemove", handleScrollAreaMouseMove);
|
|
2290
|
+
document.removeEventListener("mouseup", handleScrollAreaMouseUp);
|
|
2291
|
+
dragStateRef.current.isDragging = false;
|
|
2292
|
+
setIsDraggingScroll(false);
|
|
2293
|
+
if (wasDragging) {
|
|
2294
|
+
var preventClick_1 = function (e) {
|
|
2295
|
+
e.preventDefault();
|
|
2296
|
+
e.stopPropagation();
|
|
2297
|
+
document.removeEventListener("click", preventClick_1, true);
|
|
2298
|
+
};
|
|
2299
|
+
document.addEventListener("click", preventClick_1, true);
|
|
2300
|
+
setTimeout(function () { return document.removeEventListener("click", preventClick_1, true); }, 50);
|
|
2301
|
+
}
|
|
2302
|
+
}, [handleScrollAreaMouseMove]);
|
|
2303
|
+
useCallback(function (e) {
|
|
2304
|
+
if (e.button !== 0)
|
|
2305
|
+
return;
|
|
2306
|
+
var el = scrollContainerRef.current;
|
|
2307
|
+
if (!el)
|
|
2308
|
+
return;
|
|
2309
|
+
dragStateRef.current = {
|
|
2310
|
+
startY: e.clientY,
|
|
2311
|
+
startScrollTop: el.scrollTop,
|
|
2312
|
+
isDragging: false,
|
|
2313
|
+
prevClientY: e.clientY,
|
|
2314
|
+
};
|
|
2315
|
+
document.addEventListener("mousemove", handleScrollAreaMouseMove);
|
|
2316
|
+
document.addEventListener("mouseup", handleScrollAreaMouseUp);
|
|
2317
|
+
}, [handleScrollAreaMouseMove, handleScrollAreaMouseUp]);
|
|
2318
|
+
useEffect(function () {
|
|
2319
|
+
return function () {
|
|
2320
|
+
document.removeEventListener("mousemove", handleScrollAreaMouseMove);
|
|
2321
|
+
document.removeEventListener("mouseup", handleScrollAreaMouseUp);
|
|
2322
|
+
};
|
|
2323
|
+
}, [handleScrollAreaMouseMove, handleScrollAreaMouseUp]);
|
|
2270
2324
|
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
|
|
2271
2325
|
? "container__menu--collapsed"
|
|
2272
2326
|
: "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: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Menu.d.ts","sourceRoot":"","sources":["../../../../src/components/menu/Menu.tsx"],"names":[],"mappings":"AAKA,OAAO,
|
|
1
|
+
{"version":3,"file":"Menu.d.ts","sourceRoot":"","sources":["../../../../src/components/menu/Menu.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAkD,MAAM,OAAO,CAAC;AACvE,OAAO,aAAa,CAAC;AAIrB,OAAO,KAAK,EACX,kBAAkB,EAElB,MAAM,cAAc,CAAC;AActB;;;GAGG;AACH,eAAO,MAAM,aAAa,EAAE,KAAK,CAAC,EAAE,CAAC,kBAAkB,CA0TtD,CAAC"}
|
|
@@ -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,
|
|
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,mGAyZvB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"sidebar-items.d.ts","sourceRoot":"","sources":["../../../../src/components/menu/sidebar-items.tsx"],"names":[],"mappings":"AAEA,OAAO,EAEN,KAAK,eAAe,EACpB,MAAM,6CAA6C,CAAC;AAErD,eAAO,MAAM,kBAAkB,EAAE,eAAe,EAwH/C,CAAC"}
|