dash-core-components 3.3.0 → 3.4.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.
@@ -187,21 +187,22 @@ class Clipboard extends _react.default.Component {
187
187
  id = _this$props.id,
188
188
  title = _this$props.title,
189
189
  className = _this$props.className,
190
- style = _this$props.style;
191
- var copyIcon = /*#__PURE__*/_react.default.createElement(_reactFontawesome.FontAwesomeIcon, {
192
- icon: _freeRegularSvgIcons.faCopy
193
- });
194
- var copiedIcon = /*#__PURE__*/_react.default.createElement(_reactFontawesome.FontAwesomeIcon, {
190
+ style = _this$props.style,
191
+ children = _this$props.children,
192
+ copied_children = _this$props.copied_children;
193
+ var isCopied = this.state.copied;
194
+ var button_children = isCopied ? copied_children !== null && copied_children !== void 0 ? copied_children : /*#__PURE__*/_react.default.createElement(_reactFontawesome.FontAwesomeIcon, {
195
195
  icon: _freeRegularSvgIcons.faCheckCircle
196
+ }) : children !== null && children !== void 0 ? children : /*#__PURE__*/_react.default.createElement(_reactFontawesome.FontAwesomeIcon, {
197
+ icon: _freeRegularSvgIcons.faCopy
196
198
  });
197
- var btnIcon = this.state.copied ? copiedIcon : copyIcon;
198
199
  return clipboardAPI ? /*#__PURE__*/_react.default.createElement(_LoadingElement.default, {
199
200
  id: id,
200
201
  title: title,
201
202
  style: style,
202
203
  className: className,
203
204
  onClick: this.onClickHandler
204
- }, /*#__PURE__*/_react.default.createElement("i", null, " ", btnIcon)) : null;
205
+ }, button_children) : null;
205
206
  }
206
207
  }
207
208
  exports.default = Clipboard;
