@copilotz/chat-ui 0.1.35 → 0.1.36
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/index.cjs +22 -25
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +22 -25
- package/dist/index.js.map +1 -1
- package/dist/styles.css +48 -6
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -3258,14 +3258,14 @@ var VoiceComposer = ({
|
|
|
3258
3258
|
}) => {
|
|
3259
3259
|
const transcriptText = resolveTranscriptText(transcript, transcriptMode);
|
|
3260
3260
|
const countdownSeconds = Math.max(1, Math.ceil(countdownMs / 1e3));
|
|
3261
|
-
const countdownValue = autoSendDelayMs > 0 ? Math.min(100, Math.max(0, (autoSendDelayMs - countdownMs) / autoSendDelayMs * 100)) : 100;
|
|
3262
3261
|
const isBusy = state === "preparing" || state === "finishing" || state === "sending";
|
|
3263
3262
|
const isCapturing = state === "waiting_for_speech" || state === "listening";
|
|
3264
3263
|
const hasDraft = Boolean(attachment);
|
|
3265
3264
|
const isDraftLayout = hasDraft;
|
|
3266
3265
|
const isArmedDraft = isDraftLayout && reviewMode === "armed" && (state === "waiting_for_speech" || state === "listening");
|
|
3266
|
+
const draftStatusLabel = state === "listening" ? labels?.voiceListening || "Listening..." : state === "waiting_for_speech" ? labels?.voiceWaiting || "Waiting for speech..." : state === "finishing" ? labels?.voiceFinishing || "Finishing capture..." : state === "sending" ? labels?.voiceSending || "Sending..." : labels?.voiceReview || "Ready to send";
|
|
3267
3267
|
const levelValue = isCapturing || state === "preparing" || state === "finishing" ? Math.max(8, Math.round(audioLevel * 100)) : 0;
|
|
3268
|
-
const headerLabel = hasDraft && state !== "sending" && state !== "error" ?
|
|
3268
|
+
const headerLabel = hasDraft && state !== "sending" && state !== "error" ? draftStatusLabel : state === "error" ? labels?.voiceCaptureError || "Unable to capture audio." : resolveStateLabel(state, labels, errorMessage);
|
|
3269
3269
|
const reviewHelperText = isArmedDraft ? labels?.voiceReviewArmedHint || "Speak to add more before it sends." : labels?.voiceReviewPausedHint || labels?.voiceRecordAgain || "Tap the mic to continue this message.";
|
|
3270
3270
|
const orbIsListening = state === "listening";
|
|
3271
3271
|
const orbCanStop = !isDraftLayout && (state === "waiting_for_speech" || state === "listening");
|
|
@@ -3281,11 +3281,11 @@ var VoiceComposer = ({
|
|
|
3281
3281
|
}
|
|
3282
3282
|
onRecordAgain();
|
|
3283
3283
|
};
|
|
3284
|
-
return /* @__PURE__ */ jsxs11("div", { className: "w-full max-w-3xl rounded-
|
|
3284
|
+
return /* @__PURE__ */ jsxs11("div", { className: "w-full max-w-3xl rounded-2xl border bg-background p-3 shadow-sm sm:p-4 md:min-w-3xl", children: [
|
|
3285
3285
|
/* @__PURE__ */ jsxs11("div", { className: "flex items-center justify-between gap-2 sm:gap-3", children: [
|
|
3286
3286
|
/* @__PURE__ */ jsxs11("div", { className: "flex min-w-0 items-center gap-2", children: [
|
|
3287
3287
|
/* @__PURE__ */ jsx21(Badge, { variant: "outline", children: labels?.voiceTitle || "Voice" }),
|
|
3288
|
-
/* @__PURE__ */ jsx21("span", { className: "truncate text-
|
|
3288
|
+
/* @__PURE__ */ jsx21("span", { className: "truncate rounded-full bg-muted px-2.5 py-1 text-[11px] sm:text-xs text-muted-foreground", children: headerLabel })
|
|
3289
3289
|
] }),
|
|
3290
3290
|
/* @__PURE__ */ jsxs11(
|
|
3291
3291
|
Button,
|
|
@@ -3325,11 +3325,8 @@ var VoiceComposer = ({
|
|
|
3325
3325
|
] }),
|
|
3326
3326
|
showTranscriptPreview && transcriptMode !== "none" && transcriptText && /* @__PURE__ */ jsx21("div", { className: "w-full rounded-lg border bg-background px-3 py-2 text-left text-sm", children: transcriptText })
|
|
3327
3327
|
] }) }) : /* @__PURE__ */ jsxs11("div", { className: "mt-3 rounded-xl border bg-muted/20 p-3 sm:p-4", children: [
|
|
3328
|
-
/* @__PURE__ */ jsxs11("div", { className: "flex items-
|
|
3329
|
-
/* @__PURE__ */
|
|
3330
|
-
/* @__PURE__ */ jsx21("div", { className: "text-sm font-medium text-foreground", children: labels?.voiceReview || "Ready to send" }),
|
|
3331
|
-
/* @__PURE__ */ jsx21("div", { className: "text-xs text-muted-foreground", children: formatDuration(durationMs) })
|
|
3332
|
-
] }),
|
|
3328
|
+
/* @__PURE__ */ jsxs11("div", { className: "flex items-center justify-between gap-2 text-xs text-muted-foreground", children: [
|
|
3329
|
+
/* @__PURE__ */ jsx21("span", { children: formatDuration(durationMs) }),
|
|
3333
3330
|
/* @__PURE__ */ jsx21(
|
|
3334
3331
|
Button,
|
|
3335
3332
|
{
|
|
@@ -3345,39 +3342,39 @@ var VoiceComposer = ({
|
|
|
3345
3342
|
}
|
|
3346
3343
|
)
|
|
3347
3344
|
] }),
|
|
3348
|
-
/* @__PURE__ */ jsxs11("div", { className: "mt-4 flex flex-col items-center gap-
|
|
3345
|
+
/* @__PURE__ */ jsxs11("div", { className: "mt-4 flex flex-col items-center gap-4 text-center", children: [
|
|
3349
3346
|
/* @__PURE__ */ jsx21(
|
|
3350
3347
|
Button,
|
|
3351
3348
|
{
|
|
3352
3349
|
type: "button",
|
|
3353
3350
|
size: "icon",
|
|
3354
3351
|
variant: orbCanStop ? "destructive" : "outline",
|
|
3355
|
-
className: `h-
|
|
3352
|
+
className: `h-20 w-20 rounded-full sm:h-24 sm:w-24 ${orbIsListening ? "border-red-500 bg-red-500 text-white hover:bg-red-600" : isArmedDraft ? "border-red-200 bg-red-50 text-red-600 shadow-[0_0_0_10px_rgba(239,68,68,0.08)] hover:bg-red-100 hover:text-red-700" : "border-red-200 bg-red-50 text-red-600 hover:bg-red-100 hover:text-red-700"}`,
|
|
3356
3353
|
onClick: handleReviewOrbClick,
|
|
3357
3354
|
disabled: disabled || orbIsReviewBusy,
|
|
3358
3355
|
children: orbIsReviewBusy ? /* @__PURE__ */ jsx21(Loader2, { className: "h-7 w-7 animate-spin" }) : orbIsListening ? /* @__PURE__ */ jsx21(Square, { className: "h-7 w-7" }) : isArmedDraft ? /* @__PURE__ */ jsx21(Mic, { className: "h-7 w-7 animate-pulse" }) : /* @__PURE__ */ jsx21(Mic, { className: "h-7 w-7" })
|
|
3359
3356
|
}
|
|
3360
3357
|
),
|
|
3361
|
-
/* @__PURE__ */ jsxs11("div", { className: "
|
|
3362
|
-
/* @__PURE__ */ jsx21(
|
|
3363
|
-
/* @__PURE__ */
|
|
3364
|
-
|
|
3365
|
-
|
|
3366
|
-
|
|
3358
|
+
/* @__PURE__ */ jsxs11("div", { className: "max-w-sm space-y-1 px-2", children: [
|
|
3359
|
+
/* @__PURE__ */ jsx21("p", { className: "text-sm text-foreground", children: reviewHelperText }),
|
|
3360
|
+
isCapturing && /* @__PURE__ */ jsx21("div", { className: "mx-auto h-1.5 w-32 overflow-hidden rounded-full bg-red-100", children: /* @__PURE__ */ jsx21(
|
|
3361
|
+
"div",
|
|
3362
|
+
{
|
|
3363
|
+
className: "h-full rounded-full bg-red-500 transition-[width] duration-150",
|
|
3364
|
+
style: { width: `${levelValue}%` }
|
|
3365
|
+
}
|
|
3366
|
+
) })
|
|
3367
3367
|
] })
|
|
3368
3368
|
] }),
|
|
3369
|
-
attachment && /* @__PURE__ */ jsx21("div", { className: "mt-
|
|
3369
|
+
attachment && /* @__PURE__ */ jsx21("div", { className: "mt-4 rounded-lg border bg-background/90 p-2 shadow-sm", children: /* @__PURE__ */ jsx21("audio", { controls: true, preload: "metadata", className: "w-full", children: /* @__PURE__ */ jsx21("source", { src: attachment.dataUrl, type: attachment.mimeType }) }) }),
|
|
3370
3370
|
showTranscriptPreview && transcriptMode !== "none" && transcriptText && /* @__PURE__ */ jsx21("div", { className: "mt-3 rounded-lg border bg-background px-3 py-2 text-left text-sm", children: transcriptText }),
|
|
3371
|
-
isAutoSendActive && autoSendDelayMs > 0 && /* @__PURE__ */
|
|
3372
|
-
|
|
3373
|
-
/* @__PURE__ */
|
|
3374
|
-
] }),
|
|
3375
|
-
/* @__PURE__ */ jsxs11("div", { className: "mt-3 flex items-center justify-end gap-2", children: [
|
|
3376
|
-
isAutoSendActive && /* @__PURE__ */ jsxs11(Button, { type: "button", variant: "ghost", size: "sm", onClick: onCancelAutoSend, disabled, children: [
|
|
3371
|
+
isAutoSendActive && autoSendDelayMs > 0 && /* @__PURE__ */ jsx21("div", { className: "mt-3 flex justify-center", children: /* @__PURE__ */ jsx21("div", { className: "inline-flex items-center rounded-full border bg-background px-3 py-1 text-xs text-muted-foreground", children: interpolateSeconds(labels?.voiceAutoSendIn, countdownSeconds) }) }),
|
|
3372
|
+
/* @__PURE__ */ jsxs11("div", { className: "mt-4 grid grid-cols-1 gap-2 sm:flex sm:items-center sm:justify-end", children: [
|
|
3373
|
+
isAutoSendActive && /* @__PURE__ */ jsxs11(Button, { type: "button", variant: "ghost", size: "sm", onClick: onCancelAutoSend, disabled, className: "w-full sm:w-auto", children: [
|
|
3377
3374
|
/* @__PURE__ */ jsx21(X2, { className: "h-4 w-4" }),
|
|
3378
3375
|
labels?.voiceCancel || "Cancel"
|
|
3379
3376
|
] }),
|
|
3380
|
-
/* @__PURE__ */ jsxs11(Button, { type: "button", size: "sm", onClick: onSendNow, disabled, children: [
|
|
3377
|
+
/* @__PURE__ */ jsxs11(Button, { type: "button", size: "sm", onClick: onSendNow, disabled, className: "w-full sm:w-auto", children: [
|
|
3381
3378
|
/* @__PURE__ */ jsx21(Send, { className: "h-4 w-4" }),
|
|
3382
3379
|
labels?.voiceSendNow || "Send now"
|
|
3383
3380
|
] })
|