@gentiq/ui 1.0.0-alpha.4 → 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.
@@ -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-MFlvTavE.js";
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 { a8 as H, as as O, c as Q } from "./shared-MFlvTavE.js";
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(), r = i.status === "transcribing";
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: r,
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(r ? "voice_transcribing" : "voice_recording") })
20
+ /* @__PURE__ */ e("span", { role: "status", className: "sr-only", children: n(c ? "voice_transcribing" : "voice_recording") })
20
21
  ] });
21
22
  }
22
- function re() {
23
- const { t: n } = q("chat"), i = y().status === "transcribing", r = !K().isBusy, [d, p] = L(!1);
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: !r,
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: r, "aria-label": n("voice_send"), children: d ? /* @__PURE__ */ e(V, { className: "size-4 animate-spin" }) : void 0 }) })
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 c = 2.5, Y = 3, C = c + Y, Z = 90, $ = 0.25, ee = 1400;
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: r
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 - c - a * C - W, R = Math.max(c, Math.min(1, M) * f), B = (f - R) / 2, j = Math.max(0, Math.min(1, (m + c) / (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 - c : m;
87
- s.beginPath(), s.roundRect ? s.roundRect(F, B, c, R, c / 2) : s.rect(F, B, c, R), s.fill();
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", r), children: /* @__PURE__ */ e("canvas", { ref: d, className: "absolute inset-0 size-full" }) });
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
- re as VoiceRecordingControls,
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.*` as `GentiqUI`'s `history` options allow.
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" | "secondary" | "outline" | "ghost" | null | undefined;
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
 
@@ -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`
@@ -430,7 +453,7 @@ export declare interface FollowUpSuggestionsProps extends FollowUpSuggestions_2
430
453
  }
431
454
 
432
455
  /** Fields available in the General section. */
433
- declare interface GeneralSettingsFields {
456
+ export declare interface GeneralSettingsFields {
434
457
  theme?: SettingsFieldMode;
435
458
  language?: SettingsFieldMode;
436
459
  [key: string]: SettingsFieldMode | undefined;
@@ -769,8 +792,7 @@ export declare interface HeaderActionConfig {
769
792
  */
770
793
  export declare interface HeaderActionsProps {
771
794
  /**
772
- * Whether the viewport is phone-sized. The logo sits in the middle of the bar, so on a
773
- * phone there is room for about one icon-sized button before it is covered.
795
+ * Whether the viewport is phone-sized.
774
796
  */
775
797
  isMobile: boolean;
776
798
  }
@@ -979,7 +1001,7 @@ export declare type ResolvedSmoothStreaming = Required<UseSmoothTextOptions>;
979
1001
  declare function ScrollArea({ className, children, ...props }: React_2.ComponentProps<typeof ScrollAreaPrimitive.Root>): JSX.Element;
980
1002
 
981
1003
  /**
982
- * Configuration for the settings dialog sections and fields.
1004
+ * Configuration for the settings dialog sections, popover menu, and custom sections.
983
1005
  */
984
1006
  export declare interface SettingsConfig {
985
1007
  /** Section-specific configurations. */
@@ -991,12 +1013,36 @@ export declare interface SettingsConfig {
991
1013
  /** Account settings section (Balance, Logout, etc.) */
992
1014
  account?: SettingsSectionConfig<AccountSettingsFields>;
993
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[];
994
1020
  }
995
1021
 
996
1022
  export declare function SettingsDialog({ trigger }: {
997
1023
  trigger?: ReactNode;
998
1024
  }): JSX.Element;
999
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
+
1000
1046
  /**
1001
1047
  * Configuration for a single settings section (tab).
1002
1048
  */