analytica-frontend-lib 1.1.33 → 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.
@@ -69,6 +69,6 @@ declare const CheckBox: react.ForwardRefExoticComponent<{
69
69
  className?: string;
70
70
  /** Label CSS classes */
71
71
  labelClassName?: string;
72
- } & Omit<InputHTMLAttributes<HTMLInputElement>, "type" | "size"> & react.RefAttributes<HTMLInputElement>>;
72
+ } & Omit<InputHTMLAttributes<HTMLInputElement>, "size" | "type"> & react.RefAttributes<HTMLInputElement>>;
73
73
 
74
74
  export { type CheckBoxProps, CheckBox as default };
@@ -69,6 +69,6 @@ declare const CheckBox: react.ForwardRefExoticComponent<{
69
69
  className?: string;
70
70
  /** Label CSS classes */
71
71
  labelClassName?: string;
72
- } & Omit<InputHTMLAttributes<HTMLInputElement>, "type" | "size"> & react.RefAttributes<HTMLInputElement>>;
72
+ } & Omit<InputHTMLAttributes<HTMLInputElement>, "size" | "type"> & react.RefAttributes<HTMLInputElement>>;
73
73
 
74
74
  export { type CheckBoxProps, CheckBox as default };
@@ -4858,26 +4858,65 @@ var QuizTitle = (0, import_react12.forwardRef)(
4858
4858
  formatTime,
4859
4859
  isStarted
4860
4860
  } = useQuizStore();
4861
+ const [showExitConfirmation, setShowExitConfirmation] = (0, import_react12.useState)(false);
4861
4862
  const totalQuestions = getTotalQuestions();
4862
4863
  const quizTitle = getQuizTitle();
4863
- return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
4864
- "div",
4865
- {
4866
- ref,
4867
- className: cn(
4868
- "flex flex-row justify-center items-center relative p-2",
4869
- className
4870
- ),
4871
- ...props,
4872
- children: [
4873
- /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("span", { className: "flex flex-col gap-2 text-center", children: [
4874
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("p", { className: "text-text-950 font-bold text-md", children: quizTitle }),
4875
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("p", { className: "text-text-600 text-xs", children: totalQuestions > 0 ? `${currentQuestionIndex + 1} de ${totalQuestions}` : "0 de 0" })
4876
- ] }),
4877
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "absolute right-2", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Badge_default, { variant: "outlined", action: "info", iconLeft: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_phosphor_react9.Clock, {}), children: isStarted ? formatTime(timeElapsed) : "00:00" }) })
4878
- ]
4864
+ const handleBackClick = () => {
4865
+ if (isStarted) {
4866
+ setShowExitConfirmation(true);
4867
+ } else {
4868
+ window.history.back();
4879
4869
  }
4880
- );
4870
+ };
4871
+ const handleConfirmExit = () => {
4872
+ setShowExitConfirmation(false);
4873
+ window.history.back();
4874
+ };
4875
+ const handleCancelExit = () => {
4876
+ setShowExitConfirmation(false);
4877
+ };
4878
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_jsx_runtime18.Fragment, { children: [
4879
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
4880
+ "div",
4881
+ {
4882
+ ref,
4883
+ className: cn(
4884
+ "flex flex-row justify-between items-center relative p-2",
4885
+ className
4886
+ ),
4887
+ ...props,
4888
+ children: [
4889
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
4890
+ IconButton_default,
4891
+ {
4892
+ icon: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_phosphor_react9.CaretLeft, { size: 24 }),
4893
+ size: "md",
4894
+ "aria-label": "Voltar",
4895
+ onClick: handleBackClick
4896
+ }
4897
+ ),
4898
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("span", { className: "flex flex-col gap-2 text-center", children: [
4899
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("p", { className: "text-text-950 font-bold text-md", children: quizTitle }),
4900
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("p", { className: "text-text-600 text-xs", children: totalQuestions > 0 ? `${currentQuestionIndex + 1} de ${totalQuestions}` : "0 de 0" })
4901
+ ] }),
4902
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "flex flex-row items-center justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Badge_default, { variant: "outlined", action: "info", iconLeft: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_phosphor_react9.Clock, {}), children: isStarted ? formatTime(timeElapsed) : "00:00" }) })
4903
+ ]
4904
+ }
4905
+ ),
4906
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
4907
+ AlertDialog,
4908
+ {
4909
+ isOpen: showExitConfirmation,
4910
+ onChangeOpen: setShowExitConfirmation,
4911
+ title: "Deseja sair?",
4912
+ description: "Se voc\xEA sair do simulado agora, todas as respostas ser\xE3o perdidas.",
4913
+ cancelButtonLabel: "Voltar e revisar",
4914
+ submitButtonLabel: "Sair Mesmo Assim",
4915
+ onSubmit: handleConfirmExit,
4916
+ onCancel: handleCancelExit
4917
+ }
4918
+ )
4919
+ ] });
4881
4920
  }
