analytica-frontend-lib 1.1.5 → 1.1.6

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.
@@ -8,6 +8,7 @@ declare const getStatusBadge: (status?: "correct" | "incorrect") => react_jsx_ru
8
8
  declare const Quiz: react.ForwardRefExoticComponent<{
9
9
  children: ReactNode;
10
10
  className?: string;
11
+ variant?: "result" | "default";
11
12
  } & react.RefAttributes<HTMLDivElement>>;
12
13
  declare const QuizHeaderResult: react.ForwardRefExoticComponent<{
13
14
  className?: string;
@@ -17,7 +18,6 @@ declare const QuizTitle: react.ForwardRefExoticComponent<{
17
18
  } & react.RefAttributes<HTMLDivElement>>;
18
19
  declare const QuizHeader: () => react_jsx_runtime.JSX.Element;
19
20
  declare const QuizContent: react.ForwardRefExoticComponent<{
20
- variant?: "result" | "default";
21
21
  paddingBottom?: string;
22
22
  } & react.RefAttributes<HTMLDivElement>>;
23
23
  interface QuizVariantInterface {
@@ -37,7 +37,6 @@ declare const QuizQuestionList: ({ filterType, onQuestionClick, }?: {
37
37
  }) => react_jsx_runtime.JSX.Element;
38
38
  declare const QuizFooter: react.ForwardRefExoticComponent<{
39
39
  className?: string;
40
- variant?: "result" | "default";
41
40
  onGoToSimulated?: () => void;
42
41
  onDetailResult?: () => void;
43
42
  handleFinishSimulated?: () => void;
@@ -8,6 +8,7 @@ declare const getStatusBadge: (status?: "correct" | "incorrect") => react_jsx_ru
8
8
  declare const Quiz: react.ForwardRefExoticComponent<{
9
9
  children: ReactNode;
10
10
  className?: string;
11
+ variant?: "result" | "default";
11
12
  } & react.RefAttributes<HTMLDivElement>>;
12
13
  declare const QuizHeaderResult: react.ForwardRefExoticComponent<{
13
14
  className?: string;
@@ -17,7 +18,6 @@ declare const QuizTitle: react.ForwardRefExoticComponent<{
17
18
  } & react.RefAttributes<HTMLDivElement>>;
18
19
  declare const QuizHeader: () => react_jsx_runtime.JSX.Element;
19
20
  declare const QuizContent: react.ForwardRefExoticComponent<{
20
- variant?: "result" | "default";
21
21
  paddingBottom?: string;
22
22
  } & react.RefAttributes<HTMLDivElement>>;
23
23
  interface QuizVariantInterface {
@@ -37,7 +37,6 @@ declare const QuizQuestionList: ({ filterType, onQuestionClick, }?: {
37
37
  }) => react_jsx_runtime.JSX.Element;
38
38
  declare const QuizFooter: react.ForwardRefExoticComponent<{
39
39
  className?: string;
40
- variant?: "result" | "default";
41
40
  onGoToSimulated?: () => void;
42
41
  onDetailResult?: () => void;
43
42
  handleFinishSimulated?: () => void;
@@ -994,6 +994,7 @@ var useQuizStore = (0, import_zustand2.create)()(
994
994
  isStarted: false,
995
995
  isFinished: false,
996
996
  userId: "",
997
+ variant: "default",
997
998
  // Setters
998
999
  setBySimulated: (simulado) => set({ bySimulated: simulado }),
999
1000
  setByActivity: (atividade) => set({ byActivity: atividade }),
@@ -1001,6 +1002,7 @@ var useQuizStore = (0, import_zustand2.create)()(
1001
1002
  setUserId: (userId) => set({ userId }),
1002
1003
  setUserAnswers: (userAnswers) => set({ userAnswers }),
1003
1004
  getUserId: () => get().userId,
1005
+ setVariant: (variant) => set({ variant }),
1004
1006
  // Navigation
1005
1007
  goToNextQuestion: () => {
1006
1008
  const { currentQuestionIndex, getTotalQuestions } = get();
@@ -4500,7 +4502,11 @@ var getStatusStyles = (variantCorrect) => {
4500
4502
  return "bg-error-background border-error-300";
4501
4503
  }
4502
4504
  };
4503
- var Quiz = (0, import_react12.forwardRef)(({ children, className, ...props }, ref) => {
4505
+ var Quiz = (0, import_react12.forwardRef)(({ children, className, variant = "default", ...props }, ref) => {
4506
+ const { setVariant } = useQuizStore();
4507
+ (0, import_react12.useEffect)(() => {
4508
+ setVariant(variant);
4509
+ }, [variant, setVariant]);
4504
4510
  return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
4505
4511
  "div",
4506
4512
  {
@@ -4609,8 +4615,8 @@ var QuizContainer = (0, import_react12.forwardRef)(({ children, className, ...pr
4609
4615
  }
4610
4616
  );
4611
4617
  });
4612
- var QuizContent = (0, import_react12.forwardRef)(({ variant, paddingBottom }) => {
4613
- const { getCurrentQuestion } = useQuizStore();
4618
+ var QuizContent = (0, import_react12.forwardRef)(({ paddingBottom }) => {
4619
+ const { getCurrentQuestion, variant } = useQuizStore();
4614
4620
  const currentQuestion = getCurrentQuestion();
4615
4621
  const questionComponents = {
4616
4622
  ["ALTERNATIVA" /* ALTERNATIVA */]: QuizAlternative,
@@ -5376,7 +5382,6 @@ var QuizFooter = (0, import_react12.forwardRef)(
5376
5382
  onGoToSimulated,
5377
5383
  onDetailResult,
5378
5384
  handleFinishSimulated,
5379
- variant = "default",
5380
5385
  ...props
5381
5386
  }, ref) => {
5382
5387
  const {
@@ -5390,6 +5395,7 @@ var QuizFooter = (0, import_react12.forwardRef)(
5390
5395
  skipQuestion,
5391
5396
  getCurrentQuestion,
5392
5397
  getQuestionStatusFromUserAnswers,
5398
+ variant,
5393
5399
  getActiveQuiz
5394
5400
  } = useQuizStore();
5395
5401
  const totalQuestions = getTotalQuestions();
@@ -5401,6 +5407,7 @@ var QuizFooter = (0, import_react12.forwardRef)(
5401
5407
  const [alertDialogOpen, setAlertDialogOpen] = (0, import_react12.useState)(false);
5402
5408
  const [modalResultOpen, setModalResultOpen] = (0, import_react12.useState)(false);
5403
5409
  const [modalNavigateOpen, setModalNavigateOpen] = (0, import_react12.useState)(false);
5410
+ const [modalResolutionOpen, setModalResolutionOpen] = (0, import_react12.useState)(false);
5404
5411
  const [filterType, setFilterType] = (0, import_react12.useState)("all");
5405
5412
  const unansweredQuestions = getUnansweredQuestionsFromUserAnswers();
5406
5413
  const userAnswers = getUserAnswers();
@@ -5515,7 +5522,16 @@ var QuizFooter = (0, import_react12.forwardRef)(
5515
5522
  children: "Avan\xE7ar"
5516
5523
  }
5517
5524
  )
5518
- ] }) : /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className: "flex flex-row items-center justify-end w-full", children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(Button_default, { variant: "solid", action: "primary", size: "medium", children: "Ver Resolu\xE7\xE3o" }) })
5525
+ ] }) : /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className: "flex flex-row items-center justify-end w-full", children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
5526
+ Button_default,
5527
+ {
5528
+ variant: "solid",
5529
+ action: "primary",
5530
+ size: "medium",
5531
+ onClick: () => setModalResolutionOpen(true),
5532
+ children: "Ver Resolu\xE7\xE3o"
5533
+ }
5534
+ ) })
5519
5535
  }
5520
5536
  ),
5521
5537
  /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
@@ -5617,6 +5633,16 @@ var QuizFooter = (0, import_react12.forwardRef)(
5617
5633
  ) })
5618
5634
  ] })
5619
5635
  }
5636
+ ),
5637
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
5638
+ Modal_default,
5639
+ {
5640
+ isOpen: modalResolutionOpen,
5641
+ onClose: () => setModalResolutionOpen(false),
5642
+ title: "Resolu\xE7\xE3o",
5643
+ size: "lg",
5644
+ children: currentQuestion?.answerKey
5645
+ }
5620
5646
  )
5621
5647
  ] });
5622
5648
  }