forked from DefinitelyTyped/DefinitelyTyped
-
Notifications
You must be signed in to change notification settings - Fork 0
/
react-widgets.d.ts
963 lines (939 loc) · 40.5 KB
/
react-widgets.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
// Type definitions for react-widgets v3.2.1
// Project: https://github.com/jquense/react-widgets
// Definitions by: Rogier Schouten <https://github.com/rogierschouten/>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
///<reference path="../react/react.d.ts"/>
declare module 'react-widgets/lib/Combobox' {
interface ComboBoxMessages {
/**
* Combobox button text for screen readers
*/
open: string | ((props: ComboBoxProps) => string);
/**
* text to display when the data prop array is empty
*/
emptyList: string | ((props: ComboBoxProps) => string);
/**
* text to display when the the current filter does not return any results
*/
emptyFilter: string | ((props: ComboBoxProps) => string);
}
interface ComboBoxProps extends __React.Props<ComboBoxClass> {
/**
* The current value of the Combobox. This can be an object (such as a member of the data
* array) or a primitive value, hinted to by the valueField. The widget value does not need
* to be in the data, widgets can have values that are not in their list.
*/
value?: any;
/**
* Default value.
*/
defaultValue?: any;
/**
* Called when the value is changed. If the value is one of the data members that item will
* be returned. In the case of a value not being found in the data array the string value of
* the Combobox will be returned.
*/
onChange?: (value: any) => void;
/**
* This handler fires when an item has been selected from the list. It fires before the
* onChange handler, and fires regardless of whether the value has actually changed.
*/
onSelect?: (value: any) => void;
/**
* An array of possible values for the Combobox. If an array of objects is provided you
* should use the valueField and textField props, to specify which object properties
* comprise the value field (such as an id) and the field used to label the item.
*/
data?: any[];
/**
* A dataItem field name for uniquely identifying items in the data list. A valueField is
* required when the value prop is not itself a dataItem. A valueField is useful when
* specifying the selected item, by its id instead of using the model as the value. When a
* valueField is not provided, the Combobox will use strict equality checks (===) to locate
* the value in the data list.
*/
valueField?: string;
/**
* Specify which data item field to display in the Combobox and selected item. The
* textField` prop may also also used as to find an item in the list as you type. Providing
* an accessor function allows for computed text values
*/
textField?: string;
/**
* This component is used to render each possible item in the Combobox. The default
* component renders the text of the selected item (specified by textfield)
*/
itemComponent?: __React.ReactType;
/**
* Disable the widget, if an Array of values is passed in only those values will be
* disabled.
*/
disabled?: boolean | any[];
/**
* Place the Combobox in a read-only mode, If an Array of values is passed in only those
* values will be read-only.
*/
readOnly?: boolean | any[];
/**
* Determines how to group the Combobox. Providing a string will group the data array by
* that property. You can also provide a function which should return the group value.
*/
groupBy?: string | ((dataItem: any) => any);
/**
* This component is used to render each option group, when groupBy is specified. By default
* the groupBy value will be used.
*/
groupComponent?: __React.ReactType;
/**
* When true the Combobox will suggest, or fill in, values as you type. The suggestions are
* always "startsWith", meaning it will search from the start of the textField property
*/
suggest?: boolean;
/**
* Specify a filtering method used to reduce the items in the dropdown as you type. It can
* be used in conjunction with the suggest prop or instead of it. There are a few built-in
* filtering methods that can be specified by passing the String name. You can explicitly
* opt out of filtering by setting filter to false To handle custom filtering techniques
* provide a function that returns true or false for each passed in item (analogous to the
* array.filter builtin) Acceptable values for filter are: false "startsWith" "endsWith"
* "contains" function(String item)
*/
filter?: boolean | string | ((dataItem: any, searchItem: any) => boolean);
/**
* Use in conjunction with the filter prop. Filter the list without regard for case. This
* only applies to non function values for filter
*/
caseSensitive?: boolean;
/**
* Use in conjunction with the filter prop. Start filtering the list only after the value
* has reached a minimum length.
*/
minLength?: number;
/**
* Whether or not the Combobox is open. When unset (undefined) the Combobox will handle the
* opening and closing internally. The defaultOpen prop can be used to set an initialization
* value for uncontrolled widgets.
*/
open?: boolean;
/**
* Called fires when the Combobox is about to open or close. onToggle should be used when
* the open prop is set otherwise the widget will never open or close.
*/
onToggle?: (isOpen: boolean) => void;
/**
* Mark whether the widget is in a busy or loading state. If true the widget will display a
* spinner gif, useful when loading data via an ajax call.
*/
busy?: boolean;
/**
* The speed, in milliseconds, of the dropdown animation.
*/
duration?: number;
/**
* mark whether the widget should render right-to-left. This property can also be implicitly
* passed to the widget through a childContext prop (isRtl) this allows higher level
* application components to specify the direction.
*/
isRtl?: boolean;
/**
* Object hash containing display text and/or text for screen readers. Use the messages
* object to localize widget text and increase accessibility.
*/
messages?: ComboBoxMessages;
}
interface ComboBox extends __React.ReactElement<ComboBoxProps> {}
interface ComboBoxClass extends __React.ComponentClass<ComboBoxProps> {}
var ComboBox: ComboBoxClass;
export = ComboBox;
}
declare module 'react-widgets/lib/DateTimePicker' {
interface DateTimePickerProps extends __React.Props<DateTimePickerClass> {
/**
* Whether to show the date picker button.
* @default true
*/
calendar?: boolean;
/**
* Whether to show the time picker button.
* @default true
*/
time?: boolean;
/**
* The minimum Date that can be selected. Min only limits selection, it doesn't constrain
* the date values that can be typed or pasted into the widget. If you need this behavior
* you can constrain values via the onChange handler.
* @default Date(1900, 0, 1)
*/
min?: Date;
/**
* The maximum Date that can be selected. Max only limits selection, it doesn't constrain
* the date values that can be typed or pasted into the widget. If you need this behavior
* you can constrain values via the onChange handler.
* @default Date(2099, 11, 31)
*/
max?: Date;
/**
* Default current date at which the calendar opens. If none is provided, opens at today's
* date or the value date (if any).
* @default Date()
*/
currentDate?: Date;
/**
* Change event Handler that is called when the currentDate is changed. The handler is
* called with the currentDate object.
*/
onCurrentDateChange?: (date?: Date) => void;
/**
* A string format used to display the date value.
*/
format?: string;
/**
* A string format to be used while the date input has focus. Useful for showing a simpler
* format for inputing.
*/
editFormat?: string;
/**
* A string format used by the time dropdown to render times.
*/
timeFormat?: string;
/**
* The amount of minutes between each entry in the time list.
*/
step?: number | boolean;
/**
* Determines how the widget parses the typed date string into a Date object. You can
* provide an array of formats to try, or provide a function that returns a date to handle
* parsing yourself. When parse is unspecified and the format prop is a String parse will
* automatically use that format as its default
*/
parse?: (str: string) => Date | string[];
/**
* The starting and lowest level view the calendar can navigate down to.
* @enum "month" "year" "decade" "century"
*/
initialView?: "month" | "year" | "decade" | "century";
/**
* The highest level view the calendar can navigate up to. This value should be higher than
* initialView.
* @enum "month" "year" "decade" "century"
*/
finalView?: "month" | "year" | "decade" | "century";
/**
* The current selected date, should be a Date instance or null.
*/
value?: Date;
/**
* Default value.
*/
defaultValue?: Date;
/**
* Change event Handler that is called when the value is changed. The handler is called with
* both the current Date object (or null if it was not parseable), and the second argument
* is a string representation of the date value, formated by the format prop.
*/
onChange?: (date?: Date, dateStr?: string) => void;
/**
* This handler fires when an item has been selected from the list or calendar. It fires
* before the onChange handler, and fires regardless of whether the value has actually
* changed.
*/
onSelect?: (date?: Date) => void;
/**
* Whether or not the DateTimePicker is open. When unset (undefined) the DateTimePicker will
* handle the opening and closing internally. The defaultOpen prop can be used to set an
* initialization value for uncontrolled widgets.
* @enum false "calendar" "time"
*/
open?: boolean | "calendar" | "time";
/**
* Called when the DateTimePicker is about to open or close. onToggle should be used when
* the open prop is set otherwise the widget will never open or close.
*/
onToggle?: (isOpen: boolean) => void;
/**
* The speed, in milliseconds, of the either dropdown animation.
*/
duration?: number;
/**
* Mark whether the widget should render right-to-left. This property can also be implicitly
* passed to the widget through a childContext prop (isRtl) this allows higher level
* application components to specify the direction.
*/
isRtl?: boolean;
/**
* Object hash containing display text and/or text for screen readers. Use the messages
* object to localize widget text and increase accessibility.
*/
messages?: DateTimePickerMessages;
}
interface DateTimePickerMessages {
/**
* Title and screen reader text for the left arrow button.
* @default "Select Date"
*/
calendarButton?: string;
/**
* Title and screen reader text for the right arrow button.
* @default "Select Time"
*/
timeButton?: string;
}
interface DateTimePicker extends __React.ReactElement<DateTimePickerProps> {}
interface DateTimePickerClass extends __React.ComponentClass<DateTimePickerProps> {}
var DateTimePicker: DateTimePickerClass;
export = DateTimePicker;
}
declare module 'react-widgets/lib/Multiselect' {
interface MultiselectProps extends __React.Props<MultiselectClass> {
/**
* The current values of the Multiselect. The value should can null, or an array of
* valueField values, or an array of objects (such as a few items in the data array)
*/
value?: any[];
/**
* Default Value.
*/
defaultValue?: any[];
/**
* Change event Handler that is called when the value is changed. The handler is called with
* an array of values.
*/
onChange?: (values: any[]) => void;
/**
* This handler fires when an item has been selected from the list. It fires before the
* onChange handler, and fires regardless of whether the value has actually changed
*/
onSelect?: (value: any) => void;
/**
* This handler fires when the user chooses to create a new tag, not in the data list. It is
* up to the widget parent to implement creation logic, a common implementation is shown
* below, where the new tag is selected and added to the data list.
*/
onCreate?: (searchTerm: string) => void;
/**
* Provide an array of possible values for the Multiselect. If an array of objects is
* provided you should use the valueField and textField props, to specify which object
* properties comprise the value field (such as an id) and the field used to label the item.
*/
data?: any[];
/**
* A dataItem field name for uniquely identifying items in the data list. A valueField is
* required when the value prop is not itself a dataItem. A valueField is useful when
* specifying the selected item, by its id instead of using the model as the value.
* When a valueField is not provided, the Multiselect will use strict equality checks (===)
* to locate the value in the data list.
*/
valueField?: string;
/**
* Specify which data item field to display in the Multiselect and selected item. The
* textField prop may also also used as to find an item in the list as you type. Providing
* an accessor function allows for computed text values.
*/
textField?: string | ((dataItem: any) => string);
/**
* This component is used to render each selected item. The default component renders the
* text of the selected item (specified by textfield).
*/
tagComponent?: __React.ReactType;
/**
* This component is used to render each possible item in the list. The default component
* renders the text of the selected item (specified by textfield).
*/
itemComponent?: __React.ReactType;
/**
* Determines how to group the Multiselect values. Providing a string will group the data
* array by that property. You can also provide a 'function' which should return the group
* value.
*/
groupBy?: string | ((dataItem: any) => any);
/**
* This component is used to render each option group, when groupBy is specified. By default
* the groupBy value will be used.
*/
groupComponent?: __React.ReactType;
/**
* The same as an input placeholder, only works in browsers that support the placeholder
* attribute for inputs
*/
placeholder?: string;
/**
* The string value of the current search being typed into the Multiselect. When unset
* (undefined) the Multiselect will handle the filtering internally. The defaultSearchTerm
* prop can be used to set an initialization value for uncontrolled widgets.
*/
searchTerm?: string;
/**
* Called when the value of the text box changes either from typing or a pasted value.
* onSearch should be used when the searchTerm prop is set.
*/
onSearch?: (searchTerm: string) => void;
/**
* Whether or not the Multiselect is open. When unset (undefined) the Multiselect will
* handle the opening and closing internally. The defaultOpen prop can be used to set an
* initialization value for uncontrolled widgets.
*/
open?: boolean;
/**
* Called when the Multiselect is about to open or close. onToggle should be used when the
* open prop is set otherwise the widget will never open or close.
*/
onToggle?: (isOpen: boolean) => void;
/**
* Specify a filtering method used to reduce the items in the dropdown as you type. There
* are a few built-in filtering methods that can be specified by passing the String name.
* You can explicitly opt out of filtering by setting filter to false. To handle custom
* filtering techniques provide a function that returns true or false for each passed in
* item (analogous to the array.filter builtin)
* @enum false "startsWith" "endsWith" "contains" function(String item)
* @default startsWith
*/
filter?: boolean | "startsWith" | "endsWith" | "contains" | ((dataItem: any, searchTerm: string) => boolean);
/**
* Use in conjunction with the filter prop. Filter the list without regard for case. This
* only applies to non function values for filter.
* @default false
*/
caseSensitive?: boolean;
/**
* Use in conjunction with the filter prop. Start filtering the list only after the value
* has reached a minimum length.
* @default 1
*/
minLength?: number;
/**
* mark whether the widget is in a busy or loading state. If true the widget will display a
* spinner gif, useful when loading data via an ajax call.
* @default false
*/
busy?: boolean;
/**
* The speed, in milliseconds, of the dropdown animation.
* @default 250
*/
duration?: number;
/**
* Disable the widget, If an Array of values is passed in only the tags specified will be
* disabled.
*/
disabled?: boolean | any[];
/**
* Place the widget in a readonly mode, If an Array of values is passed in only the tags
* specified will be readonly.
*/
readOnly?: boolean | any[];
/**
* Mark whether the widget should render right-to-left. This property can also be implicitly
* passed to the widget through a childContext prop (isRtl) this allows higher level
* application components to specify the direction.
* @default false
*/
isRtl?: boolean;
/**
* Object hash containing display text and/or text for screen readers. Use the messages
* object to localize widget text and increase accessibility.
*/
messages?: MultiselectMessages;
}
interface MultiselectMessages {
/**
* The text label for creating new tags.
* @default "(create new tag)"
*/
createNew?: string | ((props: MultiselectProps) => string);
/**
* Text to display when the data prop array is empty.
* @default "There are no items in this list"
*/
emptyList?: string | ((props: MultiselectProps) => string);
/**
* Text to display when the the current filter does not return any results.
* @default "The filter returned no results"
*/
emptyFilter?: string | ((props: MultiselectProps) => string);
}
interface Multiselect extends __React.ReactElement<MultiselectProps> {}
interface MultiselectClass extends __React.ComponentClass<MultiselectProps> {}
var Multiselect: MultiselectClass;
export = Multiselect;
}
declare module 'react-widgets/lib/NumberPicker' {
interface NumberPickerProps extends __React.Props<NumberPickerClass>{
/**
* The current value of the NumberPicker.
*/
value?: number;
/**
* Default Value.
*/
defaultValue?: number;
/**
* Change event Handler that is called when the value is changed. The handler is called with
* the current numeric value or null.
*/
onChange?: (value?: number) => void;
/**
* A format string used to display the number value. Localizer dependent, read localization
* for more info.
* @see http://jquense.github.io/react-widgets/docs/#i18n
*/
format?: any;
/**
* Determines how the NumberPicker parses a number from the localized string representation.
* You can also provide a parser Function to pair with a custom format.
*/
parse?: string[] | ((str: string, culture: string) => number);
/**
* The minimum number that the NumberPicker value.
* @default -Infinity
*/
min?: number;
/**
* The maximum number that the NumberPicker value.
* @default Infinity
*/
max?: number;
/**
* Amount to increase or decrease value when using the spinner buttons.
* @default 1
*/
step?: number;
/**
* Specify how precise the value should be when typing, incrementing, or decrementing the
* value. When empty, precision is parsed from the current format and culture.
*/
precision?: number;
/**
* Mark whether the widget should render right-to-left. This property can also be implicitly
* passed to the widget through a childContext prop (isRtl) this allows higher level
* application components to specify the direction.
* @default false
*/
isRtl?: boolean;
/**
* Object hash containing display text and/or text for screen readers. Use the messages
* object to localize widget text and increase accessibility.
*/
messages?: NumberPickerMessages;
}
interface NumberPickerMessages {
/**
* Number picker spinner up button text for screen readers.
* @default "increment value"
*/
increment?: string;
/**
* Number picker spinner down button text for screen readers.
* @default "decrement value"
*/
decrement?: string;
}
interface NumberPicker extends __React.ReactElement<NumberPickerProps> {}
interface NumberPickerClass extends __React.ComponentClass<NumberPickerProps> {}
var NumberPicker: NumberPickerClass;
export = NumberPicker;
}
declare module 'react-widgets/lib/SelectList' {
interface SelectListProps extends __React.Props<SelectListClass>{
/**
* The current value or values of the SelectList. This can be an object (such as a member of
* the data array) or a primitive value, hinted to by the valueField. The widget value does
* not need to be in the data array; widgets can have values that are not in their list.
*/
value?: any | any[];
/**
* Default Value.
*/
defaultValue?: any | any[];
/**
* Change event handler that is called when the value is changed. values will be an array
* when multiple prop is set.
*/
onChange?: (values: any | any[]) => void;
/**
* Provide an array of possible values for the SelectList. If an array of objects is
* provided you should use the valueField and textField props, to specify which object
* properties comprise the value field (such as an id) and the field used to label the item.
*/
data?: any[];
/**
* A dataItem field name for uniquely identifying items in the data list. A valueField is
* required when the value prop is not itself a dataItem. A valueField is useful when
* specifying the selected item, by its id instead of using the model as the value.
* When a valueField is not provided, the SelectList will use strict equality checks (===)
* to locate the value in the data list.
*/
valueField?: string;
/**
* Specify which data item field to display in the SelectList and selected item. The
* textField prop may also also used as to find an item in the list as you type. Providing
* an accessor function allows for computed text values.
*/
textField?: string | ((dataItem: any) => string);
/**
* Whether or not the SelectList allows multiple selection or not. when false the SelectList
* will render as a list of radio buttons, and checkboxes when true.
*/
multiple?: boolean;
/**
* This component is used to render each item in the SelectList. The default component
* renders the text of the selected item (specified by textfield)
*/
itemComponent?: __React.ReactType;
/**
* Determines how to group the SelectList dropdown list. Providing a string will group the
* data array by that property. You can also provide a 'function' which should return the
* group value.
*/
groupBy?: string | ((dataItem: any) => any);
/**
* This component is used to render each option group, when groupBy is specified. By default
* the groupBy value will be used.
*/
groupComponent?: __React.ReactType;
/**
* A handler called when focus shifts on the SelectList. Internally this is used to ensure
* the focused item is in view. If you want to define your own "scrollTo" behavior or just
* disable the default one specify an onMove handler. The handler is called with the
* relevant DOM nodes needed to implement scroll behavior: the list element, the element
* that is currently focused, and a focused value.
*/
onMove?: (list: HTMLElement, focusedNode: HTMLElement, focusedItem: any) => void;
/**
* Mark whether the widget is in a busy or loading state. If true the widget will display a
* spinner gif, useful when loading data via an ajax call.
* @default false
*/
busy?: boolean;
/**
* Disable the widget, if an Array of values is passed in only those values will be
* disabled.
*/
disabled?: boolean | any[];
/**
* Place the SelectList in a read-only mode, If an Array of values is passed in only those
* values will be read-only.
*/
readOnly?: boolean | any[];
/**
* Mark whether the SelectList should render right-to-left. This property can also be
* implicitly passed to the widget through a childContext prop (isRtl) this allows higher
* level application components to specify the direction.
* @default false
*/
isRtl?: boolean;
/**
* Object hash containing display text and/or text for screen readers. Use the messages
* object to localize widget text and increase accessibility.
*/
messages?: SelectListMessages;
}
interface SelectListMessages {
/**
* @default: "There are no items in this list"
*/
emptyList?: string | ((props: SelectListProps) => string)
}
interface SelectList extends __React.ReactElement<SelectListProps> {}
interface SelectListClass extends __React.ComponentClass<SelectListProps> {}
var SelectList: SelectListClass;
export = SelectList;
}
declare module 'react-widgets/lib/Calendar' {
interface CalendarProps extends __React.Props<CalendarClass>{
/**
* The current selected date, should be a Date object or null.
*/
value?: Date;
/**
* Default value.
*/
defaultValue?: Date;
/**
* Change event Handler that is called when the value is changed. The handler is called with
* the Date object
*/
onChange?: (date?: Date) => void;
/**
* Callback fired when the Calendar navigates between views, or forward and backwards in
* time.
*/
onNavigate?: (date: Date, direction: string, view: string ) => void;
/**
* The minimum date that the Calendar can navigate from.
*/
min?: Date;
/**
* The maximum date that the Calendar can navigate to.
*/
max?: Date;
/**
* Default current date at which the calendar opens. If none is provided, opens at today's
* date or the value date (if any).
* @default Date()
*/
currentDate?: Date;
/**
* Change event Handler that is called when the currentDate is changed. The handler is
* called with the currentDate object.
*/
onCurrentDateChange?: (date?: Date) => void;
/**
* Show or hide the Calendar footer.
* @default false
*/
footer?: boolean;
/**
* Provide a custom component to render the days of the month.
* The Component is provided the following props
* - date: a Date object for the day of the month to render
* - label: a formatted String of the date to render. To adjust the format of the label
* string use the dateFormat prop, listed below.
*/
dayComponent?: __React.ReactType;
/**
* The starting and lowest level view the calendar can navigate down to.
* @enum "month" "year" "decade" "century"
*/
initialView?: "month" | "year" | "decade" | "century";
/**
* The highest level view the calendar can navigate up to. This value should be higher than
* initialView
* @enum "month" "year" "decade" "century"
*/
finalView?: "month" | "year" | "decade" | "century";
/**
* A formatter for the header button of the month view
*/
headerFormat?: string | ((day: Date) => string);
/**
* A formatter for the Calendar footer, formats Today's Date as a string.
*/
footerFormat?: string | ((day: Date) => string);
/**
* A formatter calendar days of the week, the default formats each day as a Narrow name:
* "Mo", "Tu", etc.
*/
dayFormat?: string | ((day: Date) => string);
/**
* A formatter for day of the month.
*/
dateFormat?: string | ((day: Date) => string);
/**
* A formatter for month name.
*/
monthFormat?: string | ((day: Date) => string);
/**
* A formatter for the year.
*/
yearFormat?: string | ((day: Date) => string);
/**
* A formatter for decade, the default formats the first and last year of the decade like:
* 2000 - 2009.
*/
decadeFormat?: string | ((day: Date) => string);
/**
* A formatter for century, the default formats the first and last year of the century like:
* 1900 - 1999.
*/
centuryFormat?: string | ((day: Date) => string);
/**
* Mark whether the widget should render right-to-left. This property can also be implicitly
* passed to the widget through a childContext prop (isRtl) this allows higher level
* application components to specify the direction.
*/
isRtl?: boolean;
messages?: CalendarMessages;
}
interface CalendarMessages {
/**
* Title and screen reader text for the left arrow button.
* @default: "navigate back"
*/
moveBack?: string;
/**
* Title and screen reader text for the right arrow button.
* @default: "navigate forward"
*/
moveForward?: string;
}
interface Calendar extends __React.ReactElement<CalendarProps> {}
interface CalendarClass extends __React.ComponentClass<CalendarProps> {}
var Calendar: CalendarClass;
export = Calendar;
}
declare module 'react-widgets/lib/DropdownList' {
interface DropdownListProps extends __React.Props<DropdownListClass> {
/**
* The current value of the DropdownList. This can be an object (such as a member of the
* data array) or a primitive value, hinted to by the valueField. The widget value does not
* need to be in the data array; widgets can have values that are not in their list.
*/
value?: any;
/**
* Default value.
*/
defaultValue?: any;
/**
* Change event Handler that is called when the value is changed.
*/
onChange?: (value: any) => void;
/**
* This handler fires when an item has been selected from the list. It fires before the
* onChange handler, and fires regardless of whether the value has actually changed.
*/
onSelect?: (value: any) => void;
/**
* Provide an array of possible values for the DropdownList. If an array of objects is
* provided you should use the valueField and textField props, to specify which object
* properties comprise the value field (such as an id) and the field used to label the item.
*/
data?: any[];
/**
* A dataItem field name for uniquely identifying items in the data list. A valueField is
* required when the value prop is not itself a dataItem. A valueField is useful when
* specifying the selected item, by its id instead of using the model as the value.
* When a valueField is not provided, the DropdownList will use strict equality checks (===)
* to locate the value in the data list.
*/
valueField?: string;
/**
* Specify which data item field to display in the DropdownList and selected item.
* ThetextFieldprop may also also used as to find an item in the list as you type. Providing
* an accessor function allows for computed text values
*/
textField?: string;
/**
* This component is used to render the selected value of the DropdownList. The default
* component renders the text of the selected item (specified by textfield)
*/
valueComponent?: __React.ReactType;
/**
* This component is used to render each possible item in the DropdownList. The default
* component renders the text of the selected item (specified by textfield)
*/
itemComponent?: __React.ReactType;
/**
* Disable the widget, if an Array of values is passed in only those values will be disabled.
*/
disabled?: boolean | any[];
/**
* Place the DropdownList in a read-only mode, If an Array of values is passed in only those
* values will be read-only.
*/
readOnly?: boolean | any[];
/**
* Determines how to group the DropdownList. Providing a string will group the data array by
* that property. You can also provide a function which should return the group value.
*/
groupBy?: string | ((dataItem: any) => any);
/**
* This component is used to render each option group, when groupBy is specified. By default
* the groupBy value will be used.
*/
groupComponent?: __React.ReactType;
/**
* Text to display when the value is empty.
*/
placeholder?: string;
/**
* The string value of the current search being typed into the DropdownList. When unset
* (undefined) the DropdownList will handle the filtering internally. The defaultSearchTerm
* prop can be used to set an initialization value for uncontrolled widgets. searchTerm is
* only relevant when the filter prop is set.
*/
searchTerm?: string;
/**
* Called when the value of the filter input changes either from typing or a pasted value.
* onSearch should be used when the searchTerm prop is set.
*/
onSearch?: (searchTerm: string) => void;
/**
* Whether or not the DropdownList is open. When unset (undefined) the DropdownList will
* handle the opening and closing internally. The defaultOpen prop can be used to set an
* initialization value for uncontrolled widgets.
*/
open?: boolean;
/**
* Called when the DropdownList is about to open or close. onToggle should be used when the
* open prop is set otherwise the widget open buttons won't work.
*/
onToggle?: (isOpen: boolean) => void;
/**
* Specify a filtering method used to reduce the items in the dropdown as you type.
* There are a few built-in filtering methods that can be specified by passing the String name.
* To handle custom filtering techniques provide a function that returns true or false
* for each passed in item (analogous to the array.filter builtin)
* @enum false "startsWith" "endsWith" "contains"
*/
filter?: boolean | "startsWith" | "endsWith" | "contains" | ((dataItem: any, str: string) => boolean);
/**
* Use in conjunction with the filter prop. Filter the list without regard for case. This
* only applies to non function values for filter
* @default false
*/
caseSensitive?: boolean;
/**
* Use in conjunction with the filter prop. Start filtering the list only after the value
* has reached a minimum length.
* @default 1
*/
minLength?: number;
/**
* Mark whether the widget is in a busy or loading state. If true the widget will display a
* spinner gif, useful when loading data via an ajax call.
* @default false
*/
busy?: boolean;
/**
* The speed, in milliseconds, of the dropdown animation.
* @default 250
*/
duration?: number;
/**
* Mark whether the widget should render right-to-left. This property can also be implicitly
* passed to the widget through a childContext prop (isRtl) this allows higher level
* application components to specify the direction.
*/
isRtl?: boolean;
/**
* Object hash containing display text and/or text for screen readers. Use the messages
* object to localize widget text and increase accessibility.
*/
messages?: DropdownListMessages;
}
interface DropdownListMessages {
/**
* Dropdown button text for screen readers.
* @default: "Open Dropdown"
*/
open?: string | ((props: DropdownListProps) => string);
/**
* The placeholder text for the filter input.
*/
filterPlaceholder?: string | ((props: DropdownListProps) => string);
/**
* Text to display when the data prop array is empty.
* @default: "There are no items in this list"
*/
emptyList?: string | ((props: DropdownListProps) => string);
/**
* Text to display when the the current filter does not return any results.
* @default: "The filter returned no results"
*/
emptyFilter?: string | ((props: DropdownListProps) => string);
}
interface DropdownList extends __React.ReactElement<DropdownListProps> {}
interface DropdownListClass extends __React.ComponentClass<DropdownListProps> {}
var DropdownList: DropdownListClass;
export = DropdownList;
}
declare module 'react-widgets' {
export import Calendar = require('react-widgets/lib/Calendar');
export import Combobox = require('react-widgets/lib/Combobox');
export import DateTimePicker = require('react-widgets/lib/DateTimePicker');
export import DropdownList = require('react-widgets/lib/DropdownList');
export import Multiselect = require('react-widgets/lib/Multiselect');
export import NumberPicker = require('react-widgets/lib/NumberPicker');
export import SelectList = require('react-widgets/lib/SelectList');
}