react-apexcharts 2.0.1 → 2.1.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/README.md CHANGED
@@ -192,6 +192,52 @@ this.setState({
192
192
  ```
193
193
 
194
194
 
195
+ ### Tree-Shaking (Smaller Bundles)
196
+
197
+ **New in v2.1.0**: Use the `/core` export to reduce your bundle size by only importing the chart types and features you actually use. This requires `apexcharts >=5.10.1`.
198
+
199
+ ```js
200
+ // Instead of:
201
+ import Chart from 'react-apexcharts'
202
+
203
+ // Use the core variant:
204
+ import Chart from 'react-apexcharts/core'
205
+
206
+ // Then manually register only what you need:
207
+ import 'apexcharts/bar' // bar / column chart type
208
+ import 'apexcharts/line' // line / area / scatter chart type
209
+ import 'apexcharts/features/legend' // legend feature
210
+ import 'apexcharts/features/annotations' // annotations feature
211
+ // ... etc.
212
+ ```
213
+
214
+ Full example:
215
+
216
+ ```jsx
217
+ import Chart from 'react-apexcharts/core'
218
+ import 'apexcharts/bar'
219
+ import 'apexcharts/features/legend'
220
+
221
+ export default function BarChart() {
222
+ const series = [{ name: 'Sales', data: [30, 40, 35, 50, 49, 60, 70, 91, 125] }]
223
+ const options = {
224
+ chart: { id: 'bar-chart' },
225
+ xaxis: { categories: [1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999] }
226
+ }
227
+
228
+ return <Chart type="bar" series={series} options={options} width={500} height={320} />
229
+ }
230
+ ```
231
+
232
+ The core variant also has SSR and hydration counterparts:
233
+
234
+ ```js
235
+ import Chart from 'react-apexcharts/core/server' // Server Component (async)
236
+ import Hydrate from 'react-apexcharts/core/hydrate' // Client hydration
237
+ ```
238
+
239
+ > **Note for Vite users:** Add `resolve: { dedupe: ['apexcharts'] }` to your `vite.config.js` to prevent Vite from loading two separate ApexCharts instances when mixing imports.
240
+
195
241
  ## Props
196
242
 
197
243
 
@@ -202,6 +248,7 @@ this.setState({
202
248
  | **width** | `Number or String` | Possible values for width can be `100%`, `400px` or `400` (by default is `100%`) |
203
249
  | **height** | `Number or String` | Possible values for height can be `100%`, `300px` or `300` (by default is `auto`) |
204
250
  | **options** | `Object` | The configuration object, see options on [API (Reference)](https://apexcharts.com/docs/options/chart/type/) |
251
+ | **chartRef** | `React.RefObject` | Pass a ref to get access to the underlying ApexCharts instance for imperative API calls |
205
252
 
206
253
  ## How to call methods of ApexCharts programmatically?
207
254
  Sometimes, you may want to call other methods of the core ApexCharts library, and you can do so on `ApexCharts` global variable directly
@@ -218,22 +265,28 @@ All other methods of ApexCharts can be called this way
218
265
 
219
266
  ## What's included
220
267
 
221
- The repository includes the following files and directories.
268
+ The published package includes the following files.
222
269
 
223
270
  ```
224
271
  react-apexcharts/
225
272
  ├── dist/
226
- │ ├── react-apexcharts.cjs.js
227
- │ ├── react-apexcharts.esm.js
228
- │ ├── react-apexcharts.iife.min.js
229
- └── react-apexchart.min.js (backward compat)
230
- └── example/
231
- │ ├── src/
232
- │ ├── public/
233
- │ ├── package.json
234
- └── README.md
235
- └── src/
236
- └── react-apexcharts.jsx
273
+ │ ├── react-apexcharts.cjs.js # CommonJS (default import)
274
+ │ ├── react-apexcharts.esm.js # ES Module (default import)
275
+ │ ├── react-apexcharts.iife.min.js # IIFE for browser <script> tags
276
+ ├── react-apexcharts.min.js # CommonJS (backward compat alias)
277
+ │ ├── react-apexcharts-server.esm.js # react-apexcharts/server
278
+ │ ├── react-apexcharts-hydrate.esm.js # react-apexcharts/hydrate
279
+ │ ├── react-apexcharts-core.cjs.js # react-apexcharts/core (CJS)
280
+ │ ├── react-apexcharts-core.esm.js # react-apexcharts/core (ESM)
281
+ ├── react-apexcharts-core-server.esm.js # react-apexcharts/core/server
282
+ └── react-apexcharts-core-hydrate.esm.js # react-apexcharts/core/hydrate
283
+ └── types/
284
+ ├── react-apexcharts.d.ts
285
+ ├── react-apexcharts-server.d.ts
286
+ ├── react-apexcharts-hydrate.d.ts
287
+ ├── react-apexcharts-core.d.ts
288
+ ├── react-apexcharts-core-server.d.ts
289
+ └── react-apexcharts-core-hydrate.d.ts
237
290
  ```
238
291
 
239
292
  ## Development
@@ -0,0 +1,2 @@
1
+ "use client";
2
+ import r,{useRef as e,useEffect as t}from"react";import n from"apexcharts/core";import o from"prop-types";function c(r,e,t){return(e=function(r){var e=function(r,e){if("object"!=typeof r||!r)return r;var t=r[Symbol.toPrimitive];if(void 0!==t){var n=t.call(r,e||"default");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(r)}(r,"string");return"symbol"==typeof e?e:e+""}(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function i(){return i=Object.assign?Object.assign.bind():function(r){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var n in t)({}).hasOwnProperty.call(t,n)&&(r[n]=t[n])}return r},i.apply(null,arguments)}function a(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable}))),t.push.apply(t,n)}return t}function u(r){for(var e=1;e<arguments.length;e++){var t=null!=arguments[e]?arguments[e]:{};e%2?a(Object(t),!0).forEach((function(e){c(r,e,t[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):a(Object(t)).forEach((function(e){Object.defineProperty(r,e,Object.getOwnPropertyDescriptor(t,e))}))}return r}var l=["clientOptions","className"];var f=["clientOptions","className"];function s(o){var c=o.clientOptions,a=void 0===c?{}:c,s=o.className,p=void 0===s?"":s,b=function(r,e){if(null==r)return{};var t,n,o=function(r,e){if(null==r)return{};var t={};for(var n in r)if({}.hasOwnProperty.call(r,n)){if(e.includes(n))continue;t[n]=r[n]}return t}(r,e);if(Object.getOwnPropertySymbols){var c=Object.getOwnPropertySymbols(r);for(n=0;n<c.length;n++)t=c[n],e.includes(t)||{}.propertyIsEnumerable.call(r,t)&&(o[t]=r[t])}return o}(o,l),y=e(null),O=e(null);t((function(){if(y.current&&!O.current)try{var r={chart:{animations:{enabled:!0}}},e=u(u(u({},r),a),{},{chart:u(u({},r.chart),a.chart||{})});O.current=n.hydrate(y.current,e)}catch(r){console.error("Failed to hydrate ApexChart:",r)}return function(){O.current&&(O.current.destroy(),O.current=null)}}),[a]);var v,m,h=(v=f,m=u({},b),v.forEach((function(r){delete m[r]})),m);return r.createElement("div",i({ref:y,className:p},h))}s.propTypes={clientOptions:o.object,className:o.string};export{s as default};
@@ -0,0 +1 @@
1
+ import t from"react";import r from"apexcharts/core";import e from"prop-types";function n(t,r,e,n,o,i,a){try{var c=t[i](a),u=c.value}catch(t){return void e(t)}c.done?r(u):Promise.resolve(u).then(n,o)}function o(t,r,e){return(r=function(t){var r=function(t,r){if("object"!=typeof t||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,r||"default");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===r?String:Number)(t)}(t,"string");return"symbol"==typeof r?r:r+""}(r))in t?Object.defineProperty(t,r,{value:e,enumerable:!0,configurable:!0,writable:!0}):t[r]=e,t}function i(){return i=Object.assign?Object.assign.bind():function(t){for(var r=1;r<arguments.length;r++){var e=arguments[r];for(var n in e)({}).hasOwnProperty.call(e,n)&&(t[n]=e[n])}return t},i.apply(null,arguments)}function a(t,r){var e=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);r&&(n=n.filter((function(r){return Object.getOwnPropertyDescriptor(t,r).enumerable}))),e.push.apply(e,n)}return e}function c(t,r){if(null==t)return{};var e,n,o=function(t,r){if(null==t)return{};var e={};for(var n in t)if({}.hasOwnProperty.call(t,n)){if(r.includes(n))continue;e[n]=t[n]}return e}(t,r);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(n=0;n<i.length;n++)e=i[n],r.includes(e)||{}.propertyIsEnumerable.call(t,e)&&(o[e]=t[e])}return o}function u(){u=function(){return r};var t,r={},e=Object.prototype,n=e.hasOwnProperty,o=Object.defineProperty||function(t,r,e){t[r]=e.value},i="function"==typeof Symbol?Symbol:{},a=i.iterator||"@@iterator",c=i.asyncIterator||"@@asyncIterator",f=i.toStringTag||"@@toStringTag";function l(t,r,e){return Object.defineProperty(t,r,{value:e,enumerable:!0,configurable:!0,writable:!0}),t[r]}try{l({},"")}catch(t){l=function(t,r,e){return t[r]=e}}function s(t,r,e,n){var i=r&&r.prototype instanceof m?r:m,a=Object.create(i.prototype),c=new k(n||[]);return o(a,"_invoke",{value:S(t,e,c)}),a}function h(t,r,e){try{return{type:"normal",arg:t.call(r,e)}}catch(t){return{type:"throw",arg:t}}}r.wrap=s;var p="suspendedStart",y="suspendedYield",v="executing",d="completed",g={};function m(){}function b(){}function w(){}var O={};l(O,a,(function(){return this}));var j=Object.getPrototypeOf,E=j&&j(j(G([])));E&&E!==e&&n.call(E,a)&&(O=E);var x=w.prototype=m.prototype=Object.create(O);function L(t){["next","throw","return"].forEach((function(r){l(t,r,(function(t){return this._invoke(r,t)}))}))}function P(t,r){function e(o,i,a,c){var u=h(t[o],t,i);if("throw"!==u.type){var f=u.arg,l=f.value;return l&&"object"==typeof l&&n.call(l,"__await")?r.resolve(l.__await).then((function(t){e("next",t,a,c)}),(function(t){e("throw",t,a,c)})):r.resolve(l).then((function(t){f.value=t,a(f)}),(function(t){return e("throw",t,a,c)}))}c(u.arg)}var i;o(this,"_invoke",{value:function(t,n){function o(){return new r((function(r,o){e(t,n,r,o)}))}return i=i?i.then(o,o):o()}})}function S(r,e,n){var o=p;return function(i,a){if(o===v)throw Error("Generator is already running");if(o===d){if("throw"===i)throw a;return{value:t,done:!0}}for(n.method=i,n.arg=a;;){var c=n.delegate;if(c){var u=_(c,n);if(u){if(u===g)continue;return u}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(o===p)throw o=d,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);o=v;var f=h(r,e,n);if("normal"===f.type){if(o=n.done?d:y,f.arg===g)continue;return{value:f.arg,done:n.done}}"throw"===f.type&&(o=d,n.method="throw",n.arg=f.arg)}}}function _(r,e){var n=e.method,o=r.iterator[n];if(o===t)return e.delegate=null,"throw"===n&&r.iterator.return&&(e.method="return",e.arg=t,_(r,e),"throw"===e.method)||"return"!==n&&(e.method="throw",e.arg=new TypeError("The iterator does not provide a '"+n+"' method")),g;var i=h(o,r.iterator,e.arg);if("throw"===i.type)return e.method="throw",e.arg=i.arg,e.delegate=null,g;var a=i.arg;return a?a.done?(e[r.resultName]=a.value,e.next=r.nextLoc,"return"!==e.method&&(e.method="next",e.arg=t),e.delegate=null,g):a:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,g)}function N(t){var r={tryLoc:t[0]};1 in t&&(r.catchLoc=t[1]),2 in t&&(r.finallyLoc=t[2],r.afterLoc=t[3]),this.tryEntries.push(r)}function T(t){var r=t.completion||{};r.type="normal",delete r.arg,t.completion=r}function k(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(N,this),this.reset(!0)}function G(r){if(r||""===r){var e=r[a];if(e)return e.call(r);if("function"==typeof r.next)return r;if(!isNaN(r.length)){var o=-1,i=function e(){for(;++o<r.length;)if(n.call(r,o))return e.value=r[o],e.done=!1,e;return e.value=t,e.done=!0,e};return i.next=i}}throw new TypeError(typeof r+" is not iterable")}return b.prototype=w,o(x,"constructor",{value:w,configurable:!0}),o(w,"constructor",{value:b,configurable:!0}),b.displayName=l(w,f,"GeneratorFunction"),r.isGeneratorFunction=function(t){var r="function"==typeof t&&t.constructor;return!!r&&(r===b||"GeneratorFunction"===(r.displayName||r.name))},r.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,w):(t.__proto__=w,l(t,f,"GeneratorFunction")),t.prototype=Object.create(x),t},r.awrap=function(t){return{__await:t}},L(P.prototype),l(P.prototype,c,(function(){return this})),r.AsyncIterator=P,r.async=function(t,e,n,o,i){void 0===i&&(i=Promise);var a=new P(s(t,e,n,o),i);return r.isGeneratorFunction(e)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},L(x),l(x,f,"Generator"),l(x,a,(function(){return this})),l(x,"toString",(function(){return"[object Generator]"})),r.keys=function(t){var r=Object(t),e=[];for(var n in r)e.push(n);return e.reverse(),function t(){for(;e.length;){var n=e.pop();if(n in r)return t.value=n,t.done=!1,t}return t.done=!0,t}},r.values=G,k.prototype={constructor:k,reset:function(r){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(T),!r)for(var e in this)"t"===e.charAt(0)&&n.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=t)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(r){if(this.done)throw r;var e=this;function o(n,o){return c.type="throw",c.arg=r,e.next=n,o&&(e.method="next",e.arg=t),!!o}for(var i=this.tryEntries.length-1;i>=0;--i){var a=this.tryEntries[i],c=a.completion;if("root"===a.tryLoc)return o("end");if(a.tryLoc<=this.prev){var u=n.call(a,"catchLoc"),f=n.call(a,"finallyLoc");if(u&&f){if(this.prev<a.catchLoc)return o(a.catchLoc,!0);if(this.prev<a.finallyLoc)return o(a.finallyLoc)}else if(u){if(this.prev<a.catchLoc)return o(a.catchLoc,!0)}else{if(!f)throw Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return o(a.finallyLoc)}}}},abrupt:function(t,r){for(var e=this.tryEntries.length-1;e>=0;--e){var o=this.tryEntries[e];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=r&&r<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=r,i?(this.method="next",this.next=i.finallyLoc,g):this.complete(a)},complete:function(t,r){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&r&&(this.next=r),g},finish:function(t){for(var r=this.tryEntries.length-1;r>=0;--r){var e=this.tryEntries[r];if(e.finallyLoc===t)return this.complete(e.completion,e.afterLoc),T(e),g}},catch:function(t){for(var r=this.tryEntries.length-1;r>=0;--r){var e=this.tryEntries[r];if(e.tryLoc===t){var n=e.completion;if("throw"===n.type){var o=n.arg;T(e)}return o}}throw Error("illegal catch attempt")},delegateYield:function(r,e,n){return this.delegate={iterator:G(r),resultName:e,nextLoc:n},"next"===this.method&&(this.arg=t),g}},r}function f(t){return f="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},f(t)}var l=["type","width","height","series","options","className"];function s(t){return t&&"object"===f(t)&&!Array.isArray(t)}function h(t,r){var e=function(t){for(var r=1;r<arguments.length;r++){var e=null!=arguments[r]?arguments[r]:{};r%2?a(Object(e),!0).forEach((function(r){o(t,r,e[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(e)):a(Object(e)).forEach((function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(e,r))}))}return t}({},t);return s(t)&&s(r)&&Object.keys(r).forEach((function(n){s(r[n])?e[n]=n in t?h(t[n],r[n]):r[n]:e[n]=r[n]})),e}function p(t){return y.apply(this,arguments)}function y(){var e;return e=u().mark((function e(n){var o,a,f,s,p,y,v,d,g,m,b,w,O,j,E;return u().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return o=n.type,a=void 0===o?"line":o,f=n.width,s=void 0===f?400:f,p=n.height,y=void 0===p?300:p,v=n.series,d=void 0===v?[]:v,g=n.options,m=void 0===g?{}:g,b=n.className,w=void 0===b?"":b,O=c(n,l),j=h(m,{chart:{type:a,width:s,height:y},series:d}),e.prev=2,e.next=5,r.renderToHTML(j,{width:s,height:y});case 5:return E=e.sent,e.abrupt("return",t.createElement("div",i({className:w,dangerouslySetInnerHTML:{__html:E}},O)));case 9:return e.prev=9,e.t0=e.catch(2),console.error("Failed to render ApexChart on server:",e.t0),e.abrupt("return",t.createElement("div",i({className:w},O),t.createElement("p",null,"Error rendering chart")));case 13:case"end":return e.stop()}}),e,null,[[2,9]])})),y=function(){var t=this,r=arguments;return new Promise((function(o,i){var a=e.apply(t,r);function c(t){n(a,o,i,c,u,"next",t)}function u(t){n(a,o,i,c,u,"throw",t)}c(void 0)}))},y.apply(this,arguments)}p.propTypes={type:e.string,series:e.array,options:e.object,width:e.oneOfType([e.string,e.number]),height:e.oneOfType([e.string,e.number]),className:e.string};export{p as default};
@@ -0,0 +1,2 @@
1
+ "use client";
2
+ "use strict";var e=require("react"),r=require("apexcharts/core"),t=require("prop-types");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 i(){return i=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},i.apply(null,arguments)}function o(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?o(Object(t),!0).forEach((function(r){n(e,r,t[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):o(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){return e&&"object"===c(e)&&!Array.isArray(e)}function a(e,r){var t=u({},e);return s(e)&&s(r)&&Object.keys(r).forEach((function(n){s(r[n])?t[n]=n in e?a(e[n],r[n]):r[n]:t[n]=r[n]})),t}function l(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),i=Object.keys(r);if(n.length!==i.length)return!1;for(var o=0,u=n;o<u.length;o++){var f=u[o];if(!i.includes(f)||!l(e[f],r[f],t))return!1}return!0}var p=["type","series","options","width","height","chartRef"];function y(t){var n=t.type,o=void 0===n?"line":n,c=t.width,s=void 0===c?"100%":c,y=t.height,b=void 0===y?"auto":y,h=t.series,v=t.options,d=t.chartRef,O=function(e,r){if(null==e)return{};var t,n,i=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 o=Object.getOwnPropertySymbols(e);for(n=0;n<o.length;n++)t=o[n],r.includes(t)||{}.propertyIsEnumerable.call(e,t)&&(i[t]=e[t])}return i}(t,f),g=e.useRef(null),j=e.useRef(null),m=e.useRef(null),w=d||m,P=function(){return a(v,{chart:{type:o,height:b,width:s},series:h})};e.useEffect((function(){return w.current=new r(g.current,P()),w.current.render(),j.current=v,function(){w.current&&"function"==typeof w.current.destroy&&w.current.destroy()}}),[]),e.useEffect((function(){if(w.current&&w.current.w){var e=!l(w.current.w.config.series,h),r=!l(j.current,v)||b!==w.current.opts.chart.height||s!==w.current.opts.chart.width;(e||r)&&(e?r?w.current.updateOptions(P()):w.current.updateSeries(h):w.current.updateOptions(P())),j.current=v}}),[v,h,b,s]);var S,R,E=(S=p,R=u({},O),S.forEach((function(e){delete R[e]})),R);return e.createElement("div",i({ref:g},E))}y.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})},module.exports=y;
@@ -0,0 +1,2 @@
1
+ "use client";
2
+ import r,{useRef as e,useEffect as t}from"react";import n from"apexcharts/core";import o from"prop-types";function i(r,e,t){return(e=function(r){var e=function(r,e){if("object"!=typeof r||!r)return r;var t=r[Symbol.toPrimitive];if(void 0!==t){var n=t.call(r,e||"default");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(r)}(r,"string");return"symbol"==typeof e?e:e+""}(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function u(){return u=Object.assign?Object.assign.bind():function(r){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var n in t)({}).hasOwnProperty.call(t,n)&&(r[n]=t[n])}return r},u.apply(null,arguments)}function c(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable}))),t.push.apply(t,n)}return t}function f(r){for(var e=1;e<arguments.length;e++){var t=null!=arguments[e]?arguments[e]:{};e%2?c(Object(t),!0).forEach((function(e){i(r,e,t[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):c(Object(t)).forEach((function(e){Object.defineProperty(r,e,Object.getOwnPropertyDescriptor(t,e))}))}return r}function a(r){return a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(r){return typeof r}:function(r){return r&&"function"==typeof Symbol&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},a(r)}var s=["type","width","height","series","options","chartRef"];function p(r){return r&&"object"===a(r)&&!Array.isArray(r)}function l(r,e){var t=f({},r);return p(r)&&p(e)&&Object.keys(e).forEach((function(n){p(e[n])?t[n]=n in r?l(r[n],e[n]):e[n]:t[n]=e[n]})),t}function y(r,e){var t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:new WeakSet;if(r===e)return!0;if("object"!==a(r)||null===r||"object"!==a(e)||null===e)return!1;if(t.has(r)||t.has(e))return!0;t.add(r),t.add(e);var n=Object.keys(r),o=Object.keys(e);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)||!y(r[c],e[c],t))return!1}return!0}var b=["type","series","options","width","height","chartRef"];function h(o){var i=o.type,c=void 0===i?"line":i,a=o.width,p=void 0===a?"100%":a,h=o.height,d=void 0===h?"auto":h,v=o.series,O=o.options,g=o.chartRef,m=function(r,e){if(null==r)return{};var t,n,o=function(r,e){if(null==r)return{};var t={};for(var n in r)if({}.hasOwnProperty.call(r,n)){if(e.includes(n))continue;t[n]=r[n]}return t}(r,e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(r);for(n=0;n<i.length;n++)t=i[n],e.includes(t)||{}.propertyIsEnumerable.call(r,t)&&(o[t]=r[t])}return o}(o,s),j=e(null),w=e(null),P=e(null),S=g||P,E=function(){return l(O,{chart:{type:c,height:d,width:p},series:v})};t((function(){return S.current=new n(j.current,E()),S.current.render(),w.current=O,function(){S.current&&"function"==typeof S.current.destroy&&S.current.destroy()}}),[]),t((function(){if(S.current&&S.current.w){var r=!y(S.current.w.config.series,v),e=!y(w.current,O)||d!==S.current.opts.chart.height||p!==S.current.opts.chart.width;(r||e)&&(r?e?S.current.updateOptions(E()):S.current.updateSeries(v):S.current.updateOptions(E())),w.current=O}}),[O,v,d,p]);var R,k,D=(R=b,k=f({},m),R.forEach((function(r){delete k[r]})),k);return r.createElement("div",u({ref:j},D))}h.propTypes={type:o.string.isRequired,series:o.array.isRequired,options:o.object.isRequired,width:o.oneOfType([o.string,o.number]),height:o.oneOfType([o.string,o.number]),chartRef:o.shape({current:o.any})};export{h as default};
@@ -1 +1,2 @@
1
+ "use client";
1
2
  import r,{useRef as e,useEffect as t}from"react";import n from"apexcharts/client";import o from"prop-types";function i(r,e,t){return(e=function(r){var e=function(r,e){if("object"!=typeof r||!r)return r;var t=r[Symbol.toPrimitive];if(void 0!==t){var n=t.call(r,e||"default");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(r)}(r,"string");return"symbol"==typeof e?e:e+""}(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function c(){return c=Object.assign?Object.assign.bind():function(r){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var n in t)({}).hasOwnProperty.call(t,n)&&(r[n]=t[n])}return r},c.apply(null,arguments)}function a(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable}))),t.push.apply(t,n)}return t}function u(r){for(var e=1;e<arguments.length;e++){var t=null!=arguments[e]?arguments[e]:{};e%2?a(Object(t),!0).forEach((function(e){i(r,e,t[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):a(Object(t)).forEach((function(e){Object.defineProperty(r,e,Object.getOwnPropertyDescriptor(t,e))}))}return r}var l=["clientOptions","className"];var f=["clientOptions","className"];function s(o){var i=o.clientOptions,a=void 0===i?{}:i,s=o.className,p=void 0===s?"":s,b=function(r,e){if(null==r)return{};var t,n,o=function(r,e){if(null==r)return{};var t={};for(var n in r)if({}.hasOwnProperty.call(r,n)){if(e.includes(n))continue;t[n]=r[n]}return t}(r,e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(r);for(n=0;n<i.length;n++)t=i[n],e.includes(t)||{}.propertyIsEnumerable.call(r,t)&&(o[t]=r[t])}return o}(o,l),y=e(null),O=e(null);t((function(){if(y.current&&!O.current)try{var r={chart:{animations:{enabled:!0}}},e=u(u(u({},r),a),{},{chart:u(u({},r.chart),a.chart||{})});O.current=n.hydrate(y.current,e)}catch(r){console.error("Failed to hydrate ApexChart:",r)}return function(){O.current&&(O.current.destroy(),O.current=null)}}),[a]);var v,m,h=(v=f,m=u({},b),v.forEach((function(r){delete m[r]})),m);return r.createElement("div",c({ref:y,className:p},h))}s.propTypes={clientOptions:o.object,className:o.string};export{s as default};
@@ -1 +1,2 @@
1
+ "use client";
1
2
  "use strict";var e=require("react"),r=require("apexcharts/client"),t=require("prop-types");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 i(){return i=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},i.apply(null,arguments)}function o(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?o(Object(t),!0).forEach((function(r){n(e,r,t[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):o(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){return e&&"object"===c(e)&&!Array.isArray(e)}function a(e,r){var t=u({},e);return s(e)&&s(r)&&Object.keys(r).forEach((function(n){s(r[n])?t[n]=n in e?a(e[n],r[n]):r[n]:t[n]=r[n]})),t}function l(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),i=Object.keys(r);if(n.length!==i.length)return!1;for(var o=0,u=n;o<u.length;o++){var f=u[o];if(!i.includes(f)||!l(e[f],r[f],t))return!1}return!0}var p=["type","series","options","width","height","chartRef"];function y(t){var n=t.type,o=void 0===n?"line":n,c=t.width,s=void 0===c?"100%":c,y=t.height,b=void 0===y?"auto":y,h=t.series,v=t.options,d=t.chartRef,O=function(e,r){if(null==e)return{};var t,n,i=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 o=Object.getOwnPropertySymbols(e);for(n=0;n<o.length;n++)t=o[n],r.includes(t)||{}.propertyIsEnumerable.call(e,t)&&(i[t]=e[t])}return i}(t,f),g=e.useRef(null),j=e.useRef(null),m=e.useRef(null),w=d||m,P=function(){return a(v,{chart:{type:o,height:b,width:s},series:h})};e.useEffect((function(){return w.current=new r(g.current,P()),w.current.render(),j.current=v,function(){w.current&&"function"==typeof w.current.destroy&&w.current.destroy()}}),[]),e.useEffect((function(){if(w.current&&w.current.w){var e=!l(w.current.w.config.series,h),r=!l(j.current,v)||b!==w.current.opts.chart.height||s!==w.current.opts.chart.width;(e||r)&&(e?r?w.current.updateOptions(P()):w.current.updateSeries(h):w.current.updateOptions(P())),j.current=v}}),[v,h,b,s]);var S,R,E=(S=p,R=u({},O),S.forEach((function(e){delete R[e]})),R);return e.createElement("div",i({ref:g},E))}y.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})},module.exports=y;
@@ -1 +1,2 @@
1
+ "use client";
1
2
  import r,{useRef as e,useEffect as t}from"react";import n from"apexcharts/client";import o from"prop-types";function i(r,e,t){return(e=function(r){var e=function(r,e){if("object"!=typeof r||!r)return r;var t=r[Symbol.toPrimitive];if(void 0!==t){var n=t.call(r,e||"default");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(r)}(r,"string");return"symbol"==typeof e?e:e+""}(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function u(){return u=Object.assign?Object.assign.bind():function(r){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var n in t)({}).hasOwnProperty.call(t,n)&&(r[n]=t[n])}return r},u.apply(null,arguments)}function c(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable}))),t.push.apply(t,n)}return t}function f(r){for(var e=1;e<arguments.length;e++){var t=null!=arguments[e]?arguments[e]:{};e%2?c(Object(t),!0).forEach((function(e){i(r,e,t[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):c(Object(t)).forEach((function(e){Object.defineProperty(r,e,Object.getOwnPropertyDescriptor(t,e))}))}return r}function a(r){return a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(r){return typeof r}:function(r){return r&&"function"==typeof Symbol&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},a(r)}var s=["type","width","height","series","options","chartRef"];function p(r){return r&&"object"===a(r)&&!Array.isArray(r)}function l(r,e){var t=f({},r);return p(r)&&p(e)&&Object.keys(e).forEach((function(n){p(e[n])?t[n]=n in r?l(r[n],e[n]):e[n]:t[n]=e[n]})),t}function y(r,e){var t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:new WeakSet;if(r===e)return!0;if("object"!==a(r)||null===r||"object"!==a(e)||null===e)return!1;if(t.has(r)||t.has(e))return!0;t.add(r),t.add(e);var n=Object.keys(r),o=Object.keys(e);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)||!y(r[c],e[c],t))return!1}return!0}var b=["type","series","options","width","height","chartRef"];function h(o){var i=o.type,c=void 0===i?"line":i,a=o.width,p=void 0===a?"100%":a,h=o.height,d=void 0===h?"auto":h,v=o.series,O=o.options,g=o.chartRef,m=function(r,e){if(null==r)return{};var t,n,o=function(r,e){if(null==r)return{};var t={};for(var n in r)if({}.hasOwnProperty.call(r,n)){if(e.includes(n))continue;t[n]=r[n]}return t}(r,e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(r);for(n=0;n<i.length;n++)t=i[n],e.includes(t)||{}.propertyIsEnumerable.call(r,t)&&(o[t]=r[t])}return o}(o,s),j=e(null),w=e(null),P=e(null),S=g||P,E=function(){return l(O,{chart:{type:c,height:d,width:p},series:v})};t((function(){return S.current=new n(j.current,E()),S.current.render(),w.current=O,function(){S.current&&"function"==typeof S.current.destroy&&S.current.destroy()}}),[]),t((function(){if(S.current&&S.current.w){var r=!y(S.current.w.config.series,v),e=!y(w.current,O)||d!==S.current.opts.chart.height||p!==S.current.opts.chart.width;(r||e)&&(r?e?S.current.updateOptions(E()):S.current.updateSeries(v):S.current.updateOptions(E())),w.current=O}}),[O,v,d,p]);var R,k,D=(R=b,k=f({},m),R.forEach((function(r){delete k[r]})),k);return r.createElement("div",u({ref:j},D))}h.propTypes={type:o.string.isRequired,series:o.array.isRequired,options:o.object.isRequired,width:o.oneOfType([o.string,o.number]),height:o.oneOfType([o.string,o.number]),chartRef:o.shape({current:o.any})};export{h as default};
@@ -1 +1,2 @@
1
+ "use client";
1
2
  "use strict";var e=require("react"),r=require("apexcharts/client"),t=require("prop-types");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 i(){return i=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},i.apply(null,arguments)}function o(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?o(Object(t),!0).forEach((function(r){n(e,r,t[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):o(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){return e&&"object"===c(e)&&!Array.isArray(e)}function a(e,r){var t=u({},e);return s(e)&&s(r)&&Object.keys(r).forEach((function(n){s(r[n])?t[n]=n in e?a(e[n],r[n]):r[n]:t[n]=r[n]})),t}function l(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),i=Object.keys(r);if(n.length!==i.length)return!1;for(var o=0,u=n;o<u.length;o++){var f=u[o];if(!i.includes(f)||!l(e[f],r[f],t))return!1}return!0}var p=["type","series","options","width","height","chartRef"];function y(t){var n=t.type,o=void 0===n?"line":n,c=t.width,s=void 0===c?"100%":c,y=t.height,b=void 0===y?"auto":y,h=t.series,v=t.options,d=t.chartRef,O=function(e,r){if(null==e)return{};var t,n,i=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 o=Object.getOwnPropertySymbols(e);for(n=0;n<o.length;n++)t=o[n],r.includes(t)||{}.propertyIsEnumerable.call(e,t)&&(i[t]=e[t])}return i}(t,f),g=e.useRef(null),j=e.useRef(null),m=e.useRef(null),w=d||m,P=function(){return a(v,{chart:{type:o,height:b,width:s},series:h})};e.useEffect((function(){return w.current=new r(g.current,P()),w.current.render(),j.current=v,function(){w.current&&"function"==typeof w.current.destroy&&w.current.destroy()}}),[]),e.useEffect((function(){if(w.current&&w.current.w){var e=!l(w.current.w.config.series,h),r=!l(j.current,v)||b!==w.current.opts.chart.height||s!==w.current.opts.chart.width;(e||r)&&(e?r?w.current.updateOptions(P()):w.current.updateSeries(h):w.current.updateOptions(P())),j.current=v}}),[v,h,b,s]);var S,R,E=(S=p,R=u({},O),S.forEach((function(e){delete R[e]})),R);return e.createElement("div",i({ref:g},E))}y.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})},module.exports=y;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-apexcharts",
3
- "version": "2.0.1",
3
+ "version": "2.1.0",
4
4
  "description": "React.js wrapper for ApexCharts with SSR support",
5
5
  "main": "dist/react-apexcharts.cjs.js",
6
6
  "module": "dist/react-apexcharts.esm.js",
@@ -19,6 +19,19 @@
19
19
  "./hydrate": {
20
20
  "types": "./types/react-apexcharts-hydrate.d.ts",
21
21
  "import": "./dist/react-apexcharts-hydrate.esm.js"
22
+ },
23
+ "./core": {
24
+ "import": "./dist/react-apexcharts-core.esm.js",
25
+ "require": "./dist/react-apexcharts-core.cjs.js",
26
+ "types": "./types/react-apexcharts-core.d.ts"
27
+ },
28
+ "./core/server": {
29
+ "types": "./types/react-apexcharts-core-server.d.ts",
30
+ "import": "./dist/react-apexcharts-core-server.esm.js"
31
+ },
32
+ "./core/hydrate": {
33
+ "types": "./types/react-apexcharts-core-hydrate.d.ts",
34
+ "import": "./dist/react-apexcharts-core-hydrate.esm.js"
22
35
  }
23
36
  },
24
37
  "files": [
@@ -53,7 +66,7 @@
53
66
  "prop-types": "^15.8.1"
54
67
  },
55
68
  "peerDependencies": {
56
- "apexcharts": ">=5.6.0",
69
+ "apexcharts": ">=5.10.1",
57
70
  "react": ">=16.8.0"
58
71
  },
59
72
  "devDependencies": {
@@ -74,7 +87,7 @@
74
87
  "react": "^18.3.1",
75
88
  "react-dom": "^18.3.1",
76
89
  "react-test-renderer": "^18.3.1",
77
- "rollup": "4.24.0"
90
+ "rollup": "4.59.0"
78
91
  },
79
92
  "repository": {
80
93
  "type": "git",
@@ -0,0 +1,29 @@
1
+ /// <reference types="react"/>
2
+ import { ApexOptions } from "apexcharts";
3
+ import React from "react";
4
+
5
+ /**
6
+ * Type definitions for react-apexcharts/core/hydrate
7
+ *
8
+ * Core variant of Hydrate Component — imports from 'apexcharts/core' for tree-shaking.
9
+ * Users must explicitly import chart types and features:
10
+ *
11
+ * import ReactApexChartHydrate from 'react-apexcharts/core/hydrate'
12
+ * import 'apexcharts/line'
13
+ * import 'apexcharts/features/legend'
14
+ */
15
+ declare module "react-apexcharts/core/hydrate" {
16
+ export interface HydrateChartProps {
17
+ /**
18
+ * Optional client-side options to override SSR config
19
+ * Animations are re-enabled by default
20
+ */
21
+ clientOptions?: ApexOptions;
22
+ className?: string;
23
+ [key: string]: any;
24
+ }
25
+
26
+ export default function ReactApexChartsHydrate(
27
+ props: HydrateChartProps
28
+ ): React.ReactElement;
29
+ }
@@ -0,0 +1,45 @@
1
+ /// <reference types="react"/>
2
+ import { ApexOptions } from "apexcharts";
3
+ import React from "react";
4
+
5
+ /**
6
+ * Type definitions for react-apexcharts/core/server
7
+ *
8
+ * Core variant of Server Component — imports from 'apexcharts/core' for tree-shaking.
9
+ * Users must explicitly import chart types and features:
10
+ *
11
+ * import Chart from 'react-apexcharts/core/server'
12
+ * import 'apexcharts/bar'
13
+ * import 'apexcharts/features/legend'
14
+ */
15
+ declare module "react-apexcharts/core/server" {
16
+ export interface ServerChartProps {
17
+ type?:
18
+ | "line"
19
+ | "area"
20
+ | "bar"
21
+ | "pie"
22
+ | "donut"
23
+ | "radialBar"
24
+ | "scatter"
25
+ | "bubble"
26
+ | "heatmap"
27
+ | "candlestick"
28
+ | "boxPlot"
29
+ | "radar"
30
+ | "polarArea"
31
+ | "rangeBar"
32
+ | "rangeArea"
33
+ | "treemap";
34
+ series?: ApexOptions["series"];
35
+ width?: string | number;
36
+ height?: string | number;
37
+ options?: ApexOptions;
38
+ className?: string;
39
+ [key: string]: any;
40
+ }
41
+
42
+ export default function ReactApexChartsServer(
43
+ props: ServerChartProps
44
+ ): Promise<React.ReactElement>;
45
+ }
@@ -1,10 +1,18 @@
1
1
  /// <reference types="react"/>
2
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
6
+ * Type definitions for react-apexcharts/core
7
+ *
8
+ * Core variant — imports from 'apexcharts/core' for tree-shaking.
9
+ * Users must explicitly import chart types and features:
10
+ *
11
+ * import ReactApexChart from 'react-apexcharts/core'
12
+ * import 'apexcharts/line'
13
+ * import 'apexcharts/features/legend'
6
14
  */
7
- declare module "react-apexcharts" {
15
+ declare module "react-apexcharts/core" {
8
16
  export interface Props {
9
17
  type?:
10
18
  | "line"