react-semaphor 0.0.158 → 0.0.160

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.
@@ -10589,8 +10589,8 @@ function h6({
10589
10589
  customCards: h,
10590
10590
  ...p
10591
10591
  }) {
10592
- Re((x) => x.selectedSheetId);
10593
- const g = Re((x) => x.themeStyle), v = Re((x) => x.onEvent), b = Re((x) => x.isSessionExpired), { isLoading: y, isError: w } = f6({
10592
+ Re((w) => w.selectedSheetId);
10593
+ const g = Re((w) => w.themeStyle), v = Re((w) => w.isSessionExpired), { isLoading: b, isError: y } = f6({
10594
10594
  // id,
10595
10595
  // version,
10596
10596
  authToken: l,
@@ -10599,10 +10599,10 @@ function h6({
10599
10599
  onSave: n,
10600
10600
  onEvent: r
10601
10601
  });
10602
- return y || !l ? (v == null || v({
10602
+ return b || !l ? (r == null || r({
10603
10603
  type: "info",
10604
- message: `isLoading: ${y}, accessToken: ${l == null ? void 0 : l.accessToken}`
10605
- }), o ? /* @__PURE__ */ A.jsx(o, { message: "loading" }) : /* @__PURE__ */ A.jsx("div", { className: "flex items-center gap-3", children: /* @__PURE__ */ A.jsx(c0, { className: "h-1 w-full dark:h-[2px]" }) })) : w ? (v == null || v({ type: "error", message: "Error fetching dashboard" }), i ? (console.log("Error fetching dashboard"), /* @__PURE__ */ A.jsx(i, {})) : /* @__PURE__ */ A.jsx("div", { children: "Error" })) : b ? (v == null || v({ type: "error", message: "Session Expired" }), /* @__PURE__ */ A.jsx("div", { className: "flex h-full items-center justify-center", children: /* @__PURE__ */ A.jsxs("div", { className: "space-y-4 rounded-md border border-muted p-10", children: [
10604
+ message: `isLoading: ${b}, accessToken: ${l == null ? void 0 : l.accessToken}`
10605
+ }), o ? /* @__PURE__ */ A.jsx(o, { message: "loading" }) : /* @__PURE__ */ A.jsx("div", { className: "flex items-center gap-3", children: /* @__PURE__ */ A.jsx(c0, { className: "h-1 w-full dark:h-[2px]" }) })) : y ? (r == null || r({ type: "error", message: "Error fetching dashboard" }), i ? (console.log("Error fetching dashboard"), /* @__PURE__ */ A.jsx(i, {})) : /* @__PURE__ */ A.jsx("div", { children: "Error" })) : v ? (r == null || r({ type: "error", message: "Session Expired" }), /* @__PURE__ */ A.jsx("div", { className: "flex h-full items-center justify-center", children: /* @__PURE__ */ A.jsxs("div", { className: "space-y-4 rounded-md border border-muted p-10", children: [
10606
10606
  /* @__PURE__ */ A.jsx(Jh, { children: "Session Expired" }),
10607
10607
  /* @__PURE__ */ A.jsx("p", { className: "text-muted-foreground", children: "Your session has expired. Please refresh the page to continue." })
10608
10608
  ] }) })) : /* @__PURE__ */ A.jsx(
@@ -28668,7 +28668,14 @@ function CB({
28668
28668
  onError: (r) => {
28669
28669
  console.error(`Something went wrong: ${r.message}`), r.message === "invalid token" && t(!0);
28670
28670
  }
28671
- })
28671
+ }),
28672
+ defaultOptions: {
28673
+ queries: {
28674
+ refetchOnWindowFocus: !1,
28675
+ retry: 1
28676
+ // retry failed requests once
28677
+ }
28678
+ }
28672
28679
  });
28673
28680
  return /* @__PURE__ */ A.jsx(KN, { client: n, children: e });
28674
28681
  }
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../chunks/index-3wbtWl30.js");require("react");require("react-dom");exports.Dashboard=e.Dashboard;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../chunks/index-_LlAz5ER.js");require("react");require("react-dom");exports.Dashboard=e.Dashboard;
@@ -1,4 +1,4 @@
1
- import { D as p } from "../chunks/index-uB7kIwd1.js";
1
+ import { D as p } from "../chunks/index-adBUOo_L.js";
2
2
  import "react";
3
3
  import "react-dom";
4
4
  export {
package/dist/index.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./chunks/index-3wbtWl30.js"),d=require("./chunks/dashboard-plus-Qop-RzlQ.js"),I=require("react");require("react-dom");function N({card:t,footer:u,className:m,...c}){const{customCards:r}=e.useSemaphorContext(),h=I.useRef(null),{isError:p,isLoading:n,isFetching:i,cfg:x,visualKey:C,handleDatapointClick:f}=e.useDashboardCard(t),a=e.useDashboardStore(s=>s.themeStyle),l=e.useDashboardStore(s=>s.selectedSheetId),E=e.useDashboardStore(s=>s.selectedCardId),j=e.useDashboardStore(s=>s.isDashboardEditing),{setCardTitle:g,setCardDescription:D,setSelectedCardId:b}=e.useDashboardActions();function S(s){s.stopPropagation(),b(l,t.id)}function T(){if(r&&r.length>0){const s=r.find(o=>o.cardId===t.id);if(s&&s.replaceDefault){const o=s.content;if(o)return e.jsxRuntimeExports.jsx(o,{card:t})}}return t.type==="kpi"?t.data&&t.data.length>0&&e.jsxRuntimeExports.jsx(e.KPICard,{isLoading:n||i,card:t}):y}function R(){if(p)return e.jsxRuntimeExports.jsx("p",{className:"text-sm",children:"Oops! It seems like something went wrong. Please review your connection or filters."});if(t.type==="table"&&t.data&&t.data.length>0)return e.jsxRuntimeExports.jsxs(e.ScrollArea,{children:[e.jsxRuntimeExports.jsx(e.TableVisual,{card:t,data:t.data}),e.jsxRuntimeExports.jsx(e.ScrollBar,{orientation:"horizontal"})]});if(r&&r.length>0){const s=r.find(o=>o.cardId===t.id);if(s&&s.content){const o=s.content;return e.jsxRuntimeExports.jsx(o,{card:t})}}if(x)return e.jsxRuntimeExports.jsx(e.ChartJsVisual,{cfg:x,onDatapointClick:f},C)}function A(){if(r&&r.length>0){const s=r.find(o=>o.cardId===t.id);if(s&&s.footer){const o=s.footer;if(o)return e.jsxRuntimeExports.jsx(o,{card:t})}}return u||null}if(!t.id)return null;const y=e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsxs(e.CardHeader,{className:"pb-4",children:[e.jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxRuntimeExports.jsx(e.Editable,{text:t.title,onSave:s=>g(l,t.id,s),children:e.jsxRuntimeExports.jsx(e.CardTitle,{className:"text-base",children:t.title})}),t.refreshInterval&&e.jsxRuntimeExports.jsxs(e.Tooltip,{children:[e.jsxRuntimeExports.jsx(e.TooltipTrigger,{className:"pr-1",children:e.jsxRuntimeExports.jsx("div",{className:e.cn("h-2 w-2 rounded-full bg-green-500 transition-opacity",{"opacity-10":n||i})})}),e.jsxRuntimeExports.jsx(e.TooltipContent,{side:"right",align:"center",children:e.jsxRuntimeExports.jsx("p",{className:"text-xs",children:`Realtime (${t==null?void 0:t.refreshInterval})`})})]}),!t.refreshInterval&&(n||i)&&e.jsxRuntimeExports.jsx(e.LoaderCircle,{className:"h-4 w-4 animate-spin text-muted-foreground"})]}),e.jsxRuntimeExports.jsx(e.Editable,{text:(t==null?void 0:t.description)||"",onSave:s=>D(l,t.id,s),children:e.jsxRuntimeExports.jsxs(e.CardDescription,{children:[" ",t.description]})})]}),e.jsxRuntimeExports.jsx(e.CardContent,{className:"relative flex grow flex-col overflow-auto pb-0",children:R()}),e.jsxRuntimeExports.jsx(e.CardFooter,{children:A()})]});return e.jsxRuntimeExports.jsx(e.Card,{tabIndex:-1,ref:h,role:"dashboard-card",onClick:S,className:e.cn("relative flex h-full flex-col rounded-sm",{"border-dashed border-foreground/50":E===t.id&&j},a==null?void 0:a.dashboardCard,m),...c,children:T()})}exports.BOOLEAN_DATA_TYPES=e.BOOLEAN_DATA_TYPES;exports.DATE_DATA_TYPES=e.DATE_DATA_TYPES;exports.Dashboard=e.Dashboard;exports.DashboardWC=e.DashboardWC;exports.NUMBER_DATA_TYPES=e.NUMBER_DATA_TYPES;exports.SemaphorQueryClient=e.SemaphorQueryClient;exports.TEXT_DATA_TYPES=e.TEXT_DATA_TYPES;exports.cleanCard=e.cleanCard;exports.createSqlGenConfig=e.createSqlGenConfig;exports.fmt=e.fmt;exports.getBookmarkKey=e.getBookmarkKey;exports.getColumnDataType=e.getColumnDataType;exports.getDashbaordStateWithoutData=e.getDashbaordStateWithoutData;exports.getFilterValueType=e.getFilterValueType;exports.getQualifiedTableName=e.getQualifiedTableName;exports.getSql=e.getSql;exports.isColumnInSqlGen=e.isColumnInSqlGen;exports.resolveDataType=e.resolveDataType;exports.useCard=e.useCard;exports.useDashboardActions=e.useDashboardActions;exports.useDashboardStore=e.useDashboardStore;exports.useEditorActions=e.useEditorActions;exports.useEditorStore=e.useEditorStore;exports.SelectComponent=d.SelectComponent;exports.Surfboard=d.DashboardPlus;exports.useEditorAside=d.useEditorAside;exports.DashboardCard=N;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./chunks/index-_LlAz5ER.js"),d=require("./chunks/dashboard-plus-z76D9VlN.js"),I=require("react");require("react-dom");function N({card:t,footer:u,className:m,...c}){const{customCards:r}=e.useSemaphorContext(),h=I.useRef(null),{isError:p,isLoading:n,isFetching:i,cfg:x,visualKey:C,handleDatapointClick:f}=e.useDashboardCard(t),a=e.useDashboardStore(s=>s.themeStyle),l=e.useDashboardStore(s=>s.selectedSheetId),E=e.useDashboardStore(s=>s.selectedCardId),j=e.useDashboardStore(s=>s.isDashboardEditing),{setCardTitle:g,setCardDescription:D,setSelectedCardId:b}=e.useDashboardActions();function S(s){s.stopPropagation(),b(l,t.id)}function T(){if(r&&r.length>0){const s=r.find(o=>o.cardId===t.id);if(s&&s.replaceDefault){const o=s.content;if(o)return e.jsxRuntimeExports.jsx(o,{card:t})}}return t.type==="kpi"?t.data&&t.data.length>0&&e.jsxRuntimeExports.jsx(e.KPICard,{isLoading:n||i,card:t}):y}function R(){if(p)return e.jsxRuntimeExports.jsx("p",{className:"text-sm",children:"Oops! It seems like something went wrong. Please review your connection or filters."});if(t.type==="table"&&t.data&&t.data.length>0)return e.jsxRuntimeExports.jsxs(e.ScrollArea,{children:[e.jsxRuntimeExports.jsx(e.TableVisual,{card:t,data:t.data}),e.jsxRuntimeExports.jsx(e.ScrollBar,{orientation:"horizontal"})]});if(r&&r.length>0){const s=r.find(o=>o.cardId===t.id);if(s&&s.content){const o=s.content;return e.jsxRuntimeExports.jsx(o,{card:t})}}if(x)return e.jsxRuntimeExports.jsx(e.ChartJsVisual,{cfg:x,onDatapointClick:f},C)}function A(){if(r&&r.length>0){const s=r.find(o=>o.cardId===t.id);if(s&&s.footer){const o=s.footer;if(o)return e.jsxRuntimeExports.jsx(o,{card:t})}}return u||null}if(!t.id)return null;const y=e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsxs(e.CardHeader,{className:"pb-4",children:[e.jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxRuntimeExports.jsx(e.Editable,{text:t.title,onSave:s=>g(l,t.id,s),children:e.jsxRuntimeExports.jsx(e.CardTitle,{className:"text-base",children:t.title})}),t.refreshInterval&&e.jsxRuntimeExports.jsxs(e.Tooltip,{children:[e.jsxRuntimeExports.jsx(e.TooltipTrigger,{className:"pr-1",children:e.jsxRuntimeExports.jsx("div",{className:e.cn("h-2 w-2 rounded-full bg-green-500 transition-opacity",{"opacity-10":n||i})})}),e.jsxRuntimeExports.jsx(e.TooltipContent,{side:"right",align:"center",children:e.jsxRuntimeExports.jsx("p",{className:"text-xs",children:`Realtime (${t==null?void 0:t.refreshInterval})`})})]}),!t.refreshInterval&&(n||i)&&e.jsxRuntimeExports.jsx(e.LoaderCircle,{className:"h-4 w-4 animate-spin text-muted-foreground"})]}),e.jsxRuntimeExports.jsx(e.Editable,{text:(t==null?void 0:t.description)||"",onSave:s=>D(l,t.id,s),children:e.jsxRuntimeExports.jsxs(e.CardDescription,{children:[" ",t.description]})})]}),e.jsxRuntimeExports.jsx(e.CardContent,{className:"relative flex grow flex-col overflow-auto pb-0",children:R()}),e.jsxRuntimeExports.jsx(e.CardFooter,{children:A()})]});return e.jsxRuntimeExports.jsx(e.Card,{tabIndex:-1,ref:h,role:"dashboard-card",onClick:S,className:e.cn("relative flex h-full flex-col rounded-sm",{"border-dashed border-foreground/50":E===t.id&&j},a==null?void 0:a.dashboardCard,m),...c,children:T()})}exports.BOOLEAN_DATA_TYPES=e.BOOLEAN_DATA_TYPES;exports.DATE_DATA_TYPES=e.DATE_DATA_TYPES;exports.Dashboard=e.Dashboard;exports.DashboardWC=e.DashboardWC;exports.NUMBER_DATA_TYPES=e.NUMBER_DATA_TYPES;exports.SemaphorQueryClient=e.SemaphorQueryClient;exports.TEXT_DATA_TYPES=e.TEXT_DATA_TYPES;exports.cleanCard=e.cleanCard;exports.createSqlGenConfig=e.createSqlGenConfig;exports.fmt=e.fmt;exports.getBookmarkKey=e.getBookmarkKey;exports.getColumnDataType=e.getColumnDataType;exports.getDashbaordStateWithoutData=e.getDashbaordStateWithoutData;exports.getFilterValueType=e.getFilterValueType;exports.getQualifiedTableName=e.getQualifiedTableName;exports.getSql=e.getSql;exports.isColumnInSqlGen=e.isColumnInSqlGen;exports.resolveDataType=e.resolveDataType;exports.useCard=e.useCard;exports.useDashboardActions=e.useDashboardActions;exports.useDashboardStore=e.useDashboardStore;exports.useEditorActions=e.useEditorActions;exports.useEditorStore=e.useEditorStore;exports.SelectComponent=d.SelectComponent;exports.Surfboard=d.DashboardPlus;exports.useEditorAside=d.useEditorAside;exports.DashboardCard=N;
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
- import { u as _, a as k, b as n, c as w, j as s, C as F, E as f, d as P, T as R, e as B, f as h, g as L, L as q, h as K, i as O, k as Y, l as G, K as V, S as z, m as H, n as J, o as M } from "./chunks/index-uB7kIwd1.js";
2
- import { B as se, s as te, D as ae, q as oe, N as ne, I as re, r as ie, M as le, w as de, t as ue, O as ce, y as fe, J as he, x as Ce, A as xe, v as me, z as pe, F as ge, p as je, H as De, G as be } from "./chunks/index-uB7kIwd1.js";
3
- import { S as Te, D as Ee, u as Ie } from "./chunks/dashboard-plus-_QCGGoEO.js";
1
+ import { u as _, a as k, b as n, c as w, j as s, C as F, E as f, d as P, T as R, e as B, f as h, g as L, L as q, h as K, i as O, k as Y, l as G, K as V, S as z, m as H, n as J, o as M } from "./chunks/index-adBUOo_L.js";
2
+ import { B as se, s as te, D as ae, q as oe, N as ne, I as re, r as ie, M as le, w as de, t as ue, O as ce, y as fe, J as he, x as Ce, A as xe, v as me, z as pe, F as ge, p as je, H as De, G as be } from "./chunks/index-adBUOo_L.js";
3
+ import { S as Te, D as Ee, u as Ie } from "./chunks/dashboard-plus-Dep7laYV.js";
4
4
  import Q from "react";
