react-apexcharts 1.7.0 β†’ 1.8.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.
package/LICENSE CHANGED
@@ -1,21 +1,80 @@
1
- The MIT License (MIT)
2
-
3
- Copyright (c) 2018 ApexCharts
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in
13
- all copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
- THE SOFTWARE.
1
+ ## πŸ“„ License Options for ApexCharts
2
+
3
+ ApexCharts is offered under a **dual-license model** to support individuals, startups, and commercial products of all sizes.
4
+
5
+ ---
6
+
7
+ ### πŸ”“ Community License (Free)
8
+
9
+ For individuals, non-profits, educators, and small businesses with **less than $2 million USD in annual revenue**.
10
+
11
+ βœ… What’s allowed:
12
+
13
+ - Personal, educational, or non-profit use
14
+ - Commercial use by small orgs (< $2M annual revenue)
15
+ - Modifications and redistribution (with attribution)
16
+
17
+ 🚫 Not allowed:
18
+
19
+ - Use by companies or entities over $2M/year revenue
20
+ - Use in competing charting products
21
+ - Sublicensing under different terms
22
+
23
+ ➑ By using ApexCharts under this license, you confirm that **you qualify as a Small Organization**.
24
+
25
+ ---
26
+
27
+ ### πŸ’Ό Commercial License (Paid)
28
+
29
+ Required if **you or your affiliated organization earns $2 million USD or more per year**.
30
+
31
+ βœ… What's included:
32
+
33
+ - Use in internal tools and commercial applications
34
+ - Modifications and app-level distribution
35
+ - 12-month subscription with updates & support
36
+
37
+ 🚫 Not allowed:
38
+
39
+ - Redistribution in toolkits, SDKs, or platforms
40
+ - Use by unlicensed developers
41
+ - Competing charting products
42
+
43
+ ---
44
+
45
+ ### πŸ”„ OEM / Redistribution License (Paid)
46
+
47
+ Required if you are **embedding ApexCharts into a product or platform used by other people**, such as:
48
+
49
+ - No-code dashboards
50
+ - Developer platforms
51
+ - Embedded BI tools
52
+ - White-labeled apps or SDKs
53
+
54
+ βœ… What's included:
55
+
56
+ - Redistribution rights for 1 application or product
57
+ - 12-month subscription with updates & support
58
+
59
+ βœ… OEM **not required** if your app simply renders static charts and users **cannot** configure or interact with them.
60
+
61
+ ---
62
+
63
+ ### ⚠️ License Acceptance
64
+
65
+ By installing ApexCharts (e.g., via `npm install apexcharts`), you are agreeing to the applicable license based on your usage:
66
+
67
+ - Community License (if under $2M revenue)
68
+ - Commercial License (if over $2M revenue)
69
+ - OEM License (if redistributing to third-party users)
70
+
71
+ ---
72
+
73
+ ### πŸ›  Need a License or Have Questions?
74
+
75
+ πŸ“§ Contact us at [sales@apexcharts.com](mailto:sales@apexcharts.com)
76
+ πŸ“š Read full license agreements here: [https://apexcharts.com/license](https://apexcharts.com/license)
77
+
78
+ ---
79
+
80
+ Thank you for supporting ApexCharts! Your licensing helps keep it free and open for individuals and small teams.
@@ -1,5 +1,5 @@
1
1
  /// <reference types="react"/>
2
- import { ApexOptions } from "apexcharts";
2
+ import ApexCharts, { ApexOptions } from "apexcharts";
3
3
  import React from "react";
4
4
  /**
5
5
  * Basic type definitions from https://apexcharts.com/docs/react-charts/#props
@@ -27,6 +27,7 @@ declare module "react-apexcharts" {
27
27
  width?: string | number;
28
28
  height?: string | number;
29
29
  options?: ApexOptions;
30
+ chartRef?: React.RefObject<ApexCharts | null>;
30
31
  [key: string]: any;
31
32
  }
32
33
  export default class ReactApexChart extends React.Component<Props> {}
@@ -1 +1 @@
1
- var ReactApexChart=function(e,r,t){"use strict";function n(e,r,t){return(r=function(e){var r=function(e,r){if("object"!=typeof e||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,r||"default");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===r?String:Number)(e)}(e,"string");return"symbol"==typeof r?r:r+""}(r))in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}function o(){return o=Object.assign?Object.assign.bind():function(e){for(var r=1;r<arguments.length;r++){var t=arguments[r];for(var n in t)({}).hasOwnProperty.call(t,n)&&(e[n]=t[n])}return e},o.apply(null,arguments)}function i(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r&&(n=n.filter((function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable}))),t.push.apply(t,n)}return t}function u(e){for(var r=1;r<arguments.length;r++){var t=null!=arguments[r]?arguments[r]:{};r%2?i(Object(t),!0).forEach((function(r){n(e,r,t[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):i(Object(t)).forEach((function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))}))}return e}function c(e){return c="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},c(e)}var f=["type","width","height","series","options"];function s(e,r){var t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:new WeakSet;if(e===r)return!0;if("object"!==c(e)||null===e||"object"!==c(r)||null===r)return!1;if(t.has(e)||t.has(r))return!0;t.add(e),t.add(r);var n=Object.keys(e),o=Object.keys(r);if(n.length!==o.length)return!1;for(var i=0,u=n;i<u.length;i++){var f=u[i];if(!o.includes(f)||!s(e[f],r[f],t))return!1}return!0}function a(t){var i=t.type,p=void 0===i?"line":i,l=t.width,y=void 0===l?"100%":l,b=t.height,h=void 0===b?"auto":b,v=t.series,O=t.options,d=function(e,r){if(null==e)return{};var t,n,o=function(e,r){if(null==e)return{};var t={};for(var n in e)if({}.hasOwnProperty.call(e,n)){if(r.includes(n))continue;t[n]=e[n]}return t}(e,r);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n<i.length;n++)t=i[n],r.includes(t)||{}.propertyIsEnumerable.call(e,t)&&(o[t]=e[t])}return o}(t,f),g=e.useRef(null),j=e.useRef(null),m=e.useRef();e.useEffect((function(){m.current=O;var e=g.current;return j.current=new r(e,E()),j.current.render(),function(){j.current&&"function"==typeof j.current.destroy&&j.current.destroy()}}),[]),e.useEffect((function(){var e=!s(j.current.w.config.series,v),r=!s(m.current,O)||h!==j.current.opts.chart.height||y!==j.current.opts.chart.width;(e||r)&&(e?r?j.current.updateOptions(E()):j.current.updateSeries(v):j.current.updateOptions(E())),m.current=O}),[O,v,h,y]);var w,P,S,E=function(){return k(O,{chart:{type:p,height:h,width:y},series:v})},R=function(e){return e&&"object"===c(e)&&!Array.isArray(e)},k=function(e,r){var t=u({},e);return R(e)&&R(r)&&Object.keys(r).forEach((function(o){R(r[o])&&o in e?t[o]=k(e[o],r[o]):Object.assign(t,n({},o,r[o]))})),t},T=(w=d,P=Object.keys(a.propTypes),S=u({},w),P.forEach((function(e){delete S[e]})),S);return e.createElement("div",o({ref:g},T))}return a.propTypes={type:t.string.isRequired,series:t.array.isRequired,options:t.object.isRequired,width:t.oneOfType([t.string,t.number]),height:t.oneOfType([t.string,t.number])},a}(React,ApexCharts,PropTypes);
1
+ var ReactApexChart=function(e,r,t){"use strict";function n(e,r,t){return(r=function(e){var r=function(e,r){if("object"!=typeof e||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,r||"default");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===r?String:Number)(e)}(e,"string");return"symbol"==typeof r?r:r+""}(r))in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}function o(){return o=Object.assign?Object.assign.bind():function(e){for(var r=1;r<arguments.length;r++){var t=arguments[r];for(var n in t)({}).hasOwnProperty.call(t,n)&&(e[n]=t[n])}return e},o.apply(null,arguments)}function i(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r&&(n=n.filter((function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable}))),t.push.apply(t,n)}return t}function u(e){for(var r=1;r<arguments.length;r++){var t=null!=arguments[r]?arguments[r]:{};r%2?i(Object(t),!0).forEach((function(r){n(e,r,t[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):i(Object(t)).forEach((function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))}))}return e}function c(e){return c="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},c(e)}var f=["type","width","height","series","options","chartRef"];function s(e,r){var t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:new WeakSet;if(e===r)return!0;if("object"!==c(e)||null===e||"object"!==c(r)||null===r)return!1;if(t.has(e)||t.has(r))return!0;t.add(e),t.add(r);var n=Object.keys(e),o=Object.keys(r);if(n.length!==o.length)return!1;for(var i=0,u=n;i<u.length;i++){var f=u[i];if(!o.includes(f)||!s(e[f],r[f],t))return!1}return!0}function a(t){var i=t.type,p=void 0===i?"line":i,l=t.width,y=void 0===l?"100%":l,b=t.height,h=void 0===b?"auto":b,v=t.series,O=t.options,d=t.chartRef,g=function(e,r){if(null==e)return{};var t,n,o=function(e,r){if(null==e)return{};var t={};for(var n in e)if({}.hasOwnProperty.call(e,n)){if(r.includes(n))continue;t[n]=e[n]}return t}(e,r);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n<i.length;n++)t=i[n],r.includes(t)||{}.propertyIsEnumerable.call(e,t)&&(o[t]=e[t])}return o}(t,f),j=e.useRef(null),m=d||e.useRef(null),w=e.useRef();e.useEffect((function(){w.current=O;var e=j.current;return m.current=new r(e,E()),m.current.render(),function(){m.current&&"function"==typeof m.current.destroy&&m.current.destroy()}}),[]),e.useEffect((function(){var e=!s(m.current.w.config.series,v),r=!s(w.current,O)||h!==m.current.opts.chart.height||y!==m.current.opts.chart.width;(e||r)&&(e?r?m.current.updateOptions(E()):m.current.updateSeries(v):m.current.updateOptions(E())),w.current=O}),[O,v,h,y]);var P,S,R,E=function(){return T(O,{chart:{type:p,height:h,width:y},series:v})},k=function(e){return e&&"object"===c(e)&&!Array.isArray(e)},T=function(e,r){var t=u({},e);return k(e)&&k(r)&&Object.keys(r).forEach((function(o){k(r[o])&&o in e?t[o]=T(e[o],r[o]):Object.assign(t,n({},o,r[o]))})),t},A=(P=g,S=Object.keys(a.propTypes),R=u({},P),S.forEach((function(e){delete R[e]})),R);return e.createElement("div",o({ref:j},A))}return a.propTypes={type:t.string.isRequired,series:t.array.isRequired,options:t.object.isRequired,width:t.oneOfType([t.string,t.number]),height:t.oneOfType([t.string,t.number]),chartRef:t.shape({current:t.any})},a}(React,ApexCharts,PropTypes);
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=Charts;var _react=_interopRequireWildcard(require("react")),_apexcharts=_interopRequireDefault(require("apexcharts")),_propTypes=_interopRequireDefault(require("prop-types")),_excluded=["type","width","height","series","options"];function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}function _getRequireWildcardCache(e){var t,r;return"function"!=typeof WeakMap?null:(t=new WeakMap,r=new WeakMap,(_getRequireWildcardCache=function(e){return e?r:t})(e))}function _interopRequireWildcard(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=_typeof(e)&&"function"!=typeof e)return{default:e};t=_getRequireWildcardCache(t);if(t&&t.has(e))return t.get(e);var r,n,o={__proto__:null},i=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(r in e)"default"!==r&&{}.hasOwnProperty.call(e,r)&&((n=i?Object.getOwnPropertyDescriptor(e,r):null)&&(n.get||n.set)?Object.defineProperty(o,r,n):o[r]=e[r]);return o.default=e,t&&t.set(e,o),o}function _extends(){return(_extends=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r,n=arguments[t];for(r in n)!{}.hasOwnProperty.call(n,r)||(e[r]=n[r])}return e}).apply(null,arguments)}function _objectWithoutProperties(e,t){if(null==e)return{};var r,n=_objectWithoutPropertiesLoose(e,t);if(Object.getOwnPropertySymbols)for(var o=Object.getOwnPropertySymbols(e),i=0;i<o.length;i++)r=o[i],t.includes(r)||{}.propertyIsEnumerable.call(e,r)&&(n[r]=e[r]);return n}function _objectWithoutPropertiesLoose(e,t){if(null==e)return{};var r,n={};for(r in e)if({}.hasOwnProperty.call(e,r)){if(t.includes(r))continue;n[r]=e[r]}return n}function _typeof(e){return(_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function ownKeys(t,e){var r,n=Object.keys(t);return Object.getOwnPropertySymbols&&(r=Object.getOwnPropertySymbols(t),e&&(r=r.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),n.push.apply(n,r)),n}function _objectSpread(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?ownKeys(Object(r),!0).forEach(function(e){_defineProperty(t,e,r[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):ownKeys(Object(r)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))})}return t}function _defineProperty(e,t,r){return(t=_toPropertyKey(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function _toPropertyKey(e){e=_toPrimitive(e,"string");return"symbol"==_typeof(e)?e:e+""}function _toPrimitive(e,t){if("object"!=_typeof(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0===r)return("string"===t?String:Number)(e);r=r.call(e,t||"default");if("object"!=_typeof(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}function omit(e,t){var r=_objectSpread({},e);return t.forEach(function(e){delete r[e]}),r}function deepEqual(e,t){var r=2<arguments.length&&void 0!==arguments[2]?arguments[2]:new WeakSet;if(e!==t){if("object"!==_typeof(e)||null===e||"object"!==_typeof(t)||null===t)return!1;if(!r.has(e)&&!r.has(t)){r.add(e),r.add(t);var n=Object.keys(e),o=Object.keys(t);if(n.length!==o.length)return!1;for(var i=0,u=n;i<u.length;i++){var c=u[i];if(!o.includes(c)||!deepEqual(e[c],t[c],r))return!1}}}return!0}function Charts(e){function o(e){return e&&"object"===_typeof(e)&&!Array.isArray(e)}var t=e.type,r=void 0===t?"line":t,t=e.width,n=void 0===t?"100%":t,t=e.height,i=void 0===t?"auto":t,u=e.series,c=e.options,t=_objectWithoutProperties(e,_excluded),p=(0,_react.useRef)(null),a=(0,_react.useRef)(null),f=(0,_react.useRef)(),s=((0,_react.useEffect)(function(){f.current=c;var e=p.current;return a.current=new _apexcharts.default(e,s()),a.current.render(),function(){a.current&&"function"==typeof a.current.destroy&&a.current.destroy()}},[]),(0,_react.useEffect)(function(){var e=!deepEqual(a.current.w.config.series,u),t=!deepEqual(f.current,c)||i!==a.current.opts.chart.height||n!==a.current.opts.chart.width;(e||t)&&(!e||t?a.current.updateOptions(s()):a.current.updateSeries(u)),f.current=c},[c,u,i,n]),function(){return l(c,{chart:{type:r,height:i,width:n},series:u})}),l=function(t,r){var n=_objectSpread({},t);return o(t)&&o(r)&&Object.keys(r).forEach(function(e){o(r[e])&&e in t?n[e]=l(t[e],r[e]):Object.assign(n,_defineProperty({},e,r[e]))}),n},e=omit(t,Object.keys(Charts.propTypes));return _react.default.createElement("div",_extends({ref:p},e))}Charts.propTypes={type:_propTypes.default.string.isRequired,series:_propTypes.default.array.isRequired,options:_propTypes.default.object.isRequired,width:_propTypes.default.oneOfType([_propTypes.default.string,_propTypes.default.number]),height:_propTypes.default.oneOfType([_propTypes.default.string,_propTypes.default.number])};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=Charts;var _react=_interopRequireWildcard(require("react")),_apexcharts=_interopRequireDefault(require("apexcharts")),_propTypes=_interopRequireDefault(require("prop-types")),_excluded=["type","width","height","series","options","chartRef"];function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}function _getRequireWildcardCache(e){var t,r;return"function"!=typeof WeakMap?null:(t=new WeakMap,r=new WeakMap,(_getRequireWildcardCache=function(e){return e?r:t})(e))}function _interopRequireWildcard(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=_typeof(e)&&"function"!=typeof e)return{default:e};t=_getRequireWildcardCache(t);if(t&&t.has(e))return t.get(e);var r,n,o={__proto__:null},i=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(r in e)"default"!==r&&{}.hasOwnProperty.call(e,r)&&((n=i?Object.getOwnPropertyDescriptor(e,r):null)&&(n.get||n.set)?Object.defineProperty(o,r,n):o[r]=e[r]);return o.default=e,t&&t.set(e,o),o}function _extends(){return(_extends=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r,n=arguments[t];for(r in n)!{}.hasOwnProperty.call(n,r)||(e[r]=n[r])}return e}).apply(null,arguments)}function _objectWithoutProperties(e,t){if(null==e)return{};var r,n=_objectWithoutPropertiesLoose(e,t);if(Object.getOwnPropertySymbols)for(var o=Object.getOwnPropertySymbols(e),i=0;i<o.length;i++)r=o[i],t.includes(r)||{}.propertyIsEnumerable.call(e,r)&&(n[r]=e[r]);return n}function _objectWithoutPropertiesLoose(e,t){if(null==e)return{};var r,n={};for(r in e)if({}.hasOwnProperty.call(e,r)){if(t.includes(r))continue;n[r]=e[r]}return n}function _typeof(e){return(_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function ownKeys(t,e){var r,n=Object.keys(t);return Object.getOwnPropertySymbols&&(r=Object.getOwnPropertySymbols(t),e&&(r=r.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),n.push.apply(n,r)),n}function _objectSpread(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?ownKeys(Object(r),!0).forEach(function(e){_defineProperty(t,e,r[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):ownKeys(Object(r)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))})}return t}function _defineProperty(e,t,r){return(t=_toPropertyKey(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function _toPropertyKey(e){e=_toPrimitive(e,"string");return"symbol"==_typeof(e)?e:e+""}function _toPrimitive(e,t){if("object"!=_typeof(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0===r)return("string"===t?String:Number)(e);r=r.call(e,t||"default");if("object"!=_typeof(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}function omit(e,t){var r=_objectSpread({},e);return t.forEach(function(e){delete r[e]}),r}function deepEqual(e,t){var r=2<arguments.length&&void 0!==arguments[2]?arguments[2]:new WeakSet;if(e!==t){if("object"!==_typeof(e)||null===e||"object"!==_typeof(t)||null===t)return!1;if(!r.has(e)&&!r.has(t)){r.add(e),r.add(t);var n=Object.keys(e),o=Object.keys(t);if(n.length!==o.length)return!1;for(var i=0,u=n;i<u.length;i++){var c=u[i];if(!o.includes(c)||!deepEqual(e[c],t[c],r))return!1}}}return!0}function Charts(e){function o(e){return e&&"object"===_typeof(e)&&!Array.isArray(e)}var t=e.type,r=void 0===t?"line":t,t=e.width,n=void 0===t?"100%":t,t=e.height,i=void 0===t?"auto":t,u=e.series,c=e.options,t=e.chartRef,e=_objectWithoutProperties(e,_excluded),p=(0,_react.useRef)(null),a=t||(0,_react.useRef)(null),f=(0,_react.useRef)(),s=((0,_react.useEffect)(function(){f.current=c;var e=p.current;return a.current=new _apexcharts.default(e,s()),a.current.render(),function(){a.current&&"function"==typeof a.current.destroy&&a.current.destroy()}},[]),(0,_react.useEffect)(function(){var e=!deepEqual(a.current.w.config.series,u),t=!deepEqual(f.current,c)||i!==a.current.opts.chart.height||n!==a.current.opts.chart.width;(e||t)&&(!e||t?a.current.updateOptions(s()):a.current.updateSeries(u)),f.current=c},[c,u,i,n]),function(){return l(c,{chart:{type:r,height:i,width:n},series:u})}),l=function(t,r){var n=_objectSpread({},t);return o(t)&&o(r)&&Object.keys(r).forEach(function(e){o(r[e])&&e in t?n[e]=l(t[e],r[e]):Object.assign(n,_defineProperty({},e,r[e]))}),n},t=omit(e,Object.keys(Charts.propTypes));return _react.default.createElement("div",_extends({ref:p},t))}Charts.propTypes={type:_propTypes.default.string.isRequired,series:_propTypes.default.array.isRequired,options:_propTypes.default.object.isRequired,width:_propTypes.default.oneOfType([_propTypes.default.string,_propTypes.default.number]),height:_propTypes.default.oneOfType([_propTypes.default.string,_propTypes.default.number]),chartRef:_propTypes.default.shape({current:_propTypes.default.any})};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-apexcharts",
3
- "version": "1.7.0",
3
+ "version": "1.8.0",
4
4
  "description": "React.js wrapper for ApexCharts",
5
5
  "main": "dist/react-apexcharts.min.js",
6
6
  "types": "types/react-apexcharts.d.ts",
@@ -24,7 +24,7 @@
24
24
  "bugs": {
25
25
  "url": "https://github.com/apexcharts/react-apexcharts/issues"
26
26
  },
27
- "license": "MIT",
27
+ "license": "SEE LICENSE IN LICENSE",
28
28
  "dependencies": {
29
29
  "prop-types": "^15.8.1"
30
30
  },
@@ -1,5 +1,5 @@
1
1
  /// <reference types="react"/>
2
- import { ApexOptions } from "apexcharts";
2
+ import ApexCharts, { ApexOptions } from "apexcharts";
3
3
  import React from "react";
4
4
  /**
5
5
  * Basic type definitions from https://apexcharts.com/docs/react-charts/#props
@@ -27,6 +27,7 @@ declare module "react-apexcharts" {
27
27
  width?: string | number;
28
28
  height?: string | number;
29
29
  options?: ApexOptions;
30
+ chartRef?: React.RefObject<ApexCharts | null>;
30
31
  [key: string]: any;
31
32
  }
32
33
  export default class ReactApexChart extends React.Component<Props> {}