@assistant-ui/react 0.1.6 → 0.1.7

Sign up to get free protection for your applications and to get access to all the features.
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";
@@ -665,11 +666,10 @@ var ComposerInput = forwardRef6(
665
666
  );
666
667
  }
667
668
  );
669
+ ComposerInput.displayName = "ComposerInput";
668
670
 
669
671
  // src/primitives/composer/ComposerSend.tsx
670
- import {
671
- Primitive as Primitive6
672
- } from "@radix-ui/react-primitive";
672
+ import { Primitive as Primitive6 } from "@radix-ui/react-primitive";
673
673
  import { forwardRef as forwardRef7 } from "react";
674
674
  import { jsx as jsx10 } from "react/jsx-runtime";
675
675
  var ComposerSend = forwardRef7(
@@ -687,12 +687,11 @@ var ComposerSend = forwardRef7(
687
687
  );
688
688
  }
689
689
  );
690
+ ComposerSend.displayName = "ComposerSend";
690
691
 
691
692
  // src/primitives/composer/ComposerCancel.tsx
692
693
  import { composeEventHandlers as composeEventHandlers6 } from "@radix-ui/primitive";
693
- import {
694
- Primitive as Primitive7
695
- } from "@radix-ui/react-primitive";
694
+ import { Primitive as Primitive7 } from "@radix-ui/react-primitive";
696
695
  import { forwardRef as forwardRef8 } from "react";
697
696
  import { jsx as jsx11 } from "react/jsx-runtime";
698
697
  var ComposerCancel = forwardRef8(({ onClick, ...rest }, ref) => {
@@ -710,6 +709,7 @@ var ComposerCancel = forwardRef8(({ onClick, ...rest }, ref) => {
710
709
  }
711
710
  );
712
711
  });
712
+ ComposerCancel.displayName = "ComposerCancel";
713
713
 
714
714
  // src/primitives/message/index.ts
715
715
  var message_exports = {};
@@ -722,9 +722,7 @@ __export(message_exports, {
722
722
 
723
723
  // src/primitives/message/MessageRoot.tsx
724
724
  import { composeEventHandlers as composeEventHandlers7 } from "@radix-ui/primitive";
725
- import {
726
- Primitive as Primitive8
727
- } from "@radix-ui/react-primitive";
725
+ import { Primitive as Primitive8 } from "@radix-ui/react-primitive";
728
726
  import { forwardRef as forwardRef9 } from "react";
729
727
  import { jsx as jsx12 } from "react/jsx-runtime";
730
728
  var MessageRoot = forwardRef9(
@@ -748,6 +746,7 @@ var MessageRoot = forwardRef9(
748
746
  );
749
747
  }
750
748
  );
749
+ MessageRoot.displayName = "MessageRoot";
751
750
 
752
751
  // src/primitives/message/MessageContent.tsx
753
752
  import { memo as memo2 } from "react";
@@ -815,9 +814,7 @@ var ContentPartInProgressIndicator = () => {
815
814
  };
816
815
 
817
816
  // src/primitives/contentPart/ContentPartText.tsx
818
- import {
819
- Primitive as Primitive9
820
- } from "@radix-ui/react-primitive";
817
+ import { Primitive as Primitive9 } from "@radix-ui/react-primitive";
821
818
  import { forwardRef as forwardRef10 } from "react";
822
819
  import { jsx as jsx14 } from "react/jsx-runtime";
823
820
  var ContentPartText = forwardRef10((props, forwardedRef) => {
@@ -831,6 +828,7 @@ var ContentPartText = forwardRef10((props, forwardedRef) => {
831
828
  });
832
829
  return /* @__PURE__ */ jsx14(Primitive9.span, { ...props, ref: forwardedRef, children: text });
833
830
  });
831
+ ContentPartText.displayName = "ContentPartText";
834
832
 
835
833
  // src/primitives/message/MessageContent.tsx
836
834
  import { Fragment, jsx as jsx15, jsxs as jsxs3 } from "react/jsx-runtime";
@@ -905,10 +903,11 @@ var MessageContent = ({ components }) => {
905
903
  };
906
904
 
907
905
  // src/primitives/message/MessageInProgress.tsx
906
+ import { Primitive as Primitive10 } from "@radix-ui/react-primitive";
908
907
  import {
909
- Primitive as Primitive10
910
- } from "@radix-ui/react-primitive";
911
- import { forwardRef as forwardRef11, useMemo as useMemo2 } from "react";
908
+ forwardRef as forwardRef11,
909
+ useMemo as useMemo2
910
+ } from "react";
912
911
  import { jsx as jsx16 } from "react/jsx-runtime";
913
912
  var MessageInProgress = forwardRef11((props, ref) => {
914
913
  const { useMessage } = useMessageContext();
@@ -917,6 +916,7 @@ var MessageInProgress = forwardRef11((props, ref) => {
917
916
  }, [useMessage, props, ref]);
918
917
  return null;
919
918
  });
