analytica-frontend-lib 1.1.84 → 1.1.86

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.
@@ -5559,80 +5559,83 @@ var Quiz = forwardRef11(({ children, className, variant = "default", ...props },
5559
5559
  }, [variant, setVariant]);
5560
5560
  return /* @__PURE__ */ jsx21("div", { ref, className: cn("flex flex-col", className), ...props, children });
5561
5561
  });
5562
- var QuizTitle = forwardRef11(
5563
- ({ className, ...props }, ref) => {
5564
- const {
5565
- quiz,
5566
- currentQuestionIndex,
5567
- getTotalQuestions,
5568
- getQuizTitle,
5569
- timeElapsed,
5570
- formatTime,
5571
- isStarted
5572
- } = useQuizStore();
5573
- const [showExitConfirmation, setShowExitConfirmation] = useState8(false);
5574
- const totalQuestions = getTotalQuestions();
5575
- const quizTitle = getQuizTitle();
5576
- const handleBackClick = () => {
5577
- if (isStarted) {
5578
- setShowExitConfirmation(true);
5579
- } else {
5580
- window.history.back();
5581
- }
5582
- };
5583
- const handleConfirmExit = () => {
5584
- setShowExitConfirmation(false);
5562
+ var QuizTitle = forwardRef11(({ className, onBack, ...props }, ref) => {
5563
+ const {
5564
+ quiz,
5565
+ currentQuestionIndex,
5566
+ getTotalQuestions,
5567
+ getQuizTitle,
5568
+ timeElapsed,
5569
+ formatTime,
5570
+ isStarted
5571
+ } = useQuizStore();
5572
+ const [showExitConfirmation, setShowExitConfirmation] = useState8(false);
5573
+ const totalQuestions = getTotalQuestions();
5574
+ const quizTitle = getQuizTitle();
5575
+ const handleBackClick = () => {
5576
+ if (isStarted) {
5577
+ setShowExitConfirmation(true);
5578
+ } else {
5579
+ actionOnBack();
5580
+ }
5581
+ };
5582
+ const handleConfirmExit = () => {
5583
+ setShowExitConfirmation(false);
5584
+ actionOnBack();
5585
+ };
5586
+ const actionOnBack = () => {
5587
+ if (onBack) {
5588
+ onBack();
5589
+ } else {
5585
5590
  window.history.back();
5586
- };
5587
- const handleCancelExit = () => {
5588
- setShowExitConfirmation(false);
5589
- };
5590
- return /* @__PURE__ */ jsxs17(Fragment7, { children: [
5591
- /* @__PURE__ */ jsxs17(
5592
- "div",
5593
- {
5594
- ref,
5595
- className: cn(
5596
- "flex flex-row justify-between items-center relative p-2",
5597
- className
5598
- ),
5599
- ...props,
5600
- children: [
5601
- /* @__PURE__ */ jsx21(
5602
- IconButton_default,
5603
- {
5604
- icon: /* @__PURE__ */ jsx21(CaretLeft, { size: 24 }),
5605
- size: "md",
5606
- "aria-label": "Voltar",
5607
- onClick: handleBackClick
5608
- }
5609
- ),
5610
- /* @__PURE__ */ jsxs17("span", { className: "flex flex-col gap-2 text-center", children: [
5611
- /* @__PURE__ */ jsx21("p", { className: "text-text-950 font-bold text-md", children: quizTitle }),
5612
- /* @__PURE__ */ jsx21("p", { className: "text-text-600 text-xs", children: totalQuestions > 0 ? `${currentQuestionIndex + 1} de ${totalQuestions}` : "0 de 0" })
5613
- ] }),
5614
- /* @__PURE__ */ jsx21("span", { className: "flex flex-row items-center justify-center", children: /* @__PURE__ */ jsx21(Badge_default, { variant: "outlined", action: "info", iconLeft: /* @__PURE__ */ jsx21(Clock2, {}), children: isStarted ? formatTime(timeElapsed) : "00:00" }) })
5615
- ]
5616
- }
5617
- ),
5618
- /* @__PURE__ */ jsx21(
5619
- AlertDialog,
5620
- {
5621
- isOpen: showExitConfirmation,
5622
- onChangeOpen: setShowExitConfirmation,
5623
- title: "Deseja sair?",
5624
- description: getExitConfirmationText(
5625
- quiz?.type || "SIMULADO" /* SIMULADO */
5591
+ }
5592
+ };
5593
+ const handleCancelExit = () => {
5594
+ setShowExitConfirmation(false);
5595
+ };
5596
+ return /* @__PURE__ */ jsxs17(Fragment7, { children: [
5597
+ /* @__PURE__ */ jsxs17(
5598
+ "div",
5599
+ {
5600
+ ref,
5601
+ className: cn(
5602
+ "flex flex-row justify-between items-center relative p-2",
5603
+ className
5604
+ ),
5605
+ ...props,
5606
+ children: [
5607
+ /* @__PURE__ */ jsx21(
5608
+ IconButton_default,
5609
+ {
5610
+ icon: /* @__PURE__ */ jsx21(CaretLeft, { size: 24 }),
5611
+ size: "md",
5612
+ "aria-label": "Voltar",
5613
+ onClick: handleBackClick
5614
+ }
5626
5615
  ),
5627
- cancelButtonLabel: "Voltar e revisar",
5628
- submitButtonLabel: "Sair Mesmo Assim",
5629
- onSubmit: handleConfirmExit,
5630
- onCancel: handleCancelExit
5631
- }
5632
- )
5633
- ] });
5634
- }
5635
- );
5616
+ /* @__PURE__ */ jsxs17("span", { className: "flex flex-col gap-2 text-center", children: [
5617
+ /* @__PURE__ */ jsx21("p", { className: "text-text-950 font-bold text-md", children: quizTitle }),
5618
+ /* @__PURE__ */ jsx21("p", { className: "text-text-600 text-xs", children: totalQuestions > 0 ? `${currentQuestionIndex + 1} de ${totalQuestions}` : "0 de 0" })
5619
+ ] }),
5620
+ /* @__PURE__ */ jsx21("span", { className: "flex flex-row items-center justify-center", children: /* @__PURE__ */ jsx21(Badge_default, { variant: "outlined", action: "info", iconLeft: /* @__PURE__ */ jsx21(Clock2, {}), children: isStarted ? formatTime(timeElapsed) : "00:00" }) })
5621
+ ]
5622
+ }
5623
+ ),
5624
+ /* @__PURE__ */ jsx21(
5625
+ AlertDialog,
5626
+ {
5627
+ isOpen: showExitConfirmation,
5628
+ onChangeOpen: setShowExitConfirmation,
5629
+ title: "Deseja sair?",
5630
+ description: getExitConfirmationText(quiz?.type || "SIMULADO" /* SIMULADO */),
5631
+ cancelButtonLabel: "Voltar e revisar",
5632
+ submitButtonLabel: "Sair Mesmo Assim",
5633
+ onSubmit: handleConfirmExit,
5634
+ onCancel: handleCancelExit
5635
+ }
5636
+ )
5637
+ ] });
5638
+ });
5636
5639
  var QuizHeader = () => {
5637
5640
  const { getCurrentQuestion, currentQuestionIndex } = useQuizStore();
5638
5641
  const currentQuestion = getCurrentQuestion();