@assistant-ui/react 0.1.5 → 0.1.7

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.mjs CHANGED
@@ -9,7 +9,7 @@ import {
9
9
  useContentPartContext,
10
10
  useMessageContext,
11
11
  useThreadContext
12
- } from "./chunk-KIP3YFVM.mjs";
12
+ } from "./chunk-XVZ2GVQM.mjs";
13
13
 
14
14
  // src/actions/useCopyMessage.tsx
15
15
  import { useCallback } from "react";
@@ -150,9 +150,7 @@ __export(thread_exports, {
150
150
  });
151
151
 
152
152
  // src/primitives/thread/ThreadRoot.tsx
153
- import {
154
- Primitive
155
- } from "@radix-ui/react-primitive";
153
+ import { Primitive } from "@radix-ui/react-primitive";
156
154
  import { forwardRef } from "react";
157
155
  import { jsx } from "react/jsx-runtime";
158
156
  var ThreadRoot = forwardRef(
@@ -160,6 +158,7 @@ var ThreadRoot = forwardRef(
160
158
  return /* @__PURE__ */ jsx(Primitive.div, { ...props, ref });
161
159
  }
162
160
  );
161
+ ThreadRoot.displayName = "ThreadRoot";
163
162
 
164
163
  // src/primitives/thread/ThreadIf.tsx
165
164
  var useThreadIf = (props) => {
@@ -186,18 +185,19 @@ var ThreadEmpty = ({ children }) => {
186
185
  // src/primitives/thread/ThreadViewport.tsx
187
186
  import { composeEventHandlers } from "@radix-ui/primitive";
188
187
  import { useComposedRefs } from "@radix-ui/react-compose-refs";
188
+ import { Primitive as Primitive2 } from "@radix-ui/react-primitive";
189
189
  import {
190
- Primitive as Primitive2
191
- } from "@radix-ui/react-primitive";
192
- import { forwardRef as forwardRef2, useRef } from "react";
190
+ forwardRef as forwardRef2,
191
+ useRef
192
+ } from "react";
193
193
 
194
194
  // src/utils/hooks/useOnResizeContent.tsx
195
195
  import { useCallbackRef } from "@radix-ui/react-use-callback-ref";
196
196
  import { useEffect } from "react";
197
197
  var useOnResizeContent = (ref, callback) => {
198
198
  const callbackRef = useCallbackRef(callback);
199
+ const el = ref.current;
199
200
  useEffect(() => {
200
- const el = ref.current;
201
201
  if (!el) return;
202
202
  const resizeObserver = new ResizeObserver(() => {
203
203
  callbackRef();
@@ -226,7 +226,7 @@ var useOnResizeContent = (ref, callback) => {
226
226
  resizeObserver.disconnect();
227
227
  mutationObserver.disconnect();
228
228
  };
229
- }, [ref.current, callbackRef]);
229
+ }, [el, callbackRef]);
230
230
  };
231
231
 
232
232
  // src/utils/hooks/useOnScrollToBottom.tsx
@@ -295,6 +295,7 @@ var ThreadViewport = forwardRef2(({ autoScroll = true, onScroll, children, ...re
295
295
  }
296
296
  );
297
297
  });
298
+ ThreadViewport.displayName = "ThreadViewport";
298
299
 
299
300
  // src/primitives/thread/ThreadMessages.tsx
300
301
  import { memo } from "react";
