@shapesos/clay 0.7.0 → 0.8.0
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/chat.cjs +117 -71
- package/dist/chat.cjs.map +1 -1
- package/dist/chat.d.cts +5 -0
- package/dist/chat.d.ts +5 -0
- package/dist/chat.js +2 -2
- package/dist/{chunk-J6VPAHO3.js → chunk-KYTNUZO6.js} +90 -46
- package/dist/chunk-KYTNUZO6.js.map +1 -0
- package/dist/chunk-N4FMZU56.js +71 -0
- package/dist/chunk-N4FMZU56.js.map +1 -0
- package/dist/{chunk-WYGH3FKT.js → chunk-QUJYTIGD.js} +2 -2
- package/dist/chunk-QUJYTIGD.js.map +1 -0
- package/dist/index.cjs +232 -118
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +8 -3
- package/dist/utils.cjs +73 -3
- package/dist/utils.cjs.map +1 -1
- package/dist/utils.d.cts +26 -1
- package/dist/utils.d.ts +26 -1
- package/dist/utils.js +8 -3
- package/package.json +1 -1
- package/dist/chunk-DRBRT57F.js +0 -1
- package/dist/chunk-DRBRT57F.js.map +0 -1
- package/dist/chunk-J6VPAHO3.js.map +0 -1
- package/dist/chunk-WYGH3FKT.js.map +0 -1
package/dist/chat.cjs
CHANGED
|
@@ -39,11 +39,26 @@ __export(chat_exports, {
|
|
|
39
39
|
module.exports = __toCommonJS(chat_exports);
|
|
40
40
|
|
|
41
41
|
// src/components/chat/chat-message-content/chat-message-content.tsx
|
|
42
|
+
var import_react3 = require("react");
|
|
42
43
|
var import_react_markdown = __toESM(require("react-markdown"), 1);
|
|
43
44
|
var import_remark_breaks = __toESM(require("remark-breaks"), 1);
|
|
44
45
|
var import_remark_gfm = __toESM(require("remark-gfm"), 1);
|
|
45
46
|
|
|
46
|
-
// src/components/chat/
|
|
47
|
+
// src/components/chat/scrollable-table/scrollable-table.tsx
|
|
48
|
+
var import_react2 = require("react");
|
|
49
|
+
|
|
50
|
+
// src/components/chat/chat-context/chat-context.ts
|
|
51
|
+
var import_react = require("react");
|
|
52
|
+
var ChatContext = (0, import_react.createContext)(null);
|
|
53
|
+
function useChatContext() {
|
|
54
|
+
const context = (0, import_react.useContext)(ChatContext);
|
|
55
|
+
if (!context) {
|
|
56
|
+
throw new Error("useChatContext must be used within a Chat.Root component");
|
|
57
|
+
}
|
|
58
|
+
return context;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
// src/components/chat/scrollable-table/scrollable-table-styles.ts
|
|
47
62
|
var import_styled_components = __toESM(require("styled-components"), 1);
|
|
48
63
|
|
|
49
64
|
// src/tokens/colors.ts
|
|
@@ -134,6 +149,48 @@ var colors = {
|
|
|
134
149
|
"red-600": "#DC2626"
|
|
135
150
|
};
|
|
136
151
|
|
|
152
|
+
// src/components/chat/scrollable-table/scrollable-table-styles.ts
|
|
153
|
+
var TableContainer = import_styled_components.default.div`
|
|
154
|
+
position: relative;
|
|
155
|
+
margin-block: 8px 16px;
|
|
156
|
+
`;
|
|
157
|
+
var TableScroll = import_styled_components.default.div`
|
|
158
|
+
width: 100%;
|
|
159
|
+
overflow-x: auto;
|
|
160
|
+
overflow-y: hidden;
|
|
161
|
+
`;
|
|
162
|
+
var TableActionsWrapper = import_styled_components.default.div`
|
|
163
|
+
display: flex;
|
|
164
|
+
justify-content: flex-start;
|
|
165
|
+
margin-block: 8px 0;
|
|
166
|
+
`;
|
|
167
|
+
var TableActionsDivider = import_styled_components.default.div`
|
|
168
|
+
height: 1px;
|
|
169
|
+
background: ${colors["brown-40"]};
|
|
170
|
+
margin-block: 8px 0;
|
|
171
|
+
`;
|
|
172
|
+
|
|
173
|
+
// src/components/chat/scrollable-table/scrollable-table.tsx
|
|
174
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
175
|
+
function ScrollableTable({ node: _node, messageId, counter, ...props }) {
|
|
176
|
+
const currentIndex = counter ? counter.value : 0;
|
|
177
|
+
if (counter) {
|
|
178
|
+
counter.value += 1;
|
|
179
|
+
}
|
|
180
|
+
const context = (0, import_react2.useContext)(ChatContext);
|
|
181
|
+
const TableActions = context?.TableActions;
|
|
182
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(TableContainer, { children: [
|
|
183
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(TableScroll, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("table", { ...props }) }),
|
|
184
|
+
TableActions && messageId && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
185
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(TableActionsWrapper, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TableActions, { messageId, tableIndex: currentIndex }) }),
|
|
186
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(TableActionsDivider, {})
|
|
187
|
+
] })
|
|
188
|
+
] });
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
// src/components/chat/chat-message-content/chat-message-content-styles.ts
|
|
192
|
+
var import_styled_components2 = __toESM(require("styled-components"), 1);
|
|
193
|
+
|
|
137
194
|
// src/tokens/typography.ts
|
|
138
195
|
var fontFamilies = {
|
|
139
196
|
/** Geist — primary UI font for body text, labels, headings, and display. */
|
|
@@ -430,7 +487,7 @@ function typographyMixin(type) {
|
|
|
430
487
|
}
|
|
431
488
|
|
|
432
489
|
// src/components/chat/chat-message-content/chat-message-content-styles.ts
|
|
433
|
-
var ContentWrapper =
|
|
490
|
+
var ContentWrapper = import_styled_components2.default.div`
|
|
434
491
|
${typographyMixin(typographyTypes.GEIST_BODY_S_REGULAR)};
|
|
435
492
|
color: ${colors["brown-100"]};
|
|
436
493
|
word-break: break-word;
|
|
@@ -546,30 +603,30 @@ var ContentWrapper = import_styled_components.default.div`
|
|
|
546
603
|
color: ${colors["brown-80"]};
|
|
547
604
|
}
|
|
548
605
|
`;
|
|
549
|
-
var TableScroll = import_styled_components.default.div`
|
|
550
|
-
width: 100%;
|
|
551
|
-
overflow-x: auto;
|
|
552
|
-
overflow-y: hidden;
|
|
553
|
-
margin-block: 8px 16px;
|
|
554
|
-
`;
|
|
555
606
|
|
|
556
607
|
// src/components/chat/chat-message-content/chat-message-content.tsx
|
|
557
|
-
var
|
|
558
|
-
function
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
};
|
|
564
|
-
|
|
565
|
-
|
|
608
|
+
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
609
|
+
function ChatMessageContent({ content, messageId }) {
|
|
610
|
+
const counter = { value: 0 };
|
|
611
|
+
const sanitizedContent = content.split("\n").filter((line) => {
|
|
612
|
+
const t = line.trim();
|
|
613
|
+
return !(t.startsWith("<!-- table-title:") && t.endsWith("-->"));
|
|
614
|
+
}).join("\n");
|
|
615
|
+
const markdownComponents = (0, import_react3.useMemo)(
|
|
616
|
+
() => ({
|
|
617
|
+
table: ((tableProps) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(ScrollableTable, { ...tableProps, messageId, counter }))
|
|
618
|
+
}),
|
|
619
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps -- counter is intentionally a fresh object each render for sequential table indexing
|
|
620
|
+
[messageId]
|
|
621
|
+
);
|
|
622
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(ContentWrapper, { children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_react_markdown.default, { remarkPlugins: [import_remark_gfm.default, import_remark_breaks.default], components: markdownComponents, children: sanitizedContent }) });
|
|
566
623
|
}
|
|
567
624
|
|
|
568
625
|
// src/components/chat/chat-message-actions/chat-message-actions.tsx
|
|
569
|
-
var
|
|
626
|
+
var import_react7 = require("react");
|
|
570
627
|
|
|
571
628
|
// node_modules/@tabler/icons-react/dist/esm/createReactComponent.mjs
|
|
572
|
-
var
|
|
629
|
+
var import_react4 = require("react");
|
|
573
630
|
|
|
574
631
|
// node_modules/@tabler/icons-react/dist/esm/defaultAttributes.mjs
|
|
575
632
|
var defaultAttributes = {
|
|
@@ -596,8 +653,8 @@ var defaultAttributes = {
|
|
|
596
653
|
|
|
597
654
|
// node_modules/@tabler/icons-react/dist/esm/createReactComponent.mjs
|
|
598
655
|
var createReactComponent = (type, iconName, iconNamePascal, iconNode) => {
|
|
599
|
-
const Component = (0,
|
|
600
|
-
({ color = "currentColor", size = 24, stroke = 2, title, className, children, ...rest }, ref) => (0,
|
|
656
|
+
const Component = (0, import_react4.forwardRef)(
|
|
657
|
+
({ color = "currentColor", size = 24, stroke = 2, title, className, children, ...rest }, ref) => (0, import_react4.createElement)(
|
|
601
658
|
"svg",
|
|
602
659
|
{
|
|
603
660
|
ref,
|
|
@@ -614,8 +671,8 @@ var createReactComponent = (type, iconName, iconNamePascal, iconNode) => {
|
|
|
614
671
|
...rest
|
|
615
672
|
},
|
|
616
673
|
[
|
|
617
|
-
title && (0,
|
|
618
|
-
...iconNode.map(([tag, attrs]) => (0,
|
|
674
|
+
title && (0, import_react4.createElement)("title", { key: "svg-title" }, title),
|
|
675
|
+
...iconNode.map(([tag, attrs]) => (0, import_react4.createElement)(tag, attrs)),
|
|
619
676
|
...Array.isArray(children) ? children : [children]
|
|
620
677
|
]
|
|
621
678
|
)
|
|
@@ -641,10 +698,10 @@ var __iconNode4 = [["path", { "d": "M7 11v8a1 1 0 0 1 -1 1h-2a1 1 0 0 1 -1 -1v-7
|
|
|
641
698
|
var IconThumbUp = createReactComponent("outline", "thumb-up", "ThumbUp", __iconNode4);
|
|
642
699
|
|
|
643
700
|
// src/components/icon/icon.tsx
|
|
644
|
-
var
|
|
701
|
+
var import_react5 = require("react");
|
|
645
702
|
|
|
646
703
|
// src/components/icon/icon-styles.ts
|
|
647
|
-
var
|
|
704
|
+
var import_styled_components3 = __toESM(require("styled-components"), 1);
|
|
648
705
|
var STROKE_WIDTH_BY_SIZE = {
|
|
649
706
|
12: 1.4,
|
|
650
707
|
14: 1.4,
|
|
@@ -657,7 +714,7 @@ var DEFAULT_STROKE_WIDTH = 1.8;
|
|
|
657
714
|
function getStrokeWidth(size) {
|
|
658
715
|
return STROKE_WIDTH_BY_SIZE[size] ?? DEFAULT_STROKE_WIDTH;
|
|
659
716
|
}
|
|
660
|
-
var IconWrapper =
|
|
717
|
+
var IconWrapper = import_styled_components3.default.span`
|
|
661
718
|
display: inline-flex;
|
|
662
719
|
align-items: center;
|
|
663
720
|
justify-content: center;
|
|
@@ -666,10 +723,10 @@ var IconWrapper = import_styled_components2.default.span`
|
|
|
666
723
|
`;
|
|
667
724
|
|
|
668
725
|
// src/components/icon/icon.tsx
|
|
669
|
-
var
|
|
726
|
+
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
670
727
|
var DEFAULT_SIZE = 16;
|
|
671
|
-
var Icon = (0,
|
|
672
|
-
return /* @__PURE__ */ (0,
|
|
728
|
+
var Icon = (0, import_react5.forwardRef)(function Icon2({ icon: IconComponent, size = DEFAULT_SIZE, color, className, "aria-label": ariaLabel }, ref) {
|
|
729
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
673
730
|
IconWrapper,
|
|
674
731
|
{
|
|
675
732
|
ref,
|
|
@@ -677,13 +734,13 @@ var Icon = (0, import_react2.forwardRef)(function Icon2({ icon: IconComponent, s
|
|
|
677
734
|
$color: color,
|
|
678
735
|
"aria-label": ariaLabel,
|
|
679
736
|
role: ariaLabel ? "img" : void 0,
|
|
680
|
-
children: /* @__PURE__ */ (0,
|
|
737
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(IconComponent, { width: size, height: size, strokeWidth: getStrokeWidth(size) })
|
|
681
738
|
}
|
|
682
739
|
);
|
|
683
740
|
});
|
|
684
741
|
|
|
685
742
|
// src/components/icon-button/icon-button-styles.ts
|
|
686
|
-
var
|
|
743
|
+
var import_styled_components4 = __toESM(require("styled-components"), 1);
|
|
687
744
|
var PADDING = {
|
|
688
745
|
short: {
|
|
689
746
|
small: "4px",
|
|
@@ -698,7 +755,7 @@ var BORDER_RADIUS = {
|
|
|
698
755
|
small: 6,
|
|
699
756
|
medium: 10
|
|
700
757
|
};
|
|
701
|
-
var Button =
|
|
758
|
+
var Button = import_styled_components4.default.button`
|
|
702
759
|
display: inline-flex;
|
|
703
760
|
align-items: center;
|
|
704
761
|
justify-content: center;
|
|
@@ -726,7 +783,7 @@ var Button = import_styled_components3.default.button`
|
|
|
726
783
|
`;
|
|
727
784
|
|
|
728
785
|
// src/components/icon-button/icon-button.tsx
|
|
729
|
-
var
|
|
786
|
+
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
730
787
|
var ICON_SIZE_BY_BUTTON_SIZE = {
|
|
731
788
|
small: 16,
|
|
732
789
|
medium: 20
|
|
@@ -743,7 +800,7 @@ function IconButton({
|
|
|
743
800
|
as,
|
|
744
801
|
"aria-label": ariaLabel
|
|
745
802
|
}) {
|
|
746
|
-
return /* @__PURE__ */ (0,
|
|
803
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
747
804
|
Button,
|
|
748
805
|
{
|
|
749
806
|
className,
|
|
@@ -755,24 +812,13 @@ function IconButton({
|
|
|
755
812
|
disabled,
|
|
756
813
|
onClick: disabled ? void 0 : onClick,
|
|
757
814
|
"aria-label": ariaLabel,
|
|
758
|
-
children: /* @__PURE__ */ (0,
|
|
815
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Icon, { icon, size: ICON_SIZE_BY_BUTTON_SIZE[size] })
|
|
759
816
|
}
|
|
760
817
|
);
|
|
761
818
|
}
|
|
762
819
|
|
|
763
|
-
// src/components/chat/chat-context/chat-context.ts
|
|
764
|
-
var import_react3 = require("react");
|
|
765
|
-
var ChatContext = (0, import_react3.createContext)(null);
|
|
766
|
-
function useChatContext() {
|
|
767
|
-
const context = (0, import_react3.useContext)(ChatContext);
|
|
768
|
-
if (!context) {
|
|
769
|
-
throw new Error("useChatContext must be used within a Chat.Root component");
|
|
770
|
-
}
|
|
771
|
-
return context;
|
|
772
|
-
}
|
|
773
|
-
|
|
774
820
|
// src/components/chat/hooks/use-copy-to-clipboard.ts
|
|
775
|
-
var
|
|
821
|
+
var import_react6 = require("react");
|
|
776
822
|
|
|
777
823
|
// src/utils/clipboard.ts
|
|
778
824
|
function copyToClipboard(text, options) {
|
|
@@ -789,7 +835,7 @@ var PLACEHOLDER_REGEX = new RegExp(`${PLACEHOLDER_PREFIX}(\\d+)${PLACEHOLDER_SUF
|
|
|
789
835
|
function markdownToPlainText(markdown) {
|
|
790
836
|
if (!markdown) return "";
|
|
791
837
|
const inlineCodeSnippets = [];
|
|
792
|
-
let result = markdown.replace(/```[\s\S]*?```/g, "").replace(/`([^`]+)`/g, (_match, code) => {
|
|
838
|
+
let result = markdown.replace(/^<!--[\s\S]*?--!?>\n?/gm, "").replace(/```[\s\S]*?```/g, "").replace(/`([^`]+)`/g, (_match, code) => {
|
|
793
839
|
inlineCodeSnippets.push(code);
|
|
794
840
|
return `${PLACEHOLDER_PREFIX}${inlineCodeSnippets.length - 1}${PLACEHOLDER_SUFFIX}`;
|
|
795
841
|
}).replace(/^#{1,6}\s+/gm, "").replace(/^(?:---|\*\*\*|___)\s*$/gm, "").replace(/\*{3}(.+?)\*{3}/g, "$1").replace(/\*{2}(.+?)\*{2}/g, "$1").replace(/_{2}(.+?)_{2}/g, "$1").replace(/\*(.+?)\*/g, "$1").replace(/_(.+?)_/g, "$1").replace(/~~(.+?)~~/g, "$1").replace(/!\[([^\]]*)\]\([^)]+\)/g, "$1").replace(/\[([^\]]+)\]\([^)]+\)/g, "$1").replace(/^>\s?/gm, "").replace(/^\|[-:\s|]+\|\s*$/gm, "").replace(/^\|\s?/gm, "").replace(/\s?\|$/gm, "").replace(/\n{3,}/g, "\n\n").trim();
|
|
@@ -800,14 +846,14 @@ function markdownToPlainText(markdown) {
|
|
|
800
846
|
// src/components/chat/hooks/use-copy-to-clipboard.ts
|
|
801
847
|
var RESET_DELAY_MS = 2e3;
|
|
802
848
|
function useCopyToClipboard() {
|
|
803
|
-
const [isCopied, setIsCopied] = (0,
|
|
804
|
-
const timeoutRef = (0,
|
|
805
|
-
(0,
|
|
849
|
+
const [isCopied, setIsCopied] = (0, import_react6.useState)(false);
|
|
850
|
+
const timeoutRef = (0, import_react6.useRef)(null);
|
|
851
|
+
(0, import_react6.useEffect)(() => {
|
|
806
852
|
return () => {
|
|
807
853
|
if (timeoutRef.current) clearTimeout(timeoutRef.current);
|
|
808
854
|
};
|
|
809
855
|
}, []);
|
|
810
|
-
const copy = (0,
|
|
856
|
+
const copy = (0, import_react6.useCallback)((text) => {
|
|
811
857
|
copyToClipboard(markdownToPlainText(text), {
|
|
812
858
|
onSuccess: () => {
|
|
813
859
|
setIsCopied(true);
|
|
@@ -829,16 +875,16 @@ var MESSAGE_ROLE = {
|
|
|
829
875
|
};
|
|
830
876
|
|
|
831
877
|
// src/components/chat/chat-message-actions/chat-message-actions-styles.ts
|
|
832
|
-
var
|
|
878
|
+
var import_styled_components5 = __toESM(require("styled-components"), 1);
|
|
833
879
|
var FADE_DURATION_MS = 150;
|
|
834
880
|
var ANIMATE_DURATION_MS = 200;
|
|
835
|
-
var ActionsContainer =
|
|
881
|
+
var ActionsContainer = import_styled_components5.default.div`
|
|
836
882
|
display: flex;
|
|
837
883
|
opacity: ${({ $role }) => $role === MESSAGE_ROLE.ASSISTANT ? 1 : 0};
|
|
838
884
|
pointer-events: ${({ $role }) => $role === MESSAGE_ROLE.ASSISTANT ? "auto" : "none"};
|
|
839
885
|
transition: opacity ${FADE_DURATION_MS}ms ease;
|
|
840
886
|
`;
|
|
841
|
-
var AnimatedAction =
|
|
887
|
+
var AnimatedAction = import_styled_components5.default.div`
|
|
842
888
|
display: flex;
|
|
843
889
|
overflow: hidden;
|
|
844
890
|
max-width: ${({ $visible }) => $visible ? "40px" : "0"};
|
|
@@ -847,24 +893,24 @@ var AnimatedAction = import_styled_components4.default.div`
|
|
|
847
893
|
`;
|
|
848
894
|
|
|
849
895
|
// src/components/chat/chat-message-actions/chat-message-actions.tsx
|
|
850
|
-
var
|
|
896
|
+
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
851
897
|
function ChatMessageActions({ className, messageId, content, role, isHelpful }) {
|
|
852
898
|
const { onCopyMessage, onThumbUpClick, onThumbDownClick } = useChatContext();
|
|
853
899
|
const { isCopied, copy } = useCopyToClipboard();
|
|
854
|
-
const handleCopy = (0,
|
|
900
|
+
const handleCopy = (0, import_react7.useCallback)(() => {
|
|
855
901
|
copy(content);
|
|
856
902
|
onCopyMessage?.(messageId);
|
|
857
903
|
}, [content, messageId, copy, onCopyMessage]);
|
|
858
|
-
const handleThumbUp = (0,
|
|
904
|
+
const handleThumbUp = (0, import_react7.useCallback)(() => {
|
|
859
905
|
onThumbUpClick?.(messageId, isHelpful === true ? null : true);
|
|
860
906
|
}, [messageId, isHelpful, onThumbUpClick]);
|
|
861
|
-
const handleThumbDown = (0,
|
|
907
|
+
const handleThumbDown = (0, import_react7.useCallback)(() => {
|
|
862
908
|
onThumbDownClick?.(messageId, isHelpful === false ? null : false);
|
|
863
909
|
}, [messageId, isHelpful, onThumbDownClick]);
|
|
864
910
|
const isAssistant = role === MESSAGE_ROLE.ASSISTANT;
|
|
865
911
|
const hasFeedback = isAssistant && (onThumbUpClick || onThumbDownClick);
|
|
866
|
-
return /* @__PURE__ */ (0,
|
|
867
|
-
/* @__PURE__ */ (0,
|
|
912
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(ActionsContainer, { $role: role, className, children: [
|
|
913
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
868
914
|
IconButton,
|
|
869
915
|
{
|
|
870
916
|
icon: isCopied ? IconCheck : IconCopy,
|
|
@@ -872,7 +918,7 @@ function ChatMessageActions({ className, messageId, content, role, isHelpful })
|
|
|
872
918
|
"aria-label": isCopied ? "Copied" : "Copy message"
|
|
873
919
|
}
|
|
874
920
|
),
|
|
875
|
-
hasFeedback && /* @__PURE__ */ (0,
|
|
921
|
+
hasFeedback && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(AnimatedAction, { $visible: isHelpful !== false, children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
876
922
|
IconButton,
|
|
877
923
|
{
|
|
878
924
|
icon: IconThumbUp,
|
|
@@ -881,7 +927,7 @@ function ChatMessageActions({ className, messageId, content, role, isHelpful })
|
|
|
881
927
|
"aria-label": "Good response"
|
|
882
928
|
}
|
|
883
929
|
) }),
|
|
884
|
-
hasFeedback && /* @__PURE__ */ (0,
|
|
930
|
+
hasFeedback && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(AnimatedAction, { $visible: isHelpful !== true, children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
885
931
|
IconButton,
|
|
886
932
|
{
|
|
887
933
|
icon: IconThumbDown,
|
|
@@ -894,8 +940,8 @@ function ChatMessageActions({ className, messageId, content, role, isHelpful })
|
|
|
894
940
|
}
|
|
895
941
|
|
|
896
942
|
// src/components/chat/chat-message/chat-message-styles.ts
|
|
897
|
-
var
|
|
898
|
-
var MessageRow =
|
|
943
|
+
var import_styled_components6 = __toESM(require("styled-components"), 1);
|
|
944
|
+
var MessageRow = import_styled_components6.default.div`
|
|
899
945
|
display: flex;
|
|
900
946
|
justify-content: ${({ $role }) => $role === MESSAGE_ROLE.USER ? "flex-end" : "flex-start"};
|
|
901
947
|
|
|
@@ -904,7 +950,7 @@ var MessageRow = import_styled_components5.default.div`
|
|
|
904
950
|
pointer-events: auto;
|
|
905
951
|
}
|
|
906
952
|
`;
|
|
907
|
-
var MessageContainer =
|
|
953
|
+
var MessageContainer = import_styled_components6.default.div`
|
|
908
954
|
display: flex;
|
|
909
955
|
flex-direction: column;
|
|
910
956
|
align-items: ${({ $role }) => $role === MESSAGE_ROLE.USER ? "flex-end" : "flex-start"};
|
|
@@ -912,7 +958,7 @@ var MessageContainer = import_styled_components5.default.div`
|
|
|
912
958
|
width: ${({ $role }) => $role === MESSAGE_ROLE.USER ? "auto" : "100%"};
|
|
913
959
|
gap: 12px;
|
|
914
960
|
`;
|
|
915
|
-
var MessageBubble =
|
|
961
|
+
var MessageBubble = import_styled_components6.default.div`
|
|
916
962
|
${typographyMixin(typographyTypes.GEIST_BODY_S_REGULAR)};
|
|
917
963
|
color: ${colors["brown-100"]};
|
|
918
964
|
background: ${({ $role }) => $role === MESSAGE_ROLE.USER ? colors.white : "transparent"};
|
|
@@ -923,11 +969,11 @@ var MessageBubble = import_styled_components5.default.div`
|
|
|
923
969
|
`;
|
|
924
970
|
|
|
925
971
|
// src/components/chat/chat-message/chat-message.tsx
|
|
926
|
-
var
|
|
972
|
+
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
927
973
|
function ChatMessage({ message }) {
|
|
928
|
-
return /* @__PURE__ */ (0,
|
|
929
|
-
/* @__PURE__ */ (0,
|
|
930
|
-
/* @__PURE__ */ (0,
|
|
974
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(MessageRow, { $role: message.role, role: "article", "aria-label": `${message.role} message`, children: /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(MessageContainer, { $role: message.role, children: [
|
|
975
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(MessageBubble, { $role: message.role, children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(ChatMessageContent, { content: message.content, messageId: message.id }) }),
|
|
976
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
931
977
|
ChatMessageActions,
|
|
932
978
|
{
|
|
933
979
|
messageId: message.id,
|