rn-inputforge 0.1.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.
Files changed (193) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +273 -0
  3. package/lib/commonjs/components/ChatInput/ChatInput.js +170 -0
  4. package/lib/commonjs/components/ChatInput/ChatInput.js.map +1 -0
  5. package/lib/commonjs/components/ChatInput/index.js +13 -0
  6. package/lib/commonjs/components/ChatInput/index.js.map +1 -0
  7. package/lib/commonjs/components/ChatInput/types.js +6 -0
  8. package/lib/commonjs/components/ChatInput/types.js.map +1 -0
  9. package/lib/commonjs/components/DescriptionField/DescriptionField.js +40 -0
  10. package/lib/commonjs/components/DescriptionField/DescriptionField.js.map +1 -0
  11. package/lib/commonjs/components/DescriptionField/index.js +13 -0
  12. package/lib/commonjs/components/DescriptionField/index.js.map +1 -0
  13. package/lib/commonjs/components/FieldFlowInput/FieldFlowInput.js +207 -0
  14. package/lib/commonjs/components/FieldFlowInput/FieldFlowInput.js.map +1 -0
  15. package/lib/commonjs/components/FieldFlowInput/index.js +13 -0
  16. package/lib/commonjs/components/FieldFlowInput/index.js.map +1 -0
  17. package/lib/commonjs/components/FieldFlowInput/styles.js +99 -0
  18. package/lib/commonjs/components/FieldFlowInput/styles.js.map +1 -0
  19. package/lib/commonjs/components/FieldFlowInput/types.js +6 -0
  20. package/lib/commonjs/components/FieldFlowInput/types.js.map +1 -0
  21. package/lib/commonjs/components/KeyboardAwareFormWrapper/KeyboardAwareFormWrapper.js +44 -0
  22. package/lib/commonjs/components/KeyboardAwareFormWrapper/KeyboardAwareFormWrapper.js.map +1 -0
  23. package/lib/commonjs/components/KeyboardAwareFormWrapper/index.js +13 -0
  24. package/lib/commonjs/components/KeyboardAwareFormWrapper/index.js.map +1 -0
  25. package/lib/commonjs/hooks/index.js +27 -0
  26. package/lib/commonjs/hooks/index.js.map +1 -0
  27. package/lib/commonjs/hooks/useFieldFlowForm.js +108 -0
  28. package/lib/commonjs/hooks/useFieldFlowForm.js.map +1 -0
  29. package/lib/commonjs/hooks/useFieldState.js +27 -0
  30. package/lib/commonjs/hooks/useFieldState.js.map +1 -0
  31. package/lib/commonjs/hooks/useKeyboardManager.js +68 -0
  32. package/lib/commonjs/hooks/useKeyboardManager.js.map +1 -0
  33. package/lib/commonjs/icons/Icon.js +388 -0
  34. package/lib/commonjs/icons/Icon.js.map +1 -0
  35. package/lib/commonjs/icons/index.js +13 -0
  36. package/lib/commonjs/icons/index.js.map +1 -0
  37. package/lib/commonjs/index.js +158 -0
  38. package/lib/commonjs/index.js.map +1 -0
  39. package/lib/commonjs/package.json +1 -0
  40. package/lib/commonjs/theme/ThemeProvider.js +48 -0
  41. package/lib/commonjs/theme/ThemeProvider.js.map +1 -0
  42. package/lib/commonjs/theme/defaultTheme.js +62 -0
  43. package/lib/commonjs/theme/defaultTheme.js.map +1 -0
  44. package/lib/commonjs/theme/index.js +38 -0
  45. package/lib/commonjs/theme/index.js.map +1 -0
  46. package/lib/commonjs/types/index.js +6 -0
  47. package/lib/commonjs/types/index.js.map +1 -0
  48. package/lib/commonjs/utils/formatters.js +25 -0
  49. package/lib/commonjs/utils/formatters.js.map +1 -0
  50. package/lib/commonjs/utils/keyboardTypes.js +103 -0
  51. package/lib/commonjs/utils/keyboardTypes.js.map +1 -0
  52. package/lib/commonjs/validation/index.js +80 -0
  53. package/lib/commonjs/validation/index.js.map +1 -0
  54. package/lib/commonjs/validation/useValidation.js +34 -0
  55. package/lib/commonjs/validation/useValidation.js.map +1 -0
  56. package/lib/commonjs/validation/validators.js +118 -0
  57. package/lib/commonjs/validation/validators.js.map +1 -0
  58. package/lib/module/components/ChatInput/ChatInput.js +165 -0
  59. package/lib/module/components/ChatInput/ChatInput.js.map +1 -0
  60. package/lib/module/components/ChatInput/index.js +4 -0
  61. package/lib/module/components/ChatInput/index.js.map +1 -0
  62. package/lib/module/components/ChatInput/types.js +4 -0
  63. package/lib/module/components/ChatInput/types.js.map +1 -0
  64. package/lib/module/components/DescriptionField/DescriptionField.js +35 -0
  65. package/lib/module/components/DescriptionField/DescriptionField.js.map +1 -0
  66. package/lib/module/components/DescriptionField/index.js +4 -0
  67. package/lib/module/components/DescriptionField/index.js.map +1 -0
  68. package/lib/module/components/FieldFlowInput/FieldFlowInput.js +202 -0
  69. package/lib/module/components/FieldFlowInput/FieldFlowInput.js.map +1 -0
  70. package/lib/module/components/FieldFlowInput/index.js +4 -0
  71. package/lib/module/components/FieldFlowInput/index.js.map +1 -0
  72. package/lib/module/components/FieldFlowInput/styles.js +92 -0
  73. package/lib/module/components/FieldFlowInput/styles.js.map +1 -0
  74. package/lib/module/components/FieldFlowInput/types.js +4 -0
  75. package/lib/module/components/FieldFlowInput/types.js.map +1 -0
  76. package/lib/module/components/KeyboardAwareFormWrapper/KeyboardAwareFormWrapper.js +39 -0
  77. package/lib/module/components/KeyboardAwareFormWrapper/KeyboardAwareFormWrapper.js.map +1 -0
  78. package/lib/module/components/KeyboardAwareFormWrapper/index.js +4 -0
  79. package/lib/module/components/KeyboardAwareFormWrapper/index.js.map +1 -0
  80. package/lib/module/hooks/index.js +6 -0
  81. package/lib/module/hooks/index.js.map +1 -0
  82. package/lib/module/hooks/useFieldFlowForm.js +104 -0
  83. package/lib/module/hooks/useFieldFlowForm.js.map +1 -0
  84. package/lib/module/hooks/useFieldState.js +23 -0
  85. package/lib/module/hooks/useFieldState.js.map +1 -0
  86. package/lib/module/hooks/useKeyboardManager.js +64 -0
  87. package/lib/module/hooks/useKeyboardManager.js.map +1 -0
  88. package/lib/module/icons/Icon.js +383 -0
  89. package/lib/module/icons/Icon.js.map +1 -0
  90. package/lib/module/icons/index.js +4 -0
  91. package/lib/module/icons/index.js.map +1 -0
  92. package/lib/module/index.js +18 -0
  93. package/lib/module/index.js.map +1 -0
  94. package/lib/module/theme/ThemeProvider.js +42 -0
  95. package/lib/module/theme/ThemeProvider.js.map +1 -0
  96. package/lib/module/theme/defaultTheme.js +58 -0
  97. package/lib/module/theme/defaultTheme.js.map +1 -0
  98. package/lib/module/theme/index.js +5 -0
  99. package/lib/module/theme/index.js.map +1 -0
  100. package/lib/module/types/index.js +4 -0
  101. package/lib/module/types/index.js.map +1 -0
  102. package/lib/module/utils/formatters.js +19 -0
  103. package/lib/module/utils/formatters.js.map +1 -0
  104. package/lib/module/utils/keyboardTypes.js +98 -0
  105. package/lib/module/utils/keyboardTypes.js.map +1 -0
  106. package/lib/module/validation/index.js +5 -0
  107. package/lib/module/validation/index.js.map +1 -0
  108. package/lib/module/validation/useValidation.js +30 -0
  109. package/lib/module/validation/useValidation.js.map +1 -0
  110. package/lib/module/validation/validators.js +103 -0
  111. package/lib/module/validation/validators.js.map +1 -0
  112. package/lib/typescript/components/ChatInput/ChatInput.d.ts +10 -0
  113. package/lib/typescript/components/ChatInput/ChatInput.d.ts.map +1 -0
  114. package/lib/typescript/components/ChatInput/index.d.ts +3 -0
  115. package/lib/typescript/components/ChatInput/index.d.ts.map +1 -0
  116. package/lib/typescript/components/ChatInput/types.d.ts +30 -0
  117. package/lib/typescript/components/ChatInput/types.d.ts.map +1 -0
  118. package/lib/typescript/components/DescriptionField/DescriptionField.d.ts +16 -0
  119. package/lib/typescript/components/DescriptionField/DescriptionField.d.ts.map +1 -0
  120. package/lib/typescript/components/DescriptionField/index.d.ts +3 -0
  121. package/lib/typescript/components/DescriptionField/index.d.ts.map +1 -0
  122. package/lib/typescript/components/FieldFlowInput/FieldFlowInput.d.ts +5 -0
  123. package/lib/typescript/components/FieldFlowInput/FieldFlowInput.d.ts.map +1 -0
  124. package/lib/typescript/components/FieldFlowInput/index.d.ts +3 -0
  125. package/lib/typescript/components/FieldFlowInput/index.d.ts.map +1 -0
  126. package/lib/typescript/components/FieldFlowInput/styles.d.ts +71 -0
  127. package/lib/typescript/components/FieldFlowInput/styles.d.ts.map +1 -0
  128. package/lib/typescript/components/FieldFlowInput/types.d.ts +50 -0
  129. package/lib/typescript/components/FieldFlowInput/types.d.ts.map +1 -0
  130. package/lib/typescript/components/KeyboardAwareFormWrapper/KeyboardAwareFormWrapper.d.ts +17 -0
  131. package/lib/typescript/components/KeyboardAwareFormWrapper/KeyboardAwareFormWrapper.d.ts.map +1 -0
  132. package/lib/typescript/components/KeyboardAwareFormWrapper/index.d.ts +3 -0
  133. package/lib/typescript/components/KeyboardAwareFormWrapper/index.d.ts.map +1 -0
  134. package/lib/typescript/hooks/index.d.ts +7 -0
  135. package/lib/typescript/hooks/index.d.ts.map +1 -0
  136. package/lib/typescript/hooks/useFieldFlowForm.d.ts +31 -0
  137. package/lib/typescript/hooks/useFieldFlowForm.d.ts.map +1 -0
  138. package/lib/typescript/hooks/useFieldState.d.ts +12 -0
  139. package/lib/typescript/hooks/useFieldState.d.ts.map +1 -0
  140. package/lib/typescript/hooks/useKeyboardManager.d.ts +35 -0
  141. package/lib/typescript/hooks/useKeyboardManager.d.ts.map +1 -0
  142. package/lib/typescript/icons/Icon.d.ts +17 -0
  143. package/lib/typescript/icons/Icon.d.ts.map +1 -0
  144. package/lib/typescript/icons/index.d.ts +3 -0
  145. package/lib/typescript/icons/index.d.ts.map +1 -0
  146. package/lib/typescript/index.d.ts +18 -0
  147. package/lib/typescript/index.d.ts.map +1 -0
  148. package/lib/typescript/theme/ThemeProvider.d.ts +16 -0
  149. package/lib/typescript/theme/ThemeProvider.d.ts.map +1 -0
  150. package/lib/typescript/theme/defaultTheme.d.ts +4 -0
  151. package/lib/typescript/theme/defaultTheme.d.ts.map +1 -0
  152. package/lib/typescript/theme/index.d.ts +4 -0
  153. package/lib/typescript/theme/index.d.ts.map +1 -0
  154. package/lib/typescript/types/index.d.ts +79 -0
  155. package/lib/typescript/types/index.d.ts.map +1 -0
  156. package/lib/typescript/utils/formatters.d.ts +5 -0
  157. package/lib/typescript/utils/formatters.d.ts.map +1 -0
  158. package/lib/typescript/utils/keyboardTypes.d.ts +18 -0
  159. package/lib/typescript/utils/keyboardTypes.d.ts.map +1 -0
  160. package/lib/typescript/validation/index.d.ts +4 -0
  161. package/lib/typescript/validation/index.d.ts.map +1 -0
  162. package/lib/typescript/validation/useValidation.d.ts +14 -0
  163. package/lib/typescript/validation/useValidation.d.ts.map +1 -0
  164. package/lib/typescript/validation/validators.d.ts +17 -0
  165. package/lib/typescript/validation/validators.d.ts.map +1 -0
  166. package/package.json +80 -0
  167. package/src/components/ChatInput/ChatInput.tsx +178 -0
  168. package/src/components/ChatInput/index.ts +2 -0
  169. package/src/components/ChatInput/types.ts +35 -0
  170. package/src/components/DescriptionField/DescriptionField.tsx +39 -0
  171. package/src/components/DescriptionField/index.ts +2 -0
  172. package/src/components/FieldFlowInput/FieldFlowInput.tsx +240 -0
  173. package/src/components/FieldFlowInput/index.ts +2 -0
  174. package/src/components/FieldFlowInput/styles.ts +94 -0
  175. package/src/components/FieldFlowInput/types.ts +55 -0
  176. package/src/components/KeyboardAwareFormWrapper/KeyboardAwareFormWrapper.tsx +45 -0
  177. package/src/components/KeyboardAwareFormWrapper/index.ts +2 -0
  178. package/src/hooks/index.ts +12 -0
  179. package/src/hooks/useFieldFlowForm.ts +133 -0
  180. package/src/hooks/useFieldState.ts +31 -0
  181. package/src/hooks/useKeyboardManager.ts +105 -0
  182. package/src/icons/Icon.tsx +338 -0
  183. package/src/icons/index.ts +2 -0
  184. package/src/index.ts +63 -0
  185. package/src/theme/ThemeProvider.tsx +49 -0
  186. package/src/theme/defaultTheme.ts +58 -0
  187. package/src/theme/index.ts +3 -0
  188. package/src/types/index.ts +98 -0
  189. package/src/utils/formatters.ts +18 -0
  190. package/src/utils/keyboardTypes.ts +85 -0
  191. package/src/validation/index.ts +15 -0
  192. package/src/validation/useValidation.ts +37 -0
  193. package/src/validation/validators.ts +93 -0
