@sentio/ui-dashboard 0.2.3 → 0.2.4

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,7 @@ __export(index_exports, {
38
38
  BarGuageIcon: () => BarGuageIcon_default,
39
39
  BarIcon: () => BarIcon_default,
40
40
  ChartLegend: () => ChartLegend,
41
+ ChartTypeButtonGroup: () => ChartTypeButtonGroup,
41
42
  EventsFunctionCategories: () => EventsFunctionCategories,
42
43
  EventsFunctionMap: () => EventsFunctionMap,
43
44
  FunctionInput: () => FunctionInput,
@@ -2618,1227 +2619,1295 @@ var RefreshButton = (props) => {
2618
2619
  ) });
2619
2620
  };
2620
2621
 
2621
- // src/charts/options/LineControls.tsx
2622
- var import_immer4 = require("immer");
2622
+ // src/charts/ChartTypeButtonGroup.tsx
2623
+ var import_react14 = require("react");
2624
+ var import_react_resize_detector2 = require("react-resize-detector");
2623
2625
  var import_ui_core8 = require("@sentio/ui-core");
2626
+
2627
+ // src/charts/icons/BarGuageIcon.tsx
2624
2628
  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,
2652
- {
2653
- buttons: lineStyles,
2654
- value: config?.style || "Solid",
2655
- onChange: setStyle,
2656
- small: true
2657
- }
2658
- ),
2659
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
2660
- import_ui_core8.Checkbox,
2661
- {
2662
- label: "Smooth Curves",
2663
- checked: config?.smooth,
2664
- onChange: setSmooth
2665
- }
2666
- )
2667
- ] })
2668
- }
2669
- );
2670
- };
2629
+ var SvgIcon = ({ className }) => /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
2630
+ "svg",
2631
+ {
2632
+ width: "14",
2633
+ height: "14",
2634
+ viewBox: "0 0 14 14",
2635
+ fill: "currentColor",
2636
+ className,
2637
+ xmlns: "http://www.w3.org/2000/svg",
2638
+ children: [
2639
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
2640
+ "path",
2641
+ {
2642
+ 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",
2643
+ fill: "currentColor"
2644
+ }
2645
+ ),
2646
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
2647
+ "path",
2648
+ {
2649
+ 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",
2650
+ fill: "currentColor"
2651
+ }
2652
+ ),
2653
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
2654
+ "path",
2655
+ {
2656
+ 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",
2657
+ fill: "currentColor"
2658
+ }
2659
+ ),
2660
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
2661
+ "path",
2662
+ {
2663
+ 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",
2664
+ fill: "currentColor"
2665
+ }
2666
+ )
2667
+ ]
2668
+ }
2669
+ );
2670
+ var BarGuageIcon_default = SvgIcon;
2671
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");
2672
+ // src/charts/icons/QueryValueIcon.tsx
2676
2673
  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
