@assistant-ui/react 0.5.62 → 0.5.63

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.d.mts CHANGED
@@ -1970,9 +1970,13 @@ declare const ComposerPrimitiveRoot: react.ForwardRefExoticComponent<Omit<Omit<r
1970
1970
 
1971
1971
  type ComposerPrimitiveInputProps = TextareaAutosizeProps & {
1972
1972
  asChild?: boolean | undefined;
1973
+ submitOnEnter?: boolean | undefined;
1974
+ cancelOnEscape?: boolean | undefined;
1973
1975
  };
1974
1976
  declare const ComposerPrimitiveInput: react.ForwardRefExoticComponent<TextareaAutosizeProps & {
1975
1977
  asChild?: boolean | undefined;
1978
+ submitOnEnter?: boolean | undefined;
1979
+ cancelOnEscape?: boolean | undefined;
1976
1980
  } & react.RefAttributes<HTMLTextAreaElement>>;
1977
1981
 
1978
1982
  type ComposerPrimitiveSendProps = ActionButtonProps<typeof useComposerSend>;
@@ -2362,6 +2366,8 @@ declare const _default$8: typeof BranchPicker & typeof exports$9;
2362
2366
  declare const Composer: FC;
2363
2367
  declare const ComposerInputStyled: react.ForwardRefExoticComponent<Partial<Omit<react_textarea_autosize.TextareaAutosizeProps & {
2364
2368
  asChild?: boolean | undefined;
2369
+ submitOnEnter?: boolean | undefined;
2370
+ cancelOnEscape?: boolean | undefined;
2365
2371
  } & react.RefAttributes<HTMLTextAreaElement>, "ref">> & react.RefAttributes<HTMLTextAreaElement>>;
2366
2372
  type ComposerInputProps = ComponentPropsWithoutRef<typeof ComposerInputStyled>;
