@assistant-ui/react 0.4.1 → 0.4.2
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/index.js +19 -8
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +19 -8
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
@@ -831,21 +831,30 @@ var ActionBarPrimitiveRoot = forwardRef(({ hideWhenRunning, autohide, autohideFl
|
|
831
831
|
ActionBarPrimitiveRoot.displayName = "ActionBarPrimitive.Root";
|
832
832
|
|
833
833
|
// src/utils/createActionButton.tsx
|
834
|
-
import { composeEventHandlers } from "@radix-ui/primitive";
|
835
|
-
import { Primitive as Primitive2 } from "@radix-ui/react-primitive";
|
836
834
|
import { forwardRef as forwardRef2 } from "react";
|
835
|
+
import { Primitive as Primitive2 } from "@radix-ui/react-primitive";
|
836
|
+
import { composeEventHandlers } from "@radix-ui/primitive";
|
837
837
|
import { jsx as jsx5 } from "react/jsx-runtime";
|
838
|
-
var createActionButton = (displayName, useActionButton) => {
|
838
|
+
var createActionButton = (displayName, useActionButton, forwardProps = []) => {
|
839
839
|
const ActionButton = forwardRef2((props, forwardedRef) => {
|
840
|
-
const
|
840
|
+
const forwardedProps = {};
|
841
|
+
const primitiveProps = {};
|
842
|
+
Object.keys(props).forEach((key) => {
|
843
|
+
if (forwardProps.includes(key)) {
|
844
|
+
forwardedProps[key] = props[key];
|
845
|
+
} else {
|
846
|
+
primitiveProps[key] = props[key];
|
847
|
+
}
|
848
|
+
});
|
849
|
+
const callback = useActionButton(forwardedProps);
|
841
850
|
return /* @__PURE__ */ jsx5(
|
842
851
|
Primitive2.button,
|
843
852
|
{
|
844
853
|
type: "button",
|
845
854
|
disabled: !callback,
|
846
|
-
...
|
855
|
+
...primitiveProps,
|
847
856
|
ref: forwardedRef,
|
848
|
-
onClick: composeEventHandlers(
|
857
|
+
onClick: composeEventHandlers(primitiveProps.onClick, () => {
|
849
858
|
callback?.();
|
850
859
|
})
|
851
860
|
}
|
@@ -858,7 +867,8 @@ var createActionButton = (displayName, useActionButton) => {
|
|
858
867
|
// src/primitives/actionBar/ActionBarCopy.tsx
|
859
868
|
var ActionBarPrimitiveCopy = createActionButton(
|
860
869
|
"ActionBarPrimitive.Copy",
|
861
|
-
useActionBarCopy
|
870
|
+
useActionBarCopy,
|
871
|
+
["copiedDuration"]
|
862
872
|
);
|
863
873
|
|
864
874
|
// src/primitives/actionBar/ActionBarReload.tsx
|
@@ -1885,7 +1895,8 @@ var ThreadPrimitiveScrollToBottom = createActionButton(
|
|
1885
1895
|
// src/primitives/thread/ThreadSuggestion.tsx
|
1886
1896
|
var ThreadPrimitiveSuggestion = createActionButton(
|
1887
1897
|
"ThreadPrimitive.Suggestion",
|
1888
|
-
useThreadSuggestion
|
1898
|
+
useThreadSuggestion,
|
1899
|
+
["prompt", "autoSend", "method"]
|
1889
1900
|
);
|
1890
1901
|
|
1891
1902
|
// src/runtimes/local/useLocalRuntime.tsx
|