linkedunion-design-kit 1.11.12 → 1.11.13
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/src/components/Dropdown/DropdownMenu/DropdownMenu.js +3 -3
- package/dist/src/components/Dropdown/DropdownMenu/DropdownMenu.stories.js +25 -4
- package/dist/src/components/Dropdown/DropdownMenu/index.d.ts +5 -0
- package/dist/src/components/Dropdown/DropdownMenu/index.js +5 -0
- package/package.json +1 -1
|
@@ -25,7 +25,7 @@ import * as React from "react";
|
|
|
25
25
|
import * as DropdownMenuPrimitive from "@radix-ui/react-dropdown-menu";
|
|
26
26
|
import { ChevronRight, Circle } from "lucide-react";
|
|
27
27
|
import { cn } from "../../../lib/utils";
|
|
28
|
-
import { checkBoxSize, dropdownMenuIconSize, dropDownMenuItemSize, dropdownMenuSize, } from ".";
|
|
28
|
+
import { checkBoxSize, dropdownMenuIconSize, dropDownMenuItemSize, dropdownMenuSize, dropDownSubMenuItemSize, } from ".";
|
|
29
29
|
import { Checkbox } from "../../../components/Checkbox/checkbox";
|
|
30
30
|
import { Reset_BS } from "../../../utils/constants";
|
|
31
31
|
// Provide size from Content to all items
|
|
@@ -38,7 +38,7 @@ var DropdownMenuSub = DropdownMenuPrimitive.Sub;
|
|
|
38
38
|
var DropdownMenuRadioGroup = DropdownMenuPrimitive.RadioGroup;
|
|
39
39
|
var DropdownMenuSubTrigger = React.forwardRef(function (_a, ref) {
|
|
40
40
|
var className = _a.className, inset = _a.inset, children = _a.children, props = __rest(_a, ["className", "inset", "children"]);
|
|
41
|
-
return (_jsxs(DropdownMenuPrimitive.SubTrigger, __assign({ ref: ref, className: cn("flex cursor-default select-none items-center gap-2 rounded-sm !p-2 outline-none
|
|
41
|
+
return (_jsxs(DropdownMenuPrimitive.SubTrigger, __assign({ ref: ref, className: cn("flex cursor-default select-none items-center gap-2 rounded-sm !p-2 outline-none [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0", inset && "pl-8", className) }, props, { children: [children, _jsx(ChevronRight, { className: "ml-auto" })] })));
|
|
42
42
|
});
|
|
43
43
|
DropdownMenuSubTrigger.displayName =
|
|
44
44
|
DropdownMenuPrimitive.SubTrigger.displayName;
|
|
@@ -47,7 +47,7 @@ var DropdownMenuSubContent = React.forwardRef(function (_a, ref) {
|
|
|
47
47
|
var className = _a.className, size = _a.size, props = __rest(_a, ["className", "size"]);
|
|
48
48
|
var inheritedSize = React.useContext(DropdownMenuSizeContext);
|
|
49
49
|
var effectiveSize = (_b = size !== null && size !== void 0 ? size : inheritedSize) !== null && _b !== void 0 ? _b : "md";
|
|
50
|
-
return (_jsx(DropdownMenuPrimitive.SubContent, __assign({ ref: ref, className: cn("z-50 min-w-[8rem] overflow-hidden rounded-sm bg-white text-gray-900 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-[--radix-dropdown-menu-content-transform-origin]", className,
|
|
50
|
+
return (_jsx(DropdownMenuPrimitive.SubContent, __assign({ ref: ref, className: cn("z-50 h-auto min-w-[8rem] overflow-hidden shadow-backdrop-shadow-lg rounded-sm bg-white text-gray-900 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-[--radix-dropdown-menu-content-transform-origin]", className, dropDownSubMenuItemSize[effectiveSize]) }, props)));
|
|
51
51
|
});
|
|
52
52
|
DropdownMenuSubContent.displayName =
|
|
53
53
|
DropdownMenuPrimitive.SubContent.displayName;
|
|
@@ -268,15 +268,32 @@ export var MasterDropdownMenu = function () {
|
|
|
268
268
|
var menuItems = [
|
|
269
269
|
{ type: "item", label: "Text Label 1" },
|
|
270
270
|
{ type: "item", label: "Text Label 2" },
|
|
271
|
-
{
|
|
272
|
-
|
|
271
|
+
{
|
|
272
|
+
type: "submenu",
|
|
273
|
+
label: "Text Label 3",
|
|
274
|
+
subItems: [
|
|
275
|
+
"Submenu Item 1",
|
|
276
|
+
"Submenu Item 2",
|
|
277
|
+
"Submenu Item 3",
|
|
278
|
+
"Submenu Item 4",
|
|
279
|
+
],
|
|
280
|
+
},
|
|
281
|
+
{
|
|
282
|
+
type: "submenu",
|
|
283
|
+
label: "Text Label 4",
|
|
284
|
+
subItems: ["Submenu Item 1", "Submenu Item 2", "Submenu Item 3"],
|
|
285
|
+
},
|
|
273
286
|
{ type: "item", label: "Text Label 5" },
|
|
274
287
|
{ type: "badge", label: "Text Label 6", badge: "09" },
|
|
275
288
|
{ type: "avatar", label: "Text Label 7" },
|
|
276
289
|
{ type: "item", label: "Text Label 8" },
|
|
277
290
|
// Second column starts after 8 items
|
|
278
291
|
{ type: "item", label: "Text Label 9" },
|
|
279
|
-
{
|
|
292
|
+
{
|
|
293
|
+
type: "submenu",
|
|
294
|
+
label: "Text Label 10",
|
|
295
|
+
subItems: ["Submenu Item 1", "Submenu Item 2", "Submenu Item 3"],
|
|
296
|
+
},
|
|
280
297
|
{ type: "item", label: "Text Label 11" },
|
|
281
298
|
{ type: "badge", label: "Text Label 12", badge: "09" },
|
|
282
299
|
{ type: "avatar", label: "Text Label 13" },
|
|
@@ -294,5 +311,9 @@ export var MasterDropdownMenu = function () {
|
|
|
294
311
|
return (_jsx(DropdownMenuItem, { onSelect: function () { return alert("".concat(item.label, " selected")); }, children: item.label }, index));
|
|
295
312
|
}
|
|
296
313
|
};
|
|
297
|
-
return (_jsxs(DropdownMenu, { children: [_jsx(DropdownMenuTrigger, { asChild: true, children: _jsx(Button, { shape: "rounded-full", children: "Text Label" }) }), _jsx(DropdownMenuContent, { className: "w-auto", size: "lg", children: _jsxs("div", { className: "grid gap-0 ".concat(menuItems.length > 8 ?
|
|
314
|
+
return (_jsxs(DropdownMenu, { children: [_jsx(DropdownMenuTrigger, { asChild: true, children: _jsx(Button, { shape: "rounded-full", children: "Text Label" }) }), _jsx(DropdownMenuContent, { className: "w-auto", size: "lg", children: _jsxs("div", { className: "grid gap-0 ".concat(menuItems.length > 8 ? "grid-cols-1 md:grid-cols-2" : "grid-cols-1"), children: [_jsxs("div", { className: "flex flex-col", children: [_jsx(DropdownMenuLabel, { className: "mb-1", children: "Group Heading" }), menuItems
|
|
315
|
+
.slice(0, 8)
|
|
316
|
+
.map(function (item, index) { return renderMenuItem(item, index); })] }), menuItems.length > 8 && (_jsxs("div", { className: "flex flex-col md:pl-2", children: [_jsx(DropdownMenuLabel, { className: "mb-1", children: "Group Heading" }), menuItems
|
|
317
|
+
.slice(8)
|
|
318
|
+
.map(function (item, index) { return renderMenuItem(item, index + 8); })] }))] }) })] }));
|
|
298
319
|
};
|
|
@@ -8,6 +8,11 @@ export declare const dropDownMenuItemSize: {
|
|
|
8
8
|
md: string;
|
|
9
9
|
lg: string;
|
|
10
10
|
};
|
|
11
|
+
export declare const dropDownSubMenuItemSize: {
|
|
12
|
+
sm: string;
|
|
13
|
+
md: string;
|
|
14
|
+
lg: string;
|
|
15
|
+
};
|
|
11
16
|
export declare const dropdownMenuIconSize: {
|
|
12
17
|
sm: string;
|
|
13
18
|
md: string;
|
|
@@ -8,6 +8,11 @@ export var dropDownMenuItemSize = {
|
|
|
8
8
|
md: "h-10 !py-3 !px-4",
|
|
9
9
|
lg: "h-12 !py-3 !px-4",
|
|
10
10
|
};
|
|
11
|
+
export var dropDownSubMenuItemSize = {
|
|
12
|
+
sm: "!p-3",
|
|
13
|
+
md: "!py-3 !px-4",
|
|
14
|
+
lg: "!py-3 !px-4",
|
|
15
|
+
};
|
|
11
16
|
// Map dropdown menu size to icon size
|
|
12
17
|
export var dropdownMenuIconSize = {
|
|
13
18
|
sm: "sm",
|