@@ -7,17 +7,15 @@ import CircleSpinner from '../fragments/Loading/spinners/CircleSpinner.jsx';
7
7
import DotSpinner from '../fragments/Loading/spinners/DotSpinner.jsx' ;
8
8
import { mergeRight } from 'ramda' ;
9
9
10
- const spinnerComponents = {
10
+ const spinnerComponentOptions = {
11
11
graph : GraphSpinner ,
12
12
cube : CubeSpinner ,
13
13
circle : CircleSpinner ,
14
14
dot : DotSpinner ,
15
15
} ;
16
16
17
17
const getSpinner = spinnerType =>
18
- spinnerComponents [ spinnerType ] || DefaultSpinner ;
19
-
20
- const hiddenContainer = { position : 'relative' } ;
18
+ spinnerComponentOptions [ spinnerType ] || DefaultSpinner ;
21
19
22
20
/**
23
21
* A Loading component that wraps any other component and displays a spinner until the wrapped component has rendered.
@@ -30,14 +28,13 @@ const Loading = ({
30
28
style,
31
29
parent_className,
32
30
parent_style,
31
+ overlay_style,
33
32
fullscreen,
34
33
debug,
35
34
show_initially,
36
35
type : spinnerType ,
37
36
delay_hide,
38
37
delay_show,
39
- opacity,
40
- backgroundColor,
41
38
target_components,
42
39
custom_spinner,
43
40
} ) => {
@@ -50,10 +47,16 @@ const Loading = ({
50
47
display : 'flex' ,
51
48
justifyContent : 'center' ,
52
49
alignItems : 'center' ,
53
- backgroundColor : backgroundColor ,
54
- opacity : opacity ,
55
50
} ;
51
+ const hiddenContainer = mergeRight (
52
+ { visibility : 'hidden' , position : 'relative' } ,
53
+ overlay_style
54
+ ) ;
56
55
56
+ /* Overrides default Loading behavior if target_components is set. By default,
57
+ * Loading fires when any recursive child enters loading state. This makes loading
58
+ * opt-in: Loading animation only enabled when one of target components enters loading state.
59
+ */
57
60
const isTarget = ( ) => {
58
61
if ( ! target_components ) {
59
62
return true ;
@@ -144,8 +147,6 @@ Loading.defaultProps = {
144
147
delay_show : 0 ,
145
148
delay_hide : 0 ,
146
149
show_initially : true ,
147
- opacity : 0.5 ,
148
- backgroundColor : 'white' ,
149
150
} ;
150
151
151
152
Loading . propTypes = {
@@ -200,22 +201,16 @@ Loading.propTypes = {
200
201
* Additional CSS styling for the outermost dcc.Loading parent div DOM node
201
202
*/
202
203
parent_style : PropTypes . object ,
203
-
204
204
/**
205
- * Primary color used for the loading spinners
205
+ * Additional CSS styling for the spinner overlay. This is applied to the
206
+ * dcc.Loading children while the spinner is active. The default is {'visibility': 'hidden'}
206
207
*/
207
- color : PropTypes . string ,
208
+ overlay_style : PropTypes . object ,
208
209
209
210
/**
210
- * Opacity of loading Spinner div. Can take a value from 0.0 - 1.0. The lower
211
- * the value, the more transparent:
212
- */
213
- opacity : PropTypes . number ,
214
-
215
- /**
216
- * Background color of the loading Spinner div
211
+ * Primary color used for the loading spinners
217
212
*/
218
- backgroundColor : PropTypes . string ,
213
+ color : PropTypes . string ,
219
214
220
215
/**
221
216
* Object that holds the loading state object coming from dash-renderer
0 commit comments