@superinterface/react 2.0.2 → 2.0.3
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.cjs +6 -8
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +6 -8
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1964,8 +1964,7 @@ import { useContext as useContext7 } from "react";
|
|
|
1964
1964
|
import { createContext as createContext6 } from "react";
|
|
1965
1965
|
var MessageFormContext = createContext6({
|
|
1966
1966
|
isDisabled: false,
|
|
1967
|
-
isLoading: false
|
|
1968
|
-
submit: function() {}
|
|
1967
|
+
isLoading: false
|
|
1969
1968
|
});
|
|
1970
1969
|
// src/hooks/messages/useMessageFormContext/index.ts
|
|
1971
1970
|
var useMessageFormContext = function() {
|
|
@@ -2213,8 +2212,7 @@ var Root2 = function(param) {
|
|
|
2213
2212
|
return /* @__PURE__ */ jsx39(MessageFormContext.Provider, {
|
|
2214
2213
|
value: {
|
|
2215
2214
|
isDisabled: isDisabled,
|
|
2216
|
-
isLoading: isLoading
|
|
2217
|
-
submit: handleSubmit(onSubmit)
|
|
2215
|
+
isLoading: isLoading
|
|
2218
2216
|
},
|
|
2219
2217
|
children: /* @__PURE__ */ jsx39(FormProvider, _object_spread_props(_object_spread({}, formProps), {
|
|
2220
2218
|
children: /* @__PURE__ */ jsx39("form", {
|
|
@@ -2285,7 +2283,7 @@ var Root3 = function(param) {
|
|
|
2285
2283
|
var Control = function() {
|
|
2286
2284
|
var assistantNameContext = useContext8(AssistantNameContext);
|
|
2287
2285
|
var register = useFormContext().register;
|
|
2288
|
-
var _useMessageFormContext = useMessageFormContext(), isDisabled = _useMessageFormContext.isDisabled, isLoading = _useMessageFormContext.isLoading
|
|
2286
|
+
var _useMessageFormContext = useMessageFormContext(), isDisabled = _useMessageFormContext.isDisabled, isLoading = _useMessageFormContext.isLoading;
|
|
2289
2287
|
var isSubmitDisabled = useMemo10(function() {
|
|
2290
2288
|
return isDisabled || isLoading;
|
|
2291
2289
|
}, [
|
|
@@ -2311,12 +2309,12 @@ var Control = function() {
|
|
|
2311
2309
|
disabled: isDisabled,
|
|
2312
2310
|
onKeyDown: function(e) {
|
|
2313
2311
|
if (e.key === "Enter" && !e.shiftKey) {
|
|
2312
|
+
var _e_currentTarget_form;
|
|
2314
2313
|
e.preventDefault();
|
|
2315
2314
|
if (isSubmitDisabled) return;
|
|
2316
|
-
|
|
2315
|
+
(_e_currentTarget_form = e.currentTarget.form) === null || _e_currentTarget_form === void 0 ? void 0 : _e_currentTarget_form.requestSubmit();
|
|
2317
2316
|
}
|
|
2318
|
-
}
|
|
2319
|
-
autoFocus: true
|
|
2317
|
+
}
|
|
2320
2318
|
}, textareaProps), {
|
|
2321
2319
|
ref: function(e) {
|
|
2322
2320
|
textareaProps.ref(e);
|