dash-core-components 3.0.3 → 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 (76) 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-slider.js +1 -1
  12. package/dash_core_components/async-slider.js.map +1 -1
  13. package/dash_core_components/async-upload.js +1 -1
  14. package/dash_core_components/async-upload.js.map +1 -1
  15. package/dash_core_components/dash_core_components.js +1 -1
  16. package/dash_core_components/dash_core_components.js.map +1 -1
  17. package/lib/components/Checklist.react.js +46 -63
  18. package/lib/components/Clipboard.react.js +172 -218
  19. package/lib/components/ConfirmDialog.react.js +34 -61
  20. package/lib/components/ConfirmDialogProvider.react.js +21 -44
  21. package/lib/components/DatePickerRange.react.js +7 -26
  22. package/lib/components/DatePickerSingle.react.js +7 -26
  23. package/lib/components/Download.react.js +22 -45
  24. package/lib/components/Dropdown.react.js +7 -26
  25. package/lib/components/Geolocation.react.js +64 -91
  26. package/lib/components/Graph.react.js +70 -97
  27. package/lib/components/Input.react.js +119 -162
  28. package/lib/components/Interval.react.js +55 -86
  29. package/lib/components/Link.react.js +4 -4
  30. package/lib/components/Loading.react.js +31 -35
  31. package/lib/components/Location.react.js +97 -126
  32. package/lib/components/Markdown.react.js +15 -35
  33. package/lib/components/RadioItems.react.js +45 -63
  34. package/lib/components/RangeSlider.react.js +7 -26
  35. package/lib/components/Slider.react.js +7 -26
  36. package/lib/components/Store.react.js +128 -176
  37. package/lib/components/Tab.react.js +1 -1
  38. package/lib/components/Tabs.react.js +97 -126
  39. package/lib/components/Textarea.react.js +4 -4
  40. package/lib/components/Tooltip.react.js +1 -1
  41. package/lib/components/Upload.react.js +7 -26
  42. package/lib/fragments/DatePickerRange.react.js +150 -181
  43. package/lib/fragments/DatePickerSingle.react.js +103 -134
  44. package/lib/fragments/Dropdown.react.js +11 -19
  45. package/lib/fragments/Graph.privateprops.js +3 -9
  46. package/lib/fragments/Graph.react.js +302 -370
  47. package/lib/fragments/Loading/spinners/CircleSpinner.js +2 -4
  48. package/lib/fragments/Loading/spinners/CubeSpinner.js +2 -4
  49. package/lib/fragments/Loading/spinners/DefaultSpinner.js +2 -4
  50. package/lib/fragments/Loading/spinners/DotSpinner.js +2 -4
  51. package/lib/fragments/Loading/spinners/GraphSpinner.js +2 -4
  52. package/lib/fragments/Markdown.react.js +119 -158
  53. package/lib/fragments/Math.react.js +23 -47
  54. package/lib/fragments/RangeSlider.react.js +110 -133
  55. package/lib/fragments/Slider.react.js +110 -133
  56. package/lib/fragments/Upload.react.js +82 -99
  57. package/lib/utils/DatePickerPersistence.js +2 -4
  58. package/lib/utils/LazyLoader/datePickerRange.js +2 -3
  59. package/lib/utils/LazyLoader/datePickerSingle.js +2 -3
  60. package/lib/utils/LazyLoader/dropdown.js +2 -3
  61. package/lib/utils/LazyLoader/graph.js +2 -3
  62. package/lib/utils/LazyLoader/hljs.js +2 -5
  63. package/lib/utils/LazyLoader/markdown.js +2 -3
  64. package/lib/utils/LazyLoader/mathjax.js +2 -5
  65. package/lib/utils/LazyLoader/plotly.js +7 -6
  66. package/lib/utils/LazyLoader/rangeSlider.js +2 -3
  67. package/lib/utils/LazyLoader/slider.js +2 -3
  68. package/lib/utils/LazyLoader/upload.js +2 -3
  69. package/lib/utils/MarkdownHighlighter.js +5 -6
  70. package/lib/utils/ResizeDetector.js +8 -12
  71. package/lib/utils/computeSliderMarkers.js +29 -49
  72. package/lib/utils/computeSliderStyle.js +4 -3
  73. package/lib/utils/convertToMoment.js +5 -6
  74. package/lib/utils/formatSliderTooltip.js +6 -8
  75. package/lib/utils/optionTypes.js +8 -9
  76. package/package.json +1 -1