@@ -0,0 +1,50 @@
1
+ import type React from 'react';
2
+ import type { TextInputProps, ViewStyle, TextStyle } from 'react-native';
3
+ import type { FieldFlowFieldType, FieldFlowRules, DeepPartial, FieldFlowTheme } from '../../types';
4
+ import type { FieldFlowIconName } from '../../icons';
5
+ export interface FieldFlowInputProps extends Omit<TextInputProps, 'style' | 'onChangeText' | 'onFocus' | 'onBlur' | 'onSubmitEditing'> {
6
+ /** Determines keyboard, secure entry, validation defaults, and default icon behavior. */
7
+ type?: FieldFlowFieldType;
8
+ label?: string;
9
+ helperText?: string;
10
+ errorText?: string;
11
+ /** Set true to force the error visual state even without `errorText` (e.g. from a form hook). */
12
+ hasError?: boolean;
13
+ successText?: string;
14
+ isSuccess?: boolean;
15
+ loading?: boolean;
16
+ disabled?: boolean;
17
+ readOnly?: boolean;
18
+ required?: boolean;
19
+ value?: string;
20
+ defaultValue?: string;
21
+ onChangeText?: (value: string) => void;
22
+ onFocus?: () => void;
23
+ onBlur?: () => void;
24
+ /** Validation rules; if omitted, sensible defaults are inferred from `type` (e.g. email format). */
25
+ rules?: FieldFlowRules;
26
+ /** Runs validation on every keystroke instead of just on blur. */
27
+ validateOnChange?: boolean;
28
+ /** Called with the validation result whenever a validation pass runs. */
29
+ onValidate?: (result: {
30
+ valid: boolean;
31
+ message?: string;
32
+ }) => void;
33
+ leftIcon?: FieldFlowIconName | React.ReactNode;
34
+ rightIcon?: FieldFlowIconName | React.ReactNode;
35
+ onLeftIconPress?: () => void;
36
+ onRightIconPress?: () => void;
37
+ /** Shows an "x" clear button when there's text (defaults to true for `search`, false otherwise). */
38
+ clearable?: boolean;
39
+ maxLength?: number;
40
+ showCharacterCount?: boolean;
41
+ /** Return-key handling used by useKeyboardManager; if provided, overrides default onSubmitEditing wiring. */
42
+ onSubmitEditing?: () => void;
43
+ containerStyle?: ViewStyle;
44
+ inputStyle?: TextStyle;
45
+ labelStyle?: TextStyle;
46
+ helperStyle?: TextStyle;
47
+ theme?: DeepPartial<FieldFlowTheme>;
48
+ testID?: string;
49
+ }
50
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/components/FieldFlowInput/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,O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AAM,CAAA;KAAE,KAAK,IAAI,CAAC;IAEpE,QAAQ,CAAC,EAAE,iBAAiB,GAAG,KAAK,CAAC,SAAS,CAAC;IAC/C,SAAS,CAAC,EAAE,iBAAiB,GAAG,KAAK,CAAC,SAAS,CAAC;IAChD,eAAe,CAAC,EAAE,MAAM,IAAI,CAAC;IAC7B,gBAAgB,CAAC,EAAE,MAAM,IAAI,CAAC;IAC9B,oGAAoG;IACpG,SAAS,CAAC,EAAE,OAAO,CAAC;IAEpB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAE7B,6GAA6G;IAC7G,eAAe,CAAC,EAAE,MAAM,IAAI,CAAC;IAE7B,cAAc,CAAC,EAAE,SAAS,CAAC;IAC3B,UAAU,CAAC,EAAE,SAAS,CAAC;IACvB,UAAU,CAAC,EAAE,SAAS,CAAC;IACvB,WAAW,CAAC,EAAE,SAAS,CAAC;IACxB,KAAK,CAAC,EAAE,WAAW,CAAC,cAAc,CAAC,CAAC;IAEpC,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB"}
@@ -0,0 +1,17 @@
1
+ import React from 'react';
2
+ import { ViewStyle } from 'react-native';
3
+ import type { UseKeyboardManagerResult } from '../../hooks/useKeyboardManager';
4
+ export interface KeyboardAwareFormWrapperProps {
5
+ keyboardManager: Pick<UseKeyboardManagerResult, 'scrollViewRef'>;
6
+ children: React.ReactNode;
7
+ contentContainerStyle?: ViewStyle;
8
+ style?: ViewStyle;
9
+ }
10
+ /**
11
+ * Wrap your form fields in this instead of a plain ScrollView. It automatically
12
+ * keeps the focused field visible above the keyboard and animates smoothly on
13
+ * both iOS and Android; pass it the same `keyboardManager` you got from
14
+ * `useKeyboardManager()`.
15
+ */
16
+ export declare function KeyboardAwareFormWrapper({ keyboardManager, children, contentContainerStyle, style, }: KeyboardAwareFormWrapperProps): React.JSX.Element;
17
+ //# sourceMappingURL=KeyboardAwareFormWrapper.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"KeyboardAwareFormWrapper.d.ts","sourceRoot":"","sources":["../../../../src/components/KeyboardAwareFormWrapper/KeyboardAwareFormWrapper.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAA0D,SAAS,EAAE,MAAM,cAAc,CAAC;AACjG,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,gCAAgC,CAAC;AAE/E,MAAM,WAAW,6BAA6B;IAC5C,eAAe,EAAE,IAAI,CAAC,wBAAwB,EAAE,eAAe,CAAC,CAAC;IACjE,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,qBAAqB,CAAC,EAAE,SAAS,CAAC;IAClC,KAAK,CAAC,EAAE,SAAS,CAAC;CACnB;AAED;;;;;GAKG;AACH,wBAAgB,wBAAwB,CAAC,EACvC,eAAe,EACf,QAAQ,EACR,qBAAqB,EACrB,KAAK,GACN,EAAE,6BAA6B,qBAiB/B"}
@@ -0,0 +1,3 @@
1
+ export { KeyboardAwareFormWrapper } from './KeyboardAwareFormWrapper';
2
+ export type { KeyboardAwareFormWrapperProps } from './KeyboardAwareFormWrapper';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/KeyboardAwareFormWrapper/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,MAAM,4BAA4B,CAAC;AACtE,YAAY,EAAE,6BAA6B,EAAE,MAAM,4BAA4B,CAAC"}
@@ -0,0 +1,7 @@
1
+ export { useKeyboardManager } from './useKeyboardManager';
2
+ export type { UseKeyboardManagerOptions, UseKeyboardManagerResult, KeyboardManagerField } from './useKeyboardManager';
3
+ export { useFieldFlowForm } from './useFieldFlowForm';
4
+ export type { UseFieldFlowFormOptions, UseFieldFlowFormResult, FieldFlowFormRules, } from './useFieldFlowForm';
5
+ export { useFieldState } from './useFieldState';
6
+ export type { UseFieldStateOptions } from './useFieldState';
7
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +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,GACnB,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,YAAY,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAC"}
@@ -0,0 +1,31 @@
1
+ import type { FieldFlowRules } from '../types';
2
+ export type FieldFlowFormRules<T extends Record<string, string>> = {
3
+ [K in keyof T]?: FieldFlowRules;
4
+ };
5
+ export interface UseFieldFlowFormOptions<T extends Record<string, string>> {
6
+ initialValues: T;
7
+ rules?: FieldFlowFormRules<T>;
8
+ /** Called only when every field passes validation. */
9
+ onSubmit?: (values: T) => void | Promise<void>;
10
+ }
11
+ export interface UseFieldFlowFormResult<T extends Record<string, string>> {
12
+ values: T;
13
+ errors: Partial<Record<keyof T, string>>;
14
+ touched: Partial<Record<keyof T, boolean>>;
15
+ isSubmitting: boolean;
16
+ isValid: boolean;
17
+ setValue: (field: keyof T, value: string) => void;
18
+ handleChange: (field: keyof T) => (value: string) => void;
19
+ handleBlur: (field: keyof T) => () => void;
20
+ validateField: (field: keyof T) => boolean;
21
+ validateAll: () => boolean;
22
+ submit: () => Promise<void>;
23
+ reset: () => void;
24
+ }
25
+ /**
26
+ * Drop-in form state manager for a set of FieldFlow inputs. Handles values,
27
+ * per-field + whole-form validation (via the same `FieldFlowRules` used by
28
+ * the input components), touched-state, and submission.
29
+ */
30
+ export declare function useFieldFlowForm<T extends Record<string, string>>({ initialValues, rules, onSubmit, }: UseFieldFlowFormOptions<T>): UseFieldFlowFormResult<T>;
31
+ //# sourceMappingURL=useFieldFlowForm.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useFieldFlowForm.d.ts","sourceRoot":"","sources":["../../../src/hooks/useFieldFlowForm.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAG/C,MAAM,MAAM,kBAAkB,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,IAAI;KAChE,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,EAAE,cAAc;CAChC,CAAC;AAEF,MAAM,WAAW,uBAAuB,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC;IACvE,aAAa,EAAE,CAAC,CAAC;IACjB,KAAK,CAAC,EAAE,kBAAkB,CAAC,CAAC,CAAC,CAAC;IAC9B,sDAAsD;IACtD,QAAQ,CAAC,EAAE,CAAC,MAAM,EAAE,CAAC,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CAChD;AAED,MAAM,WAAW,sBAAsB,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC;IACtE,MAAM,EAAE,CAAC,CAAC;IACV,MAAM,EAAE,OAAO,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC;IACzC,OAAO,EAAE,OAAO,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE,OAAO,CAAC,CAAC,CAAC;IAC3C,YAAY,EAAE,OAAO,CAAC;IACtB,OAAO,EAAE,OAAO,CAAC;IACjB,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,CAAC,EAAE,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAClD,YAAY,EAAE,CAAC,KAAK,EAAE,MAAM,CAAC,KAAK,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAC1D,UAAU,EAAE,CAAC,KAAK,EAAE,MAAM,CAAC,KAAK,MAAM,IAAI,CAAC;IAC3C,aAAa,EAAE,CAAC,KAAK,EAAE,MAAM,CAAC,KAAK,OAAO,CAAC;IAC3C,WAAW,EAAE,MAAM,OAAO,CAAC;IAC3B,MAAM,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IAC5B,KAAK,EAAE,MAAM,IAAI,CAAC;CACnB;AAED;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EAAE,EACjE,aAAa,EACb,KAAK,EACL,QAAQ,GACT,EAAE,uBAAuB,CAAC,CAAC,CAAC,GAAG,sBAAsB,CAAC,CAAC,CAAC,CA6FxD"}
@@ -0,0 +1,12 @@
1
+ import type { FieldFlowState } from '../types';
2
+ export interface UseFieldStateOptions {
3
+ isFocused: boolean;
4
+ hasError: boolean;
5
+ isSuccess?: boolean;
6
+ disabled?: boolean;
7
+ readOnly?: boolean;
8
+ loading?: boolean;
9
+ }
10
+ /** Resolves the many boolean flags a field can have into one canonical visual state. */
11
+ export declare function useFieldState({ isFocused, hasError, isSuccess, disabled, readOnly, loading, }: UseFieldStateOptions): FieldFlowState;
12
+ //# sourceMappingURL=useFieldState.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useFieldState.d.ts","sourceRoot":"","sources":["../../../src/hooks/useFieldState.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAE/C,MAAM,WAAW,oBAAoB;IACnC,SAAS,EAAE,OAAO,CAAC;IACnB,QAAQ,EAAE,OAAO,CAAC;IAClB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED,wFAAwF;AACxF,wBAAgB,aAAa,CAAC,EAC5B,SAAS,EACT,QAAQ,EACR,SAAS,EACT,QAAQ,EACR,QAAQ,EACR,OAAO,GACR,EAAE,oBAAoB,GAAG,cAAc,CAUvC"}
@@ -0,0 +1,35 @@
1
+ import type { ScrollView, TextInput } from 'react-native';
2
+ export interface KeyboardManagerField {
3
+ ref: React.RefObject<TextInput | null>;
4
+ /** y-position of this field within the ScrollView, used for auto-scroll. Optional. */
5
+ offsetY?: number;
6
+ }
7
+ export interface UseKeyboardManagerResult {
8
+ /** Attach to a field's `ref` and pass the returned `onSubmitEditing`/`returnKeyType` down. */
9
+ registerField: (id: string, ref: React.RefObject<TextInput | null>, offsetY?: number) => void;
10
+ unregisterField: (id: string) => void;
11
+ /** Call from a field's onSubmitEditing to move focus to the next registered field, or submit if it's last. */
12
+ focusNext: (id: string) => void;
13
+ focusField: (id: string) => void;
14
+ /** Attach to the surrounding ScrollView so FieldFlow can scroll the active field into view. */
15
+ scrollViewRef: React.RefObject<ScrollView | null>;
16
+ /** returnKeyType to use for a field given its position ("next" for all but the last, "done" for the last). */
17
+ getReturnKeyType: (id: string) => 'next' | 'done';
18
+ onSubmit: () => void;
19
+ }
20
+ export interface UseKeyboardManagerOptions {
21
+ /** Ordered list of field ids, e.g. ['name', 'email', 'password']. Determines Next/Done order. */
22
+ order: string[];
23
+ /** Called when "Done" is pressed on the last field, or focusNext is called past the end. */
24
+ onSubmit?: () => void;
25
+ /** Extra offset (px) added above the target field when auto-scrolling, e.g. for a sticky header. */
26
+ scrollOffset?: number;
27
+ }
28
+ /**
29
+ * Coordinates focus across many inputs in a form: pressing "Next" on the keyboard
30
+ * moves to the next field automatically, "Done" on the last field fires onSubmit,
31
+ * and the surrounding ScrollView auto-scrolls so the focused field stays visible
32
+ * above the keyboard.
33
+ */
34
+ export declare function useKeyboardManager({ order, onSubmit, scrollOffset, }: UseKeyboardManagerOptions): UseKeyboardManagerResult;
35
+ //# sourceMappingURL=useKeyboardMan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AAE,yBAAyB,GAAG,wBAAwB,CA8DtD"}
@@ -0,0 +1,17 @@
1
+ import React from 'react';
2
+ import { ViewStyle } from 'react-native';
3
+ export type FieldFlowIconName = 'eye' | 'eyeOff' | 'clear' | 'check' | 'alert' | 'search' | 'send' | 'camera' | 'image' | 'paperclip' | 'mic' | 'mapPin' | 'spinner';
4
+ export interface FieldFlowIconProps {
5
+ name: FieldFlowIconName;
6
+ size?: number;
7
+ color?: string;
8
+ style?: ViewStyle;
9
+ }
10
+ /**
11
+ * A minimal, dependency-free icon set built out of basic Views. Ships so consumers
12
+ * don't need to install react-native-svg / vector-icons just to use FieldFlow.
13
+ * Every icon accepts `size` and `color`, and you can always render your own
14
+ * icon via the `leftIcon` / `rightIcon` props on any FieldFlow component instead.
15
+ */
16
+ export declare function FieldFlowIcon({ name, size, color, style }: FieldFlowIconProps): React.JSX.Element;
17
+ //# sourceMappingURL=Icon.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Icon.d.ts","sourceRoot":"","sources":["../../../src/icons/Icon.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA4B,MAAM,OAAO,CAAC;AACjD,OAAO,EAA0B,SAAS,EAAE,MAAM,cAAc,CAAC;AAEjE,MAAM,MAAM,iBAAiB,GACzB,KAAK,GACL,QAAQ,GACR,OAAO,GACP,OAAO,GACP,OAAO,GACP,QAAQ,GACR,MAAM,GACN,QAAQ,GACR,OAAO,GACP,WAAW,GACX,KAAK,GACL,QAAQ,GACR,SAAS,CAAC;AAEd,MAAM,WAAW,kBAAkB;IACjC,IAAI,EAAE,iBAAiB,CAAC;IACxB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,SAAS,CAAC;CACnB;AAED;;;;;GAKG;AACH,wBAAgB,aAAa,CAAC,EAAE,IAAI,EAAE,IAAS,EAAE,KAAiB,EAAE,KAAK,EAAE,EAAE,kBAAkB,qBA8Q9F"}
@@ -0,0 +1,3 @@
1
+ export { FieldFlowIcon } from './Icon';
2
+ export type { FieldFlowIconName, FieldFlowIconProps } from './Icon';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/icons/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,QAAQ,CAAC;AACvC,YAAY,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,MAAM,QAAQ,CAAC"}
@@ -0,0 +1,18 @@
1
+ export { FieldFlowInput } from './components/FieldFlowInput';
2
+ export type { FieldFlowInputProps } from './components/FieldFlowInput';
3
+ export { DescriptionField } from './components/DescriptionField';
4
+ export type { DescriptionFieldProps } from './components/DescriptionField';
5
+ export { ChatInput } from './components/ChatInput';
6
+ export type { ChatInputProps, ChatAttachmentAction, CustomChatAction } from './components/ChatInput';
7
+ export { KeyboardAwareFormWrapper } from './components/KeyboardAwareFormWrapper';
8
+ export type { KeyboardAwareFormWrapperProps } from './components/KeyboardAwareFormWrapper';
9
+ export { FieldFlowThemeProvider, useFieldFlowTheme, defaultTheme, darkTheme } from './theme';
10
+ export type { FieldFlowThemeProviderProps } from './theme';
11
+ export { useFieldFlowForm, useKeyboardManager, useFieldState } from './hooks';
12
+ export type { UseFieldFlowFormOptions, UseFieldFlowFormResult, FieldFlowFormRules, UseKeyboardManagerOptions, UseKeyboardManagerResult, UseFieldStateOptions, } from './hooks';
13
+ export { useValidation, runRules, isValidEmail, isValidNumber, isValidPhone, requiredValidator, emailValidator, numberValidator, phoneValidator, minLengthValidator, maxLengthValidator, patternValidator, } from './validation';
14
+ export type { UseValidationResult } from './validation';
15
+ export { FieldFlowIcon } from './icons';
16
+ export type { FieldFlowIconName, FieldFlowIconProps } from './icons';
17
+ export type { FieldFlowFieldType, FieldFlowState, FieldFlowRules, ValidationResult, Validator, FieldFlowColors, FieldFlowSpacing, FieldFlowTypography, FieldFlowAnimationConfig, FieldFlowTheme, DeepPartial, } from './types';
18
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAC7D,YAAY,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAC;AAEvE,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AACjE,YAAY,EAAE,qBAAqB,EAAE,MAAM,+BAA+B,CAAC;AAE3E,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACnD,YAAY,EAAE,cAAc,EAAE,oBAAoB,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAErG,OAAO,EAAE,wBAAwB,EAAE,MAAM,uCAAuC,CAAC;AACjF,YAAY,EAAE,6BAA6B,EAAE,MAAM,uCAAuC,CAAC;AAG3F,OAAO,EAAE,sBAAsB,EAAE,iBAAiB,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAC7F,YAAY,EAAE,2BAA2B,EAAE,MAAM,SAAS,CAAC;AAG3D,OAAO,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAC9E,YAAY,EACV,uBAAuB,EACvB,sBAAsB,EACtB,kBAAkB,EAClB,yBAAyB,EACzB,wBAAwB,EACxB,oBAAoB,GACrB,MAAM,SAAS,CAAC;AAGjB,OAAO,EACL,aAAa,EACb,QAAQ,EACR,YAAY,EACZ,aAAa,EACb,YAAY,EACZ,iBAAiB,EACjB,cAAc,EACd,eAAe,EACf,cAAc,EACd,kBAAkB,EAClB,kBAAkB,EAClB,gBAAgB,GACjB,MAAM,cAAc,CAAC;AACtB,YAAY,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AAGxD,OAAO,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AACxC,YAAY,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAGrE,YAAY,EACV,kBAAkB,EAClB,cAAc,EACd,cAAc,EACd,gBAAgB,EAChB,SAAS,EACT,eAAe,EACf,gBAAgB,EAChB,mBAAmB,EACnB,wBAAwB,EACxB,cAAc,EACd,WAAW,GACZ,MAAM,SAAS,CAAC"}
@@ -0,0 +1,16 @@
1
+ import React from 'react';
2
+ import type { DeepPartial, FieldFlowTheme } from '../types';
3
+ declare function mergeDeep<T extends Record<string, any>>(base: T, override?: DeepPartial<T>): T;
4
+ export interface FieldFlowThemeProviderProps {
5
+ theme?: DeepPartial<FieldFlowTheme>;
6
+ children: React.ReactNode;
7
+ }
8
+ /**
9
+ * Wrap your app (or a screen/form) in this provider to apply a custom theme.
10
+ * Any field not covered by your overrides falls back to FieldFlow's defaults,
11
+ * so you only need to specify what you want to change.
12
+ */
13
+ export declare function FieldFlowThemeProvider({ theme, children }: FieldFlowThemeProviderProps): React.JSX.Element;
14
+ export declare function useFieldFlowTheme(): FieldFlowTheme;
15
+ export { mergeDeep };
16
+ //# sourceMappingURL=ThemeProvider.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ThemeProvider.d.ts","sourceRoot":"","sources":["../../../src/theme/ThemeProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA6C,MAAM,OAAO,CAAC;AAClE,OAAO,KAAK,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAK5D,iBAAS,SAAS,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,QAAQ,CAAC,EAAE,WAAW,CAAC,CAAC,CAAC,GAAG,CAAC,CAmBvF;AAED,MAAM,WAAW,2BAA2B;IAC1C,KAAK,CAAC,EAAE,WAAW,CAAC,cAAc,CAAC,CAAC;IACpC,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B;AAED;;;;GAIG;AACH,wBAAgB,sBAAsB,CAAC,EAAE,KAAK,EAAE,QAAQ,EAAE,EAAE,2BAA2B,qBAKtF;AAED,wBAAgB,iBAAiB,IAAI,cAAc,CAElD;AAED,OAAO,EAAE,SAAS,EAAE,CAAC"}
@@ -0,0 +1,4 @@
1
+ import type { FieldFlowTheme } from '../types';
2
+ export declare const defaultTheme: FieldFlowTheme;
3
+ export declare const darkTheme: FieldFlowTheme;
4
+ //# sourceMappingURL=defaultTheme.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"defaultTheme.d.ts","sourceRoot":"","sources":["../../../src/theme/defaultTheme.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAE/C,eAAO,MAAM,YAAY,EAAE,cAmC1B,CAAC;AAEF,eAAO,MAAM,SAAS,EAAE,cAkBvB,CAAC"}
@@ -0,0 +1,4 @@
1
+ export { defaultTheme, darkTheme } from './defaultTheme';
2
+ export { FieldFlowThemeProvider, useFieldFlowTheme, mergeDeep } from './ThemeProvider';
3
+ export type { FieldFlowThemeProviderProps } from './ThemeProvider';
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/theme/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AACzD,OAAO,EAAE,sBAAsB,EAAE,iBAAiB,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AACvF,YAAY,EAAE,2BAA2B,EAAE,MAAM,iBAAiB,CAAC"}
@@ -0,0 +1,79 @@
1
+ import type { KeyboardTypeOptions, TextInputProps, TextStyle } from 'react-native';
2
+ /** Every field "flavor" the core input understands out of the box. */
3
+ export type FieldFlowFieldType = 'text' | 'email' | 'number' | 'decimal' | 'phone' | 'password' | 'search' | 'multiline' | 'description' | 'chat';
4
+ export type FieldFlowState = 'idle' | 'focused' | 'error' | 'success' | 'disabled' | 'readonly' | 'loading';
5
+ export interface ValidationResult {
6
+ valid: boolean;
7
+ message?: string;
8
+ }
9
+ export type Validator = (value: string) => ValidationResult;
10
+ export interface FieldFlowRules {
11
+ required?: boolean | string;
12
+ minLength?: number | {
13
+ value: number;
14
+ message?: string;
15
+ };
16
+ maxLength?: number | {
17
+ value: number;
18
+ message?: string;
19
+ };
20
+ pattern?: RegExp | {
21
+ value: RegExp;
22
+ message?: string;
23
+ };
24
+ email?: boolean | string;
25
+ number?: boolean | string;
26
+ custom?: Validator | Validator[];
27
+ }
28
+ export interface FieldFlowColors {
29
+ background: string;
30
+ backgroundDisabled: string;
31
+ border: string;
32
+ borderFocused: string;
33
+ borderError: string;
34
+ borderSuccess: string;
35
+ text: string;
36
+ placeholder: string;
37
+ label: string;
38
+ labelFocused: string;
39
+ error: string;
40
+ success: string;
41
+ icon: string;
42
+ iconFocused: string;
43
+ }
44
+ export interface FieldFlowSpacing {
45
+ paddingHorizontal: number;
46
+ paddingVertical: number;
47
+ gap: number;
48
+ borderRadius: number;
49
+ borderWidth: number;
50
+ borderWidthFocused: number;
51
+ }
52
+ export interface FieldFlowTypography {
53
+ fontSize: number;
54
+ labelFontSize: number;
55
+ helperFontSize: number;
56
+ fontFamily?: string;
57
+ fontWeight: TextStyle['fontWeight'];
58
+ }
59
+ export interface FieldFlowAnimationConfig {
60
+ duration: number;
61
+ useNativeDriver: boolean;
62
+ }
63
+ export interface FieldFlowTheme {
64
+ colors: FieldFlowColors;
65
+ spacing: FieldFlowSpacing;
66
+ typography: FieldFlowTypography;
67
+ animation: FieldFlowAnimationConfig;
68
+ }
69
+ export type DeepPartial<T> = {
70
+ [P in keyof T]?: T[P] extends object ? DeepPartial<T[P]> : T[P];
71
+ };
72
+ export interface FieldFlowFieldConfigByType {
73
+ keyboardType: KeyboardTypeOptions;
74
+ secureTextEntry: boolean;
75
+ autoCapitalize: TextInputProps['autoCapitalize'];
76
+ autoCorrect: boolean;
77
+ multiline: boolean;
78
+ }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MAAM,GAAG,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;CAChE,CAAC;AAEF,MAAM,WAAW,0BAA0B;IACzC,YAAY,EAAE,mBAAmB,CAAC;IAClC,eAAe,EAAE,OAAO,CAAC;IACzB,cAAc,EAAE,cAAc,CAAC,gBAAgB,CAAC,CAAC;IACjD,WAAW,EAAE,OAAO,CAAC;IACrB,SAAS,EAAE,OAAO,CAAC;CACpB"}
@@ -0,0 +1,5 @@
1
+ /** Strips everything except digits, a single leading "+", and "." for decimals. */
2
+ export declare function sanitizeNumeric(value: string, allowDecimal?: boolean): string;
3
+ export declare function sanitizePhone(value: string): string;
4
+ export declare function truncate(value: string, maxLength?: number): string;
5
+ //# sourceMappingURL=formatters.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"formatters.d.ts","sourceRoot":"","sources":["../../../src/utils/formatters.ts"],"names":[],"mappings":"AAAA,mFAAmF;AACnF,wBAAgB,eAAe,CAAC,KAAK,EAAE,MAAM,EAAE,YAAY,UAAQ,GAAG,MAAM,CAO3E;AAED,wBAAgB,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAEnD;AAED,wBAAgB,QAAQ,CAAC,KAAK,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,MAAM,GAAG,MAAM,CAGlE"}
@@ -0,0 +1,18 @@
1
+ import type { FieldFlowFieldConfigByType, FieldFlowFieldType } from '../types';
2
+ /**
3
+ * Central place that decides "if fieldType is X, the input should behave like Y".
4
+ * This is what powers the "just set type='email' and everything is handled" behavior.
5
+ */
6
+ export declare function resolveFieldConfig(type: FieldFlowFieldType): FieldFlowFieldConfigByType;
7
+ /** Returns sensible default validation rules implied purely by the field type (before user overrides). */
8
+ export declare function implicitRulesForType(type: FieldFlowFieldType): {
9
+ email: true;
10
+ number?: undefined;
11
+ } | {
12
+ number: true;
13
+ email?: undefined;
14
+ } | {
15
+ email?: undefined;
16
+ number?: undefined;
17
+ };
18
+ //# sourceMappingURL=keyboardTypes.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"keyboardTypes.d.ts","sourceRoot":"","sources":["../../../src/utils/keyboardTypes.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,0BAA0B,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AAE/E;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,kBAAkB,GAAG,0BAA0B,CAsEvF;AAED,0GAA0G;AAC1G,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,kBAAkB;;;;;;;;;EAI5D"}
@@ -0,0 +1,4 @@
1
+ export { isValidEmail, isValidNumber, isValidPhone, requiredValidator, emailValidator, numberValidator, phoneValidator, minLengthValidator, maxLengthValidator, patternValidator, runRules, } from './validators';
2
+ export { useValidation } from './useValidation';
3
+ export type { UseValidationResult } from './useValidation';
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/validation/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,YAAY,EACZ,aAAa,EACb,YAAY,EACZ,iBAAiB,EACjB,cAAc,EACd,eAAe,EACf,cAAc,EACd,kBAAkB,EAClB,kBAAkB,EAClB,gBAAgB,EAChB,QAAQ,GACT,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,YAAY,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC"}
@@ -0,0 +1,14 @@
1
+ import type { FieldFlowRules } from '../types';
2
+ export interface UseValidationResult {
3
+ error: string | null;
4
+ touched: boolean;
5
+ validate: (value: string) => boolean;
6
+ markTouched: () => void;
7
+ reset: () => void;
8
+ }
9
+ /**
10
+ * Lightweight per-field validation hook for use outside of `useFieldFlowForm`,
11
+ * e.g. when a single input is validated on its own.
12
+ */
13
+ export declare function useValidation(rules?: FieldFlowRules): UseValidationResult;
14
+ //# sourceMappingURL=useValidation.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useValidation.d.ts","sourceRoot":"","sources":["../../../src/validation/useValidation.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAG/C,MAAM,WAAW,mBAAmB;IAClC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,OAAO,EAAE,OAAO,CAAC;IACjB,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,OAAO,CAAC;IACrC,WAAW,EAAE,MAAM,IAAI,CAAC;IACxB,KAAK,EAAE,MAAM,IAAI,CAAC;CACnB;AAED;;;GAGG;AACH,wBAAgB,aAAa,CAAC,KAAK,CAAC,EAAE,cAAc,GAAG,mBAAmB,CAoBzE"}
@@ -0,0 +1,17 @@
1
+ import type { FieldFlowRules, ValidationResult, Validator } from '../types';
2
+ export declare const isValidEmail: (value: string) => boolean;
3
+ export declare const isValidNumber: (value: string) => boolean;
4
+ export declare const isValidPhone: (value: string) => boolean;
5
+ export declare const requiredValidator: (message?: string) => Validator;
6
+ export declare const emailValidator: (message?: string) => Validator;
7
+ export declare const numberValidator: (message?: string) => Validator;
8
+ export declare const phoneValidator: (message?: string) => Validator;
9
+ export declare const minLengthValidator: (min: number, message?: string) => Validator;
10
+ export declare const maxLengthValidator: (max: number, message?: string) => Validator;
11
+ export declare const patternValidator: (pattern: RegExp, message?: string) => Validator;
12
+ /**
13
+ * Turns a declarative `FieldFlowRules` object into an ordered list of validators
14
+ * and runs them against a value, stopping at (and returning) the first failure.
15
+ */
16
+ export declare function runRules(value: string, rules?: FieldFlowRules): ValidationResult;
17
+ //# sourceMappingURL=validators.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validators.d.ts","sourceRoot":"","sources":["../../../src/validation/validators.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,gBAAgB,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAM5E,eAAO,MAAM,YAAY,GAAI,OAAO,MAAM,KAAG,OAAyC,CAAC;AACvF,eAAO,MAAM,aAAa,GAAI,OAAO,MAAM,KAAG,OAA0C,CAAC;AACzF,eAAO,MAAM,YAAY,GAAI,OAAO,MAAM,KAAG,OAAyC,CAAC;AAEvF,eAAO,MAAM,iBAAiB,GAC3B,gBAAkC,KAAG,SAIP,CAAC;AAElC,eAAO,MAAM,cAAc,GACxB,gBAAuC,KAAG,SAE8C,CAAC;AAE5F,eAAO,MAAM,eAAe,GACzB,gBAAgC,KAAG,SAEsD,CAAC;AAE7F,eAAO,MAAM,cAAc,GACxB,gBAAsC,KAAG,SAE+C,CAAC;AAE5F,eAAO,MAAM,kBAAkB,GAC5B,KAAK,MAAM,EAAE,UAAU,MAAM,KAAG,SAI+C,CAAC;AAEnF,eAAO,MAAM,kBAAkB,GAC5B,KAAK,MAAM,EAAE,UAAU,MAAM,KAAG,SAEkF,CAAC;AAEtH,eAAO,MAAM,gBAAgB,GAC1B,SAAS,MAAM,EAAE,gBAA0B,KAAG,SAE0C,CAAC;AAE5F;;;GAGG;AACH,wBAAgB,QAAQ,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,cAAc,GAAG,gBAAgB,CAuChF"}
package/package.json ADDED
@@ -0,0 +1,80 @@
1
+ {
2
+ "name": "rn-inputforge",
3
+ "version": "0.1.0",
4
+ "description": "A production-ready, highly customizable input field system for React Native (bare CLI) — text/email/number/phone/password/search fields, description fields, chat input, built-in validation, theming, icons, and keyboard-aware form navigation.",
5
+ "main": "lib/commonjs/index.js",
6
+ "module": "lib/module/index.js",
7
+ "types": "lib/typescript/index.d.ts",
8
+ "react-native": "src/index.ts",
9
+ "source": "src/index.ts",
10
+ "files": [
11
+ "src",
12
+ "lib",
13
+ "android",
14
+ "ios",
15
+ "rn-inputforge.podspec",
16
+ "!lib/typescript/example",
17
+ "!android/build",
18
+ "!ios/build",
19
+ "!**/__tests__",
20
+ "!**/*.test.*"
21
+ ],
22
+ "scripts": {
23
+ "build": "bob build",
24
+ "prepare": "bob build",
25
+ "typecheck": "tsc --noEmit -p tsconfig.build.json",
26
+ "lint": "eslint \"src/**/*.{ts,tsx}\"",
27
+ "clean": "rimraf lib"
28
+ },
29
+ "keywords": [
30
+ "react-native",
31
+ "input",
32
+ "textinput",
33
+ "form",
34
+ "form-builder",
35
+ "chat-input",
36
+ "keyboard-aware",
37
+ "validation",
38
+ "typescript",
39
+ "bare-react-native-cli"
40
+ ],
41
+ "author": "Saad Waheed Khan",
42
+ "license": "MIT",
43
+ "peerDependencies": {
44
+ "react": ">=18.0.0",
45
+ "react-native": ">=0.73.0"
46
+ },
47
+ "devDependencies": {
48
+ "@react-native/eslint-config": "^0.81.0",
49
+ "@types/react": "^19.2.0",
50
+ "eslint": "^9.19.0",
51
+ "prettier": "^3.4.2",
52
+ "react": "19.2.8",
53
+ "react-native": "0.86.2",
54
+ "react-native-builder-bob": "^0.41.0",
55
+ "rimraf": "^6.0.1",
56
+ "typescript": "^5.7.3"
57
+ },
58
+ "engines": {
59
+ "node": ">=16"
60
+ },
61
+ "packageManager": "yarn@3.6.4",
62
+ "publishConfig": {
63
+ "registry": "https://registry.npmjs.org/",
64
+ "access": "public"
65
+ },
66
+ "react-native-builder-bob": {
67
+ "source": "src",
68
+ "output": "lib",
69
+ "targets": [
70
+ "commonjs",
71
+ "module",
72
+ [
73
+ "typescript",
74
+ {
75
+ "project": "tsconfig.build.json"
76
+ }
77
+ ]
78
+ ]
79
+ }
80
+ }