@icomponents/react 0.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.
Files changed (117) hide show
  1. package/README.md +40 -0
  2. package/package.json +165 -0
  3. package/src/assets/custom/icon-dir.tsx +105 -0
  4. package/src/assets/custom/icon-layout-compact.tsx +84 -0
  5. package/src/assets/custom/icon-layout-default.tsx +48 -0
  6. package/src/assets/custom/icon-layout-full.tsx +68 -0
  7. package/src/assets/custom/icon-sidebar-floating.tsx +62 -0
  8. package/src/assets/custom/icon-sidebar-inset.tsx +53 -0
  9. package/src/assets/custom/icon-sidebar-sidebar.tsx +48 -0
  10. package/src/assets/custom/icon-theme-dark.tsx +36 -0
  11. package/src/assets/custom/icon-theme-light.tsx +35 -0
  12. package/src/assets/custom/icon-theme-system.tsx +113 -0
  13. package/src/components/admin-page-header.tsx +29 -0
  14. package/src/components/color-theme-switch.tsx +93 -0
  15. package/src/components/coming-soon.tsx +16 -0
  16. package/src/components/command-menu.tsx +98 -0
  17. package/src/components/config-drawer.tsx +401 -0
  18. package/src/components/confirm-dialog.dom.test.tsx +60 -0
  19. package/src/components/confirm-dialog.tsx +75 -0
  20. package/src/components/data-table/bulk-actions.tsx +193 -0
  21. package/src/components/data-table/column-header.tsx +66 -0
  22. package/src/components/data-table/data-table.dom.test.tsx +54 -0
  23. package/src/components/data-table/data-table.tsx +189 -0
  24. package/src/components/data-table/faceted-filter.tsx +156 -0
  25. package/src/components/data-table/index.ts +5 -0
  26. package/src/components/data-table/pagination.tsx +127 -0
  27. package/src/components/data-table/tanstack-table.d.ts +12 -0
  28. package/src/components/data-table/toolbar.tsx +88 -0
  29. package/src/components/data-table/view-options.tsx +49 -0
  30. package/src/components/date-picker.tsx +39 -0
  31. package/src/components/detail-card.tsx +63 -0
  32. package/src/components/language-switch.tsx +38 -0
  33. package/src/components/layout/app-sidebar.tsx +59 -0
  34. package/src/components/layout/app-title.tsx +62 -0
  35. package/src/components/layout/header.tsx +61 -0
  36. package/src/components/layout/main.tsx +34 -0
  37. package/src/components/layout/nav-group.tsx +185 -0
  38. package/src/components/layout/nav-user.tsx +115 -0
  39. package/src/components/layout/screen-header.tsx +119 -0
  40. package/src/components/layout/team-switcher.tsx +84 -0
  41. package/src/components/layout/top-nav.tsx +68 -0
  42. package/src/components/layout/types.ts +44 -0
  43. package/src/components/learn-more.tsx +35 -0
  44. package/src/components/long-text.tsx +80 -0
  45. package/src/components/navigation-progress.tsx +18 -0
  46. package/src/components/password-input.tsx +36 -0
  47. package/src/components/profile-dropdown.tsx +106 -0
  48. package/src/components/search.tsx +38 -0
  49. package/src/components/select-dropdown.tsx +62 -0
  50. package/src/components/sign-out-dialog.tsx +31 -0
  51. package/src/components/skip-to-main.tsx +10 -0
  52. package/src/components/stat-tile.tsx +56 -0
  53. package/src/components/status-badge.test.ts +23 -0
  54. package/src/components/status-badge.tsx +49 -0
  55. package/src/components/theme-switch.tsx +61 -0
  56. package/src/components/ui/alert-dialog.tsx +134 -0
  57. package/src/components/ui/alert.tsx +59 -0
  58. package/src/components/ui/avatar.tsx +38 -0
  59. package/src/components/ui/badge.tsx +39 -0
  60. package/src/components/ui/base-ui-state-attrs.dom.test.tsx +80 -0
  61. package/src/components/ui/button.tsx +51 -0
  62. package/src/components/ui/calendar.tsx +174 -0
  63. package/src/components/ui/card.tsx +74 -0
  64. package/src/components/ui/checkbox.tsx +26 -0
  65. package/src/components/ui/collapsible.tsx +18 -0
  66. package/src/components/ui/command.tsx +160 -0
  67. package/src/components/ui/dialog.tsx +129 -0
  68. package/src/components/ui/dropdown-menu.tsx +254 -0
  69. package/src/components/ui/form.tsx +155 -0
  70. package/src/components/ui/input-otp.tsx +67 -0
  71. package/src/components/ui/input.tsx +20 -0
  72. package/src/components/ui/label.tsx +21 -0
  73. package/src/components/ui/popover.tsx +54 -0
  74. package/src/components/ui/radio-group.tsx +37 -0
  75. package/src/components/ui/scroll-area.tsx +57 -0
  76. package/src/components/ui/select.tsx +213 -0
  77. package/src/components/ui/separator.tsx +23 -0
  78. package/src/components/ui/sheet.tsx +128 -0
  79. package/src/components/ui/sidebar.tsx +702 -0
  80. package/src/components/ui/skeleton.tsx +13 -0
  81. package/src/components/ui/sonner.tsx +26 -0
  82. package/src/components/ui/switch.tsx +25 -0
  83. package/src/components/ui/table.tsx +89 -0
  84. package/src/components/ui/tabs.tsx +51 -0
  85. package/src/components/ui/textarea.tsx +17 -0
  86. package/src/components/ui/tooltip.tsx +65 -0
  87. package/src/config/fonts.ts +2 -0
  88. package/src/context/direction-provider.tsx +61 -0
  89. package/src/context/font-provider.tsx +70 -0
  90. package/src/context/language-provider.tsx +73 -0
  91. package/src/context/layout-provider.tsx +81 -0
  92. package/src/context/search-provider.tsx +48 -0
  93. package/src/context/theme-provider.tsx +108 -0
  94. package/src/hooks/sort-url.test.ts +16 -0
  95. package/src/hooks/use-dialog-state.tsx +15 -0
  96. package/src/hooks/use-mobile.tsx +16 -0
  97. package/src/hooks/use-table-url-state.ts +243 -0
  98. package/src/i18n/common.ts +164 -0
  99. package/src/i18n/create-i18n.test.ts +50 -0
  100. package/src/i18n/create-i18n.ts +67 -0
  101. package/src/i18n/types.ts +22 -0
  102. package/src/i18n/use-translation.ts +6 -0
  103. package/src/lib/clipboard.test.ts +46 -0
  104. package/src/lib/clipboard.ts +29 -0
  105. package/src/lib/cookies.ts +39 -0
  106. package/src/lib/format-cell.test.ts +57 -0
  107. package/src/lib/format-cell.ts +63 -0
  108. package/src/lib/handle-server-error.test.ts +85 -0
  109. package/src/lib/handle-server-error.ts +39 -0
  110. package/src/lib/random-id.ts +13 -0
  111. package/src/lib/show-submitted-data.tsx +14 -0
  112. package/src/lib/utils.test.ts +35 -0
  113. package/src/lib/utils.ts +78 -0
  114. package/src/secure-context.contract.test.ts +63 -0
  115. package/src/testids.contract.test.ts +113 -0
  116. package/src/testids.ts +8 -0
  117. package/src/theme-contract.test.ts +72 -0
