@builder.io/mitosis 0.0.56-100 → 0.0.56-101
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/src/__tests__/data/blocks/form.raw.jsx +5 -5
- package/dist/src/__tests__/data/jsx-json.spec.d.ts +2 -0
- package/dist/src/__tests__/data/jsx-json.spec.js +10226 -0
- package/dist/src/__tests__/parse-jsx.test.js +6 -0
- package/dist/src/generators/react/generator.d.ts +6 -0
- package/dist/src/generators/react/generator.js +447 -0
- package/dist/src/generators/react/helpers.d.ts +2 -0
- package/dist/src/generators/react/helpers.js +14 -0
- package/dist/src/generators/react/index.d.ts +2 -0
- package/dist/src/generators/react/index.js +18 -0
- package/dist/src/generators/react/state.d.ts +9 -0
- package/dist/src/generators/react/state.js +109 -0
- package/dist/src/generators/react/types.d.ts +10 -0
- package/dist/src/generators/react/types.js +2 -0
- package/dist/src/generators/react.js +6 -5
- package/dist/src/generators/solid/index.d.ts +3 -0
- package/dist/src/generators/solid/index.js +345 -0
- package/dist/src/generators/solid/state.d.ts +19 -0
- package/dist/src/generators/solid/state.js +144 -0
- package/dist/src/generators/solid/types.d.ts +6 -0
- package/dist/src/generators/solid/types.js +2 -0
- package/dist/src/generators/svelte.js +1 -1
- package/dist/src/helpers/babel-transform.js +2 -4
- package/dist/src/helpers/nullable.d.ts +3 -0
- package/dist/src/helpers/nullable.js +7 -0
- package/dist/src/helpers/state.d.ts +8 -1
- package/dist/src/helpers/state.js +32 -5
- package/dist/src/helpers/strip-state-and-props-refs.d.ts +1 -1
- package/dist/src/helpers/strip-state-and-props-refs.js +43 -31
- package/dist/src/helpers/styles/helpers.d.ts +2 -3
- package/dist/src/parsers/jsx/state.d.ts +1 -1
- package/dist/src/targets.d.ts +1 -1
- package/dist/src/types/mitosis-component.d.ts +1 -2
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +2 -2
|
@@ -45,12 +45,12 @@ var _fake_4 = require("@fake");
|
|
|
45
45
|
function FormComponent(props) {
|
|
46
46
|
var _a;
|
|
47
47
|
var state = (0, mitosis_1.useStore)({
|
|
48
|
-
|
|
48
|
+
formState: 'unsubmitted',
|
|
49
49
|
// TODO: separate response and error?
|
|
50
50
|
responseData: null,
|
|
51
51
|
formErrorMessage: '',
|
|
52
52
|
get submissionState() {
|
|
53
|
-
return (sdk_1.Builder.isEditing && props.previewState) || state.
|
|
53
|
+
return (sdk_1.Builder.isEditing && props.previewState) || state.formState;
|
|
54
54
|
},
|
|
55
55
|
onSubmit: function (event) {
|
|
56
56
|
var _this = this;
|
|
@@ -149,7 +149,7 @@ function FormComponent(props) {
|
|
|
149
149
|
return;
|
|
150
150
|
}
|
|
151
151
|
}
|
|
152
|
-
state.
|
|
152
|
+
state.formState = 'sending';
|
|
153
153
|
var formUrl = "".concat(sdk_1.builder.env === 'dev' ? 'http://localhost:5000' : 'https://builder.io', "/api/v1/form-submit?apiKey=").concat(sdk_1.builder.apiKey, "&to=").concat(btoa(props.sendSubmissionsToEmail || ''), "&name=").concat(encodeURIComponent(props.name || ''));
|
|
154
154
|
fetch(props.sendSubmissionsTo === 'email'
|
|
155
155
|
? formUrl
|
|
@@ -185,7 +185,7 @@ function FormComponent(props) {
|
|
|
185
185
|
}
|
|
186
186
|
}
|
|
187
187
|
state.responseData = body;
|
|
188
|
-
state.
|
|
188
|
+
state.formState = res.ok ? 'success' : 'error';
|
|
189
189
|
if (res.ok) {
|
|
190
190
|
submitSuccessEvent = new CustomEvent('submit:success', {
|
|
191
191
|
detail: {
|
|
@@ -237,7 +237,7 @@ function FormComponent(props) {
|
|
|
237
237
|
}
|
|
238
238
|
}
|
|
239
239
|
state.responseData = err;
|
|
240
|
-
state.
|
|
240
|
+
state.formState = 'error';
|
|
241
241
|
});
|
|
242
242
|
}
|
|
243
243
|
},
|