@object-ui/types 0.3.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 (67) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +304 -0
  3. package/dist/api-types.d.ts +451 -0
  4. package/dist/api-types.d.ts.map +1 -0
  5. package/dist/api-types.js +10 -0
  6. package/dist/app.d.ts +120 -0
  7. package/dist/app.d.ts.map +1 -0
  8. package/dist/app.js +7 -0
  9. package/dist/base.d.ts +360 -0
  10. package/dist/base.d.ts.map +1 -0
  11. package/dist/base.js +10 -0
  12. package/dist/complex.d.ts +433 -0
  13. package/dist/complex.d.ts.map +1 -0
  14. package/dist/complex.js +9 -0
  15. package/dist/crud.d.ts +457 -0
  16. package/dist/crud.d.ts.map +1 -0
  17. package/dist/crud.js +10 -0
  18. package/dist/data-display.d.ts +599 -0
  19. package/dist/data-display.d.ts.map +1 -0
  20. package/dist/data-display.js +9 -0
  21. package/dist/data.d.ts +295 -0
  22. package/dist/data.d.ts.map +1 -0
  23. package/dist/data.js +10 -0
  24. package/dist/disclosure.d.ts +107 -0
  25. package/dist/disclosure.d.ts.map +1 -0
  26. package/dist/disclosure.js +9 -0
  27. package/dist/feedback.d.ts +159 -0
  28. package/dist/feedback.d.ts.map +1 -0
  29. package/dist/feedback.js +9 -0
  30. package/dist/form.d.ts +932 -0
  31. package/dist/form.d.ts.map +1 -0
  32. package/dist/form.js +9 -0
  33. package/dist/index.d.ts +108 -0
  34. package/dist/index.d.ts.map +1 -0
  35. package/dist/index.js +48 -0
  36. package/dist/layout.d.ts +418 -0
  37. package/dist/layout.d.ts.map +1 -0
  38. package/dist/layout.js +10 -0
  39. package/dist/navigation.d.ts +224 -0
  40. package/dist/navigation.d.ts.map +1 -0
  41. package/dist/navigation.js +9 -0
  42. package/dist/objectql.d.ts +254 -0
  43. package/dist/objectql.d.ts.map +1 -0
  44. package/dist/objectql.js +10 -0
  45. package/dist/overlay.d.ts +396 -0
  46. package/dist/overlay.d.ts.map +1 -0
  47. package/dist/overlay.js +9 -0
  48. package/dist/registry.d.ts +85 -0
  49. package/dist/registry.d.ts.map +1 -0
  50. package/dist/registry.js +1 -0
  51. package/package.json +82 -0
  52. package/src/api-types.ts +464 -0
  53. package/src/app.ts +138 -0
  54. package/src/base.ts +416 -0
  55. package/src/complex.ts +465 -0
  56. package/src/crud.ts +467 -0
  57. package/src/data-display.ts +630 -0
  58. package/src/data.ts +341 -0
  59. package/src/disclosure.ts +113 -0
  60. package/src/feedback.ts +170 -0
  61. package/src/form.ts +954 -0
  62. package/src/index.ts +350 -0
  63. package/src/layout.ts +451 -0
  64. package/src/navigation.ts +235 -0
  65. package/src/objectql.ts +301 -0
  66. package/src/overlay.ts +418 -0
  67. package/src/registry.ts +182 -0
