dash-core-components 3.0.2 → 3.0.4

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 (80) hide show
  1. package/dash_core_components/async-datepicker.js +1 -1
  2. package/dash_core_components/async-datepicker.js.map +1 -1
  3. package/dash_core_components/async-dropdown.js +1 -1
  4. package/dash_core_components/async-dropdown.js.map +1 -1
  5. package/dash_core_components/async-graph.js +1 -1
  6. package/dash_core_components/async-graph.js.map +1 -1
  7. package/dash_core_components/async-highlight.js +1 -1
  8. package/dash_core_components/async-highlight.js.map +1 -1
  9. package/dash_core_components/async-markdown.js +1 -1
  10. package/dash_core_components/async-markdown.js.map +1 -1
  11. package/dash_core_components/async-mathjax.js +1 -1
  12. package/dash_core_components/async-slider.js +1 -1
  13. package/dash_core_components/async-slider.js.map +1 -1
  14. package/dash_core_components/async-upload.js +1 -1
  15. package/dash_core_components/async-upload.js.map +1 -1
  16. package/dash_core_components/dash_core_components-shared.js +1 -1
  17. package/dash_core_components/dash_core_components-shared.js.map +1 -1
  18. package/dash_core_components/dash_core_components.js +1 -1
  19. package/dash_core_components/dash_core_components.js.map +1 -1
  20. package/lib/components/Checklist.react.js +46 -63
  21. package/lib/components/Clipboard.react.js +172 -218
  22. package/lib/components/ConfirmDialog.react.js +34 -61
  23. package/lib/components/ConfirmDialogProvider.react.js +21 -44
  24. package/lib/components/DatePickerRange.react.js +7 -26
  25. package/lib/components/DatePickerSingle.react.js +7 -26
  26. package/lib/components/Download.react.js +22 -45
  27. package/lib/components/Dropdown.react.js +7 -26
  28. package/lib/components/Geolocation.react.js +64 -91
  29. package/lib/components/Graph.react.js +70 -97
  30. package/lib/components/Input.react.js +119 -162
  31. package/lib/components/Interval.react.js +55 -86
  32. package/lib/components/Link.react.js +6 -6
  33. package/lib/components/Loading.react.js +31 -35
  34. package/lib/components/Location.react.js +97 -126
  35. package/lib/components/Markdown.react.js +15 -35
  36. package/lib/components/RadioItems.react.js +45 -63
  37. package/lib/components/RangeSlider.react.js +7 -26
  38. package/lib/components/Slider.react.js +7 -26
  39. package/lib/components/Store.react.js +128 -176
  40. package/lib/components/Tab.react.js +1 -1
  41. package/lib/components/Tabs.react.js +97 -126
  42. package/lib/components/Textarea.react.js +6 -6
  43. package/lib/components/Tooltip.react.js +3 -3
  44. package/lib/components/Upload.react.js +7 -26
  45. package/lib/fragments/DatePickerRange.react.js +150 -181
  46. package/lib/fragments/DatePickerSingle.react.js +103 -134
  47. package/lib/fragments/Dropdown.react.js +11 -19
  48. package/lib/fragments/Graph.privateprops.js +3 -9
  49. package/lib/fragments/Graph.react.js +302 -370
  50. package/lib/fragments/Loading/spinners/CircleSpinner.js +2 -4
  51. package/lib/fragments/Loading/spinners/CubeSpinner.js +2 -4
  52. package/lib/fragments/Loading/spinners/DefaultSpinner.js +2 -4
  53. package/lib/fragments/Loading/spinners/DotSpinner.js +2 -4
  54. package/lib/fragments/Loading/spinners/GraphSpinner.js +2 -4
  55. package/lib/fragments/Markdown.react.js +119 -158
  56. package/lib/fragments/Math.react.js +23 -47
  57. package/lib/fragments/RangeSlider.react.js +110 -133
  58. package/lib/fragments/Slider.react.js +110 -133
  59. package/lib/fragments/Upload.react.js +82 -99
  60. package/lib/utils/DatePickerPersistence.js +2 -4
  61. package/lib/utils/LazyLoader/datePickerRange.js +2 -3
  62. package/lib/utils/LazyLoader/datePickerSingle.js +2 -3
  63. package/lib/utils/LazyLoader/dropdown.js +2 -3
  64. package/lib/utils/LazyLoader/graph.js +2 -3
  65. package/lib/utils/LazyLoader/hljs.js +2 -5
  66. package/lib/utils/LazyLoader/markdown.js +2 -3
  67. package/lib/utils/LazyLoader/mathjax.js +2 -5
  68. package/lib/utils/LazyLoader/plotly.js +7 -6
  69. package/lib/utils/LazyLoader/rangeSlider.js +2 -3
  70. package/lib/utils/LazyLoader/slider.js +2 -3
  71. package/lib/utils/LazyLoader/upload.js +2 -3
  72. package/lib/utils/LoadingElement.js +2 -2
  73. package/lib/utils/MarkdownHighlighter.js +5 -6
  74. package/lib/utils/ResizeDetector.js +8 -12
  75. package/lib/utils/computeSliderMarkers.js +29 -49
  76. package/lib/utils/computeSliderStyle.js +4 -3
  77. package/lib/utils/convertToMoment.js +5 -6
  78. package/lib/utils/formatSliderTooltip.js +6 -8
  79. package/lib/utils/optionTypes.js +8 -9
  80. package/package.json +7 -7
