@shapesos/clay 0.8.2 → 0.10.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/index.cjs CHANGED
@@ -16342,8 +16342,12 @@ var require_lottie = __commonJS({
16342
16342
  // src/index.ts
16343
16343
  var src_exports = {};
16344
16344
  __export(src_exports, {
16345
+ BUTTON_INTENT: () => BUTTON_INTENT,
16345
16346
  BUTTON_SIZE: () => BUTTON_SIZE,
16346
16347
  BUTTON_VARIANT: () => BUTTON_VARIANT,
16348
+ Block: () => Block,
16349
+ BlockContext: () => BlockContext,
16350
+ BlockServices: () => BlockServices,
16347
16351
  Button: () => Button2,
16348
16352
  ChatContext: () => ChatContext,
16349
16353
  ChatMessage: () => ChatMessage,
@@ -16356,6 +16360,8 @@ __export(src_exports, {
16356
16360
  Lottie: () => Lottie,
16357
16361
  MESSAGE_ROLE: () => MESSAGE_ROLE,
16358
16362
  TextArea: () => TextArea,
16363
+ TextBlockService: () => TextBlockService,
16364
+ blockTypes: () => blockTypes,
16359
16365
  colors: () => colors,
16360
16366
  convertTableToCSV: () => convertTableToCSV,
16361
16367
  fontFamilies: () => fontFamilies,
@@ -16365,6 +16371,7 @@ __export(src_exports, {
16365
16371
  typographyMixin: () => typographyMixin,
16366
16372
  typographyStyles: () => typographyStyles,
16367
16373
  typographyTypes: () => typographyTypes,
16374
+ useBlockContext: () => useBlockContext,
16368
16375
  useChatContext: () => useChatContext,
16369
16376
  useCopyToClipboard: () => useCopyToClipboard
16370
16377
  });
@@ -16753,26 +16760,19 @@ function typographyMixin(type) {
16753
16760
  ].join(";\n ");
16754
16761
  }
16755
16762
 
16756
- // src/components/chat/chat-message-content/chat-message-content.tsx
16763
+ // src/components/blocks/text-block/text-block.tsx
16757
16764
  var import_react_markdown = __toESM(require("react-markdown"), 1);
16758
16765
  var import_remark_breaks = __toESM(require("remark-breaks"), 1);
16759
16766
  var import_remark_gfm = __toESM(require("remark-gfm"), 1);
16760
16767
 
16761
- // src/components/chat/scrollable-table/scrollable-table.tsx
16762
- var import_react2 = require("react");
16763
-
16764
- // src/components/chat/chat-context/chat-context.ts
16768
+ // src/components/blocks/block-context/block-context.tsx
16765
16769
  var import_react = require("react");
16766
- var ChatContext = (0, import_react.createContext)(null);
16767
- function useChatContext() {
16768
- const context = (0, import_react.useContext)(ChatContext);
16769
- if (!context) {
16770
- throw new Error("useChatContext must be used within a Chat.Root component");
16771
- }
16772
- return context;
16770
+ var BlockContext = (0, import_react.createContext)(null);
16771
+ function useBlockContext() {
16772
+ return (0, import_react.useContext)(BlockContext) ?? {};
16773
16773
  }
16774
16774
 
16775
- // src/components/chat/scrollable-table/scrollable-table-styles.ts
16775
+ // src/components/blocks/scrollable-table/scrollable-table-styles.ts
16776
16776
  var import_styled_components = __toESM(require("styled-components"), 1);
16777
16777
  var TableContainer = import_styled_components.default.div`
16778
16778
  position: relative;
@@ -16794,27 +16794,34 @@ var TableActionsDivider = import_styled_components.default.div`
16794
16794
  margin-block: 8px 0;
16795
16795
  `;
16796
16796
 
16797
- // src/components/chat/scrollable-table/scrollable-table.tsx
16797
+ // src/components/blocks/scrollable-table/scrollable-table.tsx
16798
16798
  var import_jsx_runtime = require("react/jsx-runtime");
16799
- function ScrollableTable({ node: _node, messageId, counter, ...props }) {
16799
+ function ScrollableTable({ node: _node, counter, ...props }) {
16800
16800
  const currentIndex = counter ? counter.value : 0;
16801
16801
  if (counter) {
16802
16802
  counter.value += 1;
16803
16803
  }
16804
- const context = (0, import_react2.useContext)(ChatContext);
16805
- const TableActions = context?.TableActions;
16804
+ const { TableActions } = useBlockContext();
16806
16805
  return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(TableContainer, { children: [
16807
16806
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TableScroll, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("table", { ...props }) }),
16808
- TableActions && messageId && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
16809
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TableActionsWrapper, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TableActions, { messageId, tableIndex: currentIndex }) }),
16807
+ TableActions && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
16808
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TableActionsWrapper, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TableActions, { tableIndex: currentIndex }) }),
16810
16809
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TableActionsDivider, {})
16811
16810
  ] })
16812
16811
  ] });
16813
16812
  }
16814
16813
 
16815
- // src/components/chat/chat-message-content/chat-message-content-styles.ts
16814
+ // src/components/blocks/text-block/sanitize.ts
16815
+ function sanitize(text2) {
16816
+ return text2.split("\n").filter((line) => {
16817
+ const t = line.trim();
16818
+ return !(t.startsWith("<!-- table-title:") && t.endsWith("-->"));
16819
+ }).join("\n");
16820
+ }
16821
+
16822
+ // src/components/blocks/text-block/text-block-styles.ts
16816
16823
  var import_styled_components2 = __toESM(require("styled-components"), 1);
16817
- var ContentWrapper = import_styled_components2.default.div`
16824
+ var TextBlockWrapper = import_styled_components2.default.div`
16818
16825
  ${typographyMixin(typographyTypes.GEIST_BODY_S_REGULAR)};
16819
16826
  color: ${colors["brown-100"]};
16820
16827
  word-break: break-word;
@@ -16931,18 +16938,53 @@ var ContentWrapper = import_styled_components2.default.div`
16931
16938
  }
16932
16939
  `;
16933
16940
 
16934
- // src/components/chat/chat-message-content/chat-message-content.tsx
16941
+ // src/components/blocks/text-block/text-block.tsx
16935
16942
  var import_jsx_runtime2 = require("react/jsx-runtime");
16936
- function ChatMessageContent({ content: content2, messageId }) {
16943
+ function TextBlock({ block }) {
16937
16944
  const counter = { value: 0 };
16938
- const sanitizedContent = content2.split("\n").filter((line) => {
16939
- const t = line.trim();
16940
- return !(t.startsWith("<!-- table-title:") && t.endsWith("-->"));
16941
- }).join("\n");
16942
16945
  const markdownComponents = {
16943
- table: ((tableProps) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(ScrollableTable, { ...tableProps, messageId, counter }))
16946
+ table: ((tableProps) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(ScrollableTable, { ...tableProps, counter }))
16944
16947
  };
16945
- return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(ContentWrapper, { children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_react_markdown.default, { remarkPlugins: [import_remark_gfm.default, import_remark_breaks.default], components: markdownComponents, children: sanitizedContent }) });
16948
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(TextBlockWrapper, { children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_react_markdown.default, { remarkPlugins: [import_remark_gfm.default, import_remark_breaks.default], components: markdownComponents, children: sanitize(block.payload.text) }) });
16949
+ }
16950
+
16951
+ // src/components/blocks/types.ts
16952
+ var blockTypes = {
16953
+ TEXT: "TEXT"
16954
+ };
16955
+
16956
+ // src/components/blocks/block-services/text-block-service.ts
16957
+ var TextBlockService = {
16958
+ type: blockTypes.TEXT,
16959
+ Component: TextBlock
16960
+ };
16961
+
16962
+ // src/components/blocks/block-services/index.ts
16963
+ var BlockServices = {
16964
+ [TextBlockService.type]: TextBlockService
16965
+ };
16966
+
16967
+ // src/components/blocks/block/block.tsx
16968
+ var import_jsx_runtime3 = require("react/jsx-runtime");
16969
+ function Block({ block }) {
16970
+ const service = BlockServices[block.type];
16971
+ if (!service) return null;
16972
+ const { Component } = service;
16973
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Component, { block });
16974
+ }
16975
+
16976
+ // src/components/chat/chat-message/chat-message.tsx
16977
+ var import_react7 = require("react");
16978
+
16979
+ // src/components/chat/chat-context/chat-context.ts
16980
+ var import_react2 = require("react");
16981
+ var ChatContext = (0, import_react2.createContext)(null);
16982
+ function useChatContext() {
16983
+ const context = (0, import_react2.useContext)(ChatContext);
16984
+ if (!context) {
16985
+ throw new Error("useChatContext must be used within a Chat.Root component");
16986
+ }
16987
+ return context;
16946
16988
  }
16947
16989
 
16948
16990
  // src/components/chat/chat-message-actions/chat-message-actions.tsx
@@ -17046,10 +17088,10 @@ var IconWrapper = import_styled_components3.default.span`
17046
17088
  `;
17047
17089
 
17048
17090
  // src/components/icon/icon.tsx
17049
- var import_jsx_runtime3 = require("react/jsx-runtime");
17091
+ var import_jsx_runtime4 = require("react/jsx-runtime");
17050
17092
  var DEFAULT_SIZE = 16;
17051
17093
  var Icon = (0, import_react4.forwardRef)(function Icon2({ icon: IconComponent, size = DEFAULT_SIZE, color, className, "aria-label": ariaLabel }, ref) {
17052
- return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
17094
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
17053
17095
  IconWrapper,
17054
17096
  {
17055
17097
  ref,
@@ -17057,7 +17099,7 @@ var Icon = (0, import_react4.forwardRef)(function Icon2({ icon: IconComponent, s
17057
17099
  $color: color,
17058
17100
  "aria-label": ariaLabel,
17059
17101
  role: ariaLabel ? "img" : void 0,
17060
- children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(IconComponent, { width: size, height: size, strokeWidth: getStrokeWidth(size) })
17102
+ children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(IconComponent, { width: size, height: size, strokeWidth: getStrokeWidth(size) })
17061
17103
  }
17062
17104
  );
17063
17105
  });
@@ -17106,7 +17148,7 @@ var Button = import_styled_components4.default.button`
17106
17148
  `;
17107
17149
 
17108
17150
  // src/components/icon-button/icon-button.tsx
17109
- var import_jsx_runtime4 = require("react/jsx-runtime");
17151
+ var import_jsx_runtime5 = require("react/jsx-runtime");
17110
17152
  var ICON_SIZE_BY_BUTTON_SIZE = {
17111
17153
  small: 16,
17112
17154
  medium: 20
@@ -17123,7 +17165,7 @@ function IconButton({
17123
17165
  as,
17124
17166
  "aria-label": ariaLabel
17125
17167
  }) {
17126
- return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
17168
+ return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
17127
17169
  Button,
17128
17170
  {
17129
17171
  className,
@@ -17135,7 +17177,7 @@ function IconButton({
17135
17177
  disabled,
17136
17178
  onClick: disabled ? void 0 : onClick,
17137
17179
  "aria-label": ariaLabel,
17138
- children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Icon, { icon, size: ICON_SIZE_BY_BUTTON_SIZE[size] })
17180
+ children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Icon, { icon, size: ICON_SIZE_BY_BUTTON_SIZE[size] })
17139
17181
  }
17140
17182
  );
17141
17183
  }
@@ -17220,7 +17262,7 @@ var AnimatedAction = import_styled_components5.default.div`
17220
17262
  `;
17221
17263
 
17222
17264
  // src/components/chat/chat-message-actions/chat-message-actions.tsx
17223
- var import_jsx_runtime5 = require("react/jsx-runtime");
17265
+ var import_jsx_runtime6 = require("react/jsx-runtime");
17224
17266
  function ChatMessageActions({ className, messageId, content: content2, role, isHelpful }) {
17225
17267
  const { onCopyMessage, onThumbUpClick, onThumbDownClick } = useChatContext();
17226
17268
  const { isCopied, copy } = useCopyToClipboard();
@@ -17236,8 +17278,8 @@ function ChatMessageActions({ className, messageId, content: content2, role, isH
17236
17278
  }, [messageId, isHelpful, onThumbDownClick]);
17237
17279
  const isAssistant = role === MESSAGE_ROLE.ASSISTANT;
17238
17280
  const hasFeedback = isAssistant && (onThumbUpClick || onThumbDownClick);
17239
- return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(ActionsContainer, { $role: role, className, children: [
17240
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
17281
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(ActionsContainer, { $role: role, className, children: [
17282
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
17241
17283
  IconButton,
17242
17284
  {
17243
17285
  icon: isCopied ? IconCheck : IconCopy,
@@ -17245,7 +17287,7 @@ function ChatMessageActions({ className, messageId, content: content2, role, isH
17245
17287
  "aria-label": isCopied ? "Copied" : "Copy message"
17246
17288
  }
17247
17289
  ),
17248
- hasFeedback && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(AnimatedAction, { $visible: isHelpful !== false, children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
17290
+ hasFeedback && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(AnimatedAction, { $visible: isHelpful !== false, children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
17249
17291
  IconButton,
17250
17292
  {
17251
17293
  icon: IconThumbUp,
@@ -17254,7 +17296,7 @@ function ChatMessageActions({ className, messageId, content: content2, role, isH
17254
17296
  "aria-label": "Good response"
17255
17297
  }
17256
17298
  ) }),
17257
- hasFeedback && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(AnimatedAction, { $visible: isHelpful !== true, children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
17299
+ hasFeedback && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(AnimatedAction, { $visible: isHelpful !== true, children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
17258
17300
  IconButton,
17259
17301
  {
17260
17302
  icon: IconThumbDown,
@@ -17296,15 +17338,22 @@ var MessageBubble = import_styled_components6.default.div`
17296
17338
  `;
17297
17339
 
17298
17340
  // src/components/chat/chat-message/chat-message.tsx
17299
- var import_jsx_runtime6 = require("react/jsx-runtime");
17341
+ var import_jsx_runtime7 = require("react/jsx-runtime");
17300
17342
  function ChatMessage({ message }) {
17301
- return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(MessageRow, { $role: message.role, role: "article", "aria-label": `${message.role} message`, children: /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(MessageContainer, { $role: message.role, children: [
17302
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(MessageBubble, { $role: message.role, children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(ChatMessageContent, { content: message.content, messageId: message.id }) }),
17303
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
17343
+ const { TableActions: ChatTableActions } = useChatContext();
17344
+ const blockContextValue = (0, import_react7.useMemo)(
17345
+ () => ({
17346
+ TableActions: ChatTableActions ? ({ tableIndex }) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(ChatTableActions, { messageId: message.id, tableIndex }) : void 0
17347
+ }),
17348
+ [ChatTableActions, message.id]
17349
+ );
17350
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(MessageRow, { $role: message.role, role: "article", "aria-label": `${message.role} message`, children: /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(MessageContainer, { $role: message.role, children: [
17351
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(MessageBubble, { $role: message.role, children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(BlockContext.Provider, { value: blockContextValue, children: message.blocks.map((block, index2) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Block, { block }, index2)) }) }),
17352
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
17304
17353
  ChatMessageActions,
17305
17354
  {
17306
17355
  messageId: message.id,
17307
- content: message.content,
17356
+ content: message.fallbackText,
17308
17357
  role: message.role,
17309
17358
  isHelpful: message.isHelpful
17310
17359
  }
@@ -17349,20 +17398,20 @@ var Key = import_styled_components7.default.kbd`
17349
17398
  `;
17350
17399
 
17351
17400
  // src/components/keyboard-shortcut/keyboard-shortcut.tsx
17352
- var import_jsx_runtime7 = require("react/jsx-runtime");
17401
+ var import_jsx_runtime8 = require("react/jsx-runtime");
17353
17402
  function KeyboardShortcut({
17354
17403
  keys,
17355
17404
  variant = KEYBOARD_SHORTCUT_VARIANTS.OUTLINED,
17356
17405
  className
17357
17406
  }) {
17358
- return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Wrapper, { className, children: keys.map((KeyComponent, index2) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Key, { $variant: variant, children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Icon, { icon: KeyComponent, size: 12 }) }, index2)) });
17407
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Wrapper, { className, children: keys.map((KeyComponent, index2) => /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Key, { $variant: variant, children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Icon, { icon: KeyComponent, size: 12 }) }, index2)) });
17359
17408
  }
17360
17409
 
17361
17410
  // src/components/keyboard-shortcut/icons/icon-ctrl.tsx
17362
- var import_jsx_runtime8 = require("react/jsx-runtime");
17411
+ var import_jsx_runtime9 = require("react/jsx-runtime");
17363
17412
  function IconCtrl(props) {
17364
17413
  const { width: width2 = 24, height: height2 = 24, ...rest } = props;
17365
- return /* @__PURE__ */ (0, import_jsx_runtime8.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_runtime8.jsx)(
17414
+ return /* @__PURE__ */ (0, import_jsx_runtime9.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_runtime9.jsx)(
17366
17415
  "text",
17367
17416
  {
17368
17417
  x: "50%",
@@ -17379,7 +17428,7 @@ function IconCtrl(props) {
17379
17428
  }
17380
17429
 
17381
17430
  // src/components/lottie/lottie.tsx
17382
- var import_react8 = require("react");
17431
+ var import_react9 = require("react");
17383
17432
 
17384
17433
  // src/components/lottie/lottie-styles.ts
17385
17434
  var import_styled_components8 = __toESM(require("styled-components"), 1);
@@ -17395,7 +17444,7 @@ var LottieContainer = import_styled_components8.default.div`
17395
17444
  `;
17396
17445
 
17397
17446
  // src/components/lottie/use-lottie.ts
17398
- var import_react7 = require("react");
17447
+ var import_react8 = require("react");
17399
17448
  var import_lottie_web = __toESM(require_lottie(), 1);
17400
17449
  function useLottie({
17401
17450
  animationData: animationData2,
@@ -17410,17 +17459,17 @@ function useLottie({
17410
17459
  onLoopComplete,
17411
17460
  onEnterFrame
17412
17461
  }) {
17413
- const containerRef = (0, import_react7.useRef)(null);
17414
- const animationRef = (0, import_react7.useRef)(null);
17415
- const onAnimationLoadedRef = (0, import_react7.useRef)(onAnimationLoaded);
17416
- const onCompleteRef = (0, import_react7.useRef)(onComplete);
17417
- const onLoopCompleteRef = (0, import_react7.useRef)(onLoopComplete);
17418
- const onEnterFrameRef = (0, import_react7.useRef)(onEnterFrame);
17462
+ const containerRef = (0, import_react8.useRef)(null);
17463
+ const animationRef = (0, import_react8.useRef)(null);
17464
+ const onAnimationLoadedRef = (0, import_react8.useRef)(onAnimationLoaded);
17465
+ const onCompleteRef = (0, import_react8.useRef)(onComplete);
17466
+ const onLoopCompleteRef = (0, import_react8.useRef)(onLoopComplete);
17467
+ const onEnterFrameRef = (0, import_react8.useRef)(onEnterFrame);
17419
17468
  onAnimationLoadedRef.current = onAnimationLoaded;
17420
17469
  onCompleteRef.current = onComplete;
17421
17470
  onLoopCompleteRef.current = onLoopComplete;
17422
17471
  onEnterFrameRef.current = onEnterFrame;
17423
- (0, import_react7.useEffect)(() => {
17472
+ (0, import_react8.useEffect)(() => {
17424
17473
  if (!containerRef.current) return;
17425
17474
  const anim = import_lottie_web.default.loadAnimation({
17426
17475
  container: containerRef.current,
@@ -17512,8 +17561,8 @@ function createLottieRef(animationRef) {
17512
17561
  }
17513
17562
 
17514
17563
  // src/components/lottie/lottie.tsx
17515
- var import_jsx_runtime9 = require("react/jsx-runtime");
17516
- var Lottie = (0, import_react8.forwardRef)(function Lottie2({
17564
+ var import_jsx_runtime10 = require("react/jsx-runtime");
17565
+ var Lottie = (0, import_react9.forwardRef)(function Lottie2({
17517
17566
  animationData: animationData2,
17518
17567
  autoplay,
17519
17568
  loop,
@@ -17543,8 +17592,8 @@ var Lottie = (0, import_react8.forwardRef)(function Lottie2({
17543
17592
  onLoopComplete,
17544
17593
  onEnterFrame
17545
17594
  });
17546
- (0, import_react8.useImperativeHandle)(ref, () => createLottieRef(animationRef), [animationRef]);
17547
- return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
17595
+ (0, import_react9.useImperativeHandle)(ref, () => createLottieRef(animationRef), [animationRef]);
17596
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
17548
17597
  LottieContainer,
17549
17598
  {
17550
17599
  ref: containerRef,
@@ -17558,7 +17607,7 @@ var Lottie = (0, import_react8.forwardRef)(function Lottie2({
17558
17607
  });
17559
17608
 
17560
17609
  // src/components/text-area/text-area.tsx
17561
- var import_react9 = require("react");
17610
+ var import_react10 = require("react");
17562
17611
 
17563
17612
  // src/utils/merge-refs.ts
17564
17613
  function mergeRefs(...refs) {
@@ -17598,23 +17647,23 @@ var StyledTextArea = import_styled_components9.default.textarea`
17598
17647
  `;
17599
17648
 
17600
17649
  // src/components/text-area/text-area.tsx
17601
- var import_jsx_runtime10 = require("react/jsx-runtime");
17602
- var TextArea = (0, import_react9.forwardRef)(function TextArea2({ value: value2, onChange, placeholder, maxHeight, rows = 1, autoFocus, onKeyDown, disabled, className }, externalRef) {
17603
- const internalRef = (0, import_react9.useRef)(null);
17604
- (0, import_react9.useLayoutEffect)(() => {
17650
+ var import_jsx_runtime11 = require("react/jsx-runtime");
17651
+ var TextArea = (0, import_react10.forwardRef)(function TextArea2({ value: value2, onChange, placeholder, maxHeight, rows = 1, autoFocus, onKeyDown, disabled, className }, externalRef) {
17652
+ const internalRef = (0, import_react10.useRef)(null);
17653
+ (0, import_react10.useLayoutEffect)(() => {
17605
17654
  const el = internalRef.current;
17606
17655
  if (el) {
17607
17656
  el.style.height = "auto";
17608
17657
  el.style.height = `${el.scrollHeight}px`;
17609
17658
  }
17610
17659
  }, [value2]);
17611
- const handleChange = (0, import_react9.useCallback)(
17660
+ const handleChange = (0, import_react10.useCallback)(
17612
17661
  (e) => {
17613
17662
  onChange(e.target.value);
17614
17663
  },
17615
17664
  [onChange]
17616
17665
  );
17617
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
17666
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
17618
17667
  StyledTextArea,
17619
17668
  {
17620
17669
  ref: mergeRefs(internalRef, externalRef),
@@ -17698,70 +17747,111 @@ function convertTableToCSV(table) {
17698
17747
  }
17699
17748
 
17700
17749
  // src/components/button/button.tsx
17701
- var import_react10 = require("react");
17750
+ var import_react11 = require("react");
17702
17751
 
17703
17752
  // src/components/button/button-styles.ts
17704
17753
  var import_styled_components10 = __toESM(require("styled-components"), 1);
17705
- var sizeStyles = {
17706
- xs: import_styled_components10.css`
17707
- padding: 6px 10px;
17708
- border-radius: 8px;
17709
- gap: 4px;
17710
- `,
17711
- s: import_styled_components10.css`
17712
- padding: 8px 12px;
17713
- border-radius: 10px;
17714
- gap: 6px;
17715
- `,
17716
- m: import_styled_components10.css`
17717
- padding: 10px 14px;
17718
- border-radius: 10px;
17719
- gap: 6px;
17720
- `
17721
- };
17722
- var variantStyles2 = {
17723
- solid: import_styled_components10.css`
17724
- background: ${colors["brown-100"]};
17725
- color: ${colors.white};
17726
- border: none;
17727
17754
 
17728
- &:hover:not(:disabled) {
17729
- background: ${colors["brown-90"]};
17730
- }
17731
-
17732
- &:disabled {
17733
- background: ${colors["brown-20"]};
17734
- color: ${colors["brown-50"]};
17735
- }
17736
- `,
17737
- outline: import_styled_components10.css`
17738
- background: ${colors.white};
17739
- color: ${colors["brown-100"]};
17740
- border: 1px solid ${colors["brown-40"]};
17741
-
17742
- &:hover:not(:disabled) {
17743
- background: ${colors["brown-20"]};
17744
- }
17755
+ // src/components/button/constants.ts
17756
+ var BUTTON_VARIANT = {
17757
+ SOLID: "solid",
17758
+ OUTLINE: "outline",
17759
+ GHOST: "ghost"
17760
+ };
17761
+ var BUTTON_SIZE = {
17762
+ XS: "xs",
17763
+ S: "s",
17764
+ M: "m"
17765
+ };
17766
+ var BUTTON_INTENT = {
17767
+ PRIMARY: "primary",
17768
+ ERROR: "error"
17769
+ };
17770
+ var ICON_POSITION = {
17771
+ LEADING: "leading",
17772
+ TRAILING: "trailing"
17773
+ };
17745
17774
 
17746
- &:disabled {
17747
- border-color: ${colors["brown-20"]};
17748
- color: ${colors["brown-50"]};
17749
- }
17750
- `,
17751
- ghost: import_styled_components10.css`
17752
- background: transparent;
17753
- color: ${colors["brown-100"]};
17754
- border: none;
17775
+ // src/components/button/button-styles.ts
17776
+ var intentColors = {
17777
+ [BUTTON_INTENT.PRIMARY]: {
17778
+ base: colors["brown-100"],
17779
+ hover: colors["brown-90"],
17780
+ disabledBg: colors["brown-20"],
17781
+ disabledText: colors["brown-50"],
17782
+ subtleHover: colors["brown-20"],
17783
+ border: colors["brown-40"],
17784
+ disabledBorder: colors["brown-20"]
17785
+ },
17786
+ [BUTTON_INTENT.ERROR]: {
17787
+ base: colors["red-500"],
17788
+ hover: colors["red-600"],
17789
+ disabledBg: colors["red-100"],
17790
+ disabledText: colors["red-200"],
17791
+ subtleHover: colors["red-50"],
17792
+ border: colors["red-200"],
17793
+ disabledBorder: colors["red-100"]
17794
+ }
17795
+ };
17796
+ var sizeValues = {
17797
+ [BUTTON_SIZE.XS]: { padding: "6px 10px", borderRadius: "8px", gap: "4px" },
17798
+ [BUTTON_SIZE.S]: { padding: "8px 12px", borderRadius: "10px", gap: "6px" },
17799
+ [BUTTON_SIZE.M]: { padding: "10px 14px", borderRadius: "10px", gap: "6px" }
17800
+ };
17801
+ function sizeMixin({ $size }) {
17802
+ const s = sizeValues[$size];
17803
+ return import_styled_components10.css`
17804
+ padding: ${s.padding};
17805
+ border-radius: ${s.borderRadius};
17806
+ gap: ${s.gap};
17807
+ `;
17808
+ }
17809
+ var variantColorMap = {
17810
+ [BUTTON_VARIANT.SOLID]: (c) => ({
17811
+ background: c.base,
17812
+ color: colors.white,
17813
+ border: "none",
17814
+ hoverBg: c.hover,
17815
+ disabledBg: c.disabledBg,
17816
+ disabledColor: c.disabledText
17817
+ }),
17818
+ [BUTTON_VARIANT.OUTLINE]: (c) => ({
17819
+ background: colors.white,
17820
+ color: c.base,
17821
+ border: `1px solid ${c.border}`,
17822
+ hoverBg: c.subtleHover,
17823
+ disabledColor: c.disabledText,
17824
+ disabledBorder: c.disabledBorder
17825
+ }),
17826
+ [BUTTON_VARIANT.GHOST]: (c) => ({
17827
+ background: "transparent",
17828
+ color: c.base,
17829
+ border: "none",
17830
+ hoverBg: c.subtleHover,
17831
+ disabledColor: c.disabledText
17832
+ })
17833
+ };
17834
+ function variantMixin({
17835
+ $variant,
17836
+ $intent
17837
+ }) {
17838
+ const v = variantColorMap[$variant](intentColors[$intent]);
17839
+ return import_styled_components10.css`
17840
+ background: ${v.background};
17841
+ color: ${v.color};
17842
+ border: ${v.border};
17755
17843
 
17756
17844
  &:hover:not(:disabled) {
17757
- background: ${colors["brown-20"]};
17845
+ background: ${v.hoverBg};
17758
17846
  }
17759
17847
 
17760
17848
  &:disabled {
17761
- color: ${colors["brown-50"]};
17849
+ color: ${v.disabledColor};
17850
+ ${v.disabledBg ? `background: ${v.disabledBg};` : ""}
17851
+ ${v.disabledBorder ? `border-color: ${v.disabledBorder};` : ""}
17762
17852
  }
17763
- `
17764
- };
17853
+ `;
17854
+ }
17765
17855
  var StyledButton = import_styled_components10.default.button`
17766
17856
  display: inline-flex;
17767
17857
  align-items: center;
@@ -17774,31 +17864,16 @@ var StyledButton = import_styled_components10.default.button`
17774
17864
  cursor: not-allowed;
17775
17865
  }
17776
17866
 
17777
- ${({ $size }) => sizeStyles[$size]}
17778
- ${({ $variant }) => variantStyles2[$variant]}
17867
+ ${sizeMixin}
17868
+ ${variantMixin}
17779
17869
  `;
17780
17870
 
17781
- // src/components/button/constants.ts
17782
- var BUTTON_VARIANT = {
17783
- SOLID: "solid",
17784
- OUTLINE: "outline",
17785
- GHOST: "ghost"
17786
- };
17787
- var BUTTON_SIZE = {
17788
- XS: "xs",
17789
- S: "s",
17790
- M: "m"
17791
- };
17792
- var ICON_POSITION = {
17793
- LEADING: "leading",
17794
- TRAILING: "trailing"
17795
- };
17796
-
17797
17871
  // src/components/button/button.tsx
17798
- var import_jsx_runtime11 = require("react/jsx-runtime");
17799
- var Button2 = (0, import_react10.forwardRef)(function Button3({
17872
+ var import_jsx_runtime12 = require("react/jsx-runtime");
17873
+ var Button2 = (0, import_react11.forwardRef)(function Button3({
17800
17874
  children,
17801
17875
  variant = BUTTON_VARIANT.SOLID,
17876
+ intent = BUTTON_INTENT.PRIMARY,
17802
17877
  size = BUTTON_SIZE.M,
17803
17878
  icon,
17804
17879
  iconPosition = ICON_POSITION.LEADING,
@@ -17807,13 +17882,14 @@ var Button2 = (0, import_react10.forwardRef)(function Button3({
17807
17882
  className,
17808
17883
  "aria-label": ariaLabel
17809
17884
  }, ref) {
17810
- const iconElement = icon ? /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Icon, { icon, size: 16 }) : null;
17811
- return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
17885
+ const iconElement = icon ? /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Icon, { icon, size: 16 }) : null;
17886
+ return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
17812
17887
  StyledButton,
17813
17888
  {
17814
17889
  ref,
17815
17890
  type: "button",
17816
17891
  $variant: variant,
17892
+ $intent: intent,
17817
17893
  $size: size,
17818
17894
  disabled,
17819
17895
  onClick: disabled ? void 0 : onClick,
@@ -17821,7 +17897,7 @@ var Button2 = (0, import_react10.forwardRef)(function Button3({
17821
17897
  "aria-label": ariaLabel,
17822
17898
  children: [
17823
17899
  iconPosition === ICON_POSITION.LEADING && iconElement,
17824
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { children }),
17900
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { children }),
17825
17901
  iconPosition === ICON_POSITION.TRAILING && iconElement
17826
17902
  ]
17827
17903
  }
@@ -17829,8 +17905,12 @@ var Button2 = (0, import_react10.forwardRef)(function Button3({
17829
17905
  });
17830
17906
  // Annotate the CommonJS export names for ESM import in node:
17831
17907
  0 && (module.exports = {
17908
+ BUTTON_INTENT,
17832
17909
  BUTTON_SIZE,
17833
17910
  BUTTON_VARIANT,
17911
+ Block,
17912
+ BlockContext,
17913
+ BlockServices,
17834
17914
  Button,
17835
17915
  ChatContext,
17836
17916
  ChatMessage,
@@ -17843,6 +17923,8 @@ var Button2 = (0, import_react10.forwardRef)(function Button3({
17843
17923
  Lottie,
17844
17924
  MESSAGE_ROLE,
17845
17925
  TextArea,
17926
+ TextBlockService,
17927
+ blockTypes,
17846
17928
  colors,
17847
17929
  convertTableToCSV,
17848
17930
  fontFamilies,
@@ -17852,6 +17934,7 @@ var Button2 = (0, import_react10.forwardRef)(function Button3({
17852
17934
  typographyMixin,
17853
17935
  typographyStyles,
17854
17936
  typographyTypes,
17937
+ useBlockContext,
17855
17938
  useChatContext,
17856
17939
  useCopyToClipboard
17857
17940
  });