analytica-frontend-lib 1.0.99 → 1.1.1

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
@@ -6233,7 +6233,8 @@ import {
6233
6233
  isValidElement as isValidElement5,
6234
6234
  Children as Children5,
6235
6235
  cloneElement as cloneElement5,
6236
- useState as useState12
6236
+ useState as useState12,
6237
+ useCallback
6237
6238
  } from "react";
6238
6239
  import { CaretLeft as CaretLeft2, CaretRight as CaretRight3 } from "phosphor-react";
6239
6240
  import { jsx as jsx33, jsxs as jsxs27 } from "react/jsx-runtime";
@@ -6516,6 +6517,46 @@ var injectStore5 = (children, store) => Children5.map(children, (child) => {
6516
6517
  ...typedChild.props.children ? { children: injectStore5(typedChild.props.children, store) } : {}
6517
6518
  });
6518
6519
  });
6520
+ var Breadcrumb = forwardRef17(
6521
+ ({ currentPage, parentPageName, onBackClick, className, ...props }, ref) => {
6522
+ const handleBackToParent = useCallback(() => {
6523
+ onBackClick();
6524
+ }, [onBackClick]);
6525
+ const breadcrumbClassName = `bg-transparent shadow-none !px-0 py-4 !-ml-2 ${typeof className === "string" ? className : ""}`;
6526
+ return /* @__PURE__ */ jsx33("div", { ref, ...props, children: /* @__PURE__ */ jsx33(
6527
+ Menu,
6528
+ {
6529
+ variant: "breadcrumb",
6530
+ defaultValue: "",
6531
+ className: breadcrumbClassName,
6532
+ children: /* @__PURE__ */ jsxs27(MenuContent, { variant: "breadcrumb", children: [
6533
+ /* @__PURE__ */ jsx33(
6534
+ MenuItem,
6535
+ {
6536
+ variant: "breadcrumb",
6537
+ value: parentPageName.toLowerCase(),
6538
+ onClick: handleBackToParent,
6539
+ separator: true,
6540
+ className: "text-text-600 underline cursor-pointer hover:text-text-950",
6541
+ children: parentPageName
6542
+ }
6543
+ ),
6544
+ /* @__PURE__ */ jsx33(
6545
+ MenuItem,
6546
+ {
6547
+ variant: "breadcrumb",
6548
+ value: currentPage.toLowerCase(),
6549
+ className: "text-text-950 font-bold",
6550
+ disabled: true,
6551
+ children: currentPage
6552
+ }
6553
+ )
6554
+ ] })
6555
+ }
6556
+ ) });
6557
+ }
6558
+ );
6559
+ Breadcrumb.displayName = "Breadcrumb";
6519
6560
  var Menu_default = Menu;
6520
6561
 
6521
6562
  // src/components/Skeleton/Skeleton.tsx
@@ -6777,7 +6818,7 @@ import {
6777
6818
  useContext,
6778
6819
  useEffect as useEffect11,
6779
6820
  useState as useState13,
6780
- useCallback,
6821
+ useCallback as useCallback2,
6781
6822
  useMemo as useMemo4
6782
6823
  } from "react";
6783
6824
  import { useLocation, Navigate } from "react-router-dom";
@@ -6797,7 +6838,7 @@ var AuthProvider = ({
6797
6838
  isLoading: true,
6798
6839
  ...initialAuthState
6799
6840
  });
