@carlonicora/nextjs-jsonapi 1.112.1 → 1.114.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.
- package/dist/{AssistantInterface-B1c8FhGA.d.mts → AssistantInterface-B56qznuH.d.mts} +2 -0
- package/dist/{AssistantInterface-BBUHxOCd.d.ts → AssistantInterface-CHiJIYDY.d.ts} +2 -0
- package/dist/{AssistantMessageInterface-DrgHDjZ5.d.mts → AssistantMessageInterface-BuUZFkE5.d.mts} +16 -1
- package/dist/{AssistantMessageInterface-BNzf1etU.d.ts → AssistantMessageInterface-CQwh5tEb.d.ts} +16 -1
- package/dist/{BlockNoteEditor-HNQNKCFP.js → BlockNoteEditor-DT5L5AAB.js} +19 -19
- package/dist/{BlockNoteEditor-HNQNKCFP.js.map → BlockNoteEditor-DT5L5AAB.js.map} +1 -1
- package/dist/{BlockNoteEditor-A5LNFWHW.mjs → BlockNoteEditor-HIEAHXR4.mjs} +4 -4
- package/dist/billing/index.js +346 -346
- package/dist/billing/index.mjs +3 -3
- package/dist/{chunk-6XWW67F2.js → chunk-4BUZUKER.js} +7 -7
- package/dist/{chunk-6XWW67F2.js.map → chunk-4BUZUKER.js.map} +1 -1
- package/dist/{chunk-U2HR57MY.js → chunk-7EQ46GUL.js} +76 -25
- package/dist/chunk-7EQ46GUL.js.map +1 -0
- package/dist/{chunk-CWVYU4YZ.mjs → chunk-DJSH6VHF.mjs} +2 -2
- package/dist/{chunk-ZYPNVEHB.mjs → chunk-FBTTIGLL.mjs} +53 -2
- package/dist/{chunk-ZYPNVEHB.mjs.map → chunk-FBTTIGLL.mjs.map} +1 -1
- package/dist/{chunk-LYLGU2BK.mjs → chunk-TVOW47AP.mjs} +3011 -2853
- package/dist/chunk-TVOW47AP.mjs.map +1 -0
- package/dist/{chunk-DRJUN4R6.js → chunk-VA2KFKHD.js} +1080 -922
- package/dist/chunk-VA2KFKHD.js.map +1 -0
- package/dist/client/index.js +4 -4
- package/dist/client/index.mjs +3 -3
- package/dist/components/index.d.mts +56 -8
- package/dist/components/index.d.ts +56 -8
- package/dist/components/index.js +12 -4
- package/dist/components/index.js.map +1 -1
- package/dist/components/index.mjs +11 -3
- package/dist/contexts/index.d.mts +7 -2
- package/dist/contexts/index.d.ts +7 -2
- package/dist/contexts/index.js +4 -4
- package/dist/contexts/index.mjs +3 -3
- package/dist/core/index.d.mts +26 -4
- package/dist/core/index.d.ts +26 -4
- package/dist/core/index.js +2 -2
- package/dist/core/index.mjs +1 -1
- package/dist/features/help/index.js +36 -36
- package/dist/features/help/index.mjs +3 -3
- package/dist/index.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +3 -3
- package/dist/index.mjs +2 -2
- package/dist/server/index.js +3 -3
- package/dist/server/index.mjs +1 -1
- package/package.json +1 -1
- package/src/components/tables/ContentListTable.tsx +2 -1
- package/src/features/assistant/components/containers/AssistantContainer.tsx +18 -2
- package/src/features/assistant/components/parts/AssistantEmptyState.tsx +22 -1
- package/src/features/assistant/components/parts/AssistantThread.tsx +12 -1
- package/src/features/assistant/contexts/AssistantContext.tsx +42 -9
- package/src/features/assistant/contexts/__tests__/AssistantContext.spec.tsx +94 -3
- package/src/features/assistant/data/Assistant.ts +6 -0
- package/src/features/assistant/data/AssistantInterface.ts +2 -0
- package/src/features/assistant/data/AssistantService.ts +38 -0
- package/src/features/assistant/data/__tests__/Assistant.spec.ts +30 -0
- package/src/features/assistant-message/AssistantMessageModule.ts +2 -0
- package/src/features/assistant-message/components/MessageItem.tsx +26 -4
- package/src/features/assistant-message/components/MessageList.tsx +4 -2
- package/src/features/assistant-message/data/AssistantMessage.ts +21 -1
- package/src/features/assistant-message/data/AssistantMessageInterface.ts +16 -0
- package/src/shadcnui/index.ts +3 -0
- package/src/shadcnui/ui/__tests__/confirm-dialog.test.tsx +46 -0
- package/src/shadcnui/ui/__tests__/empty-state.test.tsx +26 -0
- package/src/shadcnui/ui/__tests__/spinner.test.tsx +18 -0
- package/src/shadcnui/ui/confirm-dialog.tsx +79 -0
- package/src/shadcnui/ui/empty-state.tsx +32 -0
- package/src/shadcnui/ui/spinner.tsx +36 -0
- package/dist/chunk-DRJUN4R6.js.map +0 -1
- package/dist/chunk-LYLGU2BK.mjs.map +0 -1
- package/dist/chunk-U2HR57MY.js.map +0 -1
- /package/dist/{BlockNoteEditor-A5LNFWHW.mjs.map → BlockNoteEditor-HIEAHXR4.mjs.map} +0 -0
- /package/dist/{chunk-CWVYU4YZ.mjs.map → chunk-DJSH6VHF.mjs.map} +0 -0
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
|
|
5
|
+
import {
|
|
6
|
+
AlertDialog,
|
|
7
|
+
AlertDialogCancel,
|
|
8
|
+
AlertDialogContent,
|
|
9
|
+
AlertDialogDescription,
|
|
10
|
+
AlertDialogFooter,
|
|
11
|
+
AlertDialogHeader,
|
|
12
|
+
AlertDialogTitle,
|
|
13
|
+
} from "@/components/ui/alert-dialog";
|
|
14
|
+
import { Button } from "@/components/ui/button";
|
|
15
|
+
|
|
16
|
+
type ConfirmDialogProps = {
|
|
17
|
+
open: boolean;
|
|
18
|
+
onOpenChange: (open: boolean) => void;
|
|
19
|
+
title: string;
|
|
20
|
+
description?: React.ReactNode;
|
|
21
|
+
confirmLabel: string;
|
|
22
|
+
cancelLabel: string;
|
|
23
|
+
destructive?: boolean;
|
|
24
|
+
onConfirm: () => void | Promise<void>;
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Convenience confirmation dialog. Controlled-only and trigger-less by design:
|
|
29
|
+
* callers render their own trigger Button and own the open state, which avoids
|
|
30
|
+
* every trigger-composition pitfall (no asChild, no nested <button>).
|
|
31
|
+
*/
|
|
32
|
+
function ConfirmDialog({
|
|
33
|
+
open,
|
|
34
|
+
onOpenChange,
|
|
35
|
+
title,
|
|
36
|
+
description,
|
|
37
|
+
confirmLabel,
|
|
38
|
+
cancelLabel,
|
|
39
|
+
destructive = false,
|
|
40
|
+
onConfirm,
|
|
41
|
+
}: ConfirmDialogProps) {
|
|
42
|
+
const [pending, setPending] = React.useState(false);
|
|
43
|
+
|
|
44
|
+
const handleConfirm = async () => {
|
|
45
|
+
try {
|
|
46
|
+
setPending(true);
|
|
47
|
+
await onConfirm();
|
|
48
|
+
onOpenChange(false);
|
|
49
|
+
} catch {
|
|
50
|
+
// A rejecting onConfirm keeps the dialog open; the caller owns user-facing
|
|
51
|
+
// error feedback inside onConfirm.
|
|
52
|
+
} finally {
|
|
53
|
+
setPending(false);
|
|
54
|
+
}
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
return (
|
|
58
|
+
<AlertDialog open={open} onOpenChange={(next) => !pending && onOpenChange(next)}>
|
|
59
|
+
<AlertDialogContent>
|
|
60
|
+
<AlertDialogHeader>
|
|
61
|
+
<AlertDialogTitle>{title}</AlertDialogTitle>
|
|
62
|
+
{description && <AlertDialogDescription>{description}</AlertDialogDescription>}
|
|
63
|
+
</AlertDialogHeader>
|
|
64
|
+
<AlertDialogFooter>
|
|
65
|
+
<AlertDialogCancel disabled={pending}>{cancelLabel}</AlertDialogCancel>
|
|
66
|
+
<Button
|
|
67
|
+
variant={destructive ? "destructive" : "default"}
|
|
68
|
+
onClick={() => void handleConfirm()}
|
|
69
|
+
disabled={pending}
|
|
70
|
+
>
|
|
71
|
+
{confirmLabel}
|
|
72
|
+
</Button>
|
|
73
|
+
</AlertDialogFooter>
|
|
74
|
+
</AlertDialogContent>
|
|
75
|
+
</AlertDialog>
|
|
76
|
+
);
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
export { ConfirmDialog, type ConfirmDialogProps };
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { LucideIcon } from "lucide-react";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
|
|
4
|
+
import { cn } from "@/lib/utils";
|
|
5
|
+
|
|
6
|
+
type EmptyStateProps = React.ComponentProps<"div"> & {
|
|
7
|
+
icon?: LucideIcon;
|
|
8
|
+
title: string;
|
|
9
|
+
description?: string;
|
|
10
|
+
action?: React.ReactNode;
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
function EmptyState({ icon: Icon, title, description, action, className, ...props }: EmptyStateProps) {
|
|
14
|
+
return (
|
|
15
|
+
<div
|
|
16
|
+
data-slot="empty-state"
|
|
17
|
+
className={cn("flex flex-col items-center justify-center gap-1.5 rounded-md p-6 text-center", className)}
|
|
18
|
+
{...props}
|
|
19
|
+
>
|
|
20
|
+
{Icon && (
|
|
21
|
+
<div className="bg-muted text-muted-foreground mb-1 inline-flex size-8 items-center justify-center rounded-md">
|
|
22
|
+
<Icon className="size-4" />
|
|
23
|
+
</div>
|
|
24
|
+
)}
|
|
25
|
+
<div className="text-sm font-medium">{title}</div>
|
|
26
|
+
{description && <div className="text-muted-foreground text-xs/relaxed">{description}</div>}
|
|
27
|
+
{action && <div className="mt-2">{action}</div>}
|
|
28
|
+
</div>
|
|
29
|
+
);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export { EmptyState };
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { cva, type VariantProps } from "class-variance-authority";
|
|
2
|
+
import { Loader2Icon } from "lucide-react";
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
|
|
5
|
+
import { cn } from "@/lib/utils";
|
|
6
|
+
|
|
7
|
+
const spinnerVariants = cva("animate-spin", {
|
|
8
|
+
variants: {
|
|
9
|
+
size: {
|
|
10
|
+
sm: "size-3.5",
|
|
11
|
+
default: "size-4",
|
|
12
|
+
lg: "size-8",
|
|
13
|
+
},
|
|
14
|
+
},
|
|
15
|
+
defaultVariants: {
|
|
16
|
+
size: "default",
|
|
17
|
+
},
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
function Spinner({
|
|
21
|
+
className,
|
|
22
|
+
size,
|
|
23
|
+
...props
|
|
24
|
+
}: React.ComponentProps<typeof Loader2Icon> & VariantProps<typeof spinnerVariants>) {
|
|
25
|
+
return (
|
|
26
|
+
<Loader2Icon
|
|
27
|
+
data-slot="spinner"
|
|
28
|
+
role="status"
|
|
29
|
+
aria-label="Loading"
|
|
30
|
+
className={cn(spinnerVariants({ size, className }))}
|
|
31
|
+
{...props}
|
|
32
|
+
/>
|
|
33
|
+
);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export { Spinner, spinnerVariants };
|