@sentio/ui-dashboard 0.2.3 → 0.2.6

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/dist/index.js CHANGED
@@ -38,6 +38,8 @@ __export(index_exports, {
38
38
  BarGuageIcon: () => BarGuageIcon_default,
39
39
  BarIcon: () => BarIcon_default,
40
40
  ChartLegend: () => ChartLegend,
41
+ ChartTooltip: () => ChartTooltip,
42
+ ChartTypeButtonGroup: () => ChartTypeButtonGroup,
41
43
  EventsFunctionCategories: () => EventsFunctionCategories,
42
44
  EventsFunctionMap: () => EventsFunctionMap,
43
45
  FunctionInput: () => FunctionInput,
@@ -49,12 +51,14 @@ __export(index_exports, {
49
51
  LabelsInput: () => LabelsInput,
50
52
  LineControls: () => LineControls,
51
53
  LineIcon: () => LineIcon_default,
54
+ PieChart: () => PieChart2,
52
55
  PieChartControls: () => PieChartControls,
53
56
  PieIcon: () => PieIcon_default,
54
57
  QueryValueIcon: () => QueryValueIcon_default,
55
58
  ReactEChartsBase: () => ReactEChartsBase,
56
59
  RefreshButton: () => RefreshButton,
57
60
  RefreshContext: () => RefreshContext,
61
+ ScatterChartTooltip: () => ScatterChartTooltip,
58
62
  ScatterIcon: () => ScatterIcon_default,
59
63
  SystemLabels: () => SystemLabels,
60
64
  TableIcon: () => TableIcon_default,
@@ -2618,1227 +2622,1973 @@ var RefreshButton = (props) => {
2618
2622
  ) });
2619
2623
  };
2620
2624
 
2621
- // src/charts/options/LineControls.tsx
2622
- var import_immer4 = require("immer");
2625
+ // src/charts/ChartTypeButtonGroup.tsx
2626
+ var import_react14 = require("react");
2627
+ var import_react_resize_detector2 = require("react-resize-detector");
2623
2628
  var import_ui_core8 = require("@sentio/ui-core");
2629
+
2630
+ // src/charts/icons/BarGuageIcon.tsx
2624
2631
  var import_jsx_runtime11 = require("react/jsx-runtime");
2625
- var lineStyles = [
2626
- { label: "Solid", value: "Solid" },
2627
- { label: "Dotted", value: "Dotted" }
2628
- ];
2629
- var LineControls = ({ config, defaultOpen, onChange }) => {
2630
- const setStyle = (style) => {
2631
- onChange(
2632
- (0, import_immer4.produce)(config || {}, (draft) => {
2633
- draft.style = style;
2634
- })
2635
- );
2636
- };
2637
- const setSmooth = (smooth) => {
2638
- onChange(
2639
- (0, import_immer4.produce)(config || {}, (draft) => {
2640
- draft.smooth = smooth;
2641
- })
2642
- );
2643
- };
2644
- return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
2645
- import_ui_core8.DisclosurePanel,
2646
- {
2647
- title: "Line style",
2648
- containerClassName: "w-full bg-default-bg",
2649
- children: /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "flex items-center gap-4", children: [
2650
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
2651
- import_ui_core8.NewButtonGroup,
2632
+ var SvgIcon = ({ className }) => /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
2633
+ "svg",
2634
+ {
2635
+ width: "14",
2636
+ height: "14",
2637
+ viewBox: "0 0 14 14",
2638
+ fill: "currentColor",
2639
+ className,
2640
+ xmlns: "http://www.w3.org/2000/svg",
2641
+ children: [
2642
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
2643
+ "path",
2644
+ {
2645
+ d: "M2.12791 1.5625V12.4375C2.12791 12.5938 2.07311 12.7267 1.96349 12.836C1.85387 12.9453 1.7207 13 1.56396 13C1.40722 13 1.27404 12.9453 1.16442 12.836C1.05481 12.7267 1 12.5938 1 12.4375V1.5625C1 1.40617 1.05481 1.27333 1.16442 1.164C1.27404 1.05467 1.40722 1 1.56396 1C1.7207 1 1.85387 1.05467 1.96349 1.164C2.07311 1.27333 2.12791 1.40617 2.12791 1.5625ZM1.56396 11.875H12.436C12.5928 11.875 12.726 11.9297 12.8356 12.039C12.9452 12.1483 13 12.2812 13 12.4375C13 12.5938 12.9452 12.7267 12.8356 12.836C12.726 12.9453 12.5928 13 12.436 13H1.56396C1.40722 13 1.27404 12.9453 1.16442 12.836C1.05481 12.7267 1 12.5938 1 12.4375C1 12.2812 1.05481 12.1483 1.16442 12.039C1.27404 11.9297 1.40722 11.875 1.56396 11.875Z",
2646
+ fill: "currentColor"
2647
+ }
2648
+ ),
2649
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
2650
+ "path",
2651
+ {
2652
+ d: "M3.64159 4.02495H9.43859C9.59493 4.02495 9.72776 3.97014 9.83709 3.86052C9.94643 3.75091 10.0011 3.61773 10.0011 3.46099C10.0011 3.30425 9.94643 3.17108 9.83709 3.06146C9.72776 2.95184 9.59493 2.89703 9.43859 2.89703L3.64159 2.89703C3.48526 2.89703 3.35243 2.95184 3.24309 3.06146C3.13376 3.17108 3.07909 3.30425 3.07909 3.46099C3.07909 3.61773 3.13376 3.75091 3.24309 3.86052C3.35243 3.97014 3.48526 4.02495 3.64159 4.02495Z",
2653
+ fill: "currentColor"
2654
+ }
2655
+ ),
2656
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
2657
+ "path",
2658
+ {
2659
+ d: "M3.64209 10.0244H11.4701C11.6264 10.0244 11.7593 9.96964 11.8686 9.86002C11.9779 9.7504 12.0326 9.61723 12.0326 9.46049C12.0326 9.30375 11.9779 9.17057 11.8686 9.06096C11.7593 8.95134 11.6264 8.89653 11.4701 8.89653H3.64209C3.48576 8.89653 3.35293 8.95134 3.24359 9.06096C3.13426 9.17057 3.07959 9.30375 3.07959 9.46049C3.07959 9.61723 3.13426 9.7504 3.24359 9.86002C3.35293 9.96964 3.48576 10.0244 3.64209 10.0244Z",
2660
+ fill: "currentColor"
2661
+ }
2662
+ ),
2663
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
2664
+ "path",
2665
+ {
2666
+ d: "M3.64209 7.01668L7.47009 7.01668C7.62643 7.01634 7.75926 6.95886 7.86859 6.84423C7.97793 6.7296 8.03259 6.5991 8.03259 6.45272C8.03259 6.29598 7.97793 6.1628 7.86859 6.05319C7.75926 5.94357 7.62643 5.88876 7.47009 5.88876H3.64209C3.48576 5.88876 3.35293 5.94357 3.24359 6.05319C3.13426 6.1628 3.07959 6.29598 3.07959 6.45272C3.07959 6.60946 3.13426 6.74263 3.24359 6.85225C3.35293 6.96187 3.48576 7.01668 3.64209 7.01668Z",
2667
+ fill: "currentColor"
2668
+ }
2669
+ )
2670
+ ]
2671
+ }
2672
+ );
2673
+ var BarGuageIcon_default = SvgIcon;
2674
+
2675
+ // src/charts/icons/QueryValueIcon.tsx
2676
+ var import_jsx_runtime12 = require("react/jsx-runtime");
2677
+ var SvgIcon2 = ({ className }) => /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
2678
+ "svg",
2679
+ {
2680
+ width: "14",
2681
+ height: "14",
2682
+ viewBox: "0 0 14 14",
2683
+ fill: "none",
2684
+ className,
2685
+ xmlns: "http://www.w3.org/2000/svg",
2686
+ children: [
2687
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("g", { clipPath: "url(#clip0_3670_4424)", children: [
2688
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
2689
+ "path",
2652
2690
  {
2653
- buttons: lineStyles,
2654
- value: config?.style || "Solid",
2655
- onChange: setStyle,
2656
- small: true
2691
+ d: "M11.5 1.5H2.5C1.67157 1.5 1 2.11561 1 2.875V11.125C1 11.8844 1.67157 12.5 2.5 12.5H11.5C12.3284 12.5 13 11.8844 13 11.125V2.875C13 2.11561 12.3284 1.5 11.5 1.5Z",
2692
+ stroke: "currentColor",
2693
+ strokeWidth: "1.16667",
2694
+ strokeLinecap: "round",
2695
+ strokeLinejoin: "round"
2657
2696
  }
2658
2697
  ),
2659
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
2660
- import_ui_core8.Checkbox,
2698
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
2699
+ "path",
2661
2700
  {
2662
- label: "Smooth Curves",
2663
- checked: config?.smooth,
2664
- onChange: setSmooth
2701
+ d: "M7.98188 5.77273H6.39097L5.75461 5.13636L6.39097 4.5H7.98188L8.61824 5.13636L7.98188 5.77273Z",
2702
+ fill: "currentColor"
2665
2703
  }
2666
- )
2667
- ] })
2668
- }
2669
- );
2670
- };
2671
-
2672
- // src/charts/options/LabelControls.tsx
2673
- var import_react14 = require("react");
2674
- var import_immer5 = require("immer");
2675
- var import_ui_core9 = require("@sentio/ui-core");
2676
- var import_jsx_runtime12 = require("react/jsx-runtime");
2677
- var initialConfig = {
2678
- columns: [],
2679
- alias: ""
2680
- };
2681
- var LabelControls = ({ config, setConfig, defaultOpen }) => {
2682
- (0, import_react14.useEffect)(() => {
2683
- if (config?.columns && config.columns.length > 0 && !config.alias) {
2684
- const aliasParts = [];
2685
- config.columns.forEach((colConfig) => {
2686
- if (!colConfig.name) return;
2687
- if (colConfig.showLabel === false && colConfig.showValue === false) {
2688
- } else if (colConfig.showValue === false) {
2689
- aliasParts.push(colConfig.name);
2690
- } else {
2691
- aliasParts.push(`{{${colConfig.name}}}`);
2692
- }
2693
- });
2694
- if (aliasParts.length > 0) {
2695
- const migratedAlias = aliasParts.join(", ");
2696
- setConfig(
2697
- (0, import_immer5.produce)(config, (draft) => {
2698
- draft.alias = migratedAlias;
2699
- draft.columns = [];
2700
- })
2701
- );
2702
- }
2703
- }
2704
- }, [config, setConfig]);
2705
- const onAliasChanged = (alias) => {
2706
- setConfig(
2707
- (0, import_immer5.produce)(config ?? initialConfig, (draft) => {
2708
- draft.alias = alias;
2709
- })
2710
- );
2711
- };
2712
- const _defaultOpen = (0, import_react14.useMemo)(() => {
2713
- if (defaultOpen) {
2714
- return true;
2715
- }
2716
- return config?.alias !== "" || config?.columns && config.columns.length > 0;
2717
- }, [config, defaultOpen]);
2718
- return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
2719
- import_ui_core9.DisclosurePanel,
2720
- {
2721
- title: "Label Controls",
2722
- defaultOpen: _defaultOpen,
2723
- containerClassName: "w-full bg-default-bg",
2724
- children: /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "flex items-center gap-2", children: [
2725
- /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "inline-flex h-8", children: [
2726
- /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("span", { className: "sm:text-icontent border-main inline-flex items-center rounded-l-md border border-r-0 bg-gray-50 px-2 font-medium", children: [
2727
- "Label Alias",
2728
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
2729
- import_ui_core9.HelpIcon,
2730
- {
2731
- text: /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "text-icontent text-text-foreground", children: [
2732
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { children: "Series name override or template." }),
2733
- /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { children: [
2734
- "Ex.",
2735
- " ",
2736
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { className: "text-primary mx-1 font-semibold italic", children: "{{contract}}" }),
2737
- " ",
2738
- "will be replaced with the value of the contract label."
2739
- ] })
2740
- ] })
2741
- }
2742
- )
2743
- ] }),
2744
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
2745
- "input",
2746
- {
2747
- type: "text",
2748
- value: config?.alias || "",
2749
- onChange: (e) => onAliasChanged(e.target.value),
2750
- placeholder: "Enter alias...",
2751
- className: "focus:border-primary-500 sm:text-icontent border-main inline-flex w-64 items-center rounded-r-md border px-2"
2752
- }
2753
- )
2754
- ] }),
2704
+ ),
2755
2705
  /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
2756
- import_ui_core9.Button,
2706
+ "path",
2757
2707
  {
2758
- type: "button",
2759
- role: "link",
2760
- onClick: () => {
2761
- setConfig(initialConfig);
2762
- },
2763
- children: "Reset"
2708
+ d: "M7.98188 11.5H6.39097L5.75461 10.8637L6.39097 10.2273H7.98188L8.61824 10.8637L7.98188 11.5Z",
2709
+ fill: "currentColor"
2764
2710
  }
2765
- )
2766
- ] })
2767
- }
2768
- );
2769
- };
2770
-
2771
- // src/charts/options/PieChartControls.tsx
2772
- var import_immer6 = require("immer");
2773
- var import_lodash3 = require("lodash");
2774
- var import_ui_core10 = require("@sentio/ui-core");
2775
- var import_jsx_runtime13 = require("react/jsx-runtime");
2776
- var defaultConfig = {
2777
- pieType: "Pie",
2778
- calculation: "LAST",
2779
- showPercent: true,
2780
- showValue: true,
2781
- absValue: false
2782
- };
2783
- var CalculationItems = [
2784
- { label: "Last", value: "LAST" },
2785
- { label: "First", value: "FIRST" },
2786
- { label: "Total", value: "TOTAL" },
2787
- { label: "Mean", value: "MEAN" },
2788
- { label: "Max", value: "MAX" },
2789
- { label: "Min", value: "MIN" }
2790
- ];
2791
- var PieTypeItems = [
2792
- { label: "Pie", value: "Pie" },
2793
- { label: "Donut", value: "Donut" }
2794
- ];
2795
- function PieChartControls({ config, defaultOpen, onChange }) {
2796
- config = (0, import_lodash3.defaults)(config, defaultConfig);
2797
- function onCalculationChange(cal) {
2798
- config && onChange((0, import_immer6.produce)(config, (draft) => void (draft.calculation = cal)));
2799
- }
2800
- function onPieTypeChange(pieType) {
2801
- config && onChange((0, import_immer6.produce)(config, (draft) => void (draft.pieType = pieType)));
2802
- }
2803
- function toggle(field, value) {
2804
- config && onChange(
2805
- (0, import_immer6.produce)(config, (draft) => {
2806
- draft[field] = value;
2807
- })
2808
- );
2809
- }
2810
- return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
2811
- import_ui_core10.DisclosurePanel,
2812
- {
2813
- title: "Pie Chart Options",
2814
- defaultOpen,
2815
- containerClassName: "w-full bg-default-bg",
2816
- children: /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "flex items-center gap-4", children: [
2817
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: "shadow-xs flex rounded-md", children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
2818
- import_ui_core10.NewButtonGroup,
2711
+ ),
2712
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
2713
+ "path",
2819
2714
  {
2820
- small: true,
2821
- buttons: PieTypeItems,
2822
- value: config.pieType,
2823
- onChange: onPieTypeChange
2715
+ d: "M8.30005 9.90907V6.09089L8.93641 5.45453L9.57278 6.09089V9.90907L8.93641 10.5454L8.30005 9.90907Z",
2716
+ fill: "currentColor"
2824
2717
  }
2825
- ) }),
2826
- /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "shadow-xs flex rounded-md", children: [
2827
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { className: "sm:text-ilabel border-main inline-flex items-center rounded-l-md border border-r-0 bg-gray-50 px-3 ", children: "Calculation" }),
2828
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
2829
- "select",
2830
- {
2831
- value: config.calculation,
2832
- className: "sm:text-ilabel text-text-foreground border-main hover:border-primary-600 focus:ring-3 focus:ring-primary-600/30 focus:border-primary-600 inline-flex items-center rounded-r-md border pl-4 pr-7",
2833
- onChange: (e) => onCalculationChange(e.target.value),
2834
- children: CalculationItems.map((d) => {
2835
- return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("option", { value: d.value, children: d.label }, d.value);
2836
- })
2837
- }
2838
- )
2839
- ] }),
2840
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
2841
- import_ui_core10.Checkbox,
2718
+ ),
2719
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
2720
+ "path",
2842
2721
  {
2843
- checked: config?.showValue,
2844
- onChange: (v) => toggle("showValue", v),
2845
- label: "Show value",
2846
- labelClassName: "whitespace-nowrap"
2722
+ d: "M4.80005 9.90907V6.09089L5.43641 5.45453L6.07278 6.09089V9.90907L5.43641 10.5454L4.80005 9.90907Z",
2723
+ fill: "currentColor"
2847
2724
  }
2848
2725
  ),
2726
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
2727
+ "path",
2728
+ {
2729
+ d: "M1 3.5L13 3.5",
2730
+ stroke: "currentColor",
2731
+ strokeWidth: "1.16667",
2732
+ strokeLinecap: "round",
2733
+ strokeLinejoin: "round"
2734
+ }
2735
+ )
2736
+ ] }),
2737
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("defs", { children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("clipPath", { id: "clip0_3670_4424", children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("rect", { width: "14", height: "14", fill: "white" }) }) })
2738
+ ]
2739
+ }
2740
+ );
2741
+ var QueryValueIcon_default = SvgIcon2;
2742
+
2743
+ // src/charts/icons/TableIcon.tsx
2744
+ var import_jsx_runtime13 = require("react/jsx-runtime");
2745
+ var SvgIcon3 = ({ className }) => /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
2746
+ "svg",
2747
+ {
2748
+ width: "14",
2749
+ height: "14",
2750
+ viewBox: "0 0 14 14",
2751
+ fill: "none",
2752
+ xmlns: "http://www.w3.org/2000/svg",
2753
+ className,
2754
+ children: [
2755
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("g", { clipPath: "url(#clip0_3670_4416)", children: [
2849
2756
  /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
2850
- import_ui_core10.Checkbox,
2757
+ "path",
2851
2758
  {
2852
- checked: config?.showPercent,
2853
- onChange: (v) => toggle("showPercent", v),
2854
- label: "Show percent",
2855
- labelClassName: "whitespace-nowrap"
2759
+ d: "M11.5 2H2.5C1.67157 2 1 2.55964 1 3.25V10.75C1 11.4404 1.67157 12 2.5 12H11.5C12.3284 12 13 11.4404 13 10.75V3.25C13 2.55964 12.3284 2 11.5 2Z",
2760
+ stroke: "currentColor",
2761
+ strokeWidth: "1.16667",
2762
+ strokeLinecap: "round",
2763
+ strokeLinejoin: "round"
2856
2764
  }
2857
2765
  ),
2858
2766
  /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
2859
- import_ui_core10.Checkbox,
2767
+ "path",
2860
2768
  {
2861
- checked: config?.absValue,
2862
- onChange: (v) => toggle("absValue", v),
2863
- label: "Use absolute values",
2864
- labelClassName: "whitespace-nowrap"
2769
+ d: "M1 5L13 5",
2770
+ stroke: "currentColor",
2771
+ strokeWidth: "1.16667",
2772
+ strokeLinecap: "round",
2773
+ strokeLinejoin: "round"
2774
+ }
2775
+ ),
2776
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
2777
+ "path",
2778
+ {
2779
+ d: "M6 2L6 12",
2780
+ stroke: "currentColor",
2781
+ strokeWidth: "1.16667",
2782
+ strokeLinecap: "round",
2783
+ strokeLinejoin: "round"
2865
2784
  }
2866
2785
  )
2867
- ] })
2868
- }
2869
- );
2870
- }
2786
+ ] }),
2787
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("defs", { children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("clipPath", { id: "clip0_3670_4416", children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("rect", { width: "14", height: "14", fill: "white" }) }) })
2788
+ ]
2789
+ }
2790
+ );
2791
+ var TableIcon_default = SvgIcon3;
2871
2792
 
