@1money/react-ui 1.15.3 → 1.17.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 (378) hide show
  1. package/AGENTS.md +393 -0
  2. package/es/components/CheckboxGroup/CheckboxGroup.d.ts +3 -3
  3. package/es/components/CheckboxGroup/CheckboxGroup.js +94 -91
  4. package/es/components/CheckboxGroup/interface.d.ts +21 -15
  5. package/es/components/CheckboxGroup/style/CheckboxGroup.scss +0 -7
  6. package/es/components/Flex/Flex.d.ts +5 -0
  7. package/es/components/Flex/Flex.js +50 -0
  8. package/es/components/Flex/constants.d.ts +41 -0
  9. package/es/components/Flex/constants.js +45 -0
  10. package/es/components/Flex/index.d.ts +5 -0
  11. package/es/components/Flex/index.js +6 -0
  12. package/es/components/Flex/interface.d.ts +13 -0
  13. package/es/components/Flex/interface.js +2 -0
  14. package/es/components/Flex/style/Flex.css +1 -0
  15. package/es/components/Flex/style/Flex.scss +70 -0
  16. package/es/components/Flex/style/css.js +2 -0
  17. package/es/components/Flex/style/index.d.ts +1 -0
  18. package/es/components/Flex/style/index.js +2 -0
  19. package/es/components/Form/Form.d.ts +29 -0
  20. package/es/components/Form/Form.js +188 -0
  21. package/es/components/Form/FormItem.d.ts +4 -0
  22. package/es/components/Form/FormItem.js +165 -0
  23. package/es/components/Form/FormItemContent.d.ts +18 -0
  24. package/es/components/Form/FormItemContent.js +146 -0
  25. package/es/components/Form/constants.d.ts +46 -0
  26. package/es/components/Form/constants.js +65 -0
  27. package/es/components/Form/helper.d.ts +120 -0
  28. package/es/components/Form/helper.js +284 -0
  29. package/es/components/Form/index.d.ts +20 -0
  30. package/es/components/Form/index.js +21 -0
  31. package/es/components/Form/interface.d.ts +238 -0
  32. package/es/components/Form/interface.js +2 -0
  33. package/es/components/Form/style/Form.css +1 -0
  34. package/es/components/Form/style/Form.scss +167 -0
  35. package/es/components/Form/style/css.js +2 -0
  36. package/es/components/Form/style/index.d.ts +1 -0
  37. package/es/components/Form/style/index.js +2 -0
  38. package/es/components/Form/useFormItemContext.d.ts +32 -0
  39. package/es/components/Form/useFormItemContext.js +55 -0
  40. package/es/components/Form/useFormItemWatch.d.ts +51 -0
  41. package/es/components/Form/useFormItemWatch.js +69 -0
  42. package/es/components/Form/useValidationTrigger.d.ts +40 -0
  43. package/es/components/Form/useValidationTrigger.js +74 -0
  44. package/es/components/Grid/Col.d.ts +5 -0
  45. package/es/components/Grid/Col.js +97 -0
  46. package/es/components/Grid/Grid.d.ts +12 -0
  47. package/es/components/Grid/Grid.js +12 -0
  48. package/es/components/Grid/Row.d.ts +5 -0
  49. package/es/components/Grid/Row.js +48 -0
  50. package/es/components/Grid/constants.d.ts +55 -0
  51. package/es/components/Grid/constants.js +66 -0
  52. package/es/components/Grid/helper.d.ts +10 -0
  53. package/es/components/Grid/helper.js +44 -0
  54. package/es/components/Grid/index.d.ts +7 -0
  55. package/es/components/Grid/index.js +8 -0
  56. package/es/components/Grid/interface.d.ts +38 -0
  57. package/es/components/Grid/interface.js +2 -0
  58. package/es/components/Grid/style/Grid.css +1 -0
  59. package/es/components/Grid/style/Grid.scss +196 -0
  60. package/es/components/Grid/style/css.js +2 -0
  61. package/es/components/Grid/style/index.d.ts +1 -0
  62. package/es/components/Grid/style/index.js +2 -0
  63. package/es/components/Input/Input.js +72 -74
  64. package/es/components/Input/interface.d.ts +9 -9
  65. package/es/components/InputAmount/InputAmount.js +228 -276
  66. package/es/components/InputAmount/helper.d.ts +46 -0
  67. package/es/components/InputAmount/helper.js +115 -0
  68. package/es/components/InputAmount/style/normal.css +1 -1
  69. package/es/components/InputAmount/style/normal.scss +2 -2
  70. package/es/components/InputAmount/style/primary.css +1 -1
  71. package/es/components/InputAmount/style/primary.scss +2 -2
  72. package/es/components/Message/style/Message.css +1 -1
  73. package/es/components/Message/style/Message.scss +3 -3
  74. package/es/components/ProForm/ProForm.d.ts +33 -0
  75. package/es/components/ProForm/ProForm.js +208 -0
  76. package/es/components/ProForm/ProFormDependency.d.ts +12 -0
  77. package/es/components/ProForm/ProFormDependency.js +61 -0
  78. package/es/components/ProForm/ProFormList.d.ts +19 -0
  79. package/es/components/ProForm/ProFormList.js +348 -0
  80. package/es/components/ProForm/Submitter.d.ts +21 -0
  81. package/es/components/ProForm/Submitter.js +76 -0
  82. package/es/components/ProForm/constants.d.ts +34 -0
  83. package/es/components/ProForm/constants.js +40 -0
  84. package/es/components/ProForm/fields/ProFormCheckbox.d.ts +6 -0
  85. package/es/components/ProForm/fields/ProFormCheckbox.js +11 -0
  86. package/es/components/ProForm/fields/ProFormCheckboxGroup.d.ts +6 -0
  87. package/es/components/ProForm/fields/ProFormCheckboxGroup.js +46 -0
  88. package/es/components/ProForm/fields/ProFormDigit.d.ts +6 -0
  89. package/es/components/ProForm/fields/ProFormDigit.js +15 -0
  90. package/es/components/ProForm/fields/ProFormMoney.d.ts +6 -0
  91. package/es/components/ProForm/fields/ProFormMoney.js +10 -0
  92. package/es/components/ProForm/fields/ProFormMultiSelect.d.ts +6 -0
  93. package/es/components/ProForm/fields/ProFormMultiSelect.js +27 -0
  94. package/es/components/ProForm/fields/ProFormPassword.d.ts +6 -0
  95. package/es/components/ProForm/fields/ProFormPassword.js +16 -0
  96. package/es/components/ProForm/fields/ProFormRadio.d.ts +6 -0
  97. package/es/components/ProForm/fields/ProFormRadio.js +13 -0
  98. package/es/components/ProForm/fields/ProFormSelect.d.ts +6 -0
  99. package/es/components/ProForm/fields/ProFormSelect.js +13 -0
  100. package/es/components/ProForm/fields/ProFormSwitch.d.ts +6 -0
  101. package/es/components/ProForm/fields/ProFormSwitch.js +11 -0
  102. package/es/components/ProForm/fields/ProFormText.d.ts +6 -0
  103. package/es/components/ProForm/fields/ProFormText.js +15 -0
  104. package/es/components/ProForm/fields/ProFormTextArea.d.ts +6 -0
  105. package/es/components/ProForm/fields/ProFormTextArea.js +16 -0
  106. package/es/components/ProForm/fields/createProFormField.d.ts +43 -0
  107. package/es/components/ProForm/fields/createProFormField.js +200 -0
  108. package/es/components/ProForm/fields/index.d.ts +12 -0
  109. package/es/components/ProForm/fields/index.js +13 -0
  110. package/es/components/ProForm/index.d.ts +7 -0
  111. package/es/components/ProForm/index.js +7 -0
  112. package/es/components/ProForm/interface.d.ts +306 -0
  113. package/es/components/ProForm/interface.js +2 -0
  114. package/es/components/ProForm/layouts/DrawerForm.d.ts +16 -0
  115. package/es/components/ProForm/layouts/DrawerForm.js +79 -0
  116. package/es/components/ProForm/layouts/ModalForm.d.ts +16 -0
  117. package/es/components/ProForm/layouts/ModalForm.js +89 -0
  118. package/es/components/ProForm/layouts/QueryFilter.d.ts +21 -0
  119. package/es/components/ProForm/layouts/QueryFilter.js +132 -0
  120. package/es/components/ProForm/layouts/StepsForm.d.ts +13 -0
  121. package/es/components/ProForm/layouts/StepsForm.js +295 -0
  122. package/es/components/ProForm/layouts/index.d.ts +4 -0
  123. package/es/components/ProForm/layouts/index.js +5 -0
  124. package/es/components/ProForm/layouts/useOverlayForm.d.ts +53 -0
  125. package/es/components/ProForm/layouts/useOverlayForm.js +143 -0
  126. package/es/components/ProForm/style/ProForm.module.css +1 -0
  127. package/es/components/ProForm/style/ProForm.module.scss +59 -0
  128. package/es/components/ProForm/style/css.js +3 -0
  129. package/es/components/ProForm/style/index.d.ts +1 -0
  130. package/es/components/ProForm/style/index.js +3 -0
  131. package/es/components/ProForm/utils.d.ts +72 -0
  132. package/es/components/ProForm/utils.js +206 -0
  133. package/es/components/RadioGroup/RadioGroup.js +46 -23
  134. package/es/components/RadioGroup/interface.d.ts +3 -1
  135. package/es/components/Select/Select.d.ts +1 -1
  136. package/es/components/Select/Select.js +113 -106
  137. package/es/components/Select/constants.d.ts +18 -0
  138. package/es/components/Select/constants.js +19 -0
  139. package/es/components/Sidebar/Sidebar.js +21 -23
  140. package/es/components/Sidebar/SidebarLogo.d.ts +7 -0
  141. package/es/components/Sidebar/SidebarLogo.js +33 -0
  142. package/es/components/Sidebar/SimplySidebar.d.ts +2 -2
  143. package/es/components/Sidebar/SimplySidebar.js +18 -22
  144. package/es/components/Sidebar/Stepper.js +14 -14
  145. package/es/components/Sidebar/constants.d.ts +16 -0
  146. package/es/components/Sidebar/constants.js +17 -0
  147. package/es/components/Sidebar/style/Sidebar.css +1 -1
  148. package/es/components/Sidebar/style/Sidebar.scss +1 -1
  149. package/es/components/Sidebar/style/SimplySidebar.css +1 -1
  150. package/es/components/Sidebar/style/SimplySidebar.scss +1 -1
  151. package/es/components/Sidebar/style/Stepper.css +1 -1
  152. package/es/components/Sidebar/style/Stepper.scss +11 -1
  153. package/es/components/Space/Space.d.ts +5 -0
  154. package/es/components/Space/Space.js +71 -0
  155. package/es/components/Space/constants.d.ts +33 -0
  156. package/es/components/Space/constants.js +37 -0
  157. package/es/components/Space/index.d.ts +5 -0
  158. package/es/components/Space/index.js +6 -0
  159. package/es/components/Space/interface.d.ts +12 -0
  160. package/es/components/Space/interface.js +2 -0
  161. package/es/components/Space/style/Space.css +1 -0
  162. package/es/components/Space/style/Space.scss +40 -0
  163. package/es/components/Space/style/css.js +2 -0
  164. package/es/components/Space/style/index.d.ts +1 -0
  165. package/es/components/Space/style/index.js +2 -0
  166. package/es/components/Switch/Switch.js +28 -25
  167. package/es/components/Switch/interface.d.ts +9 -4
  168. package/es/components/useControlledState/index.d.ts +14 -0
  169. package/es/components/useControlledState/index.js +32 -0
  170. package/es/components/useEventCallback/index.d.ts +11 -0
  171. package/es/components/useEventCallback/index.js +17 -0
  172. package/es/components/useLayoutEffect/index.d.ts +11 -0
  173. package/es/components/useLayoutEffect/index.js +17 -0
  174. package/es/components/useLayoutState/index.d.ts +13 -0
  175. package/es/components/useLayoutState/index.js +71 -0
  176. package/es/components/useMemoizedFn/index.d.ts +12 -0
  177. package/es/components/useMemoizedFn/index.js +27 -0
  178. package/es/components/usePrevious/index.d.ts +11 -0
  179. package/es/components/usePrevious/index.js +19 -0
  180. package/es/components/useSafeState/index.d.ts +12 -0
  181. package/es/components/useSafeState/index.js +24 -0
  182. package/es/components/useSyncState/index.d.ts +14 -0
  183. package/es/components/useSyncState/index.js +37 -0
  184. package/es/components/useUpdateEffect/index.d.ts +9 -0
  185. package/es/components/useUpdateEffect/index.js +19 -0
  186. package/es/index.css +1 -1
  187. package/es/index.d.ts +32 -2
  188. package/es/index.js +30 -1
  189. package/jest.setup.d.ts +1 -0
  190. package/jest.setup.ts +1 -0
  191. package/lib/components/CheckboxGroup/CheckboxGroup.d.ts +3 -3
  192. package/lib/components/CheckboxGroup/CheckboxGroup.js +92 -89
  193. package/lib/components/CheckboxGroup/interface.d.ts +21 -15
  194. package/lib/components/CheckboxGroup/style/CheckboxGroup.scss +0 -7
  195. package/lib/components/Flex/Flex.d.ts +5 -0
  196. package/lib/components/Flex/Flex.js +60 -0
  197. package/lib/components/Flex/constants.d.ts +41 -0
  198. package/lib/components/Flex/constants.js +51 -0
  199. package/lib/components/Flex/index.d.ts +5 -0
  200. package/lib/components/Flex/index.js +60 -0
  201. package/lib/components/Flex/interface.d.ts +13 -0
  202. package/lib/components/Flex/interface.js +6 -0
  203. package/lib/components/Flex/style/Flex.css +1 -0
  204. package/lib/components/Flex/style/Flex.scss +70 -0
  205. package/lib/components/Flex/style/css.js +4 -0
  206. package/lib/components/Flex/style/index.d.ts +1 -0
  207. package/lib/components/Flex/style/index.js +4 -0
  208. package/lib/components/Form/Form.d.ts +29 -0
  209. package/lib/components/Form/Form.js +199 -0
  210. package/lib/components/Form/FormItem.d.ts +4 -0
  211. package/lib/components/Form/FormItem.js +176 -0
  212. package/lib/components/Form/FormItemContent.d.ts +18 -0
  213. package/lib/components/Form/FormItemContent.js +156 -0
  214. package/lib/components/Form/constants.d.ts +46 -0
  215. package/lib/components/Form/constants.js +71 -0
  216. package/lib/components/Form/helper.d.ts +120 -0
  217. package/lib/components/Form/helper.js +290 -0
  218. package/lib/components/Form/index.d.ts +20 -0
  219. package/lib/components/Form/index.js +45 -0
  220. package/lib/components/Form/interface.d.ts +238 -0
  221. package/lib/components/Form/interface.js +6 -0
  222. package/lib/components/Form/style/Form.css +1 -0
  223. package/lib/components/Form/style/Form.scss +167 -0
  224. package/lib/components/Form/style/css.js +4 -0
  225. package/lib/components/Form/style/index.d.ts +1 -0
  226. package/lib/components/Form/style/index.js +4 -0
  227. package/lib/components/Form/useFormItemContext.d.ts +32 -0
  228. package/lib/components/Form/useFormItemContext.js +62 -0
  229. package/lib/components/Form/useFormItemWatch.d.ts +51 -0
  230. package/lib/components/Form/useFormItemWatch.js +76 -0
  231. package/lib/components/Form/useValidationTrigger.d.ts +40 -0
  232. package/lib/components/Form/useValidationTrigger.js +81 -0
  233. package/lib/components/Grid/Col.d.ts +5 -0
  234. package/lib/components/Grid/Col.js +107 -0
  235. package/lib/components/Grid/Grid.d.ts +12 -0
  236. package/lib/components/Grid/Grid.js +18 -0
  237. package/lib/components/Grid/Row.d.ts +5 -0
  238. package/lib/components/Grid/Row.js +58 -0
  239. package/lib/components/Grid/constants.d.ts +55 -0
  240. package/lib/components/Grid/constants.js +72 -0
  241. package/lib/components/Grid/helper.d.ts +10 -0
  242. package/lib/components/Grid/helper.js +51 -0
  243. package/lib/components/Grid/index.d.ts +7 -0
  244. package/lib/components/Grid/index.js +62 -0
  245. package/lib/components/Grid/interface.d.ts +38 -0
  246. package/lib/components/Grid/interface.js +6 -0
  247. package/lib/components/Grid/style/Grid.css +1 -0
  248. package/lib/components/Grid/style/Grid.scss +196 -0
  249. package/lib/components/Grid/style/css.js +4 -0
  250. package/lib/components/Grid/style/index.d.ts +1 -0
  251. package/lib/components/Grid/style/index.js +4 -0
  252. package/lib/components/Input/Input.js +71 -73
  253. package/lib/components/Input/interface.d.ts +9 -9
  254. package/lib/components/InputAmount/InputAmount.js +230 -278
  255. package/lib/components/InputAmount/helper.d.ts +46 -0
  256. package/lib/components/InputAmount/helper.js +122 -0
  257. package/lib/components/InputAmount/style/normal.css +1 -1
  258. package/lib/components/InputAmount/style/normal.scss +2 -2
  259. package/lib/components/InputAmount/style/primary.css +1 -1
  260. package/lib/components/InputAmount/style/primary.scss +2 -2
  261. package/lib/components/Message/style/Message.css +1 -1
  262. package/lib/components/Message/style/Message.scss +3 -3
  263. package/lib/components/ProForm/ProForm.d.ts +33 -0
  264. package/lib/components/ProForm/ProForm.js +216 -0
  265. package/lib/components/ProForm/ProFormDependency.d.ts +12 -0
  266. package/lib/components/ProForm/ProFormDependency.js +67 -0
  267. package/lib/components/ProForm/ProFormList.d.ts +19 -0
  268. package/lib/components/ProForm/ProFormList.js +355 -0
  269. package/lib/components/ProForm/Submitter.d.ts +21 -0
  270. package/lib/components/ProForm/Submitter.js +83 -0
  271. package/lib/components/ProForm/constants.d.ts +34 -0
  272. package/lib/components/ProForm/constants.js +46 -0
  273. package/lib/components/ProForm/fields/ProFormCheckbox.d.ts +6 -0
  274. package/lib/components/ProForm/fields/ProFormCheckbox.js +18 -0
  275. package/lib/components/ProForm/fields/ProFormCheckboxGroup.d.ts +6 -0
  276. package/lib/components/ProForm/fields/ProFormCheckboxGroup.js +53 -0
  277. package/lib/components/ProForm/fields/ProFormDigit.d.ts +6 -0
  278. package/lib/components/ProForm/fields/ProFormDigit.js +22 -0
  279. package/lib/components/ProForm/fields/ProFormMoney.d.ts +6 -0
  280. package/lib/components/ProForm/fields/ProFormMoney.js +17 -0
  281. package/lib/components/ProForm/fields/ProFormMultiSelect.d.ts +6 -0
  282. package/lib/components/ProForm/fields/ProFormMultiSelect.js +34 -0
  283. package/lib/components/ProForm/fields/ProFormPassword.d.ts +6 -0
  284. package/lib/components/ProForm/fields/ProFormPassword.js +23 -0
  285. package/lib/components/ProForm/fields/ProFormRadio.d.ts +6 -0
  286. package/lib/components/ProForm/fields/ProFormRadio.js +20 -0
  287. package/lib/components/ProForm/fields/ProFormSelect.d.ts +6 -0
  288. package/lib/components/ProForm/fields/ProFormSelect.js +20 -0
  289. package/lib/components/ProForm/fields/ProFormSwitch.d.ts +6 -0
  290. package/lib/components/ProForm/fields/ProFormSwitch.js +18 -0
  291. package/lib/components/ProForm/fields/ProFormText.d.ts +6 -0
  292. package/lib/components/ProForm/fields/ProFormText.js +22 -0
  293. package/lib/components/ProForm/fields/ProFormTextArea.d.ts +6 -0
  294. package/lib/components/ProForm/fields/ProFormTextArea.js +23 -0
  295. package/lib/components/ProForm/fields/createProFormField.d.ts +43 -0
  296. package/lib/components/ProForm/fields/createProFormField.js +208 -0
  297. package/lib/components/ProForm/fields/index.d.ts +12 -0
  298. package/lib/components/ProForm/fields/index.js +90 -0
  299. package/lib/components/ProForm/index.d.ts +7 -0
  300. package/lib/components/ProForm/index.js +73 -0
  301. package/lib/components/ProForm/interface.d.ts +306 -0
  302. package/lib/components/ProForm/interface.js +6 -0
  303. package/lib/components/ProForm/layouts/DrawerForm.d.ts +16 -0
  304. package/lib/components/ProForm/layouts/DrawerForm.js +86 -0
  305. package/lib/components/ProForm/layouts/ModalForm.d.ts +16 -0
  306. package/lib/components/ProForm/layouts/ModalForm.js +96 -0
  307. package/lib/components/ProForm/layouts/QueryFilter.d.ts +21 -0
  308. package/lib/components/ProForm/layouts/QueryFilter.js +139 -0
  309. package/lib/components/ProForm/layouts/StepsForm.d.ts +13 -0
  310. package/lib/components/ProForm/layouts/StepsForm.js +302 -0
  311. package/lib/components/ProForm/layouts/index.d.ts +4 -0
  312. package/lib/components/ProForm/layouts/index.js +40 -0
  313. package/lib/components/ProForm/layouts/useOverlayForm.d.ts +53 -0
  314. package/lib/components/ProForm/layouts/useOverlayForm.js +150 -0
  315. package/lib/components/ProForm/style/ProForm.module.css +1 -0
  316. package/lib/components/ProForm/style/ProForm.module.scss +59 -0
  317. package/lib/components/ProForm/style/css.js +4 -0
  318. package/lib/components/ProForm/style/index.d.ts +1 -0
  319. package/lib/components/ProForm/style/index.js +4 -0
  320. package/lib/components/ProForm/utils.d.ts +72 -0
  321. package/lib/components/ProForm/utils.js +213 -0
  322. package/lib/components/RadioGroup/RadioGroup.js +45 -22
  323. package/lib/components/RadioGroup/interface.d.ts +3 -1
  324. package/lib/components/Select/Select.d.ts +1 -1
  325. package/lib/components/Select/Select.js +114 -107
  326. package/lib/components/Select/constants.d.ts +18 -0
  327. package/lib/components/Select/constants.js +25 -0
  328. package/lib/components/Sidebar/Sidebar.js +21 -23
  329. package/lib/components/Sidebar/SidebarLogo.d.ts +7 -0
  330. package/lib/components/Sidebar/SidebarLogo.js +39 -0
  331. package/lib/components/Sidebar/SimplySidebar.d.ts +2 -2
  332. package/lib/components/Sidebar/SimplySidebar.js +17 -21
  333. package/lib/components/Sidebar/Stepper.js +14 -14
  334. package/lib/components/Sidebar/constants.d.ts +16 -0
  335. package/lib/components/Sidebar/constants.js +23 -0
  336. package/lib/components/Sidebar/style/Sidebar.css +1 -1
  337. package/lib/components/Sidebar/style/Sidebar.scss +1 -1
  338. package/lib/components/Sidebar/style/SimplySidebar.css +1 -1
  339. package/lib/components/Sidebar/style/SimplySidebar.scss +1 -1
  340. package/lib/components/Sidebar/style/Stepper.css +1 -1
  341. package/lib/components/Sidebar/style/Stepper.scss +11 -1
  342. package/lib/components/Space/Space.d.ts +5 -0
  343. package/lib/components/Space/Space.js +81 -0
  344. package/lib/components/Space/constants.d.ts +33 -0
  345. package/lib/components/Space/constants.js +43 -0
  346. package/lib/components/Space/index.d.ts +5 -0
  347. package/lib/components/Space/index.js +53 -0
  348. package/lib/components/Space/interface.d.ts +12 -0
  349. package/lib/components/Space/interface.js +6 -0
  350. package/lib/components/Space/style/Space.css +1 -0
  351. package/lib/components/Space/style/Space.scss +40 -0
  352. package/lib/components/Space/style/css.js +4 -0
  353. package/lib/components/Space/style/index.d.ts +1 -0
  354. package/lib/components/Space/style/index.js +4 -0
  355. package/lib/components/Switch/Switch.js +27 -24
  356. package/lib/components/Switch/interface.d.ts +9 -4
  357. package/lib/components/useControlledState/index.d.ts +14 -0
  358. package/lib/components/useControlledState/index.js +39 -0
  359. package/lib/components/useEventCallback/index.d.ts +11 -0
  360. package/lib/components/useEventCallback/index.js +24 -0
  361. package/lib/components/useLayoutEffect/index.d.ts +11 -0
  362. package/lib/components/useLayoutEffect/index.js +23 -0
  363. package/lib/components/useLayoutState/index.d.ts +13 -0
  364. package/lib/components/useLayoutState/index.js +79 -0
  365. package/lib/components/useMemoizedFn/index.d.ts +12 -0
  366. package/lib/components/useMemoizedFn/index.js +33 -0
  367. package/lib/components/usePrevious/index.d.ts +11 -0
  368. package/lib/components/usePrevious/index.js +25 -0
  369. package/lib/components/useSafeState/index.d.ts +12 -0
  370. package/lib/components/useSafeState/index.js +31 -0
  371. package/lib/components/useSyncState/index.d.ts +14 -0
  372. package/lib/components/useSyncState/index.js +44 -0
  373. package/lib/components/useUpdateEffect/index.d.ts +9 -0
  374. package/lib/components/useUpdateEffect/index.js +25 -0
  375. package/lib/index.css +1 -1
  376. package/lib/index.d.ts +32 -2
  377. package/lib/index.js +251 -1
  378. package/package.json +31 -1