- ] }),
2674
+ var SvgIcon2 = ({ className }) => /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
2675
+ "svg",
2676
+ {
2677
+ width: "14",
2678
+ height: "14",
2679
+ viewBox: "0 0 14 14",
2680
+ fill: "none",
2681
+ className,
2682
+ xmlns: "http://www.w3.org/2000/svg",
2683
+ children: [
2684
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("g", { clipPath: "url(#clip0_3670_4424)", children: [
2755
2685
  /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
2756
- import_ui_core9.Button,
2686
+ "path",
2757
2687
  {
2758
- type: "button",
2759
- role: "link",
2760
- onClick: () => {
2761
- setConfig(initialConfig);
2762
- },
2763
- children: "Reset"
2688
+ 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",
2689
+ stroke: "currentColor",
2690
+ strokeWidth: "1.16667",
2691
+ strokeLinecap: "round",
2692
+ strokeLinejoin: "round"
2764
2693
  }
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,
2694
+ ),
2695
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
2696
+ "path",
2819
2697
  {
2820
- small: true,
2821
- buttons: PieTypeItems,
2822
- value: config.pieType,
2823
- onChange: onPieTypeChange
2698
+ d: "M7.98188 5.77273H6.39097L5.75461 5.13636L6.39097 4.5H7.98188L8.61824 5.13636L7.98188 5.77273Z",
2699
+ fill: "currentColor"
2824
2700
  }
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,
2701
+ ),
2702
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
2703
+ "path",
2842
2704
  {
2843
- checked: config?.showValue,
2844
- onChange: (v) => toggle("showValue", v),
2845
- label: "Show value",
2846
- labelClassName: "whitespace-nowrap"
2705
+ d: "M7.98188 11.5H6.39097L5.75461 10.8637L6.39097 10.2273H7.98188L8.61824 10.8637L7.98188 11.5Z",
2706
+ fill: "currentColor"
2847
2707
  }
2848
2708
  ),
2849
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
2850
- import_ui_core10.Checkbox,
2709
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
2710
+ "path",
2851
2711
  {
2852
- checked: config?.showPercent,
2853
- onChange: (v) => toggle("showPercent", v),
2854
- label: "Show percent",
2855
- labelClassName: "whitespace-nowrap"
2712
+ d: "M8.30005 9.90907V6.09089L8.93641 5.45453L9.57278 6.09089V9.90907L8.93641 10.5454L8.30005 9.90907Z",
2713
+ fill: "currentColor"
2714
+ }
2715
+ ),
2716
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
2717
+ "path",
2718
+ {
2719
+ d: "M4.80005 9.90907V6.09089L5.43641 5.45453L6.07278 6.09089V9.90907L5.43641 10.5454L4.80005 9.90907Z",
2720
+ fill: "currentColor"
2721
+ }
2722
+ ),
2723
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
2724
+ "path",
2725
+ {
2726
+ d: "M1 3.5L13 3.5",
2727
+ stroke: "currentColor",
2728
+ strokeWidth: "1.16667",
2729
+ strokeLinecap: "round",
2730
+ strokeLinejoin: "round"
2731
+ }
2732
+ )
2733
+ ] }),
2734
+ /* @__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" }) }) })
2735
+ ]
2736
+ }
2737
+ );
2738
+ var QueryValueIcon_default = SvgIcon2;
2739
+
2740
+ // src/charts/icons/TableIcon.tsx
2741
+ var import_jsx_runtime13 = require("react/jsx-runtime");
2742
+ var SvgIcon3 = ({ className }) => /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
2743
+ "svg",
2744
+ {
2745
+ width: "14",
2746
+ height: "14",
2747
+ viewBox: "0 0 14 14",
2748
+ fill: "none",
2749
+ xmlns: "http://www.w3.org/2000/svg",
2750
+ className,
2751
+ children: [
2752
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("g", { clipPath: "url(#clip0_3670_4416)", children: [
2753
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
2754
+ "path",
2755
+ {
2756
+ 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",
2757
+ stroke: "currentColor",
2758
+ strokeWidth: "1.16667",
2759
+ strokeLinecap: "round",
2760
+ strokeLinejoin: "round"
2761
+ }
2762
+ ),
2763
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
2764
+ "path",
2765
+ {
2766
+ d: "M1 5L13 5",
2767
+ stroke: "currentColor",
2768
+ strokeWidth: "1.16667",
2769
+ strokeLinecap: "round",
2770
+ strokeLinejoin: "round"
2856
2771
  }
2857
2772
  ),
2858
2773
  /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
2859
- import_ui_core10.Checkbox,
2774
+ "path",
2860
2775
  {
2861
- checked: config?.absValue,
2862
- onChange: (v) => toggle("absValue", v),
2863
- label: "Use absolute values",
2864
- labelClassName: "whitespace-nowrap"
2776
+ d: "M6 2L6 12",
2777
+ stroke: "currentColor",
2778
+ strokeWidth: "1.16667",
2779
+ strokeLinecap: "round",
2780
+ strokeLinejoin: "round"
2865
2781
  }
2866
2782
  )
2867
- ] })
2868
- }
2869
- );
2870
- }
2783
+ ] }),
2784
+ /* @__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" }) }) })
2785
+ ]
2786
+ }
2787
+ );
2788
+ var TableIcon_default = SvgIcon3;
2871
2789
 
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");
2790
+ // src/charts/icons/AreaIcon.tsx
2876
2791
  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
- );
2792
+ var SvgIcon4 = ({ className }) => /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
2793
+ "svg",
2794
+ {
2795
+ width: "14",
2796
+ height: "14",
2797
+ viewBox: "0 0 14 14",
2798
+ fill: "none",
2799
+ xmlns: "http://www.w3.org/2000/svg",
2800
+ className,
2801
+ children: [
2802
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("g", { clipPath: "url(#clip0_1774_9545)", children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
2803
+ "path",
2804
+ {
2805
+ 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",
2806
+ fill: "currentColor"
2807
+ }
2808
+ ) }),
2809
+ /* @__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" }) }) })
2810
+ ]
2928
2811
  }
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");
2812
+ );
2813
+ var AreaIcon_default = SvgIcon4;
2997
2814
 
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");
2815
+ // src/charts/icons/BarIcon.tsx
3002
2816
  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",
2817
+ var SvgIcon5 = ({ className }) => /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
2818
+ "svg",
2819
+ {
2820
+ width: "14",
2821
+ height: "14",
2822
+ viewBox: "0 0 14 14",
2823
+ fill: "none",
2824
+ xmlns: "http://www.w3.org/2000/svg",
2825
+ className,
2826
+ children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
2827
+ "path",
3015
2828
  {
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
- )
2829
+ 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",
2830
+ fill: "currentColor"
3020
2831
  }
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
- );
2832
+ )
3044
2833
  }
3045
- function changeRule(index, field, value) {
3046
- onChange(
3047
- (0, import_immer8.produce)(rules, (draft) => {
3048
- ;
3049
- draft[index][field] = value;
2834
+ );
2835
+ var BarIcon_default = SvgIcon5;
2836
+
2837
+ // src/charts/icons/LineIcon.tsx
2838
+ var import_jsx_runtime16 = require("react/jsx-runtime");
2839
+ var SvgIcon6 = ({ className }) => /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
2840
+ "svg",
2841
+ {
2842
+ width: "14",
2843
+ height: "14",
2844
+ viewBox: "0 0 14 14",
2845
+ fill: "none",
2846
+ xmlns: "http://www.w3.org/2000/svg",
2847
+ className,
2848
+ children: [
2849
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("g", { clipPath: "url(#clip0_1774_9563)", children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
2850
+ "path",
2851
+ {
2852
+ 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",
2853
+ fill: "currentColor"
2854
+ }
2855
+ ) }),
2856
+ /* @__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" }) }) })
2857
+ ]
2858
+ }
2859
+ );
2860
+ var LineIcon_default = SvgIcon6;
2861
+
2862
+ // src/charts/icons/PieIcon.tsx
2863
+ var import_jsx_runtime17 = require("react/jsx-runtime");
2864
+ var SvgIcon7 = ({ className }) => /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
2865
+ "svg",
2866
+ {
2867
+ width: "14",
2868
+ height: "14",
2869
+ viewBox: "0 0 14 14",
2870
+ fill: "none",
2871
+ xmlns: "http://www.w3.org/2000/svg",
2872
+ className,
2873
+ children: [
2874
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("g", { clipPath: "url(#clip0_28267_7202)", children: [
2875
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
2876
+ "path",
2877
+ {
2878
+ 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",
2879
+ stroke: "currentColor",
2880
+ strokeWidth: "1.16667",
2881
+ strokeLinecap: "round",
2882
+ strokeLinejoin: "round"
2883
+ }
2884
+ ),
2885
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
2886
+ "path",
2887
+ {
2888
+ 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",
2889
+ stroke: "currentColor",
2890
+ strokeWidth: "1.16667",
2891
+ strokeLinecap: "round",
2892
+ strokeLinejoin: "round"
2893
+ }
2894
+ )
2895
+ ] }),
2896
+ /* @__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" }) }) })
2897
+ ]
2898
+ }
2899
+ );
2900
+ var PieIcon_default = SvgIcon7;
2901
+
2902
+ // src/charts/icons/ScatterIcon.tsx
2903
+ var import_jsx_runtime18 = require("react/jsx-runtime");
2904
+ var SvgIcon8 = ({ className }) => /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
2905
+ "svg",
2906
+ {
2907
+ width: "14",
2908
+ height: "14",
2909
+ viewBox: "0 0 14 14",
2910
+ fill: "none",
2911
+ xmlns: "http://www.w3.org/2000/svg",
2912
+ className,
2913
+ children: [
2914
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("g", { clipPath: "url(#clip0_28248_7302)", children: [
2915
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
2916
+ "path",
2917
+ {
2918
+ d: "M1.75 1.75V12.25H12.25",
2919
+ stroke: "currentColor",
2920
+ strokeWidth: "1.16667",
2921
+ strokeLinecap: "round",
2922
+ strokeLinejoin: "round"
2923
+ }
2924
+ ),
2925
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
2926
+ "path",
2927
+ {
2928
+ d: "M4.66663 8.75879V8.76754",
2929
+ stroke: "currentColor",
2930
+ strokeWidth: "1.16667",
2931
+ strokeLinecap: "round",
2932
+ strokeLinejoin: "round"
2933
+ }
2934
+ ),
2935
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
2936
+ "path",
2937
+ {
2938
+ d: "M9.33337 9.34204V9.35079",
2939
+ stroke: "currentColor",
2940
+ strokeWidth: "1.16667",
2941
+ strokeLinecap: "round",
2942
+ strokeLinejoin: "round"
2943
+ }
2944
+ ),
2945
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
2946
+ "path",
2947
+ {
2948
+ d: "M4.66663 4.10083V4.10958",
2949
+ stroke: "currentColor",
2950
+ strokeWidth: "1.16667",
2951
+ strokeLinecap: "round",
2952
+ strokeLinejoin: "round"
2953
+ }
2954
+ ),
2955
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
2956
+ "path",
2957
+ {
2958
+ d: "M7 6.43408V6.44283",
2959
+ stroke: "currentColor",
2960
+ strokeWidth: "1.16667",
2961
+ strokeLinecap: "round",
2962
+ strokeLinejoin: "round"
2963
+ }
2964
+ ),
2965
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
2966
+ "path",
2967
+ {
2968
+ d: "M11.0834 6.43408V6.44283",
2969
+ stroke: "currentColor",
2970
+ strokeWidth: "1.16667",
2971
+ strokeLinecap: "round",
2972
+ strokeLinejoin: "round"
2973
+ }
2974
+ )
2975
+ ] }),
2976
+ /* @__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" }) }) })
2977
+ ]
2978
+ }
2979
+ );
2980
+ var ScatterIcon_default = SvgIcon8;
2981
+
2982
+ // src/charts/ChartTypeButtonGroup.tsx
2983
+ var import_jsx_runtime19 = require("react/jsx-runtime");
2984
+ var visuals = [
2985
+ {
2986
+ label: "Lines",
2987
+ value: "LINE",
2988
+ icon: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(LineIcon_default, { className: "mr-1 h-4 w-4" })
2989
+ },
2990
+ { label: "Bars", value: "BAR", icon: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(BarIcon_default, { className: "mr-1 h-4 w-4" }) },
2991
+ {
2992
+ label: "Areas",
2993
+ value: "AREA",
2994
+ icon: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(AreaIcon_default, { className: "mr-1 h-4 w-4" })
2995
+ },
2996
+ {
2997
+ label: "Bar Gauge",
2998
+ value: "BAR_GAUGE",
2999
+ icon: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(BarGuageIcon_default, { className: "mr-1 h-4 w-4" })
3000
+ },
3001
+ {
3002
+ label: "Scatter",
3003
+ value: "SCATTER",
3004
+ icon: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(ScatterIcon_default, { className: "mr-1 h-4 w-4" })
3005
+ },
3006
+ {
3007
+ label: "Query Value",
3008
+ value: "QUERY_VALUE",
3009
+ icon: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(QueryValueIcon_default, { className: "mr-1 h-4 w-4" })
3010
+ },
3011
+ {
3012
+ label: "Table",
3013
+ value: "TABLE",
3014
+ icon: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(TableIcon_default, { className: "mr-1 h-4 w-4" })
3015
+ },
3016
+ { label: "Pie", value: "PIE", icon: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(PieIcon_default, { className: "mr-1 h-4 w-4" }) }
3017
+ ];
3018
+ var ChartTypeButtonGroup = ({
3019
+ value,
3020
+ onChange,
3021
+ small = false
3022
+ }) => {
3023
+ const [hideLabel, setHideLabel] = (0, import_react14.useState)(small);
3024
+ const { ref } = (0, import_react_resize_detector2.useResizeDetector)({
3025
+ onResize: ({ width }) => {
3026
+ if (width) {
3027
+ setHideLabel(width < 800);
3028
+ }
3029
+ },
3030
+ refreshMode: "throttle",
3031
+ refreshRate: 100
3032
+ });
3033
+ return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: "w-full flex-1", ref, children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
3034
+ import_ui_core8.NewButtonGroup,
3035
+ {
3036
+ buttons: visuals,
3037
+ value,
3038
+ onChange,
3039
+ small,
3040
+ hideLabel
3041
+ }
3042
+ ) });
3043
+ };
3044
+
3045
+ // src/charts/options/LineControls.tsx
3046
+ var import_immer4 = require("immer");
3047
+ var import_ui_core9 = require("@sentio/ui-core");
3048
+ var import_jsx_runtime20 = require("react/jsx-runtime");
3049
+ var lineStyles = [
3050
+ { label: "Solid", value: "Solid" },
3051
+ { label: "Dotted", value: "Dotted" }
3052
+ ];
3053
+ var LineControls = ({ config, defaultOpen, onChange }) => {
3054
+ const setStyle = (style) => {
3055
+ onChange(
3056
+ (0, import_immer4.produce)(config || {}, (draft) => {
3057
+ draft.style = style;
3050
3058
  })
3051
3059
  );
3052
- }
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
- })
3075
- }
3076
- ),
3077
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
3078
- "input",
3079
- {
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
- }
3089
- }
3090
- ),
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",
3094
- {
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
- }
3104
- }
3105
- ),
3106
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
3107
- "button",
3060
+ };
3061
+ const setSmooth = (smooth) => {
3062
+ onChange(
3063
+ (0, import_immer4.produce)(config || {}, (draft) => {
3064
+ draft.smooth = smooth;
3065
+ })
3066
+ );
3067
+ };
3068
+ return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
3069
+ import_ui_core9.DisclosurePanel,
3070
+ {
3071
+ title: "Line style",
3072
+ containerClassName: "w-full bg-default-bg",
3073
+ children: /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "flex items-center gap-4", children: [
3074
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
3075
+ import_ui_core9.NewButtonGroup,
3076
+ {
3077
+ buttons: lineStyles,
3078
+ value: config?.style || "Solid",
3079
+ onChange: setStyle,
3080
+ small: true
3081
+ }
3082
+ ),
3083
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
3084
+ import_ui_core9.Checkbox,
3085
+ {
3086
+ label: "Smooth Curves",
3087
+ checked: config?.smooth,
3088
+ onChange: setSmooth
3089
+ }
3090
+ )
3091
+ ] })
3092
+ }
3093
+ );
3094
+ };
3095
+
3096
+ // src/charts/options/LabelControls.tsx
3097
+ var import_react15 = require("react");
3098
+ var import_immer5 = require("immer");
3099
+ var import_ui_core10 = require("@sentio/ui-core");
3100
+ var import_jsx_runtime21 = require("react/jsx-runtime");
3101
+ var initialConfig = {
3102
+ columns: [],
3103
+ alias: ""
3104
+ };
3105
+ var LabelControls = ({ config, setConfig, defaultOpen }) => {
3106
+ (0, import_react15.useEffect)(() => {
3107
+ if (config?.columns && config.columns.length > 0 && !config.alias) {
3108
+ const aliasParts = [];
3109
+ config.columns.forEach((colConfig) => {
3110
+ if (!colConfig.name) return;
3111
+ if (colConfig.showLabel === false && colConfig.showValue === false) {
3112
+ } else if (colConfig.showValue === false) {
3113
+ aliasParts.push(colConfig.name);
3114
+ } else {
3115
+ aliasParts.push(`{{${colConfig.name}}}`);
3116
+ }
3117
+ });
3118
+ if (aliasParts.length > 0) {
3119
+ const migratedAlias = aliasParts.join(", ");
3120
+ setConfig(
3121
+ (0, import_immer5.produce)(config, (draft) => {
3122
+ draft.alias = migratedAlias;
3123
+ draft.columns = [];
3124
+ })
3125
+ );
3126
+ }
3127
+ }
3128
+ }, [config, setConfig]);
3129
+ const onAliasChanged = (alias) => {
3130
+ setConfig(
3131
+ (0, import_immer5.produce)(config ?? initialConfig, (draft) => {
3132
+ draft.alias = alias;
3133
+ })
3134
+ );
3135
+ };
3136
+ const _defaultOpen = (0, import_react15.useMemo)(() => {
3137
+ if (defaultOpen) {
3138
+ return true;
3139
+ }
3140
+ return config?.alias !== "" || config?.columns && config.columns.length > 0;
3141
+ }, [config, defaultOpen]);
3142
+ return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
3143
+ import_ui_core10.DisclosurePanel,
3144
+ {
3145
+ title: "Label Controls",
3146
+ defaultOpen: _defaultOpen,
3147
+ containerClassName: "w-full bg-default-bg",
3148
+ children: /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "flex items-center gap-2", children: [
3149
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "inline-flex h-8", children: [
3150
+ /* @__PURE__ */ (0, import_jsx_runtime21.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: [
3151
+ "Label Alias",
3152
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
3153
+ import_ui_core10.HelpIcon,
3108
3154
  {
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
- )
3155
+ text: /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "text-icontent text-text-foreground", children: [
3156
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { children: "Series name override or template." }),
3157
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { children: [
3158
+ "Ex.",
3159
+ " ",
3160
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "text-primary mx-1 font-semibold italic", children: "{{contract}}" }),
3161
+ " ",
3162
+ "will be replaced with the value of the contract label."
3163
+ ] })
3164
+ ] })
3120
3165
  }
