@webority-technologies/mobile 0.0.22 → 0.0.24

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 (249) hide show
  1. package/lib/commonjs/components/Accordion/Accordion.js +9 -7
  2. package/lib/commonjs/components/AnimatePresence/AnimatePresence.js +69 -0
  3. package/lib/commonjs/components/AnimatePresence/index.js +13 -0
  4. package/lib/commonjs/components/AppBar/AppBar.js +9 -6
  5. package/lib/commonjs/components/Avatar/Avatar.js +4 -2
  6. package/lib/commonjs/components/Badge/Badge.js +5 -5
  7. package/lib/commonjs/components/Banner/Banner.js +20 -6
  8. package/lib/commonjs/components/BottomNavigation/BottomNavigation.js +6 -4
  9. package/lib/commonjs/components/BottomSheet/BottomSheet.js +8 -9
  10. package/lib/commonjs/components/Box/Box.js +162 -0
  11. package/lib/commonjs/components/Box/index.js +37 -0
  12. package/lib/commonjs/components/Button/Button.js +7 -7
  13. package/lib/commonjs/components/Card/Card.js +3 -3
  14. package/lib/commonjs/components/Carousel/Carousel.js +4 -2
  15. package/lib/commonjs/components/Checkbox/Checkbox.js +17 -7
  16. package/lib/commonjs/components/Chip/Chip.js +4 -2
  17. package/lib/commonjs/components/DatePicker/DatePicker.js +31 -24
  18. package/lib/commonjs/components/DateRangePicker/DateRangePicker.js +16 -11
  19. package/lib/commonjs/components/Dialog/Dialog.js +6 -4
  20. package/lib/commonjs/components/Drawer/Drawer.js +4 -2
  21. package/lib/commonjs/components/FieldBase/FieldBase.js +8 -4
  22. package/lib/commonjs/components/FloatingActionButton/FloatingActionButton.js +23 -13
  23. package/lib/commonjs/components/FormField/FormField.js +61 -25
  24. package/lib/commonjs/components/ImageGallery/ImageGallery.js +17 -15
  25. package/lib/commonjs/components/Input/Input.js +41 -29
  26. package/lib/commonjs/components/KeyboardAwareScrollView/KeyboardAwareScrollView.js +102 -0
  27. package/lib/commonjs/components/KeyboardAwareScrollView/index.js +13 -0
  28. package/lib/commonjs/components/KeyboardToolbar/KeyboardToolbar.js +130 -0
  29. package/lib/commonjs/components/KeyboardToolbar/index.js +13 -0
  30. package/lib/commonjs/components/ListItem/ListItem.js +4 -3
  31. package/lib/commonjs/components/Modal/Modal.js +21 -9
  32. package/lib/commonjs/components/NumberInput/NumberInput.js +38 -29
  33. package/lib/commonjs/components/OTPInput/OTPInput.js +37 -22
  34. package/lib/commonjs/components/Radio/Radio.js +9 -8
  35. package/lib/commonjs/components/Radio/RadioGroup.js +10 -3
  36. package/lib/commonjs/components/Rating/Rating.js +4 -3
  37. package/lib/commonjs/components/SearchBar/SearchBar.js +11 -6
  38. package/lib/commonjs/components/SegmentedControl/SegmentedControl.js +23 -12
  39. package/lib/commonjs/components/Select/Select.js +40 -36
  40. package/lib/commonjs/components/Skeleton/SkeletonContent.js +5 -2
  41. package/lib/commonjs/components/Slider/Slider.js +241 -225
  42. package/lib/commonjs/components/Spinner/Spinner.js +5 -5
  43. package/lib/commonjs/components/Stepper/Stepper.js +6 -5
  44. package/lib/commonjs/components/Swipeable/Swipeable.js +8 -9
  45. package/lib/commonjs/components/Switch/Switch.js +29 -16
  46. package/lib/commonjs/components/Tabs/Tabs.js +8 -5
  47. package/lib/commonjs/components/Text/Text.js +142 -0
  48. package/lib/commonjs/components/Text/index.js +13 -0
  49. package/lib/commonjs/components/TimePicker/TimePicker.js +23 -15
  50. package/lib/commonjs/components/Toast/Toast.js +22 -10
  51. package/lib/commonjs/components/Tooltip/Tooltip.js +6 -2
  52. package/lib/commonjs/components/index.js +156 -103
  53. package/lib/commonjs/form/FormContext.js +40 -0
  54. package/lib/commonjs/form/index.js +68 -0
  55. package/lib/commonjs/form/path.js +79 -0
  56. package/lib/commonjs/form/rules.js +67 -0
  57. package/lib/commonjs/form/types.js +2 -0
  58. package/lib/commonjs/form/useField.js +54 -0
  59. package/lib/commonjs/form/useForm.js +316 -0
  60. package/lib/commonjs/hooks/index.js +14 -0
  61. package/lib/commonjs/hooks/useControllableState.js +30 -0
  62. package/lib/commonjs/hooks/useReducedMotion.js +31 -0
  63. package/lib/commonjs/index.js +96 -11
  64. package/lib/commonjs/theme/ThemeContext.js +30 -2
  65. package/lib/commonjs/theme/tokens.js +12 -0
  66. package/lib/commonjs/utils/hapticUtils.js +11 -1
  67. package/lib/commonjs/utils/index.js +6 -0
  68. package/lib/module/components/Accordion/Accordion.js +10 -8
  69. package/lib/module/components/AnimatePresence/AnimatePresence.js +63 -0
  70. package/lib/module/components/AnimatePresence/index.js +4 -0
  71. package/lib/module/components/AppBar/AppBar.js +10 -7
  72. package/lib/module/components/Avatar/Avatar.js +4 -2
  73. package/lib/module/components/Badge/Badge.js +5 -5
  74. package/lib/module/components/Banner/Banner.js +20 -6
  75. package/lib/module/components/BottomNavigation/BottomNavigation.js +6 -4
  76. package/lib/module/components/BottomSheet/BottomSheet.js +8 -9
  77. package/lib/module/components/Box/Box.js +156 -0
  78. package/lib/module/components/Box/index.js +4 -0
  79. package/lib/module/components/Button/Button.js +7 -7
  80. package/lib/module/components/Card/Card.js +4 -4
  81. package/lib/module/components/Carousel/Carousel.js +4 -2
  82. package/lib/module/components/Checkbox/Checkbox.js +18 -8
  83. package/lib/module/components/Chip/Chip.js +5 -3
  84. package/lib/module/components/DatePicker/DatePicker.js +32 -25
  85. package/lib/module/components/DateRangePicker/DateRangePicker.js +17 -12
  86. package/lib/module/components/Dialog/Dialog.js +7 -5
  87. package/lib/module/components/Drawer/Drawer.js +5 -3
  88. package/lib/module/components/FieldBase/FieldBase.js +8 -4
  89. package/lib/module/components/FloatingActionButton/FloatingActionButton.js +24 -14
  90. package/lib/module/components/FormField/FormField.js +62 -26
  91. package/lib/module/components/ImageGallery/ImageGallery.js +18 -16
  92. package/lib/module/components/Input/Input.js +41 -29
  93. package/lib/module/components/KeyboardAwareScrollView/KeyboardAwareScrollView.js +98 -0
  94. package/lib/module/components/KeyboardAwareScrollView/index.js +4 -0
  95. package/lib/module/components/KeyboardToolbar/KeyboardToolbar.js +125 -0
  96. package/lib/module/components/KeyboardToolbar/index.js +4 -0
  97. package/lib/module/components/ListItem/ListItem.js +5 -4
  98. package/lib/module/components/Modal/Modal.js +22 -10
  99. package/lib/module/components/NumberInput/NumberInput.js +36 -27
  100. package/lib/module/components/OTPInput/OTPInput.js +37 -22
  101. package/lib/module/components/Radio/Radio.js +10 -9
  102. package/lib/module/components/Radio/RadioGroup.js +10 -3
  103. package/lib/module/components/Rating/Rating.js +5 -4
  104. package/lib/module/components/SearchBar/SearchBar.js +12 -7
  105. package/lib/module/components/SegmentedControl/SegmentedControl.js +24 -13
  106. package/lib/module/components/Select/Select.js +41 -37
  107. package/lib/module/components/Skeleton/SkeletonContent.js +5 -2
  108. package/lib/module/components/Slider/Slider.js +244 -228
  109. package/lib/module/components/Spinner/Spinner.js +5 -5
  110. package/lib/module/components/Stepper/Stepper.js +7 -6
  111. package/lib/module/components/Swipeable/Swipeable.js +9 -10
  112. package/lib/module/components/Switch/Switch.js +29 -16
  113. package/lib/module/components/Tabs/Tabs.js +9 -6
  114. package/lib/module/components/Text/Text.js +138 -0
  115. package/lib/module/components/Text/index.js +4 -0
  116. package/lib/module/components/TimePicker/TimePicker.js +24 -16
  117. package/lib/module/components/Toast/Toast.js +22 -10
  118. package/lib/module/components/Tooltip/Tooltip.js +6 -2
  119. package/lib/module/components/index.js +5 -0
  120. package/lib/module/form/FormContext.js +32 -0
  121. package/lib/module/form/index.js +12 -0
  122. package/lib/module/form/path.js +72 -0
  123. package/lib/module/form/rules.js +52 -0
  124. package/lib/module/form/types.js +2 -0
  125. package/lib/module/form/useField.js +49 -0
  126. package/lib/module/form/useForm.js +312 -0
  127. package/lib/module/hooks/index.js +2 -0
  128. package/lib/module/hooks/useControllableState.js +26 -0
  129. package/lib/module/hooks/useReducedMotion.js +27 -0
  130. package/lib/module/index.js +3 -1
  131. package/lib/module/theme/ThemeContext.js +30 -2
  132. package/lib/module/theme/tokens.js +12 -0
  133. package/lib/module/utils/hapticUtils.js +9 -0
  134. package/lib/module/utils/index.js +1 -1
  135. package/lib/typescript/commonjs/components/Accordion/Accordion.d.ts +3 -0
  136. package/lib/typescript/commonjs/components/AnimatePresence/AnimatePresence.d.ts +30 -0
  137. package/lib/typescript/commonjs/components/AnimatePresence/index.d.ts +3 -0
  138. package/lib/typescript/commonjs/components/AppBar/AppBar.d.ts +6 -0
  139. package/lib/typescript/commonjs/components/Banner/Banner.d.ts +3 -0
  140. package/lib/typescript/commonjs/components/BottomNavigation/BottomNavigation.d.ts +1 -1
  141. package/lib/typescript/commonjs/components/Box/Box.d.ts +60 -0
  142. package/lib/typescript/commonjs/components/Box/index.d.ts +3 -0
  143. package/lib/typescript/commonjs/components/Button/Button.d.ts +1 -1
  144. package/lib/typescript/commonjs/components/Card/Card.d.ts +3 -0
  145. package/lib/typescript/commonjs/components/Checkbox/Checkbox.d.ts +4 -2
  146. package/lib/typescript/commonjs/components/Chip/Chip.d.ts +3 -0
  147. package/lib/typescript/commonjs/components/DatePicker/DatePicker.d.ts +6 -3
  148. package/lib/typescript/commonjs/components/DateRangePicker/DateRangePicker.d.ts +6 -0
  149. package/lib/typescript/commonjs/components/Dialog/Dialog.d.ts +5 -2
  150. package/lib/typescript/commonjs/components/Drawer/Drawer.d.ts +3 -0
  151. package/lib/typescript/commonjs/components/FloatingActionButton/FloatingActionButton.d.ts +5 -0
  152. package/lib/typescript/commonjs/components/FormField/FormField.d.ts +13 -2
  153. package/lib/typescript/commonjs/components/ImageGallery/ImageGallery.d.ts +6 -0
  154. package/lib/typescript/commonjs/components/KeyboardAwareScrollView/KeyboardAwareScrollView.d.ts +20 -0
  155. package/lib/typescript/commonjs/components/KeyboardAwareScrollView/index.d.ts +3 -0
  156. package/lib/typescript/commonjs/components/KeyboardToolbar/KeyboardToolbar.d.ts +29 -0
  157. package/lib/typescript/commonjs/components/KeyboardToolbar/index.d.ts +3 -0
  158. package/lib/typescript/commonjs/components/ListItem/ListItem.d.ts +3 -0
  159. package/lib/typescript/commonjs/components/Modal/Modal.d.ts +6 -0
  160. package/lib/typescript/commonjs/components/NumberInput/NumberInput.d.ts +6 -2
  161. package/lib/typescript/commonjs/components/OTPInput/OTPInput.d.ts +9 -2
  162. package/lib/typescript/commonjs/components/Radio/Radio.d.ts +2 -2
  163. package/lib/typescript/commonjs/components/Radio/RadioGroup.d.ts +3 -2
  164. package/lib/typescript/commonjs/components/Rating/Rating.d.ts +6 -0
  165. package/lib/typescript/commonjs/components/SearchBar/SearchBar.d.ts +3 -0
  166. package/lib/typescript/commonjs/components/SegmentedControl/SegmentedControl.d.ts +6 -2
  167. package/lib/typescript/commonjs/components/Select/Select.d.ts +6 -0
  168. package/lib/typescript/commonjs/components/Slider/Slider.d.ts +9 -4
  169. package/lib/typescript/commonjs/components/Spinner/Spinner.d.ts +1 -1
  170. package/lib/typescript/commonjs/components/Stepper/Stepper.d.ts +6 -0
  171. package/lib/typescript/commonjs/components/Swipeable/Swipeable.d.ts +3 -0
  172. package/lib/typescript/commonjs/components/Switch/Switch.d.ts +3 -2
  173. package/lib/typescript/commonjs/components/Tabs/Tabs.d.ts +3 -0
  174. package/lib/typescript/commonjs/components/Text/Text.d.ts +25 -0
  175. package/lib/typescript/commonjs/components/Text/index.d.ts +3 -0
  176. package/lib/typescript/commonjs/components/TimePicker/TimePicker.d.ts +6 -3
  177. package/lib/typescript/commonjs/components/index.d.ts +10 -0
  178. package/lib/typescript/commonjs/form/FormContext.d.ts +17 -0
  179. package/lib/typescript/commonjs/form/index.d.ts +9 -0
  180. package/lib/typescript/commonjs/form/path.d.ts +10 -0
  181. package/lib/typescript/commonjs/form/rules.d.ts +31 -0
  182. package/lib/typescript/commonjs/form/types.d.ts +94 -0
  183. package/lib/typescript/commonjs/form/useField.d.ts +27 -0
  184. package/lib/typescript/commonjs/form/useForm.d.ts +10 -0
  185. package/lib/typescript/commonjs/hooks/index.d.ts +3 -0
  186. package/lib/typescript/commonjs/hooks/useControllableState.d.ts +17 -0
  187. package/lib/typescript/commonjs/hooks/useReducedMotion.d.ts +8 -0
  188. package/lib/typescript/commonjs/index.d.ts +4 -2
  189. package/lib/typescript/commonjs/theme/types.d.ts +17 -67
  190. package/lib/typescript/commonjs/utils/hapticUtils.d.ts +8 -0
  191. package/lib/typescript/commonjs/utils/index.d.ts +1 -1
  192. package/lib/typescript/module/components/Accordion/Accordion.d.ts +3 -0
  193. package/lib/typescript/module/components/AnimatePresence/AnimatePresence.d.ts +30 -0
  194. package/lib/typescript/module/components/AnimatePresence/index.d.ts +3 -0
  195. package/lib/typescript/module/components/AppBar/AppBar.d.ts +6 -0
  196. package/lib/typescript/module/components/Banner/Banner.d.ts +3 -0
  197. package/lib/typescript/module/components/BottomNavigation/BottomNavigation.d.ts +1 -1
  198. package/lib/typescript/module/components/Box/Box.d.ts +60 -0
  199. package/lib/typescript/module/components/Box/index.d.ts +3 -0
  200. package/lib/typescript/module/components/Button/Button.d.ts +1 -1
  201. package/lib/typescript/module/components/Card/Card.d.ts +3 -0
  202. package/lib/typescript/module/components/Checkbox/Checkbox.d.ts +4 -2
  203. package/lib/typescript/module/components/Chip/Chip.d.ts +3 -0
  204. package/lib/typescript/module/components/DatePicker/DatePicker.d.ts +6 -3
  205. package/lib/typescript/module/components/DateRangePicker/DateRangePicker.d.ts +6 -0
  206. package/lib/typescript/module/components/Dialog/Dialog.d.ts +5 -2
  207. package/lib/typescript/module/components/Drawer/Drawer.d.ts +3 -0
  208. package/lib/typescript/module/components/FloatingActionButton/FloatingActionButton.d.ts +5 -0
  209. package/lib/typescript/module/components/FormField/FormField.d.ts +13 -2
  210. package/lib/typescript/module/components/ImageGallery/ImageGallery.d.ts +6 -0
  211. package/lib/typescript/module/components/KeyboardAwareScrollView/KeyboardAwareScrollView.d.ts +20 -0
  212. package/lib/typescript/module/components/KeyboardAwareScrollView/index.d.ts +3 -0
  213. package/lib/typescript/module/components/KeyboardToolbar/KeyboardToolbar.d.ts +29 -0
  214. package/lib/typescript/module/components/KeyboardToolbar/index.d.ts +3 -0
  215. package/lib/typescript/module/components/ListItem/ListItem.d.ts +3 -0
  216. package/lib/typescript/module/components/Modal/Modal.d.ts +6 -0
  217. package/lib/typescript/module/components/NumberInput/NumberInput.d.ts +6 -2
  218. package/lib/typescript/module/components/OTPInput/OTPInput.d.ts +9 -2
  219. package/lib/typescript/module/components/Radio/Radio.d.ts +2 -2
  220. package/lib/typescript/module/components/Radio/RadioGroup.d.ts +3 -2
  221. package/lib/typescript/module/components/Rating/Rating.d.ts +6 -0
  222. package/lib/typescript/module/components/SearchBar/SearchBar.d.ts +3 -0
  223. package/lib/typescript/module/components/SegmentedControl/SegmentedControl.d.ts +6 -2
  224. package/lib/typescript/module/components/Select/Select.d.ts +6 -0
  225. package/lib/typescript/module/components/Slider/Slider.d.ts +9 -4
  226. package/lib/typescript/module/components/Spinner/Spinner.d.ts +1 -1
  227. package/lib/typescript/module/components/Stepper/Stepper.d.ts +6 -0
  228. package/lib/typescript/module/components/Swipeable/Swipeable.d.ts +3 -0
  229. package/lib/typescript/module/components/Switch/Switch.d.ts +3 -2
  230. package/lib/typescript/module/components/Tabs/Tabs.d.ts +3 -0
  231. package/lib/typescript/module/components/Text/Text.d.ts +25 -0
  232. package/lib/typescript/module/components/Text/index.d.ts +3 -0
  233. package/lib/typescript/module/components/TimePicker/TimePicker.d.ts +6 -3
  234. package/lib/typescript/module/components/index.d.ts +10 -0
  235. package/lib/typescript/module/form/FormContext.d.ts +17 -0
  236. package/lib/typescript/module/form/index.d.ts +9 -0
  237. package/lib/typescript/module/form/path.d.ts +10 -0
  238. package/lib/typescript/module/form/rules.d.ts +31 -0
  239. package/lib/typescript/module/form/types.d.ts +94 -0
  240. package/lib/typescript/module/form/useField.d.ts +27 -0
  241. package/lib/typescript/module/form/useForm.d.ts +10 -0
  242. package/lib/typescript/module/hooks/index.d.ts +3 -0
  243. package/lib/typescript/module/hooks/useControllableState.d.ts +17 -0
  244. package/lib/typescript/module/hooks/useReducedMotion.d.ts +8 -0
  245. package/lib/typescript/module/index.d.ts +4 -2
  246. package/lib/typescript/module/theme/types.d.ts +17 -67
  247. package/lib/typescript/module/utils/hapticUtils.d.ts +8 -0
  248. package/lib/typescript/module/utils/index.d.ts +1 -1
  249. package/package.json +1 -1
