analytica-frontend-lib 1.0.81 → 1.0.83

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.
Files changed (42) hide show
  1. package/dist/Accordation/index.js +76 -130
  2. package/dist/Accordation/index.js.map +1 -1
  3. package/dist/Accordation/index.mjs +76 -130
  4. package/dist/Accordation/index.mjs.map +1 -1
  5. package/dist/AlertDialog/index.js +1 -1
  6. package/dist/AlertDialog/index.js.map +1 -1
  7. package/dist/AlertDialog/index.mjs +1 -1
  8. package/dist/AlertDialog/index.mjs.map +1 -1
  9. package/dist/Card/index.d.mts +0 -3
  10. package/dist/Card/index.d.ts +0 -3
  11. package/dist/Card/index.js +76 -130
  12. package/dist/Card/index.js.map +1 -1
  13. package/dist/Card/index.mjs +76 -130
  14. package/dist/Card/index.mjs.map +1 -1
  15. package/dist/Modal/index.js +1 -1
  16. package/dist/Modal/index.js.map +1 -1
  17. package/dist/Modal/index.mjs +1 -1
  18. package/dist/Modal/index.mjs.map +1 -1
  19. package/dist/Quiz/index.d.mts +29 -0
  20. package/dist/Quiz/index.d.ts +29 -0
  21. package/dist/Quiz/index.js +3662 -0
  22. package/dist/Quiz/index.js.map +1 -0
  23. package/dist/Quiz/index.mjs +3673 -0
  24. package/dist/Quiz/index.mjs.map +1 -0
  25. package/dist/Quiz/useQuizStore/index.d.mts +108 -0
  26. package/dist/Quiz/useQuizStore/index.d.ts +108 -0
  27. package/dist/Quiz/useQuizStore/index.js +274 -0
  28. package/dist/Quiz/useQuizStore/index.js.map +1 -0
  29. package/dist/Quiz/useQuizStore/index.mjs +249 -0
  30. package/dist/Quiz/useQuizStore/index.mjs.map +1 -0
  31. package/dist/index.css +50 -3
  32. package/dist/index.css.map +1 -1
  33. package/dist/index.d.mts +2 -0
  34. package/dist/index.d.ts +2 -0
  35. package/dist/index.js +733 -132
  36. package/dist/index.js.map +1 -1
  37. package/dist/index.mjs +731 -132
  38. package/dist/index.mjs.map +1 -1
  39. package/dist/simulated-result-QN5HCUY5.png +0 -0
  40. package/dist/styles.css +50 -3
  41. package/dist/styles.css.map +1 -1
  42. package/package.json +2 -1