3121
3166
  )
3122
- ]
3123
- },
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
- }
3167
+ ] }),
3168
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
3169
+ "input",
3170
+ {
3171
+ type: "text",
3172
+ value: config?.alias || "",
3173
+ onChange: (e) => onAliasChanged(e.target.value),
3174
+ placeholder: "Enter alias...",
3175
+ className: "focus:border-primary-500 sm:text-icontent border-main inline-flex w-64 items-center rounded-r-md border px-2"
3176
+ }
3177
+ )
3178
+ ] }),
3179
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
3180
+ import_ui_core10.Button,
3181
+ {
3182
+ type: "button",
3183
+ role: "link",
3184
+ onClick: () => {
3185
+ setConfig(initialConfig);
3186
+ },
3187
+ children: "Reset"
3188
+ }
3189
+ )
3190
+ ] })
3191
+ }
3192
+ );
3193
+ };
3143
3194
 
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"
3195
+ // src/charts/options/PieChartControls.tsx
3196
+ var import_immer6 = require("immer");
3197
+ var import_lodash3 = require("lodash");
3198
+ var import_ui_core11 = require("@sentio/ui-core");
3199
+ var import_jsx_runtime22 = require("react/jsx-runtime");
3200
+ var defaultConfig = {
3201
+ pieType: "Pie",
3202
+ calculation: "LAST",
3203
+ showPercent: true,
3204
+ showValue: true,
3205
+ absValue: false
3158
3206
  };
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" }
3207
+ var CalculationItems = [
3208
+ { label: "Last", value: "LAST" },
3209
+ { label: "First", value: "FIRST" },
3210
+ { label: "Total", value: "TOTAL" },
3211
+ { label: "Mean", value: "MEAN" },
3212
+ { label: "Max", value: "MAX" },
3213
+ { label: "Min", value: "MIN" }
3170
3214
  ];
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)));
3215
+ var PieTypeItems = [
3216
+ { label: "Pie", value: "Pie" },
3217
+ { label: "Donut", value: "Donut" }
3218
+ ];
3219
+ function PieChartControls({ config, defaultOpen, onChange }) {
3220
+ config = (0, import_lodash3.defaults)(config, defaultConfig);
3221
+ function onCalculationChange(cal) {
3222
+ config && onChange((0, import_immer6.produce)(config, (draft) => void (draft.calculation = cal)));
3196
3223
  }
3197
- function onChangeSymbol(symbol) {
3198
- onChange((0, import_immer9.produce)(config, (draft) => void (draft.currencySymbol = symbol)));
3224
+ function onPieTypeChange(pieType) {
3225
+ config && onChange((0, import_immer6.produce)(config, (draft) => void (draft.pieType = pieType)));
3199
3226
  }
3200
- function onStyleChange(notation) {
3201
- onChange(
3202
- (0, import_immer9.produce)(config, (draft) => {
3203
- draft.style = notation;
3227
+ function toggle(field, value) {
3228
+ config && onChange(
3229
+ (0, import_immer6.produce)(config, (draft) => {
3230
+ draft[field] = value;
3204
3231
  })
3205
3232
  );
3206
3233
  }
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;
3234
+ return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
3235
+ import_ui_core11.DisclosurePanel,
3236
+ {
3237
+ title: "Pie Chart Options",
3238
+ defaultOpen,
3239
+ containerClassName: "w-full bg-default-bg",
3240
+ children: /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "flex items-center gap-4", children: [
3241
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: "shadow-xs flex rounded-md", children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
3242
+ import_ui_core11.NewButtonGroup,
3243
+ {
3244
+ small: true,
3245
+ buttons: PieTypeItems,
3246
+ value: config.pieType,
3247
+ onChange: onPieTypeChange
3215
3248
  }
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",
3249
+ ) }),
3250
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "shadow-xs flex rounded-md", children: [
3251
+ /* @__PURE__ */ (0, import_jsx_runtime22.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" }),
3252
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
3253
+ "select",
3314
3254
  {
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")
3255
+ value: config.calculation,
3256
+ 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",
3257
+ onChange: (e) => onCalculationChange(e.target.value),
3258
+ children: CalculationItems.map((d) => {
3259
+ return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("option", { value: d.value, children: d.label }, d.value);
3260
+ })
3322
3261
  }
3323
3262
  )
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",
3332
- {
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" : ""
3337
- ),
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
- }
3343
- ),
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",
3263
+ ] }),
3264
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
3265
+ import_ui_core11.Checkbox,
3348
3266
  {
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),
3352
- 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" })
3359
- ]
3267
+ checked: config?.showValue,
3268
+ onChange: (v) => toggle("showValue", v),
3269
+ label: "Show value",
3270
+ labelClassName: "whitespace-nowrap"
3360
3271
  }
