@shapesos/clay 0.13.1 → 0.14.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/ai-elements.cjs +877 -0
- package/dist/ai-elements.cjs.map +1 -0
- package/dist/ai-elements.d.cts +136 -0
- package/dist/ai-elements.d.ts +136 -0
- package/dist/ai-elements.js +31 -0
- package/dist/ai-elements.js.map +1 -0
- package/dist/artifacts.cjs +56 -11
- package/dist/artifacts.cjs.map +1 -1
- package/dist/artifacts.js +6 -6
- package/dist/blocks.cjs +83 -28
- package/dist/blocks.cjs.map +1 -1
- package/dist/blocks.css +1 -1
- package/dist/blocks.js +7 -7
- package/dist/button.cjs +27 -17
- package/dist/button.cjs.map +1 -1
- package/dist/button.js +3 -2
- package/dist/chart.js +3 -3
- package/dist/chat.cjs +83 -28
- package/dist/chat.cjs.map +1 -1
- package/dist/chat.js +8 -8
- package/dist/{chunk-YSSLTXZG.js → chunk-3THOTQO3.js} +7 -7
- package/dist/{chunk-WPQQVKWY.js → chunk-7OYIDM42.js} +2 -2
- package/dist/{chunk-EDICS62G.js → chunk-B4U37WIH.js} +9 -11
- package/dist/chunk-B4U37WIH.js.map +1 -0
- package/dist/chunk-BR5S37SC.js +171 -0
- package/dist/chunk-BR5S37SC.js.map +1 -0
- package/dist/chunk-CYC2YUKU.js +1 -0
- package/dist/chunk-CYC2YUKU.js.map +1 -0
- package/dist/chunk-L75JPWGS.js +1 -0
- package/dist/chunk-L75JPWGS.js.map +1 -0
- package/dist/{chunk-QAK7NM5F.js → chunk-MDAWYZBI.js} +3 -3
- package/dist/{chunk-L6DUGB2E.js → chunk-PGR2MDDU.js} +16 -5
- package/dist/chunk-PGR2MDDU.js.map +1 -0
- package/dist/{chunk-OBOXCBDL.js → chunk-PYDVANWI.js} +58 -13
- package/dist/chunk-PYDVANWI.js.map +1 -0
- package/dist/{chunk-SV24ONND.js → chunk-UXT2H3FM.js} +28 -18
- package/dist/chunk-UXT2H3FM.js.map +1 -0
- package/dist/{chunk-DT44KNCV.js → chunk-XFJ6XMJZ.js} +5 -5
- package/dist/{chunk-QXGYMDIA.js → chunk-YZB6YXKK.js} +4 -4
- package/dist/icon.cjs +56 -11
- package/dist/icon.cjs.map +1 -1
- package/dist/icon.d.cts +11 -2
- package/dist/icon.d.ts +11 -2
- package/dist/icon.js +1 -1
- package/dist/index.cjs +652 -421
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +4 -2
- package/dist/index.d.ts +4 -2
- package/dist/index.js +50 -28
- package/dist/keyboard-shortcut.cjs +15 -4
- package/dist/keyboard-shortcut.cjs.map +1 -1
- package/dist/keyboard-shortcut.d.cts +10 -3
- package/dist/keyboard-shortcut.d.ts +10 -3
- package/dist/keyboard-shortcut.js +1 -1
- package/dist/text-area.cjs +27 -17
- package/dist/text-area.cjs.map +1 -1
- package/dist/text-area.d.cts +2 -24
- package/dist/text-area.d.ts +2 -24
- package/dist/text-area.js +3 -2
- package/dist/tokens.cjs +27 -17
- package/dist/tokens.cjs.map +1 -1
- package/dist/tokens.d.cts +6 -5
- package/dist/tokens.d.ts +6 -5
- package/dist/tokens.js +1 -1
- package/dist/types-CMzZsL_J.d.cts +25 -0
- package/dist/types-CMzZsL_J.d.ts +25 -0
- package/dist/utils.js +3 -3
- package/package.json +6 -1
- package/dist/chunk-EDICS62G.js.map +0 -1
- package/dist/chunk-L6DUGB2E.js.map +0 -1
- package/dist/chunk-OBOXCBDL.js.map +0 -1
- package/dist/chunk-SV24ONND.js.map +0 -1
- /package/dist/{chunk-YSSLTXZG.js.map → chunk-3THOTQO3.js.map} +0 -0
- /package/dist/{chunk-WPQQVKWY.js.map → chunk-7OYIDM42.js.map} +0 -0
- /package/dist/{chunk-QAK7NM5F.js.map → chunk-MDAWYZBI.js.map} +0 -0
- /package/dist/{chunk-DT44KNCV.js.map → chunk-XFJ6XMJZ.js.map} +0 -0
- /package/dist/{chunk-QXGYMDIA.js.map → chunk-YZB6YXKK.js.map} +0 -0
package/dist/index.cjs
CHANGED
|
@@ -16591,6 +16591,7 @@ __export(src_exports, {
|
|
|
16591
16591
|
BlockContext: () => BlockContext,
|
|
16592
16592
|
BlockServices: () => BlockServices,
|
|
16593
16593
|
Button: () => Button2,
|
|
16594
|
+
CHAT_STATUS: () => CHAT_STATUS,
|
|
16594
16595
|
ChartArtifact: () => ChartArtifact,
|
|
16595
16596
|
ChatContext: () => ChatContext,
|
|
16596
16597
|
ChatMessage: () => ChatMessage,
|
|
@@ -16604,6 +16605,14 @@ __export(src_exports, {
|
|
|
16604
16605
|
KeyboardShortcut: () => KeyboardShortcut,
|
|
16605
16606
|
Lottie: () => Lottie,
|
|
16606
16607
|
MESSAGE_ROLE: () => MESSAGE_ROLE,
|
|
16608
|
+
MouseGrid: () => MouseGrid,
|
|
16609
|
+
PromptInput: () => PromptInput,
|
|
16610
|
+
PromptInputFooter: () => PromptInputFooter,
|
|
16611
|
+
PromptInputSubmit: () => PromptInputSubmit,
|
|
16612
|
+
PromptInputTextarea: () => PromptInputTextarea,
|
|
16613
|
+
PromptInputTools: () => PromptInputTools,
|
|
16614
|
+
Suggestion: () => Suggestion,
|
|
16615
|
+
Suggestions: () => Suggestions,
|
|
16607
16616
|
TableArtifact: () => TableArtifact,
|
|
16608
16617
|
TextArea: () => TextArea,
|
|
16609
16618
|
TextBlockService: () => TextBlockService,
|
|
@@ -16635,7 +16644,7 @@ init_colors();
|
|
|
16635
16644
|
var fontFamilies = {
|
|
16636
16645
|
/** Geist — primary UI font for body text, labels, headings, and display. */
|
|
16637
16646
|
GEIST: "Geist",
|
|
16638
|
-
/** Crimson Pro — editorial/serif font,
|
|
16647
|
+
/** Crimson Pro — editorial/serif font, mostly italic. Used for decorative headings and pull quotes. */
|
|
16639
16648
|
CRIMSON_PRO: "Crimson Pro"
|
|
16640
16649
|
};
|
|
16641
16650
|
var typographyTypes = {
|
|
@@ -16675,14 +16684,16 @@ var typographyTypes = {
|
|
|
16675
16684
|
GEIST_HEADING_L_BOLD: "GEIST_HEADING_L_BOLD",
|
|
16676
16685
|
// Geist Display Large (36px)
|
|
16677
16686
|
GEIST_DISPLAY_L_MEDIUM: "GEIST_DISPLAY_L_MEDIUM",
|
|
16678
|
-
// Crimson Pro Body Small (16px)
|
|
16679
|
-
|
|
16680
|
-
// Crimson Pro Body Medium (18px)
|
|
16681
|
-
|
|
16682
|
-
// Crimson Pro Heading Medium (24px)
|
|
16683
|
-
|
|
16684
|
-
// Crimson Pro Display
|
|
16685
|
-
|
|
16687
|
+
// Crimson Pro Body Small (16px, italic)
|
|
16688
|
+
CRIMSON_PRO_BODY_S_LIGHT_ITALIC: "CRIMSON_PRO_BODY_S_LIGHT_ITALIC",
|
|
16689
|
+
// Crimson Pro Body Medium (18px, italic)
|
|
16690
|
+
CRIMSON_PRO_BODY_M_LIGHT_ITALIC: "CRIMSON_PRO_BODY_M_LIGHT_ITALIC",
|
|
16691
|
+
// Crimson Pro Heading Medium (24px, italic)
|
|
16692
|
+
CRIMSON_PRO_HEADING_M_MEDIUM_ITALIC: "CRIMSON_PRO_HEADING_M_MEDIUM_ITALIC",
|
|
16693
|
+
// Crimson Pro Display Large (40px, upright)
|
|
16694
|
+
CRIMSON_PRO_DISPLAY_L_REGULAR: "CRIMSON_PRO_DISPLAY_L_REGULAR",
|
|
16695
|
+
// Crimson Pro Display Extra Large (46px, italic)
|
|
16696
|
+
CRIMSON_PRO_DISPLAY_XL_REGULAR_ITALIC: "CRIMSON_PRO_DISPLAY_XL_REGULAR_ITALIC"
|
|
16686
16697
|
};
|
|
16687
16698
|
var typographyStyles = {
|
|
16688
16699
|
// Geist Label Caption (12px)
|
|
@@ -16877,8 +16888,8 @@ var typographyStyles = {
|
|
|
16877
16888
|
lineHeight: 44,
|
|
16878
16889
|
letterSpacing: -0.72
|
|
16879
16890
|
},
|
|
16880
|
-
// Crimson Pro Body Small (16px)
|
|
16881
|
-
[typographyTypes.
|
|
16891
|
+
// Crimson Pro Body Small (16px, italic)
|
|
16892
|
+
[typographyTypes.CRIMSON_PRO_BODY_S_LIGHT_ITALIC]: {
|
|
16882
16893
|
fontFamily: fontFamilies.CRIMSON_PRO,
|
|
16883
16894
|
fontSize: 16,
|
|
16884
16895
|
fontWeight: 300,
|
|
@@ -16886,8 +16897,8 @@ var typographyStyles = {
|
|
|
16886
16897
|
letterSpacing: -0.32,
|
|
16887
16898
|
fontStyle: "italic"
|
|
16888
16899
|
},
|
|
16889
|
-
// Crimson Pro Body Medium (18px)
|
|
16890
|
-
[typographyTypes.
|
|
16900
|
+
// Crimson Pro Body Medium (18px, italic)
|
|
16901
|
+
[typographyTypes.CRIMSON_PRO_BODY_M_LIGHT_ITALIC]: {
|
|
16891
16902
|
fontFamily: fontFamilies.CRIMSON_PRO,
|
|
16892
16903
|
fontSize: 18,
|
|
16893
16904
|
fontWeight: 300,
|
|
@@ -16895,8 +16906,8 @@ var typographyStyles = {
|
|
|
16895
16906
|
letterSpacing: 0,
|
|
16896
16907
|
fontStyle: "italic"
|
|
16897
16908
|
},
|
|
16898
|
-
// Crimson Pro Heading Medium (24px)
|
|
16899
|
-
[typographyTypes.
|
|
16909
|
+
// Crimson Pro Heading Medium (24px, italic)
|
|
16910
|
+
[typographyTypes.CRIMSON_PRO_HEADING_M_MEDIUM_ITALIC]: {
|
|
16900
16911
|
fontFamily: fontFamilies.CRIMSON_PRO,
|
|
16901
16912
|
fontSize: 24,
|
|
16902
16913
|
fontWeight: 400,
|
|
@@ -16904,8 +16915,16 @@ var typographyStyles = {
|
|
|
16904
16915
|
letterSpacing: -0.48,
|
|
16905
16916
|
fontStyle: "italic"
|
|
16906
16917
|
},
|
|
16907
|
-
// Crimson Pro Display
|
|
16908
|
-
[typographyTypes.
|
|
16918
|
+
// Crimson Pro Display Large (40px, upright)
|
|
16919
|
+
[typographyTypes.CRIMSON_PRO_DISPLAY_L_REGULAR]: {
|
|
16920
|
+
fontFamily: fontFamilies.CRIMSON_PRO,
|
|
16921
|
+
fontSize: 40,
|
|
16922
|
+
fontWeight: 300,
|
|
16923
|
+
lineHeight: 48,
|
|
16924
|
+
letterSpacing: -1.6
|
|
16925
|
+
},
|
|
16926
|
+
// Crimson Pro Display Extra Large (46px, italic)
|
|
16927
|
+
[typographyTypes.CRIMSON_PRO_DISPLAY_XL_REGULAR_ITALIC]: {
|
|
16909
16928
|
fontFamily: fontFamilies.CRIMSON_PRO,
|
|
16910
16929
|
fontSize: 46,
|
|
16911
16930
|
fontWeight: 400,
|
|
@@ -17149,6 +17168,59 @@ var BORDER_RADIUS = {
|
|
|
17149
17168
|
small: 6,
|
|
17150
17169
|
medium: 10
|
|
17151
17170
|
};
|
|
17171
|
+
var intentStyles = {
|
|
17172
|
+
secondary: ({ $isSelected }) => import_styled_components2.css`
|
|
17173
|
+
background: ${$isSelected ? colors["brown-40"] : "transparent"};
|
|
17174
|
+
color: ${colors["brown-100"]};
|
|
17175
|
+
|
|
17176
|
+
&:hover:not(:disabled) {
|
|
17177
|
+
background: ${$isSelected ? colors["brown-40"] : colors["brown-20"]};
|
|
17178
|
+
}
|
|
17179
|
+
|
|
17180
|
+
&:active:not(:disabled) {
|
|
17181
|
+
background: ${colors["brown-40"]};
|
|
17182
|
+
}
|
|
17183
|
+
|
|
17184
|
+
&:disabled {
|
|
17185
|
+
color: ${colors["brown-50"]};
|
|
17186
|
+
background: transparent;
|
|
17187
|
+
}
|
|
17188
|
+
`,
|
|
17189
|
+
primary: () => import_styled_components2.css`
|
|
17190
|
+
background: ${colors["brown-100"]};
|
|
17191
|
+
color: ${colors.white};
|
|
17192
|
+
|
|
17193
|
+
&:hover:not(:disabled) {
|
|
17194
|
+
background: ${colors["brown-90"]};
|
|
17195
|
+
}
|
|
17196
|
+
|
|
17197
|
+
&:active:not(:disabled) {
|
|
17198
|
+
background: ${colors["brown-90"]};
|
|
17199
|
+
}
|
|
17200
|
+
|
|
17201
|
+
&:disabled {
|
|
17202
|
+
color: ${colors["brown-50"]};
|
|
17203
|
+
background: ${colors["brown-20"]};
|
|
17204
|
+
}
|
|
17205
|
+
`,
|
|
17206
|
+
error: () => import_styled_components2.css`
|
|
17207
|
+
background: ${colors["red-500"]};
|
|
17208
|
+
color: ${colors.white};
|
|
17209
|
+
|
|
17210
|
+
&:hover:not(:disabled) {
|
|
17211
|
+
background: ${colors["red-600"]};
|
|
17212
|
+
}
|
|
17213
|
+
|
|
17214
|
+
&:active:not(:disabled) {
|
|
17215
|
+
background: ${colors["red-600"]};
|
|
17216
|
+
}
|
|
17217
|
+
|
|
17218
|
+
&:disabled {
|
|
17219
|
+
color: ${colors["red-200"]};
|
|
17220
|
+
background: ${colors["red-100"]};
|
|
17221
|
+
}
|
|
17222
|
+
`
|
|
17223
|
+
};
|
|
17152
17224
|
var Button = import_styled_components2.default.button`
|
|
17153
17225
|
display: inline-flex;
|
|
17154
17226
|
align-items: center;
|
|
@@ -17156,22 +17228,12 @@ var Button = import_styled_components2.default.button`
|
|
|
17156
17228
|
padding: ${({ $size, $variant }) => PADDING[$variant][$size]};
|
|
17157
17229
|
border: none;
|
|
17158
17230
|
border-radius: ${({ $size }) => BORDER_RADIUS[$size]}px;
|
|
17159
|
-
background: ${({ $isSelected }) => $isSelected ? colors["brown-40"] : "transparent"};
|
|
17160
|
-
color: ${colors["brown-100"]};
|
|
17161
17231
|
cursor: pointer;
|
|
17162
17232
|
transition: background-color 100ms ease;
|
|
17163
17233
|
|
|
17164
|
-
|
|
17165
|
-
background: ${({ $isSelected }) => $isSelected ? colors["brown-40"] : colors["brown-20"]};
|
|
17166
|
-
}
|
|
17167
|
-
|
|
17168
|
-
&:active {
|
|
17169
|
-
background: ${colors["brown-40"]};
|
|
17170
|
-
}
|
|
17234
|
+
${({ $intent, $isSelected }) => intentStyles[$intent]({ $isSelected })}
|
|
17171
17235
|
|
|
17172
17236
|
&:disabled {
|
|
17173
|
-
color: ${colors["brown-50"]};
|
|
17174
|
-
background: transparent;
|
|
17175
17237
|
cursor: not-allowed;
|
|
17176
17238
|
}
|
|
17177
17239
|
`;
|
|
@@ -17186,6 +17248,7 @@ var IconButton = (0, import_react4.forwardRef)(function IconButton2({
|
|
|
17186
17248
|
icon,
|
|
17187
17249
|
size = "small",
|
|
17188
17250
|
variant = "short",
|
|
17251
|
+
intent = "secondary",
|
|
17189
17252
|
isSelected = false,
|
|
17190
17253
|
disabled = false,
|
|
17191
17254
|
onClick,
|
|
@@ -17205,6 +17268,7 @@ var IconButton = (0, import_react4.forwardRef)(function IconButton2({
|
|
|
17205
17268
|
as,
|
|
17206
17269
|
$size: size,
|
|
17207
17270
|
$variant: variant,
|
|
17271
|
+
$intent: intent,
|
|
17208
17272
|
$isSelected: isSelected,
|
|
17209
17273
|
disabled,
|
|
17210
17274
|
onClick: disabled ? void 0 : onClick,
|
|
@@ -18785,148 +18849,529 @@ function useBlockContext() {
|
|
|
18785
18849
|
return (0, import_react16.useContext)(BlockContext) ?? {};
|
|
18786
18850
|
}
|
|
18787
18851
|
|
|
18788
|
-
// src/components/
|
|
18789
|
-
var import_react20 = require("react");
|
|
18790
|
-
|
|
18791
|
-
// src/components/chat/hooks/copy-message-text.ts
|
|
18792
|
-
function copyMessageText(message) {
|
|
18793
|
-
const parts = [];
|
|
18794
|
-
for (const block of message.blocks) {
|
|
18795
|
-
const service = BlockServices[block.type];
|
|
18796
|
-
if (!service) continue;
|
|
18797
|
-
if (!service.toClipboardText) continue;
|
|
18798
|
-
const text2 = service.toClipboardText(block);
|
|
18799
|
-
if (text2) parts.push(text2);
|
|
18800
|
-
}
|
|
18801
|
-
if (parts.length === 0) return message.fallbackText;
|
|
18802
|
-
return parts.join("\n\n");
|
|
18803
|
-
}
|
|
18804
|
-
|
|
18805
|
-
// src/components/chat/chat-message-actions/chat-message-actions.tsx
|
|
18852
|
+
// src/components/ai-elements/prompt-input/prompt-input.tsx
|
|
18806
18853
|
var import_react19 = require("react");
|
|
18807
18854
|
|
|
18808
|
-
// src/components/
|
|
18855
|
+
// src/components/button/button.tsx
|
|
18809
18856
|
var import_react17 = require("react");
|
|
18810
|
-
var ChatContext = (0, import_react17.createContext)(null);
|
|
18811
|
-
function useChatContext() {
|
|
18812
|
-
const context = (0, import_react17.useContext)(ChatContext);
|
|
18813
|
-
if (!context) {
|
|
18814
|
-
throw new Error("useChatContext must be used within a Chat.Root component");
|
|
18815
|
-
}
|
|
18816
|
-
return context;
|
|
18817
|
-
}
|
|
18818
18857
|
|
|
18819
|
-
// src/components/
|
|
18820
|
-
var
|
|
18858
|
+
// src/components/button/button-styles.ts
|
|
18859
|
+
var import_styled_components5 = __toESM(require("styled-components"), 1);
|
|
18860
|
+
init_colors();
|
|
18821
18861
|
|
|
18822
|
-
// src/
|
|
18823
|
-
|
|
18824
|
-
|
|
18825
|
-
|
|
18826
|
-
|
|
18827
|
-
|
|
18862
|
+
// src/components/button/constants.ts
|
|
18863
|
+
var BUTTON_VARIANT = {
|
|
18864
|
+
SOLID: "solid",
|
|
18865
|
+
OUTLINE: "outline",
|
|
18866
|
+
GHOST: "ghost"
|
|
18867
|
+
};
|
|
18868
|
+
var BUTTON_SIZE = {
|
|
18869
|
+
XS: "xs",
|
|
18870
|
+
S: "s",
|
|
18871
|
+
M: "m"
|
|
18872
|
+
};
|
|
18873
|
+
var BUTTON_INTENT = {
|
|
18874
|
+
PRIMARY: "primary",
|
|
18875
|
+
ERROR: "error"
|
|
18876
|
+
};
|
|
18877
|
+
var ICON_POSITION = {
|
|
18878
|
+
LEADING: "leading",
|
|
18879
|
+
TRAILING: "trailing"
|
|
18880
|
+
};
|
|
18881
|
+
|
|
18882
|
+
// src/components/button/button-styles.ts
|
|
18883
|
+
var intentColors = {
|
|
18884
|
+
[BUTTON_INTENT.PRIMARY]: {
|
|
18885
|
+
base: colors["brown-100"],
|
|
18886
|
+
hover: colors["brown-90"],
|
|
18887
|
+
disabledBg: colors["brown-20"],
|
|
18888
|
+
disabledText: colors["brown-50"],
|
|
18889
|
+
subtleHover: colors["brown-20"],
|
|
18890
|
+
border: colors["brown-40"],
|
|
18891
|
+
disabledBorder: colors["brown-20"]
|
|
18892
|
+
},
|
|
18893
|
+
[BUTTON_INTENT.ERROR]: {
|
|
18894
|
+
base: colors["red-500"],
|
|
18895
|
+
hover: colors["red-600"],
|
|
18896
|
+
disabledBg: colors["red-100"],
|
|
18897
|
+
disabledText: colors["red-200"],
|
|
18898
|
+
subtleHover: colors["red-50"],
|
|
18899
|
+
border: colors["red-200"],
|
|
18900
|
+
disabledBorder: colors["red-100"]
|
|
18901
|
+
}
|
|
18902
|
+
};
|
|
18903
|
+
var sizeValues = {
|
|
18904
|
+
[BUTTON_SIZE.XS]: { padding: "6px 10px", borderRadius: "8px", gap: "4px" },
|
|
18905
|
+
[BUTTON_SIZE.S]: { padding: "8px 12px", borderRadius: "10px", gap: "6px" },
|
|
18906
|
+
[BUTTON_SIZE.M]: { padding: "10px 14px", borderRadius: "10px", gap: "6px" }
|
|
18907
|
+
};
|
|
18908
|
+
function sizeMixin({ $size }) {
|
|
18909
|
+
const s = sizeValues[$size];
|
|
18910
|
+
return import_styled_components5.css`
|
|
18911
|
+
padding: ${s.padding};
|
|
18912
|
+
border-radius: ${s.borderRadius};
|
|
18913
|
+
gap: ${s.gap};
|
|
18914
|
+
`;
|
|
18828
18915
|
}
|
|
18916
|
+
var variantColorMap = {
|
|
18917
|
+
[BUTTON_VARIANT.SOLID]: (c) => ({
|
|
18918
|
+
background: c.base,
|
|
18919
|
+
color: colors.white,
|
|
18920
|
+
border: "none",
|
|
18921
|
+
hoverBg: c.hover,
|
|
18922
|
+
disabledBg: c.disabledBg,
|
|
18923
|
+
disabledColor: c.disabledText
|
|
18924
|
+
}),
|
|
18925
|
+
[BUTTON_VARIANT.OUTLINE]: (c) => ({
|
|
18926
|
+
background: colors.white,
|
|
18927
|
+
color: c.base,
|
|
18928
|
+
border: `1px solid ${c.border}`,
|
|
18929
|
+
hoverBg: c.subtleHover,
|
|
18930
|
+
disabledColor: c.disabledText,
|
|
18931
|
+
disabledBorder: c.disabledBorder
|
|
18932
|
+
}),
|
|
18933
|
+
[BUTTON_VARIANT.GHOST]: (c) => ({
|
|
18934
|
+
background: "transparent",
|
|
18935
|
+
color: c.base,
|
|
18936
|
+
border: "none",
|
|
18937
|
+
hoverBg: c.subtleHover,
|
|
18938
|
+
disabledColor: c.disabledText
|
|
18939
|
+
})
|
|
18940
|
+
};
|
|
18941
|
+
function variantMixin({
|
|
18942
|
+
$variant,
|
|
18943
|
+
$intent
|
|
18944
|
+
}) {
|
|
18945
|
+
const v = variantColorMap[$variant](intentColors[$intent]);
|
|
18946
|
+
return import_styled_components5.css`
|
|
18947
|
+
background: ${v.background};
|
|
18948
|
+
color: ${v.color};
|
|
18949
|
+
border: ${v.border};
|
|
18829
18950
|
|
|
18830
|
-
|
|
18831
|
-
|
|
18832
|
-
|
|
18833
|
-
|
|
18834
|
-
|
|
18835
|
-
|
|
18836
|
-
|
|
18837
|
-
|
|
18838
|
-
}
|
|
18839
|
-
|
|
18840
|
-
const copy = (0, import_react18.useCallback)((text2) => {
|
|
18841
|
-
copyToClipboard(text2, {
|
|
18842
|
-
onSuccess: () => {
|
|
18843
|
-
setIsCopied(true);
|
|
18844
|
-
if (timeoutRef.current) clearTimeout(timeoutRef.current);
|
|
18845
|
-
timeoutRef.current = setTimeout(() => {
|
|
18846
|
-
setIsCopied(false);
|
|
18847
|
-
timeoutRef.current = null;
|
|
18848
|
-
}, RESET_DELAY_MS);
|
|
18849
|
-
}
|
|
18850
|
-
});
|
|
18851
|
-
}, []);
|
|
18852
|
-
return { isCopied, copy };
|
|
18951
|
+
&:hover:not(:disabled) {
|
|
18952
|
+
background: ${v.hoverBg};
|
|
18953
|
+
}
|
|
18954
|
+
|
|
18955
|
+
&:disabled {
|
|
18956
|
+
color: ${v.disabledColor};
|
|
18957
|
+
${v.disabledBg ? `background: ${v.disabledBg};` : ""}
|
|
18958
|
+
${v.disabledBorder ? `border-color: ${v.disabledBorder};` : ""}
|
|
18959
|
+
}
|
|
18960
|
+
`;
|
|
18853
18961
|
}
|
|
18962
|
+
var StyledButton = import_styled_components5.default.button`
|
|
18963
|
+
display: inline-flex;
|
|
18964
|
+
align-items: center;
|
|
18965
|
+
justify-content: center;
|
|
18966
|
+
cursor: pointer;
|
|
18967
|
+
${typographyMixin(typographyTypes.GEIST_BODY_XS_MEDIUM)};
|
|
18968
|
+
transition: background-color 150ms ease, border-color 150ms ease, color 150ms ease;
|
|
18854
18969
|
|
|
18855
|
-
|
|
18856
|
-
|
|
18857
|
-
|
|
18858
|
-
ASSISTANT: "assistant"
|
|
18859
|
-
};
|
|
18970
|
+
&:disabled {
|
|
18971
|
+
cursor: not-allowed;
|
|
18972
|
+
}
|
|
18860
18973
|
|
|
18861
|
-
|
|
18862
|
-
|
|
18863
|
-
var FADE_DURATION_MS = 150;
|
|
18864
|
-
var ANIMATE_DURATION_MS = 200;
|
|
18865
|
-
var ActionsContainer = import_styled_components5.default.div`
|
|
18866
|
-
display: flex;
|
|
18867
|
-
opacity: ${({ $role }) => $role === MESSAGE_ROLE.ASSISTANT ? 1 : 0};
|
|
18868
|
-
pointer-events: ${({ $role }) => $role === MESSAGE_ROLE.ASSISTANT ? "auto" : "none"};
|
|
18869
|
-
transition: opacity ${FADE_DURATION_MS}ms ease;
|
|
18870
|
-
`;
|
|
18871
|
-
var AnimatedAction = import_styled_components5.default.div`
|
|
18872
|
-
display: flex;
|
|
18873
|
-
overflow: hidden;
|
|
18874
|
-
max-width: ${({ $visible }) => $visible ? "40px" : "0"};
|
|
18875
|
-
opacity: ${({ $visible }) => $visible ? 1 : 0};
|
|
18876
|
-
transition: max-width ${ANIMATE_DURATION_MS}ms ease, opacity ${ANIMATE_DURATION_MS}ms ease;
|
|
18974
|
+
${sizeMixin}
|
|
18975
|
+
${variantMixin}
|
|
18877
18976
|
`;
|
|
18878
18977
|
|
|
18879
|
-
// src/components/
|
|
18978
|
+
// src/components/button/button.tsx
|
|
18880
18979
|
var import_jsx_runtime27 = require("react/jsx-runtime");
|
|
18881
|
-
|
|
18882
|
-
|
|
18883
|
-
|
|
18884
|
-
|
|
18885
|
-
|
|
18886
|
-
|
|
18887
|
-
|
|
18888
|
-
|
|
18889
|
-
|
|
18890
|
-
|
|
18891
|
-
|
|
18892
|
-
|
|
18893
|
-
|
|
18894
|
-
|
|
18895
|
-
|
|
18896
|
-
|
|
18897
|
-
|
|
18898
|
-
|
|
18899
|
-
|
|
18900
|
-
|
|
18901
|
-
|
|
18902
|
-
|
|
18903
|
-
|
|
18904
|
-
|
|
18905
|
-
|
|
18906
|
-
|
|
18907
|
-
|
|
18908
|
-
|
|
18909
|
-
|
|
18910
|
-
|
|
18911
|
-
|
|
18912
|
-
|
|
18913
|
-
|
|
18914
|
-
|
|
18915
|
-
|
|
18916
|
-
|
|
18917
|
-
|
|
18918
|
-
|
|
18919
|
-
|
|
18920
|
-
|
|
18921
|
-
|
|
18922
|
-
|
|
18923
|
-
|
|
18980
|
+
var Button2 = (0, import_react17.forwardRef)(function Button3({
|
|
18981
|
+
children,
|
|
18982
|
+
variant = BUTTON_VARIANT.SOLID,
|
|
18983
|
+
intent = BUTTON_INTENT.PRIMARY,
|
|
18984
|
+
size = BUTTON_SIZE.M,
|
|
18985
|
+
icon,
|
|
18986
|
+
iconPosition = ICON_POSITION.LEADING,
|
|
18987
|
+
disabled = false,
|
|
18988
|
+
onClick,
|
|
18989
|
+
className,
|
|
18990
|
+
"aria-label": ariaLabel
|
|
18991
|
+
}, ref) {
|
|
18992
|
+
const iconElement = icon ? /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(Icon, { icon, size: 16 }) : null;
|
|
18993
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(
|
|
18994
|
+
StyledButton,
|
|
18995
|
+
{
|
|
18996
|
+
ref,
|
|
18997
|
+
type: "button",
|
|
18998
|
+
$variant: variant,
|
|
18999
|
+
$intent: intent,
|
|
19000
|
+
$size: size,
|
|
19001
|
+
disabled,
|
|
19002
|
+
onClick: disabled ? void 0 : onClick,
|
|
19003
|
+
className,
|
|
19004
|
+
"aria-label": ariaLabel,
|
|
19005
|
+
children: [
|
|
19006
|
+
iconPosition === ICON_POSITION.LEADING && iconElement,
|
|
19007
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("span", { children }),
|
|
19008
|
+
iconPosition === ICON_POSITION.TRAILING && iconElement
|
|
19009
|
+
]
|
|
19010
|
+
}
|
|
19011
|
+
);
|
|
19012
|
+
});
|
|
19013
|
+
|
|
19014
|
+
// src/components/text-area/text-area.tsx
|
|
19015
|
+
var import_react18 = require("react");
|
|
19016
|
+
|
|
19017
|
+
// src/utils/merge-refs.ts
|
|
19018
|
+
function mergeRefs(...refs) {
|
|
19019
|
+
return (node) => {
|
|
19020
|
+
for (const ref of refs) {
|
|
19021
|
+
if (typeof ref === "function") {
|
|
19022
|
+
ref(node);
|
|
19023
|
+
} else if (ref) {
|
|
19024
|
+
ref.current = node;
|
|
19025
|
+
}
|
|
19026
|
+
}
|
|
19027
|
+
};
|
|
19028
|
+
}
|
|
19029
|
+
|
|
19030
|
+
// src/components/text-area/text-area-styles.ts
|
|
19031
|
+
var import_styled_components6 = __toESM(require("styled-components"), 1);
|
|
19032
|
+
init_colors();
|
|
19033
|
+
var StyledTextArea = import_styled_components6.default.textarea`
|
|
19034
|
+
${typographyMixin(typographyTypes.GEIST_BODY_S_REGULAR)};
|
|
19035
|
+
color: ${colors["brown-100"]};
|
|
19036
|
+
border: none;
|
|
19037
|
+
outline: none;
|
|
19038
|
+
resize: none;
|
|
19039
|
+
width: 100%;
|
|
19040
|
+
background: transparent;
|
|
19041
|
+
vertical-align: bottom;
|
|
19042
|
+
max-height: ${({ $maxHeight }) => $maxHeight ? `${$maxHeight}px` : "none"};
|
|
19043
|
+
overflow-y: ${({ $maxHeight }) => $maxHeight ? "auto" : "hidden"};
|
|
19044
|
+
|
|
19045
|
+
&::placeholder {
|
|
19046
|
+
color: ${colors["brown-50"]};
|
|
19047
|
+
}
|
|
19048
|
+
|
|
19049
|
+
&:disabled {
|
|
19050
|
+
opacity: 0.5;
|
|
19051
|
+
cursor: not-allowed;
|
|
19052
|
+
}
|
|
19053
|
+
`;
|
|
19054
|
+
|
|
19055
|
+
// src/components/text-area/text-area.tsx
|
|
19056
|
+
var import_jsx_runtime28 = require("react/jsx-runtime");
|
|
19057
|
+
var TextArea = (0, import_react18.forwardRef)(function TextArea2({ value: value2, onChange, placeholder, maxHeight, rows = 1, autoFocus, onKeyDown, disabled, className }, externalRef) {
|
|
19058
|
+
const internalRef = (0, import_react18.useRef)(null);
|
|
19059
|
+
(0, import_react18.useLayoutEffect)(() => {
|
|
19060
|
+
const el = internalRef.current;
|
|
19061
|
+
if (el) {
|
|
19062
|
+
el.style.height = "auto";
|
|
19063
|
+
el.style.height = `${el.scrollHeight}px`;
|
|
19064
|
+
}
|
|
19065
|
+
}, [value2]);
|
|
19066
|
+
const handleChange = (0, import_react18.useCallback)(
|
|
19067
|
+
(e) => {
|
|
19068
|
+
onChange(e.target.value);
|
|
19069
|
+
},
|
|
19070
|
+
[onChange]
|
|
19071
|
+
);
|
|
19072
|
+
return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
19073
|
+
StyledTextArea,
|
|
19074
|
+
{
|
|
19075
|
+
ref: mergeRefs(internalRef, externalRef),
|
|
19076
|
+
value: value2,
|
|
19077
|
+
onChange: handleChange,
|
|
19078
|
+
placeholder,
|
|
19079
|
+
$maxHeight: maxHeight,
|
|
19080
|
+
rows,
|
|
19081
|
+
autoFocus,
|
|
19082
|
+
onKeyDown,
|
|
19083
|
+
disabled,
|
|
19084
|
+
className
|
|
19085
|
+
}
|
|
19086
|
+
);
|
|
19087
|
+
});
|
|
19088
|
+
|
|
19089
|
+
// src/components/ai-elements/prompt-input/types.ts
|
|
19090
|
+
var CHAT_STATUS = {
|
|
19091
|
+
/** Idle / ready to submit. */
|
|
19092
|
+
READY: "ready",
|
|
19093
|
+
/** The last submission errored — the button shows a retry affordance. */
|
|
19094
|
+
ERROR: "error"
|
|
19095
|
+
};
|
|
19096
|
+
|
|
19097
|
+
// src/components/ai-elements/prompt-input/prompt-input.tsx
|
|
19098
|
+
var import_jsx_runtime29 = require("react/jsx-runtime");
|
|
19099
|
+
var PromptInput = ({ className, onSubmit, disabled, children, ...props }) => {
|
|
19100
|
+
const handleSubmit = (0, import_react19.useCallback)(
|
|
19101
|
+
(event) => {
|
|
19102
|
+
event.preventDefault();
|
|
19103
|
+
if (disabled) {
|
|
19104
|
+
return;
|
|
19105
|
+
}
|
|
19106
|
+
const textarea = event.currentTarget.querySelector("textarea");
|
|
19107
|
+
const text2 = textarea?.value ?? "";
|
|
19108
|
+
if (!text2.trim()) {
|
|
19109
|
+
return;
|
|
19110
|
+
}
|
|
19111
|
+
onSubmit({ text: text2 }, event);
|
|
19112
|
+
},
|
|
19113
|
+
[disabled, onSubmit]
|
|
19114
|
+
);
|
|
19115
|
+
return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
19116
|
+
"form",
|
|
19117
|
+
{
|
|
19118
|
+
className: cn(
|
|
19119
|
+
"flex w-full flex-col overflow-hidden rounded-xl border bg-background shadow-lg shadow-foreground/5",
|
|
19120
|
+
className
|
|
19121
|
+
),
|
|
19122
|
+
onSubmit: handleSubmit,
|
|
19123
|
+
...props,
|
|
19124
|
+
children
|
|
19125
|
+
}
|
|
19126
|
+
);
|
|
19127
|
+
};
|
|
19128
|
+
var PromptInputTextarea = (0, import_react19.forwardRef)(
|
|
19129
|
+
function PromptInputTextarea2({ className, onKeyDown, placeholder = "What would you like to know?", ...props }, ref) {
|
|
19130
|
+
const handleKeyDown = (0, import_react19.useCallback)(
|
|
19131
|
+
(event) => {
|
|
19132
|
+
onKeyDown?.(event);
|
|
19133
|
+
if (event.defaultPrevented) {
|
|
19134
|
+
return;
|
|
19135
|
+
}
|
|
19136
|
+
if (event.key === "Enter" && !event.shiftKey && !event.nativeEvent.isComposing) {
|
|
19137
|
+
event.preventDefault();
|
|
19138
|
+
event.currentTarget.form?.requestSubmit();
|
|
19139
|
+
}
|
|
19140
|
+
},
|
|
19141
|
+
[onKeyDown]
|
|
19142
|
+
);
|
|
19143
|
+
return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { className: cn("py-3", className), children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(TextArea, { ref, className: "px-4", onKeyDown: handleKeyDown, placeholder, ...props }) });
|
|
19144
|
+
}
|
|
19145
|
+
);
|
|
19146
|
+
var PromptInputFooter = ({ className, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { className: cn("flex items-center justify-between gap-1 px-4 pb-3", className), ...props });
|
|
19147
|
+
var PromptInputTools = ({ className, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { className: cn("flex min-w-0 items-center gap-1", className), ...props });
|
|
19148
|
+
var PromptInputSubmit = ({
|
|
19149
|
+
label = "Submit",
|
|
19150
|
+
status = CHAT_STATUS.READY,
|
|
19151
|
+
disabled,
|
|
19152
|
+
className
|
|
19153
|
+
}) => {
|
|
19154
|
+
const handleClick = (0, import_react19.useCallback)((event) => {
|
|
19155
|
+
event.currentTarget.form?.requestSubmit();
|
|
19156
|
+
}, []);
|
|
19157
|
+
return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
19158
|
+
Button2,
|
|
19159
|
+
{
|
|
19160
|
+
intent: status === CHAT_STATUS.ERROR ? BUTTON_INTENT.ERROR : BUTTON_INTENT.PRIMARY,
|
|
19161
|
+
size: BUTTON_SIZE.XS,
|
|
19162
|
+
className,
|
|
19163
|
+
disabled,
|
|
19164
|
+
onClick: handleClick,
|
|
19165
|
+
children: label
|
|
19166
|
+
}
|
|
19167
|
+
);
|
|
19168
|
+
};
|
|
19169
|
+
|
|
19170
|
+
// src/components/ai-elements/mouse-grid/mouse-grid.tsx
|
|
19171
|
+
var import_react20 = require("react");
|
|
19172
|
+
var import_jsx_runtime30 = require("react/jsx-runtime");
|
|
19173
|
+
function MouseGrid({ glowColor } = {}) {
|
|
19174
|
+
const layerRef = (0, import_react20.useRef)(null);
|
|
19175
|
+
(0, import_react20.useEffect)(() => {
|
|
19176
|
+
let raf = 0;
|
|
19177
|
+
let clientX = 0;
|
|
19178
|
+
let clientY = 0;
|
|
19179
|
+
function flush() {
|
|
19180
|
+
raf = 0;
|
|
19181
|
+
const layer = layerRef.current;
|
|
19182
|
+
if (!layer) {
|
|
19183
|
+
return;
|
|
19184
|
+
}
|
|
19185
|
+
const rect = layer.getBoundingClientRect();
|
|
19186
|
+
layer.style.setProperty("--vibe-mx", `${clientX - rect.left}px`);
|
|
19187
|
+
layer.style.setProperty("--vibe-my", `${clientY - rect.top}px`);
|
|
19188
|
+
}
|
|
19189
|
+
function onMove(event) {
|
|
19190
|
+
clientX = event.clientX;
|
|
19191
|
+
clientY = event.clientY;
|
|
19192
|
+
if (raf) {
|
|
19193
|
+
return;
|
|
19194
|
+
}
|
|
19195
|
+
raf = requestAnimationFrame(flush);
|
|
19196
|
+
}
|
|
19197
|
+
window.addEventListener("mousemove", onMove, { passive: true });
|
|
19198
|
+
return () => {
|
|
19199
|
+
window.removeEventListener("mousemove", onMove);
|
|
19200
|
+
if (raf) {
|
|
19201
|
+
cancelAnimationFrame(raf);
|
|
19202
|
+
}
|
|
19203
|
+
};
|
|
19204
|
+
}, []);
|
|
19205
|
+
const glowStyle = glowColor ? { "--vibe-glow-color": glowColor } : void 0;
|
|
19206
|
+
return /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { ref: layerRef, "aria-hidden": "true", className: "vibe-mouse-grid-layer", children: [
|
|
19207
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { className: "vibe-mouse-grid" }),
|
|
19208
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { className: "vibe-mouse-glow", style: glowStyle })
|
|
19209
|
+
] });
|
|
19210
|
+
}
|
|
19211
|
+
|
|
19212
|
+
// src/components/ai-elements/suggestion/suggestion.tsx
|
|
19213
|
+
var import_react21 = require("react");
|
|
19214
|
+
var import_jsx_runtime31 = require("react/jsx-runtime");
|
|
19215
|
+
var Suggestions = ({ className, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { className: cn("flex flex-wrap items-center justify-center gap-3", className), ...props });
|
|
19216
|
+
var Suggestion = ({ suggestion, onClick, className, children, ...props }) => {
|
|
19217
|
+
const handleClick = (0, import_react21.useCallback)(() => onClick?.(suggestion), [onClick, suggestion]);
|
|
19218
|
+
return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
19219
|
+
"button",
|
|
19220
|
+
{
|
|
19221
|
+
type: "button",
|
|
19222
|
+
onClick: handleClick,
|
|
19223
|
+
className: cn(
|
|
19224
|
+
"cursor-pointer whitespace-nowrap rounded-full border border-brown-30 bg-white px-4 py-2 text-sm text-brown-100 transition-colors hover:bg-brown-10 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-brown-40",
|
|
19225
|
+
className
|
|
19226
|
+
),
|
|
19227
|
+
...props,
|
|
19228
|
+
children: children ?? suggestion
|
|
19229
|
+
}
|
|
19230
|
+
);
|
|
19231
|
+
};
|
|
19232
|
+
|
|
19233
|
+
// src/components/chat/chat-message/chat-message.tsx
|
|
19234
|
+
var import_react25 = require("react");
|
|
19235
|
+
|
|
19236
|
+
// src/components/chat/hooks/copy-message-text.ts
|
|
19237
|
+
function copyMessageText(message) {
|
|
19238
|
+
const parts = [];
|
|
19239
|
+
for (const block of message.blocks) {
|
|
19240
|
+
const service = BlockServices[block.type];
|
|
19241
|
+
if (!service) continue;
|
|
19242
|
+
if (!service.toClipboardText) continue;
|
|
19243
|
+
const text2 = service.toClipboardText(block);
|
|
19244
|
+
if (text2) parts.push(text2);
|
|
19245
|
+
}
|
|
19246
|
+
if (parts.length === 0) return message.fallbackText;
|
|
19247
|
+
return parts.join("\n\n");
|
|
19248
|
+
}
|
|
19249
|
+
|
|
19250
|
+
// src/components/chat/chat-message-actions/chat-message-actions.tsx
|
|
19251
|
+
var import_react24 = require("react");
|
|
19252
|
+
|
|
19253
|
+
// src/components/chat/chat-context/chat-context.ts
|
|
19254
|
+
var import_react22 = require("react");
|
|
19255
|
+
var ChatContext = (0, import_react22.createContext)(null);
|
|
19256
|
+
function useChatContext() {
|
|
19257
|
+
const context = (0, import_react22.useContext)(ChatContext);
|
|
19258
|
+
if (!context) {
|
|
19259
|
+
throw new Error("useChatContext must be used within a Chat.Root component");
|
|
19260
|
+
}
|
|
19261
|
+
return context;
|
|
19262
|
+
}
|
|
19263
|
+
|
|
19264
|
+
// src/components/chat/hooks/use-copy-to-clipboard.ts
|
|
19265
|
+
var import_react23 = require("react");
|
|
19266
|
+
|
|
19267
|
+
// src/utils/clipboard.ts
|
|
19268
|
+
function copyToClipboard(text2, options) {
|
|
19269
|
+
navigator.clipboard.writeText(text2).then(
|
|
19270
|
+
() => options?.onSuccess?.(),
|
|
19271
|
+
(error) => options?.onFailure?.(error)
|
|
19272
|
+
);
|
|
19273
|
+
}
|
|
19274
|
+
|
|
19275
|
+
// src/components/chat/hooks/use-copy-to-clipboard.ts
|
|
19276
|
+
var RESET_DELAY_MS = 2e3;
|
|
19277
|
+
function useCopyToClipboard() {
|
|
19278
|
+
const [isCopied, setIsCopied] = (0, import_react23.useState)(false);
|
|
19279
|
+
const timeoutRef = (0, import_react23.useRef)(null);
|
|
19280
|
+
(0, import_react23.useEffect)(() => {
|
|
19281
|
+
return () => {
|
|
19282
|
+
if (timeoutRef.current) clearTimeout(timeoutRef.current);
|
|
19283
|
+
};
|
|
19284
|
+
}, []);
|
|
19285
|
+
const copy = (0, import_react23.useCallback)((text2) => {
|
|
19286
|
+
copyToClipboard(text2, {
|
|
19287
|
+
onSuccess: () => {
|
|
19288
|
+
setIsCopied(true);
|
|
19289
|
+
if (timeoutRef.current) clearTimeout(timeoutRef.current);
|
|
19290
|
+
timeoutRef.current = setTimeout(() => {
|
|
19291
|
+
setIsCopied(false);
|
|
19292
|
+
timeoutRef.current = null;
|
|
19293
|
+
}, RESET_DELAY_MS);
|
|
19294
|
+
}
|
|
19295
|
+
});
|
|
19296
|
+
}, []);
|
|
19297
|
+
return { isCopied, copy };
|
|
19298
|
+
}
|
|
19299
|
+
|
|
19300
|
+
// src/components/chat/constants.ts
|
|
19301
|
+
var MESSAGE_ROLE = {
|
|
19302
|
+
USER: "user",
|
|
19303
|
+
ASSISTANT: "assistant"
|
|
19304
|
+
};
|
|
19305
|
+
|
|
19306
|
+
// src/components/chat/chat-message-actions/chat-message-actions-styles.ts
|
|
19307
|
+
var import_styled_components7 = __toESM(require("styled-components"), 1);
|
|
19308
|
+
var FADE_DURATION_MS = 150;
|
|
19309
|
+
var ANIMATE_DURATION_MS = 200;
|
|
19310
|
+
var ActionsContainer = import_styled_components7.default.div`
|
|
19311
|
+
display: flex;
|
|
19312
|
+
opacity: ${({ $role }) => $role === MESSAGE_ROLE.ASSISTANT ? 1 : 0};
|
|
19313
|
+
pointer-events: ${({ $role }) => $role === MESSAGE_ROLE.ASSISTANT ? "auto" : "none"};
|
|
19314
|
+
transition: opacity ${FADE_DURATION_MS}ms ease;
|
|
19315
|
+
`;
|
|
19316
|
+
var AnimatedAction = import_styled_components7.default.div`
|
|
19317
|
+
display: flex;
|
|
19318
|
+
overflow: hidden;
|
|
19319
|
+
max-width: ${({ $visible }) => $visible ? "40px" : "0"};
|
|
19320
|
+
opacity: ${({ $visible }) => $visible ? 1 : 0};
|
|
19321
|
+
transition: max-width ${ANIMATE_DURATION_MS}ms ease, opacity ${ANIMATE_DURATION_MS}ms ease;
|
|
19322
|
+
`;
|
|
19323
|
+
|
|
19324
|
+
// src/components/chat/chat-message-actions/chat-message-actions.tsx
|
|
19325
|
+
var import_jsx_runtime32 = require("react/jsx-runtime");
|
|
19326
|
+
function ChatMessageActions({ className, messageId, content: content2, role, isHelpful }) {
|
|
19327
|
+
const { onCopyMessage, onThumbUpClick, onThumbDownClick } = useChatContext();
|
|
19328
|
+
const { isCopied, copy } = useCopyToClipboard();
|
|
19329
|
+
const handleCopy = (0, import_react24.useCallback)(() => {
|
|
19330
|
+
copy(content2);
|
|
19331
|
+
onCopyMessage?.(messageId);
|
|
19332
|
+
}, [content2, messageId, copy, onCopyMessage]);
|
|
19333
|
+
const handleThumbUp = (0, import_react24.useCallback)(() => {
|
|
19334
|
+
onThumbUpClick?.(messageId, isHelpful === true ? null : true);
|
|
19335
|
+
}, [messageId, isHelpful, onThumbUpClick]);
|
|
19336
|
+
const handleThumbDown = (0, import_react24.useCallback)(() => {
|
|
19337
|
+
onThumbDownClick?.(messageId, isHelpful === false ? null : false);
|
|
19338
|
+
}, [messageId, isHelpful, onThumbDownClick]);
|
|
19339
|
+
const isAssistant = role === MESSAGE_ROLE.ASSISTANT;
|
|
19340
|
+
const hasFeedback = isAssistant && (onThumbUpClick || onThumbDownClick);
|
|
19341
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(ActionsContainer, { $role: role, className, children: [
|
|
19342
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
19343
|
+
IconButton,
|
|
19344
|
+
{
|
|
19345
|
+
icon: isCopied ? IconCheck : IconCopy,
|
|
19346
|
+
onClick: handleCopy,
|
|
19347
|
+
"aria-label": isCopied ? "Copied" : "Copy message"
|
|
19348
|
+
}
|
|
19349
|
+
),
|
|
19350
|
+
hasFeedback && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(AnimatedAction, { $visible: isHelpful !== false, children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
19351
|
+
IconButton,
|
|
19352
|
+
{
|
|
19353
|
+
icon: IconThumbUp,
|
|
19354
|
+
onClick: handleThumbUp,
|
|
19355
|
+
isSelected: isHelpful === true,
|
|
19356
|
+
"aria-label": "Good response"
|
|
19357
|
+
}
|
|
19358
|
+
) }),
|
|
19359
|
+
hasFeedback && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(AnimatedAction, { $visible: isHelpful !== true, children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
19360
|
+
IconButton,
|
|
19361
|
+
{
|
|
19362
|
+
icon: IconThumbDown,
|
|
19363
|
+
onClick: handleThumbDown,
|
|
19364
|
+
isSelected: isHelpful === false,
|
|
19365
|
+
"aria-label": "Bad response"
|
|
19366
|
+
}
|
|
19367
|
+
) })
|
|
19368
|
+
] });
|
|
18924
19369
|
}
|
|
18925
19370
|
|
|
18926
19371
|
// src/components/chat/chat-message/chat-message-styles.ts
|
|
18927
|
-
var
|
|
19372
|
+
var import_styled_components8 = __toESM(require("styled-components"), 1);
|
|
18928
19373
|
init_colors();
|
|
18929
|
-
var MessageRow =
|
|
19374
|
+
var MessageRow = import_styled_components8.default.div`
|
|
18930
19375
|
display: flex;
|
|
18931
19376
|
justify-content: ${({ $role }) => $role === MESSAGE_ROLE.USER ? "flex-end" : "flex-start"};
|
|
18932
19377
|
|
|
@@ -18935,7 +19380,7 @@ var MessageRow = import_styled_components6.default.div`
|
|
|
18935
19380
|
pointer-events: auto;
|
|
18936
19381
|
}
|
|
18937
19382
|
`;
|
|
18938
|
-
var MessageContainer =
|
|
19383
|
+
var MessageContainer = import_styled_components8.default.div`
|
|
18939
19384
|
display: flex;
|
|
18940
19385
|
flex-direction: column;
|
|
18941
19386
|
align-items: ${({ $role }) => $role === MESSAGE_ROLE.USER ? "flex-end" : "flex-start"};
|
|
@@ -18943,7 +19388,7 @@ var MessageContainer = import_styled_components6.default.div`
|
|
|
18943
19388
|
width: ${({ $role }) => $role === MESSAGE_ROLE.USER ? "auto" : "100%"};
|
|
18944
19389
|
gap: 12px;
|
|
18945
19390
|
`;
|
|
18946
|
-
var MessageBubble =
|
|
19391
|
+
var MessageBubble = import_styled_components8.default.div`
|
|
18947
19392
|
${typographyMixin(typographyTypes.GEIST_BODY_S_REGULAR)};
|
|
18948
19393
|
color: ${colors["brown-100"]};
|
|
18949
19394
|
background: ${({ $role }) => $role === MESSAGE_ROLE.USER ? colors.white : "transparent"};
|
|
@@ -18962,12 +19407,12 @@ var MessageBubble = import_styled_components6.default.div`
|
|
|
18962
19407
|
`;
|
|
18963
19408
|
|
|
18964
19409
|
// src/components/chat/chat-message/chat-message.tsx
|
|
18965
|
-
var
|
|
19410
|
+
var import_jsx_runtime33 = require("react/jsx-runtime");
|
|
18966
19411
|
function ChatMessage({ message }) {
|
|
18967
|
-
const clipboardText = (0,
|
|
18968
|
-
return /* @__PURE__ */ (0,
|
|
18969
|
-
/* @__PURE__ */ (0,
|
|
18970
|
-
/* @__PURE__ */ (0,
|
|
19412
|
+
const clipboardText = (0, import_react25.useMemo)(() => copyMessageText(message), [message]);
|
|
19413
|
+
return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(MessageRow, { $role: message.role, role: "article", "aria-label": `${message.role} message`, children: /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(MessageContainer, { $role: message.role, children: [
|
|
19414
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)(MessageBubble, { $role: message.role, "data-testid": "message-bubble", children: message.blocks.map((block, index2) => /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(Block, { block }, index2)) }),
|
|
19415
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
18971
19416
|
ChatMessageActions,
|
|
18972
19417
|
{
|
|
18973
19418
|
messageId: message.id,
|
|
@@ -18980,57 +19425,68 @@ function ChatMessage({ message }) {
|
|
|
18980
19425
|
}
|
|
18981
19426
|
|
|
18982
19427
|
// src/components/keyboard-shortcut/keyboard-shortcut-styles.ts
|
|
18983
|
-
var
|
|
19428
|
+
var import_styled_components9 = __toESM(require("styled-components"), 1);
|
|
18984
19429
|
init_colors();
|
|
18985
19430
|
|
|
18986
19431
|
// src/components/keyboard-shortcut/types.ts
|
|
18987
19432
|
var KEYBOARD_SHORTCUT_VARIANTS = {
|
|
18988
|
-
/** Outlined keys with a subtle border —
|
|
19433
|
+
/** Outlined keys with a subtle border + light glyph — for dark surfaces / app chrome. Default. */
|
|
18989
19434
|
OUTLINED: "outlined",
|
|
18990
|
-
/** Filled keys with a solid background —
|
|
19435
|
+
/** Filled keys with a solid background — for emphasis. */
|
|
18991
19436
|
FILLED: "filled"
|
|
18992
19437
|
};
|
|
18993
19438
|
|
|
18994
19439
|
// src/components/keyboard-shortcut/keyboard-shortcut-styles.ts
|
|
18995
19440
|
var variantStyles = {
|
|
18996
|
-
[KEYBOARD_SHORTCUT_VARIANTS.OUTLINED]:
|
|
19441
|
+
[KEYBOARD_SHORTCUT_VARIANTS.OUTLINED]: import_styled_components9.css`
|
|
18997
19442
|
border: 1px solid ${colors["white-alpha-40"]};
|
|
18998
19443
|
color: ${colors["brown-10"]};
|
|
18999
19444
|
`,
|
|
19000
|
-
[KEYBOARD_SHORTCUT_VARIANTS.FILLED]:
|
|
19445
|
+
[KEYBOARD_SHORTCUT_VARIANTS.FILLED]: import_styled_components9.css`
|
|
19001
19446
|
background: ${colors["brown-80"]};
|
|
19002
19447
|
color: ${colors["brown-10"]};
|
|
19003
19448
|
`
|
|
19004
19449
|
};
|
|
19005
|
-
var
|
|
19450
|
+
var adaptiveStyles = {
|
|
19451
|
+
[KEYBOARD_SHORTCUT_VARIANTS.OUTLINED]: import_styled_components9.css`
|
|
19452
|
+
border: 1px solid color-mix(in oklch, currentColor 40%, transparent);
|
|
19453
|
+
color: currentColor;
|
|
19454
|
+
`,
|
|
19455
|
+
[KEYBOARD_SHORTCUT_VARIANTS.FILLED]: import_styled_components9.css`
|
|
19456
|
+
background: color-mix(in oklch, currentColor 12%, transparent);
|
|
19457
|
+
color: currentColor;
|
|
19458
|
+
`
|
|
19459
|
+
};
|
|
19460
|
+
var Wrapper = import_styled_components9.default.div`
|
|
19006
19461
|
display: inline-flex;
|
|
19007
19462
|
align-items: center;
|
|
19008
19463
|
gap: 2px;
|
|
19009
19464
|
`;
|
|
19010
|
-
var Key =
|
|
19465
|
+
var Key = import_styled_components9.default.kbd`
|
|
19011
19466
|
display: inline-flex;
|
|
19012
19467
|
align-items: center;
|
|
19013
19468
|
justify-content: center;
|
|
19014
19469
|
padding: 2px;
|
|
19015
19470
|
border-radius: 6px;
|
|
19016
|
-
${({ $variant }) => variantStyles[$variant]};
|
|
19471
|
+
${({ $variant, $adaptive }) => ($adaptive ? adaptiveStyles : variantStyles)[$variant]};
|
|
19017
19472
|
`;
|
|
19018
19473
|
|
|
19019
19474
|
// src/components/keyboard-shortcut/keyboard-shortcut.tsx
|
|
19020
|
-
var
|
|
19475
|
+
var import_jsx_runtime34 = require("react/jsx-runtime");
|
|
19021
19476
|
function KeyboardShortcut({
|
|
19022
19477
|
keys,
|
|
19023
19478
|
variant = KEYBOARD_SHORTCUT_VARIANTS.OUTLINED,
|
|
19479
|
+
adaptive = false,
|
|
19024
19480
|
className
|
|
19025
19481
|
}) {
|
|
19026
|
-
return /* @__PURE__ */ (0,
|
|
19482
|
+
return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(Wrapper, { className, children: keys.map((KeyComponent, index2) => /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(Key, { $variant: variant, $adaptive: adaptive, children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(Icon, { icon: KeyComponent, size: 12 }) }, index2)) });
|
|
19027
19483
|
}
|
|
19028
19484
|
|
|
19029
19485
|
// src/components/keyboard-shortcut/icons/icon-ctrl.tsx
|
|
19030
|
-
var
|
|
19486
|
+
var import_jsx_runtime35 = require("react/jsx-runtime");
|
|
19031
19487
|
function IconCtrl(props) {
|
|
19032
19488
|
const { width: width2 = 24, height: height2 = 24, ...rest } = props;
|
|
19033
|
-
return /* @__PURE__ */ (0,
|
|
19489
|
+
return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", width: width2, height: height2, fill: "none", ...rest, children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
19034
19490
|
"text",
|
|
19035
19491
|
{
|
|
19036
19492
|
x: "50%",
|
|
@@ -19047,11 +19503,11 @@ function IconCtrl(props) {
|
|
|
19047
19503
|
}
|
|
19048
19504
|
|
|
19049
19505
|
// src/components/lottie/lottie.tsx
|
|
19050
|
-
var
|
|
19506
|
+
var import_react27 = require("react");
|
|
19051
19507
|
|
|
19052
19508
|
// src/components/lottie/lottie-styles.ts
|
|
19053
|
-
var
|
|
19054
|
-
var LottieContainer =
|
|
19509
|
+
var import_styled_components10 = __toESM(require("styled-components"), 1);
|
|
19510
|
+
var LottieContainer = import_styled_components10.default.div`
|
|
19055
19511
|
display: inline-flex;
|
|
19056
19512
|
width: ${({ $width }) => typeof $width === "number" ? `${$width}px` : $width};
|
|
19057
19513
|
height: ${({ $height }) => typeof $height === "number" ? `${$height}px` : $height};
|
|
@@ -19063,7 +19519,7 @@ var LottieContainer = import_styled_components8.default.div`
|
|
|
19063
19519
|
`;
|
|
19064
19520
|
|
|
19065
19521
|
// src/components/lottie/use-lottie.ts
|
|
19066
|
-
var
|
|
19522
|
+
var import_react26 = require("react");
|
|
19067
19523
|
var import_lottie_web = __toESM(require_lottie(), 1);
|
|
19068
19524
|
function useLottie({
|
|
19069
19525
|
animationData: animationData2,
|
|
@@ -19078,17 +19534,17 @@ function useLottie({
|
|
|
19078
19534
|
onLoopComplete,
|
|
19079
19535
|
onEnterFrame
|
|
19080
19536
|
}) {
|
|
19081
|
-
const containerRef = (0,
|
|
19082
|
-
const animationRef = (0,
|
|
19083
|
-
const onAnimationLoadedRef = (0,
|
|
19084
|
-
const onCompleteRef = (0,
|
|
19085
|
-
const onLoopCompleteRef = (0,
|
|
19086
|
-
const onEnterFrameRef = (0,
|
|
19537
|
+
const containerRef = (0, import_react26.useRef)(null);
|
|
19538
|
+
const animationRef = (0, import_react26.useRef)(null);
|
|
19539
|
+
const onAnimationLoadedRef = (0, import_react26.useRef)(onAnimationLoaded);
|
|
19540
|
+
const onCompleteRef = (0, import_react26.useRef)(onComplete);
|
|
19541
|
+
const onLoopCompleteRef = (0, import_react26.useRef)(onLoopComplete);
|
|
19542
|
+
const onEnterFrameRef = (0, import_react26.useRef)(onEnterFrame);
|
|
19087
19543
|
onAnimationLoadedRef.current = onAnimationLoaded;
|
|
19088
19544
|
onCompleteRef.current = onComplete;
|
|
19089
19545
|
onLoopCompleteRef.current = onLoopComplete;
|
|
19090
19546
|
onEnterFrameRef.current = onEnterFrame;
|
|
19091
|
-
(0,
|
|
19547
|
+
(0, import_react26.useEffect)(() => {
|
|
19092
19548
|
if (!containerRef.current) return;
|
|
19093
19549
|
const anim = import_lottie_web.default.loadAnimation({
|
|
19094
19550
|
container: containerRef.current,
|
|
@@ -19180,8 +19636,8 @@ function createLottieRef(animationRef) {
|
|
|
19180
19636
|
}
|
|
19181
19637
|
|
|
19182
19638
|
// src/components/lottie/lottie.tsx
|
|
19183
|
-
var
|
|
19184
|
-
var Lottie = (0,
|
|
19639
|
+
var import_jsx_runtime36 = require("react/jsx-runtime");
|
|
19640
|
+
var Lottie = (0, import_react27.forwardRef)(function Lottie2({
|
|
19185
19641
|
animationData: animationData2,
|
|
19186
19642
|
autoplay,
|
|
19187
19643
|
loop,
|
|
@@ -19211,8 +19667,8 @@ var Lottie = (0, import_react22.forwardRef)(function Lottie2({
|
|
|
19211
19667
|
onLoopComplete,
|
|
19212
19668
|
onEnterFrame
|
|
19213
19669
|
});
|
|
19214
|
-
(0,
|
|
19215
|
-
return /* @__PURE__ */ (0,
|
|
19670
|
+
(0, import_react27.useImperativeHandle)(ref, () => createLottieRef(animationRef), [animationRef]);
|
|
19671
|
+
return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
19216
19672
|
LottieContainer,
|
|
19217
19673
|
{
|
|
19218
19674
|
ref: containerRef,
|
|
@@ -19225,81 +19681,6 @@ var Lottie = (0, import_react22.forwardRef)(function Lottie2({
|
|
|
19225
19681
|
);
|
|
19226
19682
|
});
|
|
19227
19683
|
|
|
19228
|
-
// src/components/text-area/text-area.tsx
|
|
19229
|
-
var import_react23 = require("react");
|
|
19230
|
-
|
|
19231
|
-
// src/utils/merge-refs.ts
|
|
19232
|
-
function mergeRefs(...refs) {
|
|
19233
|
-
return (node) => {
|
|
19234
|
-
for (const ref of refs) {
|
|
19235
|
-
if (typeof ref === "function") {
|
|
19236
|
-
ref(node);
|
|
19237
|
-
} else if (ref) {
|
|
19238
|
-
ref.current = node;
|
|
19239
|
-
}
|
|
19240
|
-
}
|
|
19241
|
-
};
|
|
19242
|
-
}
|
|
19243
|
-
|
|
19244
|
-
// src/components/text-area/text-area-styles.ts
|
|
19245
|
-
var import_styled_components9 = __toESM(require("styled-components"), 1);
|
|
19246
|
-
init_colors();
|
|
19247
|
-
var StyledTextArea = import_styled_components9.default.textarea`
|
|
19248
|
-
${typographyMixin(typographyTypes.GEIST_BODY_S_REGULAR)};
|
|
19249
|
-
color: ${colors["brown-100"]};
|
|
19250
|
-
border: none;
|
|
19251
|
-
outline: none;
|
|
19252
|
-
resize: none;
|
|
19253
|
-
width: 100%;
|
|
19254
|
-
background: transparent;
|
|
19255
|
-
vertical-align: bottom;
|
|
19256
|
-
max-height: ${({ $maxHeight }) => $maxHeight ? `${$maxHeight}px` : "none"};
|
|
19257
|
-
overflow-y: ${({ $maxHeight }) => $maxHeight ? "auto" : "hidden"};
|
|
19258
|
-
|
|
19259
|
-
&::placeholder {
|
|
19260
|
-
color: ${colors["brown-50"]};
|
|
19261
|
-
}
|
|
19262
|
-
|
|
19263
|
-
&:disabled {
|
|
19264
|
-
opacity: 0.5;
|
|
19265
|
-
cursor: not-allowed;
|
|
19266
|
-
}
|
|
19267
|
-
`;
|
|
19268
|
-
|
|
19269
|
-
// src/components/text-area/text-area.tsx
|
|
19270
|
-
var import_jsx_runtime32 = require("react/jsx-runtime");
|
|
19271
|
-
var TextArea = (0, import_react23.forwardRef)(function TextArea2({ value: value2, onChange, placeholder, maxHeight, rows = 1, autoFocus, onKeyDown, disabled, className }, externalRef) {
|
|
19272
|
-
const internalRef = (0, import_react23.useRef)(null);
|
|
19273
|
-
(0, import_react23.useLayoutEffect)(() => {
|
|
19274
|
-
const el = internalRef.current;
|
|
19275
|
-
if (el) {
|
|
19276
|
-
el.style.height = "auto";
|
|
19277
|
-
el.style.height = `${el.scrollHeight}px`;
|
|
19278
|
-
}
|
|
19279
|
-
}, [value2]);
|
|
19280
|
-
const handleChange = (0, import_react23.useCallback)(
|
|
19281
|
-
(e) => {
|
|
19282
|
-
onChange(e.target.value);
|
|
19283
|
-
},
|
|
19284
|
-
[onChange]
|
|
19285
|
-
);
|
|
19286
|
-
return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
19287
|
-
StyledTextArea,
|
|
19288
|
-
{
|
|
19289
|
-
ref: mergeRefs(internalRef, externalRef),
|
|
19290
|
-
value: value2,
|
|
19291
|
-
onChange: handleChange,
|
|
19292
|
-
placeholder,
|
|
19293
|
-
$maxHeight: maxHeight,
|
|
19294
|
-
rows,
|
|
19295
|
-
autoFocus,
|
|
19296
|
-
onKeyDown,
|
|
19297
|
-
disabled,
|
|
19298
|
-
className
|
|
19299
|
-
}
|
|
19300
|
-
);
|
|
19301
|
-
});
|
|
19302
|
-
|
|
19303
19684
|
// src/utils/parse-markdown-table.ts
|
|
19304
19685
|
function parseCells(line) {
|
|
19305
19686
|
const trimmed = line.trim();
|
|
@@ -19370,165 +19751,6 @@ function convertTableToCSV(table) {
|
|
|
19370
19751
|
const dataRows = table.rows.map((row) => row.map(escapeCsvField).join(","));
|
|
19371
19752
|
return [headerRow, ...dataRows].join("\r\n");
|
|
19372
19753
|
}
|
|
19373
|
-
|
|
19374
|
-
// src/components/button/button.tsx
|
|
19375
|
-
var import_react24 = require("react");
|
|
19376
|
-
|
|
19377
|
-
// src/components/button/button-styles.ts
|
|
19378
|
-
var import_styled_components10 = __toESM(require("styled-components"), 1);
|
|
19379
|
-
init_colors();
|
|
19380
|
-
|
|
19381
|
-
// src/components/button/constants.ts
|
|
19382
|
-
var BUTTON_VARIANT = {
|
|
19383
|
-
SOLID: "solid",
|
|
19384
|
-
OUTLINE: "outline",
|
|
19385
|
-
GHOST: "ghost"
|
|
19386
|
-
};
|
|
19387
|
-
var BUTTON_SIZE = {
|
|
19388
|
-
XS: "xs",
|
|
19389
|
-
S: "s",
|
|
19390
|
-
M: "m"
|
|
19391
|
-
};
|
|
19392
|
-
var BUTTON_INTENT = {
|
|
19393
|
-
PRIMARY: "primary",
|
|
19394
|
-
ERROR: "error"
|
|
19395
|
-
};
|
|
19396
|
-
var ICON_POSITION = {
|
|
19397
|
-
LEADING: "leading",
|
|
19398
|
-
TRAILING: "trailing"
|
|
19399
|
-
};
|
|
19400
|
-
|
|
19401
|
-
// src/components/button/button-styles.ts
|
|
19402
|
-
var intentColors = {
|
|
19403
|
-
[BUTTON_INTENT.PRIMARY]: {
|
|
19404
|
-
base: colors["brown-100"],
|
|
19405
|
-
hover: colors["brown-90"],
|
|
19406
|
-
disabledBg: colors["brown-20"],
|
|
19407
|
-
disabledText: colors["brown-50"],
|
|
19408
|
-
subtleHover: colors["brown-20"],
|
|
19409
|
-
border: colors["brown-40"],
|
|
19410
|
-
disabledBorder: colors["brown-20"]
|
|
19411
|
-
},
|
|
19412
|
-
[BUTTON_INTENT.ERROR]: {
|
|
19413
|
-
base: colors["red-500"],
|
|
19414
|
-
hover: colors["red-600"],
|
|
19415
|
-
disabledBg: colors["red-100"],
|
|
19416
|
-
disabledText: colors["red-200"],
|
|
19417
|
-
subtleHover: colors["red-50"],
|
|
19418
|
-
border: colors["red-200"],
|
|
19419
|
-
disabledBorder: colors["red-100"]
|
|
19420
|
-
}
|
|
19421
|
-
};
|
|
19422
|
-
var sizeValues = {
|
|
19423
|
-
[BUTTON_SIZE.XS]: { padding: "6px 10px", borderRadius: "8px", gap: "4px" },
|
|
19424
|
-
[BUTTON_SIZE.S]: { padding: "8px 12px", borderRadius: "10px", gap: "6px" },
|
|
19425
|
-
[BUTTON_SIZE.M]: { padding: "10px 14px", borderRadius: "10px", gap: "6px" }
|
|
19426
|
-
};
|
|
19427
|
-
function sizeMixin({ $size }) {
|
|
19428
|
-
const s = sizeValues[$size];
|
|
19429
|
-
return import_styled_components10.css`
|
|
19430
|
-
padding: ${s.padding};
|
|
19431
|
-
border-radius: ${s.borderRadius};
|
|
19432
|
-
gap: ${s.gap};
|
|
19433
|
-
`;
|
|
19434
|
-
}
|
|
19435
|
-
var variantColorMap = {
|
|
19436
|
-
[BUTTON_VARIANT.SOLID]: (c) => ({
|
|
19437
|
-
background: c.base,
|
|
19438
|
-
color: colors.white,
|
|
19439
|
-
border: "none",
|
|
19440
|
-
hoverBg: c.hover,
|
|
19441
|
-
disabledBg: c.disabledBg,
|
|
19442
|
-
disabledColor: c.disabledText
|
|
19443
|
-
}),
|
|
19444
|
-
[BUTTON_VARIANT.OUTLINE]: (c) => ({
|
|
19445
|
-
background: colors.white,
|
|
19446
|
-
color: c.base,
|
|
19447
|
-
border: `1px solid ${c.border}`,
|
|
19448
|
-
hoverBg: c.subtleHover,
|
|
19449
|
-
disabledColor: c.disabledText,
|
|
19450
|
-
disabledBorder: c.disabledBorder
|
|
19451
|
-
}),
|
|
19452
|
-
[BUTTON_VARIANT.GHOST]: (c) => ({
|
|
19453
|
-
background: "transparent",
|
|
19454
|
-
color: c.base,
|
|
19455
|
-
border: "none",
|
|
19456
|
-
hoverBg: c.subtleHover,
|
|
19457
|
-
disabledColor: c.disabledText
|
|
19458
|
-
})
|
|
19459
|
-
};
|
|
19460
|
-
function variantMixin({
|
|
19461
|
-
$variant,
|
|
19462
|
-
$intent
|
|
19463
|
-
}) {
|
|
19464
|
-
const v = variantColorMap[$variant](intentColors[$intent]);
|
|
19465
|
-
return import_styled_components10.css`
|
|
19466
|
-
background: ${v.background};
|
|
19467
|
-
color: ${v.color};
|
|
19468
|
-
border: ${v.border};
|
|
19469
|
-
|
|
19470
|
-
&:hover:not(:disabled) {
|
|
19471
|
-
background: ${v.hoverBg};
|
|
19472
|
-
}
|
|
19473
|
-
|
|
19474
|
-
&:disabled {
|
|
19475
|
-
color: ${v.disabledColor};
|
|
19476
|
-
${v.disabledBg ? `background: ${v.disabledBg};` : ""}
|
|
19477
|
-
${v.disabledBorder ? `border-color: ${v.disabledBorder};` : ""}
|
|
19478
|
-
}
|
|
19479
|
-
`;
|
|
19480
|
-
}
|
|
19481
|
-
var StyledButton = import_styled_components10.default.button`
|
|
19482
|
-
display: inline-flex;
|
|
19483
|
-
align-items: center;
|
|
19484
|
-
justify-content: center;
|
|
19485
|
-
cursor: pointer;
|
|
19486
|
-
${typographyMixin(typographyTypes.GEIST_BODY_XS_MEDIUM)};
|
|
19487
|
-
transition: background-color 150ms ease, border-color 150ms ease, color 150ms ease;
|
|
19488
|
-
|
|
19489
|
-
&:disabled {
|
|
19490
|
-
cursor: not-allowed;
|
|
19491
|
-
}
|
|
19492
|
-
|
|
19493
|
-
${sizeMixin}
|
|
19494
|
-
${variantMixin}
|
|
19495
|
-
`;
|
|
19496
|
-
|
|
19497
|
-
// src/components/button/button.tsx
|
|
19498
|
-
var import_jsx_runtime33 = require("react/jsx-runtime");
|
|
19499
|
-
var Button2 = (0, import_react24.forwardRef)(function Button3({
|
|
19500
|
-
children,
|
|
19501
|
-
variant = BUTTON_VARIANT.SOLID,
|
|
19502
|
-
intent = BUTTON_INTENT.PRIMARY,
|
|
19503
|
-
size = BUTTON_SIZE.M,
|
|
19504
|
-
icon,
|
|
19505
|
-
iconPosition = ICON_POSITION.LEADING,
|
|
19506
|
-
disabled = false,
|
|
19507
|
-
onClick,
|
|
19508
|
-
className,
|
|
19509
|
-
"aria-label": ariaLabel
|
|
19510
|
-
}, ref) {
|
|
19511
|
-
const iconElement = icon ? /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(Icon, { icon, size: 16 }) : null;
|
|
19512
|
-
return /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(
|
|
19513
|
-
StyledButton,
|
|
19514
|
-
{
|
|
19515
|
-
ref,
|
|
19516
|
-
type: "button",
|
|
19517
|
-
$variant: variant,
|
|
19518
|
-
$intent: intent,
|
|
19519
|
-
$size: size,
|
|
19520
|
-
disabled,
|
|
19521
|
-
onClick: disabled ? void 0 : onClick,
|
|
19522
|
-
className,
|
|
19523
|
-
"aria-label": ariaLabel,
|
|
19524
|
-
children: [
|
|
19525
|
-
iconPosition === ICON_POSITION.LEADING && iconElement,
|
|
19526
|
-
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)("span", { children }),
|
|
19527
|
-
iconPosition === ICON_POSITION.TRAILING && iconElement
|
|
19528
|
-
]
|
|
19529
|
-
}
|
|
19530
|
-
);
|
|
19531
|
-
});
|
|
19532
19754
|
// Annotate the CommonJS export names for ESM import in node:
|
|
19533
19755
|
0 && (module.exports = {
|
|
19534
19756
|
ArtifactCopyAsImageButton,
|
|
@@ -19544,6 +19766,7 @@ var Button2 = (0, import_react24.forwardRef)(function Button3({
|
|
|
19544
19766
|
BlockContext,
|
|
19545
19767
|
BlockServices,
|
|
19546
19768
|
Button,
|
|
19769
|
+
CHAT_STATUS,
|
|
19547
19770
|
ChartArtifact,
|
|
19548
19771
|
ChatContext,
|
|
19549
19772
|
ChatMessage,
|
|
@@ -19557,6 +19780,14 @@ var Button2 = (0, import_react24.forwardRef)(function Button3({
|
|
|
19557
19780
|
KeyboardShortcut,
|
|
19558
19781
|
Lottie,
|
|
19559
19782
|
MESSAGE_ROLE,
|
|
19783
|
+
MouseGrid,
|
|
19784
|
+
PromptInput,
|
|
19785
|
+
PromptInputFooter,
|
|
19786
|
+
PromptInputSubmit,
|
|
19787
|
+
PromptInputTextarea,
|
|
19788
|
+
PromptInputTools,
|
|
19789
|
+
Suggestion,
|
|
19790
|
+
Suggestions,
|
|
19560
19791
|
TableArtifact,
|
|
19561
19792
|
TextArea,
|
|
19562
19793
|
TextBlockService,
|