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