impact-nova 3.0.0-alpha.7 → 3.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.
Files changed (103) hide show
  1. package/README.md +1 -1
  2. package/dist/components/data/expandable-list-item/sku-picker-chrome.d.ts +4 -0
  3. package/dist/components/data/expandable-list-item/sku-picker-chrome.js +37 -42
  4. package/dist/components/data-display/stereo-scatter/index.d.ts +2 -0
  5. package/dist/components/data-display/stereo-scatter/index.js +10 -0
  6. package/dist/components/data-display/stereo-scatter/internals/stereo-engine-frame.d.ts +41 -0
  7. package/dist/components/data-display/stereo-scatter/internals/stereo-engine-frame.js +178 -0
  8. package/dist/components/data-display/stereo-scatter/internals/stereo-engine-theme.d.ts +14 -0
  9. package/dist/components/data-display/stereo-scatter/internals/stereo-engine-theme.js +29 -0
  10. package/dist/components/data-display/stereo-scatter/internals/stereo-engine-wedges.d.ts +23 -0
  11. package/dist/components/data-display/stereo-scatter/internals/stereo-engine-wedges.js +80 -0
  12. package/dist/components/data-display/stereo-scatter/internals/stereo-engine.d.ts +120 -0
  13. package/dist/components/data-display/stereo-scatter/internals/stereo-engine.js +519 -0
  14. package/dist/components/data-display/stereo-scatter/internals/stereo-math.d.ts +64 -0
  15. package/dist/components/data-display/stereo-scatter/internals/stereo-math.js +129 -0
  16. package/dist/components/data-display/stereo-scatter/internals/stereo-model.d.ts +37 -0
  17. package/dist/components/data-display/stereo-scatter/internals/stereo-model.js +71 -0
  18. package/dist/components/data-display/stereo-scatter/internals/stereo-scatter-context.d.ts +33 -0
  19. package/dist/components/data-display/stereo-scatter/internals/stereo-scatter-context.js +19 -0
  20. package/dist/components/data-display/stereo-scatter/internals/stereo-scatter-key.d.ts +4 -0
  21. package/dist/components/data-display/stereo-scatter/internals/stereo-scatter-key.js +19 -0
  22. package/dist/components/data-display/stereo-scatter/internals/stereo-scatter-legend.d.ts +2 -0
  23. package/dist/components/data-display/stereo-scatter/internals/stereo-scatter-legend.js +75 -0
  24. package/dist/components/data-display/stereo-scatter/internals/stereo-scatter-scene.d.ts +2 -0
  25. package/dist/components/data-display/stereo-scatter/internals/stereo-scatter-scene.js +149 -0
  26. package/dist/components/data-display/stereo-scatter/internals/stereo-scatter-toolbar.d.ts +13 -0
  27. package/dist/components/data-display/stereo-scatter/internals/stereo-scatter-toolbar.js +93 -0
  28. package/dist/components/data-display/stereo-scatter/internals/stereo-scatter-tooltip.d.ts +2 -0
  29. package/dist/components/data-display/stereo-scatter/internals/stereo-scatter-tooltip.js +62 -0
  30. package/dist/components/data-display/stereo-scatter/internals/stereo-scatter-viewport.d.ts +3 -0
  31. package/dist/components/data-display/stereo-scatter/internals/stereo-scatter-viewport.js +41 -0
  32. package/dist/components/data-display/stereo-scatter/stereo-scatter.d.ts +12 -0
  33. package/dist/components/data-display/stereo-scatter/stereo-scatter.js +107 -0
  34. package/dist/components/data-display/stereo-scatter/stereo-scatter.stories-data.d.ts +11 -0
  35. package/dist/components/data-display/stereo-scatter/stereo-scatter.types.d.ts +69 -0
  36. package/dist/components/data-display/stereo-scatter/stereo-scatter.variants.d.ts +13 -0
  37. package/dist/components/data-display/stereo-scatter/stereo-scatter.variants.js +42 -0
  38. package/dist/components/feedback/tooltip/button-icon-tooltip.d.ts +3 -1
  39. package/dist/components/feedback/tooltip/button-icon-tooltip.js +22 -19
  40. package/dist/components/flows/iris-chat/IrisChatComposerVoiceCapture.d.ts +5 -0
  41. package/dist/components/flows/iris-chat/IrisChatComposerVoiceCapture.js +73 -0
  42. package/dist/components/flows/iris-chat/IrisChatVoiceWaveform.d.ts +3 -0
  43. package/dist/components/flows/iris-chat/IrisChatVoiceWaveform.js +25 -0
  44. package/dist/components/flows/iris-chat/index.d.ts +3 -1
  45. package/dist/components/flows/iris-chat/index.js +58 -53
  46. package/dist/components/flows/iris-chat/iris-chat-chrome.d.ts +39 -0
  47. package/dist/components/flows/iris-chat/iris-chat-chrome.js +325 -0
  48. package/dist/components/flows/iris-chat/iris-chat-close-animation.d.ts +12 -0
  49. package/dist/components/flows/iris-chat/iris-chat-close-animation.js +21 -0
  50. package/dist/components/flows/iris-chat/iris-chat-composer.js +266 -238
  51. package/dist/components/flows/iris-chat/iris-chat-context.d.ts +13 -0
  52. package/dist/components/flows/iris-chat/iris-chat-context.js +14 -10
  53. package/dist/components/flows/iris-chat/iris-chat-copy-feedback.d.ts +4 -0
  54. package/dist/components/flows/iris-chat/iris-chat-copy-feedback.js +16 -0
  55. package/dist/components/flows/iris-chat/iris-chat-frame.d.ts +31 -0
  56. package/dist/components/flows/iris-chat/iris-chat-frame.js +79 -0
  57. package/dist/components/flows/iris-chat/iris-chat-icons.d.ts +1 -0
  58. package/dist/components/flows/iris-chat/iris-chat-icons.js +28 -15
  59. package/dist/components/flows/iris-chat/iris-chat-launch-animation.d.ts +11 -0
  60. package/dist/components/flows/iris-chat/iris-chat-launch-animation.js +35 -0
  61. package/dist/components/flows/iris-chat/iris-chat-markdown.js +70 -50
  62. package/dist/components/flows/iris-chat/iris-chat-menu.js +91 -86
  63. package/dist/components/flows/iris-chat/iris-chat-speech.d.ts +52 -0
  64. package/dist/components/flows/iris-chat/iris-chat-speech.js +121 -0
  65. package/dist/components/flows/iris-chat/iris-chat-thread.d.ts +3 -0
  66. package/dist/components/flows/iris-chat/iris-chat-thread.js +241 -190
  67. package/dist/components/flows/iris-chat/iris-chat-window-chrome.d.ts +30 -0
  68. package/dist/components/flows/iris-chat/iris-chat-window-chrome.js +34 -0
  69. package/dist/components/flows/iris-chat/iris-chat-window-geometry-context.d.ts +14 -0
  70. package/dist/components/flows/iris-chat/iris-chat-window-geometry-context.js +15 -0
  71. package/dist/components/flows/iris-chat/iris-chat-window-geometry.d.ts +12 -0
  72. package/dist/components/flows/iris-chat/iris-chat-window-geometry.js +113 -0
  73. package/dist/components/flows/iris-chat/iris-chat-window-handles.d.ts +6 -0
  74. package/dist/components/flows/iris-chat/iris-chat-window-handles.js +50 -0
  75. package/dist/components/flows/iris-chat/iris-chat-window-shell.d.ts +8 -0
  76. package/dist/components/flows/iris-chat/iris-chat-window-shell.js +37 -0
  77. package/dist/components/flows/iris-chat/iris-chat.d.ts +3 -39
  78. package/dist/components/flows/iris-chat/iris-chat.js +22 -330
  79. package/dist/components/flows/iris-chat/iris-chat.types.d.ts +18 -0
  80. package/dist/components/flows/iris-chat/iris-chat.variants.d.ts +3 -3
  81. package/dist/components/flows/iris-chat/iris-chat.variants.js +21 -16
  82. package/dist/components/flows/iris-chat/use-iris-chat-root.d.ts +26 -0
  83. package/dist/components/flows/iris-chat/use-iris-chat-root.js +140 -0
  84. package/dist/components/forms/choice-card/choice-card.d.ts +1 -0
  85. package/dist/components/forms/choice-card/choice-card.js +183 -186
  86. package/dist/components/layout/header/header.js +1 -0
  87. package/dist/form-react/Fields/SelectField.js +66 -57
  88. package/dist/form-react/Fields/VirtualizedListField.js +140 -96
  89. package/dist/form-react/index.d.ts +1 -1
  90. package/dist/form-react/types/fields.types.d.ts +27 -0
  91. package/dist/form-react/types/reactHookForm.types.d.ts +18 -1
  92. package/dist/i18n/defaultMessages.d.ts +37 -0
  93. package/dist/i18n/defaultMessages.js +54 -18
  94. package/dist/i18n/index.d.ts +1 -1
  95. package/dist/i18n/locales/de.js +36 -0
  96. package/dist/i18n/locales/es.js +36 -0
  97. package/dist/i18n/locales/hi.js +36 -0
  98. package/dist/i18n/locales/kn.js +36 -0
  99. package/dist/impact-nova-components.css +19 -0
  100. package/dist/impact-nova.css +1 -1
  101. package/dist/llms/rules/installation.js +1 -1
  102. package/dist/llms/rules/requirements.js +1 -1
  103. package/package.json +5 -1
