react-animated-dataset
Advanced tools
Comparing version 0.1.0 to 0.2.0
import React from 'react'; | ||
import { select } from 'd3-selection'; | ||
import 'd3-transition'; | ||
import { easeCubic } from 'd3-ease'; | ||
@@ -98,3 +99,5 @@ function _slicedToArray(arr, i) { | ||
_ref$disableAnimation = _ref.disableAnimation, | ||
disableAnimation = _ref$disableAnimation === void 0 ? false : _ref$disableAnimation; | ||
disableAnimation = _ref$disableAnimation === void 0 ? false : _ref$disableAnimation, | ||
_ref$easing = _ref.easing, | ||
easing = _ref$easing === void 0 ? easeCubic : _ref$easing; | ||
var ref = /*#__PURE__*/React.createRef(); | ||
@@ -124,3 +127,3 @@ var refOldAttrs = React.useRef(); | ||
}).call(function (sel) { | ||
var tran = disableAnimation ? sel : sel.transition().delay(delay).duration(duration); | ||
var tran = disableAnimation ? sel : sel.transition().ease(easing).delay(delay).duration(duration); | ||
attrsList.forEach(function (a) { | ||
@@ -132,3 +135,3 @@ tran.attr(a, attrs[a]); | ||
return update.text(attrs.text).call(function (sel) { | ||
var tran = disableAnimation ? sel : sel.transition().delay(delay).duration(duration); | ||
var tran = disableAnimation ? sel : sel.transition().ease(easing).delay(delay).duration(duration); | ||
attrsList.forEach(function (a) { | ||
@@ -140,3 +143,3 @@ tran.attr(a, attrs[a]); | ||
return exit.call(function (sel) { | ||
var tran = disableAnimation ? sel : sel.transition().delay(delay).duration(duration); | ||
var tran = disableAnimation ? sel : sel.transition().ease(easing).delay(delay).duration(duration); | ||
attrsList.forEach(function (a) { | ||
@@ -155,3 +158,3 @@ tran.attr(a, init.hasOwnProperty(a) ? init[a] : attrs[a]).remove(); | ||
} | ||
}, [dataset, unparsedInit, keyFn, ref, tag, unparsedAttrs, duration, disableAnimation, unparsedEvents, delay]); | ||
}, [dataset, unparsedInit, keyFn, ref, tag, unparsedAttrs, duration, disableAnimation, unparsedEvents, delay, easing]); | ||
return /*#__PURE__*/React.createElement('g', { | ||
@@ -158,0 +161,0 @@ ref: ref |
{ | ||
"name": "react-animated-dataset", | ||
"version": "0.1.0", | ||
"version": "0.2.0", | ||
"description": "React component for data animation", | ||
@@ -5,0 +5,0 @@ "main": "build/AnimatedDataset.js", |
@@ -226,9 +226,15 @@ # AnimatedDataset | ||
It also accepts events listener. They can be in kebab-case (`on-mouseover`) or camel case (`onMouseOver`). | ||
<h3 id="events"> | ||
<a href="#events">#</a> events | ||
</h3> | ||
- Type: `{ [key: string]: (mouseEvent: MouseEvent, datum: any) => void }` | ||
Event listeners keys can be written in kebab-case (`on-mouseover`) or camel case (`onMouseOver`). | ||
```jsx | ||
<AnimatedDataset | ||
attrs = {{ | ||
'on-click': datum => console.log(datum), | ||
onMouseOver: (datum, index, nodes) => ... | ||
events={{ | ||
'on-click': (mouseEvent, datum) => console.log(datum), | ||
onMouseOver: (mouseEvent, datum) => ... | ||
}} | ||
@@ -235,0 +241,0 @@ /> |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
14429
142
301