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.
@@ -30,6 +30,7 @@ declare const Quiz: react.ForwardRefExoticComponent<{
30
30
  } & react.RefAttributes<HTMLDivElement>>;
31
31
  declare const QuizTitle: react.ForwardRefExoticComponent<{
32
32
  className?: string;
33
+ onBack?: () => void;
33
34
  } & react.RefAttributes<HTMLDivElement>>;
34
35
  declare const QuizHeader: () => react_jsx_runtime.JSX.Element;
35
36
  declare const QuizContent: ({ paddingBottom }: {
@@ -30,6 +30,7 @@ declare const Quiz: react.ForwardRefExoticComponent<{
30
30
  } & react.RefAttributes<HTMLDivElement>>;
31
31
  declare const QuizTitle: react.ForwardRefExoticComponent<{
32
32
  className?: string;
33
+ onBack?: () => void;
33
34
  } & react.RefAttributes<HTMLDivElement>>;
34
35
  declare const QuizHeader: () => react_jsx_runtime.JSX.Element;
35
36
  declare const QuizContent: ({ paddingBottom }: {
@@ -5534,80 +5534,83 @@ var Quiz = (0, import_react14.forwardRef)(({ children, className, variant = "def
5534
5534
  }, [variant, setVariant]);
5535
5535
  return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { ref, className: cn("flex flex-col", className), ...props, children });
5536
5536
  });
5537
- var QuizTitle = (0, import_react14.forwardRef)(
5538
- ({ className, ...props }, ref) => {
5539
- const {
5540
- quiz,
5541
- currentQuestionIndex,
5542
- getTotalQuestions,
5543
- getQuizTitle,
5544
- timeElapsed,
5545
- formatTime,
5546
- isStarted
5547
- } = useQuizStore();
5548
- const [showExitConfirmation, setShowExitConfirmation] = (0, import_react14.useState)(false);
5549
- const totalQuestions = getTotalQuestions();
5550
- const quizTitle = getQuizTitle();
5551
- const handleBackClick = () => {
5552
- if (isStarted) {
5553
- setShowExitConfirmation(true);
5554
- } else {
5555
- window.history.back();
5556
- }
5557
- };
5558
- const handleConfirmExit = () => {
5559
- setShowExitConfirmation(false);
5537
+ var QuizTitle = (0, import_react14.forwardRef)(({ className, onBack, ...props }, ref) => {
5538
+ const {
5539
+ quiz,
5540
+ currentQuestionIndex,
5541
+ getTotalQuestions,
5542
+ getQuizTitle,
5543
+ timeElapsed,
5544
+ formatTime,
5545
+ isStarted
5546
+ } = useQuizStore();
5547
+ const [showExitConfirmation, setShowExitConfirmation] = (0, import_react14.useState)(false);
5548
+ const totalQuestions = getTotalQuestions();
5549
+ const quizTitle = getQuizTitle();
5550
+ const handleBackClick = () => {
5551
+ if (isStarted) {
5552
+ setShowExitConfirmation(true);
5553
+ } else {
5554
+ actionOnBack();
5555
+ }
5556
+ };
5557
+ const handleConfirmExit = () => {
5558
+ setShowExitConfirmation(false);
5559
+ actionOnBack();
5560
+ };
5561
+ const actionOnBack = () => {
5562
+ if (onBack) {
5563
+ onBack();
5564
+ } else {
5560
5565
  window.history.back();
5561
- };
5562
- const handleCancelExit = () => {
5563
- setShowExitConfirmation(false);
5564
- };
5565
- return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(import_jsx_runtime21.Fragment, { children: [
5566
- /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
5567
- "div",
5568
- {
5569
- ref,
5570
- className: cn(
5571
- "flex flex-row justify-between items-center relative p-2",
5572
- className
5573
- ),
5574
- ...props,
5575
- children: [
5576
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
5577
- IconButton_default,
5578
- {
5579
- icon: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_phosphor_react10.CaretLeft, { size: 24 }),
5580
- size: "md",
5581
- "aria-label": "Voltar",
5582
- onClick: handleBackClick
5583
- }
5584
- ),
5585
- /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("span", { className: "flex flex-col gap-2 text-center", children: [
5586
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("p", { className: "text-text-950 font-bold text-md", children: quizTitle }),
5587
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("p", { className: "text-text-600 text-xs", children: totalQuestions > 0 ? `${currentQuestionIndex + 1} de ${totalQuestions}` : "0 de 0" })
5588
- ] }),
5589
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "flex flex-row items-center justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Badge_default, { variant: "outlined", action: "info", iconLeft: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_phosphor_react10.Clock, {}), children: isStarted ? formatTime(timeElapsed) : "00:00" }) })
5590
- ]
5591
- }
5592
- ),
5593
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
5594
- AlertDialog,
5595
- {
5596
- isOpen: showExitConfirmation,
5597
- onChangeOpen: setShowExitConfirmation,
5598
- title: "Deseja sair?",
5599
- description: getExitConfirmationText(
5600
- quiz?.type || "SIMULADO" /* SIMULADO */
5566
+ }
5567
+ };
5568
+ const handleCancelExit = () => {
5569
+ setShowExitConfirmation(false);
5570
+ };
5571
+ return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(import_jsx_runtime21.Fragment, { children: [
5572
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
5573
+ "div",
5574
+ {
5575
+ ref,
5576
+ className: cn(
5577
+ "flex flex-row justify-between items-center relative p-2",
5578
+ className
5579
+ ),
5580
+ ...props,
5581
+ children: [
5582
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
5583
+ IconButton_default,
5584
+ {
5585
+ icon: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_phosphor_react10.CaretLeft, { size: 24 }),
5586
+ size: "md",
5587
+ "aria-label": "Voltar",
5588
+ onClick: handleBackClick
5589
+ }
5601
5590
  ),
5602
- cancelButtonLabel: "Voltar e revisar",
5603
- submitButtonLabel: "Sair Mesmo Assim",
5604
- onSubmit: handleConfirmExit,
5605
- onCancel: handleCancelExit
5606
- }
5607
- )
5608
- ] });
5609
- }
5610
- );
5591
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("span", { className: "flex flex-col gap-2 text-center", children: [
5592
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("p", { className: "text-text-950 font-bold text-md", children: quizTitle }),
5593
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("p", { className: "text-text-600 text-xs", children: totalQuestions > 0 ? `${currentQuestionIndex + 1} de ${totalQuestions}` : "0 de 0" })
5594
+ ] }),
5595
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "flex flex-row items-center justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Badge_default, { variant: "outlined", action: "info", iconLeft: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_phosphor_react10.Clock, {}), children: isStarted ? formatTime(timeElapsed) : "00:00" }) })
5596
+ ]
5597
+ }
5598
+ ),
5599
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
5600
+ AlertDialog,
5601
+ {
5602
+ isOpen: showExitConfirmation,
5603
+ onChangeOpen: setShowExitConfirmation,
5604
+ title: "Deseja sair?",
5605
+ description: getExitConfirmationText(quiz?.type || "SIMULADO" /* SIMULADO */),
5606
+ cancelButtonLabel: "Voltar e revisar",
5607
+ submitButtonLabel: "Sair Mesmo Assim",
5608
+ onSubmit: handleConfirmExit,
5609
+ onCancel: handleCancelExit
5610
+ }
5611
+ )
5612
+ ] });
5613
+ });
5611
5614
  var QuizHeader = () => {
5612
5615
  const { getCurrentQuestion, currentQuestionIndex } = useQuizStore();
5613
5616
  const currentQuestion = getCurrentQuestion();