haze-ui 1.26.0 → 1.28.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 (479) hide show
  1. package/README.md +420 -36
  2. package/dist/components/Anchor/Anchor.js +78 -0
  3. package/dist/components/Anchor/index.js +3 -0
  4. package/dist/components/AppShell/AppShell.js +44 -0
  5. package/dist/components/AppShell/index.js +3 -0
  6. package/dist/components/AspectRatio/AspectRatio.js +0 -1
  7. package/dist/components/AspectRatio/index.js +0 -1
  8. package/dist/components/Badge/Badge.js +5 -17
  9. package/dist/components/Badge/badge-styles.js +15 -0
  10. package/dist/components/Badge/index.js +3 -3
  11. package/dist/components/BottomSheet/BottomSheet.js +133 -22
  12. package/dist/components/Button/index.js +4 -3
  13. package/dist/components/Calendar/Calendar.js +525 -78
  14. package/dist/components/Calendar/date.js +35 -2
  15. package/dist/components/Card/Card.js +0 -1
  16. package/dist/components/Card/index.js +0 -1
  17. package/dist/components/Carousel/Carousel.js +64 -41
  18. package/dist/components/Cascader/Cascader.js +222 -140
  19. package/dist/components/Chart/Chart.js +34 -0
  20. package/dist/components/Chart/chart-elements.js +164 -0
  21. package/dist/components/Chart/index.js +3 -0
  22. package/dist/components/ChatContainer/ChatContainer.js +36 -16
  23. package/dist/components/ChatInput/ChatInput.js +49 -29
  24. package/dist/components/ChatMessage/ChatMessage.js +76 -29
  25. package/dist/components/Checkbox/Checkbox.js +6 -5
  26. package/dist/components/Checkbox/CheckboxCore.js +6 -5
  27. package/dist/components/CodeBlock/CodeBlock.js +39 -10
  28. package/dist/components/CodeBlock/index.js +0 -1
  29. package/dist/components/Collapsible/Collapsible.js +23 -10
  30. package/dist/components/ColorPicker/ColorPicker.js +5 -4
  31. package/dist/components/ColorPicker/ColorPickerCore.js +5 -4
  32. package/dist/components/Combobox/Combobox.js +202 -75
  33. package/dist/components/Combobox/ComboboxGroup.js +23 -0
  34. package/dist/components/Combobox/ComboboxOption.js +7 -6
  35. package/dist/components/Combobox/index.js +4 -3
  36. package/dist/components/Command/Command.js +102 -59
  37. package/dist/components/Command/CommandDialog.js +48 -0
  38. package/dist/components/Command/command-filter.js +16 -0
  39. package/dist/components/Command/index.js +3 -2
  40. package/dist/components/ConfirmDialog/ConfirmDialog.js +3 -3
  41. package/dist/components/Container/Container.js +0 -1
  42. package/dist/components/Container/index.js +0 -1
  43. package/dist/components/ContextMenu/ContextMenuContent.js +4 -4
  44. package/dist/components/DataTable/CellEditor.js +38 -0
  45. package/dist/components/DataTable/DataTable.js +394 -143
  46. package/dist/components/DataTable/csv.js +29 -0
  47. package/dist/components/DataTable/features.js +25 -0
  48. package/dist/components/DataTable/index.js +3 -1
  49. package/dist/components/DataTable/summary.js +17 -0
  50. package/dist/components/DateRangePicker/DateRangePicker.js +31 -13
  51. package/dist/components/DateRangePicker/DateRangePickerCore.js +59 -27
  52. package/dist/components/DateRangePicker/presets.js +43 -0
  53. package/dist/components/Datepicker/Datepicker.js +17 -12
  54. package/dist/components/Datepicker/DatepickerCore.js +73 -39
  55. package/dist/components/Datepicker/datetime.js +23 -0
  56. package/dist/components/Descriptions/Descriptions.js +46 -0
  57. package/dist/components/Descriptions/index.js +3 -0
  58. package/dist/components/Dialog/Dialog.js +56 -32
  59. package/dist/components/DiffViewer/DiffViewer.js +31 -30
  60. package/dist/components/Divider/Divider.js +0 -1
  61. package/dist/components/Divider/index.js +0 -1
  62. package/dist/components/Drawer/Drawer.js +49 -29
  63. package/dist/components/DropdownMenu/DropdownMenu.js +38 -26
  64. package/dist/components/DropdownMenu/DropdownMenuSub.js +23 -0
  65. package/dist/components/DropdownMenu/DropdownMenuSubContent.js +24 -0
  66. package/dist/components/DropdownMenu/DropdownMenuSubTrigger.js +30 -0
  67. package/dist/components/DropdownMenu/index.js +4 -1
  68. package/dist/components/FilePreview/FilePreview.js +135 -0
  69. package/dist/components/FilePreview/file-preview-format.js +23 -0
  70. package/dist/components/FilePreview/index.js +3 -0
  71. package/dist/components/Flex/Flex.js +0 -1
  72. package/dist/components/Flex/index.js +0 -1
  73. package/dist/components/FloatButton/FloatButton.js +42 -0
  74. package/dist/components/FloatButton/FloatButtonGroup.js +58 -0
  75. package/dist/components/FloatButton/float-button-context.js +9 -0
  76. package/dist/components/FloatButton/float-button-glyphs.js +26 -0
  77. package/dist/components/FloatButton/float-button-styles.js +14 -0
  78. package/dist/components/FloatButton/index.js +4 -0
  79. package/dist/components/Fullscreen/Fullscreen.js +29 -0
  80. package/dist/components/Fullscreen/index.js +3 -0
  81. package/dist/components/Grid/Grid.js +0 -1
  82. package/dist/components/Grid/GridItem.js +0 -1
  83. package/dist/components/Grid/index.js +0 -1
  84. package/dist/components/Icon/Icon.js +0 -1
  85. package/dist/components/Icon/index.js +0 -1
  86. package/dist/components/Image/Image.js +37 -19
  87. package/dist/components/Image/ImagePreview.js +233 -0
  88. package/dist/components/InlineCompletion/InlineCompletion.js +81 -0
  89. package/dist/components/InlineCompletion/index.js +3 -0
  90. package/dist/components/Input/Input.js +6 -5
  91. package/dist/components/Input/InputCore.js +3 -2
  92. package/dist/components/JsonView/JsonView.js +209 -0
  93. package/dist/components/JsonView/index.js +3 -0
  94. package/dist/components/JsonView/json-view-utils.js +24 -0
  95. package/dist/components/Kbd/Kbd.js +0 -1
  96. package/dist/components/Kbd/index.js +0 -1
  97. package/dist/components/LocaleProvider/LocaleProvider.js +16 -13
  98. package/dist/components/LocaleProvider/index.js +5 -3
  99. package/dist/components/LocaleProvider/ja-jp.js +222 -0
  100. package/dist/components/LocaleProvider/locale.js +99 -5
  101. package/dist/components/LocaleProvider/strings.js +15 -0
  102. package/dist/components/LocaleProvider/useStrings.js +13 -11
  103. package/dist/components/LocaleProvider/zh-cn.js +99 -5
  104. package/dist/components/Masonry/Masonry.js +29 -0
  105. package/dist/components/Masonry/index.js +3 -0
  106. package/dist/components/Masonry/masonry-distribute.js +15 -0
  107. package/dist/components/Mentions/Mentions.js +6 -5
  108. package/dist/components/Mentions/MentionsCore.js +69 -68
  109. package/dist/components/Menu/Menu.js +5 -5
  110. package/dist/components/Menu/MenuSub.js +23 -0
  111. package/dist/components/Menu/MenuSubContent.js +24 -0
  112. package/dist/components/Menu/MenuSubTrigger.js +30 -0
  113. package/dist/components/Menu/index.js +4 -1
  114. package/dist/components/NumberInput/NumberInput.js +6 -5
  115. package/dist/components/NumberInput/NumberInputCore.js +9 -8
  116. package/dist/components/OTPInput/OTPInput.js +5 -4
  117. package/dist/components/OTPInput/OTPInputCore.js +34 -33
  118. package/dist/components/PasswordInput/PasswordInput.js +5 -4
  119. package/dist/components/PasswordInput/PasswordInputCore.js +8 -7
  120. package/dist/components/Popover/Popover.js +43 -31
  121. package/dist/components/PromptInput/PromptInput.js +213 -0
  122. package/dist/components/PromptInput/index.js +3 -0
  123. package/dist/components/Radio/Radio.js +7 -6
  124. package/dist/components/Radio/RadioGroup.js +5 -4
  125. package/dist/components/Radio/RadioGroupCore.js +23 -14
  126. package/dist/components/Rating/Rating.js +5 -4
  127. package/dist/components/Rating/RatingCore.js +62 -28
  128. package/dist/components/Resizable/index.js +1 -1
  129. package/dist/components/Segmented/Segmented.js +5 -4
  130. package/dist/components/Segmented/SegmentedCore.js +22 -18
  131. package/dist/components/Select/OptionGroup.js +12 -0
  132. package/dist/components/Select/Select.js +20 -9
  133. package/dist/components/Select/SelectCore.js +74 -13
  134. package/dist/components/Select/SelectFloating.js +256 -0
  135. package/dist/components/Select/index.js +5 -4
  136. package/dist/components/Select/select-options.js +57 -0
  137. package/dist/components/Sidebar/Sidebar.js +9 -9
  138. package/dist/components/Signature/Signature.js +165 -0
  139. package/dist/components/Signature/index.js +3 -0
  140. package/dist/components/Signature/signature-points.js +28 -0
  141. package/dist/components/Skeleton/Skeleton.js +0 -1
  142. package/dist/components/Skeleton/index.js +0 -1
  143. package/dist/components/Slider/Slider.js +16 -8
  144. package/dist/components/Slider/SliderCore.js +75 -12
  145. package/dist/components/Sources/Sources.js +109 -0
  146. package/dist/components/Sources/index.js +3 -0
  147. package/dist/components/Stat/Stat.js +0 -1
  148. package/dist/components/Stat/index.js +0 -1
  149. package/dist/components/Switch/Switch.js +6 -5
  150. package/dist/components/Switch/SwitchCore.js +3 -2
  151. package/dist/components/Tabs/Tab.js +7 -4
  152. package/dist/components/Tabs/TabList.js +38 -7
  153. package/dist/components/Tabs/TabPanel.js +4 -3
  154. package/dist/components/Tabs/Tabs.js +11 -6
  155. package/dist/components/TagGroup/SortableTagGroup.js +26 -0
  156. package/dist/components/TagGroup/TagGroup.js +4 -6
  157. package/dist/components/TagGroup/TagGroupItem.js +17 -11
  158. package/dist/components/TagGroup/index.js +2 -1
  159. package/dist/components/TagGroup/tag-group-styles.js +7 -0
  160. package/dist/components/TagInput/SortableTagInput.js +24 -0
  161. package/dist/components/TagInput/SortableTagInputCore.js +52 -0
  162. package/dist/components/TagInput/TagInput.js +5 -4
  163. package/dist/components/TagInput/TagInputCore.js +71 -57
  164. package/dist/components/TagInput/index.js +3 -1
  165. package/dist/components/TagInput/tag-input-styles.js +7 -0
  166. package/dist/components/Textarea/Textarea.js +6 -5
  167. package/dist/components/Textarea/TextareaCore.js +3 -2
  168. package/dist/components/TimePicker/TimePicker.js +6 -5
  169. package/dist/components/TimePicker/TimePickerCore.js +3 -2
  170. package/dist/components/Toast/Toast.js +44 -42
  171. package/dist/components/Toast/ToastContainer.js +67 -47
  172. package/dist/components/Toast/ToastContext.js +23 -4
  173. package/dist/components/Toast/toast2.js +63 -28
  174. package/dist/components/Toast/useToast.js +9 -7
  175. package/dist/components/Toggle/Toggle.js +20 -0
  176. package/dist/components/Toggle/ToggleCore.js +31 -0
  177. package/dist/components/Toggle/index.js +4 -0
  178. package/dist/components/Toolbar/Toolbar.js +33 -32
  179. package/dist/components/Toolbar/ToolbarToggle.js +31 -0
  180. package/dist/components/Toolbar/index.js +2 -1
  181. package/dist/components/Tooltip/Tooltip.js +1 -1
  182. package/dist/components/Tour/Tour.js +57 -53
  183. package/dist/components/Tree/Tree.js +265 -80
  184. package/dist/components/Tree/TreeItem.js +91 -55
  185. package/dist/components/Tree/utils.js +82 -10
  186. package/dist/components/Typography/Typography.js +0 -1
  187. package/dist/components/Typography/index.js +0 -1
  188. package/dist/components/Upload/Upload.js +24 -8
  189. package/dist/components/Upload/UploadCore.js +230 -37
  190. package/dist/components/Upload/UploadList.js +300 -0
  191. package/dist/components/Upload/xhr-upload.js +22 -0
  192. package/dist/components/VirtualList/VirtualList.js +84 -56
  193. package/dist/components/Watermark/Watermark.js +55 -0
  194. package/dist/components/Watermark/index.js +3 -0
  195. package/dist/css/anchor.css +2 -0
  196. package/dist/css/app-shell.css +2 -0
  197. package/dist/css/badge.css +1 -1
  198. package/dist/css/bottom-sheet.css +1 -1
  199. package/dist/css/button.css +1 -1
  200. package/dist/css/calendar.css +1 -1
  201. package/dist/css/cascader.css +1 -1
  202. package/dist/css/chart.css +2 -0
  203. package/dist/css/chat-container.css +1 -1
  204. package/dist/css/chat-message.css +1 -1
  205. package/dist/css/combobox.css +3 -2
  206. package/dist/css/command.css +2 -1
  207. package/dist/css/context-menu.css +1 -1
  208. package/dist/css/data-table.css +2 -1
  209. package/dist/css/date-range-picker.css +1 -1
  210. package/dist/css/datepicker.css +2 -2
  211. package/dist/css/descriptions.css +2 -0
  212. package/dist/css/dialog.css +1 -1
  213. package/dist/css/drawer.css +1 -1
  214. package/dist/css/dropdown-menu.css +4 -1
  215. package/dist/css/file-preview.css +2 -0
  216. package/dist/css/float-button.css +2 -0
  217. package/dist/css/image.css +2 -1
  218. package/dist/css/inline-completion.css +2 -0
  219. package/dist/css/json-view.css +2 -0
  220. package/dist/css/masonry.css +2 -0
  221. package/dist/css/menu.css +4 -1
  222. package/dist/css/popover.css +1 -1
  223. package/dist/css/prompt-input.css +2 -0
  224. package/dist/css/rating.css +1 -1
  225. package/dist/css/select.css +3 -1
  226. package/dist/css/signature.css +2 -0
  227. package/dist/css/slider.css +1 -1
  228. package/dist/css/sources.css +2 -0
  229. package/dist/css/tag-group.css +3 -1
  230. package/dist/css/tag-input.css +2 -1
  231. package/dist/css/toggle.css +2 -0
  232. package/dist/css/toolbar.css +1 -0
  233. package/dist/css/tooltip.css +1 -1
  234. package/dist/css/tree.css +2 -2
  235. package/dist/css/upload.css +2 -1
  236. package/dist/css/watermark.css +2 -0
  237. package/dist/css-manifest.json +75 -1
  238. package/dist/form/FormItem.js +55 -50
  239. package/dist/form/FormList.js +79 -0
  240. package/dist/form/index.js +5 -1
  241. package/dist/form/standard-schema.js +16 -0
  242. package/dist/haze-ui.css +61 -30
  243. package/dist/headless/index.js +19 -0
  244. package/dist/hooks/useClickOutside.js +24 -0
  245. package/dist/hooks/useDarkMode.js +27 -0
  246. package/dist/hooks/useFullscreen.js +42 -0
  247. package/dist/hooks/useHotkeys.js +77 -0
  248. package/dist/hooks/useInView.js +27 -0
  249. package/dist/hooks/useLocalStorage.js +8 -0
  250. package/dist/hooks/useMediaQuery.js +2 -1
  251. package/dist/hooks/usePrevious.js +11 -0
  252. package/dist/hooks/useSessionStorage.js +8 -0
  253. package/dist/hooks/useStorageState.js +80 -0
  254. package/dist/index.js +220 -171
  255. package/dist/registry.json +2435 -91
  256. package/dist/tokens/colors.js +0 -1
  257. package/dist/tokens/index.js +0 -1
  258. package/dist/tokens/motion.js +0 -1
  259. package/dist/tokens/oklch.js +0 -1
  260. package/dist/tokens/palette.js +0 -1
  261. package/dist/tokens/registry.js +17 -28
  262. package/dist/tokens/spacing.js +0 -1
  263. package/dist/tokens/typography.js +0 -1
  264. package/dist/types/components/Anchor/Anchor.d.ts +25 -0
  265. package/dist/types/components/Anchor/index.d.ts +2 -0
  266. package/dist/types/components/AppShell/AppShell.d.ts +17 -0
  267. package/dist/types/components/AppShell/index.d.ts +2 -0
  268. package/dist/types/components/Badge/badge-styles.d.ts +21 -0
  269. package/dist/types/components/Badge/index.d.ts +1 -0
  270. package/dist/types/components/BottomSheet/BottomSheet.d.ts +52 -3
  271. package/dist/types/components/BottomSheet/index.d.ts +1 -1
  272. package/dist/types/components/Button/Button.d.ts +7 -0
  273. package/dist/types/components/Button/ButtonLink.d.ts +3 -0
  274. package/dist/types/components/Button/index.d.ts +1 -0
  275. package/dist/types/components/Button/styles.d.ts +17 -0
  276. package/dist/types/components/Calendar/Calendar.d.ts +71 -7
  277. package/dist/types/components/Calendar/date.d.ts +52 -0
  278. package/dist/types/components/Calendar/index.d.ts +1 -1
  279. package/dist/types/components/Cascader/Cascader.d.ts +48 -3
  280. package/dist/types/components/Chart/Chart.d.ts +43 -0
  281. package/dist/types/components/Chart/chart-elements.d.ts +104 -0
  282. package/dist/types/components/Chart/index.d.ts +2 -0
  283. package/dist/types/components/ChatContainer/ChatContainer.d.ts +18 -3
  284. package/dist/types/components/ChatInput/ChatInput.d.ts +11 -1
  285. package/dist/types/components/ChatMessage/ChatMessage.d.ts +13 -1
  286. package/dist/types/components/Checkbox/Checkbox.d.ts +6 -2
  287. package/dist/types/components/Checkbox/CheckboxCore.d.ts +4 -2
  288. package/dist/types/components/CodeBlock/CodeBlock.d.ts +19 -2
  289. package/dist/types/components/CodeBlock/index.d.ts +1 -1
  290. package/dist/types/components/Collapsible/Collapsible.d.ts +24 -2
  291. package/dist/types/components/Collapsible/index.d.ts +1 -1
  292. package/dist/types/components/ColorPicker/ColorPicker.d.ts +7 -1
  293. package/dist/types/components/ColorPicker/ColorPickerCore.d.ts +7 -1
  294. package/dist/types/components/Combobox/Combobox.d.ts +111 -7
  295. package/dist/types/components/Combobox/ComboboxGroup.d.ts +22 -0
  296. package/dist/types/components/Combobox/ComboboxOption.d.ts +7 -2
  297. package/dist/types/components/Combobox/index.d.ts +3 -1
  298. package/dist/types/components/Command/Command.d.ts +70 -6
  299. package/dist/types/components/Command/CommandDialog.d.ts +36 -0
  300. package/dist/types/components/Command/command-filter.d.ts +34 -0
  301. package/dist/types/components/Command/index.d.ts +4 -2
  302. package/dist/types/components/DataTable/CellEditor.d.ts +24 -0
  303. package/dist/types/components/DataTable/DataTable.d.ts +184 -32
  304. package/dist/types/components/DataTable/csv.d.ts +36 -0
  305. package/dist/types/components/DataTable/features.d.ts +124 -0
  306. package/dist/types/components/DataTable/index.d.ts +4 -1
  307. package/dist/types/components/DataTable/summary.d.ts +19 -0
  308. package/dist/types/components/DateRangePicker/DateRangePicker.d.ts +28 -2
  309. package/dist/types/components/DateRangePicker/DateRangePickerCore.d.ts +26 -2
  310. package/dist/types/components/DateRangePicker/index.d.ts +2 -2
  311. package/dist/types/components/DateRangePicker/presets.d.ts +23 -0
  312. package/dist/types/components/Datepicker/Datepicker.d.ts +21 -1
  313. package/dist/types/components/Datepicker/DatepickerCore.d.ts +29 -2
  314. package/dist/types/components/Datepicker/datetime.d.ts +27 -0
  315. package/dist/types/components/Datepicker/index.d.ts +1 -1
  316. package/dist/types/components/Descriptions/Descriptions.d.ts +30 -0
  317. package/dist/types/components/Descriptions/index.d.ts +2 -0
  318. package/dist/types/components/Dialog/Dialog.d.ts +68 -3
  319. package/dist/types/components/Dialog/index.d.ts +1 -1
  320. package/dist/types/components/Drawer/Drawer.d.ts +33 -3
  321. package/dist/types/components/Drawer/index.d.ts +1 -1
  322. package/dist/types/components/DropdownMenu/DropdownMenu.d.ts +23 -3
  323. package/dist/types/components/DropdownMenu/DropdownMenuSub.d.ts +18 -0
  324. package/dist/types/components/DropdownMenu/DropdownMenuSubContent.d.ts +13 -0
  325. package/dist/types/components/DropdownMenu/DropdownMenuSubTrigger.d.ts +14 -0
  326. package/dist/types/components/DropdownMenu/index.d.ts +7 -1
  327. package/dist/types/components/FilePreview/FilePreview.d.ts +35 -0
  328. package/dist/types/components/FilePreview/file-preview-format.d.ts +20 -0
  329. package/dist/types/components/FilePreview/index.d.ts +2 -0
  330. package/dist/types/components/FloatButton/FloatButton.d.ts +43 -0
  331. package/dist/types/components/FloatButton/FloatButtonGroup.d.ts +33 -0
  332. package/dist/types/components/FloatButton/float-button-context.d.ts +11 -0
  333. package/dist/types/components/FloatButton/float-button-glyphs.d.ts +3 -0
  334. package/dist/types/components/FloatButton/float-button-styles.d.ts +58 -0
  335. package/dist/types/components/FloatButton/index.d.ts +4 -0
  336. package/dist/types/components/Fullscreen/Fullscreen.d.ts +34 -0
  337. package/dist/types/components/Fullscreen/index.d.ts +3 -0
  338. package/dist/types/components/Image/Image.d.ts +20 -5
  339. package/dist/types/components/Image/ImagePreview.d.ts +13 -0
  340. package/dist/types/components/Image/index.d.ts +1 -1
  341. package/dist/types/components/InlineCompletion/InlineCompletion.d.ts +29 -0
  342. package/dist/types/components/InlineCompletion/index.d.ts +2 -0
  343. package/dist/types/components/Input/Input.d.ts +5 -2
  344. package/dist/types/components/Input/InputCore.d.ts +4 -2
  345. package/dist/types/components/JsonView/JsonView.d.ts +26 -0
  346. package/dist/types/components/JsonView/index.d.ts +2 -0
  347. package/dist/types/components/JsonView/json-view-utils.d.ts +22 -0
  348. package/dist/types/components/LocaleProvider/LocaleContext.d.ts +9 -0
  349. package/dist/types/components/LocaleProvider/LocaleProvider.d.ts +12 -1
  350. package/dist/types/components/LocaleProvider/index.d.ts +3 -0
  351. package/dist/types/components/LocaleProvider/ja-jp.d.ts +13 -0
  352. package/dist/types/components/LocaleProvider/locale.d.ts +100 -0
  353. package/dist/types/components/LocaleProvider/strings.d.ts +28 -0
  354. package/dist/types/components/Masonry/Masonry.d.ts +34 -0
  355. package/dist/types/components/Masonry/index.d.ts +2 -0
  356. package/dist/types/components/Masonry/masonry-distribute.d.ts +16 -0
  357. package/dist/types/components/Mentions/Mentions.d.ts +5 -2
  358. package/dist/types/components/Mentions/MentionsCore.d.ts +4 -2
  359. package/dist/types/components/Menu/MenuSub.d.ts +18 -0
  360. package/dist/types/components/Menu/MenuSubContent.d.ts +12 -0
  361. package/dist/types/components/Menu/MenuSubTrigger.d.ts +14 -0
  362. package/dist/types/components/Menu/index.d.ts +6 -0
  363. package/dist/types/components/NumberInput/NumberInput.d.ts +5 -2
  364. package/dist/types/components/NumberInput/NumberInputCore.d.ts +4 -2
  365. package/dist/types/components/OTPInput/OTPInput.d.ts +5 -1
  366. package/dist/types/components/OTPInput/OTPInputCore.d.ts +4 -1
  367. package/dist/types/components/PasswordInput/PasswordInput.d.ts +5 -1
  368. package/dist/types/components/PasswordInput/PasswordInputCore.d.ts +4 -1
  369. package/dist/types/components/Popover/Popover.d.ts +41 -3
  370. package/dist/types/components/Popover/index.d.ts +1 -1
  371. package/dist/types/components/PromptInput/PromptInput.d.ts +46 -0
  372. package/dist/types/components/PromptInput/index.d.ts +2 -0
  373. package/dist/types/components/Radio/Radio.d.ts +5 -2
  374. package/dist/types/components/Radio/RadioGroup.d.ts +8 -2
  375. package/dist/types/components/Radio/RadioGroupCore.d.ts +7 -2
  376. package/dist/types/components/Rating/Rating.d.ts +8 -1
  377. package/dist/types/components/Rating/RatingCore.d.ts +7 -1
  378. package/dist/types/components/Resizable/index.d.ts +2 -0
  379. package/dist/types/components/Segmented/Segmented.d.ts +8 -1
  380. package/dist/types/components/Segmented/SegmentedCore.d.ts +7 -2
  381. package/dist/types/components/Select/OptionGroup.d.ts +16 -0
  382. package/dist/types/components/Select/Select.d.ts +78 -4
  383. package/dist/types/components/Select/SelectCore.d.ts +79 -6
  384. package/dist/types/components/Select/SelectFloating.d.ts +94 -0
  385. package/dist/types/components/Select/index.d.ts +2 -0
  386. package/dist/types/components/Select/select-options.d.ts +53 -0
  387. package/dist/types/components/Signature/Signature.d.ts +51 -0
  388. package/dist/types/components/Signature/index.d.ts +2 -0
  389. package/dist/types/components/Signature/signature-points.d.ts +31 -0
  390. package/dist/types/components/Slider/Slider.d.ts +29 -4
  391. package/dist/types/components/Slider/SliderCore.d.ts +35 -6
  392. package/dist/types/components/Sources/Sources.d.ts +37 -0
  393. package/dist/types/components/Sources/index.d.ts +2 -0
  394. package/dist/types/components/Switch/Switch.d.ts +5 -2
  395. package/dist/types/components/Switch/SwitchCore.d.ts +4 -2
  396. package/dist/types/components/Tabs/TabList.d.ts +7 -0
  397. package/dist/types/components/Tabs/Tabs.d.ts +8 -1
  398. package/dist/types/components/Tabs/TabsContext.d.ts +20 -0
  399. package/dist/types/components/Tabs/index.d.ts +1 -0
  400. package/dist/types/components/TagGroup/SortableTagGroup.d.ts +20 -0
  401. package/dist/types/components/TagGroup/TagGroup.d.ts +3 -0
  402. package/dist/types/components/TagGroup/index.d.ts +2 -0
  403. package/dist/types/components/TagGroup/tag-group-styles.d.ts +7 -0
  404. package/dist/types/components/TagInput/SortableTagInput.d.ts +34 -0
  405. package/dist/types/components/TagInput/SortableTagInputCore.d.ts +18 -0
  406. package/dist/types/components/TagInput/TagInput.d.ts +5 -1
  407. package/dist/types/components/TagInput/TagInputCore.d.ts +6 -2
  408. package/dist/types/components/TagInput/index.d.ts +4 -0
  409. package/dist/types/components/TagInput/tag-input-styles.d.ts +12 -0
  410. package/dist/types/components/Textarea/Textarea.d.ts +5 -2
  411. package/dist/types/components/Textarea/TextareaCore.d.ts +4 -2
  412. package/dist/types/components/TimePicker/TimePicker.d.ts +5 -2
  413. package/dist/types/components/TimePicker/TimePickerCore.d.ts +4 -2
  414. package/dist/types/components/Toast/Toast.d.ts +31 -2
  415. package/dist/types/components/Toast/ToastContainer.d.ts +11 -1
  416. package/dist/types/components/Toast/ToastContext.d.ts +44 -3
  417. package/dist/types/components/Toast/index.d.ts +1 -1
  418. package/dist/types/components/Toast/toast.d.ts +35 -4
  419. package/dist/types/components/Toast/useToast.d.ts +16 -4
  420. package/dist/types/components/Toggle/Toggle.d.ts +19 -0
  421. package/dist/types/components/Toggle/ToggleCore.d.ts +23 -0
  422. package/dist/types/components/Toggle/index.d.ts +4 -0
  423. package/dist/types/components/Toolbar/ToolbarToggle.d.ts +19 -0
  424. package/dist/types/components/Toolbar/index.d.ts +2 -0
  425. package/dist/types/components/Tour/Tour.d.ts +3 -3
  426. package/dist/types/components/Tree/Tree.d.ts +3 -3
  427. package/dist/types/components/Tree/TreeItem.d.ts +16 -1
  428. package/dist/types/components/Tree/types.d.ts +51 -0
  429. package/dist/types/components/Tree/utils.d.ts +73 -0
  430. package/dist/types/components/Upload/Upload.d.ts +47 -3
  431. package/dist/types/components/Upload/UploadCore.d.ts +95 -4
  432. package/dist/types/components/Upload/UploadList.d.ts +18 -0
  433. package/dist/types/components/Upload/index.d.ts +1 -0
  434. package/dist/types/components/Upload/types.d.ts +60 -0
  435. package/dist/types/components/Upload/xhr-upload.d.ts +20 -0
  436. package/dist/types/components/VirtualList/VirtualList.d.ts +16 -1
  437. package/dist/types/components/Watermark/Watermark.d.ts +32 -0
  438. package/dist/types/components/Watermark/index.d.ts +2 -0
  439. package/dist/types/form/FormItem.d.ts +33 -8
  440. package/dist/types/form/FormList.d.ts +113 -0
  441. package/dist/types/form/index.d.ts +26 -0
  442. package/dist/types/form/standard-schema.d.ts +30 -0
  443. package/dist/types/headless/index.d.ts +399 -0
  444. package/dist/types/hooks/index.d.ts +13 -0
  445. package/dist/types/hooks/useClickOutside.d.ts +46 -0
  446. package/dist/types/hooks/useDarkMode.d.ts +40 -0
  447. package/dist/types/hooks/useFullscreen.d.ts +33 -0
  448. package/dist/types/hooks/useHotkeys.d.ts +53 -0
  449. package/dist/types/hooks/useInView.d.ts +32 -0
  450. package/dist/types/hooks/useLocalStorage.d.ts +33 -0
  451. package/dist/types/hooks/useMediaQuery.d.ts +3 -0
  452. package/dist/types/hooks/usePrevious.d.ts +18 -0
  453. package/dist/types/hooks/useSessionStorage.d.ts +26 -0
  454. package/dist/types/hooks/useStorageState.d.ts +12 -0
  455. package/dist/types/index.d.ts +79 -37
  456. package/dist/types/utils/collision.d.ts +39 -1
  457. package/dist/types/utils/direction.d.ts +22 -0
  458. package/dist/types/utils/floating.d.ts +32 -4
  459. package/dist/types/utils/focus-scope.d.ts +2 -1
  460. package/dist/types/utils/focus.d.ts +2 -1
  461. package/dist/types/utils/menuKeyboard.d.ts +19 -4
  462. package/dist/types/utils/refs.d.ts +16 -0
  463. package/dist/types/utils/sortable-handle.d.ts +25 -0
  464. package/dist/types/utils/sortable-shared.d.ts +30 -0
  465. package/dist/types/utils/sortable.d.ts +36 -0
  466. package/dist/types/utils/submenu.d.ts +63 -0
  467. package/dist/types/utils/view-transition.d.ts +28 -0
  468. package/dist/utils/classnames.js +0 -1
  469. package/dist/utils/collision.js +37 -26
  470. package/dist/utils/direction.js +34 -0
  471. package/dist/utils/floating.js +163 -143
  472. package/dist/utils/menuKeyboard.js +59 -46
  473. package/dist/utils/refs.js +9 -0
  474. package/dist/utils/sortable-handle.js +12 -0
  475. package/dist/utils/sortable-shared.js +16 -0
  476. package/dist/utils/sortable.js +47 -0
  477. package/dist/utils/submenu.js +106 -0
  478. package/dist/utils/view-transition.js +26 -0
  479. package/package.json +169 -16