2872
- // src/charts/options/BarGaugeControls.tsx
2873
- var import_immer7 = require("immer");
2874
- var import_lodash4 = require("lodash");
2875
- var import_ui_core11 = require("@sentio/ui-core");
2793
+ // src/charts/icons/AreaIcon.tsx
2876
2794
  var import_jsx_runtime14 = require("react/jsx-runtime");
2877
- var defaultConfig2 = {
2878
- direction: "HORIZONTAL",
2879
- calculation: "LAST",
2880
- sort: {
2881
- sortBy: "ByName",
2882
- orderDesc: true
2883
- }
2884
- };
2885
- var directionItems = [
2886
- { label: "Horizontal", value: "HORIZONTAL" },
2887
- { label: "Vertical", value: "VERTICAL" }
2888
- ];
2889
- var CalculationItems2 = [
2890
- { label: "Last", value: "LAST" },
2891
- { label: "First", value: "FIRST" },
2892
- { label: "Total", value: "TOTAL" },
2893
- { label: "Mean", value: "MEAN" },
2894
- { label: "Max", value: "MAX" },
2895
- { label: "Min", value: "MIN" }
2896
- ];
2897
- var sortByItems = [
2898
- { label: "Name", value: "ByName" },
2899
- { label: "Value", value: "ByValue" }
2900
- ];
2901
- var orderItems = [
2902
- { label: "Ascendant", value: "false" },
2903
- { label: "Descendant", value: "true" }
2904
- ];
2905
- function BarGaugeControls({ config, defaultOpen, onChange }) {
2906
- config = (0, import_lodash4.defaults)(config, defaultConfig2);
2907
- function onCalculationChange(cal) {
2908
- config && onChange((0, import_immer7.produce)(config, (draft) => void (draft.calculation = cal)));
2909
- }
2910
- function onDirectionChange(dir) {
2911
- config && onChange((0, import_immer7.produce)(config, (draft) => void (draft.direction = dir)));
2912
- }
2913
- function onOrderChange(orderDesc) {
2914
- config && onChange(
2915
- (0, import_immer7.produce)(config, (draft) => {
2916
- draft.sort = draft.sort || {};
2917
- draft.sort.orderDesc = orderDesc;
2918
- })
2919
- );
2920
- }
2921
- function onSortByChange(sortBy2) {
2922
- config && onChange(
2923
- (0, import_immer7.produce)(config, (draft) => {
2924
- draft.sort = draft.sort || {};
2925
- draft.sort.sortBy = sortBy2;
2926
- })
2927
- );
2795
+ var SvgIcon4 = ({ className }) => /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
2796
+ "svg",
2797
+ {
2798
+ width: "14",
2799
+ height: "14",
2800
+ viewBox: "0 0 14 14",
2801
+ fill: "none",
2802
+ xmlns: "http://www.w3.org/2000/svg",
2803
+ className,
2804
+ children: [
2805
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("g", { clipPath: "url(#clip0_1774_9545)", children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
2806
+ "path",
2807
+ {
2808
+ d: "M12.6193 13.1249H1.35364C1.21685 13.1249 1.10062 13.0771 1.00495 12.9814C0.909284 12.8857 0.86145 12.7695 0.86145 12.6327V1.35352C0.86145 1.21672 0.909284 1.10049 1.00495 1.00483C1.10062 0.909161 1.21685 0.861328 1.35364 0.861328C1.49043 0.861328 1.60666 0.909161 1.70233 1.00483C1.79799 1.10049 1.84583 1.21672 1.84583 1.35352V12.1405H12.6193C12.7561 12.1405 12.8723 12.1883 12.968 12.284C13.0636 12.3797 13.1115 12.4959 13.1115 12.6327C13.1115 12.7695 13.0636 12.8857 12.968 12.9814C12.8723 13.0771 12.7561 13.1249 12.6193 13.1249ZM2.62501 10.9374L4.22451 8.08008C4.26097 8.0162 4.31566 7.97289 4.38858 7.95014C4.46149 7.92739 4.53441 7.92972 4.60733 7.95714L6.12501 8.66808L7.73851 6.33008C7.83885 6.19329 7.96193 6.16135 8.10776 6.23427L9.61189 6.99989L11.7994 3.56814C11.8633 3.46781 11.9521 3.43368 12.0658 3.46577C12.1796 3.49785 12.2366 3.5731 12.2369 3.69152V10.8009C12.2369 10.9467 12.1845 11.072 12.0798 11.1767C11.9751 11.2814 11.8498 11.3338 11.704 11.3338H2.87176C2.77143 11.3338 2.69399 11.2905 2.63945 11.2038C2.58491 11.1172 2.58039 11.0284 2.62589 10.9374H2.62501Z",
2809
+ fill: "currentColor"
2810
+ }
2811
+ ) }),
2812
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("defs", { children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("clipPath", { id: "clip0_1774_9545", children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("rect", { width: "14", height: "14", fill: "white" }) }) })
2813
+ ]
2928
2814
  }
2929
- return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
2930
- import_ui_core11.DisclosurePanel,
2931
- {
2932
- title: "Bar Gauge Options",
2933
- defaultOpen,
2934
- containerClassName: "w-full bg-default-bg",
2935
- children: /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "flex items-center gap-4", children: [
2936
- /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "shadow-xs flex rounded-md", children: [
2937
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: "sm:text-ilabel border-main inline-flex items-center rounded-l-md border border-r-0 bg-gray-50 px-3 ", children: "Direction" }),
2938
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
2939
- "select",
2940
- {
2941
- value: config.direction,
2942
- className: "sm:text-ilabel border-main text-text-foreground hover:border-primary-600 focus:ring-3 focus:ring-primary-600/30 focus:border-primary-600 inline-flex items-center rounded-r-md border pl-4 pr-7",
2943
- onChange: (e) => onDirectionChange(e.target.value),
2944
- children: directionItems.map((d) => {
2945
- return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("option", { value: d.value, children: d.label }, d.value);
2946
- })
2947
- }
2948
- )
2949
- ] }),
2950
- /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "shadow-xs flex rounded-md", children: [
2951
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: "sm:text-ilabel border-main inline-flex items-center rounded-l-md border border-r-0 bg-gray-50 px-3 ", children: "Calculation" }),
2952
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
2953
- "select",
2954
- {
2955
- value: config.calculation,
2956
- className: "sm:text-ilabel border-main text-text-foreground hover:border-primary-600 focus:ring-3 focus:ring-primary-600/30 focus:border-primary-600 inline-flex items-center rounded-r-md border pl-4 pr-7",
2957
- onChange: (e) => onCalculationChange(e.target.value),
2958
- children: CalculationItems2.map((d) => {
2959
- return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("option", { value: d.value, children: d.label }, d.value);
2960
- })
2961
- }
2962
- )
2963
- ] }),
2964
- /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "shadow-xs flex rounded-md", children: [
2965
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: "sm:text-ilabel border-main inline-flex items-center whitespace-nowrap rounded-l-md border border-r-0 bg-gray-50 px-3", children: "Sort by" }),
2966
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
2967
- "select",
2968
- {
2969
- value: config?.sort?.sortBy,
2970
- className: "sm:text-ilabel border-main text-text-foreground hover:border-primary-600 focus:ring-3 focus:ring-primary-600/30 focus:border-primary-600 inline-flex items-center border pl-4 pr-7",
2971
- onChange: (e) => onSortByChange(e.target.value),
2972
- children: sortByItems.map((d) => {
2973
- return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("option", { value: d.value, children: d.label }, d.value);
2974
- })
2975
- }
2976
- ),
2977
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
2978
- "select",
2979
- {
2980
- value: config?.sort?.orderDesc + "",
2981
- className: "sm:text-ilabel border-main text-text-foreground hover:border-primary-600 focus:ring-3 focus:ring-primary-600/30 focus:border-primary-600 inline-flex items-center rounded-r-md border border-l-0 pl-4 pr-7",
2982
- onChange: (e) => onOrderChange(e.target.value === "true"),
2983
- children: orderItems.map((d) => {
2984
- return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("option", { value: d.value + "", children: d.label }, d.label);
2985
- })
2986
- }
2987
- )
2988
- ] })
2989
- ] })
2990
- }
2991
- );
2992
- }
2993
-
2994
- // src/charts/options/ValueOptions.tsx
2995
- var import_immer9 = require("immer");
2996
- var import_ui_core13 = require("@sentio/ui-core");
2815
+ );
2816
+ var AreaIcon_default = SvgIcon4;
2997
2817
 
2998
- // src/charts/options/ValueStringMapping.tsx
2999
- var import_lu3 = require("react-icons/lu");
3000
- var import_ui_core12 = require("@sentio/ui-core");
3001
- var import_immer8 = require("immer");
2818
+ // src/charts/icons/BarIcon.tsx
3002
2819
  var import_jsx_runtime15 = require("react/jsx-runtime");
3003
- var operators = {
3004
- ">": "greater than",
3005
- ">=": "greater or equal",
3006
- "==": "equal",
3007
- "!=": "not equal",
3008
- "<": "less than",
3009
- "<=": "less or equal"
3010
- };
3011
- var renderTreeLine = (index, isLast) => {
3012
- return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "mr-2 flex h-12 w-3 flex-col items-center justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "flex h-full w-full items-center", children: [
3013
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
3014
- "div",
2820
+ var SvgIcon5 = ({ className }) => /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
2821
+ "svg",
2822
+ {
2823
+ width: "14",
2824
+ height: "14",
2825
+ viewBox: "0 0 14 14",
2826
+ fill: "none",
2827
+ xmlns: "http://www.w3.org/2000/svg",
2828
+ className,
2829
+ children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
2830
+ "path",
3015
2831
  {
3016
- className: (0, import_ui_core12.classNames)(
3017
- "w-px bg-gray-300",
3018
- isLast ? "h-1/2 self-start" : index === 0 ? "h-full self-end" : "h-full"
3019
- )
2832
+ d: "M2.12791 1.5625V12.4375C2.12791 12.5938 2.07311 12.7267 1.96349 12.836C1.85387 12.9453 1.7207 13 1.56396 13C1.40722 13 1.27404 12.9453 1.16442 12.836C1.05481 12.7267 1 12.5938 1 12.4375V1.5625C1 1.40617 1.05481 1.27333 1.16442 1.164C1.27404 1.05467 1.40722 1 1.56396 1C1.7207 1 1.85387 1.05467 1.96349 1.164C2.07311 1.27333 2.12791 1.40617 2.12791 1.5625ZM1.56396 11.875H12.436C12.5928 11.875 12.726 11.9297 12.8356 12.039C12.9452 12.1483 13 12.2812 13 12.4375C13 12.5938 12.9452 12.7267 12.8356 12.836C12.726 12.9453 12.5928 13 12.436 13H1.56396C1.40722 13 1.27404 12.9453 1.16442 12.836C1.05481 12.7267 1 12.5938 1 12.4375C1 12.2812 1.05481 12.1483 1.16442 12.039C1.27404 11.9297 1.40722 11.875 1.56396 11.875ZM5.12014 4.578V10.375C5.12014 10.5313 5.06534 10.6642 4.95572 10.7735C4.8461 10.8828 4.71293 10.9375 4.55619 10.9375C4.39945 10.9375 4.26627 10.8828 4.15665 10.7735C4.04704 10.6642 3.99223 10.5313 3.99223 10.375V4.578C3.99223 4.42167 4.04704 4.28883 4.15665 4.1795C4.26627 4.07017 4.39945 4.0155 4.55619 4.0155C4.71293 4.0155 4.8461 4.07017 4.95572 4.1795C5.06534 4.28883 5.12014 4.42167 5.12014 4.578ZM11.1196 2.5465V10.3745C11.1196 10.5308 11.0648 10.6637 10.9552 10.773C10.8456 10.8823 10.7124 10.937 10.5557 10.937C10.3989 10.937 10.2658 10.8823 10.1562 10.773C10.0465 10.6637 9.99173 10.5308 9.99173 10.3745V2.5465C9.99173 2.39017 10.0465 2.25733 10.1562 2.148C10.2658 2.03867 10.3989 1.984 10.5557 1.984C10.7124 1.984 10.8456 2.03867 10.9552 2.148C11.0648 2.25733 11.1196 2.39017 11.1196 2.5465ZM8.11187 6.5465V10.3745C8.11187 10.5308 8.05706 10.6637 7.94745 10.773C7.83783 10.8823 7.70465 10.937 7.54792 10.937C7.39118 10.937 7.258 10.8823 7.14838 10.773C7.03877 10.6637 6.98396 10.5308 6.98396 10.3745V6.5465C6.98396 6.39017 7.03877 6.25733 7.14838 6.148C7.258 6.03867 7.39118 5.984 7.54792 5.984C7.69429 5.984 7.8248 6.03867 7.93943 6.148C8.05406 6.25733 8.11154 6.39017 8.11187 6.5465Z",
2833
+ fill: "currentColor"
3020
2834
  }
3021
- ),
3022
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "h-px w-3 bg-gray-300" })
3023
- ] }) });
3024
- };
3025
- function ValueStringMapping({ rules, onChange }) {
3026
- const addRule = () => {
3027
- onChange(
3028
- (0, import_immer8.produce)(rules, (draft) => {
3029
- draft = draft || [];
3030
- draft.push({
3031
- comparison: "==",
3032
- value: 0,
3033
- text: ""
3034
- });
3035
- })
3036
- );
3037
- };
3038
- function removeRule(index) {
3039
- onChange(
3040
- (0, import_immer8.produce)(rules, (draft) => {
3041
- draft.splice(index, 1);
3042
- })
3043
- );
3044
- }
3045
- function changeRule(index, field, value) {
3046
- onChange(
3047
- (0, import_immer8.produce)(rules, (draft) => {
3048
- ;
3049
- draft[index][field] = value;
3050
- })
3051
- );
2835
+ )
3052
2836
  }
