@versini/ui-menu 6.4.1 → 6.5.0
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.d.ts +1 -1
- package/dist/index.js +17 -9
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -1,19 +1,18 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
@versini/ui-menu v6.
|
|
2
|
+
@versini/ui-menu v6.5.0
|
|
3
3
|
© 2026 gizmette.com
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
7
7
|
import { useUniqueId } from "@versini/ui-hooks/use-unique-id";
|
|
8
|
-
import clsx_0 , { clsx } from "clsx";
|
|
9
8
|
import { cloneElement, createContext, isValidElement, useCallback, useContext, useEffect, useRef, useState } from "react";
|
|
9
|
+
import clsx_0 , { clsx } from "clsx";
|
|
10
10
|
import { IconNext } from "@versini/ui-icons";
|
|
11
11
|
|
|
12
12
|
|
|
13
13
|
|
|
14
14
|
|
|
15
15
|
|
|
16
|
-
|
|
17
16
|
const MenuGroupContext = createContext(false);
|
|
18
17
|
/* v8 ignore start - default context values are fallbacks, never used directly */ const MenuRootContext = createContext({
|
|
19
18
|
closeAll: ()=>{}
|
|
@@ -258,6 +257,7 @@ function getLastEnabledIndex(items) {
|
|
|
258
257
|
}
|
|
259
258
|
|
|
260
259
|
|
|
260
|
+
|
|
261
261
|
const getDisplayName = (element)=>{
|
|
262
262
|
if (typeof element === "string") {
|
|
263
263
|
return element;
|
|
@@ -355,6 +355,12 @@ const getMenuItemClasses = ({ isSub })=>{
|
|
|
355
355
|
"data-disabled:cursor-not-allowed data-disabled:text-copy-medium": !isSub
|
|
356
356
|
});
|
|
357
357
|
};
|
|
358
|
+
const getMenuClasses = ({ isSub })=>{
|
|
359
|
+
return clsx("bg-surface-medium", "rounded-md", "outline-hidden", "p-1", {
|
|
360
|
+
"z-100 plume plume-dark": !isSub,
|
|
361
|
+
"z-60 mx-3": isSub
|
|
362
|
+
});
|
|
363
|
+
};
|
|
358
364
|
|
|
359
365
|
|
|
360
366
|
|
|
@@ -407,8 +413,9 @@ function useMenuPosition({ triggerRef, menuRef, placement, sideOffset, isOpen })
|
|
|
407
413
|
|
|
408
414
|
|
|
409
415
|
|
|
410
|
-
|
|
411
|
-
|
|
416
|
+
const CONTENT_CLASS = getMenuClasses({
|
|
417
|
+
isSub: false
|
|
418
|
+
});
|
|
412
419
|
const Menu = ({ trigger, children, label = "Open menu", defaultPlacement = "bottom-start", onOpenChange, mode = "system", focusMode = "system", sideOffset = 10 })=>{
|
|
413
420
|
const [isOpen, setIsOpen] = useState(false);
|
|
414
421
|
const [activeIndex, setActiveIndex] = useState(-1);
|
|
@@ -632,7 +639,7 @@ Menu.displayName = "Menu";
|
|
|
632
639
|
|
|
633
640
|
|
|
634
641
|
const MenuGroup = ({ children, label, className, icon })=>{
|
|
635
|
-
const groupClass = clsx_0("rounded-md", "p-2", "first:mt-0 mt-
|
|
642
|
+
const groupClass = clsx_0("rounded-md", "p-2", "first:mt-0 mt-1", "bg-surface-dark", "text-copy-light", className);
|
|
636
643
|
const labelContainerClass = clsx_0("pt-2 pb-2", "px-3 sm:px-2", "-mx-1 -mt-1", "flex items-center justify-between", "text-xs text-copy-medium uppercase font-bold", "rounded-t-md");
|
|
637
644
|
return /*#__PURE__*/ jsx(MenuGroupContext.Provider, {
|
|
638
645
|
value: true,
|
|
@@ -836,12 +843,13 @@ MenuSeparator.displayName = "MenuSeparator";
|
|
|
836
843
|
|
|
837
844
|
|
|
838
845
|
|
|
839
|
-
|
|
840
|
-
|
|
846
|
+
const SUB_CONTENT_CLASS = getMenuClasses({
|
|
847
|
+
isSub: true
|
|
848
|
+
});
|
|
841
849
|
const SUB_TRIGGER_CLASS = getMenuItemClasses({
|
|
842
850
|
isSub: true
|
|
843
851
|
});
|
|
844
|
-
const MenuSub = ({ label, icon, children, disabled = false, sideOffset =
|
|
852
|
+
const MenuSub = ({ label, icon, children, disabled = false, sideOffset = 20 })=>{
|
|
845
853
|
const subMenuId = useUniqueId("av-menu-sub-");
|
|
846
854
|
const [isSubOpen, setIsSubOpen] = useState(false);
|
|
847
855
|
const [subActiveIndex, setSubActiveIndex] = useState(-1);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@versini/ui-menu",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.5.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"author": "Arno Versini",
|
|
6
6
|
"publishConfig": {
|
|
@@ -49,5 +49,5 @@
|
|
|
49
49
|
"sideEffects": [
|
|
50
50
|
"**/*.css"
|
|
51
51
|
],
|
|
52
|
-
"gitHead": "
|
|
52
|
+
"gitHead": "246529f9d6a79406fe3f2e647f2cf0084fb2733e"
|
|
53
53
|
}
|