analytica-frontend-lib 1.1.83 → 1.1.85

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.js CHANGED
@@ -11535,80 +11535,83 @@ var Quiz = (0, import_react36.forwardRef)(({ children, className, variant = "def
11535
11535
  }, [variant, setVariant]);
11536
11536
  return /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("div", { ref, className: cn("flex flex-col", className), ...props, children });
11537
11537
  });
11538
- var QuizTitle = (0, import_react36.forwardRef)(
11539
- ({ className, ...props }, ref) => {
11540
- const {
11541
- quiz,
11542
- currentQuestionIndex,
11543
- getTotalQuestions,
11544
- getQuizTitle,
11545
- timeElapsed,
11546
- formatTime: formatTime2,
11547
- isStarted
11548
- } = useQuizStore();
11549
- const [showExitConfirmation, setShowExitConfirmation] = (0, import_react36.useState)(false);
11550
- const totalQuestions = getTotalQuestions();
11551
- const quizTitle = getQuizTitle();
11552
- const handleBackClick = () => {
11553
- if (isStarted) {
11554
- setShowExitConfirmation(true);
11555
- } else {
11556
- window.history.back();
11557
- }
11558
- };
11559
- const handleConfirmExit = () => {
11560
- setShowExitConfirmation(false);
11538
+ var QuizTitle = (0, import_react36.forwardRef)(({ className, onBack, ...props }, ref) => {
11539
+ const {
11540
+ quiz,
11541
+ currentQuestionIndex,
11542
+ getTotalQuestions,
11543
+ getQuizTitle,
11544
+ timeElapsed,
11545
+ formatTime: formatTime2,
11546
+ isStarted
11547
+ } = useQuizStore();
11548
+ const [showExitConfirmation, setShowExitConfirmation] = (0, import_react36.useState)(false);
11549
+ const totalQuestions = getTotalQuestions();
11550
+ const quizTitle = getQuizTitle();
11551
+ const handleBackClick = () => {
11552
+ if (isStarted) {
11553
+ setShowExitConfirmation(true);
11554
+ } else {
11555
+ actionOnBack();
11556
+ }
11557
+ };
11558
+ const handleConfirmExit = () => {
11559
+ setShowExitConfirmation(false);
11560
+ actionOnBack();
11561
+ };
11562
+ const actionOnBack = () => {
11563
+ if (onBack) {
11564
+ onBack();
11565
+ } else {
11561
11566
  window.history.back();
11562
- };
11563
- const handleCancelExit = () => {
11564
- setShowExitConfirmation(false);
11565
- };
11566
- return /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)(import_jsx_runtime51.Fragment, { children: [
11567
- /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)(
11568
- "div",
11569
- {
11570
- ref,
11571
- className: cn(
11572
- "flex flex-row justify-between items-center relative p-2",
11573
- className
11574
- ),
11575
- ...props,
11576
- children: [
11577
- /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
11578
- IconButton_default,
11579
- {
11580
- icon: /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(import_phosphor_react25.CaretLeft, { size: 24 }),
11581
- size: "md",
11582
- "aria-label": "Voltar",
11583
- onClick: handleBackClick
11584
- }
11585
- ),
11586
- /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)("span", { className: "flex flex-col gap-2 text-center", children: [
11587
- /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("p", { className: "text-text-950 font-bold text-md", children: quizTitle }),
11588
- /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("p", { className: "text-text-600 text-xs", children: totalQuestions > 0 ? `${currentQuestionIndex + 1} de ${totalQuestions}` : "0 de 0" })
11589
- ] }),
11590
- /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("span", { className: "flex flex-row items-center justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(Badge_default, { variant: "outlined", action: "info", iconLeft: /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(import_phosphor_react25.Clock, {}), children: isStarted ? formatTime2(timeElapsed) : "00:00" }) })
11591
- ]
11592
- }
11593
- ),
11594
- /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
11595
- AlertDialog,
11596
- {
11597
- isOpen: showExitConfirmation,
11598
- onChangeOpen: setShowExitConfirmation,
11599
- title: "Deseja sair?",
11600
- description: getExitConfirmationText(
11601
- quiz?.type || "SIMULADO" /* SIMULADO */
11567
+ }
11568
+ };
11569
+ const handleCancelExit = () => {
11570
+ setShowExitConfirmation(false);
11571
+ };
11572
+ return /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)(import_jsx_runtime51.Fragment, { children: [
11573
+ /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)(
11574
+ "div",
11575
+ {
11576
+ ref,
11577
+ className: cn(
11578
+ "flex flex-row justify-between items-center relative p-2",
11579
+ className
11580
+ ),
11581
+ ...props,
11582
+ children: [
11583
+ /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
11584
+ IconButton_default,
11585
+ {
11586
+ icon: /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(import_phosphor_react25.CaretLeft, { size: 24 }),
11587
+ size: "md",
11588
+ "aria-label": "Voltar",
11589
+ onClick: handleBackClick
11590
+ }
11602
11591
  ),
11603
- cancelButtonLabel: "Voltar e revisar",
11604
- submitButtonLabel: "Sair Mesmo Assim",
11605
- onSubmit: handleConfirmExit,
11606
- onCancel: handleCancelExit
11607
- }
11608
- )
11609
- ] });
11610
- }
11611
- );
11592
+ /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)("span", { className: "flex flex-col gap-2 text-center", children: [
11593
+ /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("p", { className: "text-text-950 font-bold text-md", children: quizTitle }),
11594
+ /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("p", { className: "text-text-600 text-xs", children: totalQuestions > 0 ? `${currentQuestionIndex + 1} de ${totalQuestions}` : "0 de 0" })
11595
+ ] }),
11596
+ /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("span", { className: "flex flex-row items-center justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(Badge_default, { variant: "outlined", action: "info", iconLeft: /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(import_phosphor_react25.Clock, {}), children: isStarted ? formatTime2(timeElapsed) : "00:00" }) })
11597
+ ]
11598
+ }
11599
+ ),
11600
+ /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
11601
+ AlertDialog,
11602
+ {
11603
+ isOpen: showExitConfirmation,
11604
+ onChangeOpen: setShowExitConfirmation,
11605
+ title: "Deseja sair?",
11606
+ description: getExitConfirmationText(quiz?.type || "SIMULADO" /* SIMULADO */),
11607
+ cancelButtonLabel: "Voltar e revisar",
11608
+ submitButtonLabel: "Sair Mesmo Assim",
11609
+ onSubmit: handleConfirmExit,
11610
+ onCancel: handleCancelExit
11611
+ }
11612
+ )
11613
+ ] });
11614
+ });
11612
11615
  var QuizHeader = () => {
11613
11616
  const { getCurrentQuestion, currentQuestionIndex } = useQuizStore();
11614
11617
  const currentQuestion = getCurrentQuestion();
@@ -11879,16 +11882,34 @@ var QuizFooter = (0, import_react36.forwardRef)(
11879
11882
  children: "Avan\xE7ar"
11880
11883
  }
11881
11884
  )