@@ -0,0 +1,27 @@
1
+ import { useMemo, useRef } from 'react';
2
+ /**
3
+ * A hook that returns a memoized version of a callback function.
4
+ * Unlike `useCallback`, it maintains referential equality across renders
5
+ * without requiring a dependency array, while always calling the latest
6
+ * version of the function.
7
+ *
8
+ * @param fn The function to memoize
9
+ * @returns A memoized function with stable reference
10
+ */
11
+ export default function useMemoizedFn(fn) {
12
+ var fnRef = useRef(fn);
13
+ fnRef.current = useMemo(function () {
14
+ return fn;
15
+ }, [fn]);
16
+ var memoizedFn = useRef(undefined);
17
+ if (!memoizedFn.current) {
18
+ memoizedFn.current = function () {
19
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
20
+ args[_key] = arguments[_key];
21
+ }
22
+ return fnRef.current.apply(this, args);
23
+ };
24
+ }
25
+ return memoizedFn.current;
26
+ }
27
+ //# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImNvbXBvbmVudHMvc3JjL2NvbXBvbmVudHMvdXNlTWVtb2l6ZWRGbi9pbmRleC50cyIsImNvbXBvbmVudHMvdXNlTWVtb2l6ZWRGbi9pbmRleC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1xuICAgIH1cbiAgICByZXR1cm4gbWVtb2l6ZWRGbi5jdXJyZW50O1xufSJdLCJzb3VyY2VSb290IjoiLi4vLi4vLi4vLi4vLi4vLi4vLi4vLi4vLi4vc3JjIn0=
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Returns the last distinct value observed before the current `value`.
3
+ *
4
+ * Because the internal effect depends on `[value]`, the ref is only updated
5
+ * when `value` changes. That means this hook tracks the previous value on
6
+ * value-change boundaries (not every render).
7
+ *
8
+ * @param value The value to track
9
+ * @returns The previous distinct value, or `undefined` until one exists
10
+ */
11
+ export default function usePrevious<T>(value: T): T | undefined;
@@ -0,0 +1,19 @@
1
+ import { useEffect, useRef } from 'react';
2
+ /**
3
+ * Returns the last distinct value observed before the current `value`.
4
+ *
5
+ * Because the internal effect depends on `[value]`, the ref is only updated
6
+ * when `value` changes. That means this hook tracks the previous value on
7
+ * value-change boundaries (not every render).
8
+ *
9
+ * @param value The value to track
10
+ * @returns The previous distinct value, or `undefined` until one exists
11
+ */
12
+ export default function usePrevious(value) {
13
+ var ref = useRef(undefined);
14
+ useEffect(function () {
15
+ ref.current = value;
16
+ }, [value]);
17
+ return ref.current;
18
+ }
19
+ //# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImNvbXBvbmVudHMvc3JjL2NvbXBvbmVudHMvdXNlUHJldmlvdXMvaW5kZXgudHMiLCJjb21wb25lbnRzL3VzZVByZXZpb3VzL2luZGV4LmpzIl0sIm5hbWVzIjpbInVzZUVmZmVjdCIsInVzZVJlZiIsInVzZVByZXZpb3VzIiwidmFsdWUiLCJyZWYiLCJ1bmRlZmluZWQiLCJjdXJyZW50Il0sIm1hcHBpbmdzIjoiQUFBQSxTQUFTQSxTQUFTLEVBQUVDLE1BQU0sUUFBUSxPQUFPO0FBRXpDO0FDQUE7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FERUEsZUFBY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ZWQpO1xuICAgIHVzZUVmZmVjdCgoKSA9PiB7XG4gICAgICAgIHJlZi5jdXJyZW50ID0gdmFsdWU7XG4gICAgfSwgW3ZhbHVlXSk7XG4gICAgcmV0dXJuIHJlZi5jdXJyZW50O1xufSJdLCJzb3VyY2VSb290IjoiLi4vLi4vLi4vLi4vLi4vLi4vLi4vLi4vLi4vc3JjIn0=
@@ -0,0 +1,12 @@
1
+ import { type Dispatch, type SetStateAction } from 'react';
2
+ /**
3
+ * It is exactly the same as `React.useState`, but after the component is unmounted,
4
+ * the setState in the asynchronous callback will no longer be executed to avoid
5
+ * memory leakage caused by updating the state after the component is unmounted.
6
+ *
7
+ * @param initialState The initial state value or initializer function
8
+ * @returns A tuple of [state, setSafeState] similar to useState
9
+ */
10
+ declare function useSafeState<S>(initialState: S | (() => S)): [S, Dispatch<SetStateAction<S>>];
11
+ declare function useSafeState<S = undefined>(): [S | undefined, Dispatch<SetStateAction<S | undefined>>];
12
+ export default useSafeState;
@@ -0,0 +1,24 @@
1
+ import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
2
+ import { useState, useCallback, useRef, useEffect } from 'react';
3
+ // eslint-disable-next-line no-redeclare
4
+ function useSafeState(initialState) {
5
+ var isMountedRef = useRef(true);
6
+ var _useState = useState(initialState),
7
+ _useState2 = _slicedToArray(_useState, 2),
8
+ state = _useState2[0],
9
+ setState = _useState2[1];
10
+ useEffect(function () {
11
+ isMountedRef.current = true;
12
+ return function () {
13
+ isMountedRef.current = false;
14
+ };
15
+ }, []);
16
+ var setSafeState = useCallback(function (value) {
17
+ if (isMountedRef.current) {
18
+ setState(value);
19
+ }
20
+ }, []);
21
+ return [state, setSafeState];
22
+ }
23
+ export default useSafeState;
24
+ //# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImNvbXBvbmVudHMvc3JjL2NvbXBvbmVudHMvdXNlU2FmZVN0YXRlL2luZGV4LnRzIl0sIm5hbWVzIjp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QUFDO0FBQzlCO0FBRUEsZUFBZVQsWUFBWSIsImZpbGUiOiJjb21wb25lbnRzL3VzZVNhZmVTdGF0ZS9pbmRleC5qcyIsInNvdXJjZXNDb250ZW50IjpbbnVsbF0sInNvdXJjZVJvb3QiOiIuLi8uLi8uLi8uLi8uLi8uLi8uLi8uLi8uLi9zcmMifQ==
@@ -0,0 +1,14 @@
1
+ import { type SetStateAction } from 'react';
2
+ type GetState<T> = () => T;
3
+ type SetState<T> = (value: SetStateAction<T>) => void;
4
+ /**
5
+ * Same as `React.useState` but will always get the latest state.
6
+ * This is useful when React merges multiple state updates into one.
7
+ * e.g. `onTransitionEnd` triggers multiple events at once that will be merged
8
+ * into a single state update in React.
9
+ *
10
+ * @param initialState The initial state value or initializer function
11
+ * @returns A tuple of [getState, setState] where getState always returns the latest value
12
+ */
13
+ export default function useSyncState<T>(initialState: T | (() => T)): [GetState<T>, SetState<T>];
14
+ export {};
@@ -0,0 +1,37 @@
1
+ import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
2
+ import { useState, useRef } from 'react';
3
+ import useEventCallback from '../useEventCallback';
4
+ /** Sentinel value distinguishing "not yet initialized" from any valid state, including `null`. */
5
+ var UNINITIALIZED = Symbol('useSyncState.uninitialized');
6
+ /**
7
+ * Same as `React.useState` but will always get the latest state.
8
+ * This is useful when React merges multiple state updates into one.
9
+ * e.g. `onTransitionEnd` triggers multiple events at once that will be merged
10
+ * into a single state update in React.
11
+ *
12
+ * @param initialState The initial state value or initializer function
13
+ * @returns A tuple of [getState, setState] where getState always returns the latest value
14
+ */
15
+ export default function useSyncState(initialState) {
16
+ var stateRef = useRef(UNINITIALIZED);
17
+ // Initialize ref on first render
18
+ if (stateRef.current === UNINITIALIZED) {
19
+ stateRef.current = typeof initialState === 'function' ? initialState() : initialState;
20
+ }
21
+ var _useState = useState({}),
22
+ _useState2 = _slicedToArray(_useState, 2),
23
+ forceUpdate = _useState2[1];
24
+ var getState = useEventCallback(function () {
25
+ return stateRef.current;
26
+ });
27
+ var setState = useEventCallback(function (value) {
28
+ var prevState = stateRef.current;
29
+ var nextState = typeof value === 'function' ? value(prevState) : value;
30
+ if (!Object.is(prevState, nextState)) {
31
+ stateRef.current = nextState;
32
+ forceUpdate({});
33
+ }
34
+ });
35
+ return [getState, setState];
36
+ }
37
+ //# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImNvbXBvbmVudHMvc3JjL2NvbXBvbmVudHMvdXNlU3luY1N0YXRlL2luZGV4LnRzIiwiY29tcG9uZW50cy91c2VTeW5jU3RhdGUvaW5kZXguanMiXSwibmFtZXMiOlsidXNlU3RhdGUiLCJ1c2VSZWYiLCJ1c2VFdmVudENhbGxiYWNrIiwiVU5JTklUSUFMSVpFRCIsIlN5bWJvbCIsInVzZVN5bmNTdGF0ZSIsImluaXRpYWxTdGF0ZSIsInN0YXRlUmVmIiwiY3VycmVudCIsIl91c2VTdGF0ZSIsIl91c2VTdGF0ZTIiLCJfc2xpY2VkVG9BcnJheSIsImZvcmNlVXBkYXRlIiwiZ2V0U3RhdGUiLCJzZXRTdGF0ZSIsInZhbHVlIiwicHJldlN0YXRlIiwibmV4dFN0YXRlIiwiT2JqZWN0IiwiaXMiXSwibWFwcGluZ3MiOiI7QUFBQSxTQUFTQSxRQUFRLEVBQUVDLE1BQU0sUUFBNkIsT0FBTztBQUM3RCxPQUFPQyxnQkFBZ0IsTUFBTSxxQkFBcUI7QUFLbEQ7QUFDQSxJQUFNQyxhQUFhLEdBQUdDLE1BQU0sQ0FBQyw0QkFBNEIsQ0FBQztBQUUxRDtBQ0pBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QURNQSxlQUFjLFNBQVVDLFlBQVlBLENBQUlDLFlBQTJCLEVBQUE7RUFDakUsSUFBTUMsUUFBUSxHQUFHTixNQUFNLENBQTJCRSxhQUFhLENBQUM7RUFFaEU7RUFDQSxJQUFJSSxRQ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JlZi5jdXJyZW50ID09PSBVTklOSVRJQUxJWkVEKSB7XG4gICAgICAgIHN0YXRlUmVmLmN1cnJlbnQgPVxuICAgICAgICAgICAgdHlwZW9mIGluaXRpYWxTdGF0ZSA9PT0gJ2Z1bmN0aW9uJyA/IGluaXRpYWxTdGF0ZSgpIDogaW5pdGlhbFN0YXRlO1xuICAgIH1cbiAgICBjb25zdCBbLCBmb3JjZVVwZGF0ZV0gPSB1c2VTdGF0ZSh7fSk7XG4gICAgY29uc3QgZ2V0U3RhdGUgPSB1c2VFdmVudENhbGxiYWNrKCgpID0+IHN0YXRlUmVmLmN1cnJlbnQpO1xuICAgIGNvbnN0IHNldFN0YXRlID0gdXNlRXZlbnRDYWxsYmFjayh2YWx1ZSA9PiB7XG4gICAgICAgIGNvbnN0IHByZXZTdGF0ZSA9IHN0YXRlUmVmLmN1cnJlbnQ7XG4gICAgICAgIGNvbnN0IG5leHRTdGF0ZSA9IHR5cGVvZiB2YWx1ZSA9PT0gJ2Z1bmN0aW9uJyA/IHZhbHVlKHByZXZTdGF0ZSkgOiB2YWx1ZTtcbiAgICAgICAgaWYgKCFPYmplY3QuaXMocHJldlN0YXRlLCBuZXh0U3RhdGUpKSB7XG4gICAgICAgICAgICBzdGF0ZVJlZi5jdXJyZW50ID0gbmV4dFN0YXRlO1xuICAgICAgICAgICAgZm9yY2VVcGRhdGUoe30pO1xuICAgICAgICB9XG4gICAgfSk7XG4gICAgcmV0dXJuIFtnZXRTdGF0ZSwgc2V0U3RhdGVdO1xufSJdLCJzb3VyY2VSb290IjoiLi4vLi4vLi4vLi4vLi4vLi4vLi4vLi4vLi4vc3JjIn0=
@@ -0,0 +1,9 @@
1
+ import { type DependencyList, type EffectCallback } from 'react';
2
+ /**
3
+ * A hook identical to `useEffect`, but it skips the effect on the initial mount
4
+ * and only runs on subsequent updates.
5
+ *
6
+ * @param effect The effect callback to run on updates
7
+ * @param deps The dependency array
8
+ */
9
+ export default function useUpdateEffect(effect: EffectCallback, deps?: DependencyList): void;
@@ -0,0 +1,19 @@
1
+ import { useEffect, useRef } from 'react';
2
+ /**
3
+ * A hook identical to `useEffect`, but it skips the effect on the initial mount
4
+ * and only runs on subsequent updates.
5
+ *
6
+ * @param effect The effect callback to run on updates
7
+ * @param deps The dependency array
8
+ */
9
+ export default function useUpdateEffect(effect, deps) {
10
+ var isMounted = useRef(false);
11
+ useEffect(function () {
12
+ if (!isMounted.current) {
13
+ isMounted.current = true;
14
+ return;
15
+ }
16
+ return effect();
17
+ }, deps);
18
+ }
19
+ //# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImNvbXBvbmVudHMvc3JjL2NvbXBvbmVudHMvdXNlVXBkYXRlRWZmZWN0L2luZGV4LnRzIiwiY29tcG9uZW50cy91c2VVcGRhdGVFZmZlY3QvaW5kZXguanMiXSwibmFtZXMiOlsidXNlRWZmZWN0IiwidXNlUmVmIiwidXNlVXBkYXRlRWZmZWN0IiwiZWZmZWN0IiwiZGVwcyIsImlzTW91bnRlZCIsImN1cnJlbnQiXSwibWFwcGluZ3MiOiJBQUFBLFNBQVNBLFNBQVMsRUFBRUMsTUFBTSxRQUFrRCxPQUFPO0FBRW5GO0FDQUE7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FERUEsZUFBYyxTQUFVQyxlQUFlQSxDQUFDQyxNQUFzQixFQUFFQyxJQUFxQixFQUFBO0VBQ25GLElBQU1DLFNBQVMsR0FBR0osTUFBTSxDQUFDLEtBQUssQ0FBQztFQUUvQkQsU0FBUyxDQUFDLFlBQUs7SUFDYixJQUFJLENBQUNLLFNBQVMsQ0FBQ0MsT0FBTyxFQUFFO01BQ3RCRCxTQUFTLENBQUNDLE9BQU8sR0FBRyxJQUFJO01BQ3hCO0lBQ0Y7SUFDQSxPQUFPSCxNQUFNLENBQUEsQ0FBRTtFQUNqQixDQUFDLEVBQUVDLElBQUksQ0FBQztBQUNWIiwiZmlsZSI6ImNvbXBv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