@fuf-stack/uniform 1.19.5 → 1.20.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Checkboxes/index.d.cts +2 -2
- package/dist/Checkboxes/index.d.ts +2 -2
- package/dist/Checkboxes-D1hppxDE.js.map +1 -1
- package/dist/Checkboxes-DegQ22uN.cjs.map +1 -1
- package/dist/FieldArray/index.d.cts +2 -2
- package/dist/FieldArray/index.d.ts +2 -2
- package/dist/FieldArray-BVlqxHnR.cjs.map +1 -1
- package/dist/FieldArray-CcQ-Re3s.js.map +1 -1
- package/dist/FieldCard/index.d.cts +2 -2
- package/dist/FieldCard/index.d.ts +2 -2
- package/dist/FieldCard-Bkp8PHJw.cjs.map +1 -1
- package/dist/FieldCard-DynQT-O7.js.map +1 -1
- package/dist/FieldCopyTestIdButton-Dpmo0uBV.js.map +1 -1
- package/dist/FieldCopyTestIdButton-DrUzXwTo.cjs.map +1 -1
- package/dist/FieldValidationError-8H8LxDjk.cjs.map +1 -1
- package/dist/FieldValidationError-ktTyyyip.js.map +1 -1
- package/dist/Form/index.d.cts +2 -2
- package/dist/Form/index.d.ts +2 -2
- package/dist/Form-Dqa1b7Y7.cjs.map +1 -1
- package/dist/Form-Wzy7pBVt.js.map +1 -1
- package/dist/{FormContext-BuG3xZFe.d.cts → FormContext-1zBxAjr_.d.cts} +1 -1
- package/dist/FormContext-1zBxAjr_.d.cts.map +1 -0
- package/dist/FormContext-BrY1FQYR.cjs.map +1 -1
- package/dist/FormContext-CLfMWHQM.js.map +1 -1
- package/dist/{FormContext-B4KQxdl7.d.ts → FormContext-DjXw7wN6.d.ts} +1 -1
- package/dist/FormContext-DjXw7wN6.d.ts.map +1 -0
- package/dist/Grid/index.d.cts +2 -2
- package/dist/Grid/index.d.ts +2 -2
- package/dist/Grid-Bzyi97Cx.js.map +1 -1
- package/dist/Grid-DdYQQ_UM.cjs.map +1 -1
- package/dist/Input/index.d.cts +2 -2
- package/dist/Input/index.d.ts +2 -2
- package/dist/Input-BrwUwIYg.cjs.map +1 -1
- package/dist/Input-fZn0x5c3.js.map +1 -1
- package/dist/RadioBoxes/index.d.cts +2 -2
- package/dist/RadioBoxes/index.d.ts +2 -2
- package/dist/RadioBoxes-BR3X986V.js.map +1 -1
- package/dist/RadioBoxes-Cim3InDW.cjs.map +1 -1
- package/dist/RadioTabs/index.d.cts +2 -2
- package/dist/RadioTabs/index.d.ts +2 -2
- package/dist/RadioTabs-CsVqYCE9.js.map +1 -1
- package/dist/RadioTabs-t-x2XnuI.cjs.map +1 -1
- package/dist/Radios/index.d.cts +2 -2
- package/dist/Radios/index.d.ts +2 -2
- package/dist/Radios-CYwW3bZa.js.map +1 -1
- package/dist/Radios-CjEFdyD6.cjs.map +1 -1
- package/dist/Select/index.d.cts +2 -2
- package/dist/Select/index.d.ts +2 -2
- package/dist/Select-BEed8xan.cjs.map +1 -1
- package/dist/Select-BILyyM7Z.js.map +1 -1
- package/dist/Slider/index.d.cts +2 -2
- package/dist/Slider/index.d.ts +2 -2
- package/dist/Slider-CFYP86ku.cjs.map +1 -1
- package/dist/Slider-DxRcLu-j.js.map +1 -1
- package/dist/SubmitButton/index.d.cts +2 -2
- package/dist/SubmitButton/index.d.ts +2 -2
- package/dist/SubmitButton-Bu3NNFyt.js.map +1 -1
- package/dist/SubmitButton-D7xacDyS.cjs.map +1 -1
- package/dist/Switch/index.d.cts +2 -2
- package/dist/Switch/index.d.ts +2 -2
- package/dist/Switch-CMpXZdLc.js.map +1 -1
- package/dist/Switch-Dt9TGQ8d.cjs.map +1 -1
- package/dist/SwitchBox/index.d.cts +2 -2
- package/dist/SwitchBox/index.d.ts +2 -2
- package/dist/SwitchBox-Cg7NPfp_.js.map +1 -1
- package/dist/SwitchBox-DMPp_Ed-.cjs.map +1 -1
- package/dist/TextArea/index.d.cts +2 -2
- package/dist/TextArea/index.d.ts +2 -2
- package/dist/TextArea-BDNtxp9N.cjs.map +1 -1
- package/dist/TextArea-DMMxpDBl.js.map +1 -1
- package/dist/helpers/index.cjs.map +1 -1
- package/dist/helpers/index.d.cts +2 -224
- package/dist/helpers/index.d.ts +2 -224
- package/dist/helpers/index.js.map +1 -1
- package/dist/hooks/useFormContext/index.d.cts +1 -1
- package/dist/hooks/useFormContext/index.d.ts +1 -1
- package/dist/hooks/useInput/index.d.cts +1 -1
- package/dist/hooks/useInput/index.d.ts +1 -1
- package/dist/hooks/useInputValueDebounce/index.cjs.map +1 -1
- package/dist/hooks/useInputValueDebounce/index.d.cts +1 -1
- package/dist/hooks/useInputValueDebounce/index.d.ts +1 -1
- package/dist/hooks/useInputValueDebounce/index.js.map +1 -1
- package/dist/hooks/useInputValueTransform/index.d.cts +1 -1
- package/dist/hooks/useInputValueTransform/index.d.ts +1 -1
- package/dist/hooks/useUniformField/index.cjs.map +1 -1
- package/dist/hooks/useUniformField/index.d.cts +1 -1
- package/dist/hooks/useUniformField/index.d.ts +1 -1
- package/dist/hooks/useUniformField/index.js.map +1 -1
- package/dist/hooks/useUniformFieldArray/index.cjs.map +1 -1
- package/dist/hooks/useUniformFieldArray/index.d.cts +1 -1
- package/dist/hooks/useUniformFieldArray/index.d.ts +1 -1
- package/dist/hooks/useUniformFieldArray/index.js.map +1 -1
- package/dist/index-0zgyvkAF.d.cts +224 -0
- package/dist/index-0zgyvkAF.d.cts.map +1 -0
- package/dist/{index-3ZtX9lF3.d.ts → index-3gVUFqgo.d.cts} +4 -6
- package/dist/index-3gVUFqgo.d.cts.map +1 -0
- package/dist/{index-DVfzReu6.d.ts → index-65doPHAW.d.ts} +33 -34
- package/dist/index-65doPHAW.d.ts.map +1 -0
- package/dist/{index-BA6KNK9V.d.cts → index-B682jKQ_.d.ts} +33 -35
- package/dist/index-B682jKQ_.d.ts.map +1 -0
- package/dist/{index-Dj3NDj0T.d.ts → index-BFpoR6oH.d.ts} +3 -4
- package/dist/index-BFpoR6oH.d.ts.map +1 -0
- package/dist/{index-DFWSHdua.d.ts → index-BIefvGtf.d.ts} +2 -3
- package/dist/index-BIefvGtf.d.ts.map +1 -0
- package/dist/{index-B6WwxkLx2.d.ts → index-BLbC1_g_.d.cts} +2 -4
- package/dist/index-BLbC1_g_.d.cts.map +1 -0
- package/dist/{index-NjKV8LJD.d.cts → index-BeP-RWud.d.cts} +3 -4
- package/dist/index-BeP-RWud.d.cts.map +1 -0
- package/dist/{index-zoRnk2AH.d.cts → index-Bki-5EDW.d.cts} +34 -36
- package/dist/index-Bki-5EDW.d.cts.map +1 -0
- package/dist/{index-Dld6NP_K.d.cts → index-BlVK355b.d.cts} +2 -3
- package/dist/index-BlVK355b.d.cts.map +1 -0
- package/dist/{index-l0W6BMuz.d.cts → index-C3g-k5q8.d.cts} +19 -21
- package/dist/index-C3g-k5q8.d.cts.map +1 -0
- package/dist/{index-Cv4ERj3i.d.ts → index-CDcnRyum.d.cts} +2 -3
- package/dist/index-CDcnRyum.d.cts.map +1 -0
- package/dist/{index-DkxqHE_P2.d.ts → index-Ck9KE5Pj2.d.ts} +2 -3
- package/dist/index-Ck9KE5Pj2.d.ts.map +1 -0
- package/dist/{index-B5KHaaJD.d.ts → index-Ck9lrzur.d.cts} +4 -6
- package/dist/index-Ck9lrzur.d.cts.map +1 -0
- package/dist/{index-DkZ4lP1l.d.ts → index-Cnu0aojI.d.cts} +20 -22
- package/dist/index-Cnu0aojI.d.cts.map +1 -0
- package/dist/{index-BQtoek59.d.cts → index-CpINqeNE.d.ts} +20 -22
- package/dist/index-CpINqeNE.d.ts.map +1 -0
- package/dist/{index-Bw2N3BfM.d.ts → index-CyeWKriu.d.ts} +34 -36
- package/dist/index-CyeWKriu.d.ts.map +1 -0
- package/dist/{index-DFKoyOlV.d.cts → index-D4mUuIR2.d.cts} +33 -34
- package/dist/index-D4mUuIR2.d.cts.map +1 -0
- package/dist/{index-DFQuCtly.d.cts → index-D7qJy705.d.ts} +4 -6
- package/dist/index-D7qJy705.d.ts.map +1 -0
- package/dist/{index-DE_P3FJx.d.ts → index-DRg0anjB.d.cts} +5 -7
- package/dist/index-DRg0anjB.d.cts.map +1 -0
- package/dist/index-DVGo3QuA.d.ts +224 -0
- package/dist/index-DVGo3QuA.d.ts.map +1 -0
- package/dist/{index-Ct5ySLJH.d.cts → index-DdqwwvOD.d.ts} +5 -7
- package/dist/index-DdqwwvOD.d.ts.map +1 -0
- package/dist/{index-417lHgOQ.d.cts → index-DjPJAUOM.d.ts} +4 -6
- package/dist/index-DjPJAUOM.d.ts.map +1 -0
- package/dist/{index-D9B_5Nxa.d.ts → index-DoWEojrc.d.ts} +19 -21
- package/dist/index-DoWEojrc.d.ts.map +1 -0
- package/dist/index-Dox89nFY.d.ts +167 -0
- package/dist/index-Dox89nFY.d.ts.map +1 -0
- package/dist/{index-BV1VKQdy.d.cts → index-DqTdG65C.d.ts} +2 -3
- package/dist/index-DqTdG65C.d.ts.map +1 -0
- package/dist/index-DriOe0TW.d.cts +167 -0
- package/dist/index-DriOe0TW.d.cts.map +1 -0
- package/dist/{index-DSEgw9pC.d.ts → index-E28aP0vt.d.cts} +4 -6
- package/dist/index-E28aP0vt.d.cts.map +1 -0
- package/dist/{index-DkiQkdCW.d.cts → index-GP_4Xvec.d.cts} +2 -3
- package/dist/index-GP_4Xvec.d.cts.map +1 -0
- package/dist/{index-jCfJAgDc.d.cts → index-RavMgGrt.d.ts} +2 -4
- package/dist/index-RavMgGrt.d.ts.map +1 -0
- package/dist/{index-TupkQhBV.d.cts → index-S4bOYm9e.d.ts} +4 -6
- package/dist/index-S4bOYm9e.d.ts.map +1 -0
- package/dist/{index-DB_79gfc.d.ts → index-cxajYZel.d.cts} +33 -35
- package/dist/index-cxajYZel.d.cts.map +1 -0
- package/dist/{index-CXU4Ol-X.d.ts → index-jIVsGNsl.d.ts} +3 -4
- package/dist/index-jIVsGNsl.d.ts.map +1 -0
- package/dist/{index-KRJ69jvW.d.cts → index-o0UcZG4n.d.cts} +3 -4
- package/dist/index-o0UcZG4n.d.cts.map +1 -0
- package/dist/index-shXLkkCt.d.cts +276 -0
- package/dist/index-shXLkkCt.d.cts.map +1 -0
- package/dist/index-yhVd_5kq.d.ts +276 -0
- package/dist/index-yhVd_5kq.d.ts.map +1 -0
- package/dist/index.d.cts +25 -25
- package/dist/index.d.ts +25 -25
- package/dist/partials/FieldCopyTestIdButton/index.d.cts +2 -2
- package/dist/partials/FieldCopyTestIdButton/index.d.ts +2 -2
- package/dist/partials/FieldValidationError/index.d.cts +2 -2
- package/dist/partials/FieldValidationError/index.d.ts +2 -2
- package/dist/useClientValidation-BWElhQ91.d.ts.map +1 -1
- package/dist/useClientValidation-Dn_kJkE5.js.map +1 -1
- package/dist/useClientValidation-DtnfCE5T.d.cts.map +1 -1
- package/dist/useClientValidation-NKOuXuHV.cjs.map +1 -1
- package/dist/useController-B-6PzFna.js.map +1 -1
- package/dist/useController-CNiqy_2D.d.cts.map +1 -1
- package/dist/useController-Cc0UNQMm.d.ts.map +1 -1
- package/dist/useController-DVRh86Zy.cjs.map +1 -1
- package/dist/{useFormContext-C06aufHt.d.cts → useFormContext-BlXG2fw3.d.cts} +22 -24
- package/dist/useFormContext-BlXG2fw3.d.cts.map +1 -0
- package/dist/useFormContext-Bum4VP1o.cjs.map +1 -1
- package/dist/useFormContext-Bzpyonu6.js.map +1 -1
- package/dist/{useFormContext-CHA8GnKp.d.ts → useFormContext-CDD_1j0V.d.ts} +22 -24
- package/dist/useFormContext-CDD_1j0V.d.ts.map +1 -0
- package/dist/{useInputValueDebounce-sFOlecIQ.d.ts → useInputValueDebounce-D03GnJO4.d.ts} +1 -1
- package/dist/useInputValueDebounce-D03GnJO4.d.ts.map +1 -0
- package/dist/{useInputValueDebounce-puGRVJ6t.d.cts → useInputValueDebounce-nHt1AHRm.d.cts} +1 -1
- package/dist/useInputValueDebounce-nHt1AHRm.d.cts.map +1 -0
- package/dist/{useInputValueTransform-CdoaxNyD.d.ts → useInputValueTransform-C51LmUxi.d.ts} +1 -1
- package/dist/useInputValueTransform-C51LmUxi.d.ts.map +1 -0
- package/dist/{useInputValueTransform-BwAfw8Xb.d.cts → useInputValueTransform-CNCBU7a9.d.cts} +1 -1
- package/dist/useInputValueTransform-CNCBU7a9.d.cts.map +1 -0
- package/dist/useInputValueTransform-CXdmtc0Q.js.map +1 -1
- package/dist/useInputValueTransform-DKH-7F9D.cjs.map +1 -1
- package/dist/{useUniformField-BTBS1Kv-.d.ts → useUniformField-CNw8ujZz.d.ts} +4 -4
- package/dist/{useUniformField-BTBS1Kv-.d.ts.map → useUniformField-CNw8ujZz.d.ts.map} +1 -1
- package/dist/{useUniformField-j22kM31n.d.cts → useUniformField-CtimrtjO.d.cts} +4 -4
- package/dist/{useUniformField-j22kM31n.d.cts.map → useUniformField-CtimrtjO.d.cts.map} +1 -1
- package/dist/{useUniformFieldArray-CDEagafl.d.cts → useUniformFieldArray-BodQL2Ea.d.cts} +15 -17
- package/dist/useUniformFieldArray-BodQL2Ea.d.cts.map +1 -0
- package/dist/{useUniformFieldArray-CMHoo4o3.d.ts → useUniformFieldArray-CvlgXVBm.d.ts} +15 -17
- package/dist/useUniformFieldArray-CvlgXVBm.d.ts.map +1 -0
- package/dist/useWatchUserChange-CBuIa5kU.cjs.map +1 -1
- package/dist/useWatchUserChange-CH4x16_r.d.ts.map +1 -1
- package/dist/useWatchUserChange-CLgLc5W4.js.map +1 -1
- package/dist/useWatchUserChange-CZu_ZZ38.d.cts.map +1 -1
- package/package.json +18 -22
- package/dist/FormContext-B4KQxdl7.d.ts.map +0 -1
- package/dist/FormContext-BuG3xZFe.d.cts.map +0 -1
- package/dist/helpers/index.d.cts.map +0 -1
- package/dist/helpers/index.d.ts.map +0 -1
- package/dist/index-1R5A9Hrq.d.ts +0 -70
- package/dist/index-1R5A9Hrq.d.ts.map +0 -1
- package/dist/index-3ZtX9lF3.d.ts.map +0 -1
- package/dist/index-417lHgOQ.d.cts.map +0 -1
- package/dist/index-B5KHaaJD.d.ts.map +0 -1
- package/dist/index-B6WwxkLx2.d.ts.map +0 -1
- package/dist/index-BA6KNK9V.d.cts.map +0 -1
- package/dist/index-BQtoek59.d.cts.map +0 -1
- package/dist/index-BV1VKQdy.d.cts.map +0 -1
- package/dist/index-Bw2N3BfM.d.ts.map +0 -1
- package/dist/index-CXU4Ol-X.d.ts.map +0 -1
- package/dist/index-CXt5eE4O.d.ts +0 -169
- package/dist/index-CXt5eE4O.d.ts.map +0 -1
- package/dist/index-C_MDRbEE.d.cts +0 -169
- package/dist/index-C_MDRbEE.d.cts.map +0 -1
- package/dist/index-CgqESs42.d.cts +0 -70
- package/dist/index-CgqESs42.d.cts.map +0 -1
- package/dist/index-Ct5ySLJH.d.cts.map +0 -1
- package/dist/index-Cv4ERj3i.d.ts.map +0 -1
- package/dist/index-Cx2IEfuR.d.cts +0 -278
- package/dist/index-Cx2IEfuR.d.cts.map +0 -1
- package/dist/index-D9B_5Nxa.d.ts.map +0 -1
- package/dist/index-DB_79gfc.d.ts.map +0 -1
- package/dist/index-DE_P3FJx.d.ts.map +0 -1
- package/dist/index-DFKoyOlV.d.cts.map +0 -1
- package/dist/index-DFQuCtly.d.cts.map +0 -1
- package/dist/index-DFWSHdua.d.ts.map +0 -1
- package/dist/index-DSEgw9pC.d.ts.map +0 -1
- package/dist/index-DVfzReu6.d.ts.map +0 -1
- package/dist/index-DeEmP3Jc.d.cts +0 -1
- package/dist/index-Dj3NDj0T.d.ts.map +0 -1
- package/dist/index-DkZ4lP1l.d.ts.map +0 -1
- package/dist/index-DkiQkdCW.d.cts.map +0 -1
- package/dist/index-DkxqHE_P2.d.ts.map +0 -1
- package/dist/index-Dld6NP_K.d.cts.map +0 -1
- package/dist/index-KRJ69jvW.d.cts.map +0 -1
- package/dist/index-NjKV8LJD.d.cts.map +0 -1
- package/dist/index-TupkQhBV.d.cts.map +0 -1
- package/dist/index-jCfJAgDc.d.cts.map +0 -1
- package/dist/index-l0W6BMuz.d.cts.map +0 -1
- package/dist/index-sQecLSpR.d.cts +0 -1
- package/dist/index-xJz9euVJ.d.ts +0 -278
- package/dist/index-xJz9euVJ.d.ts.map +0 -1
- package/dist/index-zoRnk2AH.d.cts.map +0 -1
- package/dist/useFormContext-C06aufHt.d.cts.map +0 -1
- package/dist/useFormContext-CHA8GnKp.d.ts.map +0 -1
- package/dist/useInputValueDebounce-puGRVJ6t.d.cts.map +0 -1
- package/dist/useInputValueDebounce-sFOlecIQ.d.ts.map +0 -1
- package/dist/useInputValueTransform-BwAfw8Xb.d.cts.map +0 -1
- package/dist/useInputValueTransform-CdoaxNyD.d.ts.map +0 -1
- package/dist/useUniformFieldArray-CDEagafl.d.cts.map +0 -1
- package/dist/useUniformFieldArray-CMHoo4o3.d.ts.map +0 -1
- /package/dist/{index--okzibnx.d.ts → index-C2gUMYkE.d.cts} +0 -0
- /package/dist/{index-B2TCFhpj.d.ts → index-CJgP-E0M.d.cts} +0 -0
- /package/dist/{index-BtBZHVmz.d.cts → index-DTU6Hb0g.d.ts} +0 -0
- /package/dist/{index-CI4LJief.d.ts → index-E7Wvm5uX.d.ts} +0 -0
- /package/dist/{useInput-93TCCrkB.d.cts → useInput-8kDcm77k.d.cts} +0 -0
- /package/dist/{useInput-C_fY--wx.d.ts → useInput-Che-4SjF.d.ts} +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","names":["useUniformField","useFormContext","flatArrayKey"],"sources":["../../../src/hooks/useUniformFieldArray/useUniformFieldArray.ts","../../../src/hooks/useUniformFieldArray/index.ts"],"sourcesContent":["import type { ReactNode } from 'react';\nimport type { ArrayPath, FieldValues, Path } from 'react-hook-form';\n\nimport { useEffect, useMemo, useRef, useState } from 'react';\nimport { useFieldArray as useRHFFieldArray } from 'react-hook-form';\n\nimport { useReducedMotion } from '@fuf-stack/pixel-motion';\n\nimport { flatArrayKey } from '../../helpers';\nimport { useFormContext } from '../useFormContext';\nimport { useUniformField } from '../useUniformField';\n\nexport interface UseUniformFieldArrayProps<\n TFieldValues extends FieldValues = FieldValues,\n> {\n /** Field name for the array */\n name: ArrayPath<TFieldValues>;\n /** Whether this is a flat array (array of primitives) */\n flat?: boolean;\n /** Initial value for new array elements */\n elementInitialValue?: unknown;\n /** Whether the last element cannot be removed (always maintain at least one element) */\n lastElementNotRemovable?: boolean;\n /** Disable the field */\n disabled?: boolean;\n /** Optional explicit test id used to build stable test ids */\n testId?: string;\n /** Optional label content */\n label?: ReactNode;\n}\n\n/**\n * Enhanced useFieldArray hook with initialization and animation logic.\n * Based on React Hook Form's useFieldArray with additional features:\n * - Automatic initialization when lastElementNotRemovable is set\n * - Animation control (disabled during initialization)\n * - Support for flat arrays (arrays of primitives)\n *\n * Note: Automatic validation triggering on length change is disabled to prevent\n * triggering form-wide validation. Array validation still runs on form submission.\n *\n * @see https://react-hook-form.com/docs/usefieldarray\n */\nexport const useUniformFieldArray = <\n TFieldValues extends FieldValues = FieldValues,\n>({\n name,\n flat = false,\n elementInitialValue: _elementInitialValue = null,\n lastElementNotRemovable = false,\n disabled,\n testId: explicitTestId,\n label,\n}: UseUniformFieldArrayProps<TFieldValues>) => {\n // Get uniform field state and utilities\n const uniformField = useUniformField<TFieldValues>({\n name: name as Path<TFieldValues> & string,\n disabled,\n testId: explicitTestId,\n label,\n });\n\n const { control } = uniformField;\n\n const { fields, append, remove, insert, move } = useRHFFieldArray({\n control,\n name,\n });\n\n const { trigger, setValue } = useFormContext<TFieldValues>();\n\n // Determine if initialization is needed (initially or after reset).\n // This flag automatically handles both scenarios:\n // - Initial mount: fields.length starts at 0\n // - Form reset: fields.length becomes 0 again\n // Additional initialization conditions can be added here later (e.g., minElements > 0)\n // Using useMemo ensures this value is properly tracked by React and effects can depend on it\n const needsInitialize = useMemo(() => {\n return lastElementNotRemovable && fields.length === 0;\n }, [lastElementNotRemovable, fields.length]);\n\n // Track whether initialization has completed. Initialized contextually:\n // - If initialization IS needed (needsInitialize = true): starts as false, set to true after init\n // - If initialization is NOT needed (needsInitialize = false): starts as true (already initialized)\n // This ref is used to:\n // 1. Skip validation during initialization/re-initialization\n // 2. Gate animation enabling until after initialization\n // 3. Gate motion preference effect until after initialization\n const hasInitialized = useRef(!needsInitialize);\n\n // Reset initialization flag when needsInitialize changes to true.\n // This handles form reset: when fields become empty (needsInitialize becomes true),\n // hasInitialized is reset to false, triggering re-initialization in the effect below.\n useEffect(() => {\n if (needsInitialize) {\n hasInitialized.current = false;\n }\n }, [needsInitialize]);\n\n // Validate array-level constraints (min/max items) when length changes.\n // This ensures min/max errors appear instantly when user adds/removes items.\n // Note: Child field validation also runs, but new empty fields won't show as invalid\n // because useFormContext only sets invalid=true for touched fields or after form submission.\n // Skip validation during initialization/re-initialization to avoid showing errors prematurely.\n useEffect(() => {\n if (hasInitialized.current) {\n setTimeout(() => {\n trigger(name as Path<TFieldValues>);\n }, 200);\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [fields.length]);\n\n // Animation control: Start with animations disabled to prevent animating in initial elements.\n // Will be enabled after initialization completes (unless user prefers reduced motion).\n const [disableAnimation, setDisableAnimation] = useState(true);\n\n // Respond to user's motion preference changes (after initialization).\n // During initialization, animations stay disabled regardless of preference.\n const prefersReducedMotion = useReducedMotion();\n useEffect(() => {\n if (hasInitialized.current) {\n setDisableAnimation(!!prefersReducedMotion);\n }\n }, [prefersReducedMotion]);\n\n // Prepare initial element value based on mode\n // - flat=true: arrays of primitives → object with flatArrayKey and null value by default\n // - flat=false: arrays of objects → empty object by default\n const elementInitialValue = useMemo(() => {\n return flat\n ? { [flatArrayKey]: _elementInitialValue ?? null }\n : (_elementInitialValue ?? {});\n }, [flat, _elementInitialValue]);\n\n // Initialization/Re-initialization: Add initial element when needed.\n // This handles both initial mount and form reset scenarios by reacting to needsInitialize.\n // CRITICAL: This effect MUST be the LAST hook in this component.\n // It sets hasInitialized.current = true, which acts as a gate for other effects.\n // If this runs before other effects, hasInitialized will be true during their first run,\n // causing them to execute logic meant only for post-initialization (e.g., validation,\n // animation enabling). By placing this last, all other effects run first with\n // hasInitialized = false, allowing them to skip initialization-phase logic.\n useEffect(\n () => {\n if (needsInitialize) {\n // use setValue instead of append to avoid focusing the added element\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n setValue(name as Path<TFieldValues>, [elementInitialValue] as any, {\n shouldDirty: false,\n shouldTouch: false,\n });\n\n // Mark initialization as complete\n hasInitialized.current = true;\n\n // Enable animations after a brief delay (unless user prefers reduced motion or animations are already enabled).\n // This only runs on initial mount when animations start disabled.\n // On reset, disableAnimation is typically false, so this setTimeout won't run and animations stay enabled.\n if (!prefersReducedMotion && disableAnimation) {\n setTimeout(() => {\n setDisableAnimation(false);\n }, 1);\n }\n }\n },\n // Run when needsInitialize changes (initial mount or reset)\n // needsInitialize is memoized based on fields.length and lastElementNotRemovable\n // Other dependencies are intentionally omitted:\n // - append, setValue, trigger, setDisableAnimation are stable refs/functions\n // - elementInitialValue, name, flat, prefersReducedMotion, disableAnimation are props/stable values\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [needsInitialize],\n );\n\n return {\n // Field array methods and state\n fields,\n append,\n remove,\n insert,\n move,\n disableAnimation,\n elementInitialValue,\n // Uniform field state and utilities (spread all)\n ...uniformField,\n };\n};\n","/* v8 ignore start */\n\nexport * from './useUniformFieldArray';\n\n/* v8 ignore stop */\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AA2CA,MAAa,wBAEX,EACA,MACA,OAAO,OACP,qBAAqB,uBAAuB,MAC5C,0BAA0B,OAC1B,UACA,QAAQ,gBACR,YAC6C;CAE7C,MAAM,eAAeA,oCAAAA,gBAA8B;EAC3C;EACN;EACA,QAAQ;EACR;
|
|
1
|
+
{"version":3,"file":"index.cjs","names":["useUniformField","useFormContext","flatArrayKey"],"sources":["../../../src/hooks/useUniformFieldArray/useUniformFieldArray.ts","../../../src/hooks/useUniformFieldArray/index.ts"],"sourcesContent":["import type { ReactNode } from 'react';\nimport type { ArrayPath, FieldValues, Path } from 'react-hook-form';\n\nimport { useEffect, useMemo, useRef, useState } from 'react';\nimport { useFieldArray as useRHFFieldArray } from 'react-hook-form';\n\nimport { useReducedMotion } from '@fuf-stack/pixel-motion';\n\nimport { flatArrayKey } from '../../helpers';\nimport { useFormContext } from '../useFormContext';\nimport { useUniformField } from '../useUniformField';\n\nexport interface UseUniformFieldArrayProps<\n TFieldValues extends FieldValues = FieldValues,\n> {\n /** Field name for the array */\n name: ArrayPath<TFieldValues>;\n /** Whether this is a flat array (array of primitives) */\n flat?: boolean;\n /** Initial value for new array elements */\n elementInitialValue?: unknown;\n /** Whether the last element cannot be removed (always maintain at least one element) */\n lastElementNotRemovable?: boolean;\n /** Disable the field */\n disabled?: boolean;\n /** Optional explicit test id used to build stable test ids */\n testId?: string;\n /** Optional label content */\n label?: ReactNode;\n}\n\n/**\n * Enhanced useFieldArray hook with initialization and animation logic.\n * Based on React Hook Form's useFieldArray with additional features:\n * - Automatic initialization when lastElementNotRemovable is set\n * - Animation control (disabled during initialization)\n * - Support for flat arrays (arrays of primitives)\n *\n * Note: Automatic validation triggering on length change is disabled to prevent\n * triggering form-wide validation. Array validation still runs on form submission.\n *\n * @see https://react-hook-form.com/docs/usefieldarray\n */\nexport const useUniformFieldArray = <\n TFieldValues extends FieldValues = FieldValues,\n>({\n name,\n flat = false,\n elementInitialValue: _elementInitialValue = null,\n lastElementNotRemovable = false,\n disabled,\n testId: explicitTestId,\n label,\n}: UseUniformFieldArrayProps<TFieldValues>) => {\n // Get uniform field state and utilities\n const uniformField = useUniformField<TFieldValues>({\n name: name as Path<TFieldValues> & string,\n disabled,\n testId: explicitTestId,\n label,\n });\n\n const { control } = uniformField;\n\n const { fields, append, remove, insert, move } = useRHFFieldArray({\n control,\n name,\n });\n\n const { trigger, setValue } = useFormContext<TFieldValues>();\n\n // Determine if initialization is needed (initially or after reset).\n // This flag automatically handles both scenarios:\n // - Initial mount: fields.length starts at 0\n // - Form reset: fields.length becomes 0 again\n // Additional initialization conditions can be added here later (e.g., minElements > 0)\n // Using useMemo ensures this value is properly tracked by React and effects can depend on it\n const needsInitialize = useMemo(() => {\n return lastElementNotRemovable && fields.length === 0;\n }, [lastElementNotRemovable, fields.length]);\n\n // Track whether initialization has completed. Initialized contextually:\n // - If initialization IS needed (needsInitialize = true): starts as false, set to true after init\n // - If initialization is NOT needed (needsInitialize = false): starts as true (already initialized)\n // This ref is used to:\n // 1. Skip validation during initialization/re-initialization\n // 2. Gate animation enabling until after initialization\n // 3. Gate motion preference effect until after initialization\n const hasInitialized = useRef(!needsInitialize);\n\n // Reset initialization flag when needsInitialize changes to true.\n // This handles form reset: when fields become empty (needsInitialize becomes true),\n // hasInitialized is reset to false, triggering re-initialization in the effect below.\n useEffect(() => {\n if (needsInitialize) {\n hasInitialized.current = false;\n }\n }, [needsInitialize]);\n\n // Validate array-level constraints (min/max items) when length changes.\n // This ensures min/max errors appear instantly when user adds/removes items.\n // Note: Child field validation also runs, but new empty fields won't show as invalid\n // because useFormContext only sets invalid=true for touched fields or after form submission.\n // Skip validation during initialization/re-initialization to avoid showing errors prematurely.\n useEffect(() => {\n if (hasInitialized.current) {\n setTimeout(() => {\n trigger(name as Path<TFieldValues>);\n }, 200);\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [fields.length]);\n\n // Animation control: Start with animations disabled to prevent animating in initial elements.\n // Will be enabled after initialization completes (unless user prefers reduced motion).\n const [disableAnimation, setDisableAnimation] = useState(true);\n\n // Respond to user's motion preference changes (after initialization).\n // During initialization, animations stay disabled regardless of preference.\n const prefersReducedMotion = useReducedMotion();\n useEffect(() => {\n if (hasInitialized.current) {\n setDisableAnimation(!!prefersReducedMotion);\n }\n }, [prefersReducedMotion]);\n\n // Prepare initial element value based on mode\n // - flat=true: arrays of primitives → object with flatArrayKey and null value by default\n // - flat=false: arrays of objects → empty object by default\n const elementInitialValue = useMemo(() => {\n return flat\n ? { [flatArrayKey]: _elementInitialValue ?? null }\n : (_elementInitialValue ?? {});\n }, [flat, _elementInitialValue]);\n\n // Initialization/Re-initialization: Add initial element when needed.\n // This handles both initial mount and form reset scenarios by reacting to needsInitialize.\n // CRITICAL: This effect MUST be the LAST hook in this component.\n // It sets hasInitialized.current = true, which acts as a gate for other effects.\n // If this runs before other effects, hasInitialized will be true during their first run,\n // causing them to execute logic meant only for post-initialization (e.g., validation,\n // animation enabling). By placing this last, all other effects run first with\n // hasInitialized = false, allowing them to skip initialization-phase logic.\n useEffect(\n () => {\n if (needsInitialize) {\n // use setValue instead of append to avoid focusing the added element\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n setValue(name as Path<TFieldValues>, [elementInitialValue] as any, {\n shouldDirty: false,\n shouldTouch: false,\n });\n\n // Mark initialization as complete\n hasInitialized.current = true;\n\n // Enable animations after a brief delay (unless user prefers reduced motion or animations are already enabled).\n // This only runs on initial mount when animations start disabled.\n // On reset, disableAnimation is typically false, so this setTimeout won't run and animations stay enabled.\n if (!prefersReducedMotion && disableAnimation) {\n setTimeout(() => {\n setDisableAnimation(false);\n }, 1);\n }\n }\n },\n // Run when needsInitialize changes (initial mount or reset)\n // needsInitialize is memoized based on fields.length and lastElementNotRemovable\n // Other dependencies are intentionally omitted:\n // - append, setValue, trigger, setDisableAnimation are stable refs/functions\n // - elementInitialValue, name, flat, prefersReducedMotion, disableAnimation are props/stable values\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [needsInitialize],\n );\n\n return {\n // Field array methods and state\n fields,\n append,\n remove,\n insert,\n move,\n disableAnimation,\n elementInitialValue,\n // Uniform field state and utilities (spread all)\n ...uniformField,\n };\n};\n","/* v8 ignore start */\n\nexport * from './useUniformFieldArray';\n\n/* v8 ignore stop */\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AA2CA,MAAa,wBAEX,EACA,MACA,OAAO,OACP,qBAAqB,uBAAuB,MAC5C,0BAA0B,OAC1B,UACA,QAAQ,gBACR,YAC6C;CAE7C,MAAM,eAAeA,oCAAAA,gBAA8B;EAC3C;EACN;EACA,QAAQ;EACR;CACF,CAAC;CAED,MAAM,EAAE,YAAY;CAEpB,MAAM,EAAE,QAAQ,QAAQ,QAAQ,QAAQ,UAAA,GAAA,gBAAA,eAA0B;EAChE;EACA;CACF,CAAC;CAED,MAAM,EAAE,SAAS,aAAaC,uBAAAA,eAA6B;CAQ3D,MAAM,mBAAA,GAAA,MAAA,eAAgC;EACpC,OAAO,2BAA2B,OAAO,WAAW;CACtD,GAAG,CAAC,yBAAyB,OAAO,MAAM,CAAC;CAS3C,MAAM,kBAAA,GAAA,MAAA,QAAwB,CAAC,eAAe;CAK9C,CAAA,GAAA,MAAA,iBAAgB;EACd,IAAI,iBACF,eAAe,UAAU;CAE7B,GAAG,CAAC,eAAe,CAAC;CAOpB,CAAA,GAAA,MAAA,iBAAgB;EACd,IAAI,eAAe,SACjB,iBAAiB;GACf,QAAQ,IAA0B;EACpC,GAAG,GAAG;CAGV,GAAG,CAAC,OAAO,MAAM,CAAC;CAIlB,MAAM,CAAC,kBAAkB,wBAAA,GAAA,MAAA,UAAgC,IAAI;CAI7D,MAAM,wBAAA,GAAA,wBAAA,kBAAwC;CAC9C,CAAA,GAAA,MAAA,iBAAgB;EACd,IAAI,eAAe,SACjB,oBAAoB,CAAC,CAAC,oBAAoB;CAE9C,GAAG,CAAC,oBAAoB,CAAC;CAKzB,MAAM,uBAAA,GAAA,MAAA,eAAoC;EACxC,OAAO,OACH,GAAGC,sBAAAA,eAAe,wBAAwB,KAAK,IAC9C,wBAAwB,CAAC;CAChC,GAAG,CAAC,MAAM,oBAAoB,CAAC;CAU/B,CAAA,GAAA,MAAA,iBACQ;EACJ,IAAI,iBAAiB;GAGnB,SAAS,MAA4B,CAAC,mBAAmB,GAAU;IACjE,aAAa;IACb,aAAa;GACf,CAAC;GAGD,eAAe,UAAU;GAKzB,IAAI,CAAC,wBAAwB,kBAC3B,iBAAiB;IACf,oBAAoB,KAAK;GAC3B,GAAG,CAAC;EAER;CACF,GAOA,CAAC,eAAe,CAClB;CAEA,OAAO;EAEL;EACA;EACA;EACA;EACA;EACA;EACA;EAEA,GAAG;CACL;AACF"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as useUniformFieldArray, t as UseUniformFieldArrayProps } from "../../useUniformFieldArray-
|
|
1
|
+
import { n as useUniformFieldArray, t as UseUniformFieldArrayProps } from "../../useUniformFieldArray-BodQL2Ea.cjs";
|
|
2
2
|
export { UseUniformFieldArrayProps, useUniformFieldArray };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as useUniformFieldArray, t as UseUniformFieldArrayProps } from "../../useUniformFieldArray-
|
|
1
|
+
import { n as useUniformFieldArray, t as UseUniformFieldArrayProps } from "../../useUniformFieldArray-CvlgXVBm.js";
|
|
2
2
|
export { UseUniformFieldArrayProps, useUniformFieldArray };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["useRHFFieldArray","useFormContext"],"sources":["../../../src/hooks/useUniformFieldArray/useUniformFieldArray.ts","../../../src/hooks/useUniformFieldArray/index.ts"],"sourcesContent":["import type { ReactNode } from 'react';\nimport type { ArrayPath, FieldValues, Path } from 'react-hook-form';\n\nimport { useEffect, useMemo, useRef, useState } from 'react';\nimport { useFieldArray as useRHFFieldArray } from 'react-hook-form';\n\nimport { useReducedMotion } from '@fuf-stack/pixel-motion';\n\nimport { flatArrayKey } from '../../helpers';\nimport { useFormContext } from '../useFormContext';\nimport { useUniformField } from '../useUniformField';\n\nexport interface UseUniformFieldArrayProps<\n TFieldValues extends FieldValues = FieldValues,\n> {\n /** Field name for the array */\n name: ArrayPath<TFieldValues>;\n /** Whether this is a flat array (array of primitives) */\n flat?: boolean;\n /** Initial value for new array elements */\n elementInitialValue?: unknown;\n /** Whether the last element cannot be removed (always maintain at least one element) */\n lastElementNotRemovable?: boolean;\n /** Disable the field */\n disabled?: boolean;\n /** Optional explicit test id used to build stable test ids */\n testId?: string;\n /** Optional label content */\n label?: ReactNode;\n}\n\n/**\n * Enhanced useFieldArray hook with initialization and animation logic.\n * Based on React Hook Form's useFieldArray with additional features:\n * - Automatic initialization when lastElementNotRemovable is set\n * - Animation control (disabled during initialization)\n * - Support for flat arrays (arrays of primitives)\n *\n * Note: Automatic validation triggering on length change is disabled to prevent\n * triggering form-wide validation. Array validation still runs on form submission.\n *\n * @see https://react-hook-form.com/docs/usefieldarray\n */\nexport const useUniformFieldArray = <\n TFieldValues extends FieldValues = FieldValues,\n>({\n name,\n flat = false,\n elementInitialValue: _elementInitialValue = null,\n lastElementNotRemovable = false,\n disabled,\n testId: explicitTestId,\n label,\n}: UseUniformFieldArrayProps<TFieldValues>) => {\n // Get uniform field state and utilities\n const uniformField = useUniformField<TFieldValues>({\n name: name as Path<TFieldValues> & string,\n disabled,\n testId: explicitTestId,\n label,\n });\n\n const { control } = uniformField;\n\n const { fields, append, remove, insert, move } = useRHFFieldArray({\n control,\n name,\n });\n\n const { trigger, setValue } = useFormContext<TFieldValues>();\n\n // Determine if initialization is needed (initially or after reset).\n // This flag automatically handles both scenarios:\n // - Initial mount: fields.length starts at 0\n // - Form reset: fields.length becomes 0 again\n // Additional initialization conditions can be added here later (e.g., minElements > 0)\n // Using useMemo ensures this value is properly tracked by React and effects can depend on it\n const needsInitialize = useMemo(() => {\n return lastElementNotRemovable && fields.length === 0;\n }, [lastElementNotRemovable, fields.length]);\n\n // Track whether initialization has completed. Initialized contextually:\n // - If initialization IS needed (needsInitialize = true): starts as false, set to true after init\n // - If initialization is NOT needed (needsInitialize = false): starts as true (already initialized)\n // This ref is used to:\n // 1. Skip validation during initialization/re-initialization\n // 2. Gate animation enabling until after initialization\n // 3. Gate motion preference effect until after initialization\n const hasInitialized = useRef(!needsInitialize);\n\n // Reset initialization flag when needsInitialize changes to true.\n // This handles form reset: when fields become empty (needsInitialize becomes true),\n // hasInitialized is reset to false, triggering re-initialization in the effect below.\n useEffect(() => {\n if (needsInitialize) {\n hasInitialized.current = false;\n }\n }, [needsInitialize]);\n\n // Validate array-level constraints (min/max items) when length changes.\n // This ensures min/max errors appear instantly when user adds/removes items.\n // Note: Child field validation also runs, but new empty fields won't show as invalid\n // because useFormContext only sets invalid=true for touched fields or after form submission.\n // Skip validation during initialization/re-initialization to avoid showing errors prematurely.\n useEffect(() => {\n if (hasInitialized.current) {\n setTimeout(() => {\n trigger(name as Path<TFieldValues>);\n }, 200);\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [fields.length]);\n\n // Animation control: Start with animations disabled to prevent animating in initial elements.\n // Will be enabled after initialization completes (unless user prefers reduced motion).\n const [disableAnimation, setDisableAnimation] = useState(true);\n\n // Respond to user's motion preference changes (after initialization).\n // During initialization, animations stay disabled regardless of preference.\n const prefersReducedMotion = useReducedMotion();\n useEffect(() => {\n if (hasInitialized.current) {\n setDisableAnimation(!!prefersReducedMotion);\n }\n }, [prefersReducedMotion]);\n\n // Prepare initial element value based on mode\n // - flat=true: arrays of primitives → object with flatArrayKey and null value by default\n // - flat=false: arrays of objects → empty object by default\n const elementInitialValue = useMemo(() => {\n return flat\n ? { [flatArrayKey]: _elementInitialValue ?? null }\n : (_elementInitialValue ?? {});\n }, [flat, _elementInitialValue]);\n\n // Initialization/Re-initialization: Add initial element when needed.\n // This handles both initial mount and form reset scenarios by reacting to needsInitialize.\n // CRITICAL: This effect MUST be the LAST hook in this component.\n // It sets hasInitialized.current = true, which acts as a gate for other effects.\n // If this runs before other effects, hasInitialized will be true during their first run,\n // causing them to execute logic meant only for post-initialization (e.g., validation,\n // animation enabling). By placing this last, all other effects run first with\n // hasInitialized = false, allowing them to skip initialization-phase logic.\n useEffect(\n () => {\n if (needsInitialize) {\n // use setValue instead of append to avoid focusing the added element\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n setValue(name as Path<TFieldValues>, [elementInitialValue] as any, {\n shouldDirty: false,\n shouldTouch: false,\n });\n\n // Mark initialization as complete\n hasInitialized.current = true;\n\n // Enable animations after a brief delay (unless user prefers reduced motion or animations are already enabled).\n // This only runs on initial mount when animations start disabled.\n // On reset, disableAnimation is typically false, so this setTimeout won't run and animations stay enabled.\n if (!prefersReducedMotion && disableAnimation) {\n setTimeout(() => {\n setDisableAnimation(false);\n }, 1);\n }\n }\n },\n // Run when needsInitialize changes (initial mount or reset)\n // needsInitialize is memoized based on fields.length and lastElementNotRemovable\n // Other dependencies are intentionally omitted:\n // - append, setValue, trigger, setDisableAnimation are stable refs/functions\n // - elementInitialValue, name, flat, prefersReducedMotion, disableAnimation are props/stable values\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [needsInitialize],\n );\n\n return {\n // Field array methods and state\n fields,\n append,\n remove,\n insert,\n move,\n disableAnimation,\n elementInitialValue,\n // Uniform field state and utilities (spread all)\n ...uniformField,\n };\n};\n","/* v8 ignore start */\n\nexport * from './useUniformFieldArray';\n\n/* v8 ignore stop */\n"],"mappings":";;;;;;;;;;;;;;;;;;;AA2CA,MAAa,wBAEX,EACA,MACA,OAAO,OACP,qBAAqB,uBAAuB,MAC5C,0BAA0B,OAC1B,UACA,QAAQ,gBACR,YAC6C;CAE7C,MAAM,eAAe,gBAA8B;EAC3C;EACN;EACA,QAAQ;EACR;
|
|
1
|
+
{"version":3,"file":"index.js","names":["useRHFFieldArray","useFormContext"],"sources":["../../../src/hooks/useUniformFieldArray/useUniformFieldArray.ts","../../../src/hooks/useUniformFieldArray/index.ts"],"sourcesContent":["import type { ReactNode } from 'react';\nimport type { ArrayPath, FieldValues, Path } from 'react-hook-form';\n\nimport { useEffect, useMemo, useRef, useState } from 'react';\nimport { useFieldArray as useRHFFieldArray } from 'react-hook-form';\n\nimport { useReducedMotion } from '@fuf-stack/pixel-motion';\n\nimport { flatArrayKey } from '../../helpers';\nimport { useFormContext } from '../useFormContext';\nimport { useUniformField } from '../useUniformField';\n\nexport interface UseUniformFieldArrayProps<\n TFieldValues extends FieldValues = FieldValues,\n> {\n /** Field name for the array */\n name: ArrayPath<TFieldValues>;\n /** Whether this is a flat array (array of primitives) */\n flat?: boolean;\n /** Initial value for new array elements */\n elementInitialValue?: unknown;\n /** Whether the last element cannot be removed (always maintain at least one element) */\n lastElementNotRemovable?: boolean;\n /** Disable the field */\n disabled?: boolean;\n /** Optional explicit test id used to build stable test ids */\n testId?: string;\n /** Optional label content */\n label?: ReactNode;\n}\n\n/**\n * Enhanced useFieldArray hook with initialization and animation logic.\n * Based on React Hook Form's useFieldArray with additional features:\n * - Automatic initialization when lastElementNotRemovable is set\n * - Animation control (disabled during initialization)\n * - Support for flat arrays (arrays of primitives)\n *\n * Note: Automatic validation triggering on length change is disabled to prevent\n * triggering form-wide validation. Array validation still runs on form submission.\n *\n * @see https://react-hook-form.com/docs/usefieldarray\n */\nexport const useUniformFieldArray = <\n TFieldValues extends FieldValues = FieldValues,\n>({\n name,\n flat = false,\n elementInitialValue: _elementInitialValue = null,\n lastElementNotRemovable = false,\n disabled,\n testId: explicitTestId,\n label,\n}: UseUniformFieldArrayProps<TFieldValues>) => {\n // Get uniform field state and utilities\n const uniformField = useUniformField<TFieldValues>({\n name: name as Path<TFieldValues> & string,\n disabled,\n testId: explicitTestId,\n label,\n });\n\n const { control } = uniformField;\n\n const { fields, append, remove, insert, move } = useRHFFieldArray({\n control,\n name,\n });\n\n const { trigger, setValue } = useFormContext<TFieldValues>();\n\n // Determine if initialization is needed (initially or after reset).\n // This flag automatically handles both scenarios:\n // - Initial mount: fields.length starts at 0\n // - Form reset: fields.length becomes 0 again\n // Additional initialization conditions can be added here later (e.g., minElements > 0)\n // Using useMemo ensures this value is properly tracked by React and effects can depend on it\n const needsInitialize = useMemo(() => {\n return lastElementNotRemovable && fields.length === 0;\n }, [lastElementNotRemovable, fields.length]);\n\n // Track whether initialization has completed. Initialized contextually:\n // - If initialization IS needed (needsInitialize = true): starts as false, set to true after init\n // - If initialization is NOT needed (needsInitialize = false): starts as true (already initialized)\n // This ref is used to:\n // 1. Skip validation during initialization/re-initialization\n // 2. Gate animation enabling until after initialization\n // 3. Gate motion preference effect until after initialization\n const hasInitialized = useRef(!needsInitialize);\n\n // Reset initialization flag when needsInitialize changes to true.\n // This handles form reset: when fields become empty (needsInitialize becomes true),\n // hasInitialized is reset to false, triggering re-initialization in the effect below.\n useEffect(() => {\n if (needsInitialize) {\n hasInitialized.current = false;\n }\n }, [needsInitialize]);\n\n // Validate array-level constraints (min/max items) when length changes.\n // This ensures min/max errors appear instantly when user adds/removes items.\n // Note: Child field validation also runs, but new empty fields won't show as invalid\n // because useFormContext only sets invalid=true for touched fields or after form submission.\n // Skip validation during initialization/re-initialization to avoid showing errors prematurely.\n useEffect(() => {\n if (hasInitialized.current) {\n setTimeout(() => {\n trigger(name as Path<TFieldValues>);\n }, 200);\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [fields.length]);\n\n // Animation control: Start with animations disabled to prevent animating in initial elements.\n // Will be enabled after initialization completes (unless user prefers reduced motion).\n const [disableAnimation, setDisableAnimation] = useState(true);\n\n // Respond to user's motion preference changes (after initialization).\n // During initialization, animations stay disabled regardless of preference.\n const prefersReducedMotion = useReducedMotion();\n useEffect(() => {\n if (hasInitialized.current) {\n setDisableAnimation(!!prefersReducedMotion);\n }\n }, [prefersReducedMotion]);\n\n // Prepare initial element value based on mode\n // - flat=true: arrays of primitives → object with flatArrayKey and null value by default\n // - flat=false: arrays of objects → empty object by default\n const elementInitialValue = useMemo(() => {\n return flat\n ? { [flatArrayKey]: _elementInitialValue ?? null }\n : (_elementInitialValue ?? {});\n }, [flat, _elementInitialValue]);\n\n // Initialization/Re-initialization: Add initial element when needed.\n // This handles both initial mount and form reset scenarios by reacting to needsInitialize.\n // CRITICAL: This effect MUST be the LAST hook in this component.\n // It sets hasInitialized.current = true, which acts as a gate for other effects.\n // If this runs before other effects, hasInitialized will be true during their first run,\n // causing them to execute logic meant only for post-initialization (e.g., validation,\n // animation enabling). By placing this last, all other effects run first with\n // hasInitialized = false, allowing them to skip initialization-phase logic.\n useEffect(\n () => {\n if (needsInitialize) {\n // use setValue instead of append to avoid focusing the added element\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n setValue(name as Path<TFieldValues>, [elementInitialValue] as any, {\n shouldDirty: false,\n shouldTouch: false,\n });\n\n // Mark initialization as complete\n hasInitialized.current = true;\n\n // Enable animations after a brief delay (unless user prefers reduced motion or animations are already enabled).\n // This only runs on initial mount when animations start disabled.\n // On reset, disableAnimation is typically false, so this setTimeout won't run and animations stay enabled.\n if (!prefersReducedMotion && disableAnimation) {\n setTimeout(() => {\n setDisableAnimation(false);\n }, 1);\n }\n }\n },\n // Run when needsInitialize changes (initial mount or reset)\n // needsInitialize is memoized based on fields.length and lastElementNotRemovable\n // Other dependencies are intentionally omitted:\n // - append, setValue, trigger, setDisableAnimation are stable refs/functions\n // - elementInitialValue, name, flat, prefersReducedMotion, disableAnimation are props/stable values\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [needsInitialize],\n );\n\n return {\n // Field array methods and state\n fields,\n append,\n remove,\n insert,\n move,\n disableAnimation,\n elementInitialValue,\n // Uniform field state and utilities (spread all)\n ...uniformField,\n };\n};\n","/* v8 ignore start */\n\nexport * from './useUniformFieldArray';\n\n/* v8 ignore stop */\n"],"mappings":";;;;;;;;;;;;;;;;;;;AA2CA,MAAa,wBAEX,EACA,MACA,OAAO,OACP,qBAAqB,uBAAuB,MAC5C,0BAA0B,OAC1B,UACA,QAAQ,gBACR,YAC6C;CAE7C,MAAM,eAAe,gBAA8B;EAC3C;EACN;EACA,QAAQ;EACR;CACF,CAAC;CAED,MAAM,EAAE,YAAY;CAEpB,MAAM,EAAE,QAAQ,QAAQ,QAAQ,QAAQ,SAASA,cAAiB;EAChE;EACA;CACF,CAAC;CAED,MAAM,EAAE,SAAS,aAAaC,iBAA6B;CAQ3D,MAAM,kBAAkB,cAAc;EACpC,OAAO,2BAA2B,OAAO,WAAW;CACtD,GAAG,CAAC,yBAAyB,OAAO,MAAM,CAAC;CAS3C,MAAM,iBAAiB,OAAO,CAAC,eAAe;CAK9C,gBAAgB;EACd,IAAI,iBACF,eAAe,UAAU;CAE7B,GAAG,CAAC,eAAe,CAAC;CAOpB,gBAAgB;EACd,IAAI,eAAe,SACjB,iBAAiB;GACf,QAAQ,IAA0B;EACpC,GAAG,GAAG;CAGV,GAAG,CAAC,OAAO,MAAM,CAAC;CAIlB,MAAM,CAAC,kBAAkB,uBAAuB,SAAS,IAAI;CAI7D,MAAM,uBAAuB,iBAAiB;CAC9C,gBAAgB;EACd,IAAI,eAAe,SACjB,oBAAoB,CAAC,CAAC,oBAAoB;CAE9C,GAAG,CAAC,oBAAoB,CAAC;CAKzB,MAAM,sBAAsB,cAAc;EACxC,OAAO,OACH,GAAG,eAAe,wBAAwB,KAAK,IAC9C,wBAAwB,CAAC;CAChC,GAAG,CAAC,MAAM,oBAAoB,CAAC;CAU/B,gBACQ;EACJ,IAAI,iBAAiB;GAGnB,SAAS,MAA4B,CAAC,mBAAmB,GAAU;IACjE,aAAa;IACb,aAAa;GACf,CAAC;GAGD,eAAe,UAAU;GAKzB,IAAI,CAAC,wBAAwB,kBAC3B,iBAAiB;IACf,oBAAoB,KAAK;GAC3B,GAAG,CAAC;EAER;CACF,GAOA,CAAC,eAAe,CAClB;CAEA,OAAO;EAEL;EACA;EACA;EACA;EACA;EACA;EACA;EAEA,GAAG;CACL;AACF"}
|
|
@@ -0,0 +1,224 @@
|
|
|
1
|
+
//#region src/helpers/createOptionValueConverter/createOptionValueConverter.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* Creates a converter function that preserves the original type (string, number, or boolean)
|
|
4
|
+
* of option values when converting from string keys back to their original type.
|
|
5
|
+
*
|
|
6
|
+
* This is useful for radio/select components where the underlying UI library
|
|
7
|
+
* uses string keys internally, but we want to preserve number/boolean values in the form state.
|
|
8
|
+
*
|
|
9
|
+
* @param options - Array of options with a value property that can be string, number, or boolean
|
|
10
|
+
* @returns An object with:
|
|
11
|
+
* - `convertToOriginalType`: Function to convert a string key back to its original type
|
|
12
|
+
* - `numberValueKeys`: Set of string representations of number values (for internal use)
|
|
13
|
+
* - `booleanValueKeys`: Map of string representations to boolean values (for internal use)
|
|
14
|
+
*/
|
|
15
|
+
declare const createOptionValueConverter: <T extends {
|
|
16
|
+
value: string | number | boolean;
|
|
17
|
+
}>(options: T[]) => {
|
|
18
|
+
booleanValueKeys: Map<string, boolean>;
|
|
19
|
+
convertToOriginalType: (key: string | number | boolean) => string | number | boolean;
|
|
20
|
+
numberValueKeys: Set<string>;
|
|
21
|
+
};
|
|
22
|
+
//#endregion
|
|
23
|
+
//#region src/helpers/nullishFields/nullishFields.d.ts
|
|
24
|
+
/** Key used to wrap flat array elements when converting to form format */
|
|
25
|
+
declare const flatArrayKey = "__FLAT__";
|
|
26
|
+
/**
|
|
27
|
+
* Checks if a value is considered "empty" for validation display purposes.
|
|
28
|
+
*
|
|
29
|
+
* Used by useUniformField to determine when to show validation errors.
|
|
30
|
+
* Empty values don't trigger immediate error display (user must interact first).
|
|
31
|
+
*
|
|
32
|
+
* Handles:
|
|
33
|
+
* - Primitives: null, undefined, ''
|
|
34
|
+
* - Marker strings: __NULL__, __FALSE__, __ZERO__ (converted via fromNullishString)
|
|
35
|
+
* - Empty arrays: []
|
|
36
|
+
* - Objects with all empty values: {a: null, b: ''}
|
|
37
|
+
* - Flat array wrappers: {__FLAT__: null} or {__FLAT__: ''}
|
|
38
|
+
*
|
|
39
|
+
* @param value - The value to check (will be converted via fromNullishString first)
|
|
40
|
+
* @returns true if the value is empty
|
|
41
|
+
*
|
|
42
|
+
* @example
|
|
43
|
+
* isValueEmpty(null) // true
|
|
44
|
+
* isValueEmpty('') // true
|
|
45
|
+
* isValueEmpty('__NULL__') // true (marker string)
|
|
46
|
+
* isValueEmpty([]) // true (empty array)
|
|
47
|
+
* isValueEmpty({a: null}) // true (object with all empty values)
|
|
48
|
+
* isValueEmpty({__FLAT__: null}) // true (flat array wrapper with empty value)
|
|
49
|
+
* isValueEmpty({__FLAT__: ''}) // true
|
|
50
|
+
* isValueEmpty('hello') // false
|
|
51
|
+
* isValueEmpty([1, 2]) // false
|
|
52
|
+
* isValueEmpty({a: 'value'}) // false
|
|
53
|
+
* isValueEmpty({__FLAT__: 'value'}) // false
|
|
54
|
+
*/
|
|
55
|
+
declare const isValueEmpty: (value: unknown) => boolean;
|
|
56
|
+
/**
|
|
57
|
+
* Converts marker strings back to their original values when processing arrays
|
|
58
|
+
*/
|
|
59
|
+
declare const fromNullishString: (value: unknown) => unknown;
|
|
60
|
+
/**
|
|
61
|
+
* Converts null/falsy values to marker strings for JSON processing
|
|
62
|
+
*/
|
|
63
|
+
declare const toNullishString: (value: unknown) => unknown;
|
|
64
|
+
/**
|
|
65
|
+
* Converts field values to a format suitable for forms by:
|
|
66
|
+
* - Wrapping arrays of primitives as objects using the flatArrayKey `__FLAT__`
|
|
67
|
+
* to satisfy RHF's requirement that array fields contain objects
|
|
68
|
+
* - Removing empty strings and null values from objects
|
|
69
|
+
*
|
|
70
|
+
* This conversion is required because React Hook Form does not support arrays with
|
|
71
|
+
* flat values (string, number, boolean, null). Array fields must contain objects.
|
|
72
|
+
* We work around this by wrapping primitive entries: `{ __FLAT__: <value> }`.
|
|
73
|
+
*
|
|
74
|
+
* @example
|
|
75
|
+
* const fields = {
|
|
76
|
+
* name: 'John',
|
|
77
|
+
* scores: [0, null, 75, false],
|
|
78
|
+
* scoresDetailed: [
|
|
79
|
+
* { score: 1 },
|
|
80
|
+
* { score: null },
|
|
81
|
+
* { score: 0 },
|
|
82
|
+
* { score: false },
|
|
83
|
+
* { score: '' },
|
|
84
|
+
* ],
|
|
85
|
+
* contact: {
|
|
86
|
+
* email: '',
|
|
87
|
+
* phone: null,
|
|
88
|
+
* address: '123 Main St'
|
|
89
|
+
* }
|
|
90
|
+
* };
|
|
91
|
+
*
|
|
92
|
+
* // Result:
|
|
93
|
+
* {
|
|
94
|
+
* name: 'John',
|
|
95
|
+
* scores: [
|
|
96
|
+
* { __FLAT__: 0 },
|
|
97
|
+
* { __FLAT__: null },
|
|
98
|
+
* { __FLAT__: 75 },
|
|
99
|
+
* { __FLAT__: false }
|
|
100
|
+
* ],
|
|
101
|
+
* // Arrays of objects are left as objects; empty/null properties are removed
|
|
102
|
+
* scoresDetailed: [
|
|
103
|
+
* { score: 1 },
|
|
104
|
+
* {}, // null score removed
|
|
105
|
+
* { score: 0 },
|
|
106
|
+
* { score: false },
|
|
107
|
+
* {}, // empty string removed
|
|
108
|
+
* ],
|
|
109
|
+
* contact: {
|
|
110
|
+
* address: '123 Main St'
|
|
111
|
+
* }
|
|
112
|
+
* }
|
|
113
|
+
*/
|
|
114
|
+
declare const toFormFormat: (fields: Record<string, unknown>) => Record<string, unknown>;
|
|
115
|
+
/**
|
|
116
|
+
* Converts form state to a format suitable for validation by:
|
|
117
|
+
* - Unwrapping flat array wrappers `{ __FLAT__: <value> }` back to primitives
|
|
118
|
+
* - Converting legacy string markers (__NULL__, __FALSE__, __ZERO__) back to their original values
|
|
119
|
+
* - Removing fields whose converted value is empty string or null
|
|
120
|
+
* - Removing empty arrays
|
|
121
|
+
*
|
|
122
|
+
* @example
|
|
123
|
+
* const formState = {
|
|
124
|
+
* name: 'John',
|
|
125
|
+
* scores: [
|
|
126
|
+
* { __FLAT__: 75 },
|
|
127
|
+
* { __FLAT__: 0 },
|
|
128
|
+
* { __FLAT__: null },
|
|
129
|
+
* { __FLAT__: false }
|
|
130
|
+
* ],
|
|
131
|
+
* emptyArray: [],
|
|
132
|
+
* scoresDetailed: [
|
|
133
|
+
* { score: 1 },
|
|
134
|
+
* {},
|
|
135
|
+
* { score: 0 },
|
|
136
|
+
* { score: false },
|
|
137
|
+
* {},
|
|
138
|
+
* ],
|
|
139
|
+
* contact: {
|
|
140
|
+
* address: '123 Main St',
|
|
141
|
+
* fax: null
|
|
142
|
+
* }
|
|
143
|
+
* };
|
|
144
|
+
*
|
|
145
|
+
* // Result:
|
|
146
|
+
* {
|
|
147
|
+
* name: 'John',
|
|
148
|
+
* scores: [75, 0, null, false],
|
|
149
|
+
* // emptyArray is removed
|
|
150
|
+
* // Objects inside arrays remain objects; empty entries remain empty objects
|
|
151
|
+
* scoresDetailed: [
|
|
152
|
+
* { score: 1 },
|
|
153
|
+
* {},
|
|
154
|
+
* { score: 0 },
|
|
155
|
+
* { score: false },
|
|
156
|
+
* {},
|
|
157
|
+
* ],
|
|
158
|
+
* contact: {
|
|
159
|
+
* address: '123 Main St'
|
|
160
|
+
* }
|
|
161
|
+
* }
|
|
162
|
+
*/
|
|
163
|
+
declare const toValidationFormat: (formState: Record<string, unknown> | null | undefined) => Record<string, unknown> | null | undefined;
|
|
164
|
+
/**
|
|
165
|
+
* Converts form state to a format suitable for submission by:
|
|
166
|
+
* - Applying all transformations from toValidationFormat
|
|
167
|
+
* - Additionally removing empty objects from the result
|
|
168
|
+
* - Filtering empty objects from arrays
|
|
169
|
+
* - Recursively cleaning nested structures
|
|
170
|
+
*
|
|
171
|
+
* **Why separate from toValidationFormat?**
|
|
172
|
+
*
|
|
173
|
+
* Empty objects must be preserved during validation so that custom refinements
|
|
174
|
+
* can run. For example, a FieldCard with "at least email or phone required"
|
|
175
|
+
* validation needs the object to exist (even if empty) for the refine to execute.
|
|
176
|
+
*
|
|
177
|
+
* However, for submission, empty objects are meaningless and should be removed
|
|
178
|
+
* to produce clean data for APIs.
|
|
179
|
+
*
|
|
180
|
+
* @example
|
|
181
|
+
* const formState = {
|
|
182
|
+
* name: 'John',
|
|
183
|
+
* contact: {}, // Empty FieldCard - will be removed
|
|
184
|
+
* tags: [{}, {}, {}], // All empty - array will be removed
|
|
185
|
+
* items: [
|
|
186
|
+
* { value: 'a' },
|
|
187
|
+
* {}, // Empty entry - will be filtered out
|
|
188
|
+
* { value: 'b' }
|
|
189
|
+
* ],
|
|
190
|
+
* nested: {
|
|
191
|
+
* deep: {} // Nested empty - will be removed recursively
|
|
192
|
+
* }
|
|
193
|
+
* };
|
|
194
|
+
*
|
|
195
|
+
* // Result:
|
|
196
|
+
* {
|
|
197
|
+
* name: 'John',
|
|
198
|
+
* items: [{ value: 'a' }, { value: 'b' }]
|
|
199
|
+
* }
|
|
200
|
+
*/
|
|
201
|
+
declare const toSubmitFormat: (formState: Record<string, unknown> | null | undefined) => Record<string, unknown> | null | undefined;
|
|
202
|
+
/**
|
|
203
|
+
* Converts a field name to a testId by removing flat array key segments and slugifying.
|
|
204
|
+
* Removes all occurrences of `flatArrayKey` from the field name and applies slugify transformation.
|
|
205
|
+
*
|
|
206
|
+
* This is used to generate stable testIds for form fields that don't include
|
|
207
|
+
* the internal `__FLAT__` marker used for flat arrays.
|
|
208
|
+
*
|
|
209
|
+
* @param name - The field name as a string (e.g., 'tags.0.__FLAT__') or array path (e.g., ['tags', '0', '__FLAT__'])
|
|
210
|
+
* @returns The slugified field name with all flat array key segments removed (e.g., 'tags_0')
|
|
211
|
+
*
|
|
212
|
+
* @example
|
|
213
|
+
* ```ts
|
|
214
|
+
* nameToTestId('tags.0.__FLAT__') // => 'tags_0'
|
|
215
|
+
* nameToTestId('array.0.__FLAT__') // => 'array_0'
|
|
216
|
+
* nameToTestId('nested.array.0.__FLAT__.field') // => 'nested_array_0_field'
|
|
217
|
+
* nameToTestId('simple.field') // => 'simple_field'
|
|
218
|
+
* nameToTestId(['tags', '0', '__FLAT__']) // => 'tags_0'
|
|
219
|
+
* ```
|
|
220
|
+
*/
|
|
221
|
+
declare const nameToTestId: (name: string | readonly string[]) => string;
|
|
222
|
+
//#endregion
|
|
223
|
+
export { toFormFormat as a, toValidationFormat as c, nameToTestId as i, createOptionValueConverter as l, fromNullishString as n, toNullishString as o, isValueEmpty as r, toSubmitFormat as s, flatArrayKey as t };
|
|
224
|
+
//# sourceMappingURL=index-0zgyvkAF.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index-0zgyvkAF.d.cts","names":[],"sources":["../src/helpers/createOptionValueConverter/createOptionValueConverter.ts","../src/helpers/nullishFields/nullishFields.ts"],"mappings":";;AAeA;;;;;;;;;;;;cAAa,0BAAA;EACC,KAAA;AAAA,GAEZ,OAAA,EAAS,CAAA;;;;;;;;cCfE,YAAA;;;;;;;;;;;;;;;;;;;;;;;AAAb;;;;AAAyB;AAsCzB;;cAAa,YAAA,GAAgB,KAAc;;AAAA;AA0B3C;cAAa,iBAAA,GAAqB,KAAc;;;AAAA;cAsCnC,eAAA,GAAmB,KAAc;;;;AAAA;AA6E9C;;;;;;;;AAwB6C;AAmD7C;;;;;;;;AAES;AAuKT;;;;;;;;AAES;AA2BT;;;;AAA6D;;;;;;;;;;;;;;;cAjRhD,YAAA,GAAgB,MAAA,EAAQ,MAAA,sBAwBE,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAmDhC,kBAAA,GACX,SAAA,EAAW,MAAA,yCACV,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAuKI,cAAA,GACX,SAAA,EAAW,MAAA,yCACV,MAAM;;;;;;;;;;;;;;;;;;;;cA2BI,YAAA,GAAgB,IAAgC"}
|
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
import { t as TVReturnType } from "./index-1R5A9Hrq.js";
|
|
2
1
|
import { TVClassName, TVProps } from "@fuf-stack/pixel-utils";
|
|
3
2
|
import { CSSProperties, JSX, ReactNode } from "react";
|
|
4
|
-
import * as _$react_jsx_runtime0 from "react/jsx-runtime";
|
|
5
3
|
|
|
6
4
|
//#region src/FieldArray/subcomponents/FieldArrayElement.d.ts
|
|
7
5
|
interface FieldArrayElementMethods {
|
|
@@ -56,7 +54,7 @@ interface FieldArrayProps extends FieldArrayFeatures, VariantProps {
|
|
|
56
54
|
}
|
|
57
55
|
//#endregion
|
|
58
56
|
//#region src/FieldArray/FieldArray.d.ts
|
|
59
|
-
declare const fieldArrayVariants: TVReturnType<{
|
|
57
|
+
declare const fieldArrayVariants: import("tailwind-variants").TVReturnType<{
|
|
60
58
|
hasLabel: {
|
|
61
59
|
false: {
|
|
62
60
|
actionsMenuButton: string;
|
|
@@ -96,7 +94,7 @@ declare const fieldArrayVariants: TVReturnType<{
|
|
|
96
94
|
listItemInner: string[]; /** class for the remove button */
|
|
97
95
|
removeButton: string[]; /** class for the sort drag handle */
|
|
98
96
|
sortDragHandle: string[];
|
|
99
|
-
}, TVReturnType<{
|
|
97
|
+
}, import("tailwind-variants").TVReturnType<{
|
|
100
98
|
hasLabel: {
|
|
101
99
|
false: {
|
|
102
100
|
actionsMenuButton: string;
|
|
@@ -133,7 +131,7 @@ declare const FieldArray: ({
|
|
|
133
131
|
name,
|
|
134
132
|
sortable,
|
|
135
133
|
...uniformFieldProps
|
|
136
|
-
}: FieldArrayProps) =>
|
|
134
|
+
}: FieldArrayProps) => import("react/jsx-runtime").JSX.Element;
|
|
137
135
|
//#endregion
|
|
138
136
|
export { FieldArrayProps as i, FieldArrayChildrenRenderFn as n, FieldArrayFeatures as r, FieldArray as t };
|
|
139
|
-
//# sourceMappingURL=index-
|
|
137
|
+
//# sourceMappingURL=index-3gVUFqgo.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index-3gVUFqgo.d.cts","names":[],"sources":["../src/FieldArray/subcomponents/FieldArrayElement.tsx","../src/FieldArray/types.ts","../src/FieldArray/FieldArray.tsx"],"mappings":";;;;UAiBiB,wBAAA;;EAEf,MAAA;EAFuC;EAIvC,SAAA;EAJuC;EAMvC,MAAA;EAFA;EAIA,MAAA;AAAA;;;KCpBG,YAAA,GAAe,OAAO,QAAQ,kBAAA;AAAA,KAC9B,SAAA,GAAY,WAAW,QAAQ,kBAAA;;KAGxB,0BAAA,IAA8B,IAAA;EDUxC,sDCRA,KAAA,UDYA;ECVA,MAAA,UDYM;ECVN,OAAA,EAAS,wBAAA;EAET,IAAA;EAEA,MAAA;AAAA,MACI,GAAA,CAAI,OAAO;AAAA,UAEA,kBAAA;EAjBG;EAmBlB,SAAA;EAlBG;EAoBH,WAAA;;EAEA,QAAA;AAAA;AAAA,UAGe,eAAA,SAAwB,kBAAA,EAAoB,YAAA;EAtBvB;EAwBpC,gBAAA;EAbe;EAef,QAAA,EAAU,0BAAA;EAtBV;EAwBA,SAAA,GAAY,SAAA;EAEZ,mBAAA;EAKA,mBAAA,GAAsB,aAAA;EAzBtB;EA2BA,IAAA;EA1BI;EA4BJ,KAAA,GAAQ,SAAA;EA5BO;EA8Bf,uBAAA;EA5Be;EA8Bf,IAAA;;EAEA,MAAA;AAAA;;;cCzCW,kBAAA,8BAAkB,YAAA;;;;;;;;;EFU7B,6DAEM;;;+BCpBS;mBAAG;kBACf;;sBAAiD;2BAGhB;0BAWrB;;;;;;;;;;;EAAA,6DAEkB;+BAAA;0BAIjC;+BAEQ;mBAGO;;yBAMH;sBAWJ;2BAjBmD;0BAAY;;;;;;;;;;;EAevE,6DAEQ;+BAIR;0BAEM;;;kBCiDN;yBAAA;;;;;;;;;cAKI,UAAA;EAAc,gBAAA;EAAA,QAAA;EAAA,SAAA,EAAA,UAAA;EAAA,SAAA;EAAA,mBAAA,EAAA,oBAAA;EAAA,mBAAA;EAAA,IAAA;EAAA,WAAA;EAAA,uBAAA;EAAA,IAAA;EAAA,QAAA;EAAA,GAAA;AAAA,GAajB,eAAA,iCAAe,GAAA,CAAA,OAAA"}
|
|
@@ -1,34 +1,33 @@
|
|
|
1
|
-
import { n as ClassNameValue, t as TVReturnType } from "./index-1R5A9Hrq.js";
|
|
2
1
|
import { TVClassName, TVProps } from "@fuf-stack/pixel-utils";
|
|
3
2
|
import { ReactElement, ReactNode } from "react";
|
|
4
3
|
|
|
5
4
|
//#region src/Radios/Radios.d.ts
|
|
6
|
-
declare const radiosVariants: TVReturnType<{
|
|
5
|
+
declare const radiosVariants: import("tailwind-variants").TVReturnType<{
|
|
7
6
|
[key: string]: {
|
|
8
|
-
[key: string]: ClassNameValue | {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
wrapper?: ClassNameValue;
|
|
7
|
+
[key: string]: import("tailwind-merge").ClassNameValue | {
|
|
8
|
+
base?: import("tailwind-merge").ClassNameValue;
|
|
9
|
+
itemBase?: import("tailwind-merge").ClassNameValue;
|
|
10
|
+
itemControl?: import("tailwind-merge").ClassNameValue;
|
|
11
|
+
itemDescription?: import("tailwind-merge").ClassNameValue;
|
|
12
|
+
itemLabel?: import("tailwind-merge").ClassNameValue;
|
|
13
|
+
itemLabelWrapper?: import("tailwind-merge").ClassNameValue;
|
|
14
|
+
itemWrapper?: import("tailwind-merge").ClassNameValue;
|
|
15
|
+
label?: import("tailwind-merge").ClassNameValue;
|
|
16
|
+
wrapper?: import("tailwind-merge").ClassNameValue;
|
|
18
17
|
};
|
|
19
18
|
};
|
|
20
19
|
} | {
|
|
21
20
|
[x: string]: {
|
|
22
|
-
[x: string]: ClassNameValue | {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
wrapper?: ClassNameValue;
|
|
21
|
+
[x: string]: import("tailwind-merge").ClassNameValue | {
|
|
22
|
+
base?: import("tailwind-merge").ClassNameValue;
|
|
23
|
+
itemBase?: import("tailwind-merge").ClassNameValue;
|
|
24
|
+
itemControl?: import("tailwind-merge").ClassNameValue;
|
|
25
|
+
itemDescription?: import("tailwind-merge").ClassNameValue;
|
|
26
|
+
itemLabel?: import("tailwind-merge").ClassNameValue;
|
|
27
|
+
itemLabelWrapper?: import("tailwind-merge").ClassNameValue;
|
|
28
|
+
itemWrapper?: import("tailwind-merge").ClassNameValue;
|
|
29
|
+
label?: import("tailwind-merge").ClassNameValue;
|
|
30
|
+
wrapper?: import("tailwind-merge").ClassNameValue;
|
|
32
31
|
};
|
|
33
32
|
};
|
|
34
33
|
} | {}, {
|
|
@@ -43,16 +42,16 @@ declare const radiosVariants: TVReturnType<{
|
|
|
43
42
|
wrapper: string;
|
|
44
43
|
}, undefined, {
|
|
45
44
|
[key: string]: {
|
|
46
|
-
[key: string]: ClassNameValue | {
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
wrapper?: ClassNameValue;
|
|
45
|
+
[key: string]: import("tailwind-merge").ClassNameValue | {
|
|
46
|
+
base?: import("tailwind-merge").ClassNameValue;
|
|
47
|
+
itemBase?: import("tailwind-merge").ClassNameValue;
|
|
48
|
+
itemControl?: import("tailwind-merge").ClassNameValue;
|
|
49
|
+
itemDescription?: import("tailwind-merge").ClassNameValue;
|
|
50
|
+
itemLabel?: import("tailwind-merge").ClassNameValue;
|
|
51
|
+
itemLabelWrapper?: import("tailwind-merge").ClassNameValue;
|
|
52
|
+
itemWrapper?: import("tailwind-merge").ClassNameValue;
|
|
53
|
+
label?: import("tailwind-merge").ClassNameValue;
|
|
54
|
+
wrapper?: import("tailwind-merge").ClassNameValue;
|
|
56
55
|
};
|
|
57
56
|
};
|
|
58
57
|
} | {}, {
|
|
@@ -65,7 +64,7 @@ declare const radiosVariants: TVReturnType<{
|
|
|
65
64
|
itemWrapper: string;
|
|
66
65
|
label: string;
|
|
67
66
|
wrapper: string;
|
|
68
|
-
}, TVReturnType<unknown, {
|
|
67
|
+
}, import("tailwind-variants").TVReturnType<unknown, {
|
|
69
68
|
base: string;
|
|
70
69
|
itemBase: string;
|
|
71
70
|
itemControl: string;
|
|
@@ -120,4 +119,4 @@ declare const Radios: ({
|
|
|
120
119
|
}: RadiosProps) => ReactElement;
|
|
121
120
|
//#endregion
|
|
122
121
|
export { RadiosProps as n, Radios as t };
|
|
123
|
-
//# sourceMappingURL=index-
|
|
122
|
+
//# sourceMappingURL=index-65doPHAW.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index-65doPHAW.d.ts","names":[],"sources":["../src/Radios/Radios.tsx"],"mappings":";;;;cAaa,cAAA,8BAAc,YAAA;EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAkBtB,YAAA,GAAe,OAAO,QAAQ,cAAA;AAAA,KAC9B,SAAA,GAAY,WAAW,QAAQ,cAAA;AAAA,UAEnB,WAAA;;EAEf,QAAA;;EAEA,KAAA,GAAQ,SAAA;;EAER,IAAA,GAAO,SAAS;;EAEhB,MAAA;;EAEA,KAAA;AAAA;AAAA,UAGe,WAAA,SAAoB,YAAA;;EAEnC,SAAA;;EAEA,SAAA,GAAY,SAAA;;EAEZ,QAAA;;EAEA,MAAA;;EAEA,KAAA,GAAQ,SAAA;;EAER,IAAA;EA5BG;EA8BH,OAAA,EAAS,WAAA;;EAET,MAAA;AAAA;AAhC+C;;;AAAA,cAsC3C,MAAA;EAAU,SAAA;EAAA,MAAA;EAAA,IAAA;EAAA,OAAA;EAAA,GAAA;AAAA,GAMb,WAAA,KAAc,YAAA"}
|
|
@@ -1,32 +1,30 @@
|
|
|
1
|
-
import { n as ClassNameValue, t as TVReturnType } from "./index-CgqESs42.cjs";
|
|
2
|
-
import * as _$react_jsx_runtime0 from "react/jsx-runtime";
|
|
3
1
|
import { TVClassName, TVProps } from "@fuf-stack/pixel-utils";
|
|
4
2
|
import { ReactNode } from "react";
|
|
5
3
|
//#region src/RadioBoxes/RadioBoxes.d.ts
|
|
6
|
-
declare const radioBoxesVariants: TVReturnType<{
|
|
4
|
+
declare const radioBoxesVariants: import("tailwind-variants").TVReturnType<{
|
|
7
5
|
[key: string]: {
|
|
8
|
-
[key: string]: ClassNameValue | {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
wrapper?: ClassNameValue;
|
|
12
|
-
boxBase?: ClassNameValue;
|
|
13
|
-
boxControl?: ClassNameValue;
|
|
14
|
-
boxDescription?: ClassNameValue;
|
|
15
|
-
boxLabel?: ClassNameValue;
|
|
16
|
-
boxLabelWrapper?: ClassNameValue;
|
|
6
|
+
[key: string]: import("tailwind-merge").ClassNameValue | {
|
|
7
|
+
base?: import("tailwind-merge").ClassNameValue;
|
|
8
|
+
label?: import("tailwind-merge").ClassNameValue;
|
|
9
|
+
wrapper?: import("tailwind-merge").ClassNameValue;
|
|
10
|
+
boxBase?: import("tailwind-merge").ClassNameValue;
|
|
11
|
+
boxControl?: import("tailwind-merge").ClassNameValue;
|
|
12
|
+
boxDescription?: import("tailwind-merge").ClassNameValue;
|
|
13
|
+
boxLabel?: import("tailwind-merge").ClassNameValue;
|
|
14
|
+
boxLabelWrapper?: import("tailwind-merge").ClassNameValue;
|
|
17
15
|
};
|
|
18
16
|
};
|
|
19
17
|
} | {
|
|
20
18
|
[x: string]: {
|
|
21
|
-
[x: string]: ClassNameValue | {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
wrapper?: ClassNameValue;
|
|
25
|
-
boxBase?: ClassNameValue;
|
|
26
|
-
boxControl?: ClassNameValue;
|
|
27
|
-
boxDescription?: ClassNameValue;
|
|
28
|
-
boxLabel?: ClassNameValue;
|
|
29
|
-
boxLabelWrapper?: ClassNameValue;
|
|
19
|
+
[x: string]: import("tailwind-merge").ClassNameValue | {
|
|
20
|
+
base?: import("tailwind-merge").ClassNameValue;
|
|
21
|
+
label?: import("tailwind-merge").ClassNameValue;
|
|
22
|
+
wrapper?: import("tailwind-merge").ClassNameValue;
|
|
23
|
+
boxBase?: import("tailwind-merge").ClassNameValue;
|
|
24
|
+
boxControl?: import("tailwind-merge").ClassNameValue;
|
|
25
|
+
boxDescription?: import("tailwind-merge").ClassNameValue;
|
|
26
|
+
boxLabel?: import("tailwind-merge").ClassNameValue;
|
|
27
|
+
boxLabelWrapper?: import("tailwind-merge").ClassNameValue;
|
|
30
28
|
};
|
|
31
29
|
};
|
|
32
30
|
} | {}, {
|
|
@@ -40,15 +38,15 @@ declare const radioBoxesVariants: TVReturnType<{
|
|
|
40
38
|
wrapper: string;
|
|
41
39
|
}, undefined, {
|
|
42
40
|
[key: string]: {
|
|
43
|
-
[key: string]: ClassNameValue | {
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
wrapper?: ClassNameValue;
|
|
47
|
-
boxBase?: ClassNameValue;
|
|
48
|
-
boxControl?: ClassNameValue;
|
|
49
|
-
boxDescription?: ClassNameValue;
|
|
50
|
-
boxLabel?: ClassNameValue;
|
|
51
|
-
boxLabelWrapper?: ClassNameValue;
|
|
41
|
+
[key: string]: import("tailwind-merge").ClassNameValue | {
|
|
42
|
+
base?: import("tailwind-merge").ClassNameValue;
|
|
43
|
+
label?: import("tailwind-merge").ClassNameValue;
|
|
44
|
+
wrapper?: import("tailwind-merge").ClassNameValue;
|
|
45
|
+
boxBase?: import("tailwind-merge").ClassNameValue;
|
|
46
|
+
boxControl?: import("tailwind-merge").ClassNameValue;
|
|
47
|
+
boxDescription?: import("tailwind-merge").ClassNameValue;
|
|
48
|
+
boxLabel?: import("tailwind-merge").ClassNameValue;
|
|
49
|
+
boxLabelWrapper?: import("tailwind-merge").ClassNameValue;
|
|
52
50
|
};
|
|
53
51
|
};
|
|
54
52
|
} | {}, {
|
|
@@ -60,7 +58,7 @@ declare const radioBoxesVariants: TVReturnType<{
|
|
|
60
58
|
boxLabelWrapper: string;
|
|
61
59
|
label: string;
|
|
62
60
|
wrapper: string;
|
|
63
|
-
}, TVReturnType<unknown, {
|
|
61
|
+
}, import("tailwind-variants").TVReturnType<unknown, {
|
|
64
62
|
base: string;
|
|
65
63
|
boxBase: string;
|
|
66
64
|
boxControl: string;
|
|
@@ -113,10 +111,10 @@ declare const RadioBoxes: ({
|
|
|
113
111
|
name,
|
|
114
112
|
options,
|
|
115
113
|
...uniformFieldProps
|
|
116
|
-
}: RadioBoxesProps) =>
|
|
114
|
+
}: RadioBoxesProps) => import("react/jsx-runtime").JSX.Element;
|
|
117
115
|
//#endregion
|
|
118
116
|
//#region src/RadioBoxes/RadioBox.d.ts
|
|
119
|
-
declare const radioBoxVariants: TVReturnType<{
|
|
117
|
+
declare const radioBoxVariants: import("tailwind-variants").TVReturnType<{
|
|
120
118
|
isDisabled: {
|
|
121
119
|
true: {
|
|
122
120
|
base: string;
|
|
@@ -152,7 +150,7 @@ declare const radioBoxVariants: TVReturnType<{
|
|
|
152
150
|
icon: string;
|
|
153
151
|
label: string;
|
|
154
152
|
labelWrapper: string;
|
|
155
|
-
}, TVReturnType<{
|
|
153
|
+
}, import("tailwind-variants").TVReturnType<{
|
|
156
154
|
isDisabled: {
|
|
157
155
|
true: {
|
|
158
156
|
base: string;
|
|
@@ -173,4 +171,4 @@ declare const radioBoxVariants: TVReturnType<{
|
|
|
173
171
|
}, undefined, unknown, unknown, undefined>>;
|
|
174
172
|
//#endregion
|
|
175
173
|
export { RadioBoxes as n, RadioBoxesProps as r, radioBoxVariants as t };
|
|
176
|
-
//# sourceMappingURL=index-
|
|
174
|
+
//# sourceMappingURL=index-B682jKQ_.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index-B682jKQ_.d.ts","names":[],"sources":["../src/RadioBoxes/RadioBoxes.tsx","../src/RadioBoxes/RadioBox.tsx"],"mappings":";;;cAaa,kBAAA,8BAAkB,YAAA;EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAgB1B,YAAA,GAAe,OAAO,QAAQ,kBAAA;AAAA,KAC9B,SAAA,GAAY,WAAW,QAAQ,kBAAA;AAAA,UAEnB,gBAAA;;EAEf,WAAA,GAAc,SAAA;;EAEd,QAAA;;EAEA,KAAA,GAAQ,SAAA;;EAER,IAAA,GAAO,SAAA;;EAEP,MAAA;;EAEA,KAAA;AAAA;AAAA,UAGe,eAAA,SAAwB,YAAA;;EAEvC,SAAA;;EAEA,SAAA,GAAY,SAAA;;EAEZ,QAAA;;EAEA,MAAA;EA1BG;EA4BH,KAAA,GAAQ,SAAA;;EAER,IAAA;EA9BmD;EAgCnD,OAAA,EAAS,gBAAA;EA/BG;EAiCZ,MAAA;AAAA;AAjCoD;AAEtD;;AAFsD,cAuChD,UAAA;EAAc,SAAA;EAAA,MAAA;EAAA,IAAA;EAAA,OAAA;EAAA,GAAA;AAAA,GAMjB,eAAA,iCAAe,GAAA,CAAA,OAAA;;;cClEL,gBAAA,8BAAgB,YAAA"}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { t as DebugModeSettings } from "./FormContext-
|
|
1
|
+
import { t as DebugModeSettings } from "./FormContext-DjXw7wN6.js";
|
|
2
2
|
import { ReactNode } from "react";
|
|
3
|
-
import * as _$react_jsx_runtime0 from "react/jsx-runtime";
|
|
4
3
|
import { FieldValues, SubmitHandler } from "react-hook-form";
|
|
5
4
|
import { VetoInstance } from "@fuf-stack/veto";
|
|
6
5
|
|
|
@@ -38,7 +37,7 @@ declare const Form: ({
|
|
|
38
37
|
testId,
|
|
39
38
|
validation,
|
|
40
39
|
validationTrigger
|
|
41
|
-
}: FormProps) =>
|
|
40
|
+
}: FormProps) => import("react/jsx-runtime").JSX.Element;
|
|
42
41
|
//#endregion
|
|
43
42
|
export { FormProps as n, Form as t };
|
|
44
|
-
//# sourceMappingURL=index-
|
|
43
|
+
//# sourceMappingURL=index-BFpoR6oH.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index-BFpoR6oH.d.ts","names":[],"sources":["../src/Form/Form.tsx"],"mappings":";;;;;;UAYiB,SAAA;;EAEf,QAAA,EAAU,SAAA,GAAY,SAAA;EAFE;EAIxB,SAAA;EAFU;EAIV,KAAA,GAAQ,iBAAA;EAAA;EAER,aAAA,GAAgB,WAAA;EAIQ;EAFxB,IAAA;EAMa;EAJb,QAAA,EAAU,aAAA,CAAc,WAAA;EAIC;EAFzB,MAAA;EAZU;EAcV,UAAA,GAAa,YAAA;EAZb;EAcA,iBAAA;AAAA;;;;cAMI,IAAA;EAAQ,QAAA;EAAA,SAAA;EAAA,KAAA;EAAA,aAAA;EAAA,IAAA;EAAA,QAAA;EAAA,MAAA;EAAA,UAAA;EAAA;AAAA,GAUX,SAAA,iCAAS,GAAA,CAAA,OAAA"}
|