@@ -0,0 +1,94 @@
1
+ export type FormValues = Record<string, unknown>;
2
+ export type FormErrors = Record<string, string | undefined>;
3
+ export type FormTouched = Record<string, boolean>;
4
+ export type ValidationResult = string | undefined | null | false;
5
+ /**
6
+ * A single validation rule. Receives the field value and the whole values
7
+ * object (so cross-field rules work). Return an error message string when
8
+ * invalid, or any falsy value when valid. May be async — return a Promise for
9
+ * server-side checks ("is this email already registered?").
10
+ */
11
+ export type ValidationRule<V = any, Values extends FormValues = FormValues> = (value: V, allValues: Values) => ValidationResult | Promise<ValidationResult>;
12
+ export type FieldRules<V = any, Values extends FormValues = FormValues> = ValidationRule<V, Values> | ValidationRule<V, Values>[];
13
+ /** Per-field rule map keyed by field path (e.g. `{ email: [rules.required(), rules.email()] }`). */
14
+ export type ValidationSchema<Values extends FormValues = FormValues> = Record<string, FieldRules<any, Values>>;
15
+ /** Form-level validate function returning an errors map keyed by field path. */
16
+ export type FormValidateFn<Values extends FormValues = FormValues> = (values: Values) => FormErrors | Promise<FormErrors>;
17
+ export type ValidateOn = 'change' | 'blur' | 'submit';
18
+ export interface SubmitHelpers<Values extends FormValues = FormValues> {
19
+ setErrors: (errors: FormErrors) => void;
20
+ setFieldError: (name: string, error?: string) => void;
21
+ reset: (nextValues?: Partial<Values>) => void;
22
+ setSubmitting: (submitting: boolean) => void;
23
+ }
24
+ export interface FormConfig<Values extends FormValues = FormValues> {
25
+ initialValues: Values;
26
+ /** Either a per-field rule map or a single form-level validate function. */
27
+ validate?: ValidationSchema<Values> | FormValidateFn<Values>;
28
+ /** When validation first runs for a field. Library default: 'submit'. */
29
+ validateOn?: ValidateOn;
30
+ /** After a field has surfaced an error once, how it re-validates. Library default: 'change'. */
31
+ revalidateOn?: 'change' | 'blur';
32
+ onSubmit: (values: Values, helpers: SubmitHelpers<Values>) => void | Promise<void>;
33
+ /** Re-initialise values when `initialValues` changes (e.g. async-loaded edit form). Default: false. */
34
+ enableReinitialize?: boolean;
35
+ }
36
+ export interface FieldState<V = unknown> {
37
+ value: V;
38
+ /** Error the UI should show (gated by touched / submit). */
39
+ error: string | undefined;
40
+ /** Error regardless of touched — useful for `isValid`-style logic. */
41
+ rawError: string | undefined;
42
+ touched: boolean;
43
+ dirty: boolean;
44
+ }
45
+ /** Props an input needs to bind to a form field. Covers text and non-text controls. */
46
+ export interface FieldInputProps<V = unknown> {
47
+ name: string;
48
+ value: V;
49
+ error: string | undefined;
50
+ touched: boolean;
51
+ /** Generic change handler (Select/Switch/DatePicker/Slider…). */
52
+ onChange: (value: V) => void;
53
+ /** Text-input alias of `onChange` (TextInput's `onChangeText`). */
54
+ onChangeText: (text: string) => void;
55
+ onBlur: () => void;
56
+ /** Marks this field as the focused one (drives KeyboardToolbar next/prev). */
57
+ onFocus: () => void;
58
+ setValue: (value: V, shouldValidate?: boolean) => void;
59
+ }
60
+ export interface FocusableNode {
61
+ focus?: () => void;
62
+ measureInWindow?: (cb: (x: number, y: number, w: number, h: number) => void) => void;
63
+ }
64
+ export interface FormApi<Values extends FormValues = FormValues> {
65
+ values: Values;
66
+ /** Touched/submit-gated errors — what the UI shows. */
67
+ errors: FormErrors;
68
+ /** Every current error regardless of touched. */
69
+ rawErrors: FormErrors;
70
+ touched: FormTouched;
71
+ dirty: boolean;
72
+ isValid: boolean;
73
+ isSubmitting: boolean;
74
+ isValidating: boolean;
75
+ submitCount: number;
76
+ setFieldValue: (name: string, value: unknown, shouldValidate?: boolean) => void;
77
+ setFieldTouched: (name: string, touched?: boolean, shouldValidate?: boolean) => void;
78
+ setFieldError: (name: string, error?: string) => void;
79
+ setValues: (next: Partial<Values> | ((prev: Values) => Values), shouldValidate?: boolean) => void;
80
+ setErrors: (errors: FormErrors) => void;
81
+ reset: (nextValues?: Partial<Values>) => void;
82
+ validate: () => Promise<FormErrors>;
83
+ validateField: (name: string) => Promise<string | undefined>;
84
+ submit: () => void;
85
+ getFieldState: (name: string) => FieldState;
86
+ getFieldProps: (name: string) => FieldInputProps;
87
+ handleBlur: (name: string) => void;
88
+ /** Move focus to the next / previous registered field (used by KeyboardToolbar). */
89
+ focusNext: () => void;
90
+ focusPrev: () => void;
91
+ /** Registers a focusable node so a failed submit can focus the first error. */
92
+ registerField: (name: string, node: FocusableNode | null) => void;
93
+ }
94
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1,27 @@
1
+ import type { FieldInputProps } from './types';
2
+ /**
3
+ * Bind a single field by name. Returns everything an input needs; pick the
4
+ * handler your control uses:
5
+ * const email = useField('email');
6
+ * <Input value={email.value} onChangeText={email.onChangeText} onBlur={email.onBlur} error={email.error} />
7
+ * <Select value={country.value} onChange={country.onChange} error={country.error} />
8
+ * <Switch value={!!agree.value} onChange={agree.onChange} />
9
+ */
10
+ export declare function useField<V = unknown>(name: string): FieldInputProps<V>;
11
+ export interface FieldArrayApi<T = unknown> {
12
+ /** Current array value (empty array when unset). */
13
+ fields: T[];
14
+ length: number;
15
+ push: (item: T) => void;
16
+ remove: (index: number) => void;
17
+ insert: (index: number, item: T) => void;
18
+ move: (from: number, to: number) => void;
19
+ replace: (index: number, item: T) => void;
20
+ }
21
+ /**
22
+ * Manage a repeating list field (phone numbers, line items, etc.) by name.
23
+ * Each helper writes the whole array back through the form so validation and
24
+ * dirty-tracking stay correct.
25
+ */
26
+ export declare function useFieldArray<T = unknown>(name: string): FieldArrayApi<T>;
27
+ //# sourceMappingURL=useField.d.ts.map
@@ -0,0 +1,10 @@
1
+ import type { FormApi, FormConfig, FormValues } from './types';
2
+ /**
3
+ * Dependency-free form engine. Tracks values/errors/touched/dirty, runs
4
+ * synchronous and async validation (per-field rule maps or a form-level
5
+ * function), gates error display behind touched/submit, and on a failed submit
6
+ * focuses the first errored field. The returned object is rebuilt every render
7
+ * so `<Form>` consumers re-render on state changes.
8
+ */
9
+ export declare function useForm<Values extends FormValues = FormValues>(config: FormConfig<Values>): FormApi<Values>;
10
+ //# sourceMappingURL=useForm.d.ts.map
@@ -3,4 +3,7 @@ export type { UseToggleResult } from './useToggle';
3
3
  export { useDebounce } from './useDebounce';
