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