001package react4j.dom.proptypes.html;
002
003import javax.annotation.Nonnull;
004import javax.annotation.Nullable;
005import jsinterop.annotations.JsOverlay;
006import jsinterop.annotations.JsPackage;
007import jsinterop.annotations.JsType;
008import react4j.dom.events.DragEventHandler;
009import react4j.dom.events.FocusEventHandler;
010import react4j.dom.events.FormEventHandler;
011import react4j.dom.events.KeyboardEventHandler;
012import react4j.dom.events.MouseEventHandler;
013import react4j.dom.events.TouchEventHandler;
014import react4j.dom.proptypes.html.attributeTypes.InputType;
015import react4j.dom.proptypes.html.attributeTypes.OnOff;
016
017/**
018 * Props for input elements. Refer to http://www.w3schools.com/tags/tag_input.asp
019 */
020@JsType( isNative = true, namespace = JsPackage.GLOBAL, name = "Object" )
021public class InputProps
022  extends HtmlGlobalFields<InputProps>
023{
024  @JsOverlay
025  @Nonnull
026  public final InputProps accept( String s )
027  {
028    setAccept( s );
029    return self();
030  }
031
032  @JsOverlay
033  @Nonnull
034  public final InputProps alt( String s )
035  {
036    setAlt( s );
037    return self();
038  }
039
040  @JsOverlay
041  @Nonnull
042  public final InputProps async()
043  {
044    return async( true );
045  }
046
047  @JsOverlay
048  @Nonnull
049  public final InputProps async( boolean b )
050  {
051    setAsync( b );
052    return self();
053  }
054
055  @JsOverlay
056  @Nonnull
057  public final InputProps autoComplete( @OnOff final String value )
058  {
059    setAutoComplete( value );
060    return self();
061  }
062
063  @JsOverlay
064  @Nonnull
065  public final InputProps autoFocus()
066  {
067    return autoFocus( true );
068  }
069
070  @JsOverlay
071  @Nonnull
072  public final InputProps autoFocus( boolean b )
073  {
074    setAutoFocus( b );
075    return self();
076  }
077
078  @JsOverlay
079  @Nonnull
080  public final InputProps checked()
081  {
082    return checked( true );
083  }
084
085  @JsOverlay
086  @Nonnull
087  public final InputProps checked( boolean b )
088  {
089    setChecked( b );
090    return self();
091  }
092
093  @JsOverlay
094  @Nonnull
095  public final InputProps disabled()
096  {
097    return disabled( true );
098  }
099
100  @JsOverlay
101  @Nonnull
102  public final InputProps disabled( boolean b )
103  {
104    setDisabled( b );
105    return self();
106  }
107
108  @JsOverlay
109  @Nonnull
110  public final InputProps form( String s )
111  {
112    setForm( s );
113    return self();
114  }
115
116  @JsOverlay
117  @Nonnull
118  public final InputProps formAction( String s )
119  {
120    setFormAction( s );
121    return self();
122  }
123
124  @JsOverlay
125  @Nonnull
126  public final InputProps formEncType( String s )
127  {
128    setFormEncType( s );
129    return self();
130  }
131
132  @JsOverlay
133  @Nonnull
134  public final InputProps formMethod( String s )
135  {
136    setFormMethod( s );
137    return self();
138  }
139
140  @JsOverlay
141  @Nonnull
142  public final InputProps formNoValidate()
143  {
144    return formNoValidate( true );
145  }
146
147  @JsOverlay
148  @Nonnull
149  public final InputProps formNoValidate( boolean b )
150  {
151    setFormNoValidate( b );
152    return self();
153  }
154
155  @JsOverlay
156  @Nonnull
157  public final InputProps formTarget( String s )
158  {
159    setFormTarget( s );
160    return self();
161  }
162
163  @JsOverlay
164  @Nonnull
165  public final InputProps height( String s )
166  {
167    setHeight( s );
168    return self();
169  }
170
171  @JsOverlay
172  @Nonnull
173  public final InputProps list( String s )
174  {
175    setList( s );
176    return self();
177  }
178
179  @JsOverlay
180  @Nonnull
181  public final InputProps max( String s )
182  {
183    setMax( s );
184    return self();
185  }
186
187  @JsOverlay
188  @Nonnull
189  public final InputProps maxLength( int b )
190  {
191    setMaxLength( b );
192    return self();
193  }
194
195  @JsOverlay
196  @Nonnull
197  public final InputProps min( String s )
198  {
199    setMin( s );
200    return self();
201  }
202
203  @JsOverlay
204  @Nonnull
205  public final InputProps multiple()
206  {
207    return multiple( true );
208  }
209
210  @JsOverlay
211  @Nonnull
212  public final InputProps multiple( boolean b )
213  {
214    setMultiple( b );
215    return self();
216  }
217
218  @JsOverlay
219  @Nonnull
220  public final InputProps name( String s )
221  {
222    setName( s );
223    return self();
224  }
225
226  @JsOverlay
227  @Nonnull
228  public final InputProps placeHolder( String s )
229  {
230    setPlaceholder( s );
231    return self();
232  }
233
234  @JsOverlay
235  @Nonnull
236  public final InputProps readonly()
237  {
238    return readonly( true );
239  }
240
241  @JsOverlay
242  @Nonnull
243  public final InputProps readonly( boolean b )
244  {
245    setReadOnly( b );
246    return self();
247  }
248
249  @JsOverlay
250  @Nonnull
251  public final InputProps required()
252  {
253    return required( true );
254  }
255
256  @JsOverlay
257  @Nonnull
258  public final InputProps required( boolean b )
259  {
260    setRequired( b );
261    return self();
262  }
263
264  @JsOverlay
265  @Nonnull
266  public final InputProps size( int b )
267  {
268    setSize( b );
269    return self();
270  }
271
272  @JsOverlay
273  @Nonnull
274  public final InputProps src( String s )
275  {
276    setSrc( s );
277    return self();
278  }
279
280  @JsOverlay
281  @Nonnull
282  public final InputProps step( String s )
283  {
284    setStep( s );
285    return self();
286  }
287
288  @JsOverlay
289  @Nonnull
290  public final InputProps type( @Nonnull @InputType final String value )
291  {
292    setType( value );
293    return self();
294  }
295
296  @JsOverlay
297  @Nonnull
298  public final InputProps value( String s )
299  {
300    setValue( s );
301    return self();
302  }
303
304  @JsOverlay
305  @Nonnull
306  public final InputProps pattern( @Nonnull final String value )
307  {
308    setPattern( value );
309    return self();
310  }
311
312  @JsOverlay
313  @Nonnull
314  public final InputProps width( int i )
315  {
316    setWidth( Integer.toString( i ) );
317    return self();
318  }
319
320  //React Specific
321
322  @JsOverlay
323  @Nonnull
324  public final InputProps defaultChecked()
325  {
326    return defaultChecked( true );
327  }
328
329  @JsOverlay
330  @Nonnull
331  public final InputProps defaultChecked( boolean b )
332  {
333    setDefaultChecked( b );
334    return self();
335  }
336
337  @JsOverlay
338  @Nonnull
339  public final InputProps defaultValue( String s )
340  {
341    setDefaultValue( s );
342    return self();
343  }
344
345  //Applicable Event Handlers
346
347  // Focus Events
348  @JsOverlay
349  @Nonnull
350  public final InputProps onBlur( @Nullable final FocusEventHandler handler )
351  {
352    setOnBlur( handler );
353    return self();
354  }
355
356  @JsOverlay
357  @Nonnull
358  public final InputProps onFocus( @Nullable final FocusEventHandler handler )
359  {
360    setOnFocus( handler );
361    return self();
362  }
363
364  // Form Events
365  @JsOverlay
366  @Nonnull
367  public final InputProps onChange( @Nullable final FormEventHandler handler )
368  {
369    setOnChange( handler );
370    return self();
371  }
372
373  // Keyboard Events
374  @JsOverlay
375  @Nonnull
376  public final InputProps onKeyDown( @Nullable final KeyboardEventHandler handler )
377  {
378    setOnKeyDown( handler );
379    return self();
380  }
381
382  @JsOverlay
383  @Nonnull
384  public final InputProps onKeyPress( @Nullable final KeyboardEventHandler handler )
385  {
386    setOnKeyPress( handler );
387    return self();
388  }
389
390  @JsOverlay
391  @Nonnull
392  public final InputProps onKeyUp( @Nullable final KeyboardEventHandler handler )
393  {
394    setOnKeyUp( handler );
395    return self();
396  }
397
398  @JsOverlay
399  @Nonnull
400  public final InputProps onClick( @Nullable final MouseEventHandler handler )
401  {
402    setOnClick( handler );
403    return self();
404  }
405
406  @JsOverlay
407  @Nonnull
408  public final InputProps onContextMenu( @Nullable final MouseEventHandler handler )
409  {
410    setOnContextMenu( handler );
411    return self();
412  }
413
414  @JsOverlay
415  @Nonnull
416  public final InputProps onDoubleClick( @Nullable final MouseEventHandler handler )
417  {
418    setOnDoubleClick( handler );
419    return self();
420  }
421
422  @JsOverlay
423  @Nonnull
424  public final InputProps onDrag( @Nullable final DragEventHandler handler )
425  {
426    setOnDrag( handler );
427    return self();
428  }
429
430  @JsOverlay
431  @Nonnull
432  public final InputProps onDragEnd( @Nullable final DragEventHandler handler )
433  {
434    setOnDragEnd( handler );
435    return self();
436  }
437
438  @JsOverlay
439  @Nonnull
440  public final InputProps onDragEnter( @Nullable final DragEventHandler handler )
441  {
442    setOnDragEnter( handler );
443    return self();
444  }
445
446  @JsOverlay
447  @Nonnull
448  public final InputProps onDragExit( @Nullable final DragEventHandler handler )
449  {
450    setOnDragExit( handler );
451    return self();
452  }
453
454  @JsOverlay
455  @Nonnull
456  public final InputProps onDragLeave( @Nullable final DragEventHandler handler )
457  {
458    setOnDragLeave( handler );
459    return self();
460  }
461
462  @JsOverlay
463  @Nonnull
464  public final InputProps onDragOver( @Nullable final DragEventHandler handler )
465  {
466    setOnDragOver( handler );
467    return self();
468  }
469
470  @JsOverlay
471  @Nonnull
472  public final InputProps onDragStart( @Nullable final DragEventHandler handler )
473  {
474    setOnDragStart( handler );
475    return self();
476  }
477
478  @JsOverlay
479  @Nonnull
480  public final InputProps onDrop( @Nullable final DragEventHandler handler )
481  {
482    setOnDrop( handler );
483    return self();
484  }
485
486  @JsOverlay
487  @Nonnull
488  public final InputProps onMouseDown( @Nullable final MouseEventHandler handler )
489  {
490    setOnMouseDown( handler );
491    return self();
492  }
493
494  @JsOverlay
495  @Nonnull
496  public final InputProps onMouseEnter( @Nullable final MouseEventHandler handler )
497  {
498    setOnMouseEnter( handler );
499    return self();
500  }
501
502  @JsOverlay
503  @Nonnull
504  public final InputProps onMouseLeave( @Nullable final MouseEventHandler handler )
505  {
506    setOnMouseLeave( handler );
507    return self();
508  }
509
510  @JsOverlay
511  @Nonnull
512  public final InputProps onMouseMove( @Nullable final MouseEventHandler handler )
513  {
514    setOnMouseMove( handler );
515    return self();
516  }
517
518  @JsOverlay
519  @Nonnull
520  public final InputProps onMouseOut( @Nullable final MouseEventHandler handler )
521  {
522    setOnMouseOut( handler );
523    return self();
524  }
525
526  @JsOverlay
527  @Nonnull
528  public final InputProps onMouseOver( @Nullable final MouseEventHandler handler )
529  {
530    setOnMouseOver( handler );
531    return self();
532  }
533
534  @JsOverlay
535  @Nonnull
536  public final InputProps onMouseUp( @Nullable final MouseEventHandler handler )
537  {
538    setOnMouseUp( handler );
539    return self();
540  }
541
542  // Touch Events
543  @JsOverlay
544  @Nonnull
545  public final InputProps onTouchCancel( @Nullable final TouchEventHandler handler )
546  {
547    setOnTouchCancel( handler );
548    return self();
549  }
550
551  @JsOverlay
552  @Nonnull
553  public final InputProps onTouchEnd( @Nullable final TouchEventHandler handler )
554  {
555    setOnTouchEnd( handler );
556    return self();
557  }
558
559  @JsOverlay
560  @Nonnull
561  public final InputProps onTouchMove( @Nullable final TouchEventHandler handler )
562  {
563    setOnTouchMove( handler );
564    return self();
565  }
566
567  @JsOverlay
568  @Nonnull
569  public final InputProps onTouchStart( @Nullable final TouchEventHandler handler )
570  {
571    setOnTouchStart( handler );
572    return self();
573  }
574}