919
+ MessageInProgress.displayName = "MessageInProgress";
920
920
 
921
921
  // src/primitives/branchPicker/index.ts
922
922
  var branchPicker_exports = {};
@@ -930,27 +930,25 @@ __export(branchPicker_exports, {
930
930
 
931
931
  // src/utils/createActionButton.tsx
932
932
  import { composeEventHandlers as composeEventHandlers8 } from "@radix-ui/primitive";
933
- import {
934
- Primitive as Primitive11
935
- } from "@radix-ui/react-primitive";
933
+ import { Primitive as Primitive11 } from "@radix-ui/react-primitive";
936
934
  import { forwardRef as forwardRef12 } from "react";
937
935
  import { jsx as jsx17 } from "react/jsx-runtime";
938
936
  var createActionButton = (useActionButton) => {
939
- return forwardRef12(
940
- (props, forwardedRef) => {
941
- const onClick = useActionButton(props);
942
- return /* @__PURE__ */ jsx17(
943
- Primitive11.button,
944
- {
945
- type: "button",
946
- disabled: !onClick,
947
- ...props,
948
- ref: forwardedRef,
949
- onClick: composeEventHandlers8(props.onClick, onClick ?? void 0)
950
- }
951
- );
952
- }
953
- );
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;
954
952
  };
955
953
 
956
954
  // src/primitives/branchPicker/BranchPickerNext.tsx
@@ -976,14 +974,13 @@ var BranchPickerNumber = () => {
976
974
  };
977
975
 
978
976
  // src/primitives/branchPicker/BranchPickerRoot.tsx
979
- import {
980
- Primitive as Primitive12
981
- } from "@radix-ui/react-primitive";
977
+ import { Primitive as Primitive12 } from "@radix-ui/react-primitive";
982
978
  import { forwardRef as forwardRef13 } from "react";
983
979
  import { jsx as jsx20 } from "react/jsx-runtime";
984
980
  var BranchPickerRoot = forwardRef13(({ hideWhenSingleBranch, ...rest }, ref) => {
985
981
  return /* @__PURE__ */ jsx20(MessageIf, { hasBranches: hideWhenSingleBranch ? true : void 0, children: /* @__PURE__ */ jsx20(Primitive12.div, { ...rest, ref }) });
986
982
  });
983
+ BranchPickerRoot.displayName = "BranchPickerRoot";
987
984
 
988
985
  // src/primitives/actionBar/index.ts
989
986
  var actionBar_exports = {};
@@ -995,9 +992,7 @@ __export(actionBar_exports, {
995
992
  });
996
993
 
997
994
  // src/primitives/actionBar/ActionBarRoot.tsx
998
- import {
999
- Primitive as Primitive13
1000
- } from "@radix-ui/react-primitive";
995
+ import { Primitive as Primitive13 } from "@radix-ui/react-primitive";
1001
996
  import { forwardRef as forwardRef14 } from "react";
1002
997
  import { jsx as jsx21 } from "react/jsx-runtime";
1003
998
  var ActionBarRoot = forwardRef14(({ hideWhenRunning, autohide, autohideFloat, ...rest }, ref) => {
@@ -1025,6 +1020,7 @@ var ActionBarRoot = forwardRef14(({ hideWhenRunning, autohide, autohideFloat, ..
1025
1020
  }
1026
1021
  );
1027
1022
  });
1023
+ ActionBarRoot.displayName = "ActionBarRoot";
1028
1024
 
1029
1025
  // src/primitives/actionBar/ActionBarCopy.tsx
1030
1026
  var ActionBarCopy = createActionButton(useCopyMessage);
@@ -1045,9 +1041,7 @@ __export(contentPart_exports, {
1045
1041
  });
1046
1042
 
1047
1043
  // src/primitives/contentPart/ContentPartImage.tsx
1048
- import {
1049
- Primitive as Primitive14
1050
- } from "@radix-ui/react-primitive";
1044
+ import { Primitive as Primitive14 } from "@radix-ui/react-primitive";
1051
1045
  import { forwardRef as forwardRef15 } from "react";
1052
1046
  import { jsx as jsx22 } from "react/jsx-runtime";
1053
1047
  var ContentPartImage = forwardRef15((props, forwardedRef) => {
@@ -1061,6 +1055,7 @@ var ContentPartImage = forwardRef15((props, forwardedRef) => {
1061
1055
  });
1062
1056
  return /* @__PURE__ */ jsx22(Primitive14.img, { src: image, ...props, ref: forwardedRef });
1063
1057
  });
1058
+ ContentPartImage.displayName = "ContentPartImage";
1064
1059
 
1065
1060
  // src/runtime/local/useLocalRuntime.tsx
1066
1061
  import { useInsertionEffect, useState as useState3 } from "react";