3053
- return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "flex w-full flex-col rounded-md py-2", children: [
3054
- (rules || []).map((rule, index) => {
3055
- const isLast = index === (rules || []).length - 1;
3056
- return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
3057
- "div",
3058
- {
3059
- className: "text-text-foreground flex h-10 items-center py-1",
3060
- children: [
3061
- renderTreeLine(index, isLast),
3062
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "sm:text-ilabel inline-flex h-full items-center pr-3 font-medium", children: "If value is" }),
3063
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
3064
- "select",
3065
- {
3066
- value: rule.comparison,
3067
- onChange: (e) => changeRule(index, "comparison", e.target.value),
3068
- className: "rounded-r-0 sm:text-ilabel border-main text-text-foreground focus:border-primary-600 focus:ring-3 focus:ring-primary-600/30 inline-flex h-full items-center rounded-l-md border border-r-0 bg-gray-50 py-1 pl-4 pr-7",
3069
- children: Object.entries(operators).map(([op, display]) => {
3070
- return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("option", { value: op, children: [
3071
- "is ",
3072
- display
3073
- ] }, op);
3074
- })
2837
+ );
2838
+ var BarIcon_default = SvgIcon5;
2839
+
2840
+ // src/charts/icons/LineIcon.tsx
2841
+ var import_jsx_runtime16 = require("react/jsx-runtime");
2842
+ var SvgIcon6 = ({ className }) => /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
2843
+ "svg",
2844
+ {
2845
+ width: "14",
2846
+ height: "14",
2847
+ viewBox: "0 0 14 14",
2848
+ fill: "none",
2849
+ xmlns: "http://www.w3.org/2000/svg",
2850
+ className,
2851
+ children: [
2852
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("g", { clipPath: "url(#clip0_1774_9563)", children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
2853
+ "path",
2854
+ {
2855
+ d: "M12.6191 13.1249H1.35352C1.21672 13.1249 1.10049 13.0771 1.00483 12.9814C0.909161 12.8857 0.861328 12.7695 0.861328 12.6327V1.35352C0.861328 1.21672 0.909161 1.10049 1.00483 1.00483C1.10049 0.909161 1.21672 0.861328 1.35352 0.861328C1.49031 0.861328 1.60654 0.909161 1.7022 1.00483C1.79787 1.10049 1.8457 1.21672 1.8457 1.35352V12.1405H12.6191C12.7559 12.1405 12.8722 12.1883 12.9678 12.284C13.0635 12.3797 13.1113 12.4959 13.1113 12.6327C13.1113 12.7695 13.0635 12.8857 12.9678 12.9814C12.8722 13.0771 12.7559 13.1249 12.6191 13.1249ZM5.26345 10.1582C5.0902 10.1582 4.95341 10.0853 4.85308 9.93945L2.7067 6.52127C2.63379 6.40285 2.61104 6.27758 2.63845 6.14545C2.66587 6.01333 2.73645 5.91081 2.8502 5.83789C2.96395 5.76497 3.08704 5.74222 3.21945 5.76964C3.35187 5.79706 3.45439 5.86545 3.52702 5.97483L5.05827 8.46333L5.68739 6.04352C5.72385 5.89768 5.81047 5.79283 5.94727 5.72895L8.43576 4.52583C8.55418 4.47099 8.67274 4.45962 8.79145 4.4917C8.91016 4.52379 9.00583 4.59437 9.07845 4.70345L10.3227 6.72689L12.155 1.21702C12.2005 1.08927 12.2826 0.993599 12.4013 0.930016C12.52 0.866432 12.6431 0.857245 12.7705 0.902453C12.898 0.947661 12.9936 1.02977 13.0575 1.14877C13.1214 1.26777 13.1306 1.39085 13.0851 1.51802L10.9247 8.03939C10.8608 8.24006 10.724 8.35177 10.5143 8.37452C10.3046 8.39727 10.1451 8.32202 10.0357 8.14877L8.46333 5.60558L6.59039 6.50814L5.74252 9.78939C5.68768 9.9991 5.55556 10.1177 5.34614 10.1451C5.31872 10.1541 5.29131 10.1586 5.26389 10.1586L5.26345 10.1582Z",
2856
+ fill: "currentColor"
2857
+ }
2858
+ ) }),
2859
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("defs", { children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("clipPath", { id: "clip0_1774_9563", children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("rect", { width: "14", height: "14", fill: "white" }) }) })
2860
+ ]
2861
+ }
2862
+ );
2863
+ var LineIcon_default = SvgIcon6;
2864
+
2865
+ // src/charts/icons/PieIcon.tsx
2866
+ var import_jsx_runtime17 = require("react/jsx-runtime");
2867
+ var SvgIcon7 = ({ className }) => /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
2868
+ "svg",
2869
+ {
2870
+ width: "14",
2871
+ height: "14",
2872
+ viewBox: "0 0 14 14",
2873
+ fill: "none",
2874
+ xmlns: "http://www.w3.org/2000/svg",
2875
+ className,
2876
+ children: [
2877
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("g", { clipPath: "url(#clip0_28267_7202)", children: [
2878
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
2879
+ "path",
2880
+ {
2881
+ d: "M5.83329 1.86662C4.92079 2.07816 4.08149 2.52998 3.40247 3.17523C2.72345 3.82048 2.22942 4.63564 1.97164 5.53618C1.71386 6.43671 1.70171 7.38982 1.93644 8.29663C2.17118 9.20345 2.64426 10.0309 3.30661 10.6933C3.96896 11.3556 4.79646 11.8287 5.70327 12.0635C6.61009 12.2982 7.56319 12.286 8.46373 12.0283C9.36426 11.7705 10.1794 11.2765 10.8247 10.5974C11.4699 9.91841 11.9217 9.07912 12.1333 8.16662C12.1333 8.01191 12.0718 7.86353 11.9624 7.75414C11.853 7.64474 11.7047 7.58328 11.55 7.58328H7.58329C7.27387 7.58328 6.97713 7.46037 6.75833 7.24157C6.53954 7.02278 6.41662 6.72604 6.41662 6.41662V2.33328C6.40938 2.26417 6.38848 2.19719 6.35515 2.13621C6.32182 2.07524 6.27671 2.02149 6.22245 1.97808C6.16819 1.93467 6.10585 1.90247 6.03905 1.88333C5.97224 1.8642 5.90231 1.85852 5.83329 1.86662Z",
2882
+ stroke: "currentColor",
2883
+ strokeWidth: "1.16667",
2884
+ strokeLinecap: "round",
2885
+ strokeLinejoin: "round"
2886
+ }
2887
+ ),
2888
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
2889
+ "path",
2890
+ {
2891
+ d: "M8.75 2.04175C9.49067 2.30255 10.1634 2.72617 10.7187 3.28142C11.2739 3.83668 11.6975 4.50941 11.9583 5.25008H9.33333C9.17862 5.25008 9.03025 5.18862 8.92085 5.07923C8.81146 4.96983 8.75 4.82146 8.75 4.66675V2.04175Z",
2892
+ stroke: "currentColor",
2893
+ strokeWidth: "1.16667",
2894
+ strokeLinecap: "round",
2895
+ strokeLinejoin: "round"
2896
+ }
2897
+ )
2898
+ ] }),
2899
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("defs", { children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("clipPath", { id: "clip0_28267_7202", children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("rect", { width: "14", height: "14", fill: "white" }) }) })
2900
+ ]
2901
+ }
2902
+ );
2903
+ var PieIcon_default = SvgIcon7;
2904
+
2905
+ // src/charts/icons/ScatterIcon.tsx
2906
+ var import_jsx_runtime18 = require("react/jsx-runtime");
2907
+ var SvgIcon8 = ({ className }) => /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
2908
+ "svg",
2909
+ {
2910
+ width: "14",
2911
+ height: "14",
2912
+ viewBox: "0 0 14 14",
2913
+ fill: "none",
2914
+ xmlns: "http://www.w3.org/2000/svg",
2915
+ className,
2916
+ children: [
2917
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("g", { clipPath: "url(#clip0_28248_7302)", children: [
2918
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
2919
+ "path",
2920
+ {
2921
+ d: "M1.75 1.75V12.25H12.25",
2922
+ stroke: "currentColor",
2923
+ strokeWidth: "1.16667",
2924
+ strokeLinecap: "round",
2925
+ strokeLinejoin: "round"
2926
+ }
2927
+ ),
2928
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
2929
+ "path",
2930
+ {
2931
+ d: "M4.66663 8.75879V8.76754",
2932
+ stroke: "currentColor",
2933
+ strokeWidth: "1.16667",
2934
+ strokeLinecap: "round",
2935
+ strokeLinejoin: "round"
2936
+ }
2937
+ ),
2938
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
2939
+ "path",
2940
+ {
2941
+ d: "M9.33337 9.34204V9.35079",
2942
+ stroke: "currentColor",
2943
+ strokeWidth: "1.16667",
2944
+ strokeLinecap: "round",
2945
+ strokeLinejoin: "round"
2946
+ }
2947
+ ),
2948
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
2949
+ "path",
2950
+ {
2951
+ d: "M4.66663 4.10083V4.10958",
2952
+ stroke: "currentColor",
2953
+ strokeWidth: "1.16667",
2954
+ strokeLinecap: "round",
2955
+ strokeLinejoin: "round"
2956
+ }
2957
+ ),
2958
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
2959
+ "path",
2960
+ {
2961
+ d: "M7 6.43408V6.44283",
2962
+ stroke: "currentColor",
2963
+ strokeWidth: "1.16667",
2964
+ strokeLinecap: "round",
2965
+ strokeLinejoin: "round"
2966
+ }
2967
+ ),
2968
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
2969
+ "path",
2970
+ {
2971
+ d: "M11.0834 6.43408V6.44283",
2972
+ stroke: "currentColor",
2973
+ strokeWidth: "1.16667",
2974
+ strokeLinecap: "round",
2975
+ strokeLinejoin: "round"
2976
+ }
2977
+ )
2978
+ ] }),
2979
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("defs", { children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("clipPath", { id: "clip0_28248_7302", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("rect", { width: "14", height: "14", fill: "white" }) }) })
2980
+ ]
2981
+ }
2982
+ );
2983
+ var ScatterIcon_default = SvgIcon8;
2984
+
2985
+ // src/charts/ChartTypeButtonGroup.tsx
2986
+ var import_jsx_runtime19 = require("react/jsx-runtime");
2987
+ var visuals = [
2988
+ {
2989
+ label: "Lines",
2990
+ value: "LINE",
2991
+ icon: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(LineIcon_default, { className: "mr-1 h-4 w-4" })
2992
+ },
2993
+ { label: "Bars", value: "BAR", icon: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(BarIcon_default, { className: "mr-1 h-4 w-4" }) },
2994
+ {
2995
+ label: "Areas",
2996
+ value: "AREA",
2997
+ icon: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(AreaIcon_default, { className: "mr-1 h-4 w-4" })
2998
+ },
2999
+ {
3000
+ label: "Bar Gauge",
3001
+ value: "BAR_GAUGE",
3002
+ icon: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(BarGuageIcon_default, { className: "mr-1 h-4 w-4" })
3003
+ },
3004
+ {
3005
+ label: "Scatter",
3006
+ value: "SCATTER",
3007
+ icon: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(ScatterIcon_default, { className: "mr-1 h-4 w-4" })
3008
+ },
3009
+ {
3010
+ label: "Query Value",
3011
+ value: "QUERY_VALUE",
3012
+ icon: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(QueryValueIcon_default, { className: "mr-1 h-4 w-4" })
3013
+ },
3014
+ {
3015
+ label: "Table",
3016
+ value: "TABLE",
3017
+ icon: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(TableIcon_default, { className: "mr-1 h-4 w-4" })
3018
+ },
3019
+ { label: "Pie", value: "PIE", icon: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(PieIcon_default, { className: "mr-1 h-4 w-4" }) }
3020
+ ];
3021
+ var ChartTypeButtonGroup = ({
3022
+ value,
3023
+ onChange,
3024
+ small = false
3025
+ }) => {
3026
+ const [hideLabel, setHideLabel] = (0, import_react14.useState)(small);
3027
+ const { ref } = (0, import_react_resize_detector2.useResizeDetector)({
3028
+ onResize: ({ width }) => {
3029
+ if (width) {
3030
+ setHideLabel(width < 800);
3031
+ }
3032
+ },
3033
+ refreshMode: "throttle",
3034
+ refreshRate: 100
3035
+ });
3036
+ return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: "w-full flex-1", ref, children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
3037
+ import_ui_core8.NewButtonGroup,
3038
+ {
3039
+ buttons: visuals,
3040
+ value,
3041
+ onChange,
3042
+ small,
3043
+ hideLabel
3044
+ }
3045
+ ) });
3046
+ };
3047
+
3048
+ // src/charts/ChartTooltip.tsx
3049
+ var import_react15 = require("react");
3050
+ var import_dayjs = __toESM(require("dayjs"));
3051
+ var import_utc = __toESM(require("dayjs/plugin/utc"));
3052
+ var import_timezone = __toESM(require("dayjs/plugin/timezone"));
3053
+ var import_lodash3 = require("lodash");
3054
+ var import_bigdecimal = __toESM(require("@sentio/bigdecimal"));
3055
+ var import_lu3 = require("react-icons/lu");
3056
+ var import_ui_core9 = require("@sentio/ui-core");
3057
+
3058
+ // src/charts/duration.ts
3059
+ var longUnits = {
3060
+ s: "seconds",
3061
+ m: "minutes",
3062
+ h: "hours",
3063
+ d: "days",
3064
+ w: "weeks",
3065
+ M: "months",
3066
+ y: "years"
3067
+ };
3068
+ function durationToLongString(d) {
3069
+ const u = longUnits[d.unit ?? ""] ?? "";
3070
+ return Number(d.value) === 1 ? u.replace(/s$/, "") : u;
3071
+ }
3072
+
3073
+ // src/charts/ChartTooltip.tsx
3074
+ var import_jsx_runtime20 = require("react/jsx-runtime");
3075
+ import_dayjs.default.extend(import_utc.default);
3076
+ import_dayjs.default.extend(import_timezone.default);
3077
+ function isValidValue(value, includeZero) {
3078
+ if (includeZero) {
3079
+ return Number.isFinite(value);
3080
+ } else {
3081
+ return Number.isFinite(value) && value !== 0;
3082
+ }
3083
+ }
3084
+ function ChartTooltip({
3085
+ data,
3086
+ numberFormatter,
3087
+ compareTimeDuration,
3088
+ highlightSeriesId,
3089
+ title,
3090
+ showTotal,
3091
+ onViewLogs,
3092
+ viewLogDisabled,
3093
+ onViewUsers,
3094
+ viewUsersDisabled,
3095
+ isFixed
3096
+ }) {
3097
+ const {
3098
+ series,
3099
+ hasCompare,
3100
+ hasCurrent,
3101
+ currentTime,
3102
+ compareTime,
3103
+ markers,
3104
+ compareMarkers,
3105
+ total,
3106
+ compareTotal
3107
+ } = (0, import_react15.useMemo)(() => {
3108
+ const params = (0, import_lodash3.sortBy)(data, (p) => -p.value[1]);
3109
+ const hasCompare2 = (0, import_lodash3.some)(
3110
+ params,
3111
+ (param) => param.seriesId.endsWith("_compare")
3112
+ );
3113
+ const seriesData = {};
3114
+ const markers2 = {};
3115
+ const compareMarkers2 = {};
3116
+ let currentTime2;
3117
+ let compareTime2;
3118
+ let total2 = new import_bigdecimal.default(0);
3119
+ let compareTotal2 = new import_bigdecimal.default(0);
3120
+ for (const p of params) {
3121
+ const { marker, seriesName, value, seriesId } = p;
3122
+ if (seriesId.endsWith("_compare")) {
3123
+ const id = seriesId.replace("_compare", "");
3124
+ compareMarkers2[id] = marker;
3125
+ if (compareTime2 === void 0) {
3126
+ compareTime2 = (0, import_dayjs.default)(value[0]);
3127
+ }
3128
+ if (isValidValue(value[1], hasCompare2)) {
3129
+ seriesData[id] = {
3130
+ seriesId: id,
3131
+ ...seriesData[id],
3132
+ compareValue: value[1],
3133
+ compareTime: value[0],
3134
+ seriesName
3135
+ };
3136
+ compareTotal2 = compareTotal2.plus(value[1]);
3137
+ }
3138
+ } else {
3139
+ markers2[seriesId] = marker;
3140
+ if (currentTime2 === void 0) {
3141
+ currentTime2 = (0, import_dayjs.default)(value[0]);
3142
+ }
3143
+ if (isValidValue(value[1], hasCompare2)) {
3144
+ seriesData[seriesId] = {
3145
+ seriesId,
3146
+ ...seriesData[seriesId],
3147
+ time: value[0],
3148
+ value: value[1],
3149
+ seriesName
3150
+ };
3151
+ total2 = total2.plus(value[1]);
3152
+ }
3153
+ }
3154
+ }
3155
+ const series2 = (0, import_lodash3.sortBy)(Object.values(seriesData), (s) => -s.value);
3156
+ const hasCurrent2 = series2[0]?.value !== void 0;
3157
+ if (compareTimeDuration && compareTime2 && !currentTime2) {
3158
+ currentTime2 = compareTime2.add(
3159
+ Number(compareTimeDuration.value),
3160
+ compareTimeDuration.unit
3161
+ );
3162
+ }
3163
+ return {
3164
+ series: series2,
3165
+ hasCompare: hasCompare2,
3166
+ currentTime: currentTime2,
3167
+ compareTime: compareTime2,
3168
+ hasCurrent: hasCurrent2,
3169
+ markers: markers2,
3170
+ compareMarkers: compareMarkers2,
3171
+ total: total2,
3172
+ compareTotal: compareTotal2
3173
+ };
3174
+ }, [data]);
3175
+ const renderRow = (p, idx) => {
3176
+ const { seriesName, compareValue, value, seriesId } = p;
3177
+ const highlighted = seriesId === highlightSeriesId;
3178
+ const marker = markers[seriesId];
3179
+ const diff = hasCompare && hasCurrent && compareValue != null && value != null ? new import_bigdecimal.default(value).minus(compareValue).div(compareValue).toNumber() : void 0;
3180
+ const showViewLogs = onViewLogs && !viewLogDisabled?.(seriesId, idx);
3181
+ const showViewUsers = onViewUsers && !viewUsersDisabled?.(seriesId, idx);
3182
+ return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(import_react15.Fragment, { children: [
3183
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
3184
+ "div",
3185
+ {
3186
+ className: (0, import_ui_core9.classNames)(
3187
+ "sentio-tooltip-item series-name text-text-foreground inline-flex items-center overflow-hidden",
3188
+ "group",
3189
+ highlighted ? "highlighted" : ""
3190
+ ),
3191
+ style: { minWidth: "4rem" },
3192
+ children: [
3193
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { dangerouslySetInnerHTML: { __html: marker || "" } }),
3194
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { className: "truncate", children: seriesName }),
3195
+ showViewLogs && isFixed && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
3196
+ "button",
3197
+ {
3198
+ className: "text-text-foreground/60 hover:text-text-foreground invisible ml-1 text-xs underline group-hover:visible",
3199
+ onClick: (e) => {
3200
+ e.preventDefault();
3201
+ e.stopPropagation();
3202
+ onViewLogs(seriesId, idx);
3203
+ },
3204
+ title: "View logs",
3205
+ children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_lu3.LuList, { className: "h-4 w-4" })
3075
3206
  }
3076
3207
  ),
3077
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
3078
- "input",
3208
+ showViewUsers && isFixed && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
3209
+ "button",
3079
3210
  {
3080
- type: "text",
3081
- name: "value",
3082
- id: "value",
3083
- className: "w-30 rounded-l-0 sm:text-ilabel border-main hover:border-primary-600 focus:border-primary-600 focus:ring-3 focus:ring-primary-600/30 block h-full rounded-r-md border px-2 py-1",
3084
- placeholder: "0",
3085
- value: rule.value,
3086
- onChange: (e) => {
3087
- changeRule(index, "value", e.target.value);
3088
- }
3211
+ className: "text-text-foreground/60 hover:text-text-foreground invisible ml-1 text-xs underline group-hover:visible",
3212
+ onClick: (e) => {
3213
+ e.preventDefault();
3214
+ e.stopPropagation();
3215
+ onViewUsers(seriesId, idx);
3216
+ },
3217
+ title: "View users",
3218
+ children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_lu3.LuCircleUserRound, { className: "h-4 w-4" })
3089
3219
  }
3090
3220
  ),
3091
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "sm:text-ilabel inline-flex h-full items-center rounded-none px-3 font-medium", children: ", then show" }),
3092
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
3093
- "input",
3221
+ isFixed && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
3222
+ import_ui_core9.CopyButton,
3094
3223
  {
3095
- type: "text",
3096
- name: "text",
3097
- id: "text",
3098
- className: "sm:text-ilabel border-main hover:border-primary-600 focus:border-primary-600 focus:ring-3 focus:ring-primary-600/30 block h-full w-80 rounded-md px-2 py-1",
3099
- placeholder: "Display text (e.g. High, Low, Normal)",
3100
- value: rule.text,
3101
- onChange: (e) => {
3102
- changeRule(index, "text", e.target.value);
3103
- }
3224
+ size: 16,
3225
+ text: seriesName,
3226
+ className: "invisible ml-1 group-hover:visible"
3104
3227
  }
3105
- ),
3106
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
3107
- "button",
3228
+ )
3229
+ ]
3230
+ },
3231
+ idx
3232
+ ),
3233
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
3234
+ "div",
3235
+ {
3236
+ className: (0, import_ui_core9.classNames)(
3237
+ "sentio-tooltip-item min-w-16 flex items-center truncate pl-1 text-right font-semibold",
3238
+ highlighted ? "highlighted" : ""
3239
+ ),
3240
+ children: [
3241
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { children: hasCurrent ? numberFormatter(value, seriesId) : "-" }),
3242
+ diff !== void 0 && Number.isFinite(diff) && /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
3243
+ "span",
3108
3244
  {
3109
- type: "button",
3110
- className: "mx-2",
3111
- "aria-label": "remove",
3112
- onClick: () => removeRule(index),
3113
- children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
3114
- import_lu3.LuTrash2,
3115
- {
3116
- className: "icon text-text-foreground-disabled",
3117
- "aria-hidden": "true"
3118
- }
3119
- )
3245
+ className: (0, import_ui_core9.classNames)(
3246
+ "ml-1 text-xs",
3247
+ diff > 0 ? "text-green-500" : "text-red"
3248
+ ),
3249
+ children: [
3250
+ diff > 0 ? "+" : "",
3251
+ (diff * 100).toFixed(2),
3252
+ "%"
3253
+ ]
3120
3254
  }
3121
3255
  )
3122
3256
  ]
3123
3257
  },
