@assistant-ui/react 0.5.62 → 0.5.65

Sign up to get free protection for your applications and to get access to all the features.
package/dist/index.mjs CHANGED
@@ -2015,6 +2015,8 @@ var ComposerPrimitiveInput = forwardRef16(
2015
2015
  disabled: disabledProp,
2016
2016
  onChange,
2017
2017
  onKeyDown,
2018
+ submitOnEnter = true,
2019
+ cancelOnEscape = true,
2018
2020
  ...rest
2019
2021
  }, forwardedRef) => {
2020
2022
  const threadStore = useThreadStore();
@@ -2028,6 +2030,7 @@ var ComposerPrimitiveInput = forwardRef16(
2028
2030
  const textareaRef = useRef4(null);
2029
2031
  const ref = useComposedRefs2(forwardedRef, textareaRef);
2030
2032
  useEscapeKeydown2((e) => {
2033
+ if (!cancelOnEscape) return;
2031
2034
  const composer = composerStore.getState();
2032
2035
  if (composer.canCancel) {
2033
2036
  composer.cancel();
@@ -2035,7 +2038,7 @@ var ComposerPrimitiveInput = forwardRef16(
2035
2038
  }
2036
2039
  });
2037
2040
  const handleKeyPress = (e) => {
2038
- if (isDisabled) return;
2041
+ if (isDisabled || !submitOnEnter) return;
2039
2042
  if (e.nativeEvent.isComposing) return;
2040
2043
  if (e.key === "Enter" && e.shiftKey === false) {
2041
2044
  const { isRunning } = threadStore.getState();