4
4
  export { usePressAnimation } from './usePressAnimation';
5
5
  export type { UsePressAnimationOptions, UsePressAnimationResult } from './usePressAnimation';
6
+ export { useReducedMotion } from './useReducedMotion';
7
+ export { useControllableState } from './useControllableState';
8
+ export type { UseControllableStateOptions } from './useControllableState';
6
9
  //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,17 @@
1
+ export interface UseControllableStateOptions<T> {
2
+ /** Controlled value. When `undefined`, the hook manages state internally. */
3
+ value?: T;
4
+ /** Initial value used in uncontrolled mode. */
5
+ defaultValue: T;
6
+ /** Called on every change (both modes). */
7
+ onChange?: (value: T) => void;
8
+ }
9
+ /**
10
+ * Bridges controlled and uncontrolled usage for a value+onChange pair. When
11
+ * `value` is provided the component is controlled (the hook just forwards it
12
+ * and calls `onChange`); otherwise the hook owns the state, seeded from
13
+ * `defaultValue`. The controlled/uncontrolled decision is locked on first
14
+ * render so a component never flips modes mid-life.
15
+ */
16
+ export declare function useControllableState<T>({ value, defaultValue, onChange }: UseControllableStateOptions<T>): [T, (next: T) => void];
17
+ //# sourceMappingURL=useControllableState.d.ts.map
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Tracks the OS "Reduce Motion" accessibility setting. The library's
3
+ * ThemeProvider uses this to collapse `theme.motion` (durations → 0, springs →
4
+ * near-instant) so animations don't trigger vestibular discomfort; consumers
5
+ * can also read it directly to swap an animated path for a static one.
6
+ */
7
+ export declare const useReducedMotion: () => boolean;
8
+ //# sourceMappingURL=useReducedMotion.d.ts.map
@@ -21,14 +21,16 @@ export { VersionCheck, useVersionCheck } from './versionCheck';
21
21
  export type { UpdateInfo, UpdateType, VersionData, VersionComparison, VersionCheckResult, VersionCheckType, ParsedVersion, Platform } from './versionCheck';