3124
- index
3125
- );
3126
- }),
3127
- /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
3128
- import_ui_core12.Button,
3129
- {
3130
- type: "button",
3131
- role: "secondary",
3132
- className: "mt-1 w-fit flex-none",
3133
- "aria-label": "remove",
3134
- onClick: addRule,
3135
- children: [
3136
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_lu3.LuPlus, { className: (0, import_ui_core12.classNames)("h-4 w-4"), "aria-hidden": "true" }),
3137
- "Add Formatting Rule"
3138
- ]
3139
- }
3140
- )
3141
- ] });
3142
- }
3143
-
3144
- // src/charts/options/ValueOptions.tsx
3145
- var import_jsx_runtime16 = require("react/jsx-runtime");
3146
- var ValueFormatters = [
3147
- { label: "Number", value: "NumberFormatter" },
3148
- { label: "Date", value: "DateFormatter" },
3149
- { label: "String", value: "StringFormatter" }
3150
- ];
3151
- var defaultConfig3 = {
3152
- valueFormatter: "NumberFormatter",
3153
- showValueLabel: false,
3154
- maxSignificantDigits: 3,
3155
- dateFormat: "LLL",
3156
- mappingRules: [],
3157
- style: "None"
3158
- };
3159
- var dateFormats = [
3160
- { label: "Localized format", value: "LLL" },
3161
- { label: "ISO String", value: "YYYY-MM-DDTHH:mm:ss.sssZ" }
3162
- ];
3163
- var CurrencySymbols = [
3164
- { label: "USD", value: "$" },
3165
- { label: "EUR", value: "\u20AC" },
3166
- { label: "GBP", value: "\xA3" },
3167
- { label: "CNY or JPY", value: "\xA5" },
3168
- { label: "BTC", value: "\u0243" },
3169
- { label: "ETH", value: "\u039E" }
3170
- ];
3171
- var AddonLabel = ({
3172
- className,
3173
- children
3174
- }) => /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
3175
- "span",
3176
- {
3177
- className: (0, import_ui_core13.classNames)(
3178
- "sm:text-ilabel border-main inline-flex items-center whitespace-nowrap bg-gray-50 px-3",
3179
- className
3180
- ),
3181
- children
3182
- }
3183
- );
3184
- var ValueOptions = ({
3185
- config,
3186
- onChange,
3187
- formatters = ValueFormatters,
3188
- showPrefix,
3189
- showSuffix
3190
- }) => {
3191
- function onChangeDateFormat(f) {
3192
- onChange((0, import_immer9.produce)(config, (draft) => void (draft.dateFormat = f)));
3193
- }
3194
- function onChangeFormatter(f) {
3195
- onChange((0, import_immer9.produce)(config, (draft) => void (draft.valueFormatter = f)));
3196
- }
3197
- function onChangeSymbol(symbol) {
3198
- onChange((0, import_immer9.produce)(config, (draft) => void (draft.currencySymbol = symbol)));
3199
- }
3200
- function onStyleChange(notation) {
3201
- onChange(
3202
- (0, import_immer9.produce)(config, (draft) => {
3203
- draft.style = notation;
3204
- })
3205
- );
3206
- }
3207
- function onDigitsChange(value, option) {
3208
- onChange(
3209
- (0, import_immer9.produce)(config, (draft) => {
3210
- const d = draft;
3211
- if (value) {
3212
- const maxSignificantDigits = parseInt(value);
3213
- if (maxSignificantDigits >= 0 && maxSignificantDigits <= 20) {
3214
- d[option] = maxSignificantDigits;
3215
- }
3216
- } else {
3217
- delete d[option];
3218
- }
3219
- })
3220
- );
3221
- }
3222
- function onMappingRulesChange(rules) {
3223
- onChange((0, import_immer9.produce)(config, (draft) => void (draft.mappingRules = rules)));
3224
- }
3225
- function onPrefixChange(value) {
3226
- onChange(
3227
- (0, import_immer9.produce)(config, (draft) => {
3228
- if (value) {
3229
- draft.prefix = value;
3230
- } else {
3231
- delete draft.prefix;
3232
- }
3233
- })
3234
- );
3235
- }
3236
- function onSuffixChange(value) {
3237
- onChange(
3238
- (0, import_immer9.produce)(config, (draft) => {
3239
- if (value) {
3240
- draft.suffix = value;
3241
- } else {
3242
- delete draft.suffix;
3243
- }
3244
- })
3245
- );
3246
- }
3247
- function numberAddons(style) {
3248
- switch (style) {
3249
- case "None":
3250
- return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(import_jsx_runtime16.Fragment, { children: [
3251
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(AddonLabel, { className: "border border-l-0", children: "Fraction Digits" }),
3252
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
3253
- "input",
3254
- {
3255
- disabled: true,
3256
- className: "focus:border-primary-500 sm:text-ilabel min-w-20 border-main rounded-r-md border border-l-0 py-1",
3257
- value: ""
3258
- }
3259
- )
3260
- ] });
3261
- case "Percent":
3262
- case "Standard":
3263
- return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(import_jsx_runtime16.Fragment, { children: [
3264
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(AddonLabel, { className: "border border-x-0", children: "Fraction Digits" }),
3265
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
3266
- "input",
3267
- {
3268
- type: "number",
3269
- min: 0,
3270
- max: 20,
3271
- className: "focus:border-primary-500 sm:text-ilabel min-w-20 border-main focus:ring-3 focus:ring-primary-600/30 hover:border-primary-600 rounded-r-md border py-1",
3272
- value: config.maxFractionDigits,
3273
- placeholder: "0-20",
3274
- onChange: (e) => onDigitsChange(e.target.value, "maxFractionDigits")
3275
- }
3276
- )
3277
- ] });
3278
- case "Currency":
3279
- return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(import_jsx_runtime16.Fragment, { children: [
3280
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(AddonLabel, { className: "border border-r-0", children: "Symbol" }),
3281
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: "w-28 ", children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
3282
- import_ui_core13.ComboInput,
3283
- {
3284
- onChange: onChangeSymbol,
3285
- options: CurrencySymbols.map((s) => s.value),
3286
- displayFn: (s) => {
3287
- const name = CurrencySymbols.find((c) => c.value === s)?.label;
3288
- return `${name} (${s})`;
3289
- },
3290
- placeholder: "$",
3291
- value: config?.currencySymbol
3292
- }
3293
- ) }),
3294
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(AddonLabel, { className: "border", children: "Precision" }),
3295
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
3296
- "input",
3297
- {
3298
- type: "number",
3299
- min: 0,
3300
- max: 20,
3301
- className: "focus:border-primary-500 sm:text-ilabel min-w-20 border-main rounded-r-md border border-l-0 py-1",
3302
- value: config.precision,
3303
- defaultValue: 2,
3304
- placeholder: "0-20",
3305
- onChange: (e) => onDigitsChange(e.target.value, "precision")
3306
- }
3307
- )
3308
- ] });
3309
- default:
3310
- return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(import_jsx_runtime16.Fragment, { children: [
3311
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(AddonLabel, { className: "border border-x-0", children: "Max significant digits" }),
3312
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
3313
- "input",
3314
- {
3315
- type: "number",
3316
- min: 1,
3317
- max: 21,
3318
- className: "focus:border-primary-600 sm:text-ilabel min-w-20 border-main hover:border-primary-600 focus:ring-3 focus:ring-primary-600/30 rounded-r-md border py-1",
3319
- value: config.maxSignificantDigits,
3320
- placeholder: "1-21",
3321
- onChange: (e) => onDigitsChange(e.target.value, "maxSignificantDigits")
3322
- }
3323
- )
3324
- ] });
3325
- }
3326
- }
3327
- return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(import_jsx_runtime16.Fragment, { children: [
3328
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "flex", children: [
3329
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(AddonLabel, { className: "rounded-l-md border border-r-0", children: "Value formatter" }),
3330
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
3331
- "select",
3258
+ `${idx}-value`
3259
+ )
3260
+ ] }, idx);
3261
+ };
3262
+ const renderCompareRow = (p, idx) => {
3263
+ const { seriesName, compareValue, seriesId } = p;
3264
+ const highlighted = seriesId === highlightSeriesId;
3265
+ const compareMarker = compareMarkers[seriesId];
3266
+ return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(import_react15.Fragment, { children: [
3267
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
3268
+ "div",
3332
3269
  {
3333
- value: config.valueFormatter,
3334
- className: (0, import_ui_core13.classNames)(
3335
- "sm:text-ilabel border-main text-text-foreground hover:border-primary-600 inline-flex items-center border py-1.5 pl-4 pr-7 focus:ring-0",
3336
- config.valueFormatter == "StringFormatter" ? "rounded-r-md" : ""
3270
+ className: (0, import_ui_core9.classNames)(
3271
+ "sentio-tooltip-item sentio-tooltip-compare-item series-name text-text-foreground-secondary truncate",
3272
+ highlighted ? "highlighted" : ""
3337
3273
  ),
3338
- onChange: (e) => onChangeFormatter(e.target.value),
3339
- children: formatters.map((d) => {
3340
- return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("option", { value: d.value, children: d.label }, d.value);
3341
- })
3342
- }
3274
+ style: { minWidth: "4rem" },
3275
+ children: [
3276
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
3277
+ "span",
3278
+ {
3279
+ dangerouslySetInnerHTML: { __html: compareMarker || "" }
3280
+ }
3281
+ ),
3282
+ seriesName
3283
+ ]
3284
+ },
3285
+ idx
3343
3286
  ),
3344
- config.valueFormatter == "NumberFormatter" && /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(import_jsx_runtime16.Fragment, { children: [
3345
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(AddonLabel, { className: "border border-l-0 border-r-0", children: "Style" }),
3346
- /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
3347
- "select",
3287
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
3288
+ "div",
3289
+ {
3290
+ className: (0, import_ui_core9.classNames)(
3291
+ "sentio-tooltip-item min-w-16 text-text-foreground-secondary truncate pl-1 text-right font-semibold",
3292
+ highlighted ? "highlighted" : ""
3293
+ ),
3294
+ children: (0, import_lodash3.isNumber)(compareValue) ? numberFormatter(compareValue, seriesId) : "-"
3295
+ },
3296
+ `${idx}-value`
3297
+ )
3298
+ ] }, idx);
3299
+ };
3300
+ const renderTotalRow = () => {
3301
+ if (!showTotal || series.length < 2) return null;
3302
+ const diff = hasCompare && hasCurrent && total && compareTotal ? total.minus(compareTotal).div(compareTotal).toNumber() : void 0;
3303
+ return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "border-border-color col-span-2 mt-1 flex items-center justify-between border-t pt-1", children: [
3304
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: "sentio-tooltip-item series-name text-text-foreground truncate font-semibold", children: "Total" }),
3305
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "sentio-tooltip-item min-w-16 flex items-center truncate pl-1 text-right font-semibold", children: [
3306
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { children: hasCurrent ? numberFormatter(total.toNumber()) : "-" }),
3307
+ diff !== void 0 && Number.isFinite(diff) && /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
3308
+ "span",
3348
3309
  {
3349
- value: config.style,
3350
- className: "sm:text-ilabel border-main text-text-foreground hover:border-primary-600 inline-flex items-center border py-1 pl-4 pr-7 focus:ring-0",
3351
- onChange: (e) => onStyleChange(e.target.value),
3310
+ className: (0, import_ui_core9.classNames)(
3311
+ "ml-1 text-xs",
3312
+ diff > 0 ? "text-green-500" : "text-red"
3313
+ ),
3352
3314
  children: [
3353
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("option", { value: "None", children: "None" }),
3354
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("option", { value: "Compact", children: "Compact" }),
3355
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("option", { value: "Standard", children: "Standard" }),
3356
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("option", { value: "Scientific", children: "Scientific" }),
3357
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("option", { value: "Percent", children: "Percent" }),
3358
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("option", { value: "Currency", children: "Currency" })
3315
+ diff > 0 ? "+" : "",
3316
+ (diff * 100).toFixed(2),
3317
+ "%"
3359
3318
  ]
3360
3319
  }
3361
- ),
3362
- config.style && numberAddons(config.style)
3363
- ] }),
3364
- config.valueFormatter == "DateFormatter" && /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(import_jsx_runtime16.Fragment, { children: [
3365
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(AddonLabel, { className: "border border-l-0", children: "Date format" }),
3366
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
3367
- "select",
3368
- {
3369
- value: config.dateFormat,
3370
- className: "sm:text-ilabel border-main text-text-foreground inline-flex items-center rounded-r-md border border-l-0 py-1 pl-4 pr-7",
3371
- onChange: (e) => onChangeDateFormat(e.target.value),
3372
- children: dateFormats.map((d) => {
3373
- return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("option", { value: d.value, children: d.label }, d.value);
3374
- })
3375
- }
3376
3320
  )
3377
3321
  ] })
3378
- ] }) }),
3379
- (showPrefix || showSuffix) && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "mt-2 flex items-center gap-4", children: [
3380
- showPrefix && /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "border-main hover:border-primary-600 focus-within:border-primary-600 focus-within:ring-3 focus-within:ring-primary-500/30 text-icontent inline-flex items-center rounded-md border", children: [
3381
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: "h-7.5 leading-7.5 border-r px-3", children: "Prefix" }),
3382
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
3383
- "input",
3322
+ ] });
3323
+ };
3324
+ const renderCompareTotalRow = () => {
3325
+ if (!showTotal || series.length < 2 || !hasCompare) return null;
3326
+ return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "border-border-color col-span-2 mt-1 flex items-center justify-between border-t pt-1", children: [
3327
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: "sentio-tooltip-item sentio-tooltip-compare-item series-name text-text-foreground-secondary truncate font-semibold", children: "Total" }),
3328
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: "sentio-tooltip-item min-w-16 text-text-foreground-secondary truncate pl-1 text-right font-semibold", children: (0, import_lodash3.isNumber)(compareTotal) ? numberFormatter(compareTotal.toNumber()) : "-" })
3329
+ ] });
3330
+ };
3331
+ return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
3332
+ "div",
3333
+ {
3334
+ className: (0, import_ui_core9.classNames)("grid w-full px-2"),
3335
+ style: { gridTemplateColumns: "1fr auto" },
3336
+ children: [
3337
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
3338
+ "div",
3384
3339
  {
3385
- type: "text",
3386
- className: "border-0 px-3 py-1.5 focus:ring-0",
3387
- value: config.prefix || "",
3388
- placeholder: "e.g., $, #",
3389
- onChange: (e) => onPrefixChange(e.target.value)
3340
+ className: (0, import_ui_core9.classNames)(
3341
+ "pl-2",
3342
+ "text-text-foreground-secondary col-span-2 text-left"
3343
+ ),
3344
+ children: title ?? currentTime?.format("YYYY-MM-DD HH:mm:ss")
3390
3345
  }
3391
- )
3392
- ] }),
3393
- showSuffix && /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "border-main hover:border-primary-600 focus-within:border-primary-600 focus-within:ring-3 focus-within:ring-primary-500/30 text-icontent inline-flex items-center rounded-md border", children: [
3394
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: "h-7.5 leading-7.5 border-r px-3", children: "Suffix" }),
3395
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
3396
- "input",
3346
+ ),
3347
+ !series || series.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: "text-text-foreground-secondary pl-2 text-sm", children: "No data available" }) : /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(import_jsx_runtime20.Fragment, { children: [
3348
+ series.map((s, idx) => renderRow(s, idx)),
3349
+ renderTotalRow(),
3350
+ hasCompare && compareTimeDuration && /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(import_jsx_runtime20.Fragment, { children: [
3351
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
3352
+ "div",
3353
+ {
3354
+ className: (0, import_ui_core9.classNames)(
3355
+ "mt-2 pl-2",
3356
+ "text-text-foreground-secondary col-span-2 text-left"
3357
+ ),
3358
+ children: [
3359
+ compareTime?.format("YYYY-MM-DD HH:mm:ss"),
3360
+ " (previous",
3361
+ " ",
3362
+ durationToLongString(compareTimeDuration),
3363
+ ")"
3364
+ ]
3365
+ }
3366
+ ),
3367
+ series.map((s, idx) => renderCompareRow(s, idx)),
3368
+ renderCompareTotalRow()
3369
+ ] })
3370
+ ] })
3371
+ ]
3372
+ }
3373
+ );
3374
+ }
3375
+
3376
+ // src/charts/ScatterChartTooltip.tsx
3377
+ var import_react16 = require("react");
3378
+ var import_dayjs2 = __toESM(require("dayjs"));
3379
+ var import_utc2 = __toESM(require("dayjs/plugin/utc"));
3380
+ var import_timezone2 = __toESM(require("dayjs/plugin/timezone"));
3381
+ var import_lodash4 = require("lodash");
3382
+ var import_lu4 = require("react-icons/lu");
3383
+ var import_ui_core10 = require("@sentio/ui-core");
3384
+ var import_jsx_runtime21 = require("react/jsx-runtime");
3385
+ import_dayjs2.default.extend(import_utc2.default);
3386
+ import_dayjs2.default.extend(import_timezone2.default);
3387
+ function ScatterChartTooltip({
3388
+ data,
3389
+ numberFormatter,
3390
+ highlightSeriesId,
3391
+ title,
3392
+ onViewLogs,
3393
+ viewLogDisabled,
3394
+ onViewUsers,
3395
+ viewUsersDisabled,
3396
+ isFixed,
3397
+ sizeTitle = "Size"
3398
+ }) {
3399
+ const { point, seriesName, seriesId, marker } = (0, import_react16.useMemo)(() => {
3400
+ const param = Array.isArray(data) ? data[0] : data;
3401
+ return {
3402
+ point: param,
3403
+ seriesName: param?.seriesName || "",
3404
+ seriesId: param?.seriesId || "",
3405
+ marker: param?.marker || ""
3406
+ };
3407
+ }, [data]);
3408
+ if (!point || !point.value) {
3409
+ return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: "w-full px-2", children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: "text-text-foreground-secondary pl-2 text-sm", children: "No data available" }) });
3410
+ }
3411
+ const { value } = point;
3412
+ const [xValue, yValue, sizeValue] = value;
3413
+ const highlighted = seriesId === highlightSeriesId;
3414
+ const showViewLogs = onViewLogs && !viewLogDisabled?.(seriesId, 0);
3415
+ const showViewUsers = onViewUsers && !viewUsersDisabled?.(seriesId, 0);
3416
+ const formatValue = (val) => {
3417
+ if (val instanceof Date) {
3418
+ return (0, import_dayjs2.default)(val).format("YYYY-MM-DD HH:mm:ss");
3419
+ } else if ((0, import_lodash4.isNumber)(val)) {
3420
+ return numberFormatter(val);
3421
+ } else {
3422
+ return String(val);
3423
+ }
3424
+ };
3425
+ return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
3426
+ "div",
3427
+ {
3428
+ className: (0, import_ui_core10.classNames)("grid w-full px-2"),
3429
+ style: { gridTemplateColumns: "1fr auto" },
3430
+ children: [
3431
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
3432
+ "div",
3397
3433
  {
3398
- type: "text",
3399
- className: "min-w-32 border-0 px-3 py-1.5 focus:ring-0",
3400
- value: config.suffix || "",
3401
- placeholder: "e.g., %, USD, tokens",
3402
- onChange: (e) => onSuffixChange(e.target.value)
3434
+ className: (0, import_ui_core10.classNames)(
3435
+ "mb-2 pl-2",
3436
+ "text-text-foreground-secondary col-span-2 text-left"
3437
+ ),
3438
+ children: title ?? (0, import_dayjs2.default)(xValue).format("YYYY-MM-DD HH:mm:ss")
3403
3439
  }
3404
- )
3405
- ] })
3406
- ] }) }),
3407
- config.valueFormatter == "StringFormatter" && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
3408
- ValueStringMapping,
3409
- {
3410
- rules: config.mappingRules || [],
3411
- onChange: onMappingRulesChange
3412
- }
3413
- )
3414
- ] });
3415
- };
3416
-
3417
- // src/charts/options/ValueControls.tsx
3418
- var import_lodash5 = require("lodash");
3419
- var import_ui_core14 = require("@sentio/ui-core");
3420
- var import_immer10 = require("immer");
3421
- var import_jsx_runtime17 = require("react/jsx-runtime");
3422
- var defaultConfig4 = {
3423
- valueFormatter: "NumberFormatter",
3424
- showValueLabel: false,
3425
- maxSignificantDigits: 3,
3426
- dateFormat: "LLL",
3427
- mappingRules: [],
3428
- style: "None",
3429
- maxFractionDigits: 2
3430
- };
3431
- var ValueControls = ({
3432
- config,
3433
- defaultOpen,
3434
- onChange,
3435
- formatters = ValueFormatters,
3436
- showPrefix,
3437
- showSuffix
3438
- }) => {
3439
- config = (0, import_lodash5.defaults)(config || {}, defaultConfig4);
3440
- function toggleShowValueLabel(checked) {
3441
- config && onChange(
3442
- (0, import_immer10.produce)(config, (draft) => void (draft.showValueLabel = checked))
3443
- );
3444
- }
3445
- function toggleTooltipTotal(checked) {
3446
- config && onChange((0, import_immer10.produce)(config, (draft) => void (draft.tooltipTotal = checked)));
3447
- }
3448
- return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
3449
- import_ui_core14.DisclosurePanel,
3450
- {
3451
- title: "Value Options",
3452
- defaultOpen,
3453
- containerClassName: "w-full bg-default-bg",
3454
- children: [
3455
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
3456
- ValueOptions,
3440
+ ),
3441
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
3442
+ "div",
3457
3443
  {
3458
- onChange,
3459
- config,
3460
- formatters,
3461
- showPrefix,
3462
- showSuffix
3444
+ className: (0, import_ui_core10.classNames)(
3445
+ "sentio-tooltip-item series-name text-text-foreground inline-flex items-center overflow-hidden",
3446
+ "group",
3447
+ highlighted ? "highlighted" : ""
3448
+ ),
3449
+ style: { minWidth: "4rem" },
3450
+ children: [
3451
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { dangerouslySetInnerHTML: { __html: marker || "" } }),
3452
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "truncate", children: seriesName }),
3453
+ showViewLogs && isFixed && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
3454
+ "button",
3455
+ {
3456
+ className: "text-text-foreground/60 hover:text-text-foreground invisible ml-1 text-xs underline group-hover:visible",
3457
+ onClick: (e) => {
3458
+ e.preventDefault();
3459
+ e.stopPropagation();
3460
+ onViewLogs(seriesId, 0);
3461
+ },
3462
+ title: "View logs",
3463
+ children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_lu4.LuList, { className: "h-4 w-4" })
3464
+ }
3465
+ ),
3466
+ showViewUsers && isFixed && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
3467
+ "button",
3468
+ {
3469
+ className: "text-text-foreground/60 hover:text-text-foreground invisible ml-1 text-xs underline group-hover:visible",
3470
+ onClick: (e) => {
3471
+ e.preventDefault();
3472
+ e.stopPropagation();
3473
+ onViewUsers(seriesId, 0);
3474
+ },
3475
+ title: "View users",
3476
+ children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_lu4.LuCircleUserRound, { className: "h-4 w-4" })
3477
+ }
3478
+ ),
3479
+ isFixed && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
3480
+ import_ui_core10.CopyButton,
3481
+ {
3482
+ size: 16,
3483
+ text: seriesName,
3484
+ className: "invisible ml-1 group-hover:visible"
3485
+ }
3486
+ )
3487
+ ]
3488
+ }
3489
+ ),
3490
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
3491
+ "div",
3492
+ {
3493
+ className: (0, import_ui_core10.classNames)(
3494
+ "sentio-tooltip-item min-w-16 flex items-center truncate pl-1 text-right font-semibold",
3495
+ highlighted ? "highlighted" : ""
3496
+ ),
3497
+ children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { children: formatValue(yValue) })
3463
3498
  }
