@devtron-labs/devtron-fe-common-lib 1.20.3-pre-9 → 1.20.3-pre-11

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.
@@ -1,7 +1,7 @@
1
- import { j as n, aJ as v, aL as W, aK as K } from "./@vendor-DwGKptu5.js";
1
+ import { j as n, aK as v, aM as J, aL as K } from "./@vendor-DceGoESd.js";
2
2
  import V, { useState as q, useEffect as Y, forwardRef as G, useMemo as E } from "react";
3
3
  import z, { getDefaultRegistry as Q } from "@rjsf/core";
4
- import { T as O, j as F, c as S, b as N, S as X, i as Z, g as ee, a as te, d as R, e as ne } from "./@code-editor-P2jsjZMo.js";
4
+ import { T as O, j as F, c as S, b as N, S as X, i as Z, g as ee, a as te, d as R, e as ne } from "./@code-editor-BKRUF3oV.js";
5
5
  import { getUiOptions as B, getTemplate as $, getSubmitButtonOptions as re, ADDITIONAL_PROPERTY_FLAG as L, errorId as se, englishStringTranslator as ae, TranslatableString as oe, titleId as le, canExpand as ie, deepEquals as ce } from "@rjsf/utils";
6
6
  import { ReactComponent as de } from "./assets/ic-add.cfaa779b.svg";
7
7
  import { ReactComponent as ue } from "./assets/ic-warning.ecf7ff97.svg";
@@ -10,7 +10,7 @@ import './assets/@common-rjsf.css';const P = {
10
10
  SELECT: "Please select an option",
11
11
  INPUT: "Please enter an input",
12
12
  OBJECT_KEY: "Please enter a value for the key"
13
- }, pe = "Key not available", We = {
13
+ }, pe = "Key not available", Je = {
14
14
  "ui:submitButtonOptions": {
15
15
  norender: !0
16
16
  }
@@ -329,7 +329,7 @@ import './assets/@common-rjsf.css';const P = {
329
329
  wrap: !1
330
330
  });
331
331
  o !== void 0 && (r = F([N(i, o), r]));
