@databrainhq/plugin 0.8.19 → 0.8.20

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.
@@ -2,6 +2,7 @@ import React, { PropsWithChildren } from 'react';
2
2
  declare type TooltipProps = PropsWithChildren & {
3
3
  content: JSX.Element;
4
4
  className?: string;
5
+ position?: 'left' | 'right' | 'top' | 'bottom' | 'left-bottom-end' | 'right-bottom-end' | 'left-top-end' | 'right-top-end' | 'bottom-left' | 'bottom-right' | 'top-left' | 'top-right' | 'left-bottom' | 'left-top' | 'right-bottom' | 'right-top' | 'center';
5
6
  };
6
7
  export declare const Tooltip: React.FC<TooltipProps>;
7
8
  export declare const InfoTooltip: React.FC<Omit<TooltipProps, 'content'> & {
package/dist/index.es.js CHANGED
@@ -80454,7 +80454,14 @@ const FunnelChart = ({
80454
80454
  const option2 = {
80455
80455
  tooltip: {
80456
80456
  trigger: "item",
80457
- formatter: "{b} : {c}",
80457
+ formatter: customSettings.showConversionRate ? (context) => {
80458
+ var _a2, _b2;
80459
+ let percent = 100;
80460
+ if (context.dataIndex > 0) {
80461
+ percent = (((_a2 = funnelData[context.dataIndex]) == null ? void 0 : _a2.value) || 0) / (((_b2 = funnelData[context.dataIndex - 1]) == null ? void 0 : _b2.value) || 1) * 100;
80462
+ }
80463
+ return `${context.name}: ${percent.toFixed(0)}%`;
80464
+ } : customSettings.showLabelValues ? "{b}: {c}" : customSettings.labelFormat || "{b}",
80458
80465
  backgroundColor: "black",
80459
80466
  textStyle: {
80460
80467
  color: "white"
@@ -80491,12 +80498,19 @@ const FunnelChart = ({
80491
80498
  max: 100,
80492
80499
  minSize: "0%",
80493
80500
  maxSize: "100%",
80494
- sort: "descending",
80501
+ sort: "none",
80495
80502
  gap: 3,
80496
80503
  label: {
80497
80504
  show: labelSettings.show,
80498
80505
  position: labelSettings.position,
80499
- formatter: customSettings.showLabelValues ? "{b} : {c}" : "{b}"
80506
+ formatter: customSettings.showConversionRate ? (context) => {
80507
+ var _a2, _b2;
80508
+ let percent = 100;
80509
+ if (context.dataIndex > 0) {
80510
+ percent = (((_a2 = funnelData[context.dataIndex]) == null ? void 0 : _a2.value) || 0) / (((_b2 = funnelData[context.dataIndex - 1]) == null ? void 0 : _b2.value) || 1) * 100;
80511
+ }
80512
+ return `${context.name}: ${percent.toFixed(0)}%`;
80513
+ } : customSettings.showLabelValues ? "{b}: {c}" : customSettings.labelFormat || "{b}"
80500
80514
  },
80501
80515
  labelLine: {
80502
80516
  length: 10,
@@ -86139,10 +86153,10 @@ const leave$1 = "_leave_1qflp_65";
86139
86153
  const leaveFrom$1 = "_leaveFrom_1qflp_73";
86140
86154
  const leaveTo$1 = "_leaveTo_1qflp_81";
86141
86155
  const center$1 = "_center_1qflp_89";
86142
- const top$1 = "_top_1qflp_97";
86143
- const bottom$2 = "_bottom_1qflp_105";
86144
- const left$1 = "_left_1qflp_113";
86145
- const right$1 = "_right_1qflp_121";
86156
+ const top$2 = "_top_1qflp_97";
86157
+ const bottom$3 = "_bottom_1qflp_105";
86158
+ const left$2 = "_left_1qflp_113";
86159
+ const right$2 = "_right_1qflp_121";
86146
86160
  var styles$o = {
86147
86161
  container: container$a,
86148
86162
  popover: popover$1,
@@ -86156,10 +86170,10 @@ var styles$o = {
86156
86170
  leaveFrom: leaveFrom$1,
86157
86171
  leaveTo: leaveTo$1,
86158
86172
  center: center$1,
86159
- top: top$1,
86160
- bottom: bottom$2,
86161
- left: left$1,
86162
- right: right$1,
86173
+ top: top$2,
86174
+ bottom: bottom$3,
86175
+ left: left$2,
86176
+ right: right$2,
86163
86177
  "left-top-end": "_left-top-end_1qflp_129",
86164
86178
  "right-top-end": "_right-top-end_1qflp_137",
86165
86179
  "left-bottom-end": "_left-bottom-end_1qflp_145",
@@ -86525,21 +86539,42 @@ const GlobalFilters = ({
86525
86539
  })
86526
86540
  });
86527
86541
  };
86528
- const container$8 = "_container_1sd6f_1";
86529
- const tooltip$1 = "_tooltip_1sd6f_7";
86542
+ const container$8 = "_container_nbkwy_1";
86543
+ const tooltip$1 = "_tooltip_nbkwy_9";
86544
+ const top$1 = "_top_nbkwy_25";
86545
+ const bottom$2 = "_bottom_nbkwy_33";
86546
+ const left$1 = "_left_nbkwy_41";
86547
+ const right$1 = "_right_nbkwy_49";
86530
86548
  var styles$m = {
86531
86549
  container: container$8,
86532
- tooltip: tooltip$1
86550
+ tooltip: tooltip$1,
86551
+ top: top$1,
86552
+ bottom: bottom$2,
86553
+ left: left$1,
86554
+ right: right$1,
86555
+ "left-top-end": "_left-top-end_nbkwy_57",
86556
+ "right-top-end": "_right-top-end_nbkwy_65",
86557
+ "left-bottom-end": "_left-bottom-end_nbkwy_73",
86558
+ "right-bottom-end": "_right-bottom-end_nbkwy_81",
86559
+ "top-left": "_top-left_nbkwy_89",
86560
+ "top-right": "_top-right_nbkwy_97",
86561
+ "bottom-left": "_bottom-left_nbkwy_105",
86562
+ "bottom-right": "_bottom-right_nbkwy_113",
86563
+ "left-top": "_left-top_nbkwy_57",
86564
+ "left-bottom": "_left-bottom_nbkwy_73",
86565
+ "right-top": "_right-top_nbkwy_65",
86566
+ "right-bottom": "_right-bottom_nbkwy_81"
86533
86567
  };
86534
86568
  const Tooltip = ({
86535
86569
  children: children2,
86536
86570
  content: content2,
86537
- className = ""
86571
+ className = "",
86572
+ position: position2 = "bottom"
86538
86573
  }) => {
86539
86574
  return /* @__PURE__ */ jsxs("span", {
86540
86575
  className: `${styles$m.container} ${className}`,
86541
86576
  children: [content2, /* @__PURE__ */ jsx("span", {
86542
- className: styles$m.tooltip,
86577
+ className: `${styles$m.tooltip} ${styles$m[position2]}`,
86543
86578
  children: children2
86544
86579
  })]
86545
86580
  });
@@ -86547,7 +86582,8 @@ const Tooltip = ({
86547
86582
  const InfoTooltip = ({
86548
86583
  children: children2,
86549
86584
  className,
86550
- iconClass
86585
+ iconClass,
86586
+ position: position2
86551
86587
  }) => {
86552
86588
  return /* @__PURE__ */ jsx(Tooltip, {
86553
86589
  className,
@@ -86555,6 +86591,7 @@ const InfoTooltip = ({
86555
86591
  name: "info-icon",
86556
86592
  className: iconClass
86557
86593
  }),
86594
+ position: position2,
86558
86595
  children: children2
86559
86596
  });
86560
86597
  };
@@ -86679,24 +86716,25 @@ const Dataset = ({
86679
86716
  })]
86680
86717
  });
86681
86718
  };
86682
- const container$6 = "_container_j5bye_1";
86683
- const header$2 = "_header_j5bye_7";
86684
- const tab$2 = "_tab_j5bye_13";
86685
- const tabText$1 = "_tabText_j5bye_19";
86686
- const tabHeading = "_tabHeading_j5bye_25";
86687
- const form = "_form_j5bye_31";
86688
- const inputWrapper = "_inputWrapper_j5bye_37";
86689
- const input$1 = "_input_j5bye_37";
86690
- const selectWrapper = "_selectWrapper_j5bye_49";
86691
- const select = "_select_j5bye_49";
86692
- const label$1 = "_label_j5bye_61";
86693
- const series = "_series_j5bye_67";
86694
- const legendWrapper = "_legendWrapper_j5bye_73";
86695
- const seriesWrapper = "_seriesWrapper_j5bye_79";
86696
- const valueLabelWrapper = "_valueLabelWrapper_j5bye_85";
86697
- const singleCheckBox = "_singleCheckBox_j5bye_91";
86698
- const seriesCheck = "_seriesCheck_j5bye_97";
86699
- const seriesCheckContainer = "_seriesCheckContainer_j5bye_103";
86719
+ const container$6 = "_container_1pfol_1";
86720
+ const header$2 = "_header_1pfol_7";
86721
+ const tab$2 = "_tab_1pfol_13";
86722
+ const tabText$1 = "_tabText_1pfol_19";
86723
+ const tabHeading = "_tabHeading_1pfol_25";
86724
+ const form = "_form_1pfol_31";
86725
+ const inputWrapper = "_inputWrapper_1pfol_37";
86726
+ const input$1 = "_input_1pfol_37";
86727
+ const selectWrapper = "_selectWrapper_1pfol_49";
86728
+ const select = "_select_1pfol_49";
86729
+ const label$1 = "_label_1pfol_61";
86730
+ const labelFormatTooltip = "_labelFormatTooltip_1pfol_67";
86731
+ const series = "_series_1pfol_73";
86732
+ const legendWrapper = "_legendWrapper_1pfol_79";
86733
+ const seriesWrapper = "_seriesWrapper_1pfol_85";
86734
+ const valueLabelWrapper = "_valueLabelWrapper_1pfol_91";
86735
+ const singleCheckBox = "_singleCheckBox_1pfol_97";
86736
+ const seriesCheck = "_seriesCheck_1pfol_103";
86737
+ const seriesCheckContainer = "_seriesCheckContainer_1pfol_109";
86700
86738
  var styles$i = {
86701
86739
  container: container$6,
86702
86740
  header: header$2,
@@ -86709,6 +86747,7 @@ var styles$i = {
86709
86747
  selectWrapper,
86710
86748
  select,
86711
86749
  label: label$1,
86750
+ labelFormatTooltip,
86712
86751
  series,
86713
86752
  legendWrapper,
86714
86753
  seriesWrapper,
@@ -87138,14 +87177,41 @@ const ChartConfigure = ({
87138
87177
  }))
87139
87178
  })
87140
87179
  })]
87141
- }), chartType2 === "funnel" && /* @__PURE__ */ jsx(InputField, {
87142
- type: "checkbox",
87143
- label: "Show labels with values",
87144
- checked: customSettings.showLabelValues,
87145
- onChange: (e2) => setCustomSettings((settings2) => ({
87146
- ...settings2,
87147
- showLabelValues: e2.target.checked
87148
- }))
87180
+ }), chartType2 === "funnel" && /* @__PURE__ */ jsxs(Fragment, {
87181
+ children: [/* @__PURE__ */ jsx(InputField, {
87182
+ type: "checkbox",
87183
+ label: "Show labels with values",
87184
+ checked: customSettings.showLabelValues,
87185
+ onChange: (e2) => setCustomSettings((settings2) => ({
87186
+ ...settings2,
87187
+ showLabelValues: e2.target.checked
87188
+ }))
87189
+ }), /* @__PURE__ */ jsx(InputField, {
87190
+ type: "checkbox",
87191
+ label: "Show Conversion Rate",
87192
+ checked: customSettings.showConversionRate,
87193
+ onChange: (e2) => setCustomSettings((settings2) => ({
87194
+ ...settings2,
87195
+ showConversionRate: e2.target.checked
87196
+ }))
87197
+ }), /* @__PURE__ */ jsx(InputField, {
87198
+ type: "text",
87199
+ label: "Label Format",
87200
+ icon: /* @__PURE__ */ jsx("span", {
87201
+ className: styles$i.labelFormatTooltip,
87202
+ children: /* @__PURE__ */ jsx(InfoTooltip, {
87203
+ position: "left-top-end",
87204
+ children: `Please use {b} to show the label name, {c} to show the label value.
87205
+ Note: Only works if the above options are not selected.`
87206
+ })
87207
+ }),
87208
+ placeholder: "{b}",
87209
+ value: customSettings.labelFormat,
87210
+ onChange: (e2) => setCustomSettings((settings2) => ({
87211
+ ...settings2,
87212
+ labelFormat: e2.target.value
87213
+ }))
87214
+ })]
87149
87215
  }), chartType2 !== "pie" && chartType2 !== "doughnut" && chartType2 !== "funnel" && chartType2 !== "gauge" && chartType2 !== "sankey" && chartType2 !== "singleValue" && chartType2 !== "table" && /* @__PURE__ */ jsxs(Fragment, {
87150
87216
  children: [/* @__PURE__ */ jsxs("div", {
87151
87217
  className: styles$i.seriesWrapper,