analytica-frontend-lib 1.2.78 → 1.2.79

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 (45) hide show
  1. package/dist/ActivitiesHistory/index.js +485 -418
  2. package/dist/ActivitiesHistory/index.js.map +1 -1
  3. package/dist/ActivitiesHistory/index.mjs +478 -411
  4. package/dist/ActivitiesHistory/index.mjs.map +1 -1
  5. package/dist/RecommendedLessonsHistory/index.d.ts +1 -1
  6. package/dist/RecommendedLessonsHistory/index.d.ts.map +1 -1
  7. package/dist/RecommendedLessonsHistory/index.js +1183 -381
  8. package/dist/RecommendedLessonsHistory/index.js.map +1 -1
  9. package/dist/RecommendedLessonsHistory/index.mjs +1176 -372
  10. package/dist/RecommendedLessonsHistory/index.mjs.map +1 -1
  11. package/dist/SendActivityModal/SendActivityModal.d.ts.map +1 -1
  12. package/dist/SendActivityModal/SendActivityModal.js +4261 -4117
  13. package/dist/SendActivityModal/SendActivityModal.js.map +1 -1
  14. package/dist/SendActivityModal/SendActivityModal.mjs +4282 -4139
  15. package/dist/SendActivityModal/SendActivityModal.mjs.map +1 -1
  16. package/dist/SendActivityModal/hooks/useSendActivityModal.d.ts.map +1 -1
  17. package/dist/SendActivityModal/hooks/useSendActivityModal.js +16 -18
  18. package/dist/SendActivityModal/hooks/useSendActivityModal.js.map +1 -1
  19. package/dist/SendActivityModal/hooks/useSendActivityModal.mjs +16 -18
  20. package/dist/SendActivityModal/hooks/useSendActivityModal.mjs.map +1 -1
  21. package/dist/SendActivityModal/index.js +1285 -1141
  22. package/dist/SendActivityModal/index.js.map +1 -1
  23. package/dist/SendActivityModal/index.mjs +1164 -1021
  24. package/dist/SendActivityModal/index.mjs.map +1 -1
  25. package/dist/hooks/useGoalModels.d.ts +171 -0
  26. package/dist/hooks/useGoalModels.d.ts.map +1 -0
  27. package/dist/index.d.ts +9 -6
  28. package/dist/index.d.ts.map +1 -1
  29. package/dist/index.js +1864 -1716
  30. package/dist/index.js.map +1 -1
  31. package/dist/index.mjs +1896 -1765
  32. package/dist/index.mjs.map +1 -1
  33. package/dist/types/recommendedLessons/index.d.ts +61 -0
  34. package/dist/types/recommendedLessons/index.d.ts.map +1 -1
  35. package/dist/types/recommendedLessons/index.js +7 -0
  36. package/dist/types/recommendedLessons/index.js.map +1 -1
  37. package/dist/types/recommendedLessons/index.mjs +6 -0
  38. package/dist/types/recommendedLessons/index.mjs.map +1 -1
  39. package/dist/types/recommendedLessons.d.ts +61 -0
  40. package/dist/types/recommendedLessons.d.ts.map +1 -1
  41. package/dist/utils/extractStudentsFromCategories.d.ts +15 -0
  42. package/dist/utils/extractStudentsFromCategories.d.ts.map +1 -0
  43. package/dist/utils/renderSubjectCell.d.ts +11 -0
  44. package/dist/utils/renderSubjectCell.d.ts.map +1 -0
  45. package/package.json +3 -2
@@ -324,8 +324,8 @@ var injectStore = (children, store) => import_react.Children.map(children, (chil
324
324
  });
325
325
 
326
326
  // src/components/ActivitiesHistory/tabs/HistoryTab.tsx
327
- var import_react22 = require("react");
328
- var import_phosphor_react16 = require("phosphor-react");
327
+ var import_react23 = require("react");
328
+ var import_phosphor_react18 = require("phosphor-react");
329
329
 
330
330
  // src/components/Button/Button.tsx
331
331
  var import_jsx_runtime3 = require("react/jsx-runtime");