4882
4921
  );
4883
4922
  var QuizSubTitle = (0, import_react12.forwardRef)(
@@ -5961,17 +6000,21 @@ var QuizFooter = (0, import_react12.forwardRef)(
5961
6000
  ] });
5962
6001
  }
5963
6002
  );
5964
- var QuizBadge = ({ subtype }) => {
6003
+ var QuizBadge = ({
6004
+ subtype
6005
+ }) => {
5965
6006
  switch (subtype) {
5966
- case "PROVA":
5967
- return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Badge_default, { variant: "solid", action: "info", "data-testid": "quiz-badge", children: "Prova" });
5968
- case "ENEM":
5969
- return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Badge_default, { variant: "solid", action: "info", "data-testid": "quiz-badge", children: "Enem" });
5970
- case "VESTIBULAR":
5971
- return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Badge_default, { variant: "solid", action: "info", "data-testid": "quiz-badge", children: "Vestibular" });
5972
- case "SIMULADO":
5973
- case null:
5974
- return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Badge_default, { variant: "solid", action: "info", "data-testid": "quiz-badge", children: "Simulado" });
6007
+ case "PROVA" /* PROVA */:
6008
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Badge_default, { variant: "examsOutlined", action: "exam2", "data-testid": "quiz-badge", children: "Prova" });
6009
+ case "ENEM_PROVA_1" /* ENEM_PROVA_1 */:
6010
+ case "ENEM_PROVA_2" /* ENEM_PROVA_2 */:
6011
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Badge_default, { variant: "examsOutlined", action: "exam1", "data-testid": "quiz-badge", children: "Enem" });
6012
+ case "VESTIBULAR" /* VESTIBULAR */:
6013
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Badge_default, { variant: "examsOutlined", action: "exam4", "data-testid": "quiz-badge", children: "Vestibular" });
6014
+ case "SIMULADO" /* SIMULADO */:
6015
+ case "SIMULADAO" /* SIMULADAO */:
6016
+ case void 0:
6017
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Badge_default, { variant: "examsOutlined", action: "exam3", "data-testid": "quiz-badge", children: "Simulad\xE3o" });
5975
6018
  default:
5976
6019
  return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Badge_default, { variant: "solid", action: "info", "data-testid": "quiz-badge", children: subtype });
5977
6020
  }
@@ -5987,7 +6030,7 @@ var QuizResultHeaderTitle = (0, import_react12.forwardRef)(({ className, ...prop
5987
6030
  ...props,
5988
6031
  children: [
5989
6032
  /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("p", { className: "text-text-950 font-bold text-2xl", children: "Resultado" }),
5990
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(QuizBadge, { subtype: activeQuiz?.quiz.subtype || null })
6033
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(QuizBadge, { subtype: activeQuiz?.quiz.subtype || void 0 })
5991
6034
  ]
5992
6035
  }
5993
6036
  );