@cyclone-ui/state 0.0.2

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 (368) hide show
  1. package/LICENSE +187 -0
  2. package/README.md +302 -0
  3. package/dist/base/atoms/atom-with-broadcast.cjs +1 -0
  4. package/dist/base/atoms/atom-with-broadcast.d.cts +13 -0
  5. package/dist/base/atoms/atom-with-broadcast.d.cts.map +1 -0
  6. package/dist/base/atoms/atom-with-broadcast.d.mts +13 -0
  7. package/dist/base/atoms/atom-with-broadcast.d.mts.map +1 -0
  8. package/dist/base/atoms/atom-with-broadcast.mjs +2 -0
  9. package/dist/base/atoms/atom-with-broadcast.mjs.map +1 -0
  10. package/dist/base/atoms/atom-with-compare.cjs +1 -0
  11. package/dist/base/atoms/atom-with-compare.d.cts +5 -0
  12. package/dist/base/atoms/atom-with-compare.d.cts.map +1 -0
  13. package/dist/base/atoms/atom-with-compare.d.mts +5 -0
  14. package/dist/base/atoms/atom-with-compare.d.mts.map +1 -0
  15. package/dist/base/atoms/atom-with-compare.mjs +2 -0
  16. package/dist/base/atoms/atom-with-compare.mjs.map +1 -0
  17. package/dist/base/atoms/atom-with-debounce.cjs +1 -0
  18. package/dist/base/atoms/atom-with-debounce.d.cts +12 -0
  19. package/dist/base/atoms/atom-with-debounce.d.cts.map +1 -0
  20. package/dist/base/atoms/atom-with-debounce.d.mts +12 -0
  21. package/dist/base/atoms/atom-with-debounce.d.mts.map +1 -0
  22. package/dist/base/atoms/atom-with-debounce.mjs +2 -0
  23. package/dist/base/atoms/atom-with-debounce.mjs.map +1 -0
  24. package/dist/base/atoms/atom-with-effect.cjs +1 -0
  25. package/dist/base/atoms/atom-with-effect.d.cts +14 -0
  26. package/dist/base/atoms/atom-with-effect.d.cts.map +1 -0
  27. package/dist/base/atoms/atom-with-effect.d.mts +14 -0
  28. package/dist/base/atoms/atom-with-effect.d.mts.map +1 -0
  29. package/dist/base/atoms/atom-with-effect.mjs +2 -0
  30. package/dist/base/atoms/atom-with-effect.mjs.map +1 -0
  31. package/dist/base/atoms/atom-with-listeners.cjs +1 -0
  32. package/dist/base/atoms/atom-with-listeners.d.cts +13 -0
  33. package/dist/base/atoms/atom-with-listeners.d.cts.map +1 -0
  34. package/dist/base/atoms/atom-with-listeners.d.mts +13 -0
  35. package/dist/base/atoms/atom-with-listeners.d.mts.map +1 -0
  36. package/dist/base/atoms/atom-with-listeners.mjs +2 -0
  37. package/dist/base/atoms/atom-with-listeners.mjs.map +1 -0
  38. package/dist/base/atoms/atom-with-pending.cjs +1 -0
  39. package/dist/base/atoms/atom-with-pending.d.cts +12 -0
  40. package/dist/base/atoms/atom-with-pending.d.cts.map +1 -0
  41. package/dist/base/atoms/atom-with-pending.d.mts +12 -0
  42. package/dist/base/atoms/atom-with-pending.d.mts.map +1 -0
  43. package/dist/base/atoms/atom-with-pending.mjs +2 -0
  44. package/dist/base/atoms/atom-with-pending.mjs.map +1 -0
  45. package/dist/base/atoms/atom-with-refresh-and-default.cjs +1 -0
  46. package/dist/base/atoms/atom-with-refresh-and-default.d.cts +6 -0
  47. package/dist/base/atoms/atom-with-refresh-and-default.d.cts.map +1 -0
  48. package/dist/base/atoms/atom-with-refresh-and-default.d.mts +6 -0
  49. package/dist/base/atoms/atom-with-refresh-and-default.d.mts.map +1 -0
  50. package/dist/base/atoms/atom-with-refresh-and-default.mjs +2 -0
  51. package/dist/base/atoms/atom-with-refresh-and-default.mjs.map +1 -0
  52. package/dist/base/atoms/atom-with-refresh.cjs +1 -0
  53. package/dist/base/atoms/atom-with-refresh.d.cts +6 -0
  54. package/dist/base/atoms/atom-with-refresh.d.cts.map +1 -0
  55. package/dist/base/atoms/atom-with-refresh.d.mts +6 -0
  56. package/dist/base/atoms/atom-with-refresh.d.mts.map +1 -0
  57. package/dist/base/atoms/atom-with-refresh.mjs +2 -0
  58. package/dist/base/atoms/atom-with-refresh.mjs.map +1 -0
  59. package/dist/base/atoms/atom-with-toggle.cjs +1 -0
  60. package/dist/base/atoms/atom-with-toggle.d.cts +6 -0
  61. package/dist/base/atoms/atom-with-toggle.d.cts.map +1 -0
  62. package/dist/base/atoms/atom-with-toggle.d.mts +6 -0
  63. package/dist/base/atoms/atom-with-toggle.d.mts.map +1 -0
  64. package/dist/base/atoms/atom-with-toggle.mjs +2 -0
  65. package/dist/base/atoms/atom-with-toggle.mjs.map +1 -0
  66. package/dist/base/atoms/atom-with-web-storage.cjs +1 -0
  67. package/dist/base/atoms/atom-with-web-storage.d.cts +20 -0
  68. package/dist/base/atoms/atom-with-web-storage.d.cts.map +1 -0
  69. package/dist/base/atoms/atom-with-web-storage.d.mts +20 -0
  70. package/dist/base/atoms/atom-with-web-storage.d.mts.map +1 -0
  71. package/dist/base/atoms/atom-with-web-storage.mjs +2 -0
  72. package/dist/base/atoms/atom-with-web-storage.mjs.map +1 -0
  73. package/dist/base/atoms/atom-with-wrapper.cjs +1 -0
  74. package/dist/base/atoms/atom-with-wrapper.d.cts +18 -0
  75. package/dist/base/atoms/atom-with-wrapper.d.cts.map +1 -0
  76. package/dist/base/atoms/atom-with-wrapper.d.mts +18 -0
  77. package/dist/base/atoms/atom-with-wrapper.d.mts.map +1 -0
  78. package/dist/base/atoms/atom-with-wrapper.mjs +2 -0
  79. package/dist/base/atoms/atom-with-wrapper.mjs.map +1 -0
  80. package/dist/base/atoms/base-atom.cjs +1 -0
  81. package/dist/base/atoms/base-atom.mjs +2 -0
  82. package/dist/base/atoms/base-atom.mjs.map +1 -0
  83. package/dist/base/atoms/index.cjs +1 -0
  84. package/dist/base/atoms/index.d.cts +12 -0
  85. package/dist/base/atoms/index.d.mts +12 -0
  86. package/dist/base/atoms/index.mjs +1 -0
  87. package/dist/base/hooks/index.cjs +1 -0
  88. package/dist/base/hooks/index.d.cts +5 -0
  89. package/dist/base/hooks/index.d.mts +5 -0
  90. package/dist/base/hooks/index.mjs +1 -0
  91. package/dist/base/hooks/use-atom-effect.cjs +1 -0
  92. package/dist/base/hooks/use-atom-effect.d.cts +11 -0
  93. package/dist/base/hooks/use-atom-effect.d.cts.map +1 -0
  94. package/dist/base/hooks/use-atom-effect.d.mts +11 -0
  95. package/dist/base/hooks/use-atom-effect.d.mts.map +1 -0
  96. package/dist/base/hooks/use-atom-effect.mjs +2 -0
  97. package/dist/base/hooks/use-atom-effect.mjs.map +1 -0
  98. package/dist/base/hooks/use-hydrate-molecule.cjs +1 -0
  99. package/dist/base/hooks/use-hydrate-molecule.d.cts +11 -0
  100. package/dist/base/hooks/use-hydrate-molecule.d.cts.map +1 -0
  101. package/dist/base/hooks/use-hydrate-molecule.d.mts +11 -0
  102. package/dist/base/hooks/use-hydrate-molecule.d.mts.map +1 -0
  103. package/dist/base/hooks/use-hydrate-molecule.mjs +2 -0
  104. package/dist/base/hooks/use-hydrate-molecule.mjs.map +1 -0
  105. package/dist/base/hooks/use-prepare-atoms.cjs +1 -0
  106. package/dist/base/hooks/use-prepare-atoms.d.cts +8 -0
  107. package/dist/base/hooks/use-prepare-atoms.d.cts.map +1 -0
  108. package/dist/base/hooks/use-prepare-atoms.d.mts +8 -0
  109. package/dist/base/hooks/use-prepare-atoms.d.mts.map +1 -0
  110. package/dist/base/hooks/use-prepare-atoms.mjs +2 -0
  111. package/dist/base/hooks/use-prepare-atoms.mjs.map +1 -0
  112. package/dist/base/hooks/use-sync-molecule.cjs +1 -0
  113. package/dist/base/hooks/use-sync-molecule.d.cts +10 -0
  114. package/dist/base/hooks/use-sync-molecule.d.cts.map +1 -0
  115. package/dist/base/hooks/use-sync-molecule.d.mts +10 -0
  116. package/dist/base/hooks/use-sync-molecule.d.mts.map +1 -0
  117. package/dist/base/hooks/use-sync-molecule.mjs +2 -0
  118. package/dist/base/hooks/use-sync-molecule.mjs.map +1 -0
  119. package/dist/base/index.cjs +1 -0
  120. package/dist/base/index.d.cts +23 -0
  121. package/dist/base/index.d.mts +23 -0
  122. package/dist/base/index.mjs +1 -0
  123. package/dist/base/utilities/create-molecule.cjs +4 -0
  124. package/dist/base/utilities/create-molecule.d.cts +68 -0
  125. package/dist/base/utilities/create-molecule.d.cts.map +1 -0
  126. package/dist/base/utilities/create-molecule.d.mts +68 -0
  127. package/dist/base/utilities/create-molecule.d.mts.map +1 -0
  128. package/dist/base/utilities/create-molecule.mjs +5 -0
  129. package/dist/base/utilities/create-molecule.mjs.map +1 -0
  130. package/dist/base/utilities/create-web-storage.cjs +1 -0
  131. package/dist/base/utilities/create-web-storage.d.cts +6 -0
  132. package/dist/base/utilities/create-web-storage.d.cts.map +1 -0
  133. package/dist/base/utilities/create-web-storage.d.mts +6 -0
  134. package/dist/base/utilities/create-web-storage.d.mts.map +1 -0
  135. package/dist/base/utilities/create-web-storage.mjs +2 -0
  136. package/dist/base/utilities/create-web-storage.mjs.map +1 -0
  137. package/dist/base/utilities/debounce.cjs +1 -0
  138. package/dist/base/utilities/debounce.d.cts +19 -0
  139. package/dist/base/utilities/debounce.d.cts.map +1 -0
  140. package/dist/base/utilities/debounce.d.mts +19 -0
  141. package/dist/base/utilities/debounce.d.mts.map +1 -0
  142. package/dist/base/utilities/debounce.mjs +2 -0
  143. package/dist/base/utilities/debounce.mjs.map +1 -0
  144. package/dist/base/utilities/index.cjs +1 -0
  145. package/dist/base/utilities/index.d.cts +5 -0
  146. package/dist/base/utilities/index.d.mts +5 -0
  147. package/dist/base/utilities/index.mjs +1 -0
  148. package/dist/base/utilities/is-atom.cjs +1 -0
  149. package/dist/base/utilities/is-atom.mjs +2 -0
  150. package/dist/base/utilities/is-atom.mjs.map +1 -0
  151. package/dist/base/utilities/set-atom-debug.cjs +1 -0
  152. package/dist/base/utilities/set-atom-debug.d.cts +18 -0
  153. package/dist/base/utilities/set-atom-debug.d.cts.map +1 -0
  154. package/dist/base/utilities/set-atom-debug.d.mts +18 -0
  155. package/dist/base/utilities/set-atom-debug.d.mts.map +1 -0
  156. package/dist/base/utilities/set-atom-debug.mjs +2 -0
  157. package/dist/base/utilities/set-atom-debug.mjs.map +1 -0
  158. package/dist/client/index.cjs +1 -0
  159. package/dist/client/index.d.cts +8 -0
  160. package/dist/client/index.d.mts +8 -0
  161. package/dist/client/index.mjs +1 -0
  162. package/dist/form/atoms/atom-with-field.cjs +1 -0
  163. package/dist/form/atoms/atom-with-field.mjs +2 -0
  164. package/dist/form/atoms/atom-with-field.mjs.map +1 -0
  165. package/dist/form/atoms/atom-with-messages.cjs +1 -0
  166. package/dist/form/atoms/atom-with-messages.mjs +2 -0
  167. package/dist/form/atoms/atom-with-messages.mjs.map +1 -0
  168. package/dist/form/hooks/index.cjs +1 -0
  169. package/dist/form/hooks/index.d.cts +4 -0
  170. package/dist/form/hooks/index.d.mts +4 -0
  171. package/dist/form/hooks/index.mjs +1 -0
  172. package/dist/form/hooks/use-field-actions.cjs +1 -0
  173. package/dist/form/hooks/use-field-actions.d.cts +17 -0
  174. package/dist/form/hooks/use-field-actions.d.cts.map +1 -0
  175. package/dist/form/hooks/use-field-actions.d.mts +17 -0
  176. package/dist/form/hooks/use-field-actions.d.mts.map +1 -0
  177. package/dist/form/hooks/use-field-actions.mjs +2 -0
  178. package/dist/form/hooks/use-field-actions.mjs.map +1 -0
  179. package/dist/form/hooks/use-field-ref.cjs +1 -0
  180. package/dist/form/hooks/use-field-ref.d.cts +6 -0
  181. package/dist/form/hooks/use-field-ref.d.cts.map +1 -0
  182. package/dist/form/hooks/use-field-ref.d.mts +6 -0
  183. package/dist/form/hooks/use-field-ref.d.mts.map +1 -0
  184. package/dist/form/hooks/use-field-ref.mjs +2 -0
  185. package/dist/form/hooks/use-field-ref.mjs.map +1 -0
  186. package/dist/form/hooks/use-form-actions.cjs +1 -0
  187. package/dist/form/hooks/use-form-actions.d.cts +13 -0
  188. package/dist/form/hooks/use-form-actions.d.cts.map +1 -0
  189. package/dist/form/hooks/use-form-actions.d.mts +13 -0
  190. package/dist/form/hooks/use-form-actions.d.mts.map +1 -0
  191. package/dist/form/hooks/use-form-actions.mjs +2 -0
  192. package/dist/form/hooks/use-form-actions.mjs.map +1 -0
  193. package/dist/form/index.cjs +1 -0
  194. package/dist/form/index.d.cts +16 -0
  195. package/dist/form/index.d.mts +16 -0
  196. package/dist/form/index.mjs +1 -0
  197. package/dist/form/molecules/field-molecule.cjs +1 -0
  198. package/dist/form/molecules/field-molecule.d.cts +9 -0
  199. package/dist/form/molecules/field-molecule.d.cts.map +1 -0
  200. package/dist/form/molecules/field-molecule.d.mts +9 -0
  201. package/dist/form/molecules/field-molecule.d.mts.map +1 -0
  202. package/dist/form/molecules/field-molecule.mjs +2 -0
  203. package/dist/form/molecules/field-molecule.mjs.map +1 -0
  204. package/dist/form/molecules/form-molecule.cjs +1 -0
  205. package/dist/form/molecules/form-molecule.d.cts +9 -0
  206. package/dist/form/molecules/form-molecule.d.cts.map +1 -0
  207. package/dist/form/molecules/form-molecule.d.mts +9 -0
  208. package/dist/form/molecules/form-molecule.d.mts.map +1 -0
  209. package/dist/form/molecules/form-molecule.mjs +2 -0
  210. package/dist/form/molecules/form-molecule.mjs.map +1 -0
  211. package/dist/form/molecules/index.cjs +1 -0
  212. package/dist/form/molecules/index.d.cts +3 -0
  213. package/dist/form/molecules/index.d.mts +3 -0
  214. package/dist/form/molecules/index.mjs +1 -0
  215. package/dist/form/providers/FieldProvider.cjs +4 -0
  216. package/dist/form/providers/FieldProvider.d.cts +10 -0
  217. package/dist/form/providers/FieldProvider.d.cts.map +1 -0
  218. package/dist/form/providers/FieldProvider.d.mts +10 -0
  219. package/dist/form/providers/FieldProvider.d.mts.map +1 -0
  220. package/dist/form/providers/FieldProvider.mjs +5 -0
  221. package/dist/form/providers/FieldProvider.mjs.map +1 -0
  222. package/dist/form/providers/FormProvider.cjs +4 -0
  223. package/dist/form/providers/FormProvider.d.cts +10 -0
  224. package/dist/form/providers/FormProvider.d.cts.map +1 -0
  225. package/dist/form/providers/FormProvider.d.mts +10 -0
  226. package/dist/form/providers/FormProvider.d.mts.map +1 -0
  227. package/dist/form/providers/FormProvider.mjs +5 -0
  228. package/dist/form/providers/FormProvider.mjs.map +1 -0
  229. package/dist/form/providers/index.cjs +1 -0
  230. package/dist/form/providers/index.d.cts +3 -0
  231. package/dist/form/providers/index.d.mts +3 -0
  232. package/dist/form/providers/index.mjs +1 -0
  233. package/dist/form/types.cjs +1 -0
  234. package/dist/form/types.d.cts +288 -0
  235. package/dist/form/types.d.cts.map +1 -0
  236. package/dist/form/types.d.mts +288 -0
  237. package/dist/form/types.d.mts.map +1 -0
  238. package/dist/form/types.mjs +2 -0
  239. package/dist/form/types.mjs.map +1 -0
  240. package/dist/form/utilities/abort-error.cjs +1 -0
  241. package/dist/form/utilities/abort-error.d.cts +13 -0
  242. package/dist/form/utilities/abort-error.d.cts.map +1 -0
  243. package/dist/form/utilities/abort-error.d.mts +13 -0
  244. package/dist/form/utilities/abort-error.d.mts.map +1 -0
  245. package/dist/form/utilities/abort-error.mjs +2 -0
  246. package/dist/form/utilities/abort-error.mjs.map +1 -0
  247. package/dist/form/utilities/index.cjs +1 -0
  248. package/dist/form/utilities/index.d.cts +4 -0
  249. package/dist/form/utilities/index.d.mts +4 -0
  250. package/dist/form/utilities/index.mjs +1 -0
  251. package/dist/form/utilities/is-validation-results.cjs +1 -0
  252. package/dist/form/utilities/is-validation-results.d.cts +6 -0
  253. package/dist/form/utilities/is-validation-results.d.cts.map +1 -0
  254. package/dist/form/utilities/is-validation-results.d.mts +6 -0
  255. package/dist/form/utilities/is-validation-results.d.mts.map +1 -0
  256. package/dist/form/utilities/is-validation-results.mjs +2 -0
  257. package/dist/form/utilities/is-validation-results.mjs.map +1 -0
  258. package/dist/form/utilities/validators.cjs +1 -0
  259. package/dist/form/utilities/validators.d.cts +6 -0
  260. package/dist/form/utilities/validators.d.cts.map +1 -0
  261. package/dist/form/utilities/validators.d.mts +6 -0
  262. package/dist/form/utilities/validators.d.mts.map +1 -0
  263. package/dist/form/utilities/validators.mjs +2 -0
  264. package/dist/form/utilities/validators.mjs.map +1 -0
  265. package/dist/index.cjs +1 -0
  266. package/dist/index.d.cts +34 -0
  267. package/dist/index.d.mts +34 -0
  268. package/dist/index.mjs +1 -0
  269. package/dist/message/components/MessageViewport.cjs +1 -0
  270. package/dist/message/components/MessageViewport.d.cts +19 -0
  271. package/dist/message/components/MessageViewport.d.cts.map +1 -0
  272. package/dist/message/components/MessageViewport.d.mts +19 -0
  273. package/dist/message/components/MessageViewport.d.mts.map +1 -0
  274. package/dist/message/components/MessageViewport.mjs +2 -0
  275. package/dist/message/components/MessageViewport.mjs.map +1 -0
  276. package/dist/message/components/index.cjs +1 -0
  277. package/dist/message/components/index.d.cts +2 -0
  278. package/dist/message/components/index.d.mts +2 -0
  279. package/dist/message/components/index.mjs +1 -0
  280. package/dist/message/hooks/index.cjs +1 -0
  281. package/dist/message/hooks/index.d.cts +2 -0
  282. package/dist/message/hooks/index.d.mts +2 -0
  283. package/dist/message/hooks/index.mjs +1 -0
  284. package/dist/message/hooks/use-message-actions.cjs +1 -0
  285. package/dist/message/hooks/use-message-actions.d.cts +21 -0
  286. package/dist/message/hooks/use-message-actions.d.cts.map +1 -0
  287. package/dist/message/hooks/use-message-actions.d.mts +21 -0
  288. package/dist/message/hooks/use-message-actions.d.mts.map +1 -0
  289. package/dist/message/hooks/use-message-actions.mjs +2 -0
  290. package/dist/message/hooks/use-message-actions.mjs.map +1 -0
  291. package/dist/message/index.cjs +1 -0
  292. package/dist/message/index.d.cts +9 -0
  293. package/dist/message/index.d.mts +9 -0
  294. package/dist/message/index.mjs +1 -0
  295. package/dist/message/providers/MessageProvider.cjs +1 -0
  296. package/dist/message/providers/MessageProvider.d.cts +21 -0
  297. package/dist/message/providers/MessageProvider.d.cts.map +1 -0
  298. package/dist/message/providers/MessageProvider.d.mts +21 -0
  299. package/dist/message/providers/MessageProvider.d.mts.map +1 -0
  300. package/dist/message/providers/MessageProvider.mjs +2 -0
  301. package/dist/message/providers/MessageProvider.mjs.map +1 -0
  302. package/dist/message/providers/index.d.cts +2 -0
  303. package/dist/message/providers/index.d.mts +2 -0
  304. package/dist/message/types.d.cts +6 -0
  305. package/dist/message/types.d.cts.map +1 -0
  306. package/dist/message/types.d.mts +6 -0
  307. package/dist/message/types.d.mts.map +1 -0
  308. package/dist/theme/hooks/index.cjs +1 -0
  309. package/dist/theme/hooks/index.d.cts +3 -0
  310. package/dist/theme/hooks/index.d.mts +3 -0
  311. package/dist/theme/hooks/index.mjs +1 -0
  312. package/dist/theme/hooks/use-theme-actions.cjs +1 -0
  313. package/dist/theme/hooks/use-theme-actions.d.cts +11 -0
  314. package/dist/theme/hooks/use-theme-actions.d.cts.map +1 -0
  315. package/dist/theme/hooks/use-theme-actions.d.mts +11 -0
  316. package/dist/theme/hooks/use-theme-actions.d.mts.map +1 -0
  317. package/dist/theme/hooks/use-theme-actions.mjs +2 -0
  318. package/dist/theme/hooks/use-theme-actions.mjs.map +1 -0
  319. package/dist/theme/hooks/use-theme-store.cjs +1 -0
  320. package/dist/theme/hooks/use-theme-store.d.cts +49 -0
  321. package/dist/theme/hooks/use-theme-store.d.cts.map +1 -0
  322. package/dist/theme/hooks/use-theme-store.d.mts +49 -0
  323. package/dist/theme/hooks/use-theme-store.d.mts.map +1 -0
  324. package/dist/theme/hooks/use-theme-store.mjs +2 -0
  325. package/dist/theme/hooks/use-theme-store.mjs.map +1 -0
  326. package/dist/theme/index.cjs +1 -0
  327. package/dist/theme/index.d.cts +9 -0
  328. package/dist/theme/index.d.mts +9 -0
  329. package/dist/theme/index.mjs +1 -0
  330. package/dist/theme/molecules/index.cjs +1 -0
  331. package/dist/theme/molecules/index.d.cts +2 -0
  332. package/dist/theme/molecules/index.d.mts +2 -0
  333. package/dist/theme/molecules/index.mjs +1 -0
  334. package/dist/theme/molecules/theme-molecule.cjs +1 -0
  335. package/dist/theme/molecules/theme-molecule.d.cts +14 -0
  336. package/dist/theme/molecules/theme-molecule.d.cts.map +1 -0
  337. package/dist/theme/molecules/theme-molecule.d.mts +14 -0
  338. package/dist/theme/molecules/theme-molecule.d.mts.map +1 -0
  339. package/dist/theme/molecules/theme-molecule.mjs +2 -0
  340. package/dist/theme/molecules/theme-molecule.mjs.map +1 -0
  341. package/dist/theme/providers/ThemeProvider.cjs +5 -0
  342. package/dist/theme/providers/ThemeProvider.d.cts +13 -0
  343. package/dist/theme/providers/ThemeProvider.d.cts.map +1 -0
  344. package/dist/theme/providers/ThemeProvider.d.mts +13 -0
  345. package/dist/theme/providers/ThemeProvider.d.mts.map +1 -0
  346. package/dist/theme/providers/ThemeProvider.mjs +6 -0
  347. package/dist/theme/providers/ThemeProvider.mjs.map +1 -0
  348. package/dist/theme/types.cjs +1 -0
  349. package/dist/theme/types.d.cts +41 -0
  350. package/dist/theme/types.d.cts.map +1 -0
  351. package/dist/theme/types.d.mts +41 -0
  352. package/dist/theme/types.d.mts.map +1 -0
  353. package/dist/theme/types.mjs +2 -0
  354. package/dist/theme/types.mjs.map +1 -0
  355. package/dist/theme/utilities/theme-helpers.cjs +1 -0
  356. package/dist/theme/utilities/theme-helpers.d.cts +55 -0
  357. package/dist/theme/utilities/theme-helpers.d.cts.map +1 -0
  358. package/dist/theme/utilities/theme-helpers.d.mts +55 -0
  359. package/dist/theme/utilities/theme-helpers.d.mts.map +1 -0
  360. package/dist/theme/utilities/theme-helpers.mjs +2 -0
  361. package/dist/theme/utilities/theme-helpers.mjs.map +1 -0
  362. package/dist/types.cjs +0 -0
  363. package/dist/types.d.cts +55 -0
  364. package/dist/types.d.cts.map +1 -0
  365. package/dist/types.d.mts +55 -0
  366. package/dist/types.d.mts.map +1 -0
  367. package/dist/types.mjs +0 -0
  368. package/package.json +146 -0
