@luochuanyuewu/payload-auth 1.8.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 (424) hide show
  1. package/dist/better-auth/adapter/generate-schema/generate-schema-builder.d.ts +24 -0
  2. package/dist/better-auth/adapter/generate-schema/generate-schema-builder.d.ts.map +1 -0
  3. package/dist/better-auth/adapter/generate-schema/generate-schema-builder.js +317 -0
  4. package/dist/better-auth/adapter/generate-schema/get-payload-schema.d.ts +2 -0
  5. package/dist/better-auth/adapter/generate-schema/get-payload-schema.d.ts.map +1 -0
  6. package/dist/better-auth/adapter/generate-schema/get-payload-schema.js +23 -0
  7. package/dist/better-auth/adapter/generate-schema/index.d.ts +5 -0
  8. package/dist/better-auth/adapter/generate-schema/index.d.ts.map +1 -0
  9. package/dist/better-auth/adapter/generate-schema/index.js +19 -0
  10. package/dist/better-auth/adapter/generate-schema/utils.d.ts +3 -0
  11. package/dist/better-auth/adapter/generate-schema/utils.d.ts.map +1 -0
  12. package/dist/better-auth/adapter/generate-schema/utils.js +20 -0
  13. package/dist/better-auth/adapter/index.d.ts +16 -0
  14. package/dist/better-auth/adapter/index.d.ts.map +1 -0
  15. package/dist/better-auth/adapter/index.js +717 -0
  16. package/dist/better-auth/adapter/transform/index.d.ts +31 -0
  17. package/dist/better-auth/adapter/transform/index.d.ts.map +1 -0
  18. package/dist/better-auth/adapter/transform/index.js +729 -0
  19. package/dist/better-auth/adapter/types.d.ts +11 -0
  20. package/dist/better-auth/adapter/types.d.ts.map +1 -0
  21. package/dist/better-auth/adapter/types.js +3 -0
  22. package/dist/better-auth/generated-types.d.ts +329 -0
  23. package/dist/better-auth/generated-types.d.ts.map +1 -0
  24. package/dist/better-auth/generated-types.js +4 -0
  25. package/dist/better-auth/index.d.ts +4 -0
  26. package/dist/better-auth/index.d.ts.map +1 -0
  27. package/dist/better-auth/index.js +5 -0
  28. package/dist/better-auth/plugin/constants.d.ts +231 -0
  29. package/dist/better-auth/plugin/constants.d.ts.map +1 -0
  30. package/dist/better-auth/plugin/constants.js +259 -0
  31. package/dist/better-auth/plugin/helpers/check-plugin-exists.d.ts +13 -0
  32. package/dist/better-auth/plugin/helpers/check-plugin-exists.d.ts.map +1 -0
  33. package/dist/better-auth/plugin/helpers/check-plugin-exists.js +14 -0
  34. package/dist/better-auth/plugin/helpers/generate-verify-email-url.d.ts +30 -0
  35. package/dist/better-auth/plugin/helpers/generate-verify-email-url.d.ts.map +1 -0
  36. package/dist/better-auth/plugin/helpers/generate-verify-email-url.js +46 -0
  37. package/dist/better-auth/plugin/helpers/get-admin-access.d.ts +8 -0
  38. package/dist/better-auth/plugin/helpers/get-admin-access.d.ts.map +1 -0
  39. package/dist/better-auth/plugin/helpers/get-admin-access.js +22 -0
  40. package/dist/better-auth/plugin/helpers/get-all-roles.d.ts +6 -0
  41. package/dist/better-auth/plugin/helpers/get-all-roles.d.ts.map +1 -0
  42. package/dist/better-auth/plugin/helpers/get-all-roles.js +20 -0
  43. package/dist/better-auth/plugin/helpers/get-better-auth-schema.d.ts +19 -0
  44. package/dist/better-auth/plugin/helpers/get-better-auth-schema.d.ts.map +1 -0
  45. package/dist/better-auth/plugin/helpers/get-better-auth-schema.js +75 -0
  46. package/dist/better-auth/plugin/helpers/get-collection-slug.d.ts +6 -0
  47. package/dist/better-auth/plugin/helpers/get-collection-slug.d.ts.map +1 -0
  48. package/dist/better-auth/plugin/helpers/get-collection-slug.js +20 -0
  49. package/dist/better-auth/plugin/helpers/get-collection.d.ts +28 -0
  50. package/dist/better-auth/plugin/helpers/get-collection.d.ts.map +1 -0
  51. package/dist/better-auth/plugin/helpers/get-collection.js +49 -0
  52. package/dist/better-auth/plugin/helpers/get-ip.d.ts +3 -0
  53. package/dist/better-auth/plugin/helpers/get-ip.d.ts.map +1 -0
  54. package/dist/better-auth/plugin/helpers/get-ip.js +31 -0
  55. package/dist/better-auth/plugin/helpers/get-signed-cookie.d.ts +3 -0
  56. package/dist/better-auth/plugin/helpers/get-signed-cookie.d.ts.map +1 -0
  57. package/dist/better-auth/plugin/helpers/get-signed-cookie.js +63 -0
  58. package/dist/better-auth/plugin/helpers/index.d.ts +2 -0
  59. package/dist/better-auth/plugin/helpers/index.d.ts.map +1 -0
  60. package/dist/better-auth/plugin/helpers/index.js +3 -0
  61. package/dist/better-auth/plugin/helpers/prepare-session-data.d.ts +60 -0
  62. package/dist/better-auth/plugin/helpers/prepare-session-data.d.ts.map +1 -0
  63. package/dist/better-auth/plugin/helpers/prepare-session-data.js +49 -0
  64. package/dist/better-auth/plugin/helpers/sync-resolved-schema-with-collection-map.d.ts +21 -0
  65. package/dist/better-auth/plugin/helpers/sync-resolved-schema-with-collection-map.d.ts.map +1 -0
  66. package/dist/better-auth/plugin/helpers/sync-resolved-schema-with-collection-map.js +63 -0
  67. package/dist/better-auth/plugin/index.d.ts +8 -0
  68. package/dist/better-auth/plugin/index.d.ts.map +1 -0
  69. package/dist/better-auth/plugin/index.js +103 -0
  70. package/dist/better-auth/plugin/lib/apply-disabled-default-auth-config.d.ts +13 -0
  71. package/dist/better-auth/plugin/lib/apply-disabled-default-auth-config.d.ts.map +1 -0
  72. package/dist/better-auth/plugin/lib/apply-disabled-default-auth-config.js +87 -0
  73. package/dist/better-auth/plugin/lib/build-collections/accounts/hooks/sync-password-to-user.d.ts +4 -0
  74. package/dist/better-auth/plugin/lib/build-collections/accounts/hooks/sync-password-to-user.d.ts.map +1 -0
  75. package/dist/better-auth/plugin/lib/build-collections/accounts/hooks/sync-password-to-user.js +51 -0
  76. package/dist/better-auth/plugin/lib/build-collections/accounts/index.d.ts +4 -0
  77. package/dist/better-auth/plugin/lib/build-collections/accounts/index.d.ts.map +1 -0
  78. package/dist/better-auth/plugin/lib/build-collections/accounts/index.js +150 -0
  79. package/dist/better-auth/plugin/lib/build-collections/admin-invitations/hooks/get-url-after-read.d.ts +6 -0
  80. package/dist/better-auth/plugin/lib/build-collections/admin-invitations/hooks/get-url-after-read.d.ts.map +1 -0
  81. package/dist/better-auth/plugin/lib/build-collections/admin-invitations/hooks/get-url-after-read.js +11 -0
  82. package/dist/better-auth/plugin/lib/build-collections/admin-invitations/hooks/get-url-before-change.d.ts +3 -0
  83. package/dist/better-auth/plugin/lib/build-collections/admin-invitations/hooks/get-url-before-change.d.ts.map +1 -0
  84. package/dist/better-auth/plugin/lib/build-collections/admin-invitations/hooks/get-url-before-change.js +8 -0
  85. package/dist/better-auth/plugin/lib/build-collections/admin-invitations/index.d.ts +7 -0
  86. package/dist/better-auth/plugin/lib/build-collections/admin-invitations/index.d.ts.map +1 -0
  87. package/dist/better-auth/plugin/lib/build-collections/admin-invitations/index.js +117 -0
  88. package/dist/better-auth/plugin/lib/build-collections/api-keys.d.ts +4 -0
  89. package/dist/better-auth/plugin/lib/build-collections/api-keys.d.ts.map +1 -0
  90. package/dist/better-auth/plugin/lib/build-collections/api-keys.js +174 -0
  91. package/dist/better-auth/plugin/lib/build-collections/device-code.d.ts +4 -0
  92. package/dist/better-auth/plugin/lib/build-collections/device-code.d.ts.map +1 -0
  93. package/dist/better-auth/plugin/lib/build-collections/device-code.js +49 -0
  94. package/dist/better-auth/plugin/lib/build-collections/index.d.ts +11 -0
  95. package/dist/better-auth/plugin/lib/build-collections/index.d.ts.map +1 -0
  96. package/dist/better-auth/plugin/lib/build-collections/index.js +79 -0
  97. package/dist/better-auth/plugin/lib/build-collections/invitations.d.ts +4 -0
  98. package/dist/better-auth/plugin/lib/build-collections/invitations.d.ts.map +1 -0
  99. package/dist/better-auth/plugin/lib/build-collections/invitations.js +93 -0
  100. package/dist/better-auth/plugin/lib/build-collections/jwks.d.ts +4 -0
  101. package/dist/better-auth/plugin/lib/build-collections/jwks.d.ts.map +1 -0
  102. package/dist/better-auth/plugin/lib/build-collections/jwks.js +58 -0
  103. package/dist/better-auth/plugin/lib/build-collections/members.d.ts +4 -0
  104. package/dist/better-auth/plugin/lib/build-collections/members.d.ts.map +1 -0
  105. package/dist/better-auth/plugin/lib/build-collections/members.js +72 -0
  106. package/dist/better-auth/plugin/lib/build-collections/oauth-access-tokens.d.ts +4 -0
  107. package/dist/better-auth/plugin/lib/build-collections/oauth-access-tokens.d.ts.map +1 -0
  108. package/dist/better-auth/plugin/lib/build-collections/oauth-access-tokens.js +105 -0
  109. package/dist/better-auth/plugin/lib/build-collections/oauth-applications.d.ts +4 -0
  110. package/dist/better-auth/plugin/lib/build-collections/oauth-applications.d.ts.map +1 -0
  111. package/dist/better-auth/plugin/lib/build-collections/oauth-applications.js +117 -0
  112. package/dist/better-auth/plugin/lib/build-collections/oauth-consents.d.ts +4 -0
  113. package/dist/better-auth/plugin/lib/build-collections/oauth-consents.d.ts.map +1 -0
  114. package/dist/better-auth/plugin/lib/build-collections/oauth-consents.js +87 -0
  115. package/dist/better-auth/plugin/lib/build-collections/organization-roles.d.ts +4 -0
  116. package/dist/better-auth/plugin/lib/build-collections/organization-roles.d.ts.map +1 -0
  117. package/dist/better-auth/plugin/lib/build-collections/organization-roles.js +65 -0
  118. package/dist/better-auth/plugin/lib/build-collections/organizations.d.ts +4 -0
  119. package/dist/better-auth/plugin/lib/build-collections/organizations.d.ts.map +1 -0
  120. package/dist/better-auth/plugin/lib/build-collections/organizations.js +106 -0
  121. package/dist/better-auth/plugin/lib/build-collections/passkeys.d.ts +4 -0
  122. package/dist/better-auth/plugin/lib/build-collections/passkeys.d.ts.map +1 -0
  123. package/dist/better-auth/plugin/lib/build-collections/passkeys.js +115 -0
  124. package/dist/better-auth/plugin/lib/build-collections/rate-limit.d.ts +4 -0
  125. package/dist/better-auth/plugin/lib/build-collections/rate-limit.d.ts.map +1 -0
  126. package/dist/better-auth/plugin/lib/build-collections/rate-limit.js +54 -0
  127. package/dist/better-auth/plugin/lib/build-collections/scim-provider.d.ts +4 -0
  128. package/dist/better-auth/plugin/lib/build-collections/scim-provider.d.ts.map +1 -0
  129. package/dist/better-auth/plugin/lib/build-collections/scim-provider.js +65 -0
  130. package/dist/better-auth/plugin/lib/build-collections/sessions.d.ts +4 -0
  131. package/dist/better-auth/plugin/lib/build-collections/sessions.d.ts.map +1 -0
  132. package/dist/better-auth/plugin/lib/build-collections/sessions.js +140 -0
  133. package/dist/better-auth/plugin/lib/build-collections/sso-providers.d.ts +4 -0
  134. package/dist/better-auth/plugin/lib/build-collections/sso-providers.d.ts.map +1 -0
  135. package/dist/better-auth/plugin/lib/build-collections/sso-providers.js +80 -0
  136. package/dist/better-auth/plugin/lib/build-collections/subscriptions.d.ts +4 -0
  137. package/dist/better-auth/plugin/lib/build-collections/subscriptions.d.ts.map +1 -0
  138. package/dist/better-auth/plugin/lib/build-collections/subscriptions.js +110 -0
  139. package/dist/better-auth/plugin/lib/build-collections/team-members.d.ts +4 -0
  140. package/dist/better-auth/plugin/lib/build-collections/team-members.d.ts.map +1 -0
  141. package/dist/better-auth/plugin/lib/build-collections/team-members.js +63 -0
  142. package/dist/better-auth/plugin/lib/build-collections/teams.d.ts +4 -0
  143. package/dist/better-auth/plugin/lib/build-collections/teams.d.ts.map +1 -0
  144. package/dist/better-auth/plugin/lib/build-collections/teams.js +74 -0
  145. package/dist/better-auth/plugin/lib/build-collections/two-factors.d.ts +4 -0
  146. package/dist/better-auth/plugin/lib/build-collections/two-factors.d.ts.map +1 -0
  147. package/dist/better-auth/plugin/lib/build-collections/two-factors.js +66 -0
  148. package/dist/better-auth/plugin/lib/build-collections/users/better-auth-strategy.d.ts +8 -0
  149. package/dist/better-auth/plugin/lib/build-collections/users/better-auth-strategy.d.ts.map +1 -0
  150. package/dist/better-auth/plugin/lib/build-collections/users/better-auth-strategy.js +52 -0
  151. package/dist/better-auth/plugin/lib/build-collections/users/endpoints/generate-invite-url.d.ts +12 -0
  152. package/dist/better-auth/plugin/lib/build-collections/users/endpoints/generate-invite-url.d.ts.map +1 -0
  153. package/dist/better-auth/plugin/lib/build-collections/users/endpoints/generate-invite-url.js +68 -0
  154. package/dist/better-auth/plugin/lib/build-collections/users/endpoints/index.d.ts +5 -0
  155. package/dist/better-auth/plugin/lib/build-collections/users/endpoints/index.d.ts.map +1 -0
  156. package/dist/better-auth/plugin/lib/build-collections/users/endpoints/index.js +6 -0
  157. package/dist/better-auth/plugin/lib/build-collections/users/endpoints/refresh-token.d.ts +3 -0
  158. package/dist/better-auth/plugin/lib/build-collections/users/endpoints/refresh-token.d.ts.map +1 -0
  159. package/dist/better-auth/plugin/lib/build-collections/users/endpoints/refresh-token.js +114 -0
  160. package/dist/better-auth/plugin/lib/build-collections/users/endpoints/send-invite-url.d.ts +4 -0
  161. package/dist/better-auth/plugin/lib/build-collections/users/endpoints/send-invite-url.d.ts.map +1 -0
  162. package/dist/better-auth/plugin/lib/build-collections/users/endpoints/send-invite-url.js +64 -0
  163. package/dist/better-auth/plugin/lib/build-collections/users/endpoints/set-admin-role.d.ts +4 -0
  164. package/dist/better-auth/plugin/lib/build-collections/users/endpoints/set-admin-role.d.ts.map +1 -0
  165. package/dist/better-auth/plugin/lib/build-collections/users/endpoints/set-admin-role.js +90 -0
  166. package/dist/better-auth/plugin/lib/build-collections/users/hooks/after-login.d.ts +7 -0
  167. package/dist/better-auth/plugin/lib/build-collections/users/hooks/after-login.d.ts.map +1 -0
  168. package/dist/better-auth/plugin/lib/build-collections/users/hooks/after-login.js +80 -0
  169. package/dist/better-auth/plugin/lib/build-collections/users/hooks/after-logout.d.ts +3 -0
  170. package/dist/better-auth/plugin/lib/build-collections/users/hooks/after-logout.d.ts.map +1 -0
  171. package/dist/better-auth/plugin/lib/build-collections/users/hooks/after-logout.js +79 -0
  172. package/dist/better-auth/plugin/lib/build-collections/users/hooks/before-delete.d.ts +3 -0
  173. package/dist/better-auth/plugin/lib/build-collections/users/hooks/before-delete.d.ts.map +1 -0
  174. package/dist/better-auth/plugin/lib/build-collections/users/hooks/before-delete.js +54 -0
  175. package/dist/better-auth/plugin/lib/build-collections/users/hooks/before-login.d.ts +7 -0
  176. package/dist/better-auth/plugin/lib/build-collections/users/hooks/before-login.d.ts.map +1 -0
  177. package/dist/better-auth/plugin/lib/build-collections/users/hooks/before-login.js +15 -0
  178. package/dist/better-auth/plugin/lib/build-collections/users/hooks/index.d.ts +7 -0
  179. package/dist/better-auth/plugin/lib/build-collections/users/hooks/index.d.ts.map +1 -0
  180. package/dist/better-auth/plugin/lib/build-collections/users/hooks/index.js +8 -0
  181. package/dist/better-auth/plugin/lib/build-collections/users/hooks/on-verified-change.d.ts +3 -0
  182. package/dist/better-auth/plugin/lib/build-collections/users/hooks/on-verified-change.d.ts.map +1 -0
  183. package/dist/better-auth/plugin/lib/build-collections/users/hooks/on-verified-change.js +17 -0
  184. package/dist/better-auth/plugin/lib/build-collections/users/hooks/sync-account.d.ts +3 -0
  185. package/dist/better-auth/plugin/lib/build-collections/users/hooks/sync-account.d.ts.map +1 -0
  186. package/dist/better-auth/plugin/lib/build-collections/users/hooks/sync-account.js +90 -0
  187. package/dist/better-auth/plugin/lib/build-collections/users/index.d.ts +4 -0
  188. package/dist/better-auth/plugin/lib/build-collections/users/index.d.ts.map +1 -0
  189. package/dist/better-auth/plugin/lib/build-collections/users/index.js +333 -0
  190. package/dist/better-auth/plugin/lib/build-collections/utils/collection-schema.d.ts +16 -0
  191. package/dist/better-auth/plugin/lib/build-collections/utils/collection-schema.d.ts.map +1 -0
  192. package/dist/better-auth/plugin/lib/build-collections/utils/collection-schema.js +24 -0
  193. package/dist/better-auth/plugin/lib/build-collections/utils/filter-properties.d.ts +11 -0
  194. package/dist/better-auth/plugin/lib/build-collections/utils/filter-properties.d.ts.map +1 -0
  195. package/dist/better-auth/plugin/lib/build-collections/utils/filter-properties.js +112 -0
  196. package/dist/better-auth/plugin/lib/build-collections/utils/get-timestamp-fields.d.ts +8 -0
  197. package/dist/better-auth/plugin/lib/build-collections/utils/get-timestamp-fields.d.ts.map +1 -0
  198. package/dist/better-auth/plugin/lib/build-collections/utils/get-timestamp-fields.js +31 -0
  199. package/dist/better-auth/plugin/lib/build-collections/utils/model-field-transformations.d.ts +12 -0
  200. package/dist/better-auth/plugin/lib/build-collections/utils/model-field-transformations.d.ts.map +1 -0
  201. package/dist/better-auth/plugin/lib/build-collections/utils/model-field-transformations.js +26 -0
  202. package/dist/better-auth/plugin/lib/build-collections/utils/payload-access.d.ts +18 -0
  203. package/dist/better-auth/plugin/lib/build-collections/utils/payload-access.d.ts.map +1 -0
  204. package/dist/better-auth/plugin/lib/build-collections/utils/payload-access.js +84 -0
  205. package/dist/better-auth/plugin/lib/build-collections/utils/transform-schema-fields-to-payload.d.ts +21 -0
  206. package/dist/better-auth/plugin/lib/build-collections/utils/transform-schema-fields-to-payload.d.ts.map +1 -0
  207. package/dist/better-auth/plugin/lib/build-collections/utils/transform-schema-fields-to-payload.js +95 -0
  208. package/dist/better-auth/plugin/lib/build-collections/verifications.d.ts +4 -0
  209. package/dist/better-auth/plugin/lib/build-collections/verifications.d.ts.map +1 -0
  210. package/dist/better-auth/plugin/lib/build-collections/verifications.js +82 -0
  211. package/dist/better-auth/plugin/lib/get-payload-auth.d.ts +6 -0
  212. package/dist/better-auth/plugin/lib/get-payload-auth.d.ts.map +1 -0
  213. package/dist/better-auth/plugin/lib/get-payload-auth.js +9 -0
  214. package/dist/better-auth/plugin/lib/init-better-auth.d.ts +8 -0
  215. package/dist/better-auth/plugin/lib/init-better-auth.d.ts.map +1 -0
  216. package/dist/better-auth/plugin/lib/init-better-auth.js +16 -0
  217. package/dist/better-auth/plugin/lib/sanitize-better-auth-options/admin-plugin.d.ts +3 -0
  218. package/dist/better-auth/plugin/lib/sanitize-better-auth-options/admin-plugin.d.ts.map +1 -0
  219. package/dist/better-auth/plugin/lib/sanitize-better-auth-options/admin-plugin.js +12 -0
  220. package/dist/better-auth/plugin/lib/sanitize-better-auth-options/api-key-plugin.d.ts +3 -0
  221. package/dist/better-auth/plugin/lib/sanitize-better-auth-options/api-key-plugin.d.ts.map +1 -0
  222. package/dist/better-auth/plugin/lib/sanitize-better-auth-options/api-key-plugin.js +10 -0
  223. package/dist/better-auth/plugin/lib/sanitize-better-auth-options/device-authorization-plugin.d.ts +3 -0
  224. package/dist/better-auth/plugin/lib/sanitize-better-auth-options/device-authorization-plugin.d.ts.map +1 -0
  225. package/dist/better-auth/plugin/lib/sanitize-better-auth-options/device-authorization-plugin.js +8 -0
  226. package/dist/better-auth/plugin/lib/sanitize-better-auth-options/index.d.ts +12 -0
  227. package/dist/better-auth/plugin/lib/sanitize-better-auth-options/index.d.ts.map +1 -0
  228. package/dist/better-auth/plugin/lib/sanitize-better-auth-options/index.js +146 -0
  229. package/dist/better-auth/plugin/lib/sanitize-better-auth-options/oidc-plugin.d.ts +3 -0
  230. package/dist/better-auth/plugin/lib/sanitize-better-auth-options/oidc-plugin.d.ts.map +1 -0
  231. package/dist/better-auth/plugin/lib/sanitize-better-auth-options/oidc-plugin.js +18 -0
  232. package/dist/better-auth/plugin/lib/sanitize-better-auth-options/organizations-plugin.d.ts +3 -0
  233. package/dist/better-auth/plugin/lib/sanitize-better-auth-options/organizations-plugin.d.ts.map +1 -0
  234. package/dist/better-auth/plugin/lib/sanitize-better-auth-options/organizations-plugin.js +34 -0
  235. package/dist/better-auth/plugin/lib/sanitize-better-auth-options/passkey-plugin.d.ts +3 -0
  236. package/dist/better-auth/plugin/lib/sanitize-better-auth-options/passkey-plugin.d.ts.map +1 -0
  237. package/dist/better-auth/plugin/lib/sanitize-better-auth-options/passkey-plugin.js +11 -0
  238. package/dist/better-auth/plugin/lib/sanitize-better-auth-options/sso-plugin.d.ts +3 -0
  239. package/dist/better-auth/plugin/lib/sanitize-better-auth-options/sso-plugin.d.ts.map +1 -0
  240. package/dist/better-auth/plugin/lib/sanitize-better-auth-options/sso-plugin.js +10 -0
  241. package/dist/better-auth/plugin/lib/sanitize-better-auth-options/two-factor-plugin.d.ts +3 -0
  242. package/dist/better-auth/plugin/lib/sanitize-better-auth-options/two-factor-plugin.d.ts.map +1 -0
  243. package/dist/better-auth/plugin/lib/sanitize-better-auth-options/two-factor-plugin.js +11 -0
  244. package/dist/better-auth/plugin/lib/sanitize-better-auth-options/utils/admin-after-role-middleware.d.ts +8 -0
  245. package/dist/better-auth/plugin/lib/sanitize-better-auth-options/utils/admin-after-role-middleware.d.ts.map +1 -0
  246. package/dist/better-auth/plugin/lib/sanitize-better-auth-options/utils/admin-after-role-middleware.js +20 -0
  247. package/dist/better-auth/plugin/lib/sanitize-better-auth-options/utils/admin-before-role-middleware.d.ts +8 -0
  248. package/dist/better-auth/plugin/lib/sanitize-better-auth-options/utils/admin-before-role-middleware.d.ts.map +1 -0
  249. package/dist/better-auth/plugin/lib/sanitize-better-auth-options/utils/admin-before-role-middleware.js +20 -0
  250. package/dist/better-auth/plugin/lib/sanitize-better-auth-options/utils/apply-save-to-jwt-returned.d.ts +14 -0
  251. package/dist/better-auth/plugin/lib/sanitize-better-auth-options/utils/apply-save-to-jwt-returned.d.ts.map +1 -0
  252. package/dist/better-auth/plugin/lib/sanitize-better-auth-options/utils/apply-save-to-jwt-returned.js +38 -0
  253. package/dist/better-auth/plugin/lib/sanitize-better-auth-options/utils/ensure-password-set-before-create.d.ts +8 -0
  254. package/dist/better-auth/plugin/lib/sanitize-better-auth-options/utils/ensure-password-set-before-create.d.ts.map +1 -0
  255. package/dist/better-auth/plugin/lib/sanitize-better-auth-options/utils/ensure-password-set-before-create.js +23 -0
  256. package/dist/better-auth/plugin/lib/sanitize-better-auth-options/utils/password.d.ts +26 -0
  257. package/dist/better-auth/plugin/lib/sanitize-better-auth-options/utils/password.d.ts.map +1 -0
  258. package/dist/better-auth/plugin/lib/sanitize-better-auth-options/utils/password.js +62 -0
  259. package/dist/better-auth/plugin/lib/sanitize-better-auth-options/utils/require-admin-invite-for-sign-up-middleware.d.ts +10 -0
  260. package/dist/better-auth/plugin/lib/sanitize-better-auth-options/utils/require-admin-invite-for-sign-up-middleware.d.ts.map +1 -0
  261. package/dist/better-auth/plugin/lib/sanitize-better-auth-options/utils/require-admin-invite-for-sign-up-middleware.js +42 -0
  262. package/dist/better-auth/plugin/lib/sanitize-better-auth-options/utils/use-admin-invite-after-email-sign-up-middleware.d.ts +10 -0
  263. package/dist/better-auth/plugin/lib/sanitize-better-auth-options/utils/use-admin-invite-after-email-sign-up-middleware.d.ts.map +1 -0
  264. package/dist/better-auth/plugin/lib/sanitize-better-auth-options/utils/use-admin-invite-after-email-sign-up-middleware.js +62 -0
  265. package/dist/better-auth/plugin/lib/set-login-methods.d.ts +5 -0
  266. package/dist/better-auth/plugin/lib/set-login-methods.d.ts.map +1 -0
  267. package/dist/better-auth/plugin/lib/set-login-methods.js +14 -0
  268. package/dist/better-auth/plugin/payload/components/admin-buttons/index.d.ts +10 -0
  269. package/dist/better-auth/plugin/payload/components/admin-buttons/index.d.ts.map +1 -0
  270. package/dist/better-auth/plugin/payload/components/admin-buttons/index.js +116 -0
  271. package/dist/better-auth/plugin/payload/components/admin-buttons/index.scss +36 -0
  272. package/dist/better-auth/plugin/payload/components/admin-invite-button/index.d.ts +11 -0
  273. package/dist/better-auth/plugin/payload/components/admin-invite-button/index.d.ts.map +1 -0
  274. package/dist/better-auth/plugin/payload/components/admin-invite-button/index.js +213 -0
  275. package/dist/better-auth/plugin/payload/components/admin-invite-button/index.scss +136 -0
  276. package/dist/better-auth/plugin/payload/components/login-form/alternative-methods.d.ts +4 -0
  277. package/dist/better-auth/plugin/payload/components/login-form/alternative-methods.d.ts.map +1 -0
  278. package/dist/better-auth/plugin/payload/components/login-form/alternative-methods.js +197 -0
  279. package/dist/better-auth/plugin/payload/components/login-form/context.d.ts +49 -0
  280. package/dist/better-auth/plugin/payload/components/login-form/context.d.ts.map +1 -0
  281. package/dist/better-auth/plugin/payload/components/login-form/context.js +94 -0
  282. package/dist/better-auth/plugin/payload/components/login-form/credentials-form.d.ts +4 -0
  283. package/dist/better-auth/plugin/payload/components/login-form/credentials-form.d.ts.map +1 -0
  284. package/dist/better-auth/plugin/payload/components/login-form/credentials-form.js +167 -0
  285. package/dist/better-auth/plugin/payload/components/login-form/index.d.ts +5 -0
  286. package/dist/better-auth/plugin/payload/components/login-form/index.d.ts.map +1 -0
  287. package/dist/better-auth/plugin/payload/components/login-form/index.js +6 -0
  288. package/dist/better-auth/plugin/payload/components/login-form/index.scss +58 -0
  289. package/dist/better-auth/plugin/payload/components/logout-button.d.ts +5 -0
  290. package/dist/better-auth/plugin/payload/components/logout-button.d.ts.map +1 -0
  291. package/dist/better-auth/plugin/payload/components/logout-button.js +24 -0
  292. package/dist/better-auth/plugin/payload/components/passkeys/add-button.d.ts +9 -0
  293. package/dist/better-auth/plugin/payload/components/passkeys/add-button.d.ts.map +1 -0
  294. package/dist/better-auth/plugin/payload/components/passkeys/add-button.js +122 -0
  295. package/dist/better-auth/plugin/payload/components/passkeys/client.d.ts +3 -0
  296. package/dist/better-auth/plugin/payload/components/passkeys/client.d.ts.map +1 -0
  297. package/dist/better-auth/plugin/payload/components/passkeys/client.js +61 -0
  298. package/dist/better-auth/plugin/payload/components/passkeys/index.d.ts +5 -0
  299. package/dist/better-auth/plugin/payload/components/passkeys/index.d.ts.map +1 -0
  300. package/dist/better-auth/plugin/payload/components/passkeys/index.js +42 -0
  301. package/dist/better-auth/plugin/payload/components/passkeys/index.scss +98 -0
  302. package/dist/better-auth/plugin/payload/components/passkeys/list.d.ts +9 -0
  303. package/dist/better-auth/plugin/payload/components/passkeys/list.d.ts.map +1 -0
  304. package/dist/better-auth/plugin/payload/components/passkeys/list.js +57 -0
  305. package/dist/better-auth/plugin/payload/components/passkeys/types.d.ts +23 -0
  306. package/dist/better-auth/plugin/payload/components/passkeys/types.d.ts.map +1 -0
  307. package/dist/better-auth/plugin/payload/components/passkeys/types.js +3 -0
  308. package/dist/better-auth/plugin/payload/components/rsc-redirect.d.ts +7 -0
  309. package/dist/better-auth/plugin/payload/components/rsc-redirect.d.ts.map +1 -0
  310. package/dist/better-auth/plugin/payload/components/rsc-redirect.js +13 -0
  311. package/dist/better-auth/plugin/payload/components/token-field.d.ts +4 -0
  312. package/dist/better-auth/plugin/payload/components/token-field.d.ts.map +1 -0
  313. package/dist/better-auth/plugin/payload/components/token-field.js +29 -0
  314. package/dist/better-auth/plugin/payload/components/two-factor-auth/index.d.ts +9 -0
  315. package/dist/better-auth/plugin/payload/components/two-factor-auth/index.d.ts.map +1 -0
  316. package/dist/better-auth/plugin/payload/components/two-factor-auth/index.js +347 -0
  317. package/dist/better-auth/plugin/payload/components/two-factor-auth/index.scss +116 -0
  318. package/dist/better-auth/plugin/payload/exports/client.d.ts +7 -0
  319. package/dist/better-auth/plugin/payload/exports/client.d.ts.map +1 -0
  320. package/dist/better-auth/plugin/payload/exports/client.js +8 -0
  321. package/dist/better-auth/plugin/payload/exports/rsc.d.ts +9 -0
  322. package/dist/better-auth/plugin/payload/exports/rsc.d.ts.map +1 -0
  323. package/dist/better-auth/plugin/payload/exports/rsc.js +10 -0
  324. package/dist/better-auth/plugin/payload/utils/generate-admin-invite-url.d.ts +3 -0
  325. package/dist/better-auth/plugin/payload/utils/generate-admin-invite-url.d.ts.map +1 -0
  326. package/dist/better-auth/plugin/payload/utils/generate-admin-invite-url.js +9 -0
  327. package/dist/better-auth/plugin/payload/utils/get-safe-redirect.d.ts +2 -0
  328. package/dist/better-auth/plugin/payload/utils/get-safe-redirect.d.ts.map +1 -0
  329. package/dist/better-auth/plugin/payload/utils/get-safe-redirect.js +22 -0
  330. package/dist/better-auth/plugin/payload/views/admin-login/client.d.ts +23 -0
  331. package/dist/better-auth/plugin/payload/views/admin-login/client.d.ts.map +1 -0
  332. package/dist/better-auth/plugin/payload/views/admin-login/client.js +24 -0
  333. package/dist/better-auth/plugin/payload/views/admin-login/index.d.ts +11 -0
  334. package/dist/better-auth/plugin/payload/views/admin-login/index.d.ts.map +1 -0
  335. package/dist/better-auth/plugin/payload/views/admin-login/index.js +143 -0
  336. package/dist/better-auth/plugin/payload/views/admin-signup/client.d.ts +23 -0
  337. package/dist/better-auth/plugin/payload/views/admin-signup/client.d.ts.map +1 -0
  338. package/dist/better-auth/plugin/payload/views/admin-signup/client.js +185 -0
  339. package/dist/better-auth/plugin/payload/views/admin-signup/index.d.ts +10 -0
  340. package/dist/better-auth/plugin/payload/views/admin-signup/index.d.ts.map +1 -0
  341. package/dist/better-auth/plugin/payload/views/admin-signup/index.js +92 -0
  342. package/dist/better-auth/plugin/payload/views/forgot-password/client.d.ts +7 -0
  343. package/dist/better-auth/plugin/payload/views/forgot-password/client.d.ts.map +1 -0
  344. package/dist/better-auth/plugin/payload/views/forgot-password/client.js +104 -0
  345. package/dist/better-auth/plugin/payload/views/forgot-password/index.d.ts +9 -0
  346. package/dist/better-auth/plugin/payload/views/forgot-password/index.d.ts.map +1 -0
  347. package/dist/better-auth/plugin/payload/views/forgot-password/index.js +61 -0
  348. package/dist/better-auth/plugin/payload/views/reset-password/client.d.ts +11 -0
  349. package/dist/better-auth/plugin/payload/views/reset-password/client.d.ts.map +1 -0
  350. package/dist/better-auth/plugin/payload/views/reset-password/client.js +111 -0
  351. package/dist/better-auth/plugin/payload/views/reset-password/index.d.ts +9 -0
  352. package/dist/better-auth/plugin/payload/views/reset-password/index.d.ts.map +1 -0
  353. package/dist/better-auth/plugin/payload/views/reset-password/index.js +78 -0
  354. package/dist/better-auth/plugin/payload/views/two-factor-verify/client.d.ts +9 -0
  355. package/dist/better-auth/plugin/payload/views/two-factor-verify/client.d.ts.map +1 -0
  356. package/dist/better-auth/plugin/payload/views/two-factor-verify/client.js +79 -0
  357. package/dist/better-auth/plugin/payload/views/two-factor-verify/index.d.ts +10 -0
  358. package/dist/better-auth/plugin/payload/views/two-factor-verify/index.d.ts.map +1 -0
  359. package/dist/better-auth/plugin/payload/views/two-factor-verify/index.js +49 -0
  360. package/dist/better-auth/plugin/types.d.ts +448 -0
  361. package/dist/better-auth/plugin/types.d.ts.map +1 -0
  362. package/dist/better-auth/plugin/types.js +3 -0
  363. package/dist/better-auth/plugin/utils/set.d.ts +40 -0
  364. package/dist/better-auth/plugin/utils/set.d.ts.map +1 -0
  365. package/dist/better-auth/plugin/utils/set.js +84 -0
  366. package/dist/better-auth/scripts/generate-types.d.ts +2 -0
  367. package/dist/better-auth/scripts/generate-types.d.ts.map +1 -0
  368. package/dist/better-auth/scripts/generate-types.js +225 -0
  369. package/dist/better-auth/types.d.ts +3 -0
  370. package/dist/better-auth/types.d.ts.map +1 -0
  371. package/dist/better-auth/types.js +4 -0
  372. package/dist/index.d.ts +2 -0
  373. package/dist/index.d.ts.map +1 -0
  374. package/dist/index.js +4 -0
  375. package/dist/shared/components/icons.d.ts +8 -0
  376. package/dist/shared/components/icons.d.ts.map +1 -0
  377. package/dist/shared/components/icons.js +436 -0
  378. package/dist/shared/components/logo.d.ts +3 -0
  379. package/dist/shared/components/logo.d.ts.map +1 -0
  380. package/dist/shared/components/logo.js +24 -0
  381. package/dist/shared/form/components/submit.d.ts +8 -0
  382. package/dist/shared/form/components/submit.d.ts.map +1 -0
  383. package/dist/shared/form/components/submit.js +23 -0
  384. package/dist/shared/form/fields/text-field.d.ts +9 -0
  385. package/dist/shared/form/fields/text-field.d.ts.map +1 -0
  386. package/dist/shared/form/fields/text-field.js +44 -0
  387. package/dist/shared/form/index.d.ts +28 -0
  388. package/dist/shared/form/index.d.ts.map +1 -0
  389. package/dist/shared/form/index.js +17 -0
  390. package/dist/shared/form/ui/header/index.d.ts +9 -0
  391. package/dist/shared/form/ui/header/index.d.ts.map +1 -0
  392. package/dist/shared/form/ui/header/index.js +23 -0
  393. package/dist/shared/form/ui/header/index.scss +8 -0
  394. package/dist/shared/form/ui/index.d.ts +34 -0
  395. package/dist/shared/form/ui/index.d.ts.map +1 -0
  396. package/dist/shared/form/ui/index.js +70 -0
  397. package/dist/shared/form/ui/index.scss +27 -0
  398. package/dist/shared/form/validation.d.ts +65 -0
  399. package/dist/shared/form/validation.d.ts.map +1 -0
  400. package/dist/shared/form/validation.js +108 -0
  401. package/dist/shared/index.d.ts +3 -0
  402. package/dist/shared/index.d.ts.map +1 -0
  403. package/dist/shared/index.js +4 -0
  404. package/dist/shared/payload/fields/field-copy-button/index.css +47 -0
  405. package/dist/shared/payload/fields/field-copy-button/index.d.ts +4 -0
  406. package/dist/shared/payload/fields/field-copy-button/index.d.ts.map +1 -0
  407. package/dist/shared/payload/fields/field-copy-button/index.js +38 -0
  408. package/dist/shared/payload/fields/generate-uuid-button/index.css +14 -0
  409. package/dist/shared/payload/fields/generate-uuid-button/index.d.ts +4 -0
  410. package/dist/shared/payload/fields/generate-uuid-button/index.d.ts.map +1 -0
  411. package/dist/shared/payload/fields/generate-uuid-button/index.js +26 -0
  412. package/dist/shared/payload/fields/index.d.ts +3 -0
  413. package/dist/shared/payload/fields/index.d.ts.map +1 -0
  414. package/dist/shared/payload/fields/index.js +4 -0
  415. package/dist/shared/utils/regex.d.ts +3 -0
  416. package/dist/shared/utils/regex.d.ts.map +1 -0
  417. package/dist/shared/utils/regex.js +4 -0
  418. package/dist/shared/utils/try-catch.d.ts +12 -0
  419. package/dist/shared/utils/try-catch.d.ts.map +1 -0
  420. package/dist/shared/utils/try-catch.js +17 -0
  421. package/dist/shared/utils/value-or-default.d.ts +10 -0
  422. package/dist/shared/utils/value-or-default.d.ts.map +1 -0
  423. package/dist/shared/utils/value-or-default.js +12 -0
  424. package/package.json +124 -0
