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
@@ -0,0 +1,16 @@
1
+ const t = 2e3, r = "transition-[transform,color,background-color] duration-150 active:scale-90", e = "text-success bg-success-subtle hover:bg-success-subtle hover:text-success";
2
+ async function a(s) {
3
+ if (!s.trim() || !navigator.clipboard?.writeText)
4
+ return !1;
5
+ try {
6
+ return await navigator.clipboard.writeText(s), !0;
7
+ } catch {
8
+ return !1;
9
+ }
10
+ }
11
+ export {
12
+ t as IRIS_CHAT_COPY_FEEDBACK_MS,
13
+ r as irisChatActionIconPressClassName,
14
+ e as irisChatCopySuccessClassName,
15
+ a as writeIrisChatClipboardText
16
+ };
@@ -0,0 +1,31 @@
1
+ import { CSSProperties } from 'react';
2
+ export type IrisChatFrame = {
3
+ x: number;
4
+ y: number;
5
+ width: number;
6
+ height: number;
7
+ };
8
+ export declare const IRIS_CHAT_FRAME_PADDING_PX = 16;
9
+ export declare const IRIS_CHAT_FRAME_MIN_WIDTH_PX = 280;
10
+ export declare const IRIS_CHAT_FRAME_MIN_HEIGHT_PX = 360;
11
+ export declare const IRIS_CHAT_FRAME_DEFAULT_WIDTH_PX = 420;
12
+ export declare const IRIS_CHAT_FRAME_DEFAULT_HEIGHT_PX = 640;
13
+ export declare const IRIS_CHAT_FRAME_COMPACT_WIDTH_PX = 360;
14
+ export declare const IRIS_CHAT_FRAME_COMPACT_HEIGHT_PX = 480;
15
+ export declare const IRIS_CHAT_HEADER_MIN_VISIBLE_PX = 80;
16
+ export type IrisChatViewport = {
17
+ width: number;
18
+ height: number;
19
+ };
20
+ export type IrisChatResizeEdge = "north" | "south" | "east" | "west" | "north-east" | "north-west" | "south-east" | "south-west";
21
+ export declare function readIrisChatViewport(): IrisChatViewport;
22
+ export declare function readIrisChatMaxFrameSize(viewport: IrisChatViewport): {
23
+ width: number;
24
+ height: number;
25
+ };
26
+ export declare function createDefaultIrisChatFrame(viewport?: IrisChatViewport): IrisChatFrame;
27
+ export declare function createCompactIrisChatFrame(anchor: Pick<IrisChatFrame, "x" | "y">, viewport?: IrisChatViewport): IrisChatFrame;
28
+ export declare function clampIrisChatFrame(frame: IrisChatFrame, viewport: IrisChatViewport): IrisChatFrame;
29
+ export declare function moveIrisChatFrame(frame: IrisChatFrame, deltaX: number, deltaY: number, viewport: IrisChatViewport): IrisChatFrame;
30
+ export declare function resizeIrisChatFrame(frame: IrisChatFrame, edge: IrisChatResizeEdge, deltaX: number, deltaY: number, viewport: IrisChatViewport): IrisChatFrame;
31
+ export declare function readIrisChatFrameStyle(frame: IrisChatFrame): CSSProperties;
@@ -0,0 +1,79 @@
1
+ const a = 16, s = 280, c = 360, o = 420, P = 640, r = 360, F = 480, S = 80;
2
+ function e() {
3
+ return typeof window > "u" ? { width: 1280, height: 800 } : { width: window.innerWidth, height: window.innerHeight };
4
+ }
5
+ function R(_) {
6
+ const t = Math.max(
7
+ 280,
8
+ _.width - 32
9
+ ), I = Math.max(
10
+ 360,
11
+ _.height - 32
12
+ );
13
+ return { width: t, height: I };
14
+ }
15
+ function D(_ = e()) {
16
+ const { width: t, height: I } = R(_), h = Math.min(420, t), i = Math.min(640, I);
17
+ return {
18
+ x: _.width - h - 16,
19
+ y: _.height - i - 16,
20
+ width: h,
21
+ height: i
22
+ };
23
+ }
24
+ function m(_, t = e()) {
25
+ const { width: I, height: h } = R(t), i = Math.min(360, I), n = Math.min(480, h);
26
+ return T(
27
+ {
28
+ x: _.x,
29
+ y: _.y,
30
+ width: i,
31
+ height: n
32
+ },
33
+ t
34
+ );
35
+ }
36
+ function T(_, t) {
37
+ const I = R(t), h = Math.min(Math.max(_.width, 280), I.width), i = Math.min(Math.max(_.height, 360), I.height), n = t.width - 80, M = t.height - 80, A = 16 - h + 80, H = 16, E = Math.min(Math.max(_.x, A), n), C = Math.min(Math.max(_.y, H), M);
38
+ return { x: E, y: C, width: h, height: i };
39
+ }
40
+ function d(_, t, I, h) {
41
+ return T(
42
+ {
43
+ ..._,
44
+ x: _.x + t,
45
+ y: _.y + I
46
+ },
47
+ h
48
+ );
49
+ }
50
+ function X(_, t, I, h, i) {
51
+ let { x: n, y: M, width: A, height: H } = _;
52
+ return t.includes("east") && (A += I), t.includes("west") && (n += I, A -= I), t.includes("south") && (H += h), t.includes("north") && (M += h, H -= h), T({ x: n, y: M, width: A, height: H }, i);
53
+ }
54
+ function u(_) {
55
+ return {
56
+ left: _.x,
57
+ top: _.y,
58
+ width: _.width,
59
+ height: _.height
60
+ };
61
+ }
62
+ export {
63
+ F as IRIS_CHAT_FRAME_COMPACT_HEIGHT_PX,
64
+ r as IRIS_CHAT_FRAME_COMPACT_WIDTH_PX,
65
+ P as IRIS_CHAT_FRAME_DEFAULT_HEIGHT_PX,
66
+ o as IRIS_CHAT_FRAME_DEFAULT_WIDTH_PX,
67
+ c as IRIS_CHAT_FRAME_MIN_HEIGHT_PX,
68
+ s as IRIS_CHAT_FRAME_MIN_WIDTH_PX,
69
+ a as IRIS_CHAT_FRAME_PADDING_PX,
70
+ S as IRIS_CHAT_HEADER_MIN_VISIBLE_PX,
71
+ T as clampIrisChatFrame,
72
+ m as createCompactIrisChatFrame,
73
+ D as createDefaultIrisChatFrame,
74
+ d as moveIrisChatFrame,
75
+ u as readIrisChatFrameStyle,
76
+ R as readIrisChatMaxFrameSize,
77
+ e as readIrisChatViewport,
78
+ X as resizeIrisChatFrame
79
+ };
@@ -13,6 +13,7 @@ export declare function IrisChatSuggestIcon({ size, className }: IconProps): imp
13
13
  export declare function IrisChatLikeIcon({ size, className }: IconProps): import("react/jsx-runtime").JSX.Element;