3361
3272
  ),
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
- )
3377
- ] })
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",
3273
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
3274
+ import_ui_core11.Checkbox,
3384
3275
  {
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)
3276
+ checked: config?.showPercent,
3277
+ onChange: (v) => toggle("showPercent", v),
3278
+ label: "Show percent",
3279
+ labelClassName: "whitespace-nowrap"
3390
3280
  }
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",
3281
+ ),
3282
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
3283
+ import_ui_core11.Checkbox,
3397
3284
  {
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)
3285
+ checked: config?.absValue,
3286
+ onChange: (v) => toggle("absValue", v),
3287
+ label: "Use absolute values",
3288
+ labelClassName: "whitespace-nowrap"
3403
3289
  }
3404
3290
  )
3405
3291
  ] })
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
- };
3292
+ }
3293
+ );
3294
+ }
3416
3295
 
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
3296
+ // src/charts/options/BarGaugeControls.tsx
3297
+ var import_immer7 = require("immer");
3298
+ var import_lodash4 = require("lodash");
3299
+ var import_ui_core12 = require("@sentio/ui-core");
3300
+ var import_jsx_runtime23 = require("react/jsx-runtime");
3301
+ var defaultConfig2 = {
3302
+ direction: "HORIZONTAL",
3303
+ calculation: "LAST",
3304
+ sort: {
3305
+ sortBy: "ByName",
3306
+ orderDesc: true
3307
+ }
3430
3308
  };
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) {
3309
+ var directionItems = [
3310
+ { label: "Horizontal", value: "HORIZONTAL" },
3311
+ { label: "Vertical", value: "VERTICAL" }
3312
+ ];
3313
+ var CalculationItems2 = [
3314
+ { label: "Last", value: "LAST" },
3315
+ { label: "First", value: "FIRST" },
3316
+ { label: "Total", value: "TOTAL" },
3317
+ { label: "Mean", value: "MEAN" },
3318
+ { label: "Max", value: "MAX" },
3319
+ { label: "Min", value: "MIN" }
3320
+ ];
3321
+ var sortByItems = [
3322
+ { label: "Name", value: "ByName" },
3323
+ { label: "Value", value: "ByValue" }
3324
+ ];
3325
+ var orderItems = [
3326
+ { label: "Ascendant", value: "false" },
3327
+ { label: "Descendant", value: "true" }
3328
+ ];
3329
+ function BarGaugeControls({ config, defaultOpen, onChange }) {
3330
+ config = (0, import_lodash4.defaults)(config, defaultConfig2);
3331
+ function onCalculationChange(cal) {
3332
+ config && onChange((0, import_immer7.produce)(config, (draft) => void (draft.calculation = cal)));
3333
+ }
3334
+ function onDirectionChange(dir) {
3335
+ config && onChange((0, import_immer7.produce)(config, (draft) => void (draft.direction = dir)));
3336
+ }
3337
+ function onOrderChange(orderDesc) {
3441
3338
  config && onChange(
3442
- (0, import_immer10.produce)(config, (draft) => void (draft.showValueLabel = checked))
3339
+ (0, import_immer7.produce)(config, (draft) => {
3340
+ draft.sort = draft.sort || {};
3341
+ draft.sort.orderDesc = orderDesc;
3342
+ })
3443
3343
  );
3444
3344
  }
3445
- function toggleTooltipTotal(checked) {
3446
- config && onChange((0, import_immer10.produce)(config, (draft) => void (draft.tooltipTotal = checked)));
3345
+ function onSortByChange(sortBy2) {
3346
+ config && onChange(
3347
+ (0, import_immer7.produce)(config, (draft) => {
3348
+ draft.sort = draft.sort || {};
3349
+ draft.sort.sortBy = sortBy2;
3350
+ })
3351
+ );
3447
3352
  }
3448
- return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
3449
- import_ui_core14.DisclosurePanel,
3353
+ return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
3354
+ import_ui_core12.DisclosurePanel,
3450
3355
  {
3451
- title: "Value Options",
3356
+ title: "Bar Gauge Options",
3452
3357
  defaultOpen,
3453
3358
  containerClassName: "w-full bg-default-bg",
3454
- children: [
3455
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
3456
- ValueOptions,
3457
- {
3458
- onChange,
3459
- config,
3460
- formatters,
3461
- showPrefix,
3462
- showSuffix
3463
- }
3464
- ),
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,
3359
+ children: /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "flex items-center gap-4", children: [
3360
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "shadow-xs flex rounded-md", children: [
3361
+ /* @__PURE__ */ (0, import_jsx_runtime23.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" }),
3362
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
3363
+ "select",
3468
3364
  {
3469
- checked: config?.showValueLabel,
3470
- onChange: toggleShowValueLabel,
3471
- label: "Show value label"
3365
+ value: config.direction,
3366
+ 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",
3367
+ onChange: (e) => onDirectionChange(e.target.value),
3368
+ children: directionItems.map((d) => {
3369
+ return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("option", { value: d.value, children: d.label }, d.value);
3370
+ })
3371
+ }
3372
+ )
3373
+ ] }),
3374
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "shadow-xs flex rounded-md", children: [
3375
+ /* @__PURE__ */ (0, import_jsx_runtime23.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" }),
3376
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
3377
+ "select",
3378
+ {
3379
+ value: config.calculation,
3380
+ 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",
3381
+ onChange: (e) => onCalculationChange(e.target.value),
3382
+ children: CalculationItems2.map((d) => {
3383
+ return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("option", { value: d.value, children: d.label }, d.value);
3384
+ })
3385
+ }
3386
+ )
3387
+ ] }),
3388
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "shadow-xs flex rounded-md", children: [
3389
+ /* @__PURE__ */ (0, import_jsx_runtime23.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" }),
3390
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
3391
+ "select",
3392
+ {
3393
+ value: config?.sort?.sortBy,
3394
+ 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",
3395
+ onChange: (e) => onSortByChange(e.target.value),
3396
+ children: sortByItems.map((d) => {
3397
+ return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("option", { value: d.value, children: d.label }, d.value);
3398
+ })
3472
3399
  }
3473
3400
  ),
3474
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
3475
- import_ui_core14.Checkbox,
3401
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
3402
+ "select",
3476
3403
  {
3477
- checked: config?.tooltipTotal,
3478
- onChange: toggleTooltipTotal,
3479
- label: "Show total in tooltip"
3404
+ value: config?.sort?.orderDesc + "",
3405
+ 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",
3406
+ onChange: (e) => onOrderChange(e.target.value === "true"),
3407
+ children: orderItems.map((d) => {
3408
+ return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("option", { value: d.value + "", children: d.label }, d.label);
3409
+ })
3480
3410
  }
3481
3411
  )
3482
3412
  ] })
