@adea-ai/ui 0.155.1 → 0.156.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/NOTICE +27 -0
- package/dist/components/composites/model-selector/model-selector.js +45 -53
- package/dist/components/composites/model-selector/model-selector.js.map +1 -1
- package/dist/components/composites/prompt-input/index.d.ts +2 -0
- package/dist/components/composites/prompt-input/index.d.ts.map +1 -0
- package/dist/components/composites/prompt-input/index.js +1 -0
- package/dist/components/composites/prompt-input/prompt-input.d.ts +71 -0
- package/dist/components/composites/prompt-input/prompt-input.d.ts.map +1 -0
- package/dist/components/composites/prompt-input/prompt-input.js +247 -0
- package/dist/components/composites/prompt-input/prompt-input.js.map +1 -0
- package/dist/components/conversation/chat-composer.d.ts.map +1 -1
- package/dist/components/conversation/chat-composer.js +43 -29
- package/dist/components/conversation/chat-composer.js.map +1 -1
- package/dist/components/conversation/internal/chat-composer-shell.d.ts.map +1 -1
- package/dist/components/conversation/internal/chat-composer-shell.js +155 -163
- package/dist/components/conversation/internal/chat-composer-shell.js.map +1 -1
- package/dist/components/conversation/message-composer.d.ts.map +1 -1
- package/dist/components/conversation/message-composer.js +186 -192
- package/dist/components/conversation/message-composer.js.map +1 -1
- package/dist/components/conversation/paste-token-editor.js +2 -2
- package/dist/components/conversation/paste-token-editor.js.map +1 -1
- package/dist/components/ui/badge/badge.js +1 -1
- package/dist/components/ui/badge/badge.js.map +1 -1
- package/dist/components/ui/input-group/index.d.ts +1 -1
- package/dist/components/ui/input-group/index.d.ts.map +1 -1
- package/dist/components/ui/input-group/index.js +2 -2
- package/dist/components/ui/input-group/input-group.d.ts +34 -9
- package/dist/components/ui/input-group/input-group.d.ts.map +1 -1
- package/dist/components/ui/input-group/input-group.js +101 -28
- package/dist/components/ui/input-group/input-group.js.map +1 -1
- package/dist/components/ui/kbd/kbd.d.ts.map +1 -1
- package/dist/components/ui/kbd/kbd.js +6 -1
- package/dist/components/ui/kbd/kbd.js.map +1 -1
- package/dist/components/ui/message/index.d.ts +1 -1
- package/dist/components/ui/message/index.d.ts.map +1 -1
- package/dist/components/ui/message/index.js +2 -2
- package/dist/components/ui/message/message.d.ts +16 -0
- package/dist/components/ui/message/message.d.ts.map +1 -1
- package/dist/components/ui/message/message.js +52 -1
- package/dist/components/ui/message/message.js.map +1 -1
- package/dist/components/ui/tooltip/tooltip.js +1 -1
- package/dist/components/ui/tooltip/tooltip.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -3
- package/dist/lib/overlay.d.ts +5 -5
- package/dist/lib/overlay.d.ts.map +1 -1
- package/dist/lib/overlay.js +5 -5
- package/dist/lib/overlay.js.map +1 -1
- package/dist/r/conversation.json +1 -2
- package/dist/r/input-group.json +1 -0
- package/dist/r/message.json +4 -1
- package/dist/r/model-selector.json +1 -1
- package/dist/r/prompt-input.json +28 -0
- package/dist/r/registry.json +35 -4
- package/dist/r/src/components/composites/model-selector/model-selector.tsx +19 -25
- package/dist/r/src/components/composites/prompt-input/index.ts +15 -0
- package/dist/r/src/components/composites/prompt-input/prompt-input.tsx +267 -0
- package/dist/r/src/components/conversation/chat-composer.tsx +4 -2
- package/dist/r/src/components/conversation/internal/chat-composer-shell.tsx +27 -38
- package/dist/r/src/components/conversation/message-composer.tsx +93 -97
- package/dist/r/src/components/conversation/paste-token-editor.tsx +2 -2
- package/dist/r/src/components/ui/badge/badge.tsx +1 -1
- package/dist/r/src/components/ui/input-group/index.ts +3 -0
- package/dist/r/src/components/ui/input-group/input-group.tsx +121 -29
- package/dist/r/src/components/ui/kbd/kbd.tsx +3 -0
- package/dist/r/src/components/ui/message/index.ts +3 -0
- package/dist/r/src/components/ui/message/message.tsx +56 -0
- package/dist/r/src/components/ui/tooltip/tooltip.tsx +1 -1
- package/dist/r/src/lib/overlay.ts +5 -6
- package/package.json +1 -1
- package/registry.json +35 -4
- package/src/components/composites/model-selector/model-selector.tsx +19 -25
- package/src/components/composites/prompt-input/index.ts +15 -0
- package/src/components/composites/prompt-input/prompt-input.tsx +267 -0
- package/src/components/conversation/chat-composer.tsx +4 -2
- package/src/components/conversation/internal/chat-composer-shell.tsx +27 -38
- package/src/components/conversation/message-composer.tsx +93 -97
- package/src/components/conversation/paste-token-editor.tsx +2 -2
- package/src/components/ui/badge/badge.tsx +1 -1
- package/src/components/ui/input-group/index.ts +3 -0
- package/src/components/ui/input-group/input-group.tsx +121 -29
- package/src/components/ui/kbd/kbd.tsx +3 -0
- package/src/components/ui/message/index.ts +3 -0
- package/src/components/ui/message/message.tsx +56 -0
- package/src/components/ui/tooltip/tooltip.tsx +1 -1
- package/src/index.ts +1 -0
- package/src/lib/overlay.ts +5 -6
|
@@ -12,7 +12,7 @@ import { cn } from '../../../lib/utils'
|
|
|
12
12
|
* action.
|
|
13
13
|
*/
|
|
14
14
|
export const badgeVariants = cva(
|
|
15
|
-
'inline-flex w-fit shrink-0 items-center justify-center gap-1 whitespace-nowrap rounded-
|
|
15
|
+
'inline-flex w-fit shrink-0 items-center justify-center gap-1 whitespace-nowrap rounded-full border border-transparent font-medium transition-colors [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg]:size-3',
|
|
16
16
|
{
|
|
17
17
|
variants: {
|
|
18
18
|
variant: {
|
|
@@ -4,7 +4,10 @@ export {
|
|
|
4
4
|
InputGroupButton,
|
|
5
5
|
InputGroupInput,
|
|
6
6
|
InputGroupText,
|
|
7
|
+
InputGroupTextarea,
|
|
8
|
+
type InputGroupAddonAlign,
|
|
7
9
|
type InputGroupAddonProps,
|
|
10
|
+
type InputGroupButtonProps,
|
|
8
11
|
type InputGroupProps,
|
|
9
12
|
} from './input-group'
|
|
10
13
|
export { SecretInputGroup, type SecretInputGroupProps } from './secret-input-group'
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import type { ComponentProps, JSX } from 'solid-js'
|
|
2
2
|
import { splitProps } from 'solid-js'
|
|
3
|
+
import { callHandler } from '../../../lib/events'
|
|
3
4
|
import { useFormFieldControl } from '../../../lib/form-field'
|
|
4
5
|
import { cn } from '../../../lib/utils'
|
|
6
|
+
import { Button, type ButtonProps } from '../button'
|
|
5
7
|
|
|
6
8
|
/**
|
|
7
9
|
* InputGroup.
|
|
@@ -19,6 +21,12 @@ import { cn } from '../../../lib/utils'
|
|
|
19
21
|
* `size` is the control rung, matching `Input`: `sm` for a toolbar search beside
|
|
20
22
|
* `icon-sm` actions, `md` (the default) everywhere else. The group's input and
|
|
21
23
|
* text follow it.
|
|
24
|
+
*
|
|
25
|
+
* The part list and alignments follow shadcn's InputGroup: an addon aligned
|
|
26
|
+
* `block-start` or `block-end` turns the group into a column (a header or a
|
|
27
|
+
* footer row around a field), and an `InputGroupTextarea` lets the group grow
|
|
28
|
+
* with its content. That column form is what a prompt input is, so the chat
|
|
29
|
+
* composers are built from these parts instead of their own box.
|
|
22
30
|
*/
|
|
23
31
|
export type InputGroupProps = ComponentProps<'div'> & {
|
|
24
32
|
size?: 'sm' | 'md' | 'lg'
|
|
@@ -29,6 +37,7 @@ export function InputGroup(props: InputGroupProps) {
|
|
|
29
37
|
|
|
30
38
|
return (
|
|
31
39
|
<div
|
|
40
|
+
role="group"
|
|
32
41
|
data-slot="input-group"
|
|
33
42
|
data-size={local.size}
|
|
34
43
|
class={cn(
|
|
@@ -38,10 +47,16 @@ export function InputGroup(props: InputGroupProps) {
|
|
|
38
47
|
'h-control-md px-control-sm': local.size === 'md' || local.size === undefined,
|
|
39
48
|
'h-control-lg px-control-md': local.size === 'lg',
|
|
40
49
|
},
|
|
50
|
+
// A textarea, or an addon on a block edge, makes the group a column
|
|
51
|
+
// that grows with its content: shadcn's prompt-input form.
|
|
52
|
+
'has-[>textarea]:h-auto',
|
|
53
|
+
'has-[>[data-align=block-start]]:h-auto has-[>[data-align=block-start]]:flex-col has-[>[data-align=block-start]]:items-stretch',
|
|
54
|
+
'has-[>[data-align=block-end]]:h-auto has-[>[data-align=block-end]]:flex-col has-[>[data-align=block-end]]:items-stretch',
|
|
41
55
|
'transition-[color,box-shadow,border-color] ease-out',
|
|
42
56
|
'focus-within:border-ring focus-within:ring-3 focus-within:ring-primary-subtle',
|
|
43
57
|
'has-[[aria-invalid=true]]:border-destructive has-[[aria-invalid=true]]:ring-3 has-[[aria-invalid=true]]:ring-destructive-subtle',
|
|
44
58
|
'has-[input:disabled]:cursor-not-allowed has-[input:disabled]:opacity-50',
|
|
59
|
+
'has-[textarea:disabled]:cursor-not-allowed has-[textarea:disabled]:opacity-50',
|
|
45
60
|
local.class
|
|
46
61
|
)}
|
|
47
62
|
{...rest}
|
|
@@ -64,6 +79,7 @@ export function InputGroupInput(props: ComponentProps<'input'>) {
|
|
|
64
79
|
return (
|
|
65
80
|
<input
|
|
66
81
|
data-slot="input-group-input"
|
|
82
|
+
data-input-group-control=""
|
|
67
83
|
id={field?.id ?? local.id}
|
|
68
84
|
aria-label={local['aria-label']}
|
|
69
85
|
aria-labelledby={field?.['aria-labelledby'] ?? local['aria-labelledby']}
|
|
@@ -81,57 +97,132 @@ export function InputGroupInput(props: ComponentProps<'input'>) {
|
|
|
81
97
|
)
|
|
82
98
|
}
|
|
83
99
|
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
100
|
+
/**
|
|
101
|
+
* The multi-line field of a group. It grows with its content up to the
|
|
102
|
+
* group's cap (`max-h-48`, the comfortable textarea ceiling) and then scrolls,
|
|
103
|
+
* so a long draft never pushes the footer row off screen.
|
|
104
|
+
*/
|
|
105
|
+
export function InputGroupTextarea(props: ComponentProps<'textarea'>) {
|
|
106
|
+
const [local, rest] = splitProps(props, [
|
|
107
|
+
'class',
|
|
108
|
+
'id',
|
|
109
|
+
'aria-label',
|
|
110
|
+
'aria-labelledby',
|
|
111
|
+
'aria-describedby',
|
|
112
|
+
'aria-invalid',
|
|
113
|
+
'aria-errormessage',
|
|
114
|
+
])
|
|
115
|
+
const field = useFormFieldControl('control', local)
|
|
116
|
+
|
|
117
|
+
return (
|
|
118
|
+
<textarea
|
|
119
|
+
data-slot="input-group-textarea"
|
|
120
|
+
data-input-group-control=""
|
|
121
|
+
id={field?.id ?? local.id}
|
|
122
|
+
aria-label={local['aria-label']}
|
|
123
|
+
aria-labelledby={field?.['aria-labelledby'] ?? local['aria-labelledby']}
|
|
124
|
+
aria-describedby={field?.['aria-describedby'] ?? local['aria-describedby']}
|
|
125
|
+
aria-invalid={field?.['aria-invalid'] ?? local['aria-invalid']}
|
|
126
|
+
aria-errormessage={field?.['aria-errormessage'] ?? local['aria-errormessage']}
|
|
127
|
+
rows={1}
|
|
128
|
+
class={cn(
|
|
129
|
+
'field-sizing-content max-h-48 min-h-10 w-full min-w-0 flex-1 resize-none bg-transparent py-2 text-sm outline-none',
|
|
130
|
+
'placeholder:text-muted-foreground',
|
|
131
|
+
'disabled:cursor-not-allowed',
|
|
132
|
+
local.class
|
|
133
|
+
)}
|
|
134
|
+
{...rest}
|
|
135
|
+
/>
|
|
136
|
+
)
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
export type InputGroupAddonAlign =
|
|
140
|
+
| 'inline-start'
|
|
141
|
+
| 'inline-end'
|
|
142
|
+
| 'block-start'
|
|
143
|
+
| 'block-end'
|
|
144
|
+
/** @deprecated Use `inline-start`. */
|
|
145
|
+
| 'start'
|
|
146
|
+
/** @deprecated Use `inline-end`. */
|
|
147
|
+
| 'end'
|
|
148
|
+
|
|
149
|
+
export type InputGroupAddonProps = ComponentProps<'div'> & {
|
|
150
|
+
/** Which edge the adornment sits on. Block edges make the group a column. */
|
|
151
|
+
align?: InputGroupAddonAlign
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
function addonAlign(align: InputGroupAddonAlign | undefined) {
|
|
155
|
+
if (align === 'end') return 'inline-end'
|
|
156
|
+
if (align === 'start' || align === undefined) return 'inline-start'
|
|
157
|
+
return align
|
|
87
158
|
}
|
|
88
159
|
|
|
89
160
|
/**
|
|
90
|
-
*
|
|
91
|
-
*
|
|
92
|
-
* the
|
|
93
|
-
*
|
|
161
|
+
* An adornment: an icon, a unit, a row of actions. A press on the addon
|
|
162
|
+
* itself, outside a control it holds, moves focus to the group's field, as in
|
|
163
|
+
* shadcn, so the whole group behaves as one control instead of having a dead
|
|
164
|
+
* strip beside the caret.
|
|
94
165
|
*/
|
|
95
166
|
export function InputGroupAddon(props: InputGroupAddonProps) {
|
|
96
|
-
const [local, rest] = splitProps(props, ['class', 'align', 'children'])
|
|
167
|
+
const [local, rest] = splitProps(props, ['class', 'align', 'children', 'onClick'])
|
|
168
|
+
const align = () => addonAlign(local.align)
|
|
97
169
|
|
|
98
170
|
return (
|
|
99
|
-
<
|
|
171
|
+
<div
|
|
172
|
+
role="group"
|
|
100
173
|
data-slot="input-group-addon"
|
|
174
|
+
data-align={align()}
|
|
101
175
|
class={cn(
|
|
102
|
-
'text-muted-foreground flex shrink-0 items-center gap-1.5 text-sm select-none',
|
|
103
|
-
'[&_svg]:pointer-events-none [
|
|
104
|
-
'group-data-[size=sm]/input-group:text-xs group-data-[size=sm]/input-group:[
|
|
105
|
-
{
|
|
176
|
+
'text-muted-foreground flex shrink-0 cursor-text items-center gap-1.5 text-sm select-none',
|
|
177
|
+
'[&_svg]:pointer-events-none [&>svg]:size-4',
|
|
178
|
+
'group-data-[size=sm]/input-group:text-xs group-data-[size=sm]/input-group:[&>svg]:size-3.5',
|
|
179
|
+
{
|
|
180
|
+
'order-first': align() === 'inline-start' || align() === 'block-start',
|
|
181
|
+
'order-last': align() === 'inline-end' || align() === 'block-end',
|
|
182
|
+
'w-full justify-start gap-1': align() === 'block-start' || align() === 'block-end',
|
|
183
|
+
'pt-2': align() === 'block-start',
|
|
184
|
+
'pb-2': align() === 'block-end',
|
|
185
|
+
},
|
|
106
186
|
local.class
|
|
107
187
|
)}
|
|
188
|
+
onClick={(event) => {
|
|
189
|
+
callHandler(local.onClick, event)
|
|
190
|
+
if (event.defaultPrevented) return
|
|
191
|
+
const target = event.target as Element
|
|
192
|
+
if (target.closest('button, a, input, textarea, select, [role=button], [role=combobox]'))
|
|
193
|
+
return
|
|
194
|
+
const control = event.currentTarget.parentElement?.querySelector<HTMLElement>(
|
|
195
|
+
'[data-input-group-control]'
|
|
196
|
+
)
|
|
197
|
+
control?.focus()
|
|
198
|
+
}}
|
|
108
199
|
{...rest}
|
|
109
200
|
>
|
|
110
201
|
{local.children}
|
|
111
|
-
</
|
|
202
|
+
</div>
|
|
112
203
|
)
|
|
113
204
|
}
|
|
114
205
|
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
206
|
+
export type InputGroupButtonProps = Omit<ButtonProps, 'size'> & {
|
|
207
|
+
/** shadcn's four InputGroupButton sizes, mapped onto the control ladder. */
|
|
208
|
+
size?: 'xs' | 'sm' | 'icon-xs' | 'icon-sm'
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
/**
|
|
212
|
+
* A button inside the group. It is a `Button` (ghost by default), so it shares
|
|
213
|
+
* the system's pressed, focus and disabled states rather than drawing its own.
|
|
214
|
+
*/
|
|
215
|
+
export function InputGroupButton(props: InputGroupButtonProps) {
|
|
216
|
+
const [local, rest] = splitProps(props, ['size', 'variant'])
|
|
118
217
|
|
|
119
218
|
return (
|
|
120
|
-
<
|
|
219
|
+
<Button
|
|
121
220
|
type="button"
|
|
122
221
|
data-slot="input-group-button"
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
'transition-colors ease-out outline-none hover:bg-surface-hover hover:text-foreground',
|
|
126
|
-
'focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-primary-subtle',
|
|
127
|
-
'disabled:pointer-events-none disabled:opacity-50',
|
|
128
|
-
'[&_svg]:size-3.5',
|
|
129
|
-
local.class
|
|
130
|
-
)}
|
|
222
|
+
variant={local.variant ?? 'ghost'}
|
|
223
|
+
size={local.size ?? 'icon-xs'}
|
|
131
224
|
{...rest}
|
|
132
|
-
|
|
133
|
-
{local.children}
|
|
134
|
-
</button>
|
|
225
|
+
/>
|
|
135
226
|
)
|
|
136
227
|
}
|
|
137
228
|
|
|
@@ -140,6 +231,7 @@ export function InputGroupText(props: ComponentProps<'span'> & { children?: JSX.
|
|
|
140
231
|
const [local, rest] = splitProps(props, ['class'])
|
|
141
232
|
return (
|
|
142
233
|
<span
|
|
234
|
+
data-slot="input-group-text"
|
|
143
235
|
class={cn(
|
|
144
236
|
'text-muted-foreground text-sm group-data-[size=sm]/input-group:text-xs',
|
|
145
237
|
local.class
|
|
@@ -27,6 +27,9 @@ export const kbdVariants = cva(
|
|
|
27
27
|
[
|
|
28
28
|
'bg-muted text-muted-foreground pointer-events-none inline-flex min-h-5 w-fit min-w-5 items-center justify-center gap-1 rounded-sm px-1 font-sans text-xs font-medium select-none',
|
|
29
29
|
"[&_svg:not([class*='size-'])]:size-3",
|
|
30
|
+
// Inside the inverted tooltip chip the cap inverts with it, as in shadcn.
|
|
31
|
+
'[[data-slot=tooltip-content]_&]:bg-background/20 [[data-slot=tooltip-content]_&]:text-background',
|
|
32
|
+
'[[data-slot=side-rail-tip]_&]:bg-background/20 [[data-slot=side-rail-tip]_&]:text-background',
|
|
30
33
|
],
|
|
31
34
|
{
|
|
32
35
|
variants: {
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
export {
|
|
2
2
|
Message,
|
|
3
|
+
MessageAction,
|
|
3
4
|
MessageActions,
|
|
5
|
+
MessageCopyAction,
|
|
4
6
|
MessageContent,
|
|
5
7
|
MessageFooter,
|
|
6
8
|
MessageHeader,
|
|
@@ -8,6 +10,7 @@ export {
|
|
|
8
10
|
type MessageCitations,
|
|
9
11
|
type MessageCodeBlockInfo,
|
|
10
12
|
type MessageCodeBlockProps,
|
|
13
|
+
type MessageActionProps,
|
|
11
14
|
type MessageProps,
|
|
12
15
|
type MessageRole,
|
|
13
16
|
type MessageTextProps,
|
|
@@ -9,7 +9,10 @@ import {
|
|
|
9
9
|
type ComponentProps,
|
|
10
10
|
type JSX,
|
|
11
11
|
} from 'solid-js'
|
|
12
|
+
import { Check, Copy } from 'lucide-solid'
|
|
13
|
+
import { createCopyFeedback } from '../../../lib/clipboard'
|
|
12
14
|
import { cn } from '../../../lib/utils'
|
|
15
|
+
import { ActionButton, type ActionButtonProps } from '../../composites/action-button'
|
|
13
16
|
import { CodeBlock, InlineCode, type CodeBlockProps } from '../code-block'
|
|
14
17
|
import {
|
|
15
18
|
parseMessageTextIncremental,
|
|
@@ -141,6 +144,59 @@ export function MessageActions(props: ComponentProps<'div'>) {
|
|
|
141
144
|
)
|
|
142
145
|
}
|
|
143
146
|
|
|
147
|
+
export type MessageActionProps = Omit<ActionButtonProps, 'tooltip' | 'aria-label'> & {
|
|
148
|
+
/** The action's name: its accessible name and its tooltip. */
|
|
149
|
+
label: string
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
/**
|
|
153
|
+
* One action on a turn: an icon button whose name is also its tooltip, as in
|
|
154
|
+
* AI Elements' MessageAction. Turn actions are icons, never words, so a row of
|
|
155
|
+
* them stays one line under any message.
|
|
156
|
+
*/
|
|
157
|
+
export function MessageAction(props: MessageActionProps) {
|
|
158
|
+
const [local, rest] = splitProps(props, ['label'])
|
|
159
|
+
return (
|
|
160
|
+
<ActionButton
|
|
161
|
+
type="button"
|
|
162
|
+
variant="ghost"
|
|
163
|
+
size="icon-xs"
|
|
164
|
+
data-slot="message-action"
|
|
165
|
+
aria-label={local.label}
|
|
166
|
+
tooltip={local.label}
|
|
167
|
+
tooltipSide="bottom"
|
|
168
|
+
{...(rest as ActionButtonProps)}
|
|
169
|
+
/>
|
|
170
|
+
)
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
/** Copies the turn's text and shows a check for a moment once the clipboard took it. */
|
|
174
|
+
export function MessageCopyAction(
|
|
175
|
+
props: Omit<MessageActionProps, 'label' | 'children' | 'onClick'> & {
|
|
176
|
+
text: string | (() => string)
|
|
177
|
+
label?: string
|
|
178
|
+
}
|
|
179
|
+
) {
|
|
180
|
+
const [local, rest] = splitProps(props, ['text', 'label'])
|
|
181
|
+
const feedback = createCopyFeedback()
|
|
182
|
+
const label = () =>
|
|
183
|
+
feedback.copied() ? 'Copied' : feedback.failed() ? 'Copy failed' : (local.label ?? 'Copy')
|
|
184
|
+
return (
|
|
185
|
+
<MessageAction
|
|
186
|
+
label={label()}
|
|
187
|
+
onClick={() => {
|
|
188
|
+
const text = typeof local.text === 'function' ? local.text() : local.text
|
|
189
|
+
void feedback.copy(text)
|
|
190
|
+
}}
|
|
191
|
+
{...rest}
|
|
192
|
+
>
|
|
193
|
+
<Show when={feedback.copied()} fallback={<Copy />}>
|
|
194
|
+
<Check />
|
|
195
|
+
</Show>
|
|
196
|
+
</MessageAction>
|
|
197
|
+
)
|
|
198
|
+
}
|
|
199
|
+
|
|
144
200
|
export function MessageFooter(props: ComponentProps<'footer'>) {
|
|
145
201
|
const [local, rest] = splitProps(props, ['class', 'children'])
|
|
146
202
|
return (
|
|
@@ -418,7 +418,7 @@ export function TooltipContent(props: TooltipContentProps) {
|
|
|
418
418
|
// The max width is a token, not a fixed measure: it has to fall
|
|
419
419
|
// behind the viewport at large root font sizes or the tip — which
|
|
420
420
|
// Kobalte can shift but never shrink — forces a horizontal scroll.
|
|
421
|
-
'z-(--z-tooltip) w-fit max-w-(--tooltip-max-width) px-
|
|
421
|
+
'z-(--z-tooltip) w-fit max-w-(--tooltip-max-width) px-3 py-1.5',
|
|
422
422
|
'origin-(--kb-tooltip-content-transform-origin) text-balance',
|
|
423
423
|
tooltipMotion,
|
|
424
424
|
// An icon+label tip is one row that reads as a unit, so the label
|
|
@@ -66,13 +66,12 @@ export const overlayCornerClose =
|
|
|
66
66
|
'focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-primary-subtle outline-none'
|
|
67
67
|
|
|
68
68
|
/**
|
|
69
|
-
* The tip:
|
|
70
|
-
*
|
|
71
|
-
*
|
|
72
|
-
* languages.
|
|
69
|
+
* The tip: shadcn's inverted chip, foreground on background, so an explanation
|
|
70
|
+
* never reads as a popover that could hold controls. The side rail draws it
|
|
71
|
+
* flush to a collapsed row and every floating tooltip composes the same fill
|
|
72
|
+
* and type, so a control never explains itself in two visual languages.
|
|
73
73
|
*/
|
|
74
|
-
export const tooltipTip =
|
|
75
|
-
'bg-card text-card-foreground rounded-md border border-border text-sm font-medium shadow-lg'
|
|
74
|
+
export const tooltipTip = 'bg-foreground text-background rounded-md text-xs font-medium'
|
|
76
75
|
|
|
77
76
|
/**
|
|
78
77
|
* Entrance and exit motion, expressed as data-state classes.
|
package/package.json
CHANGED
package/registry.json
CHANGED
|
@@ -880,6 +880,7 @@
|
|
|
880
880
|
"dependencies": [],
|
|
881
881
|
"registryDependencies": [
|
|
882
882
|
"@adea-ai/ui/action-button",
|
|
883
|
+
"@adea-ai/ui/button",
|
|
883
884
|
"lib"
|
|
884
885
|
],
|
|
885
886
|
"files": [
|
|
@@ -1047,8 +1048,11 @@
|
|
|
1047
1048
|
"type": "registry:ui",
|
|
1048
1049
|
"title": "Message",
|
|
1049
1050
|
"description": "",
|
|
1050
|
-
"dependencies": [
|
|
1051
|
+
"dependencies": [
|
|
1052
|
+
"lucide-solid@^1.71.0"
|
|
1053
|
+
],
|
|
1051
1054
|
"registryDependencies": [
|
|
1055
|
+
"@adea-ai/ui/action-button",
|
|
1052
1056
|
"@adea-ai/ui/code-block",
|
|
1053
1057
|
"lib"
|
|
1054
1058
|
],
|
|
@@ -2807,10 +2811,10 @@
|
|
|
2807
2811
|
"lucide-solid@^1.71.0"
|
|
2808
2812
|
],
|
|
2809
2813
|
"registryDependencies": [
|
|
2810
|
-
"@adea-ai/ui/button",
|
|
2811
2814
|
"@adea-ai/ui/command",
|
|
2812
2815
|
"@adea-ai/ui/dropdown-menu",
|
|
2813
2816
|
"@adea-ai/ui/popover",
|
|
2817
|
+
"@adea-ai/ui/prompt-input",
|
|
2814
2818
|
"@adea-ai/ui/tabs",
|
|
2815
2819
|
"lib"
|
|
2816
2820
|
],
|
|
@@ -2859,6 +2863,34 @@
|
|
|
2859
2863
|
}
|
|
2860
2864
|
]
|
|
2861
2865
|
},
|
|
2866
|
+
{
|
|
2867
|
+
"name": "prompt-input",
|
|
2868
|
+
"type": "registry:ui",
|
|
2869
|
+
"title": "Prompt Input",
|
|
2870
|
+
"description": "",
|
|
2871
|
+
"dependencies": [
|
|
2872
|
+
"lucide-solid@^1.71.0"
|
|
2873
|
+
],
|
|
2874
|
+
"registryDependencies": [
|
|
2875
|
+
"@adea-ai/ui/action-button",
|
|
2876
|
+
"@adea-ai/ui/button",
|
|
2877
|
+
"@adea-ai/ui/input-group",
|
|
2878
|
+
"@adea-ai/ui/spinner",
|
|
2879
|
+
"lib"
|
|
2880
|
+
],
|
|
2881
|
+
"files": [
|
|
2882
|
+
{
|
|
2883
|
+
"path": "src/components/composites/prompt-input/index.ts",
|
|
2884
|
+
"type": "registry:ui",
|
|
2885
|
+
"target": "components/composites/prompt-input/index.ts"
|
|
2886
|
+
},
|
|
2887
|
+
{
|
|
2888
|
+
"path": "src/components/composites/prompt-input/prompt-input.tsx",
|
|
2889
|
+
"type": "registry:ui",
|
|
2890
|
+
"target": "components/composites/prompt-input/prompt-input.tsx"
|
|
2891
|
+
}
|
|
2892
|
+
]
|
|
2893
|
+
},
|
|
2862
2894
|
{
|
|
2863
2895
|
"name": "queue",
|
|
2864
2896
|
"type": "registry:ui",
|
|
@@ -3392,8 +3424,7 @@
|
|
|
3392
3424
|
"@adea-ai/ui/dropdown-menu",
|
|
3393
3425
|
"@adea-ai/ui/kbd",
|
|
3394
3426
|
"@adea-ai/ui/message",
|
|
3395
|
-
"@adea-ai/ui/
|
|
3396
|
-
"@adea-ai/ui/textarea",
|
|
3427
|
+
"@adea-ai/ui/prompt-input",
|
|
3397
3428
|
"@adea-ai/ui/tooltip",
|
|
3398
3429
|
"lib"
|
|
3399
3430
|
],
|
|
@@ -14,7 +14,7 @@ import {
|
|
|
14
14
|
type JSX,
|
|
15
15
|
} from 'solid-js'
|
|
16
16
|
import { cn } from '#lib/utils'
|
|
17
|
-
import {
|
|
17
|
+
import { PromptInputControl } from '../prompt-input'
|
|
18
18
|
import {
|
|
19
19
|
Command,
|
|
20
20
|
CommandEmpty,
|
|
@@ -236,19 +236,21 @@ function triggerText(props: { selected?: ModelOption; value?: string }): string
|
|
|
236
236
|
}
|
|
237
237
|
|
|
238
238
|
function ModelOptionBody(props: { model: ModelOption }) {
|
|
239
|
+
// One line per row: the name, then the reason it is unavailable or its
|
|
240
|
+
// description, muted and truncated; the full text is the row's title.
|
|
241
|
+
const secondary = () => props.model.disabledReason ?? props.model.description
|
|
239
242
|
return (
|
|
240
|
-
<span class="flex min-w-0
|
|
241
|
-
<span class="
|
|
242
|
-
<Show when={
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
</span>
|
|
243
|
+
<span class="flex min-w-0 items-baseline gap-2" title={secondary()}>
|
|
244
|
+
<span class="shrink-0 truncate">{boundText(props.model.label, 60)}</span>
|
|
245
|
+
<Show when={secondary()}>
|
|
246
|
+
{(text) => (
|
|
247
|
+
<span class="min-w-0 truncate text-xs text-muted-foreground">
|
|
248
|
+
<Show when={props.model.disabledReason}>
|
|
249
|
+
<span class="visually-hidden">Unavailable: </span>
|
|
250
|
+
</Show>
|
|
251
|
+
{boundText(text(), 160)}
|
|
252
|
+
</span>
|
|
253
|
+
)}
|
|
252
254
|
</Show>
|
|
253
255
|
</span>
|
|
254
256
|
)
|
|
@@ -291,9 +293,7 @@ function ModelMenu(props: PickerProps) {
|
|
|
291
293
|
gutter={6}
|
|
292
294
|
>
|
|
293
295
|
<DropdownMenuTrigger
|
|
294
|
-
as={
|
|
295
|
-
variant="ghost"
|
|
296
|
-
size="sm"
|
|
296
|
+
as={PromptInputControl}
|
|
297
297
|
aria-label={`Model: ${props.models.length === 0 ? 'No models available' : triggerText(props)}`}
|
|
298
298
|
aria-disabled={inert() || undefined}
|
|
299
299
|
aria-describedby={props.describedBy}
|
|
@@ -354,9 +354,7 @@ function ModelSearch(props: PickerProps) {
|
|
|
354
354
|
gutter={6}
|
|
355
355
|
>
|
|
356
356
|
<PopoverTrigger
|
|
357
|
-
as={
|
|
358
|
-
variant="ghost"
|
|
359
|
-
size="sm"
|
|
357
|
+
as={PromptInputControl}
|
|
360
358
|
aria-label={`Model: ${triggerText(props)}`}
|
|
361
359
|
aria-disabled={props.blocked || undefined}
|
|
362
360
|
aria-describedby={props.describedBy}
|
|
@@ -456,9 +454,7 @@ function ModelTabs(props: PickerProps & { providerIcon?: (provider: string) => J
|
|
|
456
454
|
gutter={6}
|
|
457
455
|
>
|
|
458
456
|
<PopoverTrigger
|
|
459
|
-
as={
|
|
460
|
-
variant="ghost"
|
|
461
|
-
size="sm"
|
|
457
|
+
as={PromptInputControl}
|
|
462
458
|
aria-label={`Model: ${props.models.length === 0 ? 'No models available' : triggerText(props)}`}
|
|
463
459
|
aria-disabled={inert() || undefined}
|
|
464
460
|
aria-describedby={props.describedBy}
|
|
@@ -569,9 +565,7 @@ function EffortMenu(props: {
|
|
|
569
565
|
gutter={6}
|
|
570
566
|
>
|
|
571
567
|
<DropdownMenuTrigger
|
|
572
|
-
as={
|
|
573
|
-
variant="ghost"
|
|
574
|
-
size="sm"
|
|
568
|
+
as={PromptInputControl}
|
|
575
569
|
aria-label={`Thinking effort: ${label() ?? 'not set'}`}
|
|
576
570
|
aria-disabled={props.blocked || undefined}
|
|
577
571
|
aria-describedby={props.describedBy}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export {
|
|
2
|
+
PromptInput,
|
|
3
|
+
PromptInputBody,
|
|
4
|
+
PromptInputButton,
|
|
5
|
+
PromptInputControl,
|
|
6
|
+
PromptInputFooter,
|
|
7
|
+
PromptInputHeader,
|
|
8
|
+
PromptInputSubmit,
|
|
9
|
+
PromptInputTextarea,
|
|
10
|
+
PromptInputTools,
|
|
11
|
+
type PromptInputProps,
|
|
12
|
+
type PromptInputStatus,
|
|
13
|
+
type PromptInputSubmitProps,
|
|
14
|
+
type PromptInputTextareaProps,
|
|
15
|
+
} from './prompt-input'
|