@gnwebsoft/ui 4.0.0 → 4.0.2

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 (56) hide show
  1. package/dist/chunk-BXF3QEBN.js +2181 -0
  2. package/dist/chunk-DS524L7W.cjs +467 -0
  3. package/dist/chunk-FYU2OIMD.js +15 -0
  4. package/dist/chunk-GHW77WIM.cjs +72 -0
  5. package/dist/chunk-GLN5JSFF.cjs +2181 -0
  6. package/dist/chunk-GVWCGJ3F.js +140 -0
  7. package/dist/chunk-LUW7V5GI.cjs +15 -0
  8. package/dist/chunk-M526GQZS.js +2490 -0
  9. package/dist/chunk-MULSVYFT.js +72 -0
  10. package/dist/chunk-MVPLBJRK.cjs +1 -1
  11. package/dist/chunk-PUQIPRL2.js +467 -0
  12. package/dist/chunk-QLQ6OH25.cjs +2490 -0
  13. package/dist/chunk-Y3QTSDLJ.cjs +140 -0
  14. package/dist/core/index.cjs +121 -0
  15. package/dist/core/index.js +121 -0
  16. package/dist/hooks/index.cjs +3 -3
  17. package/dist/hooks/index.js +1 -1
  18. package/dist/index.cjs +85 -7
  19. package/dist/index.js +147 -69
  20. package/dist/types/index.cjs +3 -3
  21. package/dist/types/index.js +1 -1
  22. package/dist/utils/index.cjs +4 -24
  23. package/dist/utils/index.js +6 -26
  24. package/dist/wrappers/index.cjs +7 -4
  25. package/dist/wrappers/index.js +21 -18
  26. package/package.json +22 -17
  27. package/dist/AsyncSelectPayload-B9-6l33R.d.cts +0 -10
  28. package/dist/AsyncSelectPayload-B9-6l33R.d.ts +0 -10
  29. package/dist/chunk-3OPVOWQK.js +0 -140
  30. package/dist/chunk-AEOF2TUF.cjs +0 -2273
  31. package/dist/chunk-ALHC7RLK.js +0 -575
  32. package/dist/chunk-BRRLB22L.js +0 -72
  33. package/dist/chunk-CHZU4PZB.js +0 -2273
  34. package/dist/chunk-EBRUE2WR.cjs +0 -493
  35. package/dist/chunk-HEHPKM4B.cjs +0 -140
  36. package/dist/chunk-K2EJ4YKO.cjs +0 -72
  37. package/dist/chunk-U6SDYCWF.js +0 -493
  38. package/dist/chunk-XY4U6A77.cjs +0 -575
  39. package/dist/components/index.cjs +0 -25
  40. package/dist/components/index.d.cts +0 -752
  41. package/dist/components/index.d.ts +0 -752
  42. package/dist/components/index.js +0 -25
  43. package/dist/enhanced-CDTkKUlj.d.ts +0 -134
  44. package/dist/enhanced-ZQoS03Cd.d.cts +0 -134
  45. package/dist/events-BcHVCLBz.d.cts +0 -77
  46. package/dist/events-BcHVCLBz.d.ts +0 -77
  47. package/dist/hooks/index.d.cts +0 -96
  48. package/dist/hooks/index.d.ts +0 -96
  49. package/dist/index.d.cts +0 -16
  50. package/dist/index.d.ts +0 -16
  51. package/dist/types/index.d.cts +0 -820
  52. package/dist/types/index.d.ts +0 -820
  53. package/dist/utils/index.d.cts +0 -683
  54. package/dist/utils/index.d.ts +0 -683
  55. package/dist/wrappers/index.d.cts +0 -1753
  56. package/dist/wrappers/index.d.ts +0 -1753