3464
3499
  ),
3465
- /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "mt-2 flex items-center gap-2", children: [
3466
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
3467
- import_ui_core14.Checkbox,
3500
+ sizeValue !== void 0 && sizeValue !== null && /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(import_react16.Fragment, { children: [
3501
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: "border-border-color col-span-2 my-2 w-full border-t" }),
3502
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
3503
+ "div",
3468
3504
  {
3469
- checked: config?.showValueLabel,
3470
- onChange: toggleShowValueLabel,
3471
- label: "Show value label"
3505
+ className: "sentio-tooltip-item series-name text-text-foreground-secondary truncate",
3506
+ style: { minWidth: "4rem" },
3507
+ children: sizeTitle
3472
3508
  }
3473
3509
  ),
3474
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
3475
- import_ui_core14.Checkbox,
3476
- {
3477
- checked: config?.tooltipTotal,
3478
- onChange: toggleTooltipTotal,
3479
- label: "Show total in tooltip"
3480
- }
3481
- )
3510
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: "sentio-tooltip-item min-w-16 text-text-foreground-secondary truncate pl-1 text-right font-semibold", children: formatValue(sizeValue) })
3482
3511
  ] })
3483
3512
  ]
3484
3513
  }
3485
3514
  );
3486
- };
3515
+ }
3487
3516
 
3488
- // src/charts/icons/LineIcon.tsx
3489
- var import_jsx_runtime18 = require("react/jsx-runtime");
3490
- var SvgIcon = ({ className }) => /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
3491
- "svg",
3492
- {
3493
- width: "14",
3494
- height: "14",
3495
- viewBox: "0 0 14 14",
3496
- fill: "none",
3497
- xmlns: "http://www.w3.org/2000/svg",
3498
- className,
3499
- children: [
3500
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("g", { clipPath: "url(#clip0_1774_9563)", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
3501
- "path",
3502
- {
3503
- d: "M12.6191 13.1249H1.35352C1.21672 13.1249 1.10049 13.0771 1.00483 12.9814C0.909161 12.8857 0.861328 12.7695 0.861328 12.6327V1.35352C0.861328 1.21672 0.909161 1.10049 1.00483 1.00483C1.10049 0.909161 1.21672 0.861328 1.35352 0.861328C1.49031 0.861328 1.60654 0.909161 1.7022 1.00483C1.79787 1.10049 1.8457 1.21672 1.8457 1.35352V12.1405H12.6191C12.7559 12.1405 12.8722 12.1883 12.9678 12.284C13.0635 12.3797 13.1113 12.4959 13.1113 12.6327C13.1113 12.7695 13.0635 12.8857 12.9678 12.9814C12.8722 13.0771 12.7559 13.1249 12.6191 13.1249ZM5.26345 10.1582C5.0902 10.1582 4.95341 10.0853 4.85308 9.93945L2.7067 6.52127C2.63379 6.40285 2.61104 6.27758 2.63845 6.14545C2.66587 6.01333 2.73645 5.91081 2.8502 5.83789C2.96395 5.76497 3.08704 5.74222 3.21945 5.76964C3.35187 5.79706 3.45439 5.86545 3.52702 5.97483L5.05827 8.46333L5.68739 6.04352C5.72385 5.89768 5.81047 5.79283 5.94727 5.72895L8.43576 4.52583C8.55418 4.47099 8.67274 4.45962 8.79145 4.4917C8.91016 4.52379 9.00583 4.59437 9.07845 4.70345L10.3227 6.72689L12.155 1.21702C12.2005 1.08927 12.2826 0.993599 12.4013 0.930016C12.52 0.866432 12.6431 0.857245 12.7705 0.902453C12.898 0.947661 12.9936 1.02977 13.0575 1.14877C13.1214 1.26777 13.1306 1.39085 13.0851 1.51802L10.9247 8.03939C10.8608 8.24006 10.724 8.35177 10.5143 8.37452C10.3046 8.39727 10.1451 8.32202 10.0357 8.14877L8.46333 5.60558L6.59039 6.50814L5.74252 9.78939C5.68768 9.9991 5.55556 10.1177 5.34614 10.1451C5.31872 10.1541 5.29131 10.1586 5.26389 10.1586L5.26345 10.1582Z",
3504
- fill: "currentColor"
3517
+ // src/charts/PieChart.tsx
3518
+ var import_react17 = require("react");
3519
+ var import_react_resize_detector3 = require("react-resize-detector");
3520
+ var import_jsx_runtime22 = require("react/jsx-runtime");
3521
+ var theresholdWidth = 480;
3522
+ var TOOLTIP_MIN_VIEWPORT_LEFT = 8;
3523
+ var TOOLTIP_MIN_VIEWPORT_RIGHT = 8;
3524
+ var PieChart2 = (0, import_react17.forwardRef)(
3525
+ (props, ref) => {
3526
+ const {
3527
+ series,
3528
+ valueFormatter,
3529
+ config,
3530
+ title,
3531
+ minHeight,
3532
+ loading,
3533
+ style,
3534
+ onInitChart
3535
+ } = props;
3536
+ const [options, setOptions] = (0, import_react17.useState)({});
3537
+ const isDarkMode = useDarkMode();
3538
+ const isMobile2 = isMobile();
3539
+ const { width, ref: resizeRef } = (0, import_react_resize_detector3.useResizeDetector)({
3540
+ refreshMode: "debounce",
3541
+ refreshRate: 500,
3542
+ handleHeight: false
3543
+ });
3544
+ const tooltipPosition = (point, _params, _dom, _rect, size) => {
3545
+ const chartRect = resizeRef.current?.getBoundingClientRect();
3546
+ const chartLeft = chartRect?.left ?? 0;
3547
+ const winW = typeof window !== "undefined" ? window.innerWidth : size.viewSize[0];
3548
+ const [w, h] = size.contentSize;
3549
+ const minXInChart = TOOLTIP_MIN_VIEWPORT_LEFT - chartLeft;
3550
+ const maxXInChart = winW - TOOLTIP_MIN_VIEWPORT_RIGHT - chartLeft - w;
3551
+ let x = point[0] + 12;
3552
+ if (x > maxXInChart) {
3553
+ x = point[0] - w - 12;
3554
+ }
3555
+ if (x < minXInChart) x = minXInChart;
3556
+ if (x > maxXInChart) x = maxXInChart;
3557
+ const y = Math.max(0, point[1] - h / 2);
3558
+ return [x, y];
3559
+ };
3560
+ (0, import_react17.useEffect)(() => {
3561
+ const isHLegend = width && width < theresholdWidth;
3562
+ const winW = typeof window !== "undefined" ? window.innerWidth : 1024;
3563
+ const tooltipMaxWidth = Math.max(160, Math.min(280, winW - 48));
3564
+ const tooltipExtraCss = isMobile2 ? `max-width: ${tooltipMaxWidth}px; white-space: normal; word-break: break-word; overflow-wrap: anywhere;` : "";
3565
+ const d = [];
3566
+ series.forEach((s) => {
3567
+ if (s.data.length > 0 && s.data[0] && s.data[0][1] != null) {
3568
+ const rawValue = s.data[0][1];
3569
+ if (config?.pieConfig?.absValue) {
3570
+ d.push({ name: s.name, value: Math.abs(rawValue) });
3571
+ } else if (rawValue > 0) {
3572
+ d.push({ name: s.name, value: rawValue });
3573
+ }
3505
3574
  }
3506
- ) }),
3507
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("defs", { children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("clipPath", { id: "clip0_1774_9563", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("rect", { width: "14", height: "14", fill: "white" }) }) })
3508
- ]
3509
- }
3510
- );
3511
- var LineIcon_default = SvgIcon;
3512
-
3513
- // src/charts/icons/AreaIcon.tsx
3514
- var import_jsx_runtime19 = require("react/jsx-runtime");
3515
- var SvgIcon2 = ({ className }) => /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(
3516
- "svg",
3517
- {
3518
- width: "14",
3519
- height: "14",
3520
- viewBox: "0 0 14 14",
3521
- fill: "none",
3522
- xmlns: "http://www.w3.org/2000/svg",
3523
- className,
3524
- children: [
3525
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("g", { clipPath: "url(#clip0_1774_9545)", children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
3526
- "path",
3575
+ });
3576
+ const total = d.reduce((acc, cur) => acc + cur.value, 0);
3577
+ d.sort((a, b) => {
3578
+ const percentA = a.value / total * 100;
3579
+ const percentB = b.value / total * 100;
3580
+ return percentB - percentA;
3581
+ });
3582
+ const pieSeries = [
3527
3583
  {
3528
- d: "M12.6193 13.1249H1.35364C1.21685 13.1249 1.10062 13.0771 1.00495 12.9814C0.909284 12.8857 0.86145 12.7695 0.86145 12.6327V1.35352C0.86145 1.21672 0.909284 1.10049 1.00495 1.00483C1.10062 0.909161 1.21685 0.861328 1.35364 0.861328C1.49043 0.861328 1.60666 0.909161 1.70233 1.00483C1.79799 1.10049 1.84583 1.21672 1.84583 1.35352V12.1405H12.6193C12.7561 12.1405 12.8723 12.1883 12.968 12.284C13.0636 12.3797 13.1115 12.4959 13.1115 12.6327C13.1115 12.7695 13.0636 12.8857 12.968 12.9814C12.8723 13.0771 12.7561 13.1249 12.6193 13.1249ZM2.62501 10.9374L4.22451 8.08008C4.26097 8.0162 4.31566 7.97289 4.38858 7.95014C4.46149 7.92739 4.53441 7.92972 4.60733 7.95714L6.12501 8.66808L7.73851 6.33008C7.83885 6.19329 7.96193 6.16135 8.10776 6.23427L9.61189 6.99989L11.7994 3.56814C11.8633 3.46781 11.9521 3.43368 12.0658 3.46577C12.1796 3.49785 12.2366 3.5731 12.2369 3.69152V10.8009C12.2369 10.9467 12.1845 11.072 12.0798 11.1767C11.9751 11.2814 11.8498 11.3338 11.704 11.3338H2.87176C2.77143 11.3338 2.69399 11.2905 2.63945 11.2038C2.58491 11.1172 2.58039 11.0284 2.62589 10.9374H2.62501Z",
3529
- fill: "currentColor"
3584
+ type: "pie",
3585
+ radius: [config?.pieConfig?.pieType == "Donut" ? "40%" : 0, "70%"],
3586
+ center: isHLegend ? ["50%", "50%"] : ["35%", "50%"],
3587
+ label: { show: false },
3588
+ labelLine: { length: 10, length2: 10, maxSurfaceAngle: 50 },
3589
+ data: d
3530
3590
  }
3531
- ) }),
3532
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("defs", { children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("clipPath", { id: "clip0_1774_9545", children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("rect", { width: "14", height: "14", fill: "white" }) }) })
3533
- ]
3534
- }
3535
- );
3536
- var AreaIcon_default = SvgIcon2;
3537
-
3538
- // src/charts/icons/BarIcon.tsx
3539
- var import_jsx_runtime20 = require("react/jsx-runtime");
3540
- var SvgIcon3 = ({ className }) => /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
3541
- "svg",
3542
- {
3543
- width: "14",
3544
- height: "14",
3545
- viewBox: "0 0 14 14",
3546
- fill: "none",
3547
- xmlns: "http://www.w3.org/2000/svg",
3548
- className,
3549
- children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
3550
- "path",
3591
+ ];
3592
+ const options2 = {
3593
+ title: { text: title, left: 8 },
3594
+ legend: isHLegend ? {
3595
+ type: "scroll",
3596
+ orient: "horizontal",
3597
+ bottom: 12,
3598
+ left: "center",
3599
+ animation: true,
3600
+ animationDurationUpdate: 300,
3601
+ pageIconSize: [10, 8],
3602
+ pageButtonItemGap: 2,
3603
+ pageButtonGap: 4,
3604
+ textStyle: {
3605
+ width: width ? width * 0.4 : 100,
3606
+ overflow: "truncate"
3607
+ },
3608
+ tooltip: {
3609
+ show: true,
3610
+ appendToBody: true,
3611
+ extraCssText: tooltipExtraCss,
3612
+ position: tooltipPosition,
3613
+ formatter: function(params) {
3614
+ const name = params.name;
3615
+ const item = d.find((i) => i.name === name);
3616
+ let ret = name;
3617
+ if (config?.pieConfig?.showValue && item) {
3618
+ ret += "<br/>" + valueFormatter(item.value);
3619
+ }
3620
+ if (config?.pieConfig?.showPercent && item) {
3621
+ const percent = (item.value / d.reduce((acc, cur) => acc + cur.value, 0) * 100).toFixed(2);
3622
+ ret += config.pieConfig.showValue ? ` \u2022 ${percent}%` : `
3623
+ ${percent}%`;
3624
+ }
3625
+ return ret;
3626
+ }
3627
+ }
3628
+ } : {
3629
+ type: "scroll",
3630
+ orient: "vertical",
3631
+ right: 16,
3632
+ top: title ? 48 : 8,
3633
+ width: "35%",
3634
+ animation: true,
3635
+ animationDurationUpdate: 300,
3636
+ tooltip: {
3637
+ show: true,
3638
+ appendToBody: true,
3639
+ extraCssText: tooltipExtraCss,
3640
+ position: tooltipPosition,
3641
+ formatter: function(params) {
3642
+ const name = params.name;
3643
+ const item = d.find((i) => i.name === name);
3644
+ let ret = name;
3645
+ if (config?.pieConfig?.showValue && item) {
3646
+ ret += "<br/>" + valueFormatter(item.value);
3647
+ }
3648
+ if (config?.pieConfig?.showPercent && item) {
3649
+ const percent = (item.value / d.reduce((acc, cur) => acc + cur.value, 0) * 100).toFixed(2);
3650
+ ret += config.pieConfig.showValue ? ` \u2022 ${percent}%` : `
3651
+ ${percent}%`;
3652
+ }
3653
+ return ret;
3654
+ }
3655
+ },
3656
+ icon: "roundRect",
3657
+ itemWidth: 12,
3658
+ itemHeight: 12,
3659
+ itemGap: 6,
3660
+ show: true,
3661
+ pageIconSize: [8, 10],
3662
+ pageButtonGap: 4,
3663
+ pageButtonItemGap: 2,
3664
+ pageIconColor: isDarkMode ? "#909399" : "#4E5969",
3665
+ pageIconInactiveColor: isDarkMode ? "#606266" : "#C9CDD4",
3666
+ textStyle: {
3667
+ width: width ? width * 0.3 : "auto",
3668
+ overflow: "truncate",
3669
+ lineHeight: 16,
3670
+ fontSize: 12,
3671
+ rich: { value: { padding: [4, 0, 0, 0] } }
3672
+ },
3673
+ formatter: (name) => {
3674
+ const item = d.find((i) => i.name === name);
3675
+ let ret = name;
3676
+ if (config?.pieConfig?.showValue && item) {
3677
+ ret += "\n" + valueFormatter(item.value);
3678
+ }
3679
+ if (config?.pieConfig?.showPercent && item) {
3680
+ const percent = (item.value / d.reduce((acc, cur) => acc + cur.value, 0) * 100).toFixed(2);
3681
+ ret += config.pieConfig.showValue ? ` \u2022 ${percent}%` : `
3682
+ ${percent}%`;
3683
+ }
3684
+ return ret;
3685
+ }
3686
+ },
3687
+ tooltip: {
3688
+ trigger: "item",
3689
+ appendToBody: true,
3690
+ extraCssText: tooltipExtraCss,
3691
+ position: tooltipPosition,
3692
+ formatter: ({ name, data, percent }) => {
3693
+ let ret = `${name}`;
3694
+ if (config?.pieConfig?.showValue) {
3695
+ ret += "<br/>" + valueFormatter(data.value);
3696
+ }
3697
+ if (config?.pieConfig?.showPercent) {
3698
+ ret += config.pieConfig.showValue ? ` (${percent}%)` : `
3699
+ ${percent}%`;
3700
+ }
3701
+ return ret;
3702
+ }
3703
+ },
3704
+ toolbox: { show: false },
3705
+ animation: false,
3706
+ series: pieSeries
3707
+ };
3708
+ setOptions(options2);
3709
+ }, [series, config, valueFormatter, isDarkMode, isMobile2, width, title]);
3710
+ return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: "h-full w-full", ref: resizeRef, children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
3711
+ ReactEChartsBase,
3551
3712
  {
3552
- d: "M2.12791 1.5625V12.4375C2.12791 12.5938 2.07311 12.7267 1.96349 12.836C1.85387 12.9453 1.7207 13 1.56396 13C1.40722 13 1.27404 12.9453 1.16442 12.836C1.05481 12.7267 1 12.5938 1 12.4375V1.5625C1 1.40617 1.05481 1.27333 1.16442 1.164C1.27404 1.05467 1.40722 1 1.56396 1C1.7207 1 1.85387 1.05467 1.96349 1.164C2.07311 1.27333 2.12791 1.40617 2.12791 1.5625ZM1.56396 11.875H12.436C12.5928 11.875 12.726 11.9297 12.8356 12.039C12.9452 12.1483 13 12.2812 13 12.4375C13 12.5938 12.9452 12.7267 12.8356 12.836C12.726 12.9453 12.5928 13 12.436 13H1.56396C1.40722 13 1.27404 12.9453 1.16442 12.836C1.05481 12.7267 1 12.5938 1 12.4375C1 12.2812 1.05481 12.1483 1.16442 12.039C1.27404 11.9297 1.40722 11.875 1.56396 11.875ZM5.12014 4.578V10.375C5.12014 10.5313 5.06534 10.6642 4.95572 10.7735C4.8461 10.8828 4.71293 10.9375 4.55619 10.9375C4.39945 10.9375 4.26627 10.8828 4.15665 10.7735C4.04704 10.6642 3.99223 10.5313 3.99223 10.375V4.578C3.99223 4.42167 4.04704 4.28883 4.15665 4.1795C4.26627 4.07017 4.39945 4.0155 4.55619 4.0155C4.71293 4.0155 4.8461 4.07017 4.95572 4.1795C5.06534 4.28883 5.12014 4.42167 5.12014 4.578ZM11.1196 2.5465V10.3745C11.1196 10.5308 11.0648 10.6637 10.9552 10.773C10.8456 10.8823 10.7124 10.937 10.5557 10.937C10.3989 10.937 10.2658 10.8823 10.1562 10.773C10.0465 10.6637 9.99173 10.5308 9.99173 10.3745V2.5465C9.99173 2.39017 10.0465 2.25733 10.1562 2.148C10.2658 2.03867 10.3989 1.984 10.5557 1.984C10.7124 1.984 10.8456 2.03867 10.9552 2.148C11.0648 2.25733 11.1196 2.39017 11.1196 2.5465ZM8.11187 6.5465V10.3745C8.11187 10.5308 8.05706 10.6637 7.94745 10.773C7.83783 10.8823 7.70465 10.937 7.54792 10.937C7.39118 10.937 7.258 10.8823 7.14838 10.773C7.03877 10.6637 6.98396 10.5308 6.98396 10.3745V6.5465C6.98396 6.39017 7.03877 6.25733 7.14838 6.148C7.258 6.03867 7.39118 5.984 7.54792 5.984C7.69429 5.984 7.8248 6.03867 7.93943 6.148C8.05406 6.25733 8.11154 6.39017 8.11187 6.5465Z",
3553
- fill: "currentColor"
3713
+ ref,
3714
+ loading,
3715
+ option: options,
3716
+ minHeight,
3717
+ style,
3718
+ noLegend: true,
3719
+ onInitChart
3554
3720
  }
3555
- )
3556
- }
3557
- );
3558
- var BarIcon_default = SvgIcon3;
3559
-
3560
- // src/charts/icons/BarGuageIcon.tsx
3561
- var import_jsx_runtime21 = require("react/jsx-runtime");
3562
- var SvgIcon4 = ({ className }) => /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
3563
- "svg",
3564
- {
3565
- width: "14",
3566
- height: "14",
3567
- viewBox: "0 0 14 14",
3568
- fill: "currentColor",
3569
- className,
3570
- xmlns: "http://www.w3.org/2000/svg",
3571
- children: [
3572
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
3573
- "path",
3574
- {
3575
- d: "M2.12791 1.5625V12.4375C2.12791 12.5938 2.07311 12.7267 1.96349 12.836C1.85387 12.9453 1.7207 13 1.56396 13C1.40722 13 1.27404 12.9453 1.16442 12.836C1.05481 12.7267 1 12.5938 1 12.4375V1.5625C1 1.40617 1.05481 1.27333 1.16442 1.164C1.27404 1.05467 1.40722 1 1.56396 1C1.7207 1 1.85387 1.05467 1.96349 1.164C2.07311 1.27333 2.12791 1.40617 2.12791 1.5625ZM1.56396 11.875H12.436C12.5928 11.875 12.726 11.9297 12.8356 12.039C12.9452 12.1483 13 12.2812 13 12.4375C13 12.5938 12.9452 12.7267 12.8356 12.836C12.726 12.9453 12.5928 13 12.436 13H1.56396C1.40722 13 1.27404 12.9453 1.16442 12.836C1.05481 12.7267 1 12.5938 1 12.4375C1 12.2812 1.05481 12.1483 1.16442 12.039C1.27404 11.9297 1.40722 11.875 1.56396 11.875Z",
3576
- fill: "currentColor"
3577
- }
3578
- ),
3579
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
3580
- "path",
3581
- {
3582
- d: "M3.64159 4.02495H9.43859C9.59493 4.02495 9.72776 3.97014 9.83709 3.86052C9.94643 3.75091 10.0011 3.61773 10.0011 3.46099C10.0011 3.30425 9.94643 3.17108 9.83709 3.06146C9.72776 2.95184 9.59493 2.89703 9.43859 2.89703L3.64159 2.89703C3.48526 2.89703 3.35243 2.95184 3.24309 3.06146C3.13376 3.17108 3.07909 3.30425 3.07909 3.46099C3.07909 3.61773 3.13376 3.75091 3.24309 3.86052C3.35243 3.97014 3.48526 4.02495 3.64159 4.02495Z",
3583
- fill: "currentColor"
3584
- }
3585
- ),
3586
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
3587
- "path",
3588
- {
3589
- d: "M3.64209 10.0244H11.4701C11.6264 10.0244 11.7593 9.96964 11.8686 9.86002C11.9779 9.7504 12.0326 9.61723 12.0326 9.46049C12.0326 9.30375 11.9779 9.17057 11.8686 9.06096C11.7593 8.95134 11.6264 8.89653 11.4701 8.89653H3.64209C3.48576 8.89653 3.35293 8.95134 3.24359 9.06096C3.13426 9.17057 3.07959 9.30375 3.07959 9.46049C3.07959 9.61723 3.13426 9.7504 3.24359 9.86002C3.35293 9.96964 3.48576 10.0244 3.64209 10.0244Z",
3590
- fill: "currentColor"
3591
- }
3592
- ),
3593
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
3594
- "path",
3595
- {
3596
- d: "M3.64209 7.01668L7.47009 7.01668C7.62643 7.01634 7.75926 6.95886 7.86859 6.84423C7.97793 6.7296 8.03259 6.5991 8.03259 6.45272C8.03259 6.29598 7.97793 6.1628 7.86859 6.05319C7.75926 5.94357 7.62643 5.88876 7.47009 5.88876H3.64209C3.48576 5.88876 3.35293 5.94357 3.24359 6.05319C3.13426 6.1628 3.07959 6.29598 3.07959 6.45272C3.07959 6.60946 3.13426 6.74263 3.24359 6.85225C3.35293 6.96187 3.48576 7.01668 3.64209 7.01668Z",
3597
- fill: "currentColor"
3598
- }
3599
- )
3600
- ]
3721
+ ) });
3601
3722
  }
