dash-core-components 2.6.1 → 2.7.0

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.
Files changed (84) hide show
  1. package/LICENSE +1 -1
  2. package/dash_core_components/async-datepicker.js +1 -1
  3. package/dash_core_components/async-datepicker.js.map +1 -1
  4. package/dash_core_components/async-dropdown.js +1 -1
  5. package/dash_core_components/async-dropdown.js.map +1 -1
  6. package/dash_core_components/async-graph.js +1 -1
  7. package/dash_core_components/async-graph.js.map +1 -1
  8. package/dash_core_components/async-highlight.js +1 -1
  9. package/dash_core_components/async-highlight.js.map +1 -1
  10. package/dash_core_components/async-markdown.js +1 -1
  11. package/dash_core_components/async-markdown.js.map +1 -1
  12. package/dash_core_components/async-mathjax.js +1 -1
  13. package/dash_core_components/async-plotlyjs.js +1 -1
  14. package/dash_core_components/async-slider.js +2 -1
  15. package/dash_core_components/async-slider.js.map +1 -1
  16. package/dash_core_components/async-upload.js +1 -1
  17. package/dash_core_components/async-upload.js.map +1 -1
  18. package/dash_core_components/dash_core_components-shared.js +1 -1
  19. package/dash_core_components/dash_core_components-shared.js.map +1 -1
  20. package/dash_core_components/dash_core_components.js +1 -1
  21. package/dash_core_components/dash_core_components.js.map +1 -1
  22. package/dash_core_components/plotly.min.js +7 -7
  23. package/lib/components/Checklist.react.js +14 -61
  24. package/lib/components/Clipboard.react.js +12 -82
  25. package/lib/components/ConfirmDialog.react.js +5 -35
  26. package/lib/components/ConfirmDialogProvider.react.js +7 -45
  27. package/lib/components/DatePickerRange.react.js +3 -64
  28. package/lib/components/DatePickerSingle.react.js +3 -58
  29. package/lib/components/Download.react.js +8 -41
  30. package/lib/components/Dropdown.react.js +3 -51
  31. package/lib/components/Graph.react.js +17 -121
  32. package/lib/components/Input.react.js +9 -80
  33. package/lib/components/Interval.react.js +10 -42
  34. package/lib/components/Link.react.js +18 -62
  35. package/lib/components/Loading.react.js +12 -59
  36. package/lib/components/Location.react.js +18 -56
  37. package/lib/components/LogoutButton.react.js +8 -42
  38. package/lib/components/Markdown.react.js +4 -53
  39. package/lib/components/RadioItems.react.js +15 -63
  40. package/lib/components/RangeSlider.react.js +3 -53
  41. package/lib/components/Slider.react.js +3 -50
  42. package/lib/components/Store.react.js +17 -69
  43. package/lib/components/Tab.react.js +1 -23
  44. package/lib/components/Tabs.react.js +26 -92
  45. package/lib/components/Textarea.react.js +9 -70
  46. package/lib/components/Tooltip.react.js +4 -25
  47. package/lib/components/Upload.react.js +3 -50
  48. package/lib/fragments/DatePickerRange.react.js +36 -83
  49. package/lib/fragments/DatePickerSingle.react.js +27 -67
  50. package/lib/fragments/Dropdown.react.js +50 -86
  51. package/lib/fragments/Graph.privateprops.js +0 -3
  52. package/lib/fragments/Graph.react.js +135 -235
  53. package/lib/fragments/Loading/spinners/CircleSpinner.js +5 -14
  54. package/lib/fragments/Loading/spinners/CubeSpinner.js +5 -16
  55. package/lib/fragments/Loading/spinners/DefaultSpinner.js +5 -14
  56. package/lib/fragments/Loading/spinners/DotSpinner.js +5 -14
  57. package/lib/fragments/Loading/spinners/GraphSpinner.js +4 -13
  58. package/lib/fragments/Markdown.react.js +13 -60
  59. package/lib/fragments/Math.react.js +2 -28
  60. package/lib/fragments/RangeSlider.react.js +20 -60
  61. package/lib/fragments/Slider.react.js +20 -60
  62. package/lib/fragments/Upload.react.js +23 -52
  63. package/lib/index.js +0 -28
  64. package/lib/third-party/highlight.js +0 -40
  65. package/lib/utils/DatePickerPersistence.js +0 -5
  66. package/lib/utils/LazyLoader/datePickerRange.js +1 -5
  67. package/lib/utils/LazyLoader/datePickerSingle.js +1 -5
  68. package/lib/utils/LazyLoader/dropdown.js +1 -5
  69. package/lib/utils/LazyLoader/graph.js +1 -5
  70. package/lib/utils/LazyLoader/hljs.js +1 -5
  71. package/lib/utils/LazyLoader/markdown.js +1 -5
  72. package/lib/utils/LazyLoader/mathjax.js +1 -5
  73. package/lib/utils/LazyLoader/plotly.js +1 -5
  74. package/lib/utils/LazyLoader/rangeSlider.js +1 -5
  75. package/lib/utils/LazyLoader/slider.js +1 -5
  76. package/lib/utils/LazyLoader/upload.js +1 -5
  77. package/lib/utils/MarkdownHighlighter.js +0 -6
  78. package/lib/utils/computeSliderMarkers.js +17 -68
  79. package/lib/utils/computeSliderStyle.js +0 -6
  80. package/lib/utils/convertToMoment.js +0 -8
  81. package/lib/utils/mathjax.js +0 -1
  82. package/lib/utils/optionTypes.js +3 -18
  83. package/package.json +18 -18
  84. package/lib/components/css/react-virtualized-select@3.1.0.css +0 -22