@@ -16,78 +16,60 @@ function _extends() { return _extends = Object.assign ? Object.assign.bind() : f
16
16
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
17
17
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
18
18
  function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
19
- function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
20
- function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } }
21
- function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
22
19
  function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
23
20
  function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
24
- function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
25
- function _possibleConstructorReturn(t, e) { if (e && ("object" == typeof e || "function" == typeof e)) return e; if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined"); return _assertThisInitialized(t); }
26
- function _assertThisInitialized(e) { if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return e; }
27
- function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
28
- function _getPrototypeOf(t) { return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) { return t.__proto__ || Object.getPrototypeOf(t); }, _getPrototypeOf(t); }
29
- function _inherits(t, e) { if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function"); t.prototype = Object.create(e && e.prototype, { constructor: { value: t, writable: !0, configurable: !0 } }), Object.defineProperty(t, "prototype", { writable: !1 }), e && _setPrototypeOf(t, e); }
30
- function _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, e); }
31
21
  /**
32
22
  * RadioItems is a component that encapsulates several radio item inputs.
33
23
  * The values and labels of the RadioItems is specified in the `options`
34
24
  * property and the seleced item is specified with the `value` property.
35
25
  * Each radio item is rendered as an input with a surrounding label.
36
26
  */
37
- var RadioItems = exports.default = /*#__PURE__*/function (_Component) {
38
- function RadioItems() {
39
- _classCallCheck(this, RadioItems);
40
- return _callSuper(this, RadioItems, arguments);
41
- }
42
- _inherits(RadioItems, _Component);
43
- return _createClass(RadioItems, [{
44
- key: "render",
45
- value: function render() {
46
- var _this$props = this.props,
47
- id = _this$props.id,
48
- className = _this$props.className,
49
- style = _this$props.style,
50
- inputClassName = _this$props.inputClassName,
51
- inputStyle = _this$props.inputStyle,
52
- labelClassName = _this$props.labelClassName,
53
- labelStyle = _this$props.labelStyle,
54
- options = _this$props.options,
55
- setProps = _this$props.setProps,
56
- value = _this$props.value,
57
- inline = _this$props.inline;
58
- var ids = {};
59
- if (id) {
60
- ids = {
61
- id,
62
- key: id
63
- };
64
- }
65
- return /*#__PURE__*/_react.default.createElement(_LoadingElement.default, _extends({}, ids, {
66
- className: className,
67
- style: style
68
- }), (0, _optionTypes.sanitizeOptions)(options).map(function (option) {
69
- return /*#__PURE__*/_react.default.createElement("label", {
70
- style: _objectSpread({
71
- display: inline ? 'inline-block' : 'block'
72
- }, labelStyle),
73
- className: labelClassName,
74
- key: option.value
75
- }, /*#__PURE__*/_react.default.createElement("input", {
76
- checked: option.value === value,
77
- className: inputClassName,
78
- disabled: Boolean(option.disabled),
79
- style: inputStyle,
80
- type: "radio",
81
- onChange: function onChange() {
82
- setProps({
83
- value: option.value
84
- });
85
- }
86
- }), option.label);
87
- }));
27
+
28
+ class RadioItems extends _react.Component {
29
+ render() {
30
+ var _this$props = this.props,
31
+ id = _this$props.id,
32
+ className = _this$props.className,
33
+ style = _this$props.style,
34
+ inputClassName = _this$props.inputClassName,
35
+ inputStyle = _this$props.inputStyle,
36
+ labelClassName = _this$props.labelClassName,
37
+ labelStyle = _this$props.labelStyle,
38
+ options = _this$props.options,
39
+ setProps = _this$props.setProps,
40
+ value = _this$props.value,
41
+ inline = _this$props.inline;
42
+ var ids = {};
43
+ if (id) {
44
+ ids = {
45
+ id,
46
+ key: id
47
+ };
88
48
  }
89
- }]);
90
- }(_react.Component);
49
+ return /*#__PURE__*/_react.default.createElement(_LoadingElement.default, _extends({}, ids, {
50
+ className: className,
51
+ style: style
52
+ }), (0, _optionTypes.sanitizeOptions)(options).map(option => /*#__PURE__*/_react.default.createElement("label", {
53
+ style: _objectSpread({
54
+ display: inline ? 'inline-block' : 'block'
55
+ }, labelStyle),
56
+ className: labelClassName,
57
+ key: option.value
58
+ }, /*#__PURE__*/_react.default.createElement("input", {
59
+ checked: option.value === value,
60
+ className: inputClassName,
61
+ disabled: Boolean(option.disabled),
62
+ style: inputStyle,
63
+ type: "radio",
64
+ onChange: () => {
65
+ setProps({
66
+ value: option.value
67
+ });
68
+ }
69
+ }), option.label)));
70
+ }
71
+ }
72
+ exports.default = RadioItems;
91
73
  RadioItems.propTypes = {
92
74
  /**
93
75
  * An array of options, or inline dictionary of options
@@ -10,39 +10,20 @@ var _rangeSlider = _interopRequireDefault(require("../utils/LazyLoader/rangeSlid
10
10
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
11
11
  function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
12
12
  function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
13
- function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
14
- function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } }
15
- function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
16
- function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
17
- function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
18
- function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
19
- function _possibleConstructorReturn(t, e) { if (e && ("object" == typeof e || "function" == typeof e)) return e; if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined"); return _assertThisInitialized(t); }
20
- function _assertThisInitialized(e) { if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return e; }
21
- function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
22
- function _getPrototypeOf(t) { return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) { return t.__proto__ || Object.getPrototypeOf(t); }, _getPrototypeOf(t); }
23
- function _inherits(t, e) { if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function"); t.prototype = Object.create(e && e.prototype, { constructor: { value: t, writable: !0, configurable: !0 } }), Object.defineProperty(t, "prototype", { writable: !1 }), e && _setPrototypeOf(t, e); }
24
- function _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, e); }
25
13
  var RealRangeSlider = /*#__PURE__*/(0, _react.lazy)(_rangeSlider.default);
26
14
 
27
15
  /**
28
16
  * A double slider with two handles.
29
17
  * Used for specifying a range of numerical values.
30
18
  */
31
- var RangeSlider = exports.default = /*#__PURE__*/function (_Component) {
32
- function RangeSlider() {
33
- _classCallCheck(this, RangeSlider);
34
- return _callSuper(this, RangeSlider, arguments);
19
+ class RangeSlider extends _react.Component {
20
+ render() {
21
+ return /*#__PURE__*/_react.default.createElement(_react.Suspense, {
22
+ fallback: null
23
+ }, /*#__PURE__*/_react.default.createElement(RealRangeSlider, this.props));
35
24
  }
36
- _inherits(RangeSlider, _Component);
37
- return _createClass(RangeSlider, [{
38
- key: "render",
39
- value: function render() {
40
- return /*#__PURE__*/_react.default.createElement(_react.Suspense, {
41
- fallback: null
42
- }, /*#__PURE__*/_react.default.createElement(RealRangeSlider, this.props));
43
- }
44
- }]);
45
- }(_react.Component);
25
+ }
26
+ exports.default = RangeSlider;
46
27
  RangeSlider.propTypes = {
47
28
  /**
48
29
  * Minimum allowed value of the slider
@@ -11,38 +11,19 @@ require("./css/sliders.css");
11
11
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
12
12
  function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
13
13
  function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
14
- function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
15
- function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } }
16
- function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
17
- function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
18
- function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
19
- function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
20
- function _possibleConstructorReturn(t, e) { if (e && ("object" == typeof e || "function" == typeof e)) return e; if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined"); return _assertThisInitialized(t); }
21
- function _assertThisInitialized(e) { if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return e; }
22
- function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
23
- function _getPrototypeOf(t) { return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) { return t.__proto__ || Object.getPrototypeOf(t); }, _getPrototypeOf(t); }
24
- function _inherits(t, e) { if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function"); t.prototype = Object.create(e && e.prototype, { constructor: { value: t, writable: !0, configurable: !0 } }), Object.defineProperty(t, "prototype", { writable: !1 }), e && _setPrototypeOf(t, e); }
25
- function _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, e); }
26
14
  var RealSlider = /*#__PURE__*/(0, _react.lazy)(_slider.default);
27
15
 
28
16
  /**
29
17
  * A slider component with a single handle.
30
18
  */
31
- var Slider = exports.default = /*#__PURE__*/function (_Component) {
32
- function Slider() {
33
- _classCallCheck(this, Slider);
34
- return _callSuper(this, Slider, arguments);
19
+ class Slider extends _react.Component {
20
+ render() {
21
+ return /*#__PURE__*/_react.default.createElement(_react.Suspense, {
22
+ fallback: null
23
+ }, /*#__PURE__*/_react.default.createElement(RealSlider, this.props));
35
24
  }
36
- _inherits(Slider, _Component);
37
- return _createClass(Slider, [{
38
- key: "render",
39
- value: function render() {
40
- return /*#__PURE__*/_react.default.createElement(_react.Suspense, {
41
- fallback: null
42
- }, /*#__PURE__*/_react.default.createElement(RealSlider, this.props));
43
- }
44
- }]);
45
- }(_react.Component);
25
+ }
26
+ exports.default = Slider;
46
27
  Slider.propTypes = {
47
28
  /**
48
29
  * Minimum allowed value of the slider
@@ -8,219 +8,171 @@ var _ramda = require("ramda");
8
8
  var _react = _interopRequireDefault(require("react"));
9
9
  var _propTypes = _interopRequireDefault(require("prop-types"));
10
10
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
11
- function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
12
- function _possibleConstructorReturn(t, e) { if (e && ("object" == typeof e || "function" == typeof e)) return e; if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined"); return _assertThisInitialized(t); }
13
- function _assertThisInitialized(e) { if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return e; }
14
- function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
15
- function _getPrototypeOf(t) { return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) { return t.__proto__ || Object.getPrototypeOf(t); }, _getPrototypeOf(t); }
16
- function _inherits(t, e) { if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function"); t.prototype = Object.create(e && e.prototype, { constructor: { value: t, writable: !0, configurable: !0 } }), Object.defineProperty(t, "prototype", { writable: !1 }), e && _setPrototypeOf(t, e); }
17
- function _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, e); }
18
- function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
19
- function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } }
20
- function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
21
- function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
22
- function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
23
11
  /**
24
12
  * Abstraction for the memory storage_type to work the same way as local/session
25
13
  *
26
14
  * Each memory Store component get it's own MemStore.
27
15
  */
28
- var MemStore = /*#__PURE__*/function () {
29
- function MemStore() {
30
- _classCallCheck(this, MemStore);
16
+ class MemStore {
17
+ constructor() {
31
18
  this._data = {};
32
19
  this._modified = -1;
33
20
  }
34
- return _createClass(MemStore, [{
35
- key: "getItem",
36
- value: function getItem(key) {
37
- return this._data[key];
38
- }
39
- }, {
40
- key: "setItem",
41
- value: function setItem(key, value) {
42
- this._data[key] = value;
43
- this.setModified(key);
44
- }
45
- }, {
46
- key: "removeItem",
47
- value: function removeItem(key) {
48
- delete this._data[key];
49
- this.setModified(key);
50
- }
21
+ getItem(key) {
22
+ return this._data[key];
23
+ }
24
+ setItem(key, value) {
25
+ this._data[key] = value;
26
+ this.setModified(key);
27
+ }
28
+ removeItem(key) {
29
+ delete this._data[key];
30
+ this.setModified(key);
31
+ }
51
32
 
52
- // noinspection JSUnusedLocalSymbols
53
- }, {
54
- key: "setModified",
55
- value: function setModified(_) {
56
- this._modified = Date.now();
57
- }
33
+ // noinspection JSUnusedLocalSymbols
34
+ setModified(_) {
35
+ this._modified = Date.now();
36
+ }
37
+
38
+ // noinspection JSUnusedLocalSymbols
39
+ getModified(_) {
40
+ return this._modified;
41
+ }
42
+ }
58
43
 
59
- // noinspection JSUnusedLocalSymbols
60
- }, {
61
- key: "getModified",
62
- value: function getModified(_) {
63
- return this._modified;
64
- }
65
- }]);
66
- }();
67
44
  /**
68
45
  * Abstraction for local/session storage_type.
69
46
  *
70
47
  * Single instances for localStorage, sessionStorage
71
48
  */
72
- var WebStore = /*#__PURE__*/function () {
73
- function WebStore(storage) {
74
- _classCallCheck(this, WebStore);
49
+ class WebStore {
50
+ constructor(storage) {
75
51
  this._storage = storage;
76
52
  }
77
- return _createClass(WebStore, [{
78
- key: "getItem",
79
- value: function getItem(key) {
80
- try {
81
- return JSON.parse(this._storage.getItem(key));
82
- } catch (e) {
83
- // in case we somehow got a non-JSON value in storage,
84
- // just ignore it.
85
- return null;
86
- }
87
- }
88
- }, {
89
- key: "setItem",
90
- value: function setItem(key, value) {
91
- this._storage.setItem(key, JSON.stringify(value));
92
- this.setModified(key);
93
- }
94
- }, {
95
- key: "removeItem",
96
- value: function removeItem(key) {
97
- this._storage.removeItem(key);
98
- this._storage.removeItem("".concat(key, "-timestamp"));
99
- }
100
- }, {
101
- key: "setModified",
102
- value: function setModified(key) {
103
- this._storage.setItem("".concat(key, "-timestamp"), Date.now());
104
- }
105
- }, {
106
- key: "getModified",
107
- value: function getModified(key) {
108
- return Number.parseInt(this._storage.getItem("".concat(key, "-timestamp")), 10) || -1;
53
+ getItem(key) {
54
+ try {
55
+ return JSON.parse(this._storage.getItem(key));
56
+ } catch (e) {
57
+ // in case we somehow got a non-JSON value in storage,
58
+ // just ignore it.
59
+ return null;
109
60
  }
110
- }]);
111
- }();
61
+ }
62
+ setItem(key, value) {
63
+ this._storage.setItem(key, JSON.stringify(value));
64
+ this.setModified(key);
65
+ }
66
+ removeItem(key) {
67
+ this._storage.removeItem(key);
68
+ this._storage.removeItem("".concat(key, "-timestamp"));
69
+ }
70
+ setModified(key) {
71
+ this._storage.setItem("".concat(key, "-timestamp"), Date.now());
72
+ }
73
+ getModified(key) {
74
+ return Number.parseInt(this._storage.getItem("".concat(key, "-timestamp")), 10) || -1;
75
+ }
76
+ }
77
+
112
78
  /**
113
79
  * Easily keep data on the client side with this component.
114
80
  * The data is not inserted in the DOM.
115
81
  * Data can be in memory, localStorage or sessionStorage.
116
82
  * The data will be kept with the id as key.
117
83
  */
118
- var Store = exports.default = /*#__PURE__*/function (_React$Component) {
119
- function Store(props) {
120
- var _this;
121
- _classCallCheck(this, Store);
122
- _this = _callSuper(this, Store, [props]);
84
+ class Store extends _react.default.Component {
85
+ constructor(props) {
86
+ super(props);
123
87
  if (props.storage_type === 'local') {
124
- _this._backstore = new WebStore(window.localStorage);
88
+ this._backstore = new WebStore(window.localStorage);
125
89
  } else if (props.storage_type === 'session') {
126
- _this._backstore = new WebStore(window.sessionStorage);
90
+ this._backstore = new WebStore(window.sessionStorage);
127
91
  } else if (props.storage_type === 'memory') {
128
- _this._backstore = new MemStore();
92
+ this._backstore = new MemStore();
129
93
  }
130
- _this.onStorageChange = _this.onStorageChange.bind(_this);
131
- return _this;
94
+ this.onStorageChange = this.onStorageChange.bind(this);
132
95
  }
133
- _inherits(Store, _React$Component);
134
- return _createClass(Store, [{
135
- key: "onStorageChange",
136
- value: function onStorageChange(e) {
137
- var _this$props = this.props,
138
- id = _this$props.id,
139
- setProps = _this$props.setProps;
140
- if (e.key === id && setProps && e.newValue !== e.oldValue) {
141
- setProps({
142
- data: JSON.parse(e.newValue),
143
- modified_timestamp: this._backstore.getModified(id)
144
- });
145
- }
96
+ onStorageChange(e) {
97
+ var _this$props = this.props,
98
+ id = _this$props.id,
99
+ setProps = _this$props.setProps;
100
+ if (e.key === id && setProps && e.newValue !== e.oldValue) {
101
+ setProps({
102
+ data: JSON.parse(e.newValue),
103
+ modified_timestamp: this._backstore.getModified(id)
104
+ });
146
105
  }
147
- }, {
148
- key: "UNSAFE_componentWillMount",
149
- value: function UNSAFE_componentWillMount() {
150
- var _this$props2 = this.props,
151
- setProps = _this$props2.setProps,
152
- id = _this$props2.id,
153
- data = _this$props2.data,
154
- storage_type = _this$props2.storage_type;
155
- if (storage_type !== 'memory') {
156
- window.addEventListener('storage', this.onStorageChange);
157
- }
158
- var old = this._backstore.getItem(id);
159
- if ((0, _ramda.isNil)(old) && !(0, _ramda.isNil)(data)) {
160
- // Initial data mount
161
- this._backstore.setItem(id, data);
162
- setProps({
163
- modified_timestamp: this._backstore.getModified(id)
164
- });
165
- return;
166
- }
167
- if (!(0, _ramda.equals)(old, data)) {
168
- setProps({
169
- data: old,
170
- modified_timestamp: this._backstore.getModified(id)
171
- });
172
- }
106
+ }
107
+ UNSAFE_componentWillMount() {
108
+ var _this$props2 = this.props,
109
+ setProps = _this$props2.setProps,
110
+ id = _this$props2.id,
111
+ data = _this$props2.data,
112
+ storage_type = _this$props2.storage_type;
113
+ if (storage_type !== 'memory') {
114
+ window.addEventListener('storage', this.onStorageChange);
115
+ }
116
+ var old = this._backstore.getItem(id);
117
+ if ((0, _ramda.isNil)(old) && !(0, _ramda.isNil)(data)) {
118
+ // Initial data mount
119
+ this._backstore.setItem(id, data);
120
+ setProps({
121
+ modified_timestamp: this._backstore.getModified(id)
122
+ });
123
+ return;
124
+ }
125
+ if (!(0, _ramda.equals)(old, data)) {
126
+ setProps({
127
+ data: old,
128
+ modified_timestamp: this._backstore.getModified(id)
129
+ });
173
130
  }
174
- }, {
175
- key: "componentWillUnmount",
176
- value: function componentWillUnmount() {
177
- if (this.props.storage_type !== 'memory') {
178
- window.removeEventListener('storage', this.onStorageChange);
179
- }
131
+ }
132
+ componentWillUnmount() {
133
+ if (this.props.storage_type !== 'memory') {
134
+ window.removeEventListener('storage', this.onStorageChange);
180
135
  }
181
- }, {
182
- key: "componentDidUpdate",
183
- value: function componentDidUpdate() {
184
- var _this$props3 = this.props,
185
- data = _this$props3.data,
186
- id = _this$props3.id,
187
- clear_data = _this$props3.clear_data,
188
- setProps = _this$props3.setProps;
189
- if (clear_data) {
190
- this._backstore.removeItem(id);
136
+ }
137
+ componentDidUpdate() {
138
+ var _this$props3 = this.props,
139
+ data = _this$props3.data,
140
+ id = _this$props3.id,
141
+ clear_data = _this$props3.clear_data,
142
+ setProps = _this$props3.setProps;
143
+ if (clear_data) {
144
+ this._backstore.removeItem(id);
145
+ setProps({
146
+ clear_data: false,
147
+ data: null,
148
+ modified_timestamp: this._backstore.getModified(id)
149
+ });
150
+ return;
151
+ }
152
+ var old = this._backstore.getItem(id);
153
+ // Only set the data if it's not the same data.
154
+ // If the new data is undefined, we got here by overwriting the entire
155
+ // component with a new copy that has no `data` specified - so pull back
156
+ // out the old value.
157
+ // Note: this still allows you to set data to null
158
+ if (!(0, _ramda.equals)(data, old)) {
159
+ if (data === undefined) {
160
+ setProps({
161
+ data: old
162
+ });
163
+ } else {
164
+ this._backstore.setItem(id, data);
191
165
  setProps({
192
- clear_data: false,
193
- data: null,
194
166
  modified_timestamp: this._backstore.getModified(id)
195
167
  });
196
- return;
197
- }
198
- var old = this._backstore.getItem(id);
199
- // Only set the data if it's not the same data.
200
- // If the new data is undefined, we got here by overwriting the entire
201
- // component with a new copy that has no `data` specified - so pull back
202
- // out the old value.
203
- // Note: this still allows you to set data to null
204
- if (!(0, _ramda.equals)(data, old)) {
205
- if (data === undefined) {
206
- setProps({
207
- data: old
208
- });
209
- } else {
210
- this._backstore.setItem(id, data);
211
- setProps({
212
- modified_timestamp: this._backstore.getModified(id)
213
- });
214
- }
215
168
  }
216
169
  }
217
- }, {
218
- key: "render",
219
- value: function render() {
220
- return null;
221
- }
222
- }]);
223
- }(_react.default.Component);
170
+ }
171
+ render() {
172
+ return null;
173
+ }
174
+ }
175
+ exports.default = Store;
224
176
  Store.defaultProps = {
225
177
  storage_type: 'memory',
226
178
  clear_data: false,
@@ -15,7 +15,7 @@ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e;
15
15
  */
16
16
 
17
17
  /* eslint-disable no-unused-vars */
18
- var Tab = function Tab(_ref) {
18
+ var Tab = _ref => {
19
19
  var children = _ref.children,
20
20
  _ref$disabled = _ref.disabled,
21
21
  disabled = _ref$disabled === void 0 ? false : _ref$disabled,