this.onBlur()}
- @input=\${(event) => (this.name = event.target.value)} />
+ @change=\${(event) => (this.name = event.target.value)} />
GR Supra
@@ -6066,9 +6098,9 @@ export default class FormInputComponent extends LitElement {
Builder.isEditing && this.defaultValue ? this.defaultValue : \\"default-key\\"
} .placeholder=\${this.placeholder}
.type=\${this.type} .name=\${this.name} .value=\${this.value}
- .defaultValue=\${this.defaultValue} .required=\${this.required} @input=\${(
- event
- ) => this.onChange?.(event.target.value)} />
+ .defaultValue=\${this.defaultValue} .required=\${
+ this.required
+ } @change=\${(event) => this.onChange?.(event.target.value)} />
\`;
}
@@ -6878,7 +6910,7 @@ export default class MyBasicForwardRefComponent extends LitElement {
}
-
+
(this.name = event.target.value)} />
@@ -6917,7 +6949,7 @@ export default class MyBasicForwardRefComponent extends LitElement {
}
-
+
(this.name = event.target.value)} />
@@ -7348,6 +7380,38 @@ export default class ComponentWithTypes extends LitElement {
"
`;
+exports[`Lit > jsx > Typescript Test > eventInputAndChange 1`] = `
+"import { LitElement, html, css } from \\"lit\\";
+import { customElement, property, state, query } from \\"lit/decorators.js\\";
+
+@customElement(\\"event-input-and-change\\")
+export default class EventInputAndChange extends LitElement {
+ createRenderRoot() {
+ return this;
+ }
+
+ @state() name = \\"Steve\\";
+
+ render() {
+ return html\`
+
+
+
+ (this.name = event.target.value)}
+ @change=\${(event) =>
+ (this.name = event.target.value)} /> Hello! I can run in
+ React, Vue, Solid, or Liquid!
+
+
+ \`;
+ }
+}
+"
+`;
+
exports[`Lit > jsx > Typescript Test > expressionState 1`] = `
"import { LitElement, html, css } from \\"lit\\";
import { customElement, property, state, query } from \\"lit/decorators.js\\";
@@ -9329,10 +9393,10 @@ export default class MyComponent extends LitElement {
return html\`
- (this.name = event.target.value)} .value=\${
- this.name
- }
- /> Hello! I can run in React, Vue, Solid, or Liquid!
+ (this.name = event.target.value)}
+ .value=\${
+ this.name
+ } /> Hello! I can run in React, Vue, Solid, or Liquid!
\`;
@@ -9377,21 +9441,21 @@ export default class MyComponent extends LitElement {
@@ -9715,9 +9779,9 @@ export default class MyComponent extends LitElement {
return html\`
-
+
(this.a = event.target.value)}
- .value=\${this.a} />
+ .value=\${this.a} />
(this.b = event.target.value)} .value=\${this.b} /> Result: \${this.result}
@@ -9824,10 +9888,10 @@ export default class MyComponent extends LitElement {
return html\`
- (this.name = event.target.value)} .value=\${
- this.name
- }
- /> Hello! I can run in React, Vue, Solid, or Liquid!
+ (this.name = event.target.value)}
+ .value=\${
+ this.name
+ } /> Hello! I can run in React, Vue, Solid, or Liquid!
\`;
@@ -9872,21 +9936,21 @@ export default class MyComponent extends LitElement {
@@ -10210,9 +10274,9 @@ export default class MyComponent extends LitElement {
return html\`
-
+
(this.a = event.target.value)}
- .value=\${this.a} />
+ .value=\${this.a} />
(this.b = event.target.value)} .value=\${this.b} /> Result: \${this.result}
diff --git a/packages/core/src/__tests__/__snapshots__/marko.test.ts.snap b/packages/core/src/__tests__/__snapshots__/marko.test.ts.snap
index c75a649492..4386722c0a 100644
--- a/packages/core/src/__tests__/__snapshots__/marko.test.ts.snap
+++ b/packages/core/src/__tests__/__snapshots__/marko.test.ts.snap
@@ -1677,6 +1677,30 @@ class {}
Hello \${input.name || DEFAULT_VALUES.name}
"
`;
+exports[`Marko > jsx > Javascript Test > eventInputAndChange 1`] = `
+"class {
+ onCreate() {
+ this.state = { name: \\"Steve\\" };
+ }
+}
+
+style {
+ .input-4aba533e {
+ color: red;
+ }
+}
+
+ state.name = event.target.value)
+ on-input((event) => state.name = event.target.value)
+ />
+
+ Hello! I can run in React, Vue, Solid, or Liquid!
+
"
+`;
+
exports[`Marko > jsx > Javascript Test > expressionState 1`] = `
"class {
onCreate(input) {
@@ -4299,6 +4323,30 @@ class {}
Hello \${input.name || DEFAULT_VALUES.name}
"
`;
+exports[`Marko > jsx > Typescript Test > eventInputAndChange 1`] = `
+"class {
+ onCreate() {
+ this.state = { name: \\"Steve\\" };
+ }
+}
+
+style {
+ .input-4aba533e {
+ color: red;
+ }
+}
+
+ state.name = event.target.value)
+ on-input((event) => state.name = event.target.value)
+ />
+
+ Hello! I can run in React, Vue, Solid, or Liquid!
+
"
+`;
+
exports[`Marko > jsx > Typescript Test > expressionState 1`] = `
"class {
onCreate(input) {
diff --git a/packages/core/src/__tests__/__snapshots__/mitosis.test.ts.snap b/packages/core/src/__tests__/__snapshots__/mitosis.test.ts.snap
index 4388c1fc99..d3d340ddf2 100644
--- a/packages/core/src/__tests__/__snapshots__/mitosis.test.ts.snap
+++ b/packages/core/src/__tests__/__snapshots__/mitosis.test.ts.snap
@@ -1834,6 +1834,29 @@ export default function ComponentWithTypes(props) {
"
`;
+exports[`Mitosis, format: legacy (native loops and conditionals) > jsx > Javascript Test > eventInputAndChange 1`] = `
+"import { useStore } from \\"@builder.io/mitosis\\";
+
+export default function EventInputAndChange(props) {
+ const state = useStore({ name: \\"Steve\\" });
+
+ return [
+
+ (state.name = event.target.value)}
+ onChange={(event) => (state.name = event.target.value)}
+ />
+ Hello! I can run in React, Vue, Solid, or Liquid!
+
,
+ ];
+}
+"
+`;
+
exports[`Mitosis, format: legacy (native loops and conditionals) > jsx > Javascript Test > expressionState 1`] = `
"import { useStore } from \\"@builder.io/mitosis\\";
@@ -5052,6 +5075,29 @@ export default function ComponentWithTypes(props) {
"
`;
+exports[`Mitosis, format: legacy (native loops and conditionals) > jsx > Typescript Test > eventInputAndChange 1`] = `
+"import { useStore } from \\"@builder.io/mitosis\\";
+
+export default function EventInputAndChange(props) {
+ const state = useStore({ name: \\"Steve\\" });
+
+ return [
+
+ (state.name = event.target.value)}
+ onChange={(event) => (state.name = event.target.value)}
+ />
+ Hello! I can run in React, Vue, Solid, or Liquid!
+
,
+ ];
+}
+"
+`;
+
exports[`Mitosis, format: legacy (native loops and conditionals) > jsx > Typescript Test > expressionState 1`] = `
"import { useStore } from \\"@builder.io/mitosis\\";
@@ -8809,6 +8855,29 @@ export default function ComponentWithTypes(props) {
"
`;
+exports[`Mitosis, format: legacy > jsx > Javascript Test > eventInputAndChange 1`] = `
+"import { useStore } from \\"@builder.io/mitosis\\";
+
+export default function EventInputAndChange(props) {
+ const state = useStore({ name: \\"Steve\\" });
+
+ return (
+
+ (state.name = event.target.value)}
+ onChange={(event) => (state.name = event.target.value)}
+ />
+ Hello! I can run in React, Vue, Solid, or Liquid!
+
+ );
+}
+"
+`;
+
exports[`Mitosis, format: legacy > jsx > Javascript Test > expressionState 1`] = `
"import { useStore } from \\"@builder.io/mitosis\\";
@@ -12084,6 +12153,29 @@ export default function ComponentWithTypes(props) {
"
`;
+exports[`Mitosis, format: legacy > jsx > Typescript Test > eventInputAndChange 1`] = `
+"import { useStore } from \\"@builder.io/mitosis\\";
+
+export default function EventInputAndChange(props) {
+ const state = useStore({ name: \\"Steve\\" });
+
+ return (
+
+ (state.name = event.target.value)}
+ onChange={(event) => (state.name = event.target.value)}
+ />
+ Hello! I can run in React, Vue, Solid, or Liquid!
+
+ );
+}
+"
+`;
+
exports[`Mitosis, format: legacy > jsx > Typescript Test > expressionState 1`] = `
"import { useStore } from \\"@builder.io/mitosis\\";
@@ -16165,6 +16257,33 @@ export default ComponentWithTypes;
"
`;
+exports[`Mitosis, format: react > jsx > Javascript Test > eventInputAndChange 1`] = `
+"\\"use client\\";
+import * as React from \\"react\\";
+import { useState } from \\"react\\";
+
+function EventInputAndChange(props) {
+ const [name, setName] = useState(() => \\"Steve\\");
+
+ return (
+
+ setName(event.target.value)}
+ onChange={(event) => setName(event.target.value)}
+ />
+ Hello! I can run in React, Vue, Solid, or Liquid!
+
+ );
+}
+
+export default EventInputAndChange;
+"
+`;
+
exports[`Mitosis, format: react > jsx > Javascript Test > expressionState 1`] = `
"\\"use client\\";
import * as React from \\"react\\";
@@ -19733,6 +19852,33 @@ export default ComponentWithTypes;
"
`;
+exports[`Mitosis, format: react > jsx > Typescript Test > eventInputAndChange 1`] = `
+"\\"use client\\";
+import * as React from \\"react\\";
+import { useState } from \\"react\\";
+
+function EventInputAndChange(props) {
+ const [name, setName] = useState(() => \\"Steve\\");
+
+ return (
+
+ setName(event.target.value)}
+ onChange={(event) => setName(event.target.value)}
+ />
+ Hello! I can run in React, Vue, Solid, or Liquid!
+
+ );
+}
+
+export default EventInputAndChange;
+"
+`;
+
exports[`Mitosis, format: react > jsx > Typescript Test > expressionState 1`] = `
"\\"use client\\";
import * as React from \\"react\\";
diff --git a/packages/core/src/__tests__/__snapshots__/parse-jsx.test.ts.snap b/packages/core/src/__tests__/__snapshots__/parse-jsx.test.ts.snap
index eb5a1ced5b..424d58cd78 100644
--- a/packages/core/src/__tests__/__snapshots__/parse-jsx.test.ts.snap
+++ b/packages/core/src/__tests__/__snapshots__/parse-jsx.test.ts.snap
@@ -7170,6 +7170,97 @@ exports[`Parse JSX > Javascript > defaultValsWithTypes 1`] = `
}
`;
+exports[`Parse JSX > Javascript > eventInputAndChange 1`] = `
+{
+ "@type": "@builder.io/mitosis/component",
+ "children": [
+ {
+ "@type": "@builder.io/mitosis/node",
+ "bindings": {},
+ "children": [
+ {
+ "@type": "@builder.io/mitosis/node",
+ "bindings": {
+ "css": {
+ "bindingType": "expression",
+ "code": "{
+ color: 'red'
+}",
+ "type": "single",
+ },
+ "onChange": {
+ "arguments": [
+ "event",
+ ],
+ "bindingType": "function",
+ "code": "state.name = event.target.value",
+ "type": "single",
+ },
+ "onInput": {
+ "arguments": [
+ "event",
+ ],
+ "bindingType": "function",
+ "code": "state.name = event.target.value",
+ "type": "single",
+ },
+ "value": {
+ "bindingType": "expression",
+ "code": "state.name",
+ "type": "single",
+ },
+ },
+ "children": [],
+ "meta": {},
+ "name": "input",
+ "properties": {},
+ "scope": {},
+ },
+ {
+ "@type": "@builder.io/mitosis/node",
+ "bindings": {},
+ "children": [],
+ "meta": {},
+ "name": "div",
+ "properties": {
+ "_text": "
+ Hello! I can run in React, Vue, Solid, or Liquid!
+ ",
+ },
+ "scope": {},
+ },
+ ],
+ "meta": {},
+ "name": "div",
+ "properties": {},
+ "scope": {},
+ },
+ ],
+ "context": {
+ "get": {},
+ "set": {},
+ },
+ "exports": {},
+ "hooks": {
+ "onEvent": [],
+ "onMount": [],
+ },
+ "imports": [],
+ "inputs": [],
+ "meta": {},
+ "name": "EventInputAndChange",
+ "refs": {},
+ "state": {
+ "name": {
+ "code": "'Steve'",
+ "propertyType": "normal",
+ "type": "property",
+ },
+ },
+ "subComponents": [],
+}
+`;
+
exports[`Parse JSX > Javascript > expressionState 1`] = `
{
"@type": "@builder.io/mitosis/component",
@@ -19893,6 +19984,97 @@ exports[`Parse JSX > Typescript > defaultValsWithTypes 1`] = `
}
`;
+exports[`Parse JSX > Typescript > eventInputAndChange 1`] = `
+{
+ "@type": "@builder.io/mitosis/component",
+ "children": [
+ {
+ "@type": "@builder.io/mitosis/node",
+ "bindings": {},
+ "children": [
+ {
+ "@type": "@builder.io/mitosis/node",
+ "bindings": {
+ "css": {
+ "bindingType": "expression",
+ "code": "{
+ color: 'red'
+}",
+ "type": "single",
+ },
+ "onChange": {
+ "arguments": [
+ "event",
+ ],
+ "bindingType": "function",
+ "code": "state.name = event.target.value",
+ "type": "single",
+ },
+ "onInput": {
+ "arguments": [
+ "event",
+ ],
+ "bindingType": "function",
+ "code": "state.name = event.target.value",
+ "type": "single",
+ },
+ "value": {
+ "bindingType": "expression",
+ "code": "state.name",
+ "type": "single",
+ },
+ },
+ "children": [],
+ "meta": {},
+ "name": "input",
+ "properties": {},
+ "scope": {},
+ },
+ {
+ "@type": "@builder.io/mitosis/node",
+ "bindings": {},
+ "children": [],
+ "meta": {},
+ "name": "div",
+ "properties": {
+ "_text": "
+ Hello! I can run in React, Vue, Solid, or Liquid!
+ ",
+ },
+ "scope": {},
+ },
+ ],
+ "meta": {},
+ "name": "div",
+ "properties": {},
+ "scope": {},
+ },
+ ],
+ "context": {
+ "get": {},
+ "set": {},
+ },
+ "exports": {},
+ "hooks": {
+ "onEvent": [],
+ "onMount": [],
+ },
+ "imports": [],
+ "inputs": [],
+ "meta": {},
+ "name": "EventInputAndChange",
+ "refs": {},
+ "state": {
+ "name": {
+ "code": "'Steve'",
+ "propertyType": "normal",
+ "type": "property",
+ },
+ },
+ "subComponents": [],
+}
+`;
+
exports[`Parse JSX > Typescript > expressionState 1`] = `
{
"@type": "@builder.io/mitosis/component",
diff --git a/packages/core/src/__tests__/__snapshots__/preact.test.ts.snap b/packages/core/src/__tests__/__snapshots__/preact.test.ts.snap
index 1504e2e618..914d385e35 100644
--- a/packages/core/src/__tests__/__snapshots__/preact.test.ts.snap
+++ b/packages/core/src/__tests__/__snapshots__/preact.test.ts.snap
@@ -2080,6 +2080,38 @@ export default ComponentWithTypes;
"
`;
+exports[`Preact > jsx > Javascript Test > eventInputAndChange 1`] = `
+"/** @jsx h */
+import { h, Fragment } from \\"preact\\";
+import { useState } from \\"preact/hooks\\";
+
+function EventInputAndChange(props) {
+ const [name, setName] = useState(() => \\"Steve\\");
+
+ return (
+
+
+ setName(event.target.value)}
+ onChange={(event) => setName(event.target.value)}
+ />
+ Hello! I can run in React, Vue, Solid, or Liquid!
+
+
+
+ );
+}
+
+export default EventInputAndChange;
+"
+`;
+
exports[`Preact > jsx > Javascript Test > expressionState 1`] = `
"/** @jsx h */
import { h, Fragment } from \\"preact\\";
@@ -5975,6 +6007,38 @@ export default ComponentWithTypes;
"
`;
+exports[`Preact > jsx > Typescript Test > eventInputAndChange 1`] = `
+"/** @jsx h */
+import { h, Fragment } from \\"preact\\";
+import { useState } from \\"preact/hooks\\";
+
+function EventInputAndChange(props: any) {
+ const [name, setName] = useState(() => \\"Steve\\");
+
+ return (
+
+
+ setName(event.target.value)}
+ onChange={(event) => setName(event.target.value)}
+ />
+ Hello! I can run in React, Vue, Solid, or Liquid!
+
+
+
+ );
+}
+
+export default EventInputAndChange;
+"
+`;
+
exports[`Preact > jsx > Typescript Test > expressionState 1`] = `
"/** @jsx h */
import { h, Fragment } from \\"preact\\";
diff --git a/packages/core/src/__tests__/__snapshots__/qwik.test.ts.snap b/packages/core/src/__tests__/__snapshots__/qwik.test.ts.snap
index eaf96b9dd4..e5072a17f2 100644
--- a/packages/core/src/__tests__/__snapshots__/qwik.test.ts.snap
+++ b/packages/core/src/__tests__/__snapshots__/qwik.test.ts.snap
@@ -3889,6 +3889,44 @@ export default ComponentWithTypes;
"
`;
+exports[`qwik > jsx > Javascript Test > eventInputAndChange 1`] = `
+"import {
+ $,
+ Fragment,
+ component$,
+ h,
+ useStore,
+ useStylesScoped$,
+} from \\"@builder.io/qwik\\";
+
+export const EventInputAndChange = component$((props) => {
+ useStylesScoped$(STYLES);
+
+ const state = useStore({ name: \\"Steve\\" });
+
+ return (
+
+ (state.name = event.target.value))}
+ onChange$={$((event) => (state.name = event.target.value))}
+ />
+ Hello! I can run in React, Vue, Solid, or Liquid!
+
+ );
+});
+
+export default EventInputAndChange;
+
+export const STYLES = \`
+.input-EventInputAndChange {
+ color: red;
+}
+\`;
+"
+`;
+
exports[`qwik > jsx > Javascript Test > expressionState 1`] = `
"import { Fragment, component$, h, useStore } from \\"@builder.io/qwik\\";
@@ -7708,6 +7746,44 @@ export default ComponentWithTypes;
"
`;
+exports[`qwik > jsx > Typescript Test > eventInputAndChange 1`] = `
+"import {
+ $,
+ Fragment,
+ component$,
+ h,
+ useStore,
+ useStylesScoped$,
+} from \\"@builder.io/qwik\\";
+
+export const EventInputAndChange = component$((props: any) => {
+ useStylesScoped$(STYLES);
+
+ const state = useStore({ name: \\"Steve\\" });
+
+ return (
+
+ (state.name = event.target.value))}
+ onChange$={$((event) => (state.name = event.target.value))}
+ />
+ Hello! I can run in React, Vue, Solid, or Liquid!
+
+ );
+});
+
+export default EventInputAndChange;
+
+export const STYLES = \`
+.input-EventInputAndChange {
+ color: red;
+}
+\`;
+"
+`;
+
exports[`qwik > jsx > Typescript Test > expressionState 1`] = `
"import { Fragment, component$, h, useStore } from \\"@builder.io/qwik\\";
diff --git a/packages/core/src/__tests__/__snapshots__/react-native.test.ts.snap b/packages/core/src/__tests__/__snapshots__/react-native.test.ts.snap
index d08442e341..a0004ba2dc 100644
--- a/packages/core/src/__tests__/__snapshots__/react-native.test.ts.snap
+++ b/packages/core/src/__tests__/__snapshots__/react-native.test.ts.snap
@@ -2770,6 +2770,45 @@ export default ComponentWithTypes;
"
`;
+exports[`React Native > jsx > Javascript Test > eventInputAndChange 1`] = `
+"import * as React from \\"react\\";
+import {
+ FlatList,
+ ScrollView,
+ View,
+ StyleSheet,
+ Image,
+ Text,
+ Pressable,
+ TextInput,
+ TouchableOpacity,
+ Button,
+ Linking,
+} from \\"react-native\\";
+import { useState } from \\"react\\";
+
+function EventInputAndChange(props) {
+ const [name, setName] = useState(() => \\"Steve\\");
+
+ return (
+
+ setName(event.target.value)}
+ onChange={(event) => setName(event.target.value)}
+ style={styles.textInput1}
+ />
+ Hello! I can run in React, Vue, Solid, or Liquid!
+
+ );
+}
+
+const styles = StyleSheet.create({ textInput1: { color: \\"red\\" } });
+
+export default EventInputAndChange;
+"
+`;
+
exports[`React Native > jsx > Javascript Test > expressionState 1`] = `
"import * as React from \\"react\\";
import {
@@ -8103,6 +8142,45 @@ export default ComponentWithTypes;
"
`;
+exports[`React Native > jsx > Typescript Test > eventInputAndChange 1`] = `
+"import * as React from \\"react\\";
+import {
+ FlatList,
+ ScrollView,
+ View,
+ StyleSheet,
+ Image,
+ Text,
+ Pressable,
+ TextInput,
+ TouchableOpacity,
+ Button,
+ Linking,
+} from \\"react-native\\";
+import { useState } from \\"react\\";
+
+function EventInputAndChange(props: any) {
+ const [name, setName] = useState(() => \\"Steve\\");
+
+ return (
+
+ setName(event.target.value)}
+ onChange={(event) => setName(event.target.value)}
+ style={styles.textInput1}
+ />
+ Hello! I can run in React, Vue, Solid, or Liquid!
+
+ );
+}
+
+const styles = StyleSheet.create({ textInput1: { color: \\"red\\" } });
+
+export default EventInputAndChange;
+"
+`;
+
exports[`React Native > jsx > Typescript Test > expressionState 1`] = `
"import * as React from \\"react\\";
import {
diff --git a/packages/core/src/__tests__/__snapshots__/react-state-builder.test.ts.snap b/packages/core/src/__tests__/__snapshots__/react-state-builder.test.ts.snap
index 1a1b0449c3..b7172bba6c 100644
--- a/packages/core/src/__tests__/__snapshots__/react-state-builder.test.ts.snap
+++ b/packages/core/src/__tests__/__snapshots__/react-state-builder.test.ts.snap
@@ -2107,6 +2107,37 @@ export default ComponentWithTypes;
"
`;
+exports[`React - stateType: builder > jsx > Javascript Test > eventInputAndChange 1`] = `
+"\\"use client\\";
+import * as React from \\"react\\";
+
+function EventInputAndChange(props) {
+ const state = useBuilderState({ name: \\"Steve\\" });
+
+ return (
+ <>
+
+ (state.name = event.target.value)}
+ onChange={(event) => (state.name = event.target.value)}
+ />
+ Hello! I can run in React, Vue, Solid, or Liquid!
+
+
+ >
+ );
+}
+
+export default EventInputAndChange;
+"
+`;
+
exports[`React - stateType: builder > jsx > Javascript Test > expressionState 1`] = `
"\\"use client\\";
import * as React from \\"react\\";
@@ -5988,6 +6019,37 @@ export default ComponentWithTypes;
"
`;
+exports[`React - stateType: builder > jsx > Typescript Test > eventInputAndChange 1`] = `
+"\\"use client\\";
+import * as React from \\"react\\";
+
+function EventInputAndChange(props: any) {
+ const state = useBuilderState({ name: \\"Steve\\" });
+
+ return (
+ <>
+
+ (state.name = event.target.value)}
+ onChange={(event) => (state.name = event.target.value)}
+ />
+ Hello! I can run in React, Vue, Solid, or Liquid!
+
+
+ >
+ );
+}
+
+export default EventInputAndChange;
+"
+`;
+
exports[`React - stateType: builder > jsx > Typescript Test > expressionState 1`] = `
"\\"use client\\";
import * as React from \\"react\\";
diff --git a/packages/core/src/__tests__/__snapshots__/react-state-mobx.test.ts.snap b/packages/core/src/__tests__/__snapshots__/react-state-mobx.test.ts.snap
index 50a4d8c281..2c8cff924d 100644
--- a/packages/core/src/__tests__/__snapshots__/react-state-mobx.test.ts.snap
+++ b/packages/core/src/__tests__/__snapshots__/react-state-mobx.test.ts.snap
@@ -2150,6 +2150,39 @@ export default observedComponentWithTypes;
"
`;
+exports[`React - stateType: mobx > jsx > Javascript Test > eventInputAndChange 1`] = `
+"\\"use client\\";
+import * as React from \\"react\\";
+import { useLocalObservable, observer } from \\"mobx-react-lite\\";
+
+function EventInputAndChange(props) {
+ const state = useLocalObservable(() => ({ name: \\"Steve\\" }));
+
+ return (
+ <>
+
+ (state.name = event.target.value)}
+ onChange={(event) => (state.name = event.target.value)}
+ />
+ Hello! I can run in React, Vue, Solid, or Liquid!
+
+
+ >
+ );
+}
+
+const observedEventInputAndChange = observer(EventInputAndChange);
+export default observedEventInputAndChange;
+"
+`;
+
exports[`React - stateType: mobx > jsx > Javascript Test > expressionState 1`] = `
"\\"use client\\";
import * as React from \\"react\\";
@@ -6057,6 +6090,39 @@ export default observedComponentWithTypes;
"
`;
+exports[`React - stateType: mobx > jsx > Typescript Test > eventInputAndChange 1`] = `
+"\\"use client\\";
+import * as React from \\"react\\";
+import { useLocalObservable, observer } from \\"mobx-react-lite\\";
+
+function EventInputAndChange(props: any) {
+ const state = useLocalObservable(() => ({ name: \\"Steve\\" }));
+
+ return (
+ <>
+
+ (state.name = event.target.value)}
+ onChange={(event) => (state.name = event.target.value)}
+ />
+ Hello! I can run in React, Vue, Solid, or Liquid!
+
+
+ >
+ );
+}
+
+const observedEventInputAndChange = observer(EventInputAndChange);
+export default observedEventInputAndChange;
+"
+`;
+
exports[`React - stateType: mobx > jsx > Typescript Test > expressionState 1`] = `
"\\"use client\\";
import * as React from \\"react\\";
diff --git a/packages/core/src/__tests__/__snapshots__/react-state-solid.test.ts.snap b/packages/core/src/__tests__/__snapshots__/react-state-solid.test.ts.snap
index 4f0d7f0fa5..4f991e00a1 100644
--- a/packages/core/src/__tests__/__snapshots__/react-state-solid.test.ts.snap
+++ b/packages/core/src/__tests__/__snapshots__/react-state-solid.test.ts.snap
@@ -2084,6 +2084,38 @@ export default ComponentWithTypes;
"
`;
+exports[`React - stateType: solid > jsx > Javascript Test > eventInputAndChange 1`] = `
+"\\"use client\\";
+import * as React from \\"react\\";
+import { useMutable } from \\"react-solid-state\\";
+
+function EventInputAndChange(props) {
+ const state = useMutable({ name: \\"Steve\\" });
+
+ return (
+ <>
+
+ (state.name = event.target.value)}
+ onChange={(event) => (state.name = event.target.value)}
+ />
+ Hello! I can run in React, Vue, Solid, or Liquid!
+
+
+ >
+ );
+}
+
+export default EventInputAndChange;
+"
+`;
+
exports[`React - stateType: solid > jsx > Javascript Test > expressionState 1`] = `
"\\"use client\\";
import * as React from \\"react\\";
@@ -5873,6 +5905,38 @@ export default ComponentWithTypes;
"
`;
+exports[`React - stateType: solid > jsx > Typescript Test > eventInputAndChange 1`] = `
+"\\"use client\\";
+import * as React from \\"react\\";
+import { useMutable } from \\"react-solid-state\\";
+
+function EventInputAndChange(props: any) {
+ const state = useMutable({ name: \\"Steve\\" });
+
+ return (
+ <>
+
+ (state.name = event.target.value)}
+ onChange={(event) => (state.name = event.target.value)}
+ />
+ Hello! I can run in React, Vue, Solid, or Liquid!
+
+
+ >
+ );
+}
+
+export default EventInputAndChange;
+"
+`;
+
exports[`React - stateType: solid > jsx > Typescript Test > expressionState 1`] = `
"\\"use client\\";
import * as React from \\"react\\";
diff --git a/packages/core/src/__tests__/__snapshots__/react-state-valtio.test.ts.snap b/packages/core/src/__tests__/__snapshots__/react-state-valtio.test.ts.snap
index 71f031cab0..fcb771543c 100644
--- a/packages/core/src/__tests__/__snapshots__/react-state-valtio.test.ts.snap
+++ b/packages/core/src/__tests__/__snapshots__/react-state-valtio.test.ts.snap
@@ -2087,6 +2087,38 @@ export default ComponentWithTypes;
"
`;
+exports[`React - stateType: valtio > jsx > Javascript Test > eventInputAndChange 1`] = `
+"\\"use client\\";
+import * as React from \\"react\\";
+import { useLocalProxy } from \\"valtio/utils\\";
+
+function EventInputAndChange(props) {
+ const state = useLocalProxy({ name: \\"Steve\\" });
+
+ return (
+ <>
+
+ (state.name = event.target.value)}
+ onChange={(event) => (state.name = event.target.value)}
+ />
+ Hello! I can run in React, Vue, Solid, or Liquid!
+
+
+ >
+ );
+}
+
+export default EventInputAndChange;
+"
+`;
+
exports[`React - stateType: valtio > jsx > Javascript Test > expressionState 1`] = `
"\\"use client\\";
import * as React from \\"react\\";
@@ -5879,6 +5911,38 @@ export default ComponentWithTypes;
"
`;
+exports[`React - stateType: valtio > jsx > Typescript Test > eventInputAndChange 1`] = `
+"\\"use client\\";
+import * as React from \\"react\\";
+import { useLocalProxy } from \\"valtio/utils\\";
+
+function EventInputAndChange(props: any) {
+ const state = useLocalProxy({ name: \\"Steve\\" });
+
+ return (
+ <>
+
+ (state.name = event.target.value)}
+ onChange={(event) => (state.name = event.target.value)}
+ />
+ Hello! I can run in React, Vue, Solid, or Liquid!
+
+
+ >
+ );
+}
+
+export default EventInputAndChange;
+"
+`;
+
exports[`React - stateType: valtio > jsx > Typescript Test > expressionState 1`] = `
"\\"use client\\";
import * as React from \\"react\\";
diff --git a/packages/core/src/__tests__/__snapshots__/react-state-variables.test.ts.snap b/packages/core/src/__tests__/__snapshots__/react-state-variables.test.ts.snap
index e91dca6da7..f44535b561 100644
--- a/packages/core/src/__tests__/__snapshots__/react-state-variables.test.ts.snap
+++ b/packages/core/src/__tests__/__snapshots__/react-state-variables.test.ts.snap
@@ -1519,6 +1519,37 @@ export default ComponentWithTypes;
"
`;
+exports[`React - stateType: variables > jsx > Javascript Test > eventInputAndChange 1`] = `
+"\\"use client\\";
+import * as React from \\"react\\";
+
+function EventInputAndChange(props) {
+ const name = \\"Steve\\";
+
+ return (
+ <>
+
+ (name = event.target.value)}
+ onChange={(event) => (name = event.target.value)}
+ />
+ Hello! I can run in React, Vue, Solid, or Liquid!
+
+
+ >
+ );
+}
+
+export default EventInputAndChange;
+"
+`;
+
exports[`React - stateType: variables > jsx > Javascript Test > expressionState 1`] = `
"\\"use client\\";
import * as React from \\"react\\";
@@ -4413,6 +4444,37 @@ export default ComponentWithTypes;
"
`;
+exports[`React - stateType: variables > jsx > Typescript Test > eventInputAndChange 1`] = `
+"\\"use client\\";
+import * as React from \\"react\\";
+
+function EventInputAndChange(props: any) {
+ const name = \\"Steve\\";
+
+ return (
+ <>
+
+ (name = event.target.value)}
+ onChange={(event) => (name = event.target.value)}
+ />
+ Hello! I can run in React, Vue, Solid, or Liquid!
+
+
+ >
+ );
+}
+
+export default EventInputAndChange;
+"
+`;
+
exports[`React - stateType: variables > jsx > Typescript Test > expressionState 1`] = `
"\\"use client\\";
import * as React from \\"react\\";
diff --git a/packages/core/src/__tests__/__snapshots__/react.test.ts.snap b/packages/core/src/__tests__/__snapshots__/react.test.ts.snap
index 83ea78ca4d..12e4a119d6 100644
--- a/packages/core/src/__tests__/__snapshots__/react.test.ts.snap
+++ b/packages/core/src/__tests__/__snapshots__/react.test.ts.snap
@@ -2063,6 +2063,38 @@ export default ComponentWithTypes;
"
`;
+exports[`React - stateType: useState > jsx > Javascript Test > eventInputAndChange 1`] = `
+"\\"use client\\";
+import * as React from \\"react\\";
+import { useState } from \\"react\\";
+
+function EventInputAndChange(props) {
+ const [name, setName] = useState(() => \\"Steve\\");
+
+ return (
+ <>
+
+ setName(event.target.value)}
+ onChange={(event) => setName(event.target.value)}
+ />
+ Hello! I can run in React, Vue, Solid, or Liquid!
+
+
+ >
+ );
+}
+
+export default EventInputAndChange;
+"
+`;
+
exports[`React - stateType: useState > jsx > Javascript Test > expressionState 1`] = `
"\\"use client\\";
import * as React from \\"react\\";
@@ -5855,6 +5887,38 @@ export default ComponentWithTypes;
"
`;
+exports[`React - stateType: useState > jsx > Typescript Test > eventInputAndChange 1`] = `
+"\\"use client\\";
+import * as React from \\"react\\";
+import { useState } from \\"react\\";
+
+function EventInputAndChange(props: any) {
+ const [name, setName] = useState(() => \\"Steve\\");
+
+ return (
+ <>
+
+ setName(event.target.value)}
+ onChange={(event) => setName(event.target.value)}
+ />
+ Hello! I can run in React, Vue, Solid, or Liquid!
+
+
+ >
+ );
+}
+
+export default EventInputAndChange;
+"
+`;
+
exports[`React - stateType: useState > jsx > Typescript Test > expressionState 1`] = `
"\\"use client\\";
import * as React from \\"react\\";
diff --git a/packages/core/src/__tests__/__snapshots__/rsc.test.ts.snap b/packages/core/src/__tests__/__snapshots__/rsc.test.ts.snap
index 44efc1e0d1..30048b6bfa 100644
--- a/packages/core/src/__tests__/__snapshots__/rsc.test.ts.snap
+++ b/packages/core/src/__tests__/__snapshots__/rsc.test.ts.snap
@@ -2060,6 +2060,38 @@ export default ComponentWithTypes;
"
`;
+exports[`RSC > jsx > Javascript Test > eventInputAndChange 1`] = `
+"\\"use client\\";
+import * as React from \\"react\\";
+import { useState } from \\"react\\";
+
+function EventInputAndChange(props) {
+ const [name, setName] = useState(() => \\"Steve\\");
+
+ return (
+ <>
+
+ setName(event.target.value)}
+ onChange={(event) => setName(event.target.value)}
+ />
+ Hello! I can run in React, Vue, Solid, or Liquid!
+
+
+ >
+ );
+}
+
+export default EventInputAndChange;
+"
+`;
+
exports[`RSC > jsx > Javascript Test > expressionState 1`] = `
"\\"use client\\";
import * as React from \\"react\\";
@@ -5581,6 +5613,38 @@ export default ComponentWithTypes;
"
`;
+exports[`RSC > jsx > Typescript Test > eventInputAndChange 1`] = `
+"\\"use client\\";
+import * as React from \\"react\\";
+import { useState } from \\"react\\";
+
+function EventInputAndChange(props: any) {
+ const [name, setName] = useState(() => \\"Steve\\");
+
+ return (
+ <>
+
+ setName(event.target.value)}
+ onChange={(event) => setName(event.target.value)}
+ />
+ Hello! I can run in React, Vue, Solid, or Liquid!
+
+
+ >
+ );
+}
+
+export default EventInputAndChange;
+"
+`;
+
exports[`RSC > jsx > Typescript Test > expressionState 1`] = `
"\\"use client\\";
import * as React from \\"react\\";
diff --git a/packages/core/src/__tests__/__snapshots__/solid.test.ts.snap b/packages/core/src/__tests__/__snapshots__/solid.test.ts.snap
index 021f9e0302..9f64f8eaf9 100644
--- a/packages/core/src/__tests__/__snapshots__/solid.test.ts.snap
+++ b/packages/core/src/__tests__/__snapshots__/solid.test.ts.snap
@@ -4560,6 +4560,62 @@ export default ComponentWithTypes;
"
`;
+exports[`Solid > jsx > Javascript Test > eventInputAndChange 1`] = `
+"import { createSignal, createMemo } from \\"solid-js\\";
+
+function EventInputAndChange(props) {
+ const [name, setName] = createSignal(\\"Steve\\");
+
+ return (
+ <>
+
+ setName(event.target.value)}
+ onInput={(event) => setName(event.target.value)}
+ />
+ Hello! I can run in React, Vue, Solid, or Liquid!
+
+
+ >
+ );
+}
+
+export default EventInputAndChange;
+"
+`;
+
+exports[`Solid > jsx > Javascript Test > eventInputAndChange 2`] = `
+"import { createSignal, createMemo } from \\"solid-js\\";
+
+function EventInputAndChange(props) {
+ const [name, setName] = createSignal(\\"Steve\\");
+
+ return (
+ <>
+
+ setName(event.target.value)}
+ onInput={(event) => setName(event.target.value)}
+ />
+ Hello! I can run in React, Vue, Solid, or Liquid!
+
+
+ >
+ );
+}
+
+export default EventInputAndChange;
+"
+`;
+
exports[`Solid > jsx > Javascript Test > expressionState 1`] = `
"import { createSignal, createMemo } from \\"solid-js\\";
@@ -12752,6 +12808,62 @@ export default ComponentWithTypes;
"
`;
+exports[`Solid > jsx > Typescript Test > eventInputAndChange 1`] = `
+"import { createSignal, createMemo } from \\"solid-js\\";
+
+function EventInputAndChange(props: any) {
+ const [name, setName] = createSignal(\\"Steve\\");
+
+ return (
+ <>
+
+ setName(event.target.value)}
+ onInput={(event) => setName(event.target.value)}
+ />
+ Hello! I can run in React, Vue, Solid, or Liquid!
+
+
+ >
+ );
+}
+
+export default EventInputAndChange;
+"
+`;
+
+exports[`Solid > jsx > Typescript Test > eventInputAndChange 2`] = `
+"import { createSignal, createMemo } from \\"solid-js\\";
+
+function EventInputAndChange(props: any) {
+ const [name, setName] = createSignal(\\"Steve\\");
+
+ return (
+ <>
+
+ setName(event.target.value)}
+ onInput={(event) => setName(event.target.value)}
+ />
+ Hello! I can run in React, Vue, Solid, or Liquid!
+
+
+ >
+ );
+}
+
+export default EventInputAndChange;
+"
+`;
+
exports[`Solid > jsx > Typescript Test > expressionState 1`] = `
"import { createSignal, createMemo } from \\"solid-js\\";
diff --git a/packages/core/src/__tests__/__snapshots__/stencil.test.ts.snap b/packages/core/src/__tests__/__snapshots__/stencil.test.ts.snap
index 668b1c5eed..ff6e7522fd 100644
--- a/packages/core/src/__tests__/__snapshots__/stencil.test.ts.snap
+++ b/packages/core/src/__tests__/__snapshots__/stencil.test.ts.snap
@@ -109,7 +109,7 @@ export class MyBasicRefComponent {
ref={(el) => (this.inputRef = el)}
value={this.name}
onBlur={(event) => this.onBlur()}
- onInput={(event) => (this.name = event.target.value)}
+ onChange={(event) => (this.name = event.target.value)}
/>
(this.inputNoArgRef = el)}>
Choose a car:
@@ -160,7 +160,7 @@ export class MyBasicComponent {
(this.name = myEvent.target.value)}
+ onChange={(myEvent) => (this.name = myEvent.target.value)}
/>
Hello! I can run in React, Vue, Solid, or Liquid! >
@@ -188,7 +188,7 @@ export class MyBasicForShowComponent {
{
+ onChange={(event) => {
this.name = event.target.value + \\" and \\" + person;
}}
/>
@@ -231,7 +231,7 @@ export class MyBasicComponent {
{myService.method(\\"hello\\") + this.name}
Hello! I can run in React, Vue, Solid, or Liquid!
- this.onChange} />
+ this.onChange} />
);
}
@@ -417,7 +417,7 @@ export class MyBasicForComponent {
{
+ onChange={(event) => {
this.name = event.target.value + \\" and \\" + person;
}}
/>
@@ -469,7 +469,7 @@ export class MyBasicRefComponent {
ref={(el) => (this.inputRef = el)}
value={this.name}
onBlur={(event) => this.onBlur()}
- onInput={(event) => (this.name = event.target.value)}
+ onChange={(event) => (this.name = event.target.value)}
/>
(this.inputNoArgRef = el)}>
Choose a car:
@@ -1392,7 +1392,7 @@ export class FormInputComponent {
value={this.value}
defaultValue={this.defaultValue}
required={this.required}
- onInput={(event) => this.onChange?.(event.target.value)}
+ onChange={(event) => this.onChange?.(event.target.value)}
/>
);
}
@@ -2007,7 +2007,7 @@ export class MyBasicForwardRefComponent {
class=\\"input\\"
ref={(el) => (this.inputRef = el)}
value={this.name}
- onInput={(event) => (this.name = event.target.value)}
+ onChange={(event) => (this.name = event.target.value)}
/>