@@ -0,0 +1,18 @@
1
+ import { Collapsible as CollapsiblePrimitive } from "@base-ui/react/collapsible";
2
+ import * as React from "react";
3
+
4
+ function Collapsible({ ...props }: React.ComponentProps<typeof CollapsiblePrimitive.Root>) {
5
+ return <CollapsiblePrimitive.Root data-slot="collapsible" {...props} />;
6
+ }
7
+
8
+ function CollapsibleTrigger({
9
+ ...props
10
+ }: React.ComponentProps<typeof CollapsiblePrimitive.Trigger>) {
11
+ return <CollapsiblePrimitive.Trigger data-slot="collapsible-trigger" {...props} />;
12
+ }
13
+
14
+ function CollapsibleContent({ ...props }: React.ComponentProps<typeof CollapsiblePrimitive.Panel>) {
15
+ return <CollapsiblePrimitive.Panel data-slot="collapsible-content" {...props} />;
16
+ }
17
+
18
+ export { Collapsible, CollapsibleTrigger, CollapsibleContent };
@@ -0,0 +1,160 @@
1
+ import {
2
+ Dialog,
3
+ DialogContent,
4
+ DialogDescription,
5
+ DialogHeader,
6
+ DialogTitle,
7
+ } from "@icomponents/react/components/ui/dialog";
8
+ import { cn } from "@icomponents/react/lib/utils";
9
+ import { Command as CommandPrimitive } from "cmdk";
10
+ import { SearchIcon } from "lucide-react";
11
+ import * as React from "react";
12
+
13
+ function Command({ className, ...props }: React.ComponentProps<typeof CommandPrimitive>) {
14
+ return (
15
+ <CommandPrimitive
16
+ data-slot="command"
17
+ className={cn(
18
+ "flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground",
19
+ className
20
+ )}
21
+ {...props}
22
+ />
23
+ );
24
+ }
25
+
26
+ function CommandDialog({
27
+ title = "Command Palette",
28
+ description = "Search for a command to run...",
29
+ children,
30
+ className,
31
+ showCloseButton = true,
32
+ ...props
33
+ }: Omit<React.ComponentProps<typeof Dialog>, "children"> & {
34
+ title?: string;
35
+ description?: string;
36
+ className?: string;
37
+ showCloseButton?: boolean;
38
+ // cmdk's <Command> takes ReactNode only — narrow off Base UI Dialog's render-fn children union.
39
+ children?: React.ReactNode;
40
+ }) {
41
+ return (
42
+ <Dialog {...props}>
43
+ <DialogHeader className="sr-only">
44
+ <DialogTitle>{title}</DialogTitle>
45
+ <DialogDescription>{description}</DialogDescription>
46
+ </DialogHeader>
47
+ <DialogContent
48
+ className={cn("overflow-hidden p-0", className)}
49
+ showCloseButton={showCloseButton}
50
+ >
51
+ <Command className="**:data-[slot=command-input-wrapper]:h-12 [&_[cmdk-group]:not([hidden])_~[cmdk-group]]:pt-0 [&_[cmdk-input-wrapper]_svg]:h-5 [&_[cmdk-input-wrapper]_svg]:w-5 [&_[cmdk-item]_svg]:h-5 [&_[cmdk-item]_svg]:w-5 **:[[cmdk-group-heading]]:px-2 **:[[cmdk-group-heading]]:font-medium **:[[cmdk-group-heading]]:text-muted-foreground **:[[cmdk-group]]:px-2 **:[[cmdk-input]]:h-12 **:[[cmdk-item]]:px-2 **:[[cmdk-item]]:py-3">
52
+ {children}
53
+ </Command>
54
+ </DialogContent>
55
+ </Dialog>
56
+ );
57
+ }
58
+
59
+ function CommandInput({
60
+ className,
61
+ ...props
62
+ }: React.ComponentProps<typeof CommandPrimitive.Input>) {
63
+ return (
64
+ <div data-slot="command-input-wrapper" className="flex h-9 items-center gap-2 border-b px-3">
65
+ <SearchIcon className="size-4 shrink-0 opacity-50" />
66
+ <CommandPrimitive.Input
67
+ data-slot="command-input"
68
+ className={cn(
69
+ "flex h-10 w-full rounded-md bg-transparent py-3 text-sm outline-hidden placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50",
70
+ className
71
+ )}
72
+ {...props}
73
+ />
74
+ </div>
75
+ );
76
+ }
77
+
78
+ function CommandList({ className, ...props }: React.ComponentProps<typeof CommandPrimitive.List>) {
79
+ return (
80
+ <CommandPrimitive.List
81
+ data-slot="command-list"
82
+ className={cn("max-h-75 scroll-py-1 overflow-x-hidden overflow-y-auto", className)}
83
+ {...props}
84
+ />
85
+ );
86
+ }
87
+
88
+ function CommandEmpty({ ...props }: React.ComponentProps<typeof CommandPrimitive.Empty>) {
89
+ return (
90
+ <CommandPrimitive.Empty
91
+ data-slot="command-empty"
92
+ className="py-6 text-center text-sm"
93
+ {...props}
94
+ />
95
+ );
96
+ }
97
+
98
+ function CommandGroup({
99
+ className,
100
+ ...props
101
+ }: React.ComponentProps<typeof CommandPrimitive.Group>) {
102
+ return (
103
+ <CommandPrimitive.Group
104
+ data-slot="command-group"
105
+ className={cn(
106
+ "overflow-hidden p-1 text-foreground **:[[cmdk-group-heading]]:px-2 **:[[cmdk-group-heading]]:py-1.5 **:[[cmdk-group-heading]]:text-xs **:[[cmdk-group-heading]]:font-medium **:[[cmdk-group-heading]]:text-muted-foreground",
107
+ className
108
+ )}
109
+ {...props}
110
+ />
111
+ );
112
+ }
113
+
114
+ function CommandSeparator({
115
+ className,
116
+ ...props
117
+ }: React.ComponentProps<typeof CommandPrimitive.Separator>) {
118
+ return (
119
+ <CommandPrimitive.Separator
120
+ data-slot="command-separator"
121
+ className={cn("-mx-1 h-px bg-border", className)}
122
+ {...props}
123
+ />
124
+ );
125
+ }
126
+
127
+ function CommandItem({ className, ...props }: React.ComponentProps<typeof CommandPrimitive.Item>) {
128
+ return (
129
+ <CommandPrimitive.Item
130
+ data-slot="command-item"
131
+ className={cn(
132
+ "relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50 data-[selected=true]:bg-accent data-[selected=true]:text-accent-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 [&_svg:not([class*='text-'])]:text-muted-foreground",
133
+ className
134
+ )}
135
+ {...props}
136
+ />
137
+ );
138
+ }
139
+
140
+ function CommandShortcut({ className, ...props }: React.ComponentProps<"span">) {
141
+ return (
142
+ <span
143
+ data-slot="command-shortcut"
144
+ className={cn("ms-auto text-xs tracking-widest text-muted-foreground", className)}
145
+ {...props}
146
+ />
147
+ );
148
+ }
149
+
150
+ export {
151
+ Command,
152
+ CommandDialog,
153
+ CommandInput,
154
+ CommandList,
155
+ CommandEmpty,
156
+ CommandGroup,
157
+ CommandItem,
158
+ CommandShortcut,
159
+ CommandSeparator,
160
+ };
@@ -0,0 +1,129 @@
1
+ "use client";
2
+
3
+ import { Dialog as DialogPrimitive } from "@base-ui/react/dialog";
4
+ import { cn } from "@icomponents/react/lib/utils";
5
+ import { XIcon } from "lucide-react";
6
+ import * as React from "react";
7
+
8
+ function Dialog({ ...props }: React.ComponentProps<typeof DialogPrimitive.Root>) {
9
+ return <DialogPrimitive.Root data-slot="dialog" {...props} />;
10
+ }
11
+
12
+ function DialogTrigger({ ...props }: React.ComponentProps<typeof DialogPrimitive.Trigger>) {
13
+ return <DialogPrimitive.Trigger data-slot="dialog-trigger" {...props} />;
14
+ }
15
+
16
+ function DialogPortal({ ...props }: React.ComponentProps<typeof DialogPrimitive.Portal>) {
17
+ return <DialogPrimitive.Portal data-slot="dialog-portal" {...props} />;
18
+ }
19
+
20
+ function DialogClose({ ...props }: React.ComponentProps<typeof DialogPrimitive.Close>) {
21
+ return <DialogPrimitive.Close data-slot="dialog-close" {...props} />;
22
+ }
23
+
24
+ function DialogOverlay({
25
+ className,
26
+ ...props
27
+ }: React.ComponentProps<typeof DialogPrimitive.Backdrop>) {
28
+ return (
29
+ <DialogPrimitive.Backdrop
30
+ data-slot="dialog-overlay"
31
+ className={cn(
32
+ "fixed inset-0 z-50 bg-black/50 data-closed:animate-out data-closed:fade-out-0 data-open:animate-in data-open:fade-in-0",
33
+ className
34
+ )}
35
+ {...props}
36
+ />
37
+ );
38
+ }
39
+
40
+ function DialogContent({
41
+ className,
42
+ children,
43
+ showCloseButton = true,
44
+ ...props
45
+ }: React.ComponentProps<typeof DialogPrimitive.Popup> & {
46
+ showCloseButton?: boolean;
47
+ }) {
48
+ return (
49
+ <DialogPortal data-slot="dialog-portal">
50
+ <DialogOverlay />
51
+ {/* Centered modal: Base UI Popup WITHOUT a Positioner. */}
52
+ <DialogPrimitive.Popup
53
+ data-slot="dialog-content"
54
+ className={cn(
55
+ "fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border bg-background p-6 shadow-lg duration-200 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 sm:max-w-lg",
56
+ className
57
+ )}
58
+ {...props}
59
+ >
60
+ {children}
61
+ {showCloseButton && (
62
+ <DialogPrimitive.Close
63
+ data-slot="dialog-close"
64
+ className="absolute inset-e-4 top-4 rounded-xs opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:ring-2 focus:ring-ring focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none data-open:bg-accent data-open:text-muted-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4"
65
+ >
66
+ <XIcon />
67
+ <span className="sr-only">Close</span>
68
+ </DialogPrimitive.Close>
69
+ )}
70
+ </DialogPrimitive.Popup>
71
+ </DialogPortal>
72
+ );
73
+ }
74
+
75
+ function DialogHeader({ className, ...props }: React.ComponentProps<"div">) {
76
+ return (
77
+ <div
78
+ data-slot="dialog-header"
79
+ className={cn("flex flex-col gap-2 text-center sm:text-start", className)}
80
+ {...props}
81
+ />
82
+ );
83
+ }
84
+
85
+ function DialogFooter({ className, ...props }: React.ComponentProps<"div">) {
86
+ return (
87
+ <div
88
+ data-slot="dialog-footer"
89
+ className={cn("flex flex-col-reverse gap-2 sm:flex-row sm:justify-end", className)}
90
+ {...props}
91
+ />
92
+ );
93
+ }
94
+
95
+ function DialogTitle({ className, ...props }: React.ComponentProps<typeof DialogPrimitive.Title>) {
96
+ return (
97
+ <DialogPrimitive.Title
98
+ data-slot="dialog-title"
99
+ className={cn("text-lg leading-none font-semibold", className)}
100
+ {...props}
101
+ />
102
+ );
103
+ }
104
+
105
+ function DialogDescription({
106
+ className,
107
+ ...props
108
+ }: React.ComponentProps<typeof DialogPrimitive.Description>) {
109
+ return (
110
+ <DialogPrimitive.Description
111
+ data-slot="dialog-description"
112
+ className={cn("text-sm text-muted-foreground", className)}
113
+ {...props}
114
+ />
115
+ );
116
+ }
117
+
118
+ export {
119
+ Dialog,
120
+ DialogClose,
121
+ DialogContent,
122
+ DialogDescription,
123
+ DialogFooter,
124
+ DialogHeader,
125
+ DialogOverlay,
126
+ DialogPortal,
127
+ DialogTitle,
128
+ DialogTrigger,
129
+ };
@@ -0,0 +1,254 @@
1
+ import { Menu as DropdownMenuPrimitive } from "@base-ui/react/menu";
2
+ import { cn } from "@icomponents/react/lib/utils";
3
+ import { CheckIcon, ChevronRightIcon, CircleIcon } from "lucide-react";
4
+ import * as React from "react";
5
+
6
+ function DropdownMenu({ ...props }: React.ComponentProps<typeof DropdownMenuPrimitive.Root>) {
7
+ return <DropdownMenuPrimitive.Root data-slot="dropdown-menu" {...props} />;
8
+ }
9
+
10
+ function DropdownMenuPortal({
11
+ ...props
12
+ }: React.ComponentProps<typeof DropdownMenuPrimitive.Portal>) {
13
+ return <DropdownMenuPrimitive.Portal data-slot="dropdown-menu-portal" {...props} />;
14
+ }
15
+
16
+ // Menu.Trigger is a generic component (`<Payload>`), which breaks `React.ComponentProps` (drops the
17
+ // `render` prop) — use its own `.Props` namespace type instead.
18
+ function DropdownMenuTrigger({ ...props }: DropdownMenuPrimitive.Trigger.Props) {
19
+ return <DropdownMenuPrimitive.Trigger data-slot="dropdown-menu-trigger" {...props} />;
20
+ }
21
+
22
+ function DropdownMenuContent({
23
+ className,
24
+ sideOffset = 4,
25
+ side,
26
+ align,
27
+ alignOffset,
28
+ ...props
29
+ }: React.ComponentProps<typeof DropdownMenuPrimitive.Popup> &
30
+ Pick<
31
+ React.ComponentProps<typeof DropdownMenuPrimitive.Positioner>,
32
+ "side" | "align" | "sideOffset" | "alignOffset"
33
+ >) {
34
+ return (
35
+ <DropdownMenuPrimitive.Portal>
36
+ {/* Radix Content → Portal > Positioner > Popup; positioning lives on Positioner. */}
37
+ <DropdownMenuPrimitive.Positioner
38
+ side={side}
39
+ align={align}
40
+ sideOffset={sideOffset}
41
+ alignOffset={alignOffset}
42
+ className="isolate z-50 outline-none"
43
+ >
44
+ <DropdownMenuPrimitive.Popup
45
+ data-slot="dropdown-menu-content"
46
+ className={cn(
47
+ "z-50 max-h-(--available-height) min-w-32 origin-(--transform-origin) overflow-x-hidden overflow-y-auto rounded-md border bg-popover p-1 text-popover-foreground shadow-md outline-none 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 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95",
48
+ className
49
+ )}
50
+ {...props}
51
+ />
52
+ </DropdownMenuPrimitive.Positioner>
53
+ </DropdownMenuPrimitive.Portal>
54
+ );
55
+ }
56
+
57
+ function DropdownMenuGroup({ ...props }: React.ComponentProps<typeof DropdownMenuPrimitive.Group>) {
58
+ return <DropdownMenuPrimitive.Group data-slot="dropdown-menu-group" {...props} />;
59
+ }
60
+
61
+ function DropdownMenuItem({
62
+ className,
63
+ inset,
64
+ variant = "default",
65
+ ...props
66
+ }: React.ComponentProps<typeof DropdownMenuPrimitive.Item> & {
67
+ inset?: boolean;
68
+ variant?: "default" | "destructive";
69
+ }) {
70
+ return (
71
+ <DropdownMenuPrimitive.Item
72
+ data-slot="dropdown-menu-item"
73
+ data-inset={inset}
74
+ data-variant={variant}
75
+ className={cn(
76
+ "relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground data-highlighted:bg-accent data-highlighted:text-accent-foreground data-disabled:pointer-events-none data-disabled:opacity-50 data-inset:ps-8 data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 data-[variant=destructive]:focus:text-destructive dark:data-[variant=destructive]:focus:bg-destructive/20 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 [&_svg:not([class*='text-'])]:text-muted-foreground data-[variant=destructive]:*:[svg]:text-destructive!",
77
+ className
78
+ )}
79
+ {...props}
80
+ />
81
+ );
82
+ }
83
+
84
+ function DropdownMenuCheckboxItem({
85
+ className,
86
+ children,
87
+ checked,
88
+ ...props
89
+ }: React.ComponentProps<typeof DropdownMenuPrimitive.CheckboxItem>) {
90
+ return (
91
+ <DropdownMenuPrimitive.CheckboxItem
92
+ data-slot="dropdown-menu-checkbox-item"
93
+ className={cn(
94
+ "relative flex cursor-default items-center gap-2 rounded-sm py-1.5 ps-8 pe-2 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground data-highlighted:bg-accent data-highlighted:text-accent-foreground data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
95
+ className
96
+ )}
97
+ checked={checked}
98
+ {...props}
99
+ >
100
+ <span className="pointer-events-none absolute inset-s-2 flex size-3.5 items-center justify-center">
101
+ <DropdownMenuPrimitive.CheckboxItemIndicator>
102
+ <CheckIcon className="size-4" />
103
+ </DropdownMenuPrimitive.CheckboxItemIndicator>
104
+ </span>
105
+ {children}
106
+ </DropdownMenuPrimitive.CheckboxItem>
107
+ );
108
+ }
109
+
110
+ function DropdownMenuRadioGroup({
111
+ ...props
112
+ }: React.ComponentProps<typeof DropdownMenuPrimitive.RadioGroup>) {
113
+ return <DropdownMenuPrimitive.RadioGroup data-slot="dropdown-menu-radio-group" {...props} />;
114
+ }
115
+
116
+ function DropdownMenuRadioItem({
117
+ className,
118
+ children,
119
+ ...props
120
+ }: React.ComponentProps<typeof DropdownMenuPrimitive.RadioItem>) {
121
+ return (
122
+ <DropdownMenuPrimitive.RadioItem
123
+ data-slot="dropdown-menu-radio-item"
124
+ className={cn(
125
+ "relative flex cursor-default items-center gap-2 rounded-sm py-1.5 ps-8 pe-2 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground data-highlighted:bg-accent data-highlighted:text-accent-foreground data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
126
+ className
127
+ )}
128
+ {...props}
129
+ >
130
+ <span className="pointer-events-none absolute inset-s-2 flex size-3.5 items-center justify-center">
131
+ <DropdownMenuPrimitive.RadioItemIndicator>
132
+ <CircleIcon className="size-2 fill-current" />
133
+ </DropdownMenuPrimitive.RadioItemIndicator>
134
+ </span>
135
+ {children}
136
+ </DropdownMenuPrimitive.RadioItem>
137
+ );
138
+ }
139
+
140
+ // Radix DropdownMenu.Label was a standalone styled label; Base UI Menu.GroupLabel REQUIRES a
141
+ // <Menu.Group> ancestor (crashes otherwise) and shadcn uses this label standalone (menu headers).
142
+ // Render a plain <div> to preserve the standalone usage.
143
+ function DropdownMenuLabel({
144
+ className,
145
+ inset,
146
+ ...props
147
+ }: React.ComponentProps<"div"> & {
148
+ inset?: boolean;
149
+ }) {
150
+ return (
151
+ <div
152
+ data-slot="dropdown-menu-label"
153
+ data-inset={inset}
154
+ className={cn("px-2 py-1.5 text-sm font-medium data-inset:ps-8", className)}
155
+ {...props}
156
+ />
157
+ );
158
+ }
159
+
160
+ function DropdownMenuSeparator({
161
+ className,
162
+ ...props
163
+ }: React.ComponentProps<typeof DropdownMenuPrimitive.Separator>) {
164
+ return (
165
+ <DropdownMenuPrimitive.Separator
166
+ data-slot="dropdown-menu-separator"
167
+ className={cn("-mx-1 my-1 h-px bg-border", className)}
168
+ {...props}
169
+ />
170
+ );
171
+ }
172
+
173
+ function DropdownMenuShortcut({ className, ...props }: React.ComponentProps<"span">) {
174
+ return (
175
+ <span
176
+ data-slot="dropdown-menu-shortcut"
177
+ className={cn("ms-auto text-xs tracking-widest text-muted-foreground", className)}
178
+ {...props}
179
+ />
180
+ );
181
+ }
182
+
183
+ function DropdownMenuSub({
184
+ ...props
185
+ }: React.ComponentProps<typeof DropdownMenuPrimitive.SubmenuRoot>) {
186
+ return <DropdownMenuPrimitive.SubmenuRoot data-slot="dropdown-menu-sub" {...props} />;
187
+ }
188
+
189
+ function DropdownMenuSubTrigger({
190
+ className,
191
+ inset,
192
+ children,
193
+ ...props
194
+ }: React.ComponentProps<typeof DropdownMenuPrimitive.SubmenuTrigger> & {
195
+ inset?: boolean;
196
+ }) {
197
+ return (
198
+ <DropdownMenuPrimitive.SubmenuTrigger
199
+ data-slot="dropdown-menu-sub-trigger"
200
+ data-inset={inset}
201
+ className={cn(
202
+ "flex cursor-default items-center rounded-sm px-2 py-1.5 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground data-highlighted:bg-accent data-highlighted:text-accent-foreground data-inset:ps-8 data-popup-open:bg-accent data-popup-open:text-accent-foreground",
203
+ className
204
+ )}
205
+ {...props}
206
+ >
207
+ {children}
208
+ <ChevronRightIcon className="ms-auto size-4" />
209
+ </DropdownMenuPrimitive.SubmenuTrigger>
210
+ );
211
+ }
212
+
213
+ function DropdownMenuSubContent({
214
+ className,
215
+ sideOffset = 0,
216
+ ...props
217
+ }: React.ComponentProps<typeof DropdownMenuPrimitive.Popup> & { sideOffset?: number }) {
218
+ return (
219
+ <DropdownMenuPrimitive.Portal>
220
+ <DropdownMenuPrimitive.Positioner
221
+ align="start"
222
+ sideOffset={sideOffset}
223
+ className="isolate z-50 outline-none"
224
+ >
225
+ <DropdownMenuPrimitive.Popup
226
+ data-slot="dropdown-menu-sub-content"
227
+ className={cn(
228
+ "z-50 min-w-32 origin-(--transform-origin) overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-lg outline-none 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 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95",
229
+ className
230
+ )}
231
+ {...props}
232
+ />
233
+ </DropdownMenuPrimitive.Positioner>
234
+ </DropdownMenuPrimitive.Portal>
235
+ );
236
+ }
237
+
238
+ export {
239
+ DropdownMenu,
240
+ DropdownMenuPortal,
241
+ DropdownMenuTrigger,
242
+ DropdownMenuContent,
243
+ DropdownMenuGroup,
244
+ DropdownMenuLabel,
245
+ DropdownMenuItem,
246
+ DropdownMenuCheckboxItem,
247
+ DropdownMenuRadioGroup,
248
+ DropdownMenuRadioItem,
249
+ DropdownMenuSeparator,
250
+ DropdownMenuShortcut,
251
+ DropdownMenuSub,
252
+ DropdownMenuSubTrigger,
253
+ DropdownMenuSubContent,
254
+ };