@@ -1,297 +1,325 @@
1
- import { jsxs as l, jsx as t } from "react/jsx-runtime";
2
- import { useRef as A, useState as F, useEffect as le } from "react";
3
- import { ChevronRight as ce } from "impact-nova-icons";
4
- import { ButtonIconTooltip as h } from "../../feedback/tooltip/button-icon-tooltip.js";
5
- import { Button as p } from "../../primitives/button/button.js";
6
- import { DropdownMenu as P, DropdownMenuTrigger as _, DropdownMenuContent as W, DropdownMenuItem as V, DropdownMenuRadioGroup as ue, DropdownMenuRadioItem as de } from "../../feedback/dropdown-menu/dropdown-menu.js";
7
- import { useImpactNovaI18n as he } from "../../../i18n/use-impact-nova-i18n.js";
8
- import { useControllableState as G } from "@radix-ui/react-use-controllable-state";
9
- import { createComponent as pe } from "../../../lib/primitives/create-component.js";
10
- import { cn as me } from "../../../lib/utils.js";
11
- import { useIrisChatOptional as fe } from "./iris-chat-context.js";
12
- import { IrisChatAddIcon as q, IrisChatAttachIcon as ge, IrisChatMicIcon as Ce, IrisChatStopIcon as be, IrisChatSendIcon as ve } from "./iris-chat-icons.js";
13
- import { IrisChatAttachment as ye } from "./iris-chat-thread.js";
14
- import { irisChatComposerVariants as we } from "./iris-chat.variants.js";
15
- const xe = [
1
+ import { jsxs as s, jsx as t, Fragment as ge } from "react/jsx-runtime";
2
+ import { useRef as C, useState as D, useEffect as Ce } from "react";
3
+ import { ChevronRight as be } from "impact-nova-icons";
4
+ import { ButtonIconTooltip as p } from "../../feedback/tooltip/button-icon-tooltip.js";
5
+ import { Button as f } from "../../primitives/button/button.js";
6
+ import { DropdownMenu as H, DropdownMenuTrigger as J, DropdownMenuContent as Q, DropdownMenuItem as X, DropdownMenuRadioGroup as ye, DropdownMenuRadioItem as ve } from "../../feedback/dropdown-menu/dropdown-menu.js";
7
+ import { useImpactNovaI18n as xe } from "../../../i18n/use-impact-nova-i18n.js";
8
+ import { useControllableState as Y } from "@radix-ui/react-use-controllable-state";
9
+ import { createComponent as we } from "../../../lib/primitives/create-component.js";
10
+ import { cn as Ie } from "../../../lib/utils.js";
11
+ import { useIrisChatOptional as De } from "./iris-chat-context.js";
12
+ import { readIrisChatComposerLayout as ke } from "./iris-chat-window-chrome.js";
13
+ import { IrisChatAddIcon as Z, IrisChatAttachIcon as ze, IrisChatMicIcon as Re, IrisChatStopIcon as Ne, IrisChatSendIcon as Le } from "./iris-chat-icons.js";
14
+ import { IrisChatAttachment as Se } from "./iris-chat-thread.js";
15
+ import { IrisChatComposerVoiceCapture as Fe } from "./IrisChatComposerVoiceCapture.js";
16
+ import { startComposerSpeechRecognition as Ae } from "./iris-chat-speech.js";
17
+ import { irisChatComposerVariants as Ke } from "./iris-chat.variants.js";
18
+ const Me = [
16
19
  { label: "Auto", value: "auto" },
17
20
  { label: "Fast", value: "fast" }
18
- ], $e = pe(
21
+ ], Ze = we(
19
22
  "IrisChatComposer",
20
23
  ({
21
24
  className: a,
22
- value: s,
23
- defaultValue: H = "",
24
- onValueChange: J,
25
- pending: f = !1,
26
- placeholder: g,
27
- model: Q,
28
- defaultModel: X = "auto",
29
- onModelChange: Y,
30
- models: U = xe,
31
- onSend: Z,
32
- onStop: j,
33
- onAddClick: O,
34
- onAttachClick: E,
35
- onAttach: ee,
36
- onMicClick: K
37
- }, te) => {
38
- const { t: n } = he(), $ = fe(), C = $?.placement === "minimized" || $?.placement === "composer" ? "inline" : "stacked", [ie, x] = G({
39
- prop: s,
40
- defaultProp: H,
41
- onChange: J
42
- }), [D, ne] = G({
43
- prop: Q,
44
- defaultProp: X,
45
- onChange: Y
46
- }), T = A(null), k = A(null), B = A({}), [b, m] = F(!1), [v, z] = F([]), [c, I] = F({});
47
- B.current = c;
48
- const u = ie ?? "", R = u.trim().length > 0 || v.length > 0, ae = (e) => {
49
- const i = T.current;
50
- i && (i.accept = e, i.value = "", i.click());
51
- }, L = (e) => {
25
+ value: i,
26
+ defaultValue: ee = "",
27
+ onValueChange: te,
28
+ pending: b = !1,
29
+ placeholder: y,
30
+ model: re,
31
+ defaultModel: ne = "auto",
32
+ onModelChange: ae,
33
+ models: O = Me,
34
+ onSend: ie,
35
+ onStop: T,
36
+ onAddClick: P,
37
+ onAttachClick: $,
38
+ onAttach: se,
39
+ onMicClick: z,
40
+ speechRecognitionLocale: oe,
41
+ onSpeechNotice: B
42
+ }, le) => {
43
+ const { t: r } = xe(), v = De(), c = v ? ke({
44
+ isWindowPlacement: v.isWindowPlacement,
45
+ placement: v.placement,
46
+ frame: v.frame
47
+ }) : "stacked", [ce, R] = Y({
48
+ prop: i,
49
+ defaultProp: ee,
50
+ onChange: te
51
+ }), [N, ue] = Y({
52
+ prop: re,
53
+ defaultProp: ne,
54
+ onChange: ae
55
+ }), _ = C(null), u = C(null), d = C(!1), W = C({}), [x, L] = D(!1), [V, G] = D(
56
+ null
57
+ ), [w, S] = D([]), [h, F] = D({});
58
+ W.current = h;
59
+ const l = ce ?? "", q = C(l);
60
+ q.current = l;
61
+ const A = l.trim().length > 0 || w.length > 0, de = (e) => {
62
+ if ((e.kind === "permission" || e.messageKey === "speechNetwork" || e.messageKey === "speechError") && (d.current = !1, L(!1), u.current?.abort(), u.current = null), B) {
63
+ B(e);
64
+ return;
65
+ }
66
+ G(e);
67
+ }, he = (e) => {
68
+ const n = _.current;
69
+ n && (n.accept = e, n.value = "", n.click());
70
+ }, K = (e) => {
52
71
  if (!e?.length)
53
72
  return;
54
- const i = Array.from(e);
55
- ee?.(i), z((r) => [...r, ...i]), I((r) => {
56
- const o = {};
57
- for (const d of i)
58
- d.type.startsWith("image/") && (o[w(d)] = URL.createObjectURL(d));
59
- return { ...r, ...o };
73
+ const n = Array.from(e);
74
+ se?.(n), S((o) => [...o, ...n]), F((o) => {
75
+ const g = {};
76
+ for (const m of n)
77
+ m.type.startsWith("image/") && (g[k(m)] = URL.createObjectURL(m));
78
+ return { ...o, ...g };
60
79
  });
61
80
  }, M = (e) => {
62
- if (E) {
63
- E();
81
+ if ($) {
82
+ $();
64
83
  return;
65
84
  }
66
- ae(e);
67
- }, re = () => {
68
- if (K) {
69
- K();
85
+ he(e);
86
+ }, U = () => {
87
+ d.current = !1, u.current?.stop(), u.current = null, L(!1);
88
+ }, me = () => {
89
+ if (z) {
90
+ z();
70
91
  return;
71
92
  }
72
- if (b) {
73
- k.current?.stop(), m(!1);
93
+ if (x) {
94
+ U();
74
95
  return;
75
96
  }
76
- const e = ke();
77
- if (!e)
78
- return;
79
- const i = new e();
80
- i.continuous = !1, i.interimResults = !1, i.onresult = (r) => {
81
- const o = r.results[0]?.[0]?.transcript?.trim();
82
- o && x(u ? `${u} ${o}` : o), m(!1);
83
- }, i.onerror = () => m(!1), i.onend = () => m(!1), k.current = i, i.start(), m(!0);
97
+ G(null), d.current = !0;
98
+ const e = Ae({
99
+ locale: oe ?? "",
100
+ readBaseText: () => q.current,
101
+ shouldContinueListening: () => d.current,
102
+ onDraftChange: R,
103
+ onListeningChange: L,
104
+ onNotice: de
105
+ });
106
+ e || (d.current = !1), u.current = e;
84
107
  };
85
- le(
108
+ Ce(
86
109
  () => () => {
87
- k.current?.stop(), Object.values(B.current).forEach((e) => URL.revokeObjectURL(e));
110
+ d.current = !1, u.current?.stop(), Object.values(W.current).forEach((e) => URL.revokeObjectURL(e));
88
111
  },
89
112
  []
90
113
  );
91
- const se = () => {
92
- Object.values(c).forEach((e) => URL.revokeObjectURL(e)), I({}), z([]);
93
- }, N = () => {
94
- !R || f || (Z?.(u.trim(), v), se());
114
+ const pe = () => {
115
+ Object.values(h).forEach((e) => URL.revokeObjectURL(e)), F({}), S([]);
116
+ }, j = () => {
117
+ !A || b || (ie?.(l.trim(), w), pe());
95
118
  };
96
- return /* @__PURE__ */ l(
119
+ return /* @__PURE__ */ s(
97
120
  "form",
98
121
  {
99
- ref: te,
122
+ ref: le,
100
123
  "data-component": "iris-chat-composer",
101
- "data-layout": C,
102
- "data-pending": f ? "" : void 0,
103
- className: me(
104
- we({ layout: C }),
105
- R && "iris-edge-wash-shell--menu iris-edge-wash-shell--fluid",
124
+ "data-layout": c,
125
+ "data-pending": b ? "" : void 0,
126
+ "data-listening": x ? "" : void 0,
127
+ className: Ie(
128
+ Ke({ layout: c }),
129
+ A && "iris-edge-wash-shell--menu iris-edge-wash-shell--fluid",
106
130
  a
107
131
  ),
108
132
  onDragOver: (e) => {
109
133
  e.dataTransfer.types.includes("Files") && e.preventDefault();
110
134
  },
111
135
  onDrop: (e) => {
112
- e.dataTransfer.files.length && (e.preventDefault(), L(e.dataTransfer.files));
136
+ e.dataTransfer.files.length && (e.preventDefault(), K(e.dataTransfer.files));
113
137
  },
114
138
  onPaste: (e) => {
115
- const i = De(e.clipboardData);
116
- i.length && (e.preventDefault(), L(i));
139
+ const n = Ue(e.clipboardData);
140
+ n.length && (e.preventDefault(), K(n));
117
141
  },
118
142
  onKeyDown: (e) => {
119
- e.key === "Escape" && f && (e.preventDefault(), j?.());
143
+ if (e.key === "Escape") {
144
+ if (x) {
145
+ e.preventDefault(), U();
146
+ return;
147
+ }
148
+ b && (e.preventDefault(), T?.());
149
+ }
120
150
  },
121
151
  onSubmit: (e) => {
122
- e.preventDefault(), N();
152
+ e.preventDefault(), j();
123
153
  },
124
154
  children: [
125
- v.length > 0 ? /* @__PURE__ */ t("div", { className: "flex flex-wrap gap-2", "data-testid": "iris-chat-composer-attachments", children: v.map((e, i) => {
126
- const r = w(e, i);
127
- return /* @__PURE__ */ t(
128
- ye,
155
+ x && !z ? /* @__PURE__ */ t(Fe, { transcript: l, onStop: U }) : /* @__PURE__ */ s(ge, { children: [
156
+ w.length > 0 ? /* @__PURE__ */ t("div", { className: "flex flex-wrap gap-2", "data-testid": "iris-chat-composer-attachments", children: w.map((e, n) => {
157
+ const o = k(e, n);
158
+ return /* @__PURE__ */ t(
159
+ Se,
160
+ {
161
+ name: e.name,
162
+ kind: e.type.startsWith("image/") ? "image" : "file",
163
+ sizeLabel: e.size < 1024 ? `${e.size} B` : `${Math.round(e.size / 1024)} KB`,
164
+ previewUrl: h[k(e)] ?? h[o],
165
+ onRemove: () => {
166
+ const g = k(e), m = h[g] ?? h[o];
167
+ m && URL.revokeObjectURL(m), F((E) => {
168
+ const I = { ...E };
169
+ return delete I[g], delete I[o], I;
170
+ }), S((E) => E.filter((I, fe) => fe !== n));
171
+ }
172
+ },
173
+ o
174
+ );
175
+ }) }) : null,
176
+ c === "stacked" || c === "stackedCompact" ? /* @__PURE__ */ t(
177
+ "textarea",
129
178
  {
130
- name: e.name,
131
- kind: e.type.startsWith("image/") ? "image" : "file",
132
- sizeLabel: e.size < 1024 ? `${e.size} B` : `${Math.round(e.size / 1024)} KB`,
133
- previewUrl: c[w(e)] ?? c[r],
134
- onRemove: () => {
135
- const o = w(e), d = c[o] ?? c[r];
136
- d && URL.revokeObjectURL(d), I((S) => {
137
- const y = { ...S };
138
- return delete y[o], delete y[r], y;
139
- }), z((S) => S.filter((y, oe) => oe !== i));
179
+ id: "iris-chat-composer-input",
180
+ "data-testid": "iris-chat-composer-input",
181
+ rows: c === "stackedCompact" ? 1 : 2,
182
+ value: l,
183
+ placeholder: y ?? r("irisChat.askAnything"),
184
+ "aria-label": y ?? r("irisChat.askAnything"),
185
+ className: "max-h-24 min-h-8 w-full resize-none bg-transparent text-sm font-medium leading-5 text-content outline-none placeholder:text-content-empty",
186
+ onChange: (e) => R(e.target.value),
187
+ onKeyDown: (e) => {
188
+ e.key === "Enter" && !e.shiftKey && (e.preventDefault(), j());
140
189
  }
141
- },
142
- r
143
- );
144
- }) }) : null,
145
- C === "stacked" ? /* @__PURE__ */ t(
146
- "textarea",
147
- {
148
- id: "iris-chat-composer-input",
149
- "data-testid": "iris-chat-composer-input",
150
- rows: 2,
151
- value: u,
152
- placeholder: g ?? n("irisChat.askAnything"),
153
- "aria-label": g ?? n("irisChat.askAnything"),
154
- className: "w-full resize-none bg-transparent text-sm font-medium leading-5 text-content outline-none placeholder:text-content-empty",
155
- onChange: (e) => x(e.target.value),
156
- onKeyDown: (e) => {
157
- e.key === "Enter" && !e.shiftKey && (e.preventDefault(), N());
158
190
  }
159
- }
160
- ) : null,
161
- /* @__PURE__ */ l("div", { className: "flex min-w-0 w-full items-center justify-between gap-1 [&_button[data-size=icon]]:size-8 [&_button[data-size=icon]_svg]:size-4", children: [
162
- /* @__PURE__ */ l("div", { className: "flex min-w-0 flex-1 items-center", children: [
163
- /* @__PURE__ */ t(
164
- "input",
165
- {
166
- ref: T,
167
- type: "file",
168
- hidden: !0,
169
- multiple: !0,
170
- "data-testid": "iris-chat-attach-input",
171
- onChange: (e) => L(e.target.files)
172
- }
173
- ),
174
- O ? /* @__PURE__ */ t(h, { label: n("irisChat.add"), children: /* @__PURE__ */ t(
175
- p,
176
- {
177
- type: "button",
178
- variant: "ghost",
179
- size: "icon",
180
- "aria-label": n("irisChat.add"),
181
- onClick: O,
182
- children: /* @__PURE__ */ t(q, {})
183
- }
184
- ) }) : /* @__PURE__ */ l(P, { children: [
185
- /* @__PURE__ */ t(h, { label: n("irisChat.add"), children: /* @__PURE__ */ t(_, { asChild: !0, children: /* @__PURE__ */ t(p, { type: "button", variant: "ghost", size: "icon", "aria-label": n("irisChat.add"), children: /* @__PURE__ */ t(q, {}) }) }) }),
186
- /* @__PURE__ */ l(W, { align: "start", children: [
187
- /* @__PURE__ */ t(V, { onSelect: () => M("*/*"), children: n("irisChat.attachFile") }),
188
- /* @__PURE__ */ t(V, { onSelect: () => M("image/*"), children: n("irisChat.attachImage") })
189
- ] })
190
- ] }),
191
- /* @__PURE__ */ t(h, { label: n("irisChat.attach"), children: /* @__PURE__ */ t(
192
- p,
193
- {
194
- type: "button",
195
- variant: "ghost",
196
- size: "icon",
197
- "aria-label": n("irisChat.attach"),
198
- onClick: () => M("*/*"),
199
- children: /* @__PURE__ */ t(ge, {})
200
- }
201
- ) }),
202
- C === "inline" ? /* @__PURE__ */ t(
203
- "input",
204
- {
205
- id: "iris-chat-composer-input",
206
- "data-testid": "iris-chat-composer-input",
207
- value: u,
208
- placeholder: g ?? n("irisChat.askAnything"),
209
- "aria-label": g ?? n("irisChat.askAnything"),
210
- className: "ms-1 h-8 min-w-0 flex-1 overflow-hidden bg-transparent py-0 text-sm font-medium leading-8 text-content outline-none placeholder:text-content-empty",
211
- onChange: (e) => x(e.target.value),
212
- onKeyDown: (e) => {
213
- e.key === "Enter" && !e.shiftKey && (e.preventDefault(), N());
191
+ ) : null,
192
+ /* @__PURE__ */ s("div", { className: "flex min-w-0 w-full items-center justify-between gap-1 [&_button[data-size=icon]]:size-8 [&_button[data-size=icon]_svg]:size-4", children: [
193
+ /* @__PURE__ */ s("div", { className: "flex min-w-0 flex-1 items-center", children: [
194
+ /* @__PURE__ */ t(
195
+ "input",
196
+ {
197
+ ref: _,
198
+ type: "file",
199
+ hidden: !0,
200
+ multiple: !0,
201
+ "data-testid": "iris-chat-attach-input",
202
+ onChange: (e) => K(e.target.files)
214
203
  }
215
- }
216
- ) : null
217
- ] }),
218
- /* @__PURE__ */ l("div", { className: "flex shrink-0 items-center gap-0.5", children: [
219
- /* @__PURE__ */ l(P, { children: [
220
- /* @__PURE__ */ t(_, { asChild: !0, children: /* @__PURE__ */ l(
221
- "button",
204
+ ),
205
+ P ? /* @__PURE__ */ t(p, { label: r("irisChat.add"), children: /* @__PURE__ */ t(
206
+ f,
222
207
  {
223
208
  type: "button",
224
- "data-testid": "iris-chat-model",
225
- className: "flex h-8 max-w-24 shrink-0 items-center gap-0.5 truncate rounded-lg bg-secondary px-2 text-sm font-medium capitalize leading-none text-content",
226
- "aria-label": n("irisChat.model"),
227
- children: [
228
- U.find((e) => e.value === D)?.label ?? D,
229
- /* @__PURE__ */ t(ce, { size: 16, className: "rotate-90" })
230
- ]
209
+ variant: "ghost",
210
+ size: "icon",
211
+ "aria-label": r("irisChat.add"),
212
+ onClick: P,
213
+ children: /* @__PURE__ */ t(Z, {})
214
+ }
215
+ ) }) : /* @__PURE__ */ s(H, { children: [
216
+ /* @__PURE__ */ t(p, { label: r("irisChat.add"), children: /* @__PURE__ */ t(J, { asChild: !0, children: /* @__PURE__ */ t(f, { type: "button", variant: "ghost", size: "icon", "aria-label": r("irisChat.add"), children: /* @__PURE__ */ t(Z, {}) }) }) }),
217
+ /* @__PURE__ */ s(Q, { align: "start", children: [
218
+ /* @__PURE__ */ t(X, { onSelect: () => M("*/*"), children: r("irisChat.attachFile") }),
219
+ /* @__PURE__ */ t(X, { onSelect: () => M("image/*"), children: r("irisChat.attachImage") })
220
+ ] })
221
+ ] }),
222
+ /* @__PURE__ */ t(p, { label: r("irisChat.attach"), children: /* @__PURE__ */ t(
223
+ f,
224
+ {
225
+ type: "button",
226
+ variant: "ghost",
227
+ size: "icon",
228
+ "aria-label": r("irisChat.attach"),
229
+ onClick: () => M("*/*"),
230
+ children: /* @__PURE__ */ t(ze, {})
231
231
  }
232
232
  ) }),
233
- /* @__PURE__ */ t(W, { align: "end", children: /* @__PURE__ */ t(
234
- ue,
233
+ c === "inline" ? /* @__PURE__ */ t(
234
+ "input",
235
235
  {
236
- value: D,
237
- onValueChange: ne,
238
- children: U.map((e) => /* @__PURE__ */ t(de, { value: e.value, children: e.label }, e.value))
236
+ id: "iris-chat-composer-input",
237
+ "data-testid": "iris-chat-composer-input",
238
+ value: l,
239
+ placeholder: y ?? r("irisChat.askAnything"),
240
+ "aria-label": y ?? r("irisChat.askAnything"),
241
+ className: "ms-1 h-8 min-w-0 flex-1 overflow-hidden bg-transparent py-0 text-sm font-medium leading-8 text-content outline-none placeholder:text-content-empty",
242
+ onChange: (e) => R(e.target.value),
243
+ onKeyDown: (e) => {
244
+ e.key === "Enter" && !e.shiftKey && (e.preventDefault(), j());
245
+ }
239
246
  }
240
- ) })
247
+ ) : null
241
248
  ] }),
242
- /* @__PURE__ */ t(h, { label: n(b ? "irisChat.listening" : "irisChat.mic"), children: /* @__PURE__ */ t(
243
- p,
244
- {
245
- type: "button",
246
- variant: "ghost",
247
- size: "icon",
248
- "aria-label": n(b ? "irisChat.listening" : "irisChat.mic"),
249
- "aria-pressed": b,
250
- onClick: re,
251
- children: /* @__PURE__ */ t(Ce, {})
252
- }
253
- ) }),
254
- f ? /* @__PURE__ */ t(h, { label: n("irisChat.stop"), children: /* @__PURE__ */ t(
255
- p,
256
- {
257
- type: "button",
258
- variant: "default",
259
- size: "icon",
260
- "aria-label": n("irisChat.stop"),
261
- "data-testid": "iris-chat-stop",
262
- className: "rounded-full",
263
- onClick: j,
264
- children: /* @__PURE__ */ t(be, { size: 16 })
265
- }
266
- ) }) : R ? /* @__PURE__ */ t(h, { label: n("irisChat.send"), children: /* @__PURE__ */ t(
267
- p,
268
- {
269
- type: "submit",
270
- variant: "default",
271
- size: "icon",
272
- "aria-label": n("irisChat.send"),
273
- "data-testid": "iris-chat-send",
274
- className: "rounded-full",
275
- children: /* @__PURE__ */ t(ve, { size: 16 })
276
- }
277
- ) }) : null
249
+ /* @__PURE__ */ s("div", { className: "flex shrink-0 items-center gap-0.5", children: [
250
+ /* @__PURE__ */ s(H, { children: [
251
+ /* @__PURE__ */ t(J, { asChild: !0, children: /* @__PURE__ */ s(
252
+ "button",
253
+ {
254
+ type: "button",
255
+ "data-testid": "iris-chat-model",
256
+ className: "flex h-8 max-w-24 shrink-0 items-center gap-0.5 truncate rounded-lg bg-secondary px-2 text-sm font-medium capitalize leading-none text-content",
257
+ "aria-label": r("irisChat.model"),
258
+ children: [
259
+ O.find((e) => e.value === N)?.label ?? N,
260
+ /* @__PURE__ */ t(be, { size: 16, className: "rotate-90" })
261
+ ]
262
+ }
263
+ ) }),
264
+ /* @__PURE__ */ t(Q, { align: "end", children: /* @__PURE__ */ t(
265
+ ye,
266
+ {
267
+ value: N,
268
+ onValueChange: ue,
269
+ children: O.map((e) => /* @__PURE__ */ t(ve, { value: e.value, children: e.label }, e.value))
270
+ }
271
+ ) })
272
+ ] }),
273
+ /* @__PURE__ */ t(p, { label: r("irisChat.mic"), children: /* @__PURE__ */ t(
274
+ f,
275
+ {
276
+ type: "button",
277
+ variant: "ghost",
278
+ size: "icon",
279
+ "aria-label": r("irisChat.mic"),
280
+ onClick: me,
281
+ children: /* @__PURE__ */ t(Re, {})
282
+ }
283
+ ) }),
284
+ b ? /* @__PURE__ */ t(p, { label: r("irisChat.stop"), children: /* @__PURE__ */ t(
285
+ f,
286
+ {
287
+ type: "button",
288
+ variant: "default",
289
+ size: "icon",
290
+ "aria-label": r("irisChat.stop"),
291
+ "data-testid": "iris-chat-stop",
292
+ className: "rounded-full",
293
+ onClick: T,
294
+ children: /* @__PURE__ */ t(Ne, { size: 16 })
295
+ }
296
+ ) }) : A ? /* @__PURE__ */ t(p, { label: r("irisChat.send"), children: /* @__PURE__ */ t(
297
+ f,
298
+ {
299
+ type: "submit",
300
+ variant: "default",
301
+ size: "icon",
302
+ "aria-label": r("irisChat.send"),
303
+ "data-testid": "iris-chat-send",
304
+ className: "rounded-full",
305
+ children: /* @__PURE__ */ t(Le, { size: 16 })
306
+ }
307
+ ) }) : null
308
+ ] })
278
309
  ] })
279
- ] })
310
+ ] }),
311
+ V ? /* @__PURE__ */ t("p", { className: "px-1 text-xs text-destructive", role: "alert", children: r(`irisChat.${V.messageKey}`) }) : null
280
312
  ]
281
313
  }
282
314
  );
283
315
  }
284
316
  );
285
- function w(a, s = 0) {
286
- return `${a.name}:${a.size}:${a.lastModified}:${s}`;
287
- }
288
- function De(a) {
289
- return a ? a.files.length ? Array.from(a.files) : Array.from(a.items).filter((s) => s.kind === "file").map((s) => s.getAsFile()).filter((s) => !!s) : [];
317
+ function k(a, i = 0) {
318
+ return `${a.name}:${a.size}:${a.lastModified}:${i}`;
290
319
  }
291
- function ke() {
292
- const a = window;
293
- return a.SpeechRecognition ?? a.webkitSpeechRecognition;
320
+ function Ue(a) {
321
+ return a ? a.files.length ? Array.from(a.files) : Array.from(a.items).filter((i) => i.kind === "file").map((i) => i.getAsFile()).filter((i) => !!i) : [];
294
322
  }
295
323
  export {
296
- $e as IrisChatComposer
324
+ Ze as IrisChatComposer
297
325
  };
@@ -1,10 +1,22 @@
1
+ import { IrisChatFrame } from './iris-chat-frame';
1
2
  import { IrisChatPlacement } from './iris-chat.types';
2
3
  import * as React from "react";
3
4
  export type IrisChatContextValue = {
4
5
  open: boolean;
5
6
  setOpen: (open: boolean) => void;
7
+ requestClose: () => void;
8
+ isClosing: boolean;
9
+ registerPanelNode: (node: HTMLDivElement | null) => void;
10
+ isOpening: boolean;
6
11
  placement: IrisChatPlacement;
7
12
  setPlacement: (placement: IrisChatPlacement) => void;
13
+ frame: IrisChatFrame;
14
+ setFrame: (frame: IrisChatFrame) => void;
15
+ commitFrame: (frame: IrisChatFrame) => void;
16
+ resetFrame: () => void;
17
+ applyCompactFrame: () => void;
18
+ expandFromCompactFrame: () => void;
19
+ isWindowPlacement: boolean;
8
20
  };
9
21
  export declare function IrisChatProvider({ value, children, }: {
10
22
  value: IrisChatContextValue;
@@ -12,3 +24,4 @@ export declare function IrisChatProvider({ value, children, }: {
12
24
  }): import("react/jsx-runtime").JSX.Element;
13
25
  export declare function useIrisChat(): IrisChatContextValue;
14
26
  export declare function useIrisChatOptional(): IrisChatContextValue | null;
27
+ export declare function readIsIrisChatWindowPlacement(placement: IrisChatPlacement): boolean;
@@ -1,23 +1,27 @@
1
- import { jsx as o } from "react/jsx-runtime";
1
+ import { jsx as i } from "react/jsx-runtime";
2
2
  import * as r from "react";
3
- const e = r.createContext(null);
3
+ const n = r.createContext(null);
4
4
  function s({
5
5
  value: t,
6
- children: n
6
+ children: e
7
7
  }) {
8
- return /* @__PURE__ */ o(e.Provider, { value: t, children: n });
8
+ return /* @__PURE__ */ i(n.Provider, { value: t, children: e });
9
9
  }
10
- function u() {
11
- const t = r.useContext(e);
10
+ function a() {
11
+ const t = r.useContext(n);
12
12
  if (!t)
13
13
  throw new Error("IrisChat parts must render inside IrisChat.");
14
14
  return t;
15
15
  }
16
- function a() {
17
- return r.useContext(e);
16
+ function u() {
17
+ return r.useContext(n);
18
+ }
19
+ function C(t) {
20
+ return t === "float" || t === "minimized";
18
21
  }
19
22
  export {
20
23
  s as IrisChatProvider,
21
- u as useIrisChat,
22
- a as useIrisChatOptional
24
+ C as readIsIrisChatWindowPlacement,
25
+ a as useIrisChat,
26
+ u as useIrisChatOptional
23
27
  };
@@ -0,0 +1,4 @@
1
+ export declare const IRIS_CHAT_COPY_FEEDBACK_MS = 2000;
2
+ export declare const irisChatActionIconPressClassName = "transition-[transform,color,background-color] duration-150 active:scale-90";
3
+ export declare const irisChatCopySuccessClassName = "text-success bg-success-subtle hover:bg-success-subtle hover:text-success";
4
+ export declare function writeIrisChatClipboardText(text: string): Promise<boolean>;