analytica-frontend-lib 1.2.17 → 1.2.18

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.
@@ -1,12 +1,16 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
- import { A as AlertsConfig } from '../types-DMycdI4U.mjs';
2
+ import { A as AlertsConfig } from '../types-BXzeefgf.mjs';
3
3
  import 'react';
4
4
 
5
5
  interface AlertsManagerProps {
6
6
  config: AlertsConfig;
7
7
  isOpen?: boolean;
8
8
  onClose?: () => void;
9
+ /** URL da imagem após upload (prioritária - será exibida primeiro) */
10
+ imageLink?: string | null;
11
+ /** Imagem padrão a ser exibida quando não há imagem selecionada (deve ser URL string - o front deve converter File para URL se necessário) */
12
+ defaultImage?: string | null;
9
13
  }
10
- declare const AlertsManager: ({ config, isOpen, onClose, }: AlertsManagerProps) => react_jsx_runtime.JSX.Element;
14
+ declare const AlertsManager: ({ config, isOpen, onClose, imageLink, defaultImage, }: AlertsManagerProps) => react_jsx_runtime.JSX.Element;
11
15
 
12
16
  export { AlertsManager };
@@ -1,12 +1,16 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
- import { A as AlertsConfig } from '../types-DMycdI4U.js';
2
+ import { A as AlertsConfig } from '../types-BXzeefgf.js';
3
3
  import 'react';
4
4
 
5
5
  interface AlertsManagerProps {
6
6
  config: AlertsConfig;
7
7
  isOpen?: boolean;
8
8
  onClose?: () => void;
9
+ /** URL da imagem após upload (prioritária - será exibida primeiro) */
10
+ imageLink?: string | null;
11
+ /** Imagem padrão a ser exibida quando não há imagem selecionada (deve ser URL string - o front deve converter File para URL se necessário) */
12
+ defaultImage?: string | null;
9
13
  }
10
- declare const AlertsManager: ({ config, isOpen, onClose, }: AlertsManagerProps) => react_jsx_runtime.JSX.Element;
14
+ declare const AlertsManager: ({ config, isOpen, onClose, imageLink, defaultImage, }: AlertsManagerProps) => react_jsx_runtime.JSX.Element;
11
15
 
12
16
  export { AlertsManager };
@@ -1450,9 +1450,6 @@ var Divider = ({
1450
1450
  };
1451
1451
  var Divider_default = Divider;
1452
1452
 
1453
- // src/assets/img/notification.png
1454
- var notification_default = "../notification-TD7ZFRLL.png";
1455
-
1456
1453
  // src/components/TextArea/TextArea.tsx
1457
1454
  var import_react6 = require("react");
1458
1455
  var import_phosphor_react5 = require("phosphor-react");
@@ -5439,6 +5436,7 @@ var MessageStep = ({
5439
5436
  const handleRemoveFile = () => {
5440
5437
  setImage(null);
5441
5438
  };
5439
+ const isImageFile = image instanceof File;
5442
5440
  return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("section", { className: "flex flex-col gap-4", children: [
5443
5441
  /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
5444
5442
  Input_default,
@@ -5464,7 +5462,7 @@ var MessageStep = ({
5464
5462
  allowImageAttachment && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
5465
5463
  ImageUpload,
5466
5464
  {
5467
- selectedFile: image,
5465
+ selectedFile: isImageFile ? image : null,
5468
5466
  onFileSelect: handleFileSelect,
5469
5467
  onRemoveFile: handleRemoveFile
5470
5468
  }
@@ -5668,7 +5666,7 @@ var DateStep = ({
5668
5666
  // src/components/AlertManager/AlertSteps/PreviewStep.tsx
5669
5667
  var import_react18 = require("react");
5670
5668
  var import_jsx_runtime27 = require("react/jsx-runtime");
5671
- var PreviewStep = () => {
5669
+ var PreviewStep = ({ imageLink, defaultImage }) => {
5672
5670
  const title = useAlertFormStore((state) => state.title);
5673
5671
  const message = useAlertFormStore((state) => state.message);
5674
5672
  const image = useAlertFormStore((state) => state.image);
@@ -5679,17 +5677,21 @@ var PreviewStep = () => {
5679
5677
  if (image instanceof File) {
5680
5678
  return globalThis.window.URL.createObjectURL(image);
5681
5679
  }
5680
+ if (typeof image === "string") {
5681
+ return image;
5682
+ }
5682
5683
  return void 0;
5683
5684
  }, [image]);
5684
5685
  (0, import_react18.useEffect)(() => {
5685
5686
  return () => {
5686
- if (imageUrl && globalThis.window !== void 0) {
5687
+ if (globalThis.window !== void 0 && imageUrl && image instanceof File) {
5687
5688
  URL.revokeObjectURL(imageUrl);
5688
5689
  }
5689
5690
  };
5690
- }, [imageUrl]);
5691
+ }, [imageUrl, image]);
5692
+ const finalImageUrl = imageLink || imageUrl || defaultImage || void 0;
5691
5693
  return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("section", { className: "flex flex-col gap-4", children: /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "bg-background-50 px-5 py-6 flex flex-col items-center gap-4 rounded-xl", children: [
5692
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("img", { src: imageUrl || notification_default, alt: title || "Imagem do alerta" }),
5694
+ finalImageUrl && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("img", { src: finalImageUrl, alt: title || "Imagem do alerta" }),
5693
5695
  /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "flex flex-col items-center text-center gap-3", children: [
5694
5696
  /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(Text_default, { size: "lg", weight: "semibold", children: title || "Nenhum T\xEDtulo de Alerta" }),
5695
5697
  /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(Text_default, { size: "sm", weight: "normal", className: "text-text-500", children: message || "Aqui aparecer\xE1 a mensagem do alerta definido pelo usu\xE1rio" })
@@ -5783,7 +5785,9 @@ var StepWrapper = ({ children }) => /* @__PURE__ */ (0, import_jsx_runtime28.jsx
5783
5785
  var AlertsManager = ({
5784
5786
  config,
5785
5787
  isOpen = false,
5786
- onClose
5788
+ onClose,
5789
+ imageLink,
5790
+ defaultImage
5787
5791
  }) => {
5788
5792
  const [isModalOpen, setIsModalOpen] = (0, import_react19.useState)(isOpen);
5789
5793
  const [currentStep, setCurrentStep] = (0, import_react19.useState)(0);
@@ -5942,7 +5946,7 @@ var AlertsManager = ({
5942
5946
  }
5943
5947
  ) });
5944
5948
  case 3:
5945
- return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(StepWrapper, { children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(PreviewStep, {}) });
5949
+ return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(StepWrapper, { children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(PreviewStep, { imageLink, defaultImage }) });
5946
5950
  default:
5947
5951
  return null;
5948
5952
  }
@@ -5953,7 +5957,9 @@ var AlertsManager = ({
5953
5957
  labels,
5954
5958
  behavior,
5955
5959
  handleNext2,
5956
- handlePrevious
5960
+ handlePrevious,
5961
+ imageLink,
5962
+ defaultImage
5957
5963
  ]);
5958
5964
  const isFirstStep = currentStep === 0;
5959
5965
  const isLastStep = currentStep === steps.length - 1;