@flamingo-stack/openframe-frontend-core 0.0.172 → 0.0.173-snapshot.20260513212448
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/{chunk-AY3E5FKM.cjs → chunk-TX2C3PJM.cjs} +2227 -1649
- package/dist/chunk-TX2C3PJM.cjs.map +1 -0
- package/dist/{chunk-FEEPEOW2.js → chunk-X7AOT3WQ.js} +5770 -5192
- package/dist/chunk-X7AOT3WQ.js.map +1 -0
- package/dist/components/chat/approval-batch-message.d.ts +10 -0
- package/dist/components/chat/approval-batch-message.d.ts.map +1 -0
- package/dist/components/chat/chat-input.d.ts.map +1 -1
- package/dist/components/chat/chat-message-enhanced.d.ts.map +1 -1
- package/dist/components/chat/chat-message-list.d.ts.map +1 -1
- package/dist/components/chat/chat-message-loader.d.ts +23 -0
- package/dist/components/chat/chat-message-loader.d.ts.map +1 -0
- package/dist/components/chat/hooks/index.d.ts +1 -0
- package/dist/components/chat/hooks/index.d.ts.map +1 -1
- package/dist/components/chat/hooks/use-collapsible.d.ts.map +1 -1
- package/dist/components/chat/hooks/use-delayed-flag.d.ts +25 -0
- package/dist/components/chat/hooks/use-delayed-flag.d.ts.map +1 -0
- package/dist/components/chat/hooks/use-realtime-chunk-processor.d.ts.map +1 -1
- package/dist/components/chat/index.d.ts +3 -0
- package/dist/components/chat/index.d.ts.map +1 -1
- package/dist/components/chat/thinking-display.d.ts.map +1 -1
- package/dist/components/chat/tool-call-blocks.d.ts +18 -0
- package/dist/components/chat/tool-call-blocks.d.ts.map +1 -0
- package/dist/components/chat/tool-execution-display.d.ts +1 -1
- package/dist/components/chat/tool-execution-display.d.ts.map +1 -1
- package/dist/components/chat/types/api.types.d.ts +16 -1
- package/dist/components/chat/types/api.types.d.ts.map +1 -1
- package/dist/components/chat/types/component.types.d.ts +2 -2
- package/dist/components/chat/types/component.types.d.ts.map +1 -1
- package/dist/components/chat/types/message.types.d.ts +54 -1
- package/dist/components/chat/types/message.types.d.ts.map +1 -1
- package/dist/components/chat/types/network.types.d.ts +2 -0
- package/dist/components/chat/types/network.types.d.ts.map +1 -1
- package/dist/components/chat/types/processing.types.d.ts +14 -1
- package/dist/components/chat/types/processing.types.d.ts.map +1 -1
- package/dist/components/chat/utils/chunk-parser.d.ts.map +1 -1
- package/dist/components/chat/utils/extract-incomplete-message-state.d.ts.map +1 -1
- package/dist/components/chat/utils/index.d.ts +1 -0
- package/dist/components/chat/utils/index.d.ts.map +1 -1
- package/dist/components/chat/utils/message-segment-accumulator.d.ts +32 -4
- package/dist/components/chat/utils/message-segment-accumulator.d.ts.map +1 -1
- package/dist/components/chat/utils/process-historical-messages.d.ts +2 -1
- package/dist/components/chat/utils/process-historical-messages.d.ts.map +1 -1
- package/dist/components/chat/utils/tool-call-helpers.d.ts +38 -0
- package/dist/components/chat/utils/tool-call-helpers.d.ts.map +1 -0
- package/dist/components/features/index.cjs +2 -2
- package/dist/components/features/index.js +1 -1
- package/dist/components/index.cjs +14 -2
- package/dist/components/index.cjs.map +1 -1
- package/dist/components/index.js +13 -1
- package/dist/components/navigation/index.cjs +2 -2
- package/dist/components/navigation/index.js +1 -1
- package/dist/components/ui/index.cjs +14 -2
- package/dist/components/ui/index.cjs.map +1 -1
- package/dist/components/ui/index.js +13 -1
- package/dist/components/ui/textarea.d.ts +11 -0
- package/dist/components/ui/textarea.d.ts.map +1 -1
- package/dist/index.cjs +14 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +13 -1
- package/package.json +3 -3
- package/src/components/chat/approval-batch-message.tsx +237 -0
- package/src/components/chat/chat-input.tsx +34 -106
- package/src/components/chat/chat-message-enhanced.tsx +11 -0
- package/src/components/chat/chat-message-list.tsx +100 -37
- package/src/components/chat/chat-message-loader.tsx +67 -0
- package/src/components/chat/hooks/index.ts +1 -0
- package/src/components/chat/hooks/use-collapsible.ts +10 -1
- package/src/components/chat/hooks/use-delayed-flag.ts +56 -0
- package/src/components/chat/hooks/use-realtime-chunk-processor.ts +109 -20
- package/src/components/chat/index.ts +3 -0
- package/src/components/chat/thinking-display.tsx +76 -12
- package/src/components/chat/tool-call-blocks.tsx +58 -0
- package/src/components/chat/tool-execution-display.tsx +60 -81
- package/src/components/chat/types/api.types.ts +22 -3
- package/src/components/chat/types/component.types.ts +2 -2
- package/src/components/chat/types/message.types.ts +58 -1
- package/src/components/chat/types/network.types.ts +2 -0
- package/src/components/chat/types/processing.types.ts +13 -2
- package/src/components/chat/utils/chunk-parser.ts +40 -5
- package/src/components/chat/utils/extract-incomplete-message-state.ts +19 -1
- package/src/components/chat/utils/index.ts +3 -0
- package/src/components/chat/utils/message-segment-accumulator.ts +136 -12
- package/src/components/chat/utils/process-historical-messages.ts +88 -13
- package/src/components/chat/utils/tool-call-helpers.ts +105 -0
- package/src/components/ui/textarea.tsx +107 -25
- package/dist/chunk-AY3E5FKM.cjs.map +0 -1
- package/dist/chunk-FEEPEOW2.js.map +0 -1
|
@@ -12,40 +12,122 @@ export interface TextareaProps extends React.TextareaHTMLAttributes<HTMLTextArea
|
|
|
12
12
|
label?: string;
|
|
13
13
|
/** Error message displayed below the textarea */
|
|
14
14
|
error?: string;
|
|
15
|
+
/** Element rendered at the right edge of the field (e.g. send icon). */
|
|
16
|
+
endIcon?: React.ReactNode;
|
|
17
|
+
/**
|
|
18
|
+
* When true, `endIcon` is wrapped in a real `<button>` with hover / active
|
|
19
|
+
* / focus-visible styling matching the rest of the design system. Pass any
|
|
20
|
+
* extra button attributes (`onClick`, `disabled`, `aria-label`, …) via
|
|
21
|
+
* `endIconButtonProps`.
|
|
22
|
+
*/
|
|
23
|
+
endIconAsButton?: boolean;
|
|
24
|
+
/** Extra attributes for the end-icon button. */
|
|
25
|
+
endIconButtonProps?: Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, 'children'>;
|
|
15
26
|
}
|
|
16
27
|
|
|
17
28
|
const Textarea = React.forwardRef<HTMLTextAreaElement, TextareaProps>(
|
|
18
|
-
({ className, invalid = false, label, error, ...props }, ref) => {
|
|
29
|
+
({ className, invalid = false, label, error, endIcon, endIconAsButton = false, endIconButtonProps, ...props }, ref) => {
|
|
19
30
|
const isInvalid = invalid || !!error
|
|
31
|
+
const hasEndIcon = !!endIcon
|
|
20
32
|
|
|
33
|
+
// Without an end icon we keep the historical layout: bare textarea, the
|
|
34
|
+
// border/bg/hover all live on the textarea itself.
|
|
35
|
+
if (!hasEndIcon) {
|
|
36
|
+
return (
|
|
37
|
+
<FieldWrapper label={label} error={error}>
|
|
38
|
+
<textarea
|
|
39
|
+
className={cn(
|
|
40
|
+
"flex min-h-[96px] w-full rounded-[6px] border p-3",
|
|
41
|
+
"text-h4",
|
|
42
|
+
"focus-visible:outline-none focus:border-ods-accent",
|
|
43
|
+
"transition-colors duration-200 touch-manipulation",
|
|
44
|
+
"bg-ods-card border-ods-border text-ods-text-primary placeholder:text-ods-text-secondary",
|
|
45
|
+
!props.disabled && "hover:bg-ods-bg-hover hover:border-ods-border-hover active:bg-ods-bg-active active:border-ods-border-active",
|
|
46
|
+
props.disabled && "!cursor-not-allowed bg-ods-bg disabled:placeholder:text-ods-border",
|
|
47
|
+
"cursor-text relative z-10",
|
|
48
|
+
"resize-y",
|
|
49
|
+
isInvalid && "border-ods-error hover:border-ods-error focus:border-ods-error",
|
|
50
|
+
className,
|
|
51
|
+
)}
|
|
52
|
+
ref={ref}
|
|
53
|
+
{...props}
|
|
54
|
+
/>
|
|
55
|
+
</FieldWrapper>
|
|
56
|
+
)
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
// With an end icon we lift border/bg onto a `<label>` wrapper so the icon
|
|
60
|
+
// sits visually inside the same field. The textarea becomes a transparent
|
|
61
|
+
// child. Wrapper classes mirror `Input` 1:1 (same items-center, same
|
|
62
|
+
// `has-[:focus]` selectors, same active state, same outline reset) so
|
|
63
|
+
// hover / focus / cursor behaviour matches the standard input exactly.
|
|
21
64
|
const content = (
|
|
22
|
-
<
|
|
65
|
+
<label
|
|
66
|
+
data-invalid={isInvalid || undefined}
|
|
23
67
|
className={cn(
|
|
24
|
-
//
|
|
25
|
-
|
|
26
|
-
//
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
"focus-visible:outline-none
|
|
30
|
-
|
|
31
|
-
"transition-colors duration-200
|
|
32
|
-
|
|
33
|
-
"bg-ods-card border-ods-border text-ods-text-primary placeholder:text-ods-text-secondary",
|
|
34
|
-
// Hover & active (not disabled)
|
|
68
|
+
// Wrapper mirrors `Input`, but uses `items-end` so the icon sticks
|
|
69
|
+
// to the bottom-right when the textarea grows multi-line. Vertical
|
|
70
|
+
// padding lives here (not on the textarea) so both children share
|
|
71
|
+
// the same bottom baseline at any height.
|
|
72
|
+
"flex w-full items-end gap-2 rounded-[6px] border px-3 py-2.5 md:py-3 min-h-11 md:min-h-12 cursor-text",
|
|
73
|
+
"has-[:focus-visible]:outline-none",
|
|
74
|
+
"group",
|
|
75
|
+
"transition-colors duration-200",
|
|
76
|
+
"bg-ods-card border-ods-border has-[:focus]:border-ods-accent",
|
|
35
77
|
!props.disabled && "hover:bg-ods-bg-hover hover:border-ods-border-hover active:bg-ods-bg-active active:border-ods-border-active",
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
78
|
+
props.disabled && "!cursor-not-allowed bg-ods-bg",
|
|
79
|
+
isInvalid && "border-ods-error hover:border-ods-error has-[:focus]:border-ods-error",
|
|
80
|
+
)}
|
|
81
|
+
>
|
|
82
|
+
<textarea
|
|
83
|
+
ref={ref}
|
|
84
|
+
rows={1}
|
|
85
|
+
className={cn(
|
|
86
|
+
"flex-1 min-w-0 resize-none bg-transparent border-none outline-none p-0 m-0 box-border",
|
|
87
|
+
// Native CSS auto-grow (Chrome 123+, FF 124+, Safari 16.4+) — no
|
|
88
|
+
// JS needed to size to content. Falls back to `rows={1}` natural
|
|
89
|
+
// height on older browsers.
|
|
90
|
+
"[field-sizing:content]",
|
|
91
|
+
"text-h4 text-ods-text-primary placeholder:text-ods-text-secondary leading-6",
|
|
92
|
+
// Hard cap on growth: beyond `max-h` the textarea scrolls
|
|
93
|
+
// internally instead of pushing the icon out of frame.
|
|
94
|
+
"max-h-[160px] overflow-y-auto",
|
|
95
|
+
"scrollbar-thin scrollbar-track-transparent scrollbar-thumb-ods-border/30 hover:scrollbar-thumb-ods-text-secondary/30",
|
|
96
|
+
"disabled:cursor-not-allowed disabled:placeholder:text-ods-border",
|
|
97
|
+
className,
|
|
98
|
+
)}
|
|
99
|
+
{...props}
|
|
100
|
+
/>
|
|
101
|
+
|
|
102
|
+
{endIconAsButton ? (
|
|
103
|
+
<button
|
|
104
|
+
type="button"
|
|
105
|
+
aria-label={endIconButtonProps?.['aria-label'] ?? 'Submit'}
|
|
106
|
+
{...endIconButtonProps}
|
|
107
|
+
className={cn(
|
|
108
|
+
"flex shrink-0 items-center text-ods-text-secondary transition-colors duration-200",
|
|
109
|
+
"group-has-[:focus]:text-ods-accent group-data-[invalid]:text-ods-error",
|
|
110
|
+
"[&_svg]:size-4 md:[&_svg]:size-6",
|
|
111
|
+
"cursor-pointer hover:text-ods-text-primary",
|
|
112
|
+
"focus-visible:outline-none focus-visible:text-ods-accent",
|
|
113
|
+
"disabled:cursor-not-allowed disabled:opacity-40 disabled:hover:text-ods-text-secondary",
|
|
114
|
+
endIconButtonProps?.className,
|
|
115
|
+
)}
|
|
116
|
+
>
|
|
117
|
+
{endIcon}
|
|
118
|
+
</button>
|
|
119
|
+
) : (
|
|
120
|
+
<span
|
|
121
|
+
className={cn(
|
|
122
|
+
"flex shrink-0 items-center text-ods-text-secondary transition-colors duration-200",
|
|
123
|
+
"group-has-[:focus]:text-ods-accent group-data-[invalid]:text-ods-error",
|
|
124
|
+
"[&_svg]:size-4 md:[&_svg]:size-6",
|
|
125
|
+
)}
|
|
126
|
+
>
|
|
127
|
+
{endIcon}
|
|
128
|
+
</span>
|
|
45
129
|
)}
|
|
46
|
-
|
|
47
|
-
{...props}
|
|
48
|
-
/>
|
|
130
|
+
</label>
|
|
49
131
|
)
|
|
50
132
|
|
|
51
133
|
return (
|