11882
- ] }) : /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("div", { className: "flex flex-row items-center justify-end w-full", children: /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
11883
- Button_default,
11884
- {
11885
- variant: "solid",
11886
- action: "primary",
11887
- size: "medium",
11888
- onClick: () => openModal("modalResolution"),
11889
- children: "Ver Resolu\xE7\xE3o"
11890
- }
11891
- ) })
11885
+ ] }) : /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)("div", { className: "flex flex-row items-center justify-between w-full", children: [
11886
+ /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("span", { children: quiz?.canRetry && /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
11887
+ Button_default,
11888
+ {
11889
+ variant: "link",
11890
+ action: "primary",
11891
+ size: "medium",
11892
+ onClick: () => openModal("modalResolution"),
11893
+ children: "Ver Resolu\xE7\xE3o"
11894
+ }
11895
+ ) }),
11896
+ /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
11897
+ Button_default,
11898
+ {
11899
+ variant: "solid",
11900
+ action: "primary",
11901
+ size: "medium",
11902
+ onClick: () => {
11903
+ if (quiz?.canRetry) {
11904
+ onRepeat?.();
11905
+ } else {
11906
+ openModal("modalResolution");
11907
+ }
11908
+ },
11909
+ children: quiz?.canRetry ? `Repetir ${getTypeLabel(quiz.type)}` : "Ver Resolu\xE7\xE3o"
11910
+ }
11911
+ )
11912
+ ] })
11892
11913
  }
11893
11914
  ),
11894
11915
  /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(