@@ -0,0 +1,18 @@
1
+ import type { UploadEntry, UploadListItemRender } from './types';
2
+ type UploadListProps = {
3
+ /** Tracked rows, in value order. */
4
+ entries: UploadEntry[];
5
+ /** Rendering style of the built-in list: `text` rows (default) or a
6
+ * `picture-card` grid of square thumbnail cards. */
7
+ listType?: 'text' | 'picture-card';
8
+ /** Overrides the remove-button label (text rows and picture-card
9
+ * corners alike); defaults to the locale string. */
10
+ removeLabel?: string;
11
+ /** Replaces the default row/cell rendering entirely. */
12
+ itemRender?: UploadListItemRender;
13
+ onRemove: (file: File) => void;
14
+ onRetry: (file: File) => void;
15
+ onCancel: (file: File) => void;
16
+ };
17
+ export default function UploadList({ entries, listType, removeLabel, itemRender, onRemove, onRetry, onCancel, }: UploadListProps): import("react").JSX.Element;
18
+ export type { UploadListProps };
@@ -2,3 +2,4 @@ export { default as Upload } from './Upload';
2
2
  export type { UploadProps } from './Upload';
3
3
  export { default as UploadCore } from './UploadCore';
4
4
  export type { UploadCoreProps } from './UploadCore';