@@ -499,9 +500,7 @@ var ThreadMessages = ({ components }) => {
499
500
 
500
501
  // src/primitives/thread/ThreadScrollToBottom.tsx
501
502
  import { composeEventHandlers as composeEventHandlers2 } from "@radix-ui/primitive";
502
- import {
503
- Primitive as Primitive3
504
- } from "@radix-ui/react-primitive";
503
+ import { Primitive as Primitive3 } from "@radix-ui/react-primitive";
505
504
  import { forwardRef as forwardRef3 } from "react";
506
505
  import { jsx as jsx6 } from "react/jsx-runtime";
507
506
  var ThreadScrollToBottom = forwardRef3(({ onClick, ...rest }, ref) => {
@@ -520,12 +519,11 @@ var ThreadScrollToBottom = forwardRef3(({ onClick, ...rest }, ref) => {
520
519
  }
521
520
  );
522
521
  });
522
+ ThreadScrollToBottom.displayName = "ThreadScrollToBottom";
523
523
 
524
524
  // src/primitives/thread/ThreadSuggestion.tsx
525
525
  import { composeEventHandlers as composeEventHandlers3 } from "@radix-ui/primitive";
526
- import {
527
- Primitive as Primitive4
528
- } from "@radix-ui/react-primitive";
526
+ import { Primitive as Primitive4 } from "@radix-ui/react-primitive";
529
527
  import { forwardRef as forwardRef4 } from "react";
530
528
  import { jsx as jsx7 } from "react/jsx-runtime";
531
529
  var ThreadSuggestion = forwardRef4(({ onClick, prompt, method, autoSend: send, ...rest }, ref) => {
@@ -549,6 +547,7 @@ var ThreadSuggestion = forwardRef4(({ onClick, prompt, method, autoSend: send, .
549
547
  }
550
548
  );
551
549
  });
550
+ ThreadSuggestion.displayName = "ThreadSuggestion";
552
551
 
553
552
  // src/primitives/composer/index.ts
554
553
  var composer_exports = {};
@@ -563,10 +562,11 @@ __export(composer_exports, {
563
562
  // src/primitives/composer/ComposerRoot.tsx
564
563
  import { composeEventHandlers as composeEventHandlers4 } from "@radix-ui/primitive";
565
564
  import { useComposedRefs as useComposedRefs2 } from "@radix-ui/react-compose-refs";
565
+ import { Primitive as Primitive5 } from "@radix-ui/react-primitive";
566
566
  import {
567
- Primitive as Primitive5
568
- } from "@radix-ui/react-primitive";
569
- import { forwardRef as forwardRef5, useRef as useRef2 } from "react";
567
+ forwardRef as forwardRef5,
568
+ useRef as useRef2
569
+ } from "react";
570
570
  import { jsx as jsx8 } from "react/jsx-runtime";
571
571
  var ComposerRoot = forwardRef5(
572
572
  ({ onSubmit, ...rest }, forwardedRef) => {
@@ -591,6 +591,7 @@ var ComposerRoot = forwardRef5(
591
591
  );
592
592
  }
593
593
  );
594
+ ComposerRoot.displayName = "ComposerRoot";
594
595
 
595
596
  // src/primitives/composer/ComposerInput.tsx
596
597
  import { composeEventHandlers as composeEventHandlers5 } from "@radix-ui/primitive";
@@ -634,6 +635,7 @@ var ComposerInput = forwardRef6(
634
635
  const focus = useCallback6(() => {
635
636
  const textarea = textareaRef.current;
636
637
  if (!textarea || !autoFocusEnabled) return;
638
+ console.log("focus");
637
639
  textarea.focus();
638
640
  textarea.setSelectionRange(
639
641
  textareaRef.current.value.length,
@@ -652,6 +654,7 @@ var ComposerInput = forwardRef6(
652
654
  value,
653
655
  ...rest,
654
656
  ref,
657
+ autoFocus,
655
658
  disabled,
656
659
  onChange: composeEventHandlers5(onChange, (e) => {
657
660
  const composerState = useComposer.getState();
@@ -663,11 +666,10 @@ var ComposerInput = forwardRef6(
663
666
  );
664
667
  }
665
668
  );
669
+ ComposerInput.displayName = "ComposerInput";
666
670
 
667
671
  // src/primitives/composer/ComposerSend.tsx
668
- import {
669
- Primitive as Primitive6
670
- } from "@radix-ui/react-primitive";
672
+ import { Primitive as Primitive6 } from "@radix-ui/react-primitive";
671
673
  import { forwardRef as forwardRef7 } from "react";
672
674
  import { jsx as jsx10 } from "react/jsx-runtime";
673
675
  var ComposerSend = forwardRef7(
@@ -685,12 +687,11 @@ var ComposerSend = forwardRef7(
685
687
  );
686
688
  }
687
689
  );
690
+ ComposerSend.displayName = "ComposerSend";
688
691
 
689
692
  // src/primitives/composer/ComposerCancel.tsx
690
693
  import { composeEventHandlers as composeEventHandlers6 } from "@radix-ui/primitive";
691
- import {
692
- Primitive as Primitive7
693
- } from "@radix-ui/react-primitive";
694
+ import { Primitive as Primitive7 } from "@radix-ui/react-primitive";
694
695
  import { forwardRef as forwardRef8 } from "react";
695
696
  import { jsx as jsx11 } from "react/jsx-runtime";
696
697
  var ComposerCancel = forwardRef8(({ onClick, ...rest }, ref) => {
@@ -708,6 +709,7 @@ var ComposerCancel = forwardRef8(({ onClick, ...rest }, ref) => {
708
709
  }
709
710
  );
710
711
  });
712
+ ComposerCancel.displayName = "ComposerCancel";
711
713
 
712
714
  // src/primitives/message/index.ts
713
715
  var message_exports = {};
@@ -720,9 +722,7 @@ __export(message_exports, {
720
722
 
721
723
  // src/primitives/message/MessageRoot.tsx
722
724
  import { composeEventHandlers as composeEventHandlers7 } from "@radix-ui/primitive";
723
- import {
724
- Primitive as Primitive8
725
- } from "@radix-ui/react-primitive";
725
+ import { Primitive as Primitive8 } from "@radix-ui/react-primitive";
726
726
  import { forwardRef as forwardRef9 } from "react";
727
727
  import { jsx as jsx12 } from "react/jsx-runtime";
728
728
  var MessageRoot = forwardRef9(
@@ -746,6 +746,7 @@ var MessageRoot = forwardRef9(
746
746
  );
747
747
  }
748
748
  );
749
+ MessageRoot.displayName = "MessageRoot";
749
750
 
750
751
  // src/primitives/message/MessageContent.tsx
751
752
  import { memo as memo2 } from "react";
@@ -813,9 +814,7 @@ var ContentPartInProgressIndicator = () => {
813
814
  };
814
815
 
815
816
  // src/primitives/contentPart/ContentPartText.tsx
816
- import {
817
- Primitive as Primitive9
818
- } from "@radix-ui/react-primitive";
817
+ import { Primitive as Primitive9 } from "@radix-ui/react-primitive";
819
818
  import { forwardRef as forwardRef10 } from "react";
820
819
  import { jsx as jsx14 } from "react/jsx-runtime";
821
820
  var ContentPartText = forwardRef10((props, forwardedRef) => {
@@ -829,6 +828,7 @@ var ContentPartText = forwardRef10((props, forwardedRef) => {
829
828
  });
830
829
  return /* @__PURE__ */ jsx14(Primitive9.span, { ...props, ref: forwardedRef, children: text });
831
830
  });
831
+ ContentPartText.displayName = "ContentPartText";
832
832
 
833
833
  // src/primitives/message/MessageContent.tsx
834
834
  import { Fragment, jsx as jsx15, jsxs as jsxs3 } from "react/jsx-runtime";
@@ -903,10 +903,11 @@ var MessageContent = ({ components }) => {
903
903
  };
904
904
 
905
905
  // src/primitives/message/MessageInProgress.tsx
906
+ import { Primitive as Primitive10 } from "@radix-ui/react-primitive";
906
907
  import {
907
- Primitive as Primitive10
908
- } from "@radix-ui/react-primitive";
909
- import { forwardRef as forwardRef11, useMemo as useMemo2 } from "react";
908
+ forwardRef as forwardRef11,
909
+ useMemo as useMemo2
910
+ } from "react";
910
911
  import { jsx as jsx16 } from "react/jsx-runtime";
911
912
  var MessageInProgress = forwardRef11((props, ref) => {
912
913
  const { useMessage } = useMessageContext();
@@ -915,6 +916,7 @@ var MessageInProgress = forwardRef11((props, ref) => {
915
916
  }, [useMessage, props, ref]);
916
917
  return null;
917
918
  });
919
+ MessageInProgress.displayName = "MessageInProgress";
918
920
 
919
921
  // src/primitives/branchPicker/index.ts
920
922
  var branchPicker_exports = {};
@@ -928,27 +930,25 @@ __export(branchPicker_exports, {
928
930
 
929
931
  // src/utils/createActionButton.tsx
930
932
  import { composeEventHandlers as composeEventHandlers8 } from "@radix-ui/primitive";
931
- import {
932
- Primitive as Primitive11
933
- } from "@radix-ui/react-primitive";
933
+ import { Primitive as Primitive11 } from "@radix-ui/react-primitive";
934
934
  import { forwardRef as forwardRef12 } from "react";
935
935
  import { jsx as jsx17 } from "react/jsx-runtime";
936
936
  var createActionButton = (useActionButton) => {
937
- return forwardRef12(
938
- (props, forwardedRef) => {
939
- const onClick = useActionButton(props);
940
- return /* @__PURE__ */ jsx17(
941
- Primitive11.button,
942
- {
943
- type: "button",
944
- disabled: !onClick,
945
- ...props,
946
- ref: forwardedRef,
947
- onClick: composeEventHandlers8(props.onClick, onClick ?? void 0)
948
- }
949
- );
950
- }
951
- );
937
+ const ActionButton = forwardRef12((props, forwardedRef) => {
938
+ const onClick = useActionButton(props);
939
+ return /* @__PURE__ */ jsx17(
940
+ Primitive11.button,
941
+ {
942
+ type: "button",
943
+ disabled: !onClick,
944
+ ...props,
945
+ ref: forwardedRef,
946
+ onClick: composeEventHandlers8(props.onClick, onClick ?? void 0)
947
+ }
948
+ );
949
+ });
950
+ ActionButton.displayName = "ActionButton";
951
+ return ActionButton;
952
952
  };
953
953
 
954
954
  // src/primitives/branchPicker/BranchPickerNext.tsx
@@ -974,14 +974,13 @@ var BranchPickerNumber = () => {
974
974
  };
975
975
 
976
976
  // src/primitives/branchPicker/BranchPickerRoot.tsx
977
- import {
978
- Primitive as Primitive12
979
- } from "@radix-ui/react-primitive";
977
+ import { Primitive as Primitive12 } from "@radix-ui/react-primitive";
980
978
  import { forwardRef as forwardRef13 } from "react";
981
979
  import { jsx as jsx20 } from "react/jsx-runtime";
982
980
  var BranchPickerRoot = forwardRef13(({ hideWhenSingleBranch, ...rest }, ref) => {
983
981
  return /* @__PURE__ */ jsx20(MessageIf, { hasBranches: hideWhenSingleBranch ? true : void 0, children: /* @__PURE__ */ jsx20(Primitive12.div, { ...rest, ref }) });
984
982
  });
983
+ BranchPickerRoot.displayName = "BranchPickerRoot";
985
984
 
986
985
  // src/primitives/actionBar/index.ts
987
986
  var actionBar_exports = {};
@@ -993,9 +992,7 @@ __export(actionBar_exports, {
993
992
  });
994
993
 
995
994
  // src/primitives/actionBar/ActionBarRoot.tsx
996
- import {
997
- Primitive as Primitive13
998
- } from "@radix-ui/react-primitive";
995
+ import { Primitive as Primitive13 } from "@radix-ui/react-primitive";
999
996
  import { forwardRef as forwardRef14 } from "react";
1000
997
  import { jsx as jsx21 } from "react/jsx-runtime";
1001
998
  var ActionBarRoot = forwardRef14(({ hideWhenRunning, autohide, autohideFloat, ...rest }, ref) => {
@@ -1023,6 +1020,7 @@ var ActionBarRoot = forwardRef14(({ hideWhenRunning, autohide, autohideFloat, ..
1023
1020
  }
1024
1021
  );
1025
1022
  });
1023
+ ActionBarRoot.displayName = "ActionBarRoot";
1026
1024
 
1027
1025
  // src/primitives/actionBar/ActionBarCopy.tsx
1028
1026
  var ActionBarCopy = createActionButton(useCopyMessage);
@@ -1043,9 +1041,7 @@ __export(contentPart_exports, {
1043
1041
  });
1044
1042
 
1045
1043
  // src/primitives/contentPart/ContentPartImage.tsx
1046
- import {
1047
- Primitive as Primitive14
1048
- } from "@radix-ui/react-primitive";
1044
+ import { Primitive as Primitive14 } from "@radix-ui/react-primitive";
1049
1045
  import { forwardRef as forwardRef15 } from "react";
1050
1046
  import { jsx as jsx22 } from "react/jsx-runtime";
1051
1047
  var ContentPartImage = forwardRef15((props, forwardedRef) => {
@@ -1059,6 +1055,7 @@ var ContentPartImage = forwardRef15((props, forwardedRef) => {
1059
1055
  });
1060
1056
  return /* @__PURE__ */ jsx22(Primitive14.img, { src: image, ...props, ref: forwardedRef });
1061
1057
  });
1058
+ ContentPartImage.displayName = "ContentPartImage";
1062
1059
 
1063
1060
  // src/runtime/local/useLocalRuntime.tsx
1064
1061
  import { useInsertionEffect, useState as useState3 } from "react";