@@ -217,6 +218,14 @@ Clipboard.propTypes = {
217
218
  * The ID used to identify this component.
218
219
  */
219
220
  id: _propTypes.default.string,
221
+ /**
222
+ * Children rendered inside the Clipboard button before copying. By default, a copy icon.
223
+ */
224
+ children: _propTypes.default.node,
225
+ /**
226
+ * Children rendered inside the Clipboard button after the value has been copied. By default, a check icon.
227
+ */
228
+ copied_children: _propTypes.default.node,
220
229
  /**
221
230
  * The id of target component containing text to copy to the clipboard.
222
231
  * The inner text of the `children` prop will be copied to the clipboard. If none, then the text from the
@@ -228,7 +237,7 @@ Clipboard.propTypes = {
228
237
  */
229
238
  content: _propTypes.default.string,
230
239
  /**
231
- * The number of times copy button was clicked
240
+ * The number of times Clipboard button was clicked
232
241
  */
233
242
  n_clicks: _propTypes.default.number,
234
243
  /**
@@ -50,7 +50,7 @@ var Tooltip = _ref => {
50
50
  style: props.style
51
51
  }, is_loading ? /*#__PURE__*/_react.default.createElement("span", null, loading_text) : props.children))), /*#__PURE__*/_react.default.createElement("style", {
52
52
  jsx: true
53
- }, "\n .dcc-tooltip-bounding-box {\n position: absolute;\n top: ".concat((bbox === null || bbox === void 0 ? void 0 : bbox.y0) || 0, "px;\n left: ").concat((bbox === null || bbox === void 0 ? void 0 : bbox.x0) || 0, "px;\n width: ").concat((bbox === null || bbox === void 0 ? void 0 : bbox.x1) - (bbox === null || bbox === void 0 ? void 0 : bbox.x0) || 0, "px;\n height: ").concat((bbox === null || bbox === void 0 ? void 0 : bbox.y1) - (bbox === null || bbox === void 0 ? void 0 : bbox.y0) || 0, "px;\n display: ").concat(show_tooltip ? 'inline-block' : 'none', ";\n pointer-events: ").concat(targetable ? 'auto' : 'none', ";\n }\n .hover {\n position: absolute;\n }\n .hover-right {\n /* Offset so that the triangle caret lands directly on what's hovered */\n transform: translate(5px, 0);\n top: 50%;\n left: 100%;\n }\n .hover-left {\n transform: translate(-5px, 0);\n top: 50%;\n }\n .hover-bottom {\n transform: translate(0, 6px);\n top: 100%;\n left: 50%;\n }\n .hover-top {\n transform: translate(0, -5px);\n left: 50%;\n }\n .hover-content {\n position: absolute;\n border: 1px solid ").concat(border_color, ";\n border-radius: 2px;\n padding: 5px 10px;\n background: ").concat(background_color, ";\n white-space: nowrap;\n z-index: ").concat(zindex, ";\n pointer-events: none;\n }\n .hover .hover-content,\n .hover-right .hover-content {\n transform: translate(0, -50%);\n }\n .hover-left .hover-content {\n transform: translate(-100%, -50%);\n }\n .hover-top .hover-content {\n transform: translate(-50%, -100%);\n }\n .hover-bottom .hover-content {\n transform: translate(-50%, 0);\n }\n /* Add a small triangle on the left side of the box */\n .hover:before,\n .hover:after {\n content: '';\n width: 0;\n height: 0;\n position: absolute;\n border-style: solid;\n top: -6px;\n z-index: ").concat(zindex, ";\n }\n .hover:before,\n .hover:after,\n .hover-right:before,\n .hover-right:after {\n border-width: 6px 6px 6px 0;\n }\n .hover-top:before,\n .hover-top:after {\n border-width: 6px 6px 0 6px;\n }\n .hover-bottom:before,\n .hover-bottom:after {\n border-width: 0 6px 6px 6px;\n }\n .hover-left:before,\n .hover-left:after {\n border-width: 6px 0 6px 6px;\n }\n .hover:before,\n .hover-right:before {\n border-color: transparent ").concat(border_color, " transparent\n transparent;\n left: -5px;\n }\n .hover:after,\n .hover-right:after {\n border-color: transparent ").concat(background_color, " transparent\n transparent;\n left: -4px;\n }\n .hover-left:before {\n border-color: transparent transparent transparent\n ").concat(border_color, ";\n left: -1px;\n }\n .hover-left:after {\n border-color: transparent transparent transparent\n ").concat(background_color, ";\n left: -2px;\n }\n .hover-top:before,\n .hover-top:after,\n .hover-bottom:before,\n .hover-bottom:after {\n left: -6px;\n }\n .hover-bottom:before {\n border-color: transparent transparent ").concat(border_color, "\n transparent;\n }\n .hover-bottom:after {\n border-color: transparent transparent ").concat(background_color, "\n transparent;\n top: -5px;\n }\n .hover-top:before {\n border-color: ").concat(border_color, " transparent transparent\n transparent;\n top: -1px;\n }\n .hover-top:after {\n border-color: ").concat(background_color, " transparent transparent\n transparent;\n top: -2px;\n }\n ")));
53
+ }, "\n .dcc-tooltip-bounding-box {\n position: absolute;\n top: ".concat((bbox === null || bbox === void 0 ? void 0 : bbox.y0) || 0, "px;\n left: ").concat((bbox === null || bbox === void 0 ? void 0 : bbox.x0) || 0, "px;\n width: ").concat((bbox === null || bbox === void 0 ? void 0 : bbox.x1) - (bbox === null || bbox === void 0 ? void 0 : bbox.x0) || 0, "px;\n height: ").concat((bbox === null || bbox === void 0 ? void 0 : bbox.y1) - (bbox === null || bbox === void 0 ? void 0 : bbox.y0) || 0, "px;\n display: ").concat(show_tooltip ? 'inline-block' : 'none', ";\n pointer-events: ").concat(targetable ? 'auto' : 'none', ";\n }\n .hover {\n position: absolute;\n }\n .hover-right {\n /* Offset so that the triangle caret lands directly on what's hovered */\n transform: translate(5px, 0);\n top: 50%;\n left: 100%;\n }\n .hover-left {\n transform: translate(-5px, 0);\n top: 50%;\n }\n .hover-bottom {\n transform: translate(0, 6px);\n top: 100%;\n left: 50%;\n }\n .hover-top {\n transform: translate(0, -5px);\n left: 50%;\n }\n .hover-content {\n position: absolute;\n border: 1px solid ").concat(border_color, ";\n border-radius: 2px;\n padding: 5px 10px;\n background: ").concat(background_color, ";\n white-space: nowrap;\n z-index: ").concat(zindex, ";\n pointer-events: ").concat(targetable ? 'auto' : 'none', ";\n }\n .hover .hover-content,\n .hover-right .hover-content {\n transform: translate(0, -50%);\n }\n .hover-left .hover-content {\n transform: translate(-100%, -50%);\n }\n .hover-top .hover-content {\n transform: translate(-50%, -100%);\n }\n .hover-bottom .hover-content {\n transform: translate(-50%, 0);\n }\n /* Add a small triangle on the left side of the box */\n .hover:before,\n .hover:after {\n content: '';\n width: 0;\n height: 0;\n position: absolute;\n border-style: solid;\n top: -6px;\n z-index: ").concat(zindex, ";\n }\n .hover:before,\n .hover:after,\n .hover-right:before,\n .hover-right:after {\n border-width: 6px 6px 6px 0;\n }\n .hover-top:before,\n .hover-top:after {\n border-width: 6px 6px 0 6px;\n }\n .hover-bottom:before,\n .hover-bottom:after {\n border-width: 0 6px 6px 6px;\n }\n .hover-left:before,\n .hover-left:after {\n border-width: 6px 0 6px 6px;\n }\n .hover:before,\n .hover-right:before {\n border-color: transparent ").concat(border_color, " transparent\n transparent;\n left: -5px;\n }\n .hover:after,\n .hover-right:after {\n border-color: transparent ").concat(background_color, " transparent\n transparent;\n left: -4px;\n }\n .hover-left:before {\n border-color: transparent transparent transparent\n ").concat(border_color, ";\n left: -1px;\n }\n .hover-left:after {\n border-color: transparent transparent transparent\n ").concat(background_color, ";\n left: -2px;\n }\n .hover-top:before,\n .hover-top:after,\n .hover-bottom:before,\n .hover-bottom:after {\n left: -6px;\n }\n .hover-bottom:before {\n border-color: transparent transparent ").concat(border_color, "\n transparent;\n }\n .hover-bottom:after {\n border-color: transparent transparent ").concat(background_color, "\n transparent;\n top: -5px;\n }\n .hover-top:before {\n border-color: ").concat(border_color, " transparent transparent\n transparent;\n top: -1px;\n }\n .hover-top:after {\n border-color: ").concat(background_color, " transparent transparent\n transparent;\n top: -2px;\n }\n ")));
54
54
  };