3483
- ]
3413
+ ] })
3484
3414
  }
3485
3415
  );
3486
- };
3416
+ }
3487
3417
 
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"
3505
- }
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;
3418
+ // src/charts/options/ValueOptions.tsx
3419
+ var import_immer9 = require("immer");
3420
+ var import_ui_core14 = require("@sentio/ui-core");
3512
3421
 
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",
3527
- {
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"
3530
- }
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
- ]
3422
+ // src/charts/options/ValueStringMapping.tsx
3423
+ var import_lu3 = require("react-icons/lu");
3424
+ var import_ui_core13 = require("@sentio/ui-core");
3425
+ var import_immer8 = require("immer");
3426
+ var import_jsx_runtime24 = require("react/jsx-runtime");
3427
+ var operators = {
3428
+ ">": "greater than",
3429
+ ">=": "greater or equal",
3430
+ "==": "equal",
3431
+ "!=": "not equal",
3432
+ "<": "less than",
3433
+ "<=": "less or equal"
3434
+ };
3435
+ var renderTreeLine = (index, isLast) => {
3436
+ return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: "mr-2 flex h-12 w-3 flex-col items-center justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: "flex h-full w-full items-center", children: [
3437
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
3438
+ "div",
3439
+ {
3440
+ className: (0, import_ui_core13.classNames)(
3441
+ "w-px bg-gray-300",
3442
+ isLast ? "h-1/2 self-start" : index === 0 ? "h-full self-end" : "h-full"
3443
+ )
3444
+ }
3445
+ ),
3446
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: "h-px w-3 bg-gray-300" })
3447
+ ] }) });
3448
+ };
3449
+ function ValueStringMapping({ rules, onChange }) {
3450
+ const addRule = () => {
3451
+ onChange(
3452
+ (0, import_immer8.produce)(rules, (draft) => {
3453
+ draft = draft || [];
3454
+ draft.push({
3455
+ comparison: "==",
3456
+ value: 0,
3457
+ text: ""
3458
+ });
3459
+ })
3460
+ );
3461
+ };
3462
+ function removeRule(index) {
3463
+ onChange(
3464
+ (0, import_immer8.produce)(rules, (draft) => {
3465
+ draft.splice(index, 1);
3466
+ })
3467
+ );
3534
3468
  }
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",
3469
+ function changeRule(index, field, value) {
3470
+ onChange(
3471
+ (0, import_immer8.produce)(rules, (draft) => {
3472
+ ;
3473
+ draft[index][field] = value;
3474
+ })
3475
+ );
3476
+ }
3477
+ return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: "flex w-full flex-col rounded-md py-2", children: [
3478
+ (rules || []).map((rule, index) => {
3479
+ const isLast = index === (rules || []).length - 1;
3480
+ return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
3481
+ "div",
3482
+ {
3483
+ className: "text-text-foreground flex h-10 items-center py-1",
3484
+ children: [
3485
+ renderTreeLine(index, isLast),
3486
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { className: "sm:text-ilabel inline-flex h-full items-center pr-3 font-medium", children: "If value is" }),
3487
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
3488
+ "select",
3489
+ {
3490
+ value: rule.comparison,
3491
+ onChange: (e) => changeRule(index, "comparison", e.target.value),
3492
+ 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",
3493
+ children: Object.entries(operators).map(([op, display]) => {
3494
+ return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("option", { value: op, children: [
3495
+ "is ",
3496
+ display
3497
+ ] }, op);
3498
+ })
3499
+ }
3500
+ ),
3501
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
3502
+ "input",
3503
+ {
3504
+ type: "text",
3505
+ name: "value",
3506
+ id: "value",
3507
+ 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",
3508
+ placeholder: "0",
3509
+ value: rule.value,
3510
+ onChange: (e) => {
3511
+ changeRule(index, "value", e.target.value);
3512
+ }
3513
+ }
3514
+ ),
3515
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { className: "sm:text-ilabel inline-flex h-full items-center rounded-none px-3 font-medium", children: ", then show" }),
3516
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
3517
+ "input",
3518
+ {
3519
+ type: "text",
3520
+ name: "text",
3521
+ id: "text",
3522
+ 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",
3523
+ placeholder: "Display text (e.g. High, Low, Normal)",
3524
+ value: rule.text,
3525
+ onChange: (e) => {
3526
+ changeRule(index, "text", e.target.value);
3527
+ }
3528
+ }
3529
+ ),
3530
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
3531
+ "button",
3532
+ {
3533
+ type: "button",
3534
+ className: "mx-2",
3535
+ "aria-label": "remove",
3536
+ onClick: () => removeRule(index),
3537
+ children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
3538
+ import_lu3.LuTrash2,
3539
+ {
3540
+ className: "icon text-text-foreground-disabled",
3541
+ "aria-hidden": "true"
3542
+ }
3543
+ )
3544
+ }
3545
+ )
3546
+ ]
3547
+ },
3548
+ index
3549
+ );
3550
+ }),
3551
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
3552
+ import_ui_core13.Button,
3551
3553
  {
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"
3554
+ type: "button",
3555
+ role: "secondary",
3556
+ className: "mt-1 w-fit flex-none",
3557
+ "aria-label": "remove",
3558
+ onClick: addRule,
3559
+ children: [
3560
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_lu3.LuPlus, { className: (0, import_ui_core13.classNames)("h-4 w-4"), "aria-hidden": "true" }),
3561
+ "Add Formatting Rule"
3562
+ ]
3554
3563
  }
