rn-inputforge 0.4.0 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +723 -39
- package/lib/commonjs/adapters/index.js +25 -0
- package/lib/commonjs/adapters/index.js.map +1 -0
- package/lib/commonjs/adapters/reactHookForm.js +107 -0
- package/lib/commonjs/adapters/reactHookForm.js.map +1 -0
- package/lib/commonjs/components/FieldFlowAffordance/FieldFlowAffordance.js +104 -0
- package/lib/commonjs/components/FieldFlowAffordance/FieldFlowAffordance.js.map +1 -0
- package/lib/commonjs/components/FieldFlowAffordance/index.js +13 -0
- package/lib/commonjs/components/FieldFlowAffordance/index.js.map +1 -0
- package/lib/commonjs/components/FieldFlowCreditCard/FieldFlowCreditCard.js +146 -0
- package/lib/commonjs/components/FieldFlowCreditCard/FieldFlowCreditCard.js.map +1 -0
- package/lib/commonjs/components/FieldFlowCreditCard/index.js +13 -0
- package/lib/commonjs/components/FieldFlowCreditCard/index.js.map +1 -0
- package/lib/commonjs/components/FieldFlowDraftBanner/FieldFlowDraftBanner.js +156 -0
- package/lib/commonjs/components/FieldFlowDraftBanner/FieldFlowDraftBanner.js.map +1 -0
- package/lib/commonjs/components/FieldFlowDraftBanner/index.js +13 -0
- package/lib/commonjs/components/FieldFlowDraftBanner/index.js.map +1 -0
- package/lib/commonjs/components/FieldFlowInput/FieldFlowInput.js +143 -43
- package/lib/commonjs/components/FieldFlowInput/FieldFlowInput.js.map +1 -1
- package/lib/commonjs/components/FieldFlowInput/styles.js +16 -0
- package/lib/commonjs/components/FieldFlowInput/styles.js.map +1 -1
- package/lib/commonjs/components/FieldFlowNumberStepper/FieldFlowNumberStepper.js +136 -0
- package/lib/commonjs/components/FieldFlowNumberStepper/FieldFlowNumberStepper.js.map +1 -0
- package/lib/commonjs/components/FieldFlowNumberStepper/index.js +13 -0
- package/lib/commonjs/components/FieldFlowNumberStepper/index.js.map +1 -0
- package/lib/commonjs/components/FieldFlowPasswordStrength/FieldFlowPasswordStrength.js +122 -0
- package/lib/commonjs/components/FieldFlowPasswordStrength/FieldFlowPasswordStrength.js.map +1 -0
- package/lib/commonjs/components/FieldFlowPasswordStrength/index.js +13 -0
- package/lib/commonjs/components/FieldFlowPasswordStrength/index.js.map +1 -0
- package/lib/commonjs/components/FieldFlowPhone/FieldFlowPhone.js +263 -0
- package/lib/commonjs/components/FieldFlowPhone/FieldFlowPhone.js.map +1 -0
- package/lib/commonjs/components/FieldFlowPhone/index.js +13 -0
- package/lib/commonjs/components/FieldFlowPhone/index.js.map +1 -0
- package/lib/commonjs/components/FieldFlowRating/FieldFlowRating.js +106 -0
- package/lib/commonjs/components/FieldFlowRating/FieldFlowRating.js.map +1 -0
- package/lib/commonjs/components/FieldFlowRating/index.js +13 -0
- package/lib/commonjs/components/FieldFlowRating/index.js.map +1 -0
- package/lib/commonjs/components/FieldFlowSection/FieldFlowSection.js +141 -0
- package/lib/commonjs/components/FieldFlowSection/FieldFlowSection.js.map +1 -0
- package/lib/commonjs/components/FieldFlowSection/index.js +13 -0
- package/lib/commonjs/components/FieldFlowSection/index.js.map +1 -0
- package/lib/commonjs/components/FieldFlowSegmented/FieldFlowSegmented.js +195 -0
- package/lib/commonjs/components/FieldFlowSegmented/FieldFlowSegmented.js.map +1 -0
- package/lib/commonjs/components/FieldFlowSegmented/index.js +13 -0
- package/lib/commonjs/components/FieldFlowSegmented/index.js.map +1 -0
- package/lib/commonjs/components/FieldFlowSignature/FieldFlowSignature.js +200 -0
- package/lib/commonjs/components/FieldFlowSignature/FieldFlowSignature.js.map +1 -0
- package/lib/commonjs/components/FieldFlowSignature/index.js +13 -0
- package/lib/commonjs/components/FieldFlowSignature/index.js.map +1 -0
- package/lib/commonjs/components/FieldFlowSlider/FieldFlowSlider.js +178 -0
- package/lib/commonjs/components/FieldFlowSlider/FieldFlowSlider.js.map +1 -0
- package/lib/commonjs/components/FieldFlowSlider/index.js +13 -0
- package/lib/commonjs/components/FieldFlowSlider/index.js.map +1 -0
- package/lib/commonjs/components/FieldFlowStepper/FieldFlowStepper.js +166 -0
- package/lib/commonjs/components/FieldFlowStepper/FieldFlowStepper.js.map +1 -0
- package/lib/commonjs/components/FieldFlowStepper/index.js +13 -0
- package/lib/commonjs/components/FieldFlowStepper/index.js.map +1 -0
- package/lib/commonjs/components/FieldFlowTags/FieldFlowTags.js +240 -0
- package/lib/commonjs/components/FieldFlowTags/FieldFlowTags.js.map +1 -0
- package/lib/commonjs/components/FieldFlowTags/index.js +13 -0
- package/lib/commonjs/components/FieldFlowTags/index.js.map +1 -0
- package/lib/commonjs/components/FieldFlowTypeahead/FieldFlowTypeahead.js +227 -0
- package/lib/commonjs/components/FieldFlowTypeahead/FieldFlowTypeahead.js.map +1 -0
- package/lib/commonjs/components/FieldFlowTypeahead/index.js +13 -0
- package/lib/commonjs/components/FieldFlowTypeahead/index.js.map +1 -0
- package/lib/commonjs/components/FieldFlowUpload/FieldFlowUpload.js +191 -0
- package/lib/commonjs/components/FieldFlowUpload/FieldFlowUpload.js.map +1 -0
- package/lib/commonjs/components/FieldFlowUpload/index.js +13 -0
- package/lib/commonjs/components/FieldFlowUpload/index.js.map +1 -0
- package/lib/commonjs/hooks/index.js +35 -0
- package/lib/commonjs/hooks/index.js.map +1 -1
- package/lib/commonjs/hooks/useFieldFlowArray.js +110 -0
- package/lib/commonjs/hooks/useFieldFlowArray.js.map +1 -0
- package/lib/commonjs/hooks/useFieldFlowDirtyGuard.js +53 -0
- package/lib/commonjs/hooks/useFieldFlowDirtyGuard.js.map +1 -0
- package/lib/commonjs/hooks/useFieldFlowDraft.js +168 -0
- package/lib/commonjs/hooks/useFieldFlowDraft.js.map +1 -0
- package/lib/commonjs/hooks/useFieldFlowForm.js +224 -30
- package/lib/commonjs/hooks/useFieldFlowForm.js.map +1 -1
- package/lib/commonjs/hooks/useFieldFlowSteps.js +77 -0
- package/lib/commonjs/hooks/useFieldFlowSteps.js.map +1 -0
- package/lib/commonjs/hooks/useFormIntelligence.js +130 -0
- package/lib/commonjs/hooks/useFormIntelligence.js.map +1 -0
- package/lib/commonjs/i18n/index.js +25 -0
- package/lib/commonjs/i18n/index.js.map +1 -0
- package/lib/commonjs/i18n/messages.js +88 -0
- package/lib/commonjs/i18n/messages.js.map +1 -0
- package/lib/commonjs/index.js +322 -0
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/intelligence/formAccessibility.js +79 -0
- package/lib/commonjs/intelligence/formAccessibility.js.map +1 -0
- package/lib/commonjs/intelligence/index.js +31 -0
- package/lib/commonjs/intelligence/index.js.map +1 -0
- package/lib/commonjs/intelligence/types.js +2 -0
- package/lib/commonjs/intelligence/types.js.map +1 -0
- package/lib/commonjs/motion/index.js +20 -0
- package/lib/commonjs/motion/index.js.map +1 -0
- package/lib/commonjs/motion/useFieldMotion.js +111 -0
- package/lib/commonjs/motion/useFieldMotion.js.map +1 -0
- package/lib/commonjs/motion/useReducedMotion.js +32 -0
- package/lib/commonjs/motion/useReducedMotion.js.map +1 -0
- package/lib/commonjs/theme/index.js +13 -0
- package/lib/commonjs/theme/index.js.map +1 -1
- package/lib/commonjs/theme/presets.js +142 -0
- package/lib/commonjs/theme/presets.js.map +1 -0
- package/lib/commonjs/utils/affordance.js +151 -0
- package/lib/commonjs/utils/affordance.js.map +1 -0
- package/lib/commonjs/utils/passwordStrength.js +79 -0
- package/lib/commonjs/utils/passwordStrength.js.map +1 -0
- package/lib/commonjs/utils/phoneCountries.js +119 -0
- package/lib/commonjs/utils/phoneCountries.js.map +1 -0
- package/lib/commonjs/validation/validators.js +10 -7
- package/lib/commonjs/validation/validators.js.map +1 -1
- package/lib/module/adapters/index.js +4 -0
- package/lib/module/adapters/index.js.map +1 -0
- package/lib/module/adapters/reactHookForm.js +100 -0
- package/lib/module/adapters/reactHookForm.js.map +1 -0
- package/lib/module/components/FieldFlowAffordance/FieldFlowAffordance.js +99 -0
- package/lib/module/components/FieldFlowAffordance/FieldFlowAffordance.js.map +1 -0
- package/lib/module/components/FieldFlowAffordance/index.js +4 -0
- package/lib/module/components/FieldFlowAffordance/index.js.map +1 -0
- package/lib/module/components/FieldFlowCreditCard/FieldFlowCreditCard.js +141 -0
- package/lib/module/components/FieldFlowCreditCard/FieldFlowCreditCard.js.map +1 -0
- package/lib/module/components/FieldFlowCreditCard/index.js +4 -0
- package/lib/module/components/FieldFlowCreditCard/index.js.map +1 -0
- package/lib/module/components/FieldFlowDraftBanner/FieldFlowDraftBanner.js +151 -0
- package/lib/module/components/FieldFlowDraftBanner/FieldFlowDraftBanner.js.map +1 -0
- package/lib/module/components/FieldFlowDraftBanner/index.js +4 -0
- package/lib/module/components/FieldFlowDraftBanner/index.js.map +1 -0
- package/lib/module/components/FieldFlowInput/FieldFlowInput.js +144 -44
- package/lib/module/components/FieldFlowInput/FieldFlowInput.js.map +1 -1
- package/lib/module/components/FieldFlowInput/styles.js +16 -0
- package/lib/module/components/FieldFlowInput/styles.js.map +1 -1
- package/lib/module/components/FieldFlowNumberStepper/FieldFlowNumberStepper.js +131 -0
- package/lib/module/components/FieldFlowNumberStepper/FieldFlowNumberStepper.js.map +1 -0
- package/lib/module/components/FieldFlowNumberStepper/index.js +4 -0
- package/lib/module/components/FieldFlowNumberStepper/index.js.map +1 -0
- package/lib/module/components/FieldFlowPasswordStrength/FieldFlowPasswordStrength.js +117 -0
- package/lib/module/components/FieldFlowPasswordStrength/FieldFlowPasswordStrength.js.map +1 -0
- package/lib/module/components/FieldFlowPasswordStrength/index.js +4 -0
- package/lib/module/components/FieldFlowPasswordStrength/index.js.map +1 -0
- package/lib/module/components/FieldFlowPhone/FieldFlowPhone.js +258 -0
- package/lib/module/components/FieldFlowPhone/FieldFlowPhone.js.map +1 -0
- package/lib/module/components/FieldFlowPhone/index.js +4 -0
- package/lib/module/components/FieldFlowPhone/index.js.map +1 -0
- package/lib/module/components/FieldFlowRating/FieldFlowRating.js +101 -0
- package/lib/module/components/FieldFlowRating/FieldFlowRating.js.map +1 -0
- package/lib/module/components/FieldFlowRating/index.js +4 -0
- package/lib/module/components/FieldFlowRating/index.js.map +1 -0
- package/lib/module/components/FieldFlowSection/FieldFlowSection.js +136 -0
- package/lib/module/components/FieldFlowSection/FieldFlowSection.js.map +1 -0
- package/lib/module/components/FieldFlowSection/index.js +4 -0
- package/lib/module/components/FieldFlowSection/index.js.map +1 -0
- package/lib/module/components/FieldFlowSegmented/FieldFlowSegmented.js +190 -0
- package/lib/module/components/FieldFlowSegmented/FieldFlowSegmented.js.map +1 -0
- package/lib/module/components/FieldFlowSegmented/index.js +4 -0
- package/lib/module/components/FieldFlowSegmented/index.js.map +1 -0
- package/lib/module/components/FieldFlowSignature/FieldFlowSignature.js +195 -0
- package/lib/module/components/FieldFlowSignature/FieldFlowSignature.js.map +1 -0
- package/lib/module/components/FieldFlowSignature/index.js +4 -0
- package/lib/module/components/FieldFlowSignature/index.js.map +1 -0
- package/lib/module/components/FieldFlowSlider/FieldFlowSlider.js +173 -0
- package/lib/module/components/FieldFlowSlider/FieldFlowSlider.js.map +1 -0
- package/lib/module/components/FieldFlowSlider/index.js +4 -0
- package/lib/module/components/FieldFlowSlider/index.js.map +1 -0
- package/lib/module/components/FieldFlowStepper/FieldFlowStepper.js +161 -0
- package/lib/module/components/FieldFlowStepper/FieldFlowStepper.js.map +1 -0
- package/lib/module/components/FieldFlowStepper/index.js +4 -0
- package/lib/module/components/FieldFlowStepper/index.js.map +1 -0
- package/lib/module/components/FieldFlowTags/FieldFlowTags.js +235 -0
- package/lib/module/components/FieldFlowTags/FieldFlowTags.js.map +1 -0
- package/lib/module/components/FieldFlowTags/index.js +4 -0
- package/lib/module/components/FieldFlowTags/index.js.map +1 -0
- package/lib/module/components/FieldFlowTypeahead/FieldFlowTypeahead.js +222 -0
- package/lib/module/components/FieldFlowTypeahead/FieldFlowTypeahead.js.map +1 -0
- package/lib/module/components/FieldFlowTypeahead/index.js +4 -0
- package/lib/module/components/FieldFlowTypeahead/index.js.map +1 -0
- package/lib/module/components/FieldFlowUpload/FieldFlowUpload.js +186 -0
- package/lib/module/components/FieldFlowUpload/FieldFlowUpload.js.map +1 -0
- package/lib/module/components/FieldFlowUpload/index.js +4 -0
- package/lib/module/components/FieldFlowUpload/index.js.map +1 -0
- package/lib/module/hooks/index.js +5 -0
- package/lib/module/hooks/index.js.map +1 -1
- package/lib/module/hooks/useFieldFlowArray.js +106 -0
- package/lib/module/hooks/useFieldFlowArray.js.map +1 -0
- package/lib/module/hooks/useFieldFlowDirtyGuard.js +49 -0
- package/lib/module/hooks/useFieldFlowDirtyGuard.js.map +1 -0
- package/lib/module/hooks/useFieldFlowDraft.js +165 -0
- package/lib/module/hooks/useFieldFlowDraft.js.map +1 -0
- package/lib/module/hooks/useFieldFlowForm.js +224 -30
- package/lib/module/hooks/useFieldFlowForm.js.map +1 -1
- package/lib/module/hooks/useFieldFlowSteps.js +73 -0
- package/lib/module/hooks/useFieldFlowSteps.js.map +1 -0
- package/lib/module/hooks/useFormIntelligence.js +126 -0
- package/lib/module/hooks/useFormIntelligence.js.map +1 -0
- package/lib/module/i18n/index.js +4 -0
- package/lib/module/i18n/index.js.map +1 -0
- package/lib/module/i18n/messages.js +82 -0
- package/lib/module/i18n/messages.js.map +1 -0
- package/lib/module/index.js +31 -2
- package/lib/module/index.js.map +1 -1
- package/lib/module/intelligence/formAccessibility.js +72 -0
- package/lib/module/intelligence/formAccessibility.js.map +1 -0
- package/lib/module/intelligence/index.js +4 -0
- package/lib/module/intelligence/index.js.map +1 -0
- package/lib/module/intelligence/types.js +2 -0
- package/lib/module/intelligence/types.js.map +1 -0
- package/lib/module/motion/index.js +5 -0
- package/lib/module/motion/index.js.map +1 -0
- package/lib/module/motion/useFieldMotion.js +107 -0
- package/lib/module/motion/useFieldMotion.js.map +1 -0
- package/lib/module/motion/useReducedMotion.js +29 -0
- package/lib/module/motion/useReducedMotion.js.map +1 -0
- package/lib/module/theme/index.js +1 -0
- package/lib/module/theme/index.js.map +1 -1
- package/lib/module/theme/presets.js +138 -0
- package/lib/module/theme/presets.js.map +1 -0
- package/lib/module/utils/affordance.js +140 -0
- package/lib/module/utils/affordance.js.map +1 -0
- package/lib/module/utils/passwordStrength.js +74 -0
- package/lib/module/utils/passwordStrength.js.map +1 -0
- package/lib/module/utils/phoneCountries.js +113 -0
- package/lib/module/utils/phoneCountries.js.map +1 -0
- package/lib/module/validation/validators.js +10 -7
- package/lib/module/validation/validators.js.map +1 -1
- package/lib/typescript/adapters/index.d.ts +3 -0
- package/lib/typescript/adapters/index.d.ts.map +1 -0
- package/lib/typescript/adapters/reactHookForm.d.ts +56 -0
- package/lib/typescript/adapters/reactHookForm.d.ts.map +1 -0
- package/lib/typescript/components/FieldFlowAffordance/FieldFlowAffordance.d.ts +29 -0
- package/lib/typescript/components/FieldFlowAffordance/FieldFlowAffordance.d.ts.map +1 -0
- package/lib/typescript/components/FieldFlowAffordance/index.d.ts +3 -0
- package/lib/typescript/components/FieldFlowAffordance/index.d.ts.map +1 -0
- package/lib/typescript/components/FieldFlowCreditCard/FieldFlowCreditCard.d.ts +27 -0
- package/lib/typescript/components/FieldFlowCreditCard/FieldFlowCreditCard.d.ts.map +1 -0
- package/lib/typescript/components/FieldFlowCreditCard/index.d.ts +3 -0
- package/lib/typescript/components/FieldFlowCreditCard/index.d.ts.map +1 -0
- package/lib/typescript/components/FieldFlowDraftBanner/FieldFlowDraftBanner.d.ts +24 -0
- package/lib/typescript/components/FieldFlowDraftBanner/FieldFlowDraftBanner.d.ts.map +1 -0
- package/lib/typescript/components/FieldFlowDraftBanner/index.d.ts +3 -0
- package/lib/typescript/components/FieldFlowDraftBanner/index.d.ts.map +1 -0
- package/lib/typescript/components/FieldFlowInput/FieldFlowInput.d.ts.map +1 -1
- package/lib/typescript/components/FieldFlowInput/styles.d.ts +16 -0
- package/lib/typescript/components/FieldFlowInput/styles.d.ts.map +1 -1
- package/lib/typescript/components/FieldFlowInput/types.d.ts +32 -0
- package/lib/typescript/components/FieldFlowInput/types.d.ts.map +1 -1
- package/lib/typescript/components/FieldFlowNumberStepper/FieldFlowNumberStepper.d.ts +34 -0
- package/lib/typescript/components/FieldFlowNumberStepper/FieldFlowNumberStepper.d.ts.map +1 -0
- package/lib/typescript/components/FieldFlowNumberStepper/index.d.ts +3 -0
- package/lib/typescript/components/FieldFlowNumberStepper/index.d.ts.map +1 -0
- package/lib/typescript/components/FieldFlowPasswordStrength/FieldFlowPasswordStrength.d.ts +26 -0
- package/lib/typescript/components/FieldFlowPasswordStrength/FieldFlowPasswordStrength.d.ts.map +1 -0
- package/lib/typescript/components/FieldFlowPasswordStrength/index.d.ts +3 -0
- package/lib/typescript/components/FieldFlowPasswordStrength/index.d.ts.map +1 -0
- package/lib/typescript/components/FieldFlowPhone/FieldFlowPhone.d.ts +40 -0
- package/lib/typescript/components/FieldFlowPhone/FieldFlowPhone.d.ts.map +1 -0
- package/lib/typescript/components/FieldFlowPhone/index.d.ts +3 -0
- package/lib/typescript/components/FieldFlowPhone/index.d.ts.map +1 -0
- package/lib/typescript/components/FieldFlowRating/FieldFlowRating.d.ts +30 -0
- package/lib/typescript/components/FieldFlowRating/FieldFlowRating.d.ts.map +1 -0
- package/lib/typescript/components/FieldFlowRating/index.d.ts +3 -0
- package/lib/typescript/components/FieldFlowRating/index.d.ts.map +1 -0
- package/lib/typescript/components/FieldFlowSection/FieldFlowSection.d.ts +35 -0
- package/lib/typescript/components/FieldFlowSection/FieldFlowSection.d.ts.map +1 -0
- package/lib/typescript/components/FieldFlowSection/index.d.ts +3 -0
- package/lib/typescript/components/FieldFlowSection/index.d.ts.map +1 -0
- package/lib/typescript/components/FieldFlowSegmented/FieldFlowSegmented.d.ts +28 -0
- package/lib/typescript/components/FieldFlowSegmented/FieldFlowSegmented.d.ts.map +1 -0
- package/lib/typescript/components/FieldFlowSegmented/index.d.ts +3 -0
- package/lib/typescript/components/FieldFlowSegmented/index.d.ts.map +1 -0
- package/lib/typescript/components/FieldFlowSignature/FieldFlowSignature.d.ts +41 -0
- package/lib/typescript/components/FieldFlowSignature/FieldFlowSignature.d.ts.map +1 -0
- package/lib/typescript/components/FieldFlowSignature/index.d.ts +3 -0
- package/lib/typescript/components/FieldFlowSignature/index.d.ts.map +1 -0
- package/lib/typescript/components/FieldFlowSlider/FieldFlowSlider.d.ts +30 -0
- package/lib/typescript/components/FieldFlowSlider/FieldFlowSlider.d.ts.map +1 -0
- package/lib/typescript/components/FieldFlowSlider/index.d.ts +3 -0
- package/lib/typescript/components/FieldFlowSlider/index.d.ts.map +1 -0
- package/lib/typescript/components/FieldFlowStepper/FieldFlowStepper.d.ts +31 -0
- package/lib/typescript/components/FieldFlowStepper/FieldFlowStepper.d.ts.map +1 -0
- package/lib/typescript/components/FieldFlowStepper/index.d.ts +3 -0
- package/lib/typescript/components/FieldFlowStepper/index.d.ts.map +1 -0
- package/lib/typescript/components/FieldFlowTags/FieldFlowTags.d.ts +41 -0
- package/lib/typescript/components/FieldFlowTags/FieldFlowTags.d.ts.map +1 -0
- package/lib/typescript/components/FieldFlowTags/index.d.ts +3 -0
- package/lib/typescript/components/FieldFlowTags/index.d.ts.map +1 -0
- package/lib/typescript/components/FieldFlowTypeahead/FieldFlowTypeahead.d.ts +43 -0
- package/lib/typescript/components/FieldFlowTypeahead/FieldFlowTypeahead.d.ts.map +1 -0
- package/lib/typescript/components/FieldFlowTypeahead/index.d.ts +3 -0
- package/lib/typescript/components/FieldFlowTypeahead/index.d.ts.map +1 -0
- package/lib/typescript/components/FieldFlowUpload/FieldFlowUpload.d.ts +52 -0
- package/lib/typescript/components/FieldFlowUpload/FieldFlowUpload.d.ts.map +1 -0
- package/lib/typescript/components/FieldFlowUpload/index.d.ts +3 -0
- package/lib/typescript/components/FieldFlowUpload/index.d.ts.map +1 -0
- package/lib/typescript/hooks/index.d.ts +11 -1
- package/lib/typescript/hooks/index.d.ts.map +1 -1
- package/lib/typescript/hooks/useFieldFlowArray.d.ts +54 -0
- package/lib/typescript/hooks/useFieldFlowArray.d.ts.map +1 -0
- package/lib/typescript/hooks/useFieldFlowDirtyGuard.d.ts +26 -0
- package/lib/typescript/hooks/useFieldFlowDirtyGuard.d.ts.map +1 -0
- package/lib/typescript/hooks/useFieldFlowDraft.d.ts +64 -0
- package/lib/typescript/hooks/useFieldFlowDraft.d.ts.map +1 -0
- package/lib/typescript/hooks/useFieldFlowForm.d.ts +80 -2
- package/lib/typescript/hooks/useFieldFlowForm.d.ts.map +1 -1
- package/lib/typescript/hooks/useFieldFlowSteps.d.ts +42 -0
- package/lib/typescript/hooks/useFieldFlowSteps.d.ts.map +1 -0
- package/lib/typescript/hooks/useFormIntelligence.d.ts +23 -0
- package/lib/typescript/hooks/useFormIntelligence.d.ts.map +1 -0
- package/lib/typescript/i18n/index.d.ts +3 -0
- package/lib/typescript/i18n/index.d.ts.map +1 -0
- package/lib/typescript/i18n/messages.d.ts +16 -0
- package/lib/typescript/i18n/messages.d.ts.map +1 -0
- package/lib/typescript/index.d.ts +48 -4
- package/lib/typescript/index.d.ts.map +1 -1
- package/lib/typescript/intelligence/formAccessibility.d.ts +21 -0
- package/lib/typescript/intelligence/formAccessibility.d.ts.map +1 -0
- package/lib/typescript/intelligence/index.d.ts +4 -0
- package/lib/typescript/intelligence/index.d.ts.map +1 -0
- package/lib/typescript/intelligence/types.d.ts +36 -0
- package/lib/typescript/intelligence/types.d.ts.map +1 -0
- package/lib/typescript/motion/index.d.ts +4 -0
- package/lib/typescript/motion/index.d.ts.map +1 -0
- package/lib/typescript/motion/useFieldMotion.d.ts +31 -0
- package/lib/typescript/motion/useFieldMotion.d.ts.map +1 -0
- package/lib/typescript/motion/useReducedMotion.d.ts +5 -0
- package/lib/typescript/motion/useReducedMotion.d.ts.map +1 -0
- package/lib/typescript/theme/index.d.ts +2 -0
- package/lib/typescript/theme/index.d.ts.map +1 -1
- package/lib/typescript/theme/presets.d.ts +134 -0
- package/lib/typescript/theme/presets.d.ts.map +1 -0
- package/lib/typescript/utils/affordance.d.ts +36 -0
- package/lib/typescript/utils/affordance.d.ts.map +1 -0
- package/lib/typescript/utils/passwordStrength.d.ts +26 -0
- package/lib/typescript/utils/passwordStrength.d.ts.map +1 -0
- package/lib/typescript/utils/phoneCountries.d.ts +12 -0
- package/lib/typescript/utils/phoneCountries.d.ts.map +1 -0
- package/lib/typescript/validation/validators.d.ts +3 -1
- package/lib/typescript/validation/validators.d.ts.map +1 -1
- package/package.json +19 -2
- package/src/adapters/index.ts +9 -0
- package/src/adapters/reactHookForm.tsx +152 -0
- package/src/components/FieldFlowAffordance/FieldFlowAffordance.tsx +143 -0
- package/src/components/FieldFlowAffordance/index.ts +2 -0
- package/src/components/FieldFlowCreditCard/FieldFlowCreditCard.tsx +152 -0
- package/src/components/FieldFlowCreditCard/index.ts +2 -0
- package/src/components/FieldFlowDraftBanner/FieldFlowDraftBanner.tsx +169 -0
- package/src/components/FieldFlowDraftBanner/index.ts +2 -0
- package/src/components/FieldFlowInput/FieldFlowInput.tsx +174 -53
- package/src/components/FieldFlowInput/styles.ts +16 -0
- package/src/components/FieldFlowInput/types.ts +33 -0
- package/src/components/FieldFlowNumberStepper/FieldFlowNumberStepper.tsx +156 -0
- package/src/components/FieldFlowNumberStepper/index.ts +2 -0
- package/src/components/FieldFlowPasswordStrength/FieldFlowPasswordStrength.tsx +148 -0
- package/src/components/FieldFlowPasswordStrength/index.ts +2 -0
- package/src/components/FieldFlowPhone/FieldFlowPhone.tsx +298 -0
- package/src/components/FieldFlowPhone/index.ts +2 -0
- package/src/components/FieldFlowRating/FieldFlowRating.tsx +121 -0
- package/src/components/FieldFlowRating/index.ts +2 -0
- package/src/components/FieldFlowSection/FieldFlowSection.tsx +176 -0
- package/src/components/FieldFlowSection/index.ts +2 -0
- package/src/components/FieldFlowSegmented/FieldFlowSegmented.tsx +248 -0
- package/src/components/FieldFlowSegmented/index.ts +2 -0
- package/src/components/FieldFlowSignature/FieldFlowSignature.tsx +241 -0
- package/src/components/FieldFlowSignature/index.ts +7 -0
- package/src/components/FieldFlowSlider/FieldFlowSlider.tsx +190 -0
- package/src/components/FieldFlowSlider/index.ts +2 -0
- package/src/components/FieldFlowStepper/FieldFlowStepper.tsx +190 -0
- package/src/components/FieldFlowStepper/index.ts +2 -0
- package/src/components/FieldFlowTags/FieldFlowTags.tsx +319 -0
- package/src/components/FieldFlowTags/index.ts +2 -0
- package/src/components/FieldFlowTypeahead/FieldFlowTypeahead.tsx +261 -0
- package/src/components/FieldFlowTypeahead/index.ts +2 -0
- package/src/components/FieldFlowUpload/FieldFlowUpload.tsx +226 -0
- package/src/components/FieldFlowUpload/index.ts +6 -0
- package/src/hooks/index.ts +31 -0
- package/src/hooks/useFieldFlowArray.ts +153 -0
- package/src/hooks/useFieldFlowDirtyGuard.ts +70 -0
- package/src/hooks/useFieldFlowDraft.ts +221 -0
- package/src/hooks/useFieldFlowForm.ts +357 -28
- package/src/hooks/useFieldFlowSteps.ts +130 -0
- package/src/hooks/useFormIntelligence.ts +207 -0
- package/src/i18n/index.ts +6 -0
- package/src/i18n/messages.ts +101 -0
- package/src/index.ts +161 -3
- package/src/intelligence/formAccessibility.ts +87 -0
- package/src/intelligence/index.ts +12 -0
- package/src/intelligence/types.ts +34 -0
- package/src/motion/index.ts +3 -0
- package/src/motion/useFieldMotion.ts +120 -0
- package/src/motion/useReducedMotion.ts +31 -0
- package/src/theme/index.ts +2 -0
- package/src/theme/presets.ts +120 -0
- package/src/utils/affordance.ts +138 -0
- package/src/utils/passwordStrength.ts +109 -0
- package/src/utils/phoneCountries.ts +44 -0
- package/src/validation/validators.ts +17 -7
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/FieldFlowSlider/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,YAAY,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { type TextStyle, type ViewStyle } from 'react-native';
|
|
3
|
+
import type { DeepPartial, FieldFlowTheme } from '../../types';
|
|
4
|
+
import type { FieldFlowStepDefinition } from '../../hooks/useFieldFlowSteps';
|
|
5
|
+
export interface FieldFlowStepRenderContext<T extends Record<string, string> = Record<string, string>> {
|
|
6
|
+
step: FieldFlowStepDefinition<T>;
|
|
7
|
+
index: number;
|
|
8
|
+
active: boolean;
|
|
9
|
+
done: boolean;
|
|
10
|
+
canPress: boolean;
|
|
11
|
+
onPress: () => void;
|
|
12
|
+
}
|
|
13
|
+
export interface FieldFlowStepperProps<T extends Record<string, string> = Record<string, string>> {
|
|
14
|
+
steps: FieldFlowStepDefinition<T>[];
|
|
15
|
+
stepIndex: number;
|
|
16
|
+
onStepPress?: (index: number) => void;
|
|
17
|
+
/** Allow tapping completed steps. Default: true. */
|
|
18
|
+
allowJumpBack?: boolean;
|
|
19
|
+
/** Show titles under dots. Default: true. */
|
|
20
|
+
showLabels?: boolean;
|
|
21
|
+
/** Trailing slot next to the progress row (e.g. “Skip”). */
|
|
22
|
+
headerRight?: React.ReactNode;
|
|
23
|
+
/** Fully custom step chrome. */
|
|
24
|
+
renderStep?: (ctx: FieldFlowStepRenderContext<T>) => React.ReactNode;
|
|
25
|
+
containerStyle?: ViewStyle;
|
|
26
|
+
labelStyle?: TextStyle;
|
|
27
|
+
theme?: DeepPartial<FieldFlowTheme>;
|
|
28
|
+
testID?: string;
|
|
29
|
+
}
|
|
30
|
+
export declare function FieldFlowStepper<T extends Record<string, string> = Record<string, string>>({ steps, stepIndex, onStepPress, allowJumpBack, showLabels, headerRight, renderStep, containerStyle, labelStyle, theme: themeOverride, testID, }: FieldFlowStepperProps<T>): React.JSX.Element;
|
|
31
|
+
//# sourceMappingURL=FieldFlowStepper.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FieldFlowStepper.d.ts","sourceRoot":"","sources":["../../../../src/components/FieldFlowStepper/FieldFlowStepper.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAkB,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CAAC;IACpC,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,wBAAgB,gBAAgB,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EAAE,EAC1F,KAAK,EACL,SAAS,EACT,WAAW,EACX,aAAoB,EACpB,UAAiB,EACjB,WAAW,EACX,UAAU,EACV,cAAc,EACd,UAAU,EACV,KAAK,EAAE,aAAa,EACpB,MAAM,GACP,EAAE,qBAAqB,CAAC,CAAC,CAAC,qBAsE1B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/FieldFlowStepper/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,YAAY,EAAE,qBAAqB,EAAE,0BAA0B,EAAE,MAAM,oBAAoB,CAAC"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { type TextStyle, type ViewStyle } from 'react-native';
|
|
3
|
+
import { type FieldFlowIconSource } from '../../icons';
|
|
4
|
+
import type { DeepPartial, FieldFlowTheme, FieldFlowVariant } from '../../types';
|
|
5
|
+
export interface FieldFlowTagsProps {
|
|
6
|
+
value?: string[];
|
|
7
|
+
onChange: (tags: string[]) => void;
|
|
8
|
+
label?: string;
|
|
9
|
+
placeholder?: string;
|
|
10
|
+
helperText?: string;
|
|
11
|
+
errorText?: string;
|
|
12
|
+
hasError?: boolean;
|
|
13
|
+
disabled?: boolean;
|
|
14
|
+
required?: boolean;
|
|
15
|
+
/** Max number of tags. */
|
|
16
|
+
maxTags?: number;
|
|
17
|
+
/** Max characters per tag. Default: 32. */
|
|
18
|
+
maxTagLength?: number;
|
|
19
|
+
/** Separators that commit the current draft. Default: enter + comma. */
|
|
20
|
+
separators?: Array<',' | ' ' | 'enter'>;
|
|
21
|
+
/** Allow duplicate tags. Default: false. */
|
|
22
|
+
allowDuplicates?: boolean;
|
|
23
|
+
/** Transform each tag before commit (default: trim). */
|
|
24
|
+
transformTag?: (raw: string) => string;
|
|
25
|
+
leftIcon?: FieldFlowIconSource | null;
|
|
26
|
+
variant?: FieldFlowVariant;
|
|
27
|
+
containerStyle?: ViewStyle;
|
|
28
|
+
inputContainerStyle?: ViewStyle;
|
|
29
|
+
tagStyle?: ViewStyle;
|
|
30
|
+
tagTextStyle?: TextStyle;
|
|
31
|
+
labelStyle?: TextStyle;
|
|
32
|
+
helperStyle?: TextStyle;
|
|
33
|
+
theme?: DeepPartial<FieldFlowTheme>;
|
|
34
|
+
testID?: string;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Multi-value chip / tags input — skills, interests, keywords.
|
|
38
|
+
* Type a value and press Enter or comma to commit.
|
|
39
|
+
*/
|
|
40
|
+
export declare function FieldFlowTags({ value, onChange, label, placeholder, helperText, errorText, hasError, disabled, required, maxTags, maxTagLength, separators, allowDuplicates, transformTag, leftIcon, variant, containerStyle, inputContainerStyle, tagStyle, tagTextStyle, labelStyle, helperStyle, theme: themeOverride, testID, }: FieldFlowTagsProps): React.JSX.Element;
|
|
41
|
+
//# sourceMappingURL=FieldFlowTags.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FieldFlowTags.d.ts","sourceRoot":"","sources":["../../../../src/components/FieldFlowTags/FieldFlowTags.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAyC,MAAM,OAAO,CAAC;AAC9D,OAAO,EAML,KAAK,SAAS,EACd,KAAK,SAAS,EACf,MAAM,cAAc,CAAC;AAKtB,OAAO,EAAuB,KAAK,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAC5E,OAAO,KAAK,EAAE,WAAW,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAEjF,MAAM,WAAW,kBAAkB;IACjC,KAAK,CAAC,EAAE,MAAM,EAAE,CAA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,EACjB,UAA2B,EAC3B,eAAuB,EACvB,YAAgC,EAChC,QAAiB,EACjB,OAAoB,EACpB,cAAc,EACd,mBAAmB,EACnB,QAAQ,EACR,YAAY,EACZ,UAAU,EACV,WAAW,EACX,KAAK,EAAE,aAAa,EACpB,MAAM,GACP,EAAE,kBAAkB,qBA6IpB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/FieldFlowTags/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,YAAY,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { type TextStyle, type ViewStyle } from 'react-native';
|
|
3
|
+
import type { DeepPartial, FieldFlowOption, FieldFlowTheme } from '../../types';
|
|
4
|
+
export type FieldFlowTypeaheadFetcher = (query: string) => Promise<FieldFlowOption[]> | FieldFlowOption[];
|
|
5
|
+
export interface FieldFlowTypeaheadProps {
|
|
6
|
+
value?: string | null;
|
|
7
|
+
/** Selected option label for display when value is set. */
|
|
8
|
+
displayValue?: string;
|
|
9
|
+
onChange: (value: string | null, option?: FieldFlowOption) => void;
|
|
10
|
+
/**
|
|
11
|
+
* Async (or sync) option loader. Debounced by `debounceMs`.
|
|
12
|
+
* Return [] when nothing matches.
|
|
13
|
+
*/
|
|
14
|
+
fetchOptions: FieldFlowTypeaheadFetcher;
|
|
15
|
+
/** Optional static fallback options used when query is empty. */
|
|
16
|
+
defaultOptions?: FieldFlowOption[];
|
|
17
|
+
label?: string;
|
|
18
|
+
placeholder?: string;
|
|
19
|
+
helperText?: string;
|
|
20
|
+
errorText?: string;
|
|
21
|
+
disabled?: boolean;
|
|
22
|
+
required?: boolean;
|
|
23
|
+
debounceMs?: number;
|
|
24
|
+
minChars?: number;
|
|
25
|
+
emptyText?: string;
|
|
26
|
+
/** Custom dropdown row. Call `select()` to commit. */
|
|
27
|
+
renderOption?: (ctx: {
|
|
28
|
+
option: FieldFlowOption;
|
|
29
|
+
selected: boolean;
|
|
30
|
+
select: () => void;
|
|
31
|
+
}) => React.ReactNode;
|
|
32
|
+
/** Custom empty / no-results state. */
|
|
33
|
+
renderEmpty?: (ctx: {
|
|
34
|
+
query: string;
|
|
35
|
+
loading: boolean;
|
|
36
|
+
}) => React.ReactNode;
|
|
37
|
+
containerStyle?: ViewStyle;
|
|
38
|
+
labelStyle?: TextStyle;
|
|
39
|
+
theme?: DeepPartial<FieldFlowTheme>;
|
|
40
|
+
testID?: string;
|
|
41
|
+
}
|
|
42
|
+
export declare function FieldFlowTypeahead({ value, displayValue, onChange, fetchOptions, defaultOptions, label, placeholder, helperText, errorText, disabled, required, debounceMs, minChars, emptyText, renderOption, renderEmpty, containerStyle, labelStyle, theme: themeOverride, testID, }: FieldFlowTypeaheadProps): React.JSX.Element;
|
|
43
|
+
//# sourceMappingURL=FieldFlowTypeahead.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FieldFlowTypeahead.d.ts","sourceRoot":"","sources":["../../../../src/components/FieldFlowTypeahead/FieldFlowTypeahead.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA+C,MAAM,OAAO,CAAC;AACpE,OAAO,EAQL,KAAK,SAAS,EACd,KAAK,SAAS,EACf,MAAM,cAAc,CAAC;AAItB,OAAO,KAAK,EAAE,WAAW,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAEhF,MAAM,MAAM,yBAAyB,GAAG,CACtC,KAAK,EAAE,MAAM,KACV,OAAO,CAAC,eAAe,EAAE,CAAC,GAAG,eAAe,EAAE,CAAC;AAEpD,MAAM,WAAW,uBAAuB;IACtC,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,2DAA2D;IAC3D,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,QAAQ,EAAE,CAAC,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Z,WAAW,EACX,cAAc,EACd,UAAU,EACV,KAAK,EAAE,aAAa,EACpB,MAAM,GACP,EAAE,uBAAuB,qBAuIzB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/FieldFlowTypeahead/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,YAAY,EAAE,uBAAuB,EAAE,yBAAyB,EAAE,MAAM,sBAAsB,CAAC"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { type TextStyle, type ViewStyle } from 'react-native';
|
|
3
|
+
import type { DeepPartial, FieldFlowTheme } from '../../types';
|
|
4
|
+
export interface FieldFlowUploadFile {
|
|
5
|
+
uri: string;
|
|
6
|
+
name?: string;
|
|
7
|
+
mimeType?: string;
|
|
8
|
+
size?: number;
|
|
9
|
+
/** Optional local preview (same as uri for images). */
|
|
10
|
+
previewUri?: string;
|
|
11
|
+
}
|
|
12
|
+
export type FieldFlowUploadPicker = () => Promise<FieldFlowUploadFile | FieldFlowUploadFile[] | null>;
|
|
13
|
+
export interface FieldFlowUploadProps {
|
|
14
|
+
value?: FieldFlowUploadFile[];
|
|
15
|
+
onChange: (files: FieldFlowUploadFile[]) => void;
|
|
16
|
+
/**
|
|
17
|
+
* Injected picker — keep the library free of native upload deps.
|
|
18
|
+
* Example: wrap `expo-image-picker` / `expo-document-picker` / `launchImageLibrary`.
|
|
19
|
+
*/
|
|
20
|
+
pick: FieldFlowUploadPicker;
|
|
21
|
+
label?: string;
|
|
22
|
+
helperText?: string;
|
|
23
|
+
errorText?: string;
|
|
24
|
+
disabled?: boolean;
|
|
25
|
+
required?: boolean;
|
|
26
|
+
/** Max files. Default: 1. */
|
|
27
|
+
maxFiles?: number;
|
|
28
|
+
/** Accept hint shown in UI. */
|
|
29
|
+
acceptHint?: string;
|
|
30
|
+
/** Show image thumbnails when mime looks like image. Default: true. */
|
|
31
|
+
showPreviews?: boolean;
|
|
32
|
+
/** Replace the dashed dropzone chrome. */
|
|
33
|
+
renderDropzone?: (ctx: {
|
|
34
|
+
atMax: boolean;
|
|
35
|
+
fileCount: number;
|
|
36
|
+
maxFiles: number;
|
|
37
|
+
disabled: boolean;
|
|
38
|
+
openPicker: () => void;
|
|
39
|
+
}) => React.ReactNode;
|
|
40
|
+
/** Replace each file row. Call `remove` to delete. */
|
|
41
|
+
renderFile?: (ctx: {
|
|
42
|
+
file: FieldFlowUploadFile;
|
|
43
|
+
index: number;
|
|
44
|
+
remove: () => void;
|
|
45
|
+
}) => React.ReactNode;
|
|
46
|
+
containerStyle?: ViewStyle;
|
|
47
|
+
labelStyle?: TextStyle;
|
|
48
|
+
theme?: DeepPartial<FieldFlowTheme>;
|
|
49
|
+
testID?: string;
|
|
50
|
+
}
|
|
51
|
+
export declare function FieldFlowUpload({ value, onChange, pick, label, helperText, errorText, disabled, required, maxFiles, acceptHint, showPreviews, renderDropzone, renderFile, containerStyle, labelStyle, theme: themeOverride, testID, }: FieldFlowUploadProps): React.JSX.Element;
|
|
52
|
+
//# sourceMappingURL=FieldFlowUpload.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FieldFlowUpload.d.ts","sourceRoot":"","sources":["../../../../src/components/FieldFlowUpload/FieldFlowUpload.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAkB,MAAM,OAAO,CAAC;AACvC,OAAO,EAML,KAAK,SAAS,EACd,KAAK,SAAS,EACf,MAAM,cAAc,CAAC;AAItB,OAAO,KAAK,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAE/D,MAAM,WAAW,mBAAmB;IAClC,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,uDAAuD;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AC,CAAC;IACpC,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,wBAAgB,eAAe,CAAC,EAC9B,KAAU,EACV,QAAQ,EACR,IAAI,EACJ,KAAK,EACL,UAAU,EACV,SAAS,EACT,QAAQ,EACR,QAAQ,EACR,QAAY,EACZ,UAA4B,EAC5B,YAAmB,EACnB,cAAc,EACd,UAAU,EACV,cAAc,EACd,UAAU,EACV,KAAK,EAAE,aAAa,EACpB,MAAM,GACP,EAAE,oBAAoB,qBAiGtB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/FieldFlowUpload/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,YAAY,EACV,oBAAoB,EACpB,mBAAmB,EACnB,qBAAqB,GACtB,MAAM,mBAAmB,CAAC"}
|
|
@@ -1,7 +1,17 @@
|
|
|
1
1
|
export { useKeyboardManager } from './useKeyboardManager';
|
|
2
2
|
export type { UseKeyboardManagerOptions, UseKeyboardManagerResult, KeyboardManagerField } from './useKeyboardManager';
|
|
3
3
|
export { useFieldFlowForm } from './useFieldFlowForm';
|
|
4
|
-
export type { UseFieldFlowFormOptions, UseFieldFlowFormResult, FieldFlowFormRules, AsyncFieldValidator, AsyncFieldValidators, CrossFieldRule, } from './useFieldFlowForm';
|
|
4
|
+
export type { UseFieldFlowFormOptions, UseFieldFlowFormResult, FieldFlowFormRules, AsyncFieldValidator, AsyncFieldValidators, CrossFieldRule, FieldConditionFn, FieldConditionConfig, FieldConditions, FieldVisibilityState, } from './useFieldFlowForm';
|
|
5
5
|
export { useFieldState } from './useFieldState';
|
|
6
6
|
export type { UseFieldStateOptions } from './useFieldState';
|
|
7
|
+
export { useFormIntelligence } from './useFormIntelligence';
|
|
8
|
+
export type { UseFormIntelligenceResult } from './useFormIntelligence';
|
|
9
|
+
export { useFieldFlowArray } from './useFieldFlowArray';
|
|
10
|
+
export type { UseFieldFlowArrayOptions, UseFieldFlowArrayResult } from './useFieldFlowArray';
|
|
11
|
+
export { useFieldFlowDraft } from './useFieldFlowDraft';
|
|
12
|
+
export type { FieldFlowDraftStorage, FieldFlowDraftPayload, UseFieldFlowDraftOptions, UseFieldFlowDraftResult, } from './useFieldFlowDraft';
|
|
13
|
+
export { useFieldFlowSteps } from './useFieldFlowSteps';
|
|
14
|
+
export type { FieldFlowStepDefinition, UseFieldFlowStepsOptions, UseFieldFlowStepsResult, } from './useFieldFlowSteps';
|
|
15
|
+
export { useFieldFlowDirtyGuard } from './useFieldFlowDirtyGuard';
|
|
16
|
+
export type { UseFieldFlowDirtyGuardOptions, UseFieldFlowDirtyGuardResult, } from './useFieldFlowDirtyGuard';
|
|
7
17
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/hooks/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,YAAY,EAAE,yBAAyB,EAAE,wBAAwB,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAEtH,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,YAAY,EACV,uBAAuB,EACvB,sBAAsB,EACtB,kBAAkB,EAClB,mBAAmB,EACnB,oBAAoB,EACpB,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/hooks/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,YAAY,EAAE,yBAAyB,EAAE,wBAAwB,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAEtH,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,YAAY,EACV,uBAAuB,EACvB,sBAAsB,EACtB,kBAAkB,EAClB,mBAAmB,EACnB,oBAAoB,EACpB,cAAc,EACd,gBAAgB,EAChB,oBAAoB,EACpB,eAAe,EACf,oBAAoB,GACrB,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,YAAY,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AAE5D,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,YAAY,EAAE,yBAAyB,EAAE,MAAM,uBAAuB,CAAC;AAEvE,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,YAAY,EAAE,wBAAwB,EAAE,uBAAuB,EAAE,MAAM,qBAAqB,CAAC;AAE7F,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,YAAY,EACV,qBAAqB,EACrB,qBAAqB,EACrB,wBAAwB,EACxB,uBAAuB,GACxB,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,YAAY,EACV,uBAAuB,EACvB,wBAAwB,EACxB,uBAAuB,GACxB,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAClE,YAAY,EACV,6BAA6B,EAC7B,4BAA4B,GAC7B,MAAM,0BAA0B,CAAC"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
export interface UseFieldFlowArrayOptions<TItem> {
|
|
2
|
+
/** Initial rows. Default: `[]`. */
|
|
3
|
+
initialItems?: TItem[];
|
|
4
|
+
/** Factory for a blank row when calling `append()` without an argument. */
|
|
5
|
+
createItem: () => TItem;
|
|
6
|
+
/** Hard cap on rows. `append` becomes a no-op at the limit. */
|
|
7
|
+
max?: number;
|
|
8
|
+
/** Minimum rows. `remove` is blocked when at the floor. Default: 0. */
|
|
9
|
+
min?: number;
|
|
10
|
+
}
|
|
11
|
+
export interface UseFieldFlowArrayResult<TItem> {
|
|
12
|
+
items: TItem[];
|
|
13
|
+
/** Number of rows. */
|
|
14
|
+
length: number;
|
|
15
|
+
/** True when `max` is set and reached. */
|
|
16
|
+
isMax: boolean;
|
|
17
|
+
/** True when at `min` rows. */
|
|
18
|
+
isMin: boolean;
|
|
19
|
+
setItems: (items: TItem[] | ((prev: TItem[]) => TItem[])) => void;
|
|
20
|
+
/** Append a row (or `createItem()`). Returns the new index, or `-1` if blocked. */
|
|
21
|
+
append: (item?: TItem) => number;
|
|
22
|
+
/** Remove by index. Returns false if blocked by `min`. */
|
|
23
|
+
remove: (index: number) => boolean;
|
|
24
|
+
/** Replace a single row. */
|
|
25
|
+
update: (index: number, item: TItem | ((prev: TItem) => TItem)) => void;
|
|
26
|
+
/** Swap two indices. */
|
|
27
|
+
move: (from: number, to: number) => void;
|
|
28
|
+
/** Insert at index (clamped). */
|
|
29
|
+
insert: (index: number, item?: TItem) => void;
|
|
30
|
+
clear: () => void;
|
|
31
|
+
reset: () => void;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Manage dynamic / repeatable field groups (addresses, line items, guests, …)
|
|
35
|
+
* alongside FieldFlow inputs. Pure state — no UI assumptions.
|
|
36
|
+
*
|
|
37
|
+
* @example
|
|
38
|
+
* const guests = useFieldFlowArray({
|
|
39
|
+
* createItem: () => ({ name: '', email: '' }),
|
|
40
|
+
* min: 1,
|
|
41
|
+
* max: 5,
|
|
42
|
+
* });
|
|
43
|
+
*
|
|
44
|
+
* guests.items.map((guest, i) => (
|
|
45
|
+
* <FieldFlowInput
|
|
46
|
+
* key={i}
|
|
47
|
+
* label={`Guest ${i + 1}`}
|
|
48
|
+
* value={guest.name}
|
|
49
|
+
* onChangeText={name => guests.update(i, g => ({ ...g, name }))}
|
|
50
|
+
* />
|
|
51
|
+
* ));
|
|
52
|
+
*/
|
|
53
|
+
export declare function useFieldFlowArray<TItem>({ initialItems, createItem, max, min, }: UseFieldFlowArrayOptions<TItem>): UseFieldFlowArrayResult<TItem>;
|
|
54
|
+
//# sourceMappingURL=useFieldFlowArray.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useFieldFlowArray.d.ts","sourceRoot":"","sources":["../../../src/hooks/useFieldFlowArray.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,wBAAwB,CAAC,KAAK;IAC7C,mCAAmC;IACnC,YAAY,CAAC,EAAE,KAAK,EAAE,CAAC;IACvB,2EAA2E;IAC3E,UAAU,EAAE,MAAM,KAAK,CAAC;IACxB,+DAA+D;IAC/D,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,uEAAuE;IACvE,GAAG,CAAC,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,uBAAuB,CAAC,KAAK;IAC5C,KAAK,EAAE,KAAK,EAAE,CAAC;IACf,sBAAsB;IACtB,MAAM,EAAE,MAAM,CAAC;IACf,0CAA0C;IAC1C,KAAK,EAAE,OAAO,CAAC;IACf,+BAA+B;IAC/B,KAAK,EAAE,OAAO,CAAC;IACf,QAAQ,EAAE,CAAC,KAAK,EAAE,KAAK,EAAE,GAAG,CAAC,CAAC,IAAI,EAAE,KAAK,EAAE,KAAK,KAAK,EAAE,CAAC,KAAK,IAAI,CAAC;IAClE,mFAAmF;IACnF,MAAM,EAAE,CAAC,IAAI,CAAC,EAAE,KAAK,KAAK,MAAM,CAAC;IACjC,0DAA0D;IAC1D,MAAM,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,OAAO,CAAC;IACnC,4BAA4B;IAC5B,MAAM,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,GAAG,CAAC,CAAC,IAAI,EAAE,KAAK,KAAK,KAAK,CAAC,KAAK,IAAI,CAAC;IACxE,wBAAwB;IACxB,IAAI,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;IACzC,iCAAiC;IACjC,MAAM,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,KAAK,KAAK,IAAI,CAAC;IAC9C,KAAK,EAAE,MAAM,IAAI,CAAC;IAClB,KAAK,EAAE,MAAM,IAAI,CAAC;CACnB;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,EACvC,YAAiB,EACjB,UAAU,EACV,GAAG,EACH,GAAO,GACR,EAAE,wBAAwB,CAAC,KAAK,CAAC,GAAG,uBAAuB,CAAC,KAAK,CAAC,CA2FlE"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export interface UseFieldFlowDirtyGuardOptions {
|
|
2
|
+
/** When true, leaving the screen should confirm. */
|
|
3
|
+
isDirty: boolean;
|
|
4
|
+
enabled?: boolean;
|
|
5
|
+
title?: string;
|
|
6
|
+
message?: string;
|
|
7
|
+
confirmLabel?: string;
|
|
8
|
+
cancelLabel?: string;
|
|
9
|
+
/** Android hardware back — intercept when dirty. Default: true. */
|
|
10
|
+
interceptAndroidBack?: boolean;
|
|
11
|
+
/** Called when the user confirms discard. */
|
|
12
|
+
onDiscard?: () => void;
|
|
13
|
+
}
|
|
14
|
+
export interface UseFieldFlowDirtyGuardResult {
|
|
15
|
+
/**
|
|
16
|
+
* Call before navigating away. Returns true if navigation may proceed.
|
|
17
|
+
* Shows a confirm alert when the form is dirty.
|
|
18
|
+
*/
|
|
19
|
+
confirmIfDirty: () => Promise<boolean>;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Warns before leaving a dirty form (Android back + imperative `confirmIfDirty`).
|
|
23
|
+
* For React Navigation, call `confirmIfDirty` inside a `beforeRemove` listener.
|
|
24
|
+
*/
|
|
25
|
+
export declare function useFieldFlowDirtyGuard({ isDirty, enabled, title, message, confirmLabel, cancelLabel, interceptAndroidBack, onDiscard, }: UseFieldFlowDirtyGuardOptions): UseFieldFlowDirtyGuardResult;
|
|
26
|
+
//# sourceMappingURL=useFieldFlowDirtyGuard.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useFieldFlowDirtyGuard.d.ts","sourceRoot":"","sources":["../../../src/hooks/useFieldFlowDirtyGuard.ts"],"names":[],"mappings":"AAGA,MAAM,WAAW,6BAA6B;IAC5C,oDAAoD;IACpD,OAAO,EAAE,OAAO,CAAC;IACjB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,mEAAmE;IACnE,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B,6CAA6C;IAC7C,SAAS,CAAC,EAAE,MAAM,IAAI,CAAC;CACxB;AAED,MAAM,WAAW,4BAA4B;IAC3C;;;OAGG;IACH,cAAc,EAAE,MAAM,OAAO,CAAC,OAAO,CAAC,CAAC;CACxC;AAED;;;GAGG;AACH,wBAAgB,sBAAsB,CAAC,EACrC,OAAO,EACP,OAAc,EACd,KAA0B,EAC1B,OAA2D,EAC3D,YAAwB,EACxB,WAAoB,EACpB,oBAA2B,EAC3B,SAAS,GACV,EAAE,6BAA6B,GAAG,4BAA4B,CA+B9D"}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Minimal async key-value storage. Pass AsyncStorage, MMKV wrapper, or any custom backend.
|
|
3
|
+
*
|
|
4
|
+
* @example
|
|
5
|
+
* import AsyncStorage from '@react-native-async-storage/async-storage';
|
|
6
|
+
* const storage = {
|
|
7
|
+
* getItem: (k) => AsyncStorage.getItem(k),
|
|
8
|
+
* setItem: (k, v) => AsyncStorage.setItem(k, v),
|
|
9
|
+
* removeItem: (k) => AsyncStorage.removeItem(k),
|
|
10
|
+
* };
|
|
11
|
+
*/
|
|
12
|
+
export interface FieldFlowDraftStorage {
|
|
13
|
+
getItem: (key: string) => Promise<string | null>;
|
|
14
|
+
setItem: (key: string, value: string) => Promise<void>;
|
|
15
|
+
removeItem: (key: string) => Promise<void>;
|
|
16
|
+
}
|
|
17
|
+
export interface FieldFlowDraftPayload<T extends Record<string, string>> {
|
|
18
|
+
values: T;
|
|
19
|
+
savedAt: number;
|
|
20
|
+
version: 1;
|
|
21
|
+
}
|
|
22
|
+
export interface UseFieldFlowDraftOptions<T extends Record<string, string>> {
|
|
23
|
+
/** Unique storage key, e.g. `signup-form-v1`. */
|
|
24
|
+
key: string;
|
|
25
|
+
storage: FieldFlowDraftStorage;
|
|
26
|
+
/** Live form values to persist. */
|
|
27
|
+
values: T;
|
|
28
|
+
/** Apply restored values (typically `form` helpers or `setValues`). */
|
|
29
|
+
onRestore: (values: T) => void;
|
|
30
|
+
/** Fields never written to storage (passwords, OTPs, card numbers). */
|
|
31
|
+
exclude?: (keyof T)[];
|
|
32
|
+
/** Debounce writes while typing. Default: 600ms. */
|
|
33
|
+
debounceMs?: number;
|
|
34
|
+
/** Discard drafts older than this many ms. Default: 7 days. */
|
|
35
|
+
ttlMs?: number;
|
|
36
|
+
/** When true (default), auto-load a valid draft on mount and surface `hasDraft`. */
|
|
37
|
+
autoLoad?: boolean;
|
|
38
|
+
/** Disable all persistence (useful in tests). */
|
|
39
|
+
enabled?: boolean;
|
|
40
|
+
}
|
|
41
|
+
export interface UseFieldFlowDraftResult<T extends Record<string, string>> {
|
|
42
|
+
/** True once the initial storage read has finished. */
|
|
43
|
+
ready: boolean;
|
|
44
|
+
/** A valid draft exists that has not yet been resumed or discarded. */
|
|
45
|
+
hasDraft: boolean;
|
|
46
|
+
/** Timestamp of the pending draft, if any. */
|
|
47
|
+
draftSavedAt: number | null;
|
|
48
|
+
/** Snapshot of the pending draft values (before resume). */
|
|
49
|
+
draftValues: T | null;
|
|
50
|
+
/** Apply the pending draft via `onRestore` and clear the banner state. */
|
|
51
|
+
resume: () => void;
|
|
52
|
+
/** Delete the draft and hide the banner. */
|
|
53
|
+
discard: () => Promise<void>;
|
|
54
|
+
/** Force an immediate save of current values. */
|
|
55
|
+
saveNow: () => Promise<void>;
|
|
56
|
+
/** Clear storage for this key. */
|
|
57
|
+
clear: () => Promise<void>;
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Debounced draft persistence for FieldFlow forms. Storage is injected so the
|
|
61
|
+
* package stays free of native / peer storage dependencies.
|
|
62
|
+
*/
|
|
63
|
+
export declare function useFieldFlowDraft<T extends Record<string, string>>({ key, storage, values, onRestore, exclude, debounceMs, ttlMs, autoLoad, enabled, }: UseFieldFlowDraftOptions<T>): UseFieldFlowDraftResult<T>;
|
|
64
|
+
//# sourceMappingURL=useFieldFlowDraft.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useFieldFlowDraft.d.ts","sourceRoot":"","sources":["../../../src/hooks/useFieldFlowDraft.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;GAUG;AACH,MAAM,WAAW,qBAAqB;IACpC,OAAO,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC;IACjD,OAAO,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IACvD,UAAU,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;CAC5C;AAED,MAAM,WAAW,qBAAqB,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC;IACrE,MAAM,EAAE,CAAC,CAAC;IACV,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,CAAC,CAAC;CACZ;AAED,MAAM,WAAW,wBAAwB,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC;IACxE,iDAAiD;IACjD,GAAG,EAAE,MAAM,CAAC;IACZ,OAAO,EAAE,qBAAqB,CAAC;IAC/B,mCAAmC;IACnC,MAAM,EAAE,CAA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
1
|
+
import type { TextInput } from 'react-native';
|
|
1
2
|
import type { FieldFlowRules, ValidationResult } from '../types';
|
|
3
|
+
import { type FieldFlowLocale, type FieldFlowValidationMessages } from '../i18n/messages';
|
|
4
|
+
import { type UseFormIntelligenceResult } from './useFormIntelligence';
|
|
5
|
+
import type { FormIntelligenceOptions } from '../intelligence/types';
|
|
2
6
|
export type FieldFlowFormRules<T extends Record<string, string>> = {
|
|
3
7
|
[K in keyof T]?: FieldFlowRules;
|
|
4
8
|
};
|
|
@@ -13,6 +17,23 @@ export interface CrossFieldRule<T extends Record<string, string>> {
|
|
|
13
17
|
deps?: (keyof T)[];
|
|
14
18
|
validate: (values: T) => ValidationResult;
|
|
15
19
|
}
|
|
20
|
+
export type FieldConditionFn<T extends Record<string, string>> = (values: T) => boolean;
|
|
21
|
+
export interface FieldConditionConfig<T extends Record<string, string>> {
|
|
22
|
+
/** Hide the field when false. Hidden fields are skipped during validation. */
|
|
23
|
+
showWhen?: FieldConditionFn<T>;
|
|
24
|
+
/** Dynamically require the field. */
|
|
25
|
+
requiredWhen?: FieldConditionFn<T>;
|
|
26
|
+
/** Dynamically disable the field (caller should pass `disabled` to the input). */
|
|
27
|
+
disabledWhen?: FieldConditionFn<T>;
|
|
28
|
+
}
|
|
29
|
+
export type FieldConditions<T extends Record<string, string>> = {
|
|
30
|
+
[K in keyof T]?: FieldConditionConfig<T>;
|
|
31
|
+
};
|
|
32
|
+
export interface FieldVisibilityState {
|
|
33
|
+
visible: boolean;
|
|
34
|
+
required: boolean;
|
|
35
|
+
disabled: boolean;
|
|
36
|
+
}
|
|
16
37
|
export interface UseFieldFlowFormOptions<T extends Record<string, string>> {
|
|
17
38
|
initialValues: T;
|
|
18
39
|
rules?: FieldFlowFormRules<T>;
|
|
@@ -29,6 +50,10 @@ export interface UseFieldFlowFormOptions<T extends Record<string, string>> {
|
|
|
29
50
|
* }]
|
|
30
51
|
*/
|
|
31
52
|
crossFieldRules?: CrossFieldRule<T>[];
|
|
53
|
+
/**
|
|
54
|
+
* Conditional visibility / required / disabled rules evaluated against live values.
|
|
55
|
+
*/
|
|
56
|
+
conditions?: FieldConditions<T>;
|
|
32
57
|
/**
|
|
33
58
|
* Whole-form validator (e.g. from `zodFormValidate(schema)`).
|
|
34
59
|
* Merged after sync + cross-field rules; field keys map to error messages.
|
|
@@ -41,6 +66,20 @@ export interface UseFieldFlowFormOptions<T extends Record<string, string>> {
|
|
|
41
66
|
asyncValidators?: AsyncFieldValidators<T>;
|
|
42
67
|
/** Debounce for async field validators on change. Default: 400ms. */
|
|
43
68
|
asyncDebounceMs?: number;
|
|
69
|
+
/**
|
|
70
|
+
* Enable form intelligence (friction analytics + a11y autofocus/announce on failed submit).
|
|
71
|
+
* Pass `true` for defaults, or an options object.
|
|
72
|
+
*/
|
|
73
|
+
intelligence?: boolean | FormIntelligenceOptions;
|
|
74
|
+
/** Preferred field order for focus-first-error / announcements. */
|
|
75
|
+
fieldOrder?: (keyof T)[];
|
|
76
|
+
/**
|
|
77
|
+
* Locale for default validation messages (`en` | `es` | `fr` | `de` | `pt` | `ar`).
|
|
78
|
+
* Ignored for rule keys that already pass a custom string message.
|
|
79
|
+
*/
|
|
80
|
+
locale?: FieldFlowLocale;
|
|
81
|
+
/** Full message catalog override (wins over `locale`). */
|
|
82
|
+
messages?: FieldFlowValidationMessages;
|
|
44
83
|
/** Called only when every field passes sync + cross-field + form + async validation. */
|
|
45
84
|
onSubmit?: (values: T) => void | Promise<void>;
|
|
46
85
|
}
|
|
@@ -54,17 +93,56 @@ export interface UseFieldFlowFormResult<T extends Record<string, string>> {
|
|
|
54
93
|
isValid: boolean;
|
|
55
94
|
/** True while any async field validator is in flight. */
|
|
56
95
|
isValidating: boolean;
|
|
96
|
+
/** True when current values differ from `initialValues`. */
|
|
97
|
+
isDirty: boolean;
|
|
98
|
+
/** Per-field dirty flags. */
|
|
99
|
+
dirtyFields: Partial<Record<keyof T, boolean>>;
|
|
57
100
|
setValue: (field: keyof T, value: string) => void;
|
|
101
|
+
setValues: (values: T | ((prev: T) => T)) => void;
|
|
102
|
+
/** Merge server / API errors (e.g. 422 field map). Touches those fields. */
|
|
103
|
+
setErrors: (errors: Partial<Record<keyof T, string | undefined>>) => void;
|
|
104
|
+
/** Set a single field error from the server. */
|
|
105
|
+
setFieldError: (field: keyof T, message: string | undefined) => void;
|
|
106
|
+
/** Clear one field or all errors. */
|
|
107
|
+
clearErrors: (field?: keyof T) => void;
|
|
58
108
|
handleChange: (field: keyof T) => (value: string) => void;
|
|
59
109
|
handleBlur: (field: keyof T) => () => void;
|
|
110
|
+
handleFocus: (field: keyof T) => () => void;
|
|
60
111
|
validateField: (field: keyof T) => Promise<boolean>;
|
|
112
|
+
/** Validate a subset of fields (wizard steps). */
|
|
113
|
+
validateFields: (fields: (keyof T)[]) => Promise<boolean>;
|
|
61
114
|
validateAll: () => Promise<boolean>;
|
|
62
115
|
submit: () => Promise<void>;
|
|
63
116
|
reset: () => void;
|
|
117
|
+
/** Evaluate conditional rules for a field against current values. */
|
|
118
|
+
getFieldState: (field: keyof T) => FieldVisibilityState;
|
|
119
|
+
isVisible: (field: keyof T) => boolean;
|
|
120
|
+
isRequired: (field: keyof T) => boolean;
|
|
121
|
+
isDisabled: (field: keyof T) => boolean;
|
|
122
|
+
/**
|
|
123
|
+
* Convenience props to spread onto a FieldFlow input for a given field.
|
|
124
|
+
* Respects visibility (returns `null` when hidden so you can short-circuit render).
|
|
125
|
+
*/
|
|
126
|
+
getInputProps: (field: keyof T) => null | {
|
|
127
|
+
value: string;
|
|
128
|
+
onChangeText: (value: string) => void;
|
|
129
|
+
onBlur: () => void;
|
|
130
|
+
onFocus: () => void;
|
|
131
|
+
errorText: string | undefined;
|
|
132
|
+
required: boolean;
|
|
133
|
+
disabled: boolean;
|
|
134
|
+
};
|
|
135
|
+
/** Present when `intelligence` is enabled. */
|
|
136
|
+
intelligence: UseFormIntelligenceResult<Extract<keyof T, string>> | null;
|
|
137
|
+
/** Register a TextInput ref for a11y autofocus (intelligence). */
|
|
138
|
+
registerFieldRef: (field: keyof T, ref: {
|
|
139
|
+
current: TextInput | null;
|
|
140
|
+
} | TextInput | null) => void;
|
|
64
141
|
}
|
|
65
142
|
/**
|
|
66
143
|
* Drop-in form state manager for a set of FieldFlow inputs. Handles values,
|
|
67
|
-
* per-field + cross-field + async validation, touched-state,
|
|
144
|
+
* per-field + cross-field + conditional + async validation, touched-state,
|
|
145
|
+
* optional form intelligence, and submission.
|
|
68
146
|
*/
|
|
69
|
-
export declare function useFieldFlowForm<T extends Record<string, string>>({ initialValues, rules, crossFieldRules, formValidate, asyncValidators, asyncDebounceMs, onSubmit, }: UseFieldFlowFormOptions<T>): UseFieldFlowFormResult<T>;
|
|
147
|
+
export declare function useFieldFlowForm<T extends Record<string, string>>({ initialValues, rules, crossFieldRules, conditions, formValidate, asyncValidators, asyncDebounceMs, intelligence: intelligenceOpt, fieldOrder, locale, messages: messagesOverride, onSubmit, }: UseFieldFlowFormOptions<T>): UseFieldFlowFormResult<T>;
|
|
70
148
|
//# sourceMappingURL=useFieldFlowForm.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useFieldFlowForm.d.ts","sourceRoot":"","sources":["../../../src/hooks/useFieldFlowForm.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"useFieldFlowForm.d.ts","sourceRoot":"","sources":["../../../src/hooks/useFieldFlowForm.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,KAAK,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAEjE,OAAO,EAEL,KAAK,eAAe,EACpB,KAAK,2BAA2B,EACjC,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAEL,KAAK,yBAAyB,EAC/B,MAAM,uBAAuB,CAAC;AAC/B,OAA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AS,CAAC;QAC9B,QAAQ,EAAE,OAAO,CAAC;QAClB,QAAQ,EAAE,OAAO,CAAC;KACnB,CAAC;IACF,8CAA8C;IAC9C,YAAY,EAAE,yBAAyB,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC,CAAC,GAAG,IAAI,CAAC;IACzE,kEAAkE;IAClE,gBAAgB,EAAE,CAChB,KAAK,EAAE,MAAM,CAAC,EACd,GAAG,EAAE;QAAE,OAAO,EAAE,SAAS,GAAG,IAAI,CAAA;KAAE,GAAG,SAAS,GAAG,IAAI,KAClD,IAAI,CAAC;CACX;AAED;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EAAE,EACjE,aAAa,EACb,KAAK,EACL,eAAe,EACf,UAAU,EACV,YAAY,EACZ,eAAe,EACf,eAAqB,EACrB,YAAY,EAAE,eAAe,EAC7B,UAAU,EACV,MAAa,EACb,QAAQ,EAAE,gBAAgB,EAC1B,QAAQ,GACT,EAAE,uBAAuB,CAAC,CAAC,CAAC,GAAG,sBAAsB,CAAC,CAAC,CAAC,CAkcxD"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
export interface FieldFlowStepDefinition<T extends Record<string, string> = Record<string, string>> {
|
|
2
|
+
/** Stable id for the step. */
|
|
3
|
+
id: string;
|
|
4
|
+
title: string;
|
|
5
|
+
description?: string;
|
|
6
|
+
/** Fields that must pass validation before advancing (keys of your form values). */
|
|
7
|
+
fields?: (keyof T)[];
|
|
8
|
+
/** Optional guard — return false (or a message) to block next. */
|
|
9
|
+
canLeave?: (values: T) => boolean | string;
|
|
10
|
+
}
|
|
11
|
+
export interface UseFieldFlowStepsOptions<T extends Record<string, string>> {
|
|
12
|
+
steps: FieldFlowStepDefinition<T>[];
|
|
13
|
+
/** Form values used by `canLeave` and exposed to callers. */
|
|
14
|
+
values: T;
|
|
15
|
+
/**
|
|
16
|
+
* Validate a subset of fields (usually from `useFieldFlowForm`).
|
|
17
|
+
* Should return true when all listed fields are valid.
|
|
18
|
+
*/
|
|
19
|
+
validateFields?: (fields: (keyof T)[]) => Promise<boolean>;
|
|
20
|
+
/** Initial step index. Default: 0. */
|
|
21
|
+
initialStep?: number;
|
|
22
|
+
/** Called when the user completes the last step successfully. */
|
|
23
|
+
onComplete?: () => void | Promise<void>;
|
|
24
|
+
}
|
|
25
|
+
export interface UseFieldFlowStepsResult<T extends Record<string, string>> {
|
|
26
|
+
steps: FieldFlowStepDefinition<T>[];
|
|
27
|
+
stepIndex: number;
|
|
28
|
+
step: FieldFlowStepDefinition<T>;
|
|
29
|
+
isFirst: boolean;
|
|
30
|
+
isLast: boolean;
|
|
31
|
+
progress: number;
|
|
32
|
+
stepError: string | undefined;
|
|
33
|
+
goTo: (index: number) => void;
|
|
34
|
+
next: () => Promise<boolean>;
|
|
35
|
+
back: () => void;
|
|
36
|
+
reset: () => void;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Multi-step / wizard controller — pairs with `FieldFlowStepper` and `useFieldFlowForm`.
|
|
40
|
+
*/
|
|
41
|
+
export declare function useFieldFlowSteps<T extends Record<string, string>>({ steps, values, validateFields, initialStep, onComplete, }: UseFieldFlowStepsOptions<T>): UseFieldFlowStepsResult<T>;
|
|
42
|
+
//# sourceMappingURL=useFieldFlowSteps.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useFieldFlowSteps.d.ts","sourceRoot":"","sources":["../../../src/hooks/useFieldFlowSteps.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,uBAAuB,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC;IAChG,8BAA8B;IAC9B,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,oFAAoF;IACpF,MAAM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