22
22
  export { ThemeProvider, useTheme, useThemeMode, setTheme, setColorMode, getColorMode, getTheme, resetTheme, subscribeTheme, mergeTheme, lightTheme, darkTheme } from './theme';
23
23
  export type { Theme, ThemeOverrides, ThemeProviderProps, IconRegistry, IconRenderer, ColorMode, ColorPalette, ColorSchemePreference, RadiusScale, ShadowDefinition, ShadowScale, SpacingScale, TypographyScale, MotionScale, DeepPartial } from './theme';
24
- export { useToggle, useDebounce, usePressAnimation } from './hooks';
25
- export type { UseToggleResult, UsePressAnimationOptions, UsePressAnimationResult } from './hooks';
24
+ export { useToggle, useDebounce, usePressAnimation, useReducedMotion, useControllableState } from './hooks';
25
+ export type { UseToggleResult, UsePressAnimationOptions, UsePressAnimationResult, UseControllableStateOptions } from './hooks';
26
26
  export { ScreenDimensions, Breakpoints, Responsive, isScreenSize, isTablet, Spacing, Padding, Margin, triggerHaptic, setHapticImplementation, shadowStyle, compressImage } from './utils';
27
27
  export type { BreakpointKey, SpacingToken, HapticType, CompressImageOptions } from './utils';