3555
3564
  )
3556
- }
3557
- );
3558
- var BarIcon_default = SvgIcon3;
3565
+ ] });
3566
+ }
3559
3567
 
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",
3568
+ // src/charts/options/ValueOptions.tsx
3569
+ var import_jsx_runtime25 = require("react/jsx-runtime");
3570
+ var ValueFormatters = [
3571
+ { label: "Number", value: "NumberFormatter" },
3572
+ { label: "Date", value: "DateFormatter" },
3573
+ { label: "String", value: "StringFormatter" }
3574
+ ];
3575
+ var defaultConfig3 = {
3576
+ valueFormatter: "NumberFormatter",
3577
+ showValueLabel: false,
3578
+ maxSignificantDigits: 3,
3579
+ dateFormat: "LLL",
3580
+ mappingRules: [],
3581
+ style: "None"
3582
+ };
3583
+ var dateFormats = [
3584
+ { label: "Localized format", value: "LLL" },
3585
+ { label: "ISO String", value: "YYYY-MM-DDTHH:mm:ss.sssZ" }
3586
+ ];
3587
+ var CurrencySymbols = [
3588
+ { label: "USD", value: "$" },
3589
+ { label: "EUR", value: "\u20AC" },
3590
+ { label: "GBP", value: "\xA3" },
3591
+ { label: "CNY or JPY", value: "\xA5" },
3592
+ { label: "BTC", value: "\u0243" },
3593
+ { label: "ETH", value: "\u039E" }
3594
+ ];
3595
+ var AddonLabel = ({
3596
+ className,
3597
+ children
3598
+ }) => /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
3599
+ "span",
3564
3600
  {
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
- ]
3601
+ className: (0, import_ui_core14.classNames)(
3602
+ "sm:text-ilabel border-main inline-flex items-center whitespace-nowrap bg-gray-50 px-3",
3603
+ className
3604
+ ),
3605
+ children
3601
3606
  }
3602
3607
  );
