This repository was archived by the owner on Aug 9, 2026. It is now read-only.
Commit 24e37f1
authored
(react-hooks) feat: add phone number validation (#31)
This pull request introduces a new phone number validation feature to
the `@magnidev/react-hooks` package and improves code maintainability
and documentation. The main changes include adding a
`phoneNumberSchema`, implementing a `useValidatePhoneNumber` hook,
updating exports for easier usage, and enhancing documentation for
validation hooks.
### Phone Number Validation
* Added a new `phoneNumberSchema` to `auth-schema.ts` for validating
phone numbers, supporting international formats and length checks.
* Implemented a new `useValidatePhoneNumber` React hook in
`use-validations.ts` to validate phone numbers using the new schema.
* Exported `phoneNumberSchema` and `useValidatePhoneNumber` for use in
other modules.
[[1]](diffhunk://#diff-22e8fc7bf75946e4c7e38e1e5e564c5495734705a91fb49f8f9d85be24f7abe0R195)
[[2]](diffhunk://#diff-32f91bd59d518355999d9c413973fa10bffb51c75d3bc3f05984058a92f0fdc1L70-R82)
### Code Organization and Exports
* Updated `index.ts` to use wildcard exports for both hooks and schemas,
simplifying imports for library consumers.
### Documentation Improvements
* Added JSDoc-style comments to all validation hooks in
`use-validations.ts` to clarify their usage and parameters.
[[1]](diffhunk://#diff-22e8fc7bf75946e4c7e38e1e5e564c5495734705a91fb49f8f9d85be24f7abe0R16-R20)
[[2]](diffhunk://#diff-22e8fc7bf75946e4c7e38e1e5e564c5495734705a91fb49f8f9d85be24f7abe0R43-R47)
[[3]](diffhunk://#diff-22e8fc7bf75946e4c7e38e1e5e564c5495734705a91fb49f8f9d85be24f7abe0R70-R73)
[[4]](diffhunk://#diff-22e8fc7bf75946e4c7e38e1e5e564c5495734705a91fb49f8f9d85be24f7abe0R96-R100)
[[5]](diffhunk://#diff-22e8fc7bf75946e4c7e38e1e5e564c5495734705a91fb49f8f9d85be24f7abe0R132-R162)
### Version Update
* Bumped the package version from `1.0.1` to `1.1.0` to reflect the
addition of new features.4 files changed
Lines changed: 68 additions & 16 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
| 3 | + | |
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| 7 | + | |
7 | 8 | | |
8 | 9 | | |
9 | 10 | | |
| |||
12 | 13 | | |
13 | 14 | | |
14 | 15 | | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
15 | 21 | | |
16 | 22 | | |
17 | 23 | | |
| |||
34 | 40 | | |
35 | 41 | | |
36 | 42 | | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
37 | 48 | | |
38 | 49 | | |
39 | 50 | | |
| |||
56 | 67 | | |
57 | 68 | | |
58 | 69 | | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
59 | 74 | | |
60 | 75 | | |
61 | 76 | | |
| |||
78 | 93 | | |
79 | 94 | | |
80 | 95 | | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
81 | 101 | | |
82 | 102 | | |
83 | 103 | | |
| |||
109 | 129 | | |
110 | 130 | | |
111 | 131 | | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
112 | 163 | | |
113 | 164 | | |
114 | 165 | | |
| |||
141 | 192 | | |
142 | 193 | | |
143 | 194 | | |
| 195 | + | |
144 | 196 | | |
145 | 197 | | |
146 | 198 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | | - | |
3 | | - | |
4 | | - | |
5 | | - | |
6 | | - | |
7 | | - | |
8 | | - | |
9 | | - | |
| 2 | + | |
10 | 3 | | |
11 | | - | |
12 | | - | |
13 | | - | |
14 | | - | |
15 | | - | |
16 | | - | |
| 4 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
67 | 67 | | |
68 | 68 | | |
69 | 69 | | |
70 | | - | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
0 commit comments