analytica-frontend-lib 1.1.34 → 1.1.35

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
@@ -8060,6 +8060,15 @@ var ANSWER_STATUS = /* @__PURE__ */ ((ANSWER_STATUS2) => {
8060
8060
  ANSWER_STATUS2["NAO_RESPONDIDO"] = "NAO_RESPONDIDO";
8061
8061
  return ANSWER_STATUS2;
8062
8062
  })(ANSWER_STATUS || {});
8063
+ var SUBTYPE_ENUM = /* @__PURE__ */ ((SUBTYPE_ENUM2) => {
8064
+ SUBTYPE_ENUM2["PROVA"] = "PROVA";
8065
+ SUBTYPE_ENUM2["ENEM_PROVA_1"] = "ENEM_PROVA_1";
8066
+ SUBTYPE_ENUM2["ENEM_PROVA_2"] = "ENEM_PROVA_2";
8067
+ SUBTYPE_ENUM2["VESTIBULAR"] = "VESTIBULAR";
8068
+ SUBTYPE_ENUM2["SIMULADO"] = "SIMULADO";
8069
+ SUBTYPE_ENUM2["SIMULADAO"] = "SIMULADAO";
8070
+ return SUBTYPE_ENUM2;
8071
+ })(SUBTYPE_ENUM || {});
8063
8072
  var MINUTE_INTERVAL_MS = 6e4;
8064
8073
  var useQuizStore = create7()(
8065
8074
  devtools(
@@ -8745,26 +8754,65 @@ var QuizTitle = forwardRef19(
8745
8754
  formatTime: formatTime2,
8746
8755
  isStarted
8747
8756
  } = useQuizStore();
8757
+ const [showExitConfirmation, setShowExitConfirmation] = useState17(false);
8748
8758
  const totalQuestions = getTotalQuestions();
8749
8759
  const quizTitle = getQuizTitle();
8750
- return /* @__PURE__ */ jsxs32(
8751
- "div",
8752
- {
8753
- ref,
8754
- className: cn(
8755
- "flex flex-row justify-center items-center relative p-2",
8756
- className
8757
- ),
8758
- ...props,
8759
- children: [
8760
- /* @__PURE__ */ jsxs32("span", { className: "flex flex-col gap-2 text-center", children: [
8761
- /* @__PURE__ */ jsx39("p", { className: "text-text-950 font-bold text-md", children: quizTitle }),
8762
- /* @__PURE__ */ jsx39("p", { className: "text-text-600 text-xs", children: totalQuestions > 0 ? `${currentQuestionIndex + 1} de ${totalQuestions}` : "0 de 0" })
8763
- ] }),
8764
- /* @__PURE__ */ jsx39("span", { className: "absolute right-2", children: /* @__PURE__ */ jsx39(Badge_default, { variant: "outlined", action: "info", iconLeft: /* @__PURE__ */ jsx39(Clock2, {}), children: isStarted ? formatTime2(timeElapsed) : "00:00" }) })
8765
- ]
8760
+ const handleBackClick = () => {
8761
+ if (isStarted) {
8762
+ setShowExitConfirmation(true);
8763
+ } else {
8764
+ window.history.back();
8766
8765
  }
8767
- );
8766
+ };
8767
+ const handleConfirmExit = () => {
8768
+ setShowExitConfirmation(false);
8769
+ window.history.back();
8770
+ };
8771
+ const handleCancelExit = () => {
8772
+ setShowExitConfirmation(false);
8773
+ };
8774
+ return /* @__PURE__ */ jsxs32(Fragment9, { children: [
8775
+ /* @__PURE__ */ jsxs32(
8776
+ "div",
8777
+ {
8778
+ ref,
8779
+ className: cn(
8780
+ "flex flex-row justify-between items-center relative p-2",
8781
+ className
8782
+ ),
8783
+ ...props,
8784
+ children: [
8785
+ /* @__PURE__ */ jsx39(
8786
+ IconButton_default,
8787
+ {
8788
+ icon: /* @__PURE__ */ jsx39(CaretLeft3, { size: 24 }),
8789
+ size: "md",
8790
+ "aria-label": "Voltar",
8791
+ onClick: handleBackClick
8792
+ }
8793
+ ),
8794
+ /* @__PURE__ */ jsxs32("span", { className: "flex flex-col gap-2 text-center", children: [
8795
+ /* @__PURE__ */ jsx39("p", { className: "text-text-950 font-bold text-md", children: quizTitle }),
8796
+ /* @__PURE__ */ jsx39("p", { className: "text-text-600 text-xs", children: totalQuestions > 0 ? `${currentQuestionIndex + 1} de ${totalQuestions}` : "0 de 0" })
8797
+ ] }),
8798
+ /* @__PURE__ */ jsx39("span", { className: "flex flex-row items-center justify-center", children: /* @__PURE__ */ jsx39(Badge_default, { variant: "outlined", action: "info", iconLeft: /* @__PURE__ */ jsx39(Clock2, {}), children: isStarted ? formatTime2(timeElapsed) : "00:00" }) })
8799
+ ]
8800
+ }
8801
+ ),
8802
+ /* @__PURE__ */ jsx39(
8803
+ AlertDialog,
8804
+ {
8805
+ isOpen: showExitConfirmation,
8806
+ onChangeOpen: setShowExitConfirmation,
8807
+ title: "Deseja sair?",
8808
+ description: "Se voc\xEA sair do simulado agora, todas as respostas ser\xE3o perdidas.",
8809
+ cancelButtonLabel: "Voltar e revisar",
8810
+ submitButtonLabel: "Sair Mesmo Assim",
8811
+ onSubmit: handleConfirmExit,
8812
+ onCancel: handleCancelExit
8813
+ }
8814
+ )
8815
+ ] });
8768
8816
  }
8769
8817
  );
8770
8818
  var QuizSubTitle = forwardRef19(
@@ -9848,17 +9896,21 @@ var QuizFooter = forwardRef19(
9848
9896
  ] });