3603
- var BarGuageIcon_default = SvgIcon4;
3604
-
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",
3620
- {
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"
3626
- }
3627
- ),
3628
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
3629
- "path",
3630
- {
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"
3636
- }
3637
- )
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
- ]
3608
+ var ValueOptions = ({
3609
+ config,
3610
+ onChange,
3611
+ formatters = ValueFormatters,
3612
+ showPrefix,
3613
+ showSuffix
3614
+ }) => {
3615
+ function onChangeDateFormat(f) {
3616
+ onChange((0, import_immer9.produce)(config, (draft) => void (draft.dateFormat = f)));
3641
3617
  }
3642
- );
3643
- var PieIcon_default = SvgIcon5;
3644
-
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",
3660
- {
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"
3666
- }
3667
- ),
3668
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
3669
- "path",
3670
- {
3671
- d: "M7.98188 5.77273H6.39097L5.75461 5.13636L6.39097 4.5H7.98188L8.61824 5.13636L7.98188 5.77273Z",
3672
- fill: "currentColor"
3673
- }
3674
- ),
3675
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
3676
- "path",
3677
- {
3678
- d: "M7.98188 11.5H6.39097L5.75461 10.8637L6.39097 10.2273H7.98188L8.61824 10.8637L7.98188 11.5Z",
3679
- fill: "currentColor"
3680
- }
3681
- ),
3682
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
3683
- "path",
3684
- {
3685
- d: "M8.30005 9.90907V6.09089L8.93641 5.45453L9.57278 6.09089V9.90907L8.93641 10.5454L8.30005 9.90907Z",
3686
- fill: "currentColor"
3687
- }
3688
- ),
3689
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
3690
- "path",
3691
- {
3692
- d: "M4.80005 9.90907V6.09089L5.43641 5.45453L6.07278 6.09089V9.90907L5.43641 10.5454L4.80005 9.90907Z",
3693
- fill: "currentColor"
3694
- }
3695
- ),
3696
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
3697
- "path",
3698
- {
3699
- d: "M1 3.5L13 3.5",
3700
- stroke: "currentColor",
3701
- strokeWidth: "1.16667",
3702
- strokeLinecap: "round",
3703
- strokeLinejoin: "round"
3618
+ function onChangeFormatter(f) {
3619
+ onChange((0, import_immer9.produce)(config, (draft) => void (draft.valueFormatter = f)));
3620
+ }
3621
+ function onChangeSymbol(symbol) {
3622
+ onChange((0, import_immer9.produce)(config, (draft) => void (draft.currencySymbol = symbol)));
3623
+ }
3624
+ function onStyleChange(notation) {
3625
+ onChange(
3626
+ (0, import_immer9.produce)(config, (draft) => {
3627
+ draft.style = notation;
3628
+ })
3629
+ );
3630
+ }
3631
+ function onDigitsChange(value, option) {
3632
+ onChange(
3633
+ (0, import_immer9.produce)(config, (draft) => {
3634
+ const d = draft;
3635
+ if (value) {
3636
+ const maxSignificantDigits = parseInt(value);
3637
+ if (maxSignificantDigits >= 0 && maxSignificantDigits <= 20) {
3638
+ d[option] = maxSignificantDigits;
3704
3639
  }
3705
- )
3706
- ] }),
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
- ]
3640
+ } else {
3641
+ delete d[option];
3642
+ }
3643
+ })
3644
+ );
3645
+ }
3646
+ function onMappingRulesChange(rules) {
3647
+ onChange((0, import_immer9.produce)(config, (draft) => void (draft.mappingRules = rules)));
3648
+ }
3649
+ function onPrefixChange(value) {
3650
+ onChange(
3651
+ (0, import_immer9.produce)(config, (draft) => {
3652
+ if (value) {
3653
+ draft.prefix = value;
3654
+ } else {
3655
+ delete draft.prefix;
3656
+ }
3657
+ })
3658
+ );
3659
+ }
3660
+ function onSuffixChange(value) {
3661
+ onChange(
3662
+ (0, import_immer9.produce)(config, (draft) => {
3663
+ if (value) {
3664
+ draft.suffix = value;
3665
+ } else {
3666
+ delete draft.suffix;
3667
+ }
3668
+ })
3669
+ );
3670
+ }
3671
+ function numberAddons(style) {
3672
+ switch (style) {
3673
+ case "None":
3674
+ return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(import_jsx_runtime25.Fragment, { children: [
3675
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(AddonLabel, { className: "border border-l-0", children: "Fraction Digits" }),
3676
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
3677
+ "input",
3678
+ {
3679
+ disabled: true,
3680
+ className: "focus:border-primary-500 sm:text-ilabel min-w-20 border-main rounded-r-md border border-l-0 py-1",
3681
+ value: ""
3682
+ }
3683
+ )
3684
+ ] });
3685
+ case "Percent":
3686
+ case "Standard":
3687
+ return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(import_jsx_runtime25.Fragment, { children: [
3688
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(AddonLabel, { className: "border border-x-0", children: "Fraction Digits" }),
3689
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
3690
+ "input",
3691
+ {
3692
+ type: "number",
3693
+ min: 0,
3694
+ max: 20,
3695
+ 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",
3696
+ value: config.maxFractionDigits,
3697
+ placeholder: "0-20",
3698
+ onChange: (e) => onDigitsChange(e.target.value, "maxFractionDigits")
3699
+ }
3700
+ )
3701
+ ] });
3702
+ case "Currency":
3703
+ return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(import_jsx_runtime25.Fragment, { children: [
3704
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(AddonLabel, { className: "border border-r-0", children: "Symbol" }),
3705
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: "w-28 ", children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
3706
+ import_ui_core14.ComboInput,
3707
+ {
3708
+ onChange: onChangeSymbol,
3709
+ options: CurrencySymbols.map((s) => s.value),
3710
+ displayFn: (s) => {
3711
+ const name = CurrencySymbols.find((c) => c.value === s)?.label;
3712
+ return `${name} (${s})`;
3713
+ },
3714
+ placeholder: "$",
3715
+ value: config?.currencySymbol
3716
+ }
3717
+ ) }),
3718
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(AddonLabel, { className: "border", children: "Precision" }),
3719
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
3720
+ "input",
3721
+ {
3722
+ type: "number",
3723
+ min: 0,
3724
+ max: 20,
3725
+ className: "focus:border-primary-500 sm:text-ilabel min-w-20 border-main rounded-r-md border border-l-0 py-1",
3726
+ value: config.precision,
3727
+ defaultValue: 2,
3728
+ placeholder: "0-20",
3729
+ onChange: (e) => onDigitsChange(e.target.value, "precision")
3730
+ }
3731
+ )
3732
+ ] });
3733
+ default:
3734
+ return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(import_jsx_runtime25.Fragment, { children: [
3735
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(AddonLabel, { className: "border border-x-0", children: "Max significant digits" }),
3736
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
3737
+ "input",
3738
+ {
3739
+ type: "number",
3740
+ min: 1,
3741
+ max: 21,
3742
+ 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",
3743
+ value: config.maxSignificantDigits,
3744
+ placeholder: "1-21",
3745
+ onChange: (e) => onDigitsChange(e.target.value, "maxSignificantDigits")
3746
+ }
3747
+ )
3748
+ ] });
3749
+ }
3709
3750
  }
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",
3751
+ return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(import_jsx_runtime25.Fragment, { children: [
3752
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "flex", children: [
3753
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(AddonLabel, { className: "rounded-l-md border border-r-0", children: "Value formatter" }),
3754
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
3755
+ "select",
3756
+ {
3757
+ value: config.valueFormatter,
3758
+ className: (0, import_ui_core14.classNames)(
3759
+ "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",
3760
+ config.valueFormatter == "StringFormatter" ? "rounded-r-md" : ""
3761
+ ),
3762
+ onChange: (e) => onChangeFormatter(e.target.value),
3763
+ children: formatters.map((d) => {
3764
+ return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("option", { value: d.value, children: d.label }, d.value);
3765
+ })
3766
+ }
3767
+ ),
3768
+ config.valueFormatter == "NumberFormatter" && /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(import_jsx_runtime25.Fragment, { children: [
3769
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(AddonLabel, { className: "border border-l-0 border-r-0", children: "Style" }),
3770
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(
3771
+ "select",
3768
3772
  {
3769
- d: "M7 6.43408V6.44283",
3770
- stroke: "currentColor",
3771
- strokeWidth: "1.16667",
3772
- strokeLinecap: "round",
3773
- strokeLinejoin: "round"
3773
+ value: config.style,
3774
+ 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",
3775
+ onChange: (e) => onStyleChange(e.target.value),
3776
+ children: [
3777
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("option", { value: "None", children: "None" }),
3778
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("option", { value: "Compact", children: "Compact" }),
3779
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("option", { value: "Standard", children: "Standard" }),
3780
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("option", { value: "Scientific", children: "Scientific" }),
3781
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("option", { value: "Percent", children: "Percent" }),
3782
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("option", { value: "Currency", children: "Currency" })
3783
+ ]
3774
3784
  }
3775
3785
  ),
3776
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
3777
- "path",
3778
- {
3779
- d: "M11.0834 6.43408V6.44283",
3780
- stroke: "currentColor",
3781
- strokeWidth: "1.16667",
3782
- strokeLinecap: "round",
3783
- strokeLinejoin: "round"
3784
- }
3785
- )
3786
+ config.style && numberAddons(config.style)
3786
3787
  ] }),
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;
3792
-
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: [
3788
+ config.valueFormatter == "DateFormatter" && /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(import_jsx_runtime25.Fragment, { children: [
3789
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(AddonLabel, { className: "border border-l-0", children: "Date format" }),
3806
3790
  /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
3807
- "path",
3791
+ "select",
3808
3792
  {
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"
3793
+ value: config.dateFormat,
3794
+ 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",
3795
+ onChange: (e) => onChangeDateFormat(e.target.value),
3796
+ children: dateFormats.map((d) => {
3797
+ return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("option", { value: d.value, children: d.label }, d.value);
3798
+ })
3814
3799
  }
3815
- ),
3800
+ )
3801
+ ] })
3802
+ ] }) }),
3803
+ (showPrefix || showSuffix) && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "mt-2 flex items-center gap-4", children: [
3804
+ showPrefix && /* @__PURE__ */ (0, import_jsx_runtime25.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: [
3805
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: "h-7.5 leading-7.5 border-r px-3", children: "Prefix" }),
3816
3806
  /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
3817
- "path",
3807
+ "input",
3818
3808
  {
3819
- d: "M1 5L13 5",
3820
- stroke: "currentColor",
3821
- strokeWidth: "1.16667",
3822
- strokeLinecap: "round",
3823
- strokeLinejoin: "round"
3809
+ type: "text",
3810
+ className: "border-0 px-3 py-1.5 focus:ring-0",
3811
+ value: config.prefix || "",
3812
+ placeholder: "e.g., $, #",
3813
+ onChange: (e) => onPrefixChange(e.target.value)
3824
3814
  }
3825
- ),
3815
+ )
3816
+ ] }),
3817
+ showSuffix && /* @__PURE__ */ (0, import_jsx_runtime25.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: [
3818
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: "h-7.5 leading-7.5 border-r px-3", children: "Suffix" }),
3826
3819
  /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
