@nocios/crudify-components 2.0.61 → 2.0.88

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 (85) hide show
  1. package/README.md +21 -0
  2. package/dist/api-jcCTCqPD.d.mts +61 -0
  3. package/dist/api-jcCTCqPD.d.ts +61 -0
  4. package/dist/chunk-4I767MRM.mjs +142 -0
  5. package/dist/chunk-5V5ILPP3.js +1 -0
  6. package/dist/chunk-BJEDX2HU.js +142 -0
  7. package/dist/chunk-GZOB4JDB.js +1 -0
  8. package/dist/chunk-ODKXUEH5.js +1 -0
  9. package/dist/chunk-U335FNUD.mjs +1 -0
  10. package/dist/chunk-YRU7AXYV.mjs +1 -0
  11. package/dist/chunk-Z75DRSTN.mjs +1 -0
  12. package/dist/{errorTranslation-CF-5JClP.d.ts → errorTranslation-BdqG-dXD.d.ts} +97 -26
  13. package/dist/{errorTranslation-BcX8AaK7.d.mts → errorTranslation-BxJmBGx0.d.mts} +97 -26
  14. package/dist/hooks.d.mts +3 -4
  15. package/dist/hooks.d.ts +3 -4
  16. package/dist/hooks.js +1 -1
  17. package/dist/hooks.mjs +1 -1
  18. package/dist/{index-D06kTP0C.d.mts → index-Cx9P3ZCG.d.mts} +225 -139
  19. package/dist/{index-DEDnmsdO.d.ts → index-rHtWMls-.d.ts} +225 -139
  20. package/dist/index.d.mts +508 -213
  21. package/dist/index.d.ts +508 -213
  22. package/dist/index.js +2 -2
  23. package/dist/index.mjs +2 -2
  24. package/dist/public-policies.d.mts +7 -0
  25. package/dist/public-policies.d.ts +7 -0
  26. package/dist/public-policies.js +1 -0
  27. package/dist/public-policies.mjs +1 -0
  28. package/dist/utils.d.mts +94 -26
  29. package/dist/utils.d.ts +94 -26
  30. package/dist/utils.js +1 -1
  31. package/dist/utils.mjs +1 -1
  32. package/package.json +44 -42
  33. package/.github/workflows/ci.yml +0 -70
  34. package/.husky/pre-commit +0 -26
  35. package/.husky/pre-push +0 -30
  36. package/.nvmrc +0 -1
  37. package/.prettierignore +0 -18
  38. package/.prettierrc +0 -9
  39. package/README_DEPTH.md +0 -1237
  40. package/coverage/base.css +0 -224
  41. package/coverage/block-navigation.js +0 -87
  42. package/coverage/coverage-final.json +0 -120
  43. package/coverage/favicon.png +0 -0
  44. package/coverage/index.html +0 -686
  45. package/coverage/lcov-report/base.css +0 -224
  46. package/coverage/lcov-report/block-navigation.js +0 -87
  47. package/coverage/lcov-report/favicon.png +0 -0
  48. package/coverage/lcov-report/index.html +0 -686
  49. package/coverage/lcov-report/prettify.css +0 -1
  50. package/coverage/lcov-report/prettify.js +0 -2
  51. package/coverage/lcov-report/sort-arrow-sprite.png +0 -0
  52. package/coverage/lcov-report/sorter.js +0 -210
  53. package/coverage/lcov.info +0 -22388
  54. package/coverage/prettify.css +0 -1
  55. package/coverage/prettify.js +0 -2
  56. package/coverage/sort-arrow-sprite.png +0 -0
  57. package/coverage/sorter.js +0 -210
  58. package/dist/CrudiaMarkdownField-CkiBwG-U.d.ts +0 -343
  59. package/dist/CrudiaMarkdownField-D-DqiXMQ.d.mts +0 -343
  60. package/dist/GlobalNotificationProvider-CdwdNv_8.d.mts +0 -96
  61. package/dist/GlobalNotificationProvider-CdwdNv_8.d.ts +0 -96
  62. package/dist/chunk-2WAUZ6KI.js +0 -1
  63. package/dist/chunk-3IGZNZCT.mjs +0 -1
  64. package/dist/chunk-43L2PP77.mjs +0 -1
  65. package/dist/chunk-6VS5OT3A.mjs +0 -1
  66. package/dist/chunk-BWJTTMKS.js +0 -1
  67. package/dist/chunk-EMPPCCVU.js +0 -1
  68. package/dist/chunk-J43UPGBE.js +0 -1
  69. package/dist/chunk-K6ZRXOJ7.mjs +0 -1
  70. package/dist/chunk-RYQQZTEP.js +0 -1
  71. package/dist/chunk-VTMSOK4V.mjs +0 -1
  72. package/dist/components.d.mts +0 -24
  73. package/dist/components.d.ts +0 -24
  74. package/dist/components.js +0 -1
  75. package/dist/components.mjs +0 -1
  76. package/dist/tenantConfig-CYnS9TPV.d.mts +0 -318
  77. package/dist/tenantConfig-CYnS9TPV.d.ts +0 -318
  78. package/eslint.config.mjs +0 -140
  79. package/scripts/bump-version.cjs +0 -23
  80. package/sonar-project.properties +0 -23
  81. package/tests/helpers/testUtils.tsx +0 -89
  82. package/tests/hooks/useSession/testUtils.tsx +0 -212
  83. package/tests/setup.ts +0 -139
  84. package/tests/vitest.d.ts +0 -1
  85. package/vitest.config.ts +0 -39
