@greatapps/greatagents-ui 0.3.23 → 0.3.24

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@greatapps/greatagents-ui",
3
- "version": "0.3.23",
3
+ "version": "0.3.24",
4
4
  "description": "Shared agents UI components for Great platform",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -100,8 +100,8 @@ export function AgentEditForm({ config, agent, idAccount, open, onOpenChange }:
100
100
  }
101
101
  }
102
102
 
103
- const formContent = (
104
- <form onSubmit={handleSubmit} className="space-y-4">
103
+ const formFields = (
104
+ <>
105
105
  <div className="flex justify-center">
106
106
  <ImageCropUpload
107
107
  value={form.photo || null}
@@ -184,38 +184,63 @@ export function AgentEditForm({ config, agent, idAccount, open, onOpenChange }:
184
184
  </p>
185
185
  </div>
186
186
  </div>
187
-
188
- <SheetFooter>
189
- <Button
190
- type="button"
191
- variant="outline"
192
- onClick={() => onOpenChange?.(false)}
193
- disabled={updateAgent.isPending}
194
- >
195
- Cancelar
196
- </Button>
197
- <Button type="submit" disabled={updateAgent.isPending}>
198
- {updateAgent.isPending && (
199
- <Loader2 aria-hidden="true" className="mr-2 h-4 w-4 animate-spin" />
200
- )}
201
- Salvar
202
- </Button>
203
- </SheetFooter>
204
- </form>
187
+ </>
205
188
  );
206
189
 
207
190
  if (open !== undefined && onOpenChange) {
208
191
  return (
209
192
  <Sheet open={open} onOpenChange={onOpenChange}>
210
- <SheetContent className="sm:max-w-md overflow-y-auto">
193
+ <SheetContent className="sm:max-w-md">
211
194
  <SheetHeader>
212
195
  <SheetTitle>Editar Agente</SheetTitle>
213
196
  </SheetHeader>
214
- {formContent}
197
+ <form onSubmit={handleSubmit} className="flex flex-1 flex-col overflow-hidden">
198
+ <div className="flex-1 overflow-y-auto px-4 space-y-4">
199
+ {formFields}
200
+ </div>
201
+ <SheetFooter className="flex-row justify-end border-t">
202
+ <Button
203
+ type="button"
204
+ variant="outline"
205
+ onClick={() => onOpenChange?.(false)}
206
+ disabled={updateAgent.isPending}
207
+ >
208
+ Cancelar
209
+ </Button>
210
+ <Button type="submit" disabled={updateAgent.isPending}>
211
+ {updateAgent.isPending && (
212
+ <Loader2 aria-hidden="true" className="mr-2 h-4 w-4 animate-spin" />
213
+ )}
214
+ Salvar
215
+ </Button>
216
+ </SheetFooter>
217
+ </form>
215
218
  </SheetContent>
216
219
  </Sheet>
217
220
  );
218
221
  }
219
222
 
220
- return <div className="max-w-lg pt-4">{formContent}</div>;
223
+ return (
224
+ <div className="max-w-lg pt-4">
225
+ <form onSubmit={handleSubmit} className="space-y-4">
226
+ {formFields}
227
+ <div className="flex justify-end gap-2 pt-4 border-t">
228
+ <Button
229
+ type="button"
230
+ variant="outline"
231
+ onClick={() => onOpenChange?.(false)}
232
+ disabled={updateAgent.isPending}
233
+ >
234
+ Cancelar
235
+ </Button>
236
+ <Button type="submit" disabled={updateAgent.isPending}>
237
+ {updateAgent.isPending && (
238
+ <Loader2 aria-hidden="true" className="mr-2 h-4 w-4 animate-spin" />
239
+ )}
240
+ Salvar
241
+ </Button>
242
+ </div>
243
+ </form>
244
+ </div>
245
+ );
221
246
  }
@@ -135,13 +135,14 @@ export function AgentFormDialog({
135
135
 
136
136
  return (
137
137
  <Sheet open={open} onOpenChange={onOpenChange}>
138
- <SheetContent className="sm:max-w-lg overflow-y-auto">
138
+ <SheetContent className="sm:max-w-md">
139
139
  <SheetHeader>
140
140
  <SheetTitle>
141
141
  {isEditing ? "Editar Agente" : "Novo Agente"}
142
142
  </SheetTitle>
143
143
  </SheetHeader>
144
- <form onSubmit={handleSubmit} className="space-y-4">
144
+ <form onSubmit={handleSubmit} className="flex flex-1 flex-col overflow-hidden">
145
+ <div className="flex-1 overflow-y-auto px-4 space-y-4">
145
146
  <div className="flex justify-center">
146
147
  <ImageCropUpload
147
148
  value={form.photo || null}
@@ -224,7 +225,8 @@ export function AgentFormDialog({
224
225
  </p>
225
226
  </div>
226
227
  </div>
227
- <SheetFooter>
228
+ </div>
229
+ <SheetFooter className="flex-row justify-end border-t">
228
230
  <Button
229
231
  type="button"
230
232
  variant="outline"
@@ -326,13 +326,13 @@ export function AgentObjectivesList({ agent, config }: AgentObjectivesListProps)
326
326
 
327
327
  {/* Create/Edit Sheet */}
328
328
  <Sheet open={formOpen} onOpenChange={setFormOpen}>
329
- <SheetContent className="sm:max-w-lg overflow-y-auto">
329
+ <SheetContent className="sm:max-w-lg">
330
330
  <SheetHeader>
331
331
  <SheetTitle>
332
332
  {editTarget ? "Editar Objetivo" : "Novo Objetivo"}
333
333
  </SheetTitle>
334
334
  </SheetHeader>
335
- <div className="space-y-4">
335
+ <div className="flex-1 overflow-y-auto px-4 space-y-4">
336
336
  <div className="space-y-2">
337
337
  <Label htmlFor="objective-title">Título *</Label>
338
338
  <Input
@@ -430,7 +430,7 @@ export function AgentObjectivesList({ agent, config }: AgentObjectivesListProps)
430
430
  </p>
431
431
  </div>
432
432
  </div>
433
- <SheetFooter>
433
+ <SheetFooter className="flex-row justify-end border-t">
434
434
  <Button
435
435
  variant="outline"
436
436
  onClick={() => setFormOpen(false)}
@@ -1,6 +1,6 @@
1
1
  import { useCallback, useRef, useState } from "react";
2
2
  import type { ConversationFlowStep } from "../../types";
3
- import { Button, Input } from "@greatapps/greatauth-ui/ui";
3
+ import { Button, Textarea } from "@greatapps/greatauth-ui/ui";
4
4
  import {
5
5
  Sortable,
6
6
  SortableContent,
@@ -9,7 +9,6 @@ import {
9
9
  SortableOverlay,
10
10
  } from "../ui/sortable";
11
11
  import { GripVertical, Plus, Trash2 } from "lucide-react";
12
- import { cn } from "../../lib";
13
12
 
14
13
  interface StepWithKey extends ConversationFlowStep {
15
14
  _key: number;
@@ -105,47 +104,47 @@ export function ConversationFlowEditor({
105
104
  <SortableItem
106
105
  key={step._key}
107
106
  value={step._key}
108
- className="flex items-center gap-2 rounded-lg border bg-card p-2"
107
+ className="flex flex-col gap-2 rounded-lg border bg-card p-3"
109
108
  >
110
- <SortableItemHandle className="shrink-0 cursor-grab text-muted-foreground hover:text-foreground">
111
- <GripVertical aria-hidden="true" className="h-4 w-4" />
112
- </SortableItemHandle>
113
-
114
- <span className="shrink-0 text-xs font-medium text-muted-foreground tabular-nums w-6 text-right">
115
- {step.order}.
116
- </span>
117
-
118
- <Input
119
- value={step.instruction}
120
- onChange={(e) =>
121
- handleFieldChange(step._key, "instruction", e.target.value)
122
- }
123
- placeholder="Instrução (obrigatório)"
124
- className="flex-1 min-w-0"
125
- required
126
- />
127
-
128
- <Input
129
- value={step.example ?? ""}
130
- onChange={(e) =>
131
- handleFieldChange(step._key, "example", e.target.value)
132
- }
133
- placeholder="Exemplo (opcional)"
134
- className="flex-1 min-w-0"
135
- />
136
-
137
- <Button
138
- type="button"
139
- variant="ghost"
140
- size="icon"
141
- aria-label="Remover etapa"
142
- className={cn(
143
- "shrink-0 text-muted-foreground hover:text-destructive",
144
- )}
145
- onClick={() => handleRemove(step._key)}
146
- >
147
- <Trash2 className="h-4 w-4" />
148
- </Button>
109
+ <div className="flex items-center gap-2">
110
+ <SortableItemHandle className="shrink-0 cursor-grab text-muted-foreground hover:text-foreground">
111
+ <GripVertical aria-hidden="true" className="h-4 w-4" />
112
+ </SortableItemHandle>
113
+ <span className="shrink-0 text-xs font-medium text-muted-foreground tabular-nums">
114
+ {step.order}.
115
+ </span>
116
+ <span className="flex-1 text-sm font-medium truncate">{step.instruction || "Nova etapa"}</span>
117
+ <Button
118
+ type="button"
119
+ variant="ghost"
120
+ size="icon"
121
+ aria-label="Remover etapa"
122
+ className="shrink-0 text-muted-foreground hover:text-destructive"
123
+ onClick={() => handleRemove(step._key)}
124
+ >
125
+ <Trash2 className="h-4 w-4" />
126
+ </Button>
127
+ </div>
128
+ <div className="space-y-2 pl-8">
129
+ <Textarea
130
+ value={step.instruction}
131
+ onChange={(e) =>
132
+ handleFieldChange(step._key, "instruction", e.target.value)
133
+ }
134
+ placeholder="Descreva o que o agente deve fazer nesta etapa..."
135
+ className="min-h-[2.5rem] resize-none"
136
+ rows={2}
137
+ />
138
+ <Textarea
139
+ value={step.example ?? ""}
140
+ onChange={(e) =>
141
+ handleFieldChange(step._key, "example", e.target.value)
142
+ }
143
+ placeholder="Exemplo de resposta do agente (opcional)"
144
+ className="min-h-[2.5rem] resize-none text-muted-foreground"
145
+ rows={1}
146
+ />
147
+ </div>
149
148
  </SortableItem>
150
149
  ))}
151
150
  </SortableContent>