package/src/crud.ts ADDED
@@ -0,0 +1,467 @@
1
+ /**
2
+ * @object-ui/types - CRUD Component Schemas
3
+ *
4
+ * Type definitions for Create, Read, Update, Delete operations.
5
+ * These schemas enable building complete data management interfaces.
6
+ *
7
+ * @module crud
8
+ * @packageDocumentation
9
+ */
10
+
11
+ import type { BaseSchema, SchemaNode } from './base';
12
+ import type { FormField } from './form';
13
+ import type { TableColumn } from './data-display';
14
+
15
+ /**
16
+ * Action button configuration for CRUD operations
17
+ */
18
+ export interface ActionSchema extends BaseSchema {
19
+ type: 'action';
20
+ /**
21
+ * Action label
22
+ */
23
+ label: string;
24
+ /**
25
+ * Action type/level
26
+ * @default 'default'
27
+ */
28
+ level?: 'primary' | 'secondary' | 'success' | 'warning' | 'danger' | 'info' | 'default';
29
+ /**
30
+ * Icon to display (lucide-react icon name)
31
+ */
32
+ icon?: string;
33
+ /**
34
+ * Action variant
35
+ */
36
+ variant?: 'default' | 'outline' | 'ghost' | 'link';
37
+ /**
38
+ * Whether action is disabled
39
+ */
40
+ disabled?: boolean;
41
+ /**
42
+ * Action type
43
+ */
44
+ actionType?: 'button' | 'link' | 'dropdown';
45
+ /**
46
+ * API endpoint to call
47
+ */
48
+ api?: string;
49
+ /**
50
+ * HTTP method
51
+ * @default 'POST'
52
+ */
53
+ method?: 'GET' | 'POST' | 'PUT' | 'DELETE' | 'PATCH';
54
+ /**
55
+ * Confirmation message before execution
56
+ */
57
+ confirmText?: string;
58
+ /**
59
+ * Success message after execution
60
+ */
61
+ successMessage?: string;
62
+ /**
63
+ * Whether to reload data after action
64
+ * @default true
65
+ */
66
+ reload?: boolean;
67
+ /**
68
+ * Whether to close dialog/modal after action
69
+ * @default true
70
+ */
71
+ close?: boolean;
72
+ /**
73
+ * Custom click handler
74
+ */
75
+ onClick?: () => void | Promise<void>;
76
+ /**
77
+ * Redirect URL after success
78
+ */
79
+ redirect?: string;
80
+ }
81
+
82
+ /**
83
+ * CRUD operation configuration
84
+ */
85
+ export interface CRUDOperation {
86
+ /**
87
+ * Operation type
88
+ */
89
+ type: 'create' | 'read' | 'update' | 'delete' | 'export' | 'import' | 'custom';
90
+ /**
91
+ * Operation label
92
+ */
93
+ label?: string;
94
+ /**
95
+ * Operation icon
96
+ */
97
+ icon?: string;
98
+ /**
99
+ * Whether operation is enabled
100
+ * @default true
101
+ */
102
+ enabled?: boolean;
103
+ /**
104
+ * API endpoint for this operation
105
+ */
106
+ api?: string;
107
+ /**
108
+ * HTTP method
109
+ */
110
+ method?: 'GET' | 'POST' | 'PUT' | 'DELETE' | 'PATCH';
111
+ /**
112
+ * Confirmation message
113
+ */
114
+ confirmText?: string;
115
+ /**
116
+ * Success message
117
+ */
118
+ successMessage?: string;
119
+ /**
120
+ * Visibility condition
121
+ */
122
+ visibleOn?: string;
123
+ /**
124
+ * Disabled condition
125
+ */
126
+ disabledOn?: string;
127
+ }
128
+
129
+ /**
130
+ * Filter configuration for CRUD components
131
+ */
132
+ export interface CRUDFilter {
133
+ /**
134
+ * Filter name (field name)
135
+ */
136
+ name: string;
137
+ /**
138
+ * Filter label
139
+ */
140
+ label?: string;
141
+ /**
142
+ * Filter type
143
+ */
144
+ type?: 'input' | 'select' | 'date-picker' | 'date-range' | 'number-range';
145
+ /**
146
+ * Filter operator
147
+ * @default 'equals'
148
+ */
149
+ operator?: 'equals' | 'contains' | 'startsWith' | 'endsWith' | 'gt' | 'gte' | 'lt' | 'lte' | 'between' | 'in';
150
+ /**
151
+ * Options for select filter
152
+ */
153
+ options?: Array<{ label: string; value: string | number }>;
154
+ /**
155
+ * Placeholder text
156
+ */
157
+ placeholder?: string;
158
+ /**
159
+ * Default value
160
+ */
161
+ defaultValue?: any;
162
+ }
163
+
164
+ /**
165
+ * Toolbar configuration for CRUD components
166
+ */
167
+ export interface CRUDToolbar {
168
+ /**
169
+ * Show create button
170
+ * @default true
171
+ */
172
+ showCreate?: boolean;
173
+ /**
174
+ * Show refresh button
175
+ * @default true
176
+ */
177
+ showRefresh?: boolean;
178
+ /**
179
+ * Show export button
180
+ * @default false
181
+ */
182
+ showExport?: boolean;
183
+ /**
184
+ * Show import button
185
+ * @default false
186
+ */
187
+ showImport?: boolean;
188
+ /**
189
+ * Show filter toggle
190
+ * @default true
191
+ */
192
+ showFilter?: boolean;
193
+ /**
194
+ * Show search box
195
+ * @default true
196
+ */
197
+ showSearch?: boolean;
198
+ /**
199
+ * Custom actions
200
+ */
201
+ actions?: ActionSchema[];
202
+ }
203
+
204
+ /**
205
+ * CRUD pagination configuration
206
+ */
207
+ export interface CRUDPagination {
208
+ /**
209
+ * Whether pagination is enabled
210
+ * @default true
211
+ */
212
+ enabled?: boolean;
213
+ /**
214
+ * Default page size
215
+ * @default 10
216
+ */
217
+ pageSize?: number;
218
+ /**
219
+ * Page size options
220
+ * @default [10, 20, 50, 100]
221
+ */
222
+ pageSizeOptions?: number[];
223
+ /**
224
+ * Show total count
225
+ * @default true
226
+ */
227
+ showTotal?: boolean;
228
+ /**
229
+ * Show page size selector
230
+ * @default true
231
+ */
232
+ showSizeChanger?: boolean;
233
+ }
234
+
235
+ /**
236
+ * Complete CRUD component
237
+ * Provides full Create, Read, Update, Delete functionality
238
+ */
239
+ export interface CRUDSchema extends BaseSchema {
240
+ type: 'crud';
241
+ /**
242
+ * CRUD title
243
+ */
244
+ title?: string;
245
+ /**
246
+ * Resource name (singular)
247
+ * @example 'user', 'product', 'order'
248
+ */
249
+ resource?: string;
250
+ /**
251
+ * API endpoint for list/search
252
+ */
253
+ api?: string;
254
+ /**
255
+ * Table columns configuration
256
+ */
257
+ columns: TableColumn[];
258
+ /**
259
+ * Form fields for create/edit
260
+ */
261
+ fields?: FormField[];
262
+ /**
263
+ * Enabled operations
264
+ */
265
+ operations?: {
266
+ create?: boolean | CRUDOperation;
267
+ read?: boolean | CRUDOperation;
268
+ update?: boolean | CRUDOperation;
269
+ delete?: boolean | CRUDOperation;
270
+ export?: boolean | CRUDOperation;
271
+ import?: boolean | CRUDOperation;
272
+ [key: string]: boolean | CRUDOperation | undefined;
273
+ };
274
+ /**
275
+ * Toolbar configuration
276
+ */
277
+ toolbar?: CRUDToolbar;
278
+ /**
279
+ * Filter configuration
280
+ */
281
+ filters?: CRUDFilter[];
282
+ /**
283
+ * Pagination configuration
284
+ */
285
+ pagination?: CRUDPagination;
286
+ /**
287
+ * Default sort field
288
+ */
289
+ defaultSort?: string;
290
+ /**
291
+ * Default sort order
292
+ * @default 'asc'
293
+ */
294
+ defaultSortOrder?: 'asc' | 'desc';
295
+ /**
296
+ * Row selection mode
297
+ */
298
+ selectable?: boolean | 'single' | 'multiple';
299
+ /**
300
+ * Batch actions for selected rows
301
+ */
302
+ batchActions?: ActionSchema[];
303
+ /**
304
+ * Row actions (displayed in each row)
305
+ */
306
+ rowActions?: ActionSchema[];
307
+ /**
308
+ * Custom empty state
309
+ */
310
+ emptyState?: SchemaNode;
311
+ /**
312
+ * Whether to show loading state
313
+ * @default true
314
+ */
315
+ loading?: boolean;
316
+ /**
317
+ * Custom loading component
318
+ */
319
+ loadingComponent?: SchemaNode;
320
+ /**
321
+ * Table layout mode
322
+ * @default 'table'
323
+ */
324
+ mode?: 'table' | 'grid' | 'list' | 'kanban';
325
+ /**
326
+ * Grid columns (for grid mode)
327
+ * @default 3
328
+ */
329
+ gridColumns?: number;
330
+ /**
331
+ * Card template (for grid/list mode)
332
+ */
333
+ cardTemplate?: SchemaNode;
334
+ /**
335
+ * Kanban columns (for kanban mode)
336
+ */
337
+ kanbanColumns?: Array<{
338
+ id: string;
339
+ title: string;
340
+ color?: string;
341
+ }>;
342
+ /**
343
+ * Kanban group field
344
+ */
345
+ kanbanGroupField?: string;
346
+ }
347
+
348
+ /**
349
+ * Detail view component
350
+ * Displays detailed information about a single record
351
+ */
352
+ export interface DetailSchema extends BaseSchema {
353
+ type: 'detail';
354
+ /**
355
+ * Detail title
356
+ */
357
+ title?: string;
358
+ /**
359
+ * API endpoint to fetch detail data
360
+ */
361
+ api?: string;
362
+ /**
363
+ * Resource ID to display
364
+ */
365
+ resourceId?: string | number;
366
+ /**
367
+ * Field groups for organized display
368
+ */
369
+ groups?: Array<{
370
+ title?: string;
371
+ description?: string;
372
+ fields: Array<{
373
+ name: string;
374
+ label?: string;
375
+ type?: 'text' | 'image' | 'link' | 'badge' | 'date' | 'datetime' | 'json' | 'html' | 'custom';
376
+ format?: string;
377
+ render?: SchemaNode;
378
+ }>;
379
+ }>;
380
+ /**
381
+ * Actions available in detail view
382
+ */
383
+ actions?: ActionSchema[];
384
+ /**
385
+ * Tabs for additional content
386
+ */
387
+ tabs?: Array<{
388
+ key: string;
389
+ label: string;
390
+ content: SchemaNode | SchemaNode[];
391
+ }>;
392
+ /**
393
+ * Show back button
394
+ * @default true
395
+ */
396
+ showBack?: boolean;
397
+ /**
398
+ * Custom back action
399
+ */
400
+ onBack?: () => void;
401
+ /**
402
+ * Whether to show loading state
403
+ * @default true
404
+ */
405
+ loading?: boolean;
406
+ }
407
+
408
+ /**
409
+ * CRUD Dialog/Modal component for CRUD operations
410
+ * Note: For general dialog usage, use DialogSchema from overlay module
411
+ */
412
+ export interface CRUDDialogSchema extends BaseSchema {
413
+ type: 'crud-dialog';
414
+ /**
415
+ * Dialog title
416
+ */
417
+ title?: string;
418
+ /**
419
+ * Dialog description
420
+ */
421
+ description?: string;
422
+ /**
423
+ * Dialog content
424
+ */
425
+ content?: SchemaNode | SchemaNode[];
426
+ /**
427
+ * Dialog size
428
+ * @default 'default'
429
+ */
430
+ size?: 'sm' | 'default' | 'lg' | 'xl' | 'full';
431
+ /**
432
+ * Dialog actions/buttons
433
+ */
434
+ actions?: ActionSchema[];
435
+ /**
436
+ * Whether dialog is open
437
+ */
438
+ open?: boolean;
439
+ /**
440
+ * Close handler
441
+ */
442
+ onClose?: () => void;
443
+ /**
444
+ * Whether clicking outside closes dialog
445
+ * @default true
446
+ */
447
+ closeOnOutsideClick?: boolean;
448
+ /**
449
+ * Whether pressing Escape closes dialog
450
+ * @default true
451
+ */
452
+ closeOnEscape?: boolean;
453
+ /**
454
+ * Show close button
455
+ * @default true
456
+ */
457
+ showClose?: boolean;
458
+ }
459
+
460
+ /**
461
+ * Union type of all CRUD schemas
462
+ */
463
+ export type CRUDComponentSchema =
464
+ | ActionSchema
465
+ | CRUDSchema
466
+ | DetailSchema
467
+ | CRUDDialogSchema;