@flowtomic/ui 0.1.13 → 0.1.15
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/components/atoms/actions/badge/badge.d.ts +1 -1
- package/dist/components/atoms/actions/button/button.d.ts +2 -2
- package/dist/components/atoms/data-display/calendar/calendar.d.ts +2 -1
- package/dist/components/atoms/data-display/calendar/calendar.d.ts.map +1 -1
- package/dist/components/atoms/data-display/calendar/calendar.js +7 -6
- package/dist/components/atoms/feedback/alert/alert.d.ts +1 -1
- package/dist/components/atoms/feedback/alert-dialog/alert-dialog.d.ts +2 -2
- package/dist/components/atoms/forms/input/input.d.ts +2 -2
- package/dist/components/atoms/forms/toggle/toggle.d.ts +2 -2
- package/dist/components/atoms/layout/sidebar/sidebar.d.ts +2 -2
- package/dist/components/atoms/navigation/command/command.d.ts +7 -7
- package/dist/components/molecules/data-display/chat-message/chat-message.d.ts +39 -0
- package/dist/components/molecules/data-display/chat-message/chat-message.d.ts.map +1 -0
- package/dist/components/molecules/data-display/chat-message/chat-message.js +85 -0
- package/dist/components/molecules/data-display/chat-message/index.d.ts +3 -0
- package/dist/components/molecules/data-display/chat-message/index.d.ts.map +1 -0
- package/dist/components/molecules/data-display/chat-message/index.js +1 -0
- package/dist/components/molecules/feedback/edit-chat-message-modal/edit-chat-message-modal.d.ts +20 -0
- package/dist/components/molecules/feedback/edit-chat-message-modal/edit-chat-message-modal.d.ts.map +1 -0
- package/dist/components/molecules/feedback/edit-chat-message-modal/edit-chat-message-modal.js +65 -0
- package/dist/components/molecules/feedback/edit-chat-message-modal/index.d.ts +3 -0
- package/dist/components/molecules/feedback/edit-chat-message-modal/index.d.ts.map +1 -0
- package/dist/components/molecules/feedback/edit-chat-message-modal/index.js +1 -0
- package/dist/components/molecules/forms/chat-input/chat-input.d.ts +46 -0
- package/dist/components/molecules/forms/chat-input/chat-input.d.ts.map +1 -0
- package/dist/components/molecules/forms/chat-input/chat-input.js +57 -0
- package/dist/components/molecules/forms/chat-input/index.d.ts +3 -0
- package/dist/components/molecules/forms/chat-input/index.d.ts.map +1 -0
- package/dist/components/molecules/forms/chat-input/index.js +1 -0
- package/dist/components/molecules/forms/item/item.d.ts +2 -2
- package/dist/components/molecules/index.d.ts +6 -0
- package/dist/components/molecules/index.d.ts.map +1 -1
- package/dist/components/molecules/index.js +3 -0
- package/dist/components/organisms/chat-log/chat-log.d.ts +30 -0
- package/dist/components/organisms/chat-log/chat-log.d.ts.map +1 -0
- package/dist/components/organisms/chat-log/chat-log.js +21 -0
- package/dist/components/organisms/chat-log/index.d.ts +3 -0
- package/dist/components/organisms/chat-log/index.d.ts.map +1 -0
- package/dist/components/organisms/chat-log/index.js +1 -0
- package/dist/components/organisms/form-layout/form-layout.d.ts.map +1 -1
- package/dist/components/organisms/index.d.ts +2 -0
- package/dist/components/organisms/index.d.ts.map +1 -1
- package/dist/components/organisms/index.js +1 -0
- package/dist/components/organisms/model-selector/model-selector.d.ts +1 -1
- package/dist/index.js +446 -446
- package/package.json +1 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { type VariantProps } from "class-variance-authority";
|
|
2
2
|
import React from "react";
|
|
3
3
|
declare const badgeVariants: (props?: ({
|
|
4
|
-
variant?: "
|
|
4
|
+
variant?: "default" | "destructive" | "outline" | "secondary" | "success" | "info" | "warning" | null | undefined;
|
|
5
5
|
size?: "sm" | "lg" | "md" | null | undefined;
|
|
6
6
|
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
7
7
|
export interface BadgeProps extends React.HTMLAttributes<HTMLDivElement>, VariantProps<typeof badgeVariants> {
|
|
@@ -2,8 +2,8 @@ import { type VariantProps } from "class-variance-authority";
|
|
|
2
2
|
import { type Transition } from "motion/react";
|
|
3
3
|
import * as React from "react";
|
|
4
4
|
declare const buttonVariants: (props?: ({
|
|
5
|
-
variant?: "link" | "
|
|
6
|
-
size?: "
|
|
5
|
+
variant?: "link" | "default" | "destructive" | "outline" | "secondary" | "ghost" | "success" | "info" | "natural" | null | undefined;
|
|
6
|
+
size?: "default" | "sm" | "lg" | "icon" | "icon-sm" | "icon-lg" | null | undefined;
|
|
7
7
|
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
8
8
|
export interface ButtonProps extends Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, "transition">, VariantProps<typeof buttonVariants> {
|
|
9
9
|
asChild?: boolean;
|
|
@@ -3,8 +3,9 @@ import { type DayButton, DayPicker } from "react-day-picker";
|
|
|
3
3
|
import { Button } from "../../actions/button/button";
|
|
4
4
|
export type CalendarProps = React.ComponentProps<typeof DayPicker> & {
|
|
5
5
|
buttonVariant?: React.ComponentProps<typeof Button>["variant"];
|
|
6
|
+
captionLayout?: "buttons" | "dropdown" | "dropdown-months" | "dropdown-years";
|
|
6
7
|
};
|
|
7
|
-
declare function Calendar({ className, classNames, showOutsideDays, captionLayout, buttonVariant, formatters, components, ...props }: CalendarProps): import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
declare function Calendar({ className, classNames, showOutsideDays, captionLayout: captionLayoutProp, buttonVariant, formatters, components, onMonthChange, ...props }: CalendarProps): import("react/jsx-runtime").JSX.Element;
|
|
8
9
|
declare namespace Calendar {
|
|
9
10
|
var displayName: string;
|
|
10
11
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"calendar.d.ts","sourceRoot":"","sources":["../../../../../src/components/atoms/data-display/calendar/calendar.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,KAAK,SAAS,EAAE,SAAS,EAAwB,MAAM,kBAAkB,CAAC;AAEnF,OAAO,EAAE,MAAM,EAAkB,MAAM,6BAA6B,CAAC;AAErE,MAAM,MAAM,aAAa,GAAG,KAAK,CAAC,cAAc,CAAC,OAAO,SAAS,CAAC,GAAG;IACnE,aAAa,CAAC,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,MAAM,CAAC,CAAC,SAAS,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"calendar.d.ts","sourceRoot":"","sources":["../../../../../src/components/atoms/data-display/calendar/calendar.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,KAAK,SAAS,EAAE,SAAS,EAAwB,MAAM,kBAAkB,CAAC;AAEnF,OAAO,EAAE,MAAM,EAAkB,MAAM,6BAA6B,CAAC;AAErE,MAAM,MAAM,aAAa,GAAG,KAAK,CAAC,cAAc,CAAC,OAAO,SAAS,CAAC,GAAG;IACnE,aAAa,CAAC,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,MAAM,CAAC,CAAC,SAAS,CAAC,CAAC;IAC/D,aAAa,CAAC,EAAE,SAAS,GAAG,UAAU,GAAG,iBAAiB,GAAG,gBAAgB,CAAC;CAC/E,CAAC;AAEF,iBAAS,QAAQ,CAAC,EAChB,SAAS,EACT,UAAU,EACV,eAAsB,EACtB,aAAa,EAAE,iBAAiB,EAChC,aAAuB,EACvB,UAAU,EACV,UAAU,EACV,aAAa,EACb,GAAG,KAAK,EACT,EAAE,aAAa,2CA0Hf;kBApIQ,QAAQ;;;AAwIjB,MAAM,MAAM,sBAAsB,GAAG,KAAK,CAAC,cAAc,CAAC,OAAO,SAAS,CAAC,CAAC;AAE5E,iBAAS,iBAAiB,CAAC,EAAE,SAAS,EAAE,GAAG,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,sBAAsB,2CA+BzF;kBA/BQ,iBAAiB;;;AAmC1B,OAAO,EAAE,QAAQ,EAAE,iBAAiB,EAAE,CAAC"}
|
|
@@ -4,9 +4,12 @@ import * as React from "react";
|
|
|
4
4
|
import { DayPicker, getDefaultClassNames } from "react-day-picker";
|
|
5
5
|
import { cn } from "@/lib/utils";
|
|
6
6
|
import { Button, buttonVariants } from "../../actions/button/button";
|
|
7
|
-
function Calendar({ className, classNames, showOutsideDays = true, captionLayout
|
|
7
|
+
function Calendar({ className, classNames, showOutsideDays = true, captionLayout: captionLayoutProp, buttonVariant = "ghost", formatters, components, onMonthChange, ...props }) {
|
|
8
8
|
const defaultClassNames = getDefaultClassNames();
|
|
9
|
-
|
|
9
|
+
const captionLayoutValue = !captionLayoutProp || captionLayoutProp === "buttons"
|
|
10
|
+
? undefined
|
|
11
|
+
: captionLayoutProp;
|
|
12
|
+
return (_jsx(DayPicker, { showOutsideDays: showOutsideDays, className: cn("bg-background group/calendar p-3 [--cell-size:--spacing(8)] [[data-slot=card-content]_&]:bg-transparent [[data-slot=popover-content]_&]:bg-transparent", String.raw `rtl:**:[.rdp-button\_next>svg]:rotate-180`, String.raw `rtl:**:[.rdp-button\_previous>svg]:rotate-180`, className), ...(captionLayoutValue !== undefined && { captionLayout: captionLayoutValue }), formatters: {
|
|
10
13
|
formatMonthDropdown: (date) => date.toLocaleString("default", { month: "short" }),
|
|
11
14
|
...formatters,
|
|
12
15
|
}, classNames: {
|
|
@@ -20,9 +23,7 @@ function Calendar({ className, classNames, showOutsideDays = true, captionLayout
|
|
|
20
23
|
dropdowns: cn("w-full flex items-center text-sm font-medium justify-center h-(--cell-size) gap-1.5", defaultClassNames.dropdowns),
|
|
21
24
|
dropdown_root: cn("relative has-focus:border-ring border border-input shadow-xs has-focus:ring-ring/50 has-focus:ring-[3px] rounded-md", defaultClassNames.dropdown_root),
|
|
22
25
|
dropdown: cn("absolute bg-popover inset-0 opacity-0", defaultClassNames.dropdown),
|
|
23
|
-
caption_label: cn("select-none font-medium
|
|
24
|
-
? "text-sm"
|
|
25
|
-
: "rounded-md pl-2 pr-1 flex items-center gap-1 text-sm h-8 [&>svg]:text-muted-foreground [&>svg]:size-3.5", defaultClassNames.caption_label),
|
|
26
|
+
caption_label: cn("select-none font-medium rounded-md pl-2 pr-1 flex items-center gap-1 text-sm h-8 [&>svg]:text-muted-foreground [&>svg]:size-3.5", defaultClassNames.caption_label),
|
|
26
27
|
table: "w-full border-collapse",
|
|
27
28
|
weekdays: cn("flex", defaultClassNames.weekdays),
|
|
28
29
|
weekday: cn("text-muted-foreground rounded-md flex-1 font-normal text-[0.8rem] select-none", defaultClassNames.weekday),
|
|
@@ -58,7 +59,7 @@ function Calendar({ className, classNames, showOutsideDays = true, captionLayout
|
|
|
58
59
|
return (_jsx("td", { ...props, children: _jsx("div", { className: "flex size-(--cell-size) items-center justify-center text-center", children: children }) }));
|
|
59
60
|
},
|
|
60
61
|
...components,
|
|
61
|
-
}, ...props }));
|
|
62
|
+
}, onMonthChange: onMonthChange, ...props }));
|
|
62
63
|
}
|
|
63
64
|
Calendar.displayName = "Calendar";
|
|
64
65
|
function CalendarDayButton({ className, day, modifiers, ...props }) {
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
import { type VariantProps } from "class-variance-authority";
|
|
15
15
|
import * as React from "react";
|
|
16
16
|
declare const alertVariants: (props?: ({
|
|
17
|
-
variant?: "default" | "
|
|
17
|
+
variant?: "default" | "destructive" | "success" | "info" | "warning" | null | undefined;
|
|
18
18
|
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
19
19
|
export interface AlertProps extends React.HTMLAttributes<HTMLDivElement>, VariantProps<typeof alertVariants> {
|
|
20
20
|
}
|
|
@@ -19,7 +19,7 @@ export type AlertDialogTriggerProps = React.ComponentPropsWithoutRef<typeof Aler
|
|
|
19
19
|
* Variantes de animação para AlertDialogContent
|
|
20
20
|
*/
|
|
21
21
|
declare const alertDialogContentVariants: (props?: ({
|
|
22
|
-
animation?: "center" | "
|
|
22
|
+
animation?: "center" | "bottom" | "left" | "right" | "top" | "depth" | "3d" | null | undefined;
|
|
23
23
|
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
24
24
|
export type AlertDialogContentProps = React.ComponentPropsWithoutRef<typeof AlertDialogPrimitive.Content> & VariantProps<typeof alertDialogContentVariants> & {
|
|
25
25
|
/**
|
|
@@ -61,7 +61,7 @@ declare const AlertDialogOverlay: React.ForwardRefExoticComponent<Omit<AlertDial
|
|
|
61
61
|
* Suporta animações 3D quando animation="3d"
|
|
62
62
|
*/
|
|
63
63
|
declare const AlertDialogContent: React.ForwardRefExoticComponent<Omit<AlertDialogPrimitive.AlertDialogContentProps & React.RefAttributes<HTMLDivElement>, "ref"> & VariantProps<(props?: ({
|
|
64
|
-
animation?: "center" | "
|
|
64
|
+
animation?: "center" | "bottom" | "left" | "right" | "top" | "depth" | "3d" | null | undefined;
|
|
65
65
|
} & import("class-variance-authority/types").ClassProp) | undefined) => string> & {
|
|
66
66
|
/**
|
|
67
67
|
* Habilita backdrop blur (apenas para animation="3d")
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { type VariantProps } from "class-variance-authority";
|
|
2
2
|
import React from "react";
|
|
3
3
|
declare const inputVariants: (props?: ({
|
|
4
|
-
size?: "
|
|
5
|
-
variant?: "default" | "
|
|
4
|
+
size?: "default" | "sm" | "lg" | null | undefined;
|
|
5
|
+
variant?: "default" | "success" | "error" | null | undefined;
|
|
6
6
|
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
7
7
|
export interface InputProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>, "size">, VariantProps<typeof inputVariants> {
|
|
8
8
|
label?: string;
|
|
@@ -2,8 +2,8 @@ import * as TogglePrimitive from "@radix-ui/react-toggle";
|
|
|
2
2
|
import { type VariantProps } from "class-variance-authority";
|
|
3
3
|
import type * as React from "react";
|
|
4
4
|
declare const toggleVariants: (props?: ({
|
|
5
|
-
variant?: "
|
|
6
|
-
size?: "
|
|
5
|
+
variant?: "default" | "outline" | null | undefined;
|
|
6
|
+
size?: "default" | "sm" | "lg" | null | undefined;
|
|
7
7
|
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
8
8
|
export interface ToggleProps extends React.ComponentProps<typeof TogglePrimitive.Root>, VariantProps<typeof toggleVariants> {
|
|
9
9
|
}
|
|
@@ -106,8 +106,8 @@ declare namespace SidebarMenuItem {
|
|
|
106
106
|
var displayName: string;
|
|
107
107
|
}
|
|
108
108
|
declare const sidebarMenuButtonVariants: (props?: ({
|
|
109
|
-
variant?: "
|
|
110
|
-
size?: "
|
|
109
|
+
variant?: "default" | "outline" | null | undefined;
|
|
110
|
+
size?: "default" | "sm" | "lg" | null | undefined;
|
|
111
111
|
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
112
112
|
export interface SidebarMenuButtonProps extends React.ComponentProps<"button">, VariantProps<typeof sidebarMenuButtonVariants> {
|
|
113
113
|
asChild?: boolean;
|
|
@@ -23,7 +23,7 @@ declare const Command: React.ForwardRefExoticComponent<Omit<{
|
|
|
23
23
|
ref?: React.Ref<HTMLDivElement>;
|
|
24
24
|
} & {
|
|
25
25
|
asChild?: boolean;
|
|
26
|
-
}, "
|
|
26
|
+
}, "asChild" | "key" | keyof React.HTMLAttributes<HTMLDivElement>> & {
|
|
27
27
|
label?: string;
|
|
28
28
|
shouldFilter?: boolean;
|
|
29
29
|
filter?: (value: string, search: string, keywords?: string[]) => number;
|
|
@@ -48,7 +48,7 @@ declare const CommandInput: React.ForwardRefExoticComponent<Omit<Omit<Pick<Pick<
|
|
|
48
48
|
ref?: React.Ref<HTMLInputElement>;
|
|
49
49
|
} & {
|
|
50
50
|
asChild?: boolean;
|
|
51
|
-
}, "
|
|
51
|
+
}, "asChild" | "key" | keyof React.InputHTMLAttributes<HTMLInputElement>>, "type" | "value" | "onChange"> & {
|
|
52
52
|
value?: string;
|
|
53
53
|
onValueChange?: (search: string) => void;
|
|
54
54
|
} & React.RefAttributes<HTMLInputElement>, "ref"> & React.RefAttributes<HTMLInputElement>>;
|
|
@@ -61,7 +61,7 @@ declare const CommandList: React.ForwardRefExoticComponent<Omit<{
|
|
|
61
61
|
ref?: React.Ref<HTMLDivElement>;
|
|
62
62
|
} & {
|
|
63
63
|
asChild?: boolean;
|
|
64
|
-
}, "
|
|
64
|
+
}, "asChild" | "key" | keyof React.HTMLAttributes<HTMLDivElement>> & {
|
|
65
65
|
label?: string;
|
|
66
66
|
} & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
67
67
|
/**
|
|
@@ -73,7 +73,7 @@ declare const CommandEmpty: React.ForwardRefExoticComponent<Omit<{
|
|
|
73
73
|
ref?: React.Ref<HTMLDivElement>;
|
|
74
74
|
} & {
|
|
75
75
|
asChild?: boolean;
|
|
76
|
-
}, "
|
|
76
|
+
}, "asChild" | "key" | keyof React.HTMLAttributes<HTMLDivElement>> & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
77
77
|
/**
|
|
78
78
|
* CommandGroup - Grupo do command
|
|
79
79
|
*/
|
|
@@ -83,7 +83,7 @@ declare const CommandGroup: React.ForwardRefExoticComponent<Omit<{
|
|
|
83
83
|
ref?: React.Ref<HTMLDivElement>;
|
|
84
84
|
} & {
|
|
85
85
|
asChild?: boolean;
|
|
86
|
-
}, "
|
|
86
|
+
}, "asChild" | "key" | keyof React.HTMLAttributes<HTMLDivElement>>, "value" | "heading"> & {
|
|
87
87
|
heading?: React.ReactNode;
|
|
88
88
|
value?: string;
|
|
89
89
|
forceMount?: boolean;
|
|
@@ -95,7 +95,7 @@ declare const CommandSeparator: React.ForwardRefExoticComponent<Omit<Pick<Pick<R
|
|
|
95
95
|
ref?: React.Ref<HTMLDivElement>;
|
|
96
96
|
} & {
|
|
97
97
|
asChild?: boolean;
|
|
98
|
-
}, "
|
|
98
|
+
}, "asChild" | "key" | keyof React.HTMLAttributes<HTMLDivElement>> & {
|
|
99
99
|
alwaysRender?: boolean;
|
|
100
100
|
} & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
101
101
|
/**
|
|
@@ -107,7 +107,7 @@ declare const CommandItem: React.ForwardRefExoticComponent<Omit<{
|
|
|
107
107
|
ref?: React.Ref<HTMLDivElement>;
|
|
108
108
|
} & {
|
|
109
109
|
asChild?: boolean;
|
|
110
|
-
}, "
|
|
110
|
+
}, "asChild" | "key" | keyof React.HTMLAttributes<HTMLDivElement>>, "disabled" | "value" | "onSelect"> & {
|
|
111
111
|
disabled?: boolean;
|
|
112
112
|
onSelect?: (value: string) => void;
|
|
113
113
|
value?: string;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ChatMessage Component - Flowtomic UI
|
|
3
|
+
*
|
|
4
|
+
* Componente genérico de mensagem de chat com suporte a markdown,
|
|
5
|
+
* tipos de mensagem customizáveis, badges e context menu
|
|
6
|
+
*/
|
|
7
|
+
import type { HTMLAttributes } from "react";
|
|
8
|
+
import * as React from "react";
|
|
9
|
+
export interface ChatMessageData {
|
|
10
|
+
id: string | number;
|
|
11
|
+
content: string;
|
|
12
|
+
sender: string;
|
|
13
|
+
timestamp: Date | string;
|
|
14
|
+
messageType?: string;
|
|
15
|
+
isSummary?: boolean;
|
|
16
|
+
}
|
|
17
|
+
export interface ChatMessageProps extends HTMLAttributes<HTMLDivElement> {
|
|
18
|
+
message: ChatMessageData;
|
|
19
|
+
onEdit?: (id: string | number) => void;
|
|
20
|
+
onDelete?: (id: string | number) => void;
|
|
21
|
+
onViewContext?: (id: string | number) => void;
|
|
22
|
+
renderMarkdown?: boolean;
|
|
23
|
+
messageTypeConfig?: Record<string, {
|
|
24
|
+
label: string;
|
|
25
|
+
badgeClassName?: string;
|
|
26
|
+
containerClassName?: string;
|
|
27
|
+
senderClassName?: string;
|
|
28
|
+
}>;
|
|
29
|
+
senderConfig?: Record<string, {
|
|
30
|
+
containerClassName?: string;
|
|
31
|
+
senderClassName?: string;
|
|
32
|
+
isSystem?: boolean;
|
|
33
|
+
}>;
|
|
34
|
+
formatTimestamp?: (timestamp: Date | string) => string;
|
|
35
|
+
showActions?: boolean;
|
|
36
|
+
showTimestamp?: boolean;
|
|
37
|
+
}
|
|
38
|
+
export declare const ChatMessage: React.ForwardRefExoticComponent<ChatMessageProps & React.RefAttributes<HTMLDivElement>>;
|
|
39
|
+
//# sourceMappingURL=chat-message.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chat-message.d.ts","sourceRoot":"","sources":["../../../../../src/components/molecules/data-display/chat-message/chat-message.tsx"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,KAAK,EAAE,cAAc,EAAa,MAAM,OAAO,CAAC;AACvD,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAW/B,MAAM,WAAW,eAAe;IAC9B,EAAE,EAAE,MAAM,GAAG,MAAM,CAAC;IACpB,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,IAAI,GAAG,MAAM,CAAC;IACzB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB;AAED,MAAM,WAAW,gBAAiB,SAAQ,cAAc,CAAC,cAAc,CAAC;IACtE,OAAO,EAAE,eAAe,CAAC;IACzB,MAAM,CAAC,EAAE,CAAC,EAAE,EAAE,MAAM,GAAG,MAAM,KAAK,IAAI,CAAC;IACvC,QAAQ,CAAC,EAAE,CAAC,EAAE,EAAE,MAAM,GAAG,MAAM,KAAK,IAAI,CAAC;IACzC,aAAa,CAAC,EAAE,CAAC,EAAE,EAAE,MAAM,GAAG,MAAM,KAAK,IAAI,CAAC;IAC9C,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,iBAAiB,CAAC,EAAE,MAAM,CACxB,MAAM,EACN;QACE,KAAK,EAAE,MAAM,CAAC;QACd,cAAc,CAAC,EAAE,MAAM,CAAC;QACxB,kBAAkB,CAAC,EAAE,MAAM,CAAC;QAC5B,eAAe,CAAC,EAAE,MAAM,CAAC;KAC1B,CACF,CAAC;IACF,YAAY,CAAC,EAAE,MAAM,CACnB,MAAM,EACN;QACE,kBAAkB,CAAC,EAAE,MAAM,CAAC;QAC5B,eAAe,CAAC,EAAE,MAAM,CAAC;QACzB,QAAQ,CAAC,EAAE,OAAO,CAAC;KACpB,CACF,CAAC;IACF,eAAe,CAAC,EAAE,CAAC,SAAS,EAAE,IAAI,GAAG,MAAM,KAAK,MAAM,CAAC;IACvD,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB;AA0CD,eAAO,MAAM,WAAW,yFAgKvB,CAAC"}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
/**
|
|
3
|
+
* ChatMessage Component - Flowtomic UI
|
|
4
|
+
*
|
|
5
|
+
* Componente genérico de mensagem de chat com suporte a markdown,
|
|
6
|
+
* tipos de mensagem customizáveis, badges e context menu
|
|
7
|
+
*/
|
|
8
|
+
import { Edit, Eye, MoreVertical, Trash2 } from "lucide-react";
|
|
9
|
+
import * as React from "react";
|
|
10
|
+
import ReactMarkdown from "react-markdown";
|
|
11
|
+
import { cn } from "@/lib/utils";
|
|
12
|
+
import { Badge, Button } from "../../../atoms";
|
|
13
|
+
import { ContextMenu, ContextMenuContent, ContextMenuItem, ContextMenuTrigger, } from "../../../atoms/actions/context-menu";
|
|
14
|
+
const defaultMessageTypeConfig = {
|
|
15
|
+
STORY: {
|
|
16
|
+
label: "STORY",
|
|
17
|
+
badgeClassName: "bg-blue-100 text-blue-700 dark:bg-blue-900/30 dark:text-blue-300",
|
|
18
|
+
containerClassName: "bg-blue-100 dark:bg-blue-900/30 border-blue-500",
|
|
19
|
+
senderClassName: "text-blue-700 dark:text-blue-300",
|
|
20
|
+
},
|
|
21
|
+
ACTION: {
|
|
22
|
+
label: "ACTION",
|
|
23
|
+
badgeClassName: "bg-amber-100 text-amber-700 dark:bg-amber-900/30 dark:text-amber-300",
|
|
24
|
+
containerClassName: "bg-yellow-50 dark:bg-yellow-900/20 border-yellow-500",
|
|
25
|
+
senderClassName: "text-yellow-700 dark:text-yellow-400",
|
|
26
|
+
},
|
|
27
|
+
SAY: {
|
|
28
|
+
label: "SAY",
|
|
29
|
+
badgeClassName: "bg-emerald-100 text-emerald-700 dark:bg-emerald-900/30 dark:text-emerald-300",
|
|
30
|
+
containerClassName: "bg-emerald-50 dark:bg-emerald-900/20 border-emerald-500",
|
|
31
|
+
senderClassName: "text-emerald-700 dark:text-emerald-400",
|
|
32
|
+
},
|
|
33
|
+
};
|
|
34
|
+
const defaultSenderConfig = {
|
|
35
|
+
Sistema: {
|
|
36
|
+
containerClassName: "text-center text-gray-500 dark:text-gray-400 text-sm italic",
|
|
37
|
+
isSystem: true,
|
|
38
|
+
},
|
|
39
|
+
Mestre: {
|
|
40
|
+
containerClassName: "bg-blue-100 dark:bg-blue-900/30 border-l-4 border-blue-500 p-4 rounded-r",
|
|
41
|
+
senderClassName: "text-blue-700 dark:text-blue-300 text-sm font-medium",
|
|
42
|
+
},
|
|
43
|
+
Narrador: {
|
|
44
|
+
containerClassName: "bg-blue-100 dark:bg-blue-900/30 border-l-4 border-blue-500 p-4 rounded-r",
|
|
45
|
+
senderClassName: "text-blue-700 dark:text-blue-300 text-sm font-medium",
|
|
46
|
+
},
|
|
47
|
+
};
|
|
48
|
+
const defaultFormatTimestamp = (timestamp) => {
|
|
49
|
+
return new Date(timestamp).toLocaleString();
|
|
50
|
+
};
|
|
51
|
+
export const ChatMessage = React.forwardRef(({ message, onEdit, onDelete, onViewContext, renderMarkdown = true, messageTypeConfig = defaultMessageTypeConfig, senderConfig = defaultSenderConfig, formatTimestamp = defaultFormatTimestamp, showActions = true, showTimestamp = true, className, ...props }, ref) => {
|
|
52
|
+
const typeConfig = message.messageType ? messageTypeConfig[message.messageType] : undefined;
|
|
53
|
+
const senderCfg = senderConfig[message.sender] || {
|
|
54
|
+
containerClassName: "bg-gray-100 dark:bg-gray-800/50 border-l-4 border-yellow-500 p-4 rounded-r",
|
|
55
|
+
senderClassName: "text-yellow-600 dark:text-yellow-400",
|
|
56
|
+
};
|
|
57
|
+
const isSystem = senderCfg.isSystem || message.sender === "Sistema";
|
|
58
|
+
const hasActions = showActions && (onEdit || onDelete || onViewContext);
|
|
59
|
+
const renderTypeBadge = () => {
|
|
60
|
+
if (!message.messageType || !typeConfig)
|
|
61
|
+
return null;
|
|
62
|
+
return (_jsx(Badge, { className: cn("text-[10px] font-medium ml-2", typeConfig.badgeClassName), children: typeConfig.label }));
|
|
63
|
+
};
|
|
64
|
+
const renderContent = () => {
|
|
65
|
+
if (renderMarkdown) {
|
|
66
|
+
return (_jsx(ReactMarkdown, { components: {
|
|
67
|
+
strong: ({ ...props }) => (_jsx("strong", { className: cn("font-bold", typeConfig?.senderClassName || senderCfg.senderClassName), ...props })),
|
|
68
|
+
em: ({ ...props }) => _jsx("em", { className: "italic", ...props }),
|
|
69
|
+
p: ({ ...props }) => _jsx("span", { ...props }),
|
|
70
|
+
}, children: message.content }));
|
|
71
|
+
}
|
|
72
|
+
return _jsx("span", { children: message.content });
|
|
73
|
+
};
|
|
74
|
+
// System message (centered, italic)
|
|
75
|
+
if (isSystem) {
|
|
76
|
+
return (_jsxs("div", { ref: ref, id: `message-${message.id}`, className: cn(message.isSummary
|
|
77
|
+
? "bg-purple-50 dark:bg-purple-900/20 border-l-4 border-purple-500"
|
|
78
|
+
: "", senderCfg.containerClassName, className), ...props, children: [renderContent(), showTimestamp && (_jsx("div", { className: "mt-1 text-[10px]", children: formatTimestamp(message.timestamp) }))] }));
|
|
79
|
+
}
|
|
80
|
+
// Regular message with actions
|
|
81
|
+
return (_jsxs("div", { ref: ref, id: `message-${message.id}`, className: cn(message.isSummary
|
|
82
|
+
? "bg-purple-50 dark:bg-purple-900/20 border-l-4 border-purple-500"
|
|
83
|
+
: "", typeConfig?.containerClassName || senderCfg.containerClassName, className), ...props, children: [_jsxs("div", { className: "flex items-center justify-between mb-1", children: [_jsxs("div", { className: cn("text-sm font-medium flex items-center gap-2", typeConfig?.senderClassName || senderCfg.senderClassName), children: [_jsx("span", { children: message.sender }), renderTypeBadge()] }), hasActions && (_jsxs(ContextMenu, { children: [_jsx(ContextMenuTrigger, { asChild: true, children: _jsx(Button, { variant: "ghost", size: "icon-sm", className: "p-1 hover:bg-gray-200 dark:hover:bg-gray-700/50 rounded transition-colors", title: "Op\u00E7\u00F5es da mensagem", children: _jsx(MoreVertical, { className: "w-3 h-4" }) }) }), _jsxs(ContextMenuContent, { children: [onEdit && (_jsxs(ContextMenuItem, { onClick: () => onEdit(message.id), children: [_jsx(Edit, { className: "w-4 h-4 mr-2" }), "Editar"] })), onViewContext && (_jsxs(ContextMenuItem, { onClick: () => onViewContext(message.id), children: [_jsx(Eye, { className: "w-4 h-4 mr-2" }), "Ver Contexto"] })), onDelete && (_jsxs(ContextMenuItem, { onClick: () => onDelete(message.id), className: "text-red-400 focus:text-red-400", children: [_jsx(Trash2, { className: "w-4 h-4 mr-2" }), "Excluir"] }))] })] }))] }), _jsx("div", { className: "text-gray-900 dark:text-gray-200", children: renderContent() }), showTimestamp && (_jsx("div", { className: "mt-1 text-[10px] text-gray-500 dark:text-gray-400", children: formatTimestamp(message.timestamp) }))] }));
|
|
84
|
+
});
|
|
85
|
+
ChatMessage.displayName = "ChatMessage";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/molecules/data-display/chat-message/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AACxE,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { ChatMessage } from "./chat-message";
|
package/dist/components/molecules/feedback/edit-chat-message-modal/edit-chat-message-modal.d.ts
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* EditChatMessageModal Component - Flowtomic UI
|
|
3
|
+
*
|
|
4
|
+
* Modal genérico para editar mensagens de chat com validação
|
|
5
|
+
* de alterações não salvas e exibição de metadados
|
|
6
|
+
*/
|
|
7
|
+
import type * as React from "react";
|
|
8
|
+
import type { ChatMessageData } from "../../data-display/chat-message";
|
|
9
|
+
export interface EditChatMessageModalProps {
|
|
10
|
+
isOpen: boolean;
|
|
11
|
+
onClose: () => void;
|
|
12
|
+
message: ChatMessageData | null;
|
|
13
|
+
onSave: (id: string | number, content: string) => Promise<void> | void;
|
|
14
|
+
isLoading?: boolean;
|
|
15
|
+
formatTimestamp?: (timestamp: Date | string) => string;
|
|
16
|
+
getMessageTypeBadgeClassName?: (messageType?: string) => string;
|
|
17
|
+
className?: string;
|
|
18
|
+
}
|
|
19
|
+
export declare const EditChatMessageModal: React.FC<EditChatMessageModalProps>;
|
|
20
|
+
//# sourceMappingURL=edit-chat-message-modal.d.ts.map
|
package/dist/components/molecules/feedback/edit-chat-message-modal/edit-chat-message-modal.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"edit-chat-message-modal.d.ts","sourceRoot":"","sources":["../../../../../src/components/molecules/feedback/edit-chat-message-modal/edit-chat-message-modal.tsx"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,KAAK,KAAK,KAAK,MAAM,OAAO,CAAC;AAYpC,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,iCAAiC,CAAC;AAEvE,MAAM,WAAW,yBAAyB;IACxC,MAAM,EAAE,OAAO,CAAC;IAChB,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,OAAO,EAAE,eAAe,GAAG,IAAI,CAAC;IAChC,MAAM,EAAE,CAAC,EAAE,EAAE,MAAM,GAAG,MAAM,EAAE,OAAO,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC;IACvE,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,eAAe,CAAC,EAAE,CAAC,SAAS,EAAE,IAAI,GAAG,MAAM,KAAK,MAAM,CAAC;IACvD,4BAA4B,CAAC,EAAE,CAAC,WAAW,CAAC,EAAE,MAAM,KAAK,MAAM,CAAC;IAChE,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAmBD,eAAO,MAAM,oBAAoB,EAAE,KAAK,CAAC,EAAE,CAAC,yBAAyB,CAwHpE,CAAC"}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
/**
|
|
3
|
+
* EditChatMessageModal Component - Flowtomic UI
|
|
4
|
+
*
|
|
5
|
+
* Modal genérico para editar mensagens de chat com validação
|
|
6
|
+
* de alterações não salvas e exibição de metadados
|
|
7
|
+
*/
|
|
8
|
+
import { Edit, Save } from "lucide-react";
|
|
9
|
+
import { useEffect, useState } from "react";
|
|
10
|
+
import { cn } from "@/lib/utils";
|
|
11
|
+
import { Badge, Button, Dialog, DialogContent, DialogHeader, DialogTitle, Textarea, } from "../../../atoms";
|
|
12
|
+
const defaultFormatTimestamp = (timestamp) => {
|
|
13
|
+
return new Date(timestamp).toLocaleString();
|
|
14
|
+
};
|
|
15
|
+
const defaultGetMessageTypeBadgeClassName = (messageType) => {
|
|
16
|
+
switch (messageType) {
|
|
17
|
+
case "SAY":
|
|
18
|
+
return "bg-emerald-100 text-emerald-800 dark:bg-emerald-900/30 dark:text-emerald-300";
|
|
19
|
+
case "ACTION":
|
|
20
|
+
return "bg-yellow-100 text-yellow-800 dark:bg-yellow-900/30 dark:text-yellow-300";
|
|
21
|
+
case "STORY":
|
|
22
|
+
return "bg-blue-100 text-blue-800 dark:bg-blue-900/30 dark:text-blue-300";
|
|
23
|
+
default:
|
|
24
|
+
return "bg-gray-100 text-gray-800 dark:bg-gray-900/30 dark:text-gray-300";
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
export const EditChatMessageModal = ({ isOpen, onClose, message, onSave, isLoading = false, formatTimestamp = defaultFormatTimestamp, getMessageTypeBadgeClassName = defaultGetMessageTypeBadgeClassName, className, }) => {
|
|
28
|
+
const [editedContent, setEditedContent] = useState("");
|
|
29
|
+
const [hasChanges, setHasChanges] = useState(false);
|
|
30
|
+
useEffect(() => {
|
|
31
|
+
if (message) {
|
|
32
|
+
setEditedContent(message.content);
|
|
33
|
+
setHasChanges(false);
|
|
34
|
+
}
|
|
35
|
+
}, [message]);
|
|
36
|
+
useEffect(() => {
|
|
37
|
+
if (message) {
|
|
38
|
+
setHasChanges(editedContent !== message.content);
|
|
39
|
+
}
|
|
40
|
+
}, [editedContent, message]);
|
|
41
|
+
const handleSave = async () => {
|
|
42
|
+
if (!message || !hasChanges || isLoading)
|
|
43
|
+
return;
|
|
44
|
+
try {
|
|
45
|
+
await onSave(message.id, editedContent);
|
|
46
|
+
onClose();
|
|
47
|
+
}
|
|
48
|
+
catch (error) {
|
|
49
|
+
console.error("Error saving message:", error);
|
|
50
|
+
// Error handling should be done by the parent component
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
const handleClose = () => {
|
|
54
|
+
if (hasChanges) {
|
|
55
|
+
const confirmClose = window.confirm("Você tem alterações não salvas. Deseja realmente fechar?");
|
|
56
|
+
if (!confirmClose)
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
59
|
+
onClose();
|
|
60
|
+
};
|
|
61
|
+
if (!message)
|
|
62
|
+
return null;
|
|
63
|
+
return (_jsx(Dialog, { open: isOpen, onOpenChange: handleClose, children: _jsxs(DialogContent, { className: cn("max-w-2xl max-h-[80vh] overflow-hidden", className), children: [_jsx(DialogHeader, { children: _jsxs("div", { className: "flex items-center gap-2", children: [_jsx(Edit, { className: "w-5 h-5 text-blue-600 dark:text-blue-400" }), _jsx(DialogTitle, { className: "text-lg", children: "Editar Mensagem" })] }) }), _jsxs("div", { className: "space-y-4", children: [_jsx("div", { className: "bg-gray-50 dark:bg-gray-800/50 rounded-lg p-3 border", children: _jsxs("div", { className: "flex items-center gap-2 mb-2", children: [_jsx("span", { className: "font-medium text-gray-900 dark:text-gray-100", children: message.sender }), message.messageType && (_jsx(Badge, { className: getMessageTypeBadgeClassName(message.messageType), children: message.messageType })), _jsx("span", { className: "text-xs text-gray-500 dark:text-gray-400 ml-auto", children: formatTimestamp(message.timestamp) })] }) }), _jsxs("div", { className: "space-y-2", children: [_jsx("label", { className: "text-sm font-medium text-gray-700 dark:text-gray-300", children: "Conte\u00FAdo da Mensagem" }), _jsx(Textarea, { value: editedContent, onChange: (e) => setEditedContent(e.target.value), className: "min-h-[200px] resize-none", placeholder: "Digite o conte\u00FAdo da mensagem...", disabled: isLoading }), _jsxs("div", { className: "flex items-center justify-between text-xs text-gray-500 dark:text-gray-400", children: [_jsxs("span", { children: [editedContent.length, " caracteres"] }), hasChanges && (_jsx("div", { className: "flex items-center gap-1 text-amber-600 dark:text-amber-400", children: _jsx("span", { children: "\u26A0\uFE0F Altera\u00E7\u00F5es n\u00E3o salvas" }) }))] })] }), _jsxs("div", { className: "flex items-center justify-end gap-2 pt-4 border-t", children: [_jsx(Button, { variant: "outline", onClick: handleClose, disabled: isLoading, children: "Cancelar" }), _jsxs(Button, { onClick: handleSave, disabled: !hasChanges || isLoading || !editedContent.trim(), className: "flex items-center gap-2", children: [isLoading ? (_jsx("div", { className: "animate-spin rounded-full h-4 w-4 border-b-2 border-white" })) : (_jsx(Save, { className: "w-4 h-4" })), "Salvar Altera\u00E7\u00F5es"] })] })] })] }) }));
|
|
64
|
+
};
|
|
65
|
+
EditChatMessageModal.displayName = "EditChatMessageModal";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/molecules/feedback/edit-chat-message-modal/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,yBAAyB,EAAE,MAAM,2BAA2B,CAAC;AAC3E,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { EditChatMessageModal } from "./edit-chat-message-modal";
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ChatInput Component - Flowtomic UI
|
|
3
|
+
*
|
|
4
|
+
* Componente de input para chat com suporte a tipos de mensagem,
|
|
5
|
+
* modos customizáveis, contador de caracteres e atalhos de teclado
|
|
6
|
+
*/
|
|
7
|
+
import type { HTMLAttributes, ReactNode } from "react";
|
|
8
|
+
import * as React from "react";
|
|
9
|
+
export interface MessageTypeOption {
|
|
10
|
+
value: string;
|
|
11
|
+
label: string;
|
|
12
|
+
icon?: ReactNode;
|
|
13
|
+
}
|
|
14
|
+
export interface ModeOption {
|
|
15
|
+
value: string;
|
|
16
|
+
label: string;
|
|
17
|
+
icon?: ReactNode;
|
|
18
|
+
description?: string;
|
|
19
|
+
}
|
|
20
|
+
export interface ChatInputProps extends Omit<HTMLAttributes<HTMLDivElement>, "onSubmit" | "onChange"> {
|
|
21
|
+
value: string;
|
|
22
|
+
onChange: (value: string) => void;
|
|
23
|
+
onSubmit: (value: string, messageType?: string, mode?: string) => void;
|
|
24
|
+
maxLength?: number;
|
|
25
|
+
messageTypes?: MessageTypeOption[];
|
|
26
|
+
selectedMessageType?: string;
|
|
27
|
+
onMessageTypeChange?: (type: string) => void;
|
|
28
|
+
modes?: ModeOption[];
|
|
29
|
+
selectedMode?: string;
|
|
30
|
+
onModeChange?: (mode: string) => void;
|
|
31
|
+
placeholder?: string;
|
|
32
|
+
disabled?: boolean;
|
|
33
|
+
isLoading?: boolean;
|
|
34
|
+
shortcuts?: {
|
|
35
|
+
submit?: string;
|
|
36
|
+
clear?: string;
|
|
37
|
+
};
|
|
38
|
+
indicators?: ReactNode;
|
|
39
|
+
showCounter?: boolean;
|
|
40
|
+
showHeader?: boolean;
|
|
41
|
+
headerTitle?: string;
|
|
42
|
+
headerDescription?: string;
|
|
43
|
+
className?: string;
|
|
44
|
+
}
|
|
45
|
+
export declare const ChatInput: React.ForwardRefExoticComponent<ChatInputProps & React.RefAttributes<HTMLDivElement>>;
|
|
46
|
+
//# sourceMappingURL=chat-input.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chat-input.d.ts","sourceRoot":"","sources":["../../../../../src/components/molecules/forms/chat-input/chat-input.tsx"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,KAAK,EAAE,cAAc,EAAiB,SAAS,EAAE,MAAM,OAAO,CAAC;AACtE,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAY/B,MAAM,WAAW,iBAAiB;IAChC,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,SAAS,CAAC;CAClB;AAED,MAAM,WAAW,UAAU;IACzB,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,cAAe,SAAQ,IAAI,CAAC,cAAc,CAAC,cAAc,CAAC,EAAE,UAAU,GAAG,UAAU,CAAC;IACnG,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAClC,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,WAAW,CAAC,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC;IACvE,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,YAAY,CAAC,EAAE,iBAAiB,EAAE,CAAC;IACnC,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,mBAAmB,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IAC7C,KAAK,CAAC,EAAE,UAAU,EAAE,CAAC;IACrB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IACtC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,SAAS,CAAC,EAAE;QAAE,MAAM,CAAC,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IAChD,UAAU,CAAC,EAAE,SAAS,CAAC;IACvB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,eAAO,MAAM,SAAS,uFAiNrB,CAAC"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
/**
|
|
3
|
+
* ChatInput Component - Flowtomic UI
|
|
4
|
+
*
|
|
5
|
+
* Componente de input para chat com suporte a tipos de mensagem,
|
|
6
|
+
* modos customizáveis, contador de caracteres e atalhos de teclado
|
|
7
|
+
*/
|
|
8
|
+
import { Send } from "lucide-react";
|
|
9
|
+
import * as React from "react";
|
|
10
|
+
import { useEffect, useRef } from "react";
|
|
11
|
+
import { cn } from "@/lib/utils";
|
|
12
|
+
import { Button, Textarea, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, } from "../../../atoms";
|
|
13
|
+
export const ChatInput = React.forwardRef(({ value, onChange, onSubmit, maxLength = 1500, messageTypes, selectedMessageType, onMessageTypeChange, modes, selectedMode, onModeChange, placeholder = "Digite sua mensagem...", disabled = false, isLoading = false, shortcuts = { submit: "Ctrl+Enter", clear: "Escape" }, indicators, showCounter = true, showHeader = false, headerTitle, headerDescription, className, ...props }, ref) => {
|
|
14
|
+
const textareaRef = useRef(null);
|
|
15
|
+
const remaining = maxLength - value.length;
|
|
16
|
+
// Auto-resize textarea
|
|
17
|
+
useEffect(() => {
|
|
18
|
+
if (textareaRef.current) {
|
|
19
|
+
textareaRef.current.style.height = "auto";
|
|
20
|
+
textareaRef.current.style.height = `${textareaRef.current.scrollHeight}px`;
|
|
21
|
+
}
|
|
22
|
+
}, [value]);
|
|
23
|
+
const handleSubmit = () => {
|
|
24
|
+
if (!value.trim() || remaining < 0 || disabled || isLoading)
|
|
25
|
+
return;
|
|
26
|
+
onSubmit(value.trim(), selectedMessageType, selectedMode);
|
|
27
|
+
onChange("");
|
|
28
|
+
};
|
|
29
|
+
const handleKeyDown = (e) => {
|
|
30
|
+
if (shortcuts.submit && e.key === "Enter" && (e.ctrlKey || e.metaKey)) {
|
|
31
|
+
e.preventDefault();
|
|
32
|
+
handleSubmit();
|
|
33
|
+
}
|
|
34
|
+
else if (shortcuts.clear && e.key === "Escape") {
|
|
35
|
+
e.preventDefault();
|
|
36
|
+
onChange("");
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
const renderMessageTypeButtons = () => {
|
|
40
|
+
if (!messageTypes || messageTypes.length === 0)
|
|
41
|
+
return null;
|
|
42
|
+
return (_jsx("div", { className: "flex items-center gap-2 mb-3", children: messageTypes.map((type) => (_jsxs(Button, { type: "button", variant: selectedMessageType === type.value ? "default" : "outline", size: "sm", onClick: () => onMessageTypeChange?.(type.value), className: cn("text-xs font-medium transition-colors", selectedMessageType === type.value
|
|
43
|
+
? "bg-purple-600 text-white hover:bg-purple-700"
|
|
44
|
+
: "bg-gray-700 text-gray-300 hover:bg-gray-600"), children: [type.icon && _jsx("span", { className: "mr-1", children: type.icon }), type.label] }, type.value))) }));
|
|
45
|
+
};
|
|
46
|
+
const renderModeButtons = () => {
|
|
47
|
+
if (!modes || modes.length === 0)
|
|
48
|
+
return null;
|
|
49
|
+
return (_jsx("div", { className: "flex items-center gap-3 mb-3", children: modes.map((mode) => (_jsx(TooltipProvider, { children: _jsxs(Tooltip, { children: [_jsx(TooltipTrigger, { asChild: true, children: _jsxs(Button, { type: "button", variant: selectedMode === mode.value ? "default" : "outline", size: "sm", onClick: () => onModeChange?.(mode.value), className: cn("text-sm font-medium transition-all flex items-center gap-2", selectedMode === mode.value
|
|
50
|
+
? "bg-purple-600 text-white shadow-lg shadow-purple-600/25"
|
|
51
|
+
: "bg-gray-700 text-gray-300 hover:bg-gray-600 hover:text-white"), children: [mode.icon && _jsx("span", { children: mode.icon }), _jsx("span", { className: "font-semibold", children: mode.label })] }) }), mode.description && (_jsx(TooltipContent, { children: _jsx("p", { children: mode.description }) }))] }) }, mode.value))) }));
|
|
52
|
+
};
|
|
53
|
+
return (_jsxs("div", { ref: ref, className: cn("border border-gray-700/50 rounded-lg bg-gray-900/40", className), ...props, children: [showHeader && (_jsxs("header", { className: "px-4 py-3 border-b border-gray-700/50 flex items-center gap-2", children: [_jsx("span", { className: "inline-flex w-5 h-5 items-center justify-center rounded-md bg-purple-600 text-white text-xs", children: "\u25A0" }), _jsxs("div", { children: [headerTitle && _jsx("h3", { className: "text-sm font-medium text-gray-200", children: headerTitle }), headerDescription && (_jsx("p", { className: "text-[11px] text-gray-400", children: headerDescription }))] })] })), _jsxs("div", { className: "p-4", children: [renderMessageTypeButtons(), renderModeButtons(), _jsx(Textarea, { ref: textareaRef, value: value, onChange: (e) => onChange(e.target.value), onKeyDown: handleKeyDown, placeholder: placeholder, maxLength: maxLength, disabled: disabled || isLoading, className: cn("w-full min-h-[80px] mb-2 rounded-md bg-gray-900 border border-gray-700", "text-gray-100 placeholder-gray-500 focus:outline-none focus:ring-2 focus:ring-purple-500", "p-3 resize-none disabled:opacity-50") }), _jsxs("div", { className: "flex items-center justify-between pt-3 relative", children: [showCounter && (_jsxs("span", { className: cn("absolute left-4 bottom-14 text-[12px] font-bold select-none px-2 py-0.5 rounded-full shadow bg-gray-900/50 hover:bg-gray-900 transition-colors hover:cursor-default", remaining > 0
|
|
54
|
+
? "text-green-400/70 hover:text-green-400"
|
|
55
|
+
: "text-red-400/70 hover:text-red-400"), style: { zIndex: 5 }, children: ["\u2022 ", remaining, " restantes"] })), indicators && (_jsx("div", { className: "absolute right-4 bottom-14", style: { zIndex: 5 }, children: indicators })), _jsxs(Button, { onClick: handleSubmit, disabled: !value.trim() || remaining < 0 || disabled || isLoading, className: "bg-purple-600 hover:bg-purple-700 text-white rounded-full px-5 py-2 flex items-center gap-2 transition-colors disabled:opacity-50 disabled:cursor-not-allowed", children: [_jsx(Send, { className: "w-4 h-4" }), isLoading ? "Enviando..." : "Enviar"] })] }), shortcuts && (_jsxs("div", { className: "flex items-center justify-between text-xs text-gray-500 dark:text-gray-400 mt-2", children: [shortcuts.submit && (_jsxs("span", { children: [shortcuts.submit.replace("Ctrl", "Ctrl").replace("Meta", "Cmd"), " para enviar"] })), shortcuts.clear && _jsxs("span", { children: [shortcuts.clear, " para limpar"] })] }))] })] }));
|
|
56
|
+
});
|
|
57
|
+
ChatInput.displayName = "ChatInput";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/molecules/forms/chat-input/index.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,cAAc,EACd,iBAAiB,EACjB,UAAU,GACX,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { ChatInput } from "./chat-input";
|
|
@@ -13,8 +13,8 @@ declare namespace ItemSeparator {
|
|
|
13
13
|
var displayName: string;
|
|
14
14
|
}
|
|
15
15
|
declare const itemVariants: (props?: ({
|
|
16
|
-
variant?: "
|
|
17
|
-
size?: "
|
|
16
|
+
variant?: "default" | "outline" | "muted" | null | undefined;
|
|
17
|
+
size?: "default" | "sm" | null | undefined;
|
|
18
18
|
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
19
19
|
export interface ItemProps extends React.ComponentProps<"div">, VariantProps<typeof itemVariants> {
|
|
20
20
|
asChild?: boolean;
|