package/dist/index.mjs CHANGED
@@ -3070,7 +3070,7 @@ var Modal = ({
3070
3070
  };
3071
3071
  if (!isOpen) return null;
3072
3072
  const sizeClasses = SIZE_CLASSES10[size];
3073
- const baseClasses = "bg-background rounded-3xl shadow-hard-shadow-2 border border-border-100 w-full mx-4";
3073
+ const baseClasses = "bg-secondary-50 rounded-3xl shadow-hard-shadow-2 border border-border-100 w-full mx-4";
3074
3074
  const dialogResetClasses = "p-0 m-0 border-none outline-none max-h-none static";
3075
3075
  const modalClasses = `${baseClasses} ${sizeClasses} ${dialogResetClasses} ${className}`;
3076
3076
  return /* @__PURE__ */ jsx22(
@@ -3629,8 +3629,8 @@ var CardStatus = forwardRef9(
3629
3629
  ...props,
3630
3630
  children: /* @__PURE__ */ jsxs18("div", { className: "flex justify-between w-full h-full flex-row items-center gap-2", children: [
3631
3631
  /* @__PURE__ */ jsx23("p", { className: "text-sm font-bold text-text-950 truncate flex-1 min-w-0", children: header }),
3632
- status && /* @__PURE__ */ jsxs18("span", { className: "flex flex-row gap-1 items-center flex-shrink-0", children: [
3633
- /* @__PURE__ */ jsx23(
3632
+ /* @__PURE__ */ jsxs18("span", { className: "flex flex-row gap-1 items-center flex-shrink-0", children: [
3633
+ status && /* @__PURE__ */ jsx23(
3634
3634
  Badge_default,
3635
3635
  {
3636
3636
  action: status == "correct" ? "success" : "error",
@@ -4189,144 +4189,90 @@ var SIMULATION_TYPE_STYLES = {
4189
4189
  text: "Vestibular"
4190
4190
  }
4191
4191
  };
4192
- var CardSimulationHistory = forwardRef9(
4193
- ({
4194
- title = "Simulados",
4195
- activeTab = "history",
4196
- data,
4197
- onTabChange,
4198
- onSimulationClick,
4199
- className,
4200
- ...props
4201
- }, ref) => {
4202
- return /* @__PURE__ */ jsxs18(
4203
- "div",
4204
- {
4205
- ref,
4206
- className: `w-full max-w-[992px] h-auto ${className}`,
4207
- ...props,
4208
- children: [
4209
- /* @__PURE__ */ jsxs18("div", { className: "flex flex-row items-end justify-between gap-4 mb-4", children: [
4210
- /* @__PURE__ */ jsx23(Text_default, { size: "2xl", weight: "bold", className: "text-text-950 flex-1", children: title }),
4211
- /* @__PURE__ */ jsxs18("div", { className: "flex flex-row gap-2", children: [
4212
- /* @__PURE__ */ jsxs18(
4213
- "button",
4214
- {
4215
- type: "button",
4216
- onClick: () => onTabChange?.("create"),
4217
- className: `
4218
- flex flex-row justify-center items-center px-4 py-3 gap-2 rounded-md relative
4219
- ${activeTab === "create" ? "text-text-950" : "text-text-950 hover:bg-background-50"}
4220
- `,
4221
- children: [
4222
- /* @__PURE__ */ jsx23(Text_default, { size: "xs", weight: "bold", className: "leading-4 tracking-wide", children: "Criar Simulado" }),
4223
- activeTab === "create" && /* @__PURE__ */ jsx23("div", { className: "absolute bottom-0 left-2 right-2 h-1 bg-primary-950 rounded-lg" })
4224
- ]
4225
- }
4226
- ),
4227
- /* @__PURE__ */ jsxs18(
4228
- "button",
4229
- {
4230
- type: "button",
4231
- onClick: () => onTabChange?.("history"),
4232
- className: `
4233
- flex flex-row justify-center items-center px-4 py-3 gap-2 rounded-md relative
4234
- ${activeTab === "history" ? "text-text-950" : "text-text-950 hover:bg-background-50"}
4235
- `,
4236
- children: [
4237
- /* @__PURE__ */ jsx23(Text_default, { size: "xs", weight: "bold", className: "leading-4 tracking-wide", children: "Hist\xF3rico" }),
4238
- activeTab === "history" && /* @__PURE__ */ jsx23("div", { className: "absolute bottom-0 left-2 right-2 h-1 bg-primary-950 rounded-lg" })
4239
- ]
4240
- }
4241
- )
4242
- ] })
4243
- ] }),
4244
- /* @__PURE__ */ jsxs18("div", { className: "flex flex-col gap-0", children: [
4245
- data.map((section, sectionIndex) => /* @__PURE__ */ jsx23("div", { className: "flex flex-col", children: /* @__PURE__ */ jsxs18(
4246
- "div",
4247
- {
4248
- className: `
4192
+ var CardSimulationHistory = forwardRef9(({ data, onSimulationClick, className, ...props }, ref) => {
4193
+ return /* @__PURE__ */ jsx23(
4194
+ "div",
4195
+ {
4196
+ ref,
4197
+ className: `w-full max-w-[992px] h-auto ${className}`,
4198
+ ...props,
4199
+ children: /* @__PURE__ */ jsxs18("div", { className: "flex flex-col gap-0", children: [
4200
+ data.map((section, sectionIndex) => /* @__PURE__ */ jsx23("div", { className: "flex flex-col", children: /* @__PURE__ */ jsxs18(
4201
+ "div",
4202
+ {
4203
+ className: `
4249
4204
  flex flex-row justify-center items-start px-4 py-6 gap-2 w-full bg-white
4250
4205
  ${sectionIndex === 0 ? "rounded-t-3xl" : ""}
4251
4206
  `,
4252
- children: [
4253
- /* @__PURE__ */ jsx23(
4254
- Text_default,
4255
- {
4256
- size: "xs",
4257
- weight: "bold",
4258
- className: "text-text-800 w-11 flex-shrink-0",
4259
- children: section.date
4260
- }
4261
- ),
4262
- /* @__PURE__ */ jsx23("div", { className: "flex flex-col gap-2 flex-1", children: section.simulations.map((simulation) => {
4263
- const typeStyles = SIMULATION_TYPE_STYLES[simulation.type];
4264
- return /* @__PURE__ */ jsx23(
4265
- CardBase,
4266
- {
4267
- layout: "horizontal",
4268
- padding: "medium",
4269
- minHeight: "none",
4270
- cursor: "pointer",
4271
- className: `
4207
+ children: [
4208
+ /* @__PURE__ */ jsx23(
4209
+ Text_default,
4210
+ {
4211
+ size: "xs",
4212
+ weight: "bold",
4213
+ className: "text-text-800 w-11 flex-shrink-0",
4214
+ children: section.date
4215
+ }
4216
+ ),
4217
+ /* @__PURE__ */ jsx23("div", { className: "flex flex-col gap-2 flex-1", children: section.simulations.map((simulation) => {
4218
+ const typeStyles = SIMULATION_TYPE_STYLES[simulation.type];
4219
+ return /* @__PURE__ */ jsx23(
4220
+ CardBase,
4221
+ {
4222
+ layout: "horizontal",
4223
+ padding: "medium",
4224
+ minHeight: "none",
4225
+ cursor: "pointer",
4226
+ className: `
4272
4227
  ${typeStyles.background} rounded-xl hover:shadow-soft-shadow-2
4273
4228
  transition-shadow duration-200 h-auto min-h-[61px]
4274
4229
  `,
4275
- onClick: () => onSimulationClick?.(simulation),
4276
- children: /* @__PURE__ */ jsxs18("div", { className: "flex justify-between items-center w-full gap-2", children: [
4277
- /* @__PURE__ */ jsxs18("div", { className: "flex flex-col gap-2 flex-1 min-w-0", children: [
4278
- /* @__PURE__ */ jsx23(
4279
- Text_default,
4280
- {
4281
- size: "lg",
4282
- weight: "bold",
4283
- className: "text-text-950 truncate",
4284
- children: simulation.title
4285
- }
4286
- ),
4287
- /* @__PURE__ */ jsxs18("div", { className: "flex items-center gap-2", children: [
4288
- /* @__PURE__ */ jsx23(
4289
- Badge_default,
4290
- {
4291
- variant: "examsOutlined",
4292
- action: typeStyles.badge,
4293
- size: "medium",
4294
- children: typeStyles.text
4295
- }
4296
- ),
4297
- /* @__PURE__ */ jsx23(
4298
- Text_default,
4299
- {
4300
- size: "sm",
4301
- className: "text-text-800 truncate",
4302
- children: simulation.info
4303
- }
4304
- )
4305
- ] })
4306
- ] }),
4230
+ onClick: () => onSimulationClick?.(simulation),
4231
+ children: /* @__PURE__ */ jsxs18("div", { className: "flex justify-between items-center w-full gap-2", children: [
4232
+ /* @__PURE__ */ jsxs18("div", { className: "flex flex-col gap-2 flex-1 min-w-0", children: [
4233
+ /* @__PURE__ */ jsx23(
4234
+ Text_default,
4235
+ {
4236
+ size: "lg",
4237
+ weight: "bold",
4238
+ className: "text-text-950 truncate",
4239
+ children: simulation.title
4240
+ }
4241
+ ),
4242
+ /* @__PURE__ */ jsxs18("div", { className: "flex items-center gap-2", children: [
4307
4243
  /* @__PURE__ */ jsx23(
4308
- CaretRight,
4244
+ Badge_default,
4309
4245
  {
4310
- size: 24,
4311
- className: "text-text-800 flex-shrink-0",
4312
- "data-testid": "caret-icon"
4246
+ variant: "examsOutlined",
4247
+ action: typeStyles.badge,
4248
+ size: "medium",
4249
+ children: typeStyles.text
4313
4250
  }
4314
- )
4251
+ ),
4252
+ /* @__PURE__ */ jsx23(Text_default, { size: "sm", className: "text-text-800 truncate", children: simulation.info })
4315
4253
  ] })
4316
- },
4317
- simulation.id
4318
- );
4319
- }) })
4320
- ]
4321
- }
4322
- ) }, section.date)),
4323
- data.length > 0 && /* @__PURE__ */ jsx23("div", { className: "w-full h-6 bg-white rounded-b-3xl" })
4324
- ] })
4325
- ]
4326
- }
4327
- );
4328
- }
4329
- );
4254
+ ] }),
4255
+ /* @__PURE__ */ jsx23(
4256
+ CaretRight,
4257
+ {
4258
+ size: 24,
4259
+ className: "text-text-800 flex-shrink-0",
4260
+ "data-testid": "caret-icon"
4261
+ }
4262
+ )
4263
+ ] })
4264
+ },
4265
+ simulation.id
4266
+ );
4267
+ }) })
4268
+ ]
4269
+ }
4270
+ ) }, section.date)),
4271
+ data.length > 0 && /* @__PURE__ */ jsx23("div", { className: "w-full h-6 bg-white rounded-b-3xl" })
4272
+ ] })
4273
+ }
4274
+ );
4275
+ });
4330
4276
 
