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
@@ -1,4 +1,5 @@
1
1
  import type { ReactNode } from 'react';
2
+ import type { ToastClassNames } from './Toast';
2
3
  type ToastPlacement = 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right';
3
4
  type ToastContainerProps = {
4
5
  children: ReactNode;
@@ -6,6 +7,15 @@ type ToastContainerProps = {
6
7
  maxCount?: number;
7
8
  /** Viewport edge the stack is pinned to. */
8
9
  placement?: ToastPlacement;
10
+ /**
11
+ * Semantic slot classes (AntD v6 `classNames` shape) for the whole
12
+ * toast family — `viewport` lands on the fixed stack this container
13
+ * renders, `item`/`content`/`close` flow to every toast (see
14
+ * {@link ToastClassNames}). Toasts are fired imperatively through
15
+ * `useToast()`/`toast()`, so this prop is the one place to theme
16
+ * them. Omitting it changes nothing.
17
+ */
18
+ classNames?: ToastClassNames;
9
19
  };
10
20
  export declare const toastPlacements: {
11
21
  readonly 'top-left': import("@linaria/core").LinariaClassName;
@@ -13,5 +23,5 @@ export declare const toastPlacements: {
13
23
  readonly 'bottom-left': import("@linaria/core").LinariaClassName;
14
24
  readonly 'bottom-right': import("@linaria/core").LinariaClassName;
15
25
  };
16
- export default function ToastContainer({ children, maxCount, placement, }: ToastContainerProps): import("react").JSX.Element;
26
+ export default function ToastContainer({ children, maxCount, placement, classNames, }: ToastContainerProps): import("react").JSX.Element;
17
27
  export type { ToastContainerProps, ToastPlacement };
@@ -1,15 +1,56 @@
1
1
  import type { ReactNode } from 'react';
2
+ type ToastVariant = 'info' | 'success' | 'warning' | 'danger';
2
3
  type ToastItem = {
3
4
  id: number;
4
- variant: 'info' | 'success' | 'warning' | 'danger';
5
+ variant: ToastVariant;
5
6
  content: ReactNode;
6
7
  duration: number;
7
8
  };
9
+ /**
10
+ * Patch accepted by `toast.update(id, patch)` and `useToast().update(id,
11
+ * patch)`. Only fields present in the patch change; an omitted (or
12
+ * undefined) field keeps the toast's current value.
13
+ */
14
+ type ToastUpdateOptions = {
15
+ /** Replacement message content. */
16
+ content?: ReactNode;
17
+ /** Replacement color variant. */
18
+ variant?: ToastVariant;
19
+ /** New auto-dismiss budget in ms. Changing it re-arms the countdown
20
+ * from the full value; leaving it out keeps the running countdown. */
21
+ duration?: number;
22
+ };
23
+ /** The `toast.promise` phases whose default copy lives in the locale pack. */
24
+ type ToastDeferredCopyKey = 'loading' | 'success' | 'error';
25
+ /**
26
+ * Sentinel ReactNode standing in for promise-phase copy that resolves
27
+ * against the locale pack at render time: `toast.promise` may fire from
28
+ * outside any React tree, so it cannot read `useStrings` itself — the
29
+ * container resolves the marker when it renders the toast. The sentinel
30
+ * rides the `content` channel as an opaque marker (cast once at the
31
+ * factory below); only the container ever interprets it.
32
+ */
33
+ type ToastDeferredCopy = {
34
+ readonly deferredCopy: ToastDeferredCopyKey;
35
+ };
36
+ /** Creates the locale-deferred sentinel for one promise phase. */
37
+ declare function deferredToastCopy(key: ToastDeferredCopyKey): ReactNode;
38
+ declare function deferredCopyKey(node: ReactNode): ToastDeferredCopyKey | null;
39
+ /**
40
+ * Pure merge of an update patch onto a toast item: keys absent (or
41
+ * undefined) in the patch keep the item's current value, so an update
42
+ * never clobbers fields it did not name.
43
+ */
44
+ declare function applyToastPatch(item: ToastItem, patch: ToastUpdateOptions): ToastItem;
8
45
  type ToastContextValue = {
9
46
  toasts: ToastItem[];
10
- addToast: (toast: Omit<ToastItem, 'id'>) => void;
47
+ addToast: (toast: Omit<ToastItem, 'id'>) => number;
11
48
  removeToast: (id: number) => void;
49
+ /** Patches a live toast in place — the same id and React key, so the
50
+ * enter/exit animations never replay (see `toast.update`). */
51
+ updateToast: (id: number, patch: ToastUpdateOptions) => void;
12
52
  };
13
53
  export declare const ToastProvider: import("react").Provider<ToastContextValue | undefined>;
14
54
  export declare function useToastContext(): ToastContextValue;
15
- export type { ToastItem, ToastContextValue };
55
+ export { applyToastPatch, deferredCopyKey, deferredToastCopy, };
56
+ export type { ToastDeferredCopy, ToastDeferredCopyKey, ToastItem, ToastContextValue, ToastUpdateOptions, ToastVariant, };
@@ -1,5 +1,5 @@
1
1
  export { default as Toast } from './Toast';
2
- export type { ToastProps } from './Toast';
2
+ export type { ToastProps, ToastClassNames } from './Toast';
3
3
  export { default as ToastContainer } from './ToastContainer';
4
4
  export type { ToastContainerProps } from './ToastContainer';
5
5
  export { default as useToast } from './useToast';
@@ -1,6 +1,5 @@
1
1
  import type { ReactNode } from 'react';
2
- import type { ToastItem } from './ToastContext';
3
- type ToastVariant = ToastItem['variant'];
2
+ import type { ToastDeferredCopyKey, ToastItem, ToastUpdateOptions, ToastVariant } from './ToastContext';
4
3
  /** Options accepted by `toast()` — the same call shape `useToast()` takes. */
5
4
  type ToastOptions = {
6
5
  variant?: ToastVariant;
@@ -8,10 +7,29 @@ type ToastOptions = {
8
7
  };
9
8
  /** Options accepted by the variant sugar methods (`toast.success()` …). */
10
9
  type ToastVariantOptions = Omit<ToastOptions, 'variant'>;
10
+ /** Copy for one `toast.promise` phase: a literal, or derived from the
11
+ * settled value / rejection when the promise settles. */
12
+ type ToastPhaseContent<T> = ReactNode | ((data: T) => ReactNode);
13
+ /** Options accepted by `toast.promise(promise, options)`. */
14
+ type ToastPromiseOptions<T> = {
15
+ /** Copy shown while the promise is pending. Defaults to the locale
16
+ * pack's `toast.loading`. The loading toast never auto-dismisses. */
17
+ loading?: ReactNode;
18
+ /** Copy shown once the promise resolves; a function receives the
19
+ * resolved value. Defaults to the locale pack's `toast.success`. */
20
+ success?: ToastPhaseContent<T>;
21
+ /** Copy shown once the promise rejects; a function receives the
22
+ * rejection value. Defaults to the locale pack's `toast.error`. */
23
+ error?: ToastPhaseContent<unknown>;
24
+ /** Auto-dismiss delay in ms applied once the promise settles — the
25
+ * loading toast stays until then. Defaults to 3000. */
26
+ duration?: number;
27
+ };
11
28
  /** Sink a mounted `ToastContainer` registers to receive imperative calls. */
12
29
  type ToastChannel = {
13
30
  onToast: (item: ToastItem) => void;
14
31
  onDismiss: (id?: number) => void;
32
+ onUpdate: (id: number, patch: ToastUpdateOptions) => void;
15
33
  };
16
34
  /**
17
35
  * The single id sequence, shared by this module and the container's
@@ -21,7 +39,8 @@ export declare function nextToastId(): number;
21
39
  /**
22
40
  * Fires a toast without `useToast` — module-level, callable from anywhere
23
41
  * (outside React, in event callbacks, before a container has mounted).
24
- * Returns the toast id, usable with `toast.dismiss(id)`.
42
+ * Returns the toast id, usable with `toast.dismiss(id)` and
43
+ * `toast.update(id, patch)`.
25
44
  *
26
45
  * Mirrors the `useToast()` call shape (content + `{variant, duration}`,
27
46
  * defaulting to `info` / 3000ms). With no container mounted the toast is
@@ -35,7 +54,19 @@ declare namespace toast {
35
54
  var warning: (content: ReactNode, options?: ToastVariantOptions) => number;
36
55
  var danger: (content: ReactNode, options?: ToastVariantOptions) => number;
37
56
  var dismiss: (id?: number) => void;
57
+ var update: (id: number, patch: ToastUpdateOptions) => void;
58
+ var promise: <T>(p: Promise<T>, options?: ToastPromiseOptions<T>) => Promise<T>;
38
59
  }
60
+ /**
61
+ * Shared engine behind `toast.promise` and `useToast().promise`: fires the
62
+ * loading toast through `show` (persistent — duration 0), then patches it
63
+ * in place when the promise settles, so the toast never remounts and its
64
+ * animations never replay. Returns the original promise untouched:
65
+ * rejections keep propagating to the caller's `await`/`catch`, and a
66
+ * loading toast dismissed before settling is simply not found by the
67
+ * update — it never resurrects.
68
+ */
69
+ export declare function driveToastPromise<T>(show: (content: ReactNode, options?: ToastOptions) => number, updateById: (id: number, patch: ToastUpdateOptions) => void, promise: Promise<T>, options?: ToastPromiseOptions<T>): Promise<T>;
39
70
  /**
40
71
  * Called from `ToastContainer`'s mount effect. The first subscriber also
41
72
  * replays everything queued before any container existed, in call order;
@@ -43,4 +74,4 @@ declare namespace toast {
43
74
  */
44
75
  export declare function subscribeToastChannel(channel: ToastChannel): () => void;
45
76
  export { toast };
46
- export type { ToastOptions, ToastVariant, ToastVariantOptions };
77
+ export type { ToastDeferredCopyKey, ToastOptions, ToastPhaseContent, ToastPromiseOptions, ToastUpdateOptions, ToastVariant, ToastVariantOptions, };
@@ -1,5 +1,17 @@
1
1
  import type { ReactNode } from 'react';
2
- export default function useToast(): (content: ReactNode, options?: {
3
- variant?: "info" | "success" | "warning" | "danger";
4
- duration?: number;
5
- }) => void;
2
+ import type { ToastOptions, ToastPromiseOptions, ToastUpdateOptions } from './toast';
3
+ /**
4
+ * The `useToast()` return value: the toast trigger itself (returns the id,
5
+ * usable with `update`) plus `update` and `promise` — one-to-one with the
6
+ * module-level `toast` API, but routed through the enclosing container's
7
+ * context instead of the first-mounted channel subscriber.
8
+ */
9
+ type ShowToast = {
10
+ (content: ReactNode, options?: ToastOptions): number;
11
+ /** Patches a toast in place — see `toast.update`. */
12
+ update: (id: number, patch: ToastUpdateOptions) => void;
13
+ /** Loading → success/danger lifecycle — see `toast.promise`. */
14
+ promise: <T>(promise: Promise<T>, options?: ToastPromiseOptions<T>) => Promise<T>;
15
+ };
16
+ export default function useToast(): ShowToast;
17
+ export type { ShowToast };
@@ -0,0 +1,19 @@
1
+ import type { ComponentPropsWithoutRef, Ref } from 'react';
2
+ import type { ControlOrValue } from 'react-use-control';
3
+ type ToggleProps = {
4
+ /** Whether the toggle is pressed; a control for full external ownership. */
5
+ pressed?: ControlOrValue<boolean>;
6
+ size?: 'sm' | 'md' | 'lg';
7
+ /** Equal padding on all sides — for icon-only square toggles. */
8
+ square?: boolean;
9
+ /** Forwarded to the underlying `<button>` — form bridges and
10
+ * `ref.current.focus()` reach. */
11
+ ref?: Ref<HTMLButtonElement>;
12
+ } & Omit<ComponentPropsWithoutRef<'button'>, 'type' | 'aria-pressed'>;
13
+ /**
14
+ * A momentary pressed-state button (aria-pressed) for one-shot modes —
15
+ * bold, mute, grid/list view. `pressed` is one prop, two modes: a plain
16
+ * boolean leaves state internal, a control hands ownership to the caller.
17
+ */
18
+ export default function Toggle({ pressed: pressedControl, size, square, className, onClick, ref, ...rest }: ToggleProps): import("react").JSX.Element;
19
+ export type { ToggleProps };
@@ -0,0 +1,23 @@
1
+ import type { ComponentPropsWithoutRef, Ref } from 'react';
2
+ type ToggleCoreProps = {
3
+ pressed: boolean;
4
+ onPressedChange: (pressed: boolean) => void;
5
+ /** Native click event passthrough — invoked with the DOM event after
6
+ * `onPressedChange`, so a spread can never override the controlled callback. */
7
+ onNativeClick?: ComponentPropsWithoutRef<'button'>['onClick'];
8
+ size?: 'sm' | 'md' | 'lg';
9
+ /** Equal padding on all sides — for icon-only square toggles. */
10
+ square?: boolean;
11
+ className?: string;
12
+ /** Forwarded to the `<button>` element. */
13
+ ref?: Ref<HTMLButtonElement>;
14
+ } & Omit<ComponentPropsWithoutRef<'button'>, 'type' | 'aria-pressed'>;
15
+ /**
16
+ * The controlled half of Toggle: a momentary pressed-state button
17
+ * (`<button aria-pressed>`) — one-shot commands like bold/mute, not the
18
+ * on/off *setting* that Switch's `role="switch"` carries. State never
19
+ * lives here: it renders `pressed` and reports clicks through
20
+ * `onPressedChange`, so the sugar (or any owner) owns the truth.
21
+ */
22
+ export default function ToggleCore({ pressed, onPressedChange, onNativeClick, size, square, className, ref, ...rest }: ToggleCoreProps): import("react").JSX.Element;
23
+ export type { ToggleCoreProps };
@@ -0,0 +1,4 @@
1
+ export { default as Toggle } from './Toggle';
2
+ export type { ToggleProps } from './Toggle';
3
+ export { default as ToggleCore } from './ToggleCore';
4
+ export type { ToggleCoreProps } from './ToggleCore';
@@ -0,0 +1,19 @@
1
+ import type { ComponentPropsWithoutRef } from 'react';
2
+ import type { ControlOrValue } from 'react-use-control';
3
+ /**
4
+ * A toolbar item that toggles: ToolbarButton's skin and roving behavior
5
+ * with a pressed state of its own. `pressed` is self-contained by
6
+ * default (no external wiring needed) and switches to external ownership
7
+ * when passed a control. The pressed look is keyed off `aria-pressed`,
8
+ * so the visual state can never drift from what assistive tech announces.
9
+ */
10
+ type ToolbarToggleProps = {
11
+ /** Whether the item is pressed; a control for full external ownership. */
12
+ pressed?: ControlOrValue<boolean>;
13
+ variant?: 'solid' | 'outline' | 'ghost';
14
+ size?: 'sm' | 'md' | 'lg';
15
+ /** Equal padding on all sides — for icon-only square items. */
16
+ square?: boolean;
17
+ } & Omit<ComponentPropsWithoutRef<'button'>, 'type' | 'aria-pressed'>;
18
+ export default function ToolbarToggle({ pressed: pressedControl, variant, size, square, className, onClick, ...rest }: ToolbarToggleProps): import("react").JSX.Element;
19
+ export type { ToolbarToggleProps };
@@ -4,3 +4,5 @@ export { default as ToolbarButton } from './ToolbarButton';
4
4
  export type { ToolbarButtonProps } from './ToolbarButton';
5
5
  export { default as ToolbarSeparator } from './ToolbarSeparator';
6
6
  export type { ToolbarSeparatorProps } from './ToolbarSeparator';
7
+ export { default as ToolbarToggle } from './ToolbarToggle';
8
+ export type { ToolbarToggleProps } from './ToolbarToggle';
@@ -4,9 +4,9 @@ import type { FloatingPlacement } from '../../utils/floating';
4
4
  /** Why the tour closed: the last step's Done button vs. an early exit. */
5
5
  type TourCloseReason = 'done' | 'skip';
6
6
  /**
7
- * Step-card placement relative to the spotlighted target — physical
8
- * semantics, the anchorable subset of FloatingPlacement ('point' has no
9
- * meaning without a floating trigger pair).
7
+ * Step-card placement relative to the spotlighted target — logical
8
+ * semantics (mirrors under RTL, like FloatingPlacement), the anchorable
9
+ * subset ('point' has no meaning without a floating trigger pair).
10
10
  */
11
11
  type TourPlacement = Exclude<FloatingPlacement, 'point'>;
12
12
  type TourStep = {
@@ -1,3 +1,3 @@
1
- import type { TreeProps } from './types';
2
- export default function Tree({ treeData, multiple, checkable, checkStrictly, selectable, disabled, blockNode, showLine, showIcon, switcherIcon, loadingIcon, titleRender, iconRender, expandedKeys: expandedKeysControl, selectedKeys: selectedKeysControl, checkedKeys: checkedKeysControl, className, onExpand, onSelect, onCheck, }: TreeProps): import("react").JSX.Element;
3
- export type { TreeProps };
1
+ import type { TreeProps, TreeVirtualizedConfig } from './types';
2
+ export default function Tree({ treeData, multiple, checkable, checkStrictly, selectable, disabled, blockNode, showLine, showIcon, switcherIcon, loadingIcon, titleRender, iconRender, virtualized, loadData, searchValue, expandedKeys: expandedKeysControl, selectedKeys: selectedKeysControl, checkedKeys: checkedKeysControl, className, onExpand, onSelect, onCheck, }: TreeProps): import("react").JSX.Element;
3
+ export type { TreeProps, TreeVirtualizedConfig };
@@ -15,12 +15,27 @@ type TreeItemProps = {
15
15
  switcherIcon?: ReactNode;
16
16
  loadingIcon?: ReactNode;
17
17
  loading: boolean;
18
+ /**
19
+ * Lazy loading is armed (`loadData` provided): a childless node
20
+ * without `isLeaf: true` renders as expandable instead of a leaf.
21
+ */
22
+ loadable?: boolean;
23
+ /** The last lazy load of this node rejected — show the retry note. */
24
+ loadFailed?: boolean;
25
+ /** Active search query — string titles highlight their matches. */
26
+ searchValue?: string;
18
27
  titleRender?: (node: TreeNodeData) => ReactNode;
19
28
  iconRender?: (node: TreeNodeData) => ReactNode;
20
29
  isLast: boolean[];
30
+ /**
31
+ * Roving-tabindex stop (WAI-ARIA tree pattern): `0` on the row that
32
+ * owns the tree's single tab stop, `-1` on every other row.
33
+ */
34
+ tabIndex: 0 | -1;
21
35
  onToggle: () => void;
22
36
  onSelect: () => void;
23
37
  onCheck: () => void;
38
+ onRetry?: () => void;
24
39
  };
25
- export default function TreeItem({ node, level, expanded, selected, checked, disabled, checkable, selectable, blockNode, showLine, showIcon, switcherIcon, loadingIcon: loadingIconProp, loading, titleRender, iconRender, isLast, onToggle, onSelect, onCheck, }: TreeItemProps): import("react").JSX.Element;
40
+ export default function TreeItem({ node, level, expanded, selected, checked, disabled, checkable, selectable, blockNode, showLine, showIcon, switcherIcon, loadingIcon: loadingIconProp, loading, loadable, loadFailed, searchValue, titleRender, iconRender, isLast, tabIndex, onToggle, onSelect, onCheck, onRetry, }: TreeItemProps): import("react").JSX.Element;
26
41
  export {};
@@ -32,6 +32,20 @@ export type TreeState = {
32
32
  checkedKeys: string[];
33
33
  halfCheckedKeys: string[];
34
34
  };
35
+ /**
36
+ * Virtualized windowing metrics for `Tree.virtualized`.
37
+ */
38
+ export type TreeVirtualizedConfig = {
39
+ /** Scrollport height in px. Default `320`. */
40
+ height?: number;
41
+ /** Row height in px. Default `32` — the treeitem min-height (2rem). */
42
+ itemHeight?: number;
43
+ /**
44
+ * Extra rows kept mounted above/below the visible window. Defaults to
45
+ * `VirtualList`'s `5`.
46
+ */
47
+ overscan?: number;
48
+ };
35
49
  /**
36
50
  * Tree 组件 Props
37
51
  */
@@ -62,6 +76,43 @@ export type TreeProps = {
62
76
  titleRender?: (node: TreeNodeData) => ReactNode;
63
77
  /** 自定义节点图标渲染 */
64
78
  iconRender?: (node: TreeNodeData) => ReactNode;
79
+ /**
80
+ * Render the tree through `VirtualList` so large trees mount only the
81
+ * visible window (plus overscan) instead of the full DOM list: the
82
+ * visible rows are flattened depth-first (depth indent preserved) and
83
+ * windowed. `false`/omitted (default) keeps the plain nested DOM
84
+ * path; an object additionally customizes row metrics.
85
+ * `expandedKeys`/`selectedKeys`/`checkedKeys` semantics are identical
86
+ * in both paths, and roving-tabindex keyboard navigation works the
87
+ * same way — focus moves `scrollToIndex` the target row into the
88
+ * window before focusing it.
89
+ */
90
+ virtualized?: boolean | TreeVirtualizedConfig;
91
+ /**
92
+ * Async child loading: called when a node **without** `children` and
93
+ * without `isLeaf: true` is expanded (by click, keyboard, controlled
94
+ * `expandedKeys`, or the auto-expanded ancestor path of a search hit).
95
+ *
96
+ * While the promise is pending the node's switcher shows the loading
97
+ * spinner; resolved children are merged into an internal cache, so
98
+ * collapsing and re-expanding does **not** request again. Cache entries
99
+ * are dropped when the controlled `treeData` no longer maps onto them
100
+ * (the key disappeared, or the node now ships children of its own —
101
+ * controlled data always wins). An empty array marks the node as a
102
+ * leaf. A rejected promise renders an inline "Load failed · Retry"
103
+ * affordance on the node row; expanding a failed node again also
104
+ * retries.
105
+ */
106
+ loadData?: (node: TreeNodeData) => Promise<TreeNodeData[]>;
107
+ /**
108
+ * Search filter: when non-empty, only nodes whose (string) title
109
+ * matches case-insensitively — plus the ancestor path leading to
110
+ * them — are rendered, ancestors auto-expanded so hits stay visible,
111
+ * and every match is wrapped in a token-styled `<mark>`. `titleRender`
112
+ * output is passed through untouched. When nothing matches, the
113
+ * localized empty state is shown.
114
+ */
115
+ searchValue?: string;
65
116
  /** (受控)展开的节点 */
66
117
  expandedKeys?: ControlOrValue<string[]>;
67
118
  /** (受控)选中的节点 */
@@ -1,6 +1,79 @@
1
1
  import type { TreeNodeData } from './types';
2
+ /**
3
+ * A visible tree row: one treeitem in the depth-first order the tree
4
+ * renders (parents before children, expanded subtrees only). Backs both
5
+ * the roving-tabindex keyboard navigation and the virtualized windowing,
6
+ * which need the flat "visible rows" list rather than the recursive
7
+ * structure.
8
+ */
9
+ export type VisibleTreeRow = {
10
+ key: string;
11
+ node: TreeNodeData;
12
+ /** Nesting depth; 0 for roots — matches TreeItem's `level` prop. */
13
+ level: number;
14
+ /** Parent row's key; null for roots. */
15
+ parentKey: string | null;
16
+ /**
17
+ * showLine guide chain: one "is a last child" flag per ancestor level
18
+ * (length === level), the same chain the recursive render builds.
19
+ */
20
+ isLast: boolean[];
21
+ /**
22
+ * Tree-level or per-node disabled flag. Disabled rows render (and can
23
+ * be expanded through controlled `expandedKeys`) but are skipped as
24
+ * keyboard focus stops.
25
+ */
26
+ disabled: boolean;
27
+ };
28
+ /**
29
+ * Flatten the tree to its currently visible rows: children of a node are
30
+ * included only while that node is expanded — the exact visibility rule
31
+ * of the recursive render (`children?.length && expandedKeys.has(key)`).
32
+ */
33
+ export declare function flattenVisibleTree(data: TreeNodeData[], expandedKeys: string[], treeDisabled: boolean): VisibleTreeRow[];
2
34
  export declare function flattenTreeData(data: TreeNodeData[]): TreeNodeData[];
3
35
  export declare function findNodeByKey(data: TreeNodeData[], key: string): TreeNodeData | null;
4
36
  export declare function getChildKeys(data: TreeNodeData[], parentKey: string): string[];
5
37
  export declare function getParentKey(data: TreeNodeData[], targetKey: string, parentKey?: string): string | null;
6
38
  export declare function getAllLeafKeys(data: TreeNodeData[]): string[];
39
+ /**
40
+ * Case-insensitive `[start, end)` ranges of every non-overlapping
41
+ * occurrence of `query` inside `text`, left to right. Empty when the
42
+ * query is empty or absent.
43
+ */
44
+ export declare function matchRanges(text: string, query: string): [number, number][];
45
+ /** Does the node's own title match? Only string titles can match —
46
+ * ReactNode titles stay searchable through their descendants. */
47
+ export declare function nodeTitleMatches(node: TreeNodeData, query: string): boolean;
48
+ /** Result of `filterTreeByQuery`. */
49
+ export type FilteredTree = {
50
+ /** The pruned tree: matched nodes plus the ancestors leading to them. */
51
+ tree: TreeNodeData[];
52
+ /** Keys whose own title matched the query. */
53
+ matchedKeys: string[];
54
+ /** Keys of the strict ancestors of matches — auto-expanded while the
55
+ * search is active so every hit stays visible. */
56
+ ancestorKeys: string[];
57
+ };
58
+ /**
59
+ * Filters the tree to the nodes whose own title matches `query`
60
+ * (case-insensitive) plus every ancestor on the path to them. Returns
61
+ * `null` when the query is empty (search inactive) so callers can keep
62
+ * the unfiltered data by reference.
63
+ */
64
+ export declare function filterTreeByQuery(data: TreeNodeData[], query: string | undefined): FilteredTree | null;
65
+ /**
66
+ * Overlays lazy-loaded children onto the controlled data: a childless
67
+ * node with a cache entry adopts the loaded array; an empty load marks
68
+ * the node as a leaf (the server said "no children"). Returns `data`
69
+ * untouched (same reference) when nothing is cached, so memoized
70
+ * downstream work stays stable.
71
+ */
72
+ export declare function mergeLoadedChildren(data: TreeNodeData[], loaded: Record<string, TreeNodeData[]>): TreeNodeData[];
73
+ /**
74
+ * Drops cache entries that no longer map onto the controlled data: keys
75
+ * that vanished, or nodes that now ship children of their own
76
+ * (controlled data wins over a stale load). Keeps the same reference
77
+ * when nothing is pruned.
78
+ */
79
+ export declare function pruneLoadedChildren(loaded: Record<string, TreeNodeData[]>, data: TreeNodeData[]): Record<string, TreeNodeData[]>;
@@ -1,15 +1,59 @@
1
- import type { ReactNode } from 'react';
1
+ import type { ReactNode, Ref } from 'react';
2
2
  import type { ControlOrValue } from 'react-use-control';
3
+ import type { UploadFileStatus, UploadHandle, UploadListItemRender, UploadRequest } from './types';
3
4
  type UploadProps = {
4
5
  /** Selected files; uncontrolled (accumulating internally) when omitted. */
5
6
  value?: ControlOrValue<File[]>;
6
7
  accept?: string;
8
+ /** Renders the drag-and-drop drop area (default) or a plain
9
+ * click-only picker area — see `UploadCoreProps.droppable`. */
10
+ droppable?: boolean;
11
+ /** Gatekeeper for every picked or dropped file — see
12
+ * `UploadCoreProps.beforeUpload`. */
13
+ beforeUpload?: (file: File) => boolean | Promise<boolean>;
14
+ /** Cap for the committed list — see `UploadCoreProps.maxCount`. */
15
+ maxCount?: number;
7
16
  multiple?: boolean;
17
+ /** Custom upload executor — see `UploadCoreProps.request`. */
18
+ request?: UploadRequest;
19
+ /** Upload endpoint for the built-in XHR executor — see
20
+ * `UploadCoreProps.action`. */
21
+ action?: string;
22
+ /** HTTP method for `action` uploads (default `POST`). */
23
+ method?: string;
24
+ /** Extra request headers for `action` uploads. */
25
+ headers?: Record<string, string>;
26
+ /** Form field name carrying the file in `action` mode (default `file`). */
27
+ name?: string;
28
+ /** Extra form fields appended alongside the file in `action` mode. */
29
+ data?: Record<string, string | Blob>;
30
+ /** Picks only enter the list; uploads start via the `UploadHandle`
31
+ * ref — see `UploadCoreProps.manual`. */
32
+ manual?: boolean;
33
+ /** Built-in file list with progress and per-state actions — see
34
+ * `UploadCoreProps.showUploadList`. */
35
+ showUploadList?: boolean | {
36
+ itemRender?: UploadListItemRender;
37
+ };
38
+ /** Rendering style of the built-in list (`text` rows or a
39
+ * `picture-card` thumbnail grid) — see `UploadCoreProps.listType`. */
40
+ listType?: 'text' | 'picture-card';
41
+ /** Overrides the built-in remove-button label — see
42
+ * `UploadCoreProps.removeLabel`. */
43
+ removeLabel?: string;
44
+ /** Picks directories instead of files — see
45
+ * `UploadCoreProps.directory`. */
46
+ directory?: boolean;
47
+ /** Status-machine snapshot callback — see
48
+ * `UploadCoreProps.onStatusChange`. */
49
+ onStatusChange?: (files: UploadFileStatus[]) => void;
8
50
  /** Fires with the freshly picked files only — the accumulated list is
9
- * the `value` channel (or internal state when uncontrolled). */
51
+ * the `value` channel (or internal state when uncontrolled).
52
+ * Removals and `clear()` do not fire this (they are not picks). */
10
53
  onChange?: (files: File[]) => void;
11
54
  className?: string;
12
55
  children?: ReactNode;
56
+ ref?: Ref<UploadHandle>;
13
57
  };
14
- export default function Upload({ value: valueControl, accept, multiple, onChange, className, children, }: UploadProps): import("react").JSX.Element;
58
+ export default function Upload({ value: valueControl, accept, droppable, beforeUpload, maxCount, multiple, request, action, method, headers, name, data, manual, showUploadList, listType, removeLabel, directory, onStatusChange, onChange, className, children, ref, }: UploadProps): import("react").JSX.Element;
15
59
  export type { UploadProps };
@@ -1,15 +1,106 @@
1
- import type { ComponentPropsWithoutRef, ReactNode } from 'react';
1
+ import type { ComponentPropsWithoutRef, ReactNode, Ref } from 'react';
2
+ import type { UploadFileStatus, UploadHandle, UploadListItemRender, UploadRequest } from './types';
2
3
  type UploadCoreProps = {
3
4
  /** The selected files — the field value, emitted verbatim (as the
4
5
  * complete next list) by `onChange`. */
5
6
  value: File[];
6
7
  /** Emits the next file list: a single pick replaces `value`, a
7
- * `multiple` pick appends to it. */
8
+ * `multiple` pick appends to it. Removals from the built-in list
9
+ * (and `clear()`) also flow through here. */
8
10
  onChange: (files: File[]) => void;
11
+ /** Comma-separated accept tokens (`.txt`, `image/*`, `text/plain`) —
12
+ * the same grammar the native picker uses. Dropped files that do not
13
+ * match are discarded silently (the native dialog already enforces
14
+ * this for click picks). */
9
15
  accept?: string;
16
+ /** Gate for the drag-and-drop affordance. `true` (default) renders
17
+ * the dashed drop area with a drag-over highlight and accepts dropped
18
+ * files; `false` renders a plain click-only picker area. */
19
+ droppable?: boolean;
20
+ /** Gatekeeper applied to every file — click picks and drops alike —
21
+ * before it enters the value: return `false` (or a promise resolving
22
+ * to `false`) to drop the file. Verdicts for one pick are awaited
23
+ * together (`Promise.all`) and committed as a single `onChange` once
24
+ * every verdict resolved; the UI is not blocked while waiting.
25
+ * A refused file never enters the list, so it never uploads. */
26
+ beforeUpload?: (file: File) => boolean | Promise<boolean>;
27
+ /** Cap for the committed list. Applied last: existing entries win,
28
+ * then the freshly picked survivors; anything beyond the first
29
+ * `maxCount` entries is discarded silently. */
30
+ maxCount?: number;
31
+ /** A `multiple` pick appends to `value`, a single pick replaces it. */
10
32
  multiple?: boolean;
33
+ /**
34
+ * Custom upload executor. When given, every file entering the list
35
+ * (see `manual`) runs through it: call `options.onProgress` with a
36
+ * 0–100 percent, honor `options.signal` for cancellation, resolve on
37
+ * success and reject on failure. Takes precedence over `action`.
38
+ * Neither `request` nor `action` → pure collection mode, exactly the
39
+ * pre-executor behavior.
40
+ */
41
+ request?: UploadRequest;
42
+ /**
43
+ * Upload endpoint for the built-in XHR executor: the file is sent as
44
+ * multipart FormData (field `name`, extra fields `data`) with `method`
45
+ * and `headers`; progress is wired to `xhr.upload.onprogress` and
46
+ * cancellation to `xhr.abort()`. Ignored when `request` is given.
47
+ */
48
+ action?: string;
49
+ /** HTTP method for `action` uploads — defaults to `POST`. */
50
+ method?: string;
51
+ /** Extra request headers for `action` uploads. */
52
+ headers?: Record<string, string>;
53
+ /** Form field name carrying the file in `action` mode — defaults
54
+ * to `file`. */
55
+ name?: string;
56
+ /** Extra form fields appended alongside the file in `action` mode. */
57
+ data?: Record<string, string | Blob>;
58
+ /**
59
+ * `true` keeps picked files at `idle` — the upload only starts via
60
+ * the `UploadHandle` ref (`upload()`/`uploadAll()`). Only meaningful
61
+ * with `request` or `action`.
62
+ */
63
+ manual?: boolean;
64
+ /**
65
+ * Renders the built-in file list below the zone (default `false`):
66
+ * file name, live progress (reusing `Progress`), status icon and
67
+ * per-state actions — cancel while uploading, retry + remove on
68
+ * error, remove otherwise. Pass an `itemRender` to replace whole
69
+ * rows. Without `request`/`action` the list still tracks picks as
70
+ * `idle` rows with remove actions.
71
+ */
72
+ showUploadList?: boolean | {
73
+ itemRender?: UploadListItemRender;
74
+ };
75
+ /**
76
+ * Rendering style of the built-in list (default `text`): `text`
77
+ * rows, or a `picture-card` grid of square thumbnail cards —
78
+ * object-URL previews for image files (revoked once the card leaves),
79
+ * a type-icon fallback for the rest, an upload mask with the live
80
+ * percent, and a danger border + retry on error.
81
+ */
82
+ listType?: 'text' | 'picture-card';
83
+ /**
84
+ * Overrides the built-in remove-button label (list rows and
85
+ * picture-card corners); defaults to the locale string.
86
+ */
87
+ removeLabel?: string;
88
+ /**
89
+ * Picks directories instead of files: forwards the non-standard
90
+ * `webkitdirectory`/`directory` attributes to the hidden input, so
91
+ * the native dialog enumerates every file inside the chosen folder
92
+ * (combine with `multiple` so the whole tree stays in the list).
93
+ */
94
+ directory?: boolean;
95
+ /**
96
+ * Fires whenever the tracked entries change (added, removed, status
97
+ * or percent) with the complete snapshot in value order. Only tracks
98
+ * while `request`/`action` or `showUploadList` is in play.
99
+ */
100
+ onStatusChange?: (files: UploadFileStatus[]) => void;
11
101
  className?: string;
12
102
  children?: ReactNode;
13
- } & Omit<ComponentPropsWithoutRef<'div'>, 'value' | 'onChange' | 'children' | 'onClick' | 'onDrop' | 'onDragOver' | 'role' | 'tabIndex'>;
14
- export default function UploadCore({ value, onChange, accept, multiple, className, children, ...rest }: UploadCoreProps): import("react").JSX.Element;
103
+ ref?: Ref<UploadHandle>;
104
+ } & Omit<ComponentPropsWithoutRef<'div'>, 'value' | 'onChange' | 'children' | 'onClick' | 'onDrop' | 'onDragOver' | 'onDragEnter' | 'onDragLeave' | 'onKeyDown' | 'role' | 'tabIndex'>;
105
+ export default function UploadCore({ value, onChange, accept, droppable, beforeUpload, maxCount, multiple, request, action, method, headers, name, data, manual, showUploadList, listType, removeLabel, directory, onStatusChange, className, children, ref, ...rest }: UploadCoreProps): import("react").JSX.Element;
15
106
  export type { UploadCoreProps };