@@ -1,40 +1,23 @@
1
1
  "use strict";
2
2
 
3
- function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
4
-
5
3
  Object.defineProperty(exports, "__esModule", {
6
4
  value: true
7
5
  });
8
6
  exports.default = void 0;
9
-
10
7
  var _ramda = require("ramda");
11
-
12
8
  var _react = _interopRequireDefault(require("react"));
13
-
14
9
  var _propTypes = _interopRequireDefault(require("prop-types"));
15
-
16
10
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
17
-
18
11
  function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
19
-
20
12
  function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
21
-
22
13
  function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
23
-
24
- function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
25
-
14
+ function _possibleConstructorReturn(self, call) { if (call && (typeof call === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
26
15
  function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
27
-
28
16
  function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
29
-
30
17
  function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
31
-
32
18
  function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
33
-
34
19
  function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
35
-
36
20
  function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
37
-
38
21
  /**
39
22
  * Abstraction for the memory storage_type to work the same way as local/session
40
23
  *
@@ -43,11 +26,9 @@ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _d
43
26
  var MemStore = /*#__PURE__*/function () {
44
27
  function MemStore() {
45
28
  _classCallCheck(this, MemStore);
46
-
47
29
  this._data = {};
48
30
  this._modified = -1;
49
31
  }
50
-
51
32
  _createClass(MemStore, [{
52
33
  key: "getItem",
53
34
  value: function getItem(key) {
@@ -64,21 +45,22 @@ var MemStore = /*#__PURE__*/function () {
64
45
  value: function removeItem(key) {
65
46
  delete this._data[key];
66
47
  this.setModified(key);
67
- } // noinspection JSUnusedLocalSymbols
48
+ }
68
49
 
50
+ // noinspection JSUnusedLocalSymbols
69
51
  }, {
70
52
  key: "setModified",
71
53
  value: function setModified(_) {
72
54
  this._modified = Date.now();
73
- } // noinspection JSUnusedLocalSymbols
55
+ }
74
56
 
57
+ // noinspection JSUnusedLocalSymbols
75
58
  }, {
76
59
  key: "getModified",
77
60
  value: function getModified(_) {
78
61
  return this._modified;
79
62
  }
80
63
  }]);
81
-
82
64
  return MemStore;
83
65
  }();
84
66
  /**
@@ -86,15 +68,11 @@ var MemStore = /*#__PURE__*/function () {
86
68
  *
87
69
  * Single instances for localStorage, sessionStorage
88
70
  */
89
-
90
-
91
71
  var WebStore = /*#__PURE__*/function () {
92
72
  function WebStore(storage) {
93
73
  _classCallCheck(this, WebStore);
94
-
95
74
  this._storage = storage;
96
75
  }
97
-
98
76
  _createClass(WebStore, [{
99
77
  key: "getItem",
100
78
  value: function getItem(key) {
@@ -110,14 +88,12 @@ var WebStore = /*#__PURE__*/function () {
110
88
  key: "setItem",
111
89
  value: function setItem(key, value) {
112
90
  this._storage.setItem(key, JSON.stringify(value));
113
-
114
91
  this.setModified(key);
115
92
  }
116
93
  }, {
117
94
  key: "removeItem",
118
95
  value: function removeItem(key) {
119
96
  this._storage.removeItem(key);
120
-
121
97
  this._storage.removeItem("".concat(key, "-timestamp"));
122
98
  }
123
99
  }, {
@@ -131,7 +107,6 @@ var WebStore = /*#__PURE__*/function () {
131
107
  return Number.parseInt(this._storage.getItem("".concat(key, "-timestamp")), 10) || -1;
132
108
  }
133
109
  }]);
134
-
135
110
  return WebStore;
136
111
  }();
137
112
  /**
@@ -140,20 +115,13 @@ var WebStore = /*#__PURE__*/function () {
140
115
  * Data can be in memory, localStorage or sessionStorage.
141
116
  * The data will be kept with the id as key.
142
117
  */
143
-
144
-
145
118
  var Store = /*#__PURE__*/function (_React$Component) {
146
119
  _inherits(Store, _React$Component);
147
-
148
120
  var _super = _createSuper(Store);
149
-
150
121
  function Store(props) {
151
122
  var _this;
152
-
153
123
  _classCallCheck(this, Store);
154
-
155
124
  _this = _super.call(this, props);
156
-
157
125
  if (props.storage_type === 'local') {
158
126
  _this._backstore = new WebStore(window.localStorage);
159
127
  } else if (props.storage_type === 'session') {
@@ -161,18 +129,15 @@ var Store = /*#__PURE__*/function (_React$Component) {
161
129
  } else if (props.storage_type === 'memory') {
162
130
  _this._backstore = new MemStore();
163
131
  }
164
-
165
132
  _this.onStorageChange = _this.onStorageChange.bind(_assertThisInitialized(_this));
166
133
  return _this;
167
134
  }
168
-
169
135
  _createClass(Store, [{
170
136
  key: "onStorageChange",
171
137
  value: function onStorageChange(e) {
172
138
  var _this$props = this.props,
173
- id = _this$props.id,
174
- setProps = _this$props.setProps;
175
-
139
+ id = _this$props.id,
140
+ setProps = _this$props.setProps;
176
141
  if (e.key === id && setProps && e.newValue !== e.oldValue) {
177
142
  setProps({
178
143
  data: JSON.parse(e.newValue),
@@ -184,27 +149,22 @@ var Store = /*#__PURE__*/function (_React$Component) {
184
149
  key: "UNSAFE_componentWillMount",
185
150
  value: function UNSAFE_componentWillMount() {
186
151
  var _this$props2 = this.props,
187
- setProps = _this$props2.setProps,
188
- id = _this$props2.id,
189
- data = _this$props2.data,
190
- storage_type = _this$props2.storage_type;
191
-
152
+ setProps = _this$props2.setProps,
153
+ id = _this$props2.id,
154
+ data = _this$props2.data,
155
+ storage_type = _this$props2.storage_type;
192
156
  if (storage_type !== 'memory') {
193
157
  window.addEventListener('storage', this.onStorageChange);
194
158
  }
195
-
196
159
  var old = this._backstore.getItem(id);
197
-
198
160
  if ((0, _ramda.isNil)(old) && !(0, _ramda.isNil)(data)) {
199
161
  // Initial data mount
200
162
  this._backstore.setItem(id, data);
201
-
202
163
  setProps({
203
164
  modified_timestamp: this._backstore.getModified(id)
204
165
  });
205
166
  return;
206
167
  }
207
-
208
168
  if (!(0, _ramda.equals)(old, data)) {
209
169
  setProps({
210
170
  data: old,
@@ -223,14 +183,12 @@ var Store = /*#__PURE__*/function (_React$Component) {
223
183
  key: "componentDidUpdate",
224
184
  value: function componentDidUpdate() {
225
185
  var _this$props3 = this.props,
226
- data = _this$props3.data,
227
- id = _this$props3.id,
228
- clear_data = _this$props3.clear_data,
229
- setProps = _this$props3.setProps;
230
-
186
+ data = _this$props3.data,
187
+ id = _this$props3.id,
188
+ clear_data = _this$props3.clear_data,
189
+ setProps = _this$props3.setProps;
231
190
  if (clear_data) {
232
191
  this._backstore.removeItem(id);
233
-
234
192
  setProps({
235
193
  clear_data: false,
236
194
  data: null,
@@ -238,14 +196,12 @@ var Store = /*#__PURE__*/function (_React$Component) {
238
196
  });
239
197
  return;
240
198
  }
241
-
242
- var old = this._backstore.getItem(id); // Only set the data if it's not the same data.
199
+ var old = this._backstore.getItem(id);
200
+ // Only set the data if it's not the same data.
243
201
  // If the new data is undefined, we got here by overwriting the entire
244
202
  // component with a new copy that has no `data` specified - so pull back
245
203
  // out the old value.
246
204
  // Note: this still allows you to set data to null
247
-
248
-
249
205
  if (!(0, _ramda.equals)(data, old)) {
250
206
  if (data === undefined) {
251
207
  setProps({
@@ -253,7 +209,6 @@ var Store = /*#__PURE__*/function (_React$Component) {
253
209
  });
254
210
  } else {
255
211
  this._backstore.setItem(id, data);
256
-
257
212
  setProps({
258
213
  modified_timestamp: this._backstore.getModified(id)
259
214
  });
@@ -266,10 +221,8 @@ var Store = /*#__PURE__*/function (_React$Component) {
266
221
  return null;
267
222
  }
268
223
  }]);
269
-
270
224
  return Store;
271
225
  }(_react.default.Component);
272
-
273
226
  exports.default = Store;
274
227
  Store.defaultProps = {
275
228
  storage_type: 'memory',
@@ -283,7 +236,6 @@ Store.propTypes = {
283
236
  * components in an app.
284
237
  */
285
238
  id: _propTypes.default.string.isRequired,
286
-
287
239
  /**
288
240
  * The type of the web storage.
289
241
  *
@@ -292,22 +244,18 @@ Store.propTypes = {
292
244
  * session: window.sessionStorage, data is cleared once the browser quit.
293
245
  */
294
246
  storage_type: _propTypes.default.oneOf(['local', 'session', 'memory']),
295
-
296
247
  /**
297
248
  * The stored data for the id.
298
249
  */
299
250
  data: _propTypes.default.oneOfType([_propTypes.default.object, _propTypes.default.array, _propTypes.default.number, _propTypes.default.string, _propTypes.default.bool]),
300
-
301
251
  /**
302
252
  * Set to true to remove the data contained in `data_key`.
303
253
  */
304
254
  clear_data: _propTypes.default.bool,
305
-
306
255
  /**
307
256
  * The last time the storage was modified.
308
257
  */
309
258
  modified_timestamp: _propTypes.default.number,
310
-
311
259
  /**
312
260
  * Dash-assigned callback that gets fired when the value changes.
313
261
  */
@@ -1,22 +1,14 @@
1
1
  "use strict";
2
2
 
3
- function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
4
-
5
3
  Object.defineProperty(exports, "__esModule", {
6
4
  value: true
7
5
  });
8
6
  exports.default = void 0;
9
-
10
7
  var _react = _interopRequireWildcard(require("react"));
11
-
12
8
  var _propTypes = _interopRequireDefault(require("prop-types"));
13
-
14
9
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
15
-
16
10
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
17
-
18
- function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
19
-
11
+ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
20
12
  /**
21
13
  * Part of dcc.Tabs - this is the child Tab component used to render a tabbed page.
22
14
  * Its children will be set as the content of that tab, which if clicked will become visible.
@@ -25,7 +17,6 @@ var Tab = function Tab(_ref) {
25
17
  var children = _ref.children;
26
18
  return /*#__PURE__*/_react.default.createElement(_react.Fragment, null, children);
27
19
  };
28
-
29
20
  Tab.propTypes = {
30
21
  /**
31
22
  * The ID of this component, used to identify dash components
@@ -33,57 +24,46 @@ Tab.propTypes = {
33
24
  * components in an app.
34
25
  */
35
26
  id: _propTypes.default.string,
36
-
37
27
  /**
38
28
  * The tab's label
39
29
  */
40
30
  label: _propTypes.default.string,
41
-
42
31
  /**
43
32
  * The content of the tab - will only be displayed if this tab is selected
44
33
  */
45
34
  children: _propTypes.default.node,
46
-
47
35
  /**
48
36
  * Value for determining which Tab is currently selected
49
37
  */
50
38
  value: _propTypes.default.string,
51
-
52
39
  /**
53
40
  * Determines if tab is disabled or not - defaults to false
54
41
  */
55
42
  disabled: _propTypes.default.bool,
56
-
57
43
  /**
58
44
  * Overrides the default (inline) styles when disabled
59
45
  */
60
46
  disabled_style: _propTypes.default.object,
61
-
62
47
  /**
63
48
  * Appends a class to the Tab component when it is disabled.
64
49
  */
65
50
  disabled_className: _propTypes.default.string,
66
-
67
51
  /**
68
52
  * Appends a class to the Tab component.
69
53
  */
70
54
  className: _propTypes.default.string,
71
-
72
55
  /**
73
56
  * Appends a class to the Tab component when it is selected.
74
57
  */
75
58
  selected_className: _propTypes.default.string,
76
-
77
59
  /**
78
60
  * Overrides the default (inline) styles for the Tab component.
79
61
  */
80
62
  style: _propTypes.default.object,
81
-
82
63
  /**
83
64
  * Overrides the default (inline) styles for the Tab component when it is selected.
84
65
  */
85
66
  selected_style: _propTypes.default.object,
86
-
87
67
  /**
88
68
  * Object that holds the loading state object coming from dash-renderer
89
69
  */
@@ -92,12 +72,10 @@ Tab.propTypes = {
92
72
  * Determines if the component is loading or not
93
73
  */
94
74
  is_loading: _propTypes.default.bool,
95
-
96
75
  /**
97
76
  * Holds which property is loading
98
77
  */
99
78
  prop_name: _propTypes.default.string,
100
-
101
79
  /**
102
80
  * Holds the name of the component that is loading
103
81
  */