ai-design-system 0.1.104 → 0.1.105
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/components/composites/PromptInput/PromptInput.tsx +23 -12
- package/dist/index.cjs +75 -66
- package/dist/index.cjs.map +1 -1
- package/dist/index.css +22 -3
- package/dist/index.d.ts +33 -33
- package/dist/index.js +75 -66
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -35,6 +35,7 @@ import { SpeechInput, type SpeechInputProps } from "@/components/ai-elements/spe
|
|
|
35
35
|
import type { FormEvent } from "react";
|
|
36
36
|
import { Button } from "@/components/primitives/Button";
|
|
37
37
|
import { Icon } from "@/components/primitives/Icon";
|
|
38
|
+
import { InputGroupAddon } from "@/components/primitives/InputGroup";
|
|
38
39
|
import { cn } from "@/lib/utils";
|
|
39
40
|
|
|
40
41
|
export interface PromptInputContextProps {
|
|
@@ -93,6 +94,7 @@ export const PromptInput = React.memo<PromptInputBlockProps>(
|
|
|
93
94
|
maxFiles,
|
|
94
95
|
maxFileSize,
|
|
95
96
|
onError,
|
|
97
|
+
className,
|
|
96
98
|
...props
|
|
97
99
|
}) => {
|
|
98
100
|
const isRowVariant = variant === "row" || variant === "inline";
|
|
@@ -140,30 +142,34 @@ export const PromptInput = React.memo<PromptInputBlockProps>(
|
|
|
140
142
|
maxFiles={maxFiles}
|
|
141
143
|
maxFileSize={maxFileSize}
|
|
142
144
|
onError={onError}
|
|
145
|
+
className={cn(
|
|
146
|
+
"[&>[data-slot=input-group]]:rounded-2xl",
|
|
147
|
+
className?.includes("border") &&
|
|
148
|
+
"[&>[data-slot=input-group]]:border-0 [&>[data-slot=input-group]]:bg-transparent [&>[data-slot=input-group]]:shadow-none",
|
|
149
|
+
className
|
|
150
|
+
)}
|
|
143
151
|
{...props}
|
|
144
152
|
>
|
|
145
|
-
<
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
</PromptInputBody>
|
|
154
|
-
<div className="pr-1.5 shrink-0 flex items-center self-center">
|
|
153
|
+
{showAttachments && <AttachmentPreviews />}
|
|
154
|
+
<PromptInputTextarea
|
|
155
|
+
placeholder={placeholder}
|
|
156
|
+
disabled={disabled}
|
|
157
|
+
onChange={isControlled ? handleControlledChange : undefined}
|
|
158
|
+
className="min-h-9 py-2 px-3 text-sm resize-none border-0 shadow-none focus-visible:ring-0 bg-transparent flex-1 field-sizing-content"
|
|
159
|
+
/>
|
|
160
|
+
<InputGroupAddon align="inline-end" className="self-end pb-1 pr-1.5 shrink-0">
|
|
155
161
|
<PromptInputSubmit
|
|
156
162
|
disabled={disabled || (loading && !onStop)}
|
|
157
163
|
status={loading ? (onStop ? "streaming" : "submitted") : undefined}
|
|
158
164
|
onClick={isStopping ? (e: React.MouseEvent) => { e.preventDefault(); onStop?.(); } : undefined}
|
|
159
165
|
className={cn(
|
|
160
|
-
"
|
|
166
|
+
"rounded-lg bg-blue-600 hover:bg-blue-700 text-white transition-colors",
|
|
161
167
|
isStopping && "bg-transparent hover:bg-accent"
|
|
162
168
|
)}
|
|
163
169
|
>
|
|
164
170
|
{loading ? undefined : <Icon name="corner-down-left" size="sm" />}
|
|
165
171
|
</PromptInputSubmit>
|
|
166
|
-
</
|
|
172
|
+
</InputGroupAddon>
|
|
167
173
|
</AIPromptInput>
|
|
168
174
|
) : (
|
|
169
175
|
<AIPromptInput
|
|
@@ -173,6 +179,11 @@ export const PromptInput = React.memo<PromptInputBlockProps>(
|
|
|
173
179
|
maxFiles={maxFiles}
|
|
174
180
|
maxFileSize={maxFileSize}
|
|
175
181
|
onError={onError}
|
|
182
|
+
className={cn(
|
|
183
|
+
className?.includes("border") &&
|
|
184
|
+
"[&>[data-slot=input-group]]:border-0 [&>[data-slot=input-group]]:bg-transparent [&>[data-slot=input-group]]:shadow-none",
|
|
185
|
+
className
|
|
186
|
+
)}
|
|
176
187
|
{...props}
|
|
177
188
|
>
|
|
178
189
|
<PromptInputBody>
|
package/dist/index.cjs
CHANGED
|
@@ -6825,6 +6825,54 @@ var SpeechInput = React3__namespace.memo(
|
|
|
6825
6825
|
}
|
|
6826
6826
|
);
|
|
6827
6827
|
SpeechInput.displayName = "SpeechInput";
|
|
6828
|
+
var InputGroup2 = React3__namespace.memo(
|
|
6829
|
+
React3__namespace.forwardRef(
|
|
6830
|
+
(props, ref) => {
|
|
6831
|
+
return /* @__PURE__ */ jsxRuntime.jsx(InputGroup, __spreadValues({ ref }, props));
|
|
6832
|
+
}
|
|
6833
|
+
)
|
|
6834
|
+
);
|
|
6835
|
+
InputGroup2.displayName = "InputGroup";
|
|
6836
|
+
var InputGroupAddon2 = React3__namespace.memo(
|
|
6837
|
+
React3__namespace.forwardRef(
|
|
6838
|
+
(props, ref) => {
|
|
6839
|
+
return /* @__PURE__ */ jsxRuntime.jsx(InputGroupAddon, __spreadValues({ ref }, props));
|
|
6840
|
+
}
|
|
6841
|
+
)
|
|
6842
|
+
);
|
|
6843
|
+
InputGroupAddon2.displayName = "InputGroupAddon";
|
|
6844
|
+
var InputGroupButton2 = React3__namespace.memo(
|
|
6845
|
+
React3__namespace.forwardRef(
|
|
6846
|
+
(props, ref) => {
|
|
6847
|
+
return /* @__PURE__ */ jsxRuntime.jsx(InputGroupButton, __spreadValues({ ref }, props));
|
|
6848
|
+
}
|
|
6849
|
+
)
|
|
6850
|
+
);
|
|
6851
|
+
InputGroupButton2.displayName = "InputGroupButton";
|
|
6852
|
+
var InputGroupInput2 = React3__namespace.memo(
|
|
6853
|
+
React3__namespace.forwardRef(
|
|
6854
|
+
(props, ref) => {
|
|
6855
|
+
return /* @__PURE__ */ jsxRuntime.jsx(InputGroupInput, __spreadValues({ ref }, props));
|
|
6856
|
+
}
|
|
6857
|
+
)
|
|
6858
|
+
);
|
|
6859
|
+
InputGroupInput2.displayName = "InputGroupInput";
|
|
6860
|
+
var InputGroupText2 = React3__namespace.memo(
|
|
6861
|
+
React3__namespace.forwardRef(
|
|
6862
|
+
(props, ref) => {
|
|
6863
|
+
return /* @__PURE__ */ jsxRuntime.jsx(InputGroupText, __spreadValues({ ref }, props));
|
|
6864
|
+
}
|
|
6865
|
+
)
|
|
6866
|
+
);
|
|
6867
|
+
InputGroupText2.displayName = "InputGroupText";
|
|
6868
|
+
var InputGroupTextarea2 = React3__namespace.memo(
|
|
6869
|
+
React3__namespace.forwardRef(
|
|
6870
|
+
(props, ref) => {
|
|
6871
|
+
return /* @__PURE__ */ jsxRuntime.jsx(InputGroupTextarea, __spreadValues({ ref }, props));
|
|
6872
|
+
}
|
|
6873
|
+
)
|
|
6874
|
+
);
|
|
6875
|
+
InputGroupTextarea2.displayName = "InputGroupTextarea";
|
|
6828
6876
|
var PromptInput2 = React3__namespace.memo(
|
|
6829
6877
|
(_a) => {
|
|
6830
6878
|
var _b = _a, {
|
|
@@ -6847,7 +6895,8 @@ var PromptInput2 = React3__namespace.memo(
|
|
|
6847
6895
|
multiple = true,
|
|
6848
6896
|
maxFiles,
|
|
6849
6897
|
maxFileSize,
|
|
6850
|
-
onError
|
|
6898
|
+
onError,
|
|
6899
|
+
className
|
|
6851
6900
|
} = _b, props = __objRest(_b, [
|
|
6852
6901
|
"variant",
|
|
6853
6902
|
"disabled",
|
|
@@ -6868,7 +6917,8 @@ var PromptInput2 = React3__namespace.memo(
|
|
|
6868
6917
|
"multiple",
|
|
6869
6918
|
"maxFiles",
|
|
6870
6919
|
"maxFileSize",
|
|
6871
|
-
"onError"
|
|
6920
|
+
"onError",
|
|
6921
|
+
"className"
|
|
6872
6922
|
]);
|
|
6873
6923
|
const isRowVariant = variant === "row" || variant === "inline";
|
|
6874
6924
|
const showAttachments = enableAttachments != null ? enableAttachments : !isRowVariant;
|
|
@@ -6908,22 +6958,25 @@ var PromptInput2 = React3__namespace.memo(
|
|
|
6908
6958
|
multiple,
|
|
6909
6959
|
maxFiles,
|
|
6910
6960
|
maxFileSize,
|
|
6911
|
-
onError
|
|
6961
|
+
onError,
|
|
6962
|
+
className: cn(
|
|
6963
|
+
"[&>[data-slot=input-group]]:rounded-2xl",
|
|
6964
|
+
(className == null ? void 0 : className.includes("border")) && "[&>[data-slot=input-group]]:border-0 [&>[data-slot=input-group]]:bg-transparent [&>[data-slot=input-group]]:shadow-none",
|
|
6965
|
+
className
|
|
6966
|
+
)
|
|
6912
6967
|
}, props), {
|
|
6913
6968
|
children: [
|
|
6914
|
-
/* @__PURE__ */ jsxRuntime.
|
|
6915
|
-
|
|
6916
|
-
|
|
6917
|
-
|
|
6918
|
-
|
|
6919
|
-
|
|
6920
|
-
|
|
6921
|
-
|
|
6922
|
-
|
|
6923
|
-
|
|
6924
|
-
|
|
6925
|
-
] }),
|
|
6926
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "pr-1.5 shrink-0 flex items-center self-center", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
6969
|
+
showAttachments && /* @__PURE__ */ jsxRuntime.jsx(AttachmentPreviews, {}),
|
|
6970
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
6971
|
+
PromptInputTextarea,
|
|
6972
|
+
{
|
|
6973
|
+
placeholder,
|
|
6974
|
+
disabled,
|
|
6975
|
+
onChange: isControlled ? handleControlledChange : void 0,
|
|
6976
|
+
className: "min-h-9 py-2 px-3 text-sm resize-none border-0 shadow-none focus-visible:ring-0 bg-transparent flex-1 field-sizing-content"
|
|
6977
|
+
}
|
|
6978
|
+
),
|
|
6979
|
+
/* @__PURE__ */ jsxRuntime.jsx(InputGroupAddon2, { align: "inline-end", className: "self-end pb-1 pr-1.5 shrink-0", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
6927
6980
|
PromptInputSubmit,
|
|
6928
6981
|
{
|
|
6929
6982
|
disabled: disabled || loading && !onStop,
|
|
@@ -6933,7 +6986,7 @@ var PromptInput2 = React3__namespace.memo(
|
|
|
6933
6986
|
onStop == null ? void 0 : onStop();
|
|
6934
6987
|
} : void 0,
|
|
6935
6988
|
className: cn(
|
|
6936
|
-
"
|
|
6989
|
+
"rounded-lg bg-blue-600 hover:bg-blue-700 text-white transition-colors",
|
|
6937
6990
|
isStopping && "bg-transparent hover:bg-accent"
|
|
6938
6991
|
),
|
|
6939
6992
|
children: loading ? void 0 : /* @__PURE__ */ jsxRuntime.jsx(Icon, { name: "corner-down-left", size: "sm" })
|
|
@@ -6949,7 +7002,11 @@ var PromptInput2 = React3__namespace.memo(
|
|
|
6949
7002
|
multiple,
|
|
6950
7003
|
maxFiles,
|
|
6951
7004
|
maxFileSize,
|
|
6952
|
-
onError
|
|
7005
|
+
onError,
|
|
7006
|
+
className: cn(
|
|
7007
|
+
(className == null ? void 0 : className.includes("border")) && "[&>[data-slot=input-group]]:border-0 [&>[data-slot=input-group]]:bg-transparent [&>[data-slot=input-group]]:shadow-none",
|
|
7008
|
+
className
|
|
7009
|
+
)
|
|
6953
7010
|
}, props), {
|
|
6954
7011
|
children: [
|
|
6955
7012
|
/* @__PURE__ */ jsxRuntime.jsxs(PromptInputBody, { children: [
|
|
@@ -9484,54 +9541,6 @@ var HoverCardContent2 = React3__namespace.memo(
|
|
|
9484
9541
|
)
|
|
9485
9542
|
);
|
|
9486
9543
|
HoverCardContent2.displayName = "HoverCardContent";
|
|
9487
|
-
var InputGroup2 = React3__namespace.memo(
|
|
9488
|
-
React3__namespace.forwardRef(
|
|
9489
|
-
(props, ref) => {
|
|
9490
|
-
return /* @__PURE__ */ jsxRuntime.jsx(InputGroup, __spreadValues({ ref }, props));
|
|
9491
|
-
}
|
|
9492
|
-
)
|
|
9493
|
-
);
|
|
9494
|
-
InputGroup2.displayName = "InputGroup";
|
|
9495
|
-
var InputGroupAddon2 = React3__namespace.memo(
|
|
9496
|
-
React3__namespace.forwardRef(
|
|
9497
|
-
(props, ref) => {
|
|
9498
|
-
return /* @__PURE__ */ jsxRuntime.jsx(InputGroupAddon, __spreadValues({ ref }, props));
|
|
9499
|
-
}
|
|
9500
|
-
)
|
|
9501
|
-
);
|
|
9502
|
-
InputGroupAddon2.displayName = "InputGroupAddon";
|
|
9503
|
-
var InputGroupButton2 = React3__namespace.memo(
|
|
9504
|
-
React3__namespace.forwardRef(
|
|
9505
|
-
(props, ref) => {
|
|
9506
|
-
return /* @__PURE__ */ jsxRuntime.jsx(InputGroupButton, __spreadValues({ ref }, props));
|
|
9507
|
-
}
|
|
9508
|
-
)
|
|
9509
|
-
);
|
|
9510
|
-
InputGroupButton2.displayName = "InputGroupButton";
|
|
9511
|
-
var InputGroupInput2 = React3__namespace.memo(
|
|
9512
|
-
React3__namespace.forwardRef(
|
|
9513
|
-
(props, ref) => {
|
|
9514
|
-
return /* @__PURE__ */ jsxRuntime.jsx(InputGroupInput, __spreadValues({ ref }, props));
|
|
9515
|
-
}
|
|
9516
|
-
)
|
|
9517
|
-
);
|
|
9518
|
-
InputGroupInput2.displayName = "InputGroupInput";
|
|
9519
|
-
var InputGroupText2 = React3__namespace.memo(
|
|
9520
|
-
React3__namespace.forwardRef(
|
|
9521
|
-
(props, ref) => {
|
|
9522
|
-
return /* @__PURE__ */ jsxRuntime.jsx(InputGroupText, __spreadValues({ ref }, props));
|
|
9523
|
-
}
|
|
9524
|
-
)
|
|
9525
|
-
);
|
|
9526
|
-
InputGroupText2.displayName = "InputGroupText";
|
|
9527
|
-
var InputGroupTextarea2 = React3__namespace.memo(
|
|
9528
|
-
React3__namespace.forwardRef(
|
|
9529
|
-
(props, ref) => {
|
|
9530
|
-
return /* @__PURE__ */ jsxRuntime.jsx(InputGroupTextarea, __spreadValues({ ref }, props));
|
|
9531
|
-
}
|
|
9532
|
-
)
|
|
9533
|
-
);
|
|
9534
|
-
InputGroupTextarea2.displayName = "InputGroupTextarea";
|
|
9535
9544
|
var Progress2 = React3__namespace.memo(
|
|
9536
9545
|
React3__namespace.forwardRef(
|
|
9537
9546
|
(props, ref) => {
|