@@ -1,343 +0,0 @@
1
- import React, { RefObject } from 'react';
2
- import * as react_jsx_runtime from 'react/jsx-runtime';
3
- import { A as AutoGenerateConfig } from './GlobalNotificationProvider-CdwdNv_8.mjs';
4
-
5
- /**
6
- * Password validation types and constants
7
- * Used for password requirements validation in forms
8
- */
9
- type PasswordRuleType = 'minLength' | 'alphanumeric' | 'uppercase' | 'lowercase' | 'number' | 'special';
10
- interface PasswordRule {
11
- type: PasswordRuleType;
12
- value?: number | string;
13
- message: string;
14
- enforce?: boolean;
15
- }
16
- interface EvaluatedPasswordRule {
17
- message: string;
18
- valid: boolean;
19
- enforce: boolean;
20
- }
21
- /**
22
- * Default password rules used as fallback when no custom rules are provided.
23
- * Messages are translation keys that should be translated at runtime.
24
- */
25
- declare const DEFAULT_PASSWORD_RULES: PasswordRule[];
26
-
27
- type BoxScreenType = 'login' | 'signUp' | 'forgotPassword' | 'resetPassword' | 'checkCode';
28
- interface CrudifyLoginConfig {
29
- publicApiKey?: string | null;
30
- env?: 'dev' | 'stg' | 'api' | 'prod';
31
- appName?: string;
32
- logo?: string;
33
- loginActions?: string[];
34
- }
35
- interface CrudifyLoginTranslations {
36
- [key: string]: string | CrudifyLoginTranslations;
37
- }
38
- interface UserLoginData {
39
- token: string;
40
- username?: string;
41
- email?: string;
42
- userId?: string;
43
- profile?: Record<string, unknown>;
44
- [key: string]: unknown;
45
- }
46
- interface CrudifyLoginProps {
47
- onScreenChange?: (screen: BoxScreenType, params?: Record<string, string>) => void;
48
- onExternalNavigate?: (path: string) => void;
49
- onLoginSuccess?: (userData: UserLoginData, redirectUrl?: string) => void;
50
- onError?: (error: string) => void;
51
- initialScreen?: BoxScreenType;
52
- redirectUrl?: string;
53
- autoReadFromCookies?: boolean;
54
- translations?: CrudifyLoginTranslations;
55
- translationsUrl?: string;
56
- language?: string;
57
- /** Custom password rules for reset password form. Falls back to default rules if not provided. */
58
- passwordRules?: PasswordRule[];
59
- }
60
-
61
- declare const CrudifyLogin: React.FC<CrudifyLoginProps>;
62
-
63
- interface UserProfileDisplayProps {
64
- showExtendedData?: boolean;
65
- showProfileCard?: boolean;
66
- autoRefresh?: boolean;
67
- }
68
- declare const UserProfileDisplay: React.FC<UserProfileDisplayProps>;
69
-
70
- declare const POLICY_ACTIONS: readonly ["create", "read", "update", "delete"];
71
- type PolicyAction = (typeof POLICY_ACTIONS)[number];
72
- declare const PREFERRED_POLICY_ORDER: PolicyAction[];
73
-
74
- type Policy = {
75
- id: string;
76
- action: PolicyAction;
77
- fields?: {
78
- allow: string[];
79
- owner_allow: string[];
80
- deny: string[];
81
- };
82
- permission?: string;
83
- };
84
- type FieldErrorMap = string | ({
85
- _error?: string;
86
- } & Record<string, string | undefined>);
87
- interface PoliciesProps {
88
- policies: Policy[];
89
- onChange: (next: Policy[]) => void;
90
- availableFields: string[];
91
- errors?: FieldErrorMap;
92
- isSubmitting?: boolean;
93
- }
94
- declare const Policies: React.FC<PoliciesProps>;
95
-
96
- declare function LoginComponent(): react_jsx_runtime.JSX.Element;
97
- /**
98
- * Componente simple de estado de sesión para mostrar en cualquier lugar
99
- */
100
- declare function SessionStatus(): react_jsx_runtime.JSX.Element;
101
-
102
- interface CrudiaAutoGenerateProps {
103
- config: AutoGenerateConfig;
104
- value?: string;
105
- onChange?: (value: string) => void;
106
- label?: string;
107
- error?: boolean;
108
- helperText?: string;
109
- readOnly?: boolean;
110
- disabled?: boolean;
111
- name?: string;
112
- containerRef?: React.RefObject<HTMLDivElement | null>;
113
- }
114
- /**
115
- * Componente para campos autogenerados (códigos secuenciales)
116
- *
117
- * Características:
118
- * - Auto-fetch del código al montar
119
- * - Detección automática de errores de duplicado
120
- * - Botón "Regenerar" en endAdornment cuando hay error de duplicado
121
- * - Estados de loading y error
122
- * - Readonly por defecto
123
- * - Integración con useAutoGenerate hook
124
- *
125
- * Flujo de Manejo de Errores de Duplicado:
126
- * 1. Usuario abre formulario → Código se genera automáticamente (ej: PROD-0013671)
127
- * 2. Usuario llena formulario y hace submit
128
- * 3. Backend retorna error "duplicate key" o "unique constraint"
129
- * 4. Formulario padre pasa error={true} y helperText="El código ya existe"
130
- * 5. Componente detecta palabras clave de duplicado y muestra botón de regenerar
131
- * 6. Usuario hace click en botón de regenerar → Nuevo código se genera
132
- * 7. onChange se llama con nuevo código → Formulario padre limpia el error
133
- * 8. Botón de regenerar desaparece (porque ya no hay error)
134
- *
135
- * @example
136
- * ```tsx
137
- * // Uso básico
138
- * <CrudiaAutoGenerate
139
- * config={{ prefix: "PROD-", padding: 7 }}
140
- * onChange={(code) => setFormData({ ...formData, barCode: code })}
141
- * label="Código de Barras"
142
- * />
143
- *
144
- * // Con manejo de error de duplicado desde el formulario
145
- * <CrudiaAutoGenerate
146
- * config={{ prefix: "PROD-", padding: 7 }}
147
- * onChange={(code) => {
148
- * setFormData({ ...formData, barCode: code });
149
- * // Limpiar error cuando cambia el código
150
- * setFormErrors({ ...formErrors, barCode: null });
151
- * }}
152
- * label="Código de Barras"
153
- * error={!!formErrors.barCode}
154
- * helperText={formErrors.barCode}
155
- * />
156
- * ```
157
- */
158
- declare const CrudiaAutoGenerate: React.FC<CrudiaAutoGenerateProps>;
159
-
160
- /**
161
- * Types and interfaces for CrudiaFileField component
162
- */
163
-
164
- /**
165
- * Deletion handlers exposed by the component
166
- */
167
- interface CrudiaFileFieldDeletionHandlers {
168
- /** Execute all pending deletions (call this on form success callback) */
169
- commitDeletions: () => Promise<{
170
- success: boolean;
171
- errors: string[];
172
- }>;
173
- /** Cancel all pending deletions and restore files */
174
- restorePendingDeletions: () => void;
175
- /** Whether there are files pending deletion */
176
- hasPendingDeletions: boolean;
177
- /** Mark the field as submitted (triggers validation errors display) */
178
- markAsSubmitted: () => void;
179
- /** Whether the field is valid */
180
- isValid: boolean;
181
- /** Whether files are currently being uploaded */
182
- isUploading: boolean;
183
- /** Wait for all uploads to complete - returns completed file paths */
184
- waitForUploads: () => Promise<string[]>;
185
- /** Get completed file paths synchronously (may be stale if uploads just finished) */
186
- getCompletedFilePaths: () => string[];
187
- }
188
- /**
189
- * Props del componente CrudiaFileField
190
- */
191
- interface CrudiaFileFieldProps {
192
- /** Label del campo */
193
- label?: string;
194
- /** Tipos MIME permitidos (ej: ["image/png", "image/jpeg"]) */
195
- accept?: string[];
196
- /** Tamaño máximo por archivo en bytes */
197
- maxFileSize?: number;
198
- /** Permitir múltiples archivos */
199
- multiple?: boolean;
200
- /** Número máximo de archivos (solo si multiple=true) */
201
- maxFiles?: number;
202
- /** Número mínimo de archivos requeridos */
203
- minFiles?: number;
204
- /** Campo requerido */
205
- required?: boolean;
206
- /** Campo deshabilitado */
207
- disabled?: boolean;
208
- /** Error externo */
209
- error?: boolean;
210
- /** Texto de ayuda o error */
211
- helperText?: string;
212
- /**
213
- * Callback cuando cambian los filePaths de archivos completados
214
- * Los filePaths son rutas relativas con visibility (public/... o private/...)
215
- */
216
- onChange?: (filePaths: string[]) => void;
217
- /** Callback cuando se valida el campo */
218
- onValidation?: (isValid: boolean, error: string | null) => void;
219
- /** Archivos existentes (para edición) - usar filePath (ruta relativa con visibility) */
220
- initialFiles?: Array<{
221
- filePath: string;
222
- name: string;
223
- size?: number;
224
- contentType?: string;
225
- }>;
226
- /** Texto placeholder para drag zone */
227
- placeholder?: string;
228
- /** Mostrar lista de archivos */
229
- showFileList?: boolean;
230
- /**
231
- * Visibilidad de los archivos subidos
232
- * @default "private"
233
- */
234
- visibility?: 'public' | 'private';
235
- /**
236
- * Mostrar preview de imágenes
237
- * @default true para imágenes
238
- */
239
- showPreview?: boolean;
240
- /**
241
- * URL base para prefijar al path del archivo
242
- * El valor guardado será baseUrl + path
243
- * También se usa para previsualizar/descargar archivos públicos en modo readonly
244
- */
245
- baseUrl: string;
246
- /**
247
- * Callback called when deletion handlers are ready
248
- * Use this to get access to commitDeletions and restorePendingDeletions functions
249
- */
250
- onDeletionHandlersReady?: (handlers: CrudiaFileFieldDeletionHandlers) => void;
251
- /**
252
- * Form mode: 'create' or 'edit' - affects delete behavior
253
- * - create: delete shows confirmation and deletes immediately from server
254
- * - edit: existing files use pendingDeletion, new files delete immediately
255
- * @default "create"
256
- */
257
- mode?: 'create' | 'edit';
258
- /** HTML name attribute for the hidden file input */
259
- name?: string;
260
- /** Ref para el contenedor (usado para scroll en errores) */
261
- containerRef?: RefObject<HTMLDivElement | null>;
262
- }
263
-
264
- /**
265
- * File field component with:
266
- * - Drag & drop
267
- * - File preview
268
- * - Progress bar during upload
269
- * - Delete files (soft delete)
270
- * - Type and size validation
271
- * - Single/multiple support
272
- */
273
-
274
- /**
275
- * Main file field component
276
- *
277
- * @example
278
- * ```tsx
279
- * // Basic usage - single file
280
- * <CrudiaFileField
281
- * label="Document"
282
- * accept={["application/pdf"]}
283
- * onChange={(filePaths) => setFormData({ ...formData, document: filePaths[0] })}
284
- * />
285
- *
286
- * // Multiple files with limits
287
- * <CrudiaFileField
288
- * label="Images"
289
- * accept={["image/png", "image/jpeg"]}
290
- * multiple
291
- * maxFiles={5}
292
- * minFiles={1}
293
- * maxFileSize={5 * 1024 * 1024}
294
- * onChange={(filePaths) => setFormData({ ...formData, images: filePaths })}
295
- * />
296
- *
297
- * // With initial files (edit mode)
298
- * <CrudiaFileField
299
- * label="Attachments"
300
- * multiple
301
- * initialFiles={existingFiles}
302
- * onChange={handleFilesChange}
303
- * />
304
- * ```
305
- */
306
- declare const CrudiaFileField: React.FC<CrudiaFileFieldProps>;
307
-
308
- /**
309
- * Markdown field component with rich text editing using MDXEditor
310
- * - WYSIWYG markdown editing
311
- * - Toolbar with formatting options
312
- * - Saves content as markdown string
313
- */
314
-
315
- interface CrudiaMarkdownFieldProps {
316
- /** Field label */
317
- label?: string;
318
- /** Current value (markdown string) */
319
- value?: string;
320
- /** Callback when content changes */
321
- onChange?: (value: string) => void;
322
- /** Required field */
323
- required?: boolean;
324
- /** Disabled/readonly field */
325
- disabled?: boolean;
326
- /** External error state */
327
- error?: boolean;
328
- /** Helper or error text */
329
- helperText?: string;
330
- /** Placeholder text */
331
- placeholder?: string;
332
- /** Minimum editor height in pixels */
333
- minHeight?: number;
334
- /** Maximum editor height in pixels (scrolls after) */
335
- maxHeight?: number;
336
- /** HTML name attribute for hidden input (for form semantics) */
337
- name?: string;
338
- /** Ref para el contenedor (usado para scroll en errores) */
339
- containerRef?: React.RefObject<HTMLDivElement | null>;
340
- }
341
- declare const CrudiaMarkdownField: React.FC<CrudiaMarkdownFieldProps>;
342
-
343
- export { type BoxScreenType as B, CrudiaAutoGenerate as C, DEFAULT_PASSWORD_RULES as D, type EvaluatedPasswordRule as E, LoginComponent as L, Policies as P, SessionStatus as S, type UserLoginData as U, type CrudiaAutoGenerateProps as a, CrudiaFileField as b, type CrudiaFileFieldProps as c, CrudiaMarkdownField as d, type CrudiaMarkdownFieldProps as e, CrudifyLogin as f, type CrudifyLoginConfig as g, type CrudifyLoginProps as h, type CrudifyLoginTranslations as i, type PolicyAction as j, UserProfileDisplay as k, type PasswordRule as l, type CrudiaFileFieldDeletionHandlers as m, POLICY_ACTIONS as n, PREFERRED_POLICY_ORDER as o, type PasswordRuleType as p };
@@ -1,96 +0,0 @@
1
- import React from 'react';
2
-
3
- interface AutoGenerateConfig {
4
- prefix: string;
5
- padding?: number;
6
- separator?: string;
7
- }
8
- interface UseAutoGenerateReturn {
9
- value: string;
10
- loading: boolean;
11
- error: string | null;
12
- regenerate: () => Promise<void>;
13
- clearError: () => void;
14
- }
15
- interface UseAutoGenerateOptions {
16
- autoFetch?: boolean;
17
- onSuccess?: (value: string) => void;
18
- onError?: (error: string) => void;
19
- }
20
- /**
21
- * Hook para generar códigos autogenerados desde el servidor
22
- *
23
- * ⚠️ IMPORTANTE: Genera y RESERVA el código inmediatamente al montar
24
- * El servidor incrementa counter en cada llamada, código queda reservado
25
- *
26
- * Flujo Normal:
27
- * 1. Componente monta → fetchNextSequence() ejecuta
28
- * 2. Servidor incrementa counter y retorna valor
29
- * 3. Usuario ve código → completa form → guarda exitosamente
30
- *
31
- * Flujo de Error (raro):
32
- * 1. Dos usuarios abren form al mismo tiempo
33
- * 2. Ambos reciben diferentes códigos (Counter atómico)
34
- * 3. Usuario A guarda primero → OK
35
- * 4. Usuario B intenta guardar → Error "Duplicate key" (validación única)
36
- * 5. Usuario B ve botón "Regenerar código" → Click
37
- * 6. regenerate() obtiene nuevo código → Usuario B guarda → OK
38
- *
39
- * @example
40
- * ```tsx
41
- * function ProductForm() {
42
- * const { value, loading, error, regenerate, clearError } = useAutoGenerate({
43
- * prefix: "PROD-",
44
- * padding: 7
45
- * });
46
- *
47
- * return (
48
- * <div>
49
- * <input value={value} readOnly />
50
- * {loading && <CircularProgress />}
51
- * {error && (
52
- * <div>
53
- * <span>Error: {error}</span>
54
- * <button onClick={regenerate}>Regenerar código</button>
55
- * </div>
56
- * )}
57
- * </div>
58
- * );
59
- * }
60
- * ```
61
- */
62
- declare const useAutoGenerate: (config: AutoGenerateConfig, options?: UseAutoGenerateOptions) => UseAutoGenerateReturn;
63
-
64
- type NotificationSeverity = 'error' | 'info' | 'success' | 'warning';
65
- interface Notification {
66
- id: string;
67
- message: string;
68
- severity: NotificationSeverity;
69
- autoHideDuration?: number;
70
- persistent?: boolean;
71
- allowHtml?: boolean;
72
- }
73
- interface GlobalNotificationContextValue {
74
- showNotification: (message: string, severity?: NotificationSeverity, options?: {
75
- autoHideDuration?: number;
76
- persistent?: boolean;
77
- allowHtml?: boolean;
78
- }) => string;
79
- hideNotification: (id: string) => void;
80
- clearAllNotifications: () => void;
81
- }
82
- interface GlobalNotificationProviderProps {
83
- children: React.ReactNode;
84
- maxNotifications?: number;
85
- defaultAutoHideDuration?: number;
86
- position?: {
87
- vertical: 'top' | 'bottom';
88
- horizontal: 'left' | 'center' | 'right';
89
- };
90
- enabled?: boolean;
91
- allowHtml?: boolean;
92
- }
93
- declare const GlobalNotificationProvider: React.FC<GlobalNotificationProviderProps>;
94
- declare const useGlobalNotification: () => GlobalNotificationContextValue;
95
-
96
- export { type AutoGenerateConfig as A, GlobalNotificationProvider as G, type Notification as N, type UseAutoGenerateOptions as U, type GlobalNotificationProviderProps as a, type NotificationSeverity as b, type UseAutoGenerateReturn as c, useAutoGenerate as d, useGlobalNotification as u };
@@ -1,96 +0,0 @@
1
- import React from 'react';
2
-
3
- interface AutoGenerateConfig {
4
- prefix: string;
5
- padding?: number;
6
- separator?: string;
7
- }
8
- interface UseAutoGenerateReturn {
9
- value: string;
10
- loading: boolean;
11
- error: string | null;
12
- regenerate: () => Promise<void>;
13
- clearError: () => void;
14
- }
15
- interface UseAutoGenerateOptions {
16
- autoFetch?: boolean;
17
- onSuccess?: (value: string) => void;
18
- onError?: (error: string) => void;
19
- }
20
- /**
21
- * Hook para generar códigos autogenerados desde el servidor
22
- *
23
- * ⚠️ IMPORTANTE: Genera y RESERVA el código inmediatamente al montar
24
- * El servidor incrementa counter en cada llamada, código queda reservado
25
- *
26
- * Flujo Normal:
27
- * 1. Componente monta → fetchNextSequence() ejecuta
28
- * 2. Servidor incrementa counter y retorna valor
29
- * 3. Usuario ve código → completa form → guarda exitosamente
30
- *
31
- * Flujo de Error (raro):
32
- * 1. Dos usuarios abren form al mismo tiempo
33
- * 2. Ambos reciben diferentes códigos (Counter atómico)
34
- * 3. Usuario A guarda primero → OK
35
- * 4. Usuario B intenta guardar → Error "Duplicate key" (validación única)
36
- * 5. Usuario B ve botón "Regenerar código" → Click
37
- * 6. regenerate() obtiene nuevo código → Usuario B guarda → OK
38
- *
39
- * @example
40
- * ```tsx
41
- * function ProductForm() {
42
- * const { value, loading, error, regenerate, clearError } = useAutoGenerate({
43
- * prefix: "PROD-",
44
- * padding: 7
45
- * });
46
- *
47
- * return (
48
- * <div>
49
- * <input value={value} readOnly />
50
- * {loading && <CircularProgress />}
51
- * {error && (
52
- * <div>
53
- * <span>Error: {error}</span>
54
- * <button onClick={regenerate}>Regenerar código</button>
55
- * </div>
56
- * )}
57
- * </div>
58
- * );
59
- * }
60
- * ```
61
- */
62
- declare const useAutoGenerate: (config: AutoGenerateConfig, options?: UseAutoGenerateOptions) => UseAutoGenerateReturn;
63
-
64
- type NotificationSeverity = 'error' | 'info' | 'success' | 'warning';
65
- interface Notification {
66
- id: string;
67
- message: string;
68
- severity: NotificationSeverity;
69
- autoHideDuration?: number;
70
- persistent?: boolean;
71
- allowHtml?: boolean;
72
- }
73
- interface GlobalNotificationContextValue {
74
- showNotification: (message: string, severity?: NotificationSeverity, options?: {
75
- autoHideDuration?: number;
76
- persistent?: boolean;
77
- allowHtml?: boolean;
78
- }) => string;
79
- hideNotification: (id: string) => void;
80
- clearAllNotifications: () => void;
81
- }
82
- interface GlobalNotificationProviderProps {
83
- children: React.ReactNode;
84
- maxNotifications?: number;
85
- defaultAutoHideDuration?: number;
86
- position?: {
87
- vertical: 'top' | 'bottom';
88
- horizontal: 'left' | 'center' | 'right';
89
- };
90
- enabled?: boolean;
91
- allowHtml?: boolean;
92
- }
93
- declare const GlobalNotificationProvider: React.FC<GlobalNotificationProviderProps>;
94
- declare const useGlobalNotification: () => GlobalNotificationContextValue;
95
-
96
- export { type AutoGenerateConfig as A, GlobalNotificationProvider as G, type Notification as N, type UseAutoGenerateOptions as U, type GlobalNotificationProviderProps as a, type NotificationSeverity as b, type UseAutoGenerateReturn as c, useAutoGenerate as d, useGlobalNotification as u };