linkedunion-design-kit 1.10.6-beta.2 → 1.10.7-beta.1
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 +5 -0
- package/dist/index.js +5 -0
- package/dist/src/components/Alerts/Alert/alert.js +1 -0
- package/dist/src/components/Button/Button/Button.d.ts +2 -1
- package/dist/src/components/Button/Button/Button.js +18 -6
- package/dist/src/components/Button/Button/Button.stories.d.ts +4 -2
- package/dist/src/components/Button/index.d.ts +1 -0
- package/dist/src/components/Button/index.js +3 -3
- package/dist/src/components/Dropdown/DropdownMenu/DropdownMenu.d.ts +6 -2
- package/dist/src/components/Dropdown/DropdownMenu/DropdownMenu.js +7 -6
- package/dist/src/components/Dropdown/DropdownMenu/DropdownMenu.stories.d.ts +8 -1
- package/dist/src/components/Dropdown/DropdownMenu/DropdownMenu.stories.js +48 -3
- package/dist/src/components/Dropdown/DropdownMenu/index.d.ts +5 -0
- package/dist/src/components/Dropdown/DropdownMenu/index.js +5 -0
- package/dist/src/components/Dropdown/select.js +1 -1
- package/dist/src/components/MenuBar/menubar.d.ts +26 -0
- package/dist/src/components/MenuBar/menubar.js +92 -0
- package/dist/src/components/MenuBar/menubar.stories.d.ts +14 -0
- package/dist/src/components/MenuBar/menubar.stories.js +59 -0
- package/dist/src/components/NavigationMenu/index.d.ts +1 -0
- package/dist/src/components/NavigationMenu/index.js +1 -0
- package/dist/src/components/NavigationMenu/navigation-menu.d.ts +14 -0
- package/dist/src/components/NavigationMenu/navigation-menu.js +62 -0
- package/dist/src/components/NavigationMenu/navigation-menu.stories.d.ts +29 -0
- package/dist/src/components/NavigationMenu/navigation-menu.stories.js +91 -0
- package/dist/src/components/Separator/Separator.stories.d.ts +15 -0
- package/dist/src/components/Separator/Separator.stories.js +79 -0
- package/dist/src/components/Separator/index.d.ts +1 -0
- package/dist/src/components/Separator/index.js +1 -0
- package/dist/src/components/Separator/separator.d.ts +4 -0
- package/dist/src/components/Separator/separator.js +32 -0
- package/dist/src/components/Sheet/index.d.ts +1 -0
- package/dist/src/components/Sheet/index.js +1 -0
- package/dist/src/components/Sheet/sheet.d.ts +25 -0
- package/dist/src/components/Sheet/sheet.js +76 -0
- package/dist/src/components/Sheet/sheet.stories.d.ts +7 -0
- package/dist/src/components/Sheet/sheet.stories.js +21 -0
- package/dist/styles/global.css +524 -0
- package/package.json +4 -1
package/dist/index.d.ts
CHANGED
|
@@ -34,3 +34,8 @@ export { Tabs as VerticalTabs, TabsContent as VerticalTabsContent, TabsList as V
|
|
|
34
34
|
export { Dialog, DialogTrigger, DialogContent, DialogHeader, DialogTitle, DialogDescription, DialogFooter, DialogClose, sizes, } from "./src/components/Modal/Modal";
|
|
35
35
|
export { DatePicker } from "./src/components/DatePicker/DatePicker";
|
|
36
36
|
export { TimePicker } from "./src/components/TimePicker/TimePicker";
|
|
37
|
+
export * from "./src/components/NavigationMenu";
|
|
38
|
+
export * from "./src/components/Sheet";
|
|
39
|
+
export * from "./src/components/Separator";
|
|
40
|
+
export * from "./src/components/MenuBar/menubar";
|
|
41
|
+
export * from "./src/components/Alerts/Alert/alert";
|
package/dist/index.js
CHANGED
|
@@ -34,3 +34,8 @@ export { Tabs as VerticalTabs, TabsContent as VerticalTabsContent, TabsList as V
|
|
|
34
34
|
export { Dialog, DialogTrigger, DialogContent, DialogHeader, DialogTitle, DialogDescription, DialogFooter, DialogClose, sizes, } from "./src/components/Modal/Modal";
|
|
35
35
|
export { DatePicker } from "./src/components/DatePicker/DatePicker";
|
|
36
36
|
export { TimePicker } from "./src/components/TimePicker/TimePicker";
|
|
37
|
+
export * from "./src/components/NavigationMenu";
|
|
38
|
+
export * from "./src/components/Sheet";
|
|
39
|
+
export * from "./src/components/Separator";
|
|
40
|
+
export * from "./src/components/MenuBar/menubar";
|
|
41
|
+
export * from "./src/components/Alerts/Alert/alert";
|
|
@@ -15,7 +15,8 @@ export declare const variant: {
|
|
|
15
15
|
};
|
|
16
16
|
declare const buttonVariants: (props?: ({
|
|
17
17
|
color?: "blue" | "light-blue" | "green" | "light-green" | "yellow" | "light-yellow" | "red" | "light-red" | "indigo" | "light-indigo" | "gray" | "light-gray" | "disabled" | null | undefined;
|
|
18
|
-
size?: "sm" | "md" | "lg" | "xl" | null | undefined;
|
|
18
|
+
size?: "sm" | "md" | "lg" | "xl" | "none" | null | undefined;
|
|
19
|
+
linkSize?: "sm" | "md" | "lg" | "none" | null | undefined;
|
|
19
20
|
shape?: "rounded-sm" | "rounded-full" | "rounded-none" | null | undefined;
|
|
20
21
|
variant?: "link" | "fill" | "outline" | "ghost" | null | undefined;
|
|
21
22
|
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
@@ -37,30 +37,39 @@ import LUIcon from "../../Icons/LUIcon";
|
|
|
37
37
|
import { buttonStyles } from "..";
|
|
38
38
|
export var variant = {
|
|
39
39
|
fill: "",
|
|
40
|
-
link: "lu-bg-transparent hover:lu-bg-transparent focus:lu-bg-transparent active:lu-bg-transparent !p-0 underline-offset-4 hover:underline border-none",
|
|
40
|
+
link: "lu-bg-transparent hover:lu-bg-transparent focus:lu-bg-transparent active:lu-bg-transparent !p-0 underline-offset-4 hover:underline border-none font-normal leading-normal",
|
|
41
41
|
outline: "border lu-bg-transparent",
|
|
42
42
|
ghost: "lu-bg-transparent border-none",
|
|
43
43
|
};
|
|
44
|
-
var buttonVariants = cva("inline-flex items-center justify-center gap-2 whitespace-nowrap
|
|
44
|
+
var buttonVariants = cva("inline-flex items-center justify-center gap-2 whitespace-nowrap font-medium transition-all disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none shrink-0 [&_svg]:shrink-0 outline-none aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive cursor-pointer", {
|
|
45
45
|
variants: {
|
|
46
46
|
color: buttonStyles.fillColor,
|
|
47
|
-
size: buttonStyles.size,
|
|
47
|
+
size: __assign(__assign({}, buttonStyles.size), { none: "" }),
|
|
48
|
+
linkSize: __assign(__assign({}, buttonStyles.linkSize), { none: "" }),
|
|
48
49
|
shape: buttonStyles.shape,
|
|
49
50
|
variant: variant,
|
|
50
51
|
},
|
|
51
52
|
defaultVariants: {
|
|
52
53
|
color: "blue",
|
|
53
54
|
size: "md",
|
|
55
|
+
linkSize: "none",
|
|
54
56
|
shape: "rounded-sm",
|
|
55
57
|
variant: "fill",
|
|
56
58
|
},
|
|
57
|
-
compoundVariants: __spreadArray(__spreadArray(__spreadArray([], Object.entries(buttonStyles.linkColor).map(function (_a) {
|
|
59
|
+
compoundVariants: __spreadArray(__spreadArray(__spreadArray(__spreadArray([], Object.entries(buttonStyles.linkColor).map(function (_a) {
|
|
58
60
|
var color = _a[0], className = _a[1];
|
|
59
61
|
return ({
|
|
60
62
|
color: color,
|
|
61
63
|
variant: "link",
|
|
62
64
|
class: className,
|
|
63
65
|
});
|
|
66
|
+
}), true), Object.entries(buttonStyles.linkSize).map(function (_a) {
|
|
67
|
+
var sizeKey = _a[0], className = _a[1];
|
|
68
|
+
return ({
|
|
69
|
+
linkSize: sizeKey,
|
|
70
|
+
variant: "link",
|
|
71
|
+
class: className,
|
|
72
|
+
});
|
|
64
73
|
}), true), Object.entries(buttonStyles.outlineColor).map(function (_a) {
|
|
65
74
|
var color = _a[0], className = _a[1];
|
|
66
75
|
return ({
|
|
@@ -78,7 +87,7 @@ var buttonVariants = cva("inline-flex items-center justify-center gap-2 whitespa
|
|
|
78
87
|
}), true),
|
|
79
88
|
});
|
|
80
89
|
function Button(_a) {
|
|
81
|
-
var className = _a.className, _b = _a.color, color = _b === void 0 ? "blue" : _b,
|
|
90
|
+
var className = _a.className, _b = _a.color, color = _b === void 0 ? "blue" : _b, _c = _a.size, size = _c === void 0 ? "md" : _c, shape = _a.shape, _d = _a.variant, variant = _d === void 0 ? "fill" : _d, _e = _a.asChild, asChild = _e === void 0 ? false : _e, startIcon = _a.startIcon, endIcon = _a.endIcon, props = __rest(_a, ["className", "color", "size", "shape", "variant", "asChild", "startIcon", "endIcon"]);
|
|
82
91
|
var Comp = asChild ? Slot : "button";
|
|
83
92
|
// Map button size to appropriate icon sizes for start and end icons
|
|
84
93
|
var getIconSizes = function () {
|
|
@@ -98,6 +107,9 @@ function Button(_a) {
|
|
|
98
107
|
// Use the calculated sizes based on button size
|
|
99
108
|
var startIconSizeValue = iconSizes.startIcon;
|
|
100
109
|
var endIconSizeValue = iconSizes.endIcon;
|
|
101
|
-
|
|
110
|
+
var sizeProps = variant === "link"
|
|
111
|
+
? { linkSize: (size === "xl" ? "lg" : size), size: "none" }
|
|
112
|
+
: { size: size, linkSize: "none" };
|
|
113
|
+
return (_jsxs(Comp, __assign({ "data-slot": "button", "data-size": size, "data-variant": variant, "data-color": color, className: cn(buttonVariants(__assign(__assign({ variant: variant, color: color }, sizeProps), { shape: shape })), className) }, props, { children: [startIcon && (_jsx(LUIcon, { size: startIconSizeValue, "data-testid": "start-icon", icon: startIcon })), props.children, endIcon && (_jsx(LUIcon, { size: endIconSizeValue, "data-testid": "end-icon", icon: endIcon }))] })));
|
|
102
114
|
}
|
|
103
115
|
export { Button, buttonVariants };
|
|
@@ -391,9 +391,10 @@ declare const meta: {
|
|
|
391
391
|
onTransitionRunCapture?: import("react").TransitionEventHandler<HTMLButtonElement> | undefined;
|
|
392
392
|
onTransitionStart?: import("react").TransitionEventHandler<HTMLButtonElement> | undefined;
|
|
393
393
|
onTransitionStartCapture?: import("react").TransitionEventHandler<HTMLButtonElement> | undefined;
|
|
394
|
-
size?: "sm" | "md" | "lg" | "xl" | null | undefined;
|
|
394
|
+
size?: "sm" | "md" | "lg" | "xl" | "none" | null | undefined;
|
|
395
395
|
variant?: "fill" | "link" | "outline" | "ghost" | undefined;
|
|
396
396
|
shape?: "rounded-sm" | "rounded-full" | "rounded-none" | null | undefined;
|
|
397
|
+
linkSize?: "sm" | "md" | "lg" | "none" | null | undefined;
|
|
397
398
|
asChild?: boolean | undefined;
|
|
398
399
|
startIcon?: keyof typeof import("../../../utils/iconList").iconList | undefined;
|
|
399
400
|
endIcon?: keyof typeof import("../../../utils/iconList").iconList | undefined;
|
|
@@ -691,9 +692,10 @@ declare const meta: {
|
|
|
691
692
|
onTransitionRunCapture?: import("react").TransitionEventHandler<HTMLButtonElement> | undefined;
|
|
692
693
|
onTransitionStart?: import("react").TransitionEventHandler<HTMLButtonElement> | undefined;
|
|
693
694
|
onTransitionStartCapture?: import("react").TransitionEventHandler<HTMLButtonElement> | undefined;
|
|
694
|
-
size?: "sm" | "md" | "lg" | "xl" | null | undefined;
|
|
695
|
+
size?: "sm" | "md" | "lg" | "xl" | "none" | null | undefined;
|
|
695
696
|
variant?: "fill" | "link" | "outline" | "ghost" | undefined;
|
|
696
697
|
shape?: "rounded-sm" | "rounded-full" | "rounded-none" | null | undefined;
|
|
698
|
+
linkSize?: "sm" | "md" | "lg" | "none" | null | undefined;
|
|
697
699
|
asChild?: boolean | undefined;
|
|
698
700
|
startIcon?: keyof typeof import("../../../utils/iconList").iconList | undefined;
|
|
699
701
|
endIcon?: keyof typeof import("../../../utils/iconList").iconList | undefined;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
// Button style types
|
|
2
1
|
import styles from "./Button/Button.module.css";
|
|
3
2
|
export var buttonStyles = {
|
|
4
3
|
fillColor: {
|
|
@@ -43,8 +42,9 @@ export var buttonStyles = {
|
|
|
43
42
|
disabled: "text-gray-300 hover:no-underline",
|
|
44
43
|
},
|
|
45
44
|
linkSize: {
|
|
46
|
-
lg: "!text-
|
|
47
|
-
md: "!text-
|
|
45
|
+
lg: "!text-lg",
|
|
46
|
+
md: "!text-base",
|
|
47
|
+
sm: "!text-sm",
|
|
48
48
|
},
|
|
49
49
|
outlineColor: {
|
|
50
50
|
blue: "text-blue-600 hover:bg-blue-700 hover:text-blue-50 active:bg-blue-800 active:text-blue-50",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import * as DropdownMenuPrimitive from "@radix-ui/react-dropdown-menu";
|
|
3
|
-
import { checkBoxSize, dropdownMenuSize } from ".";
|
|
3
|
+
import { checkBoxSize, dropdownContentPosition, dropdownMenuSize } from ".";
|
|
4
4
|
declare const DropdownMenu: React.FC<DropdownMenuPrimitive.DropdownMenuProps>;
|
|
5
5
|
declare const DropdownMenuTrigger: React.ForwardRefExoticComponent<DropdownMenuPrimitive.DropdownMenuTriggerProps & React.RefAttributes<HTMLButtonElement>>;
|
|
6
6
|
declare const DropdownMenuGroup: React.ForwardRefExoticComponent<DropdownMenuPrimitive.DropdownMenuGroupProps & React.RefAttributes<HTMLDivElement>>;
|
|
@@ -13,9 +13,13 @@ declare const DropdownMenuSubTrigger: React.ForwardRefExoticComponent<Omit<Dropd
|
|
|
13
13
|
declare const DropdownMenuSubContent: React.ForwardRefExoticComponent<Omit<DropdownMenuPrimitive.DropdownMenuSubContentProps & React.RefAttributes<HTMLDivElement>, "ref"> & {
|
|
14
14
|
size?: keyof typeof dropdownMenuSize;
|
|
15
15
|
} & React.RefAttributes<HTMLDivElement>>;
|
|
16
|
+
export type DropdownMenuContentProps = React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Content> & {
|
|
17
|
+
size?: keyof typeof dropdownMenuSize;
|
|
18
|
+
align?: keyof typeof dropdownContentPosition;
|
|
19
|
+
};
|
|
16
20
|
declare const DropdownMenuContent: React.ForwardRefExoticComponent<Omit<DropdownMenuPrimitive.DropdownMenuContentProps & React.RefAttributes<HTMLDivElement>, "ref"> & {
|
|
17
21
|
size?: keyof typeof dropdownMenuSize;
|
|
18
|
-
align?:
|
|
22
|
+
align?: keyof typeof dropdownContentPosition;
|
|
19
23
|
} & React.RefAttributes<HTMLDivElement>>;
|
|
20
24
|
declare const DropdownMenuItem: React.ForwardRefExoticComponent<Omit<DropdownMenuPrimitive.DropdownMenuItemProps & React.RefAttributes<HTMLDivElement>, "ref"> & {
|
|
21
25
|
inset?: boolean;
|
|
@@ -27,6 +27,7 @@ import { ChevronRight, Circle } from "lucide-react";
|
|
|
27
27
|
import { cn } from "../../../lib/utils";
|
|
28
28
|
import { checkBoxSize, dropdownMenuIconSize, dropDownMenuItemSize, dropdownMenuSize, } from ".";
|
|
29
29
|
import { Checkbox } from "../../../components/Checkbox/checkbox";
|
|
30
|
+
import { Reset_BS } from "../../../utils/constants";
|
|
30
31
|
// Provide size from Content to all items
|
|
31
32
|
var DropdownMenuSizeContext = React.createContext("md");
|
|
32
33
|
var DropdownMenu = DropdownMenuPrimitive.Root;
|
|
@@ -37,7 +38,7 @@ var DropdownMenuSub = DropdownMenuPrimitive.Sub;
|
|
|
37
38
|
var DropdownMenuRadioGroup = DropdownMenuPrimitive.RadioGroup;
|
|
38
39
|
var DropdownMenuSubTrigger = React.forwardRef(function (_a, ref) {
|
|
39
40
|
var className = _a.className, inset = _a.inset, children = _a.children, props = __rest(_a, ["className", "inset", "children"]);
|
|
40
|
-
return (_jsxs(DropdownMenuPrimitive.SubTrigger, __assign({ ref: ref, className: cn("flex cursor-default select-none items-center gap-2 rounded-sm p-2 outline-none focus:bg-accent data-[state=open]:bg-accent [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0", inset && "pl-8", className) }, props, { children: [children, _jsx(ChevronRight, { className: "ml-auto" })] })));
|
|
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 focus:bg-accent data-[state=open]:bg-accent [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0", inset && "pl-8", className) }, props, { children: [children, _jsx(ChevronRight, { className: "ml-auto" })] })));
|
|
41
42
|
});
|
|
42
43
|
DropdownMenuSubTrigger.displayName =
|
|
43
44
|
DropdownMenuPrimitive.SubTrigger.displayName;
|
|
@@ -52,7 +53,7 @@ DropdownMenuSubContent.displayName =
|
|
|
52
53
|
DropdownMenuPrimitive.SubContent.displayName;
|
|
53
54
|
var DropdownMenuContent = React.forwardRef(function (_a, ref) {
|
|
54
55
|
var className = _a.className, _b = _a.sideOffset, sideOffset = _b === void 0 ? 4 : _b, _c = _a.size, size = _c === void 0 ? "md" : _c, _d = _a.align, align = _d === void 0 ? "start" : _d, props = __rest(_a, ["className", "sideOffset", "size", "align"]);
|
|
55
|
-
return (_jsx(DropdownMenuPrimitive.Portal, { children: _jsx(DropdownMenuSizeContext.Provider, { value: size, children: _jsx(DropdownMenuPrimitive.Content, __assign({ ref: ref, sideOffset: sideOffset, align: align, className: cn("z-50 max-h-[var(--radix-dropdown-menu-content-available-height)] min-w-[8rem] overflow-y-auto overflow-x-hidden rounded-sm bg-white p-2 text-gray-900 shadow-backdrop-shadow-lg", "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]", dropdownMenuSize[size], className) }, props)) }) }));
|
|
56
|
+
return (_jsx(DropdownMenuPrimitive.Portal, { children: _jsx(DropdownMenuSizeContext.Provider, { value: size, children: _jsx(DropdownMenuPrimitive.Content, __assign({ "data-reset": Reset_BS, ref: ref, sideOffset: sideOffset, align: align, className: cn("z-50 max-h-[var(--radix-dropdown-menu-content-available-height)] min-w-[8rem] overflow-y-auto overflow-x-hidden rounded-sm bg-white !p-2 text-gray-900 shadow-backdrop-shadow-lg", "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]", dropdownMenuSize[size], className) }, props)) }) }));
|
|
56
57
|
});
|
|
57
58
|
DropdownMenuContent.displayName = DropdownMenuPrimitive.Content.displayName;
|
|
58
59
|
var DropdownMenuItem = React.forwardRef(function (_a, ref) {
|
|
@@ -60,7 +61,7 @@ var DropdownMenuItem = React.forwardRef(function (_a, ref) {
|
|
|
60
61
|
var className = _a.className, inset = _a.inset, selected = _a.selected, size = _a.size, props = __rest(_a, ["className", "inset", "selected", "size"]);
|
|
61
62
|
var inheritedSize = React.useContext(DropdownMenuSizeContext);
|
|
62
63
|
var effectiveSize = (_b = size !== null && size !== void 0 ? size : inheritedSize) !== null && _b !== void 0 ? _b : "md";
|
|
63
|
-
return (_jsx(DropdownMenuPrimitive.Item, __assign({ ref: ref, className: cn("relative flex cursor-pointer select-none items-center gap-2 rounded-sm outline-none transition-colors text-gray-900 hover:bg-blue-50 data-[disabled]:pointer-events-none data-[disabled]:opacity-50 data-[disabled]:bg-gray-100 data-[disabled]:text-gray-300 [&>svg]:shrink-0", dropdownMenuIconSize[effectiveSize], dropdownMenuSize[effectiveSize], dropDownMenuItemSize[effectiveSize], inset && "pl-8", selected && "bg-blue-50 text-blue-600", // Apply styles for selected item
|
|
64
|
+
return (_jsx(DropdownMenuPrimitive.Item, __assign({ ref: ref, "data-reset": Reset_BS, className: cn("relative flex cursor-pointer select-none items-center gap-2 rounded-sm outline-none transition-colors text-gray-900 hover:bg-blue-50 data-[disabled]:pointer-events-none data-[disabled]:opacity-50 data-[disabled]:bg-gray-100 data-[disabled]:text-gray-300 [&>svg]:shrink-0", dropdownMenuIconSize[effectiveSize], dropdownMenuSize[effectiveSize], dropDownMenuItemSize[effectiveSize], inset && "pl-8", selected && "bg-blue-50 text-blue-600", // Apply styles for selected item
|
|
64
65
|
className) }, props)));
|
|
65
66
|
});
|
|
66
67
|
DropdownMenuItem.displayName = DropdownMenuPrimitive.Item.displayName;
|
|
@@ -75,17 +76,17 @@ DropdownMenuCheckboxItem.displayName =
|
|
|
75
76
|
DropdownMenuPrimitive.CheckboxItem.displayName;
|
|
76
77
|
var DropdownMenuRadioItem = React.forwardRef(function (_a, ref) {
|
|
77
78
|
var className = _a.className, children = _a.children, props = __rest(_a, ["className", "children"]);
|
|
78
|
-
return (_jsxs(DropdownMenuPrimitive.RadioItem, __assign({ ref: ref, className: cn("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50", className) }, props, { children: [_jsx("span", { className: "absolute left-2 flex h-3.5 w-3.5 items-center justify-center", children: _jsx(DropdownMenuPrimitive.ItemIndicator, { children: _jsx(Circle, { className: "h-2 w-2 fill-current" }) }) }), children] })));
|
|
79
|
+
return (_jsxs(DropdownMenuPrimitive.RadioItem, __assign({ ref: ref, className: cn("relative flex cursor-default select-none items-center rounded-sm !py-1.5 pl-8 !pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50", className) }, props, { children: [_jsx("span", { className: "absolute left-2 flex h-3.5 w-3.5 items-center justify-center", children: _jsx(DropdownMenuPrimitive.ItemIndicator, { children: _jsx(Circle, { className: "h-2 w-2 fill-current" }) }) }), children] })));
|
|
79
80
|
});
|
|
80
81
|
DropdownMenuRadioItem.displayName = DropdownMenuPrimitive.RadioItem.displayName;
|
|
81
82
|
var DropdownMenuLabel = React.forwardRef(function (_a, ref) {
|
|
82
83
|
var className = _a.className, inset = _a.inset, props = __rest(_a, ["className", "inset"]);
|
|
83
|
-
return (_jsx(DropdownMenuPrimitive.Label, __assign({ ref: ref, className: cn("px-2 py-1.5 text-sm font-semibold", inset && "pl-8", className) }, props)));
|
|
84
|
+
return (_jsx(DropdownMenuPrimitive.Label, __assign({ ref: ref, className: cn("!px-2 !py-1.5 text-sm font-semibold", inset && "pl-8", className) }, props)));
|
|
84
85
|
});
|
|
85
86
|
DropdownMenuLabel.displayName = DropdownMenuPrimitive.Label.displayName;
|
|
86
87
|
var DropdownMenuSeparator = React.forwardRef(function (_a, ref) {
|
|
87
88
|
var className = _a.className, props = __rest(_a, ["className"]);
|
|
88
|
-
return (_jsx(DropdownMenuPrimitive.Separator, __assign({ ref: ref, className: cn("-mx-1 my-1 h-px bg-muted", className) }, props)));
|
|
89
|
+
return (_jsx(DropdownMenuPrimitive.Separator, __assign({ ref: ref, className: cn("-mx-1 !my-1 h-px bg-muted", className) }, props)));
|
|
89
90
|
});
|
|
90
91
|
DropdownMenuSeparator.displayName = DropdownMenuPrimitive.Separator.displayName;
|
|
91
92
|
var DropdownMenuShortcut = function (_a) {
|
|
@@ -1,8 +1,14 @@
|
|
|
1
1
|
import { Meta } from "@storybook/react";
|
|
2
2
|
import { DropdownMenu } from "./DropdownMenu";
|
|
3
|
+
import type { DropdownMenuContentProps } from "./DropdownMenu";
|
|
4
|
+
type DropdownMenuStoryArgs = DropdownMenuContentProps & {
|
|
5
|
+
size?: keyof typeof dropdownMenuSize;
|
|
6
|
+
align?: "start" | "center" | "end";
|
|
7
|
+
};
|
|
8
|
+
import { dropdownMenuSize } from ".";
|
|
3
9
|
declare const _default: Meta<typeof DropdownMenu>;
|
|
4
10
|
export default _default;
|
|
5
|
-
export declare const Default: import("@storybook/core/csf").AnnotatedStoryFn<import("@storybook/react").ReactRenderer,
|
|
11
|
+
export declare const Default: import("@storybook/core/csf").AnnotatedStoryFn<import("@storybook/react").ReactRenderer, DropdownMenuStoryArgs>;
|
|
6
12
|
export declare const Sizes: () => import("react/jsx-runtime").JSX.Element;
|
|
7
13
|
export declare const WithIcons: () => import("react/jsx-runtime").JSX.Element;
|
|
8
14
|
export declare const DisabledItems: () => import("react/jsx-runtime").JSX.Element;
|
|
@@ -23,3 +29,4 @@ export declare const DropdownMenuWithSelectAllAndSearch: () => import("react/jsx
|
|
|
23
29
|
export declare const WorkSpaceSwitcher: () => import("react/jsx-runtime").JSX.Element;
|
|
24
30
|
export declare const LanguageDropdownMenu: () => import("react/jsx-runtime").JSX.Element;
|
|
25
31
|
export declare const Alignments: () => import("react/jsx-runtime").JSX.Element;
|
|
32
|
+
export declare const MasterDropdownMenu: () => import("react/jsx-runtime").JSX.Element;
|
|
@@ -9,6 +9,17 @@ var __assign = (this && this.__assign) || function () {
|
|
|
9
9
|
};
|
|
10
10
|
return __assign.apply(this, arguments);
|
|
11
11
|
};
|
|
12
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
13
|
+
var t = {};
|
|
14
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
15
|
+
t[p] = s[p];
|
|
16
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
17
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
18
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
19
|
+
t[p[i]] = s[p[i]];
|
|
20
|
+
}
|
|
21
|
+
return t;
|
|
22
|
+
};
|
|
12
23
|
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
13
24
|
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
14
25
|
if (ar || !(i in from)) {
|
|
@@ -23,7 +34,7 @@ import { DropdownMenu, DropdownMenuTrigger, DropdownMenuContent, DropdownMenuIte
|
|
|
23
34
|
import { Button } from "../../../components/Button/Button/Button";
|
|
24
35
|
import LUIcon from "../../../components/Icons/LUIcon";
|
|
25
36
|
import { useState } from "react";
|
|
26
|
-
import { dropdownMenuSize } from ".";
|
|
37
|
+
import { dropdownContentPosition, dropdownMenuSize } from ".";
|
|
27
38
|
import { IconButton } from "../../../components/Button/IconButton/IconButton";
|
|
28
39
|
import { Checkbox } from "../../../components/Checkbox/checkbox";
|
|
29
40
|
import { Label } from "../../../components/Label/Label";
|
|
@@ -31,6 +42,7 @@ import { Caption } from "../../../components/Typography/Caption/caption";
|
|
|
31
42
|
import { Input } from "../../../components/Input";
|
|
32
43
|
import { SelectAllSection } from "./SelectAllSection";
|
|
33
44
|
import { Avatar, AvatarFallback, AvatarImage, } from "../../../components/Avatar/Avatar/Avatar";
|
|
45
|
+
import { Badge } from "../../../components/Badge/Badge";
|
|
34
46
|
export default {
|
|
35
47
|
title: "Components/Dropdown/DropdownMenu",
|
|
36
48
|
component: DropdownMenu,
|
|
@@ -55,7 +67,7 @@ export default {
|
|
|
55
67
|
},
|
|
56
68
|
align: {
|
|
57
69
|
control: { type: "select" },
|
|
58
|
-
options:
|
|
70
|
+
options: Object.keys(dropdownContentPosition),
|
|
59
71
|
description: "Alignment of the dropdown menu",
|
|
60
72
|
table: {
|
|
61
73
|
type: { summary: "string" },
|
|
@@ -70,7 +82,8 @@ var Template = function (args) {
|
|
|
70
82
|
{ label: "Option 2" },
|
|
71
83
|
{ label: "Option 3" },
|
|
72
84
|
];
|
|
73
|
-
|
|
85
|
+
var size = args.size, align = args.align, rest = __rest(args, ["size", "align"]);
|
|
86
|
+
return (_jsxs(DropdownMenu, __assign({}, rest, { children: [_jsx(DropdownMenuTrigger, { children: _jsx(Button, { children: "Open Menu" }) }), _jsx(DropdownMenuContent, { size: size, align: align, children: menuItems.map(function (item, index) { return (_jsx(DropdownMenuItem, { onSelect: function () { return alert("".concat(item.label, " selected")); }, children: item.label }, index)); }) })] })));
|
|
74
87
|
};
|
|
75
88
|
export var Default = Template.bind({});
|
|
76
89
|
export var Sizes = function () {
|
|
@@ -251,3 +264,35 @@ export var LanguageDropdownMenu = function () {
|
|
|
251
264
|
export var Alignments = function () {
|
|
252
265
|
return (_jsxs("div", { className: "flex flex-row space-x-4", children: [_jsxs(DropdownMenu, { children: [_jsx(DropdownMenuTrigger, { children: _jsx(Button, { children: "Align Start" }) }), _jsxs(DropdownMenuContent, { align: "start", children: [_jsx(DropdownMenuItem, { children: "Option 1" }), _jsx(DropdownMenuItem, { children: "Option 2" }), _jsx(DropdownMenuItem, { children: "Option 3" })] })] }), _jsxs(DropdownMenu, { children: [_jsx(DropdownMenuTrigger, { children: _jsx(Button, { children: "Align Center" }) }), _jsxs(DropdownMenuContent, { align: "center", children: [_jsx(DropdownMenuItem, { children: "Option 1" }), _jsx(DropdownMenuItem, { children: "Option 2" }), _jsx(DropdownMenuItem, { children: "Option 3" })] })] }), _jsxs(DropdownMenu, { children: [_jsx(DropdownMenuTrigger, { children: _jsx(Button, { children: "Align End" }) }), _jsxs(DropdownMenuContent, { align: "end", children: [_jsx(DropdownMenuItem, { children: "Option 1" }), _jsx(DropdownMenuItem, { children: "Option 2" }), _jsx(DropdownMenuItem, { children: "Option 3" })] })] })] }));
|
|
253
266
|
};
|
|
267
|
+
export var MasterDropdownMenu = function () {
|
|
268
|
+
var menuItems = [
|
|
269
|
+
{ type: "item", label: "Text Label 1" },
|
|
270
|
+
{ type: "item", label: "Text Label 2" },
|
|
271
|
+
{ type: "submenu", label: "Text Label 3", subItems: ["Submenu Item 1", "Submenu Item 2", "Submenu Item 3"] },
|
|
272
|
+
{ type: "submenu", label: "Text Label 4", subItems: ["Submenu Item 1", "Submenu Item 2", "Submenu Item 3"] },
|
|
273
|
+
{ type: "item", label: "Text Label 5" },
|
|
274
|
+
{ type: "badge", label: "Text Label 6", badge: "09" },
|
|
275
|
+
{ type: "avatar", label: "Text Label 7" },
|
|
276
|
+
{ type: "item", label: "Text Label 8" },
|
|
277
|
+
// Second column starts after 8 items
|
|
278
|
+
{ type: "item", label: "Text Label 9" },
|
|
279
|
+
{ type: "submenu", label: "Text Label 10", subItems: ["Submenu Item 1", "Submenu Item 2", "Submenu Item 3"] },
|
|
280
|
+
{ type: "item", label: "Text Label 11" },
|
|
281
|
+
{ type: "badge", label: "Text Label 12", badge: "09" },
|
|
282
|
+
{ type: "avatar", label: "Text Label 13" },
|
|
283
|
+
];
|
|
284
|
+
var renderMenuItem = function (item, index) {
|
|
285
|
+
var _a;
|
|
286
|
+
switch (item.type) {
|
|
287
|
+
case "submenu":
|
|
288
|
+
return (_jsxs(DropdownMenuSub, { children: [_jsx(DropdownMenuSubTrigger, { children: item.label }), _jsx(DropdownMenuSubContent, { children: (_a = item.subItems) === null || _a === void 0 ? void 0 : _a.map(function (subItem, subIndex) { return (_jsx(DropdownMenuItem, { children: subItem }, subIndex)); }) })] }, index));
|
|
289
|
+
case "badge":
|
|
290
|
+
return (_jsx(DropdownMenuItem, { onSelect: function () { return alert("".concat(item.label, " selected")); }, children: _jsxs("div", { className: "flex items-center justify-between w-full", children: [item.label, _jsx(Badge, { color: "light-blue", children: item.badge })] }) }, index));
|
|
291
|
+
case "avatar":
|
|
292
|
+
return (_jsx(DropdownMenuItem, { onSelect: function () { return alert("".concat(item.label, " selected")); }, children: _jsxs("div", { className: "flex items-center gap-2", children: [_jsxs(Avatar, { children: [_jsx(AvatarImage, { alt: "Avatar", src: "/images/avatar.png" }), _jsx(AvatarFallback, { children: "AB" })] }), item.label] }) }, index));
|
|
293
|
+
default:
|
|
294
|
+
return (_jsx(DropdownMenuItem, { onSelect: function () { return alert("".concat(item.label, " selected")); }, children: item.label }, index));
|
|
295
|
+
}
|
|
296
|
+
};
|
|
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 ? '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.slice(0, 8).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.slice(8).map(function (item, index) { return renderMenuItem(item, index + 8); })] }))] }) })] }));
|
|
298
|
+
};
|
|
@@ -68,7 +68,7 @@ function SelectLabel(_a) {
|
|
|
68
68
|
}
|
|
69
69
|
function SelectItem(_a) {
|
|
70
70
|
var className = _a.className, children = _a.children, _b = _a.size, size = _b === void 0 ? "md" : _b, props = __rest(_a, ["className", "children", "size"]);
|
|
71
|
-
return (_jsx(SelectPrimitive.Item, __assign({ "data-slot": "
|
|
71
|
+
return (_jsx(SelectPrimitive.Item, __assign({ "data-slot": "reset-bs-link", className: cn("text-gray-900 data-[disabled]:bg-gray-100 data-[disabled]:text-gray-300 [&_svg:not([class*='text-'])]:text-muted-foreground relative flex w-full cursor-default items-center gap-2 !rounded-sm py-1.5 pr-8 pl-2 outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2 data-[state=checked]:bg-gray-50 hover:bg-gray-50", itemSize[size], className) }, props, { children: _jsx(SelectPrimitive.ItemText, { children: children }) })));
|
|
72
72
|
}
|
|
73
73
|
function SelectSeparator(_a) {
|
|
74
74
|
var className = _a.className, props = __rest(_a, ["className"]);
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import * as MenubarPrimitive from "@radix-ui/react-menubar";
|
|
3
|
+
declare function Menubar({ className, ...props }: React.ComponentProps<typeof MenubarPrimitive.Root>): import("react/jsx-runtime").JSX.Element;
|
|
4
|
+
declare function MenubarMenu({ ...props }: React.ComponentProps<typeof MenubarPrimitive.Menu>): import("react/jsx-runtime").JSX.Element;
|
|
5
|
+
declare function MenubarGroup({ ...props }: React.ComponentProps<typeof MenubarPrimitive.Group>): import("react/jsx-runtime").JSX.Element;
|
|
6
|
+
declare function MenubarPortal({ ...props }: React.ComponentProps<typeof MenubarPrimitive.Portal>): import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
declare function MenubarRadioGroup({ ...props }: React.ComponentProps<typeof MenubarPrimitive.RadioGroup>): import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
declare function MenubarTrigger({ className, ...props }: React.ComponentProps<typeof MenubarPrimitive.Trigger>): import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
declare function MenubarContent({ className, align, alignOffset, sideOffset, ...props }: React.ComponentProps<typeof MenubarPrimitive.Content>): import("react/jsx-runtime").JSX.Element;
|
|
10
|
+
declare function MenubarItem({ className, inset, variant, ...props }: React.ComponentProps<typeof MenubarPrimitive.Item> & {
|
|
11
|
+
inset?: boolean;
|
|
12
|
+
variant?: "default" | "destructive";
|
|
13
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
14
|
+
declare function MenubarCheckboxItem({ className, children, checked, ...props }: React.ComponentProps<typeof MenubarPrimitive.CheckboxItem>): import("react/jsx-runtime").JSX.Element;
|
|
15
|
+
declare function MenubarRadioItem({ className, children, ...props }: React.ComponentProps<typeof MenubarPrimitive.RadioItem>): import("react/jsx-runtime").JSX.Element;
|
|
16
|
+
declare function MenubarLabel({ className, inset, ...props }: React.ComponentProps<typeof MenubarPrimitive.Label> & {
|
|
17
|
+
inset?: boolean;
|
|
18
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
19
|
+
declare function MenubarSeparator({ className, ...props }: React.ComponentProps<typeof MenubarPrimitive.Separator>): import("react/jsx-runtime").JSX.Element;
|
|
20
|
+
declare function MenubarShortcut({ className, ...props }: React.ComponentProps<"span">): import("react/jsx-runtime").JSX.Element;
|
|
21
|
+
declare function MenubarSub({ ...props }: React.ComponentProps<typeof MenubarPrimitive.Sub>): import("react/jsx-runtime").JSX.Element;
|
|
22
|
+
declare function MenubarSubTrigger({ className, inset, children, ...props }: React.ComponentProps<typeof MenubarPrimitive.SubTrigger> & {
|
|
23
|
+
inset?: boolean;
|
|
24
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
25
|
+
declare function MenubarSubContent({ className, ...props }: React.ComponentProps<typeof MenubarPrimitive.SubContent>): import("react/jsx-runtime").JSX.Element;
|
|
26
|
+
export { Menubar, MenubarPortal, MenubarMenu, MenubarTrigger, MenubarContent, MenubarGroup, MenubarSeparator, MenubarLabel, MenubarItem, MenubarShortcut, MenubarCheckboxItem, MenubarRadioGroup, MenubarRadioItem, MenubarSub, MenubarSubTrigger, MenubarSubContent, };
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
var __assign = (this && this.__assign) || function () {
|
|
3
|
+
__assign = Object.assign || function(t) {
|
|
4
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
+
s = arguments[i];
|
|
6
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
+
t[p] = s[p];
|
|
8
|
+
}
|
|
9
|
+
return t;
|
|
10
|
+
};
|
|
11
|
+
return __assign.apply(this, arguments);
|
|
12
|
+
};
|
|
13
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
14
|
+
var t = {};
|
|
15
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
16
|
+
t[p] = s[p];
|
|
17
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
18
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
19
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
20
|
+
t[p[i]] = s[p[i]];
|
|
21
|
+
}
|
|
22
|
+
return t;
|
|
23
|
+
};
|
|
24
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
25
|
+
import * as MenubarPrimitive from "@radix-ui/react-menubar";
|
|
26
|
+
import { CheckIcon, ChevronRightIcon, CircleIcon } from "lucide-react";
|
|
27
|
+
import { cn } from "../../lib/utils";
|
|
28
|
+
function Menubar(_a) {
|
|
29
|
+
var className = _a.className, props = __rest(_a, ["className"]);
|
|
30
|
+
return (_jsx(MenubarPrimitive.Root, __assign({ "data-slot": "menubar", className: cn("bg-background flex h-9 items-center gap-1 rounded-md border p-1 shadow-xs", className) }, props)));
|
|
31
|
+
}
|
|
32
|
+
function MenubarMenu(_a) {
|
|
33
|
+
var props = __rest(_a, []);
|
|
34
|
+
return _jsx(MenubarPrimitive.Menu, __assign({ "data-slot": "menubar-menu" }, props));
|
|
35
|
+
}
|
|
36
|
+
function MenubarGroup(_a) {
|
|
37
|
+
var props = __rest(_a, []);
|
|
38
|
+
return _jsx(MenubarPrimitive.Group, __assign({ "data-slot": "menubar-group" }, props));
|
|
39
|
+
}
|
|
40
|
+
function MenubarPortal(_a) {
|
|
41
|
+
var props = __rest(_a, []);
|
|
42
|
+
return _jsx(MenubarPrimitive.Portal, __assign({ "data-slot": "menubar-portal" }, props));
|
|
43
|
+
}
|
|
44
|
+
function MenubarRadioGroup(_a) {
|
|
45
|
+
var props = __rest(_a, []);
|
|
46
|
+
return (_jsx(MenubarPrimitive.RadioGroup, __assign({ "data-slot": "menubar-radio-group" }, props)));
|
|
47
|
+
}
|
|
48
|
+
function MenubarTrigger(_a) {
|
|
49
|
+
var className = _a.className, props = __rest(_a, ["className"]);
|
|
50
|
+
return (_jsx(MenubarPrimitive.Trigger, __assign({ "data-slot": "menubar-trigger", className: cn("focus:bg-accent focus:text-accent-foreground data-[state=open]:bg-accent data-[state=open]:text-accent-foreground flex items-center rounded-sm px-2 py-1 text-sm font-medium outline-hidden select-none", className) }, props)));
|
|
51
|
+
}
|
|
52
|
+
function MenubarContent(_a) {
|
|
53
|
+
var className = _a.className, _b = _a.align, align = _b === void 0 ? "start" : _b, _c = _a.alignOffset, alignOffset = _c === void 0 ? -4 : _c, _d = _a.sideOffset, sideOffset = _d === void 0 ? 8 : _d, props = __rest(_a, ["className", "align", "alignOffset", "sideOffset"]);
|
|
54
|
+
return (_jsx(MenubarPortal, { children: _jsx(MenubarPrimitive.Content, __assign({ "data-slot": "menubar-content", align: align, alignOffset: alignOffset, sideOffset: sideOffset, className: cn("bg-popover text-popover-foreground data-[state=open]:animate-in 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 z-50 min-w-[12rem] origin-(--radix-menubar-content-transform-origin) overflow-hidden rounded-md border p-1 shadow-md", className) }, props)) }));
|
|
55
|
+
}
|
|
56
|
+
function MenubarItem(_a) {
|
|
57
|
+
var className = _a.className, inset = _a.inset, _b = _a.variant, variant = _b === void 0 ? "default" : _b, props = __rest(_a, ["className", "inset", "variant"]);
|
|
58
|
+
return (_jsx(MenubarPrimitive.Item, __assign({ "data-slot": "menubar-item", "data-inset": inset, "data-variant": variant, className: cn("focus:bg-accent focus:text-accent-foreground data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 dark:data-[variant=destructive]:focus:bg-destructive/20 data-[variant=destructive]:focus:text-destructive data-[variant=destructive]:*:[svg]:!text-destructive [&_svg:not([class*='text-'])]:text-muted-foreground relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 data-[inset]:pl-8 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4", className) }, props)));
|
|
59
|
+
}
|
|
60
|
+
function MenubarCheckboxItem(_a) {
|
|
61
|
+
var className = _a.className, children = _a.children, checked = _a.checked, props = __rest(_a, ["className", "children", "checked"]);
|
|
62
|
+
return (_jsxs(MenubarPrimitive.CheckboxItem, __assign({ "data-slot": "menubar-checkbox-item", className: cn("focus:bg-accent focus:text-accent-foreground relative flex cursor-default items-center gap-2 rounded-xs py-1.5 pr-2 pl-8 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4", className), checked: checked }, props, { children: [_jsx("span", { className: "pointer-events-none absolute left-2 flex size-3.5 items-center justify-center", children: _jsx(MenubarPrimitive.ItemIndicator, { children: _jsx(CheckIcon, { className: "size-4" }) }) }), children] })));
|
|
63
|
+
}
|
|
64
|
+
function MenubarRadioItem(_a) {
|
|
65
|
+
var className = _a.className, children = _a.children, props = __rest(_a, ["className", "children"]);
|
|
66
|
+
return (_jsxs(MenubarPrimitive.RadioItem, __assign({ "data-slot": "menubar-radio-item", className: cn("focus:bg-accent focus:text-accent-foreground relative flex cursor-default items-center gap-2 rounded-xs py-1.5 pr-2 pl-8 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4", className) }, props, { children: [_jsx("span", { className: "pointer-events-none absolute left-2 flex size-3.5 items-center justify-center", children: _jsx(MenubarPrimitive.ItemIndicator, { children: _jsx(CircleIcon, { className: "size-2 fill-current" }) }) }), children] })));
|
|
67
|
+
}
|
|
68
|
+
function MenubarLabel(_a) {
|
|
69
|
+
var className = _a.className, inset = _a.inset, props = __rest(_a, ["className", "inset"]);
|
|
70
|
+
return (_jsx(MenubarPrimitive.Label, __assign({ "data-slot": "menubar-label", "data-inset": inset, className: cn("px-2 py-1.5 text-sm font-medium data-[inset]:pl-8", className) }, props)));
|
|
71
|
+
}
|
|
72
|
+
function MenubarSeparator(_a) {
|
|
73
|
+
var className = _a.className, props = __rest(_a, ["className"]);
|
|
74
|
+
return (_jsx(MenubarPrimitive.Separator, __assign({ "data-slot": "menubar-separator", className: cn("bg-border -mx-1 my-1 h-px", className) }, props)));
|
|
75
|
+
}
|
|
76
|
+
function MenubarShortcut(_a) {
|
|
77
|
+
var className = _a.className, props = __rest(_a, ["className"]);
|
|
78
|
+
return (_jsx("span", __assign({ "data-slot": "menubar-shortcut", className: cn("text-muted-foreground ml-auto text-xs tracking-widest", className) }, props)));
|
|
79
|
+
}
|
|
80
|
+
function MenubarSub(_a) {
|
|
81
|
+
var props = __rest(_a, []);
|
|
82
|
+
return _jsx(MenubarPrimitive.Sub, __assign({ "data-slot": "menubar-sub" }, props));
|
|
83
|
+
}
|
|
84
|
+
function MenubarSubTrigger(_a) {
|
|
85
|
+
var className = _a.className, inset = _a.inset, children = _a.children, props = __rest(_a, ["className", "inset", "children"]);
|
|
86
|
+
return (_jsxs(MenubarPrimitive.SubTrigger, __assign({ "data-slot": "menubar-sub-trigger", "data-inset": inset, className: cn("focus:bg-accent focus:text-accent-foreground data-[state=open]:bg-accent data-[state=open]:text-accent-foreground flex cursor-default items-center rounded-sm px-2 py-1.5 text-sm outline-none select-none data-[inset]:pl-8", className) }, props, { children: [children, _jsx(ChevronRightIcon, { className: "ml-auto h-4 w-4" })] })));
|
|
87
|
+
}
|
|
88
|
+
function MenubarSubContent(_a) {
|
|
89
|
+
var className = _a.className, props = __rest(_a, ["className"]);
|
|
90
|
+
return (_jsx(MenubarPrimitive.SubContent, __assign({ "data-slot": "menubar-sub-content", className: cn("bg-popover text-popover-foreground 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 z-50 min-w-[8rem] origin-(--radix-menubar-content-transform-origin) overflow-hidden rounded-md border p-1 shadow-lg", className) }, props)));
|
|
91
|
+
}
|
|
92
|
+
export { Menubar, MenubarPortal, MenubarMenu, MenubarTrigger, MenubarContent, MenubarGroup, MenubarSeparator, MenubarLabel, MenubarItem, MenubarShortcut, MenubarCheckboxItem, MenubarRadioGroup, MenubarRadioItem, MenubarSub, MenubarSubTrigger, MenubarSubContent, };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from "@storybook/react";
|
|
2
|
+
import { Menubar } from "./menubar";
|
|
3
|
+
declare const meta: Meta<typeof Menubar>;
|
|
4
|
+
export default meta;
|
|
5
|
+
type Story = StoryObj<typeof Menubar>;
|
|
6
|
+
export declare const Basic: () => import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
export declare const Complete: () => import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
export declare const WithCheckboxItems: () => import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
export declare const WithRadioGroup: () => import("react/jsx-runtime").JSX.Element;
|
|
10
|
+
export declare const WithSubMenus: Story;
|
|
11
|
+
export declare const WithDisabledItems: Story;
|
|
12
|
+
export declare const WithLabelsAndGroups: Story;
|
|
13
|
+
export declare const WithInsetItems: () => import("react/jsx-runtime").JSX.Element;
|
|
14
|
+
export declare const NestedSubMenus: Story;
|