5
+ export type { UploadHandle, UploadStatus, UploadFileStatus, UploadRequest, UploadRequestOptions, UploadListItemActions, UploadListItemRender, } from './types';
@@ -0,0 +1,60 @@
1
+ import type { ReactNode } from 'react';
2
+ /** Lifecycle of one tracked file while an upload executor (`request`
3
+ * or `action`) is armed. */
4
+ type UploadStatus = 'idle' | 'uploading' | 'success' | 'error';
5
+ /** Status snapshot for one tracked file — the shape surfaced through
6
+ * `onStatusChange` and `showUploadList.itemRender`. */
7
+ type UploadFileStatus = {
8
+ file: File;
9
+ status: UploadStatus;
10
+ /** 0–100, clamped; forced to 100 when the upload succeeds. */
11
+ percent: number;
12
+ };
13
+ /** Runtime handed to a custom `request` (and used internally by the
14
+ * XHR wrapper that `action` mode builds). */
15
+ type UploadRequestOptions = {
16
+ /** Report progress; values are clamped to 0–100. */
17
+ onProgress: (percent: number) => void;
18
+ /** Aborted when the upload is cancelled, removed or cleared — wire
19
+ * it to the underlying transport. */
20
+ signal: AbortSignal;
21
+ };
22
+ /** Custom upload executor: resolve on success, reject on failure.
23
+ * Rejecting with an `AbortError` `DOMException` (or after `signal`
24
+ * aborted) maps the file back to `idle` instead of `error`. */
25
+ type UploadRequest = (file: File, options: UploadRequestOptions) => Promise<void>;
26
+ /** Row-level callbacks handed to a custom `itemRender`. */
27
+ type UploadListItemActions = {
28
+ /** Abort the upload if in flight, then drop the file from the list. */
29
+ remove: () => void;
30
+ /** Re-run the upload. No-op unless the file errored. */
31
+ retry: () => void;
32
+ /** Abort the in-flight upload and drop the file (uploading state). */
33
+ cancel: () => void;
34
+ };
35
+ /** Custom renderer replacing a built-in list row. */
36
+ type UploadListItemRender = (file: File, status: UploadStatus, percent: number, actions: UploadListItemActions) => ReactNode;
37
+ /**
38
+ * Imperative surface (`ref.current?.…`) — the same React 19
39
+ * ref-as-prop channel `DialogHandle` uses:
40
+ *
41
+ * - `upload(file?)` — start every pending file (idle or error); with a
42
+ * `file`, (re)start just that one.
43
+ * - `uploadAll()` — (re)start every file that is not currently
44
+ * uploading, successful ones included.
45
+ * - `abort()` — abort every in-flight upload; aborted files return to
46
+ * `idle` and stay in the list.
47
+ * - `clear()` — abort everything and empty the list (`onChange([])`).
48
+ */
49
+ type UploadHandle = {
50
+ upload: (file?: File) => void;
51
+ uploadAll: () => void;
52
+ abort: () => void;
53
+ clear: () => void;
54
+ };
55
+ /** Internal tracked row: public status snapshot plus the stable uid the
56
+ * list keys on (File objects have no serializable identity). */
57
+ type UploadEntry = UploadFileStatus & {
58
+ uid: string;
59
+ };
60
+ export type { UploadStatus, UploadFileStatus, UploadRequestOptions, UploadRequest, UploadListItemActions, UploadListItemRender, UploadHandle, UploadEntry, };
@@ -0,0 +1,20 @@
1
+ import type { UploadRequest } from './types';
2
+ type XhrUploadConfig = {
3
+ /** Upload endpoint URL. */
4
+ action: string;
5
+ /** HTTP method — defaults to `POST`. */
6
+ method?: string;
7
+ /** Extra request headers. */
8
+ headers?: Record<string, string>;
9
+ /** Form field name carrying the file — defaults to `file`. */
10
+ name?: string;
11
+ /** Extra form fields appended alongside the file. */
12
+ data?: Record<string, string | Blob>;
13
+ };
14
+ /** Builds the executor used when only `action` (plus optional
15
+ * `method`/`headers`/`name`/`data`) is given: a multipart FormData
16
+ * upload via XHR with progress wired to `xhr.upload.onprogress` and
17
+ * abort wired to `xhr.abort()`. */
18
+ declare function createXhrRequest(config: XhrUploadConfig): UploadRequest;
19
+ export type { XhrUploadConfig };
20
+ export { createXhrRequest };
@@ -57,8 +57,23 @@ type VirtualListProps<T> = {
57
57
  renderItem: (item: T, index: number) => ReactNode;
58
58
  /** Extra rows kept mounted above/below the visible window. */
59
59
  overscan?: number;
60
+ /**
61
+ * Chat orientation (opt-in): rows anchor to the scrollport bottom with
62
+ * index 0 at the bottom edge and later indices stacking upward — the
63
+ * natural geometry for a newest-at-bottom log where new items are
64
+ * prepended. The viewport parks at the bottom on mount and stays glued
65
+ * there across appends while the user is parked at the bottom; a
66
+ * reader who scrolled up keeps their position (rows keep their
67
+ * top-origin coordinates as content grows upward, so nothing jumps).
68
+ *
69
+ * `scrollToIndex` keeps its signature; alignments mirror vertically —
70
+ * `'start'` pins the row's bottom edge to the viewport bottom,
71
+ * `'end'` its top edge to the viewport top. The `VirtualListHandle`
72
+ * API is unchanged.
73
+ */
74
+ reverse?: boolean;
60
75
  className?: string;
61
76
  ref?: Ref<VirtualListHandle>;
62
77
  } & Omit<ComponentPropsWithoutRef<'div'>, 'children'>;
