@gnwebsoft/ui 3.0.8 → 4.0.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 (44) hide show
  1. package/dist/chunk-3OPVOWQK.js +140 -0
  2. package/dist/chunk-AEOF2TUF.cjs +2273 -0
  3. package/dist/chunk-ALHC7RLK.js +575 -0
  4. package/dist/chunk-BRRLB22L.js +72 -0
  5. package/dist/chunk-CHZU4PZB.js +2273 -0
  6. package/dist/chunk-EBRUE2WR.cjs +1 -1
  7. package/dist/chunk-HEHPKM4B.cjs +140 -0
  8. package/dist/chunk-K2EJ4YKO.cjs +72 -0
  9. package/dist/chunk-MVPLBJRK.cjs +1 -1
  10. package/dist/chunk-XY4U6A77.cjs +575 -0
  11. package/dist/components/index.cjs +1 -1
  12. package/dist/{enhanced-z-I7EHVS.d.cts → enhanced-CDTkKUlj.d.ts} +5 -5
  13. package/dist/{enhanced-z-I7EHVS.d.ts → enhanced-ZQoS03Cd.d.cts} +5 -5
  14. package/dist/events-BcHVCLBz.d.cts +77 -0
  15. package/dist/events-BcHVCLBz.d.ts +77 -0
  16. package/dist/hooks/index.cjs +3 -3
  17. package/dist/hooks/index.d.cts +3 -2
  18. package/dist/hooks/index.d.ts +3 -2
  19. package/dist/hooks/index.js +1 -1
  20. package/dist/index.cjs +67 -6
  21. package/dist/index.d.cts +4 -3
  22. package/dist/index.d.ts +4 -3
  23. package/dist/index.js +65 -4
  24. package/dist/types/index.cjs +31 -2
  25. package/dist/types/index.d.cts +588 -1
  26. package/dist/types/index.d.ts +588 -1
  27. package/dist/types/index.js +30 -1
  28. package/dist/utils/index.cjs +37 -3
  29. package/dist/utils/index.d.cts +329 -13
  30. package/dist/utils/index.d.ts +329 -13
  31. package/dist/utils/index.js +35 -1
  32. package/dist/wrappers/index.cjs +4 -4
  33. package/dist/wrappers/index.d.cts +11 -9
  34. package/dist/wrappers/index.d.ts +11 -9
  35. package/dist/wrappers/index.js +2 -2
  36. package/package.json +2 -2
  37. package/dist/chunk-4H3AFH7A.js +0 -505
  38. package/dist/chunk-DE62KYFK.js +0 -122
  39. package/dist/chunk-DEPJRTVT.js +0 -1
  40. package/dist/chunk-FD57PCAC.cjs +0 -1
  41. package/dist/chunk-JCXHX2PZ.js +0 -2265
  42. package/dist/chunk-MW2UCDTI.cjs +0 -2265
  43. package/dist/chunk-R2YK4LTT.cjs +0 -122
  44. package/dist/chunk-ZC7FGYL2.cjs +0 -505
@@ -1,5 +1,7 @@
1
1
  import { GridSortModel } from '@mui/x-data-grid';
2
2
  export { a as AsyncSelectMultiPayload, A as AsyncSelectPayload } from '../AsyncSelectPayload-B9-6l33R.cjs';
3
+ export { E as EventOrValue, F as FormChangeEvent, c as GenericEventHandler, G as GenericSyntheticEvent, H as HtmlSelectElement, a as InputChangeEvent, I as InputElement, S as SelectChangeEvent, b as TransformInputHandler, T as TransformOutputHandler, g as createEventValueExtractor, f as extractEventValue, e as isFormChangeEvent, i as isInputChangeEvent, d as isSelectChangeEvent } from '../events-BcHVCLBz.cjs';
4
+ import 'react';
3
5
 
