@cogito.ai/cli 0.4.1 → 0.4.3
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 +29 -22
- package/dist/index.js +9 -15
- package/dist/templates/web-nextjs/.github/copilot-instructions.md +5 -6
- package/dist/templates/web-nextjs/README.md +25 -24
- package/dist/templates/web-nextjs/apps/docs/.source/browser.ts +18 -8
- package/dist/templates/web-nextjs/apps/docs/.source/dynamic.ts +11 -5
- package/dist/templates/web-nextjs/apps/docs/.source/server.ts +37 -17
- package/dist/templates/web-nextjs/apps/docs/app/docs/[[...slug]]/page.tsx +1 -6
- package/dist/templates/web-nextjs/apps/docs/app/docs/layout.tsx +1 -4
- package/dist/templates/web-nextjs/apps/docs/app/llms-full.txt/route.ts +3 -1
- package/dist/templates/web-nextjs/apps/docs/next-env.d.ts +1 -1
- package/dist/templates/web-nextjs/apps/web/.github/copilot-instructions.md +53 -6
- package/dist/templates/web-nextjs/apps/web/.github/skills/impeccable/SKILL.md +55 -0
- package/dist/templates/web-nextjs/apps/web/DESIGN.md +65 -0
- package/dist/templates/web-nextjs/apps/web/messages/en.json +127 -1
- package/dist/templates/web-nextjs/apps/web/messages/zh.json +127 -1
- package/dist/templates/web-nextjs/apps/web/next-env.d.ts +1 -1
- package/dist/templates/web-nextjs/apps/web/next.config.ts +3 -3
- package/dist/templates/web-nextjs/apps/web/src/app/[locale]/(auth)/forgot-password/page.tsx +265 -0
- package/dist/templates/web-nextjs/apps/web/src/app/[locale]/(auth)/login/page.tsx +20 -4
- package/dist/templates/web-nextjs/apps/web/src/app/[locale]/(auth)/reset-password/page.tsx +115 -0
- package/dist/templates/web-nextjs/apps/web/src/app/[locale]/(auth)/signup/page.tsx +18 -17
- package/dist/templates/web-nextjs/apps/web/src/app/[locale]/(protected)/dashboard/page.tsx +1 -5
- package/dist/templates/web-nextjs/apps/web/src/app/[locale]/(protected)/settings/layout.tsx +5 -0
- package/dist/templates/web-nextjs/apps/web/src/app/[locale]/(protected)/settings/page.tsx +9 -0
- package/dist/templates/web-nextjs/apps/web/src/app/[locale]/(protected)/settings/profile/page.tsx +91 -0
- package/dist/templates/web-nextjs/apps/web/src/app/[locale]/about/page.tsx +22 -0
- package/dist/templates/web-nextjs/apps/web/src/app/[locale]/globals.css +17 -5
- package/dist/templates/web-nextjs/apps/web/src/app/[locale]/help/page.tsx +21 -0
- package/dist/templates/web-nextjs/apps/web/src/app/[locale]/layout.tsx +10 -8
- package/dist/templates/web-nextjs/apps/web/src/app/[locale]/page.tsx +22 -6
- package/dist/templates/web-nextjs/apps/web/src/app/[locale]/privacy/page.tsx +14 -15
- package/dist/templates/web-nextjs/apps/web/src/app/[locale]/terms/page.tsx +1 -5
- package/dist/templates/web-nextjs/apps/web/src/app/auth/callback/route.ts +7 -2
- package/dist/templates/web-nextjs/apps/web/src/components/dashboard/app-sidebar.tsx +37 -137
- package/dist/templates/web-nextjs/apps/web/src/components/dashboard/chart-area-interactive.tsx +122 -146
- package/dist/templates/web-nextjs/apps/web/src/components/dashboard/data-table.tsx +84 -149
- package/dist/templates/web-nextjs/apps/web/src/components/dashboard/nav-documents.tsx +7 -16
- package/dist/templates/web-nextjs/apps/web/src/components/dashboard/nav-main.tsx +4 -4
- package/dist/templates/web-nextjs/apps/web/src/components/dashboard/nav-secondary.tsx +4 -4
- package/dist/templates/web-nextjs/apps/web/src/components/dashboard/nav-user.tsx +17 -33
- package/dist/templates/web-nextjs/apps/web/src/components/dashboard/page.tsx +10 -13
- package/dist/templates/web-nextjs/apps/web/src/components/dashboard/section-cards.tsx +5 -9
- package/dist/templates/web-nextjs/apps/web/src/components/dashboard/site-header.tsx +6 -7
- package/dist/templates/web-nextjs/apps/web/src/components/landing/features.tsx +63 -0
- package/dist/templates/web-nextjs/apps/web/src/components/landing/footer.tsx +48 -0
- package/dist/templates/web-nextjs/apps/web/src/components/landing/header.tsx +97 -0
- package/dist/templates/web-nextjs/apps/web/src/components/landing/hero.tsx +45 -0
- package/dist/templates/web-nextjs/apps/web/src/components/landing/how-it-works.tsx +35 -0
- package/dist/templates/web-nextjs/apps/web/src/components/landing/pricing-teaser.tsx +23 -0
- package/dist/templates/web-nextjs/apps/web/src/components/profile/profile-form.tsx +66 -0
- package/dist/templates/web-nextjs/apps/web/src/components/providers/theme-provider.tsx +16 -0
- package/dist/templates/web-nextjs/apps/web/src/components/ui/alert-dialog.tsx +32 -49
- package/dist/templates/web-nextjs/apps/web/src/components/ui/alert.tsx +16 -23
- package/dist/templates/web-nextjs/apps/web/src/components/ui/avatar.tsx +25 -38
- package/dist/templates/web-nextjs/apps/web/src/components/ui/badge.tsx +16 -18
- package/dist/templates/web-nextjs/apps/web/src/components/ui/breadcrumb.tsx +19 -26
- package/dist/templates/web-nextjs/apps/web/src/components/ui/button.tsx +23 -24
- package/dist/templates/web-nextjs/apps/web/src/components/ui/card.tsx +19 -36
- package/dist/templates/web-nextjs/apps/web/src/components/ui/chart.tsx +60 -94
- package/dist/templates/web-nextjs/apps/web/src/components/ui/checkbox.tsx +8 -11
- package/dist/templates/web-nextjs/apps/web/src/components/ui/collapsible.tsx +5 -17
- package/dist/templates/web-nextjs/apps/web/src/components/ui/command.tsx +25 -48
- package/dist/templates/web-nextjs/apps/web/src/components/ui/dialog.tsx +21 -35
- package/dist/templates/web-nextjs/apps/web/src/components/ui/drawer.tsx +24 -35
- package/dist/templates/web-nextjs/apps/web/src/components/ui/dropdown-menu.tsx +26 -55
- package/dist/templates/web-nextjs/apps/web/src/components/ui/field.tsx +62 -76
- package/dist/templates/web-nextjs/apps/web/src/components/ui/form.tsx +19 -34
- package/dist/templates/web-nextjs/apps/web/src/components/ui/input-otp.tsx +13 -20
- package/dist/templates/web-nextjs/apps/web/src/components/ui/input.tsx +6 -6
- package/dist/templates/web-nextjs/apps/web/src/components/ui/label.tsx +6 -6
- package/dist/templates/web-nextjs/apps/web/src/components/ui/pagination.tsx +21 -42
- package/dist/templates/web-nextjs/apps/web/src/components/ui/popover.tsx +16 -31
- package/dist/templates/web-nextjs/apps/web/src/components/ui/progress.tsx +5 -8
- package/dist/templates/web-nextjs/apps/web/src/components/ui/radio-group.tsx +8 -8
- package/dist/templates/web-nextjs/apps/web/src/components/ui/scroll-area.tsx +10 -12
- package/dist/templates/web-nextjs/apps/web/src/components/ui/select.tsx +26 -41
- package/dist/templates/web-nextjs/apps/web/src/components/ui/separator.tsx +7 -7
- package/dist/templates/web-nextjs/apps/web/src/components/ui/sheet.tsx +29 -38
- package/dist/templates/web-nextjs/apps/web/src/components/ui/sidebar.tsx +157 -189
- package/dist/templates/web-nextjs/apps/web/src/components/ui/skeleton.tsx +3 -3
- package/dist/templates/web-nextjs/apps/web/src/components/ui/slider.tsx +10 -15
- package/dist/templates/web-nextjs/apps/web/src/components/ui/sonner.tsx +13 -7
- package/dist/templates/web-nextjs/apps/web/src/components/ui/switch.tsx +9 -9
- package/dist/templates/web-nextjs/apps/web/src/components/ui/table.tsx +24 -48
- package/dist/templates/web-nextjs/apps/web/src/components/ui/tabs.tsx +21 -31
- package/dist/templates/web-nextjs/apps/web/src/components/ui/textarea.tsx +5 -5
- package/dist/templates/web-nextjs/apps/web/src/components/ui/theme-toggle.tsx +23 -0
- package/dist/templates/web-nextjs/apps/web/src/components/ui/toggle-group.tsx +15 -16
- package/dist/templates/web-nextjs/apps/web/src/components/ui/toggle.tsx +14 -15
- package/dist/templates/web-nextjs/apps/web/src/components/ui/tooltip.tsx +8 -12
- package/dist/templates/web-nextjs/apps/web/src/core/repositories/IAuthRepository.ts +5 -0
- package/dist/templates/web-nextjs/apps/web/src/core/types/auth.ts +1 -3
- package/dist/templates/web-nextjs/apps/web/src/features/auth/__contract__.ts +6 -0
- package/dist/templates/web-nextjs/apps/web/src/features/auth/actions.ts +126 -1
- package/dist/templates/web-nextjs/apps/web/src/features/auth/index.ts +12 -1
- package/dist/templates/web-nextjs/apps/web/src/features/auth/server.ts +3 -0
- package/dist/templates/web-nextjs/apps/web/src/hooks/use-mobile.ts +4 -4
- package/dist/templates/web-nextjs/apps/web/src/i18n/config.ts +1 -1
- package/dist/templates/web-nextjs/apps/web/src/infra/db/SupabaseAuthRepository.ts +73 -4
- package/dist/templates/web-nextjs/apps/web/src/infra/db/client.ts +1 -4
- package/dist/templates/web-nextjs/apps/web/src/lib/utils.ts +2 -2
- package/dist/templates/web-nextjs/apps/web/src/lib/validations/auth.ts +34 -0
- package/dist/templates/web-nextjs/apps/web/src/styles/tokens.css +58 -0
- package/package.json +1 -1
|
@@ -1,92 +1,75 @@
|
|
|
1
|
-
import * as React from
|
|
1
|
+
import * as React from 'react'
|
|
2
2
|
|
|
3
|
-
import { cn } from
|
|
3
|
+
import { cn } from '@/lib/utils'
|
|
4
4
|
|
|
5
|
-
function Card({ className, ...props }: React.ComponentProps<
|
|
5
|
+
function Card({ className, ...props }: React.ComponentProps<'div'>) {
|
|
6
6
|
return (
|
|
7
7
|
<div
|
|
8
8
|
data-slot="card"
|
|
9
9
|
className={cn(
|
|
10
|
-
|
|
11
|
-
className
|
|
10
|
+
'flex flex-col gap-6 rounded-xl border bg-card py-6 text-card-foreground shadow-sm',
|
|
11
|
+
className,
|
|
12
12
|
)}
|
|
13
13
|
{...props}
|
|
14
14
|
/>
|
|
15
15
|
)
|
|
16
16
|
}
|
|
17
17
|
|
|
18
|
-
function CardHeader({ className, ...props }: React.ComponentProps<
|
|
18
|
+
function CardHeader({ className, ...props }: React.ComponentProps<'div'>) {
|
|
19
19
|
return (
|
|
20
20
|
<div
|
|
21
21
|
data-slot="card-header"
|
|
22
22
|
className={cn(
|
|
23
|
-
|
|
24
|
-
className
|
|
23
|
+
'@container/card-header grid auto-rows-min grid-rows-[auto_auto] items-start gap-2 px-6 has-data-[slot=card-action]:grid-cols-[1fr_auto] [.border-b]:pb-6',
|
|
24
|
+
className,
|
|
25
25
|
)}
|
|
26
26
|
{...props}
|
|
27
27
|
/>
|
|
28
28
|
)
|
|
29
29
|
}
|
|
30
30
|
|
|
31
|
-
function CardTitle({ className, ...props }: React.ComponentProps<
|
|
31
|
+
function CardTitle({ className, ...props }: React.ComponentProps<'div'>) {
|
|
32
32
|
return (
|
|
33
33
|
<div
|
|
34
34
|
data-slot="card-title"
|
|
35
|
-
className={cn(
|
|
35
|
+
className={cn('leading-none font-semibold', className)}
|
|
36
36
|
{...props}
|
|
37
37
|
/>
|
|
38
38
|
)
|
|
39
39
|
}
|
|
40
40
|
|
|
41
|
-
function CardDescription({ className, ...props }: React.ComponentProps<
|
|
41
|
+
function CardDescription({ className, ...props }: React.ComponentProps<'div'>) {
|
|
42
42
|
return (
|
|
43
43
|
<div
|
|
44
44
|
data-slot="card-description"
|
|
45
|
-
className={cn(
|
|
45
|
+
className={cn('text-sm text-muted-foreground', className)}
|
|
46
46
|
{...props}
|
|
47
47
|
/>
|
|
48
48
|
)
|
|
49
49
|
}
|
|
50
50
|
|
|
51
|
-
function CardAction({ className, ...props }: React.ComponentProps<
|
|
51
|
+
function CardAction({ className, ...props }: React.ComponentProps<'div'>) {
|
|
52
52
|
return (
|
|
53
53
|
<div
|
|
54
54
|
data-slot="card-action"
|
|
55
|
-
className={cn(
|
|
56
|
-
"col-start-2 row-span-2 row-start-1 self-start justify-self-end",
|
|
57
|
-
className
|
|
58
|
-
)}
|
|
55
|
+
className={cn('col-start-2 row-span-2 row-start-1 self-start justify-self-end', className)}
|
|
59
56
|
{...props}
|
|
60
57
|
/>
|
|
61
58
|
)
|
|
62
59
|
}
|
|
63
60
|
|
|
64
|
-
function CardContent({ className, ...props }: React.ComponentProps<
|
|
65
|
-
return (
|
|
66
|
-
<div
|
|
67
|
-
data-slot="card-content"
|
|
68
|
-
className={cn("px-6", className)}
|
|
69
|
-
{...props}
|
|
70
|
-
/>
|
|
71
|
-
)
|
|
61
|
+
function CardContent({ className, ...props }: React.ComponentProps<'div'>) {
|
|
62
|
+
return <div data-slot="card-content" className={cn('px-6', className)} {...props} />
|
|
72
63
|
}
|
|
73
64
|
|
|
74
|
-
function CardFooter({ className, ...props }: React.ComponentProps<
|
|
65
|
+
function CardFooter({ className, ...props }: React.ComponentProps<'div'>) {
|
|
75
66
|
return (
|
|
76
67
|
<div
|
|
77
68
|
data-slot="card-footer"
|
|
78
|
-
className={cn(
|
|
69
|
+
className={cn('flex items-center px-6 [.border-t]:pt-6', className)}
|
|
79
70
|
{...props}
|
|
80
71
|
/>
|
|
81
72
|
)
|
|
82
73
|
}
|
|
83
74
|
|
|
84
|
-
export {
|
|
85
|
-
Card,
|
|
86
|
-
CardHeader,
|
|
87
|
-
CardFooter,
|
|
88
|
-
CardTitle,
|
|
89
|
-
CardAction,
|
|
90
|
-
CardDescription,
|
|
91
|
-
CardContent,
|
|
92
|
-
}
|
|
75
|
+
export { Card, CardHeader, CardFooter, CardTitle, CardAction, CardDescription, CardContent }
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
|
|
1
|
+
'use client'
|
|
2
2
|
|
|
3
|
-
import * as React from
|
|
4
|
-
import * as RechartsPrimitive from
|
|
5
|
-
import type { TooltipValueType } from
|
|
3
|
+
import * as React from 'react'
|
|
4
|
+
import * as RechartsPrimitive from 'recharts'
|
|
5
|
+
import type { TooltipValueType } from 'recharts'
|
|
6
6
|
|
|
7
|
-
import { cn } from
|
|
7
|
+
import { cn } from '@/lib/utils'
|
|
8
8
|
|
|
9
9
|
// Format: { THEME_NAME: CSS_SELECTOR }
|
|
10
|
-
const THEMES = { light:
|
|
10
|
+
const THEMES = { light: '', dark: '.dark' } as const
|
|
11
11
|
|
|
12
12
|
const INITIAL_DIMENSION = { width: 320, height: 200 } as const
|
|
13
13
|
type TooltipNameType = number | string
|
|
@@ -33,7 +33,7 @@ function useChart() {
|
|
|
33
33
|
const context = React.useContext(ChartContext)
|
|
34
34
|
|
|
35
35
|
if (!context) {
|
|
36
|
-
throw new Error(
|
|
36
|
+
throw new Error('useChart must be used within a <ChartContainer />')
|
|
37
37
|
}
|
|
38
38
|
|
|
39
39
|
return context
|
|
@@ -46,18 +46,16 @@ function ChartContainer({
|
|
|
46
46
|
config,
|
|
47
47
|
initialDimension = INITIAL_DIMENSION,
|
|
48
48
|
...props
|
|
49
|
-
}: React.ComponentProps<
|
|
49
|
+
}: React.ComponentProps<'div'> & {
|
|
50
50
|
config: ChartConfig
|
|
51
|
-
children: React.ComponentProps<
|
|
52
|
-
typeof RechartsPrimitive.ResponsiveContainer
|
|
53
|
-
>["children"]
|
|
51
|
+
children: React.ComponentProps<typeof RechartsPrimitive.ResponsiveContainer>['children']
|
|
54
52
|
initialDimension?: {
|
|
55
53
|
width: number
|
|
56
54
|
height: number
|
|
57
55
|
}
|
|
58
56
|
}) {
|
|
59
57
|
const uniqueId = React.useId()
|
|
60
|
-
const chartId = `chart-${id ?? uniqueId.replace(/:/g,
|
|
58
|
+
const chartId = `chart-${id ?? uniqueId.replace(/:/g, '')}`
|
|
61
59
|
|
|
62
60
|
return (
|
|
63
61
|
<ChartContext.Provider value={{ config }}>
|
|
@@ -66,14 +64,12 @@ function ChartContainer({
|
|
|
66
64
|
data-chart={chartId}
|
|
67
65
|
className={cn(
|
|
68
66
|
"flex aspect-video justify-center text-xs [&_.recharts-cartesian-axis-tick_text]:fill-muted-foreground [&_.recharts-cartesian-grid_line[stroke='#ccc']]:stroke-border/50 [&_.recharts-curve.recharts-tooltip-cursor]:stroke-border [&_.recharts-dot[stroke='#fff']]:stroke-transparent [&_.recharts-layer]:outline-hidden [&_.recharts-polar-grid_[stroke='#ccc']]:stroke-border [&_.recharts-radial-bar-background-sector]:fill-muted [&_.recharts-rectangle.recharts-tooltip-cursor]:fill-muted [&_.recharts-reference-line_[stroke='#ccc']]:stroke-border [&_.recharts-sector]:outline-hidden [&_.recharts-sector[stroke='#fff']]:stroke-transparent [&_.recharts-surface]:outline-hidden",
|
|
69
|
-
className
|
|
67
|
+
className,
|
|
70
68
|
)}
|
|
71
69
|
{...props}
|
|
72
70
|
>
|
|
73
71
|
<ChartStyle id={chartId} config={config} />
|
|
74
|
-
<RechartsPrimitive.ResponsiveContainer
|
|
75
|
-
initialDimension={initialDimension}
|
|
76
|
-
>
|
|
72
|
+
<RechartsPrimitive.ResponsiveContainer initialDimension={initialDimension}>
|
|
77
73
|
{children}
|
|
78
74
|
</RechartsPrimitive.ResponsiveContainer>
|
|
79
75
|
</div>
|
|
@@ -82,9 +78,7 @@ function ChartContainer({
|
|
|
82
78
|
}
|
|
83
79
|
|
|
84
80
|
const ChartStyle = ({ id, config }: { id: string; config: ChartConfig }) => {
|
|
85
|
-
const colorConfig = Object.entries(config).filter(
|
|
86
|
-
([, config]) => config.theme ?? config.color
|
|
87
|
-
)
|
|
81
|
+
const colorConfig = Object.entries(config).filter(([, config]) => config.theme ?? config.color)
|
|
88
82
|
|
|
89
83
|
if (!colorConfig.length) {
|
|
90
84
|
return null
|
|
@@ -99,16 +93,14 @@ const ChartStyle = ({ id, config }: { id: string; config: ChartConfig }) => {
|
|
|
99
93
|
${prefix} [data-chart=${id}] {
|
|
100
94
|
${colorConfig
|
|
101
95
|
.map(([key, itemConfig]) => {
|
|
102
|
-
const color =
|
|
103
|
-
itemConfig.theme?.[theme as keyof typeof itemConfig.theme] ??
|
|
104
|
-
itemConfig.color
|
|
96
|
+
const color = itemConfig.theme?.[theme as keyof typeof itemConfig.theme] ?? itemConfig.color
|
|
105
97
|
return color ? ` --color-${key}: ${color};` : null
|
|
106
98
|
})
|
|
107
|
-
.join(
|
|
99
|
+
.join('\n')}
|
|
108
100
|
}
|
|
109
|
-
|
|
101
|
+
`,
|
|
110
102
|
)
|
|
111
|
-
.join(
|
|
103
|
+
.join('\n'),
|
|
112
104
|
}}
|
|
113
105
|
/>
|
|
114
106
|
)
|
|
@@ -120,7 +112,7 @@ function ChartTooltipContent({
|
|
|
120
112
|
active,
|
|
121
113
|
payload,
|
|
122
114
|
className,
|
|
123
|
-
indicator =
|
|
115
|
+
indicator = 'dot',
|
|
124
116
|
hideLabel = false,
|
|
125
117
|
hideIndicator = false,
|
|
126
118
|
label,
|
|
@@ -131,18 +123,15 @@ function ChartTooltipContent({
|
|
|
131
123
|
nameKey,
|
|
132
124
|
labelKey,
|
|
133
125
|
}: React.ComponentProps<typeof RechartsPrimitive.Tooltip> &
|
|
134
|
-
React.ComponentProps<
|
|
126
|
+
React.ComponentProps<'div'> & {
|
|
135
127
|
hideLabel?: boolean
|
|
136
128
|
hideIndicator?: boolean
|
|
137
|
-
indicator?:
|
|
129
|
+
indicator?: 'line' | 'dot' | 'dashed'
|
|
138
130
|
nameKey?: string
|
|
139
131
|
labelKey?: string
|
|
140
132
|
} & Omit<
|
|
141
|
-
RechartsPrimitive.DefaultTooltipContentProps<
|
|
142
|
-
|
|
143
|
-
TooltipNameType
|
|
144
|
-
>,
|
|
145
|
-
"accessibilityLayer"
|
|
133
|
+
RechartsPrimitive.DefaultTooltipContentProps<TooltipValueType, TooltipNameType>,
|
|
134
|
+
'accessibilityLayer'
|
|
146
135
|
>) {
|
|
147
136
|
const { config } = useChart()
|
|
148
137
|
|
|
@@ -152,18 +141,14 @@ function ChartTooltipContent({
|
|
|
152
141
|
}
|
|
153
142
|
|
|
154
143
|
const [item] = payload
|
|
155
|
-
const key = `${labelKey ?? item?.dataKey ?? item?.name ??
|
|
144
|
+
const key = `${labelKey ?? item?.dataKey ?? item?.name ?? 'value'}`
|
|
156
145
|
const itemConfig = getPayloadConfigFromPayload(config, item, key)
|
|
157
146
|
const value =
|
|
158
|
-
!labelKey && typeof label ===
|
|
159
|
-
? (config[label]?.label ?? label)
|
|
160
|
-
: itemConfig?.label
|
|
147
|
+
!labelKey && typeof label === 'string' ? (config[label]?.label ?? label) : itemConfig?.label
|
|
161
148
|
|
|
162
149
|
if (labelFormatter) {
|
|
163
150
|
return (
|
|
164
|
-
<div className={cn(
|
|
165
|
-
{labelFormatter(value, payload)}
|
|
166
|
-
</div>
|
|
151
|
+
<div className={cn('font-medium', labelClassName)}>{labelFormatter(value, payload)}</div>
|
|
167
152
|
)
|
|
168
153
|
}
|
|
169
154
|
|
|
@@ -171,36 +156,28 @@ function ChartTooltipContent({
|
|
|
171
156
|
return null
|
|
172
157
|
}
|
|
173
158
|
|
|
174
|
-
return <div className={cn(
|
|
175
|
-
}, [
|
|
176
|
-
label,
|
|
177
|
-
labelFormatter,
|
|
178
|
-
payload,
|
|
179
|
-
hideLabel,
|
|
180
|
-
labelClassName,
|
|
181
|
-
config,
|
|
182
|
-
labelKey,
|
|
183
|
-
])
|
|
159
|
+
return <div className={cn('font-medium', labelClassName)}>{value}</div>
|
|
160
|
+
}, [label, labelFormatter, payload, hideLabel, labelClassName, config, labelKey])
|
|
184
161
|
|
|
185
162
|
if (!active || !payload?.length) {
|
|
186
163
|
return null
|
|
187
164
|
}
|
|
188
165
|
|
|
189
|
-
const nestLabel = payload.length === 1 && indicator !==
|
|
166
|
+
const nestLabel = payload.length === 1 && indicator !== 'dot'
|
|
190
167
|
|
|
191
168
|
return (
|
|
192
169
|
<div
|
|
193
170
|
className={cn(
|
|
194
|
-
|
|
195
|
-
className
|
|
171
|
+
'grid min-w-[8rem] items-start gap-1.5 rounded-lg border border-border/50 bg-background px-2.5 py-1.5 text-xs shadow-xl',
|
|
172
|
+
className,
|
|
196
173
|
)}
|
|
197
174
|
>
|
|
198
175
|
{!nestLabel ? tooltipLabel : null}
|
|
199
176
|
<div className="grid gap-1.5">
|
|
200
177
|
{payload
|
|
201
|
-
.filter((item) => item.type !==
|
|
178
|
+
.filter((item) => item.type !== 'none')
|
|
202
179
|
.map((item, index) => {
|
|
203
|
-
const key = `${nameKey ?? item.name ?? item.dataKey ??
|
|
180
|
+
const key = `${nameKey ?? item.name ?? item.dataKey ?? 'value'}`
|
|
204
181
|
const itemConfig = getPayloadConfigFromPayload(config, item, key)
|
|
205
182
|
const indicatorColor = color ?? item.payload?.fill ?? item.color
|
|
206
183
|
|
|
@@ -208,8 +185,8 @@ function ChartTooltipContent({
|
|
|
208
185
|
<div
|
|
209
186
|
key={index}
|
|
210
187
|
className={cn(
|
|
211
|
-
|
|
212
|
-
indicator ===
|
|
188
|
+
'flex w-full flex-wrap items-stretch gap-2 [&>svg]:h-2.5 [&>svg]:w-2.5 [&>svg]:text-muted-foreground',
|
|
189
|
+
indicator === 'dot' && 'items-center',
|
|
213
190
|
)}
|
|
214
191
|
>
|
|
215
192
|
{formatter && item?.value !== undefined && item.name ? (
|
|
@@ -222,19 +199,19 @@ function ChartTooltipContent({
|
|
|
222
199
|
!hideIndicator && (
|
|
223
200
|
<div
|
|
224
201
|
className={cn(
|
|
225
|
-
|
|
202
|
+
'shrink-0 rounded-[2px] border-(--color-border) bg-(--color-bg)',
|
|
226
203
|
{
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
indicator ===
|
|
231
|
-
|
|
232
|
-
}
|
|
204
|
+
'h-2.5 w-2.5': indicator === 'dot',
|
|
205
|
+
'w-1': indicator === 'line',
|
|
206
|
+
'w-0 border-[1.5px] border-dashed bg-transparent':
|
|
207
|
+
indicator === 'dashed',
|
|
208
|
+
'my-0.5': nestLabel && indicator === 'dashed',
|
|
209
|
+
},
|
|
233
210
|
)}
|
|
234
211
|
style={
|
|
235
212
|
{
|
|
236
|
-
|
|
237
|
-
|
|
213
|
+
'--color-bg': indicatorColor,
|
|
214
|
+
'--color-border': indicatorColor,
|
|
238
215
|
} as React.CSSProperties
|
|
239
216
|
}
|
|
240
217
|
/>
|
|
@@ -242,8 +219,8 @@ function ChartTooltipContent({
|
|
|
242
219
|
)}
|
|
243
220
|
<div
|
|
244
221
|
className={cn(
|
|
245
|
-
|
|
246
|
-
nestLabel ?
|
|
222
|
+
'flex flex-1 justify-between leading-none',
|
|
223
|
+
nestLabel ? 'items-end' : 'items-center',
|
|
247
224
|
)}
|
|
248
225
|
>
|
|
249
226
|
<div className="grid gap-1.5">
|
|
@@ -254,7 +231,7 @@ function ChartTooltipContent({
|
|
|
254
231
|
</div>
|
|
255
232
|
{item.value != null && (
|
|
256
233
|
<span className="font-mono font-medium text-foreground tabular-nums">
|
|
257
|
-
{typeof item.value ===
|
|
234
|
+
{typeof item.value === 'number'
|
|
258
235
|
? item.value.toLocaleString()
|
|
259
236
|
: String(item.value)}
|
|
260
237
|
</span>
|
|
@@ -276,9 +253,9 @@ function ChartLegendContent({
|
|
|
276
253
|
className,
|
|
277
254
|
hideIcon = false,
|
|
278
255
|
payload,
|
|
279
|
-
verticalAlign =
|
|
256
|
+
verticalAlign = 'bottom',
|
|
280
257
|
nameKey,
|
|
281
|
-
}: React.ComponentProps<
|
|
258
|
+
}: React.ComponentProps<'div'> & {
|
|
282
259
|
hideIcon?: boolean
|
|
283
260
|
nameKey?: string
|
|
284
261
|
} & RechartsPrimitive.DefaultLegendContentProps) {
|
|
@@ -291,22 +268,22 @@ function ChartLegendContent({
|
|
|
291
268
|
return (
|
|
292
269
|
<div
|
|
293
270
|
className={cn(
|
|
294
|
-
|
|
295
|
-
verticalAlign ===
|
|
296
|
-
className
|
|
271
|
+
'flex items-center justify-center gap-4',
|
|
272
|
+
verticalAlign === 'top' ? 'pb-3' : 'pt-3',
|
|
273
|
+
className,
|
|
297
274
|
)}
|
|
298
275
|
>
|
|
299
276
|
{payload
|
|
300
|
-
.filter((item) => item.type !==
|
|
277
|
+
.filter((item) => item.type !== 'none')
|
|
301
278
|
.map((item, index) => {
|
|
302
|
-
const key = `${nameKey ?? item.dataKey ??
|
|
279
|
+
const key = `${nameKey ?? item.dataKey ?? 'value'}`
|
|
303
280
|
const itemConfig = getPayloadConfigFromPayload(config, item, key)
|
|
304
281
|
|
|
305
282
|
return (
|
|
306
283
|
<div
|
|
307
284
|
key={index}
|
|
308
285
|
className={cn(
|
|
309
|
-
|
|
286
|
+
'flex items-center gap-1.5 [&>svg]:h-3 [&>svg]:w-3 [&>svg]:text-muted-foreground',
|
|
310
287
|
)}
|
|
311
288
|
>
|
|
312
289
|
{itemConfig?.icon && !hideIcon ? (
|
|
@@ -328,37 +305,26 @@ function ChartLegendContent({
|
|
|
328
305
|
}
|
|
329
306
|
|
|
330
307
|
// Helper to extract item config from a payload.
|
|
331
|
-
function getPayloadConfigFromPayload(
|
|
332
|
-
|
|
333
|
-
payload: unknown,
|
|
334
|
-
key: string
|
|
335
|
-
) {
|
|
336
|
-
if (typeof payload !== "object" || payload === null) {
|
|
308
|
+
function getPayloadConfigFromPayload(config: ChartConfig, payload: unknown, key: string) {
|
|
309
|
+
if (typeof payload !== 'object' || payload === null) {
|
|
337
310
|
return undefined
|
|
338
311
|
}
|
|
339
312
|
|
|
340
313
|
const payloadPayload =
|
|
341
|
-
|
|
342
|
-
typeof payload.payload === "object" &&
|
|
343
|
-
payload.payload !== null
|
|
314
|
+
'payload' in payload && typeof payload.payload === 'object' && payload.payload !== null
|
|
344
315
|
? payload.payload
|
|
345
316
|
: undefined
|
|
346
317
|
|
|
347
318
|
let configLabelKey: string = key
|
|
348
319
|
|
|
349
|
-
if (
|
|
350
|
-
key in payload &&
|
|
351
|
-
typeof payload[key as keyof typeof payload] === "string"
|
|
352
|
-
) {
|
|
320
|
+
if (key in payload && typeof payload[key as keyof typeof payload] === 'string') {
|
|
353
321
|
configLabelKey = payload[key as keyof typeof payload] as string
|
|
354
322
|
} else if (
|
|
355
323
|
payloadPayload &&
|
|
356
324
|
key in payloadPayload &&
|
|
357
|
-
typeof payloadPayload[key as keyof typeof payloadPayload] ===
|
|
325
|
+
typeof payloadPayload[key as keyof typeof payloadPayload] === 'string'
|
|
358
326
|
) {
|
|
359
|
-
configLabelKey = payloadPayload[
|
|
360
|
-
key as keyof typeof payloadPayload
|
|
361
|
-
] as string
|
|
327
|
+
configLabelKey = payloadPayload[key as keyof typeof payloadPayload] as string
|
|
362
328
|
}
|
|
363
329
|
|
|
364
330
|
return configLabelKey in config ? config[configLabelKey] : config[key]
|
|
@@ -1,21 +1,18 @@
|
|
|
1
|
-
|
|
1
|
+
'use client'
|
|
2
2
|
|
|
3
|
-
import * as React from
|
|
4
|
-
import { CheckIcon } from
|
|
5
|
-
import { Checkbox as CheckboxPrimitive } from
|
|
3
|
+
import * as React from 'react'
|
|
4
|
+
import { CheckIcon } from 'lucide-react'
|
|
5
|
+
import { Checkbox as CheckboxPrimitive } from 'radix-ui'
|
|
6
6
|
|
|
7
|
-
import { cn } from
|
|
7
|
+
import { cn } from '@/lib/utils'
|
|
8
8
|
|
|
9
|
-
function Checkbox({
|
|
10
|
-
className,
|
|
11
|
-
...props
|
|
12
|
-
}: React.ComponentProps<typeof CheckboxPrimitive.Root>) {
|
|
9
|
+
function Checkbox({ className, ...props }: React.ComponentProps<typeof CheckboxPrimitive.Root>) {
|
|
13
10
|
return (
|
|
14
11
|
<CheckboxPrimitive.Root
|
|
15
12
|
data-slot="checkbox"
|
|
16
13
|
className={cn(
|
|
17
|
-
|
|
18
|
-
className
|
|
14
|
+
'peer size-4 shrink-0 rounded-[4px] border border-input shadow-xs transition-shadow outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 data-[state=checked]:border-primary data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground dark:bg-input/30 dark:aria-invalid:ring-destructive/40 dark:data-[state=checked]:bg-primary',
|
|
15
|
+
className,
|
|
19
16
|
)}
|
|
20
17
|
{...props}
|
|
21
18
|
>
|
|
@@ -1,33 +1,21 @@
|
|
|
1
|
-
|
|
1
|
+
'use client'
|
|
2
2
|
|
|
3
|
-
import { Collapsible as CollapsiblePrimitive } from
|
|
3
|
+
import { Collapsible as CollapsiblePrimitive } from 'radix-ui'
|
|
4
4
|
|
|
5
|
-
function Collapsible({
|
|
6
|
-
...props
|
|
7
|
-
}: React.ComponentProps<typeof CollapsiblePrimitive.Root>) {
|
|
5
|
+
function Collapsible({ ...props }: React.ComponentProps<typeof CollapsiblePrimitive.Root>) {
|
|
8
6
|
return <CollapsiblePrimitive.Root data-slot="collapsible" {...props} />
|
|
9
7
|
}
|
|
10
8
|
|
|
11
9
|
function CollapsibleTrigger({
|
|
12
10
|
...props
|
|
13
11
|
}: React.ComponentProps<typeof CollapsiblePrimitive.CollapsibleTrigger>) {
|
|
14
|
-
return
|
|
15
|
-
<CollapsiblePrimitive.CollapsibleTrigger
|
|
16
|
-
data-slot="collapsible-trigger"
|
|
17
|
-
{...props}
|
|
18
|
-
/>
|
|
19
|
-
)
|
|
12
|
+
return <CollapsiblePrimitive.CollapsibleTrigger data-slot="collapsible-trigger" {...props} />
|
|
20
13
|
}
|
|
21
14
|
|
|
22
15
|
function CollapsibleContent({
|
|
23
16
|
...props
|
|
24
17
|
}: React.ComponentProps<typeof CollapsiblePrimitive.CollapsibleContent>) {
|
|
25
|
-
return
|
|
26
|
-
<CollapsiblePrimitive.CollapsibleContent
|
|
27
|
-
data-slot="collapsible-content"
|
|
28
|
-
{...props}
|
|
29
|
-
/>
|
|
30
|
-
)
|
|
18
|
+
return <CollapsiblePrimitive.CollapsibleContent data-slot="collapsible-content" {...props} />
|
|
31
19
|
}
|
|
32
20
|
|
|
33
21
|
export { Collapsible, CollapsibleTrigger, CollapsibleContent }
|