9849
9897
  }
9850
9898
  );
9851
- var QuizBadge = ({ subtype }) => {
9899
+ var QuizBadge = ({
9900
+ subtype
9901
+ }) => {
9852
9902
  switch (subtype) {
9853
- case "PROVA":
9854
- return /* @__PURE__ */ jsx39(Badge_default, { variant: "solid", action: "info", "data-testid": "quiz-badge", children: "Prova" });
9855
- case "ENEM":
9856
- return /* @__PURE__ */ jsx39(Badge_default, { variant: "solid", action: "info", "data-testid": "quiz-badge", children: "Enem" });
9857
- case "VESTIBULAR":
9858
- return /* @__PURE__ */ jsx39(Badge_default, { variant: "solid", action: "info", "data-testid": "quiz-badge", children: "Vestibular" });
9859
- case "SIMULADO":
9860
- case null:
9861
- return /* @__PURE__ */ jsx39(Badge_default, { variant: "solid", action: "info", "data-testid": "quiz-badge", children: "Simulado" });
9903
+ case "PROVA" /* PROVA */:
9904
+ return /* @__PURE__ */ jsx39(Badge_default, { variant: "examsOutlined", action: "exam2", "data-testid": "quiz-badge", children: "Prova" });
9905
+ case "ENEM_PROVA_1" /* ENEM_PROVA_1 */:
9906
+ case "ENEM_PROVA_2" /* ENEM_PROVA_2 */:
9907
+ return /* @__PURE__ */ jsx39(Badge_default, { variant: "examsOutlined", action: "exam1", "data-testid": "quiz-badge", children: "Enem" });
9908
+ case "VESTIBULAR" /* VESTIBULAR */:
9909
+ return /* @__PURE__ */ jsx39(Badge_default, { variant: "examsOutlined", action: "exam4", "data-testid": "quiz-badge", children: "Vestibular" });
9910
+ case "SIMULADO" /* SIMULADO */:
9911
+ case "SIMULADAO" /* SIMULADAO */:
9912
+ case void 0:
9913
+ return /* @__PURE__ */ jsx39(Badge_default, { variant: "examsOutlined", action: "exam3", "data-testid": "quiz-badge", children: "Simulad\xE3o" });
9862
9914
  default:
9863
9915
  return /* @__PURE__ */ jsx39(Badge_default, { variant: "solid", action: "info", "data-testid": "quiz-badge", children: subtype });
9864
9916
  }
@@ -9874,7 +9926,7 @@ var QuizResultHeaderTitle = forwardRef19(({ className, ...props }, ref) => {
9874
9926
  ...props,
9875
9927
  children: [
9876
9928
  /* @__PURE__ */ jsx39("p", { className: "text-text-950 font-bold text-2xl", children: "Resultado" }),
9877
- /* @__PURE__ */ jsx39(QuizBadge, { subtype: activeQuiz?.quiz.subtype || null })
9929
+ /* @__PURE__ */ jsx39(QuizBadge, { subtype: activeQuiz?.quiz.subtype || void 0 })
9878
9930
  ]
9879
9931
  }
9880
9932
  );
@@ -10404,6 +10456,7 @@ export {
10404
10456
  Radio_default as Radio,
10405
10457
  RadioGroup,
10406
10458
  RadioGroupItem,
10459
+ SUBTYPE_ENUM,
10407
10460
  Search_default as Search,
10408
10461
  Select_default as Select,
10409
10462
  SelectContent,