4
6
  /**
5
7
  * Type definition for server validation errors structure.
@@ -213,6 +215,591 @@ interface OperationResponse {
213
215
  rowsAffected: number;
214
216
  }
215
217
 
218
+ /**
219
+ * Type-safe API request and response utilities
220
+ * @module types/api
221
+ */
222
+ /**
223
+ * HTTP methods supported by the API
224
+ */
225
+ type HttpMethod = 'GET' | 'POST' | 'PUT' | 'DELETE' | 'PATCH';
226
+ /**
227
+ * Valid JSON primitive types that can be sent in request bodies
228
+ */
229
+ type JsonPrimitive = string | number | boolean | null;
230
+ /**
231
+ * Valid JSON values (primitives, objects, arrays)
232
+ */
233
+ type JsonValue = JsonPrimitive | JsonObject | JsonArray;
234
+ /**
235
+ * JSON object with string keys and JSON values
236
+ */
237
+ interface JsonObject {
238
+ [key: string]: JsonValue;
239
+ }
240
+ /**
241
+ * JSON array containing JSON values
242
+ */
243
+ type JsonArray = JsonValue[];
244
+ /**
245
+ * Type-safe request body - must be JSON-serializable
246
+ */
247
+ type RequestBody = JsonObject | JsonArray | FormData;
248
+ /**
249
+ * Standard HTTP headers with known header names
250
+ */
251
+ type HttpHeaders = Record<string, string>;
252
+ /**
253
+ * Options for making HTTP requests (based on fetch API)
254
+ */
255
+ interface RequestOptions {
256
+ /**
257
+ * HTTP method for the request
258
+ */
259
+ method: HttpMethod;
260
+ /**
261
+ * Request headers
262
+ */
263
+ headers?: HttpHeaders;
264
+ /**
265
+ * Request body (string for JSON, FormData for file uploads)
266
+ */
267
+ body?: string | FormData;
268
+ /**
269
+ * Request credentials mode
270
+ */
271
+ credentials?: RequestCredentials;
272
+ /**
273
+ * Request mode (cors, no-cors, same-origin)
274
+ */
275
+ mode?: RequestMode;
276
+ /**
277
+ * Cache mode for the request
278
+ */
279
+ cache?: RequestCache;
280
+ /**
281
+ * Redirect mode for the request
282
+ */
283
+ redirect?: RequestRedirect;
284
+ /**
285
+ * Referrer policy for the request
286
+ */
287
+ referrerPolicy?: ReferrerPolicy;
288
+ /**
289
+ * AbortSignal for request cancellation
290
+ */
291
+ signal?: AbortSignal;
292
+ }
293
+ /**
294
+ * Configuration options for API calls
295
+ */
296
+ interface ApiCallOptions {
297
+ /**
298
+ * Custom headers to include in the request
299
+ */
300
+ headers?: HttpHeaders;
301
+ /**
302
+ * Whether to include authentication token
303
+ * @defaultValue true
304
+ */
305
+ includeAuth?: boolean;
306
+ /**
307
+ * AbortSignal for request cancellation
308
+ */
309
+ signal?: AbortSignal;
310
+ /**
311
+ * Custom base URL (overrides default)
312
+ */
313
+ baseUrl?: string;
314
+ }
315
+ /**
316
+ * Options for fetch operations with any additional parameters
317
+ */
318
+ interface FetchOptions extends Omit<RequestInit, 'body' | 'headers'> {
319
+ /**
320
+ * Request headers
321
+ */
322
+ headers?: HttpHeaders;
323
+ /**
324
+ * Request body
325
+ */
326
+ body?: RequestBody;
327
+ }
328
+ /**
329
+ * Type guard to check if a value is a valid JSON object
330
+ */
331
+ declare function isJsonObject(value: unknown): value is JsonObject;
332
+ /**
333
+ * Type guard to check if a value is a valid JSON array
334
+ */
335
+ declare function isJsonArray(value: unknown): value is JsonArray;
336
+ /**
337
+ * Type guard to check if a value is FormData
338
+ */
339
+ declare function isFormData(value: unknown): value is FormData;
340
+ /**
341
+ * Type guard to check if a value is a valid request body
342
+ */
343
+ declare function isRequestBody(value: unknown): value is RequestBody;
344
+
345
+ /**
346
+ * Utility types and type helpers for enhanced type safety
347
+ *
348
+ * @packageDocumentation
349
+ */
350
+ /**
351
+ * Makes all properties of T required and non-nullable
352
+ *
353
+ * @example
354
+ * ```typescript
355
+ * interface User {
356
+ * id?: string;
357
+ * name?: string | null;
358
+ * }
359
+ *
360
+ * type RequiredUser = DeepRequired<User>;
361
+ * // { id: string; name: string }
362
+ * ```
363
+ *
364
+ * @public
365
+ */
366
+ type DeepRequired<T> = {
367
+ [P in keyof T]-?: NonNullable<T[P]>;
368
+ };
369
+ /**
370
+ * Makes all properties of T optional
371
+ *
372
+ * @example
373
+ * ```typescript
374
+ * interface User {
375
+ * id: string;
376
+ * name: string;
377
+ * }
378
+ *
379
+ * type PartialUser = DeepPartial<User>;
380
+ * // { id?: string; name?: string }
381
+ * ```
382
+ *
383
+ * @public
384
+ */
385
+ type DeepPartial<T> = {
386
+ [P in keyof T]?: T[P] extends object ? DeepPartial<T[P]> : T[P];
387
+ };
388
+ /**
389
+ * Makes all properties of T readonly deeply
390
+ *
391
+ * @example
392
+ * ```typescript
393
+ * interface User {
394
+ * id: string;
395
+ * profile: {
396
+ * name: string;
397
+ * };
398
+ * }
399
+ *
400
+ * type ReadonlyUser = DeepReadonly<User>;
401
+ * // { readonly id: string; readonly profile: { readonly name: string } }
402
+ * ```
403
+ *
404
+ * @public
405
+ */
406
+ type DeepReadonly<T> = {
407
+ readonly [P in keyof T]: T[P] extends object ? DeepReadonly<T[P]> : T[P];
408
+ };
409
+ /**
410
+ * Extracts keys from T that are not undefined
411
+ *
412
+ * @example
413
+ * ```typescript
414
+ * interface User {
415
+ * id: string;
416
+ * name?: string;
417
+ * email: string | undefined;
418
+ * }
419
+ *
420
+ * type RequiredKeys = RequiredKeys<User>;
421
+ * // 'id'
422
+ * ```
423
+ *
424
+ * @public
425
+ */
426
+ type RequiredKeys<T> = {
427
+ [K in keyof T]-?: undefined extends T[K] ? never : K;
428
+ }[keyof T];
429
+ /**
430
+ * Extracts keys from T that can be undefined
431
+ *
432
+ * @example
433
+ * ```typescript
434
+ * interface User {
435
+ * id: string;
436
+ * name?: string;
437
+ * email: string | undefined;
438
+ * }
439
+ *
440
+ * type OptKeys = OptionalKeys<User>;
441
+ * // 'name' | 'email'
442
+ * ```
443
+ *
444
+ * @public
445
+ */
446
+ type OptionalKeys<T> = {
447
+ [K in keyof T]-?: undefined extends T[K] ? K : never;
448
+ }[keyof T];
449
+ /**
450
+ * Makes specified keys K of type T required
451
+ *
452
+ * @example
453
+ * ```typescript
454
+ * interface User {
455
+ * id?: string;
456
+ * name?: string;
457
+ * email?: string;
458
+ * }
459
+ *
460
+ * type UserWithId = RequireKeys<User, 'id' | 'email'>;
461
+ * // { id: string; name?: string; email: string }
462
+ * ```
463
+ *
464
+ * @public
465
+ */
466
+ type RequireKeys<T, K extends keyof T> = Omit<T, K> & Required<Pick<T, K>>;
467
+ /**
468
+ * Makes specified keys K of type T optional
469
+ *
470
+ * @example
471
+ * ```typescript
472
+ * interface User {
473
+ * id: string;
474
+ * name: string;
475
+ * email: string;
476
+ * }
477
+ *
478
+ * type UserUpdate = PartialKeys<User, 'name' | 'email'>;
479
+ * // { id: string; name?: string; email?: string }
480
+ * ```
481
+ *
482
+ * @public
483
+ */
484
+ type PartialKeys<T, K extends keyof T> = Omit<T, K> & Partial<Pick<T, K>>;
485
+ /**
486
+ * Excludes keys K from type T
487
+ *
488
+ * @example
489
+ * ```typescript
490
+ * interface User {
491
+ * id: string;
492
+ * password: string;
493
+ * email: string;
494
+ * }
495
+ *
496
+ * type PublicUser = ExcludeKeys<User, 'password'>;
497
+ * // { id: string; email: string }
498
+ * ```
499
+ *
500
+ * @public
501
+ */
502
+ type ExcludeKeys<T, K extends keyof T> = Omit<T, K>;
503
+ /**
504
+ * Picks only keys K from type T
505
+ *
506
+ * @example
507
+ * ```typescript
508
+ * interface User {
509
+ * id: string;
510
+ * name: string;
511
+ * email: string;
512
+ * }
513
+ *
514
+ * type UserCredentials = PickKeys<User, 'email'>;
515
+ * // { email: string }
516
+ * ```
517
+ *
518
+ * @public
519
+ */
520
+ type PickKeys<T, K extends keyof T> = Pick<T, K>;
521
+ /**
522
+ * Extracts the value type from an array type
523
+ *
524
+ * @example
525
+ * ```typescript
526
+ * type StringArray = string[];
527
+ * type Item = ArrayElement<StringArray>;
528
+ * // string
529
+ * ```
530
+ *
531
+ * @public
532
+ */
533
+ type ArrayElement<T> = T extends readonly (infer E)[] ? E : never;
534
+ /**
535
+ * Extracts the return type of an async function
536
+ *
537
+ * @example
538
+ * ```typescript
539
+ * async function getUser(): Promise<User> {
540
+ * return { id: '1', name: 'John' };
541
+ * }
542
+ *
543
+ * type User = AsyncReturnType<typeof getUser>;
544
+ * // User
545
+ * ```
546
+ *
547
+ * @public
548
+ */
549
+ type AsyncReturnType<T extends (...args: readonly unknown[]) => Promise<unknown>> = T extends (...args: readonly unknown[]) => Promise<infer R> ? R : never;
550
+ /**
551
+ * Makes a type nullable (adds null)
552
+ *
553
+ * @example
554
+ * ```typescript
555
+ * type Username = string;
556
+ * type NullableUsername = Nullable<Username>;
557
+ * // string | null
558
+ * ```
559
+ *
560
+ * @public
561
+ */
562
+ type Nullable<T> = T | null;
563
+ /**
564
+ * Makes a type optional (adds undefined)
565
+ *
566
+ * @example
567
+ * ```typescript
568
+ * type Username = string;
569
+ * type OptionalUsername = Maybe<Username>;
570
+ * // string | undefined
571
+ * ```
572
+ *
573
+ * @public
574
+ */
575
+ type Maybe<T> = T | undefined;
576
+ /**
577
+ * Makes a type nullish (adds null and undefined)
578
+ *
579
+ * @example
580
+ * ```typescript
581
+ * type Username = string;
582
+ * type NullishUsername = Nullish<Username>;
583
+ * // string | null | undefined
584
+ * ```
585
+ *
586
+ * @public
587
+ */
588
+ type Nullish<T> = T | null | undefined;
589
+ /**
590
+ * Creates a union of all possible paths through an object type
591
+ *
592
+ * @example
593
+ * ```typescript
594
+ * interface User {
595
+ * profile: {
596
+ * name: string;
597
+ * address: {
598
+ * city: string;
599
+ * };
600
+ * };
601
+ * }
602
+ *
603
+ * type Paths = ObjectPaths<User>;
604
+ * // 'profile' | 'profile.name' | 'profile.address' | 'profile.address.city'
605
+ * ```
606
+ *
607
+ * @public
608
+ */
609
+ type ObjectPaths<T> = {
610
+ [K in keyof T & string]: T[K] extends object ? K | `${K}.${ObjectPaths<T[K]>}` : K;
611
+ }[keyof T & string];
612
+ /**
613
+ * Merges two types, with properties from B overriding those in A
614
+ *
615
+ * @example
616
+ * ```typescript
617
+ * interface A {
618
+ * id: number;
619
+ * name: string;
620
+ * }
621
+ *
622
+ * interface B {
623
+ * id: string;
624
+ * email: string;
625
+ * }
626
+ *
627
+ * type Merged = Merge<A, B>;
628
+ * // { id: string; name: string; email: string }
629
+ * ```
630
+ *
631
+ * @public
632
+ */
633
+ type Merge<A, B> = Omit<A, keyof B> & B;
634
+ /**
635
+ * Ensures a type is serializable (no functions, symbols, undefined)
636
+ *
637
+ * @example
638
+ * ```typescript
639
+ * interface Data {
640
+ * id: string;
641
+ * callback: () => void;
642
+ * value: number;
643
+ * }
644
+ *
645
+ * type SerializableData = Serializable<Data>;
646
+ * // { id: string; value: number }
647
+ * ```
648
+ *
649
+ * @public
650
+ */
651
+ type Serializable<T> = {
652
+ [K in keyof T as T[K] extends (...args: readonly unknown[]) => unknown ? never : T[K] extends symbol ? never : T[K] extends undefined ? never : K]: T[K] extends object ? Serializable<T[K]> : T[K];
653
+ };
654
+ /**
655
+ * Converts a union type to an intersection type
656
+ *
657
+ * @example
658
+ * ```typescript
659
+ * type Union = { a: string } | { b: number };
660
+ * type Intersection = UnionToIntersection<Union>;
661
+ * // { a: string } & { b: number }
662
+ * ```
663
+ *
664
+ * @public
665
+ */
666
+ type UnionToIntersection<U> = (U extends unknown ? (k: U) => void : never) extends (k: infer I) => void ? I : never;
667
+ /**
668
+ * Gets all keys of T whose values extend V
669
+ *
670
+ * @example
671
+ * ```typescript
672
+ * interface User {
673
+ * id: string;
674
+ * age: number;
675
+ * name: string;
676
+ * active: boolean;
677
+ * }
678
+ *
679
+ * type StringKeys = KeysOfType<User, string>;
680
+ * // 'id' | 'name'
681
+ * ```
682
+ *
683
+ * @public
684
+ */
685
+ type KeysOfType<T, V> = {
686
+ [K in keyof T]: T[K] extends V ? K : never;
687
+ }[keyof T];
688
+ /**
689
+ * Ensures a value is exactly the type T (no wider types allowed)
690
+ *
691
+ * @example
692
+ * ```typescript
693
+ * const config: Exact<{ debug: boolean }> = {
694
+ * debug: true,
695
+ * // extra: 'value' // ❌ Error: extra property not allowed
696
+ * };
697
+ * ```
698
+ *
699
+ * @public
700
+ */
701
+ type Exact<T, Shape = T> = T extends Shape ? Exclude<keyof T, keyof Shape> extends never ? T : never : never;
702
+ /**
703
+ * Creates a branded type for nominal typing
704
+ * This prevents mixing values of the same primitive type
705
+ *
706
+ * @example
707
+ * ```typescript
708
+ * type UserId = Brand<string, 'UserId'>;
709
+ * type ProductId = Brand<string, 'ProductId'>;
710
+ *
711
+ * const userId: UserId = '123' as UserId;
712
+ * const productId: ProductId = '456' as ProductId;
713
+ *
714
+ * // ❌ Type error: UserId is not assignable to ProductId
715
+ * const test: ProductId = userId;
716
+ * ```
717
+ *
718
+ * @public
719
+ */
720
+ type Brand<T, TBrand extends string> = T & {
721
+ readonly __brand: TBrand;
722
+ };
723
+ /**
724
+ * Helper to create a branded value
725
+ *
726
+ * @param value - The value to brand
727
+ * @returns The value as a branded type
728
+ *
729
+ * @example
730
+ * ```typescript
731
+ * type UserId = Brand<string, 'UserId'>;
732
+ * const id = brand<string, 'UserId'>('user-123');
733
+ * // id has type UserId
734
+ * ```
735
+ *
736
+ * @public
737
+ */
738
+ declare function brand<T, TBrand extends string>(value: T): Brand<T, TBrand>;
739
+ /**
740
+ * Removes branding from a branded type
741
+ *
742
+ * @example
743
+ * ```typescript
744
+ * type UserId = Brand<string, 'UserId'>;
745
+ * type PlainId = Unbrand<UserId>;
746
+ * // string
747
+ * ```
748
+ *
749
+ * @public
750
+ */
751
+ type Unbrand<T> = T extends infer U & {
752
+ readonly __brand: string;
753
+ } ? U : T;
754
+ /**
755
+ * Type-safe Object.keys that preserves key types
756
+ *
757
+ * @param obj - The object to get keys from
758
+ * @returns Array of keys with proper type
759
+ *
760
+ * @example
761
+ * ```typescript
762
+ * const user = { id: '1', name: 'John' } as const;
763
+ * const keys = typedKeys(user);
764
+ * // keys has type: ('id' | 'name')[]
765
+ * ```
766
+ *
767
+ * @public
768
+ */
769
+ declare function typedKeys<T extends Record<string, unknown>>(obj: T): Array<keyof T>;
770
+ /**
771
+ * Type-safe Object.entries that preserves key and value types
772
+ *
773
+ * @param obj - The object to get entries from
774
+ * @returns Array of [key, value] tuples with proper types
775
+ *
776
+ * @example
777
+ * ```typescript
778
+ * const user = { id: '1', age: 30 } as const;
779
+ * const entries = typedEntries(user);
780
+ * // entries has type: ['id', '1'] | ['age', 30]
781
+ * ```
782
+ *
783
+ * @public
784
+ */
785
+ declare function typedEntries<T extends Record<string, unknown>>(obj: T): Array<[keyof T, T[keyof T]]>;
786
+ /**
787
+ * Type-safe Object.values that preserves value types
788
+ *
789
+ * @param obj - The object to get values from
790
+ * @returns Array of values with proper type
791
+ *
792
+ * @example
793
+ * ```typescript
794
+ * const user = { id: '1', age: 30 };
795
+ * const values = typedValues(user);
796
+ * // values has type: (string | number)[]
797
+ * ```
798
+ *
799
+ * @public
800
+ */
801
+ declare function typedValues<T extends Record<string, unknown>>(obj: T): Array<T[keyof T]>;
802
+
216
803
  interface PostModel<TFilterModel> {
217
804
  filterModel?: TFilterModel;
218
805
  pageOffset: number;
@@ -230,4 +817,4 @@ interface ValueLabel {
230
817
  Label: string;
231
818
  }
232
819
 
233
- export type { ApiResponse, AsyncMultiSelectPayload, ListResponse, OperationResponse, OptionItem, OptionItem2, PostModel, ValidationErrors, ValueLabel };
820
+ export { type ApiCallOptions, type ApiResponse, type ArrayElement, type AsyncMultiSelectPayload, type AsyncReturnType, type Brand, type DeepPartial, type DeepReadonly, type DeepRequired, type Exact, type ExcludeKeys, type FetchOptions, type HttpHeaders, type HttpMethod, type JsonArray, type JsonObject, type JsonPrimitive, type JsonValue, type KeysOfType, type ListResponse, type Maybe, type Merge, type Nullable, type Nullish, type ObjectPaths, type OperationResponse, type OptionItem, type OptionItem2, type OptionalKeys, type PartialKeys, type PickKeys, type PostModel, type RequestBody, type RequestOptions, type RequireKeys, type RequiredKeys, type Serializable, type Unbrand, type UnionToIntersection, type ValidationErrors, type ValueLabel, brand, isFormData, isJsonArray, isJsonObject, isRequestBody, typedEntries, typedKeys, typedValues };