forlogic-core 2.1.5 → 2.2.0

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 (195) hide show
  1. package/README.md +53 -1
  2. package/dist/action-plans/components/ActionPlanAttachmentsTab.d.ts +3 -0
  3. package/dist/action-plans/components/ActionPlanCommentsTab.d.ts +3 -0
  4. package/dist/action-plans/components/ActionPlanCostTab.d.ts +5 -0
  5. package/dist/action-plans/components/ActionPlanGeneralTab.d.ts +3 -0
  6. package/dist/action-plans/components/ActionPlanHistoryTab.d.ts +3 -0
  7. package/dist/action-plans/components/ActionPlanPredecessorsTab.d.ts +5 -0
  8. package/dist/action-plans/components/ActionPlanProgressDialog.d.ts +3 -0
  9. package/dist/action-plans/components/ActionPlanProgressTab.d.ts +5 -0
  10. package/dist/action-plans/components/ActionPlanStatusBadge.d.ts +3 -0
  11. package/dist/action-plans/constants.d.ts +24 -0
  12. package/dist/action-plans/hooks/useActionPlan.d.ts +5 -0
  13. package/dist/action-plans/hooks/useActionPlanProgress.d.ts +5 -0
  14. package/dist/action-plans/types.d.ts +60 -0
  15. package/dist/action-plans/utils/formatTime.d.ts +9 -0
  16. package/dist/audit-trail/components/AuditTrailDetails.d.ts +10 -0
  17. package/dist/audit-trail/components/AuditTrailFilter.d.ts +10 -0
  18. package/dist/audit-trail/components/AuditTrailPage.d.ts +10 -0
  19. package/dist/audit-trail/types.d.ts +58 -0
  20. package/dist/audit-trail/utils.d.ts +18 -2
  21. package/dist/auth/components/EditProfileDialog.d.ts +1 -0
  22. package/dist/auth/components/ProtectedRoute.d.ts +5 -0
  23. package/dist/auth/contexts/AuthContext.d.ts +5 -0
  24. package/dist/auth/pages/CallbackPage.d.ts +5 -0
  25. package/dist/auth/services/AuthService.d.ts +5 -0
  26. package/dist/auth/services/TokenManager.d.ts +5 -0
  27. package/dist/auth/services/TokenService.d.ts +10 -0
  28. package/dist/auth/utils/ErrorInterceptor.d.ts +5 -0
  29. package/dist/components/dashboards/dashboard-form.d.ts +15 -0
  30. package/dist/components/dashboards/dashboard-general-view.d.ts +15 -0
  31. package/dist/components/dashboards/dashboard-grid.d.ts +25 -0
  32. package/dist/components/dashboards/dashboard-list.d.ts +10 -0
  33. package/dist/components/dashboards/dashboard-panel-renderer.d.ts +10 -0
  34. package/dist/components/dashboards/dashboard-view.d.ts +10 -0
  35. package/dist/components/dashboards/helpers.d.ts +44 -5
  36. package/dist/components/dashboards/panels/burndown-panel.d.ts +15 -0
  37. package/dist/components/dashboards/panels/cartesian-panel.d.ts +20 -0
  38. package/dist/components/dashboards/panels/list-panel.d.ts +15 -0
  39. package/dist/components/dashboards/panels/matrix-risk-panel.d.ts +25 -0
  40. package/dist/components/dashboards/panels/numeric-panel.d.ts +10 -0
  41. package/dist/components/dashboards/panels/panel-error.d.ts +10 -0
  42. package/dist/components/dashboards/panels/panel-header.d.ts +10 -0
  43. package/dist/components/dashboards/panels/panel-loader.d.ts +10 -0
  44. package/dist/components/dashboards/panels/panel-no-data.d.ts +10 -0
  45. package/dist/components/dashboards/panels/panel-unavailable.d.ts +10 -0
  46. package/dist/components/dashboards/panels/pareto-panel.d.ts +10 -0
  47. package/dist/components/dashboards/panels/performance-panel.d.ts +15 -0
  48. package/dist/components/dashboards/panels/pie-panel.d.ts +10 -0
  49. package/dist/components/dashboards/panels/text-panel.d.ts +10 -0
  50. package/dist/components/dashboards/types.d.ts +230 -0
  51. package/dist/components/modules/AccessDeniedDialog.d.ts +3 -1
  52. package/dist/components/modules/ModuleAccessGuard.d.ts +3 -1
  53. package/dist/components/modules/ModulesContent.d.ts +3 -1
  54. package/dist/components/modules/ModulesDialog.d.ts +1 -1
  55. package/dist/components/modules/ModulesFooterCards.d.ts +3 -1
  56. package/dist/components/modules/types.d.ts +2 -0
  57. package/dist/components/ui/accordion.d.ts +35 -0
  58. package/dist/components/ui/action-button.d.ts +5 -0
  59. package/dist/components/ui/alert-dialog.d.ts +82 -0
  60. package/dist/components/ui/alert.d.ts +32 -0
  61. package/dist/components/ui/avatar.d.ts +30 -0
  62. package/dist/components/ui/badge.d.ts +32 -0
  63. package/dist/components/ui/breadcrumb.d.ts +54 -0
  64. package/dist/components/ui/button-group.d.ts +15 -0
  65. package/dist/components/ui/button.d.ts +55 -0
  66. package/dist/components/ui/calendar.d.ts +16 -0
  67. package/dist/components/ui/card.d.ts +49 -0
  68. package/dist/components/ui/chart.d.ts +35 -0
  69. package/dist/components/ui/checkbox.d.ts +11 -0
  70. package/dist/components/ui/collapsible.d.ts +15 -0
  71. package/dist/components/ui/color-picker.d.ts +5 -0
  72. package/dist/components/ui/combo-tree.d.ts +23 -0
  73. package/dist/components/ui/combobox.d.ts +28 -0
  74. package/dist/components/ui/command.d.ts +66 -0
  75. package/dist/components/ui/context-menu.d.ts +95 -0
  76. package/dist/components/ui/date-picker.d.ts +10 -0
  77. package/dist/components/ui/dialog-wizard.d.ts +22 -4
  78. package/dist/components/ui/dialog.d.ts +181 -0
  79. package/dist/components/ui/drawer.d.ts +72 -0
  80. package/dist/components/ui/dropdown-menu.d.ts +153 -0
  81. package/dist/components/ui/electronic-signature-dialog.d.ts +10 -0
  82. package/dist/components/ui/export-dialog.d.ts +20 -0
  83. package/dist/components/ui/form.d.ts +96 -0
  84. package/dist/components/ui/hover-card.d.ts +15 -0
  85. package/dist/components/ui/icon-picker.d.ts +5 -0
  86. package/dist/components/ui/iframe-dialog.d.ts +10 -0
  87. package/dist/components/ui/input-group.d.ts +16 -0
  88. package/dist/components/ui/input.d.ts +5 -0
  89. package/dist/components/ui/menubar.d.ts +80 -0
  90. package/dist/components/ui/multiselect-permissions.d.ts +25 -0
  91. package/dist/components/ui/navigation-menu.d.ts +45 -0
  92. package/dist/components/ui/onboarding-dialog.d.ts +15 -0
  93. package/dist/components/ui/online-editor-dialog.d.ts +10 -0
  94. package/dist/components/ui/pagination.d.ts +53 -0
  95. package/dist/components/ui/popover.d.ts +8 -0
  96. package/dist/components/ui/radio-group.d.ts +3 -0
  97. package/dist/components/ui/report-request-list.d.ts +20 -0
  98. package/dist/components/ui/resizable.d.ts +15 -0
  99. package/dist/components/ui/rich-text-editor.d.ts +13 -0
  100. package/dist/components/ui/scroll-area.d.ts +3 -0
  101. package/dist/components/ui/select.d.ts +71 -0
  102. package/dist/components/ui/separator.d.ts +13 -0
  103. package/dist/components/ui/sheet.d.ts +76 -0
  104. package/dist/components/ui/sidebar.d.ts +203 -0
  105. package/dist/components/ui/skeleton-variants.d.ts +25 -0
  106. package/dist/components/ui/skeleton.d.ts +12 -0
  107. package/dist/components/ui/slider.d.ts +5 -0
  108. package/dist/components/ui/sonner.d.ts +5 -0
  109. package/dist/components/ui/spinner.d.ts +5 -0
  110. package/dist/components/ui/split-button.d.ts +6 -0
  111. package/dist/components/ui/stack.d.ts +5 -0
  112. package/dist/components/ui/status-badge.d.ts +3 -0
  113. package/dist/components/ui/step-selector.d.ts +5 -0
  114. package/dist/components/ui/stimulsoft-viewer.d.ts +8 -0
  115. package/dist/components/ui/switch.d.ts +21 -0
  116. package/dist/components/ui/tab-page-layout.d.ts +33 -0
  117. package/dist/components/ui/table-resize-handle.d.ts +10 -3
  118. package/dist/components/ui/table.d.ts +102 -0
  119. package/dist/components/ui/tabs.d.ts +59 -0
  120. package/dist/components/ui/terms-of-use-dialog.d.ts +50 -4
  121. package/dist/components/ui/textarea.d.ts +27 -0
  122. package/dist/components/ui/timepicker.d.ts +23 -0
  123. package/dist/components/ui/toggle-group.d.ts +25 -0
  124. package/dist/components/ui/toggle.d.ts +21 -0
  125. package/dist/components/ui/tooltip.d.ts +48 -0
  126. package/dist/components/ui/truncated-cell.d.ts +13 -0
  127. package/dist/components/ui/typography.d.ts +119 -0
  128. package/dist/components/ui/updates-notification.d.ts +33 -0
  129. package/dist/components/ui/users-groups-selector.d.ts +43 -0
  130. package/dist/components/ui/viewer-dialog.d.ts +107 -0
  131. package/dist/crud/components/ActionMenuItems.d.ts +5 -0
  132. package/dist/crud/components/BaseForm.d.ts +46 -0
  133. package/dist/crud/components/ColumnSettingsPopover.d.ts +10 -0
  134. package/dist/crud/components/CrudActionBar.d.ts +20 -0
  135. package/dist/crud/components/CrudGrid.d.ts +10 -0
  136. package/dist/crud/components/CrudPagination.d.ts +5 -0
  137. package/dist/crud/components/CrudTable.d.ts +5 -0
  138. package/dist/crud/components/TableRowActions.d.ts +5 -0
  139. package/dist/crud/createCrudPage.d.ts +41 -8
  140. package/dist/crud/generateCrudConfig.d.ts +13 -8
  141. package/dist/crud/hooks/useBaseForm.d.ts +39 -0
  142. package/dist/crud/hooks/useColumnManager.d.ts +25 -0
  143. package/dist/crud/hooks/useCrud.d.ts +35 -0
  144. package/dist/crud/primitives/ActionMenu.d.ts +41 -0
  145. package/dist/crud/primitives/FilterBar.d.ts +45 -0
  146. package/dist/crud/primitives/Pagination.d.ts +5 -0
  147. package/dist/crud/primitives/Table.d.ts +5 -0
  148. package/dist/crud/primitives/TreeTable.d.ts +5 -0
  149. package/dist/crud/primitives/types.d.ts +57 -0
  150. package/dist/crud/utils/routingHelpers.d.ts +11 -0
  151. package/dist/custom-form-fields/components/CustomFormFields.d.ts +3 -0
  152. package/dist/custom-form-fields/fields/FormDateField.d.ts +3 -0
  153. package/dist/custom-form-fields/fields/FormMultiSelectionField.d.ts +3 -0
  154. package/dist/custom-form-fields/fields/FormNumericField.d.ts +3 -0
  155. package/dist/custom-form-fields/fields/FormQuestionsField.d.ts +3 -0
  156. package/dist/custom-form-fields/fields/FormSingleSelectionField.d.ts +3 -0
  157. package/dist/custom-form-fields/fields/FormTextField.d.ts +3 -0
  158. package/dist/custom-form-fields/fields/FormTimeField.d.ts +3 -0
  159. package/dist/custom-form-fields/fields/FormUrlField.d.ts +3 -0
  160. package/dist/custom-form-fields/fields/ReadOnlyTextField.d.ts +3 -0
  161. package/dist/custom-form-fields/types.d.ts +84 -21
  162. package/dist/exports/integrations.d.ts +1 -0
  163. package/dist/file-upload/components/SingleFileUpload.d.ts +59 -0
  164. package/dist/file-upload/types.d.ts +15 -0
  165. package/dist/file-upload/utils/formatBytes.d.ts +5 -0
  166. package/dist/file-upload/utils/getFileExtension.d.ts +5 -0
  167. package/dist/hooks/useColumnResize.d.ts +24 -0
  168. package/dist/hooks/useRowResize.d.ts +18 -0
  169. package/dist/hooks/useSidebarResize.d.ts +18 -0
  170. package/dist/hooks/useUpdatesNotification.d.ts +16 -0
  171. package/dist/index.css +1 -1
  172. package/dist/index.css.map +1 -1
  173. package/dist/index.esm.js +1 -1
  174. package/dist/index.js +1 -1
  175. package/dist/integrations/clarity/clarityTracking.d.ts +31 -0
  176. package/dist/integrations/clarity/index.d.ts +3 -0
  177. package/dist/integrations/clarity/types.d.ts +46 -0
  178. package/dist/integrations/clarity/useClarity.d.ts +34 -0
  179. package/dist/integrations/index.d.ts +5 -0
  180. package/dist/providers/CoreProviders.d.ts +16 -1
  181. package/dist/qualiex/components/QualiexUserField.d.ts +8 -0
  182. package/dist/qualiex/hooks/useQualiexUsers.d.ts +16 -26
  183. package/dist/qualiex/services/qualiexApi.d.ts +38 -2
  184. package/dist/qualiex/utils/QualiexErrorInterceptor.d.ts +5 -0
  185. package/dist/supabase/SupabaseSingleton.d.ts +34 -0
  186. package/dist/types.d.ts +51 -2
  187. package/dist/vite/index.esm.js +4 -1
  188. package/dist/vite/index.js +4 -1
  189. package/docs/STORAGE_BUCKETS.md +384 -0
  190. package/docs/WORKSPACE_KNOWLEDGE.md +1 -0
  191. package/docs/design-system/README.md +1 -1
  192. package/docs/design-system/patterns/core-providers.md +2 -0
  193. package/docs/design-system/selectors.md +4 -0
  194. package/package.json +7 -1
  195. package/dist/components/ui/__tests__/status-badge.test.d.ts +0 -1
