@versini/ui-menu 1.0.11 → 1.1.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/components/Menu/MenuItem.js +60 -38
- package/dist/index.d.ts +9 -1
- package/dist/index.js +3 -3
- package/package.json +2 -2
|
@@ -1,42 +1,64 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { useListItem as
|
|
3
|
-
import
|
|
4
|
-
import * as
|
|
5
|
-
import { MenuContext as
|
|
6
|
-
const
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
1
|
+
import { jsx as i, jsxs as g } from "react/jsx-runtime";
|
|
2
|
+
import { useListItem as I, useFloatingTree as C, useMergeRefs as k } from "@floating-ui/react";
|
|
3
|
+
import y from "clsx";
|
|
4
|
+
import * as a from "react";
|
|
5
|
+
import { MenuContext as M } from "./MenuContext.js";
|
|
6
|
+
const v = a.forwardRef(
|
|
7
|
+
({
|
|
8
|
+
label: o,
|
|
9
|
+
disabled: m,
|
|
10
|
+
icon: s,
|
|
11
|
+
raw: d = !1,
|
|
12
|
+
children: c,
|
|
13
|
+
ignoreClick: l = !1,
|
|
14
|
+
...e
|
|
15
|
+
}, f) => {
|
|
16
|
+
const u = a.useContext(M), b = I({ label: m ? null : o }), n = C(), x = k([b.ref, f]);
|
|
17
|
+
return d && c ? /* @__PURE__ */ i(
|
|
18
|
+
"div",
|
|
19
|
+
{
|
|
20
|
+
role: "menuitem",
|
|
21
|
+
...u.getItemProps({
|
|
22
|
+
onClick(r) {
|
|
23
|
+
var t;
|
|
24
|
+
l || ((t = e.onClick) == null || t.call(e, r), n == null || n.events.emit("click"));
|
|
25
|
+
}
|
|
26
|
+
}),
|
|
27
|
+
children: c
|
|
28
|
+
}
|
|
29
|
+
) : /* @__PURE__ */ g(
|
|
30
|
+
"button",
|
|
31
|
+
{
|
|
32
|
+
...e,
|
|
33
|
+
ref: x,
|
|
34
|
+
role: "menuitem",
|
|
35
|
+
className: "m-0 flex w-full rounded-md border border-transparent bg-none px-3 py-2 text-left text-base outline-none focus:border focus:border-border-medium focus:bg-surface-lighter focus:underline disabled:cursor-not-allowed disabled:text-copy-medium sm:py-1",
|
|
36
|
+
tabIndex: 0,
|
|
37
|
+
disabled: m,
|
|
38
|
+
...u.getItemProps({
|
|
39
|
+
onClick(r) {
|
|
40
|
+
var t;
|
|
41
|
+
l || ((t = e.onClick) == null || t.call(e, r), n == null || n.events.emit("click"));
|
|
42
|
+
},
|
|
43
|
+
onFocus(r) {
|
|
44
|
+
var t;
|
|
45
|
+
(t = e.onFocus) == null || t.call(e, r), u.setHasFocusInside(!0);
|
|
46
|
+
}
|
|
47
|
+
}),
|
|
48
|
+
children: [
|
|
49
|
+
s,
|
|
50
|
+
o && /* @__PURE__ */ i("span", { className: "pl-2", children: o })
|
|
51
|
+
]
|
|
52
|
+
}
|
|
53
|
+
);
|
|
54
|
+
}
|
|
55
|
+
);
|
|
56
|
+
v.displayName = "MenuItem";
|
|
57
|
+
const h = ({ className: o, ...m }) => {
|
|
58
|
+
const s = y(o, "my-1 border-t border-border-medium");
|
|
59
|
+
return /* @__PURE__ */ i("div", { className: s, ...m });
|
|
38
60
|
};
|
|
39
61
|
export {
|
|
40
|
-
|
|
62
|
+
v as MenuItem,
|
|
41
63
|
h as MenuSeparator
|
|
42
64
|
};
|
package/dist/index.d.ts
CHANGED
|
@@ -9,7 +9,7 @@ type MenuItemProps = {
|
|
|
9
9
|
/**
|
|
10
10
|
* The label to use for the menu item.
|
|
11
11
|
*/
|
|
12
|
-
label
|
|
12
|
+
label?: string;
|
|
13
13
|
/**
|
|
14
14
|
* Whether or not the menu item is disabled.
|
|
15
15
|
* @default false
|
|
@@ -19,6 +19,14 @@ type MenuItemProps = {
|
|
|
19
19
|
* A React component of type Icon to be placed on the left of the label.
|
|
20
20
|
*/
|
|
21
21
|
icon?: React__default.ReactNode;
|
|
22
|
+
/**
|
|
23
|
+
* Disable internal menu item behavior (click, focus, etc.).
|
|
24
|
+
*/
|
|
25
|
+
raw?: boolean;
|
|
26
|
+
/**
|
|
27
|
+
* Whether or not the menu should close when the menu item is selected.
|
|
28
|
+
*/
|
|
29
|
+
ignoreClick?: boolean;
|
|
22
30
|
};
|
|
23
31
|
|
|
24
32
|
type MenuSeparatorProps = React__default.HTMLAttributes<HTMLDivElement>;
|
package/dist/index.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { Menu as r, MenuComponent as _ } from "./components/Menu/Menu.js";
|
|
2
2
|
import { MenuItem as t, MenuSeparator as m } from "./components/Menu/MenuItem.js";
|
|
3
3
|
/*!
|
|
4
|
-
@versini/ui-menu v1.0
|
|
4
|
+
@versini/ui-menu v1.1.0
|
|
5
5
|
© 2024 gizmette.com
|
|
6
6
|
*/
|
|
7
7
|
try {
|
|
8
8
|
window.__VERSINI_UI_MENU__ || (window.__VERSINI_UI_MENU__ = {
|
|
9
|
-
version: "1.0
|
|
10
|
-
buildTime: "
|
|
9
|
+
version: "1.1.0",
|
|
10
|
+
buildTime: "10/05/2024 01:10 PM EDT",
|
|
11
11
|
homepage: "https://github.com/aversini/ui-components",
|
|
12
12
|
license: "MIT"
|
|
13
13
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@versini/ui-menu",
|
|
3
|
-
"version": "1.0
|
|
3
|
+
"version": "1.1.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"author": "Arno Versini",
|
|
6
6
|
"publishConfig": {
|
|
@@ -46,5 +46,5 @@
|
|
|
46
46
|
"sideEffects": [
|
|
47
47
|
"**/*.css"
|
|
48
48
|
],
|
|
49
|
-
"gitHead": "
|
|
49
|
+
"gitHead": "e41e7e6d7c82572ae7187eda386f4f03d55bb086"
|
|
50
50
|
}
|