332
- }), t && r ? W(t, K(t, r), !1, !1).newDocument : r);
332
+ }), t && r ? J(t, K(t, r), !1, !1).newDocument : r);
333
333
  }, Fe = ({ formData: e, schemaPathToUpdatePathMap: t }) => F([
334
334
  ...Object.entries(t).map(([s, r]) => {
335
335
  if (s === r || !r)
@@ -507,7 +507,7 @@ import './assets/@common-rjsf.css';const P = {
507
507
  Y(() => {
508
508
  _(ee(8));
509
509
  }, []);
510
- const y = (g) => s ? u.filter((b) => g.some((J) => R(J, b.value))) : u.find((b) => R(g, b.value));
510
+ const y = (g) => s ? u.filter((b) => g.some((W) => R(W, b.value))) : u.find((b) => R(g, b.value));
511
511
  return /* @__PURE__ */ n.jsx(
512
512
  te,
513
513
  {
@@ -595,7 +595,7 @@ import './assets/@common-rjsf.css';const P = {
595
595
  ] });
596
596
  });
597
597
  export {
598
- We as H,
598
+ Je as H,
599
599
  qe as R,
600
600
  Ke as a,
601
601
  Se as b,
@@ -1,4 +1,4 @@
1
- import { aV as m, aW as lt, aX as R, aY as Zr, aZ as Le, a_ as oe, a$ as T, b0 as $e, b1 as at, b2 as Gt, b3 as Q, b4 as $r, b5 as oi, b6 as si, b7 as ui, b8 as li, b9 as fi, ba as ci, bb as vi, bc as di, bd as qr, be as pi, bf as hi, bg as mi, bh as gi, bi as yi, bj as Jr, bk as Pt, bl as he, bm as X, bn as bi, bo as Qr, bp as z, bq as tn, br as me, bs as Z, bt as Pi, bu as Ot, bv as Vi, bw as Ti, bx as en, by as Ft, bz as O, bA as ge, bB as Si, bC as se, bD as xi, bE as Ci } from "./@vendor-DwGKptu5.js";
1
+ import { aW as m, aX as lt, aY as R, aZ as Zr, a_ as Le, a$ as oe, b0 as T, b1 as $e, b2 as at, b3 as Gt, b4 as Q, b5 as $r, b6 as oi, b7 as si, b8 as ui, b9 as li, ba as fi, bb as ci, bc as vi, bd as di, be as qr, bf as pi, bg as hi, bh as mi, bi as gi, bj as yi, bk as Jr, bl as Pt, bm as he, bn as X, bo as bi, bp as Qr, bq as z, br as tn, bs as me, bt as Z, bu as Pi, bv as Ot, bw as Vi, bx as Ti, by as en, bz as Ft, bA as O, bB as ge, bC as Si, bD as se, bE as xi, bF as Ci } from "./@vendor-DceGoESd.js";
2
2
  import * as Y from "react";
3
3
  import Re, { createContext as St, useContext as F, useLayoutEffect as Ai, useEffect as N, useState as De, useRef as $, useCallback as ye, useMemo as Vt, forwardRef as wi, createElement as Ei, cloneElement as Li, Children as Ri, isValidElement as Di } from "react";
4
4
  var qe = "production", Me = typeof process > "u" || process.env === void 0 ? qe : process.env.NODE_ENV || qe, tt = function(t) {
@@ -1,5 +1,5 @@
1
1
  import Te from "react";
2
- import { bF as he, bG as Ke, bH as we, bI as cn, bJ as Le, bK as Je, bL as tt, bM as at, bN as et, bO as lt, bP as nt, bQ as so, bR as fn, bS as uo, bT as bt, bU as ei, bV as hn, bW as co, bX as fo, bY as ho, bZ as vn, b_ as Fe, b$ as pn, c0 as ti, c1 as wn, c2 as ai, c3 as ni, c4 as ri, c5 as Rt, c6 as oi, c7 as ii, c8 as li } from "./@vendor-DwGKptu5.js";
2
+ import { bG as he, bH as Ke, bI as we, bJ as cn, bK as Le, bL as Je, bM as tt, bN as at, bO as et, bP as lt, bQ as nt, bR as so, bS as fn, bT as uo, bU as bt, bV as ei, bW as hn, bX as co, bY as fo, bZ as ho, b_ as vn, b$ as Fe, c0 as pn, c1 as ti, c2 as wn, c3 as ai, c4 as ni, c5 as ri, c6 as Rt, c7 as oi, c8 as ii, c9 as li } from "./@vendor-DceGoESd.js";
3
3
  import { r as Ne, h as si, g as di } from "./@moment-CGWt8tF2.js";
4
4
  import './assets/@react-dates.css';var Wt = {}, jt = {}, zt = {}, Nn;
5
5
  function Ve() {
@@ -1,4 +1,4 @@
1
- import { c9 as xt, ca as v, bZ as re, cb as h, c4 as f, cc as Y, cd as U, ce as xe, cf as Bt, cg as Ue, ch as Ft, ci as Vt, cj as Et, ck as yt, cl as Wt, cm as Xt, cn as ne, co as Zt } from "./@vendor-DwGKptu5.js";
1
+ import { ca as xt, cb as v, b_ as re, cc as h, c5 as f, cd as Y, ce as U, cf as xe, cg as Bt, ch as Ue, ci as Ft, cj as Vt, ck as Et, cl as yt, cm as Wt, cn as Xt, co as ne, cp as Zt } from "./@vendor-DceGoESd.js";
2
2
  import * as y from "react";
3
3
  import { useRef as j, useState as ee, useMemo as q, useCallback as D, createContext as Nt, useContext as St, Component as Rt, Fragment as Be, useEffect as Qe, forwardRef as Ht } from "react";
4
4
  import { createPortal as Tt } from "react-dom";
@@ -2,7 +2,7 @@ var v = Object.defineProperty;
2
2
  var E = (a, h, e) => h in a ? v(a, h, { enumerable: !0, configurable: !0, writable: !0, value: e }) : a[h] = e;
3
3
  var f = (a, h, e) => E(a, typeof h != "symbol" ? h + "" : h, e);
4
4
  import u, { createRef as k } from "react";
5
- import { cp as x } from "./@vendor-DwGKptu5.js";
5
+ import { cq as x } from "./@vendor-DceGoESd.js";
6
6
  const b = () => typeof navigator < "u" && /Safari/.test(navigator.userAgent) && /Apple Computer/.test(navigator.vendor) ? "-webkit-sticky" : "sticky";
7
7
  var g;
8
8
  (function(a) {
@@ -80441,7 +80441,7 @@ export {
80441
80441
  UIe as Z,
80442
80442
  V5 as _,
80443
80443
  lpe as a,
80444
- X9e as a$,
80444
+ aj as a$,
80445
80445
  ap as a0,
80446
80446
  zIe as a1,
80447
80447
  Xc as a2,
@@ -80452,33 +80452,33 @@ export {
80452
80452
  VIe as a7,
80453
80453
  Gce as a8,
80454
80454
  pFe as a9,
80455
- wMe as aA,
80456
- BFe as aB,
80457
- ju as aC,
80458
- o$e as aD,
80459
- i$e as aE,
80460
- bOe as aF,
80461
- r4e as aG,
80462
- V9e as aH,
80463
- UB as aI,
80464
- Ot as aJ,
80465
- ere as aK,
80466
- kD as aL,
80467
- pi as aM,
80468
- N9e as aN,
80469
- I9e as aO,
80470
- VFe as aP,
80471
- yee as aQ,
80472
- mee as aR,
80473
- L9e as aS,
80474
- B9e as aT,
80475
- Ut as aU,
80476
- aR as aV,
80477
- zd as aW,
80478
- U9e as aX,
80479
- H9e as aY,
80480
- Rb as aZ,
80481
- aj as a_,
80455
+ gb as aA,
80456
+ wMe as aB,
80457
+ BFe as aC,
80458
+ ju as aD,
80459
+ o$e as aE,
80460
+ i$e as aF,
80461
+ bOe as aG,
80462
+ r4e as aH,
80463
+ V9e as aI,
80464
+ UB as aJ,
80465
+ Ot as aK,
80466
+ ere as aL,
80467
+ kD as aM,
80468
+ pi as aN,
80469
+ N9e as aO,
80470
+ I9e as aP,
80471
+ VFe as aQ,
80472
+ yee as aR,
80473
+ mee as aS,
80474
+ L9e as aT,
80475
+ B9e as aU,
80476
+ Ut as aV,
80477
+ aR as aW,
80478
+ zd as aX,
80479
+ U9e as aY,
80480
+ H9e as aZ,
80481
+ Rb as a_,
80482
80482
  mFe as aa,
80483
80483
  gFe as ab,
80484
80484
  yFe as ac,
@@ -80492,112 +80492,113 @@ export {
80492
80492
  Qx as ak,
80493
80493
  ag as al,
80494
80494
  dg as am,
80495
- _Fe as an,
80496
- CFe as ao,
80497
- wFe as ap,
80498
- xFe as aq,
80499
- LY as ar,
80500
- uf as as,
80501
- ko as at,
80502
- j9e as au,
80503
- LFe as av,
80504
- jFe as aw,
80505
- vb as ax,
80506
- Ve as ay,
80507
- gb as az,
80495
+ ub as an,
80496
+ _Fe as ao,
80497
+ CFe as ap,
80498
+ wFe as aq,
80499
+ xFe as ar,
80500
+ LY as as,
80501
+ uf as at,
80502
+ ko as au,
80503
+ j9e as av,
80504
+ LFe as aw,
80505
+ jFe as ax,
80506
+ vb as ay,
80507
+ Ve as az,
80508
80508
  He as b,
80509
- MFe as b$,
80510
- J9e as b0,
80511
- Q9e as b1,
80512
- Y9e as b2,
80513
- oj as b3,
80514
- gj as b4,
80515
- fIe as b5,
80516
- PE as b6,
80517
- aIe as b7,
80518
- sIe as b8,
80519
- oIe as b9,
80520
- pj as bA,
80521
- OE as bB,
80522
- uIe as bC,
80523
- W9e as bD,
80524
- xj as bE,
80525
- Cv as bF,
80526
- JOe as bG,
80527
- Nn as bH,
80528
- EFe as bI,
80529
- MQ as bJ,
80530
- GOe as bK,
80531
- YOe as bL,
80532
- SFe as bM,
80533
- XOe as bN,
80534
- nDe as bO,
80535
- yAe as bP,
80536
- xAe as bQ,
80537
- TAe as bR,
80538
- AFe as bS,
80539
- OFe as bT,
80540
- iAe as bU,
80541
- DFe as bV,
80542
- PFe as bW,
80543
- LQ as bX,
80544
- kFe as bY,
80545
- noe as bZ,
80546
- Mn as b_,
80547
- rIe as ba,
80548
- iIe as bb,
80549
- Sj as bc,
80550
- bie as bd,
80551
- nIe as be,
80552
- yie as bf,
80553
- tIe as bg,
80554
- gie as bh,
80555
- Cj as bi,
80556
- mie as bj,
80557
- MD as bk,
80558
- eIe as bl,
80559
- $b as bm,
80560
- lIe as bn,
80561
- Lie as bo,
80562
- G9e as bp,
80563
- RD as bq,
80564
- Mie as br,
80565
- Pie as bs,
80566
- Bie as bt,
80567
- dd as bu,
80568
- Z9e as bv,
80569
- K9e as bw,
80570
- cIe as bx,
80571
- Tie as by,
80572
- FD as bz,
80509
+ Mn as b$,
80510
+ X9e as b0,
80511
+ J9e as b1,
80512
+ Q9e as b2,
80513
+ Y9e as b3,
80514
+ oj as b4,
80515
+ gj as b5,
80516
+ fIe as b6,
80517
+ PE as b7,
80518
+ aIe as b8,
80519
+ sIe as b9,
80520
+ FD as bA,
80521
+ pj as bB,
80522
+ OE as bC,
80523
+ uIe as bD,
80524
+ W9e as bE,
80525
+ xj as bF,
80526
+ Cv as bG,
80527
+ JOe as bH,
80528
+ Nn as bI,
80529
+ EFe as bJ,
80530
+ MQ as bK,
80531
+ GOe as bL,
80532
+ YOe as bM,
80533
+ SFe as bN,
80534
+ XOe as bO,
80535
+ nDe as bP,
80536
+ yAe as bQ,
80537
+ xAe as bR,
80538
+ TAe as bS,
80539
+ AFe as bT,
80540
+ OFe as bU,
80541
+ iAe as bV,
80542
+ DFe as bW,
80543
+ PFe as bX,
80544
+ LQ as bY,
80545
+ kFe as bZ,
80546
+ noe as b_,
80547
+ oIe as ba,
80548
+ rIe as bb,
80549
+ iIe as bc,
80550
+ Sj as bd,
80551
+ bie as be,
80552
+ nIe as bf,
80553
+ yie as bg,
80554
+ tIe as bh,
80555
+ gie as bi,
80556
+ Cj as bj,
80557
+ mie as bk,
80558
+ MD as bl,
80559
+ eIe as bm,
80560
+ $b as bn,
80561
+ lIe as bo,
80562
+ Lie as bp,
80563
+ G9e as bq,
80564
+ RD as br,
80565
+ Mie as bs,
80566
+ Pie as bt,
80567
+ Bie as bu,
80568
+ dd as bv,
80569
+ Z9e as bw,
80570
+ K9e as bx,
80571
+ cIe as by,
80572
+ Tie as bz,
80573
80573
  mV as c,
80574
- c3e as c0,
80575
- TFe as c1,
80576
- roe as c2,
80577
- IFe as c3,
80578
- yc as c4,
80579
- $Fe as c5,
80580
- RFe as c6,
80581
- mAe as c7,
80582
- FFe as c8,
80583
- bc as c9,
80584
- hIe as ca,
80585
- vIe as cb,
80586
- _Ie as cc,
80587
- wIe as cd,
80588
- EIe as ce,
80589
- SIe as cf,
80590
- ise as cg,
80591
- xIe as ch,
80592
- CIe as ci,
80593
- gIe as cj,
80594
- yIe as ck,
80595
- mIe as cl,
80596
- pIe as cm,
80597
- bIe as cn,
80598
- kIe as co,
80599
- oZ as cp,
80600
- gD as cq,
80574
+ MFe as c0,
80575
+ c3e as c1,
80576
+ TFe as c2,
80577
+ roe as c3,
80578
+ IFe as c4,
80579
+ yc as c5,
80580
+ $Fe as c6,
80581
+ RFe as c7,
80582
+ mAe as c8,
80583
+ FFe as c9,
80584
+ bc as ca,
80585
+ hIe as cb,
80586
+ vIe as cc,
80587
+ _Ie as cd,
80588
+ wIe as ce,
80589
+ EIe as cf,
80590
+ SIe as cg,
80591
+ ise as ch,
80592
+ xIe as ci,
80593
+ CIe as cj,
80594
+ gIe as ck,
80595
+ yIe as cl,
80596
+ mIe as cm,
80597
+ pIe as cn,
80598
+ bIe as co,
80599
+ kIe as cp,
80600
+ oZ as cq,
80601
+ gD as cr,
80601
80602
  KIe as d,
80602
80603
  ZIe as e,
80603
80604
  QIe as f,
@@ -19,5 +19,10 @@ export interface FetchInTimeParamsType<Data = object> {
19
19
  isMultipartRequest?: boolean;
20
20
  }
21
21
  export interface FetchAPIParamsType<Data = object> extends Omit<FetchInTimeParamsType<Data>, 'options'>, Pick<APIOptions, 'preventAutoLogout' | 'preventLicenseRedirect' | 'shouldParseServerErrorForUnauthorizedUser'> {
22
+ /**
23
+ * @default false
24
+ * @description - If true, will override the default host (orchestrator or whatever defined initially in CoreAPI constructor) with the `proxy` host
25
+ */
26
+ isProxyHost?: boolean;
22
27
  signal: AbortSignal;
23
28
  }
@@ -944,6 +944,17 @@ export type EnvironmentsGroupedByClustersType = {
944
944
  clusterName: EnvironmentType['cluster'];
945
945
  envList: EnvironmentType[];
946
946
  }[];
947
+ export type ClusterCostModuleConfigPayload = {
948
+ enabled: true;
949
+ config?: Record<string, any>;
950
+ } | {
951
+ enabled: false;
952
+ config?: never;
953
+ };
954
+ interface ClusterCostModuleDetailsDTO extends Pick<ClusterCostModuleConfigPayload, 'enabled' | 'config'> {
955
+ installationStatus: 'Success' | 'Installing' | 'Upgrading' | 'NotInstalled' | 'Failed';
956
+ installationError?: string;
957
+ }
947
958
  export interface ClusterDetailDTO {
948
959
  category: ClusterEnvironmentCategoryType;
949
960
  cluster_name: string;
@@ -959,6 +970,7 @@ export interface ClusterDetailDTO {
959
970
  proxyUrl: string;
960
971
  toConnectWithSSHTunnel: boolean;
961
972
  clusterStatus: ClusterStatusType;
973
+ costModuleConfig: ClusterCostModuleDetailsDTO;
962
974
  }
963
975
  export interface ClusterDetailListType extends Omit<ClusterDetailDTO, 'server_url' | 'cluster_name' | 'prometheus_url' | 'id' | 'category' | 'clusterStatus'> {
964
976
  serverUrl: ClusterDetailDTO['server_url'];
@@ -0,0 +1,4 @@
1
+ import { IconName } from '../../../Shared/Components';
2
+ import { ClusterProviderType } from './types';
3
+ export declare const CLUSTER_PROVIDER_TO_ICON_NAME: Record<ClusterProviderType, IconName | null>;
4
+ export declare const CLUSTER_PROVIDER_TO_LABEL: Record<ClusterProviderType, string>;
@@ -1 +1,2 @@
1
+ export * from './constants';
1
2
  export * from './types';
@@ -1,3 +1,6 @@
1
+ import { ReactNode } from 'react';
2
+ import { RJSFFormSchema } from '../../../Common/RJSF';
3
+ import { ClusterDetailListType } from '../../../Common/Types';
1
4
  export declare enum CostBreakdownViewType {
2
5
  CLUSTERS = "clusters",
3
6
  ENVIRONMENTS = "environments",
@@ -9,3 +12,20 @@ export declare enum CostBreakdownItemViewParamsType {
9
12
  VIEW = "view",
10
13
  DETAIL = "detail"
11
14
  }
15
+ type RenderClusterFormParamsType = {
16
+ clusterDetails: ClusterDetailListType;
17
+ handleClose: () => void;
18
+ handleSuccess: () => void;
19
+ };
20
+ export interface CostVisibilityRenderContextType {
21
+ renderClusterForm: (params: RenderClusterFormParamsType) => JSX.Element;
22
+ }
23
+ export interface CostVisibilityRenderProviderProps extends CostVisibilityRenderContextType {
24
+ children: ReactNode;
25
+ }
26
+ export type ClusterProviderType = 'AWS' | 'GCP' | 'Azure' | 'Alibaba' | 'Scaleway' | 'Oracle' | 'OTC' | 'DigitalOcean' | 'Unknown';
27
+ export interface ClusterProviderDetailsType {
28
+ clusterProvider: ClusterProviderType;
29
+ costModuleSchema: RJSFFormSchema;
30
+ }
31
+ export {};
@@ -1,16 +1,8 @@
1
1
  import { AppThemeType } from '../../Providers';
2
2
  import { ChartColorKey } from './types';
3
- export declare const LEGENDS_LABEL_CONFIG: {
4
- readonly usePointStyle: true;
5
- readonly pointStyle: "rectRounded";
6
- readonly pointStyleWidth: 0;
7
- readonly font: {
8
- readonly family: "'IBM Plex Sans', 'Open Sans', 'Roboto'";
9
- readonly size: 13;
10
- readonly lineHeight: "150%";
11
- readonly weight: 400;
12
- };
13
- };
14
3
  export declare const CHART_COLORS: Record<AppThemeType, Record<ChartColorKey, string>>;
15
4
  export declare const CHART_GRID_LINES_COLORS: Record<AppThemeType, string>;
5
+ export declare const CHART_AXIS_COLORS: Record<AppThemeType, string>;
6
+ export declare const CHART_AXIS_LABELS_COLOR: Record<AppThemeType, string>;
16
7
  export declare const CHART_CANVAS_BACKGROUND_COLORS: Record<AppThemeType, string>;
8
+ export declare const LINE_DASH: number[];
@@ -1,4 +1,4 @@
1
1
  export { default as Chart } from './Chart.component';
2
2
  export { CHART_COLORS } from './constants';
3
- export type { ChartColorKey, ChartProps, ChartType, SimpleDataset, SimpleDatasetForPie } from './types';
3
+ export type { ChartColorKey, ChartProps, ChartType, ReferenceLineConfigType, SimpleDataset, SimpleDatasetForPie, } from './types';
4
4
  export { chartColorGenerator } from './utils';
@@ -1,5 +1,4 @@
1
1
  import { Plugin } from 'chart.js';
2
2
  import { AppThemeType } from '../../Providers';
3
- import { ChartType } from './types';
4
- export declare const getAverageLinePlugin: (averageValue: number, appTheme: AppThemeType) => Plugin;
5
- export declare const getSeparatorLinePlugin: (separatorIndex: number, chartType: ChartType, appTheme: AppThemeType) => Plugin;
3
+ import { ReferenceLineConfigType } from './types';
4
+ export declare const drawReferenceLine: (config: ReferenceLineConfigType, id: string, appTheme: AppThemeType) => Plugin;
@@ -1,5 +1,5 @@
1
1
  import { ReactNode } from 'react';
2
- import { ChartOptions, TooltipOptions } from 'chart.js';
2
+ import { TooltipOptions, TooltipPositionerFunction } from 'chart.js';
3
3
  import { TooltipProps } from '../../../Common/Tooltip';
4
4
  import { AppThemeType } from '../../Providers';
5
5
  import { Never } from '../../types';
@@ -13,41 +13,49 @@ interface BaseSimpleDataset {
13
13
  yAxisValues: number[];
14
14
  }
15
15
  export interface SimpleDataset extends BaseSimpleDataset {
16
- backgroundColor: ChartColorKey;
16
+ color: ChartColorKey;
17
+ isClickable?: boolean;
18
+ }
19
+ export interface SimpleDatasetForLineAndArea extends Omit<SimpleDataset, 'isClickable'> {
20
+ isDashed?: boolean;
17
21
  }
18
22
  export interface SimpleDatasetForPie extends BaseSimpleDataset {
19
- backgroundColor: Array<ChartColorKey>;
23
+ colors: Array<ChartColorKey>;
24
+ isClickable?: boolean[];
20
25
  }
21
- export interface SimpleDatasetForLine extends BaseSimpleDataset {
22
- borderColor: ChartColorKey;
26
+ export interface ReferenceLineConfigType {
27
+ strokeWidth?: number;
28
+ color?: ChartColorKey;
29
+ value: number;
23
30
  }
24
31
  type XYAxisMax = {
25
32
  xAxisMax?: number;
26
33
  yAxisMax?: number;
34
+ /**
35
+ * Optional reference lines to draw across the chart
36
+ */
37
+ referenceLines?: ReferenceLineConfigType[];
27
38
  };
28
- type TypeAndDatasetsType = ({
39
+ type OnChartClickHandler = (datasetName: string, value: number) => void;
40
+ export type TypeAndDatasetsType = ({
29
41
  type: 'pie';
30
42
  /**
31
43
  * Needs to be memoized
32
44
  */
33
45
  datasets: SimpleDatasetForPie;
34
- separatorIndex?: never;
35
- averageLineValue?: never;
46
+ onChartClick?: OnChartClickHandler;
36
47
  } & Never<XYAxisMax>) | ({
37
48
  type: 'line';
38
- datasets: SimpleDatasetForLine[];
39
- separatorIndex?: never;
40
- averageLineValue?: number;
49
+ datasets: SimpleDatasetForLineAndArea[];
50
+ onChartClick?: never;
41
51
  } & XYAxisMax) | ({
42
52
  type: 'area';
43
- datasets: SimpleDataset[];
44
- separatorIndex?: never;
45
- averageLineValue?: number;
53
+ datasets: SimpleDatasetForLineAndArea;
54
+ onChartClick?: never;
46
55
  } & XYAxisMax) | ({
47
56
  type: Exclude<ChartType, 'pie' | 'line' | 'area'>;
48
57
  datasets: SimpleDataset[];
49
- separatorIndex?: number;
50
- averageLineValue?: never;
58
+ onChartClick?: OnChartClickHandler;
51
59
  } & XYAxisMax);
52
60
  export type ChartProps = {
53
61
  id: string;
@@ -60,10 +68,7 @@ export type ChartProps = {
60
68
  * @default false
61
69
  */
62
70
  hideAxis?: boolean;
63
- /**
64
- * Callback function for chart click events
65
- */
66
- onChartClick?: ChartOptions['onClick'];
71
+ hideXAxisLabels?: boolean;
67
72
  tooltipConfig?: {
68
73
  getTooltipContent?: (args: Parameters<TooltipOptions['external']>[0]) => ReactNode;
69
74
  /**
@@ -71,6 +76,10 @@ export type ChartProps = {
71
76
  */
72
77
  placement?: TooltipProps['placement'];
73
78
  };
79
+ /** A title for x axis */
80
+ xScaleTitle?: string;
81
+ /** A title for y axis */
82
+ yScaleTitle?: string;
74
83
  } & TypeAndDatasetsType;
75
84
  export type TransformDatasetProps = {
76
85
  appTheme: AppThemeType;
@@ -78,18 +87,24 @@ export type TransformDatasetProps = {
78
87
  type: 'pie';
79
88
  dataset: SimpleDatasetForPie;
80
89
  } | {
81
- type: 'line';
82
- dataset: SimpleDatasetForLine;
90
+ type: 'line' | 'area';
91
+ dataset: SimpleDatasetForLineAndArea;
83
92
  } | {
84
- type: Exclude<ChartType, 'pie' | 'line'>;
93
+ type: Exclude<ChartType, 'pie' | 'line' | 'area'>;
85
94
  dataset: SimpleDataset;
86
95
  });
87
96
  export type GetBackgroundAndBorderColorProps = TransformDatasetProps;
88
97
  export type TransformDataForChartProps = {
89
98
  appTheme: AppThemeType;
90
99
  } & TypeAndDatasetsType;
91
- export interface GetDefaultOptionsParams extends Pick<ChartProps, 'hideAxis' | 'onChartClick' | 'type' | 'xAxisMax' | 'yAxisMax'> {
100
+ export interface GetDefaultOptionsParams {
101
+ chartProps: ChartProps;
92
102
  appTheme: AppThemeType;
93
103
  externalTooltipHandler: TooltipOptions['external'];
94
104
  }
105
+ declare module 'chart.js' {
106
+ interface TooltipPositionerMap {
107
+ barElementCenterPositioner: TooltipPositionerFunction<'bar'>;
108
+ }
109
+ }
95
110
  export {};