3602
3723
  );
3603
- var BarGuageIcon_default = SvgIcon4;
3724
+ PieChart2.displayName = "PieChart";
3604
3725
 
3605
- // src/charts/icons/PieIcon.tsx
3606
- var import_jsx_runtime22 = require("react/jsx-runtime");
3607
- var SvgIcon5 = ({ className }) => /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
3608
- "svg",
3609
- {
3610
- width: "14",
3611
- height: "14",
3612
- viewBox: "0 0 14 14",
3613
- fill: "none",
3614
- xmlns: "http://www.w3.org/2000/svg",
3615
- className,
3616
- children: [
3617
- /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("g", { clipPath: "url(#clip0_28267_7202)", children: [
3618
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
3619
- "path",
3726
+ // src/charts/options/LineControls.tsx
3727
+ var import_immer4 = require("immer");
3728
+ var import_ui_core11 = require("@sentio/ui-core");
3729
+ var import_jsx_runtime23 = require("react/jsx-runtime");
3730
+ var lineStyles = [
3731
+ { label: "Solid", value: "Solid" },
3732
+ { label: "Dotted", value: "Dotted" }
3733
+ ];
3734
+ var LineControls = ({ config, defaultOpen, onChange }) => {
3735
+ const setStyle = (style) => {
3736
+ onChange(
3737
+ (0, import_immer4.produce)(config || {}, (draft) => {
3738
+ draft.style = style;
3739
+ })
3740
+ );
3741
+ };
3742
+ const setSmooth = (smooth) => {
3743
+ onChange(
3744
+ (0, import_immer4.produce)(config || {}, (draft) => {
3745
+ draft.smooth = smooth;
3746
+ })
3747
+ );
3748
+ };
3749
+ return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
3750
+ import_ui_core11.DisclosurePanel,
3751
+ {
3752
+ title: "Line style",
3753
+ containerClassName: "w-full bg-default-bg",
3754
+ children: /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "flex items-center gap-4", children: [
3755
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
3756
+ import_ui_core11.NewButtonGroup,
3620
3757
  {
3621
- d: "M5.83329 1.86662C4.92079 2.07816 4.08149 2.52998 3.40247 3.17523C2.72345 3.82048 2.22942 4.63564 1.97164 5.53618C1.71386 6.43671 1.70171 7.38982 1.93644 8.29663C2.17118 9.20345 2.64426 10.0309 3.30661 10.6933C3.96896 11.3556 4.79646 11.8287 5.70327 12.0635C6.61009 12.2982 7.56319 12.286 8.46373 12.0283C9.36426 11.7705 10.1794 11.2765 10.8247 10.5974C11.4699 9.91841 11.9217 9.07912 12.1333 8.16662C12.1333 8.01191 12.0718 7.86353 11.9624 7.75414C11.853 7.64474 11.7047 7.58328 11.55 7.58328H7.58329C7.27387 7.58328 6.97713 7.46037 6.75833 7.24157C6.53954 7.02278 6.41662 6.72604 6.41662 6.41662V2.33328C6.40938 2.26417 6.38848 2.19719 6.35515 2.13621C6.32182 2.07524 6.27671 2.02149 6.22245 1.97808C6.16819 1.93467 6.10585 1.90247 6.03905 1.88333C5.97224 1.8642 5.90231 1.85852 5.83329 1.86662Z",
3622
- stroke: "currentColor",
3623
- strokeWidth: "1.16667",
3624
- strokeLinecap: "round",
3625
- strokeLinejoin: "round"
3758
+ buttons: lineStyles,
3759
+ value: config?.style || "Solid",
3760
+ onChange: setStyle,
3761
+ small: true
3626
3762
  }
3627
3763
  ),
3628
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
3629
- "path",
3764
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
3765
+ import_ui_core11.Checkbox,
3630
3766
  {
3631
- d: "M8.75 2.04175C9.49067 2.30255 10.1634 2.72617 10.7187 3.28142C11.2739 3.83668 11.6975 4.50941 11.9583 5.25008H9.33333C9.17862 5.25008 9.03025 5.18862 8.92085 5.07923C8.81146 4.96983 8.75 4.82146 8.75 4.66675V2.04175Z",
3632
- stroke: "currentColor",
3633
- strokeWidth: "1.16667",
3634
- strokeLinecap: "round",
3635
- strokeLinejoin: "round"
3767
+ label: "Smooth Curves",
3768
+ checked: config?.smooth,
3769
+ onChange: setSmooth
3636
3770
  }
3637
3771
  )
3638
- ] }),
3639
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("defs", { children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("clipPath", { id: "clip0_28267_7202", children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("rect", { width: "14", height: "14", fill: "white" }) }) })
3640
- ]
3641
- }
3642
- );
3643
- var PieIcon_default = SvgIcon5;
3772
+ ] })
3773
+ }
3774
+ );
3775
+ };
3644
3776
 
3645
- // src/charts/icons/QueryValueIcon.tsx
3646
- var import_jsx_runtime23 = require("react/jsx-runtime");
3647
- var SvgIcon6 = ({ className }) => /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
3648
- "svg",
3649
- {
3650
- width: "14",
3651
- height: "14",
3652
- viewBox: "0 0 14 14",
3653
- fill: "none",
3654
- className,
3655
- xmlns: "http://www.w3.org/2000/svg",
3656
- children: [
3657
- /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("g", { clipPath: "url(#clip0_3670_4424)", children: [
3658
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
3659
- "path",
3777
+ // src/charts/options/LabelControls.tsx
3778
+ var import_react18 = require("react");
3779
+ var import_immer5 = require("immer");
3780
+ var import_ui_core12 = require("@sentio/ui-core");
3781
+ var import_jsx_runtime24 = require("react/jsx-runtime");
3782
+ var initialConfig = {
3783
+ columns: [],
3784
+ alias: ""
3785
+ };
3786
+ var LabelControls = ({ config, setConfig, defaultOpen }) => {
3787
+ (0, import_react18.useEffect)(() => {
3788
+ if (config?.columns && config.columns.length > 0 && !config.alias) {
3789
+ const aliasParts = [];
3790
+ config.columns.forEach((colConfig) => {
3791
+ if (!colConfig.name) return;
3792
+ if (colConfig.showLabel === false && colConfig.showValue === false) {
3793
+ } else if (colConfig.showValue === false) {
3794
+ aliasParts.push(colConfig.name);
3795
+ } else {
3796
+ aliasParts.push(`{{${colConfig.name}}}`);
3797
+ }
3798
+ });
3799
+ if (aliasParts.length > 0) {
3800
+ const migratedAlias = aliasParts.join(", ");
3801
+ setConfig(
3802
+ (0, import_immer5.produce)(config, (draft) => {
3803
+ draft.alias = migratedAlias;
3804
+ draft.columns = [];
3805
+ })
3806
+ );
3807
+ }
3808
+ }
3809
+ }, [config, setConfig]);
3810
+ const onAliasChanged = (alias) => {
3811
+ setConfig(
3812
+ (0, import_immer5.produce)(config ?? initialConfig, (draft) => {
3813
+ draft.alias = alias;
3814
+ })
3815
+ );
3816
+ };
3817
+ const _defaultOpen = (0, import_react18.useMemo)(() => {
3818
+ if (defaultOpen) {
3819
+ return true;
3820
+ }
3821
+ return config?.alias !== "" || config?.columns && config.columns.length > 0;
3822
+ }, [config, defaultOpen]);
3823
+ return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
3824
+ import_ui_core12.DisclosurePanel,
3825
+ {
3826
+ title: "Label Controls",
3827
+ defaultOpen: _defaultOpen,
3828
+ containerClassName: "w-full bg-default-bg",
3829
+ children: /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: "flex items-center gap-2", children: [
3830
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: "inline-flex h-8", children: [
3831
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("span", { className: "sm:text-icontent border-main inline-flex items-center rounded-l-md border border-r-0 bg-gray-50 px-2 font-medium", children: [
3832
+ "Label Alias",
3833
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
3834
+ import_ui_core12.HelpIcon,
3835
+ {
3836
+ text: /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: "text-icontent text-text-foreground", children: [
3837
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { children: "Series name override or template." }),
3838
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { children: [
3839
+ "Ex.",
3840
+ " ",
3841
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { className: "text-primary mx-1 font-semibold italic", children: "{{contract}}" }),
3842
+ " ",
3843
+ "will be replaced with the value of the contract label."
3844
+ ] })
3845
+ ] })
3846
+ }
3847
+ )
3848
+ ] }),
3849
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
3850
+ "input",
3851
+ {
3852
+ type: "text",
3853
+ value: config?.alias || "",
3854
+ onChange: (e) => onAliasChanged(e.target.value),
3855
+ placeholder: "Enter alias...",
3856
+ className: "focus:border-primary-500 sm:text-icontent border-main inline-flex w-64 items-center rounded-r-md border px-2"
3857
+ }
3858
+ )
3859
+ ] }),
3860
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
3861
+ import_ui_core12.Button,
3660
3862
  {
3661
- d: "M11.5 1.5H2.5C1.67157 1.5 1 2.11561 1 2.875V11.125C1 11.8844 1.67157 12.5 2.5 12.5H11.5C12.3284 12.5 13 11.8844 13 11.125V2.875C13 2.11561 12.3284 1.5 11.5 1.5Z",
3662
- stroke: "currentColor",
3663
- strokeWidth: "1.16667",
3664
- strokeLinecap: "round",
3665
- strokeLinejoin: "round"
3863
+ type: "button",
3864
+ role: "link",
3865
+ onClick: () => {
3866
+ setConfig(initialConfig);
3867
+ },
3868
+ children: "Reset"
3666
3869
  }