@@ -11,7 +11,7 @@ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e
11
11
  /**
12
12
  * Spinner created by Tobias Ahlin, https://github.com/tobiasahlin/SpinKit
13
13
  */
14
- var CircleSpinner = function CircleSpinner(_ref) {
14
+ var CircleSpinner = _ref => {
15
15
  var status = _ref.status,
16
16
  color = _ref.color,
17
17
  fullscreen = _ref.fullscreen,
@@ -20,9 +20,7 @@ var CircleSpinner = function CircleSpinner(_ref) {
20
20
  style = _ref.style;
21
21
  var debugTitle;
22
22
  if (debug) {
23
- debugTitle = status.map(function (s) {
24
- return /*#__PURE__*/_react.default.createElement(_DebugTitle.default, s);
25
- });
23
+ debugTitle = status.map(s => /*#__PURE__*/_react.default.createElement(_DebugTitle.default, s));
26
24
  }
27
25
  var spinnerClass = fullscreen ? 'dash-spinner-container' : '';
28
26
  if (className) {
@@ -9,7 +9,7 @@ var _propTypes = _interopRequireDefault(require("prop-types"));
9
9
  var _color = _interopRequireDefault(require("color"));
10
10
  var _DebugTitle = _interopRequireDefault(require("./DebugTitle.jsx"));
11
11
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
12
- var CubeSpinner = function CubeSpinner(_ref) {
12
+ var CubeSpinner = _ref => {
13
13
  var status = _ref.status,
14
14
  color = _ref.color,
15
15
  fullscreen = _ref.fullscreen,
@@ -18,9 +18,7 @@ var CubeSpinner = function CubeSpinner(_ref) {
18
18
  style = _ref.style;
19
19
  var debugTitle;
20
20
  if (debug) {
21
- debugTitle = status.map(function (s) {
22
- return /*#__PURE__*/_react.default.createElement(_DebugTitle.default, s);
23
- });
21
+ debugTitle = status.map(s => /*#__PURE__*/_react.default.createElement(_DebugTitle.default, s));
24
22
  }
25
23
  var spinnerClass = fullscreen ? 'dash-spinner-container' : '';
26
24
  if (className) {
@@ -11,7 +11,7 @@ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e
11
11
  /**
12
12
  * Spinner created by Tobias Ahlin, https://github.com/tobiasahlin/SpinKit
13
13
  */
14
- var DefaultSpinner = function DefaultSpinner(_ref) {
14
+ var DefaultSpinner = _ref => {
15
15
  var status = _ref.status,
16
16
  color = _ref.color,
17
17
  fullscreen = _ref.fullscreen,
@@ -20,9 +20,7 @@ var DefaultSpinner = function DefaultSpinner(_ref) {
20
20
  style = _ref.style;
21
21
  var debugTitle;
22
22
  if (debug) {
23
- debugTitle = status.map(function (s) {
24
- return /*#__PURE__*/_react.default.createElement(_DebugTitle.default, s);
25
- });
23
+ debugTitle = status.map(s => /*#__PURE__*/_react.default.createElement(_DebugTitle.default, s));
26
24
  }
27
25
  var spinnerClass = fullscreen ? 'dash-spinner-container' : '';
28
26
  if (className) {
@@ -11,7 +11,7 @@ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e
11
11
  /**
12
12
  * Spinner created by Tobias Ahlin, https://github.com/tobiasahlin/SpinKit
13
13
  */
14
- var DotSpinner = function DotSpinner(_ref) {
14
+ var DotSpinner = _ref => {
15
15
  var status = _ref.status,
16
16
  color = _ref.color,
17
17
  fullscreen = _ref.fullscreen,
@@ -20,9 +20,7 @@ var DotSpinner = function DotSpinner(_ref) {
20
20
  style = _ref.style;
21
21
  var debugTitle;
22
22
  if (debug) {
23
- debugTitle = status.map(function (s) {
24
- return /*#__PURE__*/_react.default.createElement(_DebugTitle.default, s);
25
- });
23
+ debugTitle = status.map(s => /*#__PURE__*/_react.default.createElement(_DebugTitle.default, s));
26
24
  }
27
25
  var spinnerClass = fullscreen ? 'dash-spinner-container' : '';
28
26
  if (className) {
@@ -8,7 +8,7 @@ var _react = _interopRequireDefault(require("react"));
8
8
  var _propTypes = _interopRequireDefault(require("prop-types"));
9
9
  var _DebugTitle = _interopRequireDefault(require("./DebugTitle.jsx"));
10
10
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
11
- var GraphSpinner = function GraphSpinner(_ref) {
11
+ var GraphSpinner = _ref => {
12
12
  var status = _ref.status,
13
13
  fullscreen = _ref.fullscreen,
14
14
  debug = _ref.debug,
@@ -16,9 +16,7 @@ var GraphSpinner = function GraphSpinner(_ref) {
16
16
  style = _ref.style;
17
17
  var debugTitle;
18
18
  if (debug) {
19
- debugTitle = status.map(function (s) {
20
- return /*#__PURE__*/_react.default.createElement(_DebugTitle.default, s);
21
- });
19
+ debugTitle = status.map(s => /*#__PURE__*/_react.default.createElement(_DebugTitle.default, s));
22
20
  }
23
21
  var spinnerClass = fullscreen ? 'dash-spinner-container' : '';
24
22
  if (className) {
@@ -20,176 +20,137 @@ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e;
20
20
  function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t.return || t.return(); } finally { if (u) throw o; } } }; }
21
21
  function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
22
22
  function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
23
- function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
24
- 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); } }
25
- function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
26
- function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
27
- 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); }
28
- function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
29
- 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); }
30
- function _assertThisInitialized(e) { if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return e; }
31
- function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
32
- function _getPrototypeOf(t) { return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) { return t.__proto__ || Object.getPrototypeOf(t); }, _getPrototypeOf(t); }
33
- 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); }
34
- function _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, e); }
35
- var DashMarkdown = exports.default = /*#__PURE__*/function (_Component) {
36
- function DashMarkdown(props) {
37
- var _this;
38
- _classCallCheck(this, DashMarkdown);
39
- _this = _callSuper(this, DashMarkdown, [props]);
23
+ class DashMarkdown extends _react.Component {
24
+ constructor(props) {
25
+ super(props);
40
26
  if (_MarkdownHighlighter.default.isReady !== true) {
41
- _MarkdownHighlighter.default.isReady.then(function () {
42
- _this.setState({});
27
+ _MarkdownHighlighter.default.isReady.then(() => {
28
+ this.setState({});
43
29
  });
44
30
  }
45
- _this.highlightCode = _this.highlightCode.bind(_this);
46
- _this.dedent = _this.dedent.bind(_this);
47
- return _this;
31
+ this.highlightCode = this.highlightCode.bind(this);
32
+ this.dedent = this.dedent.bind(this);
48
33
  }
49
- _inherits(DashMarkdown, _Component);
50
- return _createClass(DashMarkdown, [{
51
- key: "componentDidMount",
52
- value: function componentDidMount() {
53
- this.highlightCode();
54
- }
55
- }, {
56
- key: "componentDidUpdate",
57
- value: function componentDidUpdate() {
58
- this.highlightCode();
59
- }
60
- }, {
61
- key: "highlightCode",
62
- value: function highlightCode() {
63
- var isHighlighted = function isHighlighted(node) {
64
- // a highlighted node will have <span> children which are what color the text
65
- return node.children.length > 0;
66
- };
67
- if (this.mdContainer) {
68
- var nodes = this.mdContainer.querySelectorAll('pre code');
69
- if (_MarkdownHighlighter.default.hljs) {
70
- for (var i = 0; i < nodes.length; i++) {
71
- if (!isHighlighted(nodes[i])) {
72
- nodes[i].removeAttribute('data-highlighted');
73
- _MarkdownHighlighter.default.hljs.highlightElement(nodes[i]);
74
- }
34
+ componentDidMount() {
35
+ this.highlightCode();
36
+ }
37
+ componentDidUpdate() {
38
+ this.highlightCode();
39
+ }
40
+ highlightCode() {
41
+ var isHighlighted = node => {
42
+ // a highlighted node will have <span> children which are what color the text
43
+ return node.children.length > 0;
44
+ };
45
+ if (this.mdContainer) {
46
+ var nodes = this.mdContainer.querySelectorAll('pre code');
47
+ if (_MarkdownHighlighter.default.hljs) {
48
+ for (var i = 0; i < nodes.length; i++) {
49
+ if (!isHighlighted(nodes[i])) {
50
+ nodes[i].removeAttribute('data-highlighted');
51
+ _MarkdownHighlighter.default.hljs.highlightElement(nodes[i]);
75
52
  }
76
- } else {
77
- _MarkdownHighlighter.default.loadhljs();
78
53
  }
54
+ } else {
55
+ _MarkdownHighlighter.default.loadhljs();
79
56
  }
80
57
  }
81
- }, {
82
- key: "dedent",
83
- value: function dedent(text) {
84
- var lines = text.split(/\r\n|\r|\n/);
85
- var commonPrefix = null;
86
- var _iterator = _createForOfIteratorHelper(lines),
87
- _step;
88
- try {
89
- for (_iterator.s(); !(_step = _iterator.n()).done;) {
90
- var line = _step.value;
91
- var preMatch = line && line.match(/^\s*(?=\S)/);
92
- if (preMatch) {
93
- var prefix = preMatch[0];
94
- if (commonPrefix !== null) {
95
- for (var i = 0; i < commonPrefix.length; i++) {
96
- // Like Python's textwrap.dedent, we'll remove both
97
- // space and tab characters, but only if they match
98
- if (prefix[i] !== commonPrefix[i]) {
99
- commonPrefix = commonPrefix.substr(0, i);
100
- break;
101
- }
58
+ }
59
+ dedent(text) {
60
+ var lines = text.split(/\r\n|\r|\n/);
61
+ var commonPrefix = null;
62
+ var _iterator = _createForOfIteratorHelper(lines),
63
+ _step;
64
+ try {
65
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
66
+ var line = _step.value;
67
+ var preMatch = line && line.match(/^\s*(?=\S)/);
68
+ if (preMatch) {
69
+ var prefix = preMatch[0];
70
+ if (commonPrefix !== null) {
71
+ for (var i = 0; i < commonPrefix.length; i++) {
72
+ // Like Python's textwrap.dedent, we'll remove both
73
+ // space and tab characters, but only if they match
74
+ if (prefix[i] !== commonPrefix[i]) {
75
+ commonPrefix = commonPrefix.substr(0, i);
76
+ break;
102
77
  }
103
- } else {
104
- commonPrefix = prefix;
105
- }
106
- if (!commonPrefix) {
107
- break;
108
78
  }
79
+ } else {
80
+ commonPrefix = prefix;
109
81
  }
110
- }
111
- } catch (err) {
112
- _iterator.e(err);
113
- } finally {
114
- _iterator.f();
115
- }
116
- var commonLen = commonPrefix ? commonPrefix.length : 0;
117
- return lines.map(function (line) {
118
- return line.match(/\S/) ? line.substr(commonLen) : '';
119
- }).join('\n');
120
- }
121
- }, {
122
- key: "render",
123
- value: function render() {
124
- var _this2 = this;
125
- var _this$props = this.props,
126
- id = _this$props.id,
127
- style = _this$props.style,
128
- className = _this$props.className,
129
- highlight_config = _this$props.highlight_config,
130
- dangerously_allow_html = _this$props.dangerously_allow_html,
131
- link_target = _this$props.link_target,
132
- mathjax = _this$props.mathjax,
133
- children = _this$props.children,
134
- dedent = _this$props.dedent;
135
- var textProp = (0, _ramda.type)(children) === 'Array' ? children.join('\n') : children;
136
- var displayText = dedent && textProp ? this.dedent(textProp) : textProp;
137
- var componentTransforms = {
138
- dccLink: function dccLink(props) {
139
- return /*#__PURE__*/_react.default.createElement(_Link.default, props);
140
- },
141
- dccMarkdown: function dccMarkdown(props) {
142
- return /*#__PURE__*/_react.default.createElement(_reactMarkdown.default, (0, _ramda.mergeDeepRight)((0, _ramda.pick)(['dangerously_allow_html', 'dedent'], _this2.props), (0, _ramda.pick)(['children'], props)));
143
- },
144
- dashMathjax: function dashMathjax(props) {
145
- return /*#__PURE__*/_react.default.createElement(_Math.default, {
146
- tex: props.value,
147
- inline: props.inline
148
- });
149
- }
150
- };
151
- var regexMath = function regexMath(value) {
152
- var newValue = value.replace(/(\${1,2})((?:\\.|[^$])+)\1/g, function (m, tag, src) {
153
- var inline = tag.length === 1 || src.indexOf('\n') === -1;
154
- return "<dashMathjax value='".concat(src, "' inline='").concat(inline, "'/>");
155
- });
156
- return newValue;
157
- };
158
- return /*#__PURE__*/_react.default.createElement(_LoadingElement.default, {
159
- id: id,
160
- ref: function ref(node) {
161
- _this2.mdContainer = node;
162
- },
163
- style: style,
164
- className: (highlight_config && highlight_config.theme || className) && "".concat(className ? className : '', " ").concat(highlight_config && highlight_config.theme && highlight_config.theme === 'dark' ? 'hljs-dark' : '')
165
- }, /*#__PURE__*/_react.default.createElement(_reactMarkdown.default, {
166
- source: displayText,
167
- escapeHtml: !dangerously_allow_html,
168
- linkTarget: link_target,
169
- plugins: mathjax ? [_remarkMath.default] : [],
170
- renderers: {
171
- math: function math(props) {
172
- return /*#__PURE__*/_react.default.createElement(_Math.default, {
173
- tex: props.value,
174
- inline: false
175
- });
176
- },
177
- inlineMath: function inlineMath(props) {
178
- return /*#__PURE__*/_react.default.createElement(_Math.default, {
179
- tex: props.value,
180
- inline: true
181
- });
182
- },
183
- html: function html(props) {
184
- return props.escapeHtml ? props.value : /*#__PURE__*/_react.default.createElement(_reactJsxParser.default, {
185
- jsx: mathjax ? regexMath(props.value) : props.value,
186
- components: componentTransforms,
187
- renderInWrapper: false
188
- });
82
+ if (!commonPrefix) {
83
+ break;
189
84
  }
190
85
  }
191
- }));
86
+ }
87
+ } catch (err) {
88
+ _iterator.e(err);
89
+ } finally {
90
+ _iterator.f();
192
91
  }
193
- }]);
194
- }(_react.Component);
92
+ var commonLen = commonPrefix ? commonPrefix.length : 0;
93
+ return lines.map(line => {
94
+ return line.match(/\S/) ? line.substr(commonLen) : '';
95
+ }).join('\n');
96
+ }
97
+ render() {
98
+ var _this$props = this.props,
99
+ id = _this$props.id,
100
+ style = _this$props.style,
101
+ className = _this$props.className,
102
+ highlight_config = _this$props.highlight_config,
103
+ dangerously_allow_html = _this$props.dangerously_allow_html,
104
+ link_target = _this$props.link_target,
105
+ mathjax = _this$props.mathjax,
106
+ children = _this$props.children,
107
+ dedent = _this$props.dedent;
108
+ var textProp = (0, _ramda.type)(children) === 'Array' ? children.join('\n') : children;
109
+ var displayText = dedent && textProp ? this.dedent(textProp) : textProp;
110
+ var componentTransforms = {
111
+ dccLink: props => /*#__PURE__*/_react.default.createElement(_Link.default, props),
112
+ dccMarkdown: props => /*#__PURE__*/_react.default.createElement(_reactMarkdown.default, (0, _ramda.mergeDeepRight)((0, _ramda.pick)(['dangerously_allow_html', 'dedent'], this.props), (0, _ramda.pick)(['children'], props))),
113
+ dashMathjax: props => /*#__PURE__*/_react.default.createElement(_Math.default, {
114
+ tex: props.value,
115
+ inline: props.inline
116
+ })
117
+ };
118
+ var regexMath = value => {
119
+ var newValue = value.replace(/(\${1,2})((?:\\.|[^$])+)\1/g, function (m, tag, src) {
120
+ var inline = tag.length === 1 || src.indexOf('\n') === -1;
121
+ return "<dashMathjax value='".concat(src, "' inline='").concat(inline, "'/>");
122
+ });
123
+ return newValue;
124
+ };
125
+ return /*#__PURE__*/_react.default.createElement(_LoadingElement.default, {
126
+ id: id,
127
+ ref: node => {
128
+ this.mdContainer = node;
129
+ },
130
+ style: style,
131
+ className: (highlight_config && highlight_config.theme || className) && "".concat(className ? className : '', " ").concat(highlight_config && highlight_config.theme && highlight_config.theme === 'dark' ? 'hljs-dark' : '')
132
+ }, /*#__PURE__*/_react.default.createElement(_reactMarkdown.default, {
133
+ source: displayText,
134
+ escapeHtml: !dangerously_allow_html,
135
+ linkTarget: link_target,
136
+ plugins: mathjax ? [_remarkMath.default] : [],
137
+ renderers: {
138
+ math: props => /*#__PURE__*/_react.default.createElement(_Math.default, {
139
+ tex: props.value,
140
+ inline: false
141
+ }),
142
+ inlineMath: props => /*#__PURE__*/_react.default.createElement(_Math.default, {
143
+ tex: props.value,
144
+ inline: true
145
+ }),
146
+ html: props => props.escapeHtml ? props.value : /*#__PURE__*/_react.default.createElement(_reactJsxParser.default, {
147
+ jsx: mathjax ? regexMath(props.value) : props.value,
148
+ components: componentTransforms,
149
+ renderInWrapper: false
150
+ })
151
+ }
152
+ }));
153
+ }
154
+ }
155
+ exports.default = DashMarkdown;
195
156
  DashMarkdown.propTypes = _Markdown.propTypes;
@@ -10,56 +10,32 @@ var _mathjax = _interopRequireDefault(require("../utils/LazyLoader/mathjax"));
10
10
  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); }
11
11
  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; }
12
12
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
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
- var DashMath = exports.default = /*#__PURE__*/function (_Component) {
26
- function DashMath(props) {
27
- var _this;
28
- _classCallCheck(this, DashMath);
29
- _this = _callSuper(this, DashMath, [props]);
30
- _this.span_element = /*#__PURE__*/_react.default.createRef();
31
- return _this;
13
+ class DashMath extends _react.Component {
14
+ constructor(props) {
15
+ super(props);
16
+ this.span_element = /*#__PURE__*/_react.default.createRef();
32
17
  }
33
- _inherits(DashMath, _Component);
34
- return _createClass(DashMath, [{
35
- key: "componentDidMount",
36
- value: function componentDidMount() {
18
+ componentDidMount() {
19
+ this.renderMath();
20
+ }
21
+ componentDidUpdate(prevProps) {
22
+ if (prevProps.tex !== this.props.tex || prevProps.inline !== this.props.inline) {
37
23
  this.renderMath();
38
24
  }
39
- }, {
40
- key: "componentDidUpdate",
41
- value: function componentDidUpdate(prevProps) {
42
- if (prevProps.tex !== this.props.tex || prevProps.inline !== this.props.inline) {
43
- this.renderMath();
44
- }
45
- }
46
- }, {
47
- key: "renderMath",
48
- value: function renderMath() {
49
- var current = this.span_element.current;
50
- (0, _mathjax.default)().then(function () {
51
- window.MathJax.typeset([current]);
52
- });
53
- }
54
- }, {
55
- key: "render",
56
- value: function render() {
57
- return /*#__PURE__*/_react.default.createElement("span", {
58
- ref: this.span_element
59
- }, this.props.inline ? '\\(' : '\\[', this.props.tex, this.props.inline ? '\\)' : '\\]');
60
- }
61
- }]);
62
- }(_react.Component);
25
+ }
26
+ renderMath() {
27
+ var current = this.span_element.current;
28
+ (0, _mathjax.default)().then(function () {
29
+ window.MathJax.typeset([current]);
30
+ });
31
+ }
32
+ render() {
33
+ return /*#__PURE__*/_react.default.createElement("span", {
34
+ ref: this.span_element
35
+ }, this.props.inline ? '\\(' : '\\[', this.props.tex, this.props.inline ? '\\)' : '\\]');
36
+ }
37
+ }
38
+ exports.default = DashMath;
63
39
  DashMath.propTypes = {
64
40
  tex: _propTypes.default.string,
65
41
  inline: _propTypes.default.bool