@gentiq/ui 1.0.0-alpha.7 → 1.0.0-alpha.9

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.
@@ -0,0 +1,199 @@
1
+ "use client";
2
+ import { jsxs as r, jsx as e } from "react/jsx-runtime";
3
+ import { useId as G, useState as p, useRef as q } from "react";
4
+ import { Paperclip as F, X as B, Send as P } from "lucide-react";
5
+ import { toast as d } from "sonner";
6
+ import { rejectAttachment as V } from "@gentiq/core";
7
+ import { useGentiqTranslation as H, useGentiqLanguage as J, useServerConfig as K, useSubmitReport as O, getLocalizedErrorMessage as X } from "@gentiq/react";
8
+ import { G as h, H as Q, I as U, J as W, c as l, K as Y, M as Z, N as M, B as x } from "./shared-BtZa4J_w.js";
9
+ import { T as ee } from "./shared-BKh4GbRI.js";
10
+ import { f as $ } from "./shared-DO5kF-Zj.js";
11
+ const te = ["bug", "feature", "other"], v = "bg-muted/30 border-border/50 rounded-xl focus-visible:ring-primary text-start";
12
+ function ue({
13
+ sectionMode: N = "editable",
14
+ categoryMode: b = "editable",
15
+ attachmentMode: u = "editable"
16
+ } = {}) {
17
+ const s = G(), { t: a, i18n: k } = H(["settings", "errors"]), { dir: I } = J(), i = K()?.attachments, g = O(), [y, L] = p("bug"), [S, j] = p(""), [C, z] = p(""), [m, _] = p(null), f = q(null), n = N === "faded" || g.isPending, A = b !== "hidden", R = u !== "hidden" && !!i, w = () => {
18
+ _(null), f.current && (f.current.value = "");
19
+ }, T = (t) => {
20
+ const c = t.target.files?.[0];
21
+ if (c) {
22
+ if (i) {
23
+ const o = V(c, i);
24
+ if (o === "too_large") {
25
+ d.error(
26
+ a("feedback.attachment_too_large", {
27
+ size: $(i.max_size, k.language)
28
+ })
29
+ ), t.target.value = "";
30
+ return;
31
+ }
32
+ if (o === "unsupported_type") {
33
+ d.error(a("feedback.attachment_unsupported")), t.target.value = "";
34
+ return;
35
+ }
36
+ }
37
+ _(c);
38
+ }
39
+ }, D = async (t) => {
40
+ if (t.preventDefault(), n) return;
41
+ const c = S.trim(), o = C.trim();
42
+ if (!c || !o) {
43
+ d.error(a("feedback.validation_required"));
44
+ return;
45
+ }
46
+ try {
47
+ await g.mutateAsync({
48
+ category: y,
49
+ subject: c,
50
+ description: o,
51
+ file: m
52
+ }), d.success(a("feedback.success")), j(""), z(""), w();
53
+ } catch (E) {
54
+ d.error(X(E, a));
55
+ }
56
+ };
57
+ return /* @__PURE__ */ r(
58
+ "form",
59
+ {
60
+ onSubmit: (t) => {
61
+ D(t);
62
+ },
63
+ className: l(
64
+ "space-y-5",
65
+ N === "faded" && "opacity-50 pointer-events-none select-none"
66
+ ),
67
+ children: [
68
+ A && /* @__PURE__ */ r(
69
+ "div",
70
+ {
71
+ className: l(
72
+ "flex flex-col gap-2",
73
+ b === "faded" && "opacity-60 pointer-events-none"
74
+ ),
75
+ children: [
76
+ /* @__PURE__ */ e(h, { htmlFor: `${s}-category`, className: "px-1 text-start", children: a("feedback.category") }),
77
+ /* @__PURE__ */ r(
78
+ Q,
79
+ {
80
+ value: y,
81
+ onValueChange: (t) => L(t),
82
+ disabled: n || b === "faded",
83
+ dir: I,
84
+ children: [
85
+ /* @__PURE__ */ e(U, { id: `${s}-category`, className: l(v, "h-11"), children: /* @__PURE__ */ e(W, {}) }),
86
+ /* @__PURE__ */ e(Y, { className: "rounded-xl border-border/40 shadow-xl bg-background", children: te.map((t) => /* @__PURE__ */ e(Z, { value: t, className: "rounded-lg focus:bg-primary/10", children: a(`feedback.categories.${t}`) }, t)) })
87
+ ]
88
+ }
89
+ )
90
+ ]
91
+ }
92
+ ),
93
+ /* @__PURE__ */ r("div", { className: "flex flex-col gap-2", children: [
94
+ /* @__PURE__ */ e(h, { htmlFor: `${s}-subject`, className: "px-1 text-start", children: a("feedback.subject") }),
95
+ /* @__PURE__ */ e(
96
+ M,
97
+ {
98
+ id: `${s}-subject`,
99
+ value: S,
100
+ onChange: (t) => j(t.target.value),
101
+ disabled: n,
102
+ maxLength: 200,
103
+ placeholder: a("feedback.subject_placeholder"),
104
+ className: l(v, "h-11")
105
+ }
106
+ )
107
+ ] }),
108
+ /* @__PURE__ */ r("div", { className: "flex flex-col gap-2", children: [
109
+ /* @__PURE__ */ e(h, { htmlFor: `${s}-description`, className: "px-1 text-start", children: a("feedback.description") }),
110
+ /* @__PURE__ */ e(
111
+ ee,
112
+ {
113
+ id: `${s}-description`,
114
+ value: C,
115
+ onChange: (t) => z(t.target.value),
116
+ disabled: n,
117
+ rows: 5,
118
+ maxLength: 5e3,
119
+ placeholder: a("feedback.description_placeholder"),
120
+ className: l(v, "min-h-28 resize-y text-sm")
121
+ }
122
+ )
123
+ ] }),
124
+ R && i && /* @__PURE__ */ r(
125
+ "div",
126
+ {
127
+ className: l(
128
+ "flex flex-col gap-2",
129
+ u === "faded" && "opacity-60 pointer-events-none"
130
+ ),
131
+ children: [
132
+ /* @__PURE__ */ e(h, { htmlFor: `${s}-file`, className: "px-1 text-start", children: a("feedback.attachment") }),
133
+ /* @__PURE__ */ e(
134
+ "input",
135
+ {
136
+ id: `${s}-file`,
137
+ ref: f,
138
+ type: "file",
139
+ accept: i.types.join(","),
140
+ onChange: T,
141
+ disabled: n || u === "faded",
142
+ className: "hidden"
143
+ }
144
+ ),
145
+ m ? /* @__PURE__ */ r("div", { className: "flex items-center justify-between gap-2 rounded-xl border border-border/50 bg-muted/30 px-3 py-2 text-sm", children: [
146
+ /* @__PURE__ */ r("div", { className: "flex items-center gap-2 min-w-0", children: [
147
+ /* @__PURE__ */ e(F, { className: "size-4 shrink-0 text-muted-foreground" }),
148
+ /* @__PURE__ */ e("span", { className: "truncate font-medium", children: m.name }),
149
+ /* @__PURE__ */ e("span", { className: "shrink-0 text-xs text-muted-foreground", children: $(m.size, k.language) })
150
+ ] }),
151
+ /* @__PURE__ */ e(
152
+ x,
153
+ {
154
+ type: "button",
155
+ variant: "ghost",
156
+ size: "icon",
157
+ onClick: w,
158
+ disabled: n,
159
+ "aria-label": a("feedback.remove_attachment"),
160
+ className: "size-7 shrink-0 rounded-full text-muted-foreground hover:text-foreground",
161
+ children: /* @__PURE__ */ e(B, { className: "size-3.5" })
162
+ }
163
+ )
164
+ ] }) : /* @__PURE__ */ e("div", { children: /* @__PURE__ */ r(
165
+ x,
166
+ {
167
+ type: "button",
168
+ variant: "outline",
169
+ onClick: () => f.current?.click(),
170
+ disabled: n || u === "faded",
171
+ className: "rounded-xl border-border/60 bg-muted/20 gap-2 text-sm font-medium h-10",
172
+ children: [
173
+ /* @__PURE__ */ e(F, { className: "size-4 text-muted-foreground" }),
174
+ /* @__PURE__ */ e("span", { children: a("feedback.attach_file") })
175
+ ]
176
+ }
177
+ ) })
178
+ ]
179
+ }
180
+ ),
181
+ /* @__PURE__ */ e("div", { className: "pt-2 flex justify-end", children: /* @__PURE__ */ r(
182
+ x,
183
+ {
184
+ type: "submit",
185
+ disabled: n,
186
+ className: "w-full sm:w-auto px-6 rounded-full gap-2 font-medium h-10",
187
+ children: [
188
+ /* @__PURE__ */ e(P, { className: "size-4" }),
189
+ a(g.isPending ? "feedback.submitting" : "feedback.submit")
190
+ ]
191
+ }
192
+ ) })
193
+ ]
194
+ }
195
+ );
196
+ }
197
+ export {
198
+ ue as FeedbackSettings
199
+ };
@@ -3,7 +3,7 @@ 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 { P as H, a as O } from "./shared-CDBfvRf2.js";
6
+ import { P as H, a as O } from "./shared-DO5kF-Zj.js";
7
7
  import { c as Q } from "./shared-BtZa4J_w.js";