@@ -432,7 +432,7 @@ var EmptyState = ({
432
432
  var EmptyState_default = EmptyState;
433
433
 
434
434
  // src/components/TableProvider/TableProvider.tsx
435
- var import_react21 = require("react");
435
+ var import_react22 = require("react");
436
436
 
437
437
  // src/components/Table/Table.tsx
438
438
  var import_react3 = require("react");
@@ -2530,7 +2530,7 @@ Search.displayName = "Search";
2530
2530
  var Search_default = Search;
2531
2531
 
2532
2532
  // src/components/CheckBoxGroup/CheckBoxGroup.tsx
2533
- var import_react20 = require("react");
2533
+ var import_react21 = require("react");
2534
2534
 
2535
2535
  // src/components/Badge/Badge.tsx
2536
2536
  var import_phosphor_react8 = require("phosphor-react");
@@ -5495,8 +5495,320 @@ var mapApiStatusToDisplay = (apiStatus) => {
5495
5495
  return statusMap[apiStatus];
5496
5496
  };
5497
5497
 
5498
- // src/hooks/useActivitiesHistory.ts
5498
+ // src/components/shared/ModelsTabBase/ModelsTabBase.tsx
5499
5499
  var import_react18 = require("react");
5500
+ var import_phosphor_react14 = require("phosphor-react");
5501
+
5502
+ // src/components/ActivitiesHistory/components/ErrorDisplay.tsx
5503
+ var import_jsx_runtime33 = require("react/jsx-runtime");
5504
+ var ErrorDisplay = ({ error }) => /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { className: "flex items-center justify-center bg-background rounded-xl w-full min-h-[705px]", children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(Text_default, { size: "lg", color: "text-error-500", children: error }) });
5505
+
5506
+ // src/components/shared/ModelsTabBase/ModelsTabBase.tsx
5507
+ var import_jsx_runtime34 = require("react/jsx-runtime");
5508
+ var ModelsTabBase = ({
5509
+ fetchModels: fetchModelsProp,
5510
+ deleteModel: deleteModelProp,
5511
+ onCreateModel,
5512
+ onSend,
5513
+ onEditModel,
5514
+ emptyStateImage,
5515
+ noSearchImage,
5516
+ mapSubjectNameToEnum,
5517
+ userFilterData,
5518
+ subjectsMap,
5519
+ config,
5520
+ createTableColumns,
5521
+ createFiltersConfig,
5522
+ buildFiltersFromParams,
5523
+ createUseModels
5524
+ }) => {
5525
+ const [deleteDialogOpen, setDeleteDialogOpen] = (0, import_react18.useState)(false);
5526
+ const [modelToDelete, setModelToDelete] = (0, import_react18.useState)(null);
5527
+ const { addToast } = useToast();
5528
+ const fetchModelsRef = (0, import_react18.useRef)(fetchModelsProp);
5529
+ fetchModelsRef.current = fetchModelsProp;
5530
+ const deleteModelRef = (0, import_react18.useRef)(deleteModelProp);
5531
+ deleteModelRef.current = deleteModelProp;
5532
+ const subjectsMapRef = (0, import_react18.useRef)(subjectsMap);
5533
+ subjectsMapRef.current = subjectsMap;
5534
+ const useModels = (0, import_react18.useMemo)(
5535
+ () => createUseModels(
5536
+ (filters) => fetchModelsRef.current(filters),
5537
+ (id) => deleteModelRef.current(id)
5538
+ ),
5539
+ [createUseModels]
5540
+ );
5541
+ const {
5542
+ models,
5543
+ loading: modelsLoading,
5544
+ error: modelsError,
5545
+ pagination: modelsPagination,
5546
+ fetchModels,
5547
+ deleteModel
5548
+ } = useModels();
5549
+ const modelsFilterConfigs = (0, import_react18.useMemo)(
5550
+ () => createFiltersConfig(userFilterData),
5551
+ [createFiltersConfig, userFilterData]
5552
+ );
5553
+ const handleDeleteClick = (0, import_react18.useCallback)((model) => {
5554
+ setModelToDelete(model);
5555
+ setDeleteDialogOpen(true);
5556
+ }, []);
5557
+ const modelsTableColumns = (0, import_react18.useMemo)(
5558
+ () => createTableColumns(
5559
+ mapSubjectNameToEnum,
5560
+ onSend,
5561
+ onEditModel,
5562
+ handleDeleteClick
5563
+ ),
5564
+ [
5565
+ createTableColumns,
5566
+ mapSubjectNameToEnum,
5567
+ onSend,
5568
+ onEditModel,
5569
+ handleDeleteClick
5570
+ ]
5571
+ );
5572
+ const handleParamsChange = (0, import_react18.useCallback)(
5573
+ (params) => {
5574
+ const filters = buildFiltersFromParams(params);
5575
+ fetchModels(filters, subjectsMapRef.current);
5576
+ },
5577
+ [buildFiltersFromParams, fetchModels]
5578
+ );
5579
+ (0, import_react18.useEffect)(() => {
5580
+ fetchModels({ page: 1, limit: 10 }, subjectsMapRef.current);
5581
+ }, [fetchModels]);
5582
+ const handleConfirmDelete = (0, import_react18.useCallback)(async () => {
5583
+ if (modelToDelete) {
5584
+ const success = await deleteModel(modelToDelete.id);
5585
+ if (success) {
5586
+ addToast({ title: "Modelo deletado com sucesso", action: "success" });
5587
+ fetchModels({ page: 1, limit: 10 }, subjectsMapRef.current);
5588
+ } else {
5589
+ addToast({ title: "Erro ao deletar modelo", action: "warning" });
5590
+ }
5591
+ }
5592
+ setDeleteDialogOpen(false);
5593
+ setModelToDelete(null);
5594
+ }, [modelToDelete, deleteModel, fetchModels, addToast]);
5595
+ const handleCancelDelete = (0, import_react18.useCallback)(() => {
5596
+ setDeleteDialogOpen(false);
5597
+ setModelToDelete(null);
5598
+ }, []);
5599
+ return /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(import_jsx_runtime34.Fragment, { children: [
5600
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(Toaster_default, {}),
5601
+ modelsError ? /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(ErrorDisplay, { error: modelsError }) : /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: "w-full", "data-testid": config.testId, children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
5602
+ TableProvider,
5603
+ {
5604
+ data: models,
5605
+ headers: modelsTableColumns,
5606
+ loading: modelsLoading,
5607
+ variant: "borderless",
5608
+ enableSearch: true,
5609
+ enableFilters: true,
5610
+ enableTableSort: true,
5611
+ enablePagination: true,
5612
+ initialFilters: modelsFilterConfigs,
5613
+ paginationConfig: {
5614
+ itemLabel: "modelos",
5615
+ itemsPerPageOptions: [10, 20, 50, 100],
5616
+ defaultItemsPerPage: 10,
5617
+ totalItems: modelsPagination.total,
5618
+ totalPages: modelsPagination.totalPages
5619
+ },
5620
+ searchPlaceholder: config.searchPlaceholder,
5621
+ noSearchResultState: {
5622
+ image: noSearchImage
5623
+ },
5624
+ emptyState: {
5625
+ component: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
5626
+ EmptyState_default,
5627
+ {
5628
+ image: emptyStateImage,
5629
+ title: config.emptyStateTitle,
5630
+ description: config.emptyStateDescription,
5631
+ buttonText: "Criar modelo",
5632
+ buttonIcon: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(import_phosphor_react14.Plus, { size: 18 }),
5633
+ buttonVariant: "outline",
5634
+ buttonAction: "primary",
5635
+ onButtonClick: onCreateModel
5636
+ }
5637
+ )
5638
+ },
5639
+ onParamsChange: handleParamsChange,
5640
+ children: (renderProps) => {
5641
+ const {
5642
+ controls,
5643
+ table,
5644
+ pagination: paginationComponent
5645
+ } = renderProps;
5646
+ return /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: "space-y-4", children: [
5647
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: "flex items-center justify-between gap-4", children: [
5648
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
5649
+ Button_default,
5650
+ {
5651
+ variant: "solid",
5652
+ action: "primary",
5653
+ size: "medium",
5654
+ onClick: onCreateModel,
5655
+ iconLeft: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(import_phosphor_react14.Plus, { size: 18, weight: "bold" }),
5656
+ children: "Criar modelo"
5657
+ }
5658
+ ),
5659
+ controls
5660
+ ] }),
5661
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: "bg-background rounded-xl p-6 space-y-4", children: [
5662
+ table,
5663
+ paginationComponent
5664
+ ] })
5665
+ ] });
5666
+ }
5667
+ }
5668
+ ) }),
5669
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
5670
+ AlertDialog,
5671
+ {
5672
+ isOpen: deleteDialogOpen,
5673
+ onChangeOpen: setDeleteDialogOpen,
5674
+ title: "Deletar modelo",
5675
+ description: `Tem certeza que deseja deletar o modelo "${modelToDelete?.title}"? Esta a\xE7\xE3o n\xE3o pode ser desfeita.`,
5676
+ submitButtonLabel: "Deletar",
5677
+ cancelButtonLabel: "Cancelar",
5678
+ onSubmit: handleConfirmDelete,
5679
+ onCancel: handleCancelDelete
5680
+ }
5681
+ )
5682
+ ] });
5683
+ };
5684
+
5685
+ // src/components/shared/ModelsTabBase/createModelsTableColumnsBase.tsx
5686
+ var import_phosphor_react15 = require("phosphor-react");
5687
+
5688
+ // src/utils/renderSubjectCell.tsx
5689
+ var import_jsx_runtime35 = require("react/jsx-runtime");
5690
+ var renderSubjectCell = (subjectName, mapSubjectNameToEnum, showEmptyDash = false) => {
5691
+ if (!subjectName) {
5692
+ return showEmptyDash ? /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(Text_default, { size: "sm", color: "text-text-400", children: "-" }) : null;
5693
+ }
5694
+ const subjectEnum = mapSubjectNameToEnum?.(subjectName);
5695
+ if (!subjectEnum) {
5696
+ return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(Text_default, { size: "sm", className: "truncate", title: subjectName, children: subjectName });
5697
+ }
5698
+ const subjectInfo = getSubjectInfo(subjectEnum);
5699
+ return /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: "flex items-center gap-2", title: subjectName, children: [
5700
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
5701
+ "span",
5702
+ {
5703
+ className: cn(
5704
+ "w-[21px] h-[21px] flex items-center justify-center rounded-sm text-text-950 shrink-0",
5705
+ subjectInfo.colorClass
5706
+ ),
5707
+ children: subjectInfo.icon
5708
+ }
5709
+ ),
5710
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(Text_default, { size: "sm", className: "truncate", children: subjectName })
5711
+ ] });
5712
+ };
5713
+
5714
+ // src/components/shared/ModelsTabBase/createModelsTableColumnsBase.tsx
5715
+ var import_jsx_runtime36 = require("react/jsx-runtime");
5716
+ var createModelsTableColumnsBase = (mapSubjectNameToEnum, onSend, onEdit, onDelete, config) => [
5717
+ {
5718
+ key: "title",
5719
+ label: "T\xEDtulo",
5720
+ sortable: true,
5721
+ className: "max-w-[400px]",
5722
+ render: (value) => {
5723
+ const title = typeof value === "string" ? value : "";
5724
+ return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(Text_default, { size: "sm", title, className: "truncate block", children: title });
5725
+ }
5726
+ },
5727
+ {
5728
+ key: "savedAt",
5729
+ label: "Salvo em",
5730
+ sortable: true,
5731
+ className: "w-[120px]"
5732
+ },
5733
+ {
5734
+ key: "subject",
5735
+ label: "Mat\xE9ria",
5736
+ sortable: true,
5737
+ className: "max-w-[160px]",
5738
+ render: (value) => {
5739
+ const subjectName = typeof value === "string" ? value : "";
5740
+ return renderSubjectCell(subjectName, mapSubjectNameToEnum, true);
5741
+ }
5742
+ },
5743
+ {
5744
+ key: "actions",
5745
+ label: "",
5746
+ sortable: false,
5747
+ className: "w-[220px]",
5748
+ render: (_value, row) => {
5749
+ const handleSend = (e) => {
5750
+ e.stopPropagation();
5751
+ onSend?.(row);
5752
+ };
5753
+ const handleEdit = (e) => {
5754
+ e.stopPropagation();
5755
+ onEdit?.(row);
5756
+ };
5757
+ const handleDelete = (e) => {
5758
+ e.stopPropagation();
5759
+ onDelete(row);
5760
+ };
5761
+ return /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: "flex items-center gap-2 justify-end", children: [
5762
+ onSend && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
5763
+ Button_default,
5764
+ {
5765
+ variant: "outline",
5766
+ action: "primary",
5767
+ size: "small",
5768
+ iconLeft: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(import_phosphor_react15.PaperPlaneTilt, { size: 16 }),
5769
+ onClick: handleSend,
5770
+ "aria-label": config.sendButtonAriaLabel,
5771
+ children: config.sendButtonLabel
5772
+ }
5773
+ ),
5774
+ /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
5775
+ IconButton_default,
5776
+ {
5777
+ icon: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(import_phosphor_react15.Trash, { size: 20 }),
5778
+ size: "md",
5779
+ onClick: handleDelete,
5780
+ "aria-label": config.deleteButtonAriaLabel,
5781
+ className: "text-text-600 hover:text-error-500 hover:bg-transparent"
5782
+ }
5783
+ ),
5784
+ onEdit && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
5785
+ IconButton_default,
5786
+ {
5787
+ icon: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(import_phosphor_react15.PencilSimple, { size: 20 }),
5788
+ size: "md",
5789
+ onClick: handleEdit,
5790
+ "aria-label": config.editButtonAriaLabel,
5791
+ className: "text-text-600 hover:text-primary-700 hover:bg-transparent"
5792
+ }
5793
+ )
5794
+ ] });
5795
+ }
5796
+ }
5797
+ ];
5798
+
5799
+ // src/utils/hookErrorHandler.ts
5800
+ var import_zod = require("zod");
5801
+ var createFetchErrorHandler = (validationErrorMessage, genericErrorMessage) => (error) => {
5802
+ if (error instanceof import_zod.z.ZodError) {
5803
+ console.error(validationErrorMessage, error);
5804
+ return validationErrorMessage;
5805
+ }
5806
+ console.error(genericErrorMessage, error);
5807
+ return genericErrorMessage;
5808
+ };
5809
+
5810
+ // src/hooks/useActivitiesHistory.ts
5811
+ var import_react19 = require("react");
5500
5812
  var import_zod2 = require("zod");
5501
5813
  var import_dayjs = __toESM(require("dayjs"));
5502
5814
 
@@ -5514,17 +5826,6 @@ var ACTIVITY_FILTER_STATUS_OPTIONS = [
5514
5826
  ];
5515
5827
  var mapActivityStatusToDisplay = (apiStatus) => mapApiStatusToDisplay(apiStatus);
5516
5828
 
5517
- // src/utils/hookErrorHandler.ts
5518
- var import_zod = require("zod");
5519
- var createFetchErrorHandler = (validationErrorMessage, genericErrorMessage) => (error) => {
5520
- if (error instanceof import_zod.z.ZodError) {
5521
- console.error(validationErrorMessage, error);
5522
- return validationErrorMessage;
5523
- }
5524
- console.error(genericErrorMessage, error);
5525
- return genericErrorMessage;
5526
- };
5527
-
5528
5829
  // src/hooks/useActivitiesHistory.ts
