@gzl10/nexus-sdk 0.12.7 → 0.13.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.
@@ -0,0 +1,1305 @@
1
+ import { i as FieldDefinition } from '../field-CngHXora.js';
2
+
3
+ /**
4
+ * ID Field Factory
5
+ *
6
+ * Creates ID fields with various generation strategies.
7
+ */
8
+
9
+ /**
10
+ * Supported ID generation strategies.
11
+ *
12
+ * | Type | Size | Format | Use case |
13
+ * |----------|------|--------------------------------------|--------------------------------|
14
+ * | ulid | 26 | 01ARZ3NDEKTSV4RRFFQ69G5FAV | Default, sortable by time |
15
+ * | cuid2 | 24 | ckopqwooh000001l8c5e0aaaa | Collision-resistant, random |
16
+ * | uuid | 36 | 550e8400-e29b-41d4-a716-446655440000 | Standard UUID v4 |
17
+ * | nanoid | 21 | V1StGXR8_Z5jdHi6B-myT | URL-safe, compact |
18
+ * | auto | - | 1, 2, 3... | Auto-increment integer |
19
+ * | custom | var | user-defined | Custom string with size |
20
+ * | pattern | var | TP-2025-000001 | Sequential with pattern |
21
+ */
22
+ type IdType = 'ulid' | 'uuid' | 'nanoid' | 'cuid2' | 'auto' | 'custom' | 'pattern';
23
+ /**
24
+ * Configuration for pattern-based ID generation.
25
+ *
26
+ * Supported tokens:
27
+ * - `{prefix}` - Static prefix string
28
+ * - `{suffix}` - Static suffix string
29
+ * - `{year}` - Current year (4 digits)
30
+ * - `{year2}` - Current year (2 digits)
31
+ * - `{month}` - Current month (01-12)
32
+ * - `{day}` - Current day (01-31)
33
+ * - `{seq}` - Sequence number (resets per scope)
34
+ * - `{seq:N}` - Sequence with N-digit padding (e.g., {seq:6} → 000001)
35
+ *
36
+ * @example
37
+ * ```typescript
38
+ * // TP-2025-000001, TP-2025-000002...
39
+ * { pattern: '{prefix}-{year}-{seq:6}', prefix: 'TP' }
40
+ *
41
+ * // INV-2025-01-0001
42
+ * { pattern: '{prefix}-{year}-{month}-{seq:4}', prefix: 'INV' }
43
+ *
44
+ * // ORD000001
45
+ * { pattern: '{prefix}{seq:6}', prefix: 'ORD' }
46
+ *
47
+ * // Reset sequence yearly
48
+ * { pattern: '{prefix}-{year}-{seq:6}', prefix: 'TP', resetOn: 'year' }
49
+ *
50
+ * // Reset sequence monthly
51
+ * { pattern: '{prefix}-{year}{month}-{seq:4}', prefix: 'DOC', resetOn: 'month' }
52
+ * ```
53
+ */
54
+ interface PatternIdConfig {
55
+ /**
56
+ * Pattern template with tokens.
57
+ * @example '{prefix}-{year}-{seq:6}'
58
+ */
59
+ pattern: string;
60
+ /**
61
+ * Static prefix value for {prefix} token.
62
+ * @example 'TP', 'INV', 'ORD'
63
+ */
64
+ prefix?: string;
65
+ /**
66
+ * Static suffix value for {suffix} token.
67
+ */
68
+ suffix?: string;
69
+ /**
70
+ * When to reset the sequence counter.
71
+ * - 'never': Never reset (global sequence)
72
+ * - 'year': Reset at the start of each year
73
+ * - 'month': Reset at the start of each month
74
+ * - 'day': Reset at the start of each day
75
+ * @default 'never'
76
+ */
77
+ resetOn?: 'never' | 'year' | 'month' | 'day';
78
+ /**
79
+ * Starting number for the sequence.
80
+ * @default 1
81
+ */
82
+ startAt?: number;
83
+ }
84
+ /**
85
+ * Configuration for ID fields.
86
+ */
87
+ interface IdFieldConfig {
88
+ /** Custom size for 'custom' type (default: 50) */
89
+ size?: number;
90
+ /** Custom label (default: 'ID') */
91
+ label?: string;
92
+ /** Pattern configuration for 'pattern' type */
93
+ pattern?: PatternIdConfig;
94
+ }
95
+ /**
96
+ * Create an ID field with the specified generation strategy.
97
+ *
98
+ * @param type - ID generation type (default: 'ulid' - sortable by time)
99
+ * @param config - Optional configuration for custom IDs
100
+ *
101
+ * @example
102
+ * ```typescript
103
+ * // ULID (default, sortable by time)
104
+ * fields: { id: useIdField() }
105
+ *
106
+ * // CUID2 (collision-resistant, random)
107
+ * fields: { id: useIdField('cuid2') }
108
+ *
109
+ * // UUID
110
+ * fields: { id: useIdField('uuid') }
111
+ *
112
+ * // Auto-increment
113
+ * fields: { id: useIdField('auto') }
114
+ *
115
+ * // Custom string
116
+ * fields: { id: useIdField('custom', { size: 50 }) }
117
+ *
118
+ * // Pattern-based
119
+ * fields: { id: useIdField('pattern', { pattern: { pattern: '{prefix}-{year}-{seq:6}', prefix: 'INV' } }) }
120
+ * ```
121
+ */
122
+ declare function useIdField(type?: IdType, config?: IdFieldConfig): FieldDefinition;
123
+
124
+ /**
125
+ * Shared types for field factories
126
+ */
127
+
128
+ /**
129
+ * Universal field properties that any factory can accept.
130
+ *
131
+ * These are FieldDefinition properties that are orthogonal to the
132
+ * field's core logic (input type, db config, validation) but may
133
+ * be needed in any context.
134
+ *
135
+ * @example
136
+ * ```typescript
137
+ * // Hidden field with custom input props
138
+ * token: useTextField({
139
+ * label: 'Token',
140
+ * hidden: true,
141
+ * inputProps: { monospace: true }
142
+ * })
143
+ *
144
+ * // Disabled field with display customization
145
+ * scope: useTextField({
146
+ * label: 'Scope',
147
+ * disabled: true,
148
+ * displayProps: { tag: true }
149
+ * })
150
+ * ```
151
+ */
152
+ type FieldOverrides = Partial<Pick<FieldDefinition, 'hidden' | 'disabled' | 'inputProps' | 'displayProps'>>;
153
+
154
+ /**
155
+ * Text Field Factories
156
+ *
157
+ * Creates text and unique text fields with common configuration patterns.
158
+ */
159
+
160
+ /**
161
+ * Configuration for text fields.
162
+ */
163
+ interface TextFieldConfig {
164
+ /** Field label (localized) */
165
+ label: string | {
166
+ en: string;
167
+ es?: string;
168
+ };
169
+ /** Help text shown below the input */
170
+ hint?: string | {
171
+ en: string;
172
+ es?: string;
173
+ };
174
+ /** Is field required? (default: false) */
175
+ required?: boolean;
176
+ /** Max string size (default: 255). Also sets validation.max */
177
+ size?: number;
178
+ /** Min string length for validation (default: 1 if required, 0 otherwise) */
179
+ minLength?: number;
180
+ /** DB nullable (default: true) */
181
+ nullable?: boolean;
182
+ /** Create DB index (default: false) */
183
+ index?: boolean;
184
+ /** Unique constraint (default: false) */
185
+ unique?: boolean;
186
+ /** Default value */
187
+ defaultValue?: string;
188
+ /** Placeholder text */
189
+ placeholder?: string | {
190
+ en: string;
191
+ es?: string;
192
+ };
193
+ /** Custom validation rules (merged with auto-generated min/max) */
194
+ validation?: FieldDefinition['validation'];
195
+ /** Metadata overrides */
196
+ meta?: FieldDefinition['meta'];
197
+ }
198
+ /**
199
+ * Configuration for unique text fields (omits unique/index/required as they're always true).
200
+ */
201
+ type TextUniqueFieldConfig = Omit<TextFieldConfig, 'unique' | 'index' | 'required'>;
202
+ /**
203
+ * Create a text field with common configuration.
204
+ *
205
+ * @example
206
+ * ```typescript
207
+ * // Simple text field
208
+ * name: useTextField({
209
+ * label: { en: 'Name', es: 'Nombre' },
210
+ * required: true
211
+ * })
212
+ *
213
+ * // With size and index
214
+ * code: useTextField({
215
+ * label: { en: 'Code', es: 'Código' },
216
+ * size: 50,
217
+ * unique: true,
218
+ * index: true
219
+ * })
220
+ *
221
+ * // With placeholder and default
222
+ * slug: useTextField({
223
+ * label: { en: 'Slug', es: 'Slug' },
224
+ * size: 100,
225
+ * placeholder: 'my-post-slug',
226
+ * meta: { searchable: true, sortable: true }
227
+ * })
228
+ * ```
229
+ */
230
+ declare function useTextField(config: TextFieldConfig & FieldOverrides): FieldDefinition;
231
+ /**
232
+ * Create a unique text field (required + unique + index always true).
233
+ *
234
+ * @example
235
+ * ```typescript
236
+ * // Unique code field
237
+ * code: useTextUniqueField({
238
+ * label: { en: 'Code', es: 'Código' },
239
+ * size: 50
240
+ * })
241
+ *
242
+ * // Unique slug
243
+ * slug: useTextUniqueField({
244
+ * label: { en: 'Slug', es: 'Slug' },
245
+ * size: 100
246
+ * })
247
+ * ```
248
+ */
249
+ declare function useTextUniqueField(config: TextUniqueFieldConfig): FieldDefinition;
250
+
251
+ /**
252
+ * Color Field Factory
253
+ *
254
+ * Creates color picker fields for hex color values.
255
+ */
256
+
257
+ /**
258
+ * Configuration for color fields.
259
+ */
260
+ interface ColorFieldConfig {
261
+ /** Field label (localized) */
262
+ label: string | {
263
+ en: string;
264
+ es?: string;
265
+ };
266
+ /** Help text shown below the input */
267
+ hint?: string | {
268
+ en: string;
269
+ es?: string;
270
+ };
271
+ /** Default color value (hex format: #RRGGBB) */
272
+ defaultValue?: string;
273
+ /** Placeholder text */
274
+ placeholder?: string;
275
+ /** Is field required? (default: false) */
276
+ required?: boolean;
277
+ /** DB nullable (default: true) */
278
+ nullable?: boolean;
279
+ /** Metadata overrides */
280
+ meta?: FieldDefinition['meta'];
281
+ }
282
+ /**
283
+ * Create a color field (hex color picker).
284
+ *
285
+ * @example
286
+ * ```typescript
287
+ * primaryColor: useColorField({
288
+ * label: { en: 'Primary Color', es: 'Color Principal' },
289
+ * defaultValue: '#3b82f6'
290
+ * })
291
+ *
292
+ * backgroundColor: useColorField({
293
+ * label: { en: 'Background', es: 'Fondo' },
294
+ * required: true
295
+ * })
296
+ * ```
297
+ */
298
+ declare function useColorField(config: ColorFieldConfig & FieldOverrides): FieldDefinition;
299
+
300
+ /**
301
+ * Media Field Factories
302
+ *
303
+ * Creates image and file fields with storage configuration.
304
+ */
305
+
306
+ /**
307
+ * File size type - accepts bytes (number) or human-readable string ('1MB', '512KB').
308
+ */
309
+ type FileSize = number | `${number}${'B' | 'KB' | 'MB' | 'GB'}`;
310
+ /**
311
+ * Parse file size from human-readable string to bytes.
312
+ *
313
+ * @example
314
+ * parseFileSize('1MB') // 1048576
315
+ * parseFileSize('512KB') // 524288
316
+ * parseFileSize(1024) // 1024 (passthrough)
317
+ */
318
+ declare function parseFileSize(size: FileSize): number;
319
+ /**
320
+ * Configuration for image fields.
321
+ */
322
+ interface ImageFieldConfig {
323
+ /** Field label (localized) */
324
+ label: string | {
325
+ en: string;
326
+ es?: string;
327
+ };
328
+ /** Help text shown below the input */
329
+ hint?: string | {
330
+ en: string;
331
+ es?: string;
332
+ };
333
+ /** Accepted MIME types (default: 'image/*') */
334
+ accept?: string;
335
+ /** Max file size - number (bytes) or string like '1MB', '512KB' (default: '1MB') */
336
+ maxSize?: FileSize;
337
+ /** Storage folder path */
338
+ folder?: string;
339
+ /** Mark uploaded files as public (accessible without authentication) */
340
+ isPublic?: boolean;
341
+ /** Enable SHA256 hash deduplication (default: false) */
342
+ dedupe?: boolean;
343
+ /** Is field required? (default: false) */
344
+ required?: boolean;
345
+ /** DB nullable (default: true) */
346
+ nullable?: boolean;
347
+ /** Metadata overrides */
348
+ meta?: FieldDefinition['meta'];
349
+ }
350
+ /**
351
+ * Create an image field with storage configuration.
352
+ *
353
+ * @example
354
+ * ```typescript
355
+ * // Simple image field
356
+ * avatar: useImageField({
357
+ * label: { en: 'Avatar', es: 'Avatar' },
358
+ * folder: 'avatars'
359
+ * })
360
+ *
361
+ * // With size limit and specific formats
362
+ * logo: useImageField({
363
+ * label: { en: 'Logo', es: 'Logo' },
364
+ * accept: 'image/png,image/svg+xml',
365
+ * maxSize: '512KB',
366
+ * folder: 'branding',
367
+ * required: true
368
+ * })
369
+ * ```
370
+ */
371
+ declare function useImageField(config: ImageFieldConfig & FieldOverrides): FieldDefinition;
372
+ /**
373
+ * Configuration for file fields.
374
+ */
375
+ interface FileFieldConfig {
376
+ /** Field label (localized) */
377
+ label: string | {
378
+ en: string;
379
+ es?: string;
380
+ };
381
+ /** Help text shown below the input */
382
+ hint?: string | {
383
+ en: string;
384
+ es?: string;
385
+ };
386
+ /** Accepted MIME types (default: any file) */
387
+ accept?: string;
388
+ /** Max file size - number (bytes) or string like '10MB', '1GB' (default: '10MB') */
389
+ maxSize?: FileSize;
390
+ /** Storage folder path */
391
+ folder?: string;
392
+ /** Mark uploaded files as public (accessible without authentication) */
393
+ isPublic?: boolean;
394
+ /** Enable SHA256 hash deduplication (default: false) */
395
+ dedupe?: boolean;
396
+ /** Is field required? (default: false) */
397
+ required?: boolean;
398
+ /** DB nullable (default: true) */
399
+ nullable?: boolean;
400
+ /** Metadata overrides */
401
+ meta?: FieldDefinition['meta'];
402
+ }
403
+ /**
404
+ * Create a file field with storage configuration.
405
+ *
406
+ * @example
407
+ * ```typescript
408
+ * // Any file type
409
+ * attachment: useFileField({
410
+ * label: { en: 'Attachment', es: 'Adjunto' },
411
+ * folder: 'attachments'
412
+ * })
413
+ *
414
+ * // PDF only with size limit
415
+ * document: useFileField({
416
+ * label: { en: 'Document', es: 'Documento' },
417
+ * accept: 'application/pdf',
418
+ * maxSize: '5MB',
419
+ * folder: 'documents',
420
+ * required: true
421
+ * })
422
+ *
423
+ * // Spreadsheets
424
+ * report: useFileField({
425
+ * label: { en: 'Report', es: 'Informe' },
426
+ * accept: '.xlsx,.xls,.csv',
427
+ * maxSize: '20MB',
428
+ * folder: 'reports'
429
+ * })
430
+ * ```
431
+ */
432
+ declare function useFileField(config: FileFieldConfig & FieldOverrides): FieldDefinition;
433
+ /**
434
+ * Configuration for multi-image fields (gallery).
435
+ */
436
+ interface MultiImageFieldConfig {
437
+ /** Field label (localized) */
438
+ label: string | {
439
+ en: string;
440
+ es?: string;
441
+ };
442
+ /** Help text shown below the input */
443
+ hint?: string | {
444
+ en: string;
445
+ es?: string;
446
+ };
447
+ /** Accepted MIME types (default: 'image/*') */
448
+ accept?: string;
449
+ /** Max file size per image - number (bytes) or string like '1MB', '512KB' (default: '1MB') */
450
+ maxSize?: FileSize;
451
+ /** Maximum number of images (default: 10) */
452
+ maxFiles?: number;
453
+ /** Storage folder path */
454
+ folder?: string;
455
+ /** Mark uploaded files as public (accessible without authentication) */
456
+ isPublic?: boolean;
457
+ /** Enable SHA256 hash deduplication (default: false) */
458
+ dedupe?: boolean;
459
+ /** Thumbnail sizes to auto-generate */
460
+ thumbnails?: Array<{
461
+ width: number;
462
+ height: number;
463
+ }>;
464
+ /** Is field required? (default: false) */
465
+ required?: boolean;
466
+ /** DB nullable (default: true) */
467
+ nullable?: boolean;
468
+ /** Metadata overrides */
469
+ meta?: FieldDefinition['meta'];
470
+ }
471
+ /**
472
+ * Create a multi-image field (gallery) with storage configuration.
473
+ *
474
+ * @example
475
+ * ```typescript
476
+ * // Simple gallery
477
+ * photos: useMultiImageField({
478
+ * label: { en: 'Photos', es: 'Fotos' },
479
+ * folder: 'gallery'
480
+ * })
481
+ *
482
+ * // With thumbnails and limits
483
+ * gallery: useMultiImageField({
484
+ * label: { en: 'Gallery', es: 'Galería' },
485
+ * maxFiles: 20,
486
+ * maxSize: '2MB',
487
+ * folder: 'products/gallery',
488
+ * thumbnails: [{ width: 200, height: 200 }]
489
+ * })
490
+ * ```
491
+ */
492
+ declare function useMultiImageField(config: MultiImageFieldConfig & FieldOverrides): FieldDefinition;
493
+ /**
494
+ * Configuration for multi-file fields.
495
+ */
496
+ interface MultiFileFieldConfig {
497
+ /** Field label (localized) */
498
+ label: string | {
499
+ en: string;
500
+ es?: string;
501
+ };
502
+ /** Help text shown below the input */
503
+ hint?: string | {
504
+ en: string;
505
+ es?: string;
506
+ };
507
+ /** Accepted MIME types (default: any file) */
508
+ accept?: string;
509
+ /** Max file size per file - number (bytes) or string like '10MB', '1GB' (default: '10MB') */
510
+ maxSize?: FileSize;
511
+ /** Maximum number of files (default: 10) */
512
+ maxFiles?: number;
513
+ /** Storage folder path */
514
+ folder?: string;
515
+ /** Mark uploaded files as public (accessible without authentication) */
516
+ isPublic?: boolean;
517
+ /** Enable SHA256 hash deduplication (default: false) */
518
+ dedupe?: boolean;
519
+ /** Is field required? (default: false) */
520
+ required?: boolean;
521
+ /** DB nullable (default: true) */
522
+ nullable?: boolean;
523
+ /** Metadata overrides */
524
+ meta?: FieldDefinition['meta'];
525
+ }
526
+ /**
527
+ * Create a multi-file field with storage configuration.
528
+ *
529
+ * @example
530
+ * ```typescript
531
+ * // Any file type
532
+ * attachments: useMultiFileField({
533
+ * label: { en: 'Attachments', es: 'Adjuntos' },
534
+ * folder: 'attachments'
535
+ * })
536
+ *
537
+ * // PDF documents with limits
538
+ * documents: useMultiFileField({
539
+ * label: { en: 'Documents', es: 'Documentos' },
540
+ * accept: 'application/pdf',
541
+ * maxFiles: 5,
542
+ * maxSize: '20MB',
543
+ * folder: 'documents',
544
+ * dedupe: true
545
+ * })
546
+ * ```
547
+ */
548
+ declare function useMultiFileField(config: MultiFileFieldConfig & FieldOverrides): FieldDefinition;
549
+
550
+ /**
551
+ * URL Field Factory
552
+ *
553
+ * Creates URL input fields with common configuration patterns.
554
+ */
555
+
556
+ /**
557
+ * Configuration for URL fields.
558
+ */
559
+ interface UrlFieldConfig {
560
+ /** Field label (localized) */
561
+ label: string | {
562
+ en: string;
563
+ es?: string;
564
+ };
565
+ /** Help text shown below the input */
566
+ hint?: string | {
567
+ en: string;
568
+ es?: string;
569
+ };
570
+ /** Is field required? (default: false) */
571
+ required?: boolean;
572
+ /** Max string size (default: 500) */
573
+ size?: number;
574
+ /** DB nullable (default: true) */
575
+ nullable?: boolean;
576
+ /** Create DB index (default: false) */
577
+ index?: boolean;
578
+ /** Default value */
579
+ defaultValue?: string;
580
+ /** Placeholder text */
581
+ placeholder?: string;
582
+ /** Metadata overrides */
583
+ meta?: FieldDefinition['meta'];
584
+ }
585
+ /**
586
+ * Create a URL field with common configuration.
587
+ *
588
+ * @example
589
+ * ```typescript
590
+ * // Simple URL field
591
+ * website: useUrlField({
592
+ * label: { en: 'Website', es: 'Sitio web' }
593
+ * })
594
+ *
595
+ * // Required with placeholder
596
+ * callback_url: useUrlField({
597
+ * label: { en: 'Callback URL', es: 'URL de callback' },
598
+ * required: true,
599
+ * placeholder: 'https://example.com/callback'
600
+ * })
601
+ * ```
602
+ */
603
+ declare function useUrlField(config: UrlFieldConfig & FieldOverrides): FieldDefinition;
604
+
605
+ /**
606
+ * Select Field Factory
607
+ *
608
+ * Creates select fields with static options or entity references.
609
+ */
610
+
611
+ /**
612
+ * Option for static select fields.
613
+ */
614
+ interface SelectOption {
615
+ value: string;
616
+ label: string | {
617
+ en: string;
618
+ es?: string;
619
+ };
620
+ /** Optional icon (Iconify format: mdi:home) */
621
+ icon?: string;
622
+ }
623
+ /**
624
+ * Configuration for select fields with static options.
625
+ */
626
+ interface StaticSelectConfig {
627
+ /** Field label (localized) */
628
+ label: string | {
629
+ en: string;
630
+ es?: string;
631
+ };
632
+ /** Static options array */
633
+ options: SelectOption[] | string[];
634
+ /** Default value */
635
+ defaultValue?: string;
636
+ /** Help text shown below the input */
637
+ hint?: string | {
638
+ en: string;
639
+ es?: string;
640
+ };
641
+ /** Is field required? (default: false) */
642
+ required?: boolean;
643
+ /** DB nullable (default: true) */
644
+ nullable?: boolean;
645
+ /** Max string size (default: 50) */
646
+ size?: number;
647
+ /** Create DB index (default: false) */
648
+ index?: boolean;
649
+ /** Metadata overrides */
650
+ meta?: FieldDefinition['meta'];
651
+ }
652
+ /**
653
+ * Configuration for select fields with entity reference.
654
+ */
655
+ interface RelationSelectConfig {
656
+ /** Field label (localized) */
657
+ label: string | {
658
+ en: string;
659
+ es?: string;
660
+ };
661
+ /** Related table name */
662
+ table: string;
663
+ /** Related column (default: 'id') */
664
+ column?: string;
665
+ /** API endpoint to fetch options */
666
+ endpoint: string;
667
+ /** Field to use as option value (default: 'id') */
668
+ valueField?: string;
669
+ /** Field to use as option label (default: 'name') */
670
+ labelField?: string;
671
+ /** On delete behavior (default: 'SET NULL') */
672
+ onDelete?: 'CASCADE' | 'SET NULL' | 'RESTRICT' | 'NO ACTION';
673
+ /** Help text shown below the input */
674
+ hint?: string | {
675
+ en: string;
676
+ es?: string;
677
+ };
678
+ /** Is field required? (default: false) */
679
+ required?: boolean;
680
+ /** DB nullable (default: true) */
681
+ nullable?: boolean;
682
+ /** ID size - use 26 for ULID, 36 for UUID (default: 26) */
683
+ size?: number;
684
+ /** Create DB index (default: true for relations) */
685
+ index?: boolean;
686
+ /** Metadata overrides */
687
+ meta?: FieldDefinition['meta'];
688
+ }
689
+ /**
690
+ * Create a select field with static options.
691
+ *
692
+ * @example
693
+ * ```typescript
694
+ * // Simple string options
695
+ * status: useSelectField({
696
+ * label: { en: 'Status', es: 'Estado' },
697
+ * options: ['draft', 'published', 'archived'],
698
+ * defaultValue: 'draft'
699
+ * })
700
+ *
701
+ * // Options with labels
702
+ * priority: useSelectField({
703
+ * label: { en: 'Priority', es: 'Prioridad' },
704
+ * options: [
705
+ * { value: 'low', label: { en: 'Low', es: 'Baja' } },
706
+ * { value: 'medium', label: { en: 'Medium', es: 'Media' } },
707
+ * { value: 'high', label: { en: 'High', es: 'Alta' } }
708
+ * ],
709
+ * defaultValue: 'medium',
710
+ * required: true
711
+ * })
712
+ * ```
713
+ */
714
+ declare function useSelectField(config: StaticSelectConfig & FieldOverrides): FieldDefinition;
715
+ /**
716
+ * Create a select field with entity reference (relation).
717
+ *
718
+ * @example
719
+ * ```typescript
720
+ * category_id: useSelectField({
721
+ * label: { en: 'Category', es: 'Categoría' },
722
+ * table: 'categories',
723
+ * endpoint: '/categories',
724
+ * labelField: 'name'
725
+ * })
726
+ *
727
+ * // With cascade delete
728
+ * author_id: useSelectField({
729
+ * label: { en: 'Author', es: 'Autor' },
730
+ * table: 'users',
731
+ * endpoint: '/users',
732
+ * labelField: 'display_name',
733
+ * onDelete: 'CASCADE',
734
+ * required: true
735
+ * })
736
+ * ```
737
+ */
738
+ declare function useSelectField(config: RelationSelectConfig & FieldOverrides): FieldDefinition;
739
+
740
+ /**
741
+ * Textarea Field Factory
742
+ *
743
+ * Creates multi-line text fields with common configuration patterns.
744
+ */
745
+
746
+ /**
747
+ * Configuration for textarea fields.
748
+ */
749
+ interface TextareaFieldConfig {
750
+ /** Field label (localized) */
751
+ label: string | {
752
+ en: string;
753
+ es?: string;
754
+ };
755
+ /** Help text shown below the input */
756
+ hint?: string | {
757
+ en: string;
758
+ es?: string;
759
+ };
760
+ /** Is field required? (default: false) */
761
+ required?: boolean;
762
+ /** DB nullable (default: true) */
763
+ nullable?: boolean;
764
+ /** Default value */
765
+ defaultValue?: string;
766
+ /** Placeholder text */
767
+ placeholder?: string;
768
+ /** Metadata overrides */
769
+ meta?: FieldDefinition['meta'];
770
+ }
771
+ /**
772
+ * Create a textarea field with common configuration.
773
+ *
774
+ * @example
775
+ * ```typescript
776
+ * description: useTextareaField({
777
+ * label: { en: 'Description', es: 'Descripción' }
778
+ * })
779
+ *
780
+ * notes: useTextareaField({
781
+ * label: { en: 'Notes', es: 'Notas' },
782
+ * hint: { en: 'Additional notes', es: 'Notas adicionales' }
783
+ * })
784
+ * ```
785
+ */
786
+ declare function useTextareaField(config: TextareaFieldConfig & FieldOverrides): FieldDefinition;
787
+
788
+ /**
789
+ * JSON Field Factory
790
+ *
791
+ * Creates JSON fields for storing structured data.
792
+ */
793
+
794
+ /**
795
+ * Configuration for JSON fields.
796
+ */
797
+ interface JsonFieldConfig {
798
+ /** Field label (localized) */
799
+ label: string | {
800
+ en: string;
801
+ es?: string;
802
+ };
803
+ /** Help text shown below the input */
804
+ hint?: string | {
805
+ en: string;
806
+ es?: string;
807
+ };
808
+ /** Is field required? (default: false) */
809
+ required?: boolean;
810
+ /** DB nullable (default: true) */
811
+ nullable?: boolean;
812
+ /** Metadata overrides */
813
+ meta?: FieldDefinition['meta'];
814
+ }
815
+ /**
816
+ * Create a JSON field with common configuration.
817
+ *
818
+ * @example
819
+ * ```typescript
820
+ * metadata: useJsonField({
821
+ * label: { en: 'Metadata', es: 'Metadatos' }
822
+ * })
823
+ *
824
+ * config: useJsonField({
825
+ * label: { en: 'Configuration', es: 'Configuración' },
826
+ * required: true
827
+ * })
828
+ * ```
829
+ */
830
+ declare function useJsonField(config: JsonFieldConfig & FieldOverrides): FieldDefinition;
831
+
832
+ /**
833
+ * Datetime Field Factory
834
+ *
835
+ * Creates datetime fields with common configuration patterns.
836
+ */
837
+
838
+ /**
839
+ * Configuration for datetime fields.
840
+ */
841
+ interface DatetimeFieldConfig {
842
+ /** Field label (localized) */
843
+ label: string | {
844
+ en: string;
845
+ es?: string;
846
+ };
847
+ /** Help text shown below the input */
848
+ hint?: string | {
849
+ en: string;
850
+ es?: string;
851
+ };
852
+ /** Is field required? (default: false) */
853
+ required?: boolean;
854
+ /** DB nullable (default: true) */
855
+ nullable?: boolean;
856
+ /** Metadata overrides */
857
+ meta?: FieldDefinition['meta'];
858
+ }
859
+ /**
860
+ * Create a datetime field with common configuration.
861
+ *
862
+ * @example
863
+ * ```typescript
864
+ * expires_at: useDatetimeField({
865
+ * label: { en: 'Expires At', es: 'Expira el' },
866
+ * meta: { sortable: true }
867
+ * })
868
+ *
869
+ * completed_at: useDatetimeField({
870
+ * label: { en: 'Completed At', es: 'Completado el' },
871
+ * meta: { showInForm: false, sortable: true }
872
+ * })
873
+ * ```
874
+ */
875
+ declare function useDatetimeField(config: DatetimeFieldConfig & FieldOverrides): FieldDefinition;
876
+
877
+ /**
878
+ * Number Field Factory
879
+ *
880
+ * Creates integer/number fields with common configuration patterns.
881
+ */
882
+
883
+ /**
884
+ * Configuration for number fields.
885
+ */
886
+ interface NumberFieldConfig {
887
+ /** Field label (localized) */
888
+ label: string | {
889
+ en: string;
890
+ es?: string;
891
+ };
892
+ /** Help text shown below the input */
893
+ hint?: string | {
894
+ en: string;
895
+ es?: string;
896
+ };
897
+ /** Is field required? (default: false) */
898
+ required?: boolean;
899
+ /** Default value */
900
+ defaultValue?: number;
901
+ /** DB nullable (default: true) */
902
+ nullable?: boolean;
903
+ /** Validation min/max */
904
+ validation?: {
905
+ min?: number;
906
+ max?: number;
907
+ };
908
+ /** Metadata overrides */
909
+ meta?: FieldDefinition['meta'];
910
+ }
911
+ /**
912
+ * Create a number (integer) field with common configuration.
913
+ *
914
+ * @example
915
+ * ```typescript
916
+ * retry_count: useNumberField({
917
+ * label: { en: 'Retries', es: 'Reintentos' },
918
+ * defaultValue: 3,
919
+ * validation: { min: 0, max: 10 }
920
+ * })
921
+ *
922
+ * score: useNumberField({
923
+ * label: { en: 'Score', es: 'Puntuación' },
924
+ * required: true,
925
+ * validation: { min: 1, max: 5 }
926
+ * })
927
+ * ```
928
+ */
929
+ declare function useNumberField(config: NumberFieldConfig & FieldOverrides): FieldDefinition;
930
+
931
+ /**
932
+ * Switch Field Factory
933
+ *
934
+ * Creates boolean toggle/switch fields with common configuration patterns.
935
+ */
936
+
937
+ /**
938
+ * Configuration for switch (boolean) fields.
939
+ */
940
+ interface SwitchFieldConfig {
941
+ /** Field label (localized) */
942
+ label: string | {
943
+ en: string;
944
+ es?: string;
945
+ };
946
+ /** Help text shown below the input */
947
+ hint?: string | {
948
+ en: string;
949
+ es?: string;
950
+ };
951
+ /** Default value (default: false) */
952
+ defaultValue?: boolean;
953
+ /** Metadata overrides */
954
+ meta?: FieldDefinition['meta'];
955
+ }
956
+ /**
957
+ * Create a switch (boolean) field with common configuration.
958
+ *
959
+ * @example
960
+ * ```typescript
961
+ * is_pinned: useSwitchField({
962
+ * label: { en: 'Pinned', es: 'Fijado' }
963
+ * })
964
+ *
965
+ * is_read: useSwitchField({
966
+ * label: { en: 'Read', es: 'Leído' },
967
+ * defaultValue: false,
968
+ * meta: { sortable: true }
969
+ * })
970
+ * ```
971
+ */
972
+ declare function useSwitchField(config: SwitchFieldConfig & FieldOverrides): FieldDefinition;
973
+
974
+ /**
975
+ * Localized Field Factory
976
+ *
977
+ * Creates text fields that store LocalizedString as JSON.
978
+ * Common in masters for display names: { en: "Euro", es: "Euro" }.
979
+ */
980
+
981
+ /**
982
+ * Configuration for localized text fields.
983
+ */
984
+ interface LocalizedFieldConfig {
985
+ /** Field label (localized) */
986
+ label: string | {
987
+ en: string;
988
+ es?: string;
989
+ };
990
+ /** Help text shown below the input */
991
+ hint?: string | {
992
+ en: string;
993
+ es?: string;
994
+ };
995
+ /** Is field required? (default: true — localized fields are almost always required) */
996
+ required?: boolean;
997
+ /** Metadata overrides (defaults: searchable true, sortable true) */
998
+ meta?: FieldDefinition['meta'];
999
+ }
1000
+ /**
1001
+ * Create a text field that stores a LocalizedString as JSON.
1002
+ *
1003
+ * Unlike useTextField (db: string) or useJsonField (input: json),
1004
+ * this uses input: text + db: json — the UI renders language tabs.
1005
+ *
1006
+ * @example
1007
+ * ```typescript
1008
+ * // Master entity label (most common usage)
1009
+ * label: useLocalizedField({
1010
+ * label: { en: 'Name', es: 'Nombre' }
1011
+ * })
1012
+ *
1013
+ * // Optional localized field
1014
+ * description: useLocalizedField({
1015
+ * label: { en: 'Description', es: 'Descripción' },
1016
+ * required: false
1017
+ * })
1018
+ * ```
1019
+ */
1020
+ declare function useLocalizedField(config: LocalizedFieldConfig & FieldOverrides): FieldDefinition;
1021
+
1022
+ /**
1023
+ * Icon Field Factory
1024
+ *
1025
+ * Creates icon picker fields (Iconify format: mdi:home, ph:star).
1026
+ */
1027
+
1028
+ /**
1029
+ * Configuration for icon fields.
1030
+ */
1031
+ interface IconFieldConfig {
1032
+ /** Field label (localized) */
1033
+ label: string | {
1034
+ en: string;
1035
+ es?: string;
1036
+ };
1037
+ /** Help text shown below the input */
1038
+ hint?: string | {
1039
+ en: string;
1040
+ es?: string;
1041
+ };
1042
+ /** Is field required? (default: false) */
1043
+ required?: boolean;
1044
+ /** Max string size (default: 100) */
1045
+ size?: number;
1046
+ /** Placeholder text */
1047
+ placeholder?: string;
1048
+ /** Metadata overrides */
1049
+ meta?: FieldDefinition['meta'];
1050
+ }
1051
+ /**
1052
+ * Create an icon picker field.
1053
+ *
1054
+ * @example
1055
+ * ```typescript
1056
+ * icon: useIconField({
1057
+ * label: { en: 'Icon', es: 'Icono' },
1058
+ * placeholder: 'mdi:home'
1059
+ * })
1060
+ *
1061
+ * icon: useIconField({
1062
+ * label: { en: 'Icon', es: 'Icono' },
1063
+ * required: true,
1064
+ * placeholder: 'mdi:linkedin'
1065
+ * })
1066
+ * ```
1067
+ */
1068
+ declare function useIconField(config: IconFieldConfig & FieldOverrides): FieldDefinition;
1069
+
1070
+ /**
1071
+ * Email Field Factory
1072
+ *
1073
+ * Creates email input fields with validation and common defaults.
1074
+ */
1075
+
1076
+ /**
1077
+ * Configuration for email fields.
1078
+ */
1079
+ interface EmailFieldConfig {
1080
+ /** Field label (localized) */
1081
+ label: string | {
1082
+ en: string;
1083
+ es?: string;
1084
+ };
1085
+ /** Help text shown below the input */
1086
+ hint?: string | {
1087
+ en: string;
1088
+ es?: string;
1089
+ };
1090
+ /** Is field required? (default: false) */
1091
+ required?: boolean;
1092
+ /** DB nullable (default: inverted from required) */
1093
+ nullable?: boolean;
1094
+ /** Unique constraint (default: false) */
1095
+ unique?: boolean;
1096
+ /** Placeholder text */
1097
+ placeholder?: string | {
1098
+ en: string;
1099
+ es?: string;
1100
+ };
1101
+ /** Metadata overrides */
1102
+ meta?: FieldDefinition['meta'];
1103
+ }
1104
+ /**
1105
+ * Create an email field with validation and common defaults.
1106
+ *
1107
+ * @example
1108
+ * ```typescript
1109
+ * email: useEmailField({
1110
+ * label: { en: 'Email', es: 'Correo' },
1111
+ * required: true,
1112
+ * placeholder: 'user@example.com'
1113
+ * })
1114
+ *
1115
+ * dpo_email: useEmailField({
1116
+ * label: { en: 'DPO Email', es: 'Correo del DPO' },
1117
+ * hint: { en: 'Data Protection Officer email', es: 'Correo del DPO' }
1118
+ * })
1119
+ * ```
1120
+ */
1121
+ declare function useEmailField(config: EmailFieldConfig & FieldOverrides): FieldDefinition;
1122
+
1123
+ /**
1124
+ * Checkbox Field Factory
1125
+ *
1126
+ * Creates boolean checkbox fields with common configuration patterns.
1127
+ */
1128
+
1129
+ /**
1130
+ * Configuration for checkbox (boolean) fields.
1131
+ */
1132
+ interface CheckboxFieldConfig {
1133
+ /** Field label (localized) */
1134
+ label: string | {
1135
+ en: string;
1136
+ es?: string;
1137
+ };
1138
+ /** Help text shown below the input */
1139
+ hint?: string | {
1140
+ en: string;
1141
+ es?: string;
1142
+ };
1143
+ /** Default value (default: false) */
1144
+ defaultValue?: boolean;
1145
+ /** Metadata overrides */
1146
+ meta?: FieldDefinition['meta'];
1147
+ }
1148
+ /**
1149
+ * Create a checkbox (boolean) field with common configuration.
1150
+ *
1151
+ * @example
1152
+ * ```typescript
1153
+ * is_active: useCheckboxField({
1154
+ * label: { en: 'Active', es: 'Activo' },
1155
+ * defaultValue: true
1156
+ * })
1157
+ *
1158
+ * marketing_opt_in: useCheckboxField({
1159
+ * label: { en: 'Marketing Opt-in', es: 'Consentimiento marketing' },
1160
+ * meta: { exportable: true }
1161
+ * })
1162
+ * ```
1163
+ */
1164
+ declare function useCheckboxField(config: CheckboxFieldConfig & FieldOverrides): FieldDefinition;
1165
+
1166
+ /**
1167
+ * Password Field Factory
1168
+ *
1169
+ * Creates password input fields with secure defaults (hidden from display, not searchable).
1170
+ */
1171
+
1172
+ /**
1173
+ * Configuration for password fields.
1174
+ */
1175
+ interface PasswordFieldConfig {
1176
+ /** Field label (localized) */
1177
+ label: string | {
1178
+ en: string;
1179
+ es?: string;
1180
+ };
1181
+ /** Help text shown below the input */
1182
+ hint?: string | {
1183
+ en: string;
1184
+ es?: string;
1185
+ };
1186
+ /** Is field required? (default: false) */
1187
+ required?: boolean;
1188
+ /** DB nullable (default: inverted from required) */
1189
+ nullable?: boolean;
1190
+ /** Max string size (default: 255) */
1191
+ size?: number;
1192
+ /** Placeholder text */
1193
+ placeholder?: string | {
1194
+ en: string;
1195
+ es?: string;
1196
+ };
1197
+ /** Custom validation rules */
1198
+ validation?: FieldDefinition['validation'];
1199
+ /** Metadata overrides (defaults: searchable=false, showInDisplay=false) */
1200
+ meta?: FieldDefinition['meta'];
1201
+ }
1202
+ /**
1203
+ * Create a password field with secure defaults.
1204
+ *
1205
+ * By default, password fields are NOT searchable and NOT shown in display
1206
+ * components (tables, lists). Override via `meta` if needed.
1207
+ *
1208
+ * @example
1209
+ * ```typescript
1210
+ * password: usePasswordField({
1211
+ * label: { en: 'Password', es: 'Contraseña' },
1212
+ * required: true,
1213
+ * validation: { min: 8 }
1214
+ * })
1215
+ *
1216
+ * auth_pass: usePasswordField({
1217
+ * label: { en: 'SMTP Password', es: 'Contraseña SMTP' },
1218
+ * hint: { en: 'Optional', es: 'Opcional' }
1219
+ * })
1220
+ * ```
1221
+ */
1222
+ declare function usePasswordField(config: PasswordFieldConfig & FieldOverrides): FieldDefinition;
1223
+
1224
+ /**
1225
+ * Tags Field Factory
1226
+ *
1227
+ * Creates free-form tags input fields stored as JSON arrays.
1228
+ */
1229
+
1230
+ /**
1231
+ * Configuration for tags fields.
1232
+ */
1233
+ interface TagsFieldConfig {
1234
+ /** Field label (localized) */
1235
+ label: string | {
1236
+ en: string;
1237
+ es?: string;
1238
+ };
1239
+ /** Help text shown below the input */
1240
+ hint?: string | {
1241
+ en: string;
1242
+ es?: string;
1243
+ };
1244
+ /** Is field required? (default: false) */
1245
+ required?: boolean;
1246
+ /** DB nullable (default: true) */
1247
+ nullable?: boolean;
1248
+ /** Placeholder text */
1249
+ placeholder?: string | {
1250
+ en: string;
1251
+ es?: string;
1252
+ };
1253
+ /** Custom validation rules */
1254
+ validation?: FieldDefinition['validation'];
1255
+ /** Options configuration (endpoint or static list) */
1256
+ options?: FieldDefinition['options'];
1257
+ /** Metadata overrides */
1258
+ meta?: FieldDefinition['meta'];
1259
+ }
1260
+ /**
1261
+ * Create a tags field stored as JSON array.
1262
+ *
1263
+ * @example
1264
+ * ```typescript
1265
+ * keywords: useTagsField({
1266
+ * label: { en: 'Keywords', es: 'Palabras clave' }
1267
+ * })
1268
+ *
1269
+ * recipients: useTagsField({
1270
+ * label: { en: 'To', es: 'Para' },
1271
+ * required: true,
1272
+ * placeholder: 'user@example.com',
1273
+ * validation: { min: 1 }
1274
+ * })
1275
+ * ```
1276
+ */
1277
+ declare function useTagsField(config: TagsFieldConfig & FieldOverrides): FieldDefinition;
1278
+
1279
+ /**
1280
+ * Common Field Definitions
1281
+ *
1282
+ * Pre-configured field definitions for common use cases.
1283
+ * These fields have their `name` assigned from the key when used.
1284
+ */
1285
+
1286
+ /**
1287
+ * Standard ID field (ULID string, 26 chars).
1288
+ * @deprecated Use useIdField() for default or useIdField('ulid') explicitly.
1289
+ */
1290
+ declare const idField: FieldDefinition;
1291
+ /**
1292
+ * Standard user_id field for ownership.
1293
+ * Uses ULID size (26 chars) to match default ID generation.
1294
+ */
1295
+ declare const userIdField: FieldDefinition;
1296
+ /**
1297
+ * Standard is_active field.
1298
+ */
1299
+ declare const isActiveField: FieldDefinition;
1300
+ /**
1301
+ * Standard order field for manual sorting.
1302
+ */
1303
+ declare const orderField: FieldDefinition;
1304
+
1305
+ export { type CheckboxFieldConfig, type ColorFieldConfig, type DatetimeFieldConfig, type EmailFieldConfig, type FieldOverrides, type FileFieldConfig, type FileSize, type IconFieldConfig, type IdFieldConfig, type IdType, type ImageFieldConfig, type JsonFieldConfig, type LocalizedFieldConfig, type MultiFileFieldConfig, type MultiImageFieldConfig, type NumberFieldConfig, type PasswordFieldConfig, type PatternIdConfig, type RelationSelectConfig, type SelectOption, type StaticSelectConfig, type SwitchFieldConfig, type TagsFieldConfig, type TextFieldConfig, type TextUniqueFieldConfig, type TextareaFieldConfig, type UrlFieldConfig, idField, isActiveField, orderField, parseFileSize, useCheckboxField, useColorField, useDatetimeField, useEmailField, useFileField, useIconField, useIdField, useImageField, useJsonField, useLocalizedField, useMultiFileField, useMultiImageField, useNumberField, usePasswordField, useSelectField, useSwitchField, useTagsField, useTextField, useTextUniqueField, useTextareaField, useUrlField, userIdField };