55
55
  Tooltip.propTypes = {
56
56
  /**
@@ -335,6 +335,8 @@ class PlotlyGraph extends _react.Component {
335
335
  return;
336
336
  }
337
337
  gd.classList.add('dash-graph--pending');
338
+
339
+ // Calling resize enables layout.autosize in plotly.js
338
340
  Plotly.Plots.resize(gd).catch(() => {}).finally(() => gd.classList.remove('dash-graph--pending'));
339
341
  }
340
342
  bindEvents() {
@@ -405,26 +407,6 @@ class PlotlyGraph extends _react.Component {
405
407
  }
406
408
  });
407
409
  }
408
- getStyle() {
409
- var responsive = this.props.responsive;
410
- var style = this.props.style;
411
-
412
- // When there is no forced responsive style, return the original style property
413
- if (!responsive) {
414
- return style;
415
- }
416
-
417
- // Otherwise, if the height is not set, we make the graph size equal to the parent one
418
- if (!style) {
419
- style = {};
420
- }
421
- if (!style.height) {
422
- return Object.assign({
423
- height: '100%'
424
- }, style);
425
- }
426
- return style;
427
- }
428
410
  componentDidMount() {
429
411
  var p = this.plot(this.props);
430
412
  this._queue = this.amendTraces(p, {}, this.props);
@@ -465,34 +447,25 @@ class PlotlyGraph extends _react.Component {
465
447
  var _this$props2 = this.props,
466
448
  className = _this$props2.className,
467
449
  id = _this$props2.id,
468
- loading_state = _this$props2.loading_state;
469
- var style = this.getStyle();
470
- if (window.dash_component_api) {
471
- return /*#__PURE__*/_react.default.createElement(_LoadingElement.default, {
472
- id: id,
473
- key: id,
474
- className: className,
475
- style: style,
476
- ref: this.parentElement
477
- }, /*#__PURE__*/_react.default.createElement(_ResizeDetector.default, {
478
- onResize: this.graphResize,
479
- targets: [this.parentElement, this.gd]
480
- }), /*#__PURE__*/_react.default.createElement("div", {
481
- ref: this.gd,
482
- style: {
483
- height: '100%',
484
- width: '100%'
485
- }
486
- }));
450
+ loading_state = _this$props2.loading_state,
451
+ _this$props2$style = _this$props2.style,
452
+ style = _this$props2$style === void 0 ? {} : _this$props2$style;
453
+ if (this.isResponsive(this.props)) {
454
+ style.height || (style.height = '100%');
487
455
  }
488
- return /*#__PURE__*/_react.default.createElement("div", {
489
- id: id,
456
+ var Container = _LoadingElement.default;
457
+ var containerProps = {
458
+ className,
459
+ id,
490
460
  key: id,
491
- className: className,
492
- style: style,
493
461
  ref: this.parentElement,
494
- "data-dash-is-loading": loading_state && loading_state.is_loading || undefined
495
- }, /*#__PURE__*/_react.default.createElement(_ResizeDetector.default, {
462
+ style
463
+ };
464
+ if (!window.dash_component_api) {
465
+ Container = 'div';
466
+ containerProps['data-dash-is-loading'] = (loading_state === null || loading_state === void 0 ? void 0 : loading_state.is_loading) || undefined;
467
+ }
468
+ return /*#__PURE__*/_react.default.createElement(Container, containerProps, /*#__PURE__*/_react.default.createElement(_ResizeDetector.default, {
496
469
  onResize: this.graphResize,
497
470
  targets: [this.parentElement, this.gd]
498
471
  }), /*#__PURE__*/_react.default.createElement("div", {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dash-core-components",
3
- "version": "3.3.0",
3
+ "version": "3.4.0",
4
4
  "description": "Core component suite for Dash",
5
5
  "repository": {
6
6
  "type": "git",
@@ -63,11 +63,11 @@
63
63
  "uniqid": "^5.4.0"
64
64
  },
65
65
  "devDependencies": {
66
- "@babel/cli": "^7.28.3",
67
- "@babel/core": "^7.28.5",
68
- "@babel/eslint-parser": "^7.28.5",
66
+ "@babel/cli": "^7.28.6",
67
+ "@babel/core": "^7.28.6",
68
+ "@babel/eslint-parser": "^7.28.6",
69
69
  "@babel/plugin-syntax-dynamic-import": "^7.8.3",
70
- "@babel/preset-env": "^7.28.5",
70
+ "@babel/preset-env": "^7.28.6",
71
71
  "@babel/preset-react": "^7.28.5",
72
72
  "@plotly/dash-component-plugins": "^1.2.3",
73
73
  "@plotly/webpack-dash-dynamic-import": "^1.3.0",
@@ -86,7 +86,7 @@
86
86
  "rimraf": "^5.0.5",
87
87
  "style-loader": "^3.3.3",
88
88
  "styled-jsx": "^5.1.7",
89
- "webpack": "^5.102.1",
89
+ "webpack": "^5.104.1",
90
90
  "webpack-cli": "^5.1.4"
91
91
  },
92
92
  "optionalDependencies": {