5529
5830
  var activityHistoryResponseSchema = import_zod2.z.object({
5530
5831
  id: import_zod2.z.string().uuid(),
@@ -5582,13 +5883,13 @@ var handleActivityFetchError = createFetchErrorHandler(
5582
5883
  );
5583
5884
  var createUseActivitiesHistory = (fetchActivitiesHistory) => {
5584
5885
  return () => {
5585
- const [state, setState] = (0, import_react18.useState)({
5886
+ const [state, setState] = (0, import_react19.useState)({
5586
5887
  activities: [],
5587
5888
  loading: false,
5588
5889
  error: null,
5589
5890
  pagination: DEFAULT_ACTIVITIES_PAGINATION
5590
5891
  });
5591
- const fetchActivities = (0, import_react18.useCallback)(
5892
+ const fetchActivities = (0, import_react19.useCallback)(
5592
5893
  async (filters) => {
5593
5894
  setState((prev) => ({ ...prev, loading: true, error: null }));
5594
5895
  try {
@@ -5622,7 +5923,7 @@ var createUseActivitiesHistory = (fetchActivitiesHistory) => {
5622
5923
  };
5623
5924
 
5624
5925
  // src/hooks/useActivityModels.ts
5625
- var import_react19 = require("react");
5926
+ var import_react20 = require("react");
5626
5927
  var import_zod3 = require("zod");
5627
5928
  var import_dayjs2 = __toESM(require("dayjs"));
5628
5929
  var activityDraftFiltersSchema = import_zod3.z.object({
@@ -5672,13 +5973,13 @@ var handleModelFetchError = createFetchErrorHandler(
5672
5973
  );
5673
5974
  var createUseActivityModels = (fetchActivityModels, deleteActivityModel) => {
5674
5975
  return () => {
5675
- const [state, setState] = (0, import_react19.useState)({
5976
+ const [state, setState] = (0, import_react20.useState)({
5676
5977
  models: [],
5677
5978
  loading: false,
5678
5979
  error: null,
5679
5980
  pagination: DEFAULT_MODELS_PAGINATION
5680
5981
  });
5681
- const fetchModels = (0, import_react19.useCallback)(
5982
+ const fetchModels = (0, import_react20.useCallback)(
5682
5983
  async (filters, subjectsMap) => {
5683
5984
  setState((prev) => ({ ...prev, loading: true, error: null }));
5684
5985
  try {
@@ -5713,7 +6014,7 @@ var createUseActivityModels = (fetchActivityModels, deleteActivityModel) => {
5713
6014
  },
5714
6015
  [fetchActivityModels]
5715
6016
  );
5716
- const deleteModel = (0, import_react19.useCallback)(
6017
+ const deleteModel = (0, import_react20.useCallback)(
5717
6018
  async (id) => {
5718
6019
  try {
5719
6020
  await deleteActivityModel(id);
@@ -5815,7 +6116,7 @@ var calculateFormattedItemsForAutoSelection = (category, allCategories) => {
5815
6116
  };
5816
6117
 
5817
6118
  // src/components/CheckBoxGroup/CheckBoxGroup.tsx
5818
- var import_jsx_runtime33 = require("react/jsx-runtime");
6119
+ var import_jsx_runtime37 = require("react/jsx-runtime");
5819
6120
  var CheckboxGroup = ({
5820
6121
  categories,
5821
6122
  onCategoriesChange,
@@ -5823,14 +6124,14 @@ var CheckboxGroup = ({
5823
6124
  showDivider = true,
5824
6125
  showSingleItem = false
5825
6126
  }) => {
5826
- const [openAccordion, setOpenAccordion] = (0, import_react20.useState)("");
5827
- const autoSelectionAppliedRef = (0, import_react20.useRef)(false);
5828
- const onCategoriesChangeRef = (0, import_react20.useRef)(onCategoriesChange);
5829
- const previousCategoriesRef = (0, import_react20.useRef)(categories);
5830
- (0, import_react20.useEffect)(() => {
6127
+ const [openAccordion, setOpenAccordion] = (0, import_react21.useState)("");
6128
+ const autoSelectionAppliedRef = (0, import_react21.useRef)(false);
6129
+ const onCategoriesChangeRef = (0, import_react21.useRef)(onCategoriesChange);
6130
+ const previousCategoriesRef = (0, import_react21.useRef)(categories);
6131
+ (0, import_react21.useEffect)(() => {
5831
6132
  onCategoriesChangeRef.current = onCategoriesChange;
5832
6133
  }, [onCategoriesChange]);
5833
- const categoriesWithAutoSelection = (0, import_react20.useMemo)(() => {
6134
+ const categoriesWithAutoSelection = (0, import_react21.useMemo)(() => {
5834
6135
  return categories.map((category) => {
5835
6136
  const filteredItems = calculateFormattedItemsForAutoSelection(
5836
6137
  category,
@@ -5845,7 +6146,7 @@ var CheckboxGroup = ({
5845
6146
  return category;
5846
6147
  });
5847
6148
  }, [categories]);
5848
- (0, import_react20.useEffect)(() => {
6149
+ (0, import_react21.useEffect)(() => {
5849
6150
  const categoriesChanged = categories !== previousCategoriesRef.current;
5850
6151
  if (!categoriesChanged && autoSelectionAppliedRef.current) {
5851
6152
  return;
@@ -5963,7 +6264,7 @@ var CheckboxGroup = ({
5963
6264
  );
5964
6265
  return groupedItems.length ? groupedItems : [{ itens: [] }];
5965
6266
  };
5966
- const formattedItemsMap = (0, import_react20.useMemo)(() => {
6267
+ const formattedItemsMap = (0, import_react21.useMemo)(() => {
5967
6268
  const formattedItemsMap2 = {};
5968
6269
  for (const category of categories) {
5969
6270
  const formattedItems = calculateFormattedItems(category.key);
@@ -6118,7 +6419,7 @@ var CheckboxGroup = ({
6118
6419
  };
6119
6420
  const renderCheckboxItem = (item, categoryKey) => {
6120
6421
  const uniqueId = `${categoryKey}-${item.id}`;
6121
- return /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(
6422
+ return /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(
6122
6423
  "div",
6123
6424
  {
6124
6425
  className: "flex items-center gap-3 px-2",
@@ -6128,7 +6429,7 @@ var CheckboxGroup = ({
6128
6429
  onMouseUp: (e) => e.stopPropagation(),
6129
6430
  onKeyDown: (e) => e.stopPropagation(),
6130
6431
  children: [
6131
- /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
6432
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
6132
6433
  CheckBox_default,
6133
6434
  {
6134
6435
  id: uniqueId,
@@ -6136,7 +6437,7 @@ var CheckboxGroup = ({
6136
6437
  onChange: () => toggleItem(categoryKey, item.id)
6137
6438
  }
6138
6439
  ),
6139
- /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
6440
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
6140
6441
  "label",
6141
6442
  {
6142
6443
  htmlFor: uniqueId,
@@ -6149,12 +6450,12 @@ var CheckboxGroup = ({
6149
6450
  item.id
6150
6451
  );
6151
6452
  };
6152
- const renderFormattedGroup = (formattedGroup, idx, categoryKey) => /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(
6453
+ const renderFormattedGroup = (formattedGroup, idx, categoryKey) => /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(
6153
6454
  "div",
6154
6455
  {
6155
6456
  className: "flex flex-col gap-3",
6156
6457
  children: [
6157
- "groupLabel" in formattedGroup && formattedGroup.groupLabel && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(Text_default, { size: "sm", className: "mt-2", weight: "semibold", children: formattedGroup.groupLabel }),
6458
+ "groupLabel" in formattedGroup && formattedGroup.groupLabel && /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(Text_default, { size: "sm", className: "mt-2", weight: "semibold", children: formattedGroup.groupLabel }),
6158
6459
  formattedGroup.itens?.map(
6159
6460
  (item) => renderCheckboxItem(item, categoryKey)
6160
6461
  )
@@ -6162,9 +6463,9 @@ var CheckboxGroup = ({
6162
6463
  },
6163
6464
  formattedGroup.groupLabel || `group-${idx}`
6164
6465
  );
6165
- const renderAccordionTrigger = (category, isEnabled) => /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className: "flex items-center justify-between w-full p-2", children: [
6166
- /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className: "flex items-center gap-3", children: [
6167
- /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
6466
+ const renderAccordionTrigger = (category, isEnabled) => /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { className: "flex items-center justify-between w-full p-2", children: [
6467
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { className: "flex items-center gap-3", children: [
6468
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
6168
6469
  CheckBox_default,
6169
6470
  {
6170
6471
  checked: isMinimalOneCheckBoxIsSelected(category.key),
@@ -6173,7 +6474,7 @@ var CheckboxGroup = ({
6173
6474
  onChange: () => toggleAllInCategory(category.key)
6174
6475
  }
6175
6476
  ),
6176
- /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
6477
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
6177
6478
  Text_default,
6178
6479
  {
6179
6480
  size: "sm",
@@ -6183,7 +6484,7 @@ var CheckboxGroup = ({
6183
6484
  }
6184
6485
  )
6185
6486
  ] }),
6186
- (openAccordion === category.key || isEnabled) && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(Badge_default, { variant: "solid", action: "info", children: getBadgeText2(category) })
6487
+ (openAccordion === category.key || isEnabled) && /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(Badge_default, { variant: "solid", action: "info", children: getBadgeText2(category) })
6187
6488
  ] });
6188
6489
  const renderCompactSingleItem = (category) => {
6189
6490
  const formattedItems = getFormattedItems(category.key);
@@ -6192,13 +6493,13 @@ var CheckboxGroup = ({
6192
6493
  return null;
6193
6494
  }
6194
6495
  const singleItem = allItems[0];
6195
- return /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(
6496
+ return /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(
6196
6497
  "div",
6197
6498
  {
6198
6499
  className: "flex items-center justify-between w-full px-3 py-2",
6199
6500
  children: [
6200
- /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(Text_default, { size: "sm", weight: "bold", className: "text-text-800", children: category.label }),
6201
- /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(Text_default, { size: "sm", className: "text-text-950", children: singleItem.name })
6501
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(Text_default, { size: "sm", weight: "bold", className: "text-text-800", children: category.label }),
6502
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(Text_default, { size: "sm", className: "text-text-950", children: singleItem.name })
6202
6503
  ]
6203
6504
  },
6204
6505
  category.key
@@ -6214,16 +6515,16 @@ var CheckboxGroup = ({
6214
6515
  const allItems = formattedItems.flatMap((group) => group.itens || []);
6215
6516
  const hasOnlyOneAvailableItem = allItems.length === 1;
6216
6517
  if (compactSingleItem && hasOnlyOneAvailableItem && isEnabled) {
6217
- return /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { children: [
6518
+ return /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { children: [
6218
6519
  renderCompactSingleItem(category),
6219
- showDivider && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(Divider_default, {})
6520
+ showDivider && /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(Divider_default, {})
6220
6521
  ] }, category.key);
6221
6522
  }
6222
6523
  const hasNoItems = formattedItems.every(
6223
6524
  (group) => !group.itens || group.itens.length === 0
6224
6525
  );
6225
- return /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { children: [
6226
- /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
6526
+ return /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { children: [
6527
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
6227
6528
  CardAccordation,
6228
6529
  {
6229
6530
  value: category.key,
@@ -6233,15 +6534,15 @@ var CheckboxGroup = ({
6233
6534
  openAccordion === category.key && "bg-background-50 border-none"
6234
6535
  ),
6235
6536
  trigger: renderAccordionTrigger(category, isEnabled),
6236
- children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { className: "flex flex-col gap-3 pt-2", children: hasNoItems && isEnabled ? /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { className: "px-2 py-4", children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(Text_default, { size: "sm", className: "text-text-500 text-center", children: "Sem dados" }) }) : formattedItems.map(
6537
+ children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("div", { className: "flex flex-col gap-3 pt-2", children: hasNoItems && isEnabled ? /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("div", { className: "px-2 py-4", children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(Text_default, { size: "sm", className: "text-text-500 text-center", children: "Sem dados" }) }) : formattedItems.map(
6237
6538
  (formattedGroup, idx) => renderFormattedGroup(formattedGroup, idx, category.key)
6238
6539
  ) })
6239
6540
  }
6240
6541
  ),
6241
- openAccordion !== category.key && showDivider && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(Divider_default, {})
6542
+ openAccordion !== category.key && showDivider && /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(Divider_default, {})
6242
6543
  ] }, category.key);
6243
6544
  };
6244
- (0, import_react20.useEffect)(() => {
6545
+ (0, import_react21.useEffect)(() => {
6245
6546
  if (!openAccordion) return;
6246
6547
  const category = categories.find((c) => c.key === openAccordion);
6247
6548
  if (!category) return;
@@ -6252,7 +6553,7 @@ var CheckboxGroup = ({
6252
6553
  }, 0);
6253
6554
  }
6254
6555
  }, [categories, openAccordion]);
6255
- return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
6556
+ return /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
6256
6557
  AccordionGroup,
6257
6558
  {
6258
6559
  type: "single",
@@ -6265,7 +6566,7 @@ var CheckboxGroup = ({
6265
6566
  };
6266
6567
 
6267
6568
  // src/components/Filter/FilterModal.tsx
6268
- var import_jsx_runtime34 = require("react/jsx-runtime");
6569
+ var import_jsx_runtime38 = require("react/jsx-runtime");
6269
6570
  var FilterModal = ({
6270
6571
  isOpen,
6271
6572
  onClose,
@@ -6293,20 +6594,20 @@ var FilterModal = ({
6293
6594
  const handleClear = () => {
6294
6595
  onClear();
6295
6596
  };
6296
- return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
6597
+ return /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
6297
6598
  Modal_default,
6298
6599
  {
6299
6600
  isOpen,
6300
6601
  onClose,
6301
6602
  title,
6302
6603
  size,
6303
- footer: /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: "flex gap-3 justify-end w-full", children: [
6304
- /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(Button_default, { variant: "outline", onClick: handleClear, children: clearLabel }),
6305
- /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(Button_default, { onClick: handleApply, children: applyLabel })
6604
+ footer: /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: "flex gap-3 justify-end w-full", children: [
6605
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(Button_default, { variant: "outline", onClick: handleClear, children: clearLabel }),
6606
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(Button_default, { onClick: handleApply, children: applyLabel })
6306
6607
  ] }),
6307
- children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: "flex flex-col gap-6", children: filterConfigs.map((config, index) => /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: "flex flex-col gap-4", children: [
6308
- /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: "flex items-center gap-2 text-text-400 text-sm font-medium uppercase", children: [
6309
- config.key === "academic" && /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(
6608
+ children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("div", { className: "flex flex-col gap-6", children: filterConfigs.map((config, index) => /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: "flex flex-col gap-4", children: [
6609
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: "flex items-center gap-2 text-text-400 text-sm font-medium uppercase", children: [
6610
+ config.key === "academic" && /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(
6310
6611
  "svg",
6311
6612
  {
6312
6613
  width: "16",
@@ -6316,7 +6617,7 @@ var FilterModal = ({
6316
6617
  xmlns: "http://www.w3.org/2000/svg",
6317
6618
  className: "text-text-400",
6318
6619
  children: [
6319
- /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
6620
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
6320
6621
  "path",
6321
6622
  {
6322
6623
  d: "M8 2L2 5.33333L8 8.66667L14 5.33333L8 2Z",
@@ -6326,7 +6627,7 @@ var FilterModal = ({
6326
6627
  strokeLinejoin: "round"
6327
6628
  }
6328
6629
  ),
6329
- /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
6630
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
6330
6631
  "path",
6331
6632
  {
6332
6633
  d: "M2 10.6667L8 14L14 10.6667",
@@ -6336,7 +6637,7 @@ var FilterModal = ({
6336
6637
  strokeLinejoin: "round"
6337
6638
  }
6338
6639
  ),
6339
- /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
6640
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
6340
6641
  "path",
6341
6642
  {
6342
6643
  d: "M2 8L8 11.3333L14 8",
@@ -6349,7 +6650,7 @@ var FilterModal = ({
6349
6650
  ]
6350
6651
  }
6351
6652
  ),
6352
- config.key === "content" && /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(
6653
+ config.key === "content" && /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(
6353
6654
  "svg",
6354
6655
  {
6355
6656
  width: "16",
@@ -6359,7 +6660,7 @@ var FilterModal = ({
6359
6660
  xmlns: "http://www.w3.org/2000/svg",
6360
6661
  className: "text-text-400",
6361
6662
  children: [
6362
- /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
6663
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
6363
6664
  "path",
6364
6665
  {
6365
6666
  d: "M3.33333 2H12.6667C13.403 2 14 2.59695 14 3.33333V12.6667C14 13.403 13.403 14 12.6667 14H3.33333C2.59695 14 2 13.403 2 12.6667V3.33333C2 2.59695 2.59695 2 3.33333 2Z",
@@ -6369,7 +6670,7 @@ var FilterModal = ({
6369
6670
  strokeLinejoin: "round"
6370
6671
  }
6371
6672
  ),
6372
- /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
6673
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
6373
6674
  "path",
6374
6675
  {
6375
6676
  d: "M2 6H14",
@@ -6379,7 +6680,7 @@ var FilterModal = ({
6379
6680
  strokeLinejoin: "round"
6380
6681
  }
6381
6682
  ),
6382
- /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
6683
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
6383
6684
  "path",
6384
6685
  {
6385
6686
  d: "M6 2V14",
@@ -6392,9 +6693,9 @@ var FilterModal = ({
6392
6693
  ]
6393
6694
  }
6394
6695
  ),
6395
- /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("span", { children: config.label })
6696
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("span", { children: config.label })
6396
6697
  ] }),
6397
- /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
6698
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
6398
6699
  CheckboxGroup,
6399
6700
  {
6400
6701
  categories: config.categories,
@@ -6407,8 +6708,8 @@ var FilterModal = ({
6407
6708
  };
6408
6709
 
6409
6710
  // src/components/TableProvider/TableProvider.tsx
6410
- var import_phosphor_react14 = require("phosphor-react");
6411
- var import_jsx_runtime35 = require("react/jsx-runtime");
6711
+ var import_phosphor_react16 = require("phosphor-react");
6712
+ var import_jsx_runtime39 = require("react/jsx-runtime");
6412
6713
  function TableProvider({
6413
6714
  data,
6414
6715
  headers,
@@ -6432,7 +6733,7 @@ function TableProvider({
6432
6733
  containerClassName,
6433
6734
  children
6434
6735
  }) {
6435
- const [searchQuery, setSearchQuery] = (0, import_react21.useState)("");
6736
+ const [searchQuery, setSearchQuery] = (0, import_react22.useState)("");
6436
6737
  const sortResultRaw = useTableSort(data, { syncWithUrl: true });
6437
6738
  const sortResult = enableTableSort ? sortResultRaw : {
6438
6739
  sortedData: data,
@@ -6443,7 +6744,7 @@ function TableProvider({
6443
6744
  };
6444
6745
  const { sortedData, sortColumn, sortDirection, handleSort } = sortResult;
6445
6746
  const filterResultRaw = useTableFilter(initialFilters, { syncWithUrl: true });
6446
- const disabledFilterResult = (0, import_react21.useMemo)(
6747
+ const disabledFilterResult = (0, import_react22.useMemo)(
6447
6748
  () => ({
6448
6749
  filterConfigs: [],
6449
6750
  activeFilters: {},
@@ -6473,10 +6774,10 @@ function TableProvider({
6473
6774
  totalItems,
6474
6775
  totalPages
6475
6776
  } = paginationConfig;
6476
- const [currentPage, setCurrentPage] = (0, import_react21.useState)(1);
6477
- const [itemsPerPage, setItemsPerPage] = (0, import_react21.useState)(defaultItemsPerPage);
6478
- const [isFilterModalOpen, setIsFilterModalOpen] = (0, import_react21.useState)(false);
6479
- const combinedParams = (0, import_react21.useMemo)(() => {
6777
+ const [currentPage, setCurrentPage] = (0, import_react22.useState)(1);
6778
+ const [itemsPerPage, setItemsPerPage] = (0, import_react22.useState)(defaultItemsPerPage);
6779
+ const [isFilterModalOpen, setIsFilterModalOpen] = (0, import_react22.useState)(false);
6780
+ const combinedParams = (0, import_react22.useMemo)(() => {
6480
6781
  const params = {
6481
6782
  page: currentPage,
6482
6783
  limit: itemsPerPage
@@ -6503,26 +6804,26 @@ function TableProvider({
6503
6804
  enableFilters,
6504
6805
  enableTableSort
6505
6806
  ]);
6506
- (0, import_react21.useEffect)(() => {
6807
+ (0, import_react22.useEffect)(() => {
6507
6808
  onParamsChange?.(combinedParams);
6508
6809
  }, [combinedParams]);
6509
- const handleSearchChange = (0, import_react21.useCallback)((value) => {
6810
+ const handleSearchChange = (0, import_react22.useCallback)((value) => {
6510
6811
  setSearchQuery(value);
6511
6812
  setCurrentPage(1);
6512
6813
  }, []);
6513
- const handleFilterApply = (0, import_react21.useCallback)(() => {
6814
+ const handleFilterApply = (0, import_react22.useCallback)(() => {
6514
6815
  applyFilters();
6515
6816
  setIsFilterModalOpen(false);
6516
6817
  setCurrentPage(1);
6517
6818
  }, [applyFilters]);
6518
- const handlePageChange = (0, import_react21.useCallback)((page) => {
6819
+ const handlePageChange = (0, import_react22.useCallback)((page) => {
6519
6820
  setCurrentPage(page);
6520
6821
  }, []);
6521
- const handleItemsPerPageChange = (0, import_react21.useCallback)((items) => {
6822
+ const handleItemsPerPageChange = (0, import_react22.useCallback)((items) => {
6522
6823
  setItemsPerPage(items);
6523
6824
  setCurrentPage(1);
6524
6825
  }, []);
6525
- const handleRowClickInternal = (0, import_react21.useCallback)(
6826
+ const handleRowClickInternal = (0, import_react22.useCallback)(
6526
6827
  (row, index) => {
6527
6828
  if (enableRowClick && onRowClick) {
6528
6829
  onRowClick(row, index);
@@ -6530,7 +6831,7 @@ function TableProvider({
6530
6831
  },
6531
6832
  [enableRowClick, onRowClick]
6532
6833
  );
6533
- const useInternalPagination = (0, import_react21.useMemo)(
6834
+ const useInternalPagination = (0, import_react22.useMemo)(
6534
6835
  () => enablePagination && !onParamsChange && totalItems === void 0 && totalPages === void 0,
6535
6836
  [enablePagination, onParamsChange, totalItems, totalPages]
6536
6837
  );
@@ -6538,7 +6839,7 @@ function TableProvider({
6538
6839
  (totalItems ?? (useInternalPagination ? sortedData.length : data.length)) / itemsPerPage
6539
6840
  );
6540
6841
  const calculatedTotalItems = totalItems ?? (useInternalPagination ? sortedData.length : data.length);
6541
- const displayData = (0, import_react21.useMemo)(() => {
6842
+ const displayData = (0, import_react22.useMemo)(() => {
6542
6843
  if (!useInternalPagination) {
6543
6844
  return sortedData;
6544
6845
  }
@@ -6549,21 +6850,21 @@ function TableProvider({
6549
6850
  const showLoading = loading;
6550
6851
  const showNoSearchResult = !loading && data.length === 0 && searchQuery.trim() !== "";
6551
6852
  const showEmpty = !loading && data.length === 0 && searchQuery.trim() === "";
6552
- const controls = (enableSearch || enableFilters) && /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: "flex items-center gap-4", children: [
6553
- enableFilters && /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(
6853
+ const controls = (enableSearch || enableFilters) && /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("div", { className: "flex items-center gap-4", children: [
6854
+ enableFilters && /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)(
6554
6855
  Button_default,
6555
6856
  {
6556
6857
  variant: "outline",
6557
6858
  size: "medium",
6558
6859
  onClick: () => setIsFilterModalOpen(true),
6559
6860
  children: [
6560
- /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(import_phosphor_react14.Funnel, { size: 20 }),
6861
+ /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(import_phosphor_react16.Funnel, { size: 20 }),
6561
6862
  "Filtros",
6562
- hasActiveFilters && /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("span", { className: "ml-2 rounded-full bg-primary-500 px-2 py-0.5 text-xs text-white", children: Object.keys(activeFilters).length })
6863
+ hasActiveFilters && /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("span", { className: "ml-2 rounded-full bg-primary-500 px-2 py-0.5 text-xs text-white", children: Object.keys(activeFilters).length })
6563
6864
  ]
6564
6865
  }
6565
6866
  ),
6566
- enableSearch && /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { className: "flex-1", children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
6867
+ enableSearch && /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("div", { className: "flex-1", children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
6567
6868
  Search_default,
6568
6869
  {
6569
6870
  value: searchQuery,
@@ -6574,11 +6875,11 @@ function TableProvider({
6574
6875
  }
6575
6876
  ) })
6576
6877
  ] });
6577
- const headerSection = (headerContent || controls) && /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: "flex flex-col md:flex-row items-stretch md:items-center justify-between gap-4", children: [
6578
- headerContent && /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { children: headerContent }),
6579
- controls && /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { className: "flex-1 md:flex-none", children: controls })
6878
+ const headerSection = (headerContent || controls) && /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("div", { className: "flex flex-col md:flex-row items-stretch md:items-center justify-between gap-4", children: [
6879
+ headerContent && /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("div", { children: headerContent }),
6880
+ controls && /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("div", { className: "flex-1 md:flex-none", children: controls })
6580
6881
  ] });
6581
- const table = /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { className: "w-full overflow-x-auto", children: /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(
6882
+ const table = /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("div", { className: "w-full overflow-x-auto", children: /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)(
6582
6883
  Table_default,
6583
6884
  {
6584
6885
  variant,
@@ -6589,11 +6890,11 @@ function TableProvider({
6589
6890
  showEmpty,
6590
6891
  emptyState,
6591
6892
  children: [
6592
- /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("thead", { children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
6893
+ /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("thead", { children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
6593
6894
  TableRow,
6594
6895
  {
6595
6896
  variant: variant === "borderless" ? "defaultBorderless" : "default",
6596
- children: headers.map((header, index) => /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
6897
+ children: headers.map((header, index) => /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
6597
6898
  TableHead,
6598
6899
  {
6599
6900
  sortable: enableTableSort && header.sortable,
@@ -6607,7 +6908,7 @@ function TableProvider({
6607
6908
  ))
6608
6909
  }
6609
6910
  ) }),
6610
- /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(TableBody, { children: loading ? /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(TableRow, { children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(TableCell, { colSpan: headers.length, className: "text-center py-8", children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("span", { className: "text-text-400 text-sm", children: "Carregando..." }) }) }) : displayData.map((row, rowIndex) => {
6911
+ /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(TableBody, { children: loading ? /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(TableRow, { children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(TableCell, { colSpan: headers.length, className: "text-center py-8", children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("span", { className: "text-text-400 text-sm", children: "Carregando..." }) }) }) : displayData.map((row, rowIndex) => {
6611
6912
  const effectiveIndex = useInternalPagination ? (currentPage - 1) * itemsPerPage + rowIndex : rowIndex;
6612
6913
  const rowKeyValue = rowKey ? (() => {
6613
6914
  const keyValue = row[rowKey];
@@ -6619,7 +6920,7 @@ function TableProvider({
6619
6920
  }
6620
6921
  return String(keyValue);
6621
6922
  })() : `row-${effectiveIndex}`;
6622
- return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
6923
+ return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
6623
6924
  TableRow,
6624
6925
  {
6625
6926
  variant: variant === "borderless" ? "defaultBorderless" : "default",
@@ -6640,7 +6941,7 @@ function TableProvider({
6640
6941
  }
6641
6942
  }
6642
6943
  const content = header.render ? header.render(value, row, effectiveIndex) : defaultContent;
6643
- return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
6944
+ return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
6644
6945
  TableCell,
6645
6946
  {
6646
6947
  className: header.className,
@@ -6659,7 +6960,7 @@ function TableProvider({
6659
6960
  ]
6660
6961
  }
6661
6962
  ) });
6662
- const pagination = enablePagination && !isEmpty && /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { className: "flex justify-end", children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
6963
+ const pagination = enablePagination && !isEmpty && /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("div", { className: "flex justify-end", children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
6663
6964
  TablePagination_default,
6664
6965
  {
6665
6966
  currentPage,
@@ -6673,13 +6974,13 @@ function TableProvider({
6673
6974
  }
6674
6975
  ) });
6675
6976
  if (children) {
6676
- return /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(import_jsx_runtime35.Fragment, { children: [
6977
+ return /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)(import_jsx_runtime39.Fragment, { children: [
6677
6978
  children({
6678
6979
  controls: headerSection || controls || null,
6679
6980
  table,
6680
6981
  pagination
6681
6982
  }),
6682
- enableFilters && /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
6983
+ enableFilters && /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
6683
6984
  FilterModal,
6684
6985
  {
6685
6986
  isOpen: isFilterModalOpen,
@@ -6693,11 +6994,11 @@ function TableProvider({
6693
6994
  ] });
6694
6995
  }
6695
6996
  const wrapperClassName = containerClassName || "w-full space-y-4";
6696
- return /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: wrapperClassName, children: [
6997
+ return /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("div", { className: wrapperClassName, children: [
6697
6998
  headerSection,
6698
6999
  table,
6699
7000
  pagination,
6700
- enableFilters && /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
7001
+ enableFilters && /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
6701
7002
  FilterModal,
6702
7003
  {
6703
7004
  isOpen: isFilterModalOpen,
@@ -6711,44 +7012,14 @@ function TableProvider({
6711
7012
  ] });
6712
7013
  }
6713
7014
 
6714
- // src/components/ActivitiesHistory/components/ErrorDisplay.tsx
6715
- var import_jsx_runtime36 = require("react/jsx-runtime");
6716
- var ErrorDisplay = ({ error }) => /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("div", { className: "flex items-center justify-center bg-background rounded-xl w-full min-h-[705px]", children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(Text_default, { size: "lg", color: "text-error-500", children: error }) });
6717
-
6718
7015
  // src/components/ActivitiesHistory/config/historyTableColumns.tsx
6719
- var import_phosphor_react15 = require("phosphor-react");
6720
-
6721
- // src/components/ActivitiesHistory/utils/renderSubjectCell.tsx
6722
- var import_jsx_runtime37 = require("react/jsx-runtime");
6723
- var renderSubjectCell = (subjectName, mapSubjectNameToEnum, showEmptyDash = false) => {
6724
- if (!subjectName) {
6725
- return showEmptyDash ? /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(Text_default, { size: "sm", color: "text-text-400", children: "-" }) : null;
6726
- }
6727
- const subjectEnum = mapSubjectNameToEnum?.(subjectName);
6728
- if (!subjectEnum) {
6729
- return /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(Text_default, { size: "sm", className: "truncate", title: subjectName, children: subjectName });
6730
- }
6731
- const subjectInfo = getSubjectInfo(subjectEnum);
6732
- return /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { className: "flex items-center gap-2", title: subjectName, children: [
6733
- /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
6734
- "span",
6735
- {
6736
- className: cn(
6737
- "w-[21px] h-[21px] flex items-center justify-center rounded-sm text-text-950 shrink-0",
6738
- subjectInfo.colorClass
6739
- ),
6740
- children: subjectInfo.icon
6741
- }
6742
- ),
6743
- /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(Text_default, { size: "sm", className: "truncate", children: subjectName })
6744
- ] });
6745
- };
7016
+ var import_phosphor_react17 = require("phosphor-react");
6746
7017
 
6747
7018
  // src/components/ActivitiesHistory/utils/renderTruncatedText.tsx
6748
- var import_jsx_runtime38 = require("react/jsx-runtime");
7019
+ var import_jsx_runtime40 = require("react/jsx-runtime");
6749
7020
  var renderTruncatedText = (value) => {
6750
7021
  const text = typeof value === "string" ? value : "";
6751
- return /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(Text_default, { size: "sm", title: text, children: text });
7022
+ return /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(Text_default, { size: "sm", title: text, children: text });
6752
7023
  };
6753
7024
 
6754
7025
  // src/components/ActivitiesHistory/utils/filterBuilders.ts
@@ -6804,7 +7075,7 @@ var getSubjectOptions = (data) => {
6804
7075
  };
6805
7076
 
6806
7077
  // src/components/ActivitiesHistory/config/historyTableColumns.tsx
6807
- var import_jsx_runtime39 = require("react/jsx-runtime");
7078
+ var import_jsx_runtime41 = require("react/jsx-runtime");
6808
7079
  var createHistoryTableColumns = (mapSubjectNameToEnum) => [
6809
7080
  {
6810
7081
  key: "startDate",
@@ -6857,9 +7128,9 @@ var createHistoryTableColumns = (mapSubjectNameToEnum) => [
6857
7128
  render: (value) => {
6858
7129
  const status = typeof value === "string" ? value : "";
6859
7130
  if (!status) {
6860
- return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(Text_default, { size: "sm", color: "text-text-500", children: "-" });
7131
+ return /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(Text_default, { size: "sm", color: "text-text-500", children: "-" });
6861
7132
  }
6862
- return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
7133
+ return /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
6863
7134
  Badge_default,
6864
7135
  {
6865
7136
  variant: "solid",
@@ -6874,7 +7145,7 @@ var createHistoryTableColumns = (mapSubjectNameToEnum) => [
6874
7145
  key: "completionPercentage",
6875
7146
  label: "Conclus\xE3o",
6876
7147
  sortable: true,
6877
- render: (value) => /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
7148
+ render: (value) => /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
6878
7149
  ProgressBar_default,
6879
7150
  {
6880
7151
  value: Number(value),
@@ -6891,7 +7162,7 @@ var createHistoryTableColumns = (mapSubjectNameToEnum) => [
6891
7162
  label: "",
6892
7163
  sortable: false,
6893
7164
  className: "w-12",
6894
- render: () => /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("div", { className: "flex justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(import_phosphor_react15.CaretRight, { size: 20, className: "text-text-600" }) })
7165
+ render: () => /* @__PURE__ */ (0, import_jsx_runtime41.jsx)("div", { className: "flex justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(import_phosphor_react17.CaretRight, { size: 20, className: "text-text-600" }) })
6895
7166
  }
6896
7167
  ];
6897
7168
 
@@ -6936,7 +7207,7 @@ var createHistoryFiltersConfig = (userData) => [
6936
7207
  ];
6937
7208
 
6938
7209
  // src/components/ActivitiesHistory/tabs/HistoryTab.tsx
6939
- var import_jsx_runtime40 = require("react/jsx-runtime");
7210
+ var import_jsx_runtime42 = require("react/jsx-runtime");
6940
7211
  var HistoryTab = ({
6941
7212
  fetchActivitiesHistory,
6942
7213
  onCreateActivity,
@@ -6946,9 +7217,9 @@ var HistoryTab = ({
6946
7217
  mapSubjectNameToEnum,
6947
7218
  userFilterData
6948
7219
  }) => {
6949
- const fetchActivitiesHistoryRef = (0, import_react22.useRef)(fetchActivitiesHistory);
7220
+ const fetchActivitiesHistoryRef = (0, import_react23.useRef)(fetchActivitiesHistory);
6950
7221
  fetchActivitiesHistoryRef.current = fetchActivitiesHistory;
6951
- const useActivitiesHistory = (0, import_react22.useMemo)(
7222
+ const useActivitiesHistory = (0, import_react23.useMemo)(
6952
7223
  () => createUseActivitiesHistory(
6953
7224
  (filters) => fetchActivitiesHistoryRef.current(filters)
6954
7225
  ),
@@ -6961,15 +7232,15 @@ var HistoryTab = ({
6961
7232
  pagination,
6962
7233
  fetchActivities
6963
7234
  } = useActivitiesHistory();
6964
- const historyFilterConfigs = (0, import_react22.useMemo)(
7235
+ const historyFilterConfigs = (0, import_react23.useMemo)(
6965
7236
  () => createHistoryFiltersConfig(userFilterData),
6966
7237
  [userFilterData]
6967
7238
  );
6968
- const historyTableColumns = (0, import_react22.useMemo)(
7239
+ const historyTableColumns = (0, import_react23.useMemo)(
6969
7240
  () => createHistoryTableColumns(mapSubjectNameToEnum),
6970
7241
  [mapSubjectNameToEnum]
6971
7242
  );
6972
- const handleParamsChange = (0, import_react22.useCallback)(
7243
+ const handleParamsChange = (0, import_react23.useCallback)(
6973
7244
  (params) => {
6974
7245
  const filters = buildHistoryFiltersFromParams(params);
6975
7246
  fetchActivities(filters);
@@ -6977,9 +7248,9 @@ var HistoryTab = ({
6977
7248
  [fetchActivities]
6978
7249
  );
6979
7250
  if (error) {
6980
- return /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(ErrorDisplay, { error });
7251
+ return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(ErrorDisplay, { error });
6981
7252
  }
6982
- return /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("div", { className: "w-full", children: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
7253
+ return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("div", { className: "w-full", children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
6983
7254
  TableProvider,
6984
7255
  {
6985
7256
  data: activities,
@@ -7004,14 +7275,14 @@ var HistoryTab = ({
7004
7275
  image: noSearchImage
7005
7276
  },
7006
7277
  emptyState: {
7007
- component: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
7278
+ component: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
7008
7279
  EmptyState_default,
7009
7280
  {
7010
7281
  image: emptyStateImage,
7011
7282
  title: "Incentive sua turma ao aprendizado",
7012
7283
  description: "Crie uma nova atividade e ajude seus alunos a colocarem o conte\xFAdo em pr\xE1tica!",
7013
7284
  buttonText: "Criar atividade",
7014
- buttonIcon: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(import_phosphor_react16.Plus, { size: 18 }),
7285
+ buttonIcon: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_phosphor_react18.Plus, { size: 18 }),
7015
7286
  buttonVariant: "outline",
7016
7287
  buttonAction: "primary",
7017
7288
  onButtonClick: onCreateActivity
@@ -7026,22 +7297,22 @@ var HistoryTab = ({
7026
7297
  table,
7027
7298
  pagination: paginationComponent
7028
7299
  } = renderProps;
7029
- return /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)("div", { className: "space-y-4", children: [
7030
- /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)("div", { className: "flex items-center justify-between gap-4", children: [
7031
- /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
7300
+ return /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("div", { className: "space-y-4", children: [
7301
+ /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("div", { className: "flex items-center justify-between gap-4", children: [
7302
+ /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
7032
7303
  Button_default,
7033
7304
  {
7034
7305
  variant: "solid",
7035
7306
  action: "primary",
7036
7307
  size: "medium",
7037
7308
  onClick: onCreateActivity,
7038
- iconLeft: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(import_phosphor_react16.Plus, { size: 18, weight: "bold" }),
7309
+ iconLeft: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_phosphor_react18.Plus, { size: 18, weight: "bold" }),
7039
7310
  children: "Criar atividade"
7040
7311
  }
7041
7312
  ),
7042
7313
  controls
7043
7314
  ] }),
7044
- /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)("div", { className: "bg-background rounded-xl p-6 space-y-4", children: [
7315
+ /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("div", { className: "bg-background rounded-xl p-6 space-y-4", children: [
7045
7316
  table,
7046
7317
  paginationComponent
7047
7318
  ] })
@@ -7051,96 +7322,6 @@ var HistoryTab = ({
7051
7322
  ) });
7052
7323
  };
7053
7324
 
7054
- // src/components/ActivitiesHistory/tabs/ModelsTab.tsx
7055
- var import_react23 = require("react");
7056
- var import_phosphor_react18 = require("phosphor-react");
7057
-
7058
- // src/components/ActivitiesHistory/config/modelsTableColumns.tsx
7059
- var import_phosphor_react17 = require("phosphor-react");
7060
- var import_jsx_runtime41 = require("react/jsx-runtime");
7061
- var createModelsTableColumns = (mapSubjectNameToEnum, onSendActivity, onEditModel, onDeleteModel) => [
7062
- {
7063
- key: "title",
7064
- label: "T\xEDtulo",
7065
- sortable: true,
7066
- className: "max-w-[400px]",
7067
- render: (value) => {
7068
- const title = typeof value === "string" ? value : "";
7069
- return /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(Text_default, { size: "sm", title, className: "truncate block", children: title });
7070
- }
7071
- },
7072
- {
7073
- key: "savedAt",
7074
- label: "Salvo em",
7075
- sortable: true,
7076
- className: "w-[120px]"
7077
- },
7078
- {
7079
- key: "subject",
7080
- label: "Mat\xE9ria",
7081
- sortable: true,
7082
- className: "max-w-[160px]",
7083
- render: (value) => {
7084
- const subjectName = typeof value === "string" ? value : "";
7085
- return renderSubjectCell(subjectName, mapSubjectNameToEnum, true);
7086
- }
7087
- },
7088
- {
7089
- key: "actions",
7090
- label: "",
7091
- sortable: false,
7092
- className: "w-[220px]",
7093
- render: (_value, row) => {
7094
- const handleSend = (e) => {
7095
- e.stopPropagation();
7096
- onSendActivity?.(row);
7097
- };
7098
- const handleEdit = (e) => {
7099
- e.stopPropagation();
7100
- onEditModel?.(row);
7101
- };
7102
- const handleDelete = (e) => {
7103
- e.stopPropagation();
7104
- onDeleteModel(row);
7105
- };
7106
- return /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("div", { className: "flex items-center gap-2 justify-end", children: [
7107
- onSendActivity && /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
7108
- Button_default,
7109
- {
7110
- variant: "outline",
7111
- action: "primary",
7112
- size: "small",
7113
- iconLeft: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(import_phosphor_react17.PaperPlaneTilt, { size: 16 }),
7114
- onClick: handleSend,
7115
- "aria-label": "Enviar atividade",
7116
- children: "Enviar atividade"
7117
- }
7118
- ),
7119
- /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
7120
- IconButton_default,
7121
- {
7122
- icon: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(import_phosphor_react17.Trash, { size: 20 }),
7123
- size: "md",
7124
- onClick: handleDelete,
7125
- "aria-label": "Deletar modelo",
7126
- className: "text-text-600 hover:text-error-500 hover:bg-transparent"
7127
- }
7128
- ),
7129
- onEditModel && /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
7130
- IconButton_default,
7131
- {
7132
- icon: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(import_phosphor_react17.PencilSimple, { size: 20 }),
7133
- size: "md",
7134
- onClick: handleEdit,
7135
- "aria-label": "Editar modelo",
7136
- className: "text-text-600 hover:text-primary-700 hover:bg-transparent"
7137
- }
7138
- )
7139
- ] });
7140
- }
7141
- }
7142
- ];
7143
-
7144
7325
  // src/components/ActivitiesHistory/config/modelsFiltersConfig.ts
7145
7326
  var createModelsFiltersConfig = (userData) => [
7146
7327
  {
@@ -7158,7 +7339,21 @@ var createModelsFiltersConfig = (userData) => [
7158
7339
  ];
7159
7340
 
7160
7341
  // src/components/ActivitiesHistory/tabs/ModelsTab.tsx
7161
- var import_jsx_runtime42 = require("react/jsx-runtime");
7342
+ var import_jsx_runtime43 = require("react/jsx-runtime");
7343
+ var ACTIVITY_MODELS_CONFIG = {
7344
+ entityName: "atividade",
7345
+ entityNamePlural: "atividades",
7346
+ testId: "activity-models-tab",
7347
+ emptyStateTitle: "Crie modelos para agilizar suas atividades",
7348
+ emptyStateDescription: "Salve modelos de atividades para reutilizar e enviar rapidamente para suas turmas!",
7349
+ searchPlaceholder: "Buscar modelo"
7350
+ };
7351
+ var ACTIVITY_COLUMNS_CONFIG = {
7352
+ sendButtonLabel: "Enviar atividade",
7353
+ sendButtonAriaLabel: "Enviar atividade",
7354
+ deleteButtonAriaLabel: "Deletar modelo",
7355
+ editButtonAriaLabel: "Editar modelo"
7356
+ };
7162
7357
  var ModelsTab = ({
7163
7358
  fetchActivityModels,
7164
7359
  deleteActivityModel,
@@ -7170,169 +7365,41 @@ var ModelsTab = ({
7170
7365
  mapSubjectNameToEnum,
7171
7366
  userFilterData,
7172
7367
  subjectsMap
7173
- }) => {
7174
- const [deleteDialogOpen, setDeleteDialogOpen] = (0, import_react23.useState)(false);
7175
- const [modelToDelete, setModelToDelete] = (0, import_react23.useState)(null);
7176
- const { addToast } = useToast();
7177
- const fetchActivityModelsRef = (0, import_react23.useRef)(fetchActivityModels);
7178
- fetchActivityModelsRef.current = fetchActivityModels;
7179
- const deleteActivityModelRef = (0, import_react23.useRef)(deleteActivityModel);
7180
- deleteActivityModelRef.current = deleteActivityModel;
7181
- const subjectsMapRef = (0, import_react23.useRef)(subjectsMap);
7182
- subjectsMapRef.current = subjectsMap;
7183
- const useActivityModels = (0, import_react23.useMemo)(
7184
- () => createUseActivityModels(
7185
- (filters) => fetchActivityModelsRef.current(filters),
7186
- (id) => deleteActivityModelRef.current(id)
7187
- ),
7188
- []
7189
- );
7190
- const {
7191
- models,
7192
- loading: modelsLoading,
7193
- error: modelsError,
7194
- pagination: modelsPagination,
7195
- fetchModels,
7196
- deleteModel
7197
- } = useActivityModels();
7198
- const modelsFilterConfigs = (0, import_react23.useMemo)(
7199
- () => createModelsFiltersConfig(userFilterData),
7200
- [userFilterData]
7201
- );
7202
- const handleDeleteClick = (0, import_react23.useCallback)((model) => {
7203
- setModelToDelete(model);
7204
- setDeleteDialogOpen(true);
7205
- }, []);
7206
- const modelsTableColumns = (0, import_react23.useMemo)(
7207
- () => createModelsTableColumns(
7208
- mapSubjectNameToEnum,
7209
- onSendActivity,
7210
- onEditModel,
7211
- handleDeleteClick
7368
+ }) => /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
7369
+ ModelsTabBase,
7370
+ {
7371
+ fetchModels: fetchActivityModels,
7372
+ deleteModel: deleteActivityModel,
7373
+ onCreateModel,
7374
+ onSend: onSendActivity,
7375
+ onEditModel,
7376
+ emptyStateImage,
7377
+ noSearchImage,
7378
+ mapSubjectNameToEnum,
7379
+ userFilterData,
7380
+ subjectsMap,
7381
+ config: ACTIVITY_MODELS_CONFIG,
7382
+ createTableColumns: (mapSubject, send, edit, del) => createModelsTableColumnsBase(
7383
+ mapSubject,
7384
+ send,
7385
+ edit,
7386
+ del,
7387
+ ACTIVITY_COLUMNS_CONFIG
7212
7388
  ),
7213
- [mapSubjectNameToEnum, onSendActivity, onEditModel, handleDeleteClick]
7214
- );
7215
- const handleParamsChange = (0, import_react23.useCallback)(
7216
- (params) => {
7217
- const filters = buildModelsFiltersFromParams(params);
7218
- fetchModels(filters, subjectsMapRef.current);
7219
- },
7220
- [fetchModels]
7221
- );
7222
- (0, import_react23.useEffect)(() => {
7223
- fetchModels({ page: 1, limit: 10 }, subjectsMapRef.current);
7224
- }, [fetchModels]);
7225
- const handleConfirmDelete = (0, import_react23.useCallback)(async () => {
7226
- if (modelToDelete) {
7227
- const success = await deleteModel(modelToDelete.id);
7228
- if (success) {
7229
- addToast({ title: "Modelo deletado com sucesso", action: "success" });
7230
- fetchModels({ page: 1, limit: 10 }, subjectsMapRef.current);
7231
- } else {
7232
- addToast({ title: "Erro ao deletar modelo", action: "warning" });
7233
- }
7234
- }
7235
- setDeleteDialogOpen(false);
7236
- setModelToDelete(null);
7237
- }, [modelToDelete, deleteModel, fetchModels, addToast]);
7238
- const handleCancelDelete = (0, import_react23.useCallback)(() => {
7239
- setDeleteDialogOpen(false);
7240
- setModelToDelete(null);
7241
- }, []);
7242
- return /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(import_jsx_runtime42.Fragment, { children: [
7243
- /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(Toaster_default, {}),
7244
- modelsError ? /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(ErrorDisplay, { error: modelsError }) : /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("div", { className: "w-full", "data-testid": "activity-models-tab", children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
7245
- TableProvider,
7246
- {
7247
- data: models,
7248
- headers: modelsTableColumns,
7249
- loading: modelsLoading,
7250
- variant: "borderless",
7251
- enableSearch: true,
7252
- enableFilters: true,
7253
- enableTableSort: true,
7254
- enablePagination: true,
7255
- initialFilters: modelsFilterConfigs,
7256
- paginationConfig: {
7257
- itemLabel: "modelos",
7258
- itemsPerPageOptions: [10, 20, 50, 100],
7259
- defaultItemsPerPage: 10,
7260
- totalItems: modelsPagination.total,
7261
- totalPages: modelsPagination.totalPages
7262
- },
7263
- searchPlaceholder: "Buscar modelo",
7264
- noSearchResultState: {
7265
- image: noSearchImage
7266
- },
7267
- emptyState: {
7268
- component: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
7269
- EmptyState_default,
7270
- {
7271
- image: emptyStateImage,
7272
- title: "Crie modelos para agilizar suas atividades",
7273
- description: "Salve modelos de atividades para reutilizar e enviar rapidamente para suas turmas!",
7274
- buttonText: "Criar modelo",
7275
- buttonIcon: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_phosphor_react18.Plus, { size: 18 }),
7276
- buttonVariant: "outline",
7277
- buttonAction: "primary",
7278
- onButtonClick: onCreateModel
7279
- }
7280
- )
7281
- },
7282
- onParamsChange: handleParamsChange,
7283
- children: (renderProps) => {
7284
- const {
7285
- controls,
7286
- table,
7287
- pagination: paginationComponent
7288
- } = renderProps;
7289
- return /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("div", { className: "space-y-4", children: [
7290
- /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("div", { className: "flex items-center justify-between gap-4", children: [
7291
- /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
7292
- Button_default,
7293
- {
7294
- variant: "solid",
7295
- action: "primary",
7296
- size: "medium",
7297
- onClick: onCreateModel,
7298
- iconLeft: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_phosphor_react18.Plus, { size: 18, weight: "bold" }),
7299
- children: "Criar modelo"
7300
- }
7301
- ),
7302
- controls
7303
- ] }),
7304
- /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("div", { className: "bg-background rounded-xl p-6 space-y-4", children: [
7305
- table,
7306
- paginationComponent
7307
- ] })
7308
- ] });
7309
- }
7310
- }
7311
- ) }),
7312
- /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
7313
- AlertDialog,
7314
- {
7315
- isOpen: deleteDialogOpen,
7316
- onChangeOpen: setDeleteDialogOpen,
7317
- title: "Deletar modelo",
7318
- description: `Tem certeza que deseja deletar o modelo "${modelToDelete?.title}"? Esta a\xE7\xE3o n\xE3o pode ser desfeita.`,
7319
- submitButtonLabel: "Deletar",
7320
- cancelButtonLabel: "Cancelar",
7321
- onSubmit: handleConfirmDelete,
7322
- onCancel: handleCancelDelete
7323
- }
7324
- )
7325
- ] });
7326
- };
7389
+ createFiltersConfig: createModelsFiltersConfig,
7390
+ buildFiltersFromParams: buildModelsFiltersFromParams,
7391
+ createUseModels: createUseActivityModels
7392
+ }
7393
+ );
7327
7394
 
7328
7395
  // src/components/ActivitiesHistory/tabs/DraftsTab.tsx
7329
- var import_jsx_runtime43 = require("react/jsx-runtime");
7396
+ var import_jsx_runtime44 = require("react/jsx-runtime");
7330
7397
  var DraftsTab = () => {
7331
- return /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("div", { className: "flex items-center justify-center bg-background rounded-xl w-full min-h-[705px]", children: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(Text_default, { size: "lg", color: "text-text-600", children: "Rascunhos em desenvolvimento" }) });
7398
+ return /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("div", { className: "flex items-center justify-center bg-background rounded-xl w-full min-h-[705px]", children: /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(Text_default, { size: "lg", color: "text-text-600", children: "Rascunhos em desenvolvimento" }) });
7332
7399
  };
7333
7400
 
7334
7401
  // src/components/ActivitiesHistory/ActivitiesHistory.tsx
7335
- var import_jsx_runtime44 = require("react/jsx-runtime");
7402
+ var import_jsx_runtime45 = require("react/jsx-runtime");
7336
7403
  var PAGE_TITLES = {
7337
7404
  ["history" /* HISTORY */]: "Hist\xF3rico de atividades",
7338
7405
  ["drafts" /* DRAFTS */]: "Rascunhos",
@@ -7354,16 +7421,16 @@ var ActivitiesHistory = ({
7354
7421
  subjectsMap
7355
7422
  }) => {
7356
7423
  const [activeTab, setActiveTab] = (0, import_react24.useState)("history" /* HISTORY */);
7357
- return /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(
7424
+ return /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)(
7358
7425
  "div",
7359
7426
  {
7360
7427
  "data-testid": "activities-history",
7361
7428
  className: "flex flex-col w-full h-auto relative justify-center items-center mb-5 overflow-hidden",
7362
7429
  children: [
7363
- /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("span", { className: "absolute top-0 left-0 h-[150px] w-full z-0" }),
7364
- /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)("div", { className: "flex flex-col w-full h-full max-w-[1350px] mx-auto z-10 lg:px-0 px-4 pt-4 sm:pt-0", children: [
7365
- /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)("div", { className: "flex flex-col sm:flex-row w-full mb-6 items-start sm:items-center sm:justify-between gap-0 sm:gap-4", children: [
7366
- /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
7430
+ /* @__PURE__ */ (0, import_jsx_runtime45.jsx)("span", { className: "absolute top-0 left-0 h-[150px] w-full z-0" }),
7431
+ /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)("div", { className: "flex flex-col w-full h-full max-w-[1350px] mx-auto z-10 lg:px-0 px-4 pt-4 sm:pt-0", children: [
7432
+ /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)("div", { className: "flex flex-col sm:flex-row w-full mb-6 items-start sm:items-center sm:justify-between gap-0 sm:gap-4", children: [
7433
+ /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
7367
7434
  Text_default,
7368
7435
  {
7369
7436
  as: "h1",
@@ -7372,7 +7439,7 @@ var ActivitiesHistory = ({
7372
7439
  children: PAGE_TITLES[activeTab]
7373
7440
  }
7374
7441
  ),
7375
- /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("div", { className: "flex-shrink-0 lg:w-auto self-center sm:self-auto", children: /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
7442
+ /* @__PURE__ */ (0, import_jsx_runtime45.jsx)("div", { className: "flex-shrink-0 lg:w-auto self-center sm:self-auto", children: /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
7376
7443
  Menu,
7377
7444
  {
7378
7445
  defaultValue: "history" /* HISTORY */,
@@ -7380,13 +7447,13 @@ var ActivitiesHistory = ({
7380
7447
  onValueChange: (value) => setActiveTab(value),
7381
7448
  variant: "menu2",
7382
7449
  className: "bg-transparent shadow-none px-0",
7383
- children: /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(
7450
+ children: /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)(
7384
7451
  MenuContent,
7385
7452
  {
7386
7453
  variant: "menu2",
7387
7454
  className: "w-full lg:w-auto max-w-full min-w-0",
7388
7455
  children: [
7389
- /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
7456
+ /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
7390
7457
  MenuItem,
7391
7458
  {
7392
7459
  variant: "menu2",
@@ -7396,7 +7463,7 @@ var ActivitiesHistory = ({
7396
7463
  children: "Hist\xF3rico"
7397
7464
  }
7398
7465
  ),
7399
- /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
7466
+ /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
7400
7467
  MenuItem,
7401
7468
  {
7402
7469
  variant: "menu2",
@@ -7406,7 +7473,7 @@ var ActivitiesHistory = ({
7406
7473
  children: "Rascunhos"
7407
7474
  }
7408
7475
  ),
7409
- /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
7476
+ /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
7410
7477
  MenuItem,
7411
7478
  {
7412
7479
  variant: "menu2",
@@ -7422,8 +7489,8 @@ var ActivitiesHistory = ({
7422
7489
  }
7423
7490
  ) })
7424
7491
  ] }),
7425
- /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)("div", { className: "flex flex-col items-center w-full min-h-0 flex-1", children: [
7426
- activeTab === "history" /* HISTORY */ && /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
7492
+ /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)("div", { className: "flex flex-col items-center w-full min-h-0 flex-1", children: [
7493
+ activeTab === "history" /* HISTORY */ && /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
7427
7494
  HistoryTab,
7428
7495
  {
7429
7496
  fetchActivitiesHistory,
@@ -7435,8 +7502,8 @@ var ActivitiesHistory = ({
7435
7502
  userFilterData
7436
7503
  }
7437
7504
  ),
7438
- activeTab === "drafts" /* DRAFTS */ && /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(DraftsTab, {}),
7439
- activeTab === "models" /* MODELS */ && /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
7505
+ activeTab === "drafts" /* DRAFTS */ && /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(DraftsTab, {}),
7506
+ activeTab === "models" /* MODELS */ && /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
7440
7507
  ModelsTab,
7441
7508
  {
7442
7509
  fetchActivityModels,