5
5
  import "react-dom";
6
6
  function $({
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("../chunks/dashboard-plus-Qop-RzlQ.js");require("../chunks/index-3wbtWl30.js");require("react");require("react-dom");exports.Surfboard=r.DashboardPlus;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("../chunks/dashboard-plus-z76D9VlN.js");require("../chunks/index-_LlAz5ER.js");require("react");require("react-dom");exports.Surfboard=r.DashboardPlus;
@@ -1,5 +1,5 @@
1
- import { D as i } from "../chunks/dashboard-plus-_QCGGoEO.js";
2
- import "../chunks/index-uB7kIwd1.js";
1
+ import { D as i } from "../chunks/dashboard-plus-Dep7laYV.js";
2
+ import "../chunks/index-adBUOo_L.js";
3
3
  import "react";
4
4
  import "react-dom";
5
5
  export {
@@ -357,7 +357,7 @@ declare type Params = {
357
357
 
358
358
  export declare const resolveDataType: (value: any) => string;
359
359
 
360
- export declare function SelectComponent({ title, items, value, isLoading, isError, connectionTooltip, onChange, className, showIcon, }: SelectProps): JSX_2.Element;
360
+ export declare function SelectComponent({ title, items, value, isLoading, isError, connectionTooltip, onChange, className, showIcon, disabled, }: SelectProps): JSX_2.Element;
361
361
 
362
362
  declare type SelectProps = {
363
363
  title: string;
@@ -372,6 +372,7 @@ declare type SelectProps = {
372
372
  className?: string;
373
373
  showIcon?: boolean;
374
374
  connectionTooltip?: string;
375
+ disabled?: boolean;
375
376
  };
376
377
 
377
378
  export declare function SemaphorQueryClient({ children, }: {
package/package.json CHANGED
@@ -5,7 +5,7 @@
5
5
  "email": "support@semaphor.cloud"
6
6
  },
7
7
  "license": "MIT",
8
- "version": "0.0.158",
8
+ "version": "0.0.160",
9
9
  "description": "Fully interactive and customizable dashboards for your apps.",
10
10
  "keywords": [
11
11
  "react",