@@ -0,0 +1,288 @@
1
+ import { AtomRecordConstraint, SetStateActionWithReset, SplitAtomAction } from "../types.cjs";
2
+ import { MoleculeState } from "../base/utilities/create-molecule.cjs";
3
+ import { Atom, Getter, PrimitiveAtom, SetStateAction, Setter, WritableAtom } from "jotai";
4
+ import { RESET } from "jotai/utils";
5
+ import { Ref } from "react";
6
+ import { MaskitoOptions } from "@maskito/core";
7
+ import { MaybePromise } from "@stryke/types/base";
8
+ import { SelectOption, SelectOptionValue } from "@stryke/types/form";
9
+ import { IsPlainObject } from "@stryke/types/object";
10
+ import { ValidationDetail } from "@stryke/types/validations";
11
+ //#region src/form/types.d.ts
12
+ /**
13
+ * "server" is only intended for SSR/SSG validation and should not execute anything
14
+ */
15
+ type ValidationCause = "initialize" | "change" | "blur" | "submit" | "server";
16
+ declare const ValidationCause: {
17
+ INITIALIZE: ValidationCause;
18
+ CHANGE: ValidationCause;
19
+ BLUR: ValidationCause;
20
+ SUBMIT: ValidationCause;
21
+ SERVER: ValidationCause;
22
+ };
23
+ type Validator<TValue = any> = (value: TValue, previousValue: TValue, cause: ValidationCause, get: Getter, set: Setter) => MaybePromise<ValidationDetail[]>;
24
+ type ValidationResults = Partial<Record<ValidationCause, ValidationDetail[]>>;
25
+ /**
26
+ * The field status.
27
+ */
28
+ type FieldStatus = "primary" | "secondary" | "discovery" | "success" | "info" | "warning" | "danger" | "positive" | "negative";
29
+ type InferFieldState<TValues, TState> = IsPlainObject<TValues> extends true ? { [TKey in keyof TValues]: InferFieldState<TValues[TKey], TState>; } : TState;
30
+ type InferFormState<TValues extends Record<string, any>, TState> = { [TKey in keyof TValues]: InferFieldState<TValues[TKey], TState>; };
31
+ type FormValuesState<TValues extends Record<string, any>> = TValues & { [TKey in keyof TValues]: IsPlainObject<TValues[TKey]> extends true ? FormValuesState<TValues[TKey]> : TValues[TKey] | null; };
32
+ type FieldChangeEventHandler<TFieldValue = any> = (event: CustomEvent<TFieldValue>) => any;
33
+ interface CallbackContext<TState extends AtomRecordConstraint<TState> = Record<string, Atom<unknown>>> {
34
+ get: Getter;
35
+ set: Setter;
36
+ atoms: MoleculeState<TState>;
37
+ }
38
+ /**
39
+ * The form options.
40
+ */
41
+ interface FormOptions<TFormValues extends Record<string, any> = Record<string, any>> {
42
+ /**
43
+ * The theme of the form.
44
+ */
45
+ theme?: string;
46
+ /**
47
+ * The disabled state value.
48
+ *
49
+ * @defaultValue false
50
+ */
51
+ disabled?: boolean;
52
+ /**
53
+ * The initial values of the form.
54
+ */
55
+ initialValues?: FormValuesState<TFormValues>;
56
+ /**
57
+ * The validations to run on the form when certain events occur.
58
+ */
59
+ validate?: Record<`on${Capitalize<ValidationCause>}`, Validator<FormValuesState<TFormValues>>[] | undefined>;
60
+ /**
61
+ * How long to debounce the `onChange` event and validation calls in milliseconds.
62
+ *
63
+ * @defaultValue 250
64
+ */
65
+ debounceMs?: number;
66
+ /**
67
+ * A function that compares two sets of form values to determine if they are equal.
68
+ *
69
+ * @remarks
70
+ * The default `isEqual` function is provided by the `@stryke/discoveryers` package.
71
+ *
72
+ * @defaultValue `isEqual`
73
+ */
74
+ isEqual?: (value1: FormValuesState<TFormValues>, value2: FormValuesState<TFormValues>) => boolean;
75
+ /**
76
+ * The default options provided to all fields when they are created.
77
+ */
78
+ defaultFieldOptions?: Partial<Omit<FieldOptions<TFormValues>, "name" | "mode">>;
79
+ /**
80
+ * A callback that is called when the form is initialized.
81
+ */
82
+ onInitialize?: (context: CallbackContext<FormAtoms<TFormValues>>) => MaybePromise<void>;
83
+ /**
84
+ * A callback that is called when the form is changed.
85
+ */
86
+ onChange?: (context: CallbackContext<FormAtoms<TFormValues>>) => MaybePromise<void>;
87
+ /**
88
+ * A callback that is called when the form is submitted.
89
+ */
90
+ onSubmit?: (context: CallbackContext<FormAtoms<TFormValues>>) => MaybePromise<void>;
91
+ }
92
+ type FormOptionsState<TFormValues extends Record<string, any> = Record<string, any>> = FormOptions<TFormValues> & Required<Pick<FormOptions<TFormValues>, "theme" | "debounceMs" | "isEqual" | "disabled" | "initialValues" | "defaultFieldOptions">>;
93
+ interface FormAtoms<TFormValues extends Record<string, any> = Record<string, any>> {
94
+ options: WritableAtom<FormOptionsState<TFormValues>, [SetStateActionWithReset<FormOptions<TFormValues>>], void>;
95
+ name: Atom<string>;
96
+ initialValues: WritableAtom<FormValuesState<TFormValues>, [typeof RESET | SetStateAction<FormValuesState<TFormValues>>], void>;
97
+ previousValues: Atom<FormValuesState<TFormValues>>;
98
+ values: WritableAtom<FormValuesState<TFormValues>, [typeof RESET | SetStateAction<FormValuesState<TFormValues>>], void>;
99
+ disabled: WritableAtom<boolean, [typeof RESET | SetStateAction<boolean>], void>;
100
+ formValidating: WritableAtom<boolean, [SetStateActionWithReset<boolean>], void>;
101
+ validationResults: WritableAtom<ValidationResults, [SetStateActionWithReset<ValidationResults>], void>;
102
+ submitting: WritableAtom<boolean, [SetStateActionWithReset<boolean>], void>;
103
+ submitted: WritableAtom<boolean, [SetStateActionWithReset<boolean>], void>;
104
+ submitAttempts: WritableAtom<number, [SetStateActionWithReset<number>], void>;
105
+ focusedFields: WritableAtom<InferFormState<TFormValues, boolean>, [SetStateActionWithReset<InferFormState<TFormValues, boolean>>], void>;
106
+ requiredFields: WritableAtom<InferFormState<TFormValues, boolean>, [SetStateActionWithReset<InferFormState<TFormValues, boolean>>], void>;
107
+ disabledFields: WritableAtom<InferFormState<TFormValues, boolean>, [SetStateActionWithReset<InferFormState<TFormValues, boolean>>], void>;
108
+ touchedFields: WritableAtom<InferFormState<TFormValues, boolean>, [SetStateActionWithReset<InferFormState<TFormValues, boolean>>], void>;
109
+ blurredFields: WritableAtom<InferFormState<TFormValues, boolean>, [SetStateActionWithReset<InferFormState<TFormValues, boolean>>], void>;
110
+ validatingFields: WritableAtom<InferFormState<TFormValues, boolean>, [SetStateActionWithReset<InferFormState<TFormValues, boolean>>], void>;
111
+ validationResultsFields: WritableAtom<InferFormState<TFormValues, ValidationResults>, [SetStateActionWithReset<InferFormState<TFormValues, ValidationResults>>], void>;
112
+ tabIndexes: WritableAtom<InferFormState<TFormValues, number>, [{
113
+ field: string;
114
+ tabIndex?: number;
115
+ } | SetStateActionWithReset<InferFormState<TFormValues, number>>], void>;
116
+ refs: WritableAtom<InferFormState<TFormValues, Ref<HTMLInputElement>>, [SetStateActionWithReset<InferFormState<TFormValues, Ref<HTMLInputElement>>>], void>;
117
+ dirty: Atom<boolean>;
118
+ pristine: Atom<boolean>;
119
+ blurred: Atom<boolean>;
120
+ touched: Atom<boolean>;
121
+ validating: Atom<boolean>;
122
+ dangerMessages: Atom<ValidationDetail<"danger">[]>;
123
+ warningMessages: Atom<ValidationDetail<"warning">[]>;
124
+ infoMessages: Atom<ValidationDetail<"info">[]>;
125
+ discoveryMessages: Atom<ValidationDetail<"discovery">[]>;
126
+ successMessages: Atom<ValidationDetail<"success">[]>;
127
+ positiveMessages: Atom<ValidationDetail<"positive">[]>;
128
+ negativeMessages: Atom<ValidationDetail<"negative">[]>;
129
+ messages: Atom<ValidationDetail[]>;
130
+ dangerFields: Atom<InferFieldState<TFormValues, ValidationDetail<"danger">[]>>;
131
+ warningFields: Atom<InferFieldState<TFormValues, ValidationDetail<"warning">[]>>;
132
+ infoFields: Atom<InferFieldState<TFormValues, ValidationDetail<"info">[]>>;
133
+ discoveryFields: Atom<InferFieldState<TFormValues, ValidationDetail<"discovery">[]>>;
134
+ successFields: Atom<InferFieldState<TFormValues, ValidationDetail<"success">[]>>;
135
+ fieldDangerMessages: Atom<ValidationDetail<"danger">[]>;
136
+ fieldWarningMessages: Atom<ValidationDetail<"warning">[]>;
137
+ fieldInfoMessages: Atom<ValidationDetail<"info">[]>;
138
+ fieldHelpMessages: Atom<ValidationDetail<"discovery">[]>;
139
+ fieldsSuccessMessages: Atom<ValidationDetail<"success">[]>;
140
+ valid: Atom<boolean>;
141
+ invalid: Atom<boolean>;
142
+ canSubmit: Atom<boolean>;
143
+ theme: Atom<string>;
144
+ }
145
+ /**
146
+ * The field options.
147
+ */
148
+ interface FieldOptions<TFieldValue> {
149
+ /**
150
+ * The default theme of the field.
151
+ */
152
+ theme?: string;
153
+ /**
154
+ * The default size of the field.
155
+ *
156
+ * @defaultValue "$true"
157
+ */
158
+ size?: `$${string}` | `$${string}.${string}` | `$${string}.${number}` | `$${number}`;
159
+ /**
160
+ * The default required status of the field.
161
+ *
162
+ * @defaultValue false
163
+ */
164
+ required?: boolean;
165
+ /**
166
+ * The default disabled status of the field.
167
+ *
168
+ * @defaultValue false
169
+ */
170
+ disabled?: boolean;
171
+ /**
172
+ * Whether the field's value can be cleared by its control.
173
+ *
174
+ * @defaultValue false
175
+ */
176
+ clearable?: boolean;
177
+ /**
178
+ * The options to be used as potential values for the field.
179
+ *
180
+ * @remarks
181
+ * This is only used for certain fields (e.g. `Select`, `RadioGroup`, etc.).
182
+ */
183
+ items?: Array<Partial<SelectOption> & Pick<SelectOption, "name" | "value">>;
184
+ /**
185
+ * The validations to run on the field when certain events occur.
186
+ */
187
+ validate?: Record<`on${Capitalize<ValidationCause>}`, Validator<TFieldValue>[] | undefined>;
188
+ /**
189
+ * How long to debounce the `onChange` event and validation calls in milliseconds.
190
+ *
191
+ * @defaultValue 250
192
+ */
193
+ debounceMs?: number;
194
+ /**
195
+ * A function that compares two field values to determine if they are equal.
196
+ *
197
+ * @remarks
198
+ * The default `isEqual` function is provided by the `@stryke/discoveryers` package.
199
+ *
200
+ * @defaultValue `isEqual`
201
+ */
202
+ isEqual?: (value1: TFieldValue, value2: TFieldValue) => boolean;
203
+ /**
204
+ * The options provided to the Maskito library when masking user input
205
+ *
206
+ * @remarks
207
+ * More information can be found in the [Maskito documentation](https://maskito.dev/core-concepts/overview).
208
+ *
209
+ * API reference: https://github.com/taiga-family/maskito/blob/main/projects/core/src/lib/types/mask-options.ts
210
+ */
211
+ mask?: MaskitoOptions;
212
+ /**
213
+ * A callback that is called when the field is initialized.
214
+ */
215
+ onInitialize?: (context: CallbackContext<FieldAtoms<TFieldValue>>) => MaybePromise<void>;
216
+ /**
217
+ * A callback that is called when the field is blurred.
218
+ */
219
+ onBlur?: (context: CallbackContext<FieldAtoms<TFieldValue>>) => MaybePromise<void>;
220
+ /**
221
+ * A callback that is called when the field is focused.
222
+ */
223
+ onFocus?: (context: CallbackContext<FieldAtoms<TFieldValue>>) => MaybePromise<void>;
224
+ /**
225
+ * A callback that is called when the field is changed.
226
+ */
227
+ onChange?: (context: CallbackContext<FieldAtoms<TFieldValue>>) => MaybePromise<void>;
228
+ /**
229
+ * A callback that is called when the field is submitted.
230
+ */
231
+ onSubmit?: (context: CallbackContext<FieldAtoms<TFieldValue>>) => MaybePromise<void>;
232
+ /**
233
+ * A function that formats the field value for display.
234
+ */
235
+ format?: (value: TFieldValue) => string;
236
+ /**
237
+ * A function that parses the field value for storage.
238
+ */
239
+ parse?: (value: any) => TFieldValue;
240
+ [key: string]: any;
241
+ }
242
+ type FieldOptionsState<TFieldValue = any> = FieldOptions<TFieldValue> & Required<Pick<FieldOptions<TFieldValue>, "theme" | "size" | "debounceMs" | "isEqual" | "disabled" | "clearable" | "required" | "initialValue">>;
243
+ interface FieldAtoms<TFieldValue> {
244
+ options: WritableAtom<FieldOptionsState<TFieldValue>, [SetStateActionWithReset<FieldOptions<TFieldValue>>], void>;
245
+ form: Atom<string>;
246
+ name: Atom<string>;
247
+ path: Atom<string[]>;
248
+ focused: WritableAtom<InferFieldState<TFieldValue, boolean>, [SetStateAction<InferFieldState<TFieldValue, boolean>>], void>;
249
+ required: WritableAtom<InferFieldState<TFieldValue, boolean>, [SetStateAction<InferFieldState<TFieldValue, boolean>>], void>;
250
+ disabled: WritableAtom<InferFieldState<TFieldValue, boolean>, [SetStateAction<InferFieldState<TFieldValue, boolean>>], void>;
251
+ clearable: Atom<boolean>;
252
+ touched: WritableAtom<InferFieldState<TFieldValue, boolean>, [SetStateAction<InferFieldState<TFieldValue, boolean>>], void>;
253
+ blurred: WritableAtom<InferFieldState<TFieldValue, boolean>, [SetStateAction<InferFieldState<TFieldValue, boolean>>], void>;
254
+ validating: WritableAtom<InferFieldState<TFieldValue, boolean>, [SetStateAction<InferFieldState<TFieldValue, boolean>>], void>;
255
+ validationResults: WritableAtom<InferFieldState<TFieldValue, ValidationResults>, [SetStateAction<InferFieldState<TFieldValue, ValidationResults>>], void>;
256
+ tabIndex: WritableAtom<InferFieldState<TFieldValue, number>, [SetStateAction<InferFieldState<TFieldValue, number>>], void>;
257
+ ref: WritableAtom<InferFieldState<TFieldValue, Ref<HTMLInputElement>>, [SetStateAction<InferFieldState<TFieldValue, Ref<HTMLInputElement>>>], void>;
258
+ pristine: Atom<boolean>;
259
+ dirty: Atom<boolean>;
260
+ previousValue: Atom<TFieldValue | null>;
261
+ initialValue: WritableAtom<TFieldValue, [SetStateAction<TFieldValue>], void>;
262
+ value: WritableAtom<TFieldValue, [SetStateAction<TFieldValue>], void>;
263
+ formattedValue: Atom<string>;
264
+ items: WritableAtom<SelectOption<SelectOptionValue, string>[], [SetStateAction<SelectOption<SelectOptionValue, string>[]>], void>;
265
+ itemsAtoms: WritableAtom<PrimitiveAtom<SelectOption<SelectOptionValue, string>>[], [SplitAtomAction<SelectOption<SelectOptionValue, string>>], void>;
266
+ size: WritableAtom<`$${string}` | `$${string}.${string}` | `$${string}.${number}` | `$${number}`, [SetStateAction<`$${string}` | `$${string}.${string}` | `$${string}.${number}` | `$${number}`>], void>;
267
+ errors: Atom<ValidationDetail<"danger">[]>;
268
+ warnings: Atom<ValidationDetail<"warning">[]>;
269
+ info: Atom<ValidationDetail<"info">[]>;
270
+ discovery: Atom<ValidationDetail<"discovery">[]>;
271
+ success: Atom<ValidationDetail<"success">[]>;
272
+ positive: Atom<ValidationDetail<"positive">[]>;
273
+ negative: Atom<ValidationDetail<"negative">[]>;
274
+ dangerMessages: Atom<ValidationDetail<"danger">[]>;
275
+ warningMessages: Atom<ValidationDetail<"warning">[]>;
276
+ infoMessages: Atom<ValidationDetail<"info">[]>;
277
+ discoveryMessages: Atom<ValidationDetail<"discovery">[]>;
278
+ successMessages: Atom<ValidationDetail<"success">[]>;
279
+ positiveMessages: Atom<ValidationDetail<"positive">[]>;
280
+ negativeMessages: Atom<ValidationDetail<"negative">[]>;
281
+ theme: Atom<string>;
282
+ messages: Atom<ValidationDetail[]>;
283
+ invalid: Atom<boolean>;
284
+ valid: Atom<boolean>;
285
+ }
286
+ //#endregion
287
+ export { CallbackContext, FieldAtoms, FieldChangeEventHandler, FieldOptions, FieldOptionsState, FieldStatus, FormAtoms, FormOptions, FormOptionsState, FormValuesState, InferFieldState, InferFormState, ValidationCause, ValidationResults, Validator };
288
+ //# sourceMappingURL=types.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.cts","names":[],"sources":["../../src/form/types.ts"],"mappings":"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"}
@@ -0,0 +1,288 @@
1
+ import { AtomRecordConstraint, SetStateActionWithReset, SplitAtomAction } from "../types.mjs";
2
+ import { MoleculeState } from "../base/utilities/create-molecule.mjs";
3
+ import { RESET } from "jotai/utils";
4
+ import { Atom, Getter, PrimitiveAtom, SetStateAction, Setter, WritableAtom } from "jotai";
5
+ import { Ref } from "react";
6
+ import { MaskitoOptions } from "@maskito/core";
7
+ import { MaybePromise } from "@stryke/types/base";
8
+ import { SelectOption, SelectOptionValue } from "@stryke/types/form";
9
+ import { IsPlainObject } from "@stryke/types/object";
10
+ import { ValidationDetail } from "@stryke/types/validations";
11
+ //#region src/form/types.d.ts
12
+ /**
13
+ * "server" is only intended for SSR/SSG validation and should not execute anything
14
+ */
15
+ type ValidationCause = "initialize" | "change" | "blur" | "submit" | "server";
16
+ declare const ValidationCause: {
17
+ INITIALIZE: ValidationCause;
18
+ CHANGE: ValidationCause;
19
+ BLUR: ValidationCause;
20
+ SUBMIT: ValidationCause;
21
+ SERVER: ValidationCause;
22
+ };
23
+ type Validator<TValue = any> = (value: TValue, previousValue: TValue, cause: ValidationCause, get: Getter, set: Setter) => MaybePromise<ValidationDetail[]>;
24
+ type ValidationResults = Partial<Record<ValidationCause, ValidationDetail[]>>;
25
+ /**
26
+ * The field status.
27
+ */
28
+ type FieldStatus = "primary" | "secondary" | "discovery" | "success" | "info" | "warning" | "danger" | "positive" | "negative";
29
+ type InferFieldState<TValues, TState> = IsPlainObject<TValues> extends true ? { [TKey in keyof TValues]: InferFieldState<TValues[TKey], TState>; } : TState;
30
+ type InferFormState<TValues extends Record<string, any>, TState> = { [TKey in keyof TValues]: InferFieldState<TValues[TKey], TState>; };
31
+ type FormValuesState<TValues extends Record<string, any>> = TValues & { [TKey in keyof TValues]: IsPlainObject<TValues[TKey]> extends true ? FormValuesState<TValues[TKey]> : TValues[TKey] | null; };
32
+ type FieldChangeEventHandler<TFieldValue = any> = (event: CustomEvent<TFieldValue>) => any;
33
+ interface CallbackContext<TState extends AtomRecordConstraint<TState> = Record<string, Atom<unknown>>> {
34
+ get: Getter;
35
+ set: Setter;
36
+ atoms: MoleculeState<TState>;
37
+ }
38
+ /**
39
+ * The form options.
40
+ */
41
+ interface FormOptions<TFormValues extends Record<string, any> = Record<string, any>> {
42
+ /**
43
+ * The theme of the form.
44
+ */
45
+ theme?: string;
46
+ /**
47
+ * The disabled state value.
48
+ *
49
+ * @defaultValue false
50
+ */
51
+ disabled?: boolean;
52
+ /**
53
+ * The initial values of the form.
54
+ */
55
+ initialValues?: FormValuesState<TFormValues>;
56
+ /**
57
+ * The validations to run on the form when certain events occur.
58
+ */
59
+ validate?: Record<`on${Capitalize<ValidationCause>}`, Validator<FormValuesState<TFormValues>>[] | undefined>;
60
+ /**
61
+ * How long to debounce the `onChange` event and validation calls in milliseconds.
62
+ *
63
+ * @defaultValue 250
64
+ */
65
+ debounceMs?: number;
66
+ /**
67
+ * A function that compares two sets of form values to determine if they are equal.
68
+ *
69
+ * @remarks
70
+ * The default `isEqual` function is provided by the `@stryke/discoveryers` package.
71
+ *
72
+ * @defaultValue `isEqual`
73
+ */
74
+ isEqual?: (value1: FormValuesState<TFormValues>, value2: FormValuesState<TFormValues>) => boolean;
75
+ /**
76
+ * The default options provided to all fields when they are created.
77
+ */
78
+ defaultFieldOptions?: Partial<Omit<FieldOptions<TFormValues>, "name" | "mode">>;
79
+ /**
80
+ * A callback that is called when the form is initialized.
81
+ */
82
+ onInitialize?: (context: CallbackContext<FormAtoms<TFormValues>>) => MaybePromise<void>;
83
+ /**
84
+ * A callback that is called when the form is changed.
85
+ */
86
+ onChange?: (context: CallbackContext<FormAtoms<TFormValues>>) => MaybePromise<void>;
87
+ /**
88
+ * A callback that is called when the form is submitted.
89
+ */
90
+ onSubmit?: (context: CallbackContext<FormAtoms<TFormValues>>) => MaybePromise<void>;
91
+ }
92
+ type FormOptionsState<TFormValues extends Record<string, any> = Record<string, any>> = FormOptions<TFormValues> & Required<Pick<FormOptions<TFormValues>, "theme" | "debounceMs" | "isEqual" | "disabled" | "initialValues" | "defaultFieldOptions">>;
93
+ interface FormAtoms<TFormValues extends Record<string, any> = Record<string, any>> {
94
+ options: WritableAtom<FormOptionsState<TFormValues>, [SetStateActionWithReset<FormOptions<TFormValues>>], void>;
95
+ name: Atom<string>;
96
+ initialValues: WritableAtom<FormValuesState<TFormValues>, [typeof RESET | SetStateAction<FormValuesState<TFormValues>>], void>;
97
+ previousValues: Atom<FormValuesState<TFormValues>>;
98
+ values: WritableAtom<FormValuesState<TFormValues>, [typeof RESET | SetStateAction<FormValuesState<TFormValues>>], void>;
99
+ disabled: WritableAtom<boolean, [typeof RESET | SetStateAction<boolean>], void>;
100
+ formValidating: WritableAtom<boolean, [SetStateActionWithReset<boolean>], void>;
101
+ validationResults: WritableAtom<ValidationResults, [SetStateActionWithReset<ValidationResults>], void>;
102
+ submitting: WritableAtom<boolean, [SetStateActionWithReset<boolean>], void>;
103
+ submitted: WritableAtom<boolean, [SetStateActionWithReset<boolean>], void>;
104
+ submitAttempts: WritableAtom<number, [SetStateActionWithReset<number>], void>;
105
+ focusedFields: WritableAtom<InferFormState<TFormValues, boolean>, [SetStateActionWithReset<InferFormState<TFormValues, boolean>>], void>;
106
+ requiredFields: WritableAtom<InferFormState<TFormValues, boolean>, [SetStateActionWithReset<InferFormState<TFormValues, boolean>>], void>;
107
+ disabledFields: WritableAtom<InferFormState<TFormValues, boolean>, [SetStateActionWithReset<InferFormState<TFormValues, boolean>>], void>;
108
+ touchedFields: WritableAtom<InferFormState<TFormValues, boolean>, [SetStateActionWithReset<InferFormState<TFormValues, boolean>>], void>;
109
+ blurredFields: WritableAtom<InferFormState<TFormValues, boolean>, [SetStateActionWithReset<InferFormState<TFormValues, boolean>>], void>;
110
+ validatingFields: WritableAtom<InferFormState<TFormValues, boolean>, [SetStateActionWithReset<InferFormState<TFormValues, boolean>>], void>;
111
+ validationResultsFields: WritableAtom<InferFormState<TFormValues, ValidationResults>, [SetStateActionWithReset<InferFormState<TFormValues, ValidationResults>>], void>;
112
+ tabIndexes: WritableAtom<InferFormState<TFormValues, number>, [{
113
+ field: string;
114
+ tabIndex?: number;
115
+ } | SetStateActionWithReset<InferFormState<TFormValues, number>>], void>;
116
+ refs: WritableAtom<InferFormState<TFormValues, Ref<HTMLInputElement>>, [SetStateActionWithReset<InferFormState<TFormValues, Ref<HTMLInputElement>>>], void>;
117
+ dirty: Atom<boolean>;
118
+ pristine: Atom<boolean>;
119
+ blurred: Atom<boolean>;
120
+ touched: Atom<boolean>;
121
+ validating: Atom<boolean>;
122
+ dangerMessages: Atom<ValidationDetail<"danger">[]>;
123
+ warningMessages: Atom<ValidationDetail<"warning">[]>;
124
+ infoMessages: Atom<ValidationDetail<"info">[]>;
125
+ discoveryMessages: Atom<ValidationDetail<"discovery">[]>;
126
+ successMessages: Atom<ValidationDetail<"success">[]>;
127
+ positiveMessages: Atom<ValidationDetail<"positive">[]>;
128
+ negativeMessages: Atom<ValidationDetail<"negative">[]>;
129
+ messages: Atom<ValidationDetail[]>;
130
+ dangerFields: Atom<InferFieldState<TFormValues, ValidationDetail<"danger">[]>>;
131
+ warningFields: Atom<InferFieldState<TFormValues, ValidationDetail<"warning">[]>>;
132
+ infoFields: Atom<InferFieldState<TFormValues, ValidationDetail<"info">[]>>;
133
+ discoveryFields: Atom<InferFieldState<TFormValues, ValidationDetail<"discovery">[]>>;
134
+ successFields: Atom<InferFieldState<TFormValues, ValidationDetail<"success">[]>>;
135
+ fieldDangerMessages: Atom<ValidationDetail<"danger">[]>;
136
+ fieldWarningMessages: Atom<ValidationDetail<"warning">[]>;
137
+ fieldInfoMessages: Atom<ValidationDetail<"info">[]>;
138
+ fieldHelpMessages: Atom<ValidationDetail<"discovery">[]>;
139
+ fieldsSuccessMessages: Atom<ValidationDetail<"success">[]>;
140
+ valid: Atom<boolean>;
141
+ invalid: Atom<boolean>;
142
+ canSubmit: Atom<boolean>;
143
+ theme: Atom<string>;
144
+ }
145
+ /**
146
+ * The field options.
147
+ */
148
+ interface FieldOptions<TFieldValue> {
149
+ /**
150
+ * The default theme of the field.
151
+ */
152
+ theme?: string;
153
+ /**
154
+ * The default size of the field.
155
+ *
156
+ * @defaultValue "$true"
157
+ */
158
+ size?: `$${string}` | `$${string}.${string}` | `$${string}.${number}` | `$${number}`;
159
+ /**
160
+ * The default required status of the field.
161
+ *
162
+ * @defaultValue false
163
+ */
164
+ required?: boolean;
165
+ /**
166
+ * The default disabled status of the field.
167
+ *
168
+ * @defaultValue false
169
+ */
170
+ disabled?: boolean;
171
+ /**
172
+ * Whether the field's value can be cleared by its control.
173
+ *
174
+ * @defaultValue false
175
+ */
176
+ clearable?: boolean;
177
+ /**
178
+ * The options to be used as potential values for the field.
179
+ *
180
+ * @remarks
181
+ * This is only used for certain fields (e.g. `Select`, `RadioGroup`, etc.).
182
+ */
183
+ items?: Array<Partial<SelectOption> & Pick<SelectOption, "name" | "value">>;
184
+ /**
185
+ * The validations to run on the field when certain events occur.
186
+ */
187
+ validate?: Record<`on${Capitalize<ValidationCause>}`, Validator<TFieldValue>[] | undefined>;
188
+ /**
189
+ * How long to debounce the `onChange` event and validation calls in milliseconds.
190
+ *
191
+ * @defaultValue 250
192
+ */
193
+ debounceMs?: number;
194
+ /**
195
+ * A function that compares two field values to determine if they are equal.
196
+ *
197
+ * @remarks
198
+ * The default `isEqual` function is provided by the `@stryke/discoveryers` package.
199
+ *
200
+ * @defaultValue `isEqual`
201
+ */
202
+ isEqual?: (value1: TFieldValue, value2: TFieldValue) => boolean;
203
+ /**
204
+ * The options provided to the Maskito library when masking user input
205
+ *
206
+ * @remarks
207
+ * More information can be found in the [Maskito documentation](https://maskito.dev/core-concepts/overview).
208
+ *
209
+ * API reference: https://github.com/taiga-family/maskito/blob/main/projects/core/src/lib/types/mask-options.ts
210
+ */
211
+ mask?: MaskitoOptions;
212
+ /**
213
+ * A callback that is called when the field is initialized.
214
+ */
215
+ onInitialize?: (context: CallbackContext<FieldAtoms<TFieldValue>>) => MaybePromise<void>;
216
+ /**
217
+ * A callback that is called when the field is blurred.
218
+ */
219
+ onBlur?: (context: CallbackContext<FieldAtoms<TFieldValue>>) => MaybePromise<void>;
220
+ /**
221
+ * A callback that is called when the field is focused.
222
+ */
223
+ onFocus?: (context: CallbackContext<FieldAtoms<TFieldValue>>) => MaybePromise<void>;
224
+ /**
225
+ * A callback that is called when the field is changed.
226
+ */
227
+ onChange?: (context: CallbackContext<FieldAtoms<TFieldValue>>) => MaybePromise<void>;
228
+ /**
229
+ * A callback that is called when the field is submitted.
230
+ */
231
+ onSubmit?: (context: CallbackContext<FieldAtoms<TFieldValue>>) => MaybePromise<void>;
232
+ /**
233
+ * A function that formats the field value for display.
234
+ */
235
+ format?: (value: TFieldValue) => string;
236
+ /**
237
+ * A function that parses the field value for storage.
238
+ */
239
+ parse?: (value: any) => TFieldValue;
240
+ [key: string]: any;
241
+ }
242
+ type FieldOptionsState<TFieldValue = any> = FieldOptions<TFieldValue> & Required<Pick<FieldOptions<TFieldValue>, "theme" | "size" | "debounceMs" | "isEqual" | "disabled" | "clearable" | "required" | "initialValue">>;
243
+ interface FieldAtoms<TFieldValue> {
244
+ options: WritableAtom<FieldOptionsState<TFieldValue>, [SetStateActionWithReset<FieldOptions<TFieldValue>>], void>;
245
+ form: Atom<string>;
246
+ name: Atom<string>;
247
+ path: Atom<string[]>;
248
+ focused: WritableAtom<InferFieldState<TFieldValue, boolean>, [SetStateAction<InferFieldState<TFieldValue, boolean>>], void>;
249
+ required: WritableAtom<InferFieldState<TFieldValue, boolean>, [SetStateAction<InferFieldState<TFieldValue, boolean>>], void>;
250
+ disabled: WritableAtom<InferFieldState<TFieldValue, boolean>, [SetStateAction<InferFieldState<TFieldValue, boolean>>], void>;
251
+ clearable: Atom<boolean>;
252
+ touched: WritableAtom<InferFieldState<TFieldValue, boolean>, [SetStateAction<InferFieldState<TFieldValue, boolean>>], void>;
253
+ blurred: WritableAtom<InferFieldState<TFieldValue, boolean>, [SetStateAction<InferFieldState<TFieldValue, boolean>>], void>;
254
+ validating: WritableAtom<InferFieldState<TFieldValue, boolean>, [SetStateAction<InferFieldState<TFieldValue, boolean>>], void>;
255
+ validationResults: WritableAtom<InferFieldState<TFieldValue, ValidationResults>, [SetStateAction<InferFieldState<TFieldValue, ValidationResults>>], void>;
256
+ tabIndex: WritableAtom<InferFieldState<TFieldValue, number>, [SetStateAction<InferFieldState<TFieldValue, number>>], void>;
257
+ ref: WritableAtom<InferFieldState<TFieldValue, Ref<HTMLInputElement>>, [SetStateAction<InferFieldState<TFieldValue, Ref<HTMLInputElement>>>], void>;
258
+ pristine: Atom<boolean>;
259
+ dirty: Atom<boolean>;
260
+ previousValue: Atom<TFieldValue | null>;
261
+ initialValue: WritableAtom<TFieldValue, [SetStateAction<TFieldValue>], void>;
262
+ value: WritableAtom<TFieldValue, [SetStateAction<TFieldValue>], void>;
263
+ formattedValue: Atom<string>;
264
+ items: WritableAtom<SelectOption<SelectOptionValue, string>[], [SetStateAction<SelectOption<SelectOptionValue, string>[]>], void>;
265
+ itemsAtoms: WritableAtom<PrimitiveAtom<SelectOption<SelectOptionValue, string>>[], [SplitAtomAction<SelectOption<SelectOptionValue, string>>], void>;
266
+ size: WritableAtom<`$${string}` | `$${string}.${string}` | `$${string}.${number}` | `$${number}`, [SetStateAction<`$${string}` | `$${string}.${string}` | `$${string}.${number}` | `$${number}`>], void>;
267
+ errors: Atom<ValidationDetail<"danger">[]>;
268
+ warnings: Atom<ValidationDetail<"warning">[]>;
269
+ info: Atom<ValidationDetail<"info">[]>;
270
+ discovery: Atom<ValidationDetail<"discovery">[]>;
271
+ success: Atom<ValidationDetail<"success">[]>;
272
+ positive: Atom<ValidationDetail<"positive">[]>;
273
+ negative: Atom<ValidationDetail<"negative">[]>;
274
+ dangerMessages: Atom<ValidationDetail<"danger">[]>;
275
+ warningMessages: Atom<ValidationDetail<"warning">[]>;
276
+ infoMessages: Atom<ValidationDetail<"info">[]>;
277
+ discoveryMessages: Atom<ValidationDetail<"discovery">[]>;
278
+ successMessages: Atom<ValidationDetail<"success">[]>;
279
+ positiveMessages: Atom<ValidationDetail<"positive">[]>;
280
+ negativeMessages: Atom<ValidationDetail<"negative">[]>;
281
+ theme: Atom<string>;
282
+ messages: Atom<ValidationDetail[]>;
283
+ invalid: Atom<boolean>;
284
+ valid: Atom<boolean>;
285
+ }
286
+ //#endregion
287
+ export { CallbackContext, FieldAtoms, FieldChangeEventHandler, FieldOptions, FieldOptionsState, FieldStatus, FormAtoms, FormOptions, FormOptionsState, FormValuesState, InferFieldState, InferFormState, ValidationCause, ValidationResults, Validator };
288
+ //# sourceMappingURL=types.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.mts","names":[],"sources":["../../src/form/types.ts"],"mappings":""}
@@ -0,0 +1,2 @@
1
+ const e={INITIALIZE:`initialize`,CHANGE:`change`,BLUR:`blur`,SUBMIT:`submit`,SERVER:`server`};export{e as ValidationCause};
2
+ //# sourceMappingURL=types.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.mjs","names":[],"sources":[],"mappings":""}
@@ -0,0 +1 @@
1
+ var e=class extends Error{name=`AbortError`;constructor(e=`Aborted`){super(e)}};exports.AbortError=e;
@@ -0,0 +1,13 @@
1
+ //#region src/form/utilities/abort-error.d.ts
2
+ /**
3
+ * Error used to cancel in-flight form validation when a provider unmounts.
4
+ *
5
+ * `@stryke/async` no longer exports `AbortError`.
6
+ */
7
+ declare class AbortError extends Error {
8
+ name: string;
9
+ constructor(message?: string);
10
+ }
11
+ //#endregion
12
+ export { AbortError };
13
+ //# sourceMappingURL=abort-error.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"abort-error.d.cts","names":[],"sources":["../../../src/form/utilities/abort-error.ts"],"mappings":";;;;;;cAuBa,mBAAmB;EACrB;EAEG,YAAA"}
@@ -0,0 +1,13 @@
1
+ //#region src/form/utilities/abort-error.d.ts
2
+ /**
3
+ * Error used to cancel in-flight form validation when a provider unmounts.
4
+ *
5
+ * `@stryke/async` no longer exports `AbortError`.
6
+ */
7
+ declare class AbortError extends Error {
8
+ name: string;
9
+ constructor(message?: string);
10
+ }
11
+ //#endregion
12
+ export { AbortError };
13
+ //# sourceMappingURL=abort-error.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"abort-error.d.mts","names":[],"sources":["../../../src/form/utilities/abort-error.ts"],"mappings":""}
@@ -0,0 +1,2 @@
1
+ var e=class extends Error{name=`AbortError`;constructor(e=`Aborted`){super(e)}};export{e as AbortError};
2
+ //# sourceMappingURL=abort-error.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"abort-error.mjs","names":[],"sources":[],"mappings":""}
@@ -0,0 +1 @@
1
+ const e=require("./is-validation-results.cjs"),t=require("./validators.cjs"),n=require("./abort-error.cjs");exports.AbortError=n.AbortError,exports.isValidationResults=e.isValidationResults,exports.requiredValidator=t.requiredValidator;
@@ -0,0 +1,4 @@
1
+ import { AbortError } from "./abort-error.cjs";
2
+ import { isValidationResults } from "./is-validation-results.cjs";
3
+ import { requiredValidator } from "./validators.cjs";
4
+ export { AbortError, isValidationResults, requiredValidator };