+
{children}
@@ -151,7 +152,7 @@ const Loading = ({
);
-};
-
-Loading._dashprivate_isLoadingComponent = true;
+}
Loading.propTypes = {
/**
@@ -227,24 +226,6 @@ Loading.propTypes = {
*/
color: PropTypes.string,
- /**
- * Object that holds the loading state object coming from dash-renderer
- */
- loading_state: PropTypes.shape({
- /**
- * Determines if the component is loading or not
- */
- is_loading: PropTypes.bool,
- /**
- * Holds which property is loading
- */
- prop_name: PropTypes.string,
- /**
- * Holds the name of the component that is loading
- */
- component_name: PropTypes.string,
- }),
-
/**
* Setting display to "show" or "hide" will override the loading state coming from dash-renderer
*/
diff --git a/components/dash-core-components/src/components/Markdown.react.js b/components/dash-core-components/src/components/Markdown.react.js
index 322c9d68b8..a2daa0538d 100644
--- a/components/dash-core-components/src/components/Markdown.react.js
+++ b/components/dash-core-components/src/components/Markdown.react.js
@@ -84,24 +84,6 @@ DashMarkdown.propTypes = {
theme: PropTypes.oneOf(['dark', 'light']),
}),
- /**
- * Object that holds the loading state object coming from dash-renderer
- */
- loading_state: PropTypes.shape({
- /**
- * Determines if the component is loading or not
- */
- is_loading: PropTypes.bool,
- /**
- * Holds which property is loading
- */
- prop_name: PropTypes.string,
- /**
- * Holds the name of the component that is loading
- */
- component_name: PropTypes.string,
- }),
-
/**
* User-defined inline styles for the rendered Markdown
*/
diff --git a/components/dash-core-components/src/components/RadioItems.react.js b/components/dash-core-components/src/components/RadioItems.react.js
index a62e2293ff..f7b263d92d 100644
--- a/components/dash-core-components/src/components/RadioItems.react.js
+++ b/components/dash-core-components/src/components/RadioItems.react.js
@@ -2,6 +2,7 @@ import PropTypes from 'prop-types';
import React, {Component} from 'react';
import './css/react-select@1.0.0-rc.3.min.css';
import {sanitizeOptions} from '../utils/optionTypes';
+import LoadingElement from '../utils/LoadingElement';
/**
* RadioItems is a component that encapsulates several radio item inputs.
@@ -22,7 +23,6 @@ export default class RadioItems extends Component {
labelStyle,
options,
setProps,
- loading_state,
value,
inline,
} = this.props;
@@ -32,14 +32,7 @@ export default class RadioItems extends Component {
ids = {id, key: id};
}
return (
-
+
{sanitizeOptions(options).map(option => (
+
);
}
}
@@ -185,24 +178,6 @@ RadioItems.propTypes = {
*/
setProps: PropTypes.func,
- /**
- * Object that holds the loading state object coming from dash-renderer
- */
- loading_state: PropTypes.shape({
- /**
- * Determines if the component is loading or not
- */
- is_loading: PropTypes.bool,
- /**
- * Holds which property is loading
- */
- prop_name: PropTypes.string,
- /**
- * Holds the name of the component that is loading
- */
- component_name: PropTypes.string,
- }),
-
/**
* Used to allow user interactions in this component to be persisted when
* the component - or the page - is refreshed. If `persisted` is truthy and
diff --git a/components/dash-core-components/src/components/RangeSlider.react.js b/components/dash-core-components/src/components/RangeSlider.react.js
index 93dbf015d6..0fe3341379 100644
--- a/components/dash-core-components/src/components/RangeSlider.react.js
+++ b/components/dash-core-components/src/components/RangeSlider.react.js
@@ -190,24 +190,6 @@ RangeSlider.propTypes = {
*/
setProps: PropTypes.func,
- /**
- * Object that holds the loading state object coming from dash-renderer
- */
- loading_state: PropTypes.shape({
- /**
- * Determines if the component is loading or not
- */
- is_loading: PropTypes.bool,
- /**
- * Holds which property is loading
- */
- prop_name: PropTypes.string,
- /**
- * Holds the name of the component that is loading
- */
- component_name: PropTypes.string,
- }),
-
/**
* Used to allow user interactions in this component to be persisted when
* the component - or the page - is refreshed. If `persisted` is truthy and
diff --git a/components/dash-core-components/src/components/Slider.react.js b/components/dash-core-components/src/components/Slider.react.js
index 7e642591c2..2bdfb8e958 100644
--- a/components/dash-core-components/src/components/Slider.react.js
+++ b/components/dash-core-components/src/components/Slider.react.js
@@ -173,24 +173,6 @@ Slider.propTypes = {
*/
setProps: PropTypes.func,
- /**
- * Object that holds the loading state object coming from dash-renderer
- */
- loading_state: PropTypes.shape({
- /**
- * Determines if the component is loading or not
- */
- is_loading: PropTypes.bool,
- /**
- * Holds which property is loading
- */
- prop_name: PropTypes.string,
- /**
- * Holds the name of the component that is loading
- */
- component_name: PropTypes.string,
- }),
-
/**
* Used to allow user interactions in this component to be persisted when
* the component - or the page - is refreshed. If `persisted` is truthy and
diff --git a/components/dash-core-components/src/components/Tab.react.js b/components/dash-core-components/src/components/Tab.react.js
index 1985b884c7..273ea16286 100644
--- a/components/dash-core-components/src/components/Tab.react.js
+++ b/components/dash-core-components/src/components/Tab.react.js
@@ -74,24 +74,6 @@ Tab.propTypes = {
* Overrides the default (inline) styles for the Tab component when it is selected.
*/
selected_style: PropTypes.object,
-
- /**
- * Object that holds the loading state object coming from dash-renderer
- */
- loading_state: PropTypes.shape({
- /**
- * Determines if the component is loading or not
- */
- is_loading: PropTypes.bool,
- /**
- * Holds which property is loading
- */
- prop_name: PropTypes.string,
- /**
- * Holds the name of the component that is loading
- */
- component_name: PropTypes.string,
- }),
};
export default Tab;
diff --git a/components/dash-core-components/src/components/Tabs.react.js b/components/dash-core-components/src/components/Tabs.react.js
index 0857ed1c12..a365925bdb 100644
--- a/components/dash-core-components/src/components/Tabs.react.js
+++ b/components/dash-core-components/src/components/Tabs.react.js
@@ -6,6 +6,7 @@ import {has, is, isNil} from 'ramda';
// some weird interaction btwn styled-jsx 3.4 and babel
// see https://github.com/vercel/styled-jsx/pull/716
import _JSXStyle from 'styled-jsx/style'; // eslint-disable-line no-unused-vars
+import LoadingElement from '../utils/LoadingElement';
// EnhancedTab is defined here instead of in Tab.react.js because if exported there,
// it will mess up the Python imports and metadata.json
@@ -26,8 +27,13 @@ const EnhancedTab = ({
amountOfTabs,
colors,
vertical,
- loading_state,
+ componentPath,
}) => {
+ const ctx = window.dash_component_api.useDashContext();
+ // We use the raw path here since it's up one level from
+ // the tabs child.
+ const isLoading = ctx.useLoading({rawPath: componentPath});
+
let tabStyle = style;
if (disabled) {
tabStyle = {tabStyle, ...disabled_style};
@@ -52,9 +58,7 @@ const EnhancedTab = ({
}
return (
);
});
@@ -248,12 +251,7 @@ export default class Tabs extends Component {
: 'tab-parent';
return (
-
-
+
);
}
}
@@ -412,24 +410,6 @@ Tabs.propTypes = {
background: PropTypes.string,
}),
- /**
- * Object that holds the loading state object coming from dash-renderer
- */
- loading_state: PropTypes.shape({
- /**
- * Determines if the component is loading or not
- */
- is_loading: PropTypes.bool,
- /**
- * Holds which property is loading
- */
- prop_name: PropTypes.string,
- /**
- * Holds the name of the component that is loading
- */
- component_name: PropTypes.string,
- }),
-
/**
* Used to allow user interactions in this component to be persisted when
* the component - or the page - is refreshed. If `persisted` is truthy and
diff --git a/components/dash-core-components/src/components/Textarea.react.js b/components/dash-core-components/src/components/Textarea.react.js
index 8f155c05f2..2611823f02 100644
--- a/components/dash-core-components/src/components/Textarea.react.js
+++ b/components/dash-core-components/src/components/Textarea.react.js
@@ -1,4 +1,5 @@
-import React, {Component} from 'react';
+/* eslint-disable no-unused-vars */
+import React from 'react';
import PropTypes from 'prop-types';
import {pick} from 'ramda';
@@ -34,42 +35,45 @@ const textAreaProps = [
* A basic HTML textarea for entering multiline text.
*
*/
-export default class Textarea extends Component {
- render() {
- const {setProps, loading_state, value} = this.props;
-
- return (
-