4331
4277
  // src/components/Accordation/Accordation.tsx
4332
4278
  import { CaretRight as CaretRight2 } from "phosphor-react";
@@ -4718,7 +4664,7 @@ var AlertDialog = forwardRef12(
4718
4664
  "h2",
4719
4665
  {
4720
4666
  id: "alert-dialog-title",
4721
- className: "pb-3 text-xl font-semibold",
4667
+ className: "pb-3 text-xl font-semibold text-text-950",
4722
4668
  children: title
4723
4669
  }
4724
4670
  ),
@@ -6300,6 +6246,651 @@ function useApiConfig(api) {
6300
6246
  [api]
6301
6247
  );
6302
6248
  }
6249
+
6250
+ // src/components/Quiz/Quiz.tsx
6251
+ import {
6252
+ CaretLeft as CaretLeft2,
6253
+ CaretRight as CaretRight4,
6254
+ Clock as Clock2,
6255
+ SquaresFour,
6256
+ BookOpen
6257
+ } from "phosphor-react";
6258
+ import { forwardRef as forwardRef17, useState as useState12 } from "react";
6259
+
6260
+ // src/components/Quiz/useQuizStore.ts
6261
+ import { create as create6 } from "zustand";
6262
+ import { devtools } from "zustand/middleware";
6263
+ var useQuizStore = create6()(
6264
+ devtools(
6265
+ (set, get) => {
6266
+ let timerInterval = null;
6267
+ const startTimer = () => {
6268
+ if (timerInterval) {
6269
+ clearInterval(timerInterval);
6270
+ }
6271
+ timerInterval = setInterval(() => {
6272
+ const { timeElapsed } = get();
6273
+ set({ timeElapsed: timeElapsed + 1 });
6274
+ }, 1e3);
6275
+ };
6276
+ const stopTimer = () => {
6277
+ if (timerInterval) {
6278
+ clearInterval(timerInterval);
6279
+ timerInterval = null;
6280
+ }
6281
+ };
6282
+ return {
6283
+ // Initial State
6284
+ currentQuestionIndex: 0,
6285
+ selectedAnswers: {},
6286
+ skippedQuestions: [],
6287
+ userAnswers: [],
6288
+ timeElapsed: 0,
6289
+ isStarted: false,
6290
+ isFinished: false,
6291
+ // Setters
6292
+ setBySimulado: (simulado) => set({ bySimulado: simulado }),
6293
+ setByAtividade: (atividade) => set({ byAtividade: atividade }),
6294
+ setByAula: (aula) => set({ byAula: aula }),
6295
+ // Navigation
6296
+ goToNextQuestion: () => {
6297
+ const { currentQuestionIndex, getTotalQuestions } = get();
6298
+ const totalQuestions = getTotalQuestions();
6299
+ if (currentQuestionIndex < totalQuestions - 1) {
6300
+ set({ currentQuestionIndex: currentQuestionIndex + 1 });
6301
+ }
6302
+ },
6303
+ goToPreviousQuestion: () => {
6304
+ const { currentQuestionIndex } = get();
6305
+ if (currentQuestionIndex > 0) {
6306
+ set({ currentQuestionIndex: currentQuestionIndex - 1 });
6307
+ }
6308
+ },
6309
+ goToQuestion: (index) => {
6310
+ const { getTotalQuestions } = get();
6311
+ const totalQuestions = getTotalQuestions();
6312
+ if (index >= 0 && index < totalQuestions) {
6313
+ set({ currentQuestionIndex: index });
6314
+ }
6315
+ },
6316
+ // Quiz Actions
6317
+ selectAnswer: (questionId, answerId) => {
6318
+ const { selectedAnswers, skippedQuestions, addUserAnswer } = get();
6319
+ const newSkippedQuestions = skippedQuestions.filter(
6320
+ (id) => id !== questionId
6321
+ );
6322
+ set({
6323
+ selectedAnswers: {
6324
+ ...selectedAnswers,
6325
+ [questionId]: answerId
6326
+ },
6327
+ skippedQuestions: newSkippedQuestions
6328
+ });
6329
+ addUserAnswer(questionId, answerId);
6330
+ },
6331
+ skipQuestion: () => {
6332
+ const { getCurrentQuestion, skippedQuestions, addUserAnswer } = get();
6333
+ const currentQuestion = getCurrentQuestion();
6334
+ if (currentQuestion) {
6335
+ set({
6336
+ skippedQuestions: [...skippedQuestions, currentQuestion.id]
6337
+ });
6338
+ addUserAnswer(currentQuestion.id);
6339
+ }
6340
+ },
6341
+ addUserAnswer: (questionId, answerId) => {
6342
+ const { userAnswers, bySimulado, byAtividade, byAula } = get();
6343
+ const quiz = bySimulado || byAtividade || byAula;
6344
+ const question = quiz?.questions.find((q) => q.id === questionId);
6345
+ if (!question) return;
6346
+ const existingAnswerIndex = userAnswers.findIndex(
6347
+ (answer) => answer.id === questionId
6348
+ );
6349
+ if (existingAnswerIndex !== -1) {
6350
+ const updatedAnswers = [...userAnswers];
6351
+ updatedAnswers[existingAnswerIndex] = {
6352
+ ...question,
6353
+ answerKey: answerId || "",
6354
+ isSkipped: !answerId
6355
+ };
6356
+ set({ userAnswers: updatedAnswers });
6357
+ } else {
6358
+ set({
6359
+ userAnswers: [
6360
+ ...userAnswers,
6361
+ {
6362
+ ...question,
6363
+ answerKey: answerId || "",
6364
+ isSkipped: !answerId
6365
+ }
6366
+ ]
6367
+ });
6368
+ }
6369
+ },
6370
+ startQuiz: () => {
6371
+ set({ isStarted: true, timeElapsed: 0 });
6372
+ startTimer();
6373
+ },
6374
+ finishQuiz: () => {
6375
+ set({ isFinished: true });
6376
+ stopTimer();
6377
+ },
6378
+ resetQuiz: () => {
6379
+ stopTimer();
6380
+ set({
6381
+ currentQuestionIndex: 0,
6382
+ selectedAnswers: {},
6383
+ skippedQuestions: [],
6384
+ userAnswers: [],
6385
+ timeElapsed: 0,
6386
+ isStarted: false,
6387
+ isFinished: false
6388
+ });
6389
+ },
6390
+ // Timer
6391
+ updateTime: (time) => set({ timeElapsed: time }),
6392
+ startTimer,
6393
+ stopTimer,
6394
+ // Getters
6395
+ getCurrentQuestion: () => {
6396
+ const { bySimulado, byAtividade, byAula, currentQuestionIndex } = get();
6397
+ const quiz = bySimulado || byAtividade || byAula;
6398
+ if (!quiz) {
6399
+ return null;
6400
+ }
6401
+ return quiz.questions[currentQuestionIndex];
6402
+ },
6403
+ getTotalQuestions: () => {
6404
+ const { bySimulado, byAtividade, byAula } = get();
6405
+ const quiz = bySimulado || byAtividade || byAula;
6406
+ return quiz?.questions?.length || 0;
6407
+ },
6408
+ getAnsweredQuestions: () => {
6409
+ const { selectedAnswers } = get();
6410
+ return Object.keys(selectedAnswers).length;
6411
+ },
6412
+ getUnansweredQuestions: () => {
6413
+ const {
6414
+ bySimulado,
6415
+ byAtividade,
6416
+ byAula,
6417
+ selectedAnswers,
6418
+ skippedQuestions
6419
+ } = get();
6420
+ const quiz = bySimulado || byAtividade || byAula;
6421
+ if (!quiz) return [];
6422
+ const unansweredQuestions = [];
6423
+ quiz.questions.forEach((question, index) => {
6424
+ const isAnswered = question.id in selectedAnswers;
6425
+ const isSkipped = skippedQuestions.includes(question.id);
6426
+ if (!isAnswered && !isSkipped) {
6427
+ unansweredQuestions.push(index + 1);
6428
+ }
6429
+ });
6430
+ return unansweredQuestions;
6431
+ },
6432
+ getSkippedQuestions: () => {
6433
+ const { skippedQuestions } = get();
6434
+ return skippedQuestions.length;
6435
+ },
6436
+ getProgress: () => {
6437
+ const { getTotalQuestions, getAnsweredQuestions } = get();
6438
+ const total = getTotalQuestions();
6439
+ const answered = getAnsweredQuestions();
6440
+ return total > 0 ? answered / total * 100 : 0;
6441
+ },
6442
+ isQuestionAnswered: (questionId) => {
6443
+ const { selectedAnswers } = get();
6444
+ return questionId in selectedAnswers;
6445
+ },
6446
+ isQuestionSkipped: (questionId) => {
6447
+ const { skippedQuestions } = get();
6448
+ return skippedQuestions.includes(questionId);
6449
+ },
6450
+ getCurrentAnswer: () => {
6451
+ const { getCurrentQuestion, selectedAnswers } = get();
6452
+ const currentQuestion = getCurrentQuestion();
6453
+ return selectedAnswers[currentQuestion?.id || ""];
6454
+ },
6455
+ getQuizTitle: () => {
6456
+ const { bySimulado, byAtividade, byAula } = get();
6457
+ const quiz = bySimulado || byAtividade || byAula;
6458
+ return quiz?.title || "Quiz";
6459
+ },
6460
+ formatTime: (seconds) => {
6461
+ const minutes = Math.floor(seconds / 60);
6462
+ const remainingSeconds = seconds % 60;
6463
+ return `${minutes.toString().padStart(2, "0")}:${remainingSeconds.toString().padStart(2, "0")}`;
6464
+ },
6465
+ getUserAnswers: () => {
6466
+ const { userAnswers } = get();
6467
+ return userAnswers;
6468
+ },
6469
+ getUnansweredQuestionsFromUserAnswers: () => {
6470
+ const { bySimulado, byAtividade, byAula, userAnswers } = get();
6471
+ const quiz = bySimulado || byAtividade || byAula;
6472
+ if (!quiz) return [];
6473
+ const unansweredQuestions = [];
6474
+ quiz.questions.forEach((question, index) => {
6475
+ const userAnswer = userAnswers.find(
6476
+ (answer) => answer.id === question.id
6477
+ );
6478
+ if (!userAnswer || userAnswer.isSkipped) {
6479
+ unansweredQuestions.push(index + 1);
6480
+ }
6481
+ });
6482
+ return unansweredQuestions;
6483
+ },
6484
+ getQuestionsGroupedBySubject: () => {
6485
+ const { bySimulado, byAtividade, byAula } = get();
6486
+ const quiz = bySimulado || byAtividade || byAula;
6487
+ if (!quiz) return {};
6488
+ const groupedQuestions = {};
6489
+ quiz.questions.forEach((question) => {
6490
+ const subjectId = question.knowledgeMatrix?.[0]?.subjectId || "Sem mat\xE9ria";
6491
+ if (!groupedQuestions[subjectId]) {
6492
+ groupedQuestions[subjectId] = [];
6493
+ }
6494
+ groupedQuestions[subjectId].push(question);
6495
+ });
6496
+ return groupedQuestions;
6497
+ }
6498
+ };
6499
+ },
6500
+ {
6501
+ name: "quiz-store"
6502
+ }
6503
+ )
6504
+ );
6505
+
6506
+ // src/assets/img/simulated-result.png
6507
+ var simulated_result_default = "./simulated-result-QN5HCUY5.png";
6508
+
6509
+ // src/components/Quiz/Quiz.tsx
6510
+ import { Fragment as Fragment8, jsx as jsx33, jsxs as jsxs27 } from "react/jsx-runtime";
6511
+ var Quiz = forwardRef17(({ children, className, ...props }, ref) => {
6512
+ return /* @__PURE__ */ jsx33(
6513
+ "div",
6514
+ {
6515
+ ref,
6516
+ className: `w-full max-w-[1000px] flex flex-col mx-auto h-full relative not-lg:px-6 ${className}`,
6517
+ ...props,
6518
+ children
6519
+ }
6520
+ );
6521
+ });
6522
+ var QuizTitle = forwardRef17(
6523
+ ({ className, ...props }, ref) => {
6524
+ const {
6525
+ currentQuestionIndex,
6526
+ getTotalQuestions,
6527
+ getQuizTitle,
6528
+ timeElapsed,
6529
+ formatTime,
6530
+ isStarted
6531
+ } = useQuizStore();
6532
+ const totalQuestions = getTotalQuestions();
6533
+ const quizTitle = getQuizTitle();
6534
+ return /* @__PURE__ */ jsxs27(
6535
+ "div",
6536
+ {
6537
+ ref,
6538
+ className: `flex flex-row justify-center items-center relative p-2 ${className}`,
6539
+ ...props,
6540
+ children: [
6541
+ /* @__PURE__ */ jsxs27("span", { className: "flex flex-col gap-2 text-center", children: [
6542
+ /* @__PURE__ */ jsx33("p", { className: "text-text-950 font-bold text-md", children: quizTitle }),
6543
+ /* @__PURE__ */ jsx33("p", { className: "text-text-600 text-xs", children: totalQuestions > 0 ? `${currentQuestionIndex + 1} de ${totalQuestions}` : "0 de 0" })
6544
+ ] }),
6545
+ /* @__PURE__ */ jsx33("span", { className: "absolute right-2", children: /* @__PURE__ */ jsx33(Badge_default, { variant: "outlined", action: "info", iconLeft: /* @__PURE__ */ jsx33(Clock2, {}), children: isStarted ? formatTime(timeElapsed) : "00:00" }) })
6546
+ ]
6547
+ }
6548
+ );
6549
+ }
6550
+ );
6551
+ var QuizHeader = () => {
6552
+ const { getCurrentQuestion } = useQuizStore();
6553
+ const currentQuestion = getCurrentQuestion();
6554
+ return /* @__PURE__ */ jsx33(
6555
+ HeaderAlternative,
6556
+ {
6557
+ title: currentQuestion ? `Quest\xE3o ${currentQuestion.id}` : "Quest\xE3o",
6558
+ subTitle: currentQuestion?.knowledgeMatrix?.[0]?.topicId ?? "",
6559
+ content: currentQuestion?.questionText ?? ""
6560
+ }
6561
+ );
6562
+ };
6563
+ var QuizContent = forwardRef17(({ type = "Alternativas", children, className, ...props }, ref) => {
6564
+ return /* @__PURE__ */ jsxs27(Fragment8, { children: [
6565
+ /* @__PURE__ */ jsx33("div", { className: "px-4 pb-2 pt-6", children: /* @__PURE__ */ jsx33("p", { className: "font-bold text-lg text-text-950", children: type }) }),
6566
+ /* @__PURE__ */ jsx33(
6567
+ "div",
6568
+ {
6569
+ ref,
6570
+ className: `rounded-t-xl bg-background px-4 pt-4 pb-[80px] h-full flex flex-col gap-4 mb-auto ${className}`,
6571
+ ...props,
6572
+ children
6573
+ }
6574
+ )
6575
+ ] });
6576
+ });
6577
+ var QuizAlternative = () => {
6578
+ const { getCurrentQuestion, selectAnswer, getCurrentAnswer } = useQuizStore();
6579
+ const currentQuestion = getCurrentQuestion();
6580
+ const currentAnswer = getCurrentAnswer();
6581
+ const alternatives = currentQuestion?.options?.map((option) => ({
6582
+ label: option.option,
6583
+ value: option.id
6584
+ }));
6585
+ if (!alternatives)
6586
+ return /* @__PURE__ */ jsx33("div", { children: /* @__PURE__ */ jsx33("p", { children: "N\xE3o h\xE1 Alternativas" }) });
6587
+ return /* @__PURE__ */ jsx33("div", { className: "space-y-4", children: /* @__PURE__ */ jsx33(
6588
+ AlternativesList,
6589
+ {
6590
+ name: `question-${currentQuestion?.id || "1"}`,
6591
+ layout: "default",
6592
+ alternatives,
6593
+ value: currentAnswer,
6594
+ onValueChange: (value) => {
6595
+ if (currentQuestion) {
6596
+ selectAnswer(currentQuestion.id, value);
6597
+ }
6598
+ }
6599
+ },
6600
+ `question-${currentQuestion?.id || "1"}`
6601
+ ) });
6602
+ };
6603
+ var QuizQuestionList = ({
6604
+ filterType = "all",
6605
+ onQuestionClick
6606
+ } = {}) => {
6607
+ const {
6608
+ getQuestionsGroupedBySubject,
6609
+ goToQuestion,
6610
+ isQuestionAnswered,
6611
+ isQuestionSkipped
6612
+ } = useQuizStore();
6613
+ const groupedQuestions = getQuestionsGroupedBySubject();
6614
+ const getQuestionStatus = (questionId) => {
6615
+ if (isQuestionSkipped(questionId)) {
6616
+ return "skipped";
6617
+ }
6618
+ if (isQuestionAnswered(questionId)) {
6619
+ return "answered";
6620
+ }
6621
+ return "unanswered";
6622
+ };
6623
+ const filteredGroupedQuestions = Object.entries(groupedQuestions).reduce(
6624
+ (acc, [subjectId, questions]) => {
6625
+ const filteredQuestions = questions.filter((question) => {
6626
+ const status = getQuestionStatus(question.id);
6627
+ switch (filterType) {
6628
+ case "answered":
6629
+ return status === "answered";
6630
+ case "unanswered":
6631
+ return status === "unanswered";
6632
+ default:
6633
+ return true;
6634
+ }
6635
+ });
6636
+ if (filteredQuestions.length > 0) {
6637
+ acc[subjectId] = filteredQuestions;
6638
+ }
6639
+ return acc;
6640
+ },
6641
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
6642
+ {}
6643
+ );
6644
+ const getQuestionIndex = (questionId) => {
6645
+ const { bySimulado, byAtividade, byAula } = useQuizStore.getState();
6646
+ const quiz = bySimulado ?? byAtividade ?? byAula;
6647
+ if (!quiz) return 0;
6648
+ const index = quiz.questions.findIndex((q) => q.id === questionId);
6649
+ return index + 1;
6650
+ };
6651
+ const getStatusLabel = (status) => {
6652
+ switch (status) {
6653
+ case "answered":
6654
+ return "Respondida";
6655
+ case "skipped":
6656
+ return "Pulada";
6657
+ default:
6658
+ return "Em branco";
6659
+ }
6660
+ };
6661
+ return /* @__PURE__ */ jsx33("div", { className: "space-y-6 px-4", children: Object.entries(filteredGroupedQuestions).map(
6662
+ ([subjectId, questions]) => /* @__PURE__ */ jsxs27("section", { className: "flex flex-col gap-2", children: [
6663
+ /* @__PURE__ */ jsxs27("span", { className: "pt-6 pb-4 flex flex-row gap-2", children: [
6664
+ /* @__PURE__ */ jsx33("div", { className: "bg-primary-500 p-1 rounded-sm flex items-center justify-center", children: /* @__PURE__ */ jsx33(BookOpen, { size: 17, className: "text-white" }) }),
6665
+ /* @__PURE__ */ jsx33("p", { className: "text-text-800 font-bold text-lg", children: subjectId })
6666
+ ] }),
6667
+ /* @__PURE__ */ jsx33("ul", { className: "flex flex-col gap-2", children: questions.map((question) => {
6668
+ const status = getQuestionStatus(question.id);
6669
+ const questionNumber = getQuestionIndex(question.id);
6670
+ return /* @__PURE__ */ jsx33(
6671
+ CardStatus,
6672
+ {
6673
+ header: `Quest\xE3o ${questionNumber.toString().padStart(2, "0")}`,
6674
+ label: getStatusLabel(status),
6675
+ onClick: () => {
6676
+ goToQuestion(questionNumber - 1);
6677
+ onQuestionClick?.();
6678
+ }
6679
+ },
6680
+ question.id
6681
+ );
6682
+ }) })
6683
+ ] }, subjectId)
6684
+ ) });
6685
+ };
6686
+ var QuizFooter = forwardRef17(({ className, onGoToSimulated, onDetailResult, ...props }, ref) => {
6687
+ const {
6688
+ currentQuestionIndex,
6689
+ getUserAnswers,
6690
+ getTotalQuestions,
6691
+ goToNextQuestion,
6692
+ goToPreviousQuestion,
6693
+ getUnansweredQuestionsFromUserAnswers,
6694
+ getCurrentAnswer,
6695
+ skipQuestion,
6696
+ getCurrentQuestion,
6697
+ isQuestionSkipped
6698
+ } = useQuizStore();
6699
+ const totalQuestions = getTotalQuestions();
6700
+ const isFirstQuestion = currentQuestionIndex === 0;
6701
+ const isLastQuestion = currentQuestionIndex === totalQuestions - 1;
6702
+ const currentAnswer = getCurrentAnswer();
6703
+ const currentQuestion = getCurrentQuestion();
6704
+ const isCurrentQuestionSkipped = currentQuestion ? isQuestionSkipped(currentQuestion.id) : false;
6705
+ const [alertDialogOpen, setAlertDialogOpen] = useState12(false);
6706
+ const [modalResultOpen, setModalResultOpen] = useState12(false);
6707
+ const [modalNavigateOpen, setModalNavigateOpen] = useState12(false);
6708
+ const [filterType, setFilterType] = useState12("all");
6709
+ const unansweredQuestions = getUnansweredQuestionsFromUserAnswers();
6710
+ const userAnswers = getUserAnswers();
6711
+ const allQuestions = getTotalQuestions();
6712
+ return /* @__PURE__ */ jsxs27(Fragment8, { children: [
6713
+ /* @__PURE__ */ jsxs27(
6714
+ "footer",
6715
+ {
6716
+ ref,
6717
+ className: `w-full px-2 bg-background lg:max-w-[1000px] not-lg:max-w-[calc(100vw-32px)] border-t border-border-50 fixed bottom-0 min-h-[80px] flex flex-row justify-between items-center ${className}`,
6718
+ ...props,
6719
+ children: [
6720
+ /* @__PURE__ */ jsxs27("div", { className: "flex flex-row items-center gap-1", children: [
6721
+ /* @__PURE__ */ jsx33(
6722
+ IconButton_default,
6723
+ {
6724
+ icon: /* @__PURE__ */ jsx33(SquaresFour, { size: 24, className: "text-text-950" }),
6725
+ size: "md",
6726
+ onClick: () => setModalNavigateOpen(true)
6727
+ }
6728
+ ),
6729
+ isFirstQuestion ? /* @__PURE__ */ jsx33(
6730
+ Button_default,
6731
+ {
6732
+ variant: "outline",
6733
+ size: "small",
6734
+ onClick: () => {
6735
+ skipQuestion();
6736
+ goToNextQuestion();
6737
+ },
6738
+ children: "Pular"
6739
+ }
6740
+ ) : /* @__PURE__ */ jsx33(
6741
+ Button_default,
6742
+ {
6743
+ size: "medium",
6744
+ variant: "link",
6745
+ action: "primary",
6746
+ iconLeft: /* @__PURE__ */ jsx33(CaretLeft2, { size: 18 }),
6747
+ onClick: () => {
6748
+ goToPreviousQuestion();
6749
+ },
6750
+ children: "Voltar"
6751
+ }
6752
+ )
6753
+ ] }),
6754
+ !isFirstQuestion && /* @__PURE__ */ jsx33(
6755
+ Button_default,
6756
+ {
6757
+ size: "small",
6758
+ variant: "outline",
6759
+ action: "primary",
6760
+ onClick: () => {
6761
+ skipQuestion();
6762
+ goToNextQuestion();
6763
+ },
6764
+ children: "Pular"
6765
+ }
6766
+ ),
6767
+ isLastQuestion ? /* @__PURE__ */ jsx33(
6768
+ Button_default,
6769
+ {
6770
+ size: "medium",
6771
+ variant: "solid",
6772
+ action: "primary",
6773
+ disabled: !currentAnswer && !isCurrentQuestionSkipped,
6774
+ onClick: () => {
6775
+ if (unansweredQuestions.length > 0) {
6776
+ setAlertDialogOpen(true);
6777
+ } else {
6778
+ setModalResultOpen(true);
6779
+ }
6780
+ },
6781
+ children: "Finalizar"
6782
+ }
6783
+ ) : /* @__PURE__ */ jsx33(
6784
+ Button_default,
6785
+ {
6786
+ size: "medium",
6787
+ variant: "link",
6788
+ action: "primary",
6789
+ iconRight: /* @__PURE__ */ jsx33(CaretRight4, { size: 18 }),
6790
+ disabled: !currentAnswer && !isCurrentQuestionSkipped,
6791
+ onClick: () => {
6792
+ goToNextQuestion();
6793
+ },
6794
+ children: "Avan\xE7ar"
6795
+ }
6796
+ )
6797
+ ]
6798
+ }
6799
+ ),
6800
+ /* @__PURE__ */ jsx33(
6801
+ AlertDialog,
6802
+ {
6803
+ isOpen: alertDialogOpen,
6804
+ onChangeOpen: setAlertDialogOpen,
6805
+ title: "Finalizar simulado?",
6806
+ 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?",
6807
+ cancelButtonLabel: "Voltar e revisar",
6808
+ submitButtonLabel: "Finalizar Mesmo Assim",
6809
+ onSubmit: () => {
6810
+ setModalResultOpen(true);
6811
+ }
6812
+ }
6813
+ ),
6814
+ /* @__PURE__ */ jsx33(
6815
+ Modal_default,
6816
+ {
6817
+ isOpen: modalResultOpen,
6818
+ onClose: () => setModalResultOpen(false),
6819
+ title: "",
6820
+ closeOnBackdropClick: false,
6821
+ closeOnEscape: false,
6822
+ hideCloseButton: true,
6823
+ size: "md",
6824
+ children: /* @__PURE__ */ jsxs27("div", { className: "flex flex-col w-full h-full items-center justify-center gap-4", children: [
6825
+ /* @__PURE__ */ jsx33(
6826
+ "img",
6827
+ {
6828
+ src: simulated_result_default,
6829
+ alt: "Simulated Result",
6830
+ className: "w-[282px] h-auto object-cover"
6831
+ }
6832
+ ),
6833
+ /* @__PURE__ */ jsxs27("div", { className: "flex flex-col gap-2 text-center", children: [
6834
+ /* @__PURE__ */ jsx33("h2", { className: "text-text-950 font-bold text-lg", children: "Voc\xEA concluiu o simulado!" }),
6835
+ /* @__PURE__ */ jsxs27("p", { className: "text-text-500 font-sm", children: [
6836
+ "Voc\xEA acertou",
6837
+ " ",
6838
+ userAnswers.filter(
6839
+ (answer) => answer.answerKey === answer.correctOptionId
6840
+ ).length,
6841
+ " ",
6842
+ "de ",
6843
+ allQuestions,
6844
+ " quest\xF5es."
6845
+ ] })
6846
+ ] }),
6847
+ /* @__PURE__ */ jsxs27("div", { className: "px-6 flex flex-row items-center gap-2 w-full", children: [
6848
+ /* @__PURE__ */ jsx33(
6849
+ Button_default,
6850
+ {
6851
+ variant: "outline",
6852
+ className: "w-full",
6853
+ size: "small",
6854
+ onClick: onGoToSimulated,
6855
+ children: "Ir para simulados"
6856
+ }
6857
+ ),
6858
+ /* @__PURE__ */ jsx33(Button_default, { className: "w-full", onClick: onDetailResult, children: "Detalhar resultado" })
6859
+ ] })
6860
+ ] })
6861
+ }
6862
+ ),
6863
+ /* @__PURE__ */ jsx33(
6864
+ Modal_default,
6865
+ {
6866
+ isOpen: modalNavigateOpen,
6867
+ onClose: () => setModalNavigateOpen(false),
6868
+ title: "Quest\xF5es",
6869
+ size: "lg",
6870
+ children: /* @__PURE__ */ jsxs27("div", { className: "flex flex-col w-full h-full", children: [
6871
+ /* @__PURE__ */ jsxs27("div", { className: "flex flex-row justify-between items-center py-6 pt-6 pb-4 border-b border-border-200", children: [
6872
+ /* @__PURE__ */ jsx33("p", { className: "text-text-950 font-bold text-lg", children: "Filtrar por" }),
6873
+ /* @__PURE__ */ jsx33("span", { className: "max-w-[266px]", children: /* @__PURE__ */ jsxs27(Select_default, { value: filterType, onValueChange: setFilterType, children: [
6874
+ /* @__PURE__ */ jsx33(SelectTrigger, { variant: "rounded", className: "max-w-[266px]", children: /* @__PURE__ */ jsx33(SelectValue, { placeholder: "Selecione uma op\xE7\xE3o" }) }),
6875
+ /* @__PURE__ */ jsxs27(SelectContent, { children: [
6876
+ /* @__PURE__ */ jsx33(SelectItem, { value: "all", children: "Todas" }),
6877
+ /* @__PURE__ */ jsx33(SelectItem, { value: "unanswered", children: "Em branco" }),
6878
+ /* @__PURE__ */ jsx33(SelectItem, { value: "answered", children: "Respondidas" })
6879
+ ] })
6880
+ ] }) })
6881
+ ] }),
6882
+ /* @__PURE__ */ jsx33("div", { className: "flex flex-col gap-2 not-lg:h-[calc(100vh-200px)] lg:max-h-[687px] overflow-y-auto", children: /* @__PURE__ */ jsx33(
6883
+ QuizQuestionList,
6884
+ {
6885
+ filterType,
6886
+ onQuestionClick: () => setModalNavigateOpen(false)
6887
+ }
6888
+ ) })
6889
+ ] })
6890
+ }
6891
+ )
6892
+ ] });
6893
+ });
6303
6894
  export {
6304
6895
  Alert_default as Alert,
6305
6896
  AlertDialog,
@@ -6346,6 +6937,13 @@ export {
6346
6937
  ProgressCircle_default as ProgressCircle,
6347
6938
  ProtectedRoute,
6348
6939
  PublicRoute,
6940
+ Quiz,
6941
+ QuizAlternative,
6942
+ QuizContent,
6943
+ QuizFooter,
6944
+ QuizHeader,
6945
+ QuizQuestionList,
6946
+ QuizTitle,
6349
6947
  Radio_default as Radio,
6350
6948
  RadioGroup,
6351
6949
  RadioGroupItem,
@@ -6374,6 +6972,7 @@ export {
6374
6972
  useApiConfig,
6375
6973
  useAuth,
6376
6974
  useAuthGuard,
6975
+ useQuizStore,
6377
6976
  useRouteAuth,
6378
6977
  ToastStore_default as useToastStore,
6379
6978
  useUrlAuthentication,