@@ -1,3 +1,12 @@
1
+ /**
2
+ * Tipos de viewer suportados pelo `ViewerDialog`. Resolvido automaticamente
3
+ * pela extensão do arquivo via `getViewerType`.
4
+ *
5
+ * @example
6
+ * ```tsx
7
+ * if (type === FileViewerType.image) { ... }
8
+ * ```
9
+ */
1
10
  export declare enum FileViewerType {
2
11
  none = 0,
3
12
  image = 1,
@@ -7,17 +16,42 @@ export declare enum FileViewerType {
7
16
  onlineEditor = 5,
8
17
  report = 6
9
18
  }
19
+ /**
20
+ * Modo de impressão para documentos controlados (cópia gerenciada / não gerenciada).
21
+ *
22
+ * @example
23
+ * ```tsx
24
+ * config.printType = FilePrintType.ManagedCopy;
25
+ * ```
26
+ */
10
27
  export declare enum FilePrintType {
11
28
  SimplePrint = 0,
12
29
  ManagedCopy = 1,
13
30
  NonManagedCopy = 2
14
31
  }
32
+ /**
33
+ * Descritor de um arquivo a ser visualizado pelo `ViewerDialog`.
34
+ *
35
+ * @example
36
+ * ```tsx
37
+ * const tpl: FileViewerTemplate = { name: 'manual.pdf', extension: '.pdf', url: '/files/123' };
38
+ * ```
39
+ */
15
40
  export interface FileViewerTemplate {
16
41
  code?: string;
17
42
  name: string;
18
43
  extension?: string;
19
44
  url: string;
20
45
  }
46
+ /**
47
+ * Configuração para visualização de documentos controlados (Qualiex).
48
+ * Reúne callbacks para criação de cópia física e marca d'água.
49
+ *
50
+ * @example
51
+ * ```tsx
52
+ * const cfg: ViewerDocumentControlConfig = { isControlledDocument: true, physicalCopyCode: 'C-001' };
53
+ * ```
54
+ */
21
55
  export interface ViewerDocumentControlConfig {
22
56
  isControlledDocument?: boolean;
23
57
  physicalCopyCode?: string | null;
@@ -32,6 +66,15 @@ export interface ViewerDocumentControlConfig {
32
66
  isDownload?: boolean;
33
67
  }) => Promise<any>;
34
68
  }