3667
- ),
3668
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
3669
- "path",
3870
+ )
3871
+ ] })
3872
+ }
3873
+ );
3874
+ };
3875
+
3876
+ // src/charts/options/PieChartControls.tsx
3877
+ var import_immer6 = require("immer");
3878
+ var import_lodash5 = require("lodash");
3879
+ var import_ui_core13 = require("@sentio/ui-core");
3880
+ var import_jsx_runtime25 = require("react/jsx-runtime");
3881
+ var defaultConfig = {
3882
+ pieType: "Pie",
3883
+ calculation: "LAST",
3884
+ showPercent: true,
3885
+ showValue: true,
3886
+ absValue: false
3887
+ };
3888
+ var CalculationItems = [
3889
+ { label: "Last", value: "LAST" },
3890
+ { label: "First", value: "FIRST" },
3891
+ { label: "Total", value: "TOTAL" },
3892
+ { label: "Mean", value: "MEAN" },
3893
+ { label: "Max", value: "MAX" },
3894
+ { label: "Min", value: "MIN" }
3895
+ ];
3896
+ var PieTypeItems = [
3897
+ { label: "Pie", value: "Pie" },
3898
+ { label: "Donut", value: "Donut" }
3899
+ ];
3900
+ function PieChartControls({ config, defaultOpen, onChange }) {
3901
+ config = (0, import_lodash5.defaults)(config, defaultConfig);
3902
+ function onCalculationChange(cal) {
3903
+ config && onChange((0, import_immer6.produce)(config, (draft) => void (draft.calculation = cal)));
3904
+ }
3905
+ function onPieTypeChange(pieType) {
3906
+ config && onChange((0, import_immer6.produce)(config, (draft) => void (draft.pieType = pieType)));
3907
+ }
3908
+ function toggle(field, value) {
3909
+ config && onChange(
3910
+ (0, import_immer6.produce)(config, (draft) => {
3911
+ draft[field] = value;
3912
+ })
3913
+ );
3914
+ }
3915
+ return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
3916
+ import_ui_core13.DisclosurePanel,
3917
+ {
3918
+ title: "Pie Chart Options",
3919
+ defaultOpen,
3920
+ containerClassName: "w-full bg-default-bg",
3921
+ children: /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "flex items-center gap-4", children: [
3922
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: "shadow-xs flex rounded-md", children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
3923
+ import_ui_core13.NewButtonGroup,
3670
3924
  {
3671
- d: "M7.98188 5.77273H6.39097L5.75461 5.13636L6.39097 4.5H7.98188L8.61824 5.13636L7.98188 5.77273Z",
3672
- fill: "currentColor"
3925
+ small: true,
3926
+ buttons: PieTypeItems,
3927
+ value: config.pieType,
3928
+ onChange: onPieTypeChange
3929
+ }
3930
+ ) }),
3931
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "shadow-xs flex rounded-md", children: [
3932
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { className: "sm:text-ilabel border-main inline-flex items-center rounded-l-md border border-r-0 bg-gray-50 px-3 ", children: "Calculation" }),
3933
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
3934
+ "select",
3935
+ {
3936
+ value: config.calculation,
3937
+ className: "sm:text-ilabel text-text-foreground border-main hover:border-primary-600 focus:ring-3 focus:ring-primary-600/30 focus:border-primary-600 inline-flex items-center rounded-r-md border pl-4 pr-7",
3938
+ onChange: (e) => onCalculationChange(e.target.value),
3939
+ children: CalculationItems.map((d) => {
3940
+ return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("option", { value: d.value, children: d.label }, d.value);
3941
+ })
3942
+ }
3943
+ )
3944
+ ] }),
3945
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
3946
+ import_ui_core13.Checkbox,
3947
+ {
3948
+ checked: config?.showValue,
3949
+ onChange: (v) => toggle("showValue", v),
3950
+ label: "Show value",
3951
+ labelClassName: "whitespace-nowrap"
3673
3952
  }
3674
3953
  ),
3675
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
3676
- "path",
3954
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
3955
+ import_ui_core13.Checkbox,
3677
3956
  {
3678
- d: "M7.98188 11.5H6.39097L5.75461 10.8637L6.39097 10.2273H7.98188L8.61824 10.8637L7.98188 11.5Z",
3679
- fill: "currentColor"
3957
+ checked: config?.showPercent,
3958
+ onChange: (v) => toggle("showPercent", v),
3959
+ label: "Show percent",
3960
+ labelClassName: "whitespace-nowrap"
3680
3961
  }
3681
3962
  ),
3682
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
3683
- "path",
3963
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
3964
+ import_ui_core13.Checkbox,
3965
+ {
3966
+ checked: config?.absValue,
3967
+ onChange: (v) => toggle("absValue", v),
3968
+ label: "Use absolute values",
3969
+ labelClassName: "whitespace-nowrap"
3970
+ }
3971
+ )
3972
+ ] })
3973
+ }
3974
+ );
3975
+ }
3976
+
3977
+ // src/charts/options/BarGaugeControls.tsx
3978
+ var import_immer7 = require("immer");
3979
+ var import_lodash6 = require("lodash");
3980
+ var import_ui_core14 = require("@sentio/ui-core");
3981
+ var import_jsx_runtime26 = require("react/jsx-runtime");
3982
+ var defaultConfig2 = {
3983
+ direction: "HORIZONTAL",
3984
+ calculation: "LAST",
3985
+ sort: {
3986
+ sortBy: "ByName",
3987
+ orderDesc: true
3988
+ }
3989
+ };
3990
+ var directionItems = [
3991
+ { label: "Horizontal", value: "HORIZONTAL" },
3992
+ { label: "Vertical", value: "VERTICAL" }
3993
+ ];
3994
+ var CalculationItems2 = [
3995
+ { label: "Last", value: "LAST" },
3996
+ { label: "First", value: "FIRST" },
3997
+ { label: "Total", value: "TOTAL" },
3998
+ { label: "Mean", value: "MEAN" },
3999
+ { label: "Max", value: "MAX" },
4000
+ { label: "Min", value: "MIN" }
4001
+ ];
4002
+ var sortByItems = [
4003
+ { label: "Name", value: "ByName" },
4004
+ { label: "Value", value: "ByValue" }
4005
+ ];
4006
+ var orderItems = [
4007
+ { label: "Ascendant", value: "false" },
4008
+ { label: "Descendant", value: "true" }
4009
+ ];
4010
+ function BarGaugeControls({ config, defaultOpen, onChange }) {
4011
+ config = (0, import_lodash6.defaults)(config, defaultConfig2);
4012
+ function onCalculationChange(cal) {
4013
+ config && onChange((0, import_immer7.produce)(config, (draft) => void (draft.calculation = cal)));
4014
+ }
4015
+ function onDirectionChange(dir) {
4016
+ config && onChange((0, import_immer7.produce)(config, (draft) => void (draft.direction = dir)));
4017
+ }
4018
+ function onOrderChange(orderDesc) {
4019
+ config && onChange(
4020
+ (0, import_immer7.produce)(config, (draft) => {
4021
+ draft.sort = draft.sort || {};
4022
+ draft.sort.orderDesc = orderDesc;
4023
+ })
4024
+ );
4025
+ }
4026
+ function onSortByChange(sortBy3) {
4027
+ config && onChange(
4028
+ (0, import_immer7.produce)(config, (draft) => {
4029
+ draft.sort = draft.sort || {};
4030
+ draft.sort.sortBy = sortBy3;
4031
+ })
4032
+ );
4033
+ }
4034
+ return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
4035
+ import_ui_core14.DisclosurePanel,
4036
+ {
4037
+ title: "Bar Gauge Options",
4038
+ defaultOpen,
4039
+ containerClassName: "w-full bg-default-bg",
4040
+ children: /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "flex items-center gap-4", children: [
4041
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "shadow-xs flex rounded-md", children: [
4042
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("span", { className: "sm:text-ilabel border-main inline-flex items-center rounded-l-md border border-r-0 bg-gray-50 px-3 ", children: "Direction" }),
4043
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
4044
+ "select",
4045
+ {
4046
+ value: config.direction,
4047
+ className: "sm:text-ilabel border-main text-text-foreground hover:border-primary-600 focus:ring-3 focus:ring-primary-600/30 focus:border-primary-600 inline-flex items-center rounded-r-md border pl-4 pr-7",
4048
+ onChange: (e) => onDirectionChange(e.target.value),
4049
+ children: directionItems.map((d) => {
4050
+ return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("option", { value: d.value, children: d.label }, d.value);
4051
+ })
4052
+ }
4053
+ )
4054
+ ] }),
4055
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "shadow-xs flex rounded-md", children: [
4056
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("span", { className: "sm:text-ilabel border-main inline-flex items-center rounded-l-md border border-r-0 bg-gray-50 px-3 ", children: "Calculation" }),
4057
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
4058
+ "select",
4059
+ {
4060
+ value: config.calculation,
4061
+ className: "sm:text-ilabel border-main text-text-foreground hover:border-primary-600 focus:ring-3 focus:ring-primary-600/30 focus:border-primary-600 inline-flex items-center rounded-r-md border pl-4 pr-7",
4062
+ onChange: (e) => onCalculationChange(e.target.value),
4063
+ children: CalculationItems2.map((d) => {
4064
+ return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("option", { value: d.value, children: d.label }, d.value);
4065
+ })
4066
+ }
4067
+ )
4068
+ ] }),
4069
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "shadow-xs flex rounded-md", children: [
4070
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("span", { className: "sm:text-ilabel border-main inline-flex items-center whitespace-nowrap rounded-l-md border border-r-0 bg-gray-50 px-3", children: "Sort by" }),
4071
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
4072
+ "select",
4073
+ {
4074
+ value: config?.sort?.sortBy,
4075
+ className: "sm:text-ilabel border-main text-text-foreground hover:border-primary-600 focus:ring-3 focus:ring-primary-600/30 focus:border-primary-600 inline-flex items-center border pl-4 pr-7",
4076
+ onChange: (e) => onSortByChange(e.target.value),
4077
+ children: sortByItems.map((d) => {
4078
+ return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("option", { value: d.value, children: d.label }, d.value);
4079
+ })
4080
+ }
4081
+ ),
4082
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
4083
+ "select",
4084
+ {
4085
+ value: config?.sort?.orderDesc + "",
4086
+ className: "sm:text-ilabel border-main text-text-foreground hover:border-primary-600 focus:ring-3 focus:ring-primary-600/30 focus:border-primary-600 inline-flex items-center rounded-r-md border border-l-0 pl-4 pr-7",
4087
+ onChange: (e) => onOrderChange(e.target.value === "true"),
4088
+ children: orderItems.map((d) => {
4089
+ return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("option", { value: d.value + "", children: d.label }, d.label);
4090
+ })
4091
+ }
4092
+ )
4093
+ ] })
4094
+ ] })
4095
+ }
4096
+ );
4097
+ }
4098
+
4099
+ // src/charts/options/ValueOptions.tsx
4100
+ var import_immer9 = require("immer");
4101
+ var import_ui_core16 = require("@sentio/ui-core");
4102
+
4103
+ // src/charts/options/ValueStringMapping.tsx
4104
+ var import_lu5 = require("react-icons/lu");
4105
+ var import_ui_core15 = require("@sentio/ui-core");
4106
+ var import_immer8 = require("immer");
4107
+ var import_jsx_runtime27 = require("react/jsx-runtime");
4108
+ var operators = {
4109
+ ">": "greater than",
4110
+ ">=": "greater or equal",
4111
+ "==": "equal",
4112
+ "!=": "not equal",
4113
+ "<": "less than",
4114
+ "<=": "less or equal"
4115
+ };
4116
+ var renderTreeLine = (index, isLast) => {
4117
+ return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: "mr-2 flex h-12 w-3 flex-col items-center justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "flex h-full w-full items-center", children: [
4118
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
4119
+ "div",
4120
+ {
4121
+ className: (0, import_ui_core15.classNames)(
4122
+ "w-px bg-gray-300",
4123
+ isLast ? "h-1/2 self-start" : index === 0 ? "h-full self-end" : "h-full"
4124
+ )
4125
+ }
4126
+ ),
4127
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: "h-px w-3 bg-gray-300" })
4128
+ ] }) });
4129
+ };
4130
+ function ValueStringMapping({ rules, onChange }) {
4131
+ const addRule = () => {
4132
+ onChange(
4133
+ (0, import_immer8.produce)(rules, (draft) => {
4134
+ draft = draft || [];
4135
+ draft.push({
4136
+ comparison: "==",
4137
+ value: 0,
4138
+ text: ""
4139
+ });
4140
+ })
4141
+ );
4142
+ };
4143
+ function removeRule(index) {
4144
+ onChange(
4145
+ (0, import_immer8.produce)(rules, (draft) => {
4146
+ draft.splice(index, 1);
4147
+ })
4148
+ );
4149
+ }
4150
+ function changeRule(index, field, value) {
4151
+ onChange(
4152
+ (0, import_immer8.produce)(rules, (draft) => {
4153
+ ;
4154
+ draft[index][field] = value;
4155
+ })
4156
+ );
4157
+ }
4158
+ return /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "flex w-full flex-col rounded-md py-2", children: [
4159
+ (rules || []).map((rule, index) => {
4160
+ const isLast = index === (rules || []).length - 1;
4161
+ return /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(
4162
+ "div",
4163
+ {
4164
+ className: "text-text-foreground flex h-10 items-center py-1",
4165
+ children: [
4166
+ renderTreeLine(index, isLast),
4167
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("span", { className: "sm:text-ilabel inline-flex h-full items-center pr-3 font-medium", children: "If value is" }),
4168
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
4169
+ "select",
4170
+ {
4171
+ value: rule.comparison,
4172
+ onChange: (e) => changeRule(index, "comparison", e.target.value),
4173
+ className: "rounded-r-0 sm:text-ilabel border-main text-text-foreground focus:border-primary-600 focus:ring-3 focus:ring-primary-600/30 inline-flex h-full items-center rounded-l-md border border-r-0 bg-gray-50 py-1 pl-4 pr-7",
4174
+ children: Object.entries(operators).map(([op, display]) => {
4175
+ return /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("option", { value: op, children: [
4176
+ "is ",
4177
+ display
4178
+ ] }, op);
4179
+ })
4180
+ }
4181
+ ),
4182
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
4183
+ "input",
4184
+ {
4185
+ type: "text",
4186
+ name: "value",
4187
+ id: "value",
4188
+ className: "w-30 rounded-l-0 sm:text-ilabel border-main hover:border-primary-600 focus:border-primary-600 focus:ring-3 focus:ring-primary-600/30 block h-full rounded-r-md border px-2 py-1",
4189
+ placeholder: "0",
4190
+ value: rule.value,
4191
+ onChange: (e) => {
4192
+ changeRule(index, "value", e.target.value);
4193
+ }
4194
+ }
4195
+ ),
4196
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("span", { className: "sm:text-ilabel inline-flex h-full items-center rounded-none px-3 font-medium", children: ", then show" }),
4197
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
4198
+ "input",
4199
+ {
4200
+ type: "text",
4201
+ name: "text",
4202
+ id: "text",
4203
+ className: "sm:text-ilabel border-main hover:border-primary-600 focus:border-primary-600 focus:ring-3 focus:ring-primary-600/30 block h-full w-80 rounded-md px-2 py-1",
4204
+ placeholder: "Display text (e.g. High, Low, Normal)",
4205
+ value: rule.text,
4206
+ onChange: (e) => {
4207
+ changeRule(index, "text", e.target.value);
4208
+ }
4209
+ }
4210
+ ),
4211
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
4212
+ "button",
4213
+ {
4214
+ type: "button",
4215
+ className: "mx-2",
4216
+ "aria-label": "remove",
4217
+ onClick: () => removeRule(index),
4218
+ children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
4219
+ import_lu5.LuTrash2,
4220
+ {
4221
+ className: "icon text-text-foreground-disabled",
4222
+ "aria-hidden": "true"
4223
+ }
4224
+ )
4225
+ }
4226
+ )
4227
+ ]
4228
+ },
4229
+ index
4230
+ );
4231
+ }),
4232
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(
4233
+ import_ui_core15.Button,
4234
+ {
4235
+ type: "button",
4236
+ role: "secondary",
4237
+ className: "mt-1 w-fit flex-none",
4238
+ "aria-label": "remove",
4239
+ onClick: addRule,
4240
+ children: [
4241
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_lu5.LuPlus, { className: (0, import_ui_core15.classNames)("h-4 w-4"), "aria-hidden": "true" }),
4242
+ "Add Formatting Rule"
4243
+ ]
4244
+ }
4245
+ )
4246
+ ] });
4247
+ }
4248
+
4249
+ // src/charts/options/ValueOptions.tsx
4250
+ var import_jsx_runtime28 = require("react/jsx-runtime");
4251
+ var ValueFormatters = [
4252
+ { label: "Number", value: "NumberFormatter" },
4253
+ { label: "Date", value: "DateFormatter" },
4254
+ { label: "String", value: "StringFormatter" }
4255
+ ];
4256
+ var defaultConfig3 = {
4257
+ valueFormatter: "NumberFormatter",
4258
+ showValueLabel: false,
4259
+ maxSignificantDigits: 3,
4260
+ dateFormat: "LLL",
4261
+ mappingRules: [],
4262
+ style: "None"
4263
+ };
4264
+ var dateFormats = [
4265
+ { label: "Localized format", value: "LLL" },
4266
+ { label: "ISO String", value: "YYYY-MM-DDTHH:mm:ss.sssZ" }
4267
+ ];
4268
+ var CurrencySymbols = [
4269
+ { label: "USD", value: "$" },
4270
+ { label: "EUR", value: "\u20AC" },
4271
+ { label: "GBP", value: "\xA3" },
4272
+ { label: "CNY or JPY", value: "\xA5" },
4273
+ { label: "BTC", value: "\u0243" },
4274
+ { label: "ETH", value: "\u039E" }
4275
+ ];
4276
+ var AddonLabel = ({
4277
+ className,
4278
+ children
4279
+ }) => /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
4280
+ "span",
4281
+ {
4282
+ className: (0, import_ui_core16.classNames)(
4283
+ "sm:text-ilabel border-main inline-flex items-center whitespace-nowrap bg-gray-50 px-3",
4284
+ className
4285
+ ),
4286
+ children
4287
+ }
4288
+ );
4289
+ var ValueOptions = ({
4290
+ config,
4291
+ onChange,
4292
+ formatters = ValueFormatters,
4293
+ showPrefix,
4294
+ showSuffix
4295
+ }) => {
4296
+ function onChangeDateFormat(f) {
4297
+ onChange((0, import_immer9.produce)(config, (draft) => void (draft.dateFormat = f)));
4298
+ }
4299
+ function onChangeFormatter(f) {
4300
+ onChange((0, import_immer9.produce)(config, (draft) => void (draft.valueFormatter = f)));
4301
+ }
4302
+ function onChangeSymbol(symbol) {
4303
+ onChange((0, import_immer9.produce)(config, (draft) => void (draft.currencySymbol = symbol)));
4304
+ }
4305
+ function onStyleChange(notation) {
4306
+ onChange(
4307
+ (0, import_immer9.produce)(config, (draft) => {
4308
+ draft.style = notation;
4309
+ })
4310
+ );
4311
+ }
4312
+ function onDigitsChange(value, option) {
4313
+ onChange(
4314
+ (0, import_immer9.produce)(config, (draft) => {
4315
+ const d = draft;
4316
+ if (value) {
4317
+ const maxSignificantDigits = parseInt(value);
4318
+ if (maxSignificantDigits >= 0 && maxSignificantDigits <= 20) {
4319
+ d[option] = maxSignificantDigits;
4320
+ }
4321
+ } else {
4322
+ delete d[option];
4323
+ }
4324
+ })
4325
+ );
4326
+ }
4327
+ function onMappingRulesChange(rules) {
4328
+ onChange((0, import_immer9.produce)(config, (draft) => void (draft.mappingRules = rules)));
4329
+ }
4330
+ function onPrefixChange(value) {
4331
+ onChange(
4332
+ (0, import_immer9.produce)(config, (draft) => {
4333
+ if (value) {
4334
+ draft.prefix = value;
4335
+ } else {
4336
+ delete draft.prefix;
4337
+ }
4338
+ })
4339
+ );
4340
+ }
4341
+ function onSuffixChange(value) {
4342
+ onChange(
4343
+ (0, import_immer9.produce)(config, (draft) => {
4344
+ if (value) {
4345
+ draft.suffix = value;
4346
+ } else {
4347
+ delete draft.suffix;
4348
+ }
4349
+ })
4350
+ );
4351
+ }
4352
+ function numberAddons(style) {
4353
+ switch (style) {
4354
+ case "None":
4355
+ return /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(import_jsx_runtime28.Fragment, { children: [
4356
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(AddonLabel, { className: "border border-l-0", children: "Fraction Digits" }),
4357
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
4358
+ "input",
4359
+ {
4360
+ disabled: true,
4361
+ className: "focus:border-primary-500 sm:text-ilabel min-w-20 border-main rounded-r-md border border-l-0 py-1",
4362
+ value: ""
4363
+ }
4364
+ )
4365
+ ] });
4366
+ case "Percent":
4367
+ case "Standard":
4368
+ return /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(import_jsx_runtime28.Fragment, { children: [
4369
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(AddonLabel, { className: "border border-x-0", children: "Fraction Digits" }),
4370
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
4371
+ "input",
4372
+ {
4373
+ type: "number",
4374
+ min: 0,
4375
+ max: 20,
4376
+ className: "focus:border-primary-500 sm:text-ilabel min-w-20 border-main focus:ring-3 focus:ring-primary-600/30 hover:border-primary-600 rounded-r-md border py-1",
4377
+ value: config.maxFractionDigits,
4378
+ placeholder: "0-20",
4379
+ onChange: (e) => onDigitsChange(e.target.value, "maxFractionDigits")
4380
+ }
4381
+ )
4382
+ ] });
4383
+ case "Currency":
4384
+ return /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(import_jsx_runtime28.Fragment, { children: [
4385
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(AddonLabel, { className: "border border-r-0", children: "Symbol" }),
4386
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: "w-28 ", children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
4387
+ import_ui_core16.ComboInput,
4388
+ {
4389
+ onChange: onChangeSymbol,
4390
+ options: CurrencySymbols.map((s) => s.value),
4391
+ displayFn: (s) => {
4392
+ const name = CurrencySymbols.find((c) => c.value === s)?.label;
4393
+ return `${name} (${s})`;
4394
+ },
4395
+ placeholder: "$",
4396
+ value: config?.currencySymbol
4397
+ }
4398
+ ) }),
4399
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(AddonLabel, { className: "border", children: "Precision" }),
4400
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
4401
+ "input",
4402
+ {
4403
+ type: "number",
4404
+ min: 0,
4405
+ max: 20,
4406
+ className: "focus:border-primary-500 sm:text-ilabel min-w-20 border-main rounded-r-md border border-l-0 py-1",
4407
+ value: config.precision,
4408
+ defaultValue: 2,
4409
+ placeholder: "0-20",
4410
+ onChange: (e) => onDigitsChange(e.target.value, "precision")
4411
+ }
4412
+ )
4413
+ ] });
4414
+ default:
4415
+ return /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(import_jsx_runtime28.Fragment, { children: [
4416
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(AddonLabel, { className: "border border-x-0", children: "Max significant digits" }),
4417
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
4418
+ "input",
4419
+ {
4420
+ type: "number",
4421
+ min: 1,
4422
+ max: 21,
4423
+ className: "focus:border-primary-600 sm:text-ilabel min-w-20 border-main hover:border-primary-600 focus:ring-3 focus:ring-primary-600/30 rounded-r-md border py-1",
4424
+ value: config.maxSignificantDigits,
4425
+ placeholder: "1-21",
4426
+ onChange: (e) => onDigitsChange(e.target.value, "maxSignificantDigits")
4427
+ }
4428
+ )
4429
+ ] });
4430
+ }
4431
+ }
4432
+ return /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(import_jsx_runtime28.Fragment, { children: [
4433
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "flex", children: [
4434
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(AddonLabel, { className: "rounded-l-md border border-r-0", children: "Value formatter" }),
4435
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
4436
+ "select",
4437
+ {
4438
+ value: config.valueFormatter,
4439
+ className: (0, import_ui_core16.classNames)(
4440
+ "sm:text-ilabel border-main text-text-foreground hover:border-primary-600 inline-flex items-center border py-1.5 pl-4 pr-7 focus:ring-0",
4441
+ config.valueFormatter == "StringFormatter" ? "rounded-r-md" : ""
4442
+ ),
4443
+ onChange: (e) => onChangeFormatter(e.target.value),
4444
+ children: formatters.map((d) => {
4445
+ return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("option", { value: d.value, children: d.label }, d.value);
4446
+ })
4447
+ }
4448
+ ),
4449
+ config.valueFormatter == "NumberFormatter" && /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(import_jsx_runtime28.Fragment, { children: [
4450
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(AddonLabel, { className: "border border-l-0 border-r-0", children: "Style" }),
4451
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(
4452
+ "select",
3684
4453
  {
3685
- d: "M8.30005 9.90907V6.09089L8.93641 5.45453L9.57278 6.09089V9.90907L8.93641 10.5454L8.30005 9.90907Z",
3686
- fill: "currentColor"
4454
+ value: config.style,
4455
+ className: "sm:text-ilabel border-main text-text-foreground hover:border-primary-600 inline-flex items-center border py-1 pl-4 pr-7 focus:ring-0",
4456
+ onChange: (e) => onStyleChange(e.target.value),
4457
+ children: [
4458
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("option", { value: "None", children: "None" }),
4459
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("option", { value: "Compact", children: "Compact" }),
4460
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("option", { value: "Standard", children: "Standard" }),
4461
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("option", { value: "Scientific", children: "Scientific" }),
4462
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("option", { value: "Percent", children: "Percent" }),
4463
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("option", { value: "Currency", children: "Currency" })
4464
+ ]
3687
4465
  }
3688
4466
  ),
3689
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
3690
- "path",
4467
+ config.style && numberAddons(config.style)
4468
+ ] }),
4469
+ config.valueFormatter == "DateFormatter" && /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(import_jsx_runtime28.Fragment, { children: [
4470
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(AddonLabel, { className: "border border-l-0", children: "Date format" }),
4471
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
4472
+ "select",
3691
4473
  {
3692
- d: "M4.80005 9.90907V6.09089L5.43641 5.45453L6.07278 6.09089V9.90907L5.43641 10.5454L4.80005 9.90907Z",
3693
- fill: "currentColor"
4474
+ value: config.dateFormat,
4475
+ className: "sm:text-ilabel border-main text-text-foreground inline-flex items-center rounded-r-md border border-l-0 py-1 pl-4 pr-7",
4476
+ onChange: (e) => onChangeDateFormat(e.target.value),
4477
+ children: dateFormats.map((d) => {
4478
+ return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("option", { value: d.value, children: d.label }, d.value);
4479
+ })
3694
4480
  }
3695
- ),
3696
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
3697
- "path",
4481
+ )
4482
+ ] })
4483
+ ] }) }),
4484
+ (showPrefix || showSuffix) && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "mt-2 flex items-center gap-4", children: [
4485
+ showPrefix && /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "border-main hover:border-primary-600 focus-within:border-primary-600 focus-within:ring-3 focus-within:ring-primary-500/30 text-icontent inline-flex items-center rounded-md border", children: [
4486
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: "h-7.5 leading-7.5 border-r px-3", children: "Prefix" }),
4487
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
4488
+ "input",
3698
4489
  {
3699
- d: "M1 3.5L13 3.5",
3700
- stroke: "currentColor",
3701
- strokeWidth: "1.16667",
3702
- strokeLinecap: "round",
3703
- strokeLinejoin: "round"
4490
+ type: "text",
4491
+ className: "border-0 px-3 py-1.5 focus:ring-0",
4492
+ value: config.prefix || "",
4493
+ placeholder: "e.g., $, #",
4494
+ onChange: (e) => onPrefixChange(e.target.value)
3704
4495
  }
