@assistant-ui/react 0.1.5 → 0.1.7

Sign up to get free protection for your applications and to get access to all the features.
package/dist/index.js CHANGED
@@ -126,7 +126,9 @@ var ThreadContext = (0, import_react5.createContext)(null);
126
126
  var useThreadContext = () => {
127
127
  const context = (0, import_react5.useContext)(ThreadContext);
128
128
  if (!context)
129
- throw new Error("This component must be used within an AssistantRuntimeProvider.");
129
+ throw new Error(
130
+ "This component must be used within an AssistantRuntimeProvider."
131
+ );
130
132
  return context;
131
133
  };
132
134
 
@@ -218,6 +220,7 @@ var ThreadRoot = (0, import_react10.forwardRef)(
218
220
  return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_primitive.Primitive.div, { ...props, ref });
219
221
  }
220
222
  );
223
+ ThreadRoot.displayName = "ThreadRoot";
221
224
 
222
225
  // src/primitives/thread/ThreadIf.tsx
223
226
  var useThreadIf = (props) => {
@@ -252,8 +255,8 @@ var import_react_use_callback_ref = require("@radix-ui/react-use-callback-ref");
252
255
  var import_react11 = require("react");
253
256
  var useOnResizeContent = (ref, callback) => {
254
257
  const callbackRef = (0, import_react_use_callback_ref.useCallbackRef)(callback);
258
+ const el = ref.current;
255
259
  (0, import_react11.useEffect)(() => {
256
- const el = ref.current;
257
260
  if (!el) return;
258
261
  const resizeObserver = new ResizeObserver(() => {
259
262
  callbackRef();
@@ -282,7 +285,7 @@ var useOnResizeContent = (ref, callback) => {
282
285
  resizeObserver.disconnect();
283
286
  mutationObserver.disconnect();
284
287
  };
285
- }, [ref.current, callbackRef]);
288
+ }, [el, callbackRef]);
286
289
  };
287
290
 
288
291
  // src/utils/hooks/useOnScrollToBottom.tsx
@@ -351,6 +354,7 @@ var ThreadViewport = (0, import_react13.forwardRef)(({ autoScroll = true, onScro
351
354
  }
352
355
  );
353
356
  });
357
+ ThreadViewport.displayName = "ThreadViewport";
354
358
 
355
359
  // src/primitives/thread/ThreadMessages.tsx
356
360
  var import_react16 = require("react");
@@ -588,6 +592,7 @@ var ThreadScrollToBottom = (0, import_react17.forwardRef)(({ onClick, ...rest },
588
592
  }
589
593
  );
590
594
  });
595
+ ThreadScrollToBottom.displayName = "ThreadScrollToBottom";
591
596
 
592
597
  // src/primitives/thread/ThreadSuggestion.tsx
593
598
  var import_primitive3 = require("@radix-ui/primitive");
@@ -615,6 +620,7 @@ var ThreadSuggestion = (0, import_react18.forwardRef)(({ onClick, prompt, method
615
620
  }
616
621
  );
617
622
  });
623
+ ThreadSuggestion.displayName = "ThreadSuggestion";
618
624
 
619
625
  // src/primitives/composer/index.ts
620
626
  var composer_exports = {};
@@ -655,6 +661,7 @@ var ComposerRoot = (0, import_react19.forwardRef)(
655
661
  );
656
662
  }
657
663
  );
664
+ ComposerRoot.displayName = "ComposerRoot";
658
665
 
659
666
  // src/primitives/composer/ComposerInput.tsx
660
667
  var import_primitive5 = require("@radix-ui/primitive");
@@ -693,6 +700,7 @@ var ComposerInput = (0, import_react20.forwardRef)(
693
700
  const focus = (0, import_react20.useCallback)(() => {
694
701
  const textarea = textareaRef.current;
695
702
  if (!textarea || !autoFocusEnabled) return;
703
+ console.log("focus");
696
704
  textarea.focus();
697
705
  textarea.setSelectionRange(
698
706
  textareaRef.current.value.length,
@@ -711,6 +719,7 @@ var ComposerInput = (0, import_react20.forwardRef)(
711
719
  value,
712
720
  ...rest,
713
721
  ref,
722
+ autoFocus,
714
723
  disabled,
715
724
  onChange: (0, import_primitive5.composeEventHandlers)(onChange, (e) => {
716
725
  const composerState = useComposer.getState();
@@ -722,6 +731,7 @@ var ComposerInput = (0, import_react20.forwardRef)(
722
731
  );
723
732
  }
724
733
  );
734
+ ComposerInput.displayName = "ComposerInput";
725
735
 
726
736
  // src/primitives/composer/ComposerSend.tsx
727
737
  var import_react_primitive6 = require("@radix-ui/react-primitive");
@@ -742,6 +752,7 @@ var ComposerSend = (0, import_react21.forwardRef)(
742
752
  );
743
753
  }
744
754
  );
755
+ ComposerSend.displayName = "ComposerSend";
745
756
 
746
757
  // src/primitives/composer/ComposerCancel.tsx
747
758
  var import_primitive6 = require("@radix-ui/primitive");
@@ -763,6 +774,7 @@ var ComposerCancel = (0, import_react22.forwardRef)(({ onClick, ...rest }, ref)
763
774
  }
764
775
  );
765
776
  });