63
- export default function VirtualList<T>({ items, height, itemHeight, estimatedItemHeight, groups, renderItem, overscan, className, style, ref, ...rest }: VirtualListProps<T>): import("react").JSX.Element;
78
+ export default function VirtualList<T>({ items, height, itemHeight, estimatedItemHeight, groups, renderItem, overscan, reverse, className, style, ref, ...rest }: VirtualListProps<T>): import("react").JSX.Element;
64
79
  export type { VirtualListProps, VirtualListHandle, VirtualListGroup, VirtualListAlign, };
@@ -0,0 +1,32 @@
1
+ import type { ComponentPropsWithoutRef, ReactNode } from 'react';
2
+ export type WatermarkFont = {
3
+ /** Font size in px (canvas metrics, not CSS). */
4
+ size?: number;
5
+ /** Any CSS color; defaults to the theme's `--haze-color-text-muted`. */
6
+ color?: string;
7
+ /** Numeric font weight. */
8
+ weight?: number;
9
+ /** CSS font-family stack; falls back to the page's sans stack. */
10
+ family?: string;
11
+ };
12
+ type WatermarkProps = {
13
+ /** Watermark text; an array renders stacked lines. */
14
+ content: string | string[];
15
+ /** Typography of the drawn text. */
16
+ font?: WatermarkFont;
17
+ /** Rotation in degrees. */
18
+ rotate?: number;
19
+ /** Space between tiles, in px — one number or `[x, y]`. */
20
+ gap?: number | [number, number];
21
+ /** `[x, y]` offset of the tile grid origin, in px. */
22
+ offset?: [number, number];
23
+ /** Overlay stacking order. */
24
+ zIndex?: number;
25
+ /** Span the whole viewport (fixed) instead of the container. */
26
+ fullscreen?: boolean;
27
+ /** Content to watermark; with children the component becomes its container. */
28
+ children?: ReactNode;
29
+ className?: string;
30
+ } & Omit<ComponentPropsWithoutRef<'div'>, 'children' | 'className' | 'content'>;
31
+ export default function Watermark({ content, font, rotate, gap, offset, zIndex, fullscreen, children, className, style, ...rest }: WatermarkProps): import("react").JSX.Element;
32
+ export type { WatermarkProps };
@@ -0,0 +1,2 @@
1
+ export { default as Watermark } from './Watermark';
2
+ export type { WatermarkProps, WatermarkFont } from './Watermark';
@@ -1,5 +1,5 @@
1
1
  import type { ComponentPropsWithoutRef, ComponentType, ReactNode } from 'react';