2367
2373
  declare const exports$8: {
@@ -2372,6 +2378,8 @@ declare const exports$8: {
2372
2378
  }, "ref"> & react.RefAttributes<HTMLFormElement>, "ref">> & react.RefAttributes<HTMLFormElement>>;
2373
2379
  Input: react.ForwardRefExoticComponent<Omit<Partial<Omit<react_textarea_autosize.TextareaAutosizeProps & {
2374
2380
  asChild?: boolean | undefined;
2381
+ submitOnEnter?: boolean | undefined;
2382
+ cancelOnEscape?: boolean | undefined;
2375
2383
  } & react.RefAttributes<HTMLTextAreaElement>, "ref">> & react.RefAttributes<HTMLTextAreaElement>, "ref"> & react.RefAttributes<HTMLTextAreaElement>>;
2376
2384
  Action: FC;
2377
2385
  Send: react.ForwardRefExoticComponent<Partial<TooltipIconButtonProps> & react.RefAttributes<HTMLButtonElement>>;
@@ -2397,6 +2405,8 @@ declare const exports$6: {
2397
2405
  }, "ref"> & react.RefAttributes<HTMLFormElement>, "ref">> & react.RefAttributes<HTMLFormElement>>;
2398
2406
  Input: react.ForwardRefExoticComponent<Partial<Omit<react_textarea_autosize.TextareaAutosizeProps & {
2399
2407
  asChild?: boolean | undefined;
2408
+ submitOnEnter?: boolean | undefined;
2409
+ cancelOnEscape?: boolean | undefined;
2400
2410
  } & react.RefAttributes<HTMLTextAreaElement>, "ref">> & react.RefAttributes<HTMLTextAreaElement>>;
2401
2411
  Footer: react.ForwardRefExoticComponent<Partial<Omit<react.DetailedHTMLProps<react.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref">> & react.RefAttributes<HTMLDivElement>>;
2402
2412
  Cancel: react.ForwardRefExoticComponent<Partial<ButtonProps> & react.RefAttributes<HTMLButtonElement>>;
package/dist/index.d.ts CHANGED
@@ -1970,9 +1970,13 @@ declare const ComposerPrimitiveRoot: react.ForwardRefExoticComponent<Omit<Omit<r
1970
1970
 
1971
1971
  type ComposerPrimitiveInputProps = TextareaAutosizeProps & {
1972
1972
  asChild?: boolean | undefined;
1973
+ submitOnEnter?: boolean | undefined;
1974
+ cancelOnEscape?: boolean | undefined;
1973
1975
  };
1974
1976
  declare const ComposerPrimitiveInput: react.ForwardRefExoticComponent<TextareaAutosizeProps & {
1975
1977
  asChild?: boolean | undefined;
1978
+ submitOnEnter?: boolean | undefined;
1979
+ cancelOnEscape?: boolean | undefined;
1976
1980
  } & react.RefAttributes<HTMLTextAreaElement>>;
1977
1981
 
1978
1982
  type ComposerPrimitiveSendProps = ActionButtonProps<typeof useComposerSend>;
@@ -2362,6 +2366,8 @@ declare const _default$8: typeof BranchPicker & typeof exports$9;
2362
2366
  declare const Composer: FC;
2363
2367
  declare const ComposerInputStyled: react.ForwardRefExoticComponent<Partial<Omit<react_textarea_autosize.TextareaAutosizeProps & {
2364
2368
  asChild?: boolean | undefined;
2369
+ submitOnEnter?: boolean | undefined;
2370
+ cancelOnEscape?: boolean | undefined;
2365
2371
  } & react.RefAttributes<HTMLTextAreaElement>, "ref">> & react.RefAttributes<HTMLTextAreaElement>>;
2366
2372
  type ComposerInputProps = ComponentPropsWithoutRef<typeof ComposerInputStyled>;
2367
2373
  declare const exports$8: {
@@ -2372,6 +2378,8 @@ declare const exports$8: {
2372
2378
  }, "ref"> & react.RefAttributes<HTMLFormElement>, "ref">> & react.RefAttributes<HTMLFormElement>>;
2373
2379
  Input: react.ForwardRefExoticComponent<Omit<Partial<Omit<react_textarea_autosize.TextareaAutosizeProps & {
2374
2380
  asChild?: boolean | undefined;
2381
+ submitOnEnter?: boolean | undefined;
2382
+ cancelOnEscape?: boolean | undefined;
2375
2383
  } & react.RefAttributes<HTMLTextAreaElement>, "ref">> & react.RefAttributes<HTMLTextAreaElement>, "ref"> & react.RefAttributes<HTMLTextAreaElement>>;
2376
2384
  Action: FC;
2377
2385
  Send: react.ForwardRefExoticComponent<Partial<TooltipIconButtonProps> & react.RefAttributes<HTMLButtonElement>>;
@@ -2397,6 +2405,8 @@ declare const exports$6: {
2397
2405
  }, "ref"> & react.RefAttributes<HTMLFormElement>, "ref">> & react.RefAttributes<HTMLFormElement>>;
2398
2406
  Input: react.ForwardRefExoticComponent<Partial<Omit<react_textarea_autosize.TextareaAutosizeProps & {
2399
2407
  asChild?: boolean | undefined;
2408
+ submitOnEnter?: boolean | undefined;
2409
+ cancelOnEscape?: boolean | undefined;
2400
2410
  } & react.RefAttributes<HTMLTextAreaElement>, "ref">> & react.RefAttributes<HTMLTextAreaElement>>;
2401
2411
  Footer: react.ForwardRefExoticComponent<Partial<Omit<react.DetailedHTMLProps<react.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref">> & react.RefAttributes<HTMLDivElement>>;
2402
2412
  Cancel: react.ForwardRefExoticComponent<Partial<ButtonProps> & react.RefAttributes<HTMLButtonElement>>;
package/dist/index.js CHANGED
@@ -2015,6 +2015,8 @@ var ComposerPrimitiveInput = _react.forwardRef.call(void 0,
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 = _react.forwardRef.call(void 0,
2028
2030
  const textareaRef = _react.useRef.call(void 0, null);
2029
2031
  const ref = _reactcomposerefs.useComposedRefs.call(void 0, forwardedRef, textareaRef);
2030
2032
  _reactuseescapekeydown.useEscapeKeydown.call(void 0, (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 = _react.forwardRef.call(void 0,
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();