@@ -1,25 +0,0 @@
1
- import {
2
- AuthorizedView_default,
3
- CancelButton_default,
4
- ClearButton_default,
5
- FilterButton_default,
6
- FilterWrapper_default,
7
- FormWrapper_default,
8
- LabelText_default,
9
- ListWrapper_default,
10
- SimpleButton_default,
11
- SimpleToolbar_default
12
- } from "../chunk-U6SDYCWF.js";
13
- export {
14
- AuthorizedView_default as AuthorizedView,
15
- CancelButton_default as CancelButton,
16
- ClearButton_default as ClearButton,
17
- FilterButton_default as FilterButton,
18
- FilterWrapper_default as FilterWrapper,
19
- FormWrapper_default as FormWrapper,
20
- LabelText_default as LabelText,
21
- ListWrapper_default as ListWrapper,
22
- SimpleButton_default as SimpleButton,
23
- SimpleToolbar_default as SimpleToolbar
24
- };
25
- //# sourceMappingURL=data:application/json;base64,ewogICJ2ZXJzaW9uIjogMywKICAic291cmNlcyI6IFtdLAogICJzb3VyY2VzQ29udGVudCI6IFtdLAogICJtYXBwaW5ncyI6ICIiLAogICJuYW1lcyI6IFtdCn0K
@@ -1,134 +0,0 @@
1
- import { FieldValues, FieldPath, PathValue, UseControllerReturn } from 'react-hook-form';
2
- import { E as EventOrValue } from './events-BcHVCLBz.js';
3
-
4
- /**
5
- * Field types for built-in transformation patterns
6
- */
7
- type FieldType = 'text' | 'number' | 'date' | 'time' | 'select' | 'radio';
8
- /**
9
- * Enhanced options for the useTransform hook with performance optimizations
10
- * and built-in field type handling.
11
- *
12
- * @template TFieldValues - The form values type
13
- * @template TName - The field name type
14
- * @template TValue - The transformed value type
15
- *
16
- * @public
17
- */
18
- interface EnhancedUseTransformOptions<TFieldValues extends FieldValues = FieldValues, TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>, TValue = PathValue<TFieldValues, TName>> {
19
- /** The current field value from react-hook-form */
20
- value: UseControllerReturn<TFieldValues, TName>["field"]["value"];
21
- /** The onChange handler from react-hook-form */
22
- onChange: UseControllerReturn<TFieldValues, TName>["field"]["onChange"];
23
- /** Optional transformation functions */
24
- transform?: {
25
- /**
26
- * Transform the field value for display in the input
27
- * @param value - The current field value
28
- * @returns The transformed value to display
29
- */
30
- input?: (value: PathValue<TFieldValues, TName>) => TValue;
31
- /**
32
- * Transform the input event back to the field value
33
- * @param event - The input event or value
34
- * @returns The transformed value to store in the form
35
- */
36
- output?: (eventOrValue: EventOrValue<PathValue<TFieldValues, TName>>, value?: PathValue<TFieldValues, TName>) => PathValue<TFieldValues, TName>;
37
- };
38
- /** Built-in field type for automatic transformation */
39
- fieldType?: FieldType;
40
- /** Default value to use when field value is null/undefined */
41
- defaultValue?: TValue;
42
- /** Enable development warnings for debugging */
43
- enableWarnings?: boolean;
44
- }
45
- /**
46
- * Enhanced return type for the useTransform hook with stable references
47
- *
48
- * @template TFieldValues - The form values type
49
- * @template TName - The field name type
50
- * @template TValue - The transformed value type
51
- *
52
- * @public
53
- */
54
- interface EnhancedUseTransformReturn<TFieldValues extends FieldValues = FieldValues, TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>, TValue = PathValue<TFieldValues, TName>> {
55
- /** The transformed value to display in the input (memoized) */
56
- value: TValue;
57
- /** The enhanced onChange handler with transformation applied (memoized) */
58
- onChange: UseControllerReturn<TFieldValues, TName>["field"]["onChange"];
59
- }
60
- /**
61
- * Transform factories for common field types
62
- */
63
- declare const transformFactories: {
64
- readonly number: <TFieldValues extends FieldValues, TName extends FieldPath<TFieldValues>>() => {
65
- input: (value: PathValue<TFieldValues, TName>) => string;
66
- output: (eventOrValue: EventOrValue<PathValue<TFieldValues, TName>>, _value?: PathValue<TFieldValues, TName>) => PathValue<TFieldValues, TName>;
67
- };
68
- readonly text: <TFieldValues extends FieldValues, TName extends FieldPath<TFieldValues>>() => {
69
- input: (value: PathValue<TFieldValues, TName>) => string;
70
- output: (eventOrValue: EventOrValue<PathValue<TFieldValues, TName>>, _value?: PathValue<TFieldValues, TName>) => PathValue<TFieldValues, TName>;
71
- };
72
- readonly select: <TFieldValues extends FieldValues, TName extends FieldPath<TFieldValues>>() => {
73
- input: (value: PathValue<TFieldValues, TName>) => string;
74
- output: (eventOrValue: EventOrValue<PathValue<TFieldValues, TName>>, value?: PathValue<TFieldValues, TName>) => PathValue<TFieldValues, TName>;
75
- };
76
- };
77
- /**
78
- * An enhanced hook for transforming form field values with performance optimizations
79
- * and built-in field type handling.
80
- *
81
- * This enhanced version provides:
82
- * - Performance optimizations with useMemo and useCallback
83
- * - Built-in transformations for common field types
84
- * - Better TypeScript inference
85
- * - Development warnings
86
- * - Stable references to prevent unnecessary re-renders
87
- *
88
- * @example
89
- * Basic usage with built-in number handling:
90
- * ```tsx
91
- * const { value, onChange } = useEnhancedTransform({
92
- * value: field.value,
93
- * onChange: field.onChange,
94
- * fieldType: 'number'
95
- * });
96
- * ```
97
- *
98
- * @example
99
- * Custom transformations (same as original):
100
- * ```tsx
101
- * const { value, onChange } = useEnhancedTransform({
102
- * value: field.value,
103
- * onChange: field.onChange,
104
- * transform: {
105
- * input: (value) => value?.toString() || '',
106
- * output: (event) => parseInt(event.target.value) || null
107
- * }
108
- * });
109
- * ```
110
- *
111
- * @example
112
- * With default value and warnings:
113
- * ```tsx
114
- * const { value, onChange } = useEnhancedTransform({
115
- * value: field.value,
116
- * onChange: field.onChange,
117
- * fieldType: 'text',
118
- * defaultValue: '',
119
- * enableWarnings: process.env.NODE_ENV === 'development'
120
- * });
121
- * ```
122
- *
123
- * @template TFieldValues - The form values type
124
- * @template TName - The field name type
125
- * @template TValue - The transformed value type
126
- *
127
- * @param options - Configuration options including value, onChange, and transform functions
128
- * @returns Object with transformed value and enhanced onChange handler (both memoized)
129
- *
130
- * @public
131
- */
132
- declare function useEnhancedTransform<TFieldValues extends FieldValues = FieldValues, TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>, TValue = PathValue<TFieldValues, TName>>(options: EnhancedUseTransformOptions<TFieldValues, TName, TValue>): EnhancedUseTransformReturn<TFieldValues, TName, TValue>;
133
-
134
- export { type EnhancedUseTransformOptions as E, type FieldType as F, type EnhancedUseTransformReturn as a, transformFactories as t, useEnhancedTransform as u };
@@ -1,134 +0,0 @@
1
- import { FieldValues, FieldPath, PathValue, UseControllerReturn } from 'react-hook-form';
2
- import { E as EventOrValue } from './events-BcHVCLBz.cjs';
3
-
4
- /**
5
- * Field types for built-in transformation patterns
6
- */
7
- type FieldType = 'text' | 'number' | 'date' | 'time' | 'select' | 'radio';
8
- /**
9
- * Enhanced options for the useTransform hook with performance optimizations
10
- * and built-in field type handling.
11
- *
12
- * @template TFieldValues - The form values type
13
- * @template TName - The field name type
14
- * @template TValue - The transformed value type
15
- *
16
- * @public
17
- */
18
- interface EnhancedUseTransformOptions<TFieldValues extends FieldValues = FieldValues, TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>, TValue = PathValue<TFieldValues, TName>> {
19
- /** The current field value from react-hook-form */
20
- value: UseControllerReturn<TFieldValues, TName>["field"]["value"];
21
- /** The onChange handler from react-hook-form */
22
- onChange: UseControllerReturn<TFieldValues, TName>["field"]["onChange"];
23
- /** Optional transformation functions */
24
- transform?: {
25
- /**
26
- * Transform the field value for display in the input
27
- * @param value - The current field value
28
- * @returns The transformed value to display
29
- */
30
- input?: (value: PathValue<TFieldValues, TName>) => TValue;
31
- /**
32
- * Transform the input event back to the field value
33
- * @param event - The input event or value
34
- * @returns The transformed value to store in the form
35
- */
36
- output?: (eventOrValue: EventOrValue<PathValue<TFieldValues, TName>>, value?: PathValue<TFieldValues, TName>) => PathValue<TFieldValues, TName>;
37
- };
38
- /** Built-in field type for automatic transformation */
39
- fieldType?: FieldType;
40
- /** Default value to use when field value is null/undefined */
41
- defaultValue?: TValue;
42
- /** Enable development warnings for debugging */
43
- enableWarnings?: boolean;
44
- }
45
- /**
46
- * Enhanced return type for the useTransform hook with stable references
47
- *
48
- * @template TFieldValues - The form values type
49
- * @template TName - The field name type
50
- * @template TValue - The transformed value type
51
- *
52
- * @public
53
- */
54
- interface EnhancedUseTransformReturn<TFieldValues extends FieldValues = FieldValues, TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>, TValue = PathValue<TFieldValues, TName>> {
55
- /** The transformed value to display in the input (memoized) */
56
- value: TValue;
57
- /** The enhanced onChange handler with transformation applied (memoized) */
58
- onChange: UseControllerReturn<TFieldValues, TName>["field"]["onChange"];
59
- }
60
- /**
61
- * Transform factories for common field types
62
- */
63
- declare const transformFactories: {
64
- readonly number: <TFieldValues extends FieldValues, TName extends FieldPath<TFieldValues>>() => {
65
- input: (value: PathValue<TFieldValues, TName>) => string;
66
- output: (eventOrValue: EventOrValue<PathValue<TFieldValues, TName>>, _value?: PathValue<TFieldValues, TName>) => PathValue<TFieldValues, TName>;
67
- };
68
- readonly text: <TFieldValues extends FieldValues, TName extends FieldPath<TFieldValues>>() => {
69
- input: (value: PathValue<TFieldValues, TName>) => string;
70
- output: (eventOrValue: EventOrValue<PathValue<TFieldValues, TName>>, _value?: PathValue<TFieldValues, TName>) => PathValue<TFieldValues, TName>;
71
- };
72
- readonly select: <TFieldValues extends FieldValues, TName extends FieldPath<TFieldValues>>() => {
73
- input: (value: PathValue<TFieldValues, TName>) => string;
74
- output: (eventOrValue: EventOrValue<PathValue<TFieldValues, TName>>, value?: PathValue<TFieldValues, TName>) => PathValue<TFieldValues, TName>;
75
- };
76
- };
77
- /**
78
- * An enhanced hook for transforming form field values with performance optimizations
79
- * and built-in field type handling.
80
- *
81
- * This enhanced version provides:
82
- * - Performance optimizations with useMemo and useCallback
83
- * - Built-in transformations for common field types
84
- * - Better TypeScript inference
85
- * - Development warnings
86
- * - Stable references to prevent unnecessary re-renders
87
- *
88
- * @example
89
- * Basic usage with built-in number handling:
90
- * ```tsx
91
- * const { value, onChange } = useEnhancedTransform({
92
- * value: field.value,
93
- * onChange: field.onChange,
94
- * fieldType: 'number'
95
- * });
96
- * ```
97
- *
98
- * @example
99
- * Custom transformations (same as original):
100
- * ```tsx
101
- * const { value, onChange } = useEnhancedTransform({
102
- * value: field.value,
103
- * onChange: field.onChange,
104
- * transform: {
105
- * input: (value) => value?.toString() || '',
106
- * output: (event) => parseInt(event.target.value) || null
107
- * }
108
- * });
109
- * ```
110
- *
111
- * @example
112
- * With default value and warnings:
113
- * ```tsx
114
- * const { value, onChange } = useEnhancedTransform({
115
- * value: field.value,
116
- * onChange: field.onChange,
117
- * fieldType: 'text',
118
- * defaultValue: '',
119
- * enableWarnings: process.env.NODE_ENV === 'development'
120
- * });
121
- * ```
122
- *
123
- * @template TFieldValues - The form values type
124
- * @template TName - The field name type
125
- * @template TValue - The transformed value type
126
- *
127
- * @param options - Configuration options including value, onChange, and transform functions
128
- * @returns Object with transformed value and enhanced onChange handler (both memoized)
129
- *
130
- * @public
131
- */
132
- declare function useEnhancedTransform<TFieldValues extends FieldValues = FieldValues, TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>, TValue = PathValue<TFieldValues, TName>>(options: EnhancedUseTransformOptions<TFieldValues, TName, TValue>): EnhancedUseTransformReturn<TFieldValues, TName, TValue>;
133
-
134
- export { type EnhancedUseTransformOptions as E, type FieldType as F, type EnhancedUseTransformReturn as a, transformFactories as t, useEnhancedTransform as u };
@@ -1,77 +0,0 @@
1
- import { ChangeEvent, SyntheticEvent } from 'react';
2
-
3
- /**
4
- * Type-safe DOM event and handler utilities for form transformations
5
- * @module types/events
6
- */
7
-
8
- /**
9
- * HTML input elements that support the onChange event with a value
10
- */
11
- type InputElement = HTMLInputElement | HTMLTextAreaElement;
12
- /**
13
- * HTML select element
14
- */
15
- type HtmlSelectElement = HTMLSelectElement;
16
- /**
17
- * Standard React change event for input/textarea elements
18
- */
19
- type InputChangeEvent = ChangeEvent<InputElement>;
20
- /**
21
- * Standard React change event for select elements
22
- */
23
- type SelectChangeEvent = ChangeEvent<HtmlSelectElement>;
24
- /**
25
- * Union of all standard form change events
26
- */
27
- type FormChangeEvent = InputChangeEvent | SelectChangeEvent;
28
- /**
29
- * Generic synthetic event from React
30
- */
31
- type GenericSyntheticEvent = SyntheticEvent<Element>;
32
- /**
33
- * Value extracted from an event or passed directly
34
- * This covers MUI's pattern of (event, value) callbacks
35
- */
36
- type EventOrValue<TValue = unknown> = TValue | InputChangeEvent | SelectChangeEvent | GenericSyntheticEvent;
37
- /**
38
- * Transform output handler that accepts various event patterns
39
- * Supports:
40
- * - Standard onChange: (event: ChangeEvent) => void
41
- * - MUI onChange: (event: ChangeEvent, value: T) => void
42
- * - Direct value: (value: T) => void
43
- */
44
- type TransformOutputHandler<TValue = unknown> = (eventOrValue: EventOrValue<TValue>, value?: TValue) => TValue;
45
- /**
46
- * Transform input handler that converts a value to display format
47
- */
48
- type TransformInputHandler<TInput = unknown, TOutput = unknown> = (value: TInput) => TOutput;
49
- /**
50
- * Generic event handler that accepts rest parameters
51
- * Used for flexibility in event handling
52
- */
53
- type GenericEventHandler<TReturn = void> = (...args: unknown[]) => TReturn;
54
- /**
55
- * Type guard to check if a value is an InputChangeEvent
56
- */
57
- declare function isInputChangeEvent(value: unknown): value is InputChangeEvent;
58
- /**
59
- * Type guard to check if a value is a SelectChangeEvent
60
- */
61
- declare function isSelectChangeEvent(value: unknown): value is SelectChangeEvent;
62
- /**
63
- * Type guard to check if a value is any form change event
64
- */
65
- declare function isFormChangeEvent(value: unknown): value is FormChangeEvent;
66
- /**
67
- * Extract value from event or return the value directly
68
- * Handles the common pattern: value ?? event?.target?.value ?? event
69
- */
70
- declare function extractEventValue<TValue = unknown>(eventOrValue: EventOrValue<TValue>, fallbackValue?: TValue): TValue;
71
- /**
72
- * Create a safe event value extractor with type narrowing
73
- * Useful for MUI components that pass (event, value) pattern
74
- */
75
- declare function createEventValueExtractor<TValue = unknown>(): (eventOrValue: EventOrValue<TValue>, directValue?: TValue) => TValue;
76
-
77
- export { type EventOrValue as E, type FormChangeEvent as F, type GenericSyntheticEvent as G, type HtmlSelectElement as H, type InputElement as I, type SelectChangeEvent as S, type TransformOutputHandler as T, type InputChangeEvent as a, type TransformInputHandler as b, type GenericEventHandler as c, isSelectChangeEvent as d, isFormChangeEvent as e, extractEventValue as f, createEventValueExtractor as g, isInputChangeEvent as i };
@@ -1,77 +0,0 @@
1
- import { ChangeEvent, SyntheticEvent } from 'react';
2
-
3
- /**
4
- * Type-safe DOM event and handler utilities for form transformations
5
- * @module types/events
6
- */
7
-
8
- /**
9
- * HTML input elements that support the onChange event with a value
10
- */
11
- type InputElement = HTMLInputElement | HTMLTextAreaElement;
12
- /**
13
- * HTML select element
14
- */
15
- type HtmlSelectElement = HTMLSelectElement;
16
- /**
17
- * Standard React change event for input/textarea elements
18
- */
19
- type InputChangeEvent = ChangeEvent<InputElement>;
20
- /**
21
- * Standard React change event for select elements
22
- */
23
- type SelectChangeEvent = ChangeEvent<HtmlSelectElement>;
24
- /**
25
- * Union of all standard form change events
26
- */
27
- type FormChangeEvent = InputChangeEvent | SelectChangeEvent;
28
- /**
29
- * Generic synthetic event from React
30
- */
31
- type GenericSyntheticEvent = SyntheticEvent<Element>;
32
- /**
33
- * Value extracted from an event or passed directly
34
- * This covers MUI's pattern of (event, value) callbacks
35
- */
36
- type EventOrValue<TValue = unknown> = TValue | InputChangeEvent | SelectChangeEvent | GenericSyntheticEvent;
37
- /**
38
- * Transform output handler that accepts various event patterns
39
- * Supports:
40
- * - Standard onChange: (event: ChangeEvent) => void
41
- * - MUI onChange: (event: ChangeEvent, value: T) => void
42
- * - Direct value: (value: T) => void
43
- */
44
- type TransformOutputHandler<TValue = unknown> = (eventOrValue: EventOrValue<TValue>, value?: TValue) => TValue;
45
- /**
46
- * Transform input handler that converts a value to display format
47
- */
48
- type TransformInputHandler<TInput = unknown, TOutput = unknown> = (value: TInput) => TOutput;
49
- /**
50
- * Generic event handler that accepts rest parameters
51
- * Used for flexibility in event handling
52
- */
53
- type GenericEventHandler<TReturn = void> = (...args: unknown[]) => TReturn;
54
- /**
55
- * Type guard to check if a value is an InputChangeEvent
56
- */
57
- declare function isInputChangeEvent(value: unknown): value is InputChangeEvent;
58
- /**
59
- * Type guard to check if a value is a SelectChangeEvent
60
- */
61
- declare function isSelectChangeEvent(value: unknown): value is SelectChangeEvent;
62
- /**
63
- * Type guard to check if a value is any form change event
64
- */
65
- declare function isFormChangeEvent(value: unknown): value is FormChangeEvent;
66
- /**
67
- * Extract value from event or return the value directly
68
- * Handles the common pattern: value ?? event?.target?.value ?? event
69
- */
70
- declare function extractEventValue<TValue = unknown>(eventOrValue: EventOrValue<TValue>, fallbackValue?: TValue): TValue;
71
- /**
72
- * Create a safe event value extractor with type narrowing
73
- * Useful for MUI components that pass (event, value) pattern
74
- */
75
- declare function createEventValueExtractor<TValue = unknown>(): (eventOrValue: EventOrValue<TValue>, directValue?: TValue) => TValue;
76
-
77
- export { type EventOrValue as E, type FormChangeEvent as F, type GenericSyntheticEvent as G, type HtmlSelectElement as H, type InputElement as I, type SelectChangeEvent as S, type TransformOutputHandler as T, type InputChangeEvent as a, type TransformInputHandler as b, type GenericEventHandler as c, isSelectChangeEvent as d, isFormChangeEvent as e, extractEventValue as f, createEventValueExtractor as g, isInputChangeEvent as i };
@@ -1,96 +0,0 @@
1
- import { FieldValues, FieldPath, UseControllerReturn, PathValue } from 'react-hook-form';
2
- import { E as EventOrValue } from '../events-BcHVCLBz.cjs';
3
- export { E as EnhancedUseTransformOptions, a as EnhancedUseTransformReturn, F as FieldType, t as transformFactories, u as useEnhancedTransform } from '../enhanced-ZQoS03Cd.cjs';
4
- import 'react';
5
-
6
- /**
7
- * Options for the useTransform hook.
8
- *
9
- * @template TFieldValues - The form values type
10
- * @template TName - The field name type
11
- * @template TValue - The transformed value type
12
- *
13
- * @public
14
- */
15
- interface UseTransformOptions<TFieldValues extends FieldValues = FieldValues, TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>, TValue = unknown> {
16
- /** The current field value from react-hook-form */
17
- value: UseControllerReturn<TFieldValues, TName>["field"]["value"];
18
- /** The onChange handler from react-hook-form */
19
- onChange: UseControllerReturn<TFieldValues, TName>["field"]["onChange"];
20
- /** Optional transformation functions */
21
- transform?: {
22
- /**
23
- * Transform the field value for display in the input
24
- * @param value - The current field value
25
- * @returns The transformed value to display
26
- */
27
- input?: (value: PathValue<TFieldValues, TName>) => TValue;
28
- /**
29
- * Transform the input event back to the field value
30
- * @param event - The input event parameters
31
- * @returns The transformed value to store in the form
32
- */
33
- output?: (eventOrValue: EventOrValue<PathValue<TFieldValues, TName>>, value?: PathValue<TFieldValues, TName>) => PathValue<TFieldValues, TName>;
34
- };
35
- }
36
- /**
37
- * Return type for the useTransform hook.
38
- *
39
- * @template TFieldValues - The form values type
40
- * @template TName - The field name type
41
- * @template TValue - The transformed value type
42
- *
43
- * @public
44
- */
45
- interface UseTransformReturn<TFieldValues extends FieldValues = FieldValues, TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>, TValue = unknown> {
46
- /** The transformed value to display in the input */
47
- value: TValue;
48
- /** The enhanced onChange handler with transformation applied */
49
- onChange: UseControllerReturn<TFieldValues, TName>["field"]["onChange"];
50
- }
51
- /**
52
- * A hook for transforming form field values between display and storage formats.
53
- *
54
- * This hook provides a way to transform values as they flow between the form field
55
- * and the display component. It's particularly useful for formatting data for display
56
- * (like dates, numbers, or complex objects) while maintaining a different internal
57
- * representation in the form state.
58
- *
59
- * @example
60
- * Transform a date for display:
61
- * ```tsx
62
- * const { value, onChange } = useTransform({
63
- * value: field.value,
64
- * onChange: field.onChange,
65
- * transform: {
66
- * input: (date) => date ? format(date, 'yyyy-MM-dd') : '',
67
- * output: (event) => new Date(event.target.value)
68
- * }
69
- * });
70
- * ```
71
- *
72
- * @example
73
- * Transform numbers with formatting:
74
- * ```tsx
75
- * const { value, onChange } = useTransform({
76
- * value: field.value,
77
- * onChange: field.onChange,
78
- * transform: {
79
- * input: (num) => num ? num.toLocaleString() : '',
80
- * output: (event) => parseFloat(event.target.value.replace(/,/g, ''))
81
- * }
82
- * });
83
- * ```
84
- *
85
- * @template TFieldValues - The form values type
86
- * @template TName - The field name type
87
- * @template TValue - The transformed value type
88
- *
89
- * @param options - Configuration options including value, onChange, and transform functions
90
- * @returns Object with transformed value and enhanced onChange handler
91
- *
92
- * @public
93
- */
94
- declare function useTransform<TFieldValues extends FieldValues = FieldValues, TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>, TValue = unknown>(options: UseTransformOptions<TFieldValues, TName, TValue>): UseTransformReturn<TFieldValues, TName, TValue>;
95
-
96
- export { type UseTransformOptions, type UseTransformReturn, useTransform };
@@ -1,96 +0,0 @@
1
- import { FieldValues, FieldPath, UseControllerReturn, PathValue } from 'react-hook-form';
2
- import { E as EventOrValue } from '../events-BcHVCLBz.js';
3
- export { E as EnhancedUseTransformOptions, a as EnhancedUseTransformReturn, F as FieldType, t as transformFactories, u as useEnhancedTransform } from '../enhanced-CDTkKUlj.js';
4
- import 'react';
5
-
6
- /**
7
- * Options for the useTransform hook.
8
- *
9
- * @template TFieldValues - The form values type
10
- * @template TName - The field name type
11
- * @template TValue - The transformed value type
12
- *
13
- * @public
14
- */
15
- interface UseTransformOptions<TFieldValues extends FieldValues = FieldValues, TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>, TValue = unknown> {
16
- /** The current field value from react-hook-form */
17
- value: UseControllerReturn<TFieldValues, TName>["field"]["value"];
18
- /** The onChange handler from react-hook-form */
19
- onChange: UseControllerReturn<TFieldValues, TName>["field"]["onChange"];
20
- /** Optional transformation functions */
21
- transform?: {
22
- /**
23
- * Transform the field value for display in the input
24
- * @param value - The current field value
25
- * @returns The transformed value to display
26
- */
27
- input?: (value: PathValue<TFieldValues, TName>) => TValue;
28
- /**
29
- * Transform the input event back to the field value
30
- * @param event - The input event parameters
31
- * @returns The transformed value to store in the form
32
- */
33
- output?: (eventOrValue: EventOrValue<PathValue<TFieldValues, TName>>, value?: PathValue<TFieldValues, TName>) => PathValue<TFieldValues, TName>;
34
- };
35
- }
36
- /**
37
- * Return type for the useTransform hook.
38
- *
39
- * @template TFieldValues - The form values type
40
- * @template TName - The field name type
41
- * @template TValue - The transformed value type
42
- *
43
- * @public
44
- */
45
- interface UseTransformReturn<TFieldValues extends FieldValues = FieldValues, TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>, TValue = unknown> {
46
- /** The transformed value to display in the input */
47
- value: TValue;
48
- /** The enhanced onChange handler with transformation applied */
49
- onChange: UseControllerReturn<TFieldValues, TName>["field"]["onChange"];
50
- }
51
- /**
52
- * A hook for transforming form field values between display and storage formats.
53
- *
54
- * This hook provides a way to transform values as they flow between the form field
55
- * and the display component. It's particularly useful for formatting data for display
56
- * (like dates, numbers, or complex objects) while maintaining a different internal
57
- * representation in the form state.
58
- *
59
- * @example
60
- * Transform a date for display:
61
- * ```tsx
62
- * const { value, onChange } = useTransform({
63
- * value: field.value,
64
- * onChange: field.onChange,
65
- * transform: {
66
- * input: (date) => date ? format(date, 'yyyy-MM-dd') : '',
67
- * output: (event) => new Date(event.target.value)
68
- * }
69
- * });
70
- * ```
71
- *
72
- * @example
73
- * Transform numbers with formatting:
74
- * ```tsx
75
- * const { value, onChange } = useTransform({
76
- * value: field.value,
77
- * onChange: field.onChange,
78
- * transform: {
79
- * input: (num) => num ? num.toLocaleString() : '',
80
- * output: (event) => parseFloat(event.target.value.replace(/,/g, ''))
81
- * }
82
- * });
83
- * ```
84
- *
85
- * @template TFieldValues - The form values type
86
- * @template TName - The field name type
87
- * @template TValue - The transformed value type
88
- *
89
- * @param options - Configuration options including value, onChange, and transform functions
90
- * @returns Object with transformed value and enhanced onChange handler
91
- *
92
- * @public
93
- */
94
- declare function useTransform<TFieldValues extends FieldValues = FieldValues, TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>, TValue = unknown>(options: UseTransformOptions<TFieldValues, TName, TValue>): UseTransformReturn<TFieldValues, TName, TValue>;
95
-
96
- export { type UseTransformOptions, type UseTransformReturn, useTransform };
package/dist/index.d.cts DELETED
@@ -1,16 +0,0 @@
1
- export { AuthorizedView, CancelButton, ClearButton, FilterButton, FilterWrapper, FormWrapper, LabelText, ListWrapper, SimpleButton, SimpleToolbar } from './components/index.cjs';
2
- export { UseTransformOptions, UseTransformReturn, useTransform } from './hooks/index.cjs';
3
- export { E as EnhancedUseTransformOptions, a as EnhancedUseTransformReturn, F as FieldType, t as transformFactories, u as useEnhancedTransform } from './enhanced-ZQoS03Cd.cjs';
4
- export { ApiCallOptions, ApiResponse, ArrayElement, AsyncMultiSelectPayload, AsyncReturnType, Brand, DeepPartial, DeepReadonly, DeepRequired, Exact, ExcludeKeys, FetchOptions, HttpHeaders, HttpMethod, JsonArray, JsonObject, JsonPrimitive, JsonValue, KeysOfType, ListResponse, Maybe, Merge, Nullable, Nullish, ObjectPaths, OperationResponse, OptionItem, OptionItem2, OptionalKeys, PartialKeys, PickKeys, PostModel, RequestBody, RequestOptions, RequireKeys, RequiredKeys, Serializable, Unbrand, UnionToIntersection, ValidationErrors, ValueLabel, brand, isFormData, isJsonArray, isJsonObject, isRequestBody, typedEntries, typedKeys, typedValues } from './types/index.cjs';
5
- export { PathArray, api, api2, flattenObjectKeys, getTimezone, handleServerErrors, hasProperty, isArray, isBoolean, isDate, isDefined, isError, isFunction, isNonEmptyArray, isNonEmptyString, isNull, isNullish, isNumber, isPromise, isRecord, isString, isUndefined, matches, propertyExists, readValueAsDate, removeLeadingTrailingSlashes, schemaTools, typedWatch, useWatchBatch, useWatchBoolean, useWatchConditional, useWatchDebounced, useWatchDefault, useWatchField, useWatchFields, useWatchForm, useWatchSelector, useWatchTransform } from './utils/index.cjs';
6
- export { AsyncMultiSelect2, AsyncMultiSelect2Props, AsyncSelect2Payload, BrandedDate, CheckboxElement, CheckboxElementProps, CheckboxGroup, CheckboxGroupProps, DatePickerElement, DatePickerElementCore, DatePickerElementCoreProps, DatePickerElementGridProps, DatePickerElementProps, DatePickerHookReturn, DatePickerValidationConfig, DateTransform, EnhancedTextFieldElement, EnhancedTextFieldElementProps, Field, Option2Item, OptionObject, PasswordElement, RadioButtonGroup, SelectCascadeElement, SelectElement, SelectMultiElement, TextFieldElement, TimePickerElement, TypedDatePickerSlotProps, UseDatePickerStylesOptions, UseDatePickerStylesReturn, UseDatePickerValidationOptions, UseDatePickerValidationReturn, UseDatePickerValueOptions, UseDatePickerValueReturn, ValidatedDate, createDateInputTransform, createDateOutputTransform, createDefaultDatePickerConfig, createStableKey, extractErrorMessage, isParsableDateString, isValidDate, readDatePickerValueAsDate, useDatePickerStyles, useDatePickerValidation, useDatePickerValue } from './wrappers/index.cjs';
7
- export { a as AsyncSelectMultiPayload, A as AsyncSelectPayload } from './AsyncSelectPayload-B9-6l33R.cjs';
8
- 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';
9
- import 'react/jsx-runtime';
10
- import '@mui/material';
11
- import 'react';
12
- import 'react-hook-form';
13
- import '@mui/x-data-grid';
14
- import '@mui/x-date-pickers';
15
- import '@mui/x-date-pickers/internals';
16
- import 'zod';