@@ -0,0 +1,44 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useStore } from "@tanstack/react-form";
3
+ import { useFieldContext } from "../index";
4
+ import { FieldErrors, FieldInputWrap, FormField, FormLabel } from "../ui";
5
+ export function TextField({ className, label, required = false, type = "text", autoComplete = "off", onValueChange }) {
6
+ const field = useFieldContext();
7
+ const meta = useStore(field.store, (state)=>state.meta);
8
+ const hasError = meta.isTouched && meta.errors.length > 0;
9
+ return /*#__PURE__*/ _jsxs(FormField, {
10
+ id: field.name,
11
+ className: className,
12
+ hasError: hasError,
13
+ children: [
14
+ /*#__PURE__*/ _jsx(FormLabel, {
15
+ label: label,
16
+ htmlFor: field.name,
17
+ required: required
18
+ }),
19
+ /*#__PURE__*/ _jsxs(FieldInputWrap, {
20
+ children: [
21
+ /*#__PURE__*/ _jsx("input", {
22
+ autoComplete: autoComplete,
23
+ type: type,
24
+ id: field.name,
25
+ name: field.name,
26
+ value: field.state.value,
27
+ onChange: (e)=>{
28
+ field.handleChange(e.target.value);
29
+ onValueChange?.(e.target.value);
30
+ },
31
+ onBlur: field.handleBlur,
32
+ required: required,
33
+ className: "text-field"
34
+ }),
35
+ /*#__PURE__*/ _jsx(FieldErrors, {
36
+ meta: meta
37
+ })
38
+ ]
39
+ })
40
+ ]
41
+ });
42
+ }
43
+
44
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uL3NyYy9zaGFyZWQvZm9ybS9maWVsZHMvdGV4dC1maWVsZC50c3giXSwic291cmNlc0NvbnRlbnQiOlsiaW1wb3J0IHsgdXNlU3RvcmUgfSBmcm9tIFwiQHRhbnN0YWNrL3JlYWN0LWZvcm1cIjtcbmltcG9ydCB7IHVzZUZpZWxkQ29udGV4dCB9IGZyb20gXCIuLi9pbmRleFwiO1xuaW1wb3J0IHsgRmllbGRFcnJvcnMsIEZpZWxkSW5wdXRXcmFwLCBGb3JtRmllbGQsIEZvcm1MYWJlbCB9IGZyb20gXCIuLi91aVwiO1xuXG5leHBvcnQgZnVuY3Rpb24gVGV4dEZpZWxkKHtcbiAgY2xhc3NOYW1lLFxuICBsYWJlbCxcbiAgcmVxdWlyZWQgPSBmYWxzZSxcbiAgdHlwZSA9IFwidGV4dFwiLFxuICBhdXRvQ29tcGxldGUgPSBcIm9mZlwiLFxuICBvblZhbHVlQ2hhbmdlXG59OiB7XG4gIGNsYXNzTmFtZTogc3RyaW5nO1xuICBsYWJlbDogc3RyaW5nO1xuICByZXF1aXJlZD86IGJvb2xlYW47XG4gIHR5cGU/OiBzdHJpbmc7XG4gIGF1dG9Db21wbGV0ZT86IHN0cmluZztcbiAgb25WYWx1ZUNoYW5nZT86ICh2YWx1ZTogc3RyaW5nKSA9PiB2b2lkO1xufSkge1xuICBjb25zdCBm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lBRXhELHFCQUNFLE1BQUNoQjtRQUFVaUIsSUFBSVIsTUFBTVMsSUFBSTtRQUFFZixXQUFXQTtRQUFXVSxVQUFVQTs7MEJBQ3pELEtBQUNaO2dCQUFVRyxPQUFPQTtnQkFBT2UsU0FBU1YsTUFBTVMsSUFBSTtnQkFBRWIsVUFBVUE7OzBCQUN4RCxNQUFDTjs7a0NBQ0MsS0FBQ3FCO3dCQUNDYixjQUFjQTt3QkFDZEQsTUFBTUE7d0JBQ05XLElBQUlSLE1BQU1TLElBQUk7d0JBQ2RBLE1BQU1ULE1BQU1TLElBQUk7d0JBQ2hCRyxPQUFPWixNQUFNRyxLQUFLLENBQUNTLEtBQUs7d0JBQ3hCQyxVQUFVLENBQUNDOzRCQUNUZCxNQUFNZSxZQUFZLENBQUNELEVBQUVFLE1BQU0sQ0FBQ0osS0FBSzs0QkFDakNiLGdCQUFnQmUsRUFBRUUsTUFBTSxDQUFDSixLQUFLO3dCQUNoQzt3QkFDQUssUUFBUWpCLE1BQU1rQixVQUFVO3dCQUN4QnRCLFVBQVVBO3dCQUNWRixXQUFVOztrQ0FFWixLQUFDTDt3QkFBWVksTUFBTUE7Ozs7OztBQUkzQiJ9
@@ -0,0 +1,28 @@
1
+ import { TextField } from "./fields/text-field";
2
+ declare const fieldContext: import("react").Context<import("@tanstack/react-form").AnyFieldApi>, formContext: import("react").Context<import("@tanstack/react-form").AnyFormApi>, useFieldContext: <TData>() => import("@tanstack/react-form").FieldApi<any, string, TData, any, any, any, any, any, any, any, any, any, any, any, any, any, any, any, any, any, any, any, any>, useFormContext: () => import("@tanstack/react-form").ReactFormExtendedApi<Record<string, never>, any, any, any, any, any, any, any, any, any, any, any>;
3
+ declare const useAppForm: <TFormData, TOnMount extends import("@tanstack/react-form").FormValidateOrFn<TFormData> | undefined, TOnChange extends import("@tanstack/react-form").FormValidateOrFn<TFormData> | undefined, TOnChangeAsync extends import("@tanstack/react-form").FormAsyncValidateOrFn<TFormData> | undefined, TOnBlur extends import("@tanstack/react-form").FormValidateOrFn<TFormData> | undefined, TOnBlurAsync extends import("@tanstack/react-form").FormAsyncValidateOrFn<TFormData> | undefined, TOnSubmit extends import("@tanstack/react-form").FormValidateOrFn<TFormData> | undefined, TOnSubmitAsync extends import("@tanstack/react-form").FormAsyncValidateOrFn<TFormData> | undefined, TOnDynamic extends import("@tanstack/react-form").FormValidateOrFn<TFormData> | undefined, TOnDynamicAsync extends import("@tanstack/react-form").FormAsyncValidateOrFn<TFormData> | undefined, TOnServer extends import("@tanstack/react-form").FormAsyncValidateOrFn<TFormData> | undefined, TSubmitMeta>(props: import("@tanstack/react-form").FormOptions<TFormData, TOnMount, TOnChange, TOnChangeAsync, TOnBlur, TOnBlurAsync, TOnSubmit, TOnSubmitAsync, TOnDynamic, TOnDynamicAsync, TOnServer, TSubmitMeta>) => import("@tanstack/react-form").AppFieldExtendedReactFormApi<TFormData, TOnMount, TOnChange, TOnChangeAsync, TOnBlur, TOnBlurAsync, TOnSubmit, TOnSubmitAsync, TOnDynamic, TOnDynamicAsync, TOnServer, TSubmitMeta, {
4
+ readonly TextField: typeof TextField;
5
+ }, {
6
+ readonly Submit: import("react").FC<{
7
+ label: string;
8
+ loadingLabel: string;
9
+ }>;
10
+ }>, withForm: <TFormData, TOnMount extends import("@tanstack/react-form").FormValidateOrFn<TFormData> | undefined, TOnChange extends import("@tanstack/react-form").FormValidateOrFn<TFormData> | undefined, TOnChangeAsync extends import("@tanstack/react-form").FormAsyncValidateOrFn<TFormData> | undefined, TOnBlur extends import("@tanstack/react-form").FormValidateOrFn<TFormData> | undefined, TOnBlurAsync extends import("@tanstack/react-form").FormAsyncValidateOrFn<TFormData> | undefined, TOnSubmit extends import("@tanstack/react-form").FormValidateOrFn<TFormData> | undefined, TOnSubmitAsync extends import("@tanstack/react-form").FormAsyncValidateOrFn<TFormData> | undefined, TOnDynamic extends import("@tanstack/react-form").FormValidateOrFn<TFormData> | undefined, TOnDynamicAsync extends import("@tanstack/react-form").FormAsyncValidateOrFn<TFormData> | undefined, TOnServer extends import("@tanstack/react-form").FormAsyncValidateOrFn<TFormData> | undefined, TSubmitMeta, TRenderProps extends object = {}>({ render, props, }: import("@tanstack/react-form").WithFormProps<TFormData, TOnMount, TOnChange, TOnChangeAsync, TOnBlur, TOnBlurAsync, TOnSubmit, TOnSubmitAsync, TOnDynamic, TOnDynamicAsync, TOnServer, TSubmitMeta, {
11
+ readonly TextField: typeof TextField;
12
+ }, {
13
+ readonly Submit: import("react").FC<{
14
+ label: string;
15
+ loadingLabel: string;
16
+ }>;
17
+ }, TRenderProps>) => import("react").FunctionComponent<import("react").PropsWithChildren<NoInfer<[unknown] extends [TRenderProps] ? any : TRenderProps> & {
18
+ form: import("@tanstack/react-form").AppFieldExtendedReactFormApi<[unknown] extends [TFormData] ? any : TFormData, [import("@tanstack/react-form").FormValidateOrFn<TFormData> | undefined] extends [TOnMount] ? [TOnMount] extends [TOnMount & (import("@tanstack/react-form").FormValidateOrFn<TFormData> | undefined)] ? any : TOnMount : TOnMount, [import("@tanstack/react-form").FormValidateOrFn<TFormData> | undefined] extends [TOnChange] ? [TOnChange] extends [TOnChange & (import("@tanstack/react-form").FormValidateOrFn<TFormData> | undefined)] ? any : TOnChange : TOnChange, [import("@tanstack/react-form").FormValidateOrFn<TFormData> | undefined] extends [TOnChangeAsync] ? [TOnChangeAsync] extends [TOnChangeAsync & (import("@tanstack/react-form").FormValidateOrFn<TFormData> | undefined)] ? any : TOnChangeAsync : TOnChangeAsync, [import("@tanstack/react-form").FormValidateOrFn<TFormData> | undefined] extends [TOnBlur] ? [TOnBlur] extends [TOnBlur & (import("@tanstack/react-form").FormValidateOrFn<TFormData> | undefined)] ? any : TOnBlur : TOnBlur, [import("@tanstack/react-form").FormValidateOrFn<TFormData> | undefined] extends [TOnBlurAsync] ? [TOnBlurAsync] extends [TOnBlurAsync & (import("@tanstack/react-form").FormValidateOrFn<TFormData> | undefined)] ? any : TOnBlurAsync : TOnBlurAsync, [import("@tanstack/react-form").FormValidateOrFn<TFormData> | undefined] extends [TOnSubmit] ? [TOnSubmit] extends [TOnSubmit & (import("@tanstack/react-form").FormValidateOrFn<TFormData> | undefined)] ? any : TOnSubmit : TOnSubmit, [import("@tanstack/react-form").FormValidateOrFn<TFormData> | undefined] extends [TOnSubmitAsync] ? [TOnSubmitAsync] extends [TOnSubmitAsync & (import("@tanstack/react-form").FormValidateOrFn<TFormData> | undefined)] ? any : TOnSubmitAsync : TOnSubmitAsync, [import("@tanstack/react-form").FormValidateOrFn<TFormData> | undefined] extends [TOnDynamic] ? [TOnDynamic] extends [TOnDynamic & (import("@tanstack/react-form").FormValidateOrFn<TFormData> | undefined)] ? any : TOnDynamic : TOnDynamic, [import("@tanstack/react-form").FormValidateOrFn<TFormData> | undefined] extends [TOnDynamicAsync] ? [TOnDynamicAsync] extends [TOnDynamicAsync & (import("@tanstack/react-form").FormValidateOrFn<TFormData> | undefined)] ? any : TOnDynamicAsync : TOnDynamicAsync, [import("@tanstack/react-form").FormValidateOrFn<TFormData> | undefined] extends [TOnServer] ? [TOnServer] extends [TOnServer & (import("@tanstack/react-form").FormValidateOrFn<TFormData> | undefined)] ? any : TOnServer : TOnServer, [unknown] extends [TSubmitMeta] ? any : TSubmitMeta, {
19
+ readonly TextField: typeof TextField;
20
+ }, {
21
+ readonly Submit: import("react").FC<{
22
+ label: string;
23
+ loadingLabel: string;
24
+ }>;
25
+ }>;
26
+ }>>;
27
+ export { fieldContext, formContext, useAppForm, useFieldContext, useFormContext, withForm };
28
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/shared/form/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAEhD,QAAA,MAAQ,YAAY,uEAAE,WAAW,sEAAE,eAAe,gLAAE,cAAc,yIACxC,CAAC;AAE3B,QAAA,MAAQ,UAAU;;;;;;;IAAE,QAAQ;;;;;;;;;;;;;;;;GAS1B,CAAC;AAEH,OAAO,EACL,YAAY,EACZ,WAAW,EACX,UAAU,EACV,eAAe,EACf,cAAc,EACd,QAAQ,EACT,CAAC"}
@@ -0,0 +1,17 @@
1
+ import { createFormHook, createFormHookContexts } from "@tanstack/react-form";
2
+ import { Submit } from "./components/submit";
3
+ import { TextField } from "./fields/text-field";
4
+ const { fieldContext, formContext, useFieldContext, useFormContext } = createFormHookContexts();
5
+ const { useAppForm, withForm } = createFormHook({
6
+ fieldContext,
7
+ formContext,
8
+ fieldComponents: {
9
+ TextField
10
+ },
11
+ formComponents: {
12
+ Submit
13
+ }
14
+ });
15
+ export { fieldContext, formContext, useAppForm, useFieldContext, useFormContext, withForm };
16
+
17
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uLy4uL3NyYy9zaGFyZWQvZm9ybS9pbmRleC50cyJdLCJzb3VyY2VzQ29udGVudCI6WyJpbXBvcnQgeyBjcmVhdGVGb3JtSG9vaywgY3JlYXRlRm9ybUhvb2tDb250ZXh0cyB9IGZyb20gXCJAdGFuc3RhY2svcmVhY3QtZm9ybVwiO1xuaW1wb3J0IHsgU3VibWl0IH0gZnJvbSBcIi4vY29tcG9uZW50cy9zdWJtaXRcIjtcbmltcG9ydCB7IFRleHRGaWVsZCB9IGZyb20gXCIuL2ZpZWxkcy90ZXh0LWZpZWxkXCI7XG5cbmNvbnN0IHsgZmllbGRDb250ZXh0LCBmb3JtQ29udGV4dCwgdXNlRmllbGRDb250ZXh0LCB1c2VGb3JtQ29udGV4dCB9ID1cbiAgY3JlYXRlRm9ybUhvb2tDb250ZXh0cygpO1xuXG5jb25zdCB7IHVzZUFwcEZvcm0sIHdpdGhGb3JtIH0gPSBjcmVhdGVGb3JtSG9vayh7XG4gIGZpZWxkQ29udGV4dCxcbiAgZm9ybUNvbnRleHQsXG4gIGZpZWxkQ29tcG9uZW50czoge1xuICAgIFRleHRGaWVsZFxuICB9LFxuICBmb3JtQ29tcG9uZW50czoge1xuICAgIFN1Ym1pdFxuICB9XG59KTtcblxuZXhwb3J0IHtcbiAgZmllbGRDb250ZXh0LFxuICBmb3JtQ29udGV4dCxcbiAgdXNlQXBwRm9ybSxcbiAgdXNlRmllbGRDb250ZXh0LFxuICB1c2VGb3JtQ29udGV4dCxcbiAgd2l0aEZvcm1cbn07XG4iXSwibmFtZXMiOlsiY3JlYXRlRm9ybUhvb2siLCJjcmVhdGVGb3JtSG9va0NvbnRleHRzIiwiU3VibWl0IiwiVGV4dEZpZWxkIiwiZmllbGRDb250ZXh0IiwiZm9ybUNvbnRleHQiLCJ1c2VGaWVsZENvbnRleHQiLCJ1c2VGb3JtQ29udGV4dCIsInVzZUFwcEZvcm0iLCJ3aXRoRm9ybSIsImZpZWxkQ29tcG9uZW50cyIsImZvcm1Db21wb25lbnRzIl0sIm1hcHBpbmdzIjoiQUFBQSxTQUFTQSxjQUFjLEVBQUVDLHNCQUFzQixRQUFRLHVCQUF1QjtBQUM5RSxTQUFTQyxNQUFNLFFBQVEsc0JBQXNCO0FBQzdDLFNBQVNDLFNBQVMsUUFBUSxzQkFBc0I7QUFFaEQsTUFBTSxFQUFFQyxZQUFZLEVBQUVDLFdBQVcsRUFBRUMsZUFBZSxFQUFFQyxjQUFjLEVBQUUsR0FDbEVOO0FBRUYsTUFBTSxFQUFFTyxVQUFVLEVBQUVDLFFBQVEsRUFBRSxHQUFHVCxlQUFlO0lBQzlDSTtJQUNBQztJQUNBSyxpQkFBaUI7UUFDZlA7SUFDRjtJQUNBUSxnQkFBZ0I7UUFDZFQ7SUFDRjtBQUNGO0FBRUEsU0FDRUUsWUFBWSxFQUNaQyxXQUFXLEVBQ1hHLFVBQVUsRUFDVkYsZUFBZSxFQUNmQyxjQUFjLEVBQ2RFLFFBQVEsR0FDUiJ9
@@ -0,0 +1,9 @@
1
+ import React from "react";
2
+ import "./index.scss";
3
+ interface Props extends React.ComponentProps<"div"> {
4
+ description?: React.ReactNode | string;
5
+ heading: string;
6
+ }
7
+ export declare function FormHeader({ description, heading, ...props }: Props): React.JSX.Element | null;
8
+ export {};
9
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/shared/form/ui/header/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,cAAc,CAAC;AAItB,UAAU,KAAM,SAAQ,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC;IACjD,WAAW,CAAC,EAAE,KAAK,CAAC,SAAS,GAAG,MAAM,CAAC;IACvC,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,wBAAgB,UAAU,CAAC,EAAE,WAAW,EAAE,OAAO,EAAE,GAAG,KAAK,EAAE,EAAE,KAAK,4BAWnE"}
@@ -0,0 +1,23 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import React from "react";
3
+ import "./index.scss";
4
+ const baseClass = "form-header";
5
+ export function FormHeader({ description, heading, ...props }) {
6
+ if (!heading) {
7
+ return null;
8
+ }
9
+ return /*#__PURE__*/ _jsxs("div", {
10
+ className: baseClass,
11
+ ...props,
12
+ children: [
13
+ /*#__PURE__*/ _jsx("h1", {
14
+ children: heading
15
+ }),
16
+ Boolean(description) && /*#__PURE__*/ _jsx("p", {
17
+ children: description
18
+ })
19
+ ]
20
+ });
21
+ }
22
+
23
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uLy4uL3NyYy9zaGFyZWQvZm9ybS91aS9oZWFkZXIvaW5kZXgudHN4Il0sInNvdXJjZXNDb250ZW50IjpbImltcG9ydCBSZWFjdCBmcm9tIFwicmVhY3RcIjtcblxuaW1wb3J0IFwiLi9pbmRleC5zY3NzXCI7XG5cbmNvbnN0IGJhc2VDbGFzcyA9IFwiZm9ybS1oZWFkZXJcIjtcblxua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@layer payload-default {
2
+ .form-header {
3
+ display: flex;
4
+ flex-direction: column;
5
+ gap: calc(var(--base) * 0.5);
6
+ margin-bottom: var(--base);
7
+ }
8
+ }
@@ -0,0 +1,34 @@
1
+ import type { AnyFieldMeta } from "@tanstack/react-form";
2
+ import React, { type ReactNode } from "react";
3
+ import "./index.scss";
4
+ interface FormFieldProps extends React.ComponentProps<"div"> {
5
+ hasError?: boolean;
6
+ }
7
+ declare function FormField({ children, hasError, className, ...rest }: FormFieldProps): React.JSX.Element;
8
+ interface FormLabelProps extends React.ComponentProps<"label"> {
9
+ label: ReactNode;
10
+ required?: boolean;
11
+ }
12
+ declare function FormLabel({ label, required, className, ...rest }: FormLabelProps): React.JSX.Element;
13
+ interface FieldErrorsProps {
14
+ meta: AnyFieldMeta;
15
+ className?: string;
16
+ }
17
+ declare function FieldErrors({ meta, className }: FieldErrorsProps): React.JSX.Element | null;
18
+ interface FormErrorProps {
19
+ errors?: string[];
20
+ className?: string;
21
+ }
22
+ declare function FormError({ errors, className }: FormErrorProps): React.JSX.Element | null;
23
+ interface FormProps extends React.ComponentProps<"form"> {
24
+ }
25
+ declare function Form({ children, className, ...rest }: FormProps): React.JSX.Element;
26
+ interface FormInputWrapProps extends React.ComponentProps<"div"> {
27
+ }
28
+ declare function FormInputWrap({ children, className, ...rest }: FormInputWrapProps): React.JSX.Element;
29
+ interface FieldInputWrapProps extends React.ComponentProps<"div"> {
30
+ }
31
+ declare function FieldInputWrap({ children, className, ...rest }: FieldInputWrapProps): React.JSX.Element;
32
+ export { FieldErrors, FieldInputWrap, Form, FormError, FormField, FormInputWrap, FormLabel };
33
+ export type { FormErrorProps, FormFieldProps, FormInputWrapProps, FormLabelProps, FormProps };
34
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/shared/form/ui/index.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAs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AU,mBAAoB,SAAQ,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC;CAAG;AAEpE,iBAAS,cAAc,CAAC,EAAE,QAAQ,EAAE,SAAS,EAAE,GAAG,IAAI,EAAE,EAAE,mBAAmB,qBAM5E;AAED,OAAO,EACL,WAAW,EACX,cAAc,EACd,IAAI,EACJ,SAAS,EACT,SAAS,EACT,aAAa,EACb,SAAS,EACV,CAAC;AAEF,YAAY,EACV,cAAc,EACd,cAAc,EACd,kBAAkB,EAClB,cAAc,EACd,SAAS,EACV,CAAC"}
@@ -0,0 +1,70 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { Tooltip } from "@payloadcms/ui/elements/Tooltip";
3
+ import clsx from "clsx";
4
+ import React from "react";
5
+ import "./index.scss";
6
+ function FormField({ children, hasError, className, ...rest }) {
7
+ return /*#__PURE__*/ _jsx("div", {
8
+ className: clsx("field-type", className, {
9
+ error: hasError
10
+ }),
11
+ ...rest,
12
+ children: children
13
+ });
14
+ }
15
+ function FormLabel({ label, required = false, className, ...rest }) {
16
+ return /*#__PURE__*/ _jsxs("label", {
17
+ className: clsx("field-label", className),
18
+ ...rest,
19
+ children: [
20
+ label,
21
+ required && /*#__PURE__*/ _jsx("span", {
22
+ className: "required",
23
+ children: "*"
24
+ })
25
+ ]
26
+ });
27
+ }
28
+ function FieldErrors({ meta, className }) {
29
+ if (!meta.isTouched) return null;
30
+ const error = meta.errors.at(0)?.message || null;
31
+ return /*#__PURE__*/ _jsx(Tooltip, {
32
+ alignCaret: "right",
33
+ className: clsx("field-error", className),
34
+ show: !!error,
35
+ delay: 0,
36
+ staticPositioning: true,
37
+ children: error
38
+ });
39
+ }
40
+ function FormError({ errors, className }) {
41
+ if (!errors) return null;
42
+ return /*#__PURE__*/ _jsx("div", {
43
+ className: clsx("form-error", className),
44
+ children: errors.join(", ")
45
+ });
46
+ }
47
+ function Form({ children, className, ...rest }) {
48
+ return /*#__PURE__*/ _jsx("form", {
49
+ className: clsx("form", className),
50
+ ...rest,
51
+ children: children
52
+ });
53
+ }
54
+ function FormInputWrap({ children, className, ...rest }) {
55
+ return /*#__PURE__*/ _jsx("div", {
56
+ className: `${className}__inputWrap`,
57
+ ...rest,
58
+ children: children
59
+ });
60
+ }
61
+ function FieldInputWrap({ children, className, ...rest }) {
62
+ return /*#__PURE__*/ _jsx("div", {
63
+ className: clsx("field-type__wrap", className),
64
+ ...rest,
65
+ children: children
66
+ });
67
+ }
68
+ export { FieldErrors, FieldInputWrap, Form, FormError, FormField, FormInputWrap, FormLabel };
69
+
70
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uL3NyYy9zaGFyZWQvZm9ybS91aS9pbmRleC50c3giXSwic291cmNlc0NvbnRlbnQiOlsiaW1wb3J0IHsgVG9vbHRpcCB9IGZyb20gXCJAcGF5bG9hZGNtcy91aS9lbGVtZW50cy9Ub29sdGlwXCI7XG5pbXBvcnQgdHlwZSB7IEFueUZpZWxkTWV0YSB9IGZyb20gXCJAdGFuc3RhY2svcmVhY3QtZm9ybVwiO1xuaW1wb3J0IGNsc3ggZnJvbSBcImNsc3hcIjtcbmltcG9ydCBSZWFjdCwgeyB0eXBlIFJlYWN0Tm9kZSB9IGZyb20gXCJyZWFjdFwiO1xuXG5pbXBvcnQgXCIuL2luZGV4LnNjc3NcIjtcblxuaW50ZXJmYWNlIEZvcm1GaWVsZFByb3BzIGV4dGVuZHMgUmVhY3QuQ29tcG9uZW50UHJvcHM8XCJkaXZcIj4ge1xuICBoYXNFcnJvcj86IGJvb2xlYW47XG59XG5cbmZ1bmN0aW9uIEZvcm1GaWVsZCh7IGNoaWxkcmVuLCBoYXNFcnJvciwgY2xhc3NOYW1lLCAuLi5yZXN0IH06IEZvcm1GaWVsZFByb3BzKSB7XG4gIHJldHVybiAoXG4gICAgPGRpdlxuICAgICAgY2xhc3NOYW1lPXtjbHN4KFwiZmllbGQtdHlw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1JhLE9BQU87UUFDUEMsaUJBQWlCO2tCQUVoQmQ7O0FBR1A7QUFPQSxTQUFTZSxVQUFVLEVBQUVQLE1BQU0sRUFBRVgsU0FBUyxFQUFrQjtJQUN0RCxJQUFJLENBQUNXLFFBQVEsT0FBTztJQUNwQixxQkFDRSxLQUFDVDtRQUFJRixXQUFXTCxLQUFLLGNBQWNLO2tCQUFhVyxPQUFPUSxJQUFJLENBQUM7O0FBRWhFO0FBSUEsU0FBU0MsS0FBSyxFQUFFdEIsUUFBUSxFQUFFRSxTQUFTLEVBQUUsR0FBR0MsTUFBaUI7SUFDdkQscUJBQ0UsS0FBQ29CO1FBQUtyQixXQUFXTCxLQUFLLFFBQVFLO1FBQWEsR0FBR0MsSUFBSTtrQkFDL0NIOztBQUdQO0FBSUEsU0FBU3dCLGNBQWMsRUFBRXhCLFFBQVEsRUFBRUUsU0FBUyxFQUFFLEdBQUdDLE1BQTBCO0lBQ3pFLHFCQUNFLEtBQUNDO1FBQUlGLFdBQVcsR0FBR0EsVUFBVSxXQUFXLENBQUM7UUFBRyxHQUFHQyxJQUFJO2tCQUNoREg7O0FBR1A7QUFJQSxTQUFTeUIsZUFBZSxFQUFFekIsUUFBUSxFQUFFRSxTQUFTLEVBQUUsR0FBR0MsTUFBMkI7SUFDM0UscUJBQ0UsS0FBQ0M7UUFBSUYsV0FBV0wsS0FBSyxvQkFBb0JLO1FBQWEsR0FBR0MsSUFBSTtrQkFDMURIOztBQUdQO0FBRUEsU0FDRVUsV0FBVyxFQUNYZSxjQUFjLEVBQ2RILElBQUksRUFDSkYsU0FBUyxFQUNUckIsU0FBUyxFQUNUeUIsYUFBYSxFQUNibEIsU0FBUyxHQUNUIn0=
@@ -0,0 +1,27 @@
1
+ .field-error {
2
+ display: block;
3
+ }
4
+
5
+ .field-error-message {
6
+ margin-top: 6px;
7
+ color: var(--theme-error-950);
8
+ background-color: var(--theme-error-300);
9
+ border-radius: 2px;
10
+ padding: 4px 8px;
11
+ line-height: 15px;
12
+ }
13
+
14
+ html[data-theme="light"] .form-error {
15
+ background-color: var(--theme-error-200);
16
+ color: black;
17
+ }
18
+
19
+ .form-error {
20
+ display: block;
21
+ color: var(--theme-error-950);
22
+ background-color: var(--theme-error-300);
23
+ color: white;
24
+ border-radius: var(--style-radius-s);
25
+ padding: 10px 15px;
26
+ margin-bottom: 1.2rem;
27
+ }
@@ -0,0 +1,65 @@
1
+ import { z } from "zod";
2
+ /**
3
+ * Minimal translation function type extracted from `i18next`.
4
+ * Accepts a key and returns the translated string.
5
+ */
6
+ export type Translate = (...args: any[]) => string;
7
+ export declare const emailField: ({ t, required }: {
8
+ t: Translate;
9
+ required?: boolean;
10
+ }) => z.ZodString;
11
+ export declare const usernameField: ({ t, required }: {
12
+ t: Translate;
13
+ required?: boolean;
14
+ }) => z.ZodString;
15
+ export declare const passwordField: ({ t, required, minLength }: {
16
+ t: Translate;
17
+ required?: boolean;
18
+ minLength?: number;
19
+ }) => z.ZodString;
20
+ export declare const confirmPasswordField: ({ t, required }: {
21
+ t: Translate;
22
+ required?: boolean;
23
+ }) => z.ZodString;
24
+ /**
25
+ * Returns a Zod object schema with `password` and `confirmPassword` fields
26
+ * and a refinement that ensures they match.
27
+ */
28
+ export declare const passwordWithConfirmation: ({ t, minLength }: {
29
+ t: Translate;
30
+ minLength?: number;
31
+ }) => z.ZodObject<{
32
+ password: z.ZodString;
33
+ confirmPassword: z.ZodString;
34
+ }, z.core.$strip>;
35
+ export declare const isValidEmail: (val: string) => boolean;
36
+ export declare const isValidUsername: (val: string, { minLength, maxLength }?: {
37
+ minLength?: number;
38
+ maxLength?: number;
39
+ }) => boolean;
40
+ type UsernameSettings = {
41
+ minLength: number;
42
+ maxLength: number;
43
+ };
44
+ export declare const createLoginSchema: ({ t, loginType, canLoginWithUsername, usernameSettings }: {
45
+ t: Translate;
46
+ loginType: "email" | "username" | "emailOrUsername";
47
+ canLoginWithUsername?: boolean;
48
+ usernameSettings?: UsernameSettings;
49
+ }) => z.ZodObject<{
50
+ login: z.ZodString;
51
+ password: z.ZodString;
52
+ }, z.core.$strip>;
53
+ export declare const createSignupSchema: ({ t, requireUsername, requireConfirmPassword }: {
54
+ t: Translate;
55
+ requireUsername?: boolean;
56
+ requireConfirmPassword?: boolean;
57
+ }) => z.ZodObject<{
58
+ name: z.ZodString;
59
+ email: z.ZodString;
60
+ username: z.ZodOptional<z.ZodString>;
61
+ password: z.ZodString;
62
+ confirmPassword: z.ZodOptional<z.ZodString>;
63
+ }, z.core.$strip>;
64
+ export {};
65
+ //# sourceMappingURL=validation.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validation.d.ts","sourceRoot":"","sources":["../../../src/shared/form/validation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAQxB;;;GAGG;AACH,MAAM,MAAM,SAAS,GAAG,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,MAAM,CAAC;AAMnD,eAAO,MAAM,UAAU,GAAI,iBAGxB;IACD,CAAC,EAAE,SAAS,CAAC;IACb,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB,gBAMA,CAAC;AAEF,eAAO,MAAM,aAAa,GAAI,iBAG3B;IACD,CAAC,EAAE,SAAS,CAAC;IACb,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB,gBAMA,CAAC;AAEF,eAAO,MAAM,aAAa,GAAI,4BAI3B;IACD,CAAC,EAAE,SAAS,CAAC;IACb,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,gBAQA,CAAC;AAEF,eAAO,MAAM,oBAAoB,GAAI,iBAGlC;IACD,CAAC,EAAE,SAAS,CAAC;IACb,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB,gBAQA,CAAC;AAMF;;;GAGG;AACH,eAAO,MAAM,wBAAwB,GAAI,kBAGtC;IACD,CAAC,EAAE,SAAS,CAAC;IACb,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;;;iBASK,CAAC;AAMP,eAAO,MAAM,YAAY,GAAI,KAAK,MAAM,YAAyB,CAAC;AAClE,eAAO,MAAM,eAAe,GAC1B,KAAK,MAAM,EACX,2BAGG;IAAE,SAAS,CAAC,EAAE,MAAM,CAAC;IAAC,SAAS,CAAC,EAAE,MAAM,CAAA;CAAO,YAE2B,CAAC;AAMhF,KAAK,gBAAgB,GAAG;IAAE,SAAS,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,MAAM,CAAA;CAAE,CAAC;AAEjE,eAAO,MAAM,iBAAiB,GAAI,0DAK/B;IACD,CAAC,EAAE,SAAS,CAAC;IACb,SAAS,EAAE,OAAO,GAAG,UAAU,GAAG,iBAAiB,CAAC;IACpD,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B,gBAAgB,CAAC,EAAE,gBAAgB,CAAC;CACrC;;;iBAgCG,CAAC;AAEL,eAAO,MAAM,kBAAkB,GAAI,gDAIhC;IACD,CAAC,EAAE,SAAS,CAAC;IACb,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,sBAAsB,CAAC,EAAE,OAAO,CAAC;CAClC;;;;;;iBAkBA,CAAC"}
@@ -0,0 +1,108 @@
1
+ import { z } from "zod";
2
+ import { emailRegex, usernameRegex } from "../utils/regex";
3
+ // ---------------------------------------------------------------------------
4
+ // Field builders
5
+ // ---------------------------------------------------------------------------
6
+ export const emailField = ({ t, required = true })=>{
7
+ let schema = z.string();
8
+ if (required) schema = schema.min(1, t("validation:required"));
9
+ return schema.refine((val)=>emailRegex.test(val), {
10
+ message: t("authentication:emailNotValid") || "Email is not valid"
11
+ });
12
+ };
13
+ export const usernameField = ({ t, required = true })=>{
14
+ let schema = z.string();
15
+ if (required) schema = schema.min(1, t("validation:required"));
16
+ return schema.refine((val)=>usernameRegex.test(val), {
17
+ message: t("authentication:usernameNotValid") || "Username is not valid"
18
+ });
19
+ };
20
+ export const passwordField = ({ t, required = true, minLength = 1 })=>{
21
+ let schema = z.string();
22
+ if (required) schema = schema.min(minLength, t("validation:required") || "Password is required");
23
+ return schema;
24
+ };
25
+ export const confirmPasswordField = ({ t, required = true })=>{
26
+ let schema = z.string();
27
+ if (required) schema = schema.min(1, t("validation:required") || "Confirm password is required");
28
+ return schema;
29
+ };
30
+ // ---------------------------------------------------------------------------
31
+ // Composables
32
+ // ---------------------------------------------------------------------------
33
+ /**
34
+ * Returns a Zod object schema with `password` and `confirmPassword` fields
35
+ * and a refinement that ensures they match.
36
+ */ export const passwordWithConfirmation = ({ t, minLength = 1 })=>z.object({
37
+ password: passwordField({
38
+ t,
39
+ minLength
40
+ }),
41
+ confirmPassword: confirmPasswordField({
42
+ t
43
+ })
44
+ }).refine((data)=>data.password === data.confirmPassword, {
45
+ path: [
46
+ "confirmPassword"
47
+ ],
48
+ message: t("fields:passwordsDoNotMatch") || "Passwords do not match"
49
+ });
50
+ // ---------------------------------------------------------------------------
51
+ // Utility validators (non‑Zod) — handy for dynamic login field checks
52
+ // ---------------------------------------------------------------------------
53
+ export const isValidEmail = (val)=>emailRegex.test(val);
54
+ export const isValidUsername = (val, { minLength = 5, maxLength = 128 } = {})=>usernameRegex.test(val) && val.length >= minLength && val.length <= maxLength;
55
+ export const createLoginSchema = ({ t, loginType, canLoginWithUsername = false, usernameSettings = {
56
+ minLength: 5,
57
+ maxLength: 128
58
+ } })=>z.object({
59
+ login: z.string({
60
+ message: t("validation:required")
61
+ }).min(1, {
62
+ message: t("validation:required")
63
+ }).refine((val)=>{
64
+ switch(loginType){
65
+ case "email":
66
+ return isValidEmail(val);
67
+ case "username":
68
+ return isValidUsername(val, usernameSettings);
69
+ default:
70
+ return isValidEmail(val) || isValidUsername(val, usernameSettings);
71
+ }
72
+ }, {
73
+ message: loginType === "email" ? t("authentication:emailNotValid") || "Email is not valid" : loginType === "username" ? t("authentication:usernameNotValid") || "Username is not valid" : !canLoginWithUsername ? t("authentication:emailNotValid") || "Email is not valid" : t("authentication:usernameNotValid") || "Username is not valid"
74
+ }),
75
+ password: passwordField({
76
+ t
77
+ })
78
+ });
79
+ export const createSignupSchema = ({ t, requireUsername = false, requireConfirmPassword = false })=>{
80
+ const schema = z.object({
81
+ name: z.string({
82
+ message: "Name is required"
83
+ }).min(1),
84
+ email: emailField({
85
+ t
86
+ }),
87
+ username: usernameField({
88
+ t,
89
+ required: requireUsername
90
+ }).optional(),
91
+ password: passwordField({
92
+ t
93
+ }),
94
+ confirmPassword: confirmPasswordField({
95
+ t,
96
+ required: requireConfirmPassword
97
+ }).optional()
98
+ });
99
+ if (!requireConfirmPassword) return schema;
100
+ return schema.refine((data)=>data.password === data.confirmPassword, {
101
+ path: [
102
+ "confirmPassword"
103
+ ],
104
+ message: t("fields:passwordsDoNotMatch") || "Passwords do not match"
105
+ });
106
+ };
107
+
108
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uLy4uL3NyYy9zaGFyZWQvZm9ybS92YWxpZGF0aW9uLnRzIl0sInNvdXJjZXNDb250ZW50IjpbImltcG9ydCB7IHogfSBmcm9tIFwiem9kXCI7XG5cbmltcG9ydCB7IGVtYWlsUmVnZXgsIHVzZXJuYW1lUmVnZXggfSBmcm9tIFwiQC9zaGFyZWQvdXRpbHMvcmVnZXhcIjtcblxuLy8gLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tXG4vLyBUeXBlc1xuLy8gLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tXG5cbi8qKlxuICogTWluaW1hbCB0cmFuc2xhdGlvbiBmdW5jdGlvbiB0eXBlIGV4dHJhY3RlZCBmcm9tIGBpMThuZXh0YC5cbiAqIEFjY2VwdHMgYSBrZXkgYW5kIHJldHVybnMg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WjtRQUVKZSxVQUFVTCxjQUFjO1lBQUVWO1FBQUU7SUFDOUIsR0FBRztBQUVMLE9BQU8sTUFBTTRCLHFCQUFxQixDQUFDLEVBQ2pDNUIsQ0FBQyxFQUNENkIsa0JBQWtCLEtBQUssRUFDdkJDLHlCQUF5QixLQUFLLEVBSy9CO0lBQ0MsTUFBTTVCLFNBQVNOLEVBQUVrQixNQUFNLENBQUM7UUFDdEJpQixNQUFNbkMsRUFBRU8sTUFBTSxDQUFDO1lBQUVLLFNBQVM7UUFBbUIsR0FBR0osR0FBRyxDQUFDO1FBQ3BENEIsT0FBT2pDLFdBQVc7WUFBRUM7UUFBRTtRQUN0QmlDLFVBQVV4QixjQUFjO1lBQUVUO1lBQUdDLFVBQVU0QjtRQUFnQixHQUFHSyxRQUFRO1FBQ2xFbkIsVUFBVUwsY0FBYztZQUFFVjtRQUFFO1FBQzVCZ0IsaUJBQWlCSixxQkFBcUI7WUFDcENaO1lBQ0FDLFVBQVU2QjtRQUNaLEdBQUdJLFFBQVE7SUFDYjtJQUVBLElBQUksQ0FBQ0osd0JBQXdCLE9BQU81QjtJQUVwQyxPQUFPQSxPQUFPRyxNQUFNLENBQUMsQ0FBQ1ksT0FBU0EsS0FBS0YsUUFBUSxLQUFLRSxLQUFLRCxlQUFlLEVBQUU7UUFDckVFLE1BQU07WUFBQztTQUFrQjtRQUN6QlYsU0FBU1IsRUFBRSxpQ0FBaUM7SUFDOUM7QUFDRixFQUFFIn0=
@@ -0,0 +1,3 @@
1
+ export * from "./payload/fields/field-copy-button";
2
+ export * from "./payload/fields/generate-uuid-button";
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/shared/index.ts"],"names":[],"mappings":"AAAA,cAAc,oCAAoC,CAAC;AACnD,cAAc,uCAAuC,CAAC"}
@@ -0,0 +1,4 @@
1
+ export * from "./payload/fields/field-copy-button";
2
+ export * from "./payload/fields/generate-uuid-button";
3
+
4
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9zaGFyZWQvaW5kZXgudHMiXSwic291cmNlc0NvbnRlbnQiOlsiZXhwb3J0ICogZnJvbSBcIi4vcGF5bG9hZC9maWVsZHMvZmllbGQtY29weS1idXR0b25cIjtcbmV4cG9ydCAqIGZyb20gXCIuL3BheWxvYWQvZmllbGRzL2dlbmVyYXRlLXV1aWQtYnV0dG9uXCI7XG4iXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsY0FBYyxxQ0FBcUM7QUFDbkQsY0FBYyx3Q0FBd0MifQ==
@@ -0,0 +1,47 @@
1
+ .field-copy-text__button-wrapper {
2
+ position: absolute;
3
+ right: 0;
4
+ top: 0;
5
+ height: 100%;
6
+ }
7
+
8
+ .field-copy-text__button {
9
+ margin-block: 0;
10
+ height: 100%;
11
+ }
12
+
13
+ .field-copy-text__button:focus {
14
+ background-color: transparent;
15
+ }
16
+
17
+ .field-copy-text__tooltip {
18
+ position: absolute;
19
+ bottom: 100%;
20
+ right: 50%;
21
+ transform: translateX(50%) translateY(5px);
22
+ background-color: var(--theme-elevation-800);
23
+ color: var(--theme-elevation-0);
24
+ padding: 2px 8px;
25
+ border-radius: var(--style-radius-m);
26
+ font-size: 13px;
27
+ opacity: 0;
28
+ pointer-events: none;
29
+ transition: all 0.2s ease;
30
+ z-index: 3;
31
+ }
32
+
33
+ .field-copy-text__tooltip[data-visible="true"] {
34
+ opacity: 1;
35
+ transform: translateX(50%) translateY(0);
36
+ }
37
+
38
+ .field-copy-text__tooltip::after {
39
+ content: "";
40
+ position: absolute;
41
+ top: 100%;
42
+ left: 50%;
43
+ transform: translateX(-50%);
44
+ border-left: 6px solid transparent;
45
+ border-right: 6px solid transparent;
46
+ border-top: 6px solid var(--theme-elevation-800);
47
+ }
@@ -0,0 +1,4 @@
1
+ import "./index.css";
2
+ import { TextField } from "@payloadcms/ui";
3
+ export declare const FieldCopyButton: typeof TextField;
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/shared/payload/fields/field-copy-button/index.tsx"],"names":[],"mappings":"AAEA,OAAO,aAAa,CAAC;AAErB,OAAO,EAAoB,SAAS,EAAY,MAAM,gBAAgB,CAAC;AAGvE,eAAO,MAAM,eAAe,EAAE,OAAO,SA0BpC,CAAC"}
@@ -0,0 +1,38 @@
1
+ "use client";
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import "./index.css";
4
+ import { Button, CopyIcon, useField } from "@payloadcms/ui";
5
+ import { useRef, useState } from "react";
6
+ export const FieldCopyButton = ({ path })=>{
7
+ const { value } = useField({
8
+ path
9
+ });
10
+ const [copied, setCopied] = useState(false);
11
+ const buttonRef = useRef(null);
12
+ const handleCopy = ()=>{
13
+ navigator.clipboard.writeText(value);
14
+ setCopied(true);
15
+ setTimeout(()=>{
16
+ setCopied(false);
17
+ }, 2000);
18
+ };
19
+ return /*#__PURE__*/ _jsxs("div", {
20
+ className: "field-copy-text__button-wrapper",
21
+ children: [
22
+ /*#__PURE__*/ _jsx("div", {
23
+ className: "field-copy-text__tooltip",
24
+ "data-visible": copied,
25
+ children: "Copied"
26
+ }),
27
+ /*#__PURE__*/ _jsx(Button, {
28
+ ref: buttonRef,
29
+ icon: /*#__PURE__*/ _jsx(CopyIcon, {}),
30
+ buttonStyle: "transparent",
31
+ onClick: handleCopy,
32
+ className: "field-copy-text__button"
33
+ })
34
+ ]
35
+ });
36
+ };
37
+
38
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uLy4uL3NyYy9zaGFyZWQvcGF5bG9hZC9maWVsZHMvZmllbGQtY29weS1idXR0b24vaW5kZXgudHN4Il0sInNvdXJjZXNDb250ZW50IjpbIlwidXNlIGNsaWVudFwiO1xu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