|
1 | 1 | @@jsxConfig({version: 3})
|
2 | 2 |
|
3 |
| -module FancyInput = { |
4 |
| - @obj |
5 |
| - external makeProps: ( |
6 |
| - ~className: 'className=?, |
7 |
| - ~children: 'children, |
8 |
| - ~key: string=?, |
9 |
| - ~ref: 'ref=?, |
10 |
| - unit, |
11 |
| - ) => {"className": option<'className>, "children": 'children} = "" |
| 3 | +module V3 = { |
| 4 | + module FancyInput = { |
| 5 | + @obj |
| 6 | + external makeProps: ( |
| 7 | + ~className: 'className=?, |
| 8 | + ~children: 'children, |
| 9 | + ~key: string=?, |
| 10 | + ~ref: 'ref=?, |
| 11 | + unit, |
| 12 | + ) => {"className": option<'className>, "children": 'children} = "" |
12 | 13 |
|
13 |
| - @react.component |
14 |
| - let make = |
15 |
| - (@warning("-16") ~className=?, @warning("-16") ~children) => |
16 |
| - @warning("-16") |
17 |
| - ref => |
18 |
| - ReactDOMRe.createDOMElementVariadic( |
19 |
| - "div", |
20 |
| - [ |
21 |
| - ReactDOMRe.createDOMElementVariadic( |
22 |
| - "input", |
23 |
| - ~props=ReactDOMRe.domProps( |
24 |
| - ~type_="text", |
25 |
| - ~className?, |
26 |
| - ~ref=?{Js.Nullable.toOption(ref)->Belt.Option.map(ReactDOM.Ref.domRef)}, |
27 |
| - (), |
| 14 | + @react.component |
| 15 | + let make = |
| 16 | + (@warning("-16") ~className=?, @warning("-16") ~children) => |
| 17 | + @warning("-16") |
| 18 | + ref => |
| 19 | + ReactDOMRe.createDOMElementVariadic( |
| 20 | + "div", |
| 21 | + [ |
| 22 | + ReactDOMRe.createDOMElementVariadic( |
| 23 | + "input", |
| 24 | + ~props=ReactDOMRe.domProps( |
| 25 | + ~type_="text", |
| 26 | + ~className?, |
| 27 | + ~ref=?{Js.Nullable.toOption(ref)->Belt.Option.map(ReactDOM.Ref.domRef)}, |
| 28 | + (), |
| 29 | + ), |
| 30 | + [], |
28 | 31 | ),
|
29 |
| - [], |
30 |
| - ), |
31 |
| - children, |
32 |
| - ], |
33 |
| - ) |
34 |
| - let make = React.forwardRef({ |
35 |
| - let \"ForwardRef$FancyInput" = ( |
36 |
| - \"Props": {"className": option<'className>, "children": 'children}, |
37 |
| - ref, |
38 |
| - ) => make(~children=\"Props"["children"], ~className=?\"Props"["className"], ref) |
39 |
| - \"ForwardRef$FancyInput" |
40 |
| - }) |
41 |
| -} |
42 |
| -@obj external makeProps: (~key: string=?, unit) => {.} = "" |
| 32 | + children, |
| 33 | + ], |
| 34 | + ) |
| 35 | + let make = React.forwardRef({ |
| 36 | + let \"ForwardRef$V3$FancyInput" = ( |
| 37 | + \"Props": {"className": option<'className>, "children": 'children}, |
| 38 | + ref, |
| 39 | + ) => make(~children=\"Props"["children"], ~className=?\"Props"["className"], ref) |
| 40 | + \"ForwardRef$V3$FancyInput" |
| 41 | + }) |
| 42 | + } |
| 43 | + @obj external makeProps: (~key: string=?, unit) => {.} = "" |
43 | 44 |
|
44 |
| -@react.component |
45 |
| -let make = () => { |
46 |
| - let input = React.useRef(Js.Nullable.null) |
| 45 | + @react.component |
| 46 | + let make = () => { |
| 47 | + let input = React.useRef(Js.Nullable.null) |
47 | 48 |
|
48 |
| - ReactDOMRe.createDOMElementVariadic( |
49 |
| - "div", |
50 |
| - [ |
51 |
| - React.createElement( |
52 |
| - FancyInput.make, |
53 |
| - FancyInput.makeProps(~ref=input, ~children={React.string("Click to focus")}, ()), |
54 |
| - ), |
55 |
| - ], |
56 |
| - ) |
57 |
| -} |
58 |
| -let make = { |
59 |
| - let \"ForwardRef" = (\"Props": {.}) => make() |
60 |
| - \"ForwardRef" |
| 49 | + ReactDOMRe.createDOMElementVariadic( |
| 50 | + "div", |
| 51 | + [ |
| 52 | + React.createElement( |
| 53 | + FancyInput.make, |
| 54 | + FancyInput.makeProps(~ref=input, ~children={React.string("Click to focus")}, ()), |
| 55 | + ), |
| 56 | + ], |
| 57 | + ) |
| 58 | + } |
| 59 | + let make = { |
| 60 | + let \"ForwardRef$V3" = (\"Props": {.}) => make() |
| 61 | + \"ForwardRef$V3" |
| 62 | + } |
61 | 63 | }
|
62 | 64 |
|
63 | 65 | @@jsxConfig({version: 4, mode: "classic"})
|
64 | 66 |
|
65 |
| -module FancyInput = { |
66 |
| - type props<'className, 'children> = { |
67 |
| - key?: string, |
68 |
| - ref?: ReactDOM.Ref.currentDomRef, |
69 |
| - className?: 'className, |
70 |
| - children: 'children, |
| 67 | +module V4C = { |
| 68 | + module FancyInput = { |
| 69 | + type props<'className, 'children> = { |
| 70 | + key?: string, |
| 71 | + ref?: ReactDOM.Ref.currentDomRef, |
| 72 | + className?: 'className, |
| 73 | + children: 'children, |
| 74 | + } |
| 75 | + |
| 76 | + @react.component |
| 77 | + let make = ({?className, children, _}: props<'className, 'children>, ref) => |
| 78 | + ReactDOMRe.createDOMElementVariadic( |
| 79 | + "div", |
| 80 | + [ |
| 81 | + ReactDOMRe.createDOMElementVariadic( |
| 82 | + "input", |
| 83 | + ~props=ReactDOMRe.domProps( |
| 84 | + ~type_="text", |
| 85 | + ~className?, |
| 86 | + ~ref=?{Js.Nullable.toOption(ref)->Belt.Option.map(ReactDOM.Ref.domRef)}, |
| 87 | + (), |
| 88 | + ), |
| 89 | + [], |
| 90 | + ), |
| 91 | + children, |
| 92 | + ], |
| 93 | + ) |
| 94 | + let make = React.forwardRef({ |
| 95 | + let \"ForwardRef$V4C$FancyInput" = (props: props<_>, ref) => make(props, ref) |
| 96 | + \"ForwardRef$V4C$FancyInput" |
| 97 | + }) |
71 | 98 | }
|
| 99 | + type props = {key?: string} |
72 | 100 |
|
73 | 101 | @react.component
|
74 |
| - let make = ({?className, children, _}: props<'className, 'children>, ref) => |
| 102 | + let make = (_: props) => { |
| 103 | + let input = React.useRef(Js.Nullable.null) |
| 104 | + |
75 | 105 | ReactDOMRe.createDOMElementVariadic(
|
76 | 106 | "div",
|
77 | 107 | [
|
78 |
| - ReactDOMRe.createDOMElementVariadic( |
79 |
| - "input", |
80 |
| - ~props=ReactDOMRe.domProps( |
81 |
| - ~type_="text", |
82 |
| - ~className?, |
83 |
| - ~ref=?{Js.Nullable.toOption(ref)->Belt.Option.map(ReactDOM.Ref.domRef)}, |
84 |
| - (), |
85 |
| - ), |
86 |
| - [], |
| 108 | + React.createElement( |
| 109 | + FancyInput.make, |
| 110 | + {ref: input, children: {React.string("Click to focus")}}, |
87 | 111 | ),
|
88 |
| - children, |
89 | 112 | ],
|
90 | 113 | )
|
91 |
| - let make = React.forwardRef({ |
92 |
| - let \"ForwardRef$FancyInput" = (props: props<_>, ref) => make(props, ref) |
93 |
| - \"ForwardRef$FancyInput" |
94 |
| - }) |
95 |
| -} |
96 |
| -type props = {key?: string} |
97 |
| - |
98 |
| -@react.component |
99 |
| -let make = (_: props) => { |
100 |
| - let input = React.useRef(Js.Nullable.null) |
101 |
| - |
102 |
| - ReactDOMRe.createDOMElementVariadic( |
103 |
| - "div", |
104 |
| - [ |
105 |
| - React.createElement( |
106 |
| - FancyInput.make, |
107 |
| - {ref: input, children: {React.string("Click to focus")}}, |
108 |
| - ), |
109 |
| - ], |
110 |
| - ) |
111 |
| -} |
112 |
| -let make = { |
113 |
| - let \"ForwardRef" = props => make(props) |
114 |
| - \"ForwardRef" |
| 114 | + } |
| 115 | + let make = { |
| 116 | + let \"ForwardRef$V4C" = props => make(props) |
| 117 | + \"ForwardRef$V4C" |
| 118 | + } |
115 | 119 | }
|
116 | 120 |
|
117 | 121 | @@jsxConfig({version: 4, mode: "automatic"})
|
118 | 122 |
|
119 |
| -module FancyInput = { |
120 |
| - type props<'className, 'children> = { |
121 |
| - key?: string, |
122 |
| - ref?: ReactDOM.Ref.currentDomRef, |
123 |
| - className?: 'className, |
124 |
| - children: 'children, |
| 123 | +module V4A = { |
| 124 | + module FancyInput = { |
| 125 | + type props<'className, 'children> = { |
| 126 | + key?: string, |
| 127 | + ref?: ReactDOM.Ref.currentDomRef, |
| 128 | + className?: 'className, |
| 129 | + children: 'children, |
| 130 | + } |
| 131 | + |
| 132 | + @react.component |
| 133 | + let make = ({?className, children, _}: props<'className, 'children>, ref) => |
| 134 | + ReactDOM.jsxs( |
| 135 | + "div", |
| 136 | + { |
| 137 | + children: React.array([ |
| 138 | + ReactDOM.jsx( |
| 139 | + "input", |
| 140 | + { |
| 141 | + type_: "text", |
| 142 | + ?className, |
| 143 | + ref: ?Js.Nullable.toOption(ref)->Belt.Option.map(ReactDOM.Ref.domRef), |
| 144 | + }, |
| 145 | + ), |
| 146 | + children, |
| 147 | + ]), |
| 148 | + }, |
| 149 | + ) |
| 150 | + let make = React.forwardRef({ |
| 151 | + let \"ForwardRef$V4A$FancyInput" = (props: props<_>, ref) => make(props, ref) |
| 152 | + \"ForwardRef$V4A$FancyInput" |
| 153 | + }) |
125 | 154 | }
|
| 155 | + type props = {key?: string} |
126 | 156 |
|
127 | 157 | @react.component
|
128 |
| - let make = ({?className, children, _}: props<'className, 'children>, ref) => |
129 |
| - ReactDOM.jsxs( |
| 158 | + let make = (_: props) => { |
| 159 | + let input = React.useRef(Js.Nullable.null) |
| 160 | + |
| 161 | + ReactDOM.jsx( |
130 | 162 | "div",
|
131 | 163 | {
|
132 |
| - children: React.array([ |
133 |
| - ReactDOM.jsx( |
134 |
| - "input", |
135 |
| - { |
136 |
| - type_: "text", |
137 |
| - ?className, |
138 |
| - ref: ?Js.Nullable.toOption(ref)->Belt.Option.map(ReactDOM.Ref.domRef), |
139 |
| - }, |
140 |
| - ), |
141 |
| - children, |
142 |
| - ]), |
| 164 | + children: React.jsx( |
| 165 | + FancyInput.make, |
| 166 | + {ref: input, children: {React.string("Click to focus")}}, |
| 167 | + ), |
143 | 168 | },
|
144 | 169 | )
|
145 |
| - let make = React.forwardRef({ |
146 |
| - let \"ForwardRef$FancyInput" = (props: props<_>, ref) => make(props, ref) |
147 |
| - \"ForwardRef$FancyInput" |
148 |
| - }) |
149 |
| -} |
150 |
| -type props = {key?: string} |
151 |
| - |
152 |
| -@react.component |
153 |
| -let make = (_: props) => { |
154 |
| - let input = React.useRef(Js.Nullable.null) |
155 |
| - |
156 |
| - ReactDOM.jsx( |
157 |
| - "div", |
158 |
| - { |
159 |
| - children: React.jsx( |
160 |
| - FancyInput.make, |
161 |
| - {ref: input, children: {React.string("Click to focus")}}, |
162 |
| - ), |
163 |
| - }, |
164 |
| - ) |
165 |
| -} |
166 |
| -let make = { |
167 |
| - let \"ForwardRef" = props => make(props) |
168 |
| - \"ForwardRef" |
| 170 | + } |
| 171 | + let make = { |
| 172 | + let \"ForwardRef$V4A" = props => make(props) |
| 173 | + \"ForwardRef$V4A" |
| 174 | + } |
169 | 175 | }
|
0 commit comments