777
+ ComposerCancel.displayName = "ComposerCancel";
766
778
 
767
779
  // src/primitives/message/index.ts
768
780
  var message_exports = {};
@@ -799,6 +811,7 @@ var MessageRoot = (0, import_react23.forwardRef)(
799
811
  );
800
812
  }
801
813
  );
814
+ MessageRoot.displayName = "MessageRoot";
802
815
 
803
816
  // src/primitives/message/MessageContent.tsx
804
817
  var import_react28 = require("react");
@@ -908,6 +921,7 @@ var ContentPartText = (0, import_react27.forwardRef)((props, forwardedRef) => {
908
921
  });
909
922
  return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_react_primitive9.Primitive.span, { ...props, ref: forwardedRef, children: text });
910
923
  });
924
+ ContentPartText.displayName = "ContentPartText";
911
925
 
912
926
  // src/primitives/message/MessageContent.tsx
913
927
  var import_jsx_runtime15 = require("react/jsx-runtime");
@@ -992,6 +1006,7 @@ var MessageInProgress = (0, import_react29.forwardRef)((props, ref) => {
992
1006
  }, [useMessage, props, ref]);
993
1007
  return null;
994
1008
  });
1009
+ MessageInProgress.displayName = "MessageInProgress";
995
1010
 
996
1011
  // src/primitives/branchPicker/index.ts
997
1012
  var branchPicker_exports = {};
@@ -1009,21 +1024,21 @@ var import_react_primitive11 = require("@radix-ui/react-primitive");
1009
1024
  var import_react30 = require("react");
1010
1025
  var import_jsx_runtime17 = require("react/jsx-runtime");
1011
1026
  var createActionButton = (useActionButton) => {
1012
- return (0, import_react30.forwardRef)(
1013
- (props, forwardedRef) => {
1014
- const onClick = useActionButton(props);
1015
- return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
1016
- import_react_primitive11.Primitive.button,
1017
- {
1018
- type: "button",
1019
- disabled: !onClick,
1020
- ...props,
1021
- ref: forwardedRef,
1022
- onClick: (0, import_primitive8.composeEventHandlers)(props.onClick, onClick ?? void 0)
1023
- }
1024
- );
1025
- }
1026
- );
1027
+ const ActionButton = (0, import_react30.forwardRef)((props, forwardedRef) => {
1028
+ const onClick = useActionButton(props);
1029
+ return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
1030
+ import_react_primitive11.Primitive.button,
1031
+ {
1032
+ type: "button",
1033
+ disabled: !onClick,
1034
+ ...props,
1035
+ ref: forwardedRef,
1036
+ onClick: (0, import_primitive8.composeEventHandlers)(props.onClick, onClick ?? void 0)
1037
+ }
1038
+ );
1039
+ });
1040
+ ActionButton.displayName = "ActionButton";
1041
+ return ActionButton;
1027
1042
  };
1028
1043
 
1029
1044
  // src/primitives/branchPicker/BranchPickerNext.tsx
@@ -1055,6 +1070,7 @@ var import_jsx_runtime20 = require("react/jsx-runtime");
1055
1070
  var BranchPickerRoot = (0, import_react31.forwardRef)(({ hideWhenSingleBranch, ...rest }, ref) => {
1056
1071
  return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(MessageIf, { hasBranches: hideWhenSingleBranch ? true : void 0, children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_react_primitive12.Primitive.div, { ...rest, ref }) });
1057
1072
  });
1073
+ BranchPickerRoot.displayName = "BranchPickerRoot";
1058
1074
 
1059
1075
  // src/primitives/actionBar/index.ts
1060
1076
  var actionBar_exports = {};
@@ -1094,6 +1110,7 @@ var ActionBarRoot = (0, import_react32.forwardRef)(({ hideWhenRunning, autohide,
1094
1110
  }
1095
1111
  );
1096
1112
  });
1113
+ ActionBarRoot.displayName = "ActionBarRoot";
1097
1114
 
1098
1115
  // src/primitives/actionBar/ActionBarCopy.tsx
1099
1116
  var ActionBarCopy = createActionButton(useCopyMessage);
@@ -1128,6 +1145,7 @@ var ContentPartImage = (0, import_react33.forwardRef)((props, forwardedRef) => {
1128
1145
  });
1129
1146
  return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_react_primitive14.Primitive.img, { src: image, ...props, ref: forwardedRef });
1130
1147
  });
1148
+ ContentPartImage.displayName = "ContentPartImage";
1131
1149
 
1132
1150
  // src/runtime/local/useLocalRuntime.tsx
1133
1151
  var import_react34 = require("react");