3827
- "path",
3820
+ "input",
3828
3821
  {
3829
- d: "M6 2L6 12",
3830
- stroke: "currentColor",
3831
- strokeWidth: "1.16667",
3832
- strokeLinecap: "round",
3833
- strokeLinejoin: "round"
3822
+ type: "text",
3823
+ className: "min-w-32 border-0 px-3 py-1.5 focus:ring-0",
3824
+ value: config.suffix || "",
3825
+ placeholder: "e.g., %, USD, tokens",
3826
+ onChange: (e) => onSuffixChange(e.target.value)
3834
3827
  }
3835
3828
  )
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
- ]
3829
+ ] })
3830
+ ] }) }),
3831
+ config.valueFormatter == "StringFormatter" && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
3832
+ ValueStringMapping,
3833
+ {
3834
+ rules: config.mappingRules || [],
3835
+ onChange: onMappingRulesChange
3836
+ }
3837
+ )
3838
+ ] });
3839
+ };
3840
+
3841
+ // src/charts/options/ValueControls.tsx
3842
+ var import_lodash5 = require("lodash");
3843
+ var import_ui_core15 = require("@sentio/ui-core");
3844
+ var import_immer10 = require("immer");
3845
+ var import_jsx_runtime26 = require("react/jsx-runtime");
3846
+ var defaultConfig4 = {
3847
+ valueFormatter: "NumberFormatter",
3848
+ showValueLabel: false,
3849
+ maxSignificantDigits: 3,
3850
+ dateFormat: "LLL",
3851
+ mappingRules: [],
3852
+ style: "None",
3853
+ maxFractionDigits: 2
3854
+ };
3855
+ var ValueControls = ({
3856
+ config,
3857
+ defaultOpen,
3858
+ onChange,
3859
+ formatters = ValueFormatters,
3860
+ showPrefix,
3861
+ showSuffix
3862
+ }) => {
3863
+ config = (0, import_lodash5.defaults)(config || {}, defaultConfig4);
3864
+ function toggleShowValueLabel(checked) {
3865
+ config && onChange(
3866
+ (0, import_immer10.produce)(config, (draft) => void (draft.showValueLabel = checked))
3867
+ );
3839
3868
  }
3840
- );
3841
- var TableIcon_default = SvgIcon8;
3869
+ function toggleTooltipTotal(checked) {
3870
+ config && onChange((0, import_immer10.produce)(config, (draft) => void (draft.tooltipTotal = checked)));
3871
+ }
3872
+ return /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(
3873
+ import_ui_core15.DisclosurePanel,
3874
+ {
3875
+ title: "Value Options",
3876
+ defaultOpen,
3877
+ containerClassName: "w-full bg-default-bg",
3878
+ children: [
3879
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
3880
+ ValueOptions,
3881
+ {
3882
+ onChange,
3883
+ config,
3884
+ formatters,
3885
+ showPrefix,
3886
+ showSuffix
3887
+ }
3888
+ ),
3889
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "mt-2 flex items-center gap-2", children: [
3890
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
3891
+ import_ui_core15.Checkbox,
3892
+ {
3893
+ checked: config?.showValueLabel,
3894
+ onChange: toggleShowValueLabel,
3895
+ label: "Show value label"
3896
+ }
3897
+ ),
3898
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
3899
+ import_ui_core15.Checkbox,
3900
+ {
3901
+ checked: config?.tooltipTotal,
3902
+ onChange: toggleTooltipTotal,
3903
+ label: "Show total in tooltip"
3904
+ }
3905
+ )
3906
+ ] })
3907
+ ]
3908
+ }
3909
+ );
3910
+ };
3842
3911
  // Annotate the CommonJS export names for ESM import in node:
3843
3912
  0 && (module.exports = {
3844
3913
  AggregateInput,
@@ -3849,6 +3918,7 @@ var TableIcon_default = SvgIcon8;
3849
3918
  BarGuageIcon,
3850
3919
  BarIcon,
3851
3920
  ChartLegend,
3921
+ ChartTypeButtonGroup,
3852
3922
  EventsFunctionCategories,
3853
3923
  EventsFunctionMap,
3854
3924
  FunctionInput,