6800
- const checkAuth = useCallback(async () => {
6841
+ const checkAuth = useCallback2(async () => {
6801
6842
  try {
6802
6843
  setAuthState((prev) => ({ ...prev, isLoading: true }));
6803
6844
  if (!checkAuthFn) {
@@ -6828,7 +6869,7 @@ var AuthProvider = ({
6828
6869
  return false;
6829
6870
  }
6830
6871
  }, [checkAuthFn, getUserFn, getSessionFn, getTokensFn]);
6831
- const signOut = useCallback(() => {
6872
+ const signOut = useCallback2(() => {
6832
6873
  if (signOutFn) {
6833
6874
  signOutFn();
6834
6875
  }
@@ -7075,7 +7116,7 @@ import {
7075
7116
  useMemo as useMemo6,
7076
7117
  useId as useId10,
7077
7118
  useState as useState14,
7078
- useCallback as useCallback2,
7119
+ useCallback as useCallback3,
7079
7120
  useRef as useRef9
7080
7121
  } from "react";
7081
7122
 
@@ -7787,7 +7828,7 @@ var QuizMultipleChoice = ({
7787
7828
  }
7788
7829
  return prevSelectedValuesRef.current;
7789
7830
  }, [selectedValues, currentQuestion?.id]);
7790
- const handleSelectedValues = useCallback2(
7831
+ const handleSelectedValues = useCallback3(
7791
7832
  (values) => {
7792
7833
  if (currentQuestion) {
7793
7834
  selectMultipleAnswer(currentQuestion.id, values);
@@ -7845,7 +7886,7 @@ var QuizDissertative = ({
7845
7886
  selectDissertativeAnswer(currentQuestion.id, value);
7846
7887
  }
7847
7888
  };
7848
- const adjustTextareaHeight = useCallback2(() => {
7889
+ const adjustTextareaHeight = useCallback3(() => {
7849
7890
  if (textareaRef.current) {
7850
7891
  textareaRef.current.style.height = "auto";
7851
7892
  const scrollHeight = textareaRef.current.scrollHeight;
@@ -8466,6 +8507,7 @@ var QuizFooter = forwardRef19(
8466
8507
  className,
8467
8508
  onGoToSimulated,
8468
8509
  onDetailResult,
8510
+ handleFinishSimulated,
8469
8511
  variant = "default",
8470
8512
  ...props
8471
8513
  }, ref) => {
@@ -8495,6 +8537,34 @@ var QuizFooter = forwardRef19(
8495
8537
  const unansweredQuestions = getUnansweredQuestionsFromUserAnswers();
8496
8538
  const userAnswers = getUserAnswers();
8497
8539
  const allQuestions = getTotalQuestions();
8540
+ const handleFinishQuiz = async () => {
8541
+ if (unansweredQuestions.length > 0) {
8542
+ setAlertDialogOpen(true);
8543
+ return;
8544
+ }
8545
+ try {
8546
+ if (handleFinishSimulated) {
8547
+ await Promise.resolve(handleFinishSimulated());
8548
+ }
8549
+ setModalResultOpen(true);
8550
+ } catch (err) {
8551
+ console.error("handleFinishSimulated failed:", err);
8552
+ setModalResultOpen(true);
8553
+ }
8554
+ };
8555
+ const handleAlertSubmit = async () => {
8556
+ try {
8557
+ if (handleFinishSimulated) {
8558
+ await Promise.resolve(handleFinishSimulated());
8559
+ }
8560
+ setModalResultOpen(true);
8561
+ setAlertDialogOpen(false);
8562
+ } catch (err) {
8563
+ console.error("handleFinishSimulated failed:", err);
8564
+ setModalResultOpen(true);
8565
+ setAlertDialogOpen(false);
8566
+ }
8567
+ };
8498
8568
  return /* @__PURE__ */ jsxs30(Fragment8, { children: [
8499
8569
  /* @__PURE__ */ jsx37(
8500
8570
  "footer",
@@ -8560,13 +8630,7 @@ var QuizFooter = forwardRef19(
8560
8630
  variant: "solid",
8561
8631
  action: "primary",
8562
8632
  disabled: !currentAnswer && !isCurrentQuestionSkipped,
8563
- onClick: () => {
8564
- if (unansweredQuestions.length > 0) {
8565
- setAlertDialogOpen(true);
8566
- } else {
8567
- setModalResultOpen(true);
8568
- }
8569
- },
8633
+ onClick: handleFinishQuiz,
8570
8634
  children: "Finalizar"
8571
8635
  }
8572
8636
  ) : /* @__PURE__ */ jsx37(
@@ -8595,9 +8659,7 @@ var QuizFooter = forwardRef19(
8595
8659
  description: unansweredQuestions.length > 0 ? `Voc\xEA deixou as quest\xF5es ${unansweredQuestions.join(", ")} sem resposta. Finalizar agora pode impactar seu desempenho.` : "Tem certeza que deseja finalizar o simulado?",
8596
8660
  cancelButtonLabel: "Voltar e revisar",
8597
8661
  submitButtonLabel: "Finalizar Mesmo Assim",
8598
- onSubmit: () => {
8599
- setModalResultOpen(true);
8600
- }
8662
+ onSubmit: handleAlertSubmit
8601
8663
  }
8602
8664
  ),
8603
8665
  /* @__PURE__ */ jsx37(
@@ -8929,6 +8991,7 @@ export {
8929
8991
  AlternativesList,
8930
8992
  AuthProvider,
8931
8993
  Badge_default as Badge,
8994
+ Breadcrumb,
8932
8995
  Button_default as Button,
8933
8996
  Calendar_default as Calendar,
8934
8997
  CardAccordation,