dash-core-components 4.0.0-rc1 → 4.0.0-rc2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dash_core_components/async-dropdown.js +1 -1
- package/dash_core_components/async-dropdown.js.map +1 -1
- package/dash_core_components/async-slider.js +1 -1
- package/dash_core_components/async-slider.js.map +1 -1
- package/dash_core_components/dash_core_components.js +1 -1
- package/dash_core_components/dash_core_components.js.map +1 -1
- package/dash_core_components/proptypes.js +102 -3
- package/lib/components/Checklist.tsx +67 -0
- package/lib/components/Dropdown.tsx +19 -3
- package/lib/components/Loading.tsx +185 -0
- package/lib/components/RadioItems.tsx +69 -0
- package/lib/components/RangeSlider.tsx +5 -1
- package/lib/components/Slider.tsx +12 -1
- package/lib/components/Tab.react.js.old +79 -0
- package/lib/components/Textarea.tsx +79 -0
- package/lib/components/Tooltip.tsx +66 -0
- package/lib/components/css/checklist.css +4 -0
- package/lib/components/css/dcc.css +2 -0
- package/lib/components/css/dropdown.css +30 -49
- package/lib/components/css/input.css +22 -6
- package/lib/components/css/optionslist.css +34 -0
- package/lib/components/css/radioitems.css +4 -0
- package/lib/components/css/sliders.css +11 -7
- package/lib/components/css/textarea.css +21 -0
- package/lib/components/css/tooltip.css +127 -0
- package/lib/fragments/Dropdown.tsx +205 -269
- package/lib/fragments/Loading/spinners/CircleSpinner.tsx +185 -0
- package/lib/fragments/Loading/spinners/CubeSpinner.tsx +193 -0
- package/lib/fragments/Loading/spinners/DebugTitle.tsx +11 -0
- package/lib/fragments/Loading/spinners/DefaultSpinner.tsx +110 -0
- package/lib/fragments/Loading/spinners/DotSpinner.tsx +96 -0
- package/lib/fragments/Loading/spinners/GraphSpinner.tsx +332 -0
- package/lib/fragments/Loading/types.ts +13 -0
- package/lib/fragments/RangeSlider.tsx +193 -63
- package/lib/index.ts +5 -5
- package/lib/types.ts +455 -116
- package/lib/utils/dropdownSearch.ts +4 -4
- package/lib/utils/optionRendering.tsx +168 -0
- package/lib/utils/optionTypes.ts +5 -5
- package/lib/utils/sliderRendering.tsx +23 -4
- package/package.json +1 -2
- package/lib/components/Checklist.react.js +0 -193
- package/lib/components/Input.react.js.old +0 -507
- package/lib/components/Loading.react.js +0 -254
- package/lib/components/RadioItems.react.js +0 -192
- package/lib/components/Slider.react.js.old +0 -214
- package/lib/components/Textarea.react.js +0 -223
- package/lib/components/Tooltip.react.js +0 -120
- package/lib/components/css/Dropdown.css +0 -8
- package/lib/fragments/Loading/spinners/CircleSpinner.js +0 -68
- package/lib/fragments/Loading/spinners/CubeSpinner.js +0 -57
- package/lib/fragments/Loading/spinners/DebugTitle.js +0 -15
- package/lib/fragments/Loading/spinners/DefaultSpinner.js +0 -54
- package/lib/fragments/Loading/spinners/DotSpinner.js +0 -50
- package/lib/fragments/Loading/spinners/GraphSpinner.js +0 -68
package/lib/types.ts
CHANGED
|
@@ -22,6 +22,50 @@ export enum PersistedProps {
|
|
|
22
22
|
'value' = 'value',
|
|
23
23
|
}
|
|
24
24
|
|
|
25
|
+
export interface BaseComponentProps<T> {
|
|
26
|
+
/**
|
|
27
|
+
* The ID of this component, used to identify dash components
|
|
28
|
+
* in callbacks. The ID needs to be unique across all of the
|
|
29
|
+
* components in an app.
|
|
30
|
+
*/
|
|
31
|
+
id?: string;
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Additional CSS class for the root DOM node
|
|
35
|
+
*/
|
|
36
|
+
className?: string;
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Dash-assigned callback that gets fired when component properties change
|
|
40
|
+
*/
|
|
41
|
+
setProps: (props: Partial<T>) => void;
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* Used to allow user interactions in this component to be persisted when
|
|
45
|
+
* the component - or the page - is refreshed. If `persisted` is truthy and
|
|
46
|
+
* hasn't changed from its previous value, a `value` that the user has
|
|
47
|
+
* changed while using the app will keep that change, as long as
|
|
48
|
+
* the new `value` also matches what was given originally.
|
|
49
|
+
* Used in conjunction with `persistence_type`.
|
|
50
|
+
*/
|
|
51
|
+
persistence?: boolean | string | number;
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* Properties whose user interactions will persist after refreshing the
|
|
55
|
+
* component or the page. Since only `value` is allowed this prop can
|
|
56
|
+
* normally be ignored.
|
|
57
|
+
*/
|
|
58
|
+
persisted_props?: PersistedProps[];
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* Where persisted user changes will be stored:
|
|
62
|
+
* memory: only kept in memory, reset on page refresh.
|
|
63
|
+
* local: window.localStorage, data is kept after the browser quit.
|
|
64
|
+
* session: window.sessionStorage, data is cleared once the browser quit.
|
|
65
|
+
*/
|
|
66
|
+
persistence_type?: PersistenceTypes;
|
|
67
|
+
}
|
|
68
|
+
|
|
25
69
|
export type SliderMarks = {
|
|
26
70
|
[key: number]: string | {label: string; style?: React.CSSProperties};
|
|
27
71
|
};
|
|
@@ -78,7 +122,7 @@ export type SliderTooltip = {
|
|
|
78
122
|
transform?: string;
|
|
79
123
|
};
|
|
80
124
|
|
|
81
|
-
export interface SliderProps {
|
|
125
|
+
export interface SliderProps extends BaseComponentProps<SliderProps> {
|
|
82
126
|
/**
|
|
83
127
|
* Minimum allowed value of the slider
|
|
84
128
|
*/
|
|
@@ -132,6 +176,11 @@ export interface SliderProps {
|
|
|
132
176
|
*/
|
|
133
177
|
included?: boolean;
|
|
134
178
|
|
|
179
|
+
/**
|
|
180
|
+
* If the value is true, the slider is rendered in reverse.
|
|
181
|
+
*/
|
|
182
|
+
reverse?: boolean;
|
|
183
|
+
|
|
135
184
|
/**
|
|
136
185
|
* Configuration for tooltips describing the current slider value
|
|
137
186
|
*/
|
|
@@ -158,51 +207,9 @@ export interface SliderProps {
|
|
|
158
207
|
* The height, in px, of the slider if it is vertical.
|
|
159
208
|
*/
|
|
160
209
|
verticalHeight?: number;
|
|
161
|
-
|
|
162
|
-
/**
|
|
163
|
-
* Additional CSS class for the root DOM node
|
|
164
|
-
*/
|
|
165
|
-
className?: string;
|
|
166
|
-
|
|
167
|
-
/**
|
|
168
|
-
* The ID of this component, used to identify dash components
|
|
169
|
-
* in callbacks. The ID needs to be unique across all of the
|
|
170
|
-
* components in an app.
|
|
171
|
-
*/
|
|
172
|
-
id?: string;
|
|
173
|
-
|
|
174
|
-
/**
|
|
175
|
-
* Dash-assigned callback that gets fired when the value or drag_value changes.
|
|
176
|
-
*/
|
|
177
|
-
setProps: (props: Partial<SliderProps>) => void;
|
|
178
|
-
|
|
179
|
-
/**
|
|
180
|
-
* Used to allow user interactions in this component to be persisted when
|
|
181
|
-
* the component - or the page - is refreshed. If `persisted` is truthy and
|
|
182
|
-
* hasn't changed from its previous value, a `value` that the user has
|
|
183
|
-
* changed while using the app will keep that change, as long as
|
|
184
|
-
* the new `value` also matches what was given originally.
|
|
185
|
-
* Used in conjunction with `persistence_type`.
|
|
186
|
-
*/
|
|
187
|
-
persistence?: boolean | string | number;
|
|
188
|
-
|
|
189
|
-
/**
|
|
190
|
-
* Properties whose user interactions will persist after refreshing the
|
|
191
|
-
* component or the page. Since only `value` is allowed this prop can
|
|
192
|
-
* normally be ignored.
|
|
193
|
-
*/
|
|
194
|
-
persisted_props?: PersistedProps[];
|
|
195
|
-
|
|
196
|
-
/**
|
|
197
|
-
* Where persisted user changes will be stored:
|
|
198
|
-
* memory: only kept in memory, reset on page refresh.
|
|
199
|
-
* local: window.localStorage, data is kept after the browser quit.
|
|
200
|
-
* session: window.sessionStorage, data is cleared once the browser quit.
|
|
201
|
-
*/
|
|
202
|
-
persistence_type?: PersistenceTypes;
|
|
203
210
|
}
|
|
204
211
|
|
|
205
|
-
export interface RangeSliderProps {
|
|
212
|
+
export interface RangeSliderProps extends BaseComponentProps<RangeSliderProps> {
|
|
206
213
|
/**
|
|
207
214
|
* Minimum allowed value of the slider
|
|
208
215
|
*/
|
|
@@ -275,6 +282,11 @@ export interface RangeSliderProps {
|
|
|
275
282
|
*/
|
|
276
283
|
included?: boolean;
|
|
277
284
|
|
|
285
|
+
/**
|
|
286
|
+
* If the value is true, the slider is rendered in reverse.
|
|
287
|
+
*/
|
|
288
|
+
reverse?: boolean;
|
|
289
|
+
|
|
278
290
|
/**
|
|
279
291
|
* Configuration for tooltips describing the current slider values
|
|
280
292
|
*/
|
|
@@ -300,60 +312,18 @@ export interface RangeSliderProps {
|
|
|
300
312
|
* The height, in px, of the slider if it is vertical.
|
|
301
313
|
*/
|
|
302
314
|
verticalHeight?: number;
|
|
303
|
-
|
|
304
|
-
/**
|
|
305
|
-
* Additional CSS class for the root DOM node
|
|
306
|
-
*/
|
|
307
|
-
className?: string;
|
|
308
|
-
|
|
309
|
-
/**
|
|
310
|
-
* The ID of this component, used to identify dash components
|
|
311
|
-
* in callbacks. The ID needs to be unique across all of the
|
|
312
|
-
* components in an app.
|
|
313
|
-
*/
|
|
314
|
-
id?: string;
|
|
315
|
-
|
|
316
|
-
/**
|
|
317
|
-
* Dash-assigned callback that gets fired when the value or drag_value changes.
|
|
318
|
-
*/
|
|
319
|
-
setProps: (props: Partial<RangeSliderProps>) => void;
|
|
320
|
-
|
|
321
|
-
/**
|
|
322
|
-
* Used to allow user interactions in this component to be persisted when
|
|
323
|
-
* the component - or the page - is refreshed. If `persisted` is truthy and
|
|
324
|
-
* hasn't changed from its previous value, a `value` that the user has
|
|
325
|
-
* changed while using the app will keep that change, as long as
|
|
326
|
-
* the new `value` also matches what was given originally.
|
|
327
|
-
* Used in conjunction with `persistence_type`.
|
|
328
|
-
*/
|
|
329
|
-
persistence?: boolean | string | number;
|
|
330
|
-
|
|
331
|
-
/**
|
|
332
|
-
* Properties whose user interactions will persist after refreshing the
|
|
333
|
-
* component or the page. Since only `value` is allowed this prop can
|
|
334
|
-
* normally be ignored.
|
|
335
|
-
*/
|
|
336
|
-
persisted_props?: PersistedProps[];
|
|
337
|
-
|
|
338
|
-
/**
|
|
339
|
-
* Where persisted user changes will be stored:
|
|
340
|
-
* memory: only kept in memory, reset on page refresh.
|
|
341
|
-
* local: window.localStorage, data is kept after the browser quit.
|
|
342
|
-
* session: window.sessionStorage, data is cleared once the browser quit.
|
|
343
|
-
*/
|
|
344
|
-
persistence_type?: PersistenceTypes;
|
|
345
315
|
}
|
|
346
316
|
|
|
347
|
-
export type
|
|
317
|
+
export type OptionValue = string | number | boolean;
|
|
348
318
|
|
|
349
|
-
export type
|
|
350
|
-
label: string | DashComponent;
|
|
319
|
+
export type DetailedOption = {
|
|
320
|
+
label: string | DashComponent | DashComponent[];
|
|
351
321
|
/**
|
|
352
322
|
* The value of the option. This value
|
|
353
323
|
* corresponds to the items specified in the
|
|
354
324
|
* `value` property.
|
|
355
325
|
*/
|
|
356
|
-
value:
|
|
326
|
+
value: OptionValue;
|
|
357
327
|
/**
|
|
358
328
|
* If true, this option is disabled and cannot be selected.
|
|
359
329
|
*/
|
|
@@ -376,7 +346,7 @@ export type DetailedDropdownOption = {
|
|
|
376
346
|
/**
|
|
377
347
|
* Array of options where the label and the value are the same thing, or an option dict
|
|
378
348
|
*/
|
|
379
|
-
export type
|
|
349
|
+
export type OptionsArray = (OptionValue | DetailedOption)[];
|
|
380
350
|
|
|
381
351
|
/**
|
|
382
352
|
* Simpler `options` representation in dictionary format. The order is not guaranteed.
|
|
@@ -384,14 +354,14 @@ export type DropdownOptionsArray = (DropdownValue | DetailedDropdownOption)[];
|
|
|
384
354
|
* which is equal to
|
|
385
355
|
* [{label: `label1`, value: `value1`}, {label: `label2`, value: `value2`}, ...]
|
|
386
356
|
*/
|
|
387
|
-
export type
|
|
357
|
+
export type OptionsDict = Record<string, string>;
|
|
388
358
|
|
|
389
|
-
export interface DropdownProps {
|
|
359
|
+
export interface DropdownProps extends BaseComponentProps<DropdownProps> {
|
|
390
360
|
/**
|
|
391
361
|
* An array of options {label: [string|number], value: [string|number]},
|
|
392
362
|
* an optional disabled field can be used for each option
|
|
393
363
|
*/
|
|
394
|
-
options?:
|
|
364
|
+
options?: OptionsArray | OptionsDict;
|
|
395
365
|
|
|
396
366
|
/**
|
|
397
367
|
* The value of the input. If `multi` is false (the default)
|
|
@@ -401,7 +371,7 @@ export interface DropdownProps {
|
|
|
401
371
|
* array of items with values corresponding to those in the
|
|
402
372
|
* `options` prop.
|
|
403
373
|
*/
|
|
404
|
-
value?:
|
|
374
|
+
value?: OptionValue | OptionValue[] | null;
|
|
405
375
|
|
|
406
376
|
/**
|
|
407
377
|
* If true, the user can select multiple values
|
|
@@ -443,7 +413,7 @@ export interface DropdownProps {
|
|
|
443
413
|
/**
|
|
444
414
|
* height of each option. Can be increased when label lengths would wrap around
|
|
445
415
|
*/
|
|
446
|
-
optionHeight?: number;
|
|
416
|
+
optionHeight?: 'auto' | number;
|
|
447
417
|
|
|
448
418
|
/**
|
|
449
419
|
* height of the options dropdown.
|
|
@@ -456,9 +426,260 @@ export interface DropdownProps {
|
|
|
456
426
|
style?: React.CSSProperties;
|
|
457
427
|
|
|
458
428
|
/**
|
|
459
|
-
*
|
|
429
|
+
* Text for customizing the labels rendered by this component.
|
|
460
430
|
*/
|
|
461
|
-
|
|
431
|
+
labels?: {
|
|
432
|
+
select_all?: string;
|
|
433
|
+
deselect_all?: string;
|
|
434
|
+
selected_count?: string;
|
|
435
|
+
search?: string;
|
|
436
|
+
clear_search?: string;
|
|
437
|
+
clear_selection?: string;
|
|
438
|
+
no_options_found?: string;
|
|
439
|
+
};
|
|
440
|
+
}
|
|
441
|
+
|
|
442
|
+
export interface ChecklistProps extends BaseComponentProps<ChecklistProps> {
|
|
443
|
+
/**
|
|
444
|
+
* An array of options
|
|
445
|
+
*/
|
|
446
|
+
options?: OptionsArray | OptionsDict;
|
|
447
|
+
|
|
448
|
+
/**
|
|
449
|
+
* The currently selected value
|
|
450
|
+
*/
|
|
451
|
+
value?: OptionValue[] | null;
|
|
452
|
+
|
|
453
|
+
/**
|
|
454
|
+
* Indicates whether the options labels should be displayed inline (true=horizontal)
|
|
455
|
+
* or in a block (false=vertical).
|
|
456
|
+
*/
|
|
457
|
+
inline?: boolean;
|
|
458
|
+
|
|
459
|
+
/**
|
|
460
|
+
* The style of the container (div)
|
|
461
|
+
*/
|
|
462
|
+
style?: React.CSSProperties;
|
|
463
|
+
|
|
464
|
+
/**
|
|
465
|
+
* The style of the <input> checkbox element
|
|
466
|
+
*/
|
|
467
|
+
inputStyle?: React.CSSProperties;
|
|
468
|
+
|
|
469
|
+
/**
|
|
470
|
+
* The class of the <input> checkbox element
|
|
471
|
+
*/
|
|
472
|
+
inputClassName?: string;
|
|
473
|
+
|
|
474
|
+
/**
|
|
475
|
+
* The style of the <label> that wraps the checkbox input
|
|
476
|
+
* and the option's label
|
|
477
|
+
*/
|
|
478
|
+
labelStyle?: React.CSSProperties;
|
|
479
|
+
|
|
480
|
+
/**
|
|
481
|
+
* The class of the <label> that wraps the checkbox input
|
|
482
|
+
* and the option's label
|
|
483
|
+
*/
|
|
484
|
+
labelClassName?: string;
|
|
485
|
+
}
|
|
486
|
+
|
|
487
|
+
export interface RadioItemsProps extends BaseComponentProps<RadioItemsProps> {
|
|
488
|
+
/**
|
|
489
|
+
* An array of options
|
|
490
|
+
*/
|
|
491
|
+
options?: OptionsArray | OptionsDict;
|
|
492
|
+
|
|
493
|
+
/**
|
|
494
|
+
* The currently selected value
|
|
495
|
+
*/
|
|
496
|
+
value?: OptionValue | null;
|
|
497
|
+
|
|
498
|
+
/**
|
|
499
|
+
* Indicates whether the options labels should be displayed inline (true=horizontal)
|
|
500
|
+
* or in a block (false=vertical).
|
|
501
|
+
*/
|
|
502
|
+
inline?: boolean;
|
|
503
|
+
|
|
504
|
+
/**
|
|
505
|
+
* The style of the container (div)
|
|
506
|
+
*/
|
|
507
|
+
style?: React.CSSProperties;
|
|
508
|
+
|
|
509
|
+
/**
|
|
510
|
+
* The style of the <input> checkbox element
|
|
511
|
+
*/
|
|
512
|
+
inputStyle?: React.CSSProperties;
|
|
513
|
+
|
|
514
|
+
/**
|
|
515
|
+
* The class of the <input> checkbox element
|
|
516
|
+
*/
|
|
517
|
+
inputClassName?: string;
|
|
518
|
+
|
|
519
|
+
/**
|
|
520
|
+
* The style of the <label> that wraps the checkbox input
|
|
521
|
+
* and the option's label
|
|
522
|
+
*/
|
|
523
|
+
labelStyle?: React.CSSProperties;
|
|
524
|
+
|
|
525
|
+
/**
|
|
526
|
+
* The class of the <label> that wraps the checkbox input
|
|
527
|
+
* and the option's label
|
|
528
|
+
*/
|
|
529
|
+
labelClassName?: string;
|
|
530
|
+
}
|
|
531
|
+
|
|
532
|
+
export interface TextAreaProps extends BaseComponentProps<TextAreaProps> {
|
|
533
|
+
/**
|
|
534
|
+
* The value of the textarea
|
|
535
|
+
*/
|
|
536
|
+
value?: string;
|
|
537
|
+
|
|
538
|
+
/**
|
|
539
|
+
* The element should be automatically focused after the page loaded.
|
|
540
|
+
*/
|
|
541
|
+
autoFocus?: string;
|
|
542
|
+
|
|
543
|
+
/**
|
|
544
|
+
* Defines the number of columns in a textarea.
|
|
545
|
+
*/
|
|
546
|
+
cols?: number;
|
|
547
|
+
|
|
548
|
+
/**
|
|
549
|
+
* Indicates whether the user can interact with the element.
|
|
550
|
+
*/
|
|
551
|
+
disabled?: boolean | 'disabled' | 'DISABLED';
|
|
552
|
+
|
|
553
|
+
/**
|
|
554
|
+
* Indicates the form that is the owner of the element.
|
|
555
|
+
*/
|
|
556
|
+
form?: string;
|
|
557
|
+
|
|
558
|
+
/**
|
|
559
|
+
* Defines the maximum number of characters allowed in the element.
|
|
560
|
+
*/
|
|
561
|
+
maxLength?: number;
|
|
562
|
+
|
|
563
|
+
/**
|
|
564
|
+
* Defines the minimum number of characters allowed in the element.
|
|
565
|
+
*/
|
|
566
|
+
minLength?: number;
|
|
567
|
+
|
|
568
|
+
/**
|
|
569
|
+
* Name of the element. For example used by the server to identify the fields in form submits.
|
|
570
|
+
*/
|
|
571
|
+
name?: string;
|
|
572
|
+
|
|
573
|
+
/**
|
|
574
|
+
* Provides a hint to the user of what can be entered in the field.
|
|
575
|
+
*/
|
|
576
|
+
placeholder?: string;
|
|
577
|
+
|
|
578
|
+
/**
|
|
579
|
+
* Indicates whether the element can be edited.
|
|
580
|
+
* readOnly is an HTML boolean attribute - it is enabled by a boolean or
|
|
581
|
+
* 'readOnly'. Alternative capitalizations `readonly` & `READONLY`
|
|
582
|
+
* are also acccepted.
|
|
583
|
+
*/
|
|
584
|
+
readOnly?: boolean | 'readOnly' | 'readonly' | 'READONLY';
|
|
585
|
+
|
|
586
|
+
/**
|
|
587
|
+
* Indicates whether this element is required to fill out or not.
|
|
588
|
+
* required is an HTML boolean attribute - it is enabled by a boolean or
|
|
589
|
+
* 'required'. Alternative capitalizations `REQUIRED`
|
|
590
|
+
* are also acccepted.
|
|
591
|
+
*/
|
|
592
|
+
required?: boolean | 'required' | 'REQUIRED';
|
|
593
|
+
|
|
594
|
+
/**
|
|
595
|
+
* Defines the number of rows in a text area.
|
|
596
|
+
*/
|
|
597
|
+
rows?: number;
|
|
598
|
+
|
|
599
|
+
/**
|
|
600
|
+
* Indicates whether the text should be wrapped.
|
|
601
|
+
*/
|
|
602
|
+
wrap?: string;
|
|
603
|
+
|
|
604
|
+
/**
|
|
605
|
+
* Defines a keyboard shortcut to activate or add focus to the element.
|
|
606
|
+
*/
|
|
607
|
+
accessKey?: string;
|
|
608
|
+
|
|
609
|
+
/**
|
|
610
|
+
* Indicates whether the element's content is editable.
|
|
611
|
+
*/
|
|
612
|
+
contentEditable?: boolean;
|
|
613
|
+
|
|
614
|
+
/**
|
|
615
|
+
* Defines the ID of a <menu> element which will serve as the element's context menu.
|
|
616
|
+
*/
|
|
617
|
+
contextMenu?: string;
|
|
618
|
+
|
|
619
|
+
/**
|
|
620
|
+
* Defines the text direction. Allowed values are ltr (Left-To-Right) or rtl (Right-To-Left)
|
|
621
|
+
*/
|
|
622
|
+
dir?: string;
|
|
623
|
+
|
|
624
|
+
/**
|
|
625
|
+
* Defines whether the element can be dragged.
|
|
626
|
+
*/
|
|
627
|
+
draggable?: boolean;
|
|
628
|
+
|
|
629
|
+
/**
|
|
630
|
+
* Prevents rendering of given element, while keeping child elements, e.g. script elements, active.
|
|
631
|
+
*/
|
|
632
|
+
hidden?: string;
|
|
633
|
+
|
|
634
|
+
/**
|
|
635
|
+
* Defines the language used in the element.
|
|
636
|
+
*/
|
|
637
|
+
lang?: string;
|
|
638
|
+
|
|
639
|
+
/**
|
|
640
|
+
* Indicates whether spell checking is allowed for the element.
|
|
641
|
+
*/
|
|
642
|
+
spellCheck?: boolean;
|
|
643
|
+
|
|
644
|
+
/**
|
|
645
|
+
* Defines CSS styles which will override styles previously set.
|
|
646
|
+
*/
|
|
647
|
+
style?: React.CSSProperties;
|
|
648
|
+
|
|
649
|
+
/**
|
|
650
|
+
* Overrides the browser's default tab order and follows the one specified instead.
|
|
651
|
+
*/
|
|
652
|
+
tabIndex?: number;
|
|
653
|
+
|
|
654
|
+
/**
|
|
655
|
+
* Text to be displayed in a tooltip when hovering over the element.
|
|
656
|
+
*/
|
|
657
|
+
title?: string;
|
|
658
|
+
|
|
659
|
+
/**
|
|
660
|
+
* Number of times the textarea lost focus.
|
|
661
|
+
*/
|
|
662
|
+
n_blur?: number;
|
|
663
|
+
/**
|
|
664
|
+
* Last time the textarea lost focus.
|
|
665
|
+
*/
|
|
666
|
+
n_blur_timestamp?: number;
|
|
667
|
+
|
|
668
|
+
/**
|
|
669
|
+
* Number of times the textarea has been clicked.
|
|
670
|
+
*/
|
|
671
|
+
n_clicks?: number;
|
|
672
|
+
/**
|
|
673
|
+
* Last time the textarea was clicked.
|
|
674
|
+
*/
|
|
675
|
+
n_clicks_timestamp?: number;
|
|
676
|
+
}
|
|
677
|
+
|
|
678
|
+
export interface TooltipProps {
|
|
679
|
+
/**
|
|
680
|
+
* The contents of the tooltip
|
|
681
|
+
*/
|
|
682
|
+
children?: React.ReactNode;
|
|
462
683
|
|
|
463
684
|
/**
|
|
464
685
|
* The ID of this component, used to identify dash components
|
|
@@ -468,32 +689,150 @@ export interface DropdownProps {
|
|
|
468
689
|
id?: string;
|
|
469
690
|
|
|
470
691
|
/**
|
|
471
|
-
*
|
|
692
|
+
* The class of the tooltip
|
|
472
693
|
*/
|
|
473
|
-
|
|
694
|
+
className?: string;
|
|
474
695
|
|
|
475
696
|
/**
|
|
476
|
-
*
|
|
477
|
-
* the component - or the page - is refreshed. If `persisted` is truthy and
|
|
478
|
-
* hasn't changed from its previous value, a `value` that the user has
|
|
479
|
-
* changed while using the app will keep that change, as long as
|
|
480
|
-
* the new `value` also matches what was given originally.
|
|
481
|
-
* Used in conjunction with `persistence_type`.
|
|
697
|
+
* The style of the tooltip
|
|
482
698
|
*/
|
|
483
|
-
|
|
699
|
+
style?: React.CSSProperties;
|
|
484
700
|
|
|
485
701
|
/**
|
|
486
|
-
*
|
|
487
|
-
*
|
|
488
|
-
* normally be ignored.
|
|
702
|
+
* The bounding box coordinates of the item to label, in px relative to
|
|
703
|
+
* the positioning parent of the Tooltip component.
|
|
489
704
|
*/
|
|
490
|
-
|
|
705
|
+
bbox?: {
|
|
706
|
+
x0: number;
|
|
707
|
+
y0: number;
|
|
708
|
+
x1: number;
|
|
709
|
+
y1: number;
|
|
710
|
+
};
|
|
491
711
|
|
|
492
712
|
/**
|
|
493
|
-
*
|
|
494
|
-
* memory: only kept in memory, reset on page refresh.
|
|
495
|
-
* local: window.localStorage, data is kept after the browser quit.
|
|
496
|
-
* session: window.sessionStorage, data is cleared once the browser quit.
|
|
713
|
+
* Whether to show the tooltip
|
|
497
714
|
*/
|
|
498
|
-
|
|
715
|
+
show?: boolean;
|
|
716
|
+
|
|
717
|
+
/**
|
|
718
|
+
* The side of the `bbox` on which the tooltip should open.
|
|
719
|
+
*/
|
|
720
|
+
direction?: 'top' | 'right' | 'bottom' | 'left';
|
|
721
|
+
|
|
722
|
+
/**
|
|
723
|
+
* Color of the tooltip border, as a CSS color string.
|
|
724
|
+
*/
|
|
725
|
+
border_color?: string;
|
|
726
|
+
|
|
727
|
+
/**
|
|
728
|
+
* Color of the tooltip background, as a CSS color string.
|
|
729
|
+
*/
|
|
730
|
+
background_color?: string;
|
|
731
|
+
|
|
732
|
+
/**
|
|
733
|
+
* The text displayed in the tooltip while loading
|
|
734
|
+
*/
|
|
735
|
+
loading_text?: string;
|
|
736
|
+
|
|
737
|
+
/**
|
|
738
|
+
* The `z-index` CSS property to assign to the tooltip. Components with
|
|
739
|
+
* higher values will be displayed on top of components with lower values.
|
|
740
|
+
*/
|
|
741
|
+
zindex?: number;
|
|
742
|
+
|
|
743
|
+
/**
|
|
744
|
+
* Whether the tooltip itself can be targeted by pointer events.
|
|
745
|
+
* For tooltips triggered by hover events, typically this should be left
|
|
746
|
+
* `false` to avoid the tooltip interfering with those same events.
|
|
747
|
+
*/
|
|
748
|
+
targetable?: boolean;
|
|
749
|
+
|
|
750
|
+
/**
|
|
751
|
+
* Dash-assigned callback that gets fired when the value changes.
|
|
752
|
+
*/
|
|
753
|
+
setProps: (props: Partial<TooltipProps>) => void;
|
|
754
|
+
}
|
|
755
|
+
|
|
756
|
+
export interface LoadingProps extends BaseComponentProps<LoadingProps> {
|
|
757
|
+
/**
|
|
758
|
+
* Array that holds components to render
|
|
759
|
+
*/
|
|
760
|
+
children?: React.ReactNode;
|
|
761
|
+
|
|
762
|
+
/**
|
|
763
|
+
* Property that determines which built-in spinner to show
|
|
764
|
+
* one of 'graph', 'cube', 'circle', 'dot', or 'default'.
|
|
765
|
+
*/
|
|
766
|
+
type?: 'graph' | 'cube' | 'circle' | 'dot' | 'default';
|
|
767
|
+
|
|
768
|
+
/**
|
|
769
|
+
* Boolean that makes the built-in spinner display full-screen
|
|
770
|
+
*/
|
|
771
|
+
fullscreen?: boolean;
|
|
772
|
+
|
|
773
|
+
/**
|
|
774
|
+
* If true, the built-in spinner will display the component_name and prop_name
|
|
775
|
+
* while loading
|
|
776
|
+
*/
|
|
777
|
+
debug?: boolean;
|
|
778
|
+
|
|
779
|
+
/**
|
|
780
|
+
* Additional CSS styling for the built-in spinner root DOM node
|
|
781
|
+
*/
|
|
782
|
+
style?: React.CSSProperties;
|
|
783
|
+
|
|
784
|
+
/**
|
|
785
|
+
* Additional CSS class for the outermost dcc.Loading parent div DOM node
|
|
786
|
+
*/
|
|
787
|
+
parent_className?: string;
|
|
788
|
+
|
|
789
|
+
/**
|
|
790
|
+
* Additional CSS styling for the outermost dcc.Loading parent div DOM node
|
|
791
|
+
*/
|
|
792
|
+
parent_style?: React.CSSProperties;
|
|
793
|
+
/**
|
|
794
|
+
* Additional CSS styling for the spinner overlay. This is applied to the
|
|
795
|
+
* dcc.Loading children while the spinner is active. The default is `{'visibility': 'hidden'}`
|
|
796
|
+
*/
|
|
797
|
+
overlay_style?: React.CSSProperties;
|
|
798
|
+
|
|
799
|
+
/**
|
|
800
|
+
* Primary color used for the built-in loading spinners
|
|
801
|
+
*/
|
|
802
|
+
color?: string;
|
|
803
|
+
|
|
804
|
+
/**
|
|
805
|
+
* Setting display to "show" or "hide" will override the loading state coming from dash-renderer
|
|
806
|
+
*/
|
|
807
|
+
display?: 'auto' | 'show' | 'hide';
|
|
808
|
+
|
|
809
|
+
/**
|
|
810
|
+
* Add a time delay (in ms) to the spinner being removed to prevent flickering.
|
|
811
|
+
*/
|
|
812
|
+
delay_hide?: number;
|
|
813
|
+
|
|
814
|
+
/**
|
|
815
|
+
* Add a time delay (in ms) to the spinner being shown after the loading_state
|
|
816
|
+
* is set to True.
|
|
817
|
+
*/
|
|
818
|
+
delay_show?: number;
|
|
819
|
+
|
|
820
|
+
/**
|
|
821
|
+
* Whether the Spinner should show on app start-up before the loading state
|
|
822
|
+
* has been determined. Default True. Use when also setting `delay_show`.
|
|
823
|
+
*/
|
|
824
|
+
show_initially?: boolean;
|
|
825
|
+
|
|
826
|
+
/**
|
|
827
|
+
* Specify component and prop to trigger showing the loading spinner
|
|
828
|
+
* example: `{"output-container": "children", "grid": ["rowData", "columnDefs]}`
|
|
829
|
+
*
|
|
830
|
+
*/
|
|
831
|
+
target_components?: Record<string, string | string[]>;
|
|
832
|
+
|
|
833
|
+
/**
|
|
834
|
+
* Component to use rather than the built-in spinner specified in the `type` prop.
|
|
835
|
+
*
|
|
836
|
+
*/
|
|
837
|
+
custom_spinner?: React.ReactNode;
|
|
499
838
|
}
|
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
UnorderedSearchIndex,
|
|
6
6
|
} from 'js-search';
|
|
7
7
|
import {sanitizeOptions} from './optionTypes';
|
|
8
|
-
import {
|
|
8
|
+
import {DetailedOption, DropdownProps} from '../types';
|
|
9
9
|
|
|
10
10
|
// Custom tokenizer, see https://github.com/bvaughn/js-search/issues/43
|
|
11
11
|
// Split on spaces
|
|
@@ -20,8 +20,8 @@ const TOKENIZER = {
|
|
|
20
20
|
};
|
|
21
21
|
|
|
22
22
|
interface FilteredOptionsResult {
|
|
23
|
-
sanitizedOptions:
|
|
24
|
-
filteredOptions:
|
|
23
|
+
sanitizedOptions: DetailedOption[];
|
|
24
|
+
filteredOptions: DetailedOption[];
|
|
25
25
|
}
|
|
26
26
|
|
|
27
27
|
/**
|
|
@@ -83,7 +83,7 @@ export function createFilteredOptions(
|
|
|
83
83
|
search.addDocuments(sanitized);
|
|
84
84
|
}
|
|
85
85
|
|
|
86
|
-
const filtered = search.search(searchValue) as
|
|
86
|
+
const filtered = search.search(searchValue) as DetailedOption[];
|
|
87
87
|
|
|
88
88
|
return {
|
|
89
89
|
sanitizedOptions: sanitized || [],
|