69
+ /**
70
+ * Props do `ViewerDialog`. Suporta imagem, vídeo, áudio, PDF/Office (WOPI),
71
+ * editor online (Google Docs) e relatórios (iframe genérico).
72
+ *
73
+ * @example
74
+ * ```tsx
75
+ * const props: ViewerDialogProps = { open, onOpenChange, template };
76
+ * ```
77
+ */
35
78
  export interface ViewerDialogProps {
36
79
  open: boolean;
37
80
  onOpenChange: (open: boolean) => void;
@@ -62,9 +105,51 @@ export interface ViewerDialogProps {
62
105
  /** Custom className for the dialog */
63
106
  className?: string;
64
107
  }
108
+ /**
109
+ * Resolve o `FileViewerType` a partir da extensão do arquivo (case-insensitive).
110
+ * Retorna `FileViewerType.none` quando a extensão não é suportada.
111
+ *
112
+ * @example
113
+ * ```tsx
114
+ * getViewerType('.pdf'); // FileViewerType.wopi
115
+ * getViewerType('.png'); // FileViewerType.image
116
+ * ```
117
+ */
65
118
  export declare function getViewerType(extension?: string): FileViewerType;
119
+ /**
120
+ * Resolve qual editor online (Google Docs vs Sheets) deve ser usado pela extensão.
121
+ *
122
+ * @example
123
+ * ```tsx
124
+ * getOnlineViewerType('.gsheets'); // 'spreadsheets'
125
+ * ```
126
+ */
66
127
  export declare function getOnlineViewerType(extension: string): 'document' | 'spreadsheets';
128
+ /**
129
+ * Resolve a rota WOPI (Office Web Apps) para a extensão informada.
130
+ * Retorna string vazia quando não suportado.
131
+ *
132
+ * @example
133
+ * ```tsx
134
+ * getWopiViewer('.docx'); // 'wv/wordviewerframe.aspx?'
135
+ * ```
136
+ */
67
137
  export declare function getWopiViewer(extension: string): string;
138
+ /**
139
+ * Constrói a URL completa do WOPI viewer com query params (`access_token`, `WOPISrc`, `ui`).
140
+ * Retorna `null` se a extensão não tiver viewer WOPI mapeado.
141
+ *
142
+ * @example
143
+ * ```tsx
144
+ * const url = buildWopiUrl({
145
+ * viewerUrl: 'https://wopi.qualiex.com/',
146
+ * wopiUrl: 'https://api.qualiex.com/wopi/files/',
147
+ * fileId: '42',
148
+ * token: 'abc',
149
+ * extension: '.pdf',
150
+ * });
151
+ * ```
152
+ */
68
153
  export declare function buildWopiUrl(params: {
69
154
  viewerUrl: string;
70
155
  wopiUrl: string;
@@ -73,5 +158,27 @@ export declare function buildWopiUrl(params: {
73
158
  extension: string;
74
159
  language?: string;
75
160
  }): string | null;
161
+ /**
162
+ * Dialog full-screen para visualizar arquivos de qualquer tipo. Detecta
163
+ * automaticamente o viewer apropriado pela extensão (`getViewerType`):
164
+ * imagem (`<img>`), vídeo (`<video>`), áudio (`<audio>`), PDF/Office (iframe WOPI),
165
+ * editor online (Google Docs/Sheets) ou relatório (iframe).
166
+ *
167
+ * Recursos do header: botão de download, favoritar e confirmação de leitura
168
+ * (com timer mínimo opcional). Fecha com **ESC** ou clique no X.
169
+ *
170
+ * @example
171
+ * ```tsx
172
+ * <ViewerDialog
173
+ * open={open}
174
+ * onOpenChange={setOpen}
175
+ * template={{ name: 'Manual.pdf', extension: '.pdf', url: pdfUrl }}
176
+ * enableDownload
177
+ * onDownload={handleDownload}
178
+ * />
179
+ * ```
180
+ *
181
+ * @see `docs/design-system/dialogs.md`
182
+ */
76
183
  export declare function ViewerDialog({ open, onOpenChange, template, viewerType: viewerTypeProp, isLoading, enableDownload, onDownload, isDownloading, enableFavorite, isFavorite, onFavorite, isFavoriting, enableConfirmReading, readingConfirmationDate, onConfirmReading, isConfirmingReading, readingConfirmationTimeRemaining, onIframeLoad, className, }: ViewerDialogProps): import("react/jsx-runtime").JSX.Element;
77
184
  export default ViewerDialog;
@@ -13,5 +13,10 @@ interface ActionMenuItemsProps {
13
13
  }>;
14
14
  renderAs: 'dropdown' | 'context';
15
15
  }
16
+ /**
17
+ * Componente `ActionMenuItems` da lib.
18
+ * @example
19
+ * <ActionMenuItems />
20
+ */
16
21
  export declare const ActionMenuItems: React.FC<ActionMenuItemsProps>;
17
22
  export {};
@@ -1,4 +1,50 @@
1
1
  import type { BaseFormProps } from '../../types';
2
+ /**
3
+ * Formulário modal genérico baseado em configuração declarativa de seções e campos.
4
+ *
5
+ * Renderiza um `Dialog` com navegação por seções (sidebar) quando há 2+ seções, ou um único
6
+ * painel para forms simples. Suporta os tipos: `text`, `number`, `select`, `multiselect`,
7
+ * `textarea`, `switch`, `checkbox`, `color`, `icon`, `qualiex-user` e custom render.
8
+ *
9
+ * Normalmente é renderizado automaticamente por `createCrudPage` — use diretamente apenas
10
+ * para forms standalone (fora do pipeline CRUD).
11
+ *
12
+ * @example
13
+ * const sections: FormSection[] = [
14
+ * {
15
+ * id: 'general',
16
+ * title: 'Dados gerais',
17
+ * fields: [
18
+ * { key: 'title', label: 'Título', type: 'text', required: true },
19
+ * { key: 'description', label: 'Descrição', type: 'textarea' },
20
+ * {
21
+ * key: 'status',
22
+ * label: 'Status',
23
+ * type: 'select',
24
+ * options: [
25
+ * { label: 'Ativo', value: 'active' },
26
+ * { label: 'Pausado', value: 'paused' },
27
+ * ],
28
+ * },
29
+ * ],
30
+ * },
31
+ * {
32
+ * id: 'responsible',
33
+ * title: 'Responsável',
34
+ * fields: [{ key: 'id_user', label: 'Usuário', type: 'qualiex-user', required: true }],
35
+ * },
36
+ * ];
37
+ *
38
+ * <BaseForm
39
+ * open={isOpen}
40
+ * title="Novo plano de ação"
41
+ * sections={sections}
42
+ * initialData={editing ?? undefined}
43
+ * isLoading={manager.isCreating || manager.isUpdating}
44
+ * onSubmit={(data) => onSave(data)}
45
+ * onCancel={() => setIsOpen(false)}
46
+ * />
47
+ */
2
48
  declare function BaseForm<T extends Record<string, any>>({ title, sections, initialData, onSubmit, onCancel, open, submitButtonText, isLoading, usersData }: BaseFormProps<T> & {
3
49
  usersData?: any[];
4
50
  isLoading?: boolean;
@@ -1,4 +1,9 @@
1
1
  import type { CrudColumn, BaseEntity } from '../../types';
2
+ /**
3
+ * Tipo `ColumnSettingsPopoverProps` exportado pela lib.
4
+ * @example
5
+ * const value: ColumnSettingsPopoverProps = {} as ColumnSettingsPopoverProps;
6
+ */
2
7
  export interface ColumnSettingsPopoverProps<T> {
3
8
  columns: CrudColumn<T>[];
4
9
  columnOrder: string[];
@@ -15,4 +20,9 @@ export interface ColumnSettingsPopoverProps<T> {
15
20
  addGroupByColumn?: (key: string) => void;
16
21
  removeGroupByColumn?: (key: string) => void;
17
22
  }
23
+ /**
24
+ * Função utilitária `ColumnSettingsPopover`.
25
+ * @example
26
+ * ColumnSettingsPopover();
27
+ */
18
28
  export declare function ColumnSettingsPopover<T extends BaseEntity>({ columns, columnOrder, isColumnHidden, toggleColumn, showAllColumns, reorderColumns, groupByColumn, setGroupByColumn, groupByColumns, addGroupByColumn, removeGroupByColumn, resetColumns, }: ColumnSettingsPopoverProps<T>): import("react/jsx-runtime").JSX.Element;
@@ -1,5 +1,10 @@
1
1
  import React from 'react';
2
2
  import type { BaseEntity, BulkAction } from '../../types';
3
+ /**
4
+ * Tipo `CustomAction` exportado pela lib.
5
+ * @example
6
+ * const value: CustomAction = {} as CustomAction;
7
+ */
3
8
  export interface CustomAction {
4
9
  label: string;
5
10
  icon?: React.ComponentType<{
@@ -11,7 +16,17 @@ export interface CustomAction {
11
16
  disabled?: boolean;
12
17
  disabledReason?: string;
13
18
  }
19
+ /**
20
+ * Tipo `ViewMode` exportado pela lib.
21
+ * @example
22
+ * const value: ViewMode = {} as ViewMode;
23
+ */
14
24
  export type ViewMode = 'table' | 'list' | 'grid';
25
+ /**
26
+ * Tipo `CrudActionBarProps` exportado pela lib.
27
+ * @example
28
+ * const value: CrudActionBarProps = {} as CrudActionBarProps;
29
+ */
15
30
  export interface CrudActionBarProps<T extends BaseEntity = BaseEntity> {
16
31
  onNew?: () => void;
17
32
  newButtonLabel?: string;
@@ -35,5 +50,10 @@ export interface CrudActionBarProps<T extends BaseEntity = BaseEntity> {
35
50
  className?: string;
36
51
  }
37
52
  declare function CrudActionBarComponent<T extends BaseEntity = BaseEntity>({ onNew, newButtonLabel, showNewButton, showSearch, searchValue, onSearchChange, searchPlaceholder, showBulkActions, selectedCount, bulkActions, onBulkDelete, onClearSelection, customActions, filters, viewMode, onViewModeChange, showViewToggle, availableViewModes, rightSlot, className, }: CrudActionBarProps<T>): import("react/jsx-runtime").JSX.Element;
53
+ /**
54
+ * Componente `CrudActionBar` da lib.
55
+ * @example
56
+ * <CrudActionBar />
57
+ */
38
58
  export declare const CrudActionBar: typeof CrudActionBarComponent;
39
59
  export default CrudActionBar;
@@ -1,6 +1,11 @@
1
1
  import React from 'react';
2
2
  import type { CrudColumn, CrudManager, BaseEntity, BulkAction } from '../../types';
3
3
  import { type CustomAction, type ViewMode } from './CrudActionBar';
4
+ /**
5
+ * Tipo `CrudGridProps` exportado pela lib.
6
+ * @example
7
+ * const value: CrudGridProps = {} as CrudGridProps;
8
+ */
4
9
  export interface CrudGridProps<T extends BaseEntity & {
5
10
  is_actived?: boolean;
6
11
  }> {
@@ -39,5 +44,10 @@ export interface CrudGridProps<T extends BaseEntity & {
39
44
  gridCardRenderer?: (item: T) => React.ReactNode;
40
45
  showViewToggle?: boolean;
41
46
  }
47
+ /**
48
+ * Componente `CrudGrid` da lib.
49
+ * @example
50
+ * <CrudGrid />
51
+ */
42
52
  export declare const CrudGrid: <T extends BaseEntity>({ manager, columns, onEdit, onView, onToggleStatus, onDelete, renderActions, customRowActions, enableBulkActions, onNew, newButtonLabel, showNewButton, customActions, hideActionBar, showActionBar, showSearch, searchValue, onSearchChange, searchPlaceholder, bulkActions, onBulkDelete, filters, gridColumns, renderCard, viewMode, onViewModeChange, listCardRenderer, gridCardRenderer, showViewToggle }: CrudGridProps<T>) => import("react/jsx-runtime").JSX.Element;
43
53
  export default CrudGrid;
@@ -8,5 +8,10 @@ import type { CrudManager, BaseEntity } from '../../types';
8
8
  interface CrudPaginationProps<T extends BaseEntity> {
9
9
  manager: Pick<CrudManager<T>, 'pagination' | 'handlePageChange' | 'handleItemsPerPageChange'>;
10
10
  }
11
+ /**
12
+ * Função utilitária `CrudPagination`.
13
+ * @example
14
+ * CrudPagination();
15
+ */
11
16
  export declare function CrudPagination<T extends BaseEntity>({ manager }: CrudPaginationProps<T>): import("react/jsx-runtime").JSX.Element;
12
17
  export { CrudPagination as TableFooter };
@@ -57,5 +57,10 @@ export interface CrudTableProps<T extends BaseEntity & {
57
57
  /** Oculta a coluna de ações separada. Útil quando ações são renderizadas dentro de uma coluna customizada. */
58
58
  hideActionsColumn?: boolean;
59
59
  }
60
+ /**
61
+ * Componente `CrudTable` da lib.
62
+ * @example
63
+ * <CrudTable />
64
+ */
60
65
  export declare const CrudTable: <T extends BaseEntity>({ manager, columns, onEdit, onView, onToggleStatus, onDelete, renderActions, customRowActions, enableBulkActions, rowActionsVariant, onNew, newButtonLabel, showNewButton, customActions, hideActionBar, showActionBar, showSearch, searchValue, onSearchChange, searchPlaceholder, bulkActions, onBulkDelete, filters, viewMode, onViewModeChange, showViewToggle, enableColumnResize, resizeStorageKey, enableColumnManager, columnManagerStorageKey, defaultHiddenColumns, enableGrouping, enableExpandableRows, renderExpandedContent, expandedRowIds: controlledExpandedIds, onToggleExpand: controlledToggleExpand, defaultExpandAll, hideActionsColumn, }: CrudTableProps<T>) => import("react/jsx-runtime").JSX.Element;
61
66
  export default CrudTable;
@@ -10,5 +10,10 @@ interface TableRowActionsProps {
10
10
  onClick: () => void;
11
11
  }>;
12
12
  }
13
+ /**
14
+ * Componente `TableRowActions` da lib.
15
+ * @example
16
+ * <TableRowActions />
17
+ */
13
18
  export declare const TableRowActions: React.FC<TableRowActionsProps>;
14
19
  export {};
@@ -57,6 +57,11 @@ interface CrudPageGeneratorConfig<T extends CrudEntity> {
57
57
  onEdit?: (entity: T) => T | void | Promise<T | void>;
58
58
  onToggleStatus?: (item: T) => void;
59
59
  }
60
+ /**
61
+ * Função utilitária `CrudPageInternal`.
62
+ * @example
63
+ * CrudPageInternal();
64
+ */
60
65
  declare function CrudPageInternal<T extends CrudEntity>({ manager, config, formSections, onSave, onToggleStatus, defaultSort, }: {
61
66
  manager: any;
62
67
  config: CrudPageConfig<T>;
@@ -69,18 +74,46 @@ declare function CrudPageInternal<T extends CrudEntity>({ manager, config, formS
69
74
  };
70
75
  }): import("react/jsx-runtime").JSX.Element;
71
76
  /**
72
- * Gera uma página CRUD completa
77
+ * Gera uma página CRUD completa (toolbar + tabela + paginação + form modal + confirmações).
73
78
  *
74
- * @example
75
- * ```typescript
76
- * const CrudPage = createCrudPage({
77
- * manager,
78
- * config: { entityName: 'Funcionário', ... },
79
- * onSave: handleSave
79
+ * **IMPORTANTE**: a config deve ser memoizada (`useMemo` ou definida fora do componente)
80
+ * para evitar desmontagem e flicker no render — ver
81
+ * `mem://patterns/admin-render-optimization`.
82
+ *
83
+ * @example Pipeline completo
84
+ * ```tsx
85
+ * const employeesService = createSimpleService<Employee>({
86
+ * tableName: 'employees',
87
+ * schema: 'common',
80
88
  * });
89
+ *
90
+ * function EmployeesPage() {
91
+ * const manager = useCrudHook(employeesService);
92
+ *
93
+ * const Page = useMemo(() => createCrudPage<Employee>({
94
+ * manager,
95
+ * config: {
96
+ * entityName: 'Funcionário',
97
+ * entityNamePlural: 'Funcionários',
98
+ * columns: [...],
99
+ * formSections: [...],
100
+ * defaultHiddenColumns: ['created_at'], // formato: column.key
101
+ * },
102
+ * onSave: createSimpleSaveHandler(manager, c => c, u => u),
103
+ * }), [manager]);
104
+ *
105
+ * return <Page />;
106
+ * }
81
107
  * ```
82
108
  *
83
- * Ver README para exemplos completos
109
+ * @remarks
110
+ * - `onNew`: handler customizado para o botão "Novo" (abre wizard ao invés do modal padrão).
111
+ * - `useCustomRouting`: desabilita o `BaseForm` interno (use quando o "Novo/Editar" navega para outra rota).
112
+ * - `defaultHiddenColumns`: chaves de coluna escondidas no primeiro acesso (ignorado se houver
113
+ * estado salvo do column manager).
114
+ * - `hideNewButton`: **deprecated** — use `showNewButton={false}`.
115
+ *
116
+ * @see `docs/design-system/crud.md`
84
117
  */
85
118
  export declare function createCrudPage<T extends CrudEntity>(generatorConfig: CrudPageGeneratorConfig<T>): React.FC<{
86
119
  manager?: any;
@@ -1,16 +1,21 @@
1
1
  import { GeneratedCrudConfig, EntityWithId } from '../types';
2
2
  /**
3
- * Gera automaticamente configuração CRUD a partir de uma interface TypeScript
3
+ * Gera automaticamente configuração CRUD a partir de uma interface TypeScript.
4
4
  *
5
- * **USO AVANÇADO:** Para a maioria dos casos, use `useMemo` direto com config manual.
6
- * Esta função é útil para gerar configs dinamicamente em tempo de execução.
5
+ * **USO AVANÇADO:** Para a maioria dos casos, prefira config manual memoizada com
6
+ * `useMemo` (ver {@link createCrudPage}). Esta função é útil para gerar configs
7
+ * dinamicamente em runtime a partir de uma entidade-amostra.
7
8
  *
8
- * Analisa os campos da entidade e cria colunas com tipos inteligentes baseados em:
9
- * - Nome do campo (ex: "email" type: 'email')
10
- * - Tipo do valor (ex: boolean type: 'boolean')
11
- * - Padrões comuns (ex: "description" type: 'textarea')
9
+ * @remarks
10
+ * A inferência roda em runtime via `Object.keys(sampleEntity)` campos que não estão
11
+ * presentes em `sampleEntity` (ainda que existam no tipo `T`) **não geram coluna**.
12
+ * Sempre passe um objeto com todas as chaves desejadas, mesmo com valores vazios/zero.
12
13
  *
13
- * Para exemplos completos de configuração manual, veja o README (Tutorial CRUD de Examples).
14
+ * Heurísticas de tipo:
15
+ * - Nome do campo (ex: "email" → `type: 'email'`, "description" → `type: 'textarea'`).
16
+ * - Tipo do valor (boolean/number/Date).
17
+ *
18
+ * @see {@link createCrudPage} para o fluxo recomendado.
14
19
  *
15
20
  * @example
16
21
  * ```typescript
@@ -1,4 +1,43 @@
1
1
  import { FormField } from '../../types';
2
+ /**
3
+ * Hook que gerencia estado, validação e defaults de um formulário declarativo (FormField[]).
4
+ *
5
+ * É o motor interno do {@link BaseForm} — exporte para reaproveitar o sistema de campos
6
+ * fora do `Dialog` padrão (ex: forms inline, wizards, drawers).
7
+ *
8
+ * Aplica defaults por tipo (`text` → `''`, `switch` → `false`, `multiselect` → `[]`, etc.)
9
+ * e expõe `setField`, `validate` e `reset`.
10
+ *
11
+ * @example
12
+ * const fields: FormField[] = [
13
+ * { key: 'title', label: 'Título', type: 'text', required: true },
14
+ * { key: 'is_active', label: 'Ativo', type: 'switch', defaultValue: true },
15
+ * ];
16
+ *
17
+ * function MyDrawerForm({ initial, onSave }) {
18
+ * const { formData, errors, setField, validate, reset } = useBaseForm(
19
+ * fields,
20
+ * initial,
21
+ * (data) => console.log('changed', data),
22
+ * true, // open
23
+ * );
24
+ *
25
+ * const handleSubmit = () => {
26
+ * if (validate()) onSave(formData);
27
+ * };
28
+ *
29
+ * return (
30
+ * <>
31
+ * <Input
32
+ * value={formData.title ?? ''}
33
+ * onChange={(e) => setField('title', e.target.value)}
34
+ * error={errors.title}
35
+ * />
36
+ * <Button onClick={handleSubmit}>Salvar</Button>
37
+ * </>
38
+ * );
39
+ * }
40
+ */
2
41
  export declare function useBaseForm<T extends Record<string, any>>(fields: FormField[], initialData?: Partial<T>, onFormDataChange?: (data: T) => void, open?: boolean): {
3
42
  formData: T;
4
43
  errors: Record<string, string>;
@@ -1,9 +1,19 @@
1
1
  import type { CrudColumn, BaseEntity } from '../../types';
2
+ /**
3
+ * Tipo `ColumnManagerState` exportado pela lib.
4
+ * @example
5
+ * const value: ColumnManagerState = {} as ColumnManagerState;
6
+ */
2
7
  export interface ColumnManagerState {
3
8
  hiddenColumns: Set<string>;
4
9
  columnOrder: string[];
5
10
  groupByColumns: string[];
6
11
  }
12
+ /**
13
+ * Tipo `UseColumnManagerOptions` exportado pela lib.
14
+ * @example
15
+ * const value: UseColumnManagerOptions = {} as UseColumnManagerOptions;
16
+ */
7
17
  export interface UseColumnManagerOptions<T> {
8
18
  columns: CrudColumn<T>[];
9
19
  storageKey?: string;
@@ -11,6 +21,11 @@ export interface UseColumnManagerOptions<T> {
11
21
  /** Column keys to hide by default (before any user interaction). Only applied when no saved state exists. */
12
22
  defaultHiddenColumns?: string[];
13
23
  }
24
+ /**
25
+ * Tipo `UseColumnManagerReturn` exportado pela lib.
26
+ * @example
27
+ * const value: UseColumnManagerReturn = {} as UseColumnManagerReturn;
28
+ */
14
29
  export interface UseColumnManagerReturn<T> {
15
30
  /** Columns filtered by visibility and reordered */
16
31
  visibleColumns: CrudColumn<T>[];
@@ -49,6 +64,11 @@ export interface UseColumnManagerReturn<T> {
49
64
  /** Toggle group collapse */
50
65
  toggleGroupCollapse: (groupKey: string) => void;
51
66
  }
67
+ /**
68
+ * Tipo `GroupedData` exportado pela lib.
69
+ * @example
70
+ * const value: GroupedData = {} as GroupedData;
71
+ */
52
72
  export interface GroupedData<T> {
53
73
  groupKey: string;
54
74
  groupValue: string;
@@ -57,4 +77,9 @@ export interface GroupedData<T> {
57
77
  level: number;
58
78
  children?: GroupedData<T>[];
59
79
  }
80
+ /**
81
+ * Função utilitária `useColumnManager`.
82
+ * @example
83
+ * useColumnManager();
84
+ */
60
85
  export declare function useColumnManager<T extends BaseEntity>({ columns, storageKey, enabled, defaultHiddenColumns, }: UseColumnManagerOptions<T>): UseColumnManagerReturn<T>;
@@ -72,6 +72,41 @@ interface CrudConfig<T, TInsert = Partial<T>, TUpdate = Partial<T>> {
72
72
  additionalFilters?: Record<string, any>;
73
73
  onSuccess?: () => void;
74
74
  }
75
+ /**
76
+ * Hook genérico para operações CRUD com React Query (busca, paginação, mutations, bulk).
77
+ *
78
+ * **Uso recomendado**: invoque via `createSimpleService` — ele já configura `queryKey` e `service`.
79
+ * Use diretamente apenas quando precisar de um service customizado (RPC, edge function, etc).
80
+ *
81
+ * @example
82
+ * // Via createSimpleService (recomendado)
83
+ * const { useCrudHook } = createSimpleService<Employee>({
84
+ * tableName: 'employees',
85
+ * schema: 'central',
86
+ * searchFields: ['name', 'email'],
87
+ * });
88
+ * const manager = useCrudHook();
89
+ *
90
+ * @example
91
+ * // Uso direto com service customizado
92
+ * const manager = useCrud<Project>({
93
+ * queryKey: 'projects',
94
+ * entityName: 'projeto',
95
+ * service: {
96
+ * getAll: (params) => projectsApi.list(params),
97
+ * create: (data) => projectsApi.create(data),
98
+ * update: (id, data) => projectsApi.update(id, data),
99
+ * delete: (id) => projectsApi.softDelete(id),
100
+ * },
101
+ * additionalFilters: { id_status: 'active' },
102
+ * onSuccess: () => navigate('/projects'),
103
+ * });
104
+ *
105
+ * @example
106
+ * // Consumindo o manager retornado
107
+ * const { entities, isLoading, createEntity, deleteEntity, pagination, handleSort } = manager;
108
+ * <Button onClick={() => createEntity({ title: 'Novo' })}>Criar</Button>
109
+ */
75
110
  export declare function useCrud<T extends {
76
111
  id: string;
77
112
  }, TInsert = Partial<T>, TUpdate = Partial<T>>({ queryKey, service, entityName, searchFields, additionalFilters, onSuccess }: CrudConfig<T, TInsert, TUpdate>): {
@@ -25,4 +25,45 @@
25
25
  * ```
26
26
  */
27
27
  import type { ActionMenuProps } from './types';
28
+ /**
29
+ * Menu de ações por linha — renderiza dropdown (`renderAs="dropdown"`) ou botões inline
30
+ * (`renderAs="inline"`). Acoplado às convenções do CRUD (Edit / Delete / Toggle Status)
31
+ * mas extensível via `customActions`.
32
+ *
33
+ * Para tabelas inteiras, prefira a prop `rowActions` do `CrudTable` — só use este primitive
34
+ * quando precisar de um menu fora do contexto de tabela.
35
+ *
36
+ * @example
37
+ * // Dropdown padrão (3 dots) com Edit + Delete
38
+ * <ActionMenu
39
+ * onEdit={() => openEdit(row)}
40
+ * onDelete={() => confirmDelete(row.id)}
41
+ * canDelete={row.id_user === currentUser.id}
42
+ * />
43
+ *
44
+ * @example
45
+ * // Inline compacto com ações customizadas + bloqueio condicional
46
+ * <ActionMenu
47
+ * renderAs="inline"
48
+ * variant="compact"
49
+ * onEdit={() => openEdit(row)}
50
+ * customActions={[
51
+ * { label: 'Duplicar', icon: Copy, onClick: () => duplicate(row) },
52
+ * {
53
+ * label: 'Arquivar',
54
+ * icon: Archive,
55
+ * onClick: () => archive(row),
56
+ * disabled: row.status === 'completed',
57
+ * disabledReason: 'Planos concluídos não podem ser arquivados',
58
+ * },
59
+ * ]}
60
+ * />
61
+ *
62
+ * @example
63
+ * // Toggle de status (ativar/desativar) com ícone dinâmico
64
+ * <ActionMenu
65
+ * onToggleStatus={() => toggleActive(row.id)}
66
+ * isActive={row.is_actived}
67
+ * />
68
+ */
28
69
  export declare function ActionMenu({ onEdit, onDelete, onToggleStatus, isActive, canEdit, canDelete, customActions, renderAs, variant }: ActionMenuProps): import("react/jsx-runtime").JSX.Element;
@@ -21,4 +21,49 @@
21
21
  * ```
22
22
  */
23
23
  import type { FilterBarProps } from './types';
24
+ /**
25
+ * Barra de filtros primitiva: busca textual + slots para filtros customizados (selects,
26
+ * date ranges, etc) + botão "Limpar filtros" automático.
27
+ *
28
+ * Para CRUDs completos, prefira `CrudActionBar` (já integra com o manager). Use este
29
+ * primitive apenas para listas/dashboards fora do pipeline CRUD.
30
+ *
31
+ * Ver `mem://patterns/primitive-search-strategies` para a diferença entre busca local
32
+ * (`DataFilterBar`) e busca global (`AppHeader`).
33
+ *
34
+ * @example
35
+ * // Busca + 2 filtros customizados horizontais
36
+ * const [search, setSearch] = useState('');
37
+ * const [status, setStatus] = useState('all');
38
+ * const [responsible, setResponsible] = useState<string | null>(null);
39
+ *
40
+ * <FilterBar
41
+ * searchValue={search}
42
+ * onSearchChange={setSearch}
43
+ * customFilters={[
44
+ * <Combobox
45
+ * key="status"
46
+ * options={statusOptions}
47
+ * value={status}
48
+ * onChange={setStatus}
49
+ * placeholder="Status"
50
+ * />,
51
+ * <QualiexUserField
52
+ * key="responsible"
53
+ * value={responsible}
54
+ * onChange={setResponsible}
55
+ * placeholder="Responsável"
56
+ * />,
57
+ * ]}
58
+ * onClearFilters={() => {
59
+ * setSearch('');
60
+ * setStatus('all');
61
+ * setResponsible(null);
62
+ * }}
63
+ * />
64
+ *
65
+ * @example
66
+ * // Layout vertical (sidebar de filtros)
67
+ * <FilterBar layout="vertical" searchValue={s} onSearchChange={setS} customFilters={[...]} />
68
+ */
24
69
  export declare function FilterBar({ searchValue, onSearchChange, customFilters, onClearFilters, showClearButton, layout }: FilterBarProps): import("react/jsx-runtime").JSX.Element;
@@ -21,4 +21,9 @@
21
21
  * ```
22
22
  */
23
23
  import type { PaginationProps } from "./types";
24
+ /**
25
+ * Função utilitária `Pagination`.
26
+ * @example
27
+ * Pagination();
28
+ */
24
29
  export declare function Pagination({ currentPage, totalPages, totalItems, itemsPerPage, onPageChange, onItemsPerPageChange, variant, }: PaginationProps): import("react/jsx-runtime").JSX.Element;