2
- import type { FieldError, FieldPath, FieldRules, Name, ValidationMode, FormInstance, PathValueOf } from 'react-f0rm';
2
+ import type { FieldError, FieldPath, FieldRules, Name, Path, ValidationMode, FormInstance, PathValueOf } from 'react-f0rm';
3
3
  /**
4
4
  * Field-level validator, structurally compatible with react-f0rm's
5
5
  * `Validator`: return an error (string, FieldError, or an array mixing
@@ -11,9 +11,15 @@ import type { FieldError, FieldPath, FieldRules, Name, ValidationMode, FormInsta
11
11
  * the value argument is `PathValueOf<TValues, P>` — the field's actual
12
12
  * type — instead of `any`. The bare defaults keep untyped call sites
13
13
  * exactly as permissive as before.
14
+ *
15
+ * The `meta` shape mirrors react-f0rm's `Validator` (`form`/`path`/
16
+ * `signal`) on purpose, so its resolver adapters — `zodResolver`,
17
+ * `standardSchemaResolver` from `react-f0rm/resolvers/*` — slot straight
18
+ * into `FormItem`'s `validate` prop without a wrapper.
14
19
  */
15
20
  export type FieldValidator<TValues extends Record<string, any> = any, P extends FieldPath<TValues> | Name = Name> = (value: PathValueOf<TValues, P>, meta: {
16
21
  form: FormInstance;
22
+ path: Path;
17
23
  signal: AbortSignal;
18
24
  }) => string | FieldError | (string | FieldError)[] | undefined | Promise<string | FieldError | (string | FieldError)[] | undefined>;
