@djangocfg/ui-core 2.1.314 → 2.1.315
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/README.md
CHANGED
|
@@ -104,6 +104,14 @@ import { Button, Dialog, Table } from '@djangocfg/ui-core';
|
|
|
104
104
|
### Navigation (8)
|
|
105
105
|
`Tabs` `Accordion` `Collapsible` `Command` `ContextMenu` `DropdownMenu` `Menubar` `NavigationMenu`
|
|
106
106
|
|
|
107
|
+
`ContextMenuItem`, `DropdownMenuItem`, and `MenubarItem` accept `variant?: 'default' | 'destructive'`. The `destructive` variant turns the row red on focus — use it for delete/remove actions:
|
|
108
|
+
|
|
109
|
+
```tsx
|
|
110
|
+
<DropdownMenuItem variant="destructive" onClick={remove}>
|
|
111
|
+
<Trash className="mr-2 size-4" /> Delete
|
|
112
|
+
</DropdownMenuItem>
|
|
113
|
+
```
|
|
114
|
+
|
|
107
115
|
### Data (10)
|
|
108
116
|
`Table` `Badge` `Avatar` `Progress` `Calendar` `Carousel` `Chart` `Toggle` `ToggleGroup` `DatePicker`
|
|
109
117
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@djangocfg/ui-core",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.315",
|
|
4
4
|
"description": "Pure React UI component library without Next.js dependencies - for Electron, Vite, CRA apps",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ui-components",
|
|
@@ -91,7 +91,7 @@
|
|
|
91
91
|
"playground": "playground dev"
|
|
92
92
|
},
|
|
93
93
|
"peerDependencies": {
|
|
94
|
-
"@djangocfg/i18n": "^2.1.
|
|
94
|
+
"@djangocfg/i18n": "^2.1.315",
|
|
95
95
|
"consola": "^3.4.2",
|
|
96
96
|
"lucide-react": "^0.545.0",
|
|
97
97
|
"moment": "^2.30.1",
|
|
@@ -160,9 +160,9 @@
|
|
|
160
160
|
"vaul": "1.1.2"
|
|
161
161
|
},
|
|
162
162
|
"devDependencies": {
|
|
163
|
-
"@djangocfg/i18n": "^2.1.
|
|
163
|
+
"@djangocfg/i18n": "^2.1.315",
|
|
164
164
|
"@djangocfg/playground": "workspace:*",
|
|
165
|
-
"@djangocfg/typescript-config": "^2.1.
|
|
165
|
+
"@djangocfg/typescript-config": "^2.1.315",
|
|
166
166
|
"@types/node": "^24.7.2",
|
|
167
167
|
"@types/react": "^19.1.0",
|
|
168
168
|
"@types/react-dom": "^19.1.0",
|
|
@@ -76,13 +76,17 @@ const ContextMenuItem = React.forwardRef<
|
|
|
76
76
|
React.ElementRef<typeof ContextMenuPrimitive.Item>,
|
|
77
77
|
React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.Item> & {
|
|
78
78
|
inset?: boolean
|
|
79
|
+
/** Visual style. `destructive` paints the row red on focus. */
|
|
80
|
+
variant?: "default" | "destructive"
|
|
79
81
|
key?: React.Key
|
|
80
82
|
}
|
|
81
|
-
>(({ className, inset, ...props }, ref) => (
|
|
83
|
+
>(({ className, inset, variant = "default", ...props }, ref) => (
|
|
82
84
|
<ContextMenuPrimitive.Item
|
|
83
85
|
ref={ref}
|
|
86
|
+
data-variant={variant}
|
|
84
87
|
className={cn(
|
|
85
88
|
"relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
|
|
89
|
+
"data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 data-[variant=destructive]:focus:text-destructive",
|
|
86
90
|
inset && "pl-8",
|
|
87
91
|
className
|
|
88
92
|
)}
|
|
@@ -81,18 +81,21 @@ const DropdownMenuItem = React.forwardRef<
|
|
|
81
81
|
React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Item> & {
|
|
82
82
|
inset?: boolean
|
|
83
83
|
href?: string
|
|
84
|
+
/** Visual style. `destructive` paints the row red on focus. */
|
|
85
|
+
variant?: "default" | "destructive"
|
|
84
86
|
key?: React.Key
|
|
85
87
|
}
|
|
86
|
-
>(({ className, inset, href, children, ...props }, ref) => {
|
|
88
|
+
>(({ className, inset, href, variant = "default", children, ...props }, ref) => {
|
|
87
89
|
const classes = cn(
|
|
88
90
|
"relative flex cursor-default select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&>svg]:size-4 [&>svg]:shrink-0",
|
|
91
|
+
"data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 data-[variant=destructive]:focus:text-destructive",
|
|
89
92
|
inset && "pl-8",
|
|
90
93
|
className
|
|
91
94
|
)
|
|
92
95
|
|
|
93
96
|
if (href) {
|
|
94
97
|
return (
|
|
95
|
-
<DropdownMenuPrimitive.Item asChild ref={ref} {...props}>
|
|
98
|
+
<DropdownMenuPrimitive.Item asChild ref={ref} data-variant={variant} {...props}>
|
|
96
99
|
<Link href={href} className={classes}>
|
|
97
100
|
{children}
|
|
98
101
|
</Link>
|
|
@@ -103,6 +106,7 @@ const DropdownMenuItem = React.forwardRef<
|
|
|
103
106
|
return (
|
|
104
107
|
<DropdownMenuPrimitive.Item
|
|
105
108
|
ref={ref}
|
|
109
|
+
data-variant={variant}
|
|
106
110
|
className={classes}
|
|
107
111
|
{...props}
|
|
108
112
|
>
|
|
@@ -133,18 +133,21 @@ const MenubarItem = React.forwardRef<
|
|
|
133
133
|
React.ComponentPropsWithoutRef<typeof MenubarPrimitive.Item> & {
|
|
134
134
|
inset?: boolean
|
|
135
135
|
href?: string
|
|
136
|
+
/** Visual style. `destructive` paints the row red on focus. */
|
|
137
|
+
variant?: "default" | "destructive"
|
|
136
138
|
key?: React.Key
|
|
137
139
|
}
|
|
138
|
-
>(({ className, inset, href, children, ...props }, ref) => {
|
|
140
|
+
>(({ className, inset, href, variant = "default", children, ...props }, ref) => {
|
|
139
141
|
const classes = cn(
|
|
140
142
|
"relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
|
|
143
|
+
"data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 data-[variant=destructive]:focus:text-destructive",
|
|
141
144
|
inset && "pl-8",
|
|
142
145
|
className
|
|
143
146
|
)
|
|
144
147
|
|
|
145
148
|
if (href) {
|
|
146
149
|
return (
|
|
147
|
-
<MenubarPrimitive.Item asChild ref={ref} {...props}>
|
|
150
|
+
<MenubarPrimitive.Item asChild ref={ref} data-variant={variant} {...props}>
|
|
148
151
|
<Link href={href} className={classes}>
|
|
149
152
|
{children}
|
|
150
153
|
</Link>
|
|
@@ -155,6 +158,7 @@ const MenubarItem = React.forwardRef<
|
|
|
155
158
|
return (
|
|
156
159
|
<MenubarPrimitive.Item
|
|
157
160
|
ref={ref}
|
|
161
|
+
data-variant={variant}
|
|
158
162
|
className={classes}
|
|
159
163
|
{...props}
|
|
160
164
|
>
|