@sentio/ui-dashboard 0.3.1 → 0.3.5

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
@@ -5801,7 +5801,7 @@ var operators = {
5801
5801
  "<=": "less or equal"
5802
5802
  };
5803
5803
  var renderTreeLine = (index, isLast) => {
5804
- return /* @__PURE__ */ jsx33("div", { className: "mr-2 flex h-12 w-3 flex-col items-center justify-center", children: /* @__PURE__ */ jsxs23("div", { className: "flex h-full w-full items-center", children: [
5804
+ return /* @__PURE__ */ jsx33("div", { className: "mr-2 flex w-3 flex-col items-center justify-center", children: /* @__PURE__ */ jsxs23("div", { className: "flex h-full w-full items-center", children: [
5805
5805
  /* @__PURE__ */ jsx33(
5806
5806
  "div",
5807
5807
  {
@@ -5842,16 +5842,16 @@ function ValueStringMapping({ rules, onChange }) {
5842
5842
  })
5843
5843
  );
5844
5844
  }
5845
- return /* @__PURE__ */ jsxs23("div", { className: "flex w-full flex-col rounded-md py-2", children: [
5845
+ return /* @__PURE__ */ jsxs23("div", { className: "flex w-full flex-col gap-2 rounded-md", children: [
5846
5846
  (rules || []).map((rule, index) => {
5847
5847
  const isLast = index === (rules || []).length - 1;
5848
5848
  return /* @__PURE__ */ jsxs23(
5849
5849
  "div",
5850
5850
  {
5851
- className: "text-text-foreground flex h-10 items-center py-1",
5851
+ className: "text-text-foreground flex h-8 items-center",
5852
5852
  children: [
5853
5853
  renderTreeLine(index, isLast),
5854
- /* @__PURE__ */ jsx33("span", { className: "sm:text-ilabel inline-flex h-full items-center pr-3 font-medium", children: "If value is" }),
5854
+ /* @__PURE__ */ jsx33("span", { className: "sm:text-ilabel inline-flex h-full items-center pr-2 font-medium", children: "If value is" }),
5855
5855
  /* @__PURE__ */ jsx33(
5856
5856
  "select",
5857
5857
  {
@@ -5880,7 +5880,7 @@ function ValueStringMapping({ rules, onChange }) {
5880
5880
  }
5881
5881
  }
5882
5882
  ),
5883
- /* @__PURE__ */ jsx33("span", { className: "sm:text-ilabel inline-flex h-full items-center rounded-none px-3 font-medium", children: ", then show" }),
5883
+ /* @__PURE__ */ jsx33("span", { className: "sm:text-ilabel inline-flex h-full items-center rounded-none px-2 font-medium", children: ", then show" }),
5884
5884
  /* @__PURE__ */ jsx33(
5885
5885
  "input",
5886
5886
  {
@@ -5899,16 +5899,10 @@ function ValueStringMapping({ rules, onChange }) {
5899
5899
  "button",
5900
5900
  {
5901
5901
  type: "button",
5902
- className: "mx-2",
5902
+ className: "text-text-foreground-disabled hover:text-primary-600 mx-2 cursor-pointer",
5903
5903
  "aria-label": "remove",
5904
5904
  onClick: () => removeRule(index),
5905
- children: /* @__PURE__ */ jsx33(
5906
- LuTrash2,
5907
- {
5908
- className: "icon text-text-foreground-disabled",
5909
- "aria-hidden": "true"
5910
- }
5911
- )
5905
+ children: /* @__PURE__ */ jsx33(LuTrash2, { className: "icon", "aria-hidden": "true" })
5912
5906
  }
5913
5907
  )
5914
5908
  ]
@@ -5916,18 +5910,16 @@ function ValueStringMapping({ rules, onChange }) {
5916
5910
  index
5917
5911
  );
5918
5912
  }),
5919
- /* @__PURE__ */ jsxs23(
5913
+ /* @__PURE__ */ jsx33(
5920
5914
  Button3,
5921
5915
  {
5922
5916
  type: "button",
5923
5917
  role: "secondary",
5924
- className: "mt-1 w-fit flex-none",
5918
+ className: "py-1.5! w-fit flex-none",
5925
5919
  "aria-label": "remove",
5926
5920
  onClick: addRule,
5927
- children: [
5928
- /* @__PURE__ */ jsx33(LuPlus, { className: classNames9("h-4 w-4"), "aria-hidden": "true" }),
5929
- "Add Formatting Rule"
5930
- ]
5921
+ icon: /* @__PURE__ */ jsx33(LuPlus, {}),
5922
+ children: "Add Formatting Rule"
5931
5923
  }
5932
5924
  )
5933
5925
  ] });
@@ -6577,6 +6569,558 @@ function ScatterControls({
6577
6569
  }
6578
6570
  );
6579
6571
  }
6572
+
6573
+ // src/charts/options/TableControls.tsx
6574
+ import { useMemo as useMemo11 } from "react";
6575
+ import { produce as produce14 } from "immer";
6576
+ import { defaults as defaults8 } from "lodash";
6577
+ import { Checkbox as Checkbox5, DisclosurePanel as DisclosurePanel11 } from "@sentio/ui-core";
6578
+
6579
+ // src/charts/table-utils.ts
6580
+ import { startCase } from "lodash";
6581
+ var TEMPLATE_TOKEN = /{{([\s\S]+?)}}/g;
6582
+ function sanitizeLabels(labels) {
6583
+ const result = {};
6584
+ for (const k in labels) {
6585
+ switch (k) {
6586
+ case "contract_name":
6587
+ result["contract"] = labels[k];
6588
+ break;
6589
+ case "contract_address":
6590
+ result["address"] = labels[k];
6591
+ break;
6592
+ }
6593
+ result[k] = labels[k];
6594
+ }
6595
+ return result;
6596
+ }
6597
+ function aliasTemplate(alias, labels) {
6598
+ if (alias) {
6599
+ try {
6600
+ const safe = sanitizeLabels(labels);
6601
+ return alias.replace(TEMPLATE_TOKEN, (_, m1) => {
6602
+ const value = safe[m1.trim()];
6603
+ return value == null ? `` : value;
6604
+ });
6605
+ } catch (e) {
6606
+ return alias;
6607
+ }
6608
+ }
6609
+ }
6610
+ function escapeColumnId(id) {
6611
+ return id.replace(/[\W_.]+/g, "_");
6612
+ }
6613
+ function getColumnNameId(labels, alias, displayName) {
6614
+ const s = aliasTemplate(alias, labels) || startCase(displayName);
6615
+ return { columnName: s, columnId: escapeColumnId(s) };
6616
+ }
6617
+
6618
+ // src/charts/options/TableControls.tsx
6619
+ import { jsx as jsx39, jsxs as jsxs29 } from "react/jsx-runtime";
6620
+ var defaultConfig7 = {
6621
+ calculation: "LAST",
6622
+ sortColumns: [],
6623
+ showColumns: void 0,
6624
+ columnWidths: {},
6625
+ columnOrders: [],
6626
+ showPlainData: false,
6627
+ calculations: {},
6628
+ valueConfigs: {}
6629
+ };
6630
+ function getDefaultValueConfig(type) {
6631
+ switch (type) {
6632
+ case "NUMBER":
6633
+ return {
6634
+ ...defaultConfig4,
6635
+ valueFormatter: "NumberFormatter"
6636
+ };
6637
+ case "TIME":
6638
+ return {
6639
+ ...defaultConfig4,
6640
+ valueFormatter: "DateFormatter"
6641
+ };
6642
+ default:
6643
+ return {
6644
+ ...defaultConfig4,
6645
+ valueFormatter: "StringFormatter"
6646
+ };
6647
+ }
6648
+ }
6649
+ var CalculationItems3 = [
6650
+ { label: "All", value: "ALL" },
6651
+ { label: "Last", value: "LAST" },
6652
+ { label: "First", value: "FIRST" },
6653
+ { label: "Total", value: "TOTAL" },
6654
+ { label: "Mean", value: "MEAN" },
6655
+ { label: "Max", value: "MAX" },
6656
+ { label: "Min", value: "MIN" }
6657
+ ];
6658
+ function TableControls({ config, defaultOpen, onChange, data }) {
6659
+ config = defaults8({}, config, defaultConfig7);
6660
+ function onCalculationChange(col, cal) {
6661
+ config && onChange(
6662
+ produce14(config, (draft) => {
6663
+ if (col === "") {
6664
+ delete draft.calculations;
6665
+ draft.calculation = cal;
6666
+ } else {
6667
+ draft.calculations = draft.calculations || {};
6668
+ draft.calculations[col] = cal;
6669
+ }
6670
+ })
6671
+ );
6672
+ }
6673
+ function onValueConfigChange(col, valueConfig) {
6674
+ config && onChange(
6675
+ produce14(config, (draft) => {
6676
+ draft.valueConfigs = draft.valueConfigs || {};
6677
+ draft.valueConfigs[col] = valueConfig;
6678
+ })
6679
+ );
6680
+ }
6681
+ function onMapSeriesAsColumnsChange(checked) {
6682
+ config && onChange(produce14(config, (draft) => void (draft.showPlainData = checked)));
6683
+ }
6684
+ const calculations = useMemo11(() => {
6685
+ if (!config?.showPlainData) {
6686
+ return CalculationItems3.filter((item) => item.value !== "ALL");
6687
+ }
6688
+ return CalculationItems3;
6689
+ }, [config?.showPlainData]);
6690
+ const isSql = data?.result !== void 0;
6691
+ const columns = useMemo11(() => {
6692
+ if (config?.showPlainData) {
6693
+ return [];
6694
+ }
6695
+ const map = {};
6696
+ if (isSql) {
6697
+ const results = data?.result;
6698
+ if (results) {
6699
+ for (const [name, type] of Object.entries(results?.columnTypes || {})) {
6700
+ map[name] = {
6701
+ name,
6702
+ type
6703
+ };
6704
+ }
6705
+ }
6706
+ } else {
6707
+ const results = data?.results;
6708
+ for (const r of results || []) {
6709
+ for (const s of r?.matrix?.samples || []) {
6710
+ const { columnId, columnName } = getColumnNameId(
6711
+ s?.metric?.labels || {},
6712
+ r.alias,
6713
+ s.metric?.displayName
6714
+ );
6715
+ map[columnId] = {
6716
+ name: columnName
6717
+ };
6718
+ }
6719
+ }
6720
+ }
6721
+ return Object.keys(map).sort().map((k) => ({ columnId: k, column: map[k] }));
6722
+ }, [data, config]);
6723
+ return /* @__PURE__ */ jsxs29(
6724
+ DisclosurePanel11,
6725
+ {
6726
+ title: "Table Options",
6727
+ defaultOpen,
6728
+ containerClassName: "w-full bg-default-bg",
6729
+ children: [
6730
+ !isSql && /* @__PURE__ */ jsxs29("div", { className: "min-h-8 flex items-center", children: [
6731
+ /* @__PURE__ */ jsx39("div", { className: "w-48 px-2", children: /* @__PURE__ */ jsx39(
6732
+ Checkbox5,
6733
+ {
6734
+ checked: config?.showPlainData,
6735
+ onChange: onMapSeriesAsColumnsChange,
6736
+ label: "Show plain data"
6737
+ }
6738
+ ) }),
6739
+ config?.showPlainData && /* @__PURE__ */ jsxs29("div", { className: "flex", children: [
6740
+ /* @__PURE__ */ jsx39("span", { className: "border-main sm:text-icontent inline-flex items-center rounded-l-md border border-r-0 bg-gray-50 px-3", children: "Calculation" }),
6741
+ /* @__PURE__ */ jsx39(
6742
+ "select",
6743
+ {
6744
+ value: config.calculation,
6745
+ className: "border-main text-text-foreground sm:text-icontent focus:border-primary-600 hover:border-primary-600 inline-flex items-center rounded-r-md border pl-4 pr-7 focus:ring-0",
6746
+ onChange: (e) => {
6747
+ onCalculationChange("", e.target.value);
6748
+ },
6749
+ children: calculations.map((d) => {
6750
+ return /* @__PURE__ */ jsx39("option", { value: d.value, children: d.label }, d.value);
6751
+ })
6752
+ }
6753
+ )
6754
+ ] }),
6755
+ /* @__PURE__ */ jsx39("div", {})
6756
+ ] }),
6757
+ /* @__PURE__ */ jsx39("div", { className: "divide-border-color flex flex-col gap-2 divide-y", children: columns.map(({ columnId, column }) => /* @__PURE__ */ jsxs29("div", { className: "flex items-start pb-2", children: [
6758
+ /* @__PURE__ */ jsx39("h4", { className: "text-text-foreground text-icontent leading-7.5 w-48 px-2 font-medium", children: column.name }),
6759
+ /* @__PURE__ */ jsxs29("div", { className: "flex flex-1 flex-wrap items-start gap-2 rounded-md", children: [
6760
+ !isSql && /* @__PURE__ */ jsxs29("div", { className: "flex", children: [
6761
+ /* @__PURE__ */ jsx39("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" }),
6762
+ /* @__PURE__ */ jsx39(
6763
+ "select",
6764
+ {
6765
+ value: config?.calculations && config?.calculations[columnId] || "LAST",
6766
+ className: "border-main text-text-foreground sm:text-icontent focus:border-primary-600 hover:border-primary-600 inline-flex items-center rounded-r-md border pl-4 pr-7 focus:ring-0",
6767
+ onChange: (e) => onCalculationChange(
6768
+ columnId,
6769
+ e.target.value
6770
+ ),
6771
+ children: calculations.map((d) => {
6772
+ return /* @__PURE__ */ jsx39("option", { value: d.value, children: d.label }, d.value);
6773
+ })
6774
+ }
6775
+ )
6776
+ ] }),
6777
+ /* @__PURE__ */ jsx39(
6778
+ ValueOptions,
6779
+ {
6780
+ onChange: (cfg) => onValueConfigChange(columnId, cfg),
6781
+ config: config?.valueConfigs && config.valueConfigs[columnId] || getDefaultValueConfig(column.type)
6782
+ }
6783
+ )
6784
+ ] })
6785
+ ] }, columnId)) })
6786
+ ]
6787
+ }
6788
+ );
6789
+ }
6790
+
6791
+ // src/dashboard/EditDashboardDialog.tsx
6792
+ import { useState as useState11, useRef as useRef5, useCallback as useCallback6, useEffect as useEffect10, useMemo as useMemo12 } from "react";
6793
+ import { BaseDialog } from "@sentio/ui-core";
6794
+ import { jsx as jsx40, jsxs as jsxs30 } from "react/jsx-runtime";
6795
+ var EditDashboardDialog = ({
6796
+ dashboard,
6797
+ open,
6798
+ onClose,
6799
+ onUpdate
6800
+ }) => {
6801
+ const [processing, setProcessing] = useState11(false);
6802
+ const [updateDisabled, setUpdateDisabled] = useState11(true);
6803
+ const inputElementRef = useRef5(null);
6804
+ const onCloseAndReset = useCallback6(() => {
6805
+ onClose?.();
6806
+ if (dashboard?.name && inputElementRef.current) {
6807
+ inputElementRef.current.value = dashboard.name;
6808
+ }
6809
+ }, [onClose, dashboard?.name]);
6810
+ const onOk = useCallback6(() => {
6811
+ if (!inputElementRef.current?.value) {
6812
+ return;
6813
+ }
6814
+ setProcessing(true);
6815
+ onUpdate({ ...dashboard, name: inputElementRef.current?.value }).then(() => {
6816
+ onCloseAndReset();
6817
+ }).finally(() => {
6818
+ setProcessing(false);
6819
+ });
6820
+ }, [onCloseAndReset, onUpdate, dashboard]);
6821
+ useEffect10(() => {
6822
+ if (open && dashboard?.name && inputElementRef.current) {
6823
+ inputElementRef.current.value = dashboard.name;
6824
+ }
6825
+ }, [open, dashboard?.name]);
6826
+ const onInputChange = useCallback6(
6827
+ (evt) => {
6828
+ const value = evt.target.value;
6829
+ if (!value || value === dashboard?.name) {
6830
+ setUpdateDisabled(true);
6831
+ } else {
6832
+ setUpdateDisabled(false);
6833
+ }
6834
+ },
6835
+ [dashboard?.name]
6836
+ );
6837
+ const okProps = useMemo12(
6838
+ () => ({
6839
+ processing,
6840
+ disabled: updateDisabled
6841
+ }),
6842
+ [updateDisabled, processing]
6843
+ );
6844
+ return /* @__PURE__ */ jsx40(
6845
+ BaseDialog,
6846
+ {
6847
+ title: "Edit Dashboard",
6848
+ open,
6849
+ onClose: onCloseAndReset,
6850
+ cancelText: "Close",
6851
+ onCancel: onCloseAndReset,
6852
+ onOk,
6853
+ okProps,
6854
+ okText: "Update",
6855
+ footerBorder: false,
6856
+ initialFocus: inputElementRef,
6857
+ children: /* @__PURE__ */ jsx40(
6858
+ "form",
6859
+ {
6860
+ method: "dialog",
6861
+ className: "text-text-foreground relative mb-4 mt-2 px-4",
6862
+ onSubmit: onOk,
6863
+ children: /* @__PURE__ */ jsxs30("div", { className: "grid py-2 text-sm", children: [
6864
+ /* @__PURE__ */ jsx40("div", { className: "sm:text-ilabel text-text-foreground-secondary mb-2 mt-1", children: "Dashboard Name" }),
6865
+ /* @__PURE__ */ jsx40(
6866
+ "input",
6867
+ {
6868
+ defaultValue: dashboard?.name,
6869
+ placeholder: "Provide a new name for your dashboard",
6870
+ type: "text",
6871
+ required: true,
6872
+ name: "dashboard-name",
6873
+ id: "new-dashboard-name",
6874
+ className: "focus:border-primary-600 focus:ring-primary-600/30 focus:ring-3 hover:border-primary-600 sm:text-ilabel border-main block w-full rounded-md",
6875
+ ref: inputElementRef,
6876
+ onChange: onInputChange
6877
+ }
6878
+ )
6879
+ ] })
6880
+ }
6881
+ )
6882
+ }
6883
+ );
6884
+ };
6885
+
6886
+ // src/dashboard/EditGroupDialog.tsx
6887
+ import { useEffect as useEffect11, useMemo as useMemo13, useRef as useRef6, useState as useState12 } from "react";
6888
+ import { BaseDialog as BaseDialog2, Select as Select2, classNames as classNames12 } from "@sentio/ui-core";
6889
+ import { LuCheck as LuCheck2 } from "react-icons/lu";
6890
+
6891
+ // src/dashboard/group-styles.ts
6892
+ var CLASSIC_INDEX = {
6893
+ blue: 0,
6894
+ cyan: 1,
6895
+ pink: 2,
6896
+ yellow: 3,
6897
+ green: 4,
6898
+ lightblue: 5,
6899
+ purple: 6,
6900
+ red: 7,
6901
+ orange: 8
6902
+ };
6903
+ var HIGHLIGHT_COLORS = [
6904
+ { key: "green", name: "Sentio Green" },
6905
+ { key: "blue", name: "Sentio Blue" },
6906
+ { key: "cyan", name: "Sentio Cyan" },
6907
+ { key: "lightblue", name: "Sentio Light Blue" },
6908
+ { key: "purple", name: "Sentio Purple" },
6909
+ { key: "pink", name: "Sentio Pink" },
6910
+ { key: "red", name: "Sentio Red" },
6911
+ { key: "orange", name: "Sentio Orange" },
6912
+ { key: "yellow", name: "Sentio Yellow" }
6913
+ ];
6914
+ var DEFAULT_HIGHLIGHT_KEY = "green";
6915
+ function getHighlightHex(key, isDark) {
6916
+ if (!key) return void 0;
6917
+ const idx = CLASSIC_INDEX[key];
6918
+ if (idx === void 0) return void 0;
6919
+ return sentioColors[isDark ? "dark" : "light"].classic[idx];
6920
+ }
6921
+ function readableForeground(hex) {
6922
+ const m = hex.replace("#", "");
6923
+ const r = parseInt(m.slice(0, 2), 16) / 255;
6924
+ const g = parseInt(m.slice(2, 4), 16) / 255;
6925
+ const b = parseInt(m.slice(4, 6), 16) / 255;
6926
+ const lin = (v) => v <= 0.03928 ? v / 12.92 : Math.pow((v + 0.055) / 1.055, 2.4);
6927
+ const L = 0.2126 * lin(r) + 0.7152 * lin(g) + 0.0722 * lin(b);
6928
+ return L > 0.5 ? "#1f2937" : "#ffffff";
6929
+ }
6930
+ function resolveHighlight(colorKey, isDark) {
6931
+ const hex = getHighlightHex(colorKey, isDark) ?? getHighlightHex(DEFAULT_HIGHLIGHT_KEY, isDark);
6932
+ return { solid: hex, foreground: readableForeground(hex) };
6933
+ }
6934
+ function resolveHeaderStyle(style, colorKey, isDark) {
6935
+ if (!style || style === "DEFAULT") return {};
6936
+ const color = resolveHighlight(colorKey, isDark);
6937
+ return { backgroundColor: color.solid, color: color.foreground };
6938
+ }
6939
+
6940
+ // src/dashboard/EditGroupDialog.tsx
6941
+ import { Fragment as Fragment10, jsx as jsx41, jsxs as jsxs31 } from "react/jsx-runtime";
6942
+ function StyleCard({ selected, label, onClick, preview }) {
6943
+ return /* @__PURE__ */ jsxs31(
6944
+ "button",
6945
+ {
6946
+ type: "button",
6947
+ onClick,
6948
+ className: classNames12(
6949
+ "flex flex-col items-stretch overflow-hidden rounded-lg border bg-white text-left transition-colors",
6950
+ "dark:bg-default-bg",
6951
+ selected ? "border-primary-600 ring-primary-600/30 ring-3 shadow-sm" : "border-main hover:border-primary-400"
6952
+ ),
6953
+ children: [
6954
+ /* @__PURE__ */ jsx41("div", { className: "bg-hover/40 flex h-28 items-center justify-center", children: preview }),
6955
+ /* @__PURE__ */ jsxs31(
6956
+ "div",
6957
+ {
6958
+ className: classNames12(
6959
+ "border-main flex items-center justify-center gap-1.5 border-t px-2 py-2 text-sm",
6960
+ selected ? "text-primary-600 font-semibold" : "text-text-foreground font-medium"
6961
+ ),
6962
+ children: [
6963
+ selected && /* @__PURE__ */ jsx41(LuCheck2, { className: "h-3.5 w-3.5" }),
6964
+ label
6965
+ ]
6966
+ }
6967
+ )
6968
+ ]
6969
+ }
6970
+ );
6971
+ }
6972
+ function DefaultPreview() {
6973
+ return /* @__PURE__ */ jsx41("div", { className: "border-main bg-default-bg text-text-foreground flex h-16 w-32 items-center rounded border px-2 text-base", children: "Title" });
6974
+ }
6975
+ function EmphasisPreview({
6976
+ color
6977
+ }) {
6978
+ return /* @__PURE__ */ jsxs31("div", { className: "border-main bg-default-bg flex h-16 w-32 flex-col rounded border", children: [
6979
+ /* @__PURE__ */ jsx41(
6980
+ "div",
6981
+ {
6982
+ className: "flex h-9 items-center justify-center text-sm font-semibold",
6983
+ style: { backgroundColor: color.solid, color: color.foreground },
6984
+ children: "Title"
6985
+ }
6986
+ ),
6987
+ /* @__PURE__ */ jsx41("div", { className: "flex-1" })
6988
+ ] });
6989
+ }
6990
+ function EditGroupDialog({
6991
+ open,
6992
+ onClose,
6993
+ title,
6994
+ style,
6995
+ highlightColor,
6996
+ onSave
6997
+ }) {
6998
+ const [draftTitle, setDraftTitle] = useState12(title);
6999
+ const [draftStyle, setDraftStyle] = useState12(style);
7000
+ const [draftColor, setDraftColor] = useState12(highlightColor);
7001
+ const titleRef = useRef6(null);
7002
+ const isDark = useDarkMode();
7003
+ useEffect11(() => {
7004
+ if (!open) return;
7005
+ setDraftTitle(title);
7006
+ setDraftStyle(style || "DEFAULT");
7007
+ setDraftColor(
7008
+ highlightColor || (style && style !== "DEFAULT" ? DEFAULT_HIGHLIGHT_KEY : "")
7009
+ );
7010
+ }, [open, title, style, highlightColor]);
7011
+ const previewColor = useMemo13(
7012
+ () => resolveHighlight(draftColor, isDark),
7013
+ [draftColor, isDark]
7014
+ );
7015
+ const onPickStyle = (next) => {
7016
+ setDraftStyle(next);
7017
+ if (next !== "DEFAULT" && !draftColor) {
7018
+ setDraftColor(DEFAULT_HIGHLIGHT_KEY);
7019
+ }
7020
+ };
7021
+ const onOk = () => {
7022
+ onSave({
7023
+ title: draftTitle.trim() || "Group",
7024
+ style: draftStyle,
7025
+ // Persist '' for DEFAULT so we don't pollute the model with an unused
7026
+ // color when the user reverts.
7027
+ highlightColor: draftStyle === "DEFAULT" ? "" : draftColor || DEFAULT_HIGHLIGHT_KEY
7028
+ });
7029
+ onClose();
7030
+ };
7031
+ const colorOptions = useMemo13(
7032
+ () => HIGHLIGHT_COLORS.map((c) => {
7033
+ const resolved = resolveHighlight(c.key, isDark);
7034
+ return {
7035
+ value: c.key,
7036
+ title: c.name,
7037
+ label: ({ selected }) => /* @__PURE__ */ jsxs31("div", { className: "flex w-full items-center gap-2.5 pr-2", children: [
7038
+ /* @__PURE__ */ jsx41(
7039
+ "div",
7040
+ {
7041
+ className: "flex h-5 w-5 items-center justify-center rounded text-xs font-bold",
7042
+ style: {
7043
+ backgroundColor: resolved.solid,
7044
+ color: resolved.foreground
7045
+ },
7046
+ children: "T"
7047
+ }
7048
+ ),
7049
+ /* @__PURE__ */ jsx41("span", { className: "flex-1 text-sm", children: c.name }),
7050
+ selected && /* @__PURE__ */ jsx41(LuCheck2, { className: "text-primary-600 h-4 w-4" })
7051
+ ] })
7052
+ };
7053
+ }),
7054
+ [isDark]
7055
+ );
7056
+ return /* @__PURE__ */ jsx41(
7057
+ BaseDialog2,
7058
+ {
7059
+ title: "Edit Group",
7060
+ open,
7061
+ onClose,
7062
+ cancelText: "Cancel",
7063
+ onCancel: onClose,
7064
+ onOk,
7065
+ okText: "Save",
7066
+ panelClassName: "sm:max-w-xl",
7067
+ initialFocus: titleRef,
7068
+ children: /* @__PURE__ */ jsxs31("div", { className: "text-text-foreground px-4 pb-2 pt-4", children: [
7069
+ /* @__PURE__ */ jsx41("h4", { className: "text-text-foreground mb-3 text-sm font-semibold", children: "Display options" }),
7070
+ /* @__PURE__ */ jsx41("label", { className: "text-text-foreground-secondary text-ilabel mb-1 block", children: "Title" }),
7071
+ /* @__PURE__ */ jsx41(
7072
+ "input",
7073
+ {
7074
+ ref: titleRef,
7075
+ type: "text",
7076
+ value: draftTitle,
7077
+ onChange: (e) => setDraftTitle(e.target.value),
7078
+ onKeyDown: (e) => {
7079
+ if (e.key === "Enter") {
7080
+ e.preventDefault();
7081
+ onOk();
7082
+ }
7083
+ },
7084
+ className: "focus:border-primary-600 focus:ring-primary-600/30 focus:ring-3 hover:border-primary-600 sm:text-ilabel border-main mb-4 block w-full rounded-md"
7085
+ }
7086
+ ),
7087
+ /* @__PURE__ */ jsxs31("div", { className: "mb-4 grid grid-cols-2 gap-3", children: [
7088
+ /* @__PURE__ */ jsx41(
7089
+ StyleCard,
7090
+ {
7091
+ selected: draftStyle === "DEFAULT",
7092
+ label: "Default",
7093
+ onClick: () => onPickStyle("DEFAULT"),
7094
+ preview: /* @__PURE__ */ jsx41(DefaultPreview, {})
7095
+ }
7096
+ ),
7097
+ /* @__PURE__ */ jsx41(
7098
+ StyleCard,
7099
+ {
7100
+ selected: draftStyle === "EMPHASIS",
7101
+ label: "Emphasis",
7102
+ onClick: () => onPickStyle("EMPHASIS"),
7103
+ preview: /* @__PURE__ */ jsx41(EmphasisPreview, { color: previewColor })
7104
+ }
7105
+ )
7106
+ ] }),
7107
+ draftStyle !== "DEFAULT" && /* @__PURE__ */ jsxs31(Fragment10, { children: [
7108
+ /* @__PURE__ */ jsx41("label", { className: "text-text-foreground-secondary text-ilabel mb-1 block", children: "Highlight Color" }),
7109
+ /* @__PURE__ */ jsx41(
7110
+ Select2,
7111
+ {
7112
+ value: draftColor || DEFAULT_HIGHLIGHT_KEY,
7113
+ onChange: (v) => setDraftColor(v),
7114
+ options: colorOptions,
7115
+ size: "md",
7116
+ asLayer: true
7117
+ }
7118
+ )
7119
+ ] })
7120
+ ] })
7121
+ }
7122
+ );
7123
+ }
6580
7124
  export {
6581
7125
  AggregateInput,
6582
7126
  AreaIcon_default as AreaIcon,
@@ -6589,13 +7133,17 @@ export {
6589
7133
  ChartLegend,
6590
7134
  ChartTooltip,
6591
7135
  ChartTypeButtonGroup,
7136
+ DEFAULT_HIGHLIGHT_KEY,
6592
7137
  DataControls,
7138
+ EditDashboardDialog,
7139
+ EditGroupDialog,
6593
7140
  EventsFunctionCategories,
6594
7141
  EventsFunctionMap,
6595
7142
  FunctionInput,
6596
7143
  FunctionMap,
6597
7144
  FunctionsCategories,
6598
7145
  FunctionsPanel,
7146
+ HIGHLIGHT_COLORS,
6599
7147
  LabelControls,
6600
7148
  LabelSearchProvider,
6601
7149
  LabelsInput,
@@ -6614,6 +7162,7 @@ export {
6614
7162
  ScatterControls,
6615
7163
  ScatterIcon_default as ScatterIcon,
6616
7164
  SystemLabels,
7165
+ TableControls,
6617
7166
  TableIcon_default as TableIcon,
6618
7167
  TimeSeriesChart,
6619
7168
  ValueControls,
@@ -6626,9 +7175,14 @@ export {
6626
7175
  defaultConfig5 as defaultDataConfig,
6627
7176
  defaultConfig as defaultPieConfig,
6628
7177
  defaultConfig6 as defaultScatterConfig,
7178
+ defaultConfig7 as defaultTableConfig,
6629
7179
  defaultConfig3 as defaultValueConfig,
6630
7180
  defaultConfig4 as defaultValueControlsConfig,
7181
+ getDefaultValueConfig,
7182
+ getHighlightHex,
6631
7183
  isAggrOrRollupFunction,
7184
+ resolveHeaderStyle,
7185
+ resolveHighlight,
6632
7186
  sentioColors,
6633
7187
  sentioTheme,
6634
7188
  sentioThemeDark,