3705
4496
  )
3706
4497
  ] }),
3707
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("defs", { children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("clipPath", { id: "clip0_3670_4424", children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("rect", { width: "14", height: "14", fill: "white" }) }) })
3708
- ]
3709
- }
3710
- );
3711
- var QueryValueIcon_default = SvgIcon6;
3712
-
3713
- // src/charts/icons/ScatterIcon.tsx
3714
- var import_jsx_runtime24 = require("react/jsx-runtime");
3715
- var SvgIcon7 = ({ className }) => /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
3716
- "svg",
3717
- {
3718
- width: "14",
3719
- height: "14",
3720
- viewBox: "0 0 14 14",
3721
- fill: "none",
3722
- xmlns: "http://www.w3.org/2000/svg",
3723
- className,
3724
- children: [
3725
- /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("g", { clipPath: "url(#clip0_28248_7302)", children: [
3726
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
3727
- "path",
3728
- {
3729
- d: "M1.75 1.75V12.25H12.25",
3730
- stroke: "currentColor",
3731
- strokeWidth: "1.16667",
3732
- strokeLinecap: "round",
3733
- strokeLinejoin: "round"
3734
- }
3735
- ),
3736
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
3737
- "path",
3738
- {
3739
- d: "M4.66663 8.75879V8.76754",
3740
- stroke: "currentColor",
3741
- strokeWidth: "1.16667",
3742
- strokeLinecap: "round",
3743
- strokeLinejoin: "round"
3744
- }
3745
- ),
3746
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
3747
- "path",
3748
- {
3749
- d: "M9.33337 9.34204V9.35079",
3750
- stroke: "currentColor",
3751
- strokeWidth: "1.16667",
3752
- strokeLinecap: "round",
3753
- strokeLinejoin: "round"
3754
- }
3755
- ),
3756
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
3757
- "path",
3758
- {
3759
- d: "M4.66663 4.10083V4.10958",
3760
- stroke: "currentColor",
3761
- strokeWidth: "1.16667",
3762
- strokeLinecap: "round",
3763
- strokeLinejoin: "round"
3764
- }
3765
- ),
3766
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
3767
- "path",
3768
- {
3769
- d: "M7 6.43408V6.44283",
3770
- stroke: "currentColor",
3771
- strokeWidth: "1.16667",
3772
- strokeLinecap: "round",
3773
- strokeLinejoin: "round"
3774
- }
3775
- ),
3776
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
3777
- "path",
4498
+ showSuffix && /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "border-main hover:border-primary-600 focus-within:border-primary-600 focus-within:ring-3 focus-within:ring-primary-500/30 text-icontent inline-flex items-center rounded-md border", children: [
4499
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: "h-7.5 leading-7.5 border-r px-3", children: "Suffix" }),
4500
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
4501
+ "input",
3778
4502
  {
3779
- d: "M11.0834 6.43408V6.44283",
3780
- stroke: "currentColor",
3781
- strokeWidth: "1.16667",
3782
- strokeLinecap: "round",
3783
- strokeLinejoin: "round"
4503
+ type: "text",
4504
+ className: "min-w-32 border-0 px-3 py-1.5 focus:ring-0",
4505
+ value: config.suffix || "",
4506
+ placeholder: "e.g., %, USD, tokens",
4507
+ onChange: (e) => onSuffixChange(e.target.value)
3784
4508
  }
3785
4509
  )
3786
- ] }),
3787
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("defs", { children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("clipPath", { id: "clip0_28248_7302", children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("rect", { width: "14", height: "14", fill: "white" }) }) })
3788
- ]
3789
- }
3790
- );
3791
- var ScatterIcon_default = SvgIcon7;
4510
+ ] })
4511
+ ] }) }),
4512
+ config.valueFormatter == "StringFormatter" && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
4513
+ ValueStringMapping,
4514
+ {
4515
+ rules: config.mappingRules || [],
4516
+ onChange: onMappingRulesChange
4517
+ }
4518
+ )
4519
+ ] });
4520
+ };
3792
4521
 
3793
- // src/charts/icons/TableIcon.tsx
3794
- var import_jsx_runtime25 = require("react/jsx-runtime");
3795
- var SvgIcon8 = ({ className }) => /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(
3796
- "svg",
3797
- {
3798
- width: "14",
3799
- height: "14",
3800
- viewBox: "0 0 14 14",
3801
- fill: "none",
3802
- xmlns: "http://www.w3.org/2000/svg",
3803
- className,
3804
- children: [
3805
- /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("g", { clipPath: "url(#clip0_3670_4416)", children: [
3806
- /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
3807
- "path",
3808
- {
3809
- d: "M11.5 2H2.5C1.67157 2 1 2.55964 1 3.25V10.75C1 11.4404 1.67157 12 2.5 12H11.5C12.3284 12 13 11.4404 13 10.75V3.25C13 2.55964 12.3284 2 11.5 2Z",
3810
- stroke: "currentColor",
3811
- strokeWidth: "1.16667",
3812
- strokeLinecap: "round",
3813
- strokeLinejoin: "round"
3814
- }
3815
- ),
3816
- /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
3817
- "path",
4522
+ // src/charts/options/ValueControls.tsx
4523
+ var import_lodash7 = require("lodash");
4524
+ var import_ui_core17 = require("@sentio/ui-core");
4525
+ var import_immer10 = require("immer");
4526
+ var import_jsx_runtime29 = require("react/jsx-runtime");
4527
+ var defaultConfig4 = {
4528
+ valueFormatter: "NumberFormatter",
4529
+ showValueLabel: false,
4530
+ maxSignificantDigits: 3,
4531
+ dateFormat: "LLL",
4532
+ mappingRules: [],
4533
+ style: "None",
4534
+ maxFractionDigits: 2
4535
+ };
4536
+ var ValueControls = ({
4537
+ config,
4538
+ defaultOpen,
4539
+ onChange,
4540
+ formatters = ValueFormatters,
4541
+ showPrefix,
4542
+ showSuffix
4543
+ }) => {
4544
+ config = (0, import_lodash7.defaults)(config || {}, defaultConfig4);
4545
+ function toggleShowValueLabel(checked) {
4546
+ config && onChange(
4547
+ (0, import_immer10.produce)(config, (draft) => void (draft.showValueLabel = checked))
4548
+ );
4549
+ }
4550
+ function toggleTooltipTotal(checked) {
4551
+ config && onChange((0, import_immer10.produce)(config, (draft) => void (draft.tooltipTotal = checked)));
4552
+ }
4553
+ return /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(
4554
+ import_ui_core17.DisclosurePanel,
4555
+ {
4556
+ title: "Value Options",
4557
+ defaultOpen,
4558
+ containerClassName: "w-full bg-default-bg",
4559
+ children: [
4560
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
4561
+ ValueOptions,
3818
4562
  {
3819
- d: "M1 5L13 5",
3820
- stroke: "currentColor",
3821
- strokeWidth: "1.16667",
3822
- strokeLinecap: "round",
3823
- strokeLinejoin: "round"
4563
+ onChange,
4564
+ config,
4565
+ formatters,
4566
+ showPrefix,
4567
+ showSuffix
3824
4568
  }
3825
4569
  ),
3826
- /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
3827
- "path",
3828
- {
3829
- d: "M6 2L6 12",
3830
- stroke: "currentColor",
3831
- strokeWidth: "1.16667",
3832
- strokeLinecap: "round",
3833
- strokeLinejoin: "round"
3834
- }
3835
- )
3836
- ] }),
3837
- /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("defs", { children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("clipPath", { id: "clip0_3670_4416", children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("rect", { width: "14", height: "14", fill: "white" }) }) })
3838
- ]
3839
- }
3840
- );
3841
- var TableIcon_default = SvgIcon8;
4570
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { className: "mt-2 flex items-center gap-2", children: [
4571
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
4572
+ import_ui_core17.Checkbox,
4573
+ {
4574
+ checked: config?.showValueLabel,
4575
+ onChange: toggleShowValueLabel,
4576
+ label: "Show value label"
4577
+ }
4578
+ ),
4579
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
4580
+ import_ui_core17.Checkbox,
4581
+ {
4582
+ checked: config?.tooltipTotal,
4583
+ onChange: toggleTooltipTotal,
4584
+ label: "Show total in tooltip"
4585
+ }
4586
+ )
4587
+ ] })
4588
+ ]
4589
+ }
4590
+ );
4591
+ };
3842
4592
  // Annotate the CommonJS export names for ESM import in node:
3843
4593
  0 && (module.exports = {
3844
4594
  AggregateInput,
@@ -3849,6 +4599,8 @@ var TableIcon_default = SvgIcon8;
3849
4599
  BarGuageIcon,
3850
4600
  BarIcon,
3851
4601
  ChartLegend,
4602
+ ChartTooltip,
4603
+ ChartTypeButtonGroup,
3852
4604
  EventsFunctionCategories,
3853
4605
  EventsFunctionMap,
3854
4606
  FunctionInput,
@@ -3860,12 +4612,14 @@ var TableIcon_default = SvgIcon8;
3860
4612
  LabelsInput,
3861
4613
  LineControls,
3862
4614
  LineIcon,
4615
+ PieChart,
3863
4616
  PieChartControls,
3864
4617
  PieIcon,
3865
4618
  QueryValueIcon,
3866
4619
  ReactEChartsBase,
3867
4620
  RefreshButton,
3868
4621
  RefreshContext,
4622
+ ScatterChartTooltip,
3869
4623
  ScatterIcon,
3870
4624
  SystemLabels,
3871
4625
  TableIcon,