analytica-frontend-lib 1.1.84 → 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.mjs CHANGED
@@ -11506,80 +11506,83 @@ var Quiz = forwardRef21(({ children, className, variant = "default", ...props },
11506
11506
  }, [variant, setVariant]);
11507
11507
  return /* @__PURE__ */ jsx51("div", { ref, className: cn("flex flex-col", className), ...props, children });
11508
11508
  });
11509
- var QuizTitle = forwardRef21(
11510
- ({ className, ...props }, ref) => {
11511
- const {
11512
- quiz,
11513
- currentQuestionIndex,
11514
- getTotalQuestions,
11515
- getQuizTitle,
11516
- timeElapsed,
11517
- formatTime: formatTime2,
11518
- isStarted
11519
- } = useQuizStore();
11520
- const [showExitConfirmation, setShowExitConfirmation] = useState21(false);
11521
- const totalQuestions = getTotalQuestions();
11522
- const quizTitle = getQuizTitle();
11523
- const handleBackClick = () => {
11524
- if (isStarted) {
11525
- setShowExitConfirmation(true);
11526
- } else {
11527
- window.history.back();
11528
- }
11529
- };
11530
- const handleConfirmExit = () => {
11531
- setShowExitConfirmation(false);
11509
+ var QuizTitle = forwardRef21(({ className, onBack, ...props }, ref) => {
11510
+ const {
11511
+ quiz,
11512
+ currentQuestionIndex,
11513
+ getTotalQuestions,
11514
+ getQuizTitle,
11515
+ timeElapsed,
11516
+ formatTime: formatTime2,
11517
+ isStarted
11518
+ } = useQuizStore();
11519
+ const [showExitConfirmation, setShowExitConfirmation] = useState21(false);
11520
+ const totalQuestions = getTotalQuestions();
11521
+ const quizTitle = getQuizTitle();
11522
+ const handleBackClick = () => {
11523
+ if (isStarted) {
11524
+ setShowExitConfirmation(true);
11525
+ } else {
11526
+ actionOnBack();
11527
+ }
11528
+ };
11529
+ const handleConfirmExit = () => {
11530
+ setShowExitConfirmation(false);
11531
+ actionOnBack();
11532
+ };
11533
+ const actionOnBack = () => {
11534
+ if (onBack) {
11535
+ onBack();
11536
+ } else {
11532
11537
  window.history.back();
11533
- };
11534
- const handleCancelExit = () => {
11535
- setShowExitConfirmation(false);
11536
- };
11537
- return /* @__PURE__ */ jsxs37(Fragment12, { children: [
11538
- /* @__PURE__ */ jsxs37(
11539
- "div",
11540
- {
11541
- ref,
11542
- className: cn(
11543
- "flex flex-row justify-between items-center relative p-2",
11544
- className
11545
- ),
11546
- ...props,
11547
- children: [
11548
- /* @__PURE__ */ jsx51(
11549
- IconButton_default,
11550
- {
11551
- icon: /* @__PURE__ */ jsx51(CaretLeft2, { size: 24 }),
11552
- size: "md",
11553
- "aria-label": "Voltar",
11554
- onClick: handleBackClick
11555
- }
11556
- ),
11557
- /* @__PURE__ */ jsxs37("span", { className: "flex flex-col gap-2 text-center", children: [
11558
- /* @__PURE__ */ jsx51("p", { className: "text-text-950 font-bold text-md", children: quizTitle }),
11559
- /* @__PURE__ */ jsx51("p", { className: "text-text-600 text-xs", children: totalQuestions > 0 ? `${currentQuestionIndex + 1} de ${totalQuestions}` : "0 de 0" })
11560
- ] }),
11561
- /* @__PURE__ */ jsx51("span", { className: "flex flex-row items-center justify-center", children: /* @__PURE__ */ jsx51(Badge_default, { variant: "outlined", action: "info", iconLeft: /* @__PURE__ */ jsx51(Clock2, {}), children: isStarted ? formatTime2(timeElapsed) : "00:00" }) })
11562
- ]
11563
- }
11564
- ),
11565
- /* @__PURE__ */ jsx51(
11566
- AlertDialog,
11567
- {
11568
- isOpen: showExitConfirmation,
11569
- onChangeOpen: setShowExitConfirmation,
11570
- title: "Deseja sair?",
11571
- description: getExitConfirmationText(
11572
- quiz?.type || "SIMULADO" /* SIMULADO */
11538
+ }
11539
+ };
11540
+ const handleCancelExit = () => {
11541
+ setShowExitConfirmation(false);
11542
+ };
11543
+ return /* @__PURE__ */ jsxs37(Fragment12, { children: [
11544
+ /* @__PURE__ */ jsxs37(
11545
+ "div",
11546
+ {
11547
+ ref,
11548
+ className: cn(
11549
+ "flex flex-row justify-between items-center relative p-2",
11550
+ className
11551
+ ),
11552
+ ...props,
11553
+ children: [
11554
+ /* @__PURE__ */ jsx51(
11555
+ IconButton_default,
11556
+ {
11557
+ icon: /* @__PURE__ */ jsx51(CaretLeft2, { size: 24 }),
11558
+ size: "md",
11559
+ "aria-label": "Voltar",
11560
+ onClick: handleBackClick
11561
+ }
11573
11562
  ),
11574
- cancelButtonLabel: "Voltar e revisar",
11575
- submitButtonLabel: "Sair Mesmo Assim",
11576
- onSubmit: handleConfirmExit,
11577
- onCancel: handleCancelExit
11578
- }
11579
- )
11580
- ] });
11581
- }
11582
- );
11563
+ /* @__PURE__ */ jsxs37("span", { className: "flex flex-col gap-2 text-center", children: [
11564
+ /* @__PURE__ */ jsx51("p", { className: "text-text-950 font-bold text-md", children: quizTitle }),
11565
+ /* @__PURE__ */ jsx51("p", { className: "text-text-600 text-xs", children: totalQuestions > 0 ? `${currentQuestionIndex + 1} de ${totalQuestions}` : "0 de 0" })
11566
+ ] }),
11567
+ /* @__PURE__ */ jsx51("span", { className: "flex flex-row items-center justify-center", children: /* @__PURE__ */ jsx51(Badge_default, { variant: "outlined", action: "info", iconLeft: /* @__PURE__ */ jsx51(Clock2, {}), children: isStarted ? formatTime2(timeElapsed) : "00:00" }) })
11568
+ ]
11569
+ }
11570
+ ),
11571
+ /* @__PURE__ */ jsx51(
11572
+ AlertDialog,
11573
+ {
11574
+ isOpen: showExitConfirmation,
11575
+ onChangeOpen: setShowExitConfirmation,
11576
+ title: "Deseja sair?",
11577
+ description: getExitConfirmationText(quiz?.type || "SIMULADO" /* SIMULADO */),
11578
+ cancelButtonLabel: "Voltar e revisar",
11579
+ submitButtonLabel: "Sair Mesmo Assim",
11580
+ onSubmit: handleConfirmExit,
11581
+ onCancel: handleCancelExit
11582
+ }
11583
+ )
11584
+ ] });
11585
+ });
11583
11586
  var QuizHeader = () => {
11584
11587
  const { getCurrentQuestion, currentQuestionIndex } = useQuizStore();
11585
11588
  const currentQuestion = getCurrentQuestion();