analytica-frontend-lib 1.0.96 → 1.0.97

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.
@@ -5,7 +5,9 @@ import {
5
5
  Clock as Clock2,
6
6
  SquaresFour,
7
7
  BookOpen,
8
- Book
8
+ Book,
9
+ CheckCircle as CheckCircle4,
10
+ XCircle as XCircle4
9
11
  } from "phosphor-react";
10
12
 
11
13
  // src/components/Badge/Badge.tsx
@@ -579,7 +581,7 @@ var AlternativesList = ({
579
581
  const groupName = name || `alternatives-${uniqueId}`;
580
582
  const [actualValue, setActualValue] = useState2(value);
581
583
  const isReadonly = mode === "readonly";
582
- const getStatusStyles = (status, isReadonly2) => {
584
+ const getStatusStyles2 = (status, isReadonly2) => {
583
585
  const hoverClass = isReadonly2 ? "" : "hover:bg-background-50";
584
586
  switch (status) {
585
587
  case "correct":
@@ -590,7 +592,7 @@ var AlternativesList = ({
590
592
  return `bg-background border-border-100 ${hoverClass}`;
591
593
  }
592
594
  };
593
- const getStatusBadge = (status) => {
595
+ const getStatusBadge2 = (status) => {
594
596
  switch (status) {
595
597
  case "correct":
596
598
  return /* @__PURE__ */ jsx4(Badge_default, { variant: "solid", action: "success", iconLeft: /* @__PURE__ */ jsx4(CheckCircle, {}), children: "Resposta correta" });
@@ -620,8 +622,8 @@ var AlternativesList = ({
620
622
  } else if (isCorrectAnswer) {
621
623
  displayStatus = "correct";
622
624
  }
623
- const statusStyles = getStatusStyles(displayStatus, true);
624
- const statusBadge = getStatusBadge(displayStatus);
625
+ const statusStyles = getStatusStyles2(displayStatus, true);
626
+ const statusBadge = getStatusBadge2(displayStatus);
625
627
  const renderRadio = () => {
626
628
  const radioClasses = `w-6 h-6 rounded-full border-2 cursor-default transition-all duration-200 flex items-center justify-center ${isUserSelected ? "border-primary-950 bg-background" : "border-border-400 bg-background"}`;
627
629
  const dotClasses = "w-3 h-3 rounded-full bg-primary-950 transition-all duration-200";
@@ -712,8 +714,8 @@ var AlternativesList = ({
712
714
  className: cn("flex flex-col", getLayoutClasses(), className),
713
715
  children: alternatives.map((alternative, index) => {
714
716
  const alternativeId = alternative.value || `alt-${index}`;
715
- const statusStyles = getStatusStyles(alternative.status, false);
716
- const statusBadge = getStatusBadge(alternative.status);
717
+ const statusStyles = getStatusStyles2(alternative.status, false);
718
+ const statusBadge = getStatusBadge2(alternative.status);
717
719
  if (layout === "detailed") {
718
720
  return /* @__PURE__ */ jsx4(
719
721
  "div",
@@ -935,6 +937,7 @@ import {
935
937
  forwardRef as forwardRef10,
936
938
  useEffect as useEffect7,
937
939
  useMemo,
940
+ useId as useId7,
938
941
  useState as useState7,
939
942
  useCallback,
940
943
  useRef as useRef5
@@ -1826,7 +1829,7 @@ var Select = ({
1826
1829
  }
1827
1830
  }, [propValue]);
1828
1831
  const sizeClasses = SIZE_CLASSES6[size];
1829
- return /* @__PURE__ */ jsxs7("div", { className: cn("w-auto", className), children: [
1832
+ return /* @__PURE__ */ jsxs7("div", { className: cn("w-fit", className), children: [
1830
1833
  label && /* @__PURE__ */ jsx9(
1831
1834
  "label",
1832
1835
  {
@@ -1835,7 +1838,7 @@ var Select = ({
1835
1838
  children: label
1836
1839
  }
1837
1840
  ),
1838
- /* @__PURE__ */ jsx9("div", { className: cn("relative"), ref: selectRef, children: injectStore2(children, store, size, selectId) }),
1841
+ /* @__PURE__ */ jsx9("div", { className: cn("relative w-fit"), ref: selectRef, children: injectStore2(children, store, size, selectId) }),
1839
1842
  (helperText || errorMessage) && /* @__PURE__ */ jsxs7("div", { className: "mt-1.5 gap-1.5", children: [
1840
1843
  helperText && /* @__PURE__ */ jsx9("p", { className: "text-sm text-text-500", children: helperText }),
1841
1844
  errorMessage && /* @__PURE__ */ jsxs7("p", { className: "flex gap-1 items-center text-sm text-indicator-error", children: [
@@ -1928,7 +1931,7 @@ var SelectContent = forwardRef5(
1928
1931
  role: "menu",
1929
1932
  ref,
1930
1933
  className: cn(
1931
- "bg-secondary z-50 min-w-[210px] overflow-hidden rounded-md border p-1 shadow-md border-border-100",
1934
+ "bg-secondary z-50 min-w-[210px] max-h-[300px] overflow-y-auto overflow-x-hidden rounded-md border p-1 shadow-md border-border-100",
1932
1935
  getPositionClasses(),
1933
1936
  className
1934
1937
  ),
@@ -4235,7 +4238,7 @@ var MultipleChoiceList = ({
4235
4238
  useEffect6(() => {
4236
4239
  setActualValue(selectedValues);
4237
4240
  }, [selectedValues]);
4238
- const getStatusBadge = (status) => {
4241
+ const getStatusBadge2 = (status) => {
4239
4242
  switch (status) {
4240
4243
  case "correct":
4241
4244
  return /* @__PURE__ */ jsx15(Badge_default, { variant: "solid", action: "success", iconLeft: /* @__PURE__ */ jsx15(CheckCircle3, {}), children: "Resposta correta" });
@@ -4245,7 +4248,7 @@ var MultipleChoiceList = ({
4245
4248
  return null;
4246
4249
  }
4247
4250
  };
4248
- const getStatusStyles = (status) => {
4251
+ const getStatusStyles2 = (status) => {
4249
4252
  switch (status) {
4250
4253
  case "correct":
4251
4254
  return "bg-success-background border-success-300";
@@ -4266,8 +4269,8 @@ var MultipleChoiceList = ({
4266
4269
  if (mode === "readonly") {
4267
4270
  return /* @__PURE__ */ jsx15("div", { className: cn("flex flex-col gap-2", className), children: choices.map((choice, i) => {
4268
4271
  const isSelected = actualValue?.includes(choice.value) || false;
4269
- const statusStyles = getStatusStyles(choice.status);
4270
- const statusBadge = getStatusBadge(choice.status);
4272
+ const statusStyles = getStatusStyles2(choice.status);
4273
+ const statusBadge = getStatusBadge2(choice.status);
4271
4274
  return /* @__PURE__ */ jsxs12(
4272
4275
  "div",
4273
4276
  {
@@ -4493,6 +4496,24 @@ var TextArea_default = TextArea;
4493
4496
 
4494
4497
  // src/components/Quiz/Quiz.tsx
4495
4498
  import { Fragment as Fragment6, jsx as jsx17, jsxs as jsxs14 } from "react/jsx-runtime";
4499
+ var getStatusBadge = (status) => {
4500
+ switch (status) {
4501
+ case "correct":
4502
+ return /* @__PURE__ */ jsx17(Badge_default, { variant: "solid", action: "success", iconLeft: /* @__PURE__ */ jsx17(CheckCircle4, {}), children: "Resposta correta" });
4503
+ case "incorrect":
4504
+ return /* @__PURE__ */ jsx17(Badge_default, { variant: "solid", action: "error", iconLeft: /* @__PURE__ */ jsx17(XCircle4, {}), children: "Resposta incorreta" });
4505
+ default:
4506
+ return null;
4507
+ }
4508
+ };
4509
+ var getStatusStyles = (variantCorrect) => {
4510
+ switch (variantCorrect) {
4511
+ case "correct":
4512
+ return "bg-success-background border-success-300";
4513
+ case "incorrect":
4514
+ return "bg-error-background border-error-300";
4515
+ }
4516
+ };
4496
4517
  var Quiz = forwardRef10(({ children, className, ...props }, ref) => {
4497
4518
  return /* @__PURE__ */ jsx17(
4498
4519
  "div",
@@ -4571,6 +4592,11 @@ var QuizTitle = forwardRef10(
4571
4592
  );
4572
4593
  }
4573
4594
  );
4595
+ var QuizSubTitle = forwardRef10(
4596
+ ({ subTitle, ...props }, ref) => {
4597
+ return /* @__PURE__ */ jsx17("div", { className: "px-4 pb-2 pt-6", ...props, ref, children: /* @__PURE__ */ jsx17("p", { className: "font-bold text-lg text-text-950", children: subTitle }) });
4598
+ }
4599
+ );
4574
4600
  var QuizHeader = () => {
4575
4601
  const { getCurrentQuestion } = useQuizStore();
4576
4602
  const currentQuestion = getCurrentQuestion();
@@ -4583,46 +4609,38 @@ var QuizHeader = () => {
4583
4609
  }
4584
4610
  );
4585
4611
  };
4586
- var QuizContent = forwardRef10(({ type = "Alternativas", className, variant, ...props }, ref) => {
4587
- const { getCurrentQuestion, getCurrentAnswer } = useQuizStore();
4612
+ var QuizContainer = forwardRef10(({ children, className, ...props }, ref) => {
4613
+ return /* @__PURE__ */ jsx17(
4614
+ "div",
4615
+ {
4616
+ ref,
4617
+ className: cn(
4618
+ "bg-background rounded-t-xl px-4 pt-4 pb-[80px] h-auto flex flex-col gap-4 mb-auto",
4619
+ className
4620
+ ),
4621
+ ...props,
4622
+ children
4623
+ }
4624
+ );
4625
+ });
4626
+ var QuizContent = forwardRef10(({ variant, paddingBottom }) => {
4627
+ const { getCurrentQuestion } = useQuizStore();
4588
4628
  const currentQuestion = getCurrentQuestion();
4589
- const currentAnswer = getCurrentAnswer();
4590
- return /* @__PURE__ */ jsxs14(Fragment6, { children: [
4591
- /* @__PURE__ */ jsx17("div", { className: "px-4 pb-2 pt-6", children: /* @__PURE__ */ jsx17("p", { className: "font-bold text-lg text-text-950", children: type }) }),
4592
- /* @__PURE__ */ jsx17(
4593
- "div",
4594
- {
4595
- ref,
4596
- className: cn(
4597
- "bg-background rounded-t-xl px-4 pt-4 pb-[80px] h-full flex flex-col gap-4 mb-auto",
4598
- className
4599
- ),
4600
- ...props,
4601
- children: currentQuestion && /* @__PURE__ */ jsxs14(Fragment6, { children: [
4602
- currentQuestion.type === "ALTERNATIVA" /* ALTERNATIVA */ && /* @__PURE__ */ jsx17(QuizAlternative, { variant }),
4603
- currentQuestion.type === "MULTIPLA_CHOICE" /* MULTIPLA_CHOICE */ && /* @__PURE__ */ jsx17(QuizMultipleChoice, { variant }),
4604
- currentQuestion.type === "DISSERTATIVA" /* DISSERTATIVA */ && /* @__PURE__ */ jsx17(QuizDissertative, { variant })
4605
- ] })
4606
- }
4607
- ),
4608
- currentQuestion?.type === "DISSERTATIVA" /* DISSERTATIVA */ && variant === "result" && currentAnswer?.answerStatus == "RESPOSTA_INCORRETA" /* RESPOSTA_INCORRETA */ && /* @__PURE__ */ jsxs14(Fragment6, { children: [
4609
- /* @__PURE__ */ jsx17("div", { className: "px-4 pb-2 pt-6", children: /* @__PURE__ */ jsx17("p", { className: "font-bold text-lg text-text-950", children: "Observa\xE7\xE3o do professor" }) }),
4610
- /* @__PURE__ */ jsx17(
4611
- "div",
4612
- {
4613
- ref,
4614
- className: cn(
4615
- "bg-background rounded-t-xl px-4 pt-4 pb-[80px] h-full flex flex-col gap-4 mb-auto",
4616
- className
4617
- ),
4618
- ...props,
4619
- children: /* @__PURE__ */ jsx17("p", { className: "text-text-600 text-md whitespace-pre-wrap", children: "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed euismod, urna eu tincidunt consectetur, nisi nisl aliquam nunc, eget aliquam massa nisl quis neque. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia curae; Integer euismod, urna eu tincidunt consectetur, nisi nisl aliquam nunc, eget aliquam massa nisl quis neque. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Suspendisse potenti. Nullam ac urna eu felis dapibus condimentum sit amet a augue. Sed non neque elit. Sed ut imperdiet nisi. Proin condimentum fermentum nunc. Etiam pharetra, erat sed fermentum feugiat, velit mauris egestas quam, ut aliquam massa nisl quis neque. Suspendisse in orci enim. Mauris euismod, urna eu tincidunt consectetur, nisi nisl aliquam nunc, eget aliquam massa nisl quis neque. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia curae; Integer euismod, urna eu tincidunt consectetur, nisi nisl aliquam nunc, eget aliquam massa nisl quis neque. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Suspendisse potenti. Nullam ac urna eu felis dapibus condimentum sit amet a augue. Sed non neque elit. Sed ut imperdiet nisi. Proin condimentum fermentum nunc. Etiam pharetra, erat sed fermentum feugiat, velit mauris egestas quam, ut aliquam massa nisl quis neque. Suspendisse in orci enim. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia curae; Integer euismod, urna eu tincidunt consectetur, nisi nisl aliquam nunc, eget aliquam massa nisl quis neque. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Suspendisse potenti. Nullam ac urna eu felis dapibus condimentum sit amet a augue. Sed non neque elit. Sed ut imperdiet nisi. Proin condimentum fermentum nunc. Etiam pharetra, erat sed fermentum feugiat, velit mauris egestas quam, ut aliquam massa nisl quis neque. Suspendisse in orci enim." })
4620
- }
4621
- )
4622
- ] })
4623
- ] });
4629
+ const questionComponents = {
4630
+ ["ALTERNATIVA" /* ALTERNATIVA */]: QuizAlternative,
4631
+ ["MULTIPLA_CHOICE" /* MULTIPLA_CHOICE */]: QuizMultipleChoice,
4632
+ ["DISSERTATIVA" /* DISSERTATIVA */]: QuizDissertative,
4633
+ ["VERDADEIRO_FALSO" /* VERDADEIRO_FALSO */]: QuizTrueOrFalse,
4634
+ ["LIGAR_PONTOS" /* LIGAR_PONTOS */]: QuizConnectDots,
4635
+ ["PREENCHER" /* PREENCHER */]: QuizFill
4636
+ };
4637
+ const QuestionComponent = currentQuestion ? questionComponents[currentQuestion.type] : null;
4638
+ return QuestionComponent ? /* @__PURE__ */ jsx17(QuestionComponent, { variant, paddingBottom }) : null;
4624
4639
  });
4625
- var QuizAlternative = ({ variant = "default" }) => {
4640
+ var QuizAlternative = ({
4641
+ variant = "default",
4642
+ paddingBottom
4643
+ }) => {
4626
4644
  const { getCurrentQuestion, selectAnswer, getCurrentAnswer } = useQuizStore();
4627
4645
  const currentQuestion = getCurrentQuestion();
4628
4646
  const currentAnswer = getCurrentAnswer();
@@ -4646,26 +4664,30 @@ var QuizAlternative = ({ variant = "default" }) => {
4646
4664
  });
4647
4665
  if (!alternatives)
4648
4666
  return /* @__PURE__ */ jsx17("div", { children: /* @__PURE__ */ jsx17("p", { children: "N\xE3o h\xE1 Alternativas" }) });
4649
- return /* @__PURE__ */ jsx17("div", { className: "space-y-4", children: /* @__PURE__ */ jsx17(
4650
- AlternativesList,
4651
- {
4652
- mode: variant === "default" ? "interactive" : "readonly",
4653
- name: `question-${currentQuestion?.id || "1"}`,
4654
- layout: "compact",
4655
- alternatives,
4656
- value: currentAnswer?.optionId || "",
4657
- selectedValue: currentAnswer?.optionId || "",
4658
- onValueChange: (value) => {
4659
- if (currentQuestion) {
4660
- selectAnswer(currentQuestion.id, value);
4667
+ return /* @__PURE__ */ jsxs14(Fragment6, { children: [
4668
+ /* @__PURE__ */ jsx17(QuizSubTitle, { subTitle: "Alternativas" }),
4669
+ /* @__PURE__ */ jsx17(QuizContainer, { className: cn("", paddingBottom), children: /* @__PURE__ */ jsx17("div", { className: "space-y-4", children: /* @__PURE__ */ jsx17(
4670
+ AlternativesList,
4671
+ {
4672
+ mode: variant === "default" ? "interactive" : "readonly",
4673
+ name: `question-${currentQuestion?.id || "1"}`,
4674
+ layout: "compact",
4675
+ alternatives,
4676
+ value: currentAnswer?.optionId || "",
4677
+ selectedValue: currentAnswer?.optionId || "",
4678
+ onValueChange: (value) => {
4679
+ if (currentQuestion) {
4680
+ selectAnswer(currentQuestion.id, value);
4681
+ }
4661
4682
  }
4662
- }
4663
- },
4664
- `question-${currentQuestion?.id || "1"}`
4665
- ) });
4683
+ },
4684
+ `question-${currentQuestion?.id || "1"}`
4685
+ ) }) })
4686
+ ] });
4666
4687
  };
4667
4688
  var QuizMultipleChoice = ({
4668
- variant = "default"
4689
+ variant = "default",
4690
+ paddingBottom
4669
4691
  }) => {
4670
4692
  const { getCurrentQuestion, selectMultipleAnswer, getAllCurrentAnswer } = useQuizStore();
4671
4693
  const currentQuestion = getCurrentQuestion();
@@ -4723,20 +4745,24 @@ var QuizMultipleChoice = ({
4723
4745
  });
4724
4746
  if (!choices)
4725
4747
  return /* @__PURE__ */ jsx17("div", { children: /* @__PURE__ */ jsx17("p", { children: "N\xE3o h\xE1 Escolhas Multiplas" }) });
4726
- return /* @__PURE__ */ jsx17("div", { className: "space-y-4", children: /* @__PURE__ */ jsx17(
4727
- MultipleChoiceList,
4728
- {
4729
- choices,
4730
- name: questionKey,
4731
- selectedValues: stableSelectedValues,
4732
- onHandleSelectedValues: handleSelectedValues,
4733
- mode: variant === "default" ? "interactive" : "readonly"
4734
- },
4735
- questionKey
4736
- ) });
4748
+ return /* @__PURE__ */ jsxs14(Fragment6, { children: [
4749
+ /* @__PURE__ */ jsx17(QuizSubTitle, { subTitle: "Alternativas" }),
4750
+ /* @__PURE__ */ jsx17(QuizContainer, { className: cn("", paddingBottom), children: /* @__PURE__ */ jsx17("div", { className: "space-y-4", children: /* @__PURE__ */ jsx17(
4751
+ MultipleChoiceList,
4752
+ {
4753
+ choices,
4754
+ name: questionKey,
4755
+ selectedValues: stableSelectedValues,
4756
+ onHandleSelectedValues: handleSelectedValues,
4757
+ mode: variant === "default" ? "interactive" : "readonly"
4758
+ },
4759
+ questionKey
4760
+ ) }) })
4761
+ ] });
4737
4762
  };
4738
4763
  var QuizDissertative = ({
4739
- variant = "default"
4764
+ variant = "default",
4765
+ paddingBottom
4740
4766
  }) => {
4741
4767
  const { getCurrentQuestion, getCurrentAnswer, selectDissertativeAnswer } = useQuizStore();
4742
4768
  const currentQuestion = getCurrentQuestion();
@@ -4763,17 +4789,388 @@ var QuizDissertative = ({
4763
4789
  if (!currentQuestion) {
4764
4790
  return /* @__PURE__ */ jsx17("div", { className: "space-y-4", children: /* @__PURE__ */ jsx17("p", { className: "text-text-600 text-md", children: "Nenhuma quest\xE3o dispon\xEDvel" }) });
4765
4791
  }
4766
- return /* @__PURE__ */ jsx17("div", { className: "space-y-4 max-h-[600px] overflow-y-auto", children: variant === "default" ? /* @__PURE__ */ jsx17("div", { className: "space-y-4", children: /* @__PURE__ */ jsx17(
4767
- TextArea_default,
4792
+ return /* @__PURE__ */ jsxs14(Fragment6, { children: [
4793
+ /* @__PURE__ */ jsx17(QuizSubTitle, { subTitle: "Resposta" }),
4794
+ /* @__PURE__ */ jsx17(QuizContainer, { className: cn(variant != "result" && paddingBottom), children: /* @__PURE__ */ jsx17("div", { className: "space-y-4 max-h-[600px] overflow-y-auto", children: variant === "default" ? /* @__PURE__ */ jsx17("div", { className: "space-y-4", children: /* @__PURE__ */ jsx17(
4795
+ TextArea_default,
4796
+ {
4797
+ ref: textareaRef,
4798
+ placeholder: "Escreva sua resposta",
4799
+ value: currentAnswer?.answer || "",
4800
+ onChange: (e) => handleAnswerChange(e.target.value),
4801
+ rows: 4,
4802
+ className: "min-h-[120px] max-h-[400px] resize-none overflow-y-auto"
4803
+ }
4804
+ ) }) : /* @__PURE__ */ jsx17("div", { className: "space-y-4", children: /* @__PURE__ */ jsx17("p", { className: "text-text-600 text-md whitespace-pre-wrap", children: currentAnswer?.answer || "Nenhuma resposta fornecida" }) }) }) }),
4805
+ variant === "result" && currentAnswer?.answerStatus == "RESPOSTA_INCORRETA" /* RESPOSTA_INCORRETA */ && /* @__PURE__ */ jsxs14(Fragment6, { children: [
4806
+ /* @__PURE__ */ jsx17(QuizSubTitle, { subTitle: "Observa\xE7\xE3o do professor" }),
4807
+ /* @__PURE__ */ jsx17(QuizContainer, { className: cn("", paddingBottom), children: /* @__PURE__ */ jsx17("p", { className: "text-text-600 text-md whitespace-pre-wrap", children: "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed euismod, urna eu tincidunt consectetur, nisi nisl aliquam nunc, eget aliquam massa nisl quis neque. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia curae; Integer euismod, urna eu tincidunt consectetur, nisi nisl aliquam nunc, eget aliquam massa nisl quis neque. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Suspendisse potenti. Nullam ac urna eu felis dapibus condimentum sit amet a augue. Sed non neque elit. Sed ut imperdiet nisi. Proin condimentum fermentum nunc. Etiam pharetra, erat sed fermentum feugiat, velit mauris egestas quam, ut aliquam massa nisl quis neque. Suspendisse in orci enim. Mauris euismod, urna eu tincidunt consectetur, nisi nisl aliquam nunc, eget aliquam massa nisl quis neque. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia curae; Integer euismod, urna eu tincidunt consectetur, nisi nisl aliquam nunc, eget aliquam massa nisl quis neque. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Suspendisse potenti. Nullam ac urna eu felis dapibus condimentum sit amet a augue. Sed non neque elit. Sed ut imperdiet nisi. Proin condimentum fermentum nunc. Etiam pharetra, erat sed fermentum feugiat, velit mauris egestas quam, ut aliquam massa nisl quis neque. Suspendisse in orci enim. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia curae; Integer euismod, urna eu tincidunt consectetur, nisi nisl aliquam nunc, eget aliquam massa nisl quis neque. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Suspendisse potenti. Nullam ac urna eu felis dapibus condimentum sit amet a augue. Sed non neque elit. Sed ut imperdiet nisi. Proin condimentum fermentum nunc. Etiam pharetra, erat sed fermentum feugiat, velit mauris egestas quam, ut aliquam massa nisl quis neque. Suspendisse in orci enim." }) })
4808
+ ] })
4809
+ ] });
4810
+ };
4811
+ var QuizTrueOrFalse = ({
4812
+ variant = "default",
4813
+ paddingBottom
4814
+ }) => {
4815
+ const options = [
4768
4816
  {
4769
- ref: textareaRef,
4770
- placeholder: "Escreva sua resposta",
4771
- value: currentAnswer?.answer || "",
4772
- onChange: (e) => handleAnswerChange(e.target.value),
4773
- rows: 4,
4774
- className: "min-h-[120px] max-h-[400px] resize-none overflow-y-auto"
4817
+ label: "25 metros",
4818
+ isCorrect: true
4819
+ },
4820
+ {
4821
+ label: "30 metros",
4822
+ isCorrect: false
4823
+ },
4824
+ {
4825
+ label: "40 metros",
4826
+ isCorrect: false
4827
+ },
4828
+ {
4829
+ label: "50 metros",
4830
+ isCorrect: false
4775
4831
  }
4776
- ) }) : /* @__PURE__ */ jsx17("div", { className: "space-y-4", children: /* @__PURE__ */ jsx17("p", { className: "text-text-600 text-md whitespace-pre-wrap", children: currentAnswer?.answer || "Nenhuma resposta fornecida" }) }) });
4832
+ ];
4833
+ const getLetterByIndex = (index) => String.fromCharCode(97 + index);
4834
+ const isDefaultVariant = variant == "default";
4835
+ return /* @__PURE__ */ jsxs14(Fragment6, { children: [
4836
+ /* @__PURE__ */ jsx17(QuizSubTitle, { subTitle: "Alternativas" }),
4837
+ /* @__PURE__ */ jsx17(QuizContainer, { className: cn("", paddingBottom), children: /* @__PURE__ */ jsx17("div", { className: "flex flex-col gap-3.5", children: options.map((option, index) => {
4838
+ const variantCorrect = option.isCorrect ? "correct" : "incorrect";
4839
+ return /* @__PURE__ */ jsxs14(
4840
+ "section",
4841
+ {
4842
+ className: "flex flex-col gap-2",
4843
+ children: [
4844
+ /* @__PURE__ */ jsxs14(
4845
+ "div",
4846
+ {
4847
+ className: cn(
4848
+ "flex flex-row justify-between items-center gap-2 p-2 rounded-md",
4849
+ !isDefaultVariant ? getStatusStyles(variantCorrect) : ""
4850
+ ),
4851
+ children: [
4852
+ /* @__PURE__ */ jsx17("p", { className: "text-text-900 text-sm", children: getLetterByIndex(index).concat(") ").concat(option.label) }),
4853
+ isDefaultVariant ? /* @__PURE__ */ jsxs14(Select_default, { size: "medium", children: [
4854
+ /* @__PURE__ */ jsx17(SelectTrigger, { className: "w-[180px]", children: /* @__PURE__ */ jsx17(SelectValue, { placeholder: "Selecione opc\xE3o" }) }),
4855
+ /* @__PURE__ */ jsxs14(SelectContent, { children: [
4856
+ /* @__PURE__ */ jsx17(SelectItem, { value: "V", children: "Verdadeiro" }),
4857
+ /* @__PURE__ */ jsx17(SelectItem, { value: "F", children: "Falso" })
4858
+ ] })
4859
+ ] }) : /* @__PURE__ */ jsx17("div", { className: "flex-shrink-0", children: getStatusBadge(variantCorrect) })
4860
+ ]
4861
+ }
4862
+ ),
4863
+ !isDefaultVariant && /* @__PURE__ */ jsxs14("span", { className: "flex flex-row gap-2 items-center", children: [
4864
+ /* @__PURE__ */ jsx17("p", { className: "text-text-800 text-2xs", children: "Resposta selecionada: V" }),
4865
+ !option.isCorrect && /* @__PURE__ */ jsx17("p", { className: "text-text-800 text-2xs", children: "Resposta correta: F" })
4866
+ ] })
4867
+ ]
4868
+ },
4869
+ option.label.concat(`-${index}`)
4870
+ );
4871
+ }) }) })
4872
+ ] });
4873
+ };
4874
+ var QuizConnectDots = ({
4875
+ variant = "default",
4876
+ paddingBottom
4877
+ }) => {
4878
+ const dotsOptions = [
4879
+ { label: "Ra\xE7\xE3o" },
4880
+ { label: "Rato" },
4881
+ { label: "Grama" },
4882
+ { label: "Peixe" }
4883
+ ];
4884
+ const options = [
4885
+ {
4886
+ label: "Cachorro",
4887
+ correctOption: "Ra\xE7\xE3o"
4888
+ },
4889
+ {
4890
+ label: "Gato",
4891
+ correctOption: "Rato"
4892
+ },
4893
+ {
4894
+ label: "Cabra",
4895
+ correctOption: "Grama"
4896
+ },
4897
+ {
4898
+ label: "Baleia",
4899
+ correctOption: "Peixe"
4900
+ }
4901
+ ];
4902
+ const mockUserAnswers = [
4903
+ {
4904
+ option: "Cachorro",
4905
+ dotOption: "Ra\xE7\xE3o",
4906
+ correctOption: "Ra\xE7\xE3o",
4907
+ isCorrect: true
4908
+ },
4909
+ {
4910
+ option: "Gato",
4911
+ dotOption: "Rato",
4912
+ correctOption: "Rato",
4913
+ isCorrect: true
4914
+ },
4915
+ {
4916
+ option: "Cabra",
4917
+ dotOption: "Peixe",
4918
+ correctOption: "Grama",
4919
+ isCorrect: false
4920
+ },
4921
+ {
4922
+ option: "Baleia",
4923
+ dotOption: "Grama",
4924
+ correctOption: "Peixe",
4925
+ isCorrect: false
4926
+ }
4927
+ ];
4928
+ const [userAnswers, setUserAnswers] = useState7(() => {
4929
+ if (variant === "result") {
4930
+ return mockUserAnswers;
4931
+ }
4932
+ return options.map((option) => ({
4933
+ option: option.label,
4934
+ dotOption: null,
4935
+ correctOption: option.correctOption,
4936
+ isCorrect: null
4937
+ }));
4938
+ });
4939
+ const handleSelectDot = (optionIndex, dotValue) => {
4940
+ setUserAnswers((prev) => {
4941
+ const next = [...prev];
4942
+ const { label: optionLabel, correctOption } = options[optionIndex];
4943
+ next[optionIndex] = {
4944
+ option: optionLabel,
4945
+ dotOption: dotValue,
4946
+ correctOption,
4947
+ isCorrect: dotValue ? dotValue === correctOption : null
4948
+ };
4949
+ return next;
4950
+ });
4951
+ };
4952
+ const getLetterByIndex = (index) => String.fromCharCode(97 + index);
4953
+ const isDefaultVariant = variant === "default";
4954
+ const assignedDots = new Set(
4955
+ userAnswers.map((a) => a.dotOption).filter(Boolean)
4956
+ );
4957
+ return /* @__PURE__ */ jsxs14(Fragment6, { children: [
4958
+ /* @__PURE__ */ jsx17(QuizSubTitle, { subTitle: "Alternativas" }),
4959
+ /* @__PURE__ */ jsx17(QuizContainer, { className: cn("", paddingBottom), children: /* @__PURE__ */ jsx17("div", { className: "flex flex-col gap-3.5", children: options.map((option, index) => {
4960
+ const answer = userAnswers[index];
4961
+ const variantCorrect = answer.isCorrect ? "correct" : "incorrect";
4962
+ return /* @__PURE__ */ jsxs14("section", { className: "flex flex-col gap-2", children: [
4963
+ /* @__PURE__ */ jsxs14(
4964
+ "div",
4965
+ {
4966
+ className: cn(
4967
+ "flex flex-row justify-between items-center gap-2 p-2 rounded-md",
4968
+ !isDefaultVariant ? getStatusStyles(variantCorrect) : ""
4969
+ ),
4970
+ children: [
4971
+ /* @__PURE__ */ jsx17("p", { className: "text-text-900 text-sm", children: getLetterByIndex(index) + ") " + option.label }),
4972
+ isDefaultVariant ? /* @__PURE__ */ jsxs14(
4973
+ Select_default,
4974
+ {
4975
+ size: "medium",
4976
+ value: answer.dotOption || void 0,
4977
+ onValueChange: (value) => handleSelectDot(index, value),
4978
+ children: [
4979
+ /* @__PURE__ */ jsx17(SelectTrigger, { className: "w-[180px]", children: /* @__PURE__ */ jsx17(SelectValue, { placeholder: "Selecione op\xE7\xE3o" }) }),
4980
+ /* @__PURE__ */ jsx17(SelectContent, { children: dotsOptions.filter(
4981
+ (dot) => !assignedDots.has(dot.label) || answer.dotOption === dot.label
4982
+ ).map((dot) => /* @__PURE__ */ jsx17(SelectItem, { value: dot.label, children: dot.label }, dot.label)) })
4983
+ ]
4984
+ }
4985
+ ) : /* @__PURE__ */ jsx17("div", { className: "flex-shrink-0", children: answer.isCorrect === null ? null : getStatusBadge(variantCorrect) })
4986
+ ]
4987
+ }
4988
+ ),
4989
+ !isDefaultVariant && /* @__PURE__ */ jsxs14("span", { className: "flex flex-row gap-2 items-center", children: [
4990
+ /* @__PURE__ */ jsxs14("p", { className: "text-text-800 text-2xs", children: [
4991
+ "Resposta selecionada: ",
4992
+ answer.dotOption || "Nenhuma"
4993
+ ] }),
4994
+ !answer.isCorrect && /* @__PURE__ */ jsxs14("p", { className: "text-text-800 text-2xs", children: [
4995
+ "Resposta correta: ",
4996
+ answer.correctOption
4997
+ ] })
4998
+ ] })
4999
+ ] }, option.label);
5000
+ }) }) })
5001
+ ] });
5002
+ };
5003
+ var QuizFill = ({
5004
+ variant = "default",
5005
+ paddingBottom = "pb-[80px]"
5006
+ }) => {
5007
+ const options = [
5008
+ "ci\xEAncia",
5009
+ "disciplina",
5010
+ "\xE1rea",
5011
+ "especialidade",
5012
+ "varia\xE7\xF5es"
5013
+ ];
5014
+ const exampleText = `A meteorologia \xE9 a {{ciencia}} que estuda os fen\xF4menos atmosf\xE9ricos e suas {{varia\xE7\xF5es}}. Esta disciplina cient\xEDfica tem como objetivo principal {{objetivo}} o comportamento da atmosfera terrestre.
5015
+
5016
+ Os meteorologistas utilizam diversos {{instrumentos}} para coletar dados atmosf\xE9ricos, incluindo term\xF4metros, bar\xF4metros e {{equipamentos}} modernos como radares meteorol\xF3gicos.`;
5017
+ const mockUserAnswers = [
5018
+ {
5019
+ selectId: "ciencia",
5020
+ userAnswer: "tecnologia",
5021
+ correctAnswer: "ci\xEAncia",
5022
+ isCorrect: false
5023
+ },
5024
+ {
5025
+ selectId: "varia\xE7\xF5es",
5026
+ userAnswer: "varia\xE7\xF5es",
5027
+ correctAnswer: "varia\xE7\xF5es",
5028
+ isCorrect: true
5029
+ },
5030
+ {
5031
+ selectId: "objetivo",
5032
+ userAnswer: "estudar",
5033
+ correctAnswer: "compreender",
5034
+ isCorrect: false
5035
+ },
5036
+ {
5037
+ selectId: "instrumentos",
5038
+ userAnswer: "ferramentas",
5039
+ correctAnswer: "instrumentos",
5040
+ isCorrect: false
5041
+ },
5042
+ {
5043
+ selectId: "equipamentos",
5044
+ userAnswer: "equipamentos",
5045
+ correctAnswer: "equipamentos",
5046
+ isCorrect: true
5047
+ }
5048
+ ];
5049
+ const [answers, setAnswers] = useState7({});
5050
+ const baseId = useId7();
5051
+ const getAvailableOptionsForSelect = (selectId) => {
5052
+ const usedOptions = Object.entries(answers).filter(([key]) => key !== selectId).map(([, value]) => value);
5053
+ return options.filter((option) => !usedOptions.includes(option));
5054
+ };
5055
+ const handleSelectChange = (selectId, value) => {
5056
+ const newAnswers = { ...answers, [selectId]: value };
5057
+ setAnswers(newAnswers);
5058
+ };
5059
+ const renderResolutionElement = (selectId) => {
5060
+ const mockAnswer = mockUserAnswers.find(
5061
+ (answer) => answer.selectId === selectId
5062
+ );
5063
+ return /* @__PURE__ */ jsx17("p", { className: "inline-flex mb-2.5 text-success-600 font-semibold text-md border-b-2 border-success-600", children: mockAnswer?.correctAnswer });
5064
+ };
5065
+ const renderDefaultElement = (selectId, startIndex, selectedValue, availableOptionsForThisSelect) => {
5066
+ return /* @__PURE__ */ jsxs14(
5067
+ Select_default,
5068
+ {
5069
+ value: selectedValue,
5070
+ onValueChange: (value) => handleSelectChange(selectId, value),
5071
+ className: "inline-flex mb-2.5",
5072
+ children: [
5073
+ /* @__PURE__ */ jsx17(SelectTrigger, { className: "inline-flex w-auto min-w-[140px] h-8 mx-1 bg-white border-gray-300", children: /* @__PURE__ */ jsx17(SelectValue, { placeholder: "Selecione op\xE7\xE3o" }) }),
5074
+ /* @__PURE__ */ jsx17(SelectContent, { children: availableOptionsForThisSelect.map((option, index) => /* @__PURE__ */ jsx17(SelectItem, { value: option, children: option }, `${option}-${index}`)) })
5075
+ ]
5076
+ },
5077
+ `${selectId}-${startIndex}`
5078
+ );
5079
+ };
5080
+ const renderResultElement = (selectId) => {
5081
+ const mockAnswer = mockUserAnswers.find(
5082
+ (answer) => answer.selectId === selectId
5083
+ );
5084
+ if (!mockAnswer) return null;
5085
+ const action = mockAnswer.isCorrect ? "success" : "error";
5086
+ const icon = mockAnswer.isCorrect ? /* @__PURE__ */ jsx17(CheckCircle4, {}) : /* @__PURE__ */ jsx17(XCircle4, {});
5087
+ return /* @__PURE__ */ jsx17(
5088
+ Badge_default,
5089
+ {
5090
+ variant: "solid",
5091
+ action,
5092
+ iconRight: icon,
5093
+ size: "large",
5094
+ className: "py-3 w-[180px] justify-between mb-2.5",
5095
+ children: /* @__PURE__ */ jsx17("span", { className: "text-text-900", children: mockAnswer.userAnswer })
5096
+ },
5097
+ selectId
5098
+ );
5099
+ };
5100
+ const renderTextWithSelects = (text, isResolution) => {
5101
+ const elements = [];
5102
+ let lastIndex = 0;
5103
+ let elementCounter = 0;
5104
+ const regex = /\{\{([\p{L}\p{M}\d_]+)\}\}/gu;
5105
+ let match;
5106
+ while ((match = regex.exec(text)) !== null) {
5107
+ const [fullMatch, selectId] = match;
5108
+ const startIndex = match.index;
5109
+ if (startIndex > lastIndex) {
5110
+ elements.push({
5111
+ element: text.slice(lastIndex, startIndex),
5112
+ id: `${baseId}-text-${++elementCounter}`
5113
+ });
5114
+ }
5115
+ const selectedValue = answers[selectId];
5116
+ const availableOptionsForThisSelect = getAvailableOptionsForSelect(selectId);
5117
+ if (isResolution) {
5118
+ elements.push({
5119
+ element: renderResolutionElement(selectId),
5120
+ id: `${baseId}-resolution-${++elementCounter}`
5121
+ });
5122
+ } else if (variant === "default") {
5123
+ elements.push({
5124
+ element: renderDefaultElement(
5125
+ selectId,
5126
+ startIndex,
5127
+ selectedValue,
5128
+ availableOptionsForThisSelect
5129
+ ),
5130
+ id: `${baseId}-select-${++elementCounter}`
5131
+ });
5132
+ } else {
5133
+ const resultElement = renderResultElement(selectId);
5134
+ if (resultElement) {
5135
+ elements.push({
5136
+ element: resultElement,
5137
+ id: `${baseId}-result-${++elementCounter}`
5138
+ });
5139
+ }
5140
+ }
5141
+ lastIndex = match.index + fullMatch.length;
5142
+ }
5143
+ if (lastIndex < text.length) {
5144
+ elements.push({
5145
+ element: text.slice(lastIndex),
5146
+ id: `${baseId}-text-${++elementCounter}`
5147
+ });
5148
+ }
5149
+ return elements;
5150
+ };
5151
+ return /* @__PURE__ */ jsxs14(Fragment6, { children: [
5152
+ /* @__PURE__ */ jsx17(QuizSubTitle, { subTitle: "Alternativas" }),
5153
+ /* @__PURE__ */ jsx17(QuizContainer, { className: "h-auto pb-0", children: /* @__PURE__ */ jsx17("div", { className: "space-y-6 px-4 h-auto", children: /* @__PURE__ */ jsx17(
5154
+ "div",
5155
+ {
5156
+ className: cn(
5157
+ "text-lg text-text-900 leading-8 h-auto",
5158
+ variant != "result" && paddingBottom
5159
+ ),
5160
+ children: renderTextWithSelects(exampleText).map((element) => /* @__PURE__ */ jsx17("span", { children: element.element }, element.id))
5161
+ }
5162
+ ) }) }),
5163
+ variant === "result" && /* @__PURE__ */ jsxs14(Fragment6, { children: [
5164
+ /* @__PURE__ */ jsx17(QuizSubTitle, { subTitle: "Resultado" }),
5165
+ /* @__PURE__ */ jsx17(QuizContainer, { className: "h-auto pb-0", children: /* @__PURE__ */ jsx17("div", { className: "space-y-6 px-4", children: /* @__PURE__ */ jsx17(
5166
+ "div",
5167
+ {
5168
+ className: cn("text-lg text-text-900 leading-8", paddingBottom),
5169
+ children: renderTextWithSelects(exampleText, true).map((element) => /* @__PURE__ */ jsx17("span", { children: element.element }, element.id))
5170
+ }
5171
+ ) }) })
5172
+ ] })
5173
+ ] });
4777
5174
  };
4778
5175
  var QuizQuestionList = ({
4779
5176
  filterType = "all",
@@ -5316,8 +5713,10 @@ var QuizListResultByMateria = ({
5316
5713
  export {
5317
5714
  Quiz,
5318
5715
  QuizAlternative,
5716
+ QuizConnectDots,
5319
5717
  QuizContent,
5320
5718
  QuizDissertative,
5719
+ QuizFill,
5321
5720
  QuizFooter,
5322
5721
  QuizHeader,
5323
5722
  QuizHeaderResult,
@@ -5328,6 +5727,8 @@ export {
5328
5727
  QuizResultHeaderTitle,
5329
5728
  QuizResultPerformance,
5330
5729
  QuizResultTitle,
5331
- QuizTitle
5730
+ QuizTitle,
5731
+ QuizTrueOrFalse,
5732
+ getStatusBadge
5332
5733
  };
5333
5734
  //# sourceMappingURL=index.mjs.map