28
28
  export { formatDate, formatTime, formatDateTime, formatRelativeTime, formatPhone, normalizePhone, formatCurrency, formatNumber, formatPercent, formatCompactNumber, getInitials } from './formatters';
29
29
  export type { DateInput, DateStyle, TimeStyle, FormatCurrencyOptions } from './formatters';
30
30
  export { isNonEmpty, isEmail, isIndianMobile, isPhone, isUrl, isNumeric, isInteger, isAlphanumeric, isStrongPassword, isIndianPincode, isPan, isGstin, isAadhaar, isIfsc, isHexColor, isBetween, minLength, maxLength } from './validators';
31
31
  export type { PasswordRules } from './validators';
32
+ export { useForm, useField, useFieldArray, Form, useFormContext, useOptionalFormContext, rules, getPath, setPath, deletePath } from './form';
33
+ export type { FormApi, FormConfig, FormValues, FormErrors, FormTouched, FieldState, FieldInputProps, FocusableNode, ValidationRule, ValidationResult, FieldRules, ValidationSchema, FormValidateFn, ValidateOn, SubmitHelpers, FieldArrayApi } from './form';
32
34
  export { useNetworkStatus, getNetworkStatus, addNetworkStatusListener, NetworkStatusBanner } from './network';
33
35
  export type { NetworkStatus, NetworkConnectionType, NetworkStatusListener, NetworkStatusBannerProps } from './network';