14
14
  export declare function IrisChatDislikeIcon({ size, className }: IconProps): import("react/jsx-runtime").JSX.Element;
15
15
  export declare function IrisChatCopyIcon({ size, className }: IconProps): import("react/jsx-runtime").JSX.Element;
16
+ export declare function IrisChatCheckIcon({ size, className }: IconProps): import("react/jsx-runtime").JSX.Element;
16
17
  export declare function IrisChatRetryIcon({ size, className }: IconProps): import("react/jsx-runtime").JSX.Element;
17
18
  export declare function IrisChatSpeakIcon({ size, className }: IconProps): import("react/jsx-runtime").JSX.Element;
18
19
  export {};
@@ -3,20 +3,20 @@ import { cn as h } from "../../../lib/utils.js";
3
3
  function n({
4
4
  size: r = 16,
5
5
  className: t,
6
- children: c,
7
- viewBox: i = "0 0 24 24"
6
+ children: i,
7
+ viewBox: c = "0 0 24 24"
8
8
  }) {
9
9
  return /* @__PURE__ */ o(
10
10
  "svg",
11
11
  {
12
12
  width: r,
13
13
  height: r,
14
- viewBox: i,
14
+ viewBox: c,
15
15
  fill: "none",
16
16
  xmlns: "http://www.w3.org/2000/svg",
17
17
  "aria-hidden": !0,
18
18
  className: h("block shrink-0", t),
19
- children: c
19
+ children: i
20
20
  }
21
21
  );
22
22
  }
