@fuf-stack/uniform 2.0.0-next.4 → 2.0.0-next.5
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/Checkboxes/index.d.mts +49 -49
- package/dist/Checkboxes/index.mjs +5 -5
- package/dist/Checkboxes/index.mjs.map +1 -1
- package/dist/DatePicker/index.d.mts +59 -59
- package/dist/DatePicker/index.mjs +18 -18
- package/dist/DatePicker/index.mjs.map +1 -1
- package/dist/FieldArray/index.d.mts +6 -6
- package/dist/FieldArray/index.mjs +12 -12
- package/dist/FieldArray/index.mjs.map +1 -1
- package/dist/FieldCard/index.mjs +6 -6
- package/dist/FieldCard/index.mjs.map +1 -1
- package/dist/FieldReset/index.d.mts +1 -1
- package/dist/FieldReset/index.mjs +1 -1
- package/dist/Form/index.d.mts +2 -2
- package/dist/Form/index.mjs +4 -4
- package/dist/Form/index.mjs.map +1 -1
- package/dist/{FormContext-PXkVlBdU.mjs → FormContext-CVq3glVW.mjs} +5 -5
- package/dist/FormContext-CVq3glVW.mjs.map +1 -0
- package/dist/{FormContext-BnNJYZOo.d.mts → FormContext-Dvt3MiKq.d.mts} +3 -3
- package/dist/{FormContext-BnNJYZOo.d.mts.map → FormContext-Dvt3MiKq.d.mts.map} +1 -1
- package/dist/Input/index.d.mts +52 -52
- package/dist/Input/index.mjs +10 -10
- package/dist/Input/index.mjs.map +1 -1
- package/dist/RadioBoxes/index.d.mts +28 -28
- package/dist/RadioBoxes/index.mjs +3 -3
- package/dist/RadioBoxes/index.mjs.map +1 -1
- package/dist/RadioTabs/index.d.mts +21 -21
- package/dist/RadioTabs/index.d.mts.map +1 -1
- package/dist/RadioTabs/index.mjs +5 -5
- package/dist/RadioTabs/index.mjs.map +1 -1
- package/dist/Radios/index.d.mts +14 -14
- package/dist/Radios/index.mjs +2 -2
- package/dist/Select/index.d.mts +48 -48
- package/dist/Select/index.mjs +8 -8
- package/dist/Select/index.mjs.map +1 -1
- package/dist/Slider/index.d.mts +51 -51
- package/dist/Slider/index.mjs +7 -7
- package/dist/Slider/index.mjs.map +1 -1
- package/dist/Switch/index.d.mts +1 -1
- package/dist/Switch/index.mjs +2 -2
- package/dist/{Switch-aBYStBoY.d.mts → Switch-3ujfKWwt.d.mts} +38 -38
- package/dist/{Switch-aBYStBoY.d.mts.map → Switch-3ujfKWwt.d.mts.map} +1 -1
- package/dist/SwitchBox/index.d.mts +35 -35
- package/dist/SwitchBox/index.mjs +2 -2
- package/dist/TextArea/index.d.mts +18 -18
- package/dist/TextArea/index.mjs +7 -7
- package/dist/TextArea/index.mjs.map +1 -1
- package/dist/Time/index.d.mts +37 -37
- package/dist/Time/index.mjs +2 -2
- package/dist/hooks/useClientValidation/index.mjs +1 -1
- package/dist/hooks/useController/index.mjs +1 -1
- package/dist/hooks/useFormContext/index.d.mts +1 -1
- package/dist/hooks/useFormContext/index.mjs +1 -1
- package/dist/hooks/useInputValueDebounce/index.mjs +1 -1
- package/dist/hooks/useWatchFormReset/index.mjs +1 -1
- package/dist/hooks/useWatchUserChange/index.mjs +1 -1
- package/dist/partials/FieldHelper/index.d.mts +2 -2
- package/dist/partials/FieldValidationError/index.d.mts +11 -11
- package/dist/{radioControlVariants-CbtG5U4_.mjs → radioControlVariants-CxA0og5-.mjs} +7 -7
- package/dist/{radioControlVariants-CbtG5U4_.mjs.map → radioControlVariants-CxA0og5-.mjs.map} +1 -1
- package/dist/{switchVariants-0Xa7TQYg.mjs → switchVariants-B8dq8DYP.mjs} +9 -9
- package/dist/{switchVariants-0Xa7TQYg.mjs.map → switchVariants-B8dq8DYP.mjs.map} +1 -1
- package/dist/{timeVariants-Bkt4iwXx.mjs → timeVariants-CIX6R59-.mjs} +6 -6
- package/dist/{timeVariants-Bkt4iwXx.mjs.map → timeVariants-CIX6R59-.mjs.map} +1 -1
- package/dist/{useController-JtIeurpw.mjs → useController-SEAuP3G4.mjs} +6 -6
- package/dist/useController-SEAuP3G4.mjs.map +1 -0
- package/dist/{useFormContext-piqnN2L-.mjs → useFormContext-CQzJhAU4.mjs} +12 -8
- package/dist/useFormContext-CQzJhAU4.mjs.map +1 -0
- package/dist/{useUniformField-TTNPTsVn.mjs → useUniformField-BvPoQyLL.mjs} +4 -4
- package/dist/{useUniformField-TTNPTsVn.mjs.map → useUniformField-BvPoQyLL.mjs.map} +1 -1
- package/package.json +4 -4
- package/dist/FormContext-PXkVlBdU.mjs.map +0 -1
- package/dist/useController-JtIeurpw.mjs.map +0 -1
- package/dist/useFormContext-piqnN2L-.mjs.map +0 -1
|
@@ -522,23 +522,23 @@ declare const fieldValidationErrorVariants: ((props?: ({
|
|
|
522
522
|
defaultVariants: {};
|
|
523
523
|
compoundVariants: ({} & ({
|
|
524
524
|
class?: (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | /*elided*/ any | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined) | {
|
|
525
|
-
message?: string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | /*elided*/ any | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined;
|
|
526
525
|
base?: string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | /*elided*/ any | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined;
|
|
527
526
|
item?: string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | /*elided*/ any | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined;
|
|
527
|
+
message?: string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | /*elided*/ any | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined;
|
|
528
528
|
wrapper?: string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | /*elided*/ any | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined;
|
|
529
529
|
};
|
|
530
530
|
className?: never;
|
|
531
531
|
} | {
|
|
532
532
|
class?: never;
|
|
533
533
|
className?: (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | /*elided*/ any | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined) | {
|
|
534
|
-
message?: string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | /*elided*/ any | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined;
|
|
535
534
|
base?: string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | /*elided*/ any | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined;
|
|
536
535
|
item?: string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | /*elided*/ any | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined;
|
|
536
|
+
message?: string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | /*elided*/ any | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined;
|
|
537
537
|
wrapper?: string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | /*elided*/ any | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined;
|
|
538
538
|
};
|
|
539
539
|
}))[];
|
|
540
540
|
compoundSlots: ({
|
|
541
|
-
slots: ("
|
|
541
|
+
slots: ("base" | "item" | "message" | "wrapper")[];
|
|
542
542
|
} & ({} & ({
|
|
543
543
|
class?: string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | /*elided*/ any | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined;
|
|
544
544
|
className?: never;
|
|
@@ -562,18 +562,18 @@ declare const fieldValidationErrorVariants: ((props?: ({
|
|
|
562
562
|
variants: {
|
|
563
563
|
[key: string]: {
|
|
564
564
|
[key: string]: (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | /*elided*/ any | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined) | {
|
|
565
|
-
message?: string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | /*elided*/ any | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined;
|
|
566
565
|
base?: string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | /*elided*/ any | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined;
|
|
567
566
|
item?: string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | /*elided*/ any | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined;
|
|
567
|
+
message?: string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | /*elided*/ any | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined;
|
|
568
568
|
wrapper?: string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | /*elided*/ any | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined;
|
|
569
569
|
};
|
|
570
570
|
};
|
|
571
571
|
} | {
|
|
572
572
|
[x: string]: {
|
|
573
573
|
[x: string]: (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | /*elided*/ any | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined) | {
|
|
574
|
-
message?: string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | /*elided*/ any | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined;
|
|
575
574
|
base?: string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | /*elided*/ any | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined;
|
|
576
575
|
item?: string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | /*elided*/ any | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined;
|
|
576
|
+
message?: string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | /*elided*/ any | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined;
|
|
577
577
|
wrapper?: string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | /*elided*/ any | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined;
|
|
578
578
|
};
|
|
579
579
|
};
|
|
@@ -581,23 +581,23 @@ declare const fieldValidationErrorVariants: ((props?: ({
|
|
|
581
581
|
defaultVariants: {};
|
|
582
582
|
compoundVariants: ({} & ({
|
|
583
583
|
class?: (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | /*elided*/ any | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined) | {
|
|
584
|
-
message?: string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | /*elided*/ any | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined;
|
|
585
584
|
base?: string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | /*elided*/ any | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined;
|
|
586
585
|
item?: string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | /*elided*/ any | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined;
|
|
586
|
+
message?: string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | /*elided*/ any | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined;
|
|
587
587
|
wrapper?: string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | /*elided*/ any | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined;
|
|
588
588
|
};
|
|
589
589
|
className?: never;
|
|
590
590
|
} | {
|
|
591
591
|
class?: never;
|
|
592
592
|
className?: (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | /*elided*/ any | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined) | {
|
|
593
|
-
message?: string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | /*elided*/ any | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined;
|
|
594
593
|
base?: string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | /*elided*/ any | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined;
|
|
595
594
|
item?: string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | /*elided*/ any | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined;
|
|
595
|
+
message?: string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | /*elided*/ any | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined;
|
|
596
596
|
wrapper?: string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | /*elided*/ any | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined;
|
|
597
597
|
};
|
|
598
598
|
}))[];
|
|
599
599
|
compoundSlots: (({
|
|
600
|
-
slots: ("
|
|
600
|
+
slots: ("base" | "item" | "message" | "wrapper")[];
|
|
601
601
|
} & ({
|
|
602
602
|
[x: string]: string | number | (string | number)[] | undefined;
|
|
603
603
|
} & ({
|
|
@@ -607,7 +607,7 @@ declare const fieldValidationErrorVariants: ((props?: ({
|
|
|
607
607
|
class?: never;
|
|
608
608
|
className?: string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | /*elided*/ any | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined;
|
|
609
609
|
}))) | ({
|
|
610
|
-
slots: ("
|
|
610
|
+
slots: ("base" | "item" | "message" | "wrapper")[];
|
|
611
611
|
} & ({
|
|
612
612
|
[x: string]: string | number | (string | number)[] | undefined;
|
|
613
613
|
} & ({
|
|
@@ -617,7 +617,7 @@ declare const fieldValidationErrorVariants: ((props?: ({
|
|
|
617
617
|
class?: never;
|
|
618
618
|
className?: string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | /*elided*/ any | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined;
|
|
619
619
|
}))) | ({
|
|
620
|
-
slots: ("
|
|
620
|
+
slots: ("base" | "item" | "message" | "wrapper")[];
|
|
621
621
|
} & ({} & ({
|
|
622
622
|
class?: string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | /*elided*/ any | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined;
|
|
623
623
|
className?: never;
|
|
@@ -625,7 +625,7 @@ declare const fieldValidationErrorVariants: ((props?: ({
|
|
|
625
625
|
class?: never;
|
|
626
626
|
className?: string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | /*elided*/ any | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined;
|
|
627
627
|
}))))[];
|
|
628
|
-
variantKeys:
|
|
628
|
+
variantKeys: (string | number)[] | never[];
|
|
629
629
|
};
|
|
630
630
|
type ClassName = TVClassName<typeof fieldValidationErrorVariants>;
|
|
631
631
|
interface FieldValidationErrorProps {
|
|
@@ -153,28 +153,28 @@ const RadioControl = ({ children, className: classNames, description = void 0, d
|
|
|
153
153
|
const radioControlVariants = tv({
|
|
154
154
|
slots: {
|
|
155
155
|
/** Clickable option containing the indicator and label */
|
|
156
|
-
base: ["group relative -m-2 inline-flex max-w-fit cursor-pointer
|
|
156
|
+
base: ["group relative -m-2 inline-flex max-w-fit cursor-pointer items-center justify-start p-2 select-none tap-highlight-transparent", "data-[disabled=true]:cursor-not-allowed data-[disabled=true]:opacity-disabled data-[disabled=true]:**:cursor-not-allowed"],
|
|
157
157
|
/** Dot marking the selected option */
|
|
158
158
|
control: [
|
|
159
159
|
"z-10 h-2 w-2 origin-center scale-0 rounded-full bg-primary text-primary-foreground opacity-0 transition-transform-opacity",
|
|
160
|
-
"group-data-[
|
|
160
|
+
"group-data-[invalid=true]:bg-danger group-data-[invalid=true]:text-danger-foreground group-data-[selected=true]:scale-100 group-data-[selected=true]:opacity-100",
|
|
161
161
|
"motion-reduce:transition-none"
|
|
162
162
|
],
|
|
163
163
|
/** Supporting text below the option label */
|
|
164
|
-
description: "relative text-foreground-400 transition-colors
|
|
164
|
+
description: "relative text-small text-foreground-400 transition-colors motion-reduce:transition-none",
|
|
165
165
|
/** Option state boundary without an additional layout box */
|
|
166
166
|
field: "contents",
|
|
167
167
|
/** Container for a decorative option icon */
|
|
168
168
|
icon: "",
|
|
169
169
|
/** Primary option text */
|
|
170
|
-
label: "relative
|
|
170
|
+
label: "relative text-medium text-foreground transition-colors select-none motion-reduce:transition-none",
|
|
171
171
|
/** Container grouping the option label and description */
|
|
172
|
-
labelWrapper: "ml-1
|
|
172
|
+
labelWrapper: "ms-2 ml-1 flex flex-col",
|
|
173
173
|
/** Circular outline around the selection indicator */
|
|
174
174
|
wrapper: [
|
|
175
175
|
"relative box-border inline-flex h-5 w-5 shrink-0 items-center justify-center overflow-hidden",
|
|
176
176
|
"rounded-full border-2 border-solid border-default transition-transform-colors",
|
|
177
|
-
"group-data-[
|
|
177
|
+
"group-data-[hover-unselected=true]:bg-default-100 group-data-[invalid=true]:border-danger group-data-[pressed=true]:scale-95 group-data-[selected=true]:border-primary group-data-[invalid=true]:group-data-[selected=true]:border-danger",
|
|
178
178
|
"group-data-[focus-visible=true]:ring-2 group-data-[focus-visible=true]:ring-focus group-data-[focus-visible=true]:ring-offset-2 group-data-[focus-visible=true]:ring-offset-background",
|
|
179
179
|
"motion-reduce:transition-none"
|
|
180
180
|
]
|
|
@@ -188,4 +188,4 @@ const radioControlVariants = tv({
|
|
|
188
188
|
});
|
|
189
189
|
export { RadioGroupField as i, RadioControl as n, radioGroupFieldVariants as r, radioControlVariants as t };
|
|
190
190
|
|
|
191
|
-
//# sourceMappingURL=radioControlVariants-
|
|
191
|
+
//# sourceMappingURL=radioControlVariants-CxA0og5-.mjs.map
|
package/dist/{radioControlVariants-CbtG5U4_.mjs.map → radioControlVariants-CxA0og5-.mjs.map}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"radioControlVariants-CbtG5U4_.mjs","names":[],"sources":["../src/partials/RadioGroupField/RadioGroupDescriptionContext.ts","../src/partials/RadioGroupField/RadioGroupField.tsx","../src/partials/RadioGroupField/radioGroupFieldVariants.ts","../src/Radios/subcomponents/RadioControl.tsx","../src/Radios/subcomponents/radioControlVariants.ts"],"sourcesContent":["import { createContext } from 'react';\n\n/** Supporting message IDs inherited by each option */\nconst RadioGroupDescriptionContext = createContext<string | undefined>(\n undefined,\n);\n\nexport default RadioGroupDescriptionContext;\n","import type { ReactNode } from 'react';\nimport type { RadioGroupProps } from 'react-aria-components';\nimport type { FieldControlProps } from '../types';\n\nimport { useRef } from 'react';\nimport { RadioGroup } from 'react-aria-components';\n\nimport RadioGroupDescriptionContext from './RadioGroupDescriptionContext';\n\ninterface RadioGroupFieldProps {\n /** Group content, including its label and options */\n children: ReactNode;\n /** CSS class name */\n className?: string;\n /** Control ID, explicit accessible name and supporting message IDs */\n controlProps: Pick<\n FieldControlProps,\n 'id' | 'aria-label' | 'aria-describedby'\n >;\n /** Identifies the public component owning the radio group */\n dataComponent?: string;\n /** Disables every option */\n disabled?: boolean;\n /** Arranges options horizontally */\n inline: boolean;\n /** Connects form focus requests to the selected or first enabled option */\n inputRef: (control: Pick<HTMLElement, 'focus'> | null) => void;\n /** Marks visible validation failure */\n invalid: boolean;\n /** Field name */\n name: string;\n /** Callback when focus leaves the group */\n onBlur: () => void;\n /** Callback with the selected option's string value */\n onChange: (value: string) => void;\n /** Prevents selection changes while options stay focusable */\n readOnly?: boolean;\n /** Marks the group as required */\n required: boolean;\n /** HTML data-testid attribute */\n testId: string;\n /** Selected value, nullish values become an empty selection */\n value: unknown;\n}\n\n/**\n * React Aria radio-group engine with option focus routing and shared descriptions\n *\n * Receives bound values and callbacks, without registering a form field.\n * Its children own the field layout and option presentation.\n *\n * @see https://react-aria.adobe.com/RadioGroup\n */\nconst RadioGroupField = ({\n children,\n className = undefined,\n controlProps,\n dataComponent = undefined,\n disabled = undefined,\n inputRef,\n invalid,\n inline,\n name,\n onBlur,\n onChange,\n readOnly = undefined,\n required,\n testId,\n value,\n}: RadioGroupFieldProps) => {\n const groupRef = useRef<HTMLDivElement>(null);\n\n // focus the selected enabled option, otherwise the first enabled option\n const handleFocus = () => {\n const input =\n groupRef.current?.querySelector<HTMLInputElement>(\n 'input:checked:not(:disabled)',\n ) ??\n groupRef.current?.querySelector<HTMLInputElement>('input:not(:disabled)');\n input?.focus();\n };\n\n // expose option focus through the binding ref\n const setControlRef = (node: HTMLDivElement | null) => {\n groupRef.current = node;\n inputRef(node ? { focus: handleFocus } : null);\n };\n\n // preserve the group's existing state selectors on the actual root\n const renderGroup: NonNullable<RadioGroupProps['render']> = (props) => {\n return (\n <div {...props} data-invalid={invalid} data-required={required}>\n {props.children}\n </div>\n );\n };\n\n return (\n <RadioGroup\n ref={setControlRef}\n aria-describedby={controlProps['aria-describedby']}\n aria-label={controlProps['aria-label']}\n className={className}\n data-component={dataComponent}\n data-invalid={invalid}\n data-required={required}\n data-slot=\"base\"\n data-testid={testId}\n id={controlProps.id}\n isDisabled={disabled}\n isInvalid={invalid}\n isReadOnly={readOnly}\n isRequired={required}\n name={name}\n onBlur={onBlur}\n onChange={onChange}\n orientation={inline ? 'horizontal' : 'vertical'}\n render={renderGroup}\n validationBehavior=\"aria\"\n value={value != null ? String(value) : ''}\n >\n <RadioGroupDescriptionContext.Provider\n value={controlProps['aria-describedby']}\n >\n {children}\n </RadioGroupDescriptionContext.Provider>\n </RadioGroup>\n );\n};\n\nexport default RadioGroupField;\n","import { tv } from '@fuf-stack/pixel-utils';\n\nimport { fieldHelperVariants } from '../FieldHelper/fieldHelperVariants';\nimport { fieldLabelVariants } from '../FieldLabel/fieldLabelVariants';\n\nconst radioGroupFieldVariants = tv({\n // reference slots instead of extending, tv types follow only one extend level\n slots: {\n /** Container grouping the label, options and hints */\n base: 'relative',\n /** Help text below the control */\n description: fieldHelperVariants.slots.description,\n /** Validation message container */\n errorMessage: fieldHelperVariants.slots.errorMessage,\n /** Container for help text and validation messages */\n helperWrapper: fieldHelperVariants.slots.helperWrapper,\n /** Label above the options */\n label: [fieldLabelVariants.base, 'relative inline-flex'],\n /** Container around the selectable options */\n wrapper: '',\n },\n variants: {\n readOnly: {\n true: {\n // inner controls set their own cursors, override every descendant\n base: 'cursor-not-allowed opacity-disabled **:cursor-not-allowed',\n },\n },\n },\n});\n\nexport default radioGroupFieldVariants;\n","import type { ReactNode } from 'react';\nimport type { RadioButtonProps } from 'react-aria-components';\nimport type { RadioControlClassNames } from './radioControlVariants';\n\nimport { useContext, useId } from 'react';\nimport { RadioButton, RadioField } from 'react-aria-components';\n\nimport RadioGroupDescriptionContext from '../../partials/RadioGroupField/RadioGroupDescriptionContext';\n\ninterface RadioControlProps {\n /** Option label */\n children: ReactNode;\n /** CSS class name */\n className: RadioControlClassNames;\n /** Help text associated with the field */\n description?: ReactNode;\n /** Disables the field */\n disabled?: boolean;\n /** Decorative option icon */\n icon?: ReactNode;\n /** Marks visible validation failure */\n invalid: boolean;\n /** HTML data-testid attribute for e2e tests */\n testId?: string;\n /** String value managed by the containing group */\n value: string;\n}\n\n/**\n * React Aria radio option with an indicator, label and optional supporting text\n *\n * Inherits selection and disabled state from its RadioGroup, and supporting\n * message IDs from RadioGroupField when composed inside that engine.\n *\n * @see https://react-aria.adobe.com/RadioGroup\n */\nconst RadioControl = ({\n children,\n className: classNames,\n description = undefined,\n disabled = undefined,\n icon = undefined,\n invalid,\n testId = undefined,\n value,\n}: RadioControlProps) => {\n const id = useId();\n const groupDescription = useContext(RadioGroupDescriptionContext);\n\n const describedBy =\n [groupDescription, description ? `${id}-description` : undefined]\n .filter(Boolean)\n .join(' ') || undefined;\n\n const control = (\n <span aria-hidden className={classNames.wrapper} data-slot=\"wrapper\">\n <span className={classNames.control} data-slot=\"control\" />\n </span>\n );\n\n // preserve option state selectors on the visible label\n const renderOption: NonNullable<RadioButtonProps['render']> = (\n props,\n state,\n ) => {\n return (\n <label\n {...props}\n data-focus={state.isFocused || undefined}\n data-hover={state.isHovered || undefined}\n data-hover-unselected={\n (state.isHovered && !state.isSelected) || undefined\n }\n htmlFor={`${id}-control`}\n >\n {props.children}\n </label>\n );\n };\n\n return (\n <RadioField\n aria-describedby={describedBy}\n aria-labelledby={`${id}-label`}\n className={classNames.field}\n id={`${id}-control`}\n isDisabled={disabled}\n value={value}\n >\n <RadioButton\n className={classNames.base}\n data-invalid={invalid}\n data-slot=\"base\"\n data-testid={testId}\n render={renderOption}\n >\n {!icon ? control : null}\n {icon ? <div className={classNames.icon}>{icon}</div> : null}\n <div className={classNames.labelWrapper} data-slot=\"label-wrapper\">\n <span\n className={classNames.label}\n data-slot=\"label\"\n id={`${id}-label`}\n >\n {children}\n </span>\n {description ? (\n <div\n className={classNames.description}\n data-slot=\"description\"\n id={`${id}-description`}\n >\n {description}\n </div>\n ) : null}\n </div>\n {icon ? control : null}\n </RadioButton>\n </RadioField>\n );\n};\n\nexport default RadioControl;\n","import type { TVClassName } from '@fuf-stack/pixel-utils';\n\nimport { tv } from '@fuf-stack/pixel-utils';\n\nconst radioControlVariants = tv({\n slots: {\n /** Clickable option containing the indicator and label */\n base: [\n // option layout and pointer behavior\n 'group relative -m-2 inline-flex max-w-fit cursor-pointer select-none items-center justify-start p-2 tap-highlight-transparent',\n // disabled cursor and opacity, the native input covers the option\n 'data-[disabled=true]:cursor-not-allowed data-[disabled=true]:opacity-disabled data-[disabled=true]:**:cursor-not-allowed',\n ],\n /** Dot marking the selected option */\n control: [\n // selection dot appearance and animation\n 'z-10 h-2 w-2 origin-center scale-0 rounded-full bg-primary text-primary-foreground opacity-0 transition-transform-opacity',\n // selection and validation states\n 'group-data-[selected=true]:scale-100 group-data-[invalid=true]:bg-danger group-data-[invalid=true]:text-danger-foreground group-data-[selected=true]:opacity-100',\n // reduced motion\n 'motion-reduce:transition-none',\n ],\n /** Supporting text below the option label */\n description:\n 'relative text-foreground-400 transition-colors text-small motion-reduce:transition-none',\n /** Option state boundary without an additional layout box */\n field: 'contents',\n /** Container for a decorative option icon */\n icon: '',\n /** Primary option text */\n label:\n 'relative select-none text-foreground transition-colors text-medium motion-reduce:transition-none',\n /** Container grouping the option label and description */\n labelWrapper: 'ml-1 ms-2 flex flex-col',\n /** Circular outline around the selection indicator */\n wrapper: [\n // indicator dimensions and layout\n 'relative box-border inline-flex h-5 w-5 shrink-0 items-center justify-center overflow-hidden',\n // circular border and transitions\n 'rounded-full border-2 border-solid border-default transition-transform-colors',\n // pressed, selected and invalid states\n 'group-data-[pressed=true]:scale-95 group-data-[invalid=true]:border-danger group-data-[invalid=true]:group-data-[selected=true]:border-danger group-data-[selected=true]:border-primary group-data-[hover-unselected=true]:bg-default-100',\n // keyboard focus ring\n 'group-data-[focus-visible=true]:ring-2 group-data-[focus-visible=true]:ring-focus group-data-[focus-visible=true]:ring-offset-2 group-data-[focus-visible=true]:ring-offset-background',\n // reduced motion\n 'motion-reduce:transition-none',\n ],\n },\n variants: {\n invalid: {\n true: {\n control: 'bg-danger text-danger-foreground',\n description: 'text-danger-300',\n label: 'text-danger',\n wrapper: 'border-danger group-data-[selected=true]:border-danger',\n },\n },\n },\n});\n\nexport type RadioControlClassNames = Partial<\n Record<keyof ReturnType<typeof radioControlVariants>, string>\n>;\n\nexport type ClassName = TVClassName<typeof radioControlVariants>;\n\nexport default radioControlVariants;\n"],"mappings":"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"}
|
|
1
|
+
{"version":3,"file":"radioControlVariants-CxA0og5-.mjs","names":[],"sources":["../src/partials/RadioGroupField/RadioGroupDescriptionContext.ts","../src/partials/RadioGroupField/RadioGroupField.tsx","../src/partials/RadioGroupField/radioGroupFieldVariants.ts","../src/Radios/subcomponents/RadioControl.tsx","../src/Radios/subcomponents/radioControlVariants.ts"],"sourcesContent":["import { createContext } from 'react';\n\n/** Supporting message IDs inherited by each option */\nconst RadioGroupDescriptionContext = createContext<string | undefined>(\n undefined,\n);\n\nexport default RadioGroupDescriptionContext;\n","import type { ReactNode } from 'react';\nimport type { RadioGroupProps } from 'react-aria-components';\nimport type { FieldControlProps } from '../types';\n\nimport { useRef } from 'react';\nimport { RadioGroup } from 'react-aria-components';\n\nimport RadioGroupDescriptionContext from './RadioGroupDescriptionContext';\n\ninterface RadioGroupFieldProps {\n /** Group content, including its label and options */\n children: ReactNode;\n /** CSS class name */\n className?: string;\n /** Control ID, explicit accessible name and supporting message IDs */\n controlProps: Pick<\n FieldControlProps,\n 'id' | 'aria-label' | 'aria-describedby'\n >;\n /** Identifies the public component owning the radio group */\n dataComponent?: string;\n /** Disables every option */\n disabled?: boolean;\n /** Arranges options horizontally */\n inline: boolean;\n /** Connects form focus requests to the selected or first enabled option */\n inputRef: (control: Pick<HTMLElement, 'focus'> | null) => void;\n /** Marks visible validation failure */\n invalid: boolean;\n /** Field name */\n name: string;\n /** Callback when focus leaves the group */\n onBlur: () => void;\n /** Callback with the selected option's string value */\n onChange: (value: string) => void;\n /** Prevents selection changes while options stay focusable */\n readOnly?: boolean;\n /** Marks the group as required */\n required: boolean;\n /** HTML data-testid attribute */\n testId: string;\n /** Selected value, nullish values become an empty selection */\n value: unknown;\n}\n\n/**\n * React Aria radio-group engine with option focus routing and shared descriptions\n *\n * Receives bound values and callbacks, without registering a form field.\n * Its children own the field layout and option presentation.\n *\n * @see https://react-aria.adobe.com/RadioGroup\n */\nconst RadioGroupField = ({\n children,\n className = undefined,\n controlProps,\n dataComponent = undefined,\n disabled = undefined,\n inputRef,\n invalid,\n inline,\n name,\n onBlur,\n onChange,\n readOnly = undefined,\n required,\n testId,\n value,\n}: RadioGroupFieldProps) => {\n const groupRef = useRef<HTMLDivElement>(null);\n\n // focus the selected enabled option, otherwise the first enabled option\n const handleFocus = () => {\n const input =\n groupRef.current?.querySelector<HTMLInputElement>(\n 'input:checked:not(:disabled)',\n ) ??\n groupRef.current?.querySelector<HTMLInputElement>('input:not(:disabled)');\n input?.focus();\n };\n\n // expose option focus through the binding ref\n const setControlRef = (node: HTMLDivElement | null) => {\n groupRef.current = node;\n inputRef(node ? { focus: handleFocus } : null);\n };\n\n // preserve the group's existing state selectors on the actual root\n const renderGroup: NonNullable<RadioGroupProps['render']> = (props) => {\n return (\n <div {...props} data-invalid={invalid} data-required={required}>\n {props.children}\n </div>\n );\n };\n\n return (\n <RadioGroup\n ref={setControlRef}\n aria-describedby={controlProps['aria-describedby']}\n aria-label={controlProps['aria-label']}\n className={className}\n data-component={dataComponent}\n data-invalid={invalid}\n data-required={required}\n data-slot=\"base\"\n data-testid={testId}\n id={controlProps.id}\n isDisabled={disabled}\n isInvalid={invalid}\n isReadOnly={readOnly}\n isRequired={required}\n name={name}\n onBlur={onBlur}\n onChange={onChange}\n orientation={inline ? 'horizontal' : 'vertical'}\n render={renderGroup}\n validationBehavior=\"aria\"\n value={value != null ? String(value) : ''}\n >\n <RadioGroupDescriptionContext.Provider\n value={controlProps['aria-describedby']}\n >\n {children}\n </RadioGroupDescriptionContext.Provider>\n </RadioGroup>\n );\n};\n\nexport default RadioGroupField;\n","import { tv } from '@fuf-stack/pixel-utils';\n\nimport { fieldHelperVariants } from '../FieldHelper/fieldHelperVariants';\nimport { fieldLabelVariants } from '../FieldLabel/fieldLabelVariants';\n\nconst radioGroupFieldVariants = tv({\n // reference slots instead of extending, tv types follow only one extend level\n slots: {\n /** Container grouping the label, options and hints */\n base: 'relative',\n /** Help text below the control */\n description: fieldHelperVariants.slots.description,\n /** Validation message container */\n errorMessage: fieldHelperVariants.slots.errorMessage,\n /** Container for help text and validation messages */\n helperWrapper: fieldHelperVariants.slots.helperWrapper,\n /** Label above the options */\n label: [fieldLabelVariants.base, 'relative inline-flex'],\n /** Container around the selectable options */\n wrapper: '',\n },\n variants: {\n readOnly: {\n true: {\n // inner controls set their own cursors, override every descendant\n base: 'cursor-not-allowed opacity-disabled **:cursor-not-allowed',\n },\n },\n },\n});\n\nexport default radioGroupFieldVariants;\n","import type { ReactNode } from 'react';\nimport type { RadioButtonProps } from 'react-aria-components';\nimport type { RadioControlClassNames } from './radioControlVariants';\n\nimport { useContext, useId } from 'react';\nimport { RadioButton, RadioField } from 'react-aria-components';\n\nimport RadioGroupDescriptionContext from '../../partials/RadioGroupField/RadioGroupDescriptionContext';\n\ninterface RadioControlProps {\n /** Option label */\n children: ReactNode;\n /** CSS class name */\n className: RadioControlClassNames;\n /** Help text associated with the field */\n description?: ReactNode;\n /** Disables the field */\n disabled?: boolean;\n /** Decorative option icon */\n icon?: ReactNode;\n /** Marks visible validation failure */\n invalid: boolean;\n /** HTML data-testid attribute for e2e tests */\n testId?: string;\n /** String value managed by the containing group */\n value: string;\n}\n\n/**\n * React Aria radio option with an indicator, label and optional supporting text\n *\n * Inherits selection and disabled state from its RadioGroup, and supporting\n * message IDs from RadioGroupField when composed inside that engine.\n *\n * @see https://react-aria.adobe.com/RadioGroup\n */\nconst RadioControl = ({\n children,\n className: classNames,\n description = undefined,\n disabled = undefined,\n icon = undefined,\n invalid,\n testId = undefined,\n value,\n}: RadioControlProps) => {\n const id = useId();\n const groupDescription = useContext(RadioGroupDescriptionContext);\n\n const describedBy =\n [groupDescription, description ? `${id}-description` : undefined]\n .filter(Boolean)\n .join(' ') || undefined;\n\n const control = (\n <span aria-hidden className={classNames.wrapper} data-slot=\"wrapper\">\n <span className={classNames.control} data-slot=\"control\" />\n </span>\n );\n\n // preserve option state selectors on the visible label\n const renderOption: NonNullable<RadioButtonProps['render']> = (\n props,\n state,\n ) => {\n return (\n <label\n {...props}\n data-focus={state.isFocused || undefined}\n data-hover={state.isHovered || undefined}\n data-hover-unselected={\n (state.isHovered && !state.isSelected) || undefined\n }\n htmlFor={`${id}-control`}\n >\n {props.children}\n </label>\n );\n };\n\n return (\n <RadioField\n aria-describedby={describedBy}\n aria-labelledby={`${id}-label`}\n className={classNames.field}\n id={`${id}-control`}\n isDisabled={disabled}\n value={value}\n >\n <RadioButton\n className={classNames.base}\n data-invalid={invalid}\n data-slot=\"base\"\n data-testid={testId}\n render={renderOption}\n >\n {!icon ? control : null}\n {icon ? <div className={classNames.icon}>{icon}</div> : null}\n <div className={classNames.labelWrapper} data-slot=\"label-wrapper\">\n <span\n className={classNames.label}\n data-slot=\"label\"\n id={`${id}-label`}\n >\n {children}\n </span>\n {description ? (\n <div\n className={classNames.description}\n data-slot=\"description\"\n id={`${id}-description`}\n >\n {description}\n </div>\n ) : null}\n </div>\n {icon ? control : null}\n </RadioButton>\n </RadioField>\n );\n};\n\nexport default RadioControl;\n","import type { TVClassName } from '@fuf-stack/pixel-utils';\n\nimport { tv } from '@fuf-stack/pixel-utils';\n\nconst radioControlVariants = tv({\n slots: {\n /** Clickable option containing the indicator and label */\n base: [\n // option layout and pointer behavior\n 'group relative -m-2 inline-flex max-w-fit cursor-pointer items-center justify-start p-2 select-none tap-highlight-transparent',\n // disabled cursor and opacity, the native input covers the option\n 'data-[disabled=true]:cursor-not-allowed data-[disabled=true]:opacity-disabled data-[disabled=true]:**:cursor-not-allowed',\n ],\n /** Dot marking the selected option */\n control: [\n // selection dot appearance and animation\n 'z-10 h-2 w-2 origin-center scale-0 rounded-full bg-primary text-primary-foreground opacity-0 transition-transform-opacity',\n // selection and validation states\n 'group-data-[invalid=true]:bg-danger group-data-[invalid=true]:text-danger-foreground group-data-[selected=true]:scale-100 group-data-[selected=true]:opacity-100',\n // reduced motion\n 'motion-reduce:transition-none',\n ],\n /** Supporting text below the option label */\n description:\n 'relative text-small text-foreground-400 transition-colors motion-reduce:transition-none',\n /** Option state boundary without an additional layout box */\n field: 'contents',\n /** Container for a decorative option icon */\n icon: '',\n /** Primary option text */\n label:\n 'relative text-medium text-foreground transition-colors select-none motion-reduce:transition-none',\n /** Container grouping the option label and description */\n labelWrapper: 'ms-2 ml-1 flex flex-col',\n /** Circular outline around the selection indicator */\n wrapper: [\n // indicator dimensions and layout\n 'relative box-border inline-flex h-5 w-5 shrink-0 items-center justify-center overflow-hidden',\n // circular border and transitions\n 'rounded-full border-2 border-solid border-default transition-transform-colors',\n // pressed, selected and invalid states\n 'group-data-[hover-unselected=true]:bg-default-100 group-data-[invalid=true]:border-danger group-data-[pressed=true]:scale-95 group-data-[selected=true]:border-primary group-data-[invalid=true]:group-data-[selected=true]:border-danger',\n // keyboard focus ring\n 'group-data-[focus-visible=true]:ring-2 group-data-[focus-visible=true]:ring-focus group-data-[focus-visible=true]:ring-offset-2 group-data-[focus-visible=true]:ring-offset-background',\n // reduced motion\n 'motion-reduce:transition-none',\n ],\n },\n variants: {\n invalid: {\n true: {\n control: 'bg-danger text-danger-foreground',\n description: 'text-danger-300',\n label: 'text-danger',\n wrapper: 'border-danger group-data-[selected=true]:border-danger',\n },\n },\n },\n});\n\nexport type RadioControlClassNames = Partial<\n Record<keyof ReturnType<typeof radioControlVariants>, string>\n>;\n\nexport type ClassName = TVClassName<typeof radioControlVariants>;\n\nexport default radioControlVariants;\n"],"mappings":";;;;;;;;AAGA,MAAM,+BAA+B,cACnC,KAAA,CACF;;;;;;;;;;ACgDA,MAAM,mBAAmB,EACvB,UACA,YAAY,KAAA,GACZ,cACA,gBAAgB,KAAA,GAChB,WAAW,KAAA,GACX,UACA,SACA,QACA,MACA,QACA,UACA,WAAW,KAAA,GACX,UACA,QACA,YAC0B;CAC1B,MAAM,WAAW,OAAuB,IAAI;CAG5C,MAAM,oBAAoB;EAMxB,CAJE,SAAS,SAAS,cAChB,8BACF,KACA,SAAS,SAAS,cAAgC,sBAAsB,EAAA,EACnE,MAAM;CACf;CAGA,MAAM,iBAAiB,SAAgC;EACrD,SAAS,UAAU;EACnB,SAAS,OAAO,EAAE,OAAO,YAAY,IAAI,IAAI;CAC/C;CAGA,MAAM,eAAuD,UAAU;EACrE,OACE,oBAAC,OAAD;GAAK,GAAI;GAAO,gBAAc;GAAS,iBAAe;GACnD,UAAA,MAAM;EACJ,CAAA;CAET;CAEA,OACE,oBAAC,YAAD;EACE,KAAK;EACL,oBAAkB,aAAa;EAC/B,cAAY,aAAa;EACd;EACX,kBAAgB;EAChB,gBAAc;EACd,iBAAe;EACf,aAAU;EACV,eAAa;EACb,IAAI,aAAa;EACjB,YAAY;EACZ,WAAW;EACX,YAAY;EACZ,YAAY;EACN;EACE;EACE;EACV,aAAa,SAAS,eAAe;EACrC,QAAQ;EACR,oBAAmB;EACnB,OAAO,SAAS,OAAO,OAAO,KAAK,IAAI;EAEvC,UAAA,oBAAC,6BAA6B,UAA9B;GACE,OAAO,aAAa;GAEnB;EACoC,CAAA;CAC7B,CAAA;AAEhB;;AC3HA,MAAM,0BAA0B,GAAG;CAEjC,OAAO;;EAEL,MAAM;;EAEN,aAAa,oBAAoB,MAAM;;EAEvC,cAAc,oBAAoB,MAAM;;EAExC,eAAe,oBAAoB,MAAM;;EAEzC,OAAO,CAAC,mBAAmB,MAAM,sBAAsB;;EAEvD,SAAS;CACX;CACA,UAAU,EACR,UAAU,EACR,MAAM,EAEJ,MAAM,4DACR,EACF,EACF;AACF,CAAC;;;;;;;;;;ACOD,MAAM,gBAAgB,EACpB,UACA,WAAW,YACX,cAAc,KAAA,GACd,WAAW,KAAA,GACX,OAAO,KAAA,GACP,SACA,SAAS,KAAA,GACT,YACuB;CACvB,MAAM,KAAK,MAAM;CAGjB,MAAM,cACJ,CAHuB,WAAW,4BAGlB,GAAG,cAAc,GAAG,GAAG,gBAAgB,KAAA,CAAS,CAAC,CAC9D,OAAO,OAAO,CAAC,CACf,KAAK,GAAG,KAAK,KAAA;CAElB,MAAM,UACJ,oBAAC,QAAD;EAAM,eAAA;EAAY,WAAW,WAAW;EAAS,aAAU;EACzD,UAAA,oBAAC,QAAD;GAAM,WAAW,WAAW;GAAS,aAAU;EAAW,CAAA;CACtD,CAAA;CAIR,MAAM,gBACJ,OACA,UACG;EACH,OACE,oBAAC,SAAD;GACE,GAAI;GACJ,cAAY,MAAM,aAAa,KAAA;GAC/B,cAAY,MAAM,aAAa,KAAA;GAC/B,yBACG,MAAM,aAAa,CAAC,MAAM,cAAe,KAAA;GAE5C,SAAS,GAAG,GAAG;GAEd,UAAA,MAAM;EACF,CAAA;CAEX;CAEA,OACE,oBAAC,YAAD;EACE,oBAAkB;EAClB,mBAAiB,GAAG,GAAG;EACvB,WAAW,WAAW;EACtB,IAAI,GAAG,GAAG;EACV,YAAY;EACL;EAEP,UAAA,qBAAC,aAAD;GACE,WAAW,WAAW;GACtB,gBAAc;GACd,aAAU;GACV,eAAa;GACb,QAAQ;GALV,UAAA;IAOG,CAAC,OAAO,UAAU;IAClB,OAAO,oBAAC,OAAD;KAAK,WAAW,WAAW;KAAO,UAAA;IAAU,CAAA,IAAI;IACxD,qBAAC,OAAD;KAAK,WAAW,WAAW;KAAc,aAAU;KAAnD,UAAA,CACE,oBAAC,QAAD;MACE,WAAW,WAAW;MACtB,aAAU;MACV,IAAI,GAAG,GAAG;MAET;KACG,CAAA,GACL,cACC,oBAAC,OAAD;MACE,WAAW,WAAW;MACtB,aAAU;MACV,IAAI,GAAG,GAAG;MAET,UAAA;KACE,CAAA,IACH,IACD;;IACJ,OAAO,UAAU;GACP;;CACH,CAAA;AAEhB;;ACpHA,MAAM,uBAAuB,GAAG;CAC9B,OAAO;;EAEL,MAAM,CAEJ,iIAEA,0HACF;;EAEA,SAAS;GAEP;GAEA;GAEA;EACF;;EAEA,aACE;;EAEF,OAAO;;EAEP,MAAM;;EAEN,OACE;;EAEF,cAAc;;EAEd,SAAS;GAEP;GAEA;GAEA;GAEA;GAEA;EACF;CACF;CACA,UAAU,EACR,SAAS,EACP,MAAM;EACJ,SAAS;EACT,aAAa;EACb,OAAO;EACP,SAAS;CACX,EACF,EACF;AACF,CAAC"}
|
|
@@ -6,27 +6,27 @@ const switchVariants = tv({
|
|
|
6
6
|
extend: fieldHelperVariants,
|
|
7
7
|
slots: {
|
|
8
8
|
/** Container for the field control and supporting text */
|
|
9
|
-
base: "group relative inline-flex max-w-fit cursor-pointer touch-none
|
|
9
|
+
base: "group relative inline-flex max-w-fit cursor-pointer touch-none items-center justify-start select-none tap-highlight-transparent",
|
|
10
10
|
/** Content at the end of the control */
|
|
11
11
|
endContent: [
|
|
12
|
-
"absolute end-1.5 z-0 text-default-600 opacity-100 transition-transform-opacity
|
|
12
|
+
"absolute end-1.5 z-0 text-small text-default-600 opacity-100 transition-transform-opacity",
|
|
13
13
|
"group-data-[selected=true]:translate-x-3 group-data-[selected=true]:opacity-0",
|
|
14
14
|
"motion-reduce:transition-none"
|
|
15
15
|
],
|
|
16
16
|
/** Visible field label */
|
|
17
|
-
label: [fieldLabelVariants.base, "relative ms-2 cursor-pointer select-none
|
|
17
|
+
label: [fieldLabelVariants.base, "relative ms-2 cursor-pointer pb-0 select-none"],
|
|
18
18
|
/** Container grouping the toggle and field messages */
|
|
19
19
|
outerWrapper: "place-content-center",
|
|
20
20
|
/** Content at the start of the control */
|
|
21
21
|
startContent: [
|
|
22
|
-
"absolute start-1.5 z-0 scale-50 text-current opacity-0 transition-transform-opacity
|
|
22
|
+
"absolute start-1.5 z-0 scale-50 text-small text-current opacity-0 transition-transform-opacity",
|
|
23
23
|
"group-data-[selected=true]:scale-100 group-data-[selected=true]:opacity-100",
|
|
24
24
|
"motion-reduce:transition-none"
|
|
25
25
|
],
|
|
26
26
|
/** Movable indicator showing the current value */
|
|
27
27
|
thumb: [
|
|
28
|
-
"pointer-events-none z-10 flex h-5 w-5 origin-right items-center justify-center rounded-full bg-white shadow-small transition-all
|
|
29
|
-
"group-data-[
|
|
28
|
+
"pointer-events-none z-10 flex h-5 w-5 origin-right items-center justify-center rounded-full bg-white text-small shadow-small transition-all",
|
|
29
|
+
"group-data-[pressed=true]:w-6 group-data-[selected=true]:ms-5 group-data-[selected=true]:group-data-[pressed=true]:ms-4",
|
|
30
30
|
"motion-reduce:transition-none"
|
|
31
31
|
],
|
|
32
32
|
/** Content inside the toggle thumb */
|
|
@@ -44,14 +44,14 @@ const switchVariants = tv({
|
|
|
44
44
|
lg: {
|
|
45
45
|
endContent: "text-medium",
|
|
46
46
|
startContent: "text-medium",
|
|
47
|
-
thumb: "h-6 w-6 text-medium group-data-[
|
|
47
|
+
thumb: "h-6 w-6 text-medium group-data-[pressed=true]:w-7 group-data-[selected=true]:ms-6 group-data-[selected=true]:group-data-[pressed=true]:ms-5",
|
|
48
48
|
wrapper: "h-8 w-14"
|
|
49
49
|
},
|
|
50
50
|
md: {},
|
|
51
51
|
sm: {
|
|
52
52
|
endContent: "text-tiny",
|
|
53
53
|
startContent: "text-tiny",
|
|
54
|
-
thumb: "h-4 w-4 text-tiny group-data-[
|
|
54
|
+
thumb: "h-4 w-4 text-tiny group-data-[pressed=true]:w-5 group-data-[selected=true]:ms-4 group-data-[selected=true]:group-data-[pressed=true]:ms-3",
|
|
55
55
|
wrapper: "h-6 w-10"
|
|
56
56
|
}
|
|
57
57
|
},
|
|
@@ -61,4 +61,4 @@ const switchVariants = tv({
|
|
|
61
61
|
});
|
|
62
62
|
export { switchVariants as t };
|
|
63
63
|
|
|
64
|
-
//# sourceMappingURL=switchVariants-
|
|
64
|
+
//# sourceMappingURL=switchVariants-B8dq8DYP.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"switchVariants-
|
|
1
|
+
{"version":3,"file":"switchVariants-B8dq8DYP.mjs","names":[],"sources":["../src/Switch/switchVariants.ts"],"sourcesContent":["import type { TVClassName, TVProps } from '@fuf-stack/pixel-utils';\n\nimport { tv } from '@fuf-stack/pixel-utils';\n\nimport { fieldHelperVariants } from '../partials/FieldHelper/fieldHelperVariants';\nimport { fieldLabelVariants } from '../partials/FieldLabel/fieldLabelVariants';\n\nexport const switchVariants = tv({\n extend: fieldHelperVariants,\n slots: {\n /** Container for the field control and supporting text */\n base: 'group relative inline-flex max-w-fit cursor-pointer touch-none items-center justify-start select-none tap-highlight-transparent',\n /** Content at the end of the control */\n endContent: [\n // end icon position and fade transition\n 'absolute end-1.5 z-0 text-small text-default-600 opacity-100 transition-transform-opacity',\n // move and hide the selected end icon\n 'group-data-[selected=true]:translate-x-3 group-data-[selected=true]:opacity-0',\n // reduced motion\n 'motion-reduce:transition-none',\n ],\n /** Visible field label */\n label: [\n fieldLabelVariants.base,\n // beside the control, without the spacing below a stacked label\n 'relative ms-2 cursor-pointer pb-0 select-none',\n ],\n /** Container grouping the toggle and field messages */\n outerWrapper: 'place-content-center',\n /** Content at the start of the control */\n startContent: [\n // start icon position and fade transition\n 'absolute start-1.5 z-0 scale-50 text-small text-current opacity-0 transition-transform-opacity',\n // reveal the selected start icon\n 'group-data-[selected=true]:scale-100 group-data-[selected=true]:opacity-100',\n // reduced motion\n 'motion-reduce:transition-none',\n ],\n /** Movable indicator showing the current value */\n thumb: [\n // thumb layout and surface\n 'pointer-events-none z-10 flex h-5 w-5 origin-right items-center justify-center rounded-full bg-white text-small shadow-small transition-all',\n // selected position and pressed width\n 'group-data-[pressed=true]:w-6 group-data-[selected=true]:ms-5 group-data-[selected=true]:group-data-[pressed=true]:ms-4',\n // reduced motion\n 'motion-reduce:transition-none',\n ],\n /** Content inside the toggle thumb */\n thumbIcon: 'text-black',\n /** Container arranging the selectable content */\n wrapper: [\n // switch track layout and surface\n 'relative inline-flex h-7 w-12 shrink-0 items-center justify-start overflow-hidden rounded-full bg-default-200 px-1 transition-background',\n // selected track colors\n 'group-data-[selected=true]:bg-primary group-data-[selected=true]:text-primary-foreground',\n // keyboard focus ring\n 'group-data-[focus-visible=true]:ring-2 group-data-[focus-visible=true]:ring-focus group-data-[focus-visible=true]:ring-offset-2 group-data-[focus-visible=true]:ring-offset-background',\n // reduced motion\n 'motion-reduce:transition-none',\n ],\n },\n variants: {\n size: {\n lg: {\n endContent: 'text-medium',\n startContent: 'text-medium',\n thumb:\n 'h-6 w-6 text-medium group-data-[pressed=true]:w-7 group-data-[selected=true]:ms-6 group-data-[selected=true]:group-data-[pressed=true]:ms-5',\n wrapper: 'h-8 w-14',\n },\n md: {},\n sm: {\n endContent: 'text-tiny',\n startContent: 'text-tiny',\n thumb:\n 'h-4 w-4 text-tiny group-data-[pressed=true]:w-5 group-data-[selected=true]:ms-4 group-data-[selected=true]:group-data-[pressed=true]:ms-3',\n wrapper: 'h-6 w-10',\n },\n },\n disabled: { true: { base: 'pointer-events-none opacity-disabled' } },\n readOnly: {\n true: {\n // inner controls set their own cursors, override every descendant\n base: 'cursor-not-allowed opacity-disabled **:cursor-not-allowed',\n },\n },\n },\n});\n\nexport type VariantProps = TVProps<typeof switchVariants>;\n\nexport type ClassName = TVClassName<typeof switchVariants>;\n"],"mappings":";;;;AAOA,MAAa,iBAAiB,GAAG;CAC/B,QAAQ;CACR,OAAO;;EAEL,MAAM;;EAEN,YAAY;GAEV;GAEA;GAEA;EACF;;EAEA,OAAO,CACL,mBAAmB,MAEnB,+CACF;;EAEA,cAAc;;EAEd,cAAc;GAEZ;GAEA;GAEA;EACF;;EAEA,OAAO;GAEL;GAEA;GAEA;EACF;;EAEA,WAAW;;EAEX,SAAS;GAEP;GAEA;GAEA;GAEA;EACF;CACF;CACA,UAAU;EACR,MAAM;GACJ,IAAI;IACF,YAAY;IACZ,cAAc;IACd,OACE;IACF,SAAS;GACX;GACA,IAAI,CAAC;GACL,IAAI;IACF,YAAY;IACZ,cAAc;IACd,OACE;IACF,SAAS;GACX;EACF;EACA,UAAU,EAAE,MAAM,EAAE,MAAM,uCAAuC,EAAE;EACnE,UAAU,EACR,MAAM,EAEJ,MAAM,4DACR,EACF;CACF;AACF,CAAC"}
|
|
@@ -15,10 +15,10 @@ const segmentedInputVariants = tv({ slots: {
|
|
|
15
15
|
/** Row containing segments and optional controls */
|
|
16
16
|
innerWrapper: "flex h-6 w-full items-center gap-x-2 text-default-400",
|
|
17
17
|
/** Editable date or time segment group */
|
|
18
|
-
input: "flex h-full w-full gap-x-0.5 font-normal
|
|
18
|
+
input: "flex h-full w-full gap-x-0.5 text-small font-normal",
|
|
19
19
|
/** Bordered surface around the editable segments */
|
|
20
20
|
inputWrapper: [
|
|
21
|
-
"
|
|
21
|
+
"relative inline-flex h-10 min-h-10 w-full cursor-text flex-row items-center gap-3 shadow-xs",
|
|
22
22
|
"rounded-small border-2 border-default-200 px-3",
|
|
23
23
|
"transition-colors duration-150",
|
|
24
24
|
"hover:border-default-400 focus-within:hover:border-default-foreground",
|
|
@@ -30,10 +30,10 @@ const segmentedInputVariants = tv({ slots: {
|
|
|
30
30
|
/** Individual editable value or separator */
|
|
31
31
|
segment: [
|
|
32
32
|
"outline-solid focus:shadow-xs",
|
|
33
|
-
"group my-auto box-content inline-block rounded-md px-0.5 text-start
|
|
33
|
+
"group my-auto box-content inline-block rounded-md px-0.5 text-start text-foreground-500 tabular-nums outline-transparent",
|
|
34
34
|
"transition-colors",
|
|
35
35
|
"first:-ml-0.5 focus:bg-default-400/50",
|
|
36
|
-
"data-[editable=true]:data-[
|
|
36
|
+
"data-[editable=true]:text-foreground data-[editable=true]:focus:text-default-foreground data-[editable=true]:data-[placeholder=true]:text-foreground-500",
|
|
37
37
|
"motion-reduce:transition-none",
|
|
38
38
|
"[&:not(:first-child)]:-ml-1"
|
|
39
39
|
]
|
|
@@ -49,7 +49,7 @@ const timeVariants = tv({
|
|
|
49
49
|
label: "text-danger",
|
|
50
50
|
segment: [
|
|
51
51
|
"text-danger-300 focus:bg-danger-400/50",
|
|
52
|
-
"data-[editable=true]:data-[
|
|
52
|
+
"data-[editable=true]:text-danger data-[editable=true]:focus:text-danger data-[editable=true]:data-[placeholder=true]:text-danger",
|
|
53
53
|
"dark:focus:bg-danger-400/20"
|
|
54
54
|
]
|
|
55
55
|
} }
|
|
@@ -57,4 +57,4 @@ const timeVariants = tv({
|
|
|
57
57
|
});
|
|
58
58
|
export { timeVariants as n, segmentedInputVariants as t };
|
|
59
59
|
|
|
60
|
-
//# sourceMappingURL=timeVariants-
|
|
60
|
+
//# sourceMappingURL=timeVariants-CIX6R59-.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"timeVariants-
|
|
1
|
+
{"version":3,"file":"timeVariants-CIX6R59-.mjs","names":[],"sources":["../src/Time/timeVariants.ts"],"sourcesContent":["import type { TVClassName, TVProps } from '@fuf-stack/pixel-utils';\n\nimport { tv } from '@fuf-stack/pixel-utils';\n\nimport { fieldHelperVariants } from '../partials/FieldHelper/fieldHelperVariants';\nimport { fieldLabelVariants } from '../partials/FieldLabel/fieldLabelVariants';\n\n/** Shared segmented input defaults, also extended by DatePicker */\nexport const segmentedInputVariants = tv({\n // reference slots instead of extending, tv types follow only one extend level\n slots: {\n /** Field container */\n base: 'group flex w-full flex-col',\n /** Help text below the control */\n description: fieldHelperVariants.slots.description,\n /** Validation message container */\n errorMessage: fieldHelperVariants.slots.errorMessage,\n /** Container for help text and validation messages */\n helperWrapper: fieldHelperVariants.slots.helperWrapper,\n /** Row containing segments and optional controls */\n innerWrapper: 'flex h-6 w-full items-center gap-x-2 text-default-400',\n /** Editable date or time segment group */\n input: 'flex h-full w-full gap-x-0.5 text-small font-normal',\n /** Bordered surface around the editable segments */\n inputWrapper: [\n // segmented control frame and layout\n 'relative inline-flex h-10 min-h-10 w-full cursor-text flex-row items-center gap-3 shadow-xs',\n // border and padding\n 'rounded-small border-2 border-default-200 px-3',\n // color transitions\n 'transition-colors duration-150',\n // hover and focus borders\n 'hover:border-default-400 focus-within:hover:border-default-foreground',\n // reduced motion\n 'motion-reduce:transition-none',\n // surface color and focused border\n 'bg-content1 focus-within:border-focus',\n ],\n /** Label above the segmented input */\n label: [fieldLabelVariants.base, 'block w-full'],\n /** Individual editable value or separator */\n segment: [\n // segment focus outline and shadow\n 'outline-solid focus:shadow-xs',\n // segment spacing and typography\n 'group my-auto box-content inline-block rounded-md px-0.5 text-start text-foreground-500 tabular-nums outline-transparent',\n // color transition\n 'transition-colors',\n // first segment alignment and focus background\n 'first:-ml-0.5 focus:bg-default-400/50',\n // editable values and empty placeholders\n 'data-[editable=true]:text-foreground data-[editable=true]:focus:text-default-foreground data-[editable=true]:data-[placeholder=true]:text-foreground-500',\n // reduced motion\n 'motion-reduce:transition-none',\n // spacing between subsequent segments\n '[&:not(:first-child)]:-ml-1',\n ],\n },\n});\n\nexport const timeVariants = tv({\n extend: segmentedInputVariants,\n variants: {\n disabled: { true: { base: 'pointer-events-none opacity-disabled' } },\n readOnly: {\n true: {\n // inner controls set their own cursors, override every descendant\n base: 'cursor-not-allowed opacity-disabled **:cursor-not-allowed',\n },\n },\n invalid: {\n true: {\n innerWrapper: 'text-danger',\n inputWrapper:\n 'border-danger focus-within:border-danger hover:border-danger focus-within:hover:border-danger',\n label: 'text-danger',\n segment: [\n // invalid text and focus background\n 'text-danger-300 focus:bg-danger-400/50',\n // editable values and empty placeholders\n 'data-[editable=true]:text-danger data-[editable=true]:focus:text-danger data-[editable=true]:data-[placeholder=true]:text-danger',\n // dark theme focus background\n 'dark:focus:bg-danger-400/20',\n ],\n },\n },\n },\n});\n\nexport type VariantProps = TVProps<typeof timeVariants>;\n\nexport type ClassName = TVClassName<typeof timeVariants>;\n\n/** Resolved class names for the segmented time slots */\nexport type TimeClassNames = Record<\n keyof ReturnType<typeof timeVariants>,\n string\n>;\n"],"mappings":";;;;;AAQA,MAAa,yBAAyB,GAAG,EAEvC,OAAO;;CAEL,MAAM;;CAEN,aAAa,oBAAoB,MAAM;;CAEvC,cAAc,oBAAoB,MAAM;;CAExC,eAAe,oBAAoB,MAAM;;CAEzC,cAAc;;CAEd,OAAO;;CAEP,cAAc;EAEZ;EAEA;EAEA;EAEA;EAEA;EAEA;CACF;;CAEA,OAAO,CAAC,mBAAmB,MAAM,cAAc;;CAE/C,SAAS;EAEP;EAEA;EAEA;EAEA;EAEA;EAEA;EAEA;CACF;AACF,EACF,CAAC;AAED,MAAa,eAAe,GAAG;CAC7B,QAAQ;CACR,UAAU;EACR,UAAU,EAAE,MAAM,EAAE,MAAM,uCAAuC,EAAE;EACnE,UAAU,EACR,MAAM,EAEJ,MAAM,4DACR,EACF;EACA,SAAS,EACP,MAAM;GACJ,cAAc;GACd,cACE;GACF,OAAO;GACP,SAAS;IAEP;IAEA;IAEA;GACF;EACF,EACF;CACF;AACF,CAAC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { n as UniformContext } from "./FormContext-
|
|
1
|
+
import { n as UniformContext } from "./FormContext-CVq3glVW.mjs";
|
|
2
2
|
import { fromNullishString, toNullishString } from "./helpers/index.mjs";
|
|
3
3
|
import { useContext } from "react";
|
|
4
|
-
import { useController } from "react-hook-form";
|
|
4
|
+
import { useController as useController$1 } from "react-hook-form";
|
|
5
5
|
// src/hooks/useController/useController.ts
|
|
6
6
|
/**
|
|
7
7
|
* A wrapper around react-hook-form's useController that transparently handles nullish string conversions.
|
|
@@ -20,8 +20,8 @@ import { useController } from "react-hook-form";
|
|
|
20
20
|
*
|
|
21
21
|
* @see https://react-hook-form.com/docs/usecontroller
|
|
22
22
|
*/
|
|
23
|
-
const useController
|
|
24
|
-
const { field, formState, fieldState } = useController(props);
|
|
23
|
+
const useController = (props) => {
|
|
24
|
+
const { field, formState, fieldState } = useController$1(props);
|
|
25
25
|
const { userChange } = useContext(UniformContext);
|
|
26
26
|
return {
|
|
27
27
|
field: {
|
|
@@ -39,6 +39,6 @@ const useController$1 = (props) => {
|
|
|
39
39
|
fieldState
|
|
40
40
|
};
|
|
41
41
|
};
|
|
42
|
-
export { useController
|
|
42
|
+
export { useController as t };
|
|
43
43
|
|
|
44
|
-
//# sourceMappingURL=useController-
|
|
44
|
+
//# sourceMappingURL=useController-SEAuP3G4.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useController-SEAuP3G4.mjs","names":["useRHFController"],"sources":["../src/hooks/useController/useController.ts"],"sourcesContent":["import type {\n ControllerFieldState,\n ControllerRenderProps,\n UseControllerProps as RHFUseControllerProps,\n UseFormStateReturn,\n} from 'react-hook-form';\n\nimport { useContext } from 'react';\nimport { useController as useRHFController } from 'react-hook-form';\n\nimport { UniformContext } from '../../Form/subcomponents/FormContext';\nimport { fromNullishString, toNullishString } from '../../helpers';\n\nexport type UseControllerProps<TFieldValues extends object = object> =\n RHFUseControllerProps<TFieldValues>;\n\nexport interface 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 fieldState: ControllerFieldState;\n formState: UseFormStateReturn<TFieldValues>;\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 * 5. Notifies UniformContext's userChange listeners on field changes (enables useWatchUserChange hook)\n * 6. No-op when value unchanged: onChange is ignored if the new value equals the current value\n * (prevents unnecessary re-renders and spurious useWatchUserChange triggers)\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 const { userChange } = useContext(UniformContext);\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 const formattedValue = value === '' ? '' : toNullishString(value);\n\n // Skip if value hasn't changed (e.g., user re-selects same option)\n // We compare formattedValue (the new value after nullish conversion) with\n // field.value (the current stored value, also in nullish format)\n if (formattedValue === field.value) {\n return;\n }\n\n // Update form state first\n field.onChange(formattedValue);\n\n // Then notify userChange listeners (for useWatchUserChange hook)\n // This ensures getValues() in listeners returns the updated value\n // Guard against undefined userChange (when used outside FormProvider)\n // NOTE: We notify with the original value (not formattedValue) so that\n // listeners receive the actual value (false, 0, null) instead of marker\n // strings like '__FALSE__', '__ZERO__', '__NULL__'\n userChange?.notify(field.name, 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"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AA4CA,MAAa,iBACX,UACsC;CACtC,MAAM,EAAE,OAAO,WAAW,eAAeA,gBAAiB,KAAK;CAC/D,MAAM,EAAE,eAAe,WAAW,cAAc;CAEhD,OAAO;EACL,OAAO;GACL,GAAG;GAGH,WAAW,GAAG,UAAiB;IAC7B,MAAM,QAAQ,MAAM,EAAE,EAAE,QAAQ,SAAS,MAAM;IAC/C,MAAM,iBAAiB,UAAU,KAAK,KAAK,gBAAgB,KAAK;IAKhE,IAAI,mBAAmB,MAAM,OAC3B;IAIF,MAAM,SAAS,cAAc;IAQ7B,YAAY,OAAO,MAAM,MAAM,KAAK;GACtC;GAEA,OAAO,kBAAkB,MAAM,KAAK;EACtC;EACA;EACA;CACF;AACF"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { n as UniformContext } from "./FormContext-
|
|
1
|
+
import { n as UniformContext } from "./FormContext-CVq3glVW.mjs";
|
|
2
2
|
import { flatArrayKey, nameToTestId, toValidationFormat } from "./helpers/index.mjs";
|
|
3
3
|
import { useContext } from "react";
|
|
4
|
-
import { useFormContext } from "react-hook-form";
|
|
4
|
+
import { get, useFormContext as useFormContext$1 } from "react-hook-form";
|
|
5
5
|
// src/hooks/useFormContext/useFormContext.ts
|
|
6
6
|
/** Schema check whether a field is required or optional */
|
|
7
7
|
const checkFieldIsRequired = (validation, path) => {
|
|
@@ -48,8 +48,8 @@ const getValidationErrorsByName = (errors, name) => {
|
|
|
48
48
|
* - Converts nullish string markers (`__NULL__` → `null`, `__FALSE__` → `false`, `__ZERO__` → `0`)
|
|
49
49
|
* - Filters out empty/null values
|
|
50
50
|
*/
|
|
51
|
-
const useFormContext
|
|
52
|
-
const { formState,
|
|
51
|
+
const useFormContext = () => {
|
|
52
|
+
const { formState, getValues: getValuesOrig, watch: watchOrig, subscribe: subscribeOrig, reset: resetOrig, ...otherMethods } = useFormContext$1();
|
|
53
53
|
const uniformContext = useContext(UniformContext);
|
|
54
54
|
/**
|
|
55
55
|
* Wrap react-hook-form's `reset` so the uniform context is notified about
|
|
@@ -76,11 +76,15 @@ const useFormContext$1 = () => {
|
|
|
76
76
|
const required = validationInstance ? checkFieldIsRequired(validationInstance, fieldPath) : false;
|
|
77
77
|
const error = getValidationErrorsByName(uniformContext?.validation.errors ?? {}, name);
|
|
78
78
|
return {
|
|
79
|
-
...getFieldStateOrig(name, formState),
|
|
80
79
|
error,
|
|
81
80
|
invalid: !!error,
|
|
81
|
+
isDirty: !!get(formState.dirtyFields, name),
|
|
82
|
+
isTouched: !!get(formState.touchedFields, name),
|
|
82
83
|
required,
|
|
83
|
-
testId: nameToTestId(testId ?? name)
|
|
84
|
+
testId: nameToTestId(testId ?? name),
|
|
85
|
+
get isValidating() {
|
|
86
|
+
return !!get(formState.validatingFields, name);
|
|
87
|
+
}
|
|
84
88
|
};
|
|
85
89
|
};
|
|
86
90
|
/**
|
|
@@ -131,6 +135,6 @@ const useFormContext$1 = () => {
|
|
|
131
135
|
watch
|
|
132
136
|
};
|
|
133
137
|
};
|
|
134
|
-
export { useFormContext
|
|
138
|
+
export { useFormContext as n, checkFieldIsRequired as t };
|
|
135
139
|
|
|
136
|
-
//# sourceMappingURL=useFormContext-
|
|
140
|
+
//# sourceMappingURL=useFormContext-CQzJhAU4.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useFormContext-CQzJhAU4.mjs","names":["useHookFormContext"],"sources":["../src/hooks/useFormContext/useFormContext.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\n\nimport type { VetoFormattedError, VetoInstance } from '@fuf-stack/veto';\nimport type { ContextType } from 'react';\nimport type {\n FieldError,\n FieldValues,\n Path,\n UseFormReturn,\n} from 'react-hook-form';\n\nimport { useContext } from 'react';\nimport { get, useFormContext as useHookFormContext } from 'react-hook-form';\n\nimport { UniformContext } from '../../Form/subcomponents/FormContext';\nimport { flatArrayKey, nameToTestId, 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 // Handle flat array paths: strip the flatArrayKey to check the array element schema\n // e.g., ['arrayField', '0', '__FLAT__'] -> check schema at ['arrayField', '0']\n const checkPath =\n path[path.length - 1] === flatArrayKey ? path.slice(0, -1) : path;\n\n const checkRequired = (schema: any) => {\n // arrays ...\n if (schema.type === 'array') {\n // ... if array is optional or nullable it is not required\n if (schema.isOptional || schema.isNullable) {\n return false;\n }\n // ... otherwise arrays are required (display logic wise -> no asterisk in the label)\n return true;\n }\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, checkPath);\n};\n\n/**\n * Resolve validation errors for a given field path.\n *\n * Traverses a nested `VetoFormattedError` structure using a dotted path\n * (for example: \"user.address.0.street\") and returns the matching\n * `FieldError[]` if present. If no error exists at the path, returns\n * `undefined`.\n *\n * @param errors - The formatted validation errors from Uniform's context\n * @param name - The dotted field path to resolve\n * @returns An array of `FieldError` entries for the field, or `undefined`\n */\nconst getValidationErrorsByName = (\n errors: VetoFormattedError,\n name: string,\n) => {\n // Traverse nested error structure; ignore flat array wrapper key\n const keys = name.split('.').filter((k) => {\n return k !== flatArrayKey;\n });\n let current: unknown = errors;\n keys.forEach((key) => {\n if (current && typeof current === 'object') {\n current = (current as Record<string, unknown>)[key];\n } else {\n current = undefined;\n }\n });\n return current as FieldError[] | undefined;\n};\n\n/** Field state returned by the enhanced `getFieldState` */\nexport interface UniformFieldState {\n /** Validation errors for the field from the Uniform validation schema */\n error: FieldError[] | undefined;\n /** Whether the field has validation errors */\n invalid: boolean;\n /** Whether the field value differs from its default value */\n isDirty: boolean;\n /** Whether the field has been touched */\n isTouched: boolean;\n /** Whether the field is currently being validated */\n isValidating: boolean;\n /** Whether the validation schema requires the field */\n required: boolean;\n /** Generated HTML data-testid for the field */\n testId: string;\n}\n\n/**\n * Return type of `useFormContext`.\n *\n * Declared explicitly so the published declarations only reference types that\n * react-hook-form exports from its package root.\n */\nexport type UseFormContextReturn<\n TFieldValues extends FieldValues = FieldValues,\n TContext = any,\n TTransformedValues = TFieldValues,\n> = Omit<\n UseFormReturn<TFieldValues, TContext, TTransformedValues>,\n 'getFieldState'\n> &\n ContextType<typeof UniformContext> & {\n getFieldState: (\n name: Path<TFieldValues>,\n testId?: string,\n ) => UniformFieldState;\n };\n\n/**\n * Custom hook that extends react-hook-form's useFormContext to add validation and state management.\n *\n * Key features:\n * - Enhanced `getFieldState` that includes validation schema-based \"required\" status and testId generation\n * - Automatic conversion of form values via `getValues`, `watch`, and `subscribe`:\n * - Unwraps flat array wrappers (`{ __FLAT__: value }` → `value`)\n * - Converts nullish string markers (`__NULL__` → `null`, `__FALSE__` → `false`, `__ZERO__` → `0`)\n * - Filters out empty/null values\n */\nexport const useFormContext = <\n TFieldValues extends FieldValues = FieldValues,\n TContext = any,\n TTransformedValues = TFieldValues,\n>(): UseFormContextReturn<TFieldValues, TContext, TTransformedValues> => {\n const {\n formState,\n // some methods that will be enhanced below\n getValues: getValuesOrig,\n watch: watchOrig,\n subscribe: subscribeOrig,\n reset: resetOrig,\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 * Wrap react-hook-form's `reset` so the uniform context is notified about\n * programmatic resets. Field components (e.g. FieldArray) use this signal to\n * normalize their state on reset instead of inferring it from field contents.\n */\n const notifyReset = uniformContext?.formReset?.notify;\n const reset = ((...args: Parameters<typeof resetOrig>) => {\n resetOrig(...args);\n notifyReset?.();\n }) as typeof resetOrig;\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 * - A testId generated from the field name (with flat array keys removed and slugified)\n *\n * @param name - The field path (string or array)\n * @param testId - Optional explicit testId. If provided, will be slugified. If not provided, generated from name.\n */\n const getFieldState = (\n name: Path<TFieldValues>,\n testId?: string,\n ): UniformFieldState => {\n const fieldPath =\n typeof name === 'string' ? name.replace(/\\[\\d+\\]/g, '').split('.') : name;\n\n // Use base validation instance for checking \"required\" status\n // Client validation often uses .nullish() which would incorrectly mark fields as optional\n const validationInstance =\n uniformContext?.validation.baseInstance ??\n uniformContext?.validation.instance;\n\n // Check if the field is required using the validation schema\n const required = validationInstance\n ? checkFieldIsRequired(validationInstance, fieldPath)\n : false;\n\n const error = getValidationErrorsByName(\n uniformContext?.validation.errors ?? {},\n name,\n );\n\n return {\n error,\n invalid: !!error,\n isDirty: !!get(formState.dirtyFields, name),\n isTouched: !!get(formState.touchedFields, name),\n required,\n testId: nameToTestId(testId ?? name),\n // Read lazily like React Hook Form's useController: reading\n // validatingFields subscribes to it, and React Hook Form then updates\n // the form while a field renders when its disabled state changes.\n get isValidating() {\n return !!get(formState.validatingFields, name);\n },\n };\n };\n\n /**\n * Wrap form value accessor methods to automatically convert from internal storage format\n * to component-friendly format:\n *\n * - Unwrap flat array wrappers: `{ __FLAT__: value }` → `value`\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 or flat array wrapping 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 // eslint-disable-next-line @typescript-eslint/no-unsafe-return\n return originalCallback(convertedFormState);\n },\n };\n return subscribeOrig(wrappedOptions);\n }\n // eslint-disable-next-line @typescript-eslint/no-unsafe-return\n return (subscribeOrig as any)(...args);\n }) as typeof subscribeOrig;\n\n return {\n ...otherMethods,\n ...uniformContext,\n formState,\n getFieldState,\n getValues,\n reset,\n subscribe,\n watch,\n };\n};\n"],"mappings":";;;;;;AAkBA,MAAa,wBACX,YACA,SACY;CAGZ,MAAM,YACJ,KAAK,KAAK,SAAS,OAAA,aAAsB,KAAK,MAAM,GAAG,EAAE,IAAI;CAE/D,MAAM,iBAAiB,WAAgB;EAErC,IAAI,OAAO,SAAS,SAAS;GAE3B,IAAI,OAAO,cAAc,OAAO,YAC9B,OAAO;GAGT,OAAO;EACT;EAIA,OAAO,CAAC,OAAO,cAAc,CAAC,OAAO;CACvC;CAEA,OAAO,WAAW,gBAAgB,eAAe,SAAS;AAC5D;;;;;;;;;;;;;AAcA,MAAM,6BACJ,QACA,SACG;CAEH,MAAM,OAAO,KAAK,MAAM,GAAG,CAAC,CAAC,QAAQ,MAAM;EACzC,OAAO,MAAM;CACf,CAAC;CACD,IAAI,UAAmB;CACvB,KAAK,SAAS,QAAQ;EACpB,IAAI,WAAW,OAAO,YAAY,UAChC,UAAW,QAAoC;OAE/C,UAAU,KAAA;CAEd,CAAC;CACD,OAAO;AACT;;;;;;;;;;;AAmDA,MAAa,uBAI4D;CACvE,MAAM,EACJ,WAEA,WAAW,eACX,OAAO,WACP,WAAW,eACX,OAAO,WAEP,GAAG,iBACDA,iBAA+D;CAEnE,MAAM,iBAAiB,WAAW,cAAc;;;;;;CAOhD,MAAM,cAAc,gBAAgB,WAAW;CAC/C,MAAM,UAAU,GAAG,SAAuC;EACxD,UAAU,GAAG,IAAI;EACjB,cAAc;CAChB;;;;;;;;;;CAWA,MAAM,iBACJ,MACA,WACsB;EACtB,MAAM,YACJ,OAAO,SAAS,WAAW,KAAK,QAAQ,YAAY,EAAE,CAAC,CAAC,MAAM,GAAG,IAAI;EAIvE,MAAM,qBACJ,gBAAgB,WAAW,gBAC3B,gBAAgB,WAAW;EAG7B,MAAM,WAAW,qBACb,qBAAqB,oBAAoB,SAAS,IAClD;EAEJ,MAAM,QAAQ,0BACZ,gBAAgB,WAAW,UAAU,CAAC,GACtC,IACF;EAEA,OAAO;GACL;GACA,SAAS,CAAC,CAAC;GACX,SAAS,CAAC,CAAC,IAAI,UAAU,aAAa,IAAI;GAC1C,WAAW,CAAC,CAAC,IAAI,UAAU,eAAe,IAAI;GAC9C;GACA,QAAQ,aAAa,UAAU,IAAI;GAInC,IAAI,eAAe;IACjB,OAAO,CAAC,CAAC,IAAI,UAAU,kBAAkB,IAAI;GAC/C;EACF;CACF;;;;;;;;;;;;CAaA,MAAM,cAAc,GAAG,SAAgB;EACrC,MAAM,SAAU,cAAsB,GAAG,IAAI;EAC7C,OAAO,mBAAmB,MAAM;CAClC;CAEA,MAAM,UAAU,GAAG,SAAgB;EACjC,MAAM,SAAU,UAAkB,GAAG,IAAI;EACzC,OAAO,mBAAmB,MAAM;CAClC;CAEA,MAAM,cAAc,GAAG,SAAgB;EAErC,MAAM,CAAC,WAAW;EAClB,IAAI,SAAS,UAAU;GACrB,MAAM,mBAAmB,QAAQ;GACjC,MAAM,iBAAiB;IACrB,GAAG;IACH,WAAW,uBAA4B;KAErC,MAAM,qBAAqB;MACzB,GAAG;MACH,GAAI,mBAAmB,UAAU,EAC/B,QAAQ,mBAAmB,mBAAmB,MAAM,EACtD;KACF;KAEA,OAAO,iBAAiB,kBAAkB;IAC5C;GACF;GACA,OAAO,cAAc,cAAc;EACrC;EAEA,OAAQ,cAAsB,GAAG,IAAI;CACvC;CAEA,OAAO;EACL,GAAG;EACH,GAAG;EACH;EACA;EACA;EACA;EACA;EACA;CACF;AACF"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { a as useSensitiveField } from "./FormContext-
|
|
1
|
+
import { a as useSensitiveField } from "./FormContext-CVq3glVW.mjs";
|
|
2
2
|
import { flattenFieldErrors, isValueEmpty } from "./helpers/index.mjs";
|
|
3
3
|
import { t as FieldCopyTestIdButton_default } from "./FieldCopyTestIdButton-D3_jZYJ1.mjs";
|
|
4
4
|
import { t as FieldValidationError_default } from "./FieldValidationError-BuLvuRyi.mjs";
|
|
5
|
-
import { t as useController } from "./useController-
|
|
6
|
-
import { n as useFormContext } from "./useFormContext-
|
|
5
|
+
import { t as useController } from "./useController-SEAuP3G4.mjs";
|
|
6
|
+
import { n as useFormContext } from "./useFormContext-CQzJhAU4.mjs";
|
|
7
7
|
import { t as useInputValueTransform } from "./useInputValueTransform-CXWWFhy_.mjs";
|
|
8
8
|
import React from "react";
|
|
9
9
|
import { useDebounce } from "@fuf-stack/pixels";
|
|
@@ -100,4 +100,4 @@ const useUniformField = (params) => {
|
|
|
100
100
|
};
|
|
101
101
|
export { useUniformField as t };
|
|
102
102
|
|
|
103
|
-
//# sourceMappingURL=useUniformField-
|
|
103
|
+
//# sourceMappingURL=useUniformField-BvPoQyLL.mjs.map
|