randmarcomps 1.323.0 → 1.325.0

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.
@@ -12,6 +12,7 @@ import * as DropdownMenuPrimitive from '@radix-ui/react-dropdown-menu';
12
12
  import { FC } from 'react';
13
13
  import { ForwardRefExoticComponent } from 'react';
14
14
  import { GeneralDocument } from 'randmar-api-client';
15
+ import { GoogleChartOptions } from 'react-google-charts';
15
16
  import { InputProps as InputProps_2 } from './input';
16
17
  import { Inventory } from 'randmar-api-client';
17
18
  import { JSX } from 'react/jsx-runtime';
@@ -804,7 +805,7 @@ export declare const Sidebar: React_2.ForwardRefExoticComponent<Omit<React_2.Cla
804
805
 
805
806
  export declare const SidebarContent: React_2.ForwardRefExoticComponent<Omit<React_2.DetailedHTMLProps<React_2.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & React_2.RefAttributes<HTMLDivElement>>;
806
807
 
807
- declare type SidebarContext = {
808
+ declare type SidebarContextValue = {
808
809
  state: "expanded" | "collapsed";
809
810
  open: boolean;
810
811
  setOpen: (open: boolean) => void;
@@ -814,8 +815,6 @@ declare type SidebarContext = {
814
815
  toggleSidebar: () => void;
815
816
  };
816
817
 
817
- declare const SidebarContext: React_2.Context<SidebarContext | null>;
818
-
819
818
  export declare const SidebarFooter: React_2.ForwardRefExoticComponent<Omit<React_2.DetailedHTMLProps<React_2.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & React_2.RefAttributes<HTMLDivElement>>;
820
819
 
821
820
  export declare const SidebarGroup: React_2.ForwardRefExoticComponent<Omit<React_2.DetailedHTMLProps<React_2.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & React_2.RefAttributes<HTMLDivElement>>;
@@ -985,12 +984,12 @@ declare interface TopPercentTreemapProps {
985
984
  export declare const Treemap: React_2.ForwardRefExoticComponent<TreemapProps & React_2.RefAttributes<HTMLDivElement>>;
986
985
 
987
986
  declare interface TreemapProps {
988
- data: any[][];
987
+ data: (string | number | null)[][];
989
988
  /**
990
989
  * A Google Charts options object for customizing the treemap's appearance and behavior.
991
990
  * @see https://developers.google.com/chart/interactive/docs/gallery/treemap#configuration-options
992
991
  */
993
- options?: object;
992
+ options?: GoogleChartOptions;
994
993
  height?: string;
995
994
  className?: string;
996
995
  loading?: boolean;
@@ -1003,7 +1002,7 @@ export declare const useGeminiApiKey: () => ApiKeyContextType;
1003
1002
 
1004
1003
  export declare function useIsMobile(): boolean;
1005
1004
 
1006
- export declare function useSidebar(): SidebarContext;
1005
+ export declare function useSidebar(): SidebarContextValue;
1007
1006
 
1008
1007
  export declare function useToast(): {
1009
1008
  toast: typeof toast;
@@ -16288,6 +16288,13 @@ function useIsMobile() {
16288
16288
  return n.addEventListener("change", o), e(window.innerWidth < MOBILE_BREAKPOINT), () => n.removeEventListener("change", o);
16289
16289
  }, []), !!t;
16290
16290
  }
16291
+ const SidebarContext = React.createContext(null);
16292
+ function useSidebar() {
16293
+ const t = React.useContext(SidebarContext);
16294
+ if (!t)
16295
+ throw new Error("useSidebar must be used within a SidebarProvider.");
16296
+ return t;
16297
+ }
16291
16298
  function Skeleton({
16292
16299
  className: t,
16293
16300
  ...e
@@ -16300,14 +16307,7 @@ function Skeleton({
16300
16307
  }
16301
16308
  );
16302
16309
  }
16303
- const SIDEBAR_COOKIE_NAME = "sidebar:state", SIDEBAR_COOKIE_MAX_AGE = 60 * 60 * 24 * 7, SIDEBAR_WIDTH = "16rem", SIDEBAR_WIDTH_MOBILE = "18rem", SIDEBAR_WIDTH_ICON = "3rem", SIDEBAR_KEYBOARD_SHORTCUT = "b", SidebarContext = React.createContext(null);
16304
- function useSidebar() {
16305
- const t = React.useContext(SidebarContext);
16306
- if (!t)
16307
- throw new Error("useSidebar must be used within a SidebarProvider.");
16308
- return t;
16309
- }
16310
- const SidebarProvider = React.forwardRef(
16310
+ const SIDEBAR_COOKIE_NAME = "sidebar:state", SIDEBAR_COOKIE_MAX_AGE = 60 * 60 * 24 * 7, SIDEBAR_WIDTH = "16rem", SIDEBAR_WIDTH_MOBILE = "18rem", SIDEBAR_WIDTH_ICON = "3rem", SIDEBAR_KEYBOARD_SHORTCUT = "b", SidebarProvider = React.forwardRef(
16311
16311
  ({
16312
16312
  defaultOpen: t = !0,
16313
16313
  open: e,
@@ -35593,7 +35593,7 @@ function ChartTooltipContent({ active: t, payload: e, label: n, series: o }) {
35593
35593
  return /* @__PURE__ */ jsxs("div", { className: "rounded-lg border bg-background p-2 text-sm shadow-sm", children: [
35594
35594
  /* @__PURE__ */ jsx("div", { className: "mb-1 font-medium", children: n }),
35595
35595
  /* @__PURE__ */ jsx("div", { className: "space-y-1", children: e.map((d) => {
35596
- if (d.value === null || d.value === void 0)
35596
+ if (typeof d.dataKey != "string" || d.value === null || d.value === void 0)
35597
35597
  return null;
35598
35598
  const f = l.get(d.dataKey);
35599
35599
  if (!f) return null;
@@ -54132,7 +54132,8 @@ async function convertExcelWithApi(t, e, n, o) {
54132
54132
  const b = await f.json();
54133
54133
  g += `
54134
54134
  Server response: ${JSON.stringify(b)}`;
54135
- } catch {
54135
+ } catch (b) {
54136
+ console.error(b);
54136
54137
  const S = await f.text().catch(() => "Could not read error text.");
54137
54138
  g += `
54138
54139
  Server response (text): ${S}`;
@@ -54274,35 +54275,35 @@ function useAIAssistant({ userId: t, smartAndSlow: e = !1 }) {
54274
54275
  }
54275
54276
  const oe = async ($e, Ne) => {
54276
54277
  try {
54277
- const je = [$e.trim()];
54278
+ const Ve = [$e.trim()];
54278
54279
  if (Ne) {
54279
54280
  o("Receiving attached file...");
54280
- let Oe = new Blob(
54281
+ let ze = new Blob(
54281
54282
  [await Ne.arrayBuffer()],
54282
54283
  { type: Ne.type }
54283
- ), Le = Ne.name;
54284
- if (Le.indexOf(".xl") !== -1) {
54285
- var Ve = await convertExcelWithApi(t, Oe, Le, localStorage.getItem("access_token"));
54286
- Le = Le.replace(/\.(xlsx|xls)$/, ".txt"), Oe = new Blob([ne(Ve)], { type: "text/plain" });
54287
- }
54288
- const qe = await O.files.upload({
54289
- file: Oe,
54290
- config: { displayName: Le }
54284
+ ), Oe = Ne.name;
54285
+ if (Oe.indexOf(".xl") !== -1) {
54286
+ const Ge = await convertExcelWithApi(t, ze, Oe, localStorage.getItem("access_token"));
54287
+ Oe = Oe.replace(/\.(xlsx|xls)$/, ".txt"), ze = new Blob([ne(Ge)], { type: "text/plain" });
54288
+ }
54289
+ const Le = await O.files.upload({
54290
+ file: ze,
54291
+ config: { displayName: Oe }
54291
54292
  });
54292
- let Ge = await O.files.get({ name: qe.name });
54293
- for (; Ge.state === "PROCESSING"; )
54294
- Ge = await O.files.get({ name: qe.name }), await new Promise((He) => {
54295
- setTimeout(He, 1e3);
54293
+ let qe = await O.files.get({ name: Le.name });
54294
+ for (; qe.state === "PROCESSING"; )
54295
+ qe = await O.files.get({ name: Le.name }), await new Promise((Ge) => {
54296
+ setTimeout(Ge, 1e3);
54296
54297
  });
54297
- if (qe.state === "FAILED")
54298
+ if (Le.state === "FAILED")
54298
54299
  throw new Error("File processing failed.");
54299
- je.push({ fileData: { fileUri: qe.uri, mimeType: qe.mimeType } });
54300
+ Ve.push({ fileData: { fileUri: Le.uri, mimeType: Le.mimeType } });
54300
54301
  }
54301
54302
  o("Thinking...");
54302
- const ze = await f.sendMessage({ message: je });
54303
- await F(ze);
54304
- } catch (je) {
54305
- console.error("[debug] error sending message:", je), ge({
54303
+ const je = await f.sendMessage({ message: Ve });
54304
+ await F(je);
54305
+ } catch (Ve) {
54306
+ console.error("[debug] error sending message:", Ve), ge({
54306
54307
  content: "I'm sorry, I encountered an error processing your request. Please try again later.",
54307
54308
  timestamp: /* @__PURE__ */ new Date()
54308
54309
  });
@@ -93305,6 +93306,7 @@ const Treemap = React.forwardRef(
93305
93306
  fontSize: 14,
93306
93307
  showScale: !1,
93307
93308
  isHtml: !0,
93309
+ backgroundColor: "hsl(var(--background))",
93308
93310
  generateTooltip: (A, M) => {
93309
93311
  var q;
93310
93312
  const I = (q = t[A + 1]) == null ? void 0 : q[0];
@@ -93318,6 +93320,9 @@ const Treemap = React.forwardRef(
93318
93320
  return S && (!e || !e.colorAxis) && (R.minColor = S.minColor, R.midColor = S.midColor, R.maxColor = S.maxColor), { ...R, ...e };
93319
93321
  }, [t, e, S]), E = React.useMemo(() => d ? [{
93320
93322
  eventName: "select",
93323
+ // react-google-charts is not officially maintained by Google and not up
93324
+ // to date with the GoogleChartWrapper type, setSelection is missing
93325
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
93321
93326
  callback: ({ chartWrapper: A }) => {
93322
93327
  A.getChart().setSelection(null);
93323
93328
  }
@@ -93365,7 +93370,8 @@ const TopPercentTreemap = ({
93365
93370
  return _;
93366
93371
  }, [t, e]), f = React.useMemo(() => ({
93367
93372
  title: n,
93368
- maxDepth: 1
93373
+ maxDepth: 1,
93374
+ backgroundColor: "hsl(var(--background))"
93369
93375
  }), [n]);
93370
93376
  return /* @__PURE__ */ jsx(
93371
93377
  Treemap,