8
8
  function ce() {
9
9
  const { t: n } = q("chat"), i = y(), c = i.status === "transcribing";
package/dist/index.d.ts CHANGED
@@ -427,6 +427,13 @@ export declare interface CustomSettingsSection {
427
427
  */
428
428
  export declare function DocumentSync(): null;
429
429
 
430
+ /** Fields available in the Feedback section. */
431
+ export declare interface FeedbackSettingsFields {
432
+ category?: SettingsFieldMode;
433
+ attachment?: SettingsFieldMode;
434
+ [key: string]: SettingsFieldMode | undefined;
435
+ }
436
+
430
437
  /** The built-in renderer of `file` parts: an image's preview, or a file to download. */
431
438
  export declare function FilePart({ part }: FilePartProps): JSX.Element;
432
439
 
@@ -1012,6 +1019,8 @@ export declare interface SettingsConfig {
1012
1019
  profile?: SettingsSectionConfig<ProfileSettingsFields>;
1013
1020
  /** Account settings section (Balance, Logout, etc.) */
1014
1021
  account?: SettingsSectionConfig<AccountSettingsFields>;
1022
+ /** Feedback settings section (Bug reports, Feature requests, etc.) */
1023
+ feedback?: SettingsSectionConfig<FeedbackSettingsFields>;
1015
1024
  };
1016
1025
  /** Which shortcuts and quick actions appear in the floating settings popover menu. */
1017
1026
  menu?: SettingsMenuConfig;
@@ -1033,6 +1042,8 @@ export declare interface SettingsMenuConfig {
1033
1042
  showProfile?: boolean;
1034
1043
  /** Whether to show the Account & Usage item in the popover menu. Defaults to `true`. */
1035
1044
  showAccount?: boolean;
1045
+ /** Whether to show the Feedback item in the popover menu. Defaults to `true`. */
1046
+ showFeedback?: boolean;
1036
1047
  /** Whether to show the Settings item in the popover menu. Defaults to `true`. */
1037
1048
  showSettings?: boolean;
1038
1049
  /** Whether to show the inline Theme submenu in the popover menu. Defaults to `false`. */
package/dist/index.es.js CHANGED
@@ -1,5 +1,5 @@
1
1
  "use client";
2
- import { A as s, C as t, b as o, c as i, d as n, e as r, f as u, g, D as c, F as p, h, G as S, i as C, j as P, k as l, M as m, l as d, m as T, n as q, o as Q, P as f, Q as A, p as G, R as M, q as R, r as U, s as x, S as B, t as b, u as v, v as w, w as D, T as I, x as y, U as F, y as L, W, z as j, B as k, E, H as z } from "./shared-CDBfvRf2.js";
2
+ import { A as s, C as t, b as o, c as i, d as n, e as r, g as u, h as g, D as c, F as p, i as h, G as S, j as C, k as P, l, M as m, m as d, n as T, o as q, p as Q, P as A, Q as G, q as M, R, r as U, s as f, t as x, S as B, u as I, v as b, w as v, x as w, T as D, y, U as F, z as L, W, B as j, E as k, H as E, I as z } from "./shared-DO5kF-Zj.js";
3
3
  import { T as O, j as V, i as J } from "./shared-BtZa4J_w.js";
4
4
  export {
5
5
  s as AppSidebar,
@@ -22,19 +22,19 @@ export {
22
22
  T as MessageActions,
23
23
  q as MessageList,
24
24
  Q as PromptInputArea,
25
- f as PromptInputButton,
26
- A as QuotaBar,
27
- G as QuotaWindows,
28
- M as ReasoningPart,
29
- R as ReferencePart,
30
- U as Referenceable,
25
+ A as PromptInputButton,
26
+ G as QuotaBar,
27
+ M as QuotaWindows,
28
+ R as ReasoningPart,
29
+ U as ReferencePart,
30
+ f as Referenceable,
31
31
  x as RequireAuth,
32
32
  B as SettingsDialog,
33
- b as SharedChatView,
34
- v as SidebarProvider,
35
- w as Suggestion,
36
- D as Suggestions,
37
- I as TextPart,
33
+ I as SharedChatView,
34
+ b as SidebarProvider,
35
+ v as Suggestion,
36
+ w as Suggestions,
37
+ D as TextPart,
38
38
  y as ToolPart,
39
39
  O as Tooltip,
40
40
  V as TooltipContent,
@@ -1,32 +1,33 @@
1
1
  "use client";
2
- import { T as g, i as b, B as h, j as m, c as r } from "./shared-BtZa4J_w.js";
3
- import { a1 as H, h as B, C as R, b as j, a as O, D as P, a2 as Q, e as q, _ as A, $ as F, f as G, g as U, d as V, l as W, n as X, o as J, m as K, N as Y, G as Z, L as $, a3 as ee, H as ae, K as te, M as re, I as ie, J as oe, V as se, W as ne, Z as de, X as le, Y as ce, a4 as ue, x as ge, F as be, w as he, a0 as me, y as pe, u as fe } from "./shared-BtZa4J_w.js";
4
- import { jsxs as s, jsx as e } from "react/jsx-runtime";
5
- import { Monitor as l, Moon as p, Sun as f, CheckIcon as k } from "lucide-react";
6
- import { useGentiqTranslation as x, useTheme as v } from "@gentiq/react";
2
+ import { T as u, i as h, B as m, j as p, c as r } from "./shared-BtZa4J_w.js";
3
+ import { a1 as H, h as z, C as B, b as R, a as j, D as O, a2 as P, e as Q, _ as q, $ as A, f as F, g as G, d as U, l as V, n as W, o as X, m as J, N as K, G as Y, L as Z, a3 as $, H as ee, K as ae, M as te, I as re, J as se, V as oe, W as ie, Z as ne, X as de, Y as ce, a4 as le, x as ge, F as ue, w as he, a0 as me, y as pe, u as be } from "./shared-BtZa4J_w.js";
4
+ import { jsxs as i, jsx as e } from "react/jsx-runtime";
5
+ import { Monitor as c, Moon as b, Sun as k, CheckIcon as f } from "lucide-react";
6
+ import { useGentiqTranslation as T, useTheme as x } from "@gentiq/react";
7
7
  import "react";
8
8
  import * as n from "@radix-ui/react-checkbox";
9
9
  import * as d from "@radix-ui/react-switch";
10
- const T = { system: "light", light: "dark", dark: "system" }, w = { light: f, dark: p, system: l }, I = ({ className: t }) => {
11
- const { t: a } = x(["theme"]), { theme: i, setTheme: c } = v(), u = w[i] ?? l, o = T[i];
12
- return /* @__PURE__ */ s(g, { children: [
13
- /* @__PURE__ */ e(b, { asChild: !0, children: /* @__PURE__ */ s(
14
- h,
10
+ import { T as fe } from "./shared-BKh4GbRI.js";
11
+ const D = { system: "light", light: "dark", dark: "system" }, w = { light: k, dark: b, system: c }, M = ({ className: t }) => {
12
+ const { t: a } = T(["theme"]), { theme: s, setTheme: l } = x(), g = w[s] ?? c, o = D[s];
13
+ return /* @__PURE__ */ i(u, { children: [
14
+ /* @__PURE__ */ e(h, { asChild: !0, children: /* @__PURE__ */ i(
15
+ m,
15
16
  {
16
17
  variant: "ghost",
17
18
  size: "icon",
18
- onClick: () => c(o ?? "system"),
19
+ onClick: () => l(o ?? "system"),
19
20
  className: t,
20
21
  children: [
21
- /* @__PURE__ */ e(u, { className: "h-[1.2rem] w-[1.2rem]" }),
22
+ /* @__PURE__ */ e(g, { className: "h-[1.2rem] w-[1.2rem]" }),
22
23
  /* @__PURE__ */ e("span", { className: "sr-only", children: a("toggle") })
23
24
  ]
24
25
  }
25
26
  ) }),
26
- /* @__PURE__ */ e(m, { children: a(o ?? "toggle") })
27
+ /* @__PURE__ */ e(p, { children: a(o ?? "toggle") })
27
28
  ] });
28
29
  };
29
- function M({ className: t, ...a }) {
30
+ function N({ className: t, ...a }) {
30
31
  return /* @__PURE__ */ e(
31
32
  n.Root,
32
33
  {
@@ -41,7 +42,7 @@ function M({ className: t, ...a }) {
41
42
  {
42
43
  "data-slot": "checkbox-indicator",
43
44
  className: "grid place-content-center text-current transition-none",
44
- children: /* @__PURE__ */ e(k, { className: "size-3.5" })
45
+ children: /* @__PURE__ */ e(f, { className: "size-3.5" })
45
46
  }
46
47
  )
47
48
  }
@@ -70,62 +71,49 @@ function E({ className: t, ...a }) {
70
71
  }
71
72
  );
72
73
  }
73
- function L({ className: t, ...a }) {
74
- return /* @__PURE__ */ e(
75
- "textarea",
76
- {
77
- "data-slot": "textarea",
78
- className: r(
79
- "border-input placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:bg-input/30 flex field-sizing-content min-h-16 w-full rounded-md border bg-transparent px-3 py-2 text-base shadow-xs transition-[color,box-shadow] outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50",
80
- t
81
- ),
82
- ...a
83
- }
84
- );
85
- }
86
74
  export {
87
75
  H as BUILT_IN_METERS,
88
- B as Badge,
89
- h as Button,
90
- M as Checkbox,
91
- R as Collapsible,
92
- j as CollapsibleContent,
93
- O as CollapsibleTrigger,
94
- P as Dialog,
95
- Q as DialogClose,
96
- q as DialogContent,
97
- A as DialogDescription,
98
- F as DialogFooter,
99
- G as DialogHeader,
100
- U as DialogTitle,
101
- V as DialogTrigger,
102
- W as DropdownMenu,
103
- X as DropdownMenuContent,
104
- J as DropdownMenuItem,
105
- K as DropdownMenuTrigger,
106
- Y as Input,
107
- Z as Label,
108
- $ as Loader,
109
- I as ModeToggle,
110
- ee as QUOTA_PERIODS,
111
- ae as Select,
112
- te as SelectContent,
113
- re as SelectItem,
114
- ie as SelectTrigger,
115
- oe as SelectValue,
116
- se as Sheet,
117
- ne as SheetContent,
118
- de as SheetDescription,
119
- le as SheetHeader,
76
+ z as Badge,
77
+ m as Button,
78
+ N as Checkbox,
79
+ B as Collapsible,
80
+ R as CollapsibleContent,
81
+ j as CollapsibleTrigger,
82
+ O as Dialog,
83
+ P as DialogClose,
84
+ Q as DialogContent,
85
+ q as DialogDescription,
86
+ A as DialogFooter,
87
+ F as DialogHeader,
88
+ G as DialogTitle,
89
+ U as DialogTrigger,
90
+ V as DropdownMenu,
91
+ W as DropdownMenuContent,
92
+ X as DropdownMenuItem,
93
+ J as DropdownMenuTrigger,
94
+ K as Input,
95
+ Y as Label,
96
+ Z as Loader,
97
+ M as ModeToggle,
98
+ $ as QUOTA_PERIODS,
99
+ ee as Select,
100
+ ae as SelectContent,
101
+ te as SelectItem,
102
+ re as SelectTrigger,
103
+ se as SelectValue,
104
+ oe as Sheet,
105
+ ie as SheetContent,
106
+ ne as SheetDescription,
107
+ de as SheetHeader,
120
108
  ce as SheetTitle,
121
109
  E as Switch,
122
- L as Textarea,
110
+ fe as Textarea,
123
111
  r as cn,
124
- ue as describeDuration,
112
+ le as describeDuration,
125
113
  ge as describeWindow,
126
- be as formatQuotaAmount,
114
+ ue as formatQuotaAmount,
127
115
  he as formatQuotaDate,
128
116
  me as gentiqLogo,
129
117
  pe as meterLabel,
130
- fe as useSlots
118
+ be as useSlots
131
119
  };
@@ -0,0 +1,20 @@
1
+ "use client";
2
+ import { jsx as i } from "react/jsx-runtime";
3
+ import "react";
4
+ import { c as t } from "./shared-BtZa4J_w.js";
5
+ function d({ className: r, ...e }) {
6
+ return /* @__PURE__ */ i(
7
+ "textarea",
8
+ {
9
+ "data-slot": "textarea",
10
+ className: t(
11
+ "border-input placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:bg-input/30 flex field-sizing-content min-h-16 w-full rounded-md border bg-transparent px-3 py-2 text-base shadow-xs transition-[color,box-shadow] outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50",
12
+ r
13
+ ),
14
+ ...e
15
+ }
16
+ );
17
+ }
18
+ export {
19
+ d as T
20
+ };