@versini/ui-dropdown 1.2.1 → 1.2.2
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.
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
@versini/ui-dropdown v1.2.
|
|
2
|
+
@versini/ui-dropdown v1.2.2
|
|
3
3
|
© 2025 gizmette.com
|
|
4
4
|
*/
|
|
5
5
|
try {
|
|
6
6
|
if (!window.__VERSINI_UI_DROPDOWN__) {
|
|
7
7
|
window.__VERSINI_UI_DROPDOWN__ = {
|
|
8
|
-
version: "1.2.
|
|
9
|
-
buildTime: "12/
|
|
8
|
+
version: "1.2.2",
|
|
9
|
+
buildTime: "12/24/2025 09:20 AM EST",
|
|
10
10
|
homepage: "https://www.npmjs.com/package/@versini/ui-dropdown",
|
|
11
11
|
license: "MIT",
|
|
12
12
|
};
|
|
@@ -43,14 +43,14 @@ import { getDisplayName } from "./utilities.js";
|
|
|
43
43
|
|
|
44
44
|
const CONTENT_CLASS = "z-100 rounded-md bg-surface-light shadow-sm shadow-border-dark outline-hidden p-3 sm:p-2 prose prose-dark";
|
|
45
45
|
const SUB_CONTENT_CLASS = "z-[60] rounded-md bg-surface-light shadow-sm shadow-border-dark outline-hidden p-3 sm:p-2 mx-3";
|
|
46
|
-
const SUB_TRIGGER_CLASS = clsx("flex items-center flex-row justify-between", "w-full", "m-0 first:mt-0 mt-2 sm:mt-1 px-2 py-1", "rounded-md border border-transparent", "text-left text-base select-none cursor-pointer", "outline-hidden focus:border focus:border-border-medium focus:bg-surface-lighter focus:underline", "disabled:cursor-not-allowed disabled:text-copy-medium", "data-
|
|
46
|
+
const SUB_TRIGGER_CLASS = clsx("flex items-center flex-row justify-between", "w-full", "m-0 first:mt-0 mt-2 sm:mt-1 px-2 py-1", "rounded-md border border-transparent", "text-left text-base select-none cursor-pointer", "outline-hidden focus:border focus:border-border-medium focus:bg-surface-lighter focus:underline", "disabled:cursor-not-allowed disabled:text-copy-medium", "data-highlighted:bg-surface-lighter data-highlighted:border-border-medium data-highlighted:underline", "data-[state=open]:bg-surface-lighter");
|
|
47
47
|
/**
|
|
48
48
|
* Convert Radix placement format to our simplified format.
|
|
49
49
|
*/ const getRadixSide = (placement)=>{
|
|
50
|
-
/* v8 ignore
|
|
50
|
+
/* v8 ignore start */ if (!placement) {
|
|
51
51
|
return "bottom";
|
|
52
52
|
}
|
|
53
|
-
if (placement.startsWith("top")) {
|
|
53
|
+
/* v8 ignore stop */ if (placement.startsWith("top")) {
|
|
54
54
|
return "top";
|
|
55
55
|
}
|
|
56
56
|
if (placement.startsWith("left")) {
|
|
@@ -62,10 +62,10 @@ const SUB_TRIGGER_CLASS = clsx("flex items-center flex-row justify-between", "w-
|
|
|
62
62
|
return "bottom";
|
|
63
63
|
};
|
|
64
64
|
const getRadixAlign = (placement)=>{
|
|
65
|
-
/* v8 ignore
|
|
65
|
+
/* v8 ignore start */ if (!placement) {
|
|
66
66
|
return "start";
|
|
67
67
|
}
|
|
68
|
-
if (placement.endsWith("-start")) {
|
|
68
|
+
/* v8 ignore stop */ if (placement.endsWith("-start")) {
|
|
69
69
|
return "start";
|
|
70
70
|
}
|
|
71
71
|
if (placement.endsWith("-end")) {
|
|
@@ -84,12 +84,12 @@ const DropdownMenu = ({ trigger, children, label = "Open menu", defaultPlacement
|
|
|
84
84
|
mode
|
|
85
85
|
} : {};
|
|
86
86
|
const triggerRef = useRef(null);
|
|
87
|
-
/* v8 ignore
|
|
87
|
+
/* v8 ignore start - trigger is required in practice */ const triggerElement = trigger ? /*#__PURE__*/ cloneElement(trigger, {
|
|
88
88
|
...uiButtonsExtraProps,
|
|
89
89
|
"aria-label": label,
|
|
90
90
|
ref: triggerRef
|
|
91
91
|
}) : null;
|
|
92
|
-
const handleOpenChange = (open)=>{
|
|
92
|
+
/* v8 ignore stop */ const handleOpenChange = (open)=>{
|
|
93
93
|
setIsOpen(open);
|
|
94
94
|
onOpenChange?.(open);
|
|
95
95
|
/**
|
|
@@ -101,12 +101,12 @@ const DropdownMenu = ({ trigger, children, label = "Open menu", defaultPlacement
|
|
|
101
101
|
*/ if (open && triggerRef.current) {
|
|
102
102
|
// Auto-detect if we're inside a native <dialog> element shown modally
|
|
103
103
|
const closestDialog = triggerRef.current.closest("dialog");
|
|
104
|
-
/* v8 ignore
|
|
104
|
+
/* v8 ignore start - dialog detection cannot be fully tested without native showModal */ if (closestDialog?.open) {
|
|
105
105
|
setPortalContainer(closestDialog);
|
|
106
106
|
} else {
|
|
107
107
|
setPortalContainer(undefined);
|
|
108
108
|
}
|
|
109
|
-
/**
|
|
109
|
+
/* v8 ignore stop */ /**
|
|
110
110
|
* Dispatch a click event to parent elements.
|
|
111
111
|
* This ensures that parent components like Tooltip can detect the
|
|
112
112
|
* interaction and respond appropriately (e.g., disable tooltip display).
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
@versini/ui-dropdown v1.2.
|
|
2
|
+
@versini/ui-dropdown v1.2.2
|
|
3
3
|
© 2025 gizmette.com
|
|
4
4
|
*/
|
|
5
5
|
try {
|
|
6
6
|
if (!window.__VERSINI_UI_DROPDOWN__) {
|
|
7
7
|
window.__VERSINI_UI_DROPDOWN__ = {
|
|
8
|
-
version: "1.2.
|
|
9
|
-
buildTime: "12/
|
|
8
|
+
version: "1.2.2",
|
|
9
|
+
buildTime: "12/24/2025 09:20 AM EST",
|
|
10
10
|
homepage: "https://www.npmjs.com/package/@versini/ui-dropdown",
|
|
11
11
|
license: "MIT",
|
|
12
12
|
};
|
|
@@ -33,7 +33,7 @@ import clsx from "clsx";
|
|
|
33
33
|
|
|
34
34
|
|
|
35
35
|
|
|
36
|
-
const ITEM_CLASS = clsx("flex flex-row items-center", "w-full", "m-0 first:mt-0 mt-2 sm:mt-1 px-2 py-1", "rounded-md border border-transparent", "text-left text-base select-none cursor-pointer", "outline-hidden focus:border focus:border-border-medium focus:bg-surface-lighter focus:underline", "disabled:cursor-not-allowed disabled:text-copy-medium", "data-
|
|
36
|
+
const ITEM_CLASS = clsx("flex flex-row items-center", "w-full", "m-0 first:mt-0 mt-2 sm:mt-1 px-2 py-1", "rounded-md border border-transparent", "text-left text-base select-none cursor-pointer", "outline-hidden focus:border focus:border-border-medium focus:bg-surface-lighter focus:underline", "disabled:cursor-not-allowed disabled:text-copy-medium", "data-highlighted:bg-surface-lighter data-highlighted:border-border-medium data-highlighted:underline", "data-disabled:cursor-not-allowed data-disabled:text-copy-medium");
|
|
37
37
|
const DropdownMenuItem = ({ label, disabled, icon, raw = false, children, ignoreClick = false, selected, onSelect, onClick, onFocus, ...props })=>{
|
|
38
38
|
let buttonSpanClass = "";
|
|
39
39
|
if (raw && children) {
|
|
@@ -44,8 +44,8 @@ const DropdownMenuItem = ({ label, disabled, icon, raw = false, children, ignore
|
|
|
44
44
|
event.preventDefault();
|
|
45
45
|
}
|
|
46
46
|
onSelect?.(event);
|
|
47
|
-
/* v8 ignore
|
|
48
|
-
},
|
|
47
|
+
/* v8 ignore start - optional onClick may not be provided */ onClick?.(event);
|
|
48
|
+
/* v8 ignore stop */ },
|
|
49
49
|
...props,
|
|
50
50
|
children: children
|
|
51
51
|
});
|
|
@@ -62,8 +62,8 @@ const DropdownMenuItem = ({ label, disabled, icon, raw = false, children, ignore
|
|
|
62
62
|
}
|
|
63
63
|
onSelect?.(event);
|
|
64
64
|
// Also call onClick for compatibility with common patterns
|
|
65
|
-
/* v8 ignore
|
|
66
|
-
};
|
|
65
|
+
/* v8 ignore start - optional onClick may not be provided */ onClick?.(event);
|
|
66
|
+
/* v8 ignore stop */ };
|
|
67
67
|
return /*#__PURE__*/ jsxs(Item, {
|
|
68
68
|
className: itemClass,
|
|
69
69
|
disabled: disabled,
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
@versini/ui-dropdown v1.2.
|
|
2
|
+
@versini/ui-dropdown v1.2.2
|
|
3
3
|
© 2025 gizmette.com
|
|
4
4
|
*/
|
|
5
5
|
try {
|
|
6
6
|
if (!window.__VERSINI_UI_DROPDOWN__) {
|
|
7
7
|
window.__VERSINI_UI_DROPDOWN__ = {
|
|
8
|
-
version: "1.2.
|
|
9
|
-
buildTime: "12/
|
|
8
|
+
version: "1.2.2",
|
|
9
|
+
buildTime: "12/24/2025 09:20 AM EST",
|
|
10
10
|
homepage: "https://www.npmjs.com/package/@versini/ui-dropdown",
|
|
11
11
|
license: "MIT",
|
|
12
12
|
};
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
@versini/ui-dropdown v1.2.
|
|
2
|
+
@versini/ui-dropdown v1.2.2
|
|
3
3
|
© 2025 gizmette.com
|
|
4
4
|
*/
|
|
5
5
|
try {
|
|
6
6
|
if (!window.__VERSINI_UI_DROPDOWN__) {
|
|
7
7
|
window.__VERSINI_UI_DROPDOWN__ = {
|
|
8
|
-
version: "1.2.
|
|
9
|
-
buildTime: "12/
|
|
8
|
+
version: "1.2.2",
|
|
9
|
+
buildTime: "12/24/2025 09:20 AM EST",
|
|
10
10
|
homepage: "https://www.npmjs.com/package/@versini/ui-dropdown",
|
|
11
11
|
license: "MIT",
|
|
12
12
|
};
|
|
@@ -27,8 +27,8 @@ const getDisplayName = (element)=>{
|
|
|
27
27
|
if (typeof element === "object" && element !== null && "type" in element) {
|
|
28
28
|
const type = element.type;
|
|
29
29
|
if (typeof type === "function" || typeof type === "object") {
|
|
30
|
-
/* v8 ignore
|
|
31
|
-
}
|
|
30
|
+
/* v8 ignore start */ return type.displayName || type.name || "Component";
|
|
31
|
+
/* v8 ignore stop */ }
|
|
32
32
|
}
|
|
33
33
|
return "Element";
|
|
34
34
|
};
|
package/dist/index.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
@versini/ui-dropdown v1.2.
|
|
2
|
+
@versini/ui-dropdown v1.2.2
|
|
3
3
|
© 2025 gizmette.com
|
|
4
4
|
*/
|
|
5
5
|
try {
|
|
6
6
|
if (!window.__VERSINI_UI_DROPDOWN__) {
|
|
7
7
|
window.__VERSINI_UI_DROPDOWN__ = {
|
|
8
|
-
version: "1.2.
|
|
9
|
-
buildTime: "12/
|
|
8
|
+
version: "1.2.2",
|
|
9
|
+
buildTime: "12/24/2025 09:20 AM EST",
|
|
10
10
|
homepage: "https://www.npmjs.com/package/@versini/ui-dropdown",
|
|
11
11
|
license: "MIT",
|
|
12
12
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@versini/ui-dropdown",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.2",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"author": "Arno Versini",
|
|
6
6
|
"publishConfig": {
|
|
@@ -50,5 +50,5 @@
|
|
|
50
50
|
"sideEffects": [
|
|
51
51
|
"**/*.css"
|
|
52
52
|
],
|
|
53
|
-
"gitHead": "
|
|
53
|
+
"gitHead": "7b2640a0650a4c3aa6ca078888f765cb400f9f13"
|
|
54
54
|
}
|