19
25
  /** Render binding handed to `FormItem`'s render-prop children. */
@@ -37,6 +43,15 @@ export type FormItemBinding<TValues, P extends FieldPath<TValues> | Name> = {
37
43
  * It routes through the same mode-gated, re-validating pipeline as
38
44
  * react-f0rm's built-in Field/Checkbox/Select. */
39
45
  onChange: (next: PathValueOf<TValues, P>) => void;
46
+ /**
47
+ * react-f0rm's focus channel (callback ref): attach it to the
48
+ * control's `ref` (`<InputCore ref={focusRef} />`) so
49
+ * `setFocus(form, name)` and a failed submit's first-error
50
+ * auto-focus can reach this field's element. Without it, focus
51
+ * requests aimed at this field are silent no-ops (react-f0rm's
52
+ * `setFocus` contract).
53
+ */
54
+ focusRef: (el: any) => void;
40
55
  };
41
56
  /**
42
57
  * Declarative `as` binding for `FormItem` — the same props shape as
@@ -87,7 +102,12 @@ export type FormItemRawElementBinding<TRawElement extends FormItemRawElement = F
87
102
  * consumes regardless of how the control is bound (render-prop, `as`
88
103
  * or `input`). */
89
104
  export type FormItemOwnProps<TValues extends Record<string, any> = any, P extends FieldPath<TValues> | Name = Name> = {
90
- form: FormInstance<TValues>;
105
+ /**
106
+ * 表单实例(`useForm()`/`createForm()` 的返回值)。可省略:省略时从
107
+ * 最近的 `<FormProvider value={form}>` 读取(react-f0rm 的 form
108
+ * context),显式传入的 `form` 总是优先。两者都没有时 throw。
109
+ */
110
+ form?: FormInstance<TValues>;
91
111
  name: P;
92
112
  label?: ReactNode;
93
113
  /** Field-level validator, registered through react-f0rm's own
@@ -131,6 +151,9 @@ export type FormItemOwnProps<TValues extends Record<string, any> = any, P extend
131
151
  */
132
152
  type FormItemWiredProps = {
133
153
  id?: unknown;
154
+ /** the focus channel: react-f0rm's `focusRef` rides the control's
155
+ * `ref` — `setFocus` and failed-submit auto-focus depend on it */
156
+ ref?: unknown;
134
157
  onBlur?: unknown;
135
158
  onChange?: unknown;
136
159
  /** the value channel: `value` directly, or the prop `valueToProps`
@@ -231,11 +254,13 @@ export type FormItemProps<TValues extends Record<string, any> = any, P extends F
231
254
  *
232
255
  * With `as`, the id/aria/onBlur/onChange wiring happens here: the control
233
256
  * gets `id`, `aria-invalid`/`aria-describedby` while the field errors,
234
- * and `onChange={(v) => onChange(toValue(v))}` where `toValue` defaults
257
+ * `onChange={(v) => onChange(toValue(v))}` where `toValue` defaults
235
258
  * to identity (haze cores emit plain values — pass
236
259
  * `eventToValue={(e) => e.target.value}` for a raw DOM element) and the
237
260
  * value lands as `{value}` or, with `valueToProps`, whatever props the
238
- * control wants (e.g. `{checked}` for CheckboxCore).
261
+ * control wants (e.g. `{checked}` for CheckboxCore). react-f0rm's focus
262
+ * channel rides the control's `ref`, so `setFocus(form, name)` and a
263
+ * failed submit's first-error auto-focus reach the field's element.
239
264
  *
240
265
  * The ergonomic form for haze-ui cores is `input`: the rest of the JSX
241
266
  * props — and JSX children, e.g. a `SelectCore`'s `<option>`s — are
@@ -252,10 +277,10 @@ export type FormItemProps<TValues extends Record<string, any> = any, P extends F
252
277
  * />
253
278
  * ```
254
279
  *
255
- * The same wiring as `as` applies (id, aria, onBlur, onChange, value);
256
- * wired and FormItem-owned prop names are reserved — a control prop that
257
- * collides (CheckboxCore's `label`) needs the render-prop or
258
- * `as`/`asProps` channel.
280
+ * The same wiring as `as` applies (id, aria, onBlur, onChange, value,
281
+ * and the `ref`-riding focus channel); wired and FormItem-owned prop
282
+ * names are reserved — a control prop that collides (CheckboxCore's
283
+ * `label`) needs the render-prop or `as`/`asProps` channel.
259
284
  *
260
285
  * `input` also accepts raw DOM bindings — no core required:
261
286
  *
@@ -0,0 +1,113 @@
1
+ import type { ReactNode } from 'react';
2
+ import type { FieldPath, FieldRules, FormInstance, Name } from 'react-f0rm';
3
+ /**
4
+ * `fields` 数组的元素 —— react-f0rm `useFieldArray` 的行描述透传:
5
+ * 稳定行 key、当前索引,以及 `keyName` 指定属性名下的同值别名
6
+ * (默认 `id`,自定义名如 `'key'` 用于避开行数据自带的同名字段)。
7
+ */
8
+ export type FormListField<K extends string = 'id'> = {
9
+ /** 行的稳定 id:跨 append/remove/swap/move 跟随数据行本身,
10
+ * 渲染列表时直接作 React key(绝不要用 index 当 key)。 */
11
+ id: string;
12
+ /** 行的当前位置:remove/move/swap/insert 之后随数据迁移。 */
13
+ index: number;
14
+ } & Record<K, string>;
15
+ /**
16
+ * FormList 的 render-prop 入参 —— react-f0rm `useFieldArray` 返回值
17
+ * (`UseFieldArrayResult`)的结构透传。f0rm 主入口不导出该类型,这里按
18
+ * 其形状镜像声明;`useFieldArray` 的真实返回值直接满足本类型。
19
+ */
20
+ export type FormListBinding<K extends string = 'id'> = {
21
+ /** 行列表:每行带稳定 key(`id` 或 `keyName` 指定的属性)与当前索引。 */
22
+ fields: FormListField<K>[];
23
+ /** 在数组末尾追加一行。 */
24
+ append: (value: any) => void;
25
+ /** 在数组头部插入一行。 */
26
+ prepend: (value: any) => void;
27
+ /** 在 `index` 处插入一行,其后各行顺移。 */
28
+ insert: (index: number, value: any) => void;
29
+ /** 删除 `index` 处的行,其后各行前移(行 key 随数据行消失)。 */
30
+ remove: (index: number) => void;
31
+ /** 交换两行位置:只动这两行,中间行不动。 */
32
+ swap: (from: number, to: number) => void;
33
+ /** 把 `from` 行移动到 `to` 位置,中间行整体顺移。 */
34
+ move: (from: number, to: number) => void;
35
+ /** 整表替换:清空后按 `values` 重建全部行。 */
36
+ replace: (values: any[]) => void;
37
+ /** 原位覆写 `index` 行的值:行 key 与位置保持不变。 */
38
+ update: (index: number, value: any) => void;
39
+ };
40
+ /** FormList 自身的 props —— `useFieldArray` 选项的组件化外壳。 */
41
+ export type FormListProps<TValues extends Record<string, any> = any, P extends FieldPath<TValues> | Name = Name, K extends string = 'id'> = {
42
+ /**
43
+ * 表单实例(`useForm()`/`createForm()` 的返回值)。可省略:省略时从
44
+ * 最近的 `<FormProvider value={form}>` 读取(react-f0rm 的 form
45
+ * context);显式传入的 `form` 总是优先。
46
+ */
47
+ form?: FormInstance<TValues>;
48
+ /** 数组字段的路径,如 `'tags'`。 */
49
+ name: P;
50
+ /**
51
+ * 稳定行 key 在每个 `fields` 条目上暴露的属性名(默认 `'id'`);
52
+ * 行数据自带同名字段时换一个(如 `'key'`)避免覆盖,底层 id 不变。
53
+ */
54
+ keyName?: K;
55
+ /**
56
+ * 声明式规则,对整个数组值校验(react-hook-form `useFieldArray` 的
57
+ * `rules`):`required` 空数组失败,`minLength`/`maxLength` 读行数。
58
+ * 与字段级规则一样在 submit 与 `trigger` 时运行。
59
+ */
60
+ rules?: FieldRules;
61
+ /**
62
+ * 卸载本组件时是否移除整个数组分支(含各行数据)。默认跟随表单级
63
+ * `shouldUnregister`;传 `false` 保留数据。
64
+ */
65
+ shouldUnregister?: boolean;
66
+ className?: string;
67
+ /** render-prop:收到数组操作句柄,渲染整张行列表。 */
68
+ children: (binding: FormListBinding<K>) => ReactNode;
69
+ };
70
+ /**
71
+ * 数组字段的组件外壳:包住 react-f0rm 1.3 的 `useFieldArray`,把行
72
+ * 列表与增删换位操作以 render-prop 交给消费者。headless —— 不带任何
73
+ * 内置布局,只渲染一个可挂 `className` 的壳 `<div>`;行怎么排、按钮
74
+ * 怎么放完全由 children 决定。
75
+ *
76
+ * `form` 可省略:省略时从最近的 `<FormProvider value={form}>` 回退读取;
77
+ * 两者都没有时 throw。`keyName`/`rules`/`shouldUnregister` 原样透传给
78
+ * `useFieldArray`。
79
+ *
80
+ * **行内编辑的保留(物化时机)**:react-f0rm 的数组操作从「数组层的
81
+ * 上一次物化」读取整表,行内控件(如 `name={['tags', i, 'label']}` 的
82
+ * FormItem)的编辑先是挂在更深层的待合并写入——直接 append/remove 会
83
+ * 让它们被下一代覆盖丢失。FormList 在每个读旧值的操作(append/
84
+ * prepend/insert/remove/swap/move/update)前,先用 `getValues()` 的
85
+ * 合并视图把数组分支物化一次,行内编辑因此跨操作保留——与
86
+ * react-hook-form / TanStack Form 的行为一致。`replace` 不读旧值,
87
+ * 原样透传;`update`/`replace` 的显式值仍然覆盖对应行的行内编辑。
88
+ *
89
+ * ```tsx
90
+ * <FormList form={form} name='tags'>
91
+ * {({fields, append, remove}) => (
92
+ * <>
93
+ * {fields.map((field) => (
94
+ * <div key={field.id}>
95
+ * <FormItem
96
+ * form={form}
97
+ * name={['tags', field.index, 'label']}
98
+ * input={InputCore}
99
+ * />
100
+ * <Button onClick={() => remove(field.index)}>Remove</Button>
101
+ * </div>
102
+ * ))}
103
+ * <Button onClick={() => append({label: ''})}>Add tag</Button>
104
+ * </>
105
+ * )}
106
+ * </FormList>
107
+ * ```
108
+ *
109
+ * 行 key 用 `field.id`(或 `keyName` 指定的属性)——不要用 index:
110
+ * remove/swap/move 之后 index 会迁移,index key 会让 React 把行状态
111
+ * 错配到别的数据行上。
112
+ */
113
+ export default function FormList<TValues extends Record<string, any> = any, P extends FieldPath<TValues> | Name = Name, K extends string = 'id'>({ form, name, keyName, rules, shouldUnregister, className, children }: FormListProps<TValues, P, K>): import("react").JSX.Element;
@@ -1,3 +1,29 @@
1
1
  export { default as FormItem } from './FormItem';
2
2
  export type { FieldValidator, FormItemAsProps, FormItemBinding, FormItemOwnProps, FormItemProps, FormItemRawElement, FormItemRawElementBinding } from './FormItem';
3
+ export { default as FormList } from './FormList';
4
+ export type { FormListBinding, FormListField, FormListProps } from './FormList';
3
5
  export type { FormInstance, PathValueOf } from 'react-f0rm';
6
+ /**
7
+ * react-f0rm 的上下文与命令式 API —— haze-ui form 层的官方透传出口。
8
+ * react-f0rm 是 haze-ui 的普通依赖,从这里 import 即可,无需再直接
9
+ * 依赖 react-f0rm。`<FormProvider value={form}>` 挂 context 后,子树里的
10
+ * `FormItem`/`FormList` 可以省略 `form` prop。
11
+ */
12
+ export { FormProvider, useFormContext, useFieldArray, useFieldArrayItem, useWatch, trigger, setFocus, setServerErrors, setValue, getValue, getValues, reset } from 'react-f0rm';
13
+ /**
14
+ * Standard Schema v1 适配器(react-f0rm/resolvers/standard-schema):
15
+ * 任何实现 `~standard` 的 schema 库通用 —— zod v3.24+/v4、valibot v1、
16
+ * arktype 等。`standardSchemaResolver` 是字段级(FormItem 的
17
+ * `validate`),`standardSchemaFormValidator` 是表单级
18
+ * (`createForm({validate})`,成功时把 schema 解析结果存为
19
+ * parsedValues;经 `./standard-schema` 兜底 react-f0rm 1.3.0 的
20
+ * 品牌符号打包缺陷)。`hasStandardProps` 运行时探测 schema 是否实现了
21
+ * Standard Schema。
22
+ */
23
+ export { hasStandardProps, standardSchemaFormValidator, standardSchemaResolver } from './standard-schema';
24
+ export type { StandardSchemaV1 } from './standard-schema';
25
+ /**
26
+ * zod 专用字段级适配器(react-f0rm/resolvers/zod):schema 实现了
27
+ * Standard Schema 时直接走通用通道,否则走 zod 的 safeParseAsync。
28
+ */
29
+ export { zodResolver } from 'react-f0rm/resolvers/zod';
@@ -0,0 +1,30 @@
1
+ import type { StandardSchemaV1 } from 'react-f0rm/resolvers/standard-schema';
2
+ import type { FormValidateFn } from 'react-f0rm';
3
+ import { hasStandardProps, standardSchemaResolver } from 'react-f0rm/resolvers/standard-schema';
4
+ export { hasStandardProps, standardSchemaResolver };
5
+ export type { StandardSchemaV1 } from 'react-f0rm/resolvers/standard-schema';
6
+ /**
7
+ * react-f0rm 1.3.0 的表单级 Standard Schema 适配器,附带一个 dist 打包
8
+ * 缺陷的兜底:共享块被内联进主入口,`Symbol('validation-outcome')` 品牌
9
+ * 因此存在两份 —— resolvers 子路径用 errors 块的那份给 `ValidationOutcome`
10
+ * 打品牌,而主入口里内联的核心校验管线检查的是自己那份,品牌对不上时
11
+ * outcome 被当成普通错误记录处理,`errors`(`FieldError` 对象数组)被
12
+ * 静默丢弃。这里用主入口导出的 `VALIDATION_OUTCOME`(核心实际检查的
13
+ * symbol)给结果重新打品牌;品牌一致(上游修复后)时原样透传。
14
+ *
15
+ * 其余行为与 `react-f0rm/resolvers/standard-schema` 的同名函数一致:
16
+ * 任何实现 `~standard` 的 schema(zod v3.24+/v4、valibot v1、arktype…)
17
+ * 整表校验,失败时每个 issue 映射为对应路径的 `FieldError`,成功时
18
+ * schema 的解析结果(coerce/transform)成为表单的 parsedValues 基线。
19
+ *
20
+ * 注意与 `createForm` 的 `validateDeps` 搭配:表单级校验轮对字段是
21
+ * 只设不清的,把参与校验的字段列进 `validateDeps`(如
22
+ * `['title', 'email']`)后,这些字段的用户修改会重跑整表 schema,
23
+ * 且上一轮的旧错误在下一轮按快照清理——react-f0rm 的跨字段依赖
24
+ * 机制,也是 schema 校验错误随输入消除的正路。
25
+ *
26
+ * 提交时的校验顺序:先跑已注册的字段级 validator(FormItem 的
27
+ * `validate`/`rules`),有失败即短路,表单级 schema 那一轮不再执行
28
+ * ——同一字段两种来源混用时以字段级为准,别在同一场表单里重复覆盖。
29
+ */
30
+ export declare function standardSchemaFormValidator<T extends Record<string, any>>(schema: StandardSchemaV1<T, any>): FormValidateFn<T>;