34
36
  export { Permissions } from './permissions';
@@ -39,6 +39,21 @@ export interface ColorPalette {
39
39
  warning: string;
40
40
  error: string;
41
41
  info: string;
42
+ /**
43
+ * Foreground (text/icon) colour to render ON a solid fill of each semantic
44
+ * tone. Solid Button / Badge / Chip / Banner backgrounds read these instead
45
+ * of assuming `text.inverse` (white) — white-on-pale (notably `warning`
46
+ * amber) fails contrast. Library defaults keep the historical white for
47
+ * primary/success/error/info, use dark ink for `warning`, and `text.primary`
48
+ * for the surface-like `secondary` tone. Override per-brand to match your
49
+ * palette's luminance.
50
+ */
51
+ onPrimary: string;
52
+ onSecondary: string;
53
+ onSuccess: string;
54
+ onWarning: string;
55
+ onError: string;
56
+ onInfo: string;
42
57
  text: {
43
58
  primary: string;
44
59
  secondary: string;
@@ -280,8 +295,6 @@ export interface DialogTokens {
280
295
  iconWrapperSize: number;
281
296
  iconWrapperBorderRadius: number;
282
297
  actionButtonMinHeight: number;
283
- /** When true, fires a selection haptic on action-button press. Library default: false. */
284
- actionHaptic?: boolean;
285
298
  }
286
299
  export interface ToastTokens {
287
300
  iconCircleSize: number;
@@ -322,43 +335,25 @@ export interface CheckboxSizeTokens {
322
335
  }
323
336
  export interface CheckboxTokens extends Partial<Record<ComponentSizeKey, CheckboxSizeTokens>> {
324
337
  labelGap?: number;
325
- /** When true, fires a selection haptic on press by default. Library default: false. */
326
- pressHaptic?: boolean;
327
- }
328
- export interface ChipTokens extends Partial<Record<ComponentSizeKey, ChipSizeTokens>> {
329
- /** When true, fires a selection haptic when the chip itself is pressed. Library default: false. */
330
- pressHaptic?: boolean;
331
- /** When true, fires a selection haptic when the close (×) button is pressed. Library default: false. */
332
- closeHaptic?: boolean;
333
- }
334
- export interface ListItemTokens extends Partial<Record<ComponentSizeKey, ListItemSizeTokens>> {
335
- /** When true, fires a selection haptic on press. Library default: false. */
336
- pressHaptic?: boolean;
337
338
  }
339
+ export type ChipTokens = Partial<Record<ComponentSizeKey, ChipSizeTokens>>;
340
+ export type ListItemTokens = Partial<Record<ComponentSizeKey, ListItemSizeTokens>>;
338
341
  export interface RadioSizeTokens {
339
342
  outer: number;
340
343
  inner: number;
341
344
  }
342
345
  export interface RadioTokens extends Partial<Record<ComponentSizeKey, RadioSizeTokens>> {
343
346
  labelGap?: number;
344
- /** When true, fires a selection haptic on press by default. Library default: false. */
345
- pressHaptic?: boolean;
346
347
  }
347
348
  export interface NumberInputTokens {
348
349
  /** Milliseconds before long-press auto-repeat kicks in. Library default: 500. */
349
350
  longPressDelayMs?: number;
350
351
  /** Milliseconds between auto-repeated step ticks while long-pressed. Library default: 80. */
351
352
  longPressIntervalMs?: number;
352
- /** When true, fires a light impact haptic on every +/- press. Library default: false. */
353
- pressHaptic?: boolean;
354
353
  }
355
354
  export interface OTPInputTokens extends Partial<Record<ComponentSizeKey, OTPInputSizeTokens>> {
356
355
  /** When true, the row shakes horizontally on first error transition. Library default: false. */
357
356
  shakeOnError?: boolean;
358
- /** When true, fires an error haptic on first error transition. Library default: false. */
359
- errorHaptic?: boolean;
360
- /** When true, fires a selection haptic on each value change. Library default: false. */
361
- selectionHaptic?: boolean;
362
357
  }
363
358
  export interface ProgressBarTokens {
364
359
  /** Duration in ms of the indeterminate-loop animation cycle. Library default: 1500. */
@@ -373,8 +368,6 @@ export interface RatingTokens {
373
368
  pulseOnPress?: boolean;
374
369
  /** Peak scale of the pulse animation. Library default: 1.2. */
375
370
  pulseScale?: number;
376
- /** When true, fires a selection haptic on each rating change. Library default: false. */
377
- pressHaptic?: boolean;
378
371
  }
379
372
  /**
380
373
  * Per-size dimensions for the unified field box (FieldBase). Every
@@ -515,8 +508,6 @@ export interface BottomNavigationTokens {
515
508
  underlineHeight?: number;
516
509
  }
517
510
  export interface DatePickerTokens {
518
- /** Opt-in haptic feedback on month/year navigation and selection. Default: false. */
519
- haptic?: boolean;
520
511
  /** Pixel offset for the month-slide animation. Default: 32. */
521
512
  monthSlideDistance?: number;
522
513
  /** Outgoing month-slide animation duration (ms). Default: theme.motion.duration.fast or 140. */
@@ -549,8 +540,6 @@ export interface DatePickerTokens {
549
540
  footerButtonMinHeight?: number;
550
541
  }
551
542
  export interface DateRangePickerTokens {
552
- /** Opt-in haptic feedback on month navigation and selection. Default: false. */
553
- haptic?: boolean;
554
543
  /** Pixel offset for the month-slide animation. Default: 32. */
555
544
  monthSlideDistance?: number;
556
545
  /** Outgoing month-slide animation duration (ms). Default: theme.motion.duration.fast or 140. */
@@ -567,8 +556,6 @@ export interface DateRangePickerTokens {
567
556
  footerButtonMinHeight?: number;
568
557
  }
569
558
  export interface TimePickerTokens {
570
- /** Opt-in haptic feedback on wheel scroll and confirm/cancel. Default: false. */
571
- haptic?: boolean;
572
559
  /** Debounce window between scroll-haptic ticks (ms). Default: 35. */
573
560
  hapticDebounceMs?: number;
574
561
  /** Width of the bottom-sheet drag handle. Default: 36. */
@@ -601,14 +588,10 @@ export interface AvatarTokens {
601
588
  fontWeight?: keyof TypographyScale['fontWeight'];
602
589
  }
603
590
  export interface AccordionTokens {
604
- /** When true, fires a selection haptic on header press. Library default: false. */
605
- pressHaptic?: boolean;
606
591
  /** Vertical padding inside the `card` variant container. Library default: 4. */
607
592
  cardPaddingVertical?: number;
608
593
  }
609
594
  export interface AppBarTokens {
610
- /** When true, fires a selection haptic on action-button press. Library default: false. */
611
- pressHaptic?: boolean;
612
595
  /** Min-width of the left/right side action slots. Library default: 48. */
613
596
  sideSlotMinWidth?: number;
614
597
  /** Translate-Y distance (px, negative) the large title travels when collapsing. Library default: -20. */
@@ -649,17 +632,11 @@ export interface BannerTokens {
649
632
  actionButtonPaddingVertical?: number;
650
633
  actionButtonRadius?: number;
651
634
  }
652
- export interface CardTokens {
653
- /** When true, fires a selection haptic on interactive card press. Library default: false. */
654
- pressHaptic?: boolean;
655
- }
656
635
  export interface DrawerTokens {
657
636
  /** Pixel velocity above which a fling closes the drawer. Library default: 1000. */
658
637
  closeVelocityThreshold?: number;
659
638
  /** Pixel drag distance before the gesture is recognised. Library default: 10. */
660
639
  dragActivationOffset?: number;
661
- /** When true, fires a selection haptic on backdrop press. Library default: false. */
662
- backdropPressHaptic?: boolean;
663
640
  }
664
641
  export interface FloatingActionButtonTokens {
665
642
  /** Horizontal inset from screen edge for bottomLeft/bottomRight positions. Library default: 24. */
@@ -670,8 +647,6 @@ export interface FloatingActionButtonTokens {
670
647
  secondaryGap?: number;
671
648
  /** Per-item stagger delay in ms when opening/closing the group. Library default: 50. */
672
649
  staggerMs?: number;
673
- /** When true, fires impactLight on press / open / action. Library default: false. */
674
- pressHaptic?: boolean;
675
650
  }
676
651
  export interface ImageGalleryTokens {
677
652
  /** Maximum pinch-zoom scale. Library default: 4. */
@@ -680,14 +655,10 @@ export interface ImageGalleryTokens {
680
655
  minScale?: number;
681
656
  /** Scale applied on double-tap at rest. Library default: 2. */
682
657
  doubleTapScale?: number;
683
- /** When true, fires haptics on open/close/swipe/double-tap. Library default: false. */
684
- pressHaptic?: boolean;
685
658
  }
686
659
  export interface ModalTokens {
687
660
  /** Initial scale value for the centred presentation enter animation. Library default: 0.9. */
688
661
  scaleStartValue?: number;
689
- /** When true, fires a selection haptic on backdrop dismiss. Library default: false. */
690
- backdropHaptic?: boolean;
691
662
  }
692
663
  export interface SegmentedControlSizeTokens {
693
664
  height?: number;
@@ -697,8 +668,6 @@ export interface SegmentedControlSizeTokens {
697
668
  export interface SegmentedControlTokens extends Partial<Record<'sm' | 'md', SegmentedControlSizeTokens>> {
698
669
  /** Padding between the track edge and the selected indicator. Library default: 2. */
699
670
  trackPadding?: number;
700
- /** When true, fires a selection haptic on segment change. Library default: false. */
701
- changeHaptic?: boolean;
702
671
  }
703
672
  export interface SliderSizeTokens {
704
673
  trackHeight?: number;
@@ -713,14 +682,6 @@ export interface SliderTokens extends Partial<Record<ComponentSizeKey, SliderSiz
713
682
  labelShowDuration?: number;
714
683
  /** Final opacity of the bubble label when visible. Library default: 1. */
715
684
  labelOpacity?: number;
716
- /** When true, fires a selection haptic while dragging. Library default: false. */
717
- dragHaptic?: boolean;
718
- /** When true, fires a selection haptic each time the value crosses a step boundary. Library default: false. */
719
- stepHaptic?: boolean;
720
- /** When true, fires a selection haptic on track tap. Library default: false. */
721
- tapHaptic?: boolean;
722
- /** When true, fires a selection haptic on accessibility increment/decrement. Library default: false. */
723
- a11yHaptic?: boolean;
724
685
  }
725
686
  export interface StepperTokens {
726
687
  /** Diameter of each step circle. Library default: 24. */
@@ -731,8 +692,6 @@ export interface StepperTokens {
731
692
  pulseDuration?: number;
732
693
  /** When true, the active step animates a continuous pulse ring. Library default: false. */
733
694
  pulseAnimation?: boolean;
734
- /** When true, fires a selection haptic on step press. Library default: false. */
735
- pressHaptic?: boolean;
736
695
  }
737
696
  export interface SwipeableTokens {
738
697
  /** Pixel distance after which a partial-swipe action commits on release. Library default: 64. */
@@ -751,12 +710,6 @@ export interface SwipeableTokens {
751
710
  springStiffness?: number;
752
711
  /** Spring mass for snap-back animation. */
753
712
  springMass?: number;
754
- /** When true, fires a notification haptic on full-swipe commit. Library default: true. */
755
- fullSwipeHaptic?: boolean;
756
- /** When true, fires a selection haptic on action button press. Library default: true. */
757
- actionPressHaptic?: boolean;
758
- /** When true, fires a selection haptic on accessibility action. Library default: true. */
759
- a11yActionHaptic?: boolean;
760
713
  }
761
714
  export interface TabsTokens {
762
715
  /** Horizontal padding of each tab. Library default: theme.spacing.lg. */
@@ -773,8 +726,6 @@ export interface TabsTokens {
773
726
  disabledOpacity?: number;
774
727
  /** Gap between label and inline badge. Library default: 6. */
775
728
  badgeGap?: number;
776
- /** When true, fires a selection haptic on tab press. Library default: false. */
777
- hapticOnPress?: boolean;
778
729
  }
779
730
  export interface TooltipTokens {
780
731
  /** Gap between trigger and tooltip card. Library default: 8. */
@@ -807,7 +758,6 @@ export interface ComponentTokens {
807
758
  badge?: BadgeTokens;
808
759
  bottomNavigation?: BottomNavigationTokens;
809
760
  bottomSheet?: BottomSheetTokens;
810
- card?: CardTokens;
811
761
  checkbox?: CheckboxTokens;
812
762
  chip?: ChipTokens;
813
763
  datePicker?: DatePickerTokens;
@@ -1,4 +1,12 @@
1
1
  export type HapticType = 'selection' | 'impactLight' | 'impactMedium' | 'impactHeavy' | 'notificationSuccess' | 'notificationWarning' | 'notificationError';
2
2
  export declare const triggerHaptic: (type?: HapticType) => void;
3
3
  export declare const setHapticImplementation: (impl: ((type: HapticType) => void) | null) => void;
4
+ /**
5
+ * Resolves a component's `haptic` prop to the type that should fire, or null
6
+ * when haptics are off. `false` disables; a `HapticType` overrides; `undefined`
7
+ * falls back to the component's sensible default. Pair with `triggerHaptic`:
8
+ * const h = resolveHaptic(haptic, 'selection');
9
+ * if (h) triggerHaptic(h);
10
+ */
11
+ export declare const resolveHaptic: (haptic: HapticType | false | undefined, fallbackType: HapticType) => HapticType | null;
4
12
  //# sourceMappingURL=hapticUtils.d.ts.map
@@ -2,7 +2,7 @@ export { ScreenDimensions, Breakpoints, Responsive, isScreenSize, isTablet } fro
2
2
  export type { BreakpointKey } from './responsive';
3
3
  export { Spacing, Padding, Margin } from './spacing';
4
4
  export type { SpacingToken } from './spacing';
5
- export { triggerHaptic, setHapticImplementation } from './hapticUtils';
5
+ export { triggerHaptic, setHapticImplementation, resolveHaptic } from './hapticUtils';
6
6
  export type { HapticType } from './hapticUtils';
7
7
  export { shadowStyle } from './shadows';
8
8
  export { compressImage } from './imageCompression';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@webority-technologies/mobile",
3
- "version": "0.0.22",
3
+ "version": "0.0.24",
4
4
  "description": "Beautiful, animated, accessible React Native components plus API/auth/logging/network/storage utilities for Webority projects.",
5
5
  "keywords": [
6
6
  "react-native",