@@ -29,7 +29,7 @@ function u({ size: r = 16, className: t }) {
29
29
  }
30
30
  ) });
31
31
  }
32
- function l({ size: r = 16, className: t }) {
32
+ function a({ size: r = 16, className: t }) {
33
33
  return /* @__PURE__ */ o(n, { size: r, viewBox: "0 0 16 16", className: t, children: /* @__PURE__ */ o(
34
34
  "path",
35
35
  {
@@ -38,7 +38,7 @@ function l({ size: r = 16, className: t }) {
38
38
  }
39
39
  ) });
40
40
  }
41
- function a({ size: r = 16, className: t }) {
41
+ function l({ size: r = 16, className: t }) {
42
42
  return /* @__PURE__ */ o(n, { size: r, viewBox: "0 0 16 16", className: t, children: /* @__PURE__ */ o(
43
43
  "path",
44
44
  {
@@ -47,7 +47,7 @@ function a({ size: r = 16, className: t }) {
47
47
  }
48
48
  ) });
49
49
  }
50
- function C({ size: r = 16, className: t }) {
50
+ function k({ size: r = 16, className: t }) {
51
51
  return /* @__PURE__ */ o(n, { size: r, className: t, children: /* @__PURE__ */ o(
52
52
  "path",
53
53
  {
@@ -59,7 +59,7 @@ function C({ size: r = 16, className: t }) {
59
59
  }
60
60
  ) });
61
61
  }
62
- function k({ size: r = 16, className: t }) {
62
+ function C({ size: r = 16, className: t }) {
63
63
  return /* @__PURE__ */ o(n, { size: r, className: t, children: /* @__PURE__ */ o("rect", { x: "6.5", y: "6.5", width: "11", height: "11", rx: "1.5", fill: "currentColor" }) });
64
64
  }
65
65
  function p({ size: r = 16, className: t }) {
@@ -126,6 +126,18 @@ function L({ size: r = 16, className: t }) {
126
126
  ] });
127
127
  }
128
128
  function A({ size: r = 16, className: t }) {
129
+ return /* @__PURE__ */ o(n, { size: r, className: t, children: /* @__PURE__ */ o(
130
+ "path",
131
+ {
132
+ d: "M5 12.5 9.5 17 19 7",
133
+ stroke: "currentColor",
134
+ strokeWidth: "1.8",
135
+ strokeLinecap: "round",
136
+ strokeLinejoin: "round"
137
+ }
138
+ ) });
139
+ }
140
+ function V({ size: r = 16, className: t }) {
129
141
  return /* @__PURE__ */ o(n, { size: r, className: t, children: /* @__PURE__ */ o(
130
142
  "path",
131
143
  {
@@ -137,7 +149,7 @@ function A({ size: r = 16, className: t }) {
137
149
  }
138
150
  ) });
139
151
  }
140
- function V({ size: r = 16, className: t }) {
152
+ function W({ size: r = 16, className: t }) {
141
153
  return /* @__PURE__ */ e(n, { size: r, className: t, children: [
142
154
  /* @__PURE__ */ o(
143
155
  "path",
@@ -161,16 +173,17 @@ function V({ size: r = 16, className: t }) {
161
173
  }
162
174
  export {
163
175
  u as IrisChatAddIcon,
164
- l as IrisChatAttachIcon,
176
+ a as IrisChatAttachIcon,
177
+ A as IrisChatCheckIcon,
165
178
  L as IrisChatCopyIcon,
166
179
  v as IrisChatDislikeIcon,
167
180
  p as IrisChatHamburgerIcon,
168
181
  f as IrisChatLikeIcon,
169
- a as IrisChatMicIcon,
182
+ l as IrisChatMicIcon,
170
183
  I as IrisChatMinimizeIcon,
171
- A as IrisChatRetryIcon,
172
- C as IrisChatSendIcon,
173
- V as IrisChatSpeakIcon,
174
- k as IrisChatStopIcon,
184
+ V as IrisChatRetryIcon,
185
+ k as IrisChatSendIcon,
186
+ W as IrisChatSpeakIcon,
187
+ C as IrisChatStopIcon,
175
188
  M as IrisChatSuggestIcon
176
189
  };
@@ -0,0 +1,11 @@
1
+ export declare function readIrisChatLaunchAnimationTransition(): string;
2
+ export declare function runIrisChatOpenFromLaunchTarget(input: {
3
+ panel: HTMLDivElement;
4
+ target: HTMLElement;
5
+ onComplete: () => void;
6
+ }): () => void;
7
+ export declare function readIrisChatLaunchAnimationEnabled(input: {
8
+ target: HTMLElement | null;
9
+ panel: HTMLDivElement | null;
10
+ isWindowPlacement: boolean;
11
+ }): boolean;
@@ -0,0 +1,35 @@
1
+ import { readIrisChatCloseTransform as c, readIrisChatCloseAnimationStyle as m, IRIS_CHAT_CLOSE_ANIMATION_MS as r } from "./iris-chat-close-animation.js";
2
+ function d() {
3
+ return `transform ${r}ms cubic-bezier(0.22, 1, 0.36, 1), opacity ${r - 40}ms ease-out`;
4
+ }
5
+ function y(e) {
6
+ const n = c(
7
+ e.panel.getBoundingClientRect(),
8
+ e.target.getBoundingClientRect()
9
+ ), a = m(n);
10
+ e.panel.style.pointerEvents = "none", e.panel.style.transformOrigin = "center center", e.panel.style.transition = "none", e.panel.style.transform = a.transform, e.panel.style.opacity = a.opacity;
11
+ let o = !1;
12
+ const t = () => {
13
+ o || (o = !0, e.panel.removeEventListener("transitionend", s), l !== null && window.clearTimeout(l), e.panel.style.transition = "", e.panel.style.transform = "", e.panel.style.opacity = "", e.panel.style.pointerEvents = "", e.onComplete());
14
+ }, s = (i) => {
15
+ i.target !== e.panel || i.propertyName !== "transform" || t();
16
+ };
17
+ requestAnimationFrame(() => {
18
+ requestAnimationFrame(() => {
19
+ e.panel.style.transition = d(), e.panel.style.transform = "", e.panel.style.opacity = "1";
20
+ });
21
+ }), e.panel.addEventListener("transitionend", s);
22
+ const l = window.setTimeout(t, r + 80);
23
+ return t;
24
+ }
25
+ function h(e) {
26
+ if (e.target === null || e.panel === null || !e.isWindowPlacement || window.matchMedia("(prefers-reduced-motion: reduce)").matches)
27
+ return !1;
28
+ const n = e.panel.getBoundingClientRect();
29
+ return n.width >= 1 && n.height >= 1;
30
+ }
31
+ export {
32
+ h as readIrisChatLaunchAnimationEnabled,
33
+ d as readIrisChatLaunchAnimationTransition,
34
+ y as runIrisChatOpenFromLaunchTarget
35
+ };
@@ -1,82 +1,102 @@
1
- import { jsx as t, jsxs as s } from "react/jsx-runtime";
2
- import { useState as l } from "react";
3
- import { ButtonIconTooltip as c } from "../../feedback/tooltip/button-icon-tooltip.js";
4
- import { Button as d } from "../../primitives/button/button.js";
5
- import { useImpactNovaI18n as m } from "../../../i18n/use-impact-nova-i18n.js";
6
- import { createComponent as p } from "../../../lib/primitives/create-component.js";
7
- import { cn as h } from "../../../lib/utils.js";
8
- import { IrisChatCopyIcon as f } from "./iris-chat-icons.js";
9
- import { irisChatMarkdownVariants as u } from "./iris-chat.variants.js";
10
- import { Markdown as w } from "../../../node_modules/react-markdown/lib/index.js";
11
- import b from "../../../node_modules/remark-gfm/lib/index.js";
12
- function n(r) {
13
- return typeof r == "string" || typeof r == "number" ? String(r) : Array.isArray(r) ? r.map(n).join("") : r && typeof r == "object" && "props" in r ? n(r.props.children) : "";
1
+ import { jsx as e, jsxs as m } from "react/jsx-runtime";
2
+ import { useState as l, useRef as u, useEffect as f } from "react";
3
+ import { ButtonIconTooltip as h } from "../../feedback/tooltip/button-icon-tooltip.js";
4
+ import { Button as C } from "../../primitives/button/button.js";
5
+ import { useImpactNovaI18n as w } from "../../../i18n/use-impact-nova-i18n.js";
6
+ import { createComponent as b } from "../../../lib/primitives/create-component.js";
7
+ import { cn as d } from "../../../lib/utils.js";
8
+ import { IrisChatCheckIcon as y, IrisChatCopyIcon as x } from "./iris-chat-icons.js";
9
+ import { writeIrisChatClipboardText as k, IRIS_CHAT_COPY_FEEDBACK_MS as v, irisChatCopySuccessClassName as I, irisChatActionIconPressClassName as N } from "./iris-chat-copy-feedback.js";
10
+ import { irisChatMarkdownVariants as T } from "./iris-chat.variants.js";
11
+ import { Markdown as g } from "../../../node_modules/react-markdown/lib/index.js";
12
+ import M from "../../../node_modules/remark-gfm/lib/index.js";
13
+ function c(r) {
14
+ return typeof r == "string" || typeof r == "number" ? String(r) : Array.isArray(r) ? r.map(c).join("") : r && typeof r == "object" && "props" in r ? c(r.props.children) : "";
14
15
  }
15
- function x({ children: r }) {
16
- return /* @__PURE__ */ t("div", { className: "grid w-full min-w-0 max-w-full grid-cols-[minmax(0,1fr)] overflow-hidden rounded-xl border border-stroke-subtle", children: /* @__PURE__ */ t(
16
+ function A({ children: r }) {
17
+ return /* @__PURE__ */ e("div", { className: "grid w-full min-w-0 max-w-full grid-cols-[minmax(0,1fr)] overflow-hidden rounded-xl border border-stroke-subtle", children: /* @__PURE__ */ e(
17
18
  "div",
18
19
  {
19
20
  "data-slot": "markdown-table-scroll",
20
21
  className: "min-w-0 max-w-full overflow-x-auto overflow-y-hidden overscroll-x-contain",
21
- children: /* @__PURE__ */ t("table", { className: "w-max min-w-full border-separate border-spacing-0 text-sm", children: r })
22
+ children: /* @__PURE__ */ e("table", { className: "w-max min-w-full border-separate border-spacing-0 text-sm", children: r })
22
23
  }
23
24
  ) });
24
25
  }
25
- function k({ children: r }) {
26
- const { t: i } = m(), [a, e] = l(!1), o = n(r);
27
- return /* @__PURE__ */ s("div", { className: "relative", children: [
28
- /* @__PURE__ */ t(c, { label: i(a ? "irisChat.copied" : "irisChat.copyCode"), children: /* @__PURE__ */ t(
29
- d,
26
+ function S({ children: r }) {
27
+ const { t: a } = w(), [o, t] = l(!1), [i, s] = l(!1), n = u(null), p = c(r);
28
+ return f(
29
+ () => () => {
30
+ n.current !== null && window.clearTimeout(n.current);
31
+ },
32
+ []
33
+ ), /* @__PURE__ */ m("div", { className: "relative", children: [
34
+ /* @__PURE__ */ e(
35
+ h,
30
36
  {
31
- type: "button",
32
- variant: "ghost",
33
- size: "icon",
34
- className: "absolute end-1.5 top-1.5 size-7",
35
- "aria-label": i(a ? "irisChat.copied" : "irisChat.copyCode"),
36
- "data-testid": "iris-chat-copy-code",
37
- onClick: () => {
38
- navigator.clipboard?.writeText(o).catch(() => {
39
- }), e(!0), window.setTimeout(() => e(!1), 1600);
40
- },
41
- children: /* @__PURE__ */ t(f, { size: 14 })
37
+ label: a(o ? "irisChat.copied" : "irisChat.copyCode"),
38
+ open: i,
39
+ onOpenChange: s,
40
+ children: /* @__PURE__ */ e(
41
+ C,
42
+ {
43
+ type: "button",
44
+ variant: "ghost",
45
+ size: "icon",
46
+ className: d(
47
+ "absolute end-1.5 top-1.5 size-7",
48
+ N,
49
+ o && I
50
+ ),
51
+ "aria-label": a(o ? "irisChat.copied" : "irisChat.copyCode"),
52
+ "data-testid": "iris-chat-copy-code",
53
+ "data-copied": o ? "" : void 0,
54
+ onClick: () => {
55
+ (async () => await k(p) && (t(!0), s(!0), n.current !== null && window.clearTimeout(n.current), n.current = window.setTimeout(() => {
56
+ t(!1), s(!1), n.current = null;
57
+ }, v)))();
58
+ },
59
+ children: o ? /* @__PURE__ */ e(y, { size: 14 }) : /* @__PURE__ */ e(x, { size: 14 })
60
+ }
61
+ )
42
62
  }
43
- ) }),
44
- /* @__PURE__ */ t("pre", { children: r })
63
+ ),
64
+ /* @__PURE__ */ e("pre", { children: r })
45
65
  ] });
46
66
  }
47
- const A = p(
67
+ const V = b(
48
68
  "IrisChatMarkdown",
49
- ({ className: r, children: i }, a) => /* @__PURE__ */ t(
69
+ ({ className: r, children: a }, o) => /* @__PURE__ */ e(
50
70
  "div",
51
71
  {
52
- ref: a,
72
+ ref: o,
53
73
  "data-component": "iris-chat-markdown",
54
- className: h(u(), r),
55
- children: /* @__PURE__ */ t(
56
- w,
74
+ className: d(T(), r),
75
+ children: /* @__PURE__ */ e(
76
+ g,
57
77
  {
58
- remarkPlugins: [b],
78
+ remarkPlugins: [M],
59
79
  skipHtml: !0,
60
80
  components: {
61
- a: ({ href: e, children: o }) => /* @__PURE__ */ t("a", { href: e, target: "_blank", rel: "noreferrer", children: o }),
62
- pre: ({ children: e }) => /* @__PURE__ */ t(k, { children: e }),
63
- table: ({ children: e }) => /* @__PURE__ */ t(x, { children: e }),
64
- th: ({ children: e, style: o }) => /* @__PURE__ */ t(
81
+ a: ({ href: t, children: i }) => /* @__PURE__ */ e("a", { href: t, target: "_blank", rel: "noreferrer", children: i }),
82
+ pre: ({ children: t }) => /* @__PURE__ */ e(S, { children: t }),
83
+ table: ({ children: t }) => /* @__PURE__ */ e(A, { children: t }),
84
+ th: ({ children: t, style: i }) => /* @__PURE__ */ e(
65
85
  "th",
66
86
  {
67
- style: o,
87
+ style: i,
68
88
  className: "whitespace-nowrap bg-secondary px-3 py-2 text-start text-xs font-semibold",
69
- children: e
89
+ children: t
70
90
  }
71
91
  ),
72
- td: ({ children: e, style: o }) => /* @__PURE__ */ t("td", { style: o, className: "whitespace-nowrap border-t border-stroke-subtle px-3 py-2", children: e })
92
+ td: ({ children: t, style: i }) => /* @__PURE__ */ e("td", { style: i, className: "whitespace-nowrap border-t border-stroke-subtle px-3 py-2", children: t })
73
93
  },
74
- children: i
94
+ children: a
75
95
  }
76
96
  )
77
97
  }
78
98
  )
79
99
  );
80
100
  export {
81
- A as IrisChatMarkdown
101
+ V as IrisChatMarkdown
82
102
  };