@gentiq/ui 1.0.0-alpha.3 → 1.0.0-alpha.5
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/{MessageEditor-HB-YJP7R.js → MessageEditor-CTATfUm3.js} +1 -1
- package/dist/{VoiceInput-B3e7emmb.js → VoiceInput-CYuGXRYZ.js} +16 -15
- package/dist/index.d.ts +74 -6
- package/dist/index.es.js +46 -2029
- package/dist/internal.d.ts +18 -18
- package/dist/internal.es.js +94 -87
- package/dist/shared-BPpDLW8N.js +650 -0
- package/dist/shared-Yglb7Id_.js +5095 -0
- package/dist/style.css +1 -1
- package/package.json +3 -3
- package/dist/shared-BNCHeyvj.js +0 -3505
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsxs as r, jsx as e } from "react/jsx-runtime";
|
|
3
3
|
import { useGentiqTranslation as a, MessageEdit as t } from "@gentiq/react";
|
|
4
|
-
import { B as s } from "./shared-
|
|
4
|
+
import { B as s } from "./shared-BPpDLW8N.js";
|
|
5
5
|
function d() {
|
|
6
6
|
const { t: n } = a(["chat"]);
|
|
7
7
|
return /* @__PURE__ */ r(t.Root, { className: "ms-auto flex w-full max-w-[88%] flex-col gap-2 rounded-lg border border-border bg-background p-3 md:max-w-[78%]", children: [
|
|
@@ -3,42 +3,43 @@ import { jsxs as z, jsx as e, Fragment as k } from "react/jsx-runtime";
|
|
|
3
3
|
import { useState as L, useRef as P, useEffect as U } from "react";
|
|
4
4
|
import { XIcon as X, Loader2Icon as V, SquareIcon as J } from "lucide-react";
|
|
5
5
|
import { useGentiqTranslation as q, useComposerVoice as y, Composer as S, useComposer as K } from "@gentiq/react";
|
|
6
|
-
import {
|
|
6
|
+
import { P as H, a as O } from "./shared-Yglb7Id_.js";
|
|
7
|
+
import { c as Q } from "./shared-BPpDLW8N.js";
|
|
7
8
|
function ce() {
|
|
8
|
-
const { t: n } = q("chat"), i = y(),
|
|
9
|
+
const { t: n } = q("chat"), i = y(), c = i.status === "transcribing";
|
|
9
10
|
return /* @__PURE__ */ z("div", { className: "flex min-h-[40px] min-w-0 flex-1 items-center gap-2 md:min-h-[44px]", children: [
|
|
10
11
|
/* @__PURE__ */ e(S.VoiceCancel, { asChild: !0, children: /* @__PURE__ */ e(H, { "aria-label": n("voice_cancel"), className: "-ms-1 mb-1 self-end", children: /* @__PURE__ */ e(X, { className: "size-5" }) }) }),
|
|
11
12
|
/* @__PURE__ */ e(
|
|
12
13
|
te,
|
|
13
14
|
{
|
|
14
15
|
analyser: i.analyser,
|
|
15
|
-
busy:
|
|
16
|
+
busy: c,
|
|
16
17
|
className: "h-7 min-w-0 flex-1 text-foreground/75"
|
|
17
18
|
}
|
|
18
19
|
),
|
|
19
|
-
/* @__PURE__ */ e("span", { role: "status", className: "sr-only", children: n(
|
|
20
|
+
/* @__PURE__ */ e("span", { role: "status", className: "sr-only", children: n(c ? "voice_transcribing" : "voice_recording") })
|
|
20
21
|
] });
|
|
21
22
|
}
|
|
22
|
-
function
|
|
23
|
-
const { t: n } = q("chat"), i = y().status === "transcribing",
|
|
23
|
+
function le() {
|
|
24
|
+
const { t: n } = q("chat"), i = y().status === "transcribing", c = !K().isBusy, [d, p] = L(!1);
|
|
24
25
|
return /* @__PURE__ */ z(k, { children: [
|
|
25
26
|
/* @__PURE__ */ e(S.VoiceStop, { asChild: !0, children: /* @__PURE__ */ e(
|
|
26
27
|
H,
|
|
27
28
|
{
|
|
28
|
-
autoFocus: !
|
|
29
|
+
autoFocus: !c,
|
|
29
30
|
"aria-label": n("voice_stop"),
|
|
30
31
|
className: "bg-accent/60 text-foreground",
|
|
31
32
|
children: i && !d ? /* @__PURE__ */ e(V, { className: "size-4 animate-spin" }) : /* @__PURE__ */ e(J, { className: "size-3.5 fill-current" })
|
|
32
33
|
}
|
|
33
34
|
) }),
|
|
34
|
-
/* @__PURE__ */ e(S.VoiceSend, { asChild: !0, disabled: d, onClick: () => p(!0), children: /* @__PURE__ */ e(O, { type: "button", autoFocus:
|
|
35
|
+
/* @__PURE__ */ e(S.VoiceSend, { asChild: !0, disabled: d, onClick: () => p(!0), children: /* @__PURE__ */ e(O, { type: "button", autoFocus: c, "aria-label": n("voice_send"), children: d ? /* @__PURE__ */ e(V, { className: "size-4 animate-spin" }) : void 0 }) })
|
|
35
36
|
] });
|
|
36
37
|
}
|
|
37
|
-
const
|
|
38
|
+
const r = 2.5, Y = 3, C = r + Y, Z = 90, $ = 0.25, ee = 1400;
|
|
38
39
|
function te({
|
|
39
40
|
analyser: n,
|
|
40
41
|
busy: i = !1,
|
|
41
|
-
className:
|
|
42
|
+
className: c
|
|
42
43
|
}) {
|
|
43
44
|
const d = P(null), p = P({
|
|
44
45
|
/** The finished bars' levels, most recent first. */
|
|
@@ -76,23 +77,23 @@ function te({
|
|
|
76
77
|
s.fillStyle = D;
|
|
77
78
|
const W = w ? 0 : t.progress * C;
|
|
78
79
|
for (let a = -1; a < x; a++) {
|
|
79
|
-
const M = a < 0 ? t.live : t.bars[a] ?? 0, m = l -
|
|
80
|
+
const M = a < 0 ? t.live : t.bars[a] ?? 0, m = l - r - a * C - W, R = Math.max(r, Math.min(1, M) * f), B = (f - R) / 2, j = Math.max(0, Math.min(1, (m + r) / (l * $)));
|
|
80
81
|
let I = 1;
|
|
81
82
|
if (i) {
|
|
82
83
|
const G = Math.sin((b / ee - m / l) * 2 * Math.PI);
|
|
83
84
|
I = w ? 0.5 : 0.35 + 0.325 * (1 + G);
|
|
84
85
|
}
|
|
85
86
|
s.globalAlpha = j * I;
|
|
86
|
-
const F = E === "rtl" ? l - m -
|
|
87
|
-
s.beginPath(), s.roundRect ? s.roundRect(F, B,
|
|
87
|
+
const F = E === "rtl" ? l - m - r : m;
|
|
88
|
+
s.beginPath(), s.roundRect ? s.roundRect(F, B, r, R, r / 2) : s.rect(F, B, r, R), s.fill();
|
|
88
89
|
}
|
|
89
90
|
g = requestAnimationFrame(A);
|
|
90
91
|
};
|
|
91
92
|
return g = requestAnimationFrame(A), () => cancelAnimationFrame(g);
|
|
92
|
-
}, [n, i]), /* @__PURE__ */ e("div", { "aria-hidden": !0, className: Q("relative",
|
|
93
|
+
}, [n, i]), /* @__PURE__ */ e("div", { "aria-hidden": !0, className: Q("relative", c), children: /* @__PURE__ */ e("canvas", { ref: d, className: "absolute inset-0 size-full" }) });
|
|
93
94
|
}
|
|
94
95
|
export {
|
|
95
96
|
ce as VoiceRecordingBar,
|
|
96
|
-
|
|
97
|
+
le as VoiceRecordingControls,
|
|
97
98
|
te as VoiceWaveform
|
|
98
99
|
};
|
package/dist/index.d.ts
CHANGED
|
@@ -46,7 +46,7 @@ export declare interface AccountSettingsFields {
|
|
|
46
46
|
|
|
47
47
|
/**
|
|
48
48
|
* The default sidebar: a new-conversation button and the user's conversations, built from
|
|
49
|
-
* `ThreadList
|
|
49
|
+
* `ThreadList.*`. Switches into the grouped settings navigation while settings are open.
|
|
50
50
|
*/
|
|
51
51
|
export declare function AppSidebar({ side }: {
|
|
52
52
|
side?: 'start' | 'end';
|
|
@@ -57,7 +57,7 @@ declare function Button({ className, variant, size, asChild, ...props }: React_2
|
|
|
57
57
|
}): JSX.Element;
|
|
58
58
|
|
|
59
59
|
declare const buttonVariants: (props?: ({
|
|
60
|
-
variant?: "default" | "destructive" | "link" | "
|
|
60
|
+
variant?: "default" | "destructive" | "link" | "outline" | "secondary" | "ghost" | null | undefined;
|
|
61
61
|
size?: "default" | "icon" | "sm" | "lg" | null | undefined;
|
|
62
62
|
} & ClassProp) | undefined) => string;
|
|
63
63
|
|
|
@@ -68,7 +68,7 @@ export declare const Chat: ({ threadId, onThreadChange, components: localCompone
|
|
|
68
68
|
* e.g. to offer an upgrade when `error.code` is `quota_exceeded`, and render this one for the
|
|
69
69
|
* rest.
|
|
70
70
|
*/
|
|
71
|
-
export declare function ChatError({ error }: ChatErrorProps): JSX.Element;
|
|
71
|
+
export declare function ChatError({ error, code }: ChatErrorProps): JSX.Element;
|
|
72
72
|
|
|
73
73
|
/**
|
|
74
74
|
* Props for the ChatError component, the notice under the transcript when a turn fails. Dismiss
|
|
@@ -395,6 +395,29 @@ export declare function CreditsBar({ credits, action }: {
|
|
|
395
395
|
action?: ReactNode;
|
|
396
396
|
}): JSX.Element;
|
|
397
397
|
|
|
398
|
+
/**
|
|
399
|
+
* A custom section added to the settings sidebar and page by the host application.
|
|
400
|
+
*/
|
|
401
|
+
export declare interface CustomSettingsSection {
|
|
402
|
+
/** Unique identifier for the section (e.g. `'notifications'`, `'personalization'`). */
|
|
403
|
+
id: string;
|
|
404
|
+
/** Display title or translation key for the sidebar item and page heading. */
|
|
405
|
+
label: string;
|
|
406
|
+
/** Optional subtitle or translation key shown under the page heading. */
|
|
407
|
+
subtitle?: string;
|
|
408
|
+
/**
|
|
409
|
+
* Sidebar group this section belongs to: `'account'`, `'general'`, or a custom group title /
|
|
410
|
+
* translation key. Defaults to `'general'`.
|
|
411
|
+
*/
|
|
412
|
+
group?: string;
|
|
413
|
+
/** Optional icon rendered beside the label in the sidebar and popover menu. */
|
|
414
|
+
icon?: LucideIcon;
|
|
415
|
+
/** Whether to also show a shortcut to this section in the floating settings popover menu. */
|
|
416
|
+
showInMenu?: boolean;
|
|
417
|
+
/** Component rendered in the main settings page when this section is active. */
|
|
418
|
+
component: ComponentType;
|
|
419
|
+
}
|
|
420
|
+
|
|
398
421
|
/**
|
|
399
422
|
* Mirrors Gentiq's state onto the page, for an app whose whole page is Gentiq, such as the
|
|
400
423
|
* starter: `<html lang>` and `dir` follow the chat's language, `<html>` gets the theme's `light`
|
|
@@ -429,6 +452,13 @@ export declare interface FollowUpSuggestionsProps extends FollowUpSuggestions_2
|
|
|
429
452
|
className?: string;
|
|
430
453
|
}
|
|
431
454
|
|
|
455
|
+
/** Fields available in the General section. */
|
|
456
|
+
export declare interface GeneralSettingsFields {
|
|
457
|
+
theme?: SettingsFieldMode;
|
|
458
|
+
language?: SettingsFieldMode;
|
|
459
|
+
[key: string]: SettingsFieldMode | undefined;
|
|
460
|
+
}
|
|
461
|
+
|
|
432
462
|
/**
|
|
433
463
|
* A whole chat app on the browser's URL: sign-in, the chat with its sidebar, shared
|
|
434
464
|
* conversations and, when given, the admin panel. It owns the page, so it also keeps the
|
|
@@ -498,6 +528,10 @@ export declare interface GentiqComponents {
|
|
|
498
528
|
PromptInput?: ComponentType<PromptInputProps>;
|
|
499
529
|
/** Replaces the welcome / empty-state screen */
|
|
500
530
|
WelcomeScreen?: ComponentType<WelcomeScreenProps>;
|
|
531
|
+
/**
|
|
532
|
+
* Replaces the pending-reply and thread-loading indicator with a custom loader component.
|
|
533
|
+
*/
|
|
534
|
+
Loader?: ComponentType<LoaderProps>;
|
|
501
535
|
/**
|
|
502
536
|
* The component for each part type, over Gentiq's: `text`, `reasoning`, `file`, `tool` (any tool
|
|
503
537
|
* call without its own), `tool-<name>` (one tool's calls), `data-<name>` (a part the backend
|
|
@@ -758,8 +792,7 @@ export declare interface HeaderActionConfig {
|
|
|
758
792
|
*/
|
|
759
793
|
export declare interface HeaderActionsProps {
|
|
760
794
|
/**
|
|
761
|
-
* Whether the viewport is phone-sized.
|
|
762
|
-
* phone there is room for about one icon-sized button before it is covered.
|
|
795
|
+
* Whether the viewport is phone-sized.
|
|
763
796
|
*/
|
|
764
797
|
isMobile: boolean;
|
|
765
798
|
}
|
|
@@ -780,6 +813,15 @@ export declare interface HistoryConfig {
|
|
|
780
813
|
showPin?: boolean;
|
|
781
814
|
}
|
|
782
815
|
|
|
816
|
+
declare type LoaderProps = HTMLAttributes<HTMLDivElement> & {
|
|
817
|
+
size?: number;
|
|
818
|
+
/**
|
|
819
|
+
* Indicator variant. Retained for compatibility with custom renderers;
|
|
820
|
+
* Gentiq's built-in loader renders the clean 3-dot pulse.
|
|
821
|
+
*/
|
|
822
|
+
variant?: string;
|
|
823
|
+
};
|
|
824
|
+
|
|
783
825
|
/**
|
|
784
826
|
* The strip shown above the chat while maintenance is on. Replace it with
|
|
785
827
|
* `components.MaintenanceBanner`.
|
|
@@ -959,22 +1001,48 @@ export declare type ResolvedSmoothStreaming = Required<UseSmoothTextOptions>;
|
|
|
959
1001
|
declare function ScrollArea({ className, children, ...props }: React_2.ComponentProps<typeof ScrollAreaPrimitive.Root>): JSX.Element;
|
|
960
1002
|
|
|
961
1003
|
/**
|
|
962
|
-
* Configuration for the settings dialog sections and
|
|
1004
|
+
* Configuration for the settings dialog sections, popover menu, and custom sections.
|
|
963
1005
|
*/
|
|
964
1006
|
export declare interface SettingsConfig {
|
|
965
1007
|
/** Section-specific configurations. */
|
|
966
1008
|
sections?: {
|
|
1009
|
+
/** General settings section (Theme, Language) */
|
|
1010
|
+
general?: SettingsSectionConfig<GeneralSettingsFields>;
|
|
967
1011
|
/** Profile settings section (Name, Phone, etc.) */
|
|
968
1012
|
profile?: SettingsSectionConfig<ProfileSettingsFields>;
|
|
969
1013
|
/** Account settings section (Balance, Logout, etc.) */
|
|
970
1014
|
account?: SettingsSectionConfig<AccountSettingsFields>;
|
|
971
1015
|
};
|
|
1016
|
+
/** Which shortcuts and quick actions appear in the floating settings popover menu. */
|
|
1017
|
+
menu?: SettingsMenuConfig;
|
|
1018
|
+
/** Additional settings sections registered by the application. */
|
|
1019
|
+
customSections?: CustomSettingsSection[];
|
|
972
1020
|
}
|
|
973
1021
|
|
|
974
1022
|
export declare function SettingsDialog({ trigger }: {
|
|
975
1023
|
trigger?: ReactNode;
|
|
976
1024
|
}): JSX.Element;
|
|
977
1025
|
|
|
1026
|
+
/**
|
|
1027
|
+
* Controls which shortcuts and quick actions appear in the floating settings popover menu.
|
|
1028
|
+
*/
|
|
1029
|
+
export declare interface SettingsMenuConfig {
|
|
1030
|
+
/** Whether to show the signed-in user's header at the top of the popover menu. Defaults to `true`. */
|
|
1031
|
+
showUserHeader?: boolean;
|
|
1032
|
+
/** Whether to show a separate Profile item in the popover menu. Defaults to `false` (clicking the user header opens Profile). */
|
|
1033
|
+
showProfile?: boolean;
|
|
1034
|
+
/** Whether to show the Account & Usage item in the popover menu. Defaults to `true`. */
|
|
1035
|
+
showAccount?: boolean;
|
|
1036
|
+
/** Whether to show the Settings item in the popover menu. Defaults to `true`. */
|
|
1037
|
+
showSettings?: boolean;
|
|
1038
|
+
/** Whether to show the inline Theme submenu in the popover menu. Defaults to `false`. */
|
|
1039
|
+
showTheme?: boolean;
|
|
1040
|
+
/** Whether to show the inline Language submenu in the popover menu. Defaults to `false`. */
|
|
1041
|
+
showLanguage?: boolean;
|
|
1042
|
+
/** Whether to show the Logout action in the popover menu. Defaults to `true`. */
|
|
1043
|
+
showLogout?: boolean;
|
|
1044
|
+
}
|
|
1045
|
+
|
|
978
1046
|
/**
|
|
979
1047
|
* Configuration for a single settings section (tab).
|
|
980
1048
|
*/
|