@fuf-stack/uniform 0.21.5 → 0.22.1
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.
- package/dist/CheckboxGroup/index.cjs +6 -4
- package/dist/CheckboxGroup/index.cjs.map +1 -1
- package/dist/CheckboxGroup/index.js +5 -3
- package/dist/FieldArray/index.cjs +6 -4
- package/dist/FieldArray/index.cjs.map +1 -1
- package/dist/FieldArray/index.js +5 -3
- package/dist/Form/index.cjs +5 -3
- package/dist/Form/index.cjs.map +1 -1
- package/dist/Form/index.js +4 -2
- package/dist/Input/index.cjs +6 -4
- package/dist/Input/index.cjs.map +1 -1
- package/dist/Input/index.d.cts +3 -2
- package/dist/Input/index.d.ts +3 -2
- package/dist/Input/index.js +5 -3
- package/dist/{Input-oubBKJSg.d.cts → Input-BpsVvxwO.d.ts} +5 -7
- package/dist/{Input-oubBKJSg.d.ts → Input-Com9bFxL.d.cts} +5 -7
- package/dist/RadioBoxes/index.cjs +6 -4
- package/dist/RadioBoxes/index.cjs.map +1 -1
- package/dist/RadioBoxes/index.js +5 -3
- package/dist/RadioGroup/index.cjs +6 -4
- package/dist/RadioGroup/index.cjs.map +1 -1
- package/dist/RadioGroup/index.js +5 -3
- package/dist/RadioTabs/index.cjs +6 -4
- package/dist/RadioTabs/index.cjs.map +1 -1
- package/dist/RadioTabs/index.js +5 -3
- package/dist/Select/index.cjs +6 -4
- package/dist/Select/index.cjs.map +1 -1
- package/dist/Select/index.js +5 -3
- package/dist/SubmitButton/index.cjs +5 -3
- package/dist/SubmitButton/index.cjs.map +1 -1
- package/dist/SubmitButton/index.js +4 -2
- package/dist/Switch/index.cjs +6 -4
- package/dist/Switch/index.cjs.map +1 -1
- package/dist/Switch/index.js +5 -3
- package/dist/TextArea/index.cjs +6 -4
- package/dist/TextArea/index.cjs.map +1 -1
- package/dist/TextArea/index.d.cts +2 -2
- package/dist/TextArea/index.d.ts +2 -2
- package/dist/TextArea/index.js +5 -3
- package/dist/{TextArea-DNpInDsW.d.cts → TextArea-DnFGyl4a.d.cts} +3 -1
- package/dist/{TextArea-DNpInDsW.d.ts → TextArea-DnFGyl4a.d.ts} +3 -1
- package/dist/{chunk-QHBFRUXJ.js → chunk-3BE3GUCZ.js} +2 -2
- package/dist/{chunk-PYYWIAGC.js → chunk-7QWLAPOT.js} +2 -2
- package/dist/{chunk-PYYWIAGC.js.map → chunk-7QWLAPOT.js.map} +1 -1
- package/dist/{chunk-IE7LRIBW.cjs → chunk-AZT3TDWZ.cjs} +29 -11
- package/dist/chunk-AZT3TDWZ.cjs.map +1 -0
- package/dist/{chunk-BLUXOGQ5.js → chunk-DPOGZE5O.js} +2 -2
- package/dist/{chunk-WAP6L4MW.cjs → chunk-GKAVSIH3.cjs} +6 -6
- package/dist/{chunk-WAP6L4MW.cjs.map → chunk-GKAVSIH3.cjs.map} +1 -1
- package/dist/{chunk-NF2XBX5E.cjs → chunk-IAMV2JNU.cjs} +6 -6
- package/dist/{chunk-NF2XBX5E.cjs.map → chunk-IAMV2JNU.cjs.map} +1 -1
- package/dist/{chunk-3HBHQT6M.js → chunk-IZFO7YMQ.js} +5 -5
- package/dist/{chunk-LH6YZ2O5.cjs → chunk-NMYLBRT5.cjs} +9 -9
- package/dist/{chunk-LH6YZ2O5.cjs.map → chunk-NMYLBRT5.cjs.map} +1 -1
- package/dist/{chunk-6ON3SM45.js → chunk-NNKOK5EU.js} +30 -12
- package/dist/chunk-NNKOK5EU.js.map +1 -0
- package/dist/{chunk-HRDUEFZG.js → chunk-NR5MV234.js} +5 -5
- package/dist/{chunk-LSNARJIH.js → chunk-O7DOVGO2.js} +5 -5
- package/dist/chunk-OWWUTKGY.cjs +79 -0
- package/dist/chunk-OWWUTKGY.cjs.map +1 -0
- package/dist/{chunk-NS3JN77D.js → chunk-P3PJSG5J.js} +5 -5
- package/dist/chunk-P6HJOG7D.cjs +41 -0
- package/dist/chunk-P6HJOG7D.cjs.map +1 -0
- package/dist/{chunk-BK4ZFMD3.cjs → chunk-PL44Y7AM.cjs} +3 -3
- package/dist/{chunk-BK4ZFMD3.cjs.map → chunk-PL44Y7AM.cjs.map} +1 -1
- package/dist/chunk-Q2BOMFJ5.js +41 -0
- package/dist/chunk-Q2BOMFJ5.js.map +1 -0
- package/dist/{chunk-EV2JYVMO.js → chunk-QDFIRRB5.js} +27 -20
- package/dist/chunk-QDFIRRB5.js.map +1 -0
- package/dist/{chunk-ZNZ5ZB3A.cjs → chunk-QTROOQ53.cjs} +7 -7
- package/dist/{chunk-ZNZ5ZB3A.cjs.map → chunk-QTROOQ53.cjs.map} +1 -1
- package/dist/{chunk-X4BLYZLW.cjs → chunk-SG6PWCRL.cjs} +27 -20
- package/dist/chunk-SG6PWCRL.cjs.map +1 -0
- package/dist/{chunk-SQWCZMAR.cjs → chunk-SGXLTMB5.cjs} +6 -6
- package/dist/{chunk-SQWCZMAR.cjs.map → chunk-SGXLTMB5.cjs.map} +1 -1
- package/dist/{chunk-Z7AMEDDV.js → chunk-TCYPTU4E.js} +5 -5
- package/dist/{chunk-IH622HTJ.cjs → chunk-U3XAM5F4.cjs} +6 -6
- package/dist/{chunk-IH622HTJ.cjs.map → chunk-U3XAM5F4.cjs.map} +1 -1
- package/dist/chunk-U5WBLGZV.js +79 -0
- package/dist/chunk-U5WBLGZV.js.map +1 -0
- package/dist/{chunk-45LTWIGZ.cjs → chunk-UOTSJ55B.cjs} +6 -6
- package/dist/{chunk-45LTWIGZ.cjs.map → chunk-UOTSJ55B.cjs.map} +1 -1
- package/dist/{chunk-G5UTMDGM.js → chunk-WRNAIS4U.js} +5 -5
- package/dist/{chunk-AQBZLE53.js → chunk-X2PR2IOK.js} +5 -5
- package/dist/{chunk-FJZFJWOX.cjs → chunk-XALYGZ3R.cjs} +4 -4
- package/dist/{chunk-FJZFJWOX.cjs.map → chunk-XALYGZ3R.cjs.map} +1 -1
- package/dist/{chunk-OHEPPLIL.cjs → chunk-Y6EAPURV.cjs} +2 -2
- package/dist/chunk-Y6EAPURV.cjs.map +1 -0
- package/dist/hooks/index.cjs +10 -2
- package/dist/hooks/index.cjs.map +1 -1
- package/dist/hooks/index.d.cts +2 -0
- package/dist/hooks/index.d.ts +2 -0
- package/dist/hooks/index.js +10 -2
- package/dist/hooks/useInputValueDebounce/index.cjs +9 -0
- package/dist/hooks/useInputValueDebounce/index.cjs.map +1 -0
- package/dist/hooks/useInputValueDebounce/index.d.cts +90 -0
- package/dist/hooks/useInputValueDebounce/index.d.ts +90 -0
- package/dist/hooks/useInputValueDebounce/index.js +9 -0
- package/dist/hooks/useInputValueDebounce/index.js.map +1 -0
- package/dist/hooks/useInputValueTransform/index.cjs +8 -0
- package/dist/hooks/useInputValueTransform/index.cjs.map +1 -0
- package/dist/hooks/useInputValueTransform/index.d.cts +84 -0
- package/dist/hooks/useInputValueTransform/index.d.ts +84 -0
- package/dist/hooks/useInputValueTransform/index.js +8 -0
- package/dist/hooks/useInputValueTransform/index.js.map +1 -0
- package/dist/index.cjs +23 -15
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +4 -2
- package/dist/index.d.ts +4 -2
- package/dist/index.js +24 -16
- package/package.json +12 -2
- package/dist/chunk-6ON3SM45.js.map +0 -1
- package/dist/chunk-EV2JYVMO.js.map +0 -1
- package/dist/chunk-IE7LRIBW.cjs.map +0 -1
- package/dist/chunk-OHEPPLIL.cjs.map +0 -1
- package/dist/chunk-X4BLYZLW.cjs.map +0 -1
- /package/dist/{chunk-QHBFRUXJ.js.map → chunk-3BE3GUCZ.js.map} +0 -0
- /package/dist/{chunk-BLUXOGQ5.js.map → chunk-DPOGZE5O.js.map} +0 -0
- /package/dist/{chunk-3HBHQT6M.js.map → chunk-IZFO7YMQ.js.map} +0 -0
- /package/dist/{chunk-HRDUEFZG.js.map → chunk-NR5MV234.js.map} +0 -0
- /package/dist/{chunk-LSNARJIH.js.map → chunk-O7DOVGO2.js.map} +0 -0
- /package/dist/{chunk-NS3JN77D.js.map → chunk-P3PJSG5J.js.map} +0 -0
- /package/dist/{chunk-Z7AMEDDV.js.map → chunk-TCYPTU4E.js.map} +0 -0
- /package/dist/{chunk-G5UTMDGM.js.map → chunk-WRNAIS4U.js.map} +0 -0
- /package/dist/{chunk-AQBZLE53.js.map → chunk-X2PR2IOK.js.map} +0 -0
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
interface InputValueTransform {
|
|
2
|
+
/** Transforms the form value to display value (e.g., 1000 → "$1,000") */
|
|
3
|
+
toDisplayValue: (value: string | number) => string | number;
|
|
4
|
+
/** Transforms the display value to form value (e.g., "$1,000" → 1000) */
|
|
5
|
+
toFormValue: (value: string) => string | number;
|
|
6
|
+
}
|
|
7
|
+
interface UseInputValueTransformOptions {
|
|
8
|
+
/** Input type for special number handling */
|
|
9
|
+
type?: 'text' | 'number' | 'password';
|
|
10
|
+
/** Value transformation functions */
|
|
11
|
+
transform?: InputValueTransform;
|
|
12
|
+
}
|
|
13
|
+
interface UseInputValueTransformReturn {
|
|
14
|
+
/** Converts any form value to display value */
|
|
15
|
+
toDisplayValue: (formValue: string | number) => string | number;
|
|
16
|
+
/** Converts any display value to form value */
|
|
17
|
+
toFormValue: (displayValue: string | number) => string | number;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Custom hook providing utility functions for value transformations between display and form values.
|
|
21
|
+
*
|
|
22
|
+
* This hook provides pure conversion functions without any state management. It's useful for:
|
|
23
|
+
* - Currency formatting ($1,000 display vs 1000 stored)
|
|
24
|
+
* - Number inputs with special handling
|
|
25
|
+
* - Date formatting (MM/DD/YYYY display vs ISO date stored)
|
|
26
|
+
* - Phone number formatting ((555) 123-4567 display vs 5551234567 stored)
|
|
27
|
+
*
|
|
28
|
+
* **Key Features:**
|
|
29
|
+
* - Pure conversion functions (no state)
|
|
30
|
+
* - Special number input handling (empty string preservation)
|
|
31
|
+
* - Bidirectional value transformations
|
|
32
|
+
* - Memoized functions for performance
|
|
33
|
+
*
|
|
34
|
+
* @param options Configuration for value transformation
|
|
35
|
+
* @returns Pure conversion utility functions
|
|
36
|
+
*
|
|
37
|
+
* @example
|
|
38
|
+
* ```tsx
|
|
39
|
+
* // Currency formatting
|
|
40
|
+
* const currencyTransform = {
|
|
41
|
+
* displayValue: (val) => val ? `$${Number(val).toLocaleString()}` : '',
|
|
42
|
+
* formValue: (val) => parseFloat(val.replace(/[$,]/g, '')) || 0
|
|
43
|
+
* };
|
|
44
|
+
*
|
|
45
|
+
* const { toDisplayValue, toFormValue } = useInputValueTransform({
|
|
46
|
+
* transform: currencyTransform
|
|
47
|
+
* });
|
|
48
|
+
*
|
|
49
|
+
* const displayVal = toDisplayValue(1000); // "$1,000"
|
|
50
|
+
* const formVal = toFormValue("$1,500"); // 1500
|
|
51
|
+
* ```
|
|
52
|
+
*
|
|
53
|
+
* @example
|
|
54
|
+
* ```tsx
|
|
55
|
+
* // Number input (no transforms needed)
|
|
56
|
+
* const { toDisplayValue, toFormValue } = useInputValueTransform({
|
|
57
|
+
* type: 'number'
|
|
58
|
+
* });
|
|
59
|
+
*
|
|
60
|
+
* // Handles empty string → empty string (not NaN)
|
|
61
|
+
* // Handles "123" → 123 (string to number conversion)
|
|
62
|
+
* ```
|
|
63
|
+
*
|
|
64
|
+
* @example
|
|
65
|
+
* ```tsx
|
|
66
|
+
* // Integration with debouncing
|
|
67
|
+
* const MyInput = ({ field, transform }) => {
|
|
68
|
+
* const transform = useInputValueTransform({ transform });
|
|
69
|
+
*
|
|
70
|
+
* const { onChange, onBlur, value } = useInputValueDebounce({
|
|
71
|
+
* ...transform,
|
|
72
|
+
* initialValue: field.value,
|
|
73
|
+
* debounceDelay: 300,
|
|
74
|
+
* onBlur: field.onBlur,
|
|
75
|
+
* onChange: field.onChange,
|
|
76
|
+
* });
|
|
77
|
+
*
|
|
78
|
+
* return <input value={value} onChange={onChange} onBlur={onBlur} />;
|
|
79
|
+
* };
|
|
80
|
+
* ```
|
|
81
|
+
*/
|
|
82
|
+
declare const useInputValueTransform: ({ type, transform, }: UseInputValueTransformOptions) => UseInputValueTransformReturn;
|
|
83
|
+
|
|
84
|
+
export { type InputValueTransform, type UseInputValueTransformOptions, type UseInputValueTransformReturn, useInputValueTransform };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
package/dist/index.cjs
CHANGED
|
@@ -1,45 +1,45 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _chunkIAMV2JNUcjs = require('./chunk-IAMV2JNU.cjs');
|
|
4
4
|
|
|
5
5
|
|
|
6
|
-
var
|
|
6
|
+
var _chunkU3XAM5F4cjs = require('./chunk-U3XAM5F4.cjs');
|
|
7
7
|
|
|
8
8
|
|
|
9
|
-
var
|
|
9
|
+
var _chunkPL44Y7AMcjs = require('./chunk-PL44Y7AM.cjs');
|
|
10
10
|
|
|
11
11
|
|
|
12
|
-
var
|
|
12
|
+
var _chunkQTROOQ53cjs = require('./chunk-QTROOQ53.cjs');
|
|
13
13
|
|
|
14
14
|
|
|
15
|
-
var
|
|
15
|
+
var _chunkAZT3TDWZcjs = require('./chunk-AZT3TDWZ.cjs');
|
|
16
16
|
|
|
17
17
|
|
|
18
|
-
var
|
|
18
|
+
var _chunkGKAVSIH3cjs = require('./chunk-GKAVSIH3.cjs');
|
|
19
19
|
|
|
20
20
|
|
|
21
|
-
var
|
|
21
|
+
var _chunkNMYLBRT5cjs = require('./chunk-NMYLBRT5.cjs');
|
|
22
22
|
|
|
23
23
|
|
|
24
|
-
var
|
|
24
|
+
var _chunkXALYGZ3Rcjs = require('./chunk-XALYGZ3R.cjs');
|
|
25
25
|
|
|
26
26
|
|
|
27
27
|
var _chunkTTD3KL6Ecjs = require('./chunk-TTD3KL6E.cjs');
|
|
28
28
|
|
|
29
29
|
|
|
30
|
-
var
|
|
30
|
+
var _chunkSG6PWCRLcjs = require('./chunk-SG6PWCRL.cjs');
|
|
31
31
|
|
|
32
32
|
|
|
33
|
-
var
|
|
33
|
+
var _chunkUOTSJ55Bcjs = require('./chunk-UOTSJ55B.cjs');
|
|
34
34
|
|
|
35
35
|
|
|
36
|
-
var
|
|
36
|
+
var _chunkSGXLTMB5cjs = require('./chunk-SGXLTMB5.cjs');
|
|
37
37
|
|
|
38
38
|
|
|
39
|
-
var
|
|
39
|
+
var _chunkPA2DQCBYcjs = require('./chunk-PA2DQCBY.cjs');
|
|
40
40
|
|
|
41
41
|
|
|
42
|
-
var
|
|
42
|
+
var _chunkGNYQC5IJcjs = require('./chunk-GNYQC5IJ.cjs');
|
|
43
43
|
|
|
44
44
|
|
|
45
45
|
|
|
@@ -47,13 +47,19 @@ var _chunkPA2DQCBYcjs = require('./chunk-PA2DQCBY.cjs');
|
|
|
47
47
|
|
|
48
48
|
|
|
49
49
|
|
|
50
|
-
var
|
|
50
|
+
var _chunkY6EAPURVcjs = require('./chunk-Y6EAPURV.cjs');
|
|
51
51
|
|
|
52
52
|
|
|
53
53
|
|
|
54
54
|
|
|
55
55
|
|
|
56
56
|
var _chunkL4YPB7MUcjs = require('./chunk-L4YPB7MU.cjs');
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
var _chunkOWWUTKGYcjs = require('./chunk-OWWUTKGY.cjs');
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
var _chunkP6HJOG7Dcjs = require('./chunk-P6HJOG7D.cjs');
|
|
57
63
|
require('./chunk-555JRYCS.cjs');
|
|
58
64
|
|
|
59
65
|
|
|
@@ -80,5 +86,7 @@ require('./chunk-555JRYCS.cjs');
|
|
|
80
86
|
|
|
81
87
|
|
|
82
88
|
|
|
83
|
-
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
exports.CheckboxGroup = _chunkGKAVSIH3cjs.CheckboxGroup_default; exports.FieldArray = _chunkNMYLBRT5cjs.FieldArray_default; exports.FieldCopyTestIdButton = _chunkPA2DQCBYcjs.FieldCopyTestIdButton_default; exports.FieldValidationError = _chunkGNYQC5IJcjs.FieldValidationError_default; exports.Form = _chunkXALYGZ3Rcjs.Form_default; exports.Grid = _chunkTTD3KL6Ecjs.Grid_default; exports.Input = _chunkSG6PWCRLcjs.Input_default; exports.RadioBoxes = _chunkUOTSJ55Bcjs.RadioBoxes_default; exports.RadioGroup = _chunkSGXLTMB5cjs.RadioGroup_default; exports.RadioTabs = _chunkIAMV2JNUcjs.RadioTabs_default; exports.Select = _chunkU3XAM5F4cjs.Select_default; exports.SubmitButton = _chunkPL44Y7AMcjs.SubmitButton_default; exports.Switch = _chunkQTROOQ53cjs.Switch_default; exports.TextArea = _chunkAZT3TDWZcjs.TextArea_default; exports.checkFieldIsRequired = _chunkY6EAPURVcjs.checkFieldIsRequired; exports.fromNullishString = _chunkL4YPB7MUcjs.fromNullishString; exports.toFormFormat = _chunkL4YPB7MUcjs.toFormFormat; exports.toNullishString = _chunkL4YPB7MUcjs.toNullishString; exports.toValidationFormat = _chunkL4YPB7MUcjs.toValidationFormat; exports.useClientValidation = _chunkY6EAPURVcjs.useClientValidation; exports.useController = _chunkY6EAPURVcjs.useController; exports.useFieldArray = _chunkY6EAPURVcjs.useFieldArray; exports.useFormContext = _chunkY6EAPURVcjs.useFormContext; exports.useInput = _chunkY6EAPURVcjs.useInput; exports.useInputValueDebounce = _chunkOWWUTKGYcjs.useInputValueDebounce; exports.useInputValueTransform = _chunkP6HJOG7Dcjs.useInputValueTransform;
|
|
84
92
|
//# sourceMappingURL=index.cjs.map
|
package/dist/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/home/runner/work/pixels/pixels/packages/uniform/dist/index.cjs"],"names":[],"mappings":"AAAA;AACE;AACF,wDAA6B;AAC7B;AACE;AACF,wDAA6B;AAC7B;AACE;AACF,wDAA6B;AAC7B;AACE;AACF,wDAA6B;AAC7B;AACE;AACF,wDAA6B;AAC7B;AACE;AACF,wDAA6B;AAC7B;AACE;AACF,wDAA6B;AAC7B;AACE;AACF,wDAA6B;AAC7B;AACE;AACF,wDAA6B;AAC7B;AACE;AACF,wDAA6B;AAC7B;AACE;AACF,wDAA6B;AAC7B;AACE;AACF,wDAA6B;AAC7B;AACE;AACF,wDAA6B;AAC7B;AACE;AACF,wDAA6B;AAC7B;AACE;AACA;AACA;AACA;AACA;AACA;AACF,wDAA6B;AAC7B;AACE;AACA;AACA;AACA;AACF,wDAA6B;AAC7B,gCAA6B;AAC7B;AACE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACF,
|
|
1
|
+
{"version":3,"sources":["/home/runner/work/pixels/pixels/packages/uniform/dist/index.cjs"],"names":[],"mappings":"AAAA;AACE;AACF,wDAA6B;AAC7B;AACE;AACF,wDAA6B;AAC7B;AACE;AACF,wDAA6B;AAC7B;AACE;AACF,wDAA6B;AAC7B;AACE;AACF,wDAA6B;AAC7B;AACE;AACF,wDAA6B;AAC7B;AACE;AACF,wDAA6B;AAC7B;AACE;AACF,wDAA6B;AAC7B;AACE;AACF,wDAA6B;AAC7B;AACE;AACF,wDAA6B;AAC7B;AACE;AACF,wDAA6B;AAC7B;AACE;AACF,wDAA6B;AAC7B;AACE;AACF,wDAA6B;AAC7B;AACE;AACF,wDAA6B;AAC7B;AACE;AACA;AACA;AACA;AACA;AACA;AACF,wDAA6B;AAC7B;AACE;AACA;AACA;AACA;AACF,wDAA6B;AAC7B;AACE;AACF,wDAA6B;AAC7B;AACE;AACF,wDAA6B;AAC7B,gCAA6B;AAC7B;AACE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACF,yiDAAC","file":"/home/runner/work/pixels/pixels/packages/uniform/dist/index.cjs"}
|
package/dist/index.d.cts
CHANGED
|
@@ -6,7 +6,9 @@ export { fromNullishString, toFormFormat, toNullishString, toValidationFormat }
|
|
|
6
6
|
export { UseControllerProps, UseControllerReturn, checkFieldIsRequired, useClientValidation, useController, useFormContext } from './hooks/index.cjs';
|
|
7
7
|
export { useFieldArray } from 'react-hook-form';
|
|
8
8
|
export { useInput } from '@heroui/input';
|
|
9
|
-
export {
|
|
9
|
+
export { UseInputValueDebounceOptions, UseInputValueDebounceReturn, useInputValueDebounce } from './hooks/useInputValueDebounce/index.cjs';
|
|
10
|
+
export { InputValueTransform, UseInputValueTransformOptions, UseInputValueTransformReturn, useInputValueTransform } from './hooks/useInputValueTransform/index.cjs';
|
|
11
|
+
export { I as Input, a as InputProps } from './Input-Com9bFxL.cjs';
|
|
10
12
|
export { F as FieldCopyTestIdButton, a as FieldCopyTestIdButtonProps } from './FieldCopyTestIdButton-_TDlmw0L.cjs';
|
|
11
13
|
export { F as FieldValidationError, a as FieldValidationErrorProps } from './FieldValidationError-CU_xw0BL.cjs';
|
|
12
14
|
export { R as RadioBoxes, a as RadioBoxesProps } from './RadioBoxes-BmJBBZVd.cjs';
|
|
@@ -15,7 +17,7 @@ export { R as RadioTabs, a as RadioTabsProps } from './RadioTabs-CT8PT7ky.cjs';
|
|
|
15
17
|
export { S as Select, a as SelectProps } from './Select-JRwrSDew.cjs';
|
|
16
18
|
export { S as SubmitButton, a as SubmitButtonProps } from './SubmitButton-C81VCkmx.cjs';
|
|
17
19
|
export { S as Switch, a as SwitchProps } from './Switch-CLs964dL.cjs';
|
|
18
|
-
export { T as TextArea, a as TextAreaProps } from './TextArea-
|
|
20
|
+
export { T as TextArea, a as TextAreaProps } from './TextArea-DnFGyl4a.cjs';
|
|
19
21
|
import 'react/jsx-runtime';
|
|
20
22
|
import 'tailwind-variants';
|
|
21
23
|
import 'tailwind-variants/dist/config.js';
|
package/dist/index.d.ts
CHANGED
|
@@ -6,7 +6,9 @@ export { fromNullishString, toFormFormat, toNullishString, toValidationFormat }
|
|
|
6
6
|
export { UseControllerProps, UseControllerReturn, checkFieldIsRequired, useClientValidation, useController, useFormContext } from './hooks/index.js';
|
|
7
7
|
export { useFieldArray } from 'react-hook-form';
|
|
8
8
|
export { useInput } from '@heroui/input';
|
|
9
|
-
export {
|
|
9
|
+
export { UseInputValueDebounceOptions, UseInputValueDebounceReturn, useInputValueDebounce } from './hooks/useInputValueDebounce/index.js';
|
|
10
|
+
export { InputValueTransform, UseInputValueTransformOptions, UseInputValueTransformReturn, useInputValueTransform } from './hooks/useInputValueTransform/index.js';
|
|
11
|
+
export { I as Input, a as InputProps } from './Input-BpsVvxwO.js';
|
|
10
12
|
export { F as FieldCopyTestIdButton, a as FieldCopyTestIdButtonProps } from './FieldCopyTestIdButton-_TDlmw0L.js';
|
|
11
13
|
export { F as FieldValidationError, a as FieldValidationErrorProps } from './FieldValidationError-CU_xw0BL.js';
|
|
12
14
|
export { R as RadioBoxes, a as RadioBoxesProps } from './RadioBoxes-BmJBBZVd.js';
|
|
@@ -15,7 +17,7 @@ export { R as RadioTabs, a as RadioTabsProps } from './RadioTabs-CT8PT7ky.js';
|
|
|
15
17
|
export { S as Select, a as SelectProps } from './Select-JRwrSDew.js';
|
|
16
18
|
export { S as SubmitButton, a as SubmitButtonProps } from './SubmitButton-C81VCkmx.js';
|
|
17
19
|
export { S as Switch, a as SwitchProps } from './Switch-CLs964dL.js';
|
|
18
|
-
export { T as TextArea, a as TextAreaProps } from './TextArea-
|
|
20
|
+
export { T as TextArea, a as TextAreaProps } from './TextArea-DnFGyl4a.js';
|
|
19
21
|
import 'react/jsx-runtime';
|
|
20
22
|
import 'tailwind-variants';
|
|
21
23
|
import 'tailwind-variants/dist/config.js';
|
package/dist/index.js
CHANGED
|
@@ -1,45 +1,45 @@
|
|
|
1
1
|
import {
|
|
2
2
|
RadioTabs_default
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-IZFO7YMQ.js";
|
|
4
4
|
import {
|
|
5
5
|
Select_default
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-TCYPTU4E.js";
|
|
7
7
|
import {
|
|
8
8
|
SubmitButton_default
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-3BE3GUCZ.js";
|
|
10
10
|
import {
|
|
11
11
|
Switch_default
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-NR5MV234.js";
|
|
13
13
|
import {
|
|
14
14
|
TextArea_default
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-NNKOK5EU.js";
|
|
16
16
|
import {
|
|
17
17
|
CheckboxGroup_default
|
|
18
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-O7DOVGO2.js";
|
|
19
19
|
import {
|
|
20
20
|
FieldArray_default
|
|
21
|
-
} from "./chunk-
|
|
21
|
+
} from "./chunk-P3PJSG5J.js";
|
|
22
22
|
import {
|
|
23
23
|
Form_default
|
|
24
|
-
} from "./chunk-
|
|
24
|
+
} from "./chunk-DPOGZE5O.js";
|
|
25
25
|
import {
|
|
26
26
|
Grid_default
|
|
27
27
|
} from "./chunk-B62HKKMS.js";
|
|
28
28
|
import {
|
|
29
29
|
Input_default
|
|
30
|
-
} from "./chunk-
|
|
30
|
+
} from "./chunk-QDFIRRB5.js";
|
|
31
31
|
import {
|
|
32
32
|
RadioBoxes_default
|
|
33
|
-
} from "./chunk-
|
|
33
|
+
} from "./chunk-X2PR2IOK.js";
|
|
34
34
|
import {
|
|
35
35
|
RadioGroup_default
|
|
36
|
-
} from "./chunk-
|
|
37
|
-
import {
|
|
38
|
-
FieldValidationError_default
|
|
39
|
-
} from "./chunk-UTFZRBBS.js";
|
|
36
|
+
} from "./chunk-WRNAIS4U.js";
|
|
40
37
|
import {
|
|
41
38
|
FieldCopyTestIdButton_default
|
|
42
39
|
} from "./chunk-BQGN3JTU.js";
|
|
40
|
+
import {
|
|
41
|
+
FieldValidationError_default
|
|
42
|
+
} from "./chunk-UTFZRBBS.js";
|
|
43
43
|
import {
|
|
44
44
|
checkFieldIsRequired,
|
|
45
45
|
useClientValidation,
|
|
@@ -47,13 +47,19 @@ import {
|
|
|
47
47
|
useFieldArray,
|
|
48
48
|
useFormContext,
|
|
49
49
|
useInput
|
|
50
|
-
} from "./chunk-
|
|
50
|
+
} from "./chunk-7QWLAPOT.js";
|
|
51
51
|
import {
|
|
52
52
|
fromNullishString,
|
|
53
53
|
toFormFormat,
|
|
54
54
|
toNullishString,
|
|
55
55
|
toValidationFormat
|
|
56
56
|
} from "./chunk-57WY5GAE.js";
|
|
57
|
+
import {
|
|
58
|
+
useInputValueDebounce
|
|
59
|
+
} from "./chunk-U5WBLGZV.js";
|
|
60
|
+
import {
|
|
61
|
+
useInputValueTransform
|
|
62
|
+
} from "./chunk-Q2BOMFJ5.js";
|
|
57
63
|
import "./chunk-K2V4ULA2.js";
|
|
58
64
|
export {
|
|
59
65
|
CheckboxGroup_default as CheckboxGroup,
|
|
@@ -79,6 +85,8 @@ export {
|
|
|
79
85
|
useController,
|
|
80
86
|
useFieldArray,
|
|
81
87
|
useFormContext,
|
|
82
|
-
useInput
|
|
88
|
+
useInput,
|
|
89
|
+
useInputValueDebounce,
|
|
90
|
+
useInputValueTransform
|
|
83
91
|
};
|
|
84
92
|
//# sourceMappingURL=index.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fuf-stack/uniform",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.22.1",
|
|
4
4
|
"description": "fuf react form library",
|
|
5
5
|
"author": "Hannes Tiede",
|
|
6
6
|
"homepage": "https://github.com/fuf-stack/pixels#readme",
|
|
@@ -46,6 +46,16 @@
|
|
|
46
46
|
"import": "./dist/hooks/index.js",
|
|
47
47
|
"require": "./dist/hooks/index.cjs"
|
|
48
48
|
},
|
|
49
|
+
"./hooks/useInputValueDebounce": {
|
|
50
|
+
"types": "./dist/hooks/useInputValueDebounce/index.d.ts",
|
|
51
|
+
"import": "./dist/hooks/useInputValueDebounce/index.js",
|
|
52
|
+
"require": "./dist/hooks/useInputValueDebounce/index.cjs"
|
|
53
|
+
},
|
|
54
|
+
"./hooks/useInputValueTransform": {
|
|
55
|
+
"types": "./dist/hooks/useInputValueTransform/index.d.ts",
|
|
56
|
+
"import": "./dist/hooks/useInputValueTransform/index.js",
|
|
57
|
+
"require": "./dist/hooks/useInputValueTransform/index.cjs"
|
|
58
|
+
},
|
|
49
59
|
"./Input": {
|
|
50
60
|
"types": "./dist/Input/index.d.ts",
|
|
51
61
|
"import": "./dist/Input/index.js",
|
|
@@ -133,8 +143,8 @@
|
|
|
133
143
|
"react-icons": "5.5.0",
|
|
134
144
|
"react-hook-form": "7.55.0",
|
|
135
145
|
"react-select": "5.10.1",
|
|
136
|
-
"@fuf-stack/pixel-utils": "0.5.5",
|
|
137
146
|
"@fuf-stack/pixels": "0.43.10",
|
|
147
|
+
"@fuf-stack/pixel-utils": "0.5.5",
|
|
138
148
|
"@fuf-stack/veto": "0.12.1"
|
|
139
149
|
},
|
|
140
150
|
"devDependencies": {
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/TextArea/TextArea.tsx","../src/TextArea/index.ts"],"sourcesContent":["import type { ReactNode } from 'react';\n\nimport { Textarea as HeroTextArea } from '@heroui/input';\n\nimport { cn } from '@fuf-stack/pixel-utils';\n\nimport { useController, useFormContext } from '../hooks';\nimport { FieldCopyTestIdButton } from '../partials/FieldCopyTestIdButton';\nimport { FieldValidationError } from '../partials/FieldValidationError';\n\nexport interface TextAreaProps {\n /** Child components. The content of the textarea. */\n children?: ReactNode;\n /** CSS class name */\n className?: string;\n /** Determines if the TextArea is disabled or not. */\n disabled?: boolean;\n /** Label displayed above the TextArea. */\n label?: ReactNode;\n /** Name the TextArea is registered at in HTML forms (react-hook-form). */\n name: string;\n /** placeholder for the textArea content. */\n placeholder?: string;\n /** Id to grab element in internal tests. */\n testId?: string;\n}\n\n/**\n * TextArea component based on [HeroUI TextArea](https://www.heroui.com//docs/components/textarea)\n */\nconst TextArea = ({\n children = null,\n className = undefined,\n disabled = false,\n label = undefined,\n name,\n placeholder = ' ',\n testId: _testId = undefined,\n}: TextAreaProps) => {\n const { control, debugMode, getFieldState } = useFormContext();\n const { error, invalid, required, testId } = getFieldState(name, _testId);\n\n const { field } = useController({ control, name, disabled });\n const { disabled: isDisabled, onChange, onBlur, value = '', ref } = field;\n\n const showTestIdCopyButton = debugMode === 'debug-testids';\n const showLabel = label || showTestIdCopyButton;\n\n /**\n * Ensures the textarea always has a defined string value to prevent uncontrolled to\n * controlled component warnings:\n *\n * 1. Warning Prevention:\n * - Sets default value to '' in field destructuring\n * - Guarantees the value prop is never undefined/null\n * - Prevents React warning: \"A component is changing from uncontrolled to controlled\"\n *\n * 2. Value Handling:\n * - Converts undefined/null to empty string\n * - Converts non-string values to strings\n * - Maintains existing string values\n *\n * Examples:\n * - undefined → \"\" (prevents uncontrolled warning)\n * - null → \"\" (prevents uncontrolled warning)\n * - \"hello\" → \"hello\" (maintains string value)\n * - 123 → \"123\" (converts to string)\n *\n * Without this handling, the textarea could switch between controlled/uncontrolled\n * states when the form value changes from undefined to defined, causing React warnings\n * and potential rendering issues.\n */\n const displayValue = value?.toString() ?? '';\n\n return (\n <HeroTextArea\n className={cn(className)}\n classNames={{\n inputWrapper: 'bg-content1 group-data-[focus=true]:border-focus',\n }}\n data-testid={testId}\n errorMessage={\n error && <FieldValidationError error={error} testId={testId} />\n }\n isDisabled={isDisabled}\n isRequired={required}\n isInvalid={invalid}\n label={\n showLabel && (\n <>\n {label}\n {showTestIdCopyButton && <FieldCopyTestIdButton testId={testId} />}\n </>\n )\n }\n labelPlacement=\"outside\"\n placeholder={placeholder}\n name={name}\n value={displayValue}\n onChange={onChange}\n onBlur={onBlur}\n ref={ref}\n variant=\"bordered\"\n >\n {children}\n </HeroTextArea>\n );\n};\n\nexport default TextArea;\n","import TextArea from './TextArea';\n\nexport type { TextAreaProps } from './TextArea';\n\nexport { TextArea };\n\nexport default TextArea;\n"],"mappings":";;;;;;;;;;;;AAEA,SAAS,YAAY,oBAAoB;AAEzC,SAAS,UAAU;AA8EF,SAOP,UAPO,KAOP,YAPO;AApDjB,IAAM,WAAW,CAAC;AAAA,EAChB,WAAW;AAAA,EACX,YAAY;AAAA,EACZ,WAAW;AAAA,EACX,QAAQ;AAAA,EACR;AAAA,EACA,cAAc;AAAA,EACd,QAAQ,UAAU;AACpB,MAAqB;AAtCrB;AAuCE,QAAM,EAAE,SAAS,WAAW,cAAc,IAAI,eAAe;AAC7D,QAAM,EAAE,OAAO,SAAS,UAAU,OAAO,IAAI,cAAc,MAAM,OAAO;AAExE,QAAM,EAAE,MAAM,IAAI,cAAc,EAAE,SAAS,MAAM,SAAS,CAAC;AAC3D,QAAM,EAAE,UAAU,YAAY,UAAU,QAAQ,QAAQ,IAAI,IAAI,IAAI;AAEpE,QAAM,uBAAuB,cAAc;AAC3C,QAAM,YAAY,SAAS;AA0B3B,QAAM,gBAAe,oCAAO,eAAP,YAAqB;AAE1C,SACE;AAAA,IAAC;AAAA;AAAA,MACC,WAAW,GAAG,SAAS;AAAA,MACvB,YAAY;AAAA,QACV,cAAc;AAAA,MAChB;AAAA,MACA,eAAa;AAAA,MACb,cACE,SAAS,oBAAC,gCAAqB,OAAc,QAAgB;AAAA,MAE/D;AAAA,MACA,YAAY;AAAA,MACZ,WAAW;AAAA,MACX,OACE,aACE,iCACG;AAAA;AAAA,QACA,wBAAwB,oBAAC,iCAAsB,QAAgB;AAAA,SAClE;AAAA,MAGJ,gBAAe;AAAA,MACf;AAAA,MACA;AAAA,MACA,OAAO;AAAA,MACP;AAAA,MACA;AAAA,MACA;AAAA,MACA,SAAQ;AAAA,MAEP;AAAA;AAAA,EACH;AAEJ;AAEA,IAAO,mBAAQ;;;ACvGf,IAAOA,oBAAQ;","names":["TextArea_default"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/Input/Input.tsx","../src/Input/index.ts"],"sourcesContent":["import type { ReactNode } from 'react';\n\nimport { Input as HeroInput } from '@heroui/input';\n\nimport { cn } from '@fuf-stack/pixel-utils';\n\nimport { useController, useFormContext } from '../hooks';\nimport { FieldCopyTestIdButton } from '../partials/FieldCopyTestIdButton';\nimport { FieldValidationError } from '../partials/FieldValidationError';\n\nexport interface InputProps {\n /** CSS class name */\n className?: string;\n /** input field is disabled */\n disabled?: boolean;\n /** added content to the end of the input Field. */\n endContent?: ReactNode;\n /** form field label (set to false to disable label) */\n label?: string | false;\n /** form field name */\n name: string;\n /** form field placeholder */\n placeholder?: string;\n /** size of the input */\n size?: 'sm' | 'md' | 'lg';\n /** content added to the start of the input field */\n startContent?: ReactNode;\n /** HTML data-testid attribute used in e2e tests */\n testId?: string;\n /** allows disentangled display and form values for a field */\n transformValue?: {\n /** transforms the formValue of the field to the display value of the field */\n displayValue: (value: string | number) => string | number;\n /** transforms the displayValue of the field to the form value of the field */\n formValue: (value: string) => string | number;\n };\n /** input type */\n type?: 'number' | 'password';\n}\n\n/**\n * Input component based on [HeroUI Input](https://www.heroui.com//docs/components/input)\n */\nconst Input = ({\n className = undefined,\n disabled = false,\n endContent = undefined,\n label = undefined,\n name,\n placeholder = ' ',\n size = undefined,\n startContent = undefined,\n testId: _testId = undefined,\n transformValue = undefined,\n type = undefined,\n}: InputProps) => {\n const { control, debugMode, getFieldState } = useFormContext();\n const { error, invalid, required, testId } = getFieldState(name, _testId);\n\n const { field } = useController({\n control,\n disabled,\n name,\n });\n\n const { disabled: isDisabled, onChange, onBlur, value, ref } = field;\n\n const showTestIdCopyButton = debugMode === 'debug-testids';\n const showLabel = label || showTestIdCopyButton;\n\n /**\n * Determines the display value for the input field:\n * 1. If transformValue.displayValue is provided, applies the transform to the current value\n * (useful for formatting like adding currency symbols, date formatting, etc.)\n * 2. Falls back to the raw value if no transform is provided\n * 3. Ensures a defined value by using empty string as fallback (prevents uncontrolled input warnings)\n *\n * Examples:\n * - With transform: value \"1000\" → displayValue \"$1,000\"\n * - Without transform: value \"1000\" → displayValue \"1000\"\n * - Undefined value: value undefined → displayValue \"\"\n */\n const displayValue = transformValue?.displayValue\n ? transformValue.displayValue(value ?? '')\n : (value ?? '');\n\n /**\n * Handles input value changes with special processing:\n * 1. For number inputs:\n * - Preserves empty string (prevents NaN in the form state)\n * - Converts non-empty values to numbers\n * Example: \"\" → \"\" (empty stays empty)\n * \"42\" → 42 (converts to number)\n *\n * 2. For text inputs with transformValue.formValue:\n * - Applies custom transform before updating form state\n * - Useful for converting display format to storage format\n * Example: \"$1,000\" → \"1000\" (strips formatting)\n *\n * 3. For regular text inputs:\n * - Passes through the raw input value\n * Example: \"hello\" → \"hello\" (no transformation)\n *\n * @param e The input change event\n */\n const handleChange = (e: React.ChangeEvent<HTMLInputElement>) => {\n const inputValue = e.target.value;\n if (type === 'number') {\n onChange(inputValue === '' ? '' : Number(inputValue));\n } else {\n onChange(\n transformValue?.formValue\n ? transformValue.formValue(inputValue)\n : inputValue,\n );\n }\n };\n\n return (\n <HeroInput\n className={cn(className)}\n classNames={{\n inputWrapper: 'bg-content1 group-data-[focus=true]:border-focus',\n }}\n data-testid={testId}\n endContent={endContent}\n errorMessage={\n error && <FieldValidationError error={error} testId={testId} />\n }\n isDisabled={isDisabled}\n isInvalid={invalid}\n isRequired={required}\n label={\n showLabel && (\n <>\n {label}\n {showTestIdCopyButton && <FieldCopyTestIdButton testId={testId} />}\n </>\n )\n }\n labelPlacement=\"outside\"\n name={name}\n onBlur={onBlur}\n onChange={handleChange}\n placeholder={placeholder}\n radius=\"sm\"\n ref={ref}\n size={size}\n startContent={startContent}\n type={type}\n // @ts-expect-error number is ok here\n value={displayValue}\n variant=\"bordered\"\n />\n );\n};\n\nexport default Input;\n","import Input from './Input';\n\nexport type { InputProps } from './Input';\n\nexport { Input };\n\nexport default Input;\n"],"mappings":";;;;;;;;;;;;AAEA,SAAS,SAAS,iBAAiB;AAEnC,SAAS,UAAU;AA2HF,SAOP,UAPO,KAOP,YAPO;AApFjB,IAAM,QAAQ,CAAC;AAAA,EACb,YAAY;AAAA,EACZ,WAAW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AAA,MACA;AAAA,MACA;AAAA,MAEA,OAAO;AAAA,MACP,SAAQ;AAAA;AAAA,EACV;AAEJ;AAEA,IAAO,gBAAQ;;;ACvJf,IAAOA,iBAAQ;","names":["Input_default"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["/home/runner/work/pixels/pixels/packages/uniform/dist/chunk-IE7LRIBW.cjs","../src/TextArea/TextArea.tsx","../src/TextArea/index.ts"],"names":["TextArea_default"],"mappings":"AAAA;AACE;AACF,wDAA6B;AAC7B;AACE;AACF,wDAA6B;AAC7B;AACE;AACA;AACF,wDAA6B;AAC7B;AACA;ACTA,sCAAyC;AAEzC,oDAAmB;AA8EF,+CAAA;AApDjB,IAAM,SAAA,EAAW,CAAC;AAAA,EAChB,SAAA,EAAW,IAAA;AAAA,EACX,UAAA,EAAY,KAAA,CAAA;AAAA,EACZ,SAAA,EAAW,KAAA;AAAA,EACX,MAAA,EAAQ,KAAA,CAAA;AAAA,EACR,IAAA;AAAA,EACA,YAAA,EAAc,GAAA;AAAA,EACd,MAAA,EAAQ,QAAA,EAAU,KAAA;AACpB,CAAA,EAAA,GAAqB;AAtCrB,EAAA,IAAA,EAAA;AAuCE,EAAA,MAAM,EAAE,OAAA,EAAS,SAAA,EAAW,cAAc,EAAA,EAAI,8CAAA,CAAe;AAC7D,EAAA,MAAM,EAAE,KAAA,EAAO,OAAA,EAAS,QAAA,EAAU,OAAO,EAAA,EAAI,aAAA,CAAc,IAAA,EAAM,OAAO,CAAA;AAExE,EAAA,MAAM,EAAE,MAAM,EAAA,EAAI,6CAAA,EAAgB,OAAA,EAAS,IAAA,EAAM,SAAS,CAAC,CAAA;AAC3D,EAAA,MAAM,EAAE,QAAA,EAAU,UAAA,EAAY,QAAA,EAAU,MAAA,EAAQ,MAAA,EAAQ,EAAA,EAAI,IAAI,EAAA,EAAI,KAAA;AAEpE,EAAA,MAAM,qBAAA,EAAuB,UAAA,IAAc,eAAA;AAC3C,EAAA,MAAM,UAAA,EAAY,MAAA,GAAS,oBAAA;AA0B3B,EAAA,MAAM,aAAA,EAAA,CAAe,GAAA,EAAA,MAAA,GAAA,KAAA,EAAA,KAAA,EAAA,EAAA,KAAA,CAAO,QAAA,CAAA,CAAA,EAAA,GAAP,KAAA,EAAA,GAAA,EAAqB,EAAA;AAE1C,EAAA,uBACE,6BAAA;AAAA,IAAC,eAAA;AAAA,IAAA;AAAA,MACC,SAAA,EAAW,4BAAA,SAAY,CAAA;AAAA,MACvB,UAAA,EAAY;AAAA,QACV,YAAA,EAAc;AAAA,MAChB,CAAA;AAAA,MACA,aAAA,EAAa,MAAA;AAAA,MACb,YAAA,EACE,MAAA,mBAAS,6BAAA,8CAAC,EAAA,EAAqB,KAAA,EAAc,OAAA,CAAgB,CAAA;AAAA,MAE/D,UAAA;AAAA,MACA,UAAA,EAAY,QAAA;AAAA,MACZ,SAAA,EAAW,OAAA;AAAA,MACX,KAAA,EACE,UAAA,mBACE,8BAAA,oBAAA,EAAA,EACG,QAAA,EAAA;AAAA,QAAA,KAAA;AAAA,QACA,qBAAA,mBAAwB,6BAAA,+CAAC,EAAA,EAAsB,OAAA,CAAgB;AAAA,MAAA,EAAA,CAClE,CAAA;AAAA,MAGJ,cAAA,EAAe,SAAA;AAAA,MACf,WAAA;AAAA,MACA,IAAA;AAAA,MACA,KAAA,EAAO,YAAA;AAAA,MACP,QAAA;AAAA,MACA,MAAA;AAAA,MACA,GAAA;AAAA,MACA,OAAA,EAAQ,UAAA;AAAA,MAEP;AAAA,IAAA;AAAA,EACH,CAAA;AAEJ,CAAA;AAEA,IAAO,iBAAA,EAAQ,QAAA;ADhDf;AACA;AExDA,IAAOA,kBAAAA,EAAQ,gBAAA;AF0Df;AACA;AACE;AACA;AACF,2FAAC","file":"/home/runner/work/pixels/pixels/packages/uniform/dist/chunk-IE7LRIBW.cjs","sourcesContent":[null,"import type { ReactNode } from 'react';\n\nimport { Textarea as HeroTextArea } from '@heroui/input';\n\nimport { cn } from '@fuf-stack/pixel-utils';\n\nimport { useController, useFormContext } from '../hooks';\nimport { FieldCopyTestIdButton } from '../partials/FieldCopyTestIdButton';\nimport { FieldValidationError } from '../partials/FieldValidationError';\n\nexport interface TextAreaProps {\n /** Child components. The content of the textarea. */\n children?: ReactNode;\n /** CSS class name */\n className?: string;\n /** Determines if the TextArea is disabled or not. */\n disabled?: boolean;\n /** Label displayed above the TextArea. */\n label?: ReactNode;\n /** Name the TextArea is registered at in HTML forms (react-hook-form). */\n name: string;\n /** placeholder for the textArea content. */\n placeholder?: string;\n /** Id to grab element in internal tests. */\n testId?: string;\n}\n\n/**\n * TextArea component based on [HeroUI TextArea](https://www.heroui.com//docs/components/textarea)\n */\nconst TextArea = ({\n children = null,\n className = undefined,\n disabled = false,\n label = undefined,\n name,\n placeholder = ' ',\n testId: _testId = undefined,\n}: TextAreaProps) => {\n const { control, debugMode, getFieldState } = useFormContext();\n const { error, invalid, required, testId } = getFieldState(name, _testId);\n\n const { field } = useController({ control, name, disabled });\n const { disabled: isDisabled, onChange, onBlur, value = '', ref } = field;\n\n const showTestIdCopyButton = debugMode === 'debug-testids';\n const showLabel = label || showTestIdCopyButton;\n\n /**\n * Ensures the textarea always has a defined string value to prevent uncontrolled to\n * controlled component warnings:\n *\n * 1. Warning Prevention:\n * - Sets default value to '' in field destructuring\n * - Guarantees the value prop is never undefined/null\n * - Prevents React warning: \"A component is changing from uncontrolled to controlled\"\n *\n * 2. Value Handling:\n * - Converts undefined/null to empty string\n * - Converts non-string values to strings\n * - Maintains existing string values\n *\n * Examples:\n * - undefined → \"\" (prevents uncontrolled warning)\n * - null → \"\" (prevents uncontrolled warning)\n * - \"hello\" → \"hello\" (maintains string value)\n * - 123 → \"123\" (converts to string)\n *\n * Without this handling, the textarea could switch between controlled/uncontrolled\n * states when the form value changes from undefined to defined, causing React warnings\n * and potential rendering issues.\n */\n const displayValue = value?.toString() ?? '';\n\n return (\n <HeroTextArea\n className={cn(className)}\n classNames={{\n inputWrapper: 'bg-content1 group-data-[focus=true]:border-focus',\n }}\n data-testid={testId}\n errorMessage={\n error && <FieldValidationError error={error} testId={testId} />\n }\n isDisabled={isDisabled}\n isRequired={required}\n isInvalid={invalid}\n label={\n showLabel && (\n <>\n {label}\n {showTestIdCopyButton && <FieldCopyTestIdButton testId={testId} />}\n </>\n )\n }\n labelPlacement=\"outside\"\n placeholder={placeholder}\n name={name}\n value={displayValue}\n onChange={onChange}\n onBlur={onBlur}\n ref={ref}\n variant=\"bordered\"\n >\n {children}\n </HeroTextArea>\n );\n};\n\nexport default TextArea;\n","import TextArea from './TextArea';\n\nexport type { TextAreaProps } from './TextArea';\n\nexport { TextArea };\n\nexport default TextArea;\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["/home/runner/work/pixels/pixels/packages/uniform/dist/chunk-OHEPPLIL.cjs","../src/hooks/useClientValidation/useClientValidation.ts","../src/hooks/useFormContext/useFormContext.ts","../src/Form/subcomponents/FormContext.tsx","../src/Form/subcomponents/FormResolver.ts","../src/hooks/useController/useController.ts","../src/hooks/useFieldArray/useFieldArray.ts","../src/hooks/useInput/useInput.ts"],"names":["useState","useMemo","_a"],"mappings":"AAAA;AACE;AACA;AACA;AACF,wDAA6B;AAC7B;AACE;AACA;AACA;AACA;AACA;AACF,wDAA6B;AAC7B;AACA;ACTA,4EAAiC;ADWjC;AACA;AEXA;AACA,gDAAqD;AAErD,oDAAwB;AFYxB;AACA;AGbA;AACA;AAEA,2CAAgC;AHchC;AACA;AIjBA;AAEA,uCAA2C;AAUpC,IAAM,2BAAA,EAA6B,CAAA,EAAA,GAAM;AAE9C,EAAA,MAAM,CAAC,uBAAA,EAAyB,0BAA0B,EAAA,EAAI,6BAAA,CAE3D,CAAC,CAAA;AAGJ,EAAA,MAAM,0BAAA,EAA4B,4BAAA;AAAA,IAChC,CAAA,EAAA,GAAM;AACJ,MAAA,OAAO,CAAC,GAAA,EAAa,MAAA,EAAA,GAA+B;AAElD,QAAA,0BAAA,CAA2B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AAA,EAAA,EAAA,CAAkB,KAAA,EAAA,GAAlB,KAAA,EAAA,GAAA,EAA2B,KAAA,CAAM,CAAC,CAAA;AAChD,QAAA,KAAA,CAAM,QAAA,CAAS,+CAAA,KAAqB,CAAC,CAAA;AAAA,MACvC,CAAA;AAAA;AAAA,MAEA,KAAA,EAAO,iDAAA,KAAkB,CAAM,KAAK;AAAA,IACtC,CAAA,CAAA;AAAA,IACA,SAAA;AAAA,IACA;AAAA,EACF,CAAA;AACF,CAAA;ALgQA;AACA;AM3TA;AN6TA;AACA;AOhUA,sCAAyB;APkUzB;AACA;AACE;AACA;AACA;AACA;AACA;AACA;AACA;AACF,oUAAC","file":"/home/runner/work/pixels/pixels/packages/uniform/dist/chunk-OHEPPLIL.cjs","sourcesContent":[null,"/* eslint-disable import/prefer-default-export */\n\nimport type { VetoTypeAny } from '@fuf-stack/veto';\n\nimport { useEffect, useId } from 'react';\n\nimport { useFormContext } from '../useFormContext/useFormContext';\n\n/**\n * Hook for adding dynamic client-side validation to forms.\n *\n * Automatically manages validation schema lifecycle: sets schema when data is provided,\n * clears schema when data is null/undefined, and cleans up on unmount.\n *\n * When the client validation schema changes, automatically re-validates all touched\n * fields to ensure they are validated against the new schema.\n *\n * @param data - Data to create validation schema from (or null/undefined to clear validation)\n * @param schemaFactory - Function that creates a validation schema from the data.\n *\n * @example\n * ```tsx\n * const { data: teamData } = useTeamQuery(teamId);\n *\n * useClientValidation(teamData, (data) =>\n * vt.object({\n * username: vt.string().refine(\n * (value) => !data.existingUsers.includes(value),\n * { message: 'Username already exists' }\n * )\n * })\n * );\n * ```\n */\nexport const useClientValidation = <TData = unknown>(\n data: TData | null | undefined,\n schemaFactory: (data: TData) => VetoTypeAny,\n): void => {\n const {\n formState: { touchedFields },\n validation: { setClientValidationSchema },\n trigger,\n } = useFormContext();\n\n // Auto-generate unique key\n const key = useId();\n\n // Use data hash instead of object reference to avoid unnecessary re-runs\n // when data object reference changes but data remains the same\n const dataHash = JSON.stringify(data);\n\n // Single effect to manage validation schema lifecycle\n useEffect(() => {\n // Set validation schema when data is available\n if (data != null) {\n const validationSchema = schemaFactory(data);\n setClientValidationSchema(key, validationSchema);\n } else {\n // Clear validation schema when no data\n setClientValidationSchema(key, null);\n }\n\n // Re-validate all touched fields when client validation schema changes\n const touchedFieldNames = Object.keys(touchedFields);\n if (touchedFieldNames.length > 0) {\n // Use setTimeout to ensure the client validation schema update has propagated\n // before triggering re-validation (fixes race condition)\n setTimeout(() => trigger(touchedFieldNames), 1);\n }\n\n // Cleanup on unmount or when dependencies change\n return () => {\n setClientValidationSchema(key, null);\n };\n // Only re-run when data (dataHash) or key changes\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [dataHash, key]);\n};\n","/* eslint-disable @typescript-eslint/no-explicit-any */\n\nimport type { VetoInstance } from '@fuf-stack/veto';\nimport type { FieldError, FieldValues, Path } from 'react-hook-form';\n\nimport { useContext } from 'react';\nimport { useFormContext as useHookFormContext } from 'react-hook-form';\n\nimport { slugify } from '@fuf-stack/pixel-utils';\n\nimport { UniformContext } from '../../Form/subcomponents/FormContext';\nimport { toValidationFormat } from '../../helpers';\n\n/** Schema check whether a field is required or optional */\nexport const checkFieldIsRequired = (\n validation: VetoInstance,\n path: string[],\n): boolean => {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const checkRequired = (schema: any) => {\n // arrays with minLength are required\n if (schema.type === 'array' && schema?.minLength) {\n return true;\n }\n // all other fields are required if they are\n // not optional and not nullable\n return !schema.isOptional && !schema.isNullable;\n };\n\n return validation.checkSchemaPath(checkRequired, path);\n};\n\n/**\n * Custom hook that extends react-hook-form's useFormContext to add validation and state management.\n */\nexport const useFormContext = <\n TFieldValues extends FieldValues = FieldValues,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n TContext = any,\n TTransformedValues = TFieldValues,\n>() => {\n const {\n formState,\n // some methods that will be enhanced below\n getFieldState: getFieldStateOrig,\n getValues: getValuesOrig,\n watch: watchOrig,\n subscribe: subscribeOrig,\n // the rest of the methods pass through unchanged\n ...otherMethods\n } = useHookFormContext<TFieldValues, TContext, TTransformedValues>();\n\n const uniformContext = useContext(UniformContext);\n\n /**\n * Updated getFieldState method which returns:\n * - Whether the field is required by checking the validation schema\n * - Existing field state information (errors, etc.)\n */\n const getFieldState = (name: Path<TFieldValues>, testId?: string) => {\n const fieldPath =\n typeof name === 'string' ? name.replace(/\\[\\d+\\]/g, '').split('.') : name;\n\n // Check if the field is required using the validation schema\n const required = uniformContext?.validation.instance\n ? checkFieldIsRequired(uniformContext.validation.instance, fieldPath)\n : false;\n\n // Get the original field state (errors, etc.) from react-hook-form\n const { error, ...rest } = getFieldStateOrig(name, formState);\n\n return {\n ...rest,\n error: error as FieldError[] | undefined, // Ensure correct type for error\n required,\n testId: slugify(testId || name, { replaceDots: true }),\n };\n };\n\n /**\n * Wrap form value accessor methods to automatically convert from internal storage format\n * to component-friendly format:\n *\n * - Convert nullish string markers: \"__NULL__\" → null, \"__FALSE__\" → false, \"__ZERO__\" → 0\n * - Filter out empty/null values: fields with converted null/empty values are removed entirely\n *\n * This ensures components receive clean, predictable data without needing to handle\n * the internal nullish string conversion system manually.\n */\n const getValues = ((...args: any[]) => {\n const result = (getValuesOrig as any)(...args);\n return toValidationFormat(result);\n }) as typeof getValuesOrig;\n\n const watch = ((...args: any[]) => {\n const result = (watchOrig as any)(...args);\n return toValidationFormat(result);\n }) as typeof watchOrig;\n\n const subscribe = ((...args: any[]) => {\n // For subscribe, we need to wrap the callback to convert the values property\n const [options] = args;\n if (options?.callback) {\n const originalCallback = options.callback;\n const wrappedOptions = {\n ...options,\n callback: (subscribeFormState: any) => {\n // Convert the values property if it exists\n const convertedFormState = {\n ...subscribeFormState,\n ...(subscribeFormState.values && {\n values: toValidationFormat(subscribeFormState.values),\n }),\n };\n return originalCallback(convertedFormState);\n },\n };\n return subscribeOrig(wrappedOptions);\n }\n return (subscribeOrig as any)(...args);\n }) as typeof subscribeOrig;\n\n return {\n ...otherMethods,\n ...uniformContext,\n formState,\n getFieldState,\n getValues,\n subscribe,\n watch,\n };\n};\n","import type {\n VetoFormattedError,\n VetoInstance,\n VetoTypeAny,\n} from '@fuf-stack/veto';\nimport type { BaseSyntheticEvent, ReactNode } from 'react';\nimport type { FieldValues, SubmitHandler } from 'react-hook-form';\n\nimport React, { useMemo, useState } from 'react';\nimport { FormProvider as HookFormProvider, useForm } from 'react-hook-form';\n\nimport { useLocalStorage } from '@fuf-stack/pixels';\n\nimport { toValidationFormat } from '../../helpers';\nimport { useExtendedValidation, useFormResolver } from './FormResolver';\n\ntype DebugMode = 'debug' | 'debug-testids' | 'off' | 'disabled';\n\nexport type DebugModeSettings = {\n /** disable form debug completely */\n disable?: boolean;\n /** custom localStorage key to save debug mode state */\n localStorageKey?: string;\n};\n\nconst DEBUG_MODE_LOCAL_STORAGE_KEY_DEFAULT = 'uniform:debug-mode';\n\n/**\n * The `UniformContext` provides control over the form's submission behavior and may optionally include\n * a Veto validation schema for form validation.\n *\n * Specifically, this context offers:\n * 1. **Form Submission Control**: The `preventSubmit` function allows components to enable or disable\n * form submissions.\n * 2. **Optional Validation Schema**: The `validation` property may hold a Veto validation schema instance\n * that can be used to validate form fields and handle validation logic.\n * 3. **Client Validation**: The `setClientValidationSchema` function allows setting dynamic client-side\n * validation schemas that complement the base Veto validation.\n *\n * This context is useful for components that need to interact with or control the form submission state,\n * or access the validation schema for managing form validation logic.\n */\nexport const UniformContext = React.createContext<{\n /** Form debug mode enabled or not */\n debugMode: DebugMode;\n /** settings for from debug mode */\n debugModeSettings?: DebugModeSettings;\n /** Function to update if the form can currently be submitted */\n preventSubmit: (prevent: boolean) => void;\n /** Setter to enable or disable form debug mode */\n setDebugMode: (debugMode: DebugMode) => void;\n /** Function to trigger form submit programmatically */\n triggerSubmit: (e?: BaseSyntheticEvent) => Promise<void> | void;\n /** Form validation configuration */\n validation: {\n /** Veto validation schema instance for form validation */\n instance?: VetoInstance;\n /** Current validation errors in form */\n errors?: VetoFormattedError;\n /** Function to set client validation schema for a specific key */\n setClientValidationSchema: (\n key: string,\n schema: VetoTypeAny | null,\n ) => void;\n };\n}>({\n debugMode: 'off',\n preventSubmit: () => undefined,\n setDebugMode: () => undefined,\n triggerSubmit: () => undefined,\n validation: {\n setClientValidationSchema: () => undefined,\n },\n});\n\n// Define props for the FormProvider component, extending HookForm's props\ninterface FormProviderProps {\n /** children form render function */\n children: (childProps: {\n handleSubmit: (e?: BaseSyntheticEvent) => Promise<void>;\n isValid: boolean;\n }) => ReactNode;\n /** settings for from debug mode */\n debugModeSettings?: DebugModeSettings;\n /** initial form values */\n initialValues?: FieldValues;\n /** form submit handler */\n onSubmit: SubmitHandler<FieldValues>;\n /** Veto validation schema instance */\n validation?: VetoInstance;\n /** when the validation should be triggered */\n validationTrigger: 'onChange' | 'onBlur' | 'onSubmit' | 'onTouched' | 'all';\n}\n\n/**\n * FormProvider component provides:\n * - Veto validation schema context\n * - Client validation schema management\n * - Submit handler with automatic data conversion and submission control with preventSubmit\n * - Form Debug Mode state\n * - React Hook Form context\n */\nconst FormProvider: React.FC<FormProviderProps> = ({\n children,\n debugModeSettings = undefined,\n initialValues = undefined,\n onSubmit,\n validation: baseValidation = undefined,\n validationTrigger,\n}) => {\n // Form Debug mode state is handled in the form context\n const [debugMode, setDebugMode] = useLocalStorage<DebugMode>(\n debugModeSettings?.localStorageKey || DEBUG_MODE_LOCAL_STORAGE_KEY_DEFAULT,\n 'off',\n );\n\n // Create extended validation combining base + client validations\n const { extendedValidation, setClientValidationSchema } =\n useExtendedValidation(baseValidation);\n\n // Create resolver from extended validation + get current validation errors\n const { resolver, validationErrors, validationErrorsHash } =\n useFormResolver(extendedValidation);\n\n // Initialize react hook form with the resolver\n const methods = useForm({\n defaultValues: initialValues,\n // set rhf mode\n // see: https://react-hook-form.com/docs/useform#mode\n mode: validationTrigger,\n resolver,\n });\n\n // Get isValid from React Hook Form's formState\n const isValid = methods.formState?.isValid;\n\n // Control if the form can currently be submitted\n const [preventSubmit, setPreventSubmit] = useState(false);\n\n // Create submit handler with automatic data conversion\n // eslint-disable-next-line consistent-return\n const handleSubmit = async (e?: React.BaseSyntheticEvent) => {\n // only prevent submit when form state is valid, because otherwise\n // submit will only trigger validation and add errors / focus invalid fields\n if (methods.formState.isValid && preventSubmit) {\n console.warn(\n '[FormProvider] form submit was prevented because preventSubmit is true...',\n );\n e?.preventDefault();\n return Promise.resolve();\n }\n\n // Convert nullish strings and filter out empty values before submission\n const wrappedOnSubmit = (data: FieldValues, event?: BaseSyntheticEvent) => {\n const submitData = toValidationFormat(data) || {};\n return onSubmit(submitData, event);\n };\n\n await methods.handleSubmit(wrappedOnSubmit)(e);\n };\n\n // Memoize the context value to prevent re-renders\n const contextValue = useMemo(\n () => ({\n // set debugMode to disabled when debugModeSettings.disable is true\n // otherwise use current debug mode from localStorage\n debugMode: debugModeSettings?.disable ? 'disabled' : debugMode,\n preventSubmit: (prevent: boolean) => {\n setPreventSubmit(prevent);\n },\n setClientValidationSchema,\n setDebugMode,\n triggerSubmit: handleSubmit,\n validation: {\n instance: extendedValidation,\n errors: validationErrors,\n setClientValidationSchema,\n },\n }),\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [debugMode, debugModeSettings?.disable, validationErrorsHash],\n );\n\n return (\n <UniformContext.Provider value={contextValue}>\n {/* Spread all hook form props into HookFormProvider */}\n {/* eslint-disable-next-line react/jsx-props-no-spreading */}\n <HookFormProvider {...methods}>\n {children({ handleSubmit, isValid })}\n </HookFormProvider>\n </UniformContext.Provider>\n );\n};\n\nexport default FormProvider;\n","/* eslint-disable import/prefer-default-export */\n\nimport type {\n VetoFormattedError,\n VetoInstance,\n VetoTypeAny,\n} from '@fuf-stack/veto';\nimport type { FieldValues } from 'react-hook-form';\n\nimport { useMemo, useRef, useState } from 'react';\n\nimport { and, serializeSchema, veto } from '@fuf-stack/veto';\n\n/**\n * Hook that manages client validation schemas state.\n *\n * Provides a centralized way to add/remove dynamic validation schemas\n * that can be combined with base form validation.\n *\n * @returns Object with client validation state and memoized setter function\n */\nexport const useClientValidationManager = () => {\n // Client validation schemas state\n const [clientValidationSchemas, setClientValidationSchemas] = useState<\n Record<string, VetoTypeAny>\n >({});\n\n // Memoized function to set/clear client validation schema\n const setClientValidationSchema = useMemo(\n () => {\n return (key: string, schema: VetoTypeAny | null) => {\n // update client validation schemas\n setClientValidationSchemas((prev) => {\n // if no schema and no existing client validation schema for this key, do nothing\n if (!prev[key] && !schema) {\n return prev;\n }\n // if no schema, remove the client validation schema for this key\n if (!schema) {\n const { [key]: _removed, ...rest } = prev;\n return rest;\n }\n // if schema, add or update the client validation schema for this key\n return { ...prev, [key]: schema };\n });\n };\n },\n\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [],\n );\n\n return {\n clientValidationSchemas,\n setClientValidationSchema,\n };\n};\n\n/**\n * Hook that creates an extended validation instance combining base Veto validation with dynamic client validation.\n *\n * @param baseValidation - Optional base Veto validation schema\n * @returns Combined validation instance and client schema setter\n */\nexport const useExtendedValidation = (baseValidation?: VetoInstance) => {\n // Setup client validation schemas\n const { clientValidationSchemas, setClientValidationSchema } =\n useClientValidationManager();\n\n // Create client schema hash for optimized memoization\n const clientValidationSchemasHash = JSON.stringify(\n Object.values(clientValidationSchemas).map((schema) =>\n serializeSchema(schema),\n ),\n );\n\n // Create a stable dependency array from the client validation schemas\n const clientSchemaValues = useMemo(\n () => {\n const keys = Object.keys(clientValidationSchemas).sort();\n return keys.map((key) => clientValidationSchemas[key]).filter(Boolean);\n },\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [clientValidationSchemasHash],\n );\n\n // Memoized extended validation instance\n const extendedValidation = useMemo(\n () => {\n const hasBaseValidation = !!baseValidation;\n const hasClientSchemas = clientSchemaValues.length > 0;\n\n // If no base validation and no client schemas, return undefined\n if (!hasBaseValidation && !hasClientSchemas) {\n return undefined;\n }\n\n // If no client schemas, return base validation\n if (!hasClientSchemas) {\n return baseValidation;\n }\n\n // Combine client validation schemas\n const clientSchemasCombined = clientSchemaValues.reduce(\n (combined, clientSchema) => {\n return combined ? and(combined, clientSchema) : clientSchema;\n },\n null,\n );\n\n // return combined validation\n if (hasBaseValidation && clientSchemasCombined) {\n return veto(\n and((baseValidation as VetoInstance).schema, clientSchemasCombined),\n );\n }\n\n // If we only have client schemas, return them as a veto instance\n if (clientSchemasCombined) {\n return veto(clientSchemasCombined);\n }\n\n // This should not happen due to the conditions above, but just in case\n return baseValidation;\n },\n // Using hash-based dependency to optimize performance\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [clientValidationSchemasHash],\n );\n\n return {\n extendedValidation,\n setClientValidationSchema,\n };\n};\n\n/**\n * Hook that creates a React Hook Form resolver from an extended validation instance.\n *\n * @param extendedValidation - Extended validation instance from useExtendedValidation\n * @returns Object containing resolver function, current validation errors, and optimization hash\n */\nexport const useFormResolver = (extendedValidation?: VetoInstance) => {\n // Use ref to store validation errors without triggering re-renders\n const validationErrors = useRef<VetoFormattedError>(undefined);\n\n // Memoized resolver function for React Hook Form\n const resolver = useMemo(() => {\n if (!extendedValidation) {\n return undefined;\n }\n\n return async (values: FieldValues) => {\n const result = await extendedValidation.validateAsync(values);\n validationErrors.current = result.errors;\n\n // Transform veto result to React Hook Form format\n return {\n values: result.data || {},\n errors: result.errors || {},\n };\n };\n }, [extendedValidation]);\n\n // Hash for memo dependency optimization in consuming components\n const validationErrorsHash = JSON.stringify(validationErrors.current);\n\n return {\n resolver,\n validationErrors: validationErrors.current,\n validationErrorsHash,\n };\n};\n","/* eslint-disable import/prefer-default-export */\n\nimport type {\n ControllerFieldState,\n ControllerRenderProps,\n UseControllerProps as RHFUseControllerProps,\n UseFormStateReturn,\n} from 'react-hook-form';\n\nimport { useController as useRHFController } from 'react-hook-form';\n\nimport { fromNullishString, toNullishString } from '../../helpers';\n\nexport type UseControllerProps<TFieldValues extends object = object> =\n RHFUseControllerProps<TFieldValues>;\n\nexport type UseControllerReturn<TFieldValues extends object = object> = {\n field: Omit<ControllerRenderProps<TFieldValues>, 'onChange' | 'value'> & {\n // Using any[] to support both direct value changes and React synthetic events\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n onChange: (...event: any[]) => void;\n value: string;\n };\n formState: UseFormStateReturn<TFieldValues>;\n fieldState: ControllerFieldState;\n};\n\n/**\n * A wrapper around react-hook-form's useController that transparently handles nullish string conversions.\n *\n * Key features:\n * 1. Empty strings ('') in the UI are stored as null in form state\n * 2. Null/undefined values in form state are displayed as empty strings in the UI\n * 3. Handles both direct value changes and React synthetic events\n * 4. Maintains the same API as react-hook-form's useController\n *\n * This enables consistent handling of empty/null values while keeping a clean API\n * for form inputs that expect string values.\n *\n * @see https://react-hook-form.com/docs/usecontroller\n */\nexport const useController = <TFieldValues extends object = object>(\n props: UseControllerProps<TFieldValues>,\n): UseControllerReturn<TFieldValues> => {\n const { field, formState, fieldState } = useRHFController(props);\n\n return {\n field: {\n ...field,\n // Handles both direct values (onChange(\"value\")) and events (onChange(event))\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n onChange: (...event: any[]) => {\n const value = event[0]?.target?.value ?? event[0];\n field.onChange(toNullishString(value));\n },\n // Convert null/undefined to empty string for UI display\n value: fromNullishString(field.value) as string,\n },\n formState,\n fieldState,\n };\n};\n","/* eslint-disable import/prefer-default-export */\n\n/** @see https://react-hook-form.com/docs/usefieldarray */\nexport { useFieldArray } from 'react-hook-form';\n","/* eslint-disable import/prefer-default-export */\nexport { useInput } from '@heroui/input';\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["/home/runner/work/pixels/pixels/packages/uniform/dist/chunk-X4BLYZLW.cjs","../src/Input/Input.tsx","../src/Input/index.ts"],"names":["Input_default"],"mappings":"AAAA;AACE;AACF,wDAA6B;AAC7B;AACE;AACF,wDAA6B;AAC7B;AACE;AACA;AACF,wDAA6B;AAC7B;AACA;ACTA,sCAAmC;AAEnC,oDAAmB;AA2HF,+CAAA;AApFjB,IAAM,MAAA,EAAQ,CAAC;AAAA,EACb,UAAA,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EJ,CAAA;AAEA,IAAO,cAAA,EAAQ,KAAA;AD3Ef;AACA;AE7EA,IAAOA,eAAAA,EAAQ,aAAA;AF+Ef;AACA;AACE;AACA;AACF,+EAAC","file":"/home/runner/work/pixels/pixels/packages/uniform/dist/chunk-X4BLYZLW.cjs","sourcesContent":[null,"import type { ReactNode } from 'react';\n\nimport { Input as HeroInput } from '@heroui/input';\n\nimport { cn } from '@fuf-stack/pixel-utils';\n\nimport { useController, useFormContext } from '../hooks';\nimport { FieldCopyTestIdButton } from '../partials/FieldCopyTestIdButton';\nimport { FieldValidationError } from '../partials/FieldValidationError';\n\nexport interface InputProps {\n /** CSS class name */\n className?: string;\n /** input field is disabled */\n disabled?: boolean;\n /** added content to the end of the input Field. */\n endContent?: ReactNode;\n /** form field label (set to false to disable label) */\n label?: string | false;\n /** form field name */\n name: string;\n /** form field placeholder */\n placeholder?: string;\n /** size of the input */\n size?: 'sm' | 'md' | 'lg';\n /** content added to the start of the input field */\n startContent?: ReactNode;\n /** HTML data-testid attribute used in e2e tests */\n testId?: string;\n /** allows disentangled display and form values for a field */\n transformValue?: {\n /** transforms the formValue of the field to the display value of the field */\n displayValue: (value: string | number) => string | number;\n /** transforms the displayValue of the field to the form value of the field */\n formValue: (value: string) => string | number;\n };\n /** input type */\n type?: 'number' | 'password';\n}\n\n/**\n * Input component based on [HeroUI Input](https://www.heroui.com//docs/components/input)\n */\nconst Input = ({\n className = undefined,\n disabled = false,\n endContent = undefined,\n label = undefined,\n name,\n placeholder = ' ',\n size = undefined,\n startContent = undefined,\n testId: _testId = undefined,\n transformValue = undefined,\n type = undefined,\n}: InputProps) => {\n const { control, debugMode, getFieldState } = useFormContext();\n const { error, invalid, required, testId } = getFieldState(name, _testId);\n\n const { field } = useController({\n control,\n disabled,\n name,\n });\n\n const { disabled: isDisabled, onChange, onBlur, value, ref } = field;\n\n const showTestIdCopyButton = debugMode === 'debug-testids';\n const showLabel = label || showTestIdCopyButton;\n\n /**\n * Determines the display value for the input field:\n * 1. If transformValue.displayValue is provided, applies the transform to the current value\n * (useful for formatting like adding currency symbols, date formatting, etc.)\n * 2. Falls back to the raw value if no transform is provided\n * 3. Ensures a defined value by using empty string as fallback (prevents uncontrolled input warnings)\n *\n * Examples:\n * - With transform: value \"1000\" → displayValue \"$1,000\"\n * - Without transform: value \"1000\" → displayValue \"1000\"\n * - Undefined value: value undefined → displayValue \"\"\n */\n const displayValue = transformValue?.displayValue\n ? transformValue.displayValue(value ?? '')\n : (value ?? '');\n\n /**\n * Handles input value changes with special processing:\n * 1. For number inputs:\n * - Preserves empty string (prevents NaN in the form state)\n * - Converts non-empty values to numbers\n * Example: \"\" → \"\" (empty stays empty)\n * \"42\" → 42 (converts to number)\n *\n * 2. For text inputs with transformValue.formValue:\n * - Applies custom transform before updating form state\n * - Useful for converting display format to storage format\n * Example: \"$1,000\" → \"1000\" (strips formatting)\n *\n * 3. For regular text inputs:\n * - Passes through the raw input value\n * Example: \"hello\" → \"hello\" (no transformation)\n *\n * @param e The input change event\n */\n const handleChange = (e: React.ChangeEvent<HTMLInputElement>) => {\n const inputValue = e.target.value;\n if (type === 'number') {\n onChange(inputValue === '' ? '' : Number(inputValue));\n } else {\n onChange(\n transformValue?.formValue\n ? transformValue.formValue(inputValue)\n : inputValue,\n );\n }\n };\n\n return (\n <HeroInput\n className={cn(className)}\n classNames={{\n inputWrapper: 'bg-content1 group-data-[focus=true]:border-focus',\n }}\n data-testid={testId}\n endContent={endContent}\n errorMessage={\n error && <FieldValidationError error={error} testId={testId} />\n }\n isDisabled={isDisabled}\n isInvalid={invalid}\n isRequired={required}\n label={\n showLabel && (\n <>\n {label}\n {showTestIdCopyButton && <FieldCopyTestIdButton testId={testId} />}\n </>\n )\n }\n labelPlacement=\"outside\"\n name={name}\n onBlur={onBlur}\n onChange={handleChange}\n placeholder={placeholder}\n radius=\"sm\"\n ref={ref}\n size={size}\n startContent={startContent}\n type={type}\n // @ts-expect-error number is ok here\n value={displayValue}\n variant=\"bordered\"\n />\n );\n};\n\nexport default Input;\n","import Input from './Input';\n\nexport type { InputProps } from './Input';\n\nexport { Input };\n\nexport default Input;\n"]}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|