@shapesos/clay 0.13.0 → 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 +95 -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 +95 -28
- package/dist/chat.cjs.map +1 -1
- package/dist/chat.js +8 -8
- package/dist/{chunk-QH2WW2MW.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-26XVDY6Z.js → chunk-MDAWYZBI.js} +15 -3
- package/dist/{chunk-26XVDY6Z.js.map → chunk-MDAWYZBI.js.map} +1 -1
- 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 +658 -415
- 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-QH2WW2MW.js.map → chunk-3THOTQO3.js.map} +0 -0
- /package/dist/{chunk-WPQQVKWY.js.map → chunk-7OYIDM42.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,
|
|
@@ -18658,6 +18722,18 @@ var TextBlockWrapper = import_styled_components4.default.div`
|
|
|
18658
18722
|
margin-block: 4px;
|
|
18659
18723
|
}
|
|
18660
18724
|
|
|
18725
|
+
& ul {
|
|
18726
|
+
list-style-type: disc;
|
|
18727
|
+
}
|
|
18728
|
+
|
|
18729
|
+
& ul ul {
|
|
18730
|
+
list-style-type: circle;
|
|
18731
|
+
}
|
|
18732
|
+
|
|
18733
|
+
& ul ul ul {
|
|
18734
|
+
list-style-type: square;
|
|
18735
|
+
}
|
|
18736
|
+
|
|
18661
18737
|
& ol {
|
|
18662
18738
|
list-style-type: decimal;
|
|
18663
18739
|
}
|
|
@@ -18773,136 +18849,517 @@ function useBlockContext() {
|
|
|
18773
18849
|
return (0, import_react16.useContext)(BlockContext) ?? {};
|
|
18774
18850
|
}
|
|
18775
18851
|
|
|
18776
|
-
// src/components/
|
|
18777
|
-
var import_react20 = require("react");
|
|
18778
|
-
|
|
18779
|
-
// src/components/chat/hooks/copy-message-text.ts
|
|
18780
|
-
function copyMessageText(message) {
|
|
18781
|
-
const parts = [];
|
|
18782
|
-
for (const block of message.blocks) {
|
|
18783
|
-
const service = BlockServices[block.type];
|
|
18784
|
-
if (!service) continue;
|
|
18785
|
-
if (!service.toClipboardText) continue;
|
|
18786
|
-
const text2 = service.toClipboardText(block);
|
|
18787
|
-
if (text2) parts.push(text2);
|
|
18788
|
-
}
|
|
18789
|
-
if (parts.length === 0) return message.fallbackText;
|
|
18790
|
-
return parts.join("\n\n");
|
|
18791
|
-
}
|
|
18792
|
-
|
|
18793
|
-
// src/components/chat/chat-message-actions/chat-message-actions.tsx
|
|
18852
|
+
// src/components/ai-elements/prompt-input/prompt-input.tsx
|
|
18794
18853
|
var import_react19 = require("react");
|
|
18795
18854
|
|
|
18796
|
-
// src/components/
|
|
18855
|
+
// src/components/button/button.tsx
|
|
18797
18856
|
var import_react17 = require("react");
|
|
18798
|
-
var ChatContext = (0, import_react17.createContext)(null);
|
|
18799
|
-
function useChatContext() {
|
|
18800
|
-
const context = (0, import_react17.useContext)(ChatContext);
|
|
18801
|
-
if (!context) {
|
|
18802
|
-
throw new Error("useChatContext must be used within a Chat.Root component");
|
|
18803
|
-
}
|
|
18804
|
-
return context;
|
|
18805
|
-
}
|
|
18806
18857
|
|
|
18807
|
-
// src/components/
|
|
18808
|
-
var
|
|
18858
|
+
// src/components/button/button-styles.ts
|
|
18859
|
+
var import_styled_components5 = __toESM(require("styled-components"), 1);
|
|
18860
|
+
init_colors();
|
|
18809
18861
|
|
|
18810
|
-
// src/
|
|
18811
|
-
|
|
18812
|
-
|
|
18813
|
-
|
|
18814
|
-
|
|
18815
|
-
|
|
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
|
+
`;
|
|
18816
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};
|
|
18817
18950
|
|
|
18818
|
-
|
|
18819
|
-
|
|
18820
|
-
|
|
18821
|
-
|
|
18822
|
-
|
|
18823
|
-
|
|
18824
|
-
|
|
18825
|
-
|
|
18826
|
-
}
|
|
18827
|
-
|
|
18828
|
-
const copy = (0, import_react18.useCallback)((text2) => {
|
|
18829
|
-
copyToClipboard(text2, {
|
|
18830
|
-
onSuccess: () => {
|
|
18831
|
-
setIsCopied(true);
|
|
18832
|
-
if (timeoutRef.current) clearTimeout(timeoutRef.current);
|
|
18833
|
-
timeoutRef.current = setTimeout(() => {
|
|
18834
|
-
setIsCopied(false);
|
|
18835
|
-
timeoutRef.current = null;
|
|
18836
|
-
}, RESET_DELAY_MS);
|
|
18837
|
-
}
|
|
18838
|
-
});
|
|
18839
|
-
}, []);
|
|
18840
|
-
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
|
+
`;
|
|
18841
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;
|
|
18842
18969
|
|
|
18843
|
-
|
|
18844
|
-
|
|
18845
|
-
|
|
18846
|
-
ASSISTANT: "assistant"
|
|
18847
|
-
};
|
|
18970
|
+
&:disabled {
|
|
18971
|
+
cursor: not-allowed;
|
|
18972
|
+
}
|
|
18848
18973
|
|
|
18849
|
-
|
|
18850
|
-
|
|
18851
|
-
var FADE_DURATION_MS = 150;
|
|
18852
|
-
var ANIMATE_DURATION_MS = 200;
|
|
18853
|
-
var ActionsContainer = import_styled_components5.default.div`
|
|
18854
|
-
display: flex;
|
|
18855
|
-
opacity: ${({ $role }) => $role === MESSAGE_ROLE.ASSISTANT ? 1 : 0};
|
|
18856
|
-
pointer-events: ${({ $role }) => $role === MESSAGE_ROLE.ASSISTANT ? "auto" : "none"};
|
|
18857
|
-
transition: opacity ${FADE_DURATION_MS}ms ease;
|
|
18858
|
-
`;
|
|
18859
|
-
var AnimatedAction = import_styled_components5.default.div`
|
|
18860
|
-
display: flex;
|
|
18861
|
-
overflow: hidden;
|
|
18862
|
-
max-width: ${({ $visible }) => $visible ? "40px" : "0"};
|
|
18863
|
-
opacity: ${({ $visible }) => $visible ? 1 : 0};
|
|
18864
|
-
transition: max-width ${ANIMATE_DURATION_MS}ms ease, opacity ${ANIMATE_DURATION_MS}ms ease;
|
|
18974
|
+
${sizeMixin}
|
|
18975
|
+
${variantMixin}
|
|
18865
18976
|
`;
|
|
18866
18977
|
|
|
18867
|
-
// src/components/
|
|
18978
|
+
// src/components/button/button.tsx
|
|
18868
18979
|
var import_jsx_runtime27 = require("react/jsx-runtime");
|
|
18869
|
-
|
|
18870
|
-
|
|
18871
|
-
|
|
18872
|
-
|
|
18873
|
-
|
|
18874
|
-
|
|
18875
|
-
|
|
18876
|
-
|
|
18877
|
-
|
|
18878
|
-
|
|
18879
|
-
|
|
18880
|
-
|
|
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
|
-
|
|
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,
|
|
18906
19363
|
onClick: handleThumbDown,
|
|
18907
19364
|
isSelected: isHelpful === false,
|
|
18908
19365
|
"aria-label": "Bad response"
|
|
@@ -18912,9 +19369,9 @@ function ChatMessageActions({ className, messageId, content: content2, role, isH
|
|
|
18912
19369
|
}
|
|
18913
19370
|
|
|
18914
19371
|
// src/components/chat/chat-message/chat-message-styles.ts
|
|
18915
|
-
var
|
|
19372
|
+
var import_styled_components8 = __toESM(require("styled-components"), 1);
|
|
18916
19373
|
init_colors();
|
|
18917
|
-
var MessageRow =
|
|
19374
|
+
var MessageRow = import_styled_components8.default.div`
|
|
18918
19375
|
display: flex;
|
|
18919
19376
|
justify-content: ${({ $role }) => $role === MESSAGE_ROLE.USER ? "flex-end" : "flex-start"};
|
|
18920
19377
|
|
|
@@ -18923,7 +19380,7 @@ var MessageRow = import_styled_components6.default.div`
|
|
|
18923
19380
|
pointer-events: auto;
|
|
18924
19381
|
}
|
|
18925
19382
|
`;
|
|
18926
|
-
var MessageContainer =
|
|
19383
|
+
var MessageContainer = import_styled_components8.default.div`
|
|
18927
19384
|
display: flex;
|
|
18928
19385
|
flex-direction: column;
|
|
18929
19386
|
align-items: ${({ $role }) => $role === MESSAGE_ROLE.USER ? "flex-end" : "flex-start"};
|
|
@@ -18931,7 +19388,7 @@ var MessageContainer = import_styled_components6.default.div`
|
|
|
18931
19388
|
width: ${({ $role }) => $role === MESSAGE_ROLE.USER ? "auto" : "100%"};
|
|
18932
19389
|
gap: 12px;
|
|
18933
19390
|
`;
|
|
18934
|
-
var MessageBubble =
|
|
19391
|
+
var MessageBubble = import_styled_components8.default.div`
|
|
18935
19392
|
${typographyMixin(typographyTypes.GEIST_BODY_S_REGULAR)};
|
|
18936
19393
|
color: ${colors["brown-100"]};
|
|
18937
19394
|
background: ${({ $role }) => $role === MESSAGE_ROLE.USER ? colors.white : "transparent"};
|
|
@@ -18950,12 +19407,12 @@ var MessageBubble = import_styled_components6.default.div`
|
|
|
18950
19407
|
`;
|
|
18951
19408
|
|
|
18952
19409
|
// src/components/chat/chat-message/chat-message.tsx
|
|
18953
|
-
var
|
|
19410
|
+
var import_jsx_runtime33 = require("react/jsx-runtime");
|
|
18954
19411
|
function ChatMessage({ message }) {
|
|
18955
|
-
const clipboardText = (0,
|
|
18956
|
-
return /* @__PURE__ */ (0,
|
|
18957
|
-
/* @__PURE__ */ (0,
|
|
18958
|
-
/* @__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)(
|
|
18959
19416
|
ChatMessageActions,
|
|
18960
19417
|
{
|
|
18961
19418
|
messageId: message.id,
|
|
@@ -18968,57 +19425,68 @@ function ChatMessage({ message }) {
|
|
|
18968
19425
|
}
|
|
18969
19426
|
|
|
18970
19427
|
// src/components/keyboard-shortcut/keyboard-shortcut-styles.ts
|
|
18971
|
-
var
|
|
19428
|
+
var import_styled_components9 = __toESM(require("styled-components"), 1);
|
|
18972
19429
|
init_colors();
|
|
18973
19430
|
|
|
18974
19431
|
// src/components/keyboard-shortcut/types.ts
|
|
18975
19432
|
var KEYBOARD_SHORTCUT_VARIANTS = {
|
|
18976
|
-
/** Outlined keys with a subtle border —
|
|
19433
|
+
/** Outlined keys with a subtle border + light glyph — for dark surfaces / app chrome. Default. */
|
|
18977
19434
|
OUTLINED: "outlined",
|
|
18978
|
-
/** Filled keys with a solid background —
|
|
19435
|
+
/** Filled keys with a solid background — for emphasis. */
|
|
18979
19436
|
FILLED: "filled"
|
|
18980
19437
|
};
|
|
18981
19438
|
|
|
18982
19439
|
// src/components/keyboard-shortcut/keyboard-shortcut-styles.ts
|
|
18983
19440
|
var variantStyles = {
|
|
18984
|
-
[KEYBOARD_SHORTCUT_VARIANTS.OUTLINED]:
|
|
19441
|
+
[KEYBOARD_SHORTCUT_VARIANTS.OUTLINED]: import_styled_components9.css`
|
|
18985
19442
|
border: 1px solid ${colors["white-alpha-40"]};
|
|
18986
19443
|
color: ${colors["brown-10"]};
|
|
18987
19444
|
`,
|
|
18988
|
-
[KEYBOARD_SHORTCUT_VARIANTS.FILLED]:
|
|
19445
|
+
[KEYBOARD_SHORTCUT_VARIANTS.FILLED]: import_styled_components9.css`
|
|
18989
19446
|
background: ${colors["brown-80"]};
|
|
18990
19447
|
color: ${colors["brown-10"]};
|
|
18991
19448
|
`
|
|
18992
19449
|
};
|
|
18993
|
-
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`
|
|
18994
19461
|
display: inline-flex;
|
|
18995
19462
|
align-items: center;
|
|
18996
19463
|
gap: 2px;
|
|
18997
19464
|
`;
|
|
18998
|
-
var Key =
|
|
19465
|
+
var Key = import_styled_components9.default.kbd`
|
|
18999
19466
|
display: inline-flex;
|
|
19000
19467
|
align-items: center;
|
|
19001
19468
|
justify-content: center;
|
|
19002
19469
|
padding: 2px;
|
|
19003
19470
|
border-radius: 6px;
|
|
19004
|
-
${({ $variant }) => variantStyles[$variant]};
|
|
19471
|
+
${({ $variant, $adaptive }) => ($adaptive ? adaptiveStyles : variantStyles)[$variant]};
|
|
19005
19472
|
`;
|
|
19006
19473
|
|
|
19007
19474
|
// src/components/keyboard-shortcut/keyboard-shortcut.tsx
|
|
19008
|
-
var
|
|
19475
|
+
var import_jsx_runtime34 = require("react/jsx-runtime");
|
|
19009
19476
|
function KeyboardShortcut({
|
|
19010
19477
|
keys,
|
|
19011
19478
|
variant = KEYBOARD_SHORTCUT_VARIANTS.OUTLINED,
|
|
19479
|
+
adaptive = false,
|
|
19012
19480
|
className
|
|
19013
19481
|
}) {
|
|
19014
|
-
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)) });
|
|
19015
19483
|
}
|
|
19016
19484
|
|
|
19017
19485
|
// src/components/keyboard-shortcut/icons/icon-ctrl.tsx
|
|
19018
|
-
var
|
|
19486
|
+
var import_jsx_runtime35 = require("react/jsx-runtime");
|
|
19019
19487
|
function IconCtrl(props) {
|
|
19020
19488
|
const { width: width2 = 24, height: height2 = 24, ...rest } = props;
|
|
19021
|
-
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)(
|
|
19022
19490
|
"text",
|
|
19023
19491
|
{
|
|
19024
19492
|
x: "50%",
|
|
@@ -19035,11 +19503,11 @@ function IconCtrl(props) {
|
|
|
19035
19503
|
}
|
|
19036
19504
|
|
|
19037
19505
|
// src/components/lottie/lottie.tsx
|
|
19038
|
-
var
|
|
19506
|
+
var import_react27 = require("react");
|
|
19039
19507
|
|
|
19040
19508
|
// src/components/lottie/lottie-styles.ts
|
|
19041
|
-
var
|
|
19042
|
-
var LottieContainer =
|
|
19509
|
+
var import_styled_components10 = __toESM(require("styled-components"), 1);
|
|
19510
|
+
var LottieContainer = import_styled_components10.default.div`
|
|
19043
19511
|
display: inline-flex;
|
|
19044
19512
|
width: ${({ $width }) => typeof $width === "number" ? `${$width}px` : $width};
|
|
19045
19513
|
height: ${({ $height }) => typeof $height === "number" ? `${$height}px` : $height};
|
|
@@ -19051,7 +19519,7 @@ var LottieContainer = import_styled_components8.default.div`
|
|
|
19051
19519
|
`;
|
|
19052
19520
|
|
|
19053
19521
|
// src/components/lottie/use-lottie.ts
|
|
19054
|
-
var
|
|
19522
|
+
var import_react26 = require("react");
|
|
19055
19523
|
var import_lottie_web = __toESM(require_lottie(), 1);
|
|
19056
19524
|
function useLottie({
|
|
19057
19525
|
animationData: animationData2,
|
|
@@ -19066,17 +19534,17 @@ function useLottie({
|
|
|
19066
19534
|
onLoopComplete,
|
|
19067
19535
|
onEnterFrame
|
|
19068
19536
|
}) {
|
|
19069
|
-
const containerRef = (0,
|
|
19070
|
-
const animationRef = (0,
|
|
19071
|
-
const onAnimationLoadedRef = (0,
|
|
19072
|
-
const onCompleteRef = (0,
|
|
19073
|
-
const onLoopCompleteRef = (0,
|
|
19074
|
-
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);
|
|
19075
19543
|
onAnimationLoadedRef.current = onAnimationLoaded;
|
|
19076
19544
|
onCompleteRef.current = onComplete;
|
|
19077
19545
|
onLoopCompleteRef.current = onLoopComplete;
|
|
19078
19546
|
onEnterFrameRef.current = onEnterFrame;
|
|
19079
|
-
(0,
|
|
19547
|
+
(0, import_react26.useEffect)(() => {
|
|
19080
19548
|
if (!containerRef.current) return;
|
|
19081
19549
|
const anim = import_lottie_web.default.loadAnimation({
|
|
19082
19550
|
container: containerRef.current,
|
|
@@ -19168,8 +19636,8 @@ function createLottieRef(animationRef) {
|
|
|
19168
19636
|
}
|
|
19169
19637
|
|
|
19170
19638
|
// src/components/lottie/lottie.tsx
|
|
19171
|
-
var
|
|
19172
|
-
var Lottie = (0,
|
|
19639
|
+
var import_jsx_runtime36 = require("react/jsx-runtime");
|
|
19640
|
+
var Lottie = (0, import_react27.forwardRef)(function Lottie2({
|
|
19173
19641
|
animationData: animationData2,
|
|
19174
19642
|
autoplay,
|
|
19175
19643
|
loop,
|
|
@@ -19199,8 +19667,8 @@ var Lottie = (0, import_react22.forwardRef)(function Lottie2({
|
|
|
19199
19667
|
onLoopComplete,
|
|
19200
19668
|
onEnterFrame
|
|
19201
19669
|
});
|
|
19202
|
-
(0,
|
|
19203
|
-
return /* @__PURE__ */ (0,
|
|
19670
|
+
(0, import_react27.useImperativeHandle)(ref, () => createLottieRef(animationRef), [animationRef]);
|
|
19671
|
+
return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
19204
19672
|
LottieContainer,
|
|
19205
19673
|
{
|
|
19206
19674
|
ref: containerRef,
|
|
@@ -19213,81 +19681,6 @@ var Lottie = (0, import_react22.forwardRef)(function Lottie2({
|
|
|
19213
19681
|
);
|
|
19214
19682
|
});
|
|
19215
19683
|
|
|
19216
|
-
// src/components/text-area/text-area.tsx
|
|
19217
|
-
var import_react23 = require("react");
|
|
19218
|
-
|
|
19219
|
-
// src/utils/merge-refs.ts
|
|
19220
|
-
function mergeRefs(...refs) {
|
|
19221
|
-
return (node) => {
|
|
19222
|
-
for (const ref of refs) {
|
|
19223
|
-
if (typeof ref === "function") {
|
|
19224
|
-
ref(node);
|
|
19225
|
-
} else if (ref) {
|
|
19226
|
-
ref.current = node;
|
|
19227
|
-
}
|
|
19228
|
-
}
|
|
19229
|
-
};
|
|
19230
|
-
}
|
|
19231
|
-
|
|
19232
|
-
// src/components/text-area/text-area-styles.ts
|
|
19233
|
-
var import_styled_components9 = __toESM(require("styled-components"), 1);
|
|
19234
|
-
init_colors();
|
|
19235
|
-
var StyledTextArea = import_styled_components9.default.textarea`
|
|
19236
|
-
${typographyMixin(typographyTypes.GEIST_BODY_S_REGULAR)};
|
|
19237
|
-
color: ${colors["brown-100"]};
|
|
19238
|
-
border: none;
|
|
19239
|
-
outline: none;
|
|
19240
|
-
resize: none;
|
|
19241
|
-
width: 100%;
|
|
19242
|
-
background: transparent;
|
|
19243
|
-
vertical-align: bottom;
|
|
19244
|
-
max-height: ${({ $maxHeight }) => $maxHeight ? `${$maxHeight}px` : "none"};
|
|
19245
|
-
overflow-y: ${({ $maxHeight }) => $maxHeight ? "auto" : "hidden"};
|
|
19246
|
-
|
|
19247
|
-
&::placeholder {
|
|
19248
|
-
color: ${colors["brown-50"]};
|
|
19249
|
-
}
|
|
19250
|
-
|
|
19251
|
-
&:disabled {
|
|
19252
|
-
opacity: 0.5;
|
|
19253
|
-
cursor: not-allowed;
|
|
19254
|
-
}
|
|
19255
|
-
`;
|
|
19256
|
-
|
|
19257
|
-
// src/components/text-area/text-area.tsx
|
|
19258
|
-
var import_jsx_runtime32 = require("react/jsx-runtime");
|
|
19259
|
-
var TextArea = (0, import_react23.forwardRef)(function TextArea2({ value: value2, onChange, placeholder, maxHeight, rows = 1, autoFocus, onKeyDown, disabled, className }, externalRef) {
|
|
19260
|
-
const internalRef = (0, import_react23.useRef)(null);
|
|
19261
|
-
(0, import_react23.useLayoutEffect)(() => {
|
|
19262
|
-
const el = internalRef.current;
|
|
19263
|
-
if (el) {
|
|
19264
|
-
el.style.height = "auto";
|
|
19265
|
-
el.style.height = `${el.scrollHeight}px`;
|
|
19266
|
-
}
|
|
19267
|
-
}, [value2]);
|
|
19268
|
-
const handleChange = (0, import_react23.useCallback)(
|
|
19269
|
-
(e) => {
|
|
19270
|
-
onChange(e.target.value);
|
|
19271
|
-
},
|
|
19272
|
-
[onChange]
|
|
19273
|
-
);
|
|
19274
|
-
return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
19275
|
-
StyledTextArea,
|
|
19276
|
-
{
|
|
19277
|
-
ref: mergeRefs(internalRef, externalRef),
|
|
19278
|
-
value: value2,
|
|
19279
|
-
onChange: handleChange,
|
|
19280
|
-
placeholder,
|
|
19281
|
-
$maxHeight: maxHeight,
|
|
19282
|
-
rows,
|
|
19283
|
-
autoFocus,
|
|
19284
|
-
onKeyDown,
|
|
19285
|
-
disabled,
|
|
19286
|
-
className
|
|
19287
|
-
}
|
|
19288
|
-
);
|
|
19289
|
-
});
|
|
19290
|
-
|
|
19291
19684
|
// src/utils/parse-markdown-table.ts
|
|
19292
19685
|
function parseCells(line) {
|
|
19293
19686
|
const trimmed = line.trim();
|
|
@@ -19358,165 +19751,6 @@ function convertTableToCSV(table) {
|
|
|
19358
19751
|
const dataRows = table.rows.map((row) => row.map(escapeCsvField).join(","));
|
|
19359
19752
|
return [headerRow, ...dataRows].join("\r\n");
|
|
19360
19753
|
}
|
|
19361
|
-
|
|
19362
|
-
// src/components/button/button.tsx
|
|
19363
|
-
var import_react24 = require("react");
|
|
19364
|
-
|
|
19365
|
-
// src/components/button/button-styles.ts
|
|
19366
|
-
var import_styled_components10 = __toESM(require("styled-components"), 1);
|
|
19367
|
-
init_colors();
|
|
19368
|
-
|
|
19369
|
-
// src/components/button/constants.ts
|
|
19370
|
-
var BUTTON_VARIANT = {
|
|
19371
|
-
SOLID: "solid",
|
|
19372
|
-
OUTLINE: "outline",
|
|
19373
|
-
GHOST: "ghost"
|
|
19374
|
-
};
|
|
19375
|
-
var BUTTON_SIZE = {
|
|
19376
|
-
XS: "xs",
|
|
19377
|
-
S: "s",
|
|
19378
|
-
M: "m"
|
|
19379
|
-
};
|
|
19380
|
-
var BUTTON_INTENT = {
|
|
19381
|
-
PRIMARY: "primary",
|
|
19382
|
-
ERROR: "error"
|
|
19383
|
-
};
|
|
19384
|
-
var ICON_POSITION = {
|
|
19385
|
-
LEADING: "leading",
|
|
19386
|
-
TRAILING: "trailing"
|
|
19387
|
-
};
|
|
19388
|
-
|
|
19389
|
-
// src/components/button/button-styles.ts
|
|
19390
|
-
var intentColors = {
|
|
19391
|
-
[BUTTON_INTENT.PRIMARY]: {
|
|
19392
|
-
base: colors["brown-100"],
|
|
19393
|
-
hover: colors["brown-90"],
|
|
19394
|
-
disabledBg: colors["brown-20"],
|
|
19395
|
-
disabledText: colors["brown-50"],
|
|
19396
|
-
subtleHover: colors["brown-20"],
|
|
19397
|
-
border: colors["brown-40"],
|
|
19398
|
-
disabledBorder: colors["brown-20"]
|
|
19399
|
-
},
|
|
19400
|
-
[BUTTON_INTENT.ERROR]: {
|
|
19401
|
-
base: colors["red-500"],
|
|
19402
|
-
hover: colors["red-600"],
|
|
19403
|
-
disabledBg: colors["red-100"],
|
|
19404
|
-
disabledText: colors["red-200"],
|
|
19405
|
-
subtleHover: colors["red-50"],
|
|
19406
|
-
border: colors["red-200"],
|
|
19407
|
-
disabledBorder: colors["red-100"]
|
|
19408
|
-
}
|
|
19409
|
-
};
|
|
19410
|
-
var sizeValues = {
|
|
19411
|
-
[BUTTON_SIZE.XS]: { padding: "6px 10px", borderRadius: "8px", gap: "4px" },
|
|
19412
|
-
[BUTTON_SIZE.S]: { padding: "8px 12px", borderRadius: "10px", gap: "6px" },
|
|
19413
|
-
[BUTTON_SIZE.M]: { padding: "10px 14px", borderRadius: "10px", gap: "6px" }
|
|
19414
|
-
};
|
|
19415
|
-
function sizeMixin({ $size }) {
|
|
19416
|
-
const s = sizeValues[$size];
|
|
19417
|
-
return import_styled_components10.css`
|
|
19418
|
-
padding: ${s.padding};
|
|
19419
|
-
border-radius: ${s.borderRadius};
|
|
19420
|
-
gap: ${s.gap};
|
|
19421
|
-
`;
|
|
19422
|
-
}
|
|
19423
|
-
var variantColorMap = {
|
|
19424
|
-
[BUTTON_VARIANT.SOLID]: (c) => ({
|
|
19425
|
-
background: c.base,
|
|
19426
|
-
color: colors.white,
|
|
19427
|
-
border: "none",
|
|
19428
|
-
hoverBg: c.hover,
|
|
19429
|
-
disabledBg: c.disabledBg,
|
|
19430
|
-
disabledColor: c.disabledText
|
|
19431
|
-
}),
|
|
19432
|
-
[BUTTON_VARIANT.OUTLINE]: (c) => ({
|
|
19433
|
-
background: colors.white,
|
|
19434
|
-
color: c.base,
|
|
19435
|
-
border: `1px solid ${c.border}`,
|
|
19436
|
-
hoverBg: c.subtleHover,
|
|
19437
|
-
disabledColor: c.disabledText,
|
|
19438
|
-
disabledBorder: c.disabledBorder
|
|
19439
|
-
}),
|
|
19440
|
-
[BUTTON_VARIANT.GHOST]: (c) => ({
|
|
19441
|
-
background: "transparent",
|
|
19442
|
-
color: c.base,
|
|
19443
|
-
border: "none",
|
|
19444
|
-
hoverBg: c.subtleHover,
|
|
19445
|
-
disabledColor: c.disabledText
|
|
19446
|
-
})
|
|
19447
|
-
};
|
|
19448
|
-
function variantMixin({
|
|
19449
|
-
$variant,
|
|
19450
|
-
$intent
|
|
19451
|
-
}) {
|
|
19452
|
-
const v = variantColorMap[$variant](intentColors[$intent]);
|
|
19453
|
-
return import_styled_components10.css`
|
|
19454
|
-
background: ${v.background};
|
|
19455
|
-
color: ${v.color};
|
|
19456
|
-
border: ${v.border};
|
|
19457
|
-
|
|
19458
|
-
&:hover:not(:disabled) {
|
|
19459
|
-
background: ${v.hoverBg};
|
|
19460
|
-
}
|
|
19461
|
-
|
|
19462
|
-
&:disabled {
|
|
19463
|
-
color: ${v.disabledColor};
|
|
19464
|
-
${v.disabledBg ? `background: ${v.disabledBg};` : ""}
|
|
19465
|
-
${v.disabledBorder ? `border-color: ${v.disabledBorder};` : ""}
|
|
19466
|
-
}
|
|
19467
|
-
`;
|
|
19468
|
-
}
|
|
19469
|
-
var StyledButton = import_styled_components10.default.button`
|
|
19470
|
-
display: inline-flex;
|
|
19471
|
-
align-items: center;
|
|
19472
|
-
justify-content: center;
|
|
19473
|
-
cursor: pointer;
|
|
19474
|
-
${typographyMixin(typographyTypes.GEIST_BODY_XS_MEDIUM)};
|
|
19475
|
-
transition: background-color 150ms ease, border-color 150ms ease, color 150ms ease;
|
|
19476
|
-
|
|
19477
|
-
&:disabled {
|
|
19478
|
-
cursor: not-allowed;
|
|
19479
|
-
}
|
|
19480
|
-
|
|
19481
|
-
${sizeMixin}
|
|
19482
|
-
${variantMixin}
|
|
19483
|
-
`;
|
|
19484
|
-
|
|
19485
|
-
// src/components/button/button.tsx
|
|
19486
|
-
var import_jsx_runtime33 = require("react/jsx-runtime");
|
|
19487
|
-
var Button2 = (0, import_react24.forwardRef)(function Button3({
|
|
19488
|
-
children,
|
|
19489
|
-
variant = BUTTON_VARIANT.SOLID,
|
|
19490
|
-
intent = BUTTON_INTENT.PRIMARY,
|
|
19491
|
-
size = BUTTON_SIZE.M,
|
|
19492
|
-
icon,
|
|
19493
|
-
iconPosition = ICON_POSITION.LEADING,
|
|
19494
|
-
disabled = false,
|
|
19495
|
-
onClick,
|
|
19496
|
-
className,
|
|
19497
|
-
"aria-label": ariaLabel
|
|
19498
|
-
}, ref) {
|
|
19499
|
-
const iconElement = icon ? /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(Icon, { icon, size: 16 }) : null;
|
|
19500
|
-
return /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(
|
|
19501
|
-
StyledButton,
|
|
19502
|
-
{
|
|
19503
|
-
ref,
|
|
19504
|
-
type: "button",
|
|
19505
|
-
$variant: variant,
|
|
19506
|
-
$intent: intent,
|
|
19507
|
-
$size: size,
|
|
19508
|
-
disabled,
|
|
19509
|
-
onClick: disabled ? void 0 : onClick,
|
|
19510
|
-
className,
|
|
19511
|
-
"aria-label": ariaLabel,
|
|
19512
|
-
children: [
|
|
19513
|
-
iconPosition === ICON_POSITION.LEADING && iconElement,
|
|
19514
|
-
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)("span", { children }),
|
|
19515
|
-
iconPosition === ICON_POSITION.TRAILING && iconElement
|
|
19516
|
-
]
|
|
19517
|
-
}
|
|
19518
|
-
);
|
|
19519
|
-
});
|
|
19520
19754
|
// Annotate the CommonJS export names for ESM import in node:
|
|
19521
19755
|
0 && (module.exports = {
|
|
19522
19756
|
ArtifactCopyAsImageButton,
|
|
@@ -19532,6 +19766,7 @@ var Button2 = (0, import_react24.forwardRef)(function Button3({
|
|
|
19532
19766
|
BlockContext,
|
|
19533
19767
|
BlockServices,
|
|
19534
19768
|
Button,
|
|
19769
|
+
CHAT_STATUS,
|
|
19535
19770
|
ChartArtifact,
|
|
19536
19771
|
ChatContext,
|
|
19537
19772
|
ChatMessage,
|
|
@@ -19545,6 +19780,14 @@ var Button2 = (0, import_react24.forwardRef)(function Button3({
|
|
|
19545
19780
|
KeyboardShortcut,
|
|
19546
19781
|
Lottie,
|
|
19547
19782
|
MESSAGE_ROLE,
|
|
19783
|
+
MouseGrid,
|
|
19784
|
+
PromptInput,
|
|
19785
|
+
PromptInputFooter,
|
|
19786
|
+
PromptInputSubmit,
|
|
19787
|
+
PromptInputTextarea,
|
|
19788
|
+
PromptInputTools,
|
|
19789
|
+
Suggestion,
|
|
19790
|
+
Suggestions,
|
|
19548
19791
|
TableArtifact,
|
|
19549
19792
|
TextArea,
|
|
19550
19793
|
TextBlockService,
|