@djangocfg/ui-nextjs 1.4.47 → 2.1.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/package.json +9 -8
- package/src/components/breadcrumb.tsx +3 -3
- package/src/components/dropdown-menu.tsx +4 -4
- package/src/components/markdown/MarkdownMessage.tsx +29 -17
- package/src/components/menubar.tsx +4 -4
- package/src/components/navigation-menu.tsx +2 -2
- package/src/components/sidebar.tsx +2 -2
- package/src/styles/index.css +6 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@djangocfg/ui-nextjs",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "2.1.1",
|
|
4
4
|
"description": "Next.js UI component library with Radix UI primitives, Tailwind CSS styling, charts, and form components",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ui-components",
|
|
@@ -58,15 +58,15 @@
|
|
|
58
58
|
"check": "tsc --noEmit"
|
|
59
59
|
},
|
|
60
60
|
"peerDependencies": {
|
|
61
|
-
"@djangocfg/api": "^1.
|
|
62
|
-
"@djangocfg/ui-core": "^1.0.
|
|
63
|
-
"@types/react": "^19.
|
|
64
|
-
"@types/react-dom": "^19.
|
|
61
|
+
"@djangocfg/api": "^2.1.1",
|
|
62
|
+
"@djangocfg/ui-core": "^1.0.4",
|
|
63
|
+
"@types/react": "^19.1.0",
|
|
64
|
+
"@types/react-dom": "^19.1.0",
|
|
65
65
|
"lucide-react": "^0.545.0",
|
|
66
66
|
"moment": "^2.30.1",
|
|
67
67
|
"next": "^15.5.7",
|
|
68
|
-
"react": "^19.
|
|
69
|
-
"react-dom": "^19.
|
|
68
|
+
"react": "^19.1.0",
|
|
69
|
+
"react-dom": "^19.1.0",
|
|
70
70
|
"react-hook-form": "7.65.0",
|
|
71
71
|
"tailwindcss": "^4.1.14",
|
|
72
72
|
"zod": "^4.1.13",
|
|
@@ -76,6 +76,7 @@
|
|
|
76
76
|
"@radix-ui/react-dropdown-menu": "^2.1.16",
|
|
77
77
|
"@radix-ui/react-menubar": "^1.1.16",
|
|
78
78
|
"@radix-ui/react-navigation-menu": "^1.2.14",
|
|
79
|
+
"@radix-ui/react-slot": "^1.2.4",
|
|
79
80
|
"@rjsf/core": "^6.1.2",
|
|
80
81
|
"@rjsf/utils": "^6.1.2",
|
|
81
82
|
"@rjsf/validator-ajv8": "^6.1.2",
|
|
@@ -98,7 +99,7 @@
|
|
|
98
99
|
"vidstack": "next"
|
|
99
100
|
},
|
|
100
101
|
"devDependencies": {
|
|
101
|
-
"@djangocfg/typescript-config": "^1.
|
|
102
|
+
"@djangocfg/typescript-config": "^2.1.1",
|
|
102
103
|
"@types/node": "^24.7.2",
|
|
103
104
|
"eslint": "^9.37.0",
|
|
104
105
|
"tailwindcss-animate": "1.0.7",
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
import * as React from "react"
|
|
4
4
|
import { Slot } from "@radix-ui/react-slot"
|
|
5
5
|
import { cn } from "@djangocfg/ui-core/lib"
|
|
6
|
-
import {
|
|
6
|
+
import { ChevronRight, MoreHorizontal } from "lucide-react"
|
|
7
7
|
import Link from "next/link"
|
|
8
8
|
|
|
9
9
|
const Breadcrumb = React.forwardRef<
|
|
@@ -100,7 +100,7 @@ const BreadcrumbSeparator = ({
|
|
|
100
100
|
className={cn("[&>svg]:w-3.5 [&>svg]:h-3.5", className)}
|
|
101
101
|
{...props}
|
|
102
102
|
>
|
|
103
|
-
{children ?? <
|
|
103
|
+
{children ?? <ChevronRight />}
|
|
104
104
|
</li>
|
|
105
105
|
)
|
|
106
106
|
BreadcrumbSeparator.displayName = "BreadcrumbSeparator"
|
|
@@ -115,7 +115,7 @@ const BreadcrumbEllipsis = ({
|
|
|
115
115
|
className={cn("flex h-9 w-9 items-center justify-center", className)}
|
|
116
116
|
{...props}
|
|
117
117
|
>
|
|
118
|
-
<
|
|
118
|
+
<MoreHorizontal className="h-4 w-4" />
|
|
119
119
|
<span className="sr-only">More</span>
|
|
120
120
|
</span>
|
|
121
121
|
)
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
import * as React from "react"
|
|
4
4
|
import * as DropdownMenuPrimitive from "@radix-ui/react-dropdown-menu"
|
|
5
5
|
import { cn } from "@djangocfg/ui-core/lib"
|
|
6
|
-
import {
|
|
6
|
+
import { Check, ChevronRight, Circle } from "lucide-react"
|
|
7
7
|
import Link from "next/link"
|
|
8
8
|
|
|
9
9
|
const DropdownMenu = DropdownMenuPrimitive.Root
|
|
@@ -34,7 +34,7 @@ const DropdownMenuSubTrigger = React.forwardRef<
|
|
|
34
34
|
{...props}
|
|
35
35
|
>
|
|
36
36
|
{children}
|
|
37
|
-
<
|
|
37
|
+
<ChevronRight className="ml-auto" />
|
|
38
38
|
</DropdownMenuPrimitive.SubTrigger>
|
|
39
39
|
))
|
|
40
40
|
DropdownMenuSubTrigger.displayName =
|
|
@@ -126,7 +126,7 @@ const DropdownMenuCheckboxItem = React.forwardRef<
|
|
|
126
126
|
>
|
|
127
127
|
<span className="absolute left-2 flex h-3.5 w-3.5 items-center justify-center">
|
|
128
128
|
<DropdownMenuPrimitive.ItemIndicator>
|
|
129
|
-
<
|
|
129
|
+
<Check className="h-4 w-4" />
|
|
130
130
|
</DropdownMenuPrimitive.ItemIndicator>
|
|
131
131
|
</span>
|
|
132
132
|
{children}
|
|
@@ -149,7 +149,7 @@ const DropdownMenuRadioItem = React.forwardRef<
|
|
|
149
149
|
>
|
|
150
150
|
<span className="absolute left-2 flex h-3.5 w-3.5 items-center justify-center">
|
|
151
151
|
<DropdownMenuPrimitive.ItemIndicator>
|
|
152
|
-
<
|
|
152
|
+
<Circle className="h-2 w-2 fill-current" />
|
|
153
153
|
</DropdownMenuPrimitive.ItemIndicator>
|
|
154
154
|
</span>
|
|
155
155
|
{children}
|
|
@@ -40,6 +40,8 @@ export interface MarkdownMessageProps {
|
|
|
40
40
|
className?: string;
|
|
41
41
|
/** Whether the message is from the user (affects styling) */
|
|
42
42
|
isUser?: boolean;
|
|
43
|
+
/** Use compact size (text-xs instead of text-sm) */
|
|
44
|
+
isCompact?: boolean;
|
|
43
45
|
}
|
|
44
46
|
|
|
45
47
|
// Code block component with copy functionality
|
|
@@ -90,39 +92,45 @@ const CodeBlock: React.FC<CodeBlockProps> = ({ code, language, isUser }) => {
|
|
|
90
92
|
};
|
|
91
93
|
|
|
92
94
|
// Custom components for markdown in chat
|
|
93
|
-
// Base size: text-sm (14px) for
|
|
94
|
-
const createMarkdownComponents = (isUser: boolean = false): Components =>
|
|
95
|
+
// Base size: text-sm (14px) for normal, text-xs (12px) for compact
|
|
96
|
+
const createMarkdownComponents = (isUser: boolean = false, isCompact: boolean = false): Components => {
|
|
97
|
+
// Text size classes based on compact mode
|
|
98
|
+
const textSize = isCompact ? 'text-xs' : 'text-sm';
|
|
99
|
+
const headingBase = isCompact ? 'text-sm' : 'text-base';
|
|
100
|
+
const headingSm = isCompact ? 'text-xs' : 'text-sm';
|
|
101
|
+
|
|
102
|
+
return {
|
|
95
103
|
// Headings - scaled for chat context
|
|
96
104
|
h1: ({ children }) => (
|
|
97
|
-
<h1 className=
|
|
105
|
+
<h1 className={`${headingBase} font-bold mb-2 mt-3 first:mt-0`}>{children}</h1>
|
|
98
106
|
),
|
|
99
107
|
h2: ({ children }) => (
|
|
100
|
-
<h2 className=
|
|
108
|
+
<h2 className={`${headingSm} font-bold mb-2 mt-3 first:mt-0`}>{children}</h2>
|
|
101
109
|
),
|
|
102
110
|
h3: ({ children }) => (
|
|
103
|
-
<h3 className=
|
|
111
|
+
<h3 className={`${headingSm} font-semibold mb-1 mt-2 first:mt-0`}>{children}</h3>
|
|
104
112
|
),
|
|
105
113
|
h4: ({ children }) => (
|
|
106
|
-
<h4 className=
|
|
114
|
+
<h4 className={`${headingSm} font-semibold mb-1 mt-2 first:mt-0`}>{children}</h4>
|
|
107
115
|
),
|
|
108
116
|
h5: ({ children }) => (
|
|
109
|
-
<h5 className=
|
|
117
|
+
<h5 className={`${headingSm} font-medium mb-1 mt-2 first:mt-0`}>{children}</h5>
|
|
110
118
|
),
|
|
111
119
|
h6: ({ children }) => (
|
|
112
|
-
<h6 className=
|
|
120
|
+
<h6 className={`${headingSm} font-medium mb-1 mt-2 first:mt-0`}>{children}</h6>
|
|
113
121
|
),
|
|
114
122
|
|
|
115
123
|
// Paragraphs - compact spacing for chat
|
|
116
124
|
p: ({ children }) => (
|
|
117
|
-
<p className=
|
|
125
|
+
<p className={`${textSize} mb-2 last:mb-0 leading-relaxed break-words`}>{children}</p>
|
|
118
126
|
),
|
|
119
127
|
|
|
120
128
|
// Lists - compact
|
|
121
129
|
ul: ({ children }) => (
|
|
122
|
-
<ul className=
|
|
130
|
+
<ul className={`list-disc list-inside mb-2 space-y-1 ${textSize}`}>{children}</ul>
|
|
123
131
|
),
|
|
124
132
|
ol: ({ children }) => (
|
|
125
|
-
<ol className=
|
|
133
|
+
<ol className={`list-decimal list-inside mb-2 space-y-1 ${textSize}`}>{children}</ol>
|
|
126
134
|
),
|
|
127
135
|
li: ({ children }) => (
|
|
128
136
|
<li className="break-words">{children}</li>
|
|
@@ -132,7 +140,7 @@ const createMarkdownComponents = (isUser: boolean = false): Components => ({
|
|
|
132
140
|
a: ({ href, children }) => (
|
|
133
141
|
<a
|
|
134
142
|
href={href}
|
|
135
|
-
className=
|
|
143
|
+
className={`${textSize} text-primary underline hover:text-primary/80 transition-colors break-all`}
|
|
136
144
|
target={href?.startsWith('http') ? '_blank' : undefined}
|
|
137
145
|
rel={href?.startsWith('http') ? 'noopener noreferrer' : undefined}
|
|
138
146
|
>
|
|
@@ -239,7 +247,7 @@ const createMarkdownComponents = (isUser: boolean = false): Components => ({
|
|
|
239
247
|
|
|
240
248
|
// Blockquotes
|
|
241
249
|
blockquote: ({ children }) => (
|
|
242
|
-
<blockquote className=
|
|
250
|
+
<blockquote className={`${textSize} border-l-2 border-border pl-3 my-2 italic text-muted-foreground break-words`}>
|
|
243
251
|
{children}
|
|
244
252
|
</blockquote>
|
|
245
253
|
),
|
|
@@ -247,7 +255,7 @@ const createMarkdownComponents = (isUser: boolean = false): Components => ({
|
|
|
247
255
|
// Tables - compact for chat
|
|
248
256
|
table: ({ children }) => (
|
|
249
257
|
<div className="overflow-x-auto my-3">
|
|
250
|
-
<table className=
|
|
258
|
+
<table className={`min-w-full ${textSize} border-collapse`}>
|
|
251
259
|
{children}
|
|
252
260
|
</table>
|
|
253
261
|
</div>
|
|
@@ -282,7 +290,7 @@ const createMarkdownComponents = (isUser: boolean = false): Components => ({
|
|
|
282
290
|
em: ({ children }) => (
|
|
283
291
|
<em className="italic">{children}</em>
|
|
284
292
|
),
|
|
285
|
-
}
|
|
293
|
+
};};
|
|
286
294
|
|
|
287
295
|
/**
|
|
288
296
|
* MarkdownMessage - Renders markdown content with syntax highlighting and GFM support
|
|
@@ -306,13 +314,17 @@ export const MarkdownMessage: React.FC<MarkdownMessageProps> = ({
|
|
|
306
314
|
content,
|
|
307
315
|
className = "",
|
|
308
316
|
isUser = false,
|
|
317
|
+
isCompact = false,
|
|
309
318
|
}) => {
|
|
310
|
-
const components = React.useMemo(() => createMarkdownComponents(isUser), [isUser]);
|
|
319
|
+
const components = React.useMemo(() => createMarkdownComponents(isUser, isCompact), [isUser, isCompact]);
|
|
320
|
+
|
|
321
|
+
const textSizeClass = isCompact ? 'text-xs' : 'text-sm';
|
|
322
|
+
const proseClass = isCompact ? 'prose-xs' : 'prose-sm';
|
|
311
323
|
|
|
312
324
|
return (
|
|
313
325
|
<div
|
|
314
326
|
className={`
|
|
315
|
-
prose
|
|
327
|
+
prose ${proseClass} max-w-none break-words overflow-hidden ${textSizeClass}
|
|
316
328
|
${isUser ? 'prose-invert' : 'dark:prose-invert'}
|
|
317
329
|
${className}
|
|
318
330
|
`}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
import * as React from "react"
|
|
4
4
|
import * as MenubarPrimitive from "@radix-ui/react-menubar"
|
|
5
5
|
import { cn } from "@djangocfg/ui-core/lib"
|
|
6
|
-
import {
|
|
6
|
+
import { Check, ChevronRight, Circle } from "lucide-react"
|
|
7
7
|
import Link from "next/link"
|
|
8
8
|
|
|
9
9
|
function MenubarMenu({
|
|
@@ -82,7 +82,7 @@ const MenubarSubTrigger = React.forwardRef<
|
|
|
82
82
|
{...props}
|
|
83
83
|
>
|
|
84
84
|
{children}
|
|
85
|
-
<
|
|
85
|
+
<ChevronRight className="ml-auto h-4 w-4" />
|
|
86
86
|
</MenubarPrimitive.SubTrigger>
|
|
87
87
|
))
|
|
88
88
|
MenubarSubTrigger.displayName = MenubarPrimitive.SubTrigger.displayName
|
|
@@ -178,7 +178,7 @@ const MenubarCheckboxItem = React.forwardRef<
|
|
|
178
178
|
>
|
|
179
179
|
<span className="absolute left-2 flex h-3.5 w-3.5 items-center justify-center">
|
|
180
180
|
<MenubarPrimitive.ItemIndicator>
|
|
181
|
-
<
|
|
181
|
+
<Check className="h-4 w-4" />
|
|
182
182
|
</MenubarPrimitive.ItemIndicator>
|
|
183
183
|
</span>
|
|
184
184
|
{children}
|
|
@@ -200,7 +200,7 @@ const MenubarRadioItem = React.forwardRef<
|
|
|
200
200
|
>
|
|
201
201
|
<span className="absolute left-2 flex h-3.5 w-3.5 items-center justify-center">
|
|
202
202
|
<MenubarPrimitive.ItemIndicator>
|
|
203
|
-
<
|
|
203
|
+
<Circle className="h-4 w-4 fill-current" />
|
|
204
204
|
</MenubarPrimitive.ItemIndicator>
|
|
205
205
|
</span>
|
|
206
206
|
{children}
|
|
@@ -4,7 +4,7 @@ import * as React from "react"
|
|
|
4
4
|
import * as NavigationMenuPrimitive from "@radix-ui/react-navigation-menu"
|
|
5
5
|
import { cva } from "class-variance-authority"
|
|
6
6
|
import { cn } from "@djangocfg/ui-core/lib"
|
|
7
|
-
import {
|
|
7
|
+
import { ChevronDown } from "lucide-react"
|
|
8
8
|
import Link from "next/link"
|
|
9
9
|
|
|
10
10
|
const NavigationMenu = React.forwardRef<
|
|
@@ -56,7 +56,7 @@ const NavigationMenuTrigger = React.forwardRef<
|
|
|
56
56
|
{...props}
|
|
57
57
|
>
|
|
58
58
|
{children}{" "}
|
|
59
|
-
<
|
|
59
|
+
<ChevronDown
|
|
60
60
|
className="relative top-[1px] ml-1 h-3 w-3 transition duration-300 group-data-[state=open]:rotate-180"
|
|
61
61
|
aria-hidden="true"
|
|
62
62
|
/>
|
|
@@ -20,7 +20,7 @@ import {
|
|
|
20
20
|
TooltipProvider,
|
|
21
21
|
TooltipTrigger,
|
|
22
22
|
} from "@djangocfg/ui-core/components"
|
|
23
|
-
import {
|
|
23
|
+
import { PanelLeft } from "lucide-react"
|
|
24
24
|
import Link from "next/link"
|
|
25
25
|
|
|
26
26
|
const SIDEBAR_COOKIE_NAME = "sidebar_state"
|
|
@@ -322,7 +322,7 @@ const SidebarTrigger = React.forwardRef<
|
|
|
322
322
|
}}
|
|
323
323
|
{...props}
|
|
324
324
|
>
|
|
325
|
-
<
|
|
325
|
+
<PanelLeft />
|
|
326
326
|
<span className="sr-only">Toggle Sidebar</span>
|
|
327
327
|
</Button>
|
|
328
328
|
)
|