@ug666/ui-react 0.3.0-beta.1 → 0.3.0-beta.3

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 (494) hide show
  1. package/LICENSE +21 -0
  2. package/dist/RELEASE_PROVENANCE.json +8 -0
  3. package/dist/THIRD_PARTY_NOTICES.txt +98 -0
  4. package/dist/ai/SKILL.md +242 -0
  5. package/dist/ai/manifest.json +815 -0
  6. package/dist/ai/references/components/accordion.md +41 -0
  7. package/dist/ai/references/components/admin-shell.md +27 -0
  8. package/dist/ai/references/components/alert.md +40 -0
  9. package/dist/ai/references/components/app-tabs.md +27 -0
  10. package/dist/ai/references/components/attachment-list.md +27 -0
  11. package/dist/ai/references/components/autocomplete.md +41 -0
  12. package/dist/ai/references/components/avatar-group.md +39 -0
  13. package/dist/ai/references/components/avatar.md +39 -0
  14. package/dist/ai/references/components/backtop.md +40 -0
  15. package/dist/ai/references/components/badge.md +43 -0
  16. package/dist/ai/references/components/bar-chart.md +41 -0
  17. package/dist/ai/references/components/breadcrumb.md +41 -0
  18. package/dist/ai/references/components/button.md +39 -0
  19. package/dist/ai/references/components/calendar.md +42 -0
  20. package/dist/ai/references/components/card.md +39 -0
  21. package/dist/ai/references/components/carousel.md +41 -0
  22. package/dist/ai/references/components/cascader.md +43 -0
  23. package/dist/ai/references/components/checkbox.md +40 -0
  24. package/dist/ai/references/components/collapse.md +41 -0
  25. package/dist/ai/references/components/color-picker.md +42 -0
  26. package/dist/ai/references/components/config-provider.md +39 -0
  27. package/dist/ai/references/components/confirm-dialog.md +27 -0
  28. package/dist/ai/references/components/container.md +39 -0
  29. package/dist/ai/references/components/context-menu.md +40 -0
  30. package/dist/ai/references/components/conversation-list.md +27 -0
  31. package/dist/ai/references/components/copy-field.md +27 -0
  32. package/dist/ai/references/components/data-panel.md +43 -0
  33. package/dist/ai/references/components/data-table-identity.md +27 -0
  34. package/dist/ai/references/components/data-table-toolbar.md +27 -0
  35. package/dist/ai/references/components/data-table.md +32 -0
  36. package/dist/ai/references/components/date-picker.md +42 -0
  37. package/dist/ai/references/components/date-range-picker.md +43 -0
  38. package/dist/ai/references/components/date-time-picker.md +40 -0
  39. package/dist/ai/references/components/descriptions.md +40 -0
  40. package/dist/ai/references/components/dialog.md +40 -0
  41. package/dist/ai/references/components/dock.md +41 -0
  42. package/dist/ai/references/components/donut-chart.md +41 -0
  43. package/dist/ai/references/components/drawer.md +41 -0
  44. package/dist/ai/references/components/dropdown.md +42 -0
  45. package/dist/ai/references/components/empty-state.md +40 -0
  46. package/dist/ai/references/components/fab.md +41 -0
  47. package/dist/ai/references/components/feature-grid.md +27 -0
  48. package/dist/ai/references/components/fieldset.md +41 -0
  49. package/dist/ai/references/components/file-input.md +41 -0
  50. package/dist/ai/references/components/form.md +42 -0
  51. package/dist/ai/references/components/gauge-chart.md +41 -0
  52. package/dist/ai/references/components/heatmap-chart.md +41 -0
  53. package/dist/ai/references/components/icon.md +39 -0
  54. package/dist/ai/references/components/image.md +41 -0
  55. package/dist/ai/references/components/index.md +171 -0
  56. package/dist/ai/references/components/indicator.md +41 -0
  57. package/dist/ai/references/components/infinite-scroll.md +42 -0
  58. package/dist/ai/references/components/input.md +42 -0
  59. package/dist/ai/references/components/join.md +40 -0
  60. package/dist/ai/references/components/kbd.md +40 -0
  61. package/dist/ai/references/components/label.md +39 -0
  62. package/dist/ai/references/components/landing-hero.md +27 -0
  63. package/dist/ai/references/components/layout.md +39 -0
  64. package/dist/ai/references/components/link.md +41 -0
  65. package/dist/ai/references/components/list.md +41 -0
  66. package/dist/ai/references/components/loading.md +40 -0
  67. package/dist/ai/references/components/message.md +27 -0
  68. package/dist/ai/references/components/modal.md +42 -0
  69. package/dist/ai/references/components/navbar.md +41 -0
  70. package/dist/ai/references/components/navigation-menu.md +41 -0
  71. package/dist/ai/references/components/notification.md +41 -0
  72. package/dist/ai/references/components/number-input.md +40 -0
  73. package/dist/ai/references/components/otp-input.md +40 -0
  74. package/dist/ai/references/components/page-header.md +27 -0
  75. package/dist/ai/references/components/pagination.md +42 -0
  76. package/dist/ai/references/components/popconfirm.md +42 -0
  77. package/dist/ai/references/components/popover.md +41 -0
  78. package/dist/ai/references/components/progress.md +41 -0
  79. package/dist/ai/references/components/prompt-composer.md +27 -0
  80. package/dist/ai/references/components/quick-access.md +30 -0
  81. package/dist/ai/references/components/radar-chart.md +41 -0
  82. package/dist/ai/references/components/radial-progress.md +41 -0
  83. package/dist/ai/references/components/radio.md +40 -0
  84. package/dist/ai/references/components/ranking-list.md +41 -0
  85. package/dist/ai/references/components/rating.md +42 -0
  86. package/dist/ai/references/components/result.md +40 -0
  87. package/dist/ai/references/components/scrollbar.md +39 -0
  88. package/dist/ai/references/components/select.md +41 -0
  89. package/dist/ai/references/components/selection-list.md +29 -0
  90. package/dist/ai/references/components/separator.md +39 -0
  91. package/dist/ai/references/components/sheet.md +40 -0
  92. package/dist/ai/references/components/sidebar.md +46 -0
  93. package/dist/ai/references/components/skeleton.md +40 -0
  94. package/dist/ai/references/components/slider.md +40 -0
  95. package/dist/ai/references/components/space.md +39 -0
  96. package/dist/ai/references/components/spinner.md +41 -0
  97. package/dist/ai/references/components/splitter.md +39 -0
  98. package/dist/ai/references/components/stack.md +41 -0
  99. package/dist/ai/references/components/stacked-bar-chart.md +41 -0
  100. package/dist/ai/references/components/statistic-card.md +41 -0
  101. package/dist/ai/references/components/statistic.md +41 -0
  102. package/dist/ai/references/components/steps.md +40 -0
  103. package/dist/ai/references/components/switch.md +40 -0
  104. package/dist/ai/references/components/table.md +41 -0
  105. package/dist/ai/references/components/tabs.md +41 -0
  106. package/dist/ai/references/components/tag.md +39 -0
  107. package/dist/ai/references/components/text.md +39 -0
  108. package/dist/ai/references/components/textarea.md +40 -0
  109. package/dist/ai/references/components/theme-configurator-dialog.md +27 -0
  110. package/dist/ai/references/components/theme-configurator.md +27 -0
  111. package/dist/ai/references/components/theme-controller.md +41 -0
  112. package/dist/ai/references/components/time-picker.md +42 -0
  113. package/dist/ai/references/components/time-range-picker.md +41 -0
  114. package/dist/ai/references/components/time-select.md +40 -0
  115. package/dist/ai/references/components/timeline.md +41 -0
  116. package/dist/ai/references/components/toast.md +39 -0
  117. package/dist/ai/references/components/tooltip.md +39 -0
  118. package/dist/ai/references/components/transfer.md +41 -0
  119. package/dist/ai/references/components/tree-select.md +45 -0
  120. package/dist/ai/references/components/tree-table.md +27 -0
  121. package/dist/ai/references/components/tree.md +43 -0
  122. package/dist/ai/references/components/trend-chart.md +41 -0
  123. package/dist/ai/references/components/upload.md +43 -0
  124. package/dist/ai/references/components.md +97 -0
  125. package/dist/ai/references/examples/data-table.md +50 -0
  126. package/dist/ai/references/release.md +158 -0
  127. package/dist/ai/ui-react.zip +0 -0
  128. package/dist/aliases.d.ts +62 -14
  129. package/dist/aliases.d.ts.map +1 -1
  130. package/dist/blocks/feature-grid.d.ts +8 -0
  131. package/dist/blocks/feature-grid.d.ts.map +1 -1
  132. package/dist/blocks/index.cjs +1 -467
  133. package/dist/blocks/index.cjs.map +1 -1
  134. package/dist/blocks/index.js +1 -194
  135. package/dist/blocks/index.js.map +1 -1
  136. package/dist/blocks/landing-hero.d.ts +6 -0
  137. package/dist/blocks/landing-hero.d.ts.map +1 -1
  138. package/dist/chunk-2EJWWTLH.cjs +1 -0
  139. package/dist/chunk-2EJWWTLH.cjs.map +1 -0
  140. package/dist/chunk-3A5O2NHW.cjs +1 -0
  141. package/dist/chunk-3A5O2NHW.cjs.map +1 -0
  142. package/dist/chunk-3LSTRFSY.js +1 -0
  143. package/dist/chunk-3LSTRFSY.js.map +1 -0
  144. package/dist/chunk-AQJWS45G.js +1 -0
  145. package/dist/chunk-AQJWS45G.js.map +1 -0
  146. package/dist/chunk-D63UPGP5.cjs +1 -0
  147. package/dist/chunk-D63UPGP5.cjs.map +1 -0
  148. package/dist/chunk-DJDACMBD.js +1 -0
  149. package/dist/chunk-DJDACMBD.js.map +1 -0
  150. package/dist/chunk-EYSM2SU5.cjs +1 -0
  151. package/dist/chunk-EYSM2SU5.cjs.map +1 -0
  152. package/dist/chunk-HCGUPREG.cjs +1 -0
  153. package/dist/chunk-HCGUPREG.cjs.map +1 -0
  154. package/dist/chunk-IOUGF444.cjs +1 -0
  155. package/dist/chunk-IOUGF444.cjs.map +1 -0
  156. package/dist/chunk-JJQENNZW.cjs +1 -0
  157. package/dist/chunk-JJQENNZW.cjs.map +1 -0
  158. package/dist/chunk-KNWHIFJE.js +1 -0
  159. package/dist/chunk-KNWHIFJE.js.map +1 -0
  160. package/dist/chunk-PZ4UH6BC.js +1 -0
  161. package/dist/chunk-PZ4UH6BC.js.map +1 -0
  162. package/dist/chunk-TWOBEV2L.js +1 -0
  163. package/dist/chunk-TWOBEV2L.js.map +1 -0
  164. package/dist/chunk-V4VCVCOX.js +1 -0
  165. package/dist/chunk-V4VCVCOX.js.map +1 -0
  166. package/dist/chunk-WQHHSYYD.js +1 -0
  167. package/dist/chunk-WQHHSYYD.js.map +1 -0
  168. package/dist/chunk-X4EMYHLY.cjs +1 -0
  169. package/dist/chunk-X4EMYHLY.cjs.map +1 -0
  170. package/dist/chunk-XN7GQRSF.js +1 -0
  171. package/dist/chunk-XN7GQRSF.js.map +1 -0
  172. package/dist/chunk-YI5JDPI2.cjs +1 -0
  173. package/dist/chunk-YI5JDPI2.cjs.map +1 -0
  174. package/dist/components/accordion.d.ts +8 -2
  175. package/dist/components/accordion.d.ts.map +1 -1
  176. package/dist/components/alert.d.ts +4 -5
  177. package/dist/components/alert.d.ts.map +1 -1
  178. package/dist/components/autocomplete.d.ts +21 -0
  179. package/dist/components/autocomplete.d.ts.map +1 -0
  180. package/dist/components/avatar.d.ts +4 -5
  181. package/dist/components/avatar.d.ts.map +1 -1
  182. package/dist/components/backtop.d.ts +11 -0
  183. package/dist/components/backtop.d.ts.map +1 -0
  184. package/dist/components/badge.d.ts +21 -2
  185. package/dist/components/badge.d.ts.map +1 -1
  186. package/dist/components/bar-chart.d.ts +23 -0
  187. package/dist/components/bar-chart.d.ts.map +1 -0
  188. package/dist/components/breadcrumb.d.ts +5 -1
  189. package/dist/components/breadcrumb.d.ts.map +1 -1
  190. package/dist/components/button-group.d.ts.map +1 -1
  191. package/dist/components/button.d.ts +12 -7
  192. package/dist/components/button.d.ts.map +1 -1
  193. package/dist/components/calendar.d.ts +40 -0
  194. package/dist/components/calendar.d.ts.map +1 -0
  195. package/dist/components/card.d.ts +8 -1
  196. package/dist/components/card.d.ts.map +1 -1
  197. package/dist/components/carousel.d.ts +29 -0
  198. package/dist/components/carousel.d.ts.map +1 -0
  199. package/dist/components/cascader.d.ts +54 -0
  200. package/dist/components/cascader.d.ts.map +1 -0
  201. package/dist/components/checkbox-group.d.ts.map +1 -1
  202. package/dist/components/checkbox.d.ts +4 -2
  203. package/dist/components/checkbox.d.ts.map +1 -1
  204. package/dist/components/collapsible.d.ts +23 -0
  205. package/dist/components/collapsible.d.ts.map +1 -0
  206. package/dist/components/color-picker.d.ts +19 -0
  207. package/dist/components/color-picker.d.ts.map +1 -0
  208. package/dist/components/config-provider.d.ts +2 -0
  209. package/dist/components/config-provider.d.ts.map +1 -1
  210. package/dist/components/context/form-context.d.ts.map +1 -1
  211. package/dist/components/context-menu.d.ts +1 -1
  212. package/dist/components/context-menu.d.ts.map +1 -1
  213. package/dist/components/data-panel.d.ts +38 -0
  214. package/dist/components/data-panel.d.ts.map +1 -0
  215. package/dist/components/date-picker.d.ts +16 -0
  216. package/dist/components/date-picker.d.ts.map +1 -0
  217. package/dist/components/date-range-picker.d.ts +42 -0
  218. package/dist/components/date-range-picker.d.ts.map +1 -0
  219. package/dist/components/date-time-picker.d.ts +12 -0
  220. package/dist/components/date-time-picker.d.ts.map +1 -0
  221. package/dist/components/descriptions.d.ts.map +1 -1
  222. package/dist/components/dialog.d.ts +9 -0
  223. package/dist/components/dialog.d.ts.map +1 -1
  224. package/dist/components/dock.d.ts +29 -0
  225. package/dist/components/dock.d.ts.map +1 -0
  226. package/dist/components/donut-chart.d.ts +30 -0
  227. package/dist/components/donut-chart.d.ts.map +1 -0
  228. package/dist/components/drawer.d.ts +11 -2
  229. package/dist/components/drawer.d.ts.map +1 -1
  230. package/dist/components/dropdown.d.ts +9 -1
  231. package/dist/components/dropdown.d.ts.map +1 -1
  232. package/dist/components/empty-state.d.ts +3 -0
  233. package/dist/components/empty-state.d.ts.map +1 -1
  234. package/dist/components/fab.d.ts +38 -0
  235. package/dist/components/fab.d.ts.map +1 -0
  236. package/dist/components/fieldset.d.ts +13 -0
  237. package/dist/components/fieldset.d.ts.map +1 -0
  238. package/dist/components/file-input.d.ts +17 -0
  239. package/dist/components/file-input.d.ts.map +1 -0
  240. package/dist/components/form.d.ts +2 -2
  241. package/dist/components/form.d.ts.map +1 -1
  242. package/dist/components/gauge-chart.d.ts +19 -0
  243. package/dist/components/gauge-chart.d.ts.map +1 -0
  244. package/dist/components/heatmap-chart.d.ts +28 -0
  245. package/dist/components/heatmap-chart.d.ts.map +1 -0
  246. package/dist/components/image-viewer.d.ts +15 -0
  247. package/dist/components/image-viewer.d.ts.map +1 -0
  248. package/dist/components/image.d.ts +14 -0
  249. package/dist/components/image.d.ts.map +1 -0
  250. package/dist/components/index.cjs +1 -8684
  251. package/dist/components/index.cjs.map +1 -1
  252. package/dist/components/index.d.ts +49 -1
  253. package/dist/components/index.d.ts.map +1 -1
  254. package/dist/components/index.js +1 -391
  255. package/dist/components/indicator.d.ts +20 -0
  256. package/dist/components/indicator.d.ts.map +1 -0
  257. package/dist/components/infinite-scroll.d.ts +20 -0
  258. package/dist/components/infinite-scroll.d.ts.map +1 -0
  259. package/dist/components/input.d.ts.map +1 -1
  260. package/dist/components/join.d.ts +20 -0
  261. package/dist/components/join.d.ts.map +1 -0
  262. package/dist/components/kbd.d.ts +8 -0
  263. package/dist/components/kbd.d.ts.map +1 -0
  264. package/dist/components/label.d.ts.map +1 -1
  265. package/dist/components/list.d.ts +21 -0
  266. package/dist/components/list.d.ts.map +1 -0
  267. package/dist/components/loading.d.ts +10 -0
  268. package/dist/components/loading.d.ts.map +1 -0
  269. package/dist/components/modal.d.ts +20 -3
  270. package/dist/components/modal.d.ts.map +1 -1
  271. package/dist/components/navbar.d.ts +23 -0
  272. package/dist/components/navbar.d.ts.map +1 -0
  273. package/dist/components/navigation-menu.d.ts +15 -0
  274. package/dist/components/navigation-menu.d.ts.map +1 -1
  275. package/dist/components/notification.d.ts +22 -0
  276. package/dist/components/notification.d.ts.map +1 -0
  277. package/dist/components/number-input.d.ts +4 -2
  278. package/dist/components/number-input.d.ts.map +1 -1
  279. package/dist/components/otp-input.d.ts +13 -3
  280. package/dist/components/otp-input.d.ts.map +1 -1
  281. package/dist/components/pagination.d.ts +12 -9
  282. package/dist/components/pagination.d.ts.map +1 -1
  283. package/dist/components/popconfirm.d.ts +20 -0
  284. package/dist/components/popconfirm.d.ts.map +1 -0
  285. package/dist/components/popover.d.ts +3 -2
  286. package/dist/components/popover.d.ts.map +1 -1
  287. package/dist/components/progress.d.ts +9 -0
  288. package/dist/components/progress.d.ts.map +1 -1
  289. package/dist/components/radar-chart.d.ts +24 -0
  290. package/dist/components/radar-chart.d.ts.map +1 -0
  291. package/dist/components/radial-progress.d.ts +18 -0
  292. package/dist/components/radial-progress.d.ts.map +1 -0
  293. package/dist/components/radio.d.ts +15 -6
  294. package/dist/components/radio.d.ts.map +1 -1
  295. package/dist/components/ranking-list.d.ts +31 -0
  296. package/dist/components/ranking-list.d.ts.map +1 -0
  297. package/dist/components/rating.d.ts +20 -0
  298. package/dist/components/rating.d.ts.map +1 -0
  299. package/dist/components/result.d.ts +13 -0
  300. package/dist/components/result.d.ts.map +1 -0
  301. package/dist/components/select.d.ts +2 -2
  302. package/dist/components/select.d.ts.map +1 -1
  303. package/dist/components/sheet.d.ts +11 -0
  304. package/dist/components/sheet.d.ts.map +1 -1
  305. package/dist/components/sidebar.d.ts +46 -10
  306. package/dist/components/sidebar.d.ts.map +1 -1
  307. package/dist/components/skeleton.d.ts +4 -5
  308. package/dist/components/skeleton.d.ts.map +1 -1
  309. package/dist/components/slider.d.ts.map +1 -1
  310. package/dist/components/space.d.ts.map +1 -1
  311. package/dist/components/spinner.d.ts +8 -5
  312. package/dist/components/spinner.d.ts.map +1 -1
  313. package/dist/components/splitter.d.ts +1 -0
  314. package/dist/components/splitter.d.ts.map +1 -1
  315. package/dist/components/stack.d.ts +16 -0
  316. package/dist/components/stack.d.ts.map +1 -0
  317. package/dist/components/stacked-bar-chart.d.ts +25 -0
  318. package/dist/components/stacked-bar-chart.d.ts.map +1 -0
  319. package/dist/components/statistic-card.d.ts +50 -0
  320. package/dist/components/statistic-card.d.ts.map +1 -0
  321. package/dist/components/statistic.d.ts +6 -1
  322. package/dist/components/statistic.d.ts.map +1 -1
  323. package/dist/components/steps.d.ts +3 -1
  324. package/dist/components/steps.d.ts.map +1 -1
  325. package/dist/components/switch.d.ts.map +1 -1
  326. package/dist/components/table.d.ts +15 -1
  327. package/dist/components/table.d.ts.map +1 -1
  328. package/dist/components/tabs.d.ts +13 -0
  329. package/dist/components/tabs.d.ts.map +1 -1
  330. package/dist/components/tag.d.ts +9 -4
  331. package/dist/components/tag.d.ts.map +1 -1
  332. package/dist/components/text.d.ts.map +1 -1
  333. package/dist/components/textarea.d.ts.map +1 -1
  334. package/dist/components/theme-controller.d.ts +24 -0
  335. package/dist/components/theme-controller.d.ts.map +1 -0
  336. package/dist/components/time-picker.d.ts +8 -0
  337. package/dist/components/time-picker.d.ts.map +1 -0
  338. package/dist/components/time-range-picker.d.ts +30 -0
  339. package/dist/components/time-range-picker.d.ts.map +1 -0
  340. package/dist/components/time-select.d.ts +15 -0
  341. package/dist/components/time-select.d.ts.map +1 -0
  342. package/dist/components/timeline.d.ts +22 -0
  343. package/dist/components/timeline.d.ts.map +1 -0
  344. package/dist/components/toast.d.ts +52 -6
  345. package/dist/components/toast.d.ts.map +1 -1
  346. package/dist/components/tooltip.d.ts +5 -2
  347. package/dist/components/tooltip.d.ts.map +1 -1
  348. package/dist/components/transfer.d.ts +51 -0
  349. package/dist/components/transfer.d.ts.map +1 -0
  350. package/dist/components/tree-select.d.ts +29 -0
  351. package/dist/components/tree-select.d.ts.map +1 -0
  352. package/dist/components/tree.d.ts +56 -0
  353. package/dist/components/tree.d.ts.map +1 -0
  354. package/dist/components/trend-chart.d.ts +43 -0
  355. package/dist/components/trend-chart.d.ts.map +1 -0
  356. package/dist/components/upload.d.ts +28 -0
  357. package/dist/components/upload.d.ts.map +1 -0
  358. package/dist/essentials.cjs +1 -0
  359. package/dist/essentials.cjs.map +1 -0
  360. package/dist/essentials.css +2 -0
  361. package/dist/essentials.d.ts +9 -0
  362. package/dist/essentials.d.ts.map +1 -0
  363. package/dist/essentials.js +1 -0
  364. package/dist/essentials.js.map +1 -0
  365. package/dist/hooks/index.cjs +1 -553
  366. package/dist/hooks/index.cjs.map +1 -1
  367. package/dist/hooks/index.js +1 -32
  368. package/dist/hooks/use-copy-to-clipboard.d.ts.map +1 -1
  369. package/dist/hooks/use-escape-key.d.ts +8 -1
  370. package/dist/hooks/use-escape-key.d.ts.map +1 -1
  371. package/dist/hooks/use-event-listener.d.ts +6 -7
  372. package/dist/hooks/use-event-listener.d.ts.map +1 -1
  373. package/dist/hooks/use-form.d.ts +17 -16
  374. package/dist/hooks/use-form.d.ts.map +1 -1
  375. package/dist/hooks/use-local-storage.d.ts.map +1 -1
  376. package/dist/hooks/use-media-query.d.ts.map +1 -1
  377. package/dist/hooks/use-pagination.d.ts.map +1 -1
  378. package/dist/index.cjs +1 -9206
  379. package/dist/index.cjs.map +1 -1
  380. package/dist/index.d.ts +64 -17
  381. package/dist/index.d.ts.map +1 -1
  382. package/dist/index.js +1 -419
  383. package/dist/internal/data-table-header.d.ts +20 -0
  384. package/dist/internal/data-table-header.d.ts.map +1 -0
  385. package/dist/internal/date-time/date-mode-panel.d.ts +9 -0
  386. package/dist/internal/date-time/date-mode-panel.d.ts.map +1 -0
  387. package/dist/internal/date-time/date-time-control.d.ts +33 -0
  388. package/dist/internal/date-time/date-time-control.d.ts.map +1 -0
  389. package/dist/internal/date-time/date-time-range-control.d.ts +27 -0
  390. package/dist/internal/date-time/date-time-range-control.d.ts.map +1 -0
  391. package/dist/internal/date-time/time-panel.d.ts +8 -0
  392. package/dist/internal/date-time/time-panel.d.ts.map +1 -0
  393. package/dist/internal/navigation/admin-horizontal-navigation.d.ts +9 -0
  394. package/dist/internal/navigation/admin-horizontal-navigation.d.ts.map +1 -0
  395. package/dist/internal/navigation/sidebar-navigation.d.ts +55 -0
  396. package/dist/internal/navigation/sidebar-navigation.d.ts.map +1 -0
  397. package/dist/internal/overlay/use-floating-layout-observer.d.ts +8 -0
  398. package/dist/internal/overlay/use-floating-layout-observer.d.ts.map +1 -0
  399. package/dist/internal/overlay/use-overlay-focus.d.ts +9 -0
  400. package/dist/internal/overlay/use-overlay-focus.d.ts.map +1 -0
  401. package/dist/internal/overlay/use-portal-container.d.ts.map +1 -0
  402. package/dist/internal/overlay/use-presence.d.ts +13 -0
  403. package/dist/internal/overlay/use-presence.d.ts.map +1 -0
  404. package/dist/internal/selection/option-window.d.ts +9 -0
  405. package/dist/internal/selection/option-window.d.ts.map +1 -0
  406. package/dist/internal/selection/use-cascader-lazy.d.ts +8 -0
  407. package/dist/internal/selection/use-cascader-lazy.d.ts.map +1 -0
  408. package/dist/internal/selection/use-transfer-remote.d.ts +20 -0
  409. package/dist/internal/selection/use-transfer-remote.d.ts.map +1 -0
  410. package/dist/internal/selection/use-tree-data.d.ts +8 -0
  411. package/dist/internal/selection/use-tree-data.d.ts.map +1 -0
  412. package/dist/patterns/admin-shell.d.ts +68 -2
  413. package/dist/patterns/admin-shell.d.ts.map +1 -1
  414. package/dist/patterns/app-tabs.d.ts +33 -0
  415. package/dist/patterns/app-tabs.d.ts.map +1 -0
  416. package/dist/patterns/attachment-list.d.ts +36 -0
  417. package/dist/patterns/attachment-list.d.ts.map +1 -0
  418. package/dist/patterns/confirm-dialog.d.ts.map +1 -1
  419. package/dist/patterns/conversation-list.d.ts +27 -0
  420. package/dist/patterns/conversation-list.d.ts.map +1 -0
  421. package/dist/patterns/copy-field.d.ts +6 -0
  422. package/dist/patterns/copy-field.d.ts.map +1 -1
  423. package/dist/patterns/data-table-identity.d.ts +14 -0
  424. package/dist/patterns/data-table-identity.d.ts.map +1 -0
  425. package/dist/patterns/data-table-toolbar.d.ts +18 -0
  426. package/dist/patterns/data-table-toolbar.d.ts.map +1 -0
  427. package/dist/patterns/data-table.d.ts +69 -0
  428. package/dist/patterns/data-table.d.ts.map +1 -0
  429. package/dist/patterns/index.cjs +1 -1206
  430. package/dist/patterns/index.cjs.map +1 -1
  431. package/dist/patterns/index.d.ts +14 -1
  432. package/dist/patterns/index.d.ts.map +1 -1
  433. package/dist/patterns/index.js +1 -375
  434. package/dist/patterns/index.js.map +1 -1
  435. package/dist/patterns/message.d.ts +30 -0
  436. package/dist/patterns/message.d.ts.map +1 -0
  437. package/dist/patterns/page-header.d.ts +4 -0
  438. package/dist/patterns/page-header.d.ts.map +1 -1
  439. package/dist/patterns/prompt-composer.d.ts +55 -0
  440. package/dist/patterns/prompt-composer.d.ts.map +1 -0
  441. package/dist/patterns/quick-access.d.ts +39 -0
  442. package/dist/patterns/quick-access.d.ts.map +1 -0
  443. package/dist/patterns/selection-list.d.ts +34 -0
  444. package/dist/patterns/selection-list.d.ts.map +1 -0
  445. package/dist/patterns/theme-configurator-dialog.d.ts +21 -0
  446. package/dist/patterns/theme-configurator-dialog.d.ts.map +1 -0
  447. package/dist/patterns/theme-configurator.d.ts +24 -0
  448. package/dist/patterns/theme-configurator.d.ts.map +1 -0
  449. package/dist/patterns/tree-table.d.ts +18 -0
  450. package/dist/patterns/tree-table.d.ts.map +1 -0
  451. package/dist/primitives/index.cjs +1 -2161
  452. package/dist/primitives/index.cjs.map +1 -1
  453. package/dist/primitives/index.d.ts +6 -2
  454. package/dist/primitives/index.d.ts.map +1 -1
  455. package/dist/primitives/index.js +1 -107
  456. package/dist/styles.css +1 -4364
  457. package/dist/theme.cjs +1 -161
  458. package/dist/theme.cjs.map +1 -1
  459. package/dist/theme.d.ts +7 -0
  460. package/dist/theme.d.ts.map +1 -1
  461. package/dist/theme.js +1 -19
  462. package/dist/themes/default.css +1 -80
  463. package/dist/themes/mecha.css +1 -195
  464. package/dist/themes/minimal.css +1 -160
  465. package/dist/tokens.css +1 -1240
  466. package/package.json +21 -17
  467. package/dist/chunk-AKWJMDCW.js +0 -467
  468. package/dist/chunk-AKWJMDCW.js.map +0 -1
  469. package/dist/chunk-F23X4N6B.js +0 -11
  470. package/dist/chunk-F23X4N6B.js.map +0 -1
  471. package/dist/chunk-HGO3GZ56.js +0 -1777
  472. package/dist/chunk-HGO3GZ56.js.map +0 -1
  473. package/dist/chunk-HXIWD5LQ.js +0 -319
  474. package/dist/chunk-HXIWD5LQ.js.map +0 -1
  475. package/dist/chunk-M6J4PLF4.js +0 -521
  476. package/dist/chunk-M6J4PLF4.js.map +0 -1
  477. package/dist/chunk-N3Z7R6GG.js +0 -139
  478. package/dist/chunk-N3Z7R6GG.js.map +0 -1
  479. package/dist/chunk-UXWCK6M7.js +0 -5757
  480. package/dist/chunk-UXWCK6M7.js.map +0 -1
  481. package/dist/internal/use-overlay-focus.d.ts +0 -8
  482. package/dist/internal/use-overlay-focus.d.ts.map +0 -1
  483. package/dist/internal/use-portal-container.d.ts.map +0 -1
  484. package/dist/labs/file-preview.d.ts +0 -44
  485. package/dist/labs/file-preview.d.ts.map +0 -1
  486. package/dist/labs/index.cjs +0 -224
  487. package/dist/labs/index.cjs.map +0 -1
  488. package/dist/labs/index.d.ts +0 -14
  489. package/dist/labs/index.d.ts.map +0 -1
  490. package/dist/labs/index.js +0 -188
  491. package/dist/labs/index.js.map +0 -1
  492. package/dist/labs/model-card.d.ts +0 -50
  493. package/dist/labs/model-card.d.ts.map +0 -1
  494. /package/dist/internal/{use-portal-container.d.ts → overlay/use-portal-container.d.ts} +0 -0
@@ -0,0 +1 @@
1
+ "use client";import{cn as e,isAriaInvalid as t,resolveControlSize as a,resolveDisabled as r,useUIConfig as o}from"./chunk-AQJWS45G.js";import{forwardRef as n,useEffect as i,useId as l,useLayoutEffect as s,useRef as d,useState as u}from"react";import{X as c}from"lucide-react";import{countTextCharacters as m,limitTextByCount as g}from"@ug666/ui-core";import{jsx as h,jsxs as v}from"react/jsx-runtime";var x={sm:"min-h-[calc(var(--control-height-sm)*2)] px-[var(--control-padding-x-sm)] py-1.5 text-xs",default:"min-h-[calc(var(--control-height-md)*2)] px-[var(--control-padding-x-md)] py-2 text-sm",lg:"min-h-[calc(var(--control-height-lg)*2)] px-[var(--control-padding-x-lg)] py-2.5 text-base"},b={none:"resize-none",both:"resize",horizontal:"resize-x",vertical:"resize-y"};function normalizeValue(e){return null==e?"":Array.isArray(e)?e.join(","):String(e)}function resizeTextarea(e,t,a){if(!t)return;const r="object"==typeof t?t:{},o=getComputedStyle(e),n=Number.parseFloat(o.lineHeight)||1.5*Number.parseFloat(o.fontSize),i=Number.parseFloat(o.paddingTop)+Number.parseFloat(o.paddingBottom)+Number.parseFloat(o.borderTopWidth)+Number.parseFloat(o.borderBottomWidth),l=Math.max(1,r.minRows??a),s=r.maxRows?Math.max(l,r.maxRows):void 0,d=n*l+i,u=s?n*s+i:Number.POSITIVE_INFINITY;e.style.height="auto";const c=Math.min(u,Math.max(d,e.scrollHeight));e.style.height=`${c}px`,e.style.overflowY=e.scrollHeight>u?"auto":"hidden"}var f=n(({autosize:n=!1,className:f,clearable:p=!1,clearIcon:y,countCharacters:w,defaultValue:z,disabled:T,error:N,helperText:C,id:R,label:V,maxLength:S,onChange:F,onClear:j,onCompositionEnd:E,onCompositionStart:B,onValueChange:I,readOnly:L=!1,resize:M="vertical",rows:k=3,showWordLimit:W=!1,size:A,value:H,wordLimitPosition:O="inside","aria-describedby":P,"aria-invalid":Y,...$},G)=>{const J=o(),Q=l(),_=R??Q,q=`${_}-message`,D=d(null),[K,U]=u(()=>normalizeValue(z)),[X,Z]=u(!1),ee=r(T,J.disabled),te=a(A,J.size),ae=Boolean(N)||t(Y),re=n?"object"==typeof n?Math.max(1,n.minRows??1):1:k,oe=void 0===H?K:normalizeValue(H),ne=Boolean(N||C||W&&S),ie=m(oe,w),le=p&&oe.length>0&&!ee&&!L,se=Boolean(W&&S&&"inside"===O),de=!n&&"none"!==M,ue=[ae&&"invalid",ee&&"disabled",L&&"readonly"].filter(Boolean).join(" ")||"default",ce=d({defaultValue:z,value:H,autosize:n,resolvedRows:re});return ce.current={defaultValue:z,value:H,autosize:n,resolvedRows:re},i(()=>{const e=D.current?.form;if(!e)return;const t=new Set;function handleReset(a){const r=setTimeout(()=>{t.delete(r);const o=D.current;if(a.defaultPrevented||!o||o.form!==e)return;const n=ce.current,i=normalizeValue(void 0===n.value?n.defaultValue:n.value);Z(!1),void 0===n.value&&U(i),o.value=i,resizeTextarea(o,n.autosize,n.resolvedRows)},0);t.add(r)}return e.addEventListener("reset",handleReset),()=>{e.removeEventListener("reset",handleReset);for(const e of t)clearTimeout(e)}},[$.form]),s(()=>{D.current&&resizeTextarea(D.current,n,re)},[n,oe,re]),v("div",{className:"flex min-w-0 flex-col gap-1","data-size":te,"data-state":ue,"data-ug":"textarea","data-ug-slot":"root","data-variant":n?"autosize":M,children:[V?h("label",{className:"min-w-0 text-sm font-medium text-text-primary [overflow-wrap:anywhere]","data-ug-slot":"label",htmlFor:_,children:V}):null,v("div",{className:"relative min-w-0","data-ug-slot":"wrapper",children:[h("textarea",{...$,ref:function setTextareaRef(e){D.current=e,function assignRef(e,t){"function"==typeof e?e(t):e&&(e.current=t)}(G,e)},"aria-describedby":P??(ne?q:void 0),"aria-invalid":Y??(!!N||void 0),className:e("block w-full border bg-surface-1 text-text-primary placeholder:text-text-tertiary [border-radius:var(--radius-control)]",x[te],n?"resize-none":b[M],se&&(de?"pb-11":"pb-7"),le&&"pr-9","transition-[background,border-color,box-shadow] duration-[var(--motion-duration-state)] ease-[var(--motion-easing-state)] motion-reduce:transition-none","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-offset-1","disabled:cursor-not-allowed disabled:opacity-50",L&&"bg-surface-2",ae?"border-danger focus-visible:ring-danger/30":"border-border-base hover:border-border-strong focus-visible:border-primary focus-visible:ring-ring/30",f),"data-ug-slot":"control","data-clearable":le?"true":void 0,disabled:ee,id:_,maxLength:w?void 0:S,onChange:function handleChange(e){const t=e.currentTarget.value,a=X||e.nativeEvent.isComposing?t:g(t,S,w);a!==e.currentTarget.value&&(e.currentTarget.value=a),U(a),I?.(a),resizeTextarea(e.currentTarget,n,k),F?.(e)},onCompositionEnd:function handleCompositionEnd(e){Z(!1);const t=g(e.currentTarget.value,S,w);t!==e.currentTarget.value&&(e.currentTarget.value=t),U(t),I?.(t),resizeTextarea(e.currentTarget,n,k),E?.(e)},onCompositionStart:function handleCompositionStart(e){Z(!0),B?.(e)},readOnly:L,rows:re,value:oe}),le?h("button",{"aria-label":"清空输入","aria-controls":_,className:"absolute right-2 top-2 inline-flex size-7 items-center justify-center rounded-[var(--radius-control)] text-text-secondary hover:bg-surface-2 hover:text-text-primary","data-ug-slot":"clear",onClick:function handleClear(){U(""),I?.(""),j?.(),D.current?.focus()},type:"button",children:y??h(c,{"aria-hidden":"true",size:14})}):null,se?v("span",{"aria-hidden":"true",className:e("pointer-events-none absolute right-3 text-xs tabular-nums text-text-tertiary",de?"bottom-6":"bottom-2"),"data-ug-slot":"count",children:[ie,"/",S]}):null]}),W&&S&&"outside"===O?v("span",{"aria-hidden":"true",className:"self-end text-xs tabular-nums text-text-tertiary","data-ug-slot":"count",children:[ie,"/",S]}):null,N?h("p",{id:q,className:"min-w-0 text-xs text-danger [overflow-wrap:anywhere]","data-ug-slot":"message",children:N}):null,!N&&C?h("p",{id:q,className:"min-w-0 text-xs text-text-secondary [overflow-wrap:anywhere]","data-ug-slot":"message",children:C}):null]})});f.displayName="Textarea";export{f as Textarea};//# sourceMappingURL=chunk-3LSTRFSY.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/components/textarea.tsx"],"sourcesContent":["import {\n forwardRef,\n useEffect,\n useId,\n useLayoutEffect,\n useRef,\n useState,\n type ChangeEvent,\n type CompositionEvent,\n type Ref,\n} from 'react'\nimport { X } from 'lucide-react'\nimport { countTextCharacters, limitTextByCount, type TextCountFunction } from '@ug666/ui-core'\nimport { cn } from '../internal/cn'\nimport { isAriaInvalid, resolveControlSize, resolveDisabled, useUIConfig, type ControlSize } from './config-provider'\n\nexport type TextareaResize = 'none' | 'both' | 'horizontal' | 'vertical'\n\nexport interface TextareaAutosizeOptions {\n minRows?: number\n maxRows?: number\n}\n\nexport interface TextareaProps extends React.TextareaHTMLAttributes<HTMLTextAreaElement> {\n label?: React.ReactNode\n error?: React.ReactNode\n helperText?: React.ReactNode\n rows?: number\n size?: ControlSize\n resize?: TextareaResize\n autosize?: boolean | TextareaAutosizeOptions\n clearable?: boolean\n clearIcon?: React.ReactNode\n showWordLimit?: boolean\n wordLimitPosition?: 'inside' | 'outside'\n countCharacters?: TextCountFunction\n onClear?: () => void\n onValueChange?: (value: string) => void\n}\n\nconst textareaSizeClasses: Record<ControlSize, string> = {\n sm: 'min-h-[calc(var(--control-height-sm)*2)] px-[var(--control-padding-x-sm)] py-1.5 text-xs',\n default: 'min-h-[calc(var(--control-height-md)*2)] px-[var(--control-padding-x-md)] py-2 text-sm',\n lg: 'min-h-[calc(var(--control-height-lg)*2)] px-[var(--control-padding-x-lg)] py-2.5 text-base',\n}\n\nconst resizeClasses: Record<TextareaResize, string> = {\n none: 'resize-none',\n both: 'resize',\n horizontal: 'resize-x',\n vertical: 'resize-y',\n}\n\nfunction assignRef<T>(ref: Ref<T> | undefined, value: T | null) {\n if (typeof ref === 'function') ref(value)\n else if (ref) ref.current = value\n}\n\nfunction normalizeValue(value: TextareaProps['value'] | TextareaProps['defaultValue']) {\n if (value === undefined || value === null) return ''\n return Array.isArray(value) ? value.join(',') : String(value)\n}\n\nfunction resizeTextarea(element: HTMLTextAreaElement, autosize: TextareaProps['autosize'], rows: number) {\n if (!autosize) return\n const options = typeof autosize === 'object' ? autosize : {}\n const styles = getComputedStyle(element)\n const lineHeight = Number.parseFloat(styles.lineHeight) || Number.parseFloat(styles.fontSize) * 1.5\n const verticalExtras =\n Number.parseFloat(styles.paddingTop) +\n Number.parseFloat(styles.paddingBottom) +\n Number.parseFloat(styles.borderTopWidth) +\n Number.parseFloat(styles.borderBottomWidth)\n const minRows = Math.max(1, options.minRows ?? rows)\n const maxRows = options.maxRows ? Math.max(minRows, options.maxRows) : undefined\n const minHeight = lineHeight * minRows + verticalExtras\n const maxHeight = maxRows ? lineHeight * maxRows + verticalExtras : Number.POSITIVE_INFINITY\n\n element.style.height = 'auto'\n const nextHeight = Math.min(maxHeight, Math.max(minHeight, element.scrollHeight))\n element.style.height = `${nextHeight}px`\n element.style.overflowY = element.scrollHeight > maxHeight ? 'auto' : 'hidden'\n}\n\nconst Textarea = forwardRef<HTMLTextAreaElement, TextareaProps>(\n (\n {\n autosize = false,\n className,\n clearable = false,\n clearIcon,\n countCharacters,\n defaultValue,\n disabled,\n error,\n helperText,\n id,\n label,\n maxLength,\n onChange,\n onClear,\n onCompositionEnd,\n onCompositionStart,\n onValueChange,\n readOnly = false,\n resize = 'vertical',\n rows = 3,\n showWordLimit = false,\n size,\n value,\n wordLimitPosition = 'inside',\n 'aria-describedby': describedBy,\n 'aria-invalid': invalid,\n ...props\n },\n forwardedRef,\n ) => {\n const config = useUIConfig()\n const generatedId = useId()\n const textareaId = id ?? generatedId\n const messageId = `${textareaId}-message`\n const textareaRef = useRef<HTMLTextAreaElement | null>(null)\n const [uncontrolledValue, setUncontrolledValue] = useState(() => normalizeValue(defaultValue))\n const [composing, setComposing] = useState(false)\n const resolvedDisabled = resolveDisabled(disabled, config.disabled)\n const resolvedSize = resolveControlSize(size, config.size)\n const resolvedInvalid = Boolean(error) || isAriaInvalid(invalid)\n const resolvedRows = autosize ? (typeof autosize === 'object' ? Math.max(1, autosize.minRows ?? 1) : 1) : rows\n const rawValue = value === undefined ? uncontrolledValue : normalizeValue(value)\n const hasMessage = Boolean(error || helperText || (showWordLimit && maxLength))\n const characterCount = countTextCharacters(rawValue, countCharacters)\n const canClear = clearable && rawValue.length > 0 && !resolvedDisabled && !readOnly\n const hasInsideCount = Boolean(showWordLimit && maxLength && wordLimitPosition === 'inside')\n const hasResizeHandle = !autosize && resize !== 'none'\n const state =\n [resolvedInvalid && 'invalid', resolvedDisabled && 'disabled', readOnly && 'readonly']\n .filter(Boolean)\n .join(' ') || 'default'\n\n const resetStateRef = useRef({ defaultValue, value, autosize, resolvedRows })\n resetStateRef.current = { defaultValue, value, autosize, resolvedRows }\n useEffect(() => {\n const ownerForm = textareaRef.current?.form\n if (!ownerForm) return\n const tasks = new Set<ReturnType<typeof setTimeout>>()\n function handleReset(event: Event) {\n const task = setTimeout(() => {\n tasks.delete(task)\n const textarea = textareaRef.current\n if (event.defaultPrevented || !textarea || textarea.form !== ownerForm) return\n const current = resetStateRef.current\n const nextValue = normalizeValue(current.value === undefined ? current.defaultValue : current.value)\n setComposing(false)\n if (current.value === undefined) setUncontrolledValue(nextValue)\n textarea.value = nextValue\n resizeTextarea(textarea, current.autosize, current.resolvedRows)\n }, 0)\n tasks.add(task)\n }\n ownerForm.addEventListener('reset', handleReset)\n return () => {\n ownerForm.removeEventListener('reset', handleReset)\n for (const task of tasks) clearTimeout(task)\n }\n }, [props.form])\n\n useLayoutEffect(() => {\n if (textareaRef.current) resizeTextarea(textareaRef.current, autosize, resolvedRows)\n }, [autosize, rawValue, resolvedRows])\n\n function setTextareaRef(node: HTMLTextAreaElement | null) {\n textareaRef.current = node\n assignRef(forwardedRef, node)\n }\n\n function handleChange(event: ChangeEvent<HTMLTextAreaElement>) {\n const inputValue = event.currentTarget.value\n const isComposing = composing || (event.nativeEvent as InputEvent).isComposing\n const nextValue = isComposing ? inputValue : limitTextByCount(inputValue, maxLength, countCharacters)\n if (nextValue !== event.currentTarget.value) event.currentTarget.value = nextValue\n setUncontrolledValue(nextValue)\n onValueChange?.(nextValue)\n resizeTextarea(event.currentTarget, autosize, rows)\n onChange?.(event)\n }\n\n function handleCompositionStart(event: CompositionEvent<HTMLTextAreaElement>) {\n setComposing(true)\n onCompositionStart?.(event)\n }\n\n function handleCompositionEnd(event: CompositionEvent<HTMLTextAreaElement>) {\n setComposing(false)\n const nextValue = limitTextByCount(event.currentTarget.value, maxLength, countCharacters)\n if (nextValue !== event.currentTarget.value) event.currentTarget.value = nextValue\n setUncontrolledValue(nextValue)\n onValueChange?.(nextValue)\n resizeTextarea(event.currentTarget, autosize, rows)\n onCompositionEnd?.(event)\n }\n\n function handleClear() {\n setUncontrolledValue('')\n onValueChange?.('')\n onClear?.()\n textareaRef.current?.focus()\n }\n\n return (\n <div\n className=\"flex min-w-0 flex-col gap-1\"\n data-size={resolvedSize}\n data-state={state}\n data-ug=\"textarea\"\n data-ug-slot=\"root\"\n data-variant={autosize ? 'autosize' : resize}\n >\n {label ? (\n <label\n className=\"min-w-0 text-sm font-medium text-text-primary [overflow-wrap:anywhere]\"\n data-ug-slot=\"label\"\n htmlFor={textareaId}\n >\n {label}\n </label>\n ) : null}\n <div className=\"relative min-w-0\" data-ug-slot=\"wrapper\">\n <textarea\n {...props}\n ref={setTextareaRef}\n aria-describedby={describedBy ?? (hasMessage ? messageId : undefined)}\n aria-invalid={invalid ?? (error ? true : undefined)}\n className={cn(\n 'block w-full border bg-surface-1 text-text-primary placeholder:text-text-tertiary [border-radius:var(--radius-control)]',\n textareaSizeClasses[resolvedSize],\n autosize ? 'resize-none' : resizeClasses[resize],\n hasInsideCount && (hasResizeHandle ? 'pb-11' : 'pb-7'),\n canClear && 'pr-9',\n 'transition-[background,border-color,box-shadow] duration-[var(--motion-duration-state)] ease-[var(--motion-easing-state)] motion-reduce:transition-none',\n 'focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-offset-1',\n 'disabled:cursor-not-allowed disabled:opacity-50',\n readOnly && 'bg-surface-2',\n resolvedInvalid\n ? 'border-danger focus-visible:ring-danger/30'\n : 'border-border-base hover:border-border-strong focus-visible:border-primary focus-visible:ring-ring/30',\n className,\n )}\n data-ug-slot=\"control\"\n data-clearable={canClear ? 'true' : undefined}\n disabled={resolvedDisabled}\n id={textareaId}\n maxLength={countCharacters ? undefined : maxLength}\n onChange={handleChange}\n onCompositionEnd={handleCompositionEnd}\n onCompositionStart={handleCompositionStart}\n readOnly={readOnly}\n rows={resolvedRows}\n value={rawValue}\n />\n {canClear ? (\n <button\n aria-label=\"清空输入\"\n aria-controls={textareaId}\n className=\"absolute right-2 top-2 inline-flex size-7 items-center justify-center rounded-[var(--radius-control)] text-text-secondary hover:bg-surface-2 hover:text-text-primary\"\n data-ug-slot=\"clear\"\n onClick={handleClear}\n type=\"button\"\n >\n {clearIcon ?? <X aria-hidden=\"true\" size={14} />}\n </button>\n ) : null}\n {hasInsideCount ? (\n <span\n aria-hidden=\"true\"\n className={cn(\n 'pointer-events-none absolute right-3 text-xs tabular-nums text-text-tertiary',\n hasResizeHandle ? 'bottom-6' : 'bottom-2',\n )}\n data-ug-slot=\"count\"\n >\n {characterCount}/{maxLength}\n </span>\n ) : null}\n </div>\n {showWordLimit && maxLength && wordLimitPosition === 'outside' ? (\n <span aria-hidden=\"true\" className=\"self-end text-xs tabular-nums text-text-tertiary\" data-ug-slot=\"count\">\n {characterCount}/{maxLength}\n </span>\n ) : null}\n {error ? (\n <p id={messageId} className=\"min-w-0 text-xs text-danger [overflow-wrap:anywhere]\" data-ug-slot=\"message\">\n {error}\n </p>\n ) : null}\n {!error && helperText ? (\n <p\n id={messageId}\n className=\"min-w-0 text-xs text-text-secondary [overflow-wrap:anywhere]\"\n data-ug-slot=\"message\"\n >\n {helperText}\n </p>\n ) : null}\n </div>\n )\n },\n)\n\nTextarea.displayName = 'Textarea'\n\nexport { Textarea }\n"],"mappings":";;;;;;;;;;AAAA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OAIK;AACP,SAAS,SAAS;AAClB,SAAS,qBAAqB,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EZ;AAAA;AAAA,UACH,IACE;AAAA;AAAA;AAAA,IACN;AAAA,EAEJ;AACF;AAEA,SAAS,cAAc;","names":[]}
@@ -0,0 +1 @@
1
+ "use client";import{clsx as e}from"clsx";import{twMerge as t}from"tailwind-merge";function cn(...n){return t(e(n))}import{createContext as n,useContext as a,useMemo as o}from"react";import{jsx as i}from"react/jsx-runtime";var r={small:"sm",medium:"default",large:"lg"},s={sm:"small",default:"medium",lg:"large"};function resolveControlSize(e,t){return e??r[t]}function resolveDisabled(e,t){return e??t}function isAriaInvalid(e){return!0===e||"true"===e||"grammar"===e||"spelling"===e}function controlSizeToComponentSize(e){return s[e]}var l=n({namespace:"ug",size:"medium",disabled:!1,button:{},link:{}});function mergeDefined(e,t){const n={...e};return t?(Object.entries(t).forEach(([e,t])=>{void 0!==t&&Object.assign(n,{[e]:t})}),n):n}function ConfigProvider({children:e,className:t,disabled:n,button:r,link:s,namespace:u,size:d,style:c,...g}){const m=a(l),f=o(()=>({namespace:u??m.namespace,size:d??m.size,disabled:n??m.disabled,button:mergeDefined(m.button,r),link:mergeDefined(m.link,s)}),[r,n,s,u,m,d]);return i(l.Provider,{value:f,children:i("div",{...g,className:["[display:contents]",t].filter(Boolean).join(" "),style:c,"data-size":f.size,"data-state":f.disabled?"disabled":"default","data-ug":"config-provider","data-ug-namespace":f.namespace,"data-ug-slot":"root","data-variant":"default",children:e})})}function useUIConfig(){return a(l)}import{forwardRef as u}from"react";import{Loader2 as d}from"lucide-react";import{cva as c}from"class-variance-authority";import{createContext as g,useContext as m}from"react";var f=g({}),p=f.Provider;import{jsx as b,jsxs as v}from"react/jsx-runtime";var h=c("ug-button m-0 inline-flex appearance-none items-center justify-center gap-[var(--button-icon-gap)] whitespace-nowrap font-[var(--button-font-weight)] disabled:pointer-events-none disabled:cursor-not-allowed select-none",{variants:{variant:{solid:"ug-button--solid",soft:"ug-button--soft",primary:"ug-button--primary",success:"ug-button--success",warning:"ug-button--warning",danger:"ug-button--danger",destructive:"ug-button--destructive",info:"ug-button--info",default:"ug-button--default",outline:"ug-button--outline",secondary:"ug-button--secondary",dashed:"ug-button--dashed",ghost:"ug-button--ghost",text:"ug-button--text",link:"ug-button--link"},size:{default:"ug-button--size-default h-[var(--control-height-md)] px-[var(--control-padding-x-md)] py-0",sm:"ug-button--size-sm h-[var(--control-height-sm)] px-[var(--control-padding-x-sm)] py-0",lg:"ug-button--size-lg h-[var(--control-height-lg)] px-[var(--control-padding-x-lg)] py-0","icon-sm":"ug-button--size-icon-sm h-[var(--control-height-sm)] w-[var(--control-height-sm)] p-0",icon:"ug-button--size-icon h-[var(--control-height-md)] w-[var(--control-height-md)] p-0"},shape:{default:"rounded-[var(--radius-control)]",circle:"!rounded-full !p-0 aspect-square",round:"!rounded-full"},block:{true:"w-full flex",false:""}},defaultVariants:{variant:"default",size:"default",shape:"default",block:!1}}),z={text:"px-[var(--control-padding-x-sm)]",link:"h-auto border-0 p-0 underline-offset-4 hover:underline"},buttonVariants=e=>{const{class:t,className:n,...a}=e??{};return cn(h(a),z[a.variant??"default"],t,n)},x={small:"sm",medium:"default",large:"lg"},y={primary:"primary",success:"success",warning:"warning",danger:"danger",destructive:"danger",info:"info"};var w=u(({className:e,variant:t,tone:n,size:a,shape:o,block:i,loading:r=!1,loadingText:s,loadingIcon:l,loadingPlacement:u="start",disabled:c,type:g="button",style:p,children:h,...z},w)=>{const k=function useButtonGroup(){return m(f)}(),C=useUIConfig(),j=t??k.variant??C.button.variant??"default",N=n??k.tone??C.button.tone??y[j]??("solid"===j||"soft"===j?"primary":"neutral"),S=a??k.size??x[C.size],D=o??k.shape??C.button.shape??"default",I=resolveDisabled(c,k.disabled??C.disabled),P=function getButtonState(e,t){const n=[];return e&&n.push("loading"),(t||e)&&n.push("disabled"),n.length>0?n.join(" "):"default"}(r,I),B=r&&void 0!==s?s:h,T=r?b("span",{"data-ug-slot":"loader",className:"inline-flex shrink-0 items-center justify-center","aria-hidden":"true",children:l??b(d,{className:"animate-spin motion-reduce:animate-none",size:"sm"===S||"icon-sm"===S?14:16})}):null;return v("button",{ref:w,...z,type:g,style:{fontWeight:"var(--button-font-weight)",...p},className:cn(buttonVariants({variant:j,size:S,shape:D,block:i}),e),disabled:I||r,"aria-busy":r||void 0,"data-ug":"button","data-state":P,"data-variant":j,"data-tone":N,"data-size":S,"data-shape":D,"data-block":i?"true":void 0,"data-ug-namespace":C.namespace,children:["start"===u?T:null,b("span",{"data-ug-slot":"label",className:"inline-flex min-w-0 items-center justify-center gap-[var(--button-icon-gap)]",children:B}),"end"===u?T:null]})});w.displayName="Button";export{cn,p as ButtonGroupProvider,resolveControlSize,resolveDisabled,isAriaInvalid,controlSizeToComponentSize,ConfigProvider,useUIConfig,buttonVariants,w as Button};//# sourceMappingURL=chunk-AQJWS45G.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/internal/cn.ts","../src/components/config-provider.tsx","../src/components/button.tsx","../src/internal/button-group-context.ts"],"sourcesContent":["/**\n * @description: React 包内部类名合并工具\n * @author: UG - 一个斗码大陆苦逼的三段码之气的少年,并没有神秘戒指中码老的帮助,但总有一天,我会成为斗码大陆中码帝一样的存在。三十年河东,三十年河西,莫欺少年穷。\n * @date: 2026-05-27\n */\nimport { type ClassValue, clsx } from 'clsx'\nimport { twMerge } from 'tailwind-merge'\n\nexport function cn(...inputs: ClassValue[]): string {\n return twMerge(clsx(inputs))\n}\n","import {\n createContext,\n useContext,\n useMemo,\n type HTMLAttributes,\n type PropsWithChildren,\n} from 'react'\n\nexport type ComponentSize = 'small' | 'medium' | 'large'\nexport type ControlSize = 'sm' | 'default' | 'lg'\nexport type AriaInvalidValue = boolean | 'true' | 'false' | 'grammar' | 'spelling'\n\nconst CONFIG_SIZE_TO_CONTROL_SIZE: Record<ComponentSize, ControlSize> = {\n small: 'sm',\n medium: 'default',\n large: 'lg',\n}\n\nconst CONTROL_SIZE_TO_CONFIG_SIZE: Record<ControlSize, ComponentSize> = {\n sm: 'small',\n default: 'medium',\n lg: 'large',\n}\n\nexport function resolveControlSize(\n size: ControlSize | undefined,\n configSize: ComponentSize,\n): ControlSize {\n return size ?? CONFIG_SIZE_TO_CONTROL_SIZE[configSize]\n}\n\nexport function resolveDisabled(\n disabled: boolean | undefined,\n configDisabled: boolean,\n): boolean {\n return disabled ?? configDisabled\n}\n\nexport function isAriaInvalid(value: AriaInvalidValue | undefined): boolean {\n return value === true || value === 'true' || value === 'grammar' || value === 'spelling'\n}\n\nexport function controlSizeToComponentSize(size: ControlSize): ComponentSize {\n return CONTROL_SIZE_TO_CONFIG_SIZE[size]\n}\n\nexport interface UIConfig {\n namespace: string\n size: ComponentSize\n disabled: boolean\n button: ButtonDefaults\n link: LinkDefaults\n}\n\nexport interface ButtonDefaults {\n variant?:\n | 'solid'\n | 'soft'\n | 'primary'\n | 'success'\n | 'warning'\n | 'danger'\n | 'info'\n | 'default'\n | 'secondary'\n | 'outline'\n | 'dashed'\n | 'ghost'\n | 'text'\n | 'link'\n | 'destructive'\n tone?: 'neutral' | 'primary' | 'success' | 'warning' | 'danger' | 'info'\n shape?: 'default' | 'circle' | 'round'\n}\n\nexport interface LinkDefaults {\n underline?: 'always' | 'hover' | 'never'\n tone?: 'neutral' | 'primary' | 'success' | 'warning' | 'danger' | 'info' | 'inherit'\n}\n\nexport type ConfigProviderProps = PropsWithChildren<\n Omit<Partial<UIConfig>, 'button' | 'link'> & {\n button?: Partial<ButtonDefaults>\n link?: Partial<LinkDefaults>\n } & Omit<HTMLAttributes<HTMLDivElement>, 'children'>\n>\n\nconst defaultConfig: UIConfig = {\n namespace: 'ug',\n size: 'medium',\n disabled: false,\n button: {},\n link: {},\n}\n\nconst ConfigContext = createContext<UIConfig>(defaultConfig)\n\nfunction mergeDefined<T extends object>(parent: T, current?: Partial<T>): T {\n const merged = { ...parent }\n if (!current) return merged\n\n Object.entries(current).forEach(([key, value]) => {\n if (value !== undefined) Object.assign(merged, { [key]: value })\n })\n return merged\n}\n\nexport function ConfigProvider({\n children,\n className,\n disabled,\n button,\n link,\n namespace,\n size,\n style,\n ...containerProps\n}: ConfigProviderProps) {\n const parent = useContext(ConfigContext)\n const value = useMemo<UIConfig>(() => ({\n namespace: namespace ?? parent.namespace,\n size: size ?? parent.size,\n disabled: disabled ?? parent.disabled,\n button: mergeDefined(parent.button, button),\n link: mergeDefined(parent.link, link),\n }), [button, disabled, link, namespace, parent, size])\n\n return (\n <ConfigContext.Provider value={value}>\n <div\n {...containerProps}\n className={['[display:contents]', className].filter(Boolean).join(' ')}\n style={style}\n data-size={value.size}\n data-state={value.disabled ? 'disabled' : 'default'}\n data-ug=\"config-provider\"\n data-ug-namespace={value.namespace}\n data-ug-slot=\"root\"\n data-variant=\"default\"\n >\n {children}\n </div>\n </ConfigContext.Provider>\n )\n}\n\nexport function useUIConfig(): UIConfig {\n return useContext(ConfigContext)\n}\n","/**\n * @description: Button 按钮组件,统一处理外观、语义色、尺寸、状态与组合\n * @author: UG - 一个斗码大陆苦逼的三段码之气的少年,并没有神秘戒指中码老的帮助,但总有一天,我会成为斗码大陆中码帝一样的存在。三十年河东,三十年河西,莫欺少年穷。\n * @date: 2026-07-22\n */\nimport { forwardRef, type ReactNode } from 'react'\nimport { Loader2 } from 'lucide-react'\nimport { cva, type VariantProps } from 'class-variance-authority'\nimport { cn } from '../internal/cn'\nimport { useButtonGroup } from '../internal/button-group-context'\nimport {\n resolveDisabled,\n useUIConfig,\n type ComponentSize,\n} from './config-provider'\n\nconst buttonRecipe = cva(\n 'ug-button m-0 inline-flex appearance-none items-center justify-center gap-[var(--button-icon-gap)] whitespace-nowrap font-[var(--button-font-weight)] disabled:pointer-events-none disabled:cursor-not-allowed select-none',\n {\n variants: {\n variant: {\n solid: 'ug-button--solid',\n soft: 'ug-button--soft',\n primary: 'ug-button--primary',\n success: 'ug-button--success',\n warning: 'ug-button--warning',\n danger: 'ug-button--danger',\n destructive: 'ug-button--destructive',\n info: 'ug-button--info',\n default: 'ug-button--default',\n outline: 'ug-button--outline',\n secondary: 'ug-button--secondary',\n dashed: 'ug-button--dashed',\n ghost: 'ug-button--ghost',\n text: 'ug-button--text',\n link: 'ug-button--link',\n },\n size: {\n default: 'ug-button--size-default h-[var(--control-height-md)] px-[var(--control-padding-x-md)] py-0',\n sm: 'ug-button--size-sm h-[var(--control-height-sm)] px-[var(--control-padding-x-sm)] py-0',\n lg: 'ug-button--size-lg h-[var(--control-height-lg)] px-[var(--control-padding-x-lg)] py-0',\n 'icon-sm': 'ug-button--size-icon-sm h-[var(--control-height-sm)] w-[var(--control-height-sm)] p-0',\n icon: 'ug-button--size-icon h-[var(--control-height-md)] w-[var(--control-height-md)] p-0',\n },\n shape: {\n default: 'rounded-[var(--radius-control)]',\n circle: '!rounded-full !p-0 aspect-square',\n round: '!rounded-full',\n },\n block: {\n true: 'w-full flex',\n false: '',\n },\n },\n defaultVariants: {\n variant: 'default',\n size: 'default',\n shape: 'default',\n block: false,\n },\n }\n)\n\nexport type ButtonTone = 'neutral' | 'primary' | 'success' | 'warning' | 'danger' | 'info'\nexport type ButtonLoadingPlacement = 'start' | 'end'\n// 公开类型必须显式声明:从本地 cva 常量推导会在 d.ts 生成时被拍平,\n// 消费方(以及其他框架绑定)就拿不到 variant/size/shape。\nexport type ButtonVariant =\n | 'solid'\n | 'soft'\n | 'primary'\n | 'success'\n | 'warning'\n | 'danger'\n | 'destructive'\n | 'info'\n | 'default'\n | 'outline'\n | 'secondary'\n | 'dashed'\n | 'ghost'\n | 'text'\n | 'link'\nexport type ButtonSize = 'default' | 'sm' | 'lg' | 'icon-sm' | 'icon'\nexport type ButtonShape = 'default' | 'circle' | 'round'\n\nconst VARIANT_LAYOUT_CLASSES: Partial<Record<ButtonVariant, string>> = {\n text: 'px-[var(--control-padding-x-sm)]',\n link: 'h-auto border-0 p-0 underline-offset-4 hover:underline',\n}\n\n/** 保留公开 class recipe 的独立变体与布局;语义 marker 消费同一套共享 CSS。 */\nconst buttonVariants = (options?: Parameters<typeof buttonRecipe>[0]) => {\n const { class: classValue, className, ...variants } = options ?? {}\n return cn(\n buttonRecipe(variants),\n VARIANT_LAYOUT_CLASSES[variants.variant ?? 'default'],\n classValue,\n className,\n )\n}\n\nconst CONFIG_SIZE_TO_BUTTON_SIZE: Record<ComponentSize, ButtonSize> = {\n small: 'sm',\n medium: 'default',\n large: 'lg',\n}\n\nconst LEGACY_VARIANT_TONES: Partial<Record<ButtonVariant, ButtonTone>> = {\n primary: 'primary',\n success: 'success',\n warning: 'warning',\n danger: 'danger',\n destructive: 'danger',\n info: 'info',\n}\n\nexport interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {\n /** 外观变体 */\n variant?: ButtonVariant\n /** 尺寸 */\n size?: ButtonSize\n /** 语义色,用于 solid / soft / outline / dashed / ghost / text / link 外观 */\n tone?: ButtonTone\n /** 是否处于加载状态,加载时显示旋转图标并禁用点击 */\n loading?: boolean\n /** 加载时替换按钮正文;不传时保留原文,避免宽度跳动 */\n loadingText?: ReactNode\n /** 自定义加载指示器 */\n loadingIcon?: ReactNode\n /** 加载指示器位于文字起始或末尾 */\n loadingPlacement?: ButtonLoadingPlacement\n /** 形状属性:默认圆角 / 正圆 / 胶囊圆角 */\n shape?: 'default' | 'circle' | 'round'\n /** 是否为块级按钮 (宽度 100%) */\n block?: boolean\n}\n\nfunction getButtonState(loading: boolean, disabled?: boolean): string | undefined {\n const states: string[] = []\n if (loading) states.push('loading')\n if (disabled || loading) states.push('disabled')\n return states.length > 0 ? states.join(' ') : 'default'\n}\n\n/**\n * 原生操作按钮。导航行为使用 UGLink。\n * @example\n * <Button variant=\"solid\">保存</Button>\n * <Button variant=\"outline\" tone=\"danger\">删除</Button>\n */\nconst Button = forwardRef<HTMLButtonElement, ButtonProps>(\n ({\n className,\n variant,\n tone,\n size,\n shape,\n block,\n loading = false,\n loadingText,\n loadingIcon,\n loadingPlacement = 'start',\n disabled,\n type = 'button',\n style,\n children,\n ...props\n }, ref) => {\n const group = useButtonGroup()\n const config = useUIConfig()\n const resolvedVariant = variant ?? group.variant ?? config.button.variant ?? 'default'\n const resolvedTone = tone\n ?? group.tone\n ?? config.button.tone\n ?? LEGACY_VARIANT_TONES[resolvedVariant]\n ?? (resolvedVariant === 'solid' || resolvedVariant === 'soft' ? 'primary' : 'neutral')\n const resolvedSize = size ?? group.size ?? CONFIG_SIZE_TO_BUTTON_SIZE[config.size]\n const resolvedShape = shape ?? group.shape ?? config.button.shape ?? 'default'\n const resolvedDisabled = resolveDisabled(\n disabled,\n group.disabled ?? config.disabled,\n )\n const state = getButtonState(loading, resolvedDisabled)\n const loader = loadingIcon ?? (\n <Loader2 className=\"animate-spin motion-reduce:animate-none\" size={resolvedSize === 'sm' || resolvedSize === 'icon-sm' ? 14 : 16} />\n )\n const label = loading && loadingText !== undefined ? loadingText : children\n const loaderNode = loading ? (\n <span data-ug-slot=\"loader\" className=\"inline-flex shrink-0 items-center justify-center\" aria-hidden=\"true\">\n {loader}\n </span>\n ) : null\n\n return (\n <button\n ref={ref}\n {...props}\n type={type}\n style={{ fontWeight: 'var(--button-font-weight)', ...style }}\n className={cn(\n buttonVariants({\n variant: resolvedVariant,\n size: resolvedSize,\n shape: resolvedShape,\n block,\n }),\n className,\n )}\n disabled={resolvedDisabled || loading}\n aria-busy={loading || undefined}\n data-ug=\"button\"\n data-state={state}\n data-variant={resolvedVariant}\n data-tone={resolvedTone}\n data-size={resolvedSize}\n data-shape={resolvedShape}\n data-block={block ? 'true' : undefined}\n data-ug-namespace={config.namespace}\n >\n {loadingPlacement === 'start' ? loaderNode : null}\n <span data-ug-slot=\"label\" className=\"inline-flex min-w-0 items-center justify-center gap-[var(--button-icon-gap)]\">\n {label}\n </span>\n {loadingPlacement === 'end' ? loaderNode : null}\n </button>\n )\n }\n)\n\nButton.displayName = 'Button'\n\nexport { Button, buttonVariants }\n","/**\n * @description: React ButtonGroup 共享上下文\n * @author: UG - 一个斗码大陆苦逼的三段码之气的少年,并没有神秘戒指中码老的帮助,但总有一天,我会成为斗码大陆中码帝一样的存在。三十年河东,三十年河西,莫欺少年穷。\n * @date: 2026-07-25\n */\nimport { createContext, useContext } from 'react'\nimport type {\n ButtonShape,\n ButtonSize,\n ButtonTone,\n ButtonVariant,\n} from '../components/button'\n\nexport interface ButtonGroupContextValue {\n variant?: ButtonVariant\n tone?: ButtonTone\n size?: ButtonSize\n shape?: ButtonShape\n disabled?: boolean\n}\n\nconst ButtonGroupContext = createContext<ButtonGroupContextValue>({})\n\nexport const ButtonGroupProvider = ButtonGroupContext.Provider\n\nexport function useButtonGroup(): ButtonGroupContextValue {\n return useContext(ButtonGroupContext)\n}\n"],"mappings":";;;AAKA,SAA0B,YAAY;AACtC,SAAS,eAAe;AAEjB,SAAS,MAAM,QAA8B;AAClD,SAAO,QAAQ,KAAK,MAAM,CAAC;AAC7B;;;ACVA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OAGK;AA2HD;AArHN,IAAM,8BAAkE;AAAA,EACtE,OAAO;AAAA,EACP,QAAQ;AAAA,EACR,OAAO;AACT;AAEA,IAAM,8BAAkE;AAAA,EACtE,IAAI;AAAA,EACJ,SAAS;AAAA,EACT,IAAI;AACN;AAEO,SAAS,mBACd,MACA,YACa;AACb,SAAO,QAAQ,4BAA4B,UAAU;AACvD;AAEO,SAAS,gBACd,UACA,gBACS;AACT,SAAO,YAAY;AACrB;AAEO,SAAS,cAAc,OAA8C;AAC1E,SAAO,UAAU,QAAQ,UAAU,UAAU,UAAU,aAAa,UAAU;AAChF;AAEO,SAAS,2BAA2B,MAAkC;AAC3E,SAAO,4BAA4B,IAAI;AACzC;AA2CA,IAAM,gBAA0B;AAAA,EAC9B,WAAW;AAAA,EACX,MAAM;AAAA,EACN,UAAU;AAAA,EACV,QAAQ,CAAC;AAAA,EACT,MAAM,CAAC;AACT;AAEA,IAAM,gBAAgB,cAAwB,aAAa;AAE3D,SAAS,aAA+B,QAAW,SAAyB;AAC1E,QAAM,SAAS,EAAE,GAAG,OAAO;AAC3B,MAAI,CAAC,QAAS,QAAO;AAErB,SAAO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QACJ;AAAA,QACA,OAAO,EAAE,YAAY,6BAA6B,GAAG,MAAM;AAAA,QAC3D,WAAW;AAAA,UACT,eAAe;AAAA,YACb,SAAS;AAAA,YACT,MAAM;AAAA,YACN,OAAO;AAAA,YACP;AAAA,UACF,CAAC;AAAA,UACD;AAAA,QACF;AAAA,QACA,UAAU,oBAAoB;AAAA,QAC9B,aAAW,WAAW;AAAA,QACtB,WAAQ;AAAA,QACR,cAAY;AAAA,QACZ,gBAAc;AAAA,QACd,aAAW;AAAA,QACX,aAAW;AAAA,QACX,cAAY;AAAA,QACZ,cAAY,QAAQ,SAAS;AAAA,QAC7B,qBAAmB,OAAO;AAAA,QAEzB;AAAA,+BAAqB,UAAU,aAAa;AAAA,UAC7C,gBAAAA,KAAC,UAAK,gBAAa,SAAQ,WAAU,gFAClC,iBACH;AAAA,UACC,qBAAqB,QAAQ,aAAa;AAAA;AAAA;AAAA,IAC7C;AAAA,EAEJ;AACF;AAEA,OAAO,cAAc;","names":["createContext","useContext","jsx"]}
@@ -0,0 +1 @@
1
+ "use strict";function _nullishCoalesce(e,t){return null!=e?e:t()}function _optionalChain(e){let t,r=e[0],l=1;for(;l<e.length;){const o=e[l],n=e[l+1];if(l+=2,("optionalAccess"===o||"optionalCall"===o)&&null==r)return;"access"===o||"optionalAccess"===o?(t=r,r=n(r)):"call"!==o&&"optionalCall"!==o||(r=n((...e)=>r.call(t,...e)),t=void 0)}return r}Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react");function readValue(e,t){if("undefined"==typeof window)return t;try{const r=window.localStorage.getItem(e);return r?JSON.parse(r):t}catch(e){return t}}var t=require("@ug666/ui-core");function normalizeFields(e,r){return void 0===e?t.getFormPaths.call(void 0,r):(Array.isArray(e)?e:[e]).map(t.normalizeFormPath)}exports.useDebounce=function useDebounce(t,r=300){const[l,o]=e.useState.call(void 0,t);return e.useEffect.call(void 0,()=>{const e=setTimeout(()=>o(t),r);return()=>clearTimeout(e)},[t,r]),l},exports.useLocalStorage=function useLocalStorage(t,r){const[l,o]=e.useState.call(void 0,()=>({key:t,current:readValue(t,r)})),[,n]=e.useState.call(void 0,0);let a=l;a.key!==t&&(a={key:t,current:readValue(t,r)},o(a));const c=e.useCallback.call(void 0,e=>{const t=e instanceof Function?e(a.current):e;if(a.current=t,"undefined"!=typeof window)try{window.localStorage.setItem(a.key,JSON.stringify(t))}catch(e){}n(e=>e+1)},[a]),i=e.useCallback.call(void 0,()=>{if(a.current=r,"undefined"!=typeof window)try{window.localStorage.removeItem(a.key)}catch(e){}n(e=>e+1)},[a,r]);return[a.current,c,i]},exports.useClickOutside=function useClickOutside(t,r){e.useEffect.call(void 0,()=>{const handleMouseDown=e=>{t.current&&!t.current.contains(e.target)&&r()},handleTouchStart=e=>{t.current&&!t.current.contains(e.target)&&r()};return document.addEventListener("mousedown",handleMouseDown),document.addEventListener("touchstart",handleTouchStart),()=>{document.removeEventListener("mousedown",handleMouseDown),document.removeEventListener("touchstart",handleTouchStart)}},[t,r])},exports.useCopyToClipboard=function useCopyToClipboard(){const[t,r]=e.useState.call(void 0,!1),l=e.useRef.call(void 0,null),o=e.useRef.call(void 0,0),n=e.useRef.call(void 0,!0);return e.useLayoutEffect.call(void 0,()=>(n.current=!0,()=>{n.current=!1,o.current++,null!==l.current&&(clearTimeout(l.current),l.current=null)}),[]),{copied:t,copy:e.useCallback.call(void 0,async e=>{if(!n.current)return;const t=++o.current;if(null!==l.current&&(clearTimeout(l.current),l.current=null),r(!1),"undefined"!=typeof navigator&&navigator.clipboard)try{if(await navigator.clipboard.writeText(e),!n.current||t!==o.current)return;r(!0),l.current=setTimeout(()=>{l.current=null,n.current&&t===o.current&&r(!1)},2e3)}catch(e){n.current&&t===o.current&&r(!1)}},[])}},exports.useToggle=function useToggle(t=!1){const[r,l]=e.useState.call(void 0,t);return[r,e.useCallback.call(void 0,()=>{l(e=>!e)},[]),l]},exports.usePagination=function usePagination({total:t,pageSize:r=10,initialPage:l=1}){const o=e.useMemo.call(void 0,()=>Math.max(1,Math.ceil(t/r)),[t,r]),[n,a]=e.useState.call(void 0,()=>Math.min(Math.max(1,l),Math.max(1,Math.ceil(t/r)))),c=Math.min(n,o);e.useEffect.call(void 0,()=>{a(e=>Math.min(e,o))},[o]);const i=e.useCallback.call(void 0,e=>{a(Math.min(Math.max(1,e),o))},[o]),s=e.useCallback.call(void 0,()=>{a(e=>Math.min(e+1,o))},[o]),u=e.useCallback.call(void 0,()=>{a(e=>Math.max(Math.min(e,o)-1,1))},[o]),d=(c-1)*r,v=Math.min(d+r,t);return{page:c,totalPages:o,setPage:i,nextPage:s,prevPage:u,hasNext:c<o,hasPrev:c>1,startIndex:d,endIndex:v}},exports.useForm=function useForm(r,l={}){const o=e.useRef.call(void 0,{...r}),n=e.useRef.call(void 0,{...r}),a=e.useRef.call(void 0,new Map),[c,i]=e.useState.call(void 0,0),[s,u]=e.useState.call(void 0,()=>({...r})),[d,v]=e.useState.call(void 0,_nullishCoalesce(l.initialErrors,()=>({}))),[f,m]=e.useState.call(void 0,{}),[h,y]=e.useState.call(void 0,{}),F=e.useRef.call(void 0,0),k=e.useRef.call(void 0,{}),b=e.useRef.call(void 0,new Map),C=e.useMemo.call(void 0,()=>{const e={};for(const r of new Set([...t.getFormPaths.call(void 0,o.current),...t.getFormPaths.call(void 0,s)]))t.isFormValueEqual.call(void 0,t.getFormPath.call(void 0,s,r),t.getFormPath.call(void 0,o.current,r))||(e[r]=!0);return e},[s,c]),p=Object.keys(C).length>0,g=0===Object.keys(d).length,P=e.useCallback.call(void 0,async(e,r,o)=>{const a=t.normalizeFormPath.call(void 0,e);if(!t.isFormPathActive.call(void 0,o,a))return!0;const c=_nullishCoalesce(k.current[a],()=>0)+1;k.current[a]=c,y(e=>({...e,[a]:!0}));const i=F.current,s=await t.validateFormValue.call(void 0,t.getFormPath.call(void 0,o,a),function getRules(e){const r=Object.keys(_nullishCoalesce(l.rules,()=>({}))).find(r=>t.normalizeFormPath.call(void 0,r)===e);return void 0===r?void 0:l.rules[r]}(a),o,r),isLatestRun=()=>k.current[a]===c&&i===F.current,isCurrentRun=()=>isLatestRun()&&o===n.current;try{isCurrentRun()&&(v(e=>{if(s)return{...e,[a]:s};if(void 0===e[a])return e;const t={...e};return delete t[a],t}),_optionalChain([l,"access",e=>e.onValidate,"optionalCall",e=>e(a,!s,s)]))}finally{isLatestRun()&&y(e=>{if(!isLatestRun())return e;const t={...e};return delete t[a],t})}return isCurrentRun()&&!s},[l.onValidate,l.rules]),w=e.useCallback.call(void 0,(e,r)=>{const o=t.normalizeFormPath.call(void 0,e),a=t.setFormPath.call(void 0,n.current,o,r);n.current=a,u(a),l.validateOnChange&&P(o,"change",a)},[l.validateOnChange,P]),E=w,O=e.useCallback.call(void 0,e=>{const r=t.normalizeFormPath.call(void 0,e);m(e=>({...e,[r]:!0})),l.validateOnBlur&&P(t.normalizeFormPath.call(void 0,r),"blur",n.current)},[l.validateOnBlur,P,s]),S=e.useCallback.call(void 0,e=>{const t="function"==typeof e?e(n.current):e;n.current=t,u(t)},[]),x=e.useCallback.call(void 0,(e,r)=>{const l=t.normalizeFormPath.call(void 0,e);v(e=>({...e,[l]:r}))},[]),M=e.useCallback.call(void 0,e=>{if(void 0===e)return void v({});const r=normalizeFields(e,n.current);v(e=>{const l={...e};for(const e of Object.keys(l))r.some(r=>t.isFormPathWithin.call(void 0,e,r))&&delete l[e];return l})},[]),z=e.useCallback.call(void 0,e=>{M(e);const r=void 0===e?Object.keys(k.current):[...new Set([...normalizeFields(e,n.current),...Object.keys(k.current).filter(r=>normalizeFields(e,n.current).some(e=>t.isFormPathWithin.call(void 0,r,e)))])];for(const e of r)k.current[e]=_nullishCoalesce(k.current[e],()=>0)+1;y(t=>{if(void 0===e)return{};const l={...t};for(const e of r)delete l[e];return l})},[M]),j=e.useCallback.call(void 0,(e,r)=>{const l=t.normalizeFormPath.call(void 0,e);r?b.current.set(l,r):b.current.delete(l)},[]),T=e.useCallback.call(void 0,e=>b.current.get(t.normalizeFormPath.call(void 0,e)),[]),_=e.useCallback.call(void 0,(e,r=_nullishCoalesce(l.scrollIntoViewOptions,()=>({behavior:"smooth",block:"center"})))=>{_optionalChain([b,"access",e=>e.current,"access",e=>e.get,"call",r=>r(t.normalizeFormPath.call(void 0,e)),"optionalAccess",e=>e.scrollIntoView,"call",e=>e(r)])},[l.scrollIntoViewOptions]),I=e.useCallback.call(void 0,e=>{const t=Object.keys(d)[0];void 0!==t&&_(t,e)},[d,_]),V=e.useCallback.call(void 0,(e,r="submit")=>P(t.normalizeFormPath.call(void 0,e),r,n.current),[P,s]),L=e.useCallback.call(void 0,async e=>{const r=n.current,o=void 0===e?[...new Set([...t.getFormPaths.call(void 0,r),...Object.keys(_nullishCoalesce(l.rules,()=>({}))).map(t.normalizeFormPath),...b.current.keys()])]:normalizeFields(e,r);return(await Promise.all(o.filter(e=>t.isFormPathActive.call(void 0,r,e)).map(e=>P(e,"submit",r)))).every(Boolean)&&r===n.current},[P,s,l.rules]),R=e.useCallback.call(void 0,e=>async r=>{r.preventDefault(),m(Object.fromEntries(t.getFormPaths.call(void 0,n.current).map(e=>[e,!0]))),await L()?await e(n.current,r):l.scrollToError&&requestAnimationFrame(()=>{const e=[...b.current.entries()].find(([,e])=>"invalid"===e.dataset.state);e&&_(e[0])})},[l.scrollToError,_,L,s]),A=e.useCallback.call(void 0,e=>{e&&(o.current={...e}),n.current={..._nullishCoalesce(e,()=>o.current)},u(n.current);for(const e of a.current.values())e.resetIds();v({}),m({}),y({});for(const e of Object.keys(k.current))k.current[e]=_nullishCoalesce(k.current[e],()=>0)+1;F.current+=1},[]),W=e.useCallback.call(void 0,e=>{if(void 0===e)return void A();const r=normalizeFields(e,n.current);for(const e of Object.keys(k.current).filter(e=>r.some(r=>t.isFormPathWithin.call(void 0,e,r))))k.current[e]=_nullishCoalesce(k.current[e],()=>0)+1;let l=n.current;for(const e of r)l=t.setFormPath.call(void 0,l,e,t.getFormPath.call(void 0,o.current,e));n.current=l,u(l);for(const[e,l]of a.current)r.some(r=>t.isFormPathWithin.call(void 0,e,r)||t.isFormPathWithin.call(void 0,r,e))&&l.resetIds();v(e=>{const l={...e};for(const e of Object.keys(l))r.some(r=>t.isFormPathWithin.call(void 0,e,r))&&delete l[e];return l}),m(e=>{const l={...e};for(const e of Object.keys(l))r.some(r=>t.isFormPathWithin.call(void 0,e,r))&&delete l[e];return l}),y(e=>{const l={...e};for(const e of Object.keys(l))r.some(r=>t.isFormPathWithin.call(void 0,e,r))&&delete l[e];return l})},[A]),D=e.useCallback.call(void 0,e=>{o.current={...e},i(e=>e+1)},[]),q=e.useCallback.call(void 0,e=>{const r=t.normalizeFormPath.call(void 0,e);let l=a.current.get(r);return l||(l=t.createFormFieldArray.call(void 0,r,()=>t.getFormPath.call(void 0,n.current,r),e=>{F.current+=1,y({});const prune=e=>Object.fromEntries(Object.entries(e).filter(([e])=>!t.isFormPathWithin.call(void 0,e,r)));v(prune),m(prune);for(const[e,l]of a.current)e!==r&&t.isFormPathWithin.call(void 0,e,r)&&l.resetIds();const l=t.setFormPath.call(void 0,n.current,r,e);n.current=l,u(l)}),a.current.set(r,l)),l.controller},[]);return{values:s,rules:l.rules,errors:d,touched:f,dirtyFields:C,validatingFields:h,isDirty:p,isValid:g,isValidating:Object.keys(h).length>0,handleChange:E,handleBlur:O,setFieldValue:w,setValues:S,setError:x,clearErrors:M,clearValidate:z,validateField:V,validate:L,handleSubmit:R,fieldArray:q,reset:A,resetFields:W,setInitialValues:D,registerField:j,getField:T,scrollToField:_,scrollToError:I}},exports.useMounted=function useMounted(){const[t,r]=e.useState.call(void 0,!1);return e.useEffect.call(void 0,()=>{r(!0)},[]),t},exports.useInterval=function useInterval(t,r){const l=e.useRef.call(void 0,t);e.useEffect.call(void 0,()=>{l.current=t},[t]),e.useEffect.call(void 0,()=>{if(null===r)return;const e=setInterval(()=>l.current(),r);return()=>clearInterval(e)},[r])},exports.useTimeout=function useTimeout(t,r){const l=e.useRef.call(void 0,t);e.useEffect.call(void 0,()=>{l.current=t},[t]),e.useEffect.call(void 0,()=>{if(null===r)return;const e=setTimeout(()=>l.current(),r);return()=>clearTimeout(e)},[r])},exports.useHotkeys=function useHotkeys(t,r,l={}){const{preventDefault:o=!1,target:n=null}=l,a=e.useRef.call(void 0,r);e.useEffect.call(void 0,()=>{a.current=r},[r]),e.useEffect.call(void 0,()=>{const e=function parseHotkey(e){const t=e.toLowerCase().split("+").map(e=>e.trim());return{ctrl:t.includes("ctrl"),meta:t.includes("cmd")||t.includes("meta"),alt:t.includes("alt"),shift:t.includes("shift"),key:_nullishCoalesce(t.find(e=>!["ctrl","cmd","meta","alt","shift"].includes(e)),()=>"")}}(t),r=_nullishCoalesce(n,()=>window);function handler(t){t.key.toLowerCase()===e.key&&t.ctrlKey===e.ctrl&&t.metaKey===e.meta&&t.altKey===e.alt&&t.shiftKey===e.shift&&(o&&t.preventDefault(),a.current(t))}return r.addEventListener("keydown",handler),()=>{r.removeEventListener("keydown",handler)}},[t,o,n])},exports.useEventListener=function useEventListener(t,r,l){const o=e.useRef.call(void 0,r);e.useEffect.call(void 0,()=>{o.current=r},[r]),e.useEffect.call(void 0,()=>{if(null===l)return;const e=_nullishCoalesce(l,()=>window);function listener(e){o.current(e)}return e.addEventListener(t,listener),()=>{e.removeEventListener(t,listener)}},[t,l])};//# sourceMappingURL=chunk-D63UPGP5.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["/home/runner/work/ug-ui/ug-ui/packages/ui-react/dist/chunk-D63UPGP5.cjs","../src/hooks/use-debounce.ts","../src/hooks/use-local-storage.ts","../src/hooks/use-click-outside.ts","../src/hooks/use-copy-to-clipboard.ts","../src/hooks/use-toggle.ts","../src/hooks/use-pagination.ts","../src/hooks/use-form.ts","../src/hooks/use-mounted.ts","../src/hooks/use-interval.ts","../src/hooks/use-timeout.ts","../src/hooks/use-hotkeys.ts","../src/hooks/use-event-listener.ts"],"names":["useState","useEffect","useCallback","useRef","useMemo","key","name","entry","values","event"],"mappings":"AAAA;AACA;AACA;ACGA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CAAY,gBAAA,CAAiB,KAAA,EAAO,QAAQ,CAAA;AAC5C,IAAA,OAAO,CAAA,EAAA,GAAM;AACX,MAAA,WAAA,CAAY,mBAAA,CAAoB,KAAA,EAAO,QAAQ,CAAA;AAAA,IACjD,CAAA;AAAA,EACF,CAAA,EAAG,CAAC,KAAA,EAAO,MAAM,CAAC,CAAA;AACpB;AZseA;AACA;AACE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACF,6bAAC","file":"/home/runner/work/ug-ui/ug-ui/packages/ui-react/dist/chunk-D63UPGP5.cjs","sourcesContent":[null,"/**\n * @description: 防抖 hook\n * @author: UG - 一个斗码大陆苦逼的三段码之气的少年,并没有神秘戒指中码老的帮助,但总有一天,我会成为斗码大陆中码帝一样的存在。三十年河东,三十年河西,莫欺少年穷。\n * @date: 2026-04-15\n */\nimport { useState, useEffect } from 'react'\n\n/**\n * 防抖值,延迟 delay 毫秒后才更新\n * @example\n * const keyword = useDebounce(inputValue, 300)\n */\nexport function useDebounce<T>(value: T, delay = 300): T {\n const [debounced, setDebounced] = useState(value)\n\n useEffect(() => {\n const timer = setTimeout(() => setDebounced(value), delay)\n return () => clearTimeout(timer)\n }, [value, delay])\n\n return debounced\n}\n","/**\n * @description: localStorage 持久化 hook\n * @author: UG - 一个斗码大陆苦逼的三段码之气的少年,并没有神秘戒指中码老的帮助,但总有一天,我会成为斗码大陆中码帝一样的存在。三十年河东,三十年河西,莫欺少年穷。\n * @date: 2026-04-15\n */\nimport { useState, useCallback } from 'react'\n\nexport type SetLocalStorageValue<T> = (value: T | ((prev: T) => T)) => void\nexport type UseLocalStorageReturn<T> = [T, SetLocalStorageValue<T>, () => void]\n\ninterface StorageSlot<T> {\n key: string\n current: T\n}\n\nfunction readValue<T>(key: string, initialValue: T): T {\n if (typeof window === 'undefined') return initialValue\n try {\n const item = window.localStorage.getItem(key)\n return item ? (JSON.parse(item) as T) : initialValue\n } catch {\n return initialValue\n }\n}\n\n/**\n * 自动读写 localStorage 的 useState\n * @example\n * const [token, setToken, removeToken] = useLocalStorage('token', '')\n */\nexport function useLocalStorage<T>(key: string, initialValue: T): UseLocalStorageReturn<T> {\n const [storedSlot, setStoredSlot] = useState<StorageSlot<T>>(() => ({ key, current: readValue(key, initialValue) }))\n const [, renderValue] = useState(0)\n let slot = storedSlot\n if (slot.key !== key) {\n slot = { key, current: readValue(key, initialValue) }\n setStoredSlot(slot)\n }\n\n const setValue = useCallback((value: T | ((prev: T) => T)) => {\n // 当前槽立即保存会话值,连续调用不依赖尚未提交的 React 更新。\n const next = value instanceof Function ? value(slot.current) : value\n slot.current = next\n if (typeof window !== 'undefined') {\n try {\n window.localStorage.setItem(slot.key, JSON.stringify(next))\n } catch {\n // 存储不可用时仍保留当前会话内的 React 状态。\n }\n }\n renderValue(revision => revision + 1)\n }, [slot])\n\n const removeValue = useCallback(() => {\n slot.current = initialValue\n if (typeof window !== 'undefined') {\n try {\n window.localStorage.removeItem(slot.key)\n } catch {\n // 存储不可用时仍完成当前会话内的状态重置。\n }\n }\n renderValue(revision => revision + 1)\n }, [slot, initialValue])\n\n return [slot.current, setValue, removeValue]\n}\n","/**\n * @description: 点击元素外部触发回调的 hook\n * @author: UG - 一个斗码大陆苦逼的三段码之气的少年,并没有神秘戒指中码老的帮助,但总有一天,我会成为斗码大陆中码帝一样的存在。三十年河东,三十年河西,莫欺少年穷。\n * @date: 2026-04-15\n */\nimport { useEffect } from 'react'\nimport type { RefObject } from 'react'\n\n/**\n * 点击 ref 元素外部时触发 handler\n * @example\n * const ref = useRef<HTMLDivElement>(null)\n * useClickOutside(ref, () => setOpen(false))\n */\nexport function useClickOutside<T extends HTMLElement>(\n ref: RefObject<T | null>,\n handler: () => void,\n): void {\n useEffect(() => {\n const handleMouseDown = (event: MouseEvent) => {\n if (ref.current && !ref.current.contains(event.target as Node)) {\n handler()\n }\n }\n\n const handleTouchStart = (event: TouchEvent) => {\n if (ref.current && !ref.current.contains(event.target as Node)) {\n handler()\n }\n }\n\n document.addEventListener('mousedown', handleMouseDown)\n document.addEventListener('touchstart', handleTouchStart)\n\n return () => {\n document.removeEventListener('mousedown', handleMouseDown)\n document.removeEventListener('touchstart', handleTouchStart)\n }\n }, [ref, handler])\n}\n","/**\n * @description: 复制文本到剪贴板的 hook\n * @author: UG - 一个斗码大陆苦逼的三段码之气的少年,并没有神秘戒指中码老的帮助,但总有一天,我会成为斗码大陆中码帝一样的存在。三十年河东,三十年河西,莫欺少年穷。\n * @date: 2026-04-15\n */\nimport { useCallback, useLayoutEffect, useRef, useState } from 'react'\n\nexport interface UseCopyToClipboardReturn {\n copied: boolean\n copy: (text: string) => Promise<void>\n}\n\n/**\n * 复制文本到剪贴板,copied 状态 2 秒后自动重置\n * @example\n * const { copied, copy } = useCopyToClipboard()\n * <button onClick={() => copy('hello')}>{copied ? '已复制' : '复制'}</button>\n */\nexport function useCopyToClipboard(): UseCopyToClipboardReturn {\n const [copied, setCopied] = useState(false)\n const timerRef = useRef<ReturnType<typeof setTimeout> | null>(null)\n const sequence = useRef(0)\n const alive = useRef(true)\n\n useLayoutEffect(() => {\n alive.current = true\n return () => {\n alive.current = false\n sequence.current++\n if (timerRef.current !== null) {\n clearTimeout(timerRef.current)\n timerRef.current = null\n }\n }\n }, [])\n\n const copy = useCallback(async (text: string) => {\n if (!alive.current) return\n const request = ++sequence.current\n if (timerRef.current !== null) { clearTimeout(timerRef.current); timerRef.current = null }\n setCopied(false)\n if (typeof navigator === 'undefined' || !navigator.clipboard) {\n return\n }\n\n try {\n await navigator.clipboard.writeText(text)\n if (!alive.current || request !== sequence.current) return\n setCopied(true)\n // 2 秒后自动重置状态\n timerRef.current = setTimeout(() => {\n timerRef.current = null\n if (alive.current && request === sequence.current) setCopied(false)\n }, 2000)\n } catch {\n if (alive.current && request === sequence.current) setCopied(false)\n }\n }, [])\n\n return { copied, copy }\n}\n","/**\n * @description: 布尔值切换 hook\n * @author: UG - 一个斗码大陆苦逼的三段码之气的少年,并没有神秘戒指中码老的帮助,但总有一天,我会成为斗码大陆中码帝一样的存在。三十年河东,三十年河西,莫欺少年穷。\n * @date: 2026-04-15\n */\nimport { useState, useCallback } from 'react'\n\nexport type UseToggleReturn = [boolean, () => void, (value: boolean) => void]\n\n/**\n * 简单的布尔值切换,返回 [value, toggle, setValue]\n * @example\n * const [isOpen, toggleOpen, setIsOpen] = useToggle(false)\n * <button onClick={toggleOpen}>切换</button>\n */\nexport function useToggle(\n initial = false,\n): UseToggleReturn {\n const [value, setValue] = useState(initial)\n\n const toggle = useCallback(() => {\n setValue(prev => !prev)\n }, [])\n\n return [value, toggle, setValue]\n}\n","/**\n * @description: 分页状态管理 hook\n * @author: UG - 一个斗码大陆苦逼的三段码之气的少年,并没有神秘戒指中码老的帮助,但总有一天,我会成为斗码大陆中码帝一样的存在。三十年河东,三十年河西,莫欺少年穷。\n * @date: 2026-04-15\n */\nimport { useCallback, useEffect, useMemo, useState } from 'react'\n\nexport interface UsePaginationOptions {\n /** 数据总条数 */\n total: number\n /** 每页条数,默认 10 */\n pageSize?: number\n /** 初始页码,默认 1 */\n initialPage?: number\n}\n\nexport interface UsePaginationReturn {\n /** 当前页码 (从 1 开始) */\n page: number\n /** 总页数 */\n totalPages: number\n /** 跳转到指定页 */\n setPage: (p: number) => void\n /** 下一页 */\n nextPage: () => void\n /** 上一页 */\n prevPage: () => void\n /** 是否有下一页 */\n hasNext: boolean\n /** 是否有上一页 */\n hasPrev: boolean\n /** 当前页起始索引 (0-based,用于切片) */\n startIndex: number\n /** 当前页结束索引 (exclusive,用于切片) */\n endIndex: number\n}\n\n/**\n * 分页状态管理,提供页码、边界判断和数据切片索引\n * @example\n * const { page, totalPages, nextPage, prevPage, startIndex, endIndex } = usePagination({ total: 100, pageSize: 10 })\n * const pageData = data.slice(startIndex, endIndex)\n */\nexport function usePagination({\n total,\n pageSize = 10,\n initialPage = 1,\n}: UsePaginationOptions): UsePaginationReturn {\n const totalPages = useMemo(\n () => Math.max(1, Math.ceil(total / pageSize)),\n [total, pageSize],\n )\n\n const [internalPage, setPageState] = useState(() =>\n Math.min(Math.max(1, initialPage), Math.max(1, Math.ceil(total / pageSize))),\n )\n const page = Math.min(internalPage, totalPages)\n\n useEffect(() => {\n setPageState(prev => Math.min(prev, totalPages))\n }, [totalPages])\n\n const setPage = useCallback(\n (p: number) => {\n setPageState(Math.min(Math.max(1, p), totalPages))\n },\n [totalPages],\n )\n\n const nextPage = useCallback(() => {\n setPageState(prev => Math.min(prev + 1, totalPages))\n }, [totalPages])\n\n const prevPage = useCallback(() => {\n setPageState(prev => Math.max(Math.min(prev, totalPages) - 1, 1))\n }, [totalPages])\n\n const startIndex = (page - 1) * pageSize\n const endIndex = Math.min(startIndex + pageSize, total)\n\n return {\n page,\n totalPages,\n setPage,\n nextPage,\n prevPage,\n hasNext: page < totalPages,\n hasPrev: page > 1,\n startIndex,\n endIndex,\n }\n}\n","/**\n * @description: React 表单状态、校验与提交流程管理\n * @author: UG - 一个斗码大陆苦逼的三段码之气的少年,并没有神秘戒指中码老的帮助,但总有一天,我会成为斗码大陆中码帝一样的存在。三十年河东,三十年河西,莫欺少年穷。\n * @date: 2026-07-27\n */\nimport {\n useCallback,\n useMemo,\n useRef,\n useState,\n type FormEvent,\n type SetStateAction,\n} from 'react'\nimport {\n validateFormValue, createFormFieldArray, getFormPath, setFormPath, getFormPaths, isFormPathWithin, normalizeFormPath, isFormValueEqual, isFormPathActive,\n type FormFieldArray, type FormFieldName, type FormSetFieldValue, type FormFieldRules,\n type FormRules,\n type FormValidationTrigger,\n} from '@ug666/ui-core'\n\nexport type UseFormErrors<T extends Record<string, unknown>> = Partial<Record<string, string>>\nexport type UseFormTouched<T extends Record<string, unknown>> = Partial<Record<string, boolean>>\n\nexport interface UseFormOptions<T extends Record<string, unknown>> {\n rules?: FormRules<T>\n validateOnChange?: boolean\n validateOnBlur?: boolean\n initialErrors?: UseFormErrors<T>\n scrollToError?: boolean\n scrollIntoViewOptions?: ScrollIntoViewOptions\n onValidate?: (name: FormFieldName<T>, valid: boolean, message?: string) => void\n}\n\nexport interface UseFormReturn<T extends Record<string, unknown>> {\n values: T\n rules: FormRules<T> | undefined\n errors: UseFormErrors<T>\n touched: UseFormTouched<T>\n dirtyFields: UseFormTouched<T>\n validatingFields: UseFormTouched<T>\n isDirty: boolean\n isValid: boolean\n isValidating: boolean\n handleChange: FormSetFieldValue<T>\n handleBlur: (name: FormFieldName<T>) => void\n setFieldValue: FormSetFieldValue<T>\n setValues: (values: SetStateAction<T>) => void\n setError: (name: FormFieldName<T>, message: string) => void\n clearErrors: (names?: FormFieldName<T> | (FormFieldName<T>)[]) => void\n clearValidate: (names?: FormFieldName<T> | (FormFieldName<T>)[]) => void\n validateField: (name: FormFieldName<T>, trigger?: FormValidationTrigger) => Promise<boolean>\n validate: (names?: FormFieldName<T> | (FormFieldName<T>)[]) => Promise<boolean>\n handleSubmit: (\n callback: (values: T, event: FormEvent<HTMLFormElement>) => void | Promise<void>,\n ) => (event: FormEvent<HTMLFormElement>) => Promise<void>\n fieldArray: <Item = unknown>(name: FormFieldName<T>) => FormFieldArray<Item>\n reset: (nextValues?: T) => void\n resetFields: (names?: FormFieldName<T> | (FormFieldName<T>)[]) => void\n setInitialValues: (values: T) => void\n registerField: (name: FormFieldName<T>, element: HTMLElement | null) => void\n getField: (name: FormFieldName<T>) => HTMLElement | undefined\n scrollToField: (name: FormFieldName<T>, options?: ScrollIntoViewOptions) => void\n scrollToError: (options?: ScrollIntoViewOptions) => void\n}\n\nfunction normalizeFields<T extends Record<string, unknown>>(\n names: FormFieldName<T> | (FormFieldName<T>)[] | undefined,\n values: T,\n): (FormFieldName<T>)[] {\n if (names === undefined) return getFormPaths(values)\n return (Array.isArray(names) ? names : [names]).map(normalizeFormPath)\n}\n\nexport function useForm<T extends Record<string, unknown>>(\n initialValues: T,\n options: UseFormOptions<T> = {},\n): UseFormReturn<T> {\n const initialValuesRef = useRef<T>({ ...initialValues })\n const valuesRef = useRef<T>({ ...initialValues })\n const fieldArraysRef = useRef(new Map<string, ReturnType<typeof createFormFieldArray>>())\n const [baselineRevision, setBaselineRevision] = useState(0)\n const [values, setValuesState] = useState<T>(() => ({ ...initialValues }))\n const [errors, setErrors] = useState<UseFormErrors<T>>(options.initialErrors ?? {})\n const [touched, setTouched] = useState<UseFormTouched<T>>({})\n const [validatingFields, setValidatingFields] = useState<UseFormTouched<T>>({})\n const validationGenerationRef = useRef(0)\n const validationRunRef = useRef<Partial<Record<string, number>>>({})\n const fieldElementsRef = useRef(new Map<FormFieldName<T>, HTMLElement>())\n\n const dirtyFields = useMemo(() => {\n const next: UseFormTouched<T> = {}\n for (const name of new Set([...getFormPaths(initialValuesRef.current), ...getFormPaths(values)])) {\n if (!isFormValueEqual(getFormPath(values, name), getFormPath(initialValuesRef.current, name))) next[name] = true\n }\n return next\n }, [values, baselineRevision])\n\n const isDirty = Object.keys(dirtyFields).length > 0\n const isValid = Object.keys(errors).length === 0\n\n function getRules(path: string): FormFieldRules<T[Extract<keyof T, string>], T> | undefined {\n const key = Object.keys(options.rules ?? {}).find(key => normalizeFormPath(key) === path)\n return key === undefined ? undefined : (options.rules as Record<string, FormFieldRules<T[Extract<keyof T, string>], T>>)[key]\n }\n\n const runFieldValidation = useCallback(async (\n path: FormFieldName<T>,\n trigger: FormValidationTrigger,\n currentValues: T,\n ): Promise<boolean> => {\n const name = normalizeFormPath(path)\n if (!isFormPathActive(currentValues, name)) return true\n const run = (validationRunRef.current[name] ?? 0) + 1\n validationRunRef.current[name] = run\n setValidatingFields((current) => ({ ...current, [name]: true }))\n const generation = validationGenerationRef.current\n\n const message = await validateFormValue(\n getFormPath(currentValues, name) as T[Extract<keyof T, string>],\n getRules(name),\n currentValues,\n trigger,\n )\n\n const isLatestRun = () => validationRunRef.current[name] === run && generation === validationGenerationRef.current\n // validator 可以读取整表 values;仅比较当前字段会接收依赖字段已变的旧结果。\n const isCurrentRun = () => isLatestRun() && currentValues === valuesRef.current\n try {\n if (isCurrentRun()) {\n setErrors((current) => {\n if (message) return { ...current, [name]: message }\n if (current[name] === undefined) return current\n const next = { ...current }\n delete next[name]\n return next\n })\n options.onValidate?.(name, !message, message)\n }\n } finally {\n // 用户回调可能重入校验或 reset;清理也必须重新确认任务归属。\n if (isLatestRun()) setValidatingFields(current => { if (!isLatestRun()) return current; const next = { ...current }; delete next[name]; return next })\n }\n\n return isCurrentRun() && !message\n }, [options.onValidate, options.rules])\n\n const setFieldValue: FormSetFieldValue<T> = useCallback((path: string, value: unknown) => {\n const name = normalizeFormPath(path)\n const next = setFormPath(valuesRef.current, name, value)\n valuesRef.current = next\n setValuesState(next)\n if (options.validateOnChange) void runFieldValidation(name, 'change', next)\n }, [options.validateOnChange, runFieldValidation])\n\n const handleChange = setFieldValue\n\n const handleBlur = useCallback((path: FormFieldName<T>) => {\n const name = normalizeFormPath(path)\n setTouched((current) => ({ ...current, [name]: true }))\n if (options.validateOnBlur) void runFieldValidation(normalizeFormPath(name), 'blur', valuesRef.current)\n }, [options.validateOnBlur, runFieldValidation, values])\n\n const setValues = useCallback((nextValue: SetStateAction<T>) => {\n const next = typeof nextValue === 'function' ? (nextValue as (previous: T) => T)(valuesRef.current) : nextValue\n valuesRef.current = next\n setValuesState(next)\n }, [])\n\n const setError = useCallback((path: FormFieldName<T>, message: string) => {\n const name = normalizeFormPath(path)\n setErrors((current) => ({ ...current, [name]: message }))\n }, [])\n\n const clearErrors = useCallback((names?: FormFieldName<T> | (FormFieldName<T>)[]) => {\n if (names === undefined) {\n setErrors({})\n return\n }\n const fields = normalizeFields(names, valuesRef.current)\n setErrors((current) => {\n const next = { ...current }\n for (const name of Object.keys(next)) if (fields.some(field => isFormPathWithin(name, field))) delete next[name]\n return next\n })\n }, [])\n const clearValidate = useCallback((names?: FormFieldName<T> | (FormFieldName<T>)[]) => {\n clearErrors(names)\n const fields = names === undefined\n ? Object.keys(validationRunRef.current) as (FormFieldName<T>)[]\n : [...new Set([...normalizeFields(names, valuesRef.current), ...Object.keys(validationRunRef.current).filter(name => normalizeFields(names, valuesRef.current).some(field => isFormPathWithin(name, field)))])]\n for (const name of fields) {\n validationRunRef.current[name] = (validationRunRef.current[name] ?? 0) + 1\n }\n setValidatingFields((current) => {\n if (names === undefined) return {}\n const next = { ...current }\n for (const name of fields) delete next[name]\n return next\n })\n }, [clearErrors])\n\n const registerField = useCallback((path: FormFieldName<T>, element: HTMLElement | null) => {\n const name = normalizeFormPath(path)\n if (element) fieldElementsRef.current.set(name, element)\n else fieldElementsRef.current.delete(name)\n }, [])\n\n const getField = useCallback(\n (name: FormFieldName<T>) => fieldElementsRef.current.get(normalizeFormPath(name)),\n [],\n )\n\n const scrollToField = useCallback((\n name: FormFieldName<T>,\n scrollOptions: ScrollIntoViewOptions = options.scrollIntoViewOptions ?? {\n behavior: 'smooth',\n block: 'center',\n },\n ) => {\n fieldElementsRef.current.get(normalizeFormPath(name))?.scrollIntoView(scrollOptions)\n }, [options.scrollIntoViewOptions])\n\n const scrollToError = useCallback((\n scrollOptions?: ScrollIntoViewOptions,\n ) => {\n const firstInvalidField = (Object.keys(errors) as FormFieldName<T>[])[0]\n if (firstInvalidField !== undefined) scrollToField(firstInvalidField, scrollOptions)\n }, [errors, scrollToField])\n\n const validateField = useCallback((\n name: FormFieldName<T>,\n trigger: FormValidationTrigger = 'submit',\n ) => runFieldValidation(normalizeFormPath(name), trigger, valuesRef.current), [runFieldValidation, values])\n\n const validate = useCallback(async (names?: FormFieldName<T> | (FormFieldName<T>)[]) => {\n const snapshot = valuesRef.current\n const fields = names === undefined ? [...new Set([...getFormPaths(snapshot), ...Object.keys(options.rules ?? {}).map(normalizeFormPath), ...fieldElementsRef.current.keys()])] : normalizeFields(names, snapshot)\n const results = await Promise.all(\n fields.filter(name => isFormPathActive(snapshot, name)).map((name) => runFieldValidation(name, 'submit', snapshot)),\n )\n return results.every(Boolean) && snapshot === valuesRef.current\n }, [runFieldValidation, values, options.rules])\n\n const handleSubmit = useCallback((\n callback: (values: T, event: FormEvent<HTMLFormElement>) => void | Promise<void>,\n ) => async (event: FormEvent<HTMLFormElement>) => {\n event.preventDefault()\n setTouched(Object.fromEntries(\n getFormPaths(valuesRef.current).map((name) => [name, true]),\n ) as UseFormTouched<T>)\n if (await validate()) {\n await callback(valuesRef.current, event)\n return\n }\n if (options.scrollToError) {\n requestAnimationFrame(() => {\n const firstInvalidEntry = [...fieldElementsRef.current.entries()]\n .find(([, element]) => element.dataset.state === 'invalid')\n if (firstInvalidEntry) scrollToField(firstInvalidEntry[0])\n })\n }\n }, [options.scrollToError, scrollToField, validate, values])\n\n const reset = useCallback((nextValues?: T) => {\n if (nextValues) initialValuesRef.current = { ...nextValues }\n valuesRef.current = { ...(nextValues ?? initialValuesRef.current) }\n setValuesState(valuesRef.current)\n for (const entry of fieldArraysRef.current.values()) entry.resetIds()\n setErrors({})\n setTouched({})\n setValidatingFields({})\n for (const name of Object.keys(validationRunRef.current) as (FormFieldName<T>)[]) {\n validationRunRef.current[name] = (validationRunRef.current[name] ?? 0) + 1\n }\n validationGenerationRef.current += 1\n }, [])\n\n const resetFields = useCallback((names?: FormFieldName<T> | (FormFieldName<T>)[]) => {\n if (names === undefined) {\n reset()\n return\n }\n const fields = normalizeFields(names, valuesRef.current)\n for (const name of Object.keys(validationRunRef.current).filter(name => fields.some(field => isFormPathWithin(name, field)))) {\n validationRunRef.current[name] = (validationRunRef.current[name] ?? 0) + 1\n }\n let nextValues = valuesRef.current\n for (const name of fields) nextValues = setFormPath(nextValues, name, getFormPath(initialValuesRef.current, name))\n valuesRef.current = nextValues\n setValuesState(nextValues)\n for (const [name, entry] of fieldArraysRef.current) if (fields.some(field => isFormPathWithin(name, field) || isFormPathWithin(field, name))) entry.resetIds()\n\n setErrors((current) => {\n const next = { ...current }\n for (const name of Object.keys(next)) if (fields.some(field => isFormPathWithin(name, field))) delete next[name]\n return next\n })\n setTouched((current) => {\n const next = { ...current }\n for (const name of Object.keys(next)) if (fields.some(field => isFormPathWithin(name, field))) delete next[name]\n return next\n })\n setValidatingFields((current) => {\n const next = { ...current }\n for (const name of Object.keys(next)) if (fields.some(field => isFormPathWithin(name, field))) delete next[name]\n return next\n })\n }, [reset])\n\n const setInitialValues = useCallback((nextValues: T) => {\n initialValuesRef.current = { ...nextValues }\n setBaselineRevision(revision => revision + 1)\n }, [])\n\n const fieldArray = useCallback(<Item = unknown>(path: FormFieldName<T>): FormFieldArray<Item> => {\n const name = normalizeFormPath(path)\n let entry = fieldArraysRef.current.get(name)\n if (!entry) {\n entry = createFormFieldArray(name, () => getFormPath(valuesRef.current, name), next => {\n validationGenerationRef.current += 1\n setValidatingFields({})\n const prune = <Value,>(current: Partial<Record<FormFieldName<T>, Value>>) => Object.fromEntries(Object.entries(current).filter(([field]) => !isFormPathWithin(field, name))) as Partial<Record<FormFieldName<T>, Value>>\n setErrors(prune); setTouched(prune)\n for (const [field, entry] of fieldArraysRef.current) if (field !== name && isFormPathWithin(field, name)) entry.resetIds()\n const values = setFormPath(valuesRef.current, name, next)\n valuesRef.current = values; setValuesState(values)\n })\n fieldArraysRef.current.set(name, entry)\n }\n return entry.controller as FormFieldArray<Item>\n }, [])\n\n return {\n values,\n rules: options.rules,\n errors,\n touched,\n dirtyFields,\n validatingFields,\n isDirty,\n isValid,\n isValidating: Object.keys(validatingFields).length > 0,\n handleChange,\n handleBlur,\n setFieldValue,\n setValues,\n setError,\n clearErrors,\n clearValidate,\n validateField,\n validate,\n handleSubmit,\n fieldArray,\n reset,\n resetFields,\n setInitialValues,\n registerField,\n getField,\n scrollToField,\n scrollToError,\n }\n}\n","/**\n * @description: 组件挂载状态 hook — 用于避免 SSR 环境下的 hydration 报错\n * @author: UG - 一个斗码大陆苦逼的三段码之气的少年,并没有神秘戒指中码老的帮助,但总有一天,我会成为斗码大陆中码帝一样的存在。三十年河东,三十年河西,莫欺少年穷。\n * @date: 2026-04-17\n */\nimport { useState, useEffect } from 'react'\n\n/**\n * 返回组件是否已在客户端挂载完成。\n *\n * 在 SSR 场景中,服务端渲染时始终返回 false,\n * 客户端 hydration 完成后变为 true,可用于条件渲染仅客户端内容。\n *\n * @returns 组件是否已挂载\n *\n * @example\n * ```tsx\n * const isMounted = useMounted()\n *\n * if (!isMounted) return null // 服务端不渲染\n * return <ClientOnlyComponent />\n * ```\n */\nexport function useMounted(): boolean {\n const [mounted, setMounted] = useState(false)\n\n useEffect(() => {\n setMounted(true)\n }, [])\n\n return mounted\n}\n","/**\n * @description: 定时间隔 hook — delay 为 null 时暂停,支持动态调整间隔\n * @author: UG - 一个斗码大陆苦逼的三段码之气的少年,并没有神秘戒指中码老的帮助,但总有一天,我会成为斗码大陆中码帝一样的存在。三十年河东,三十年河西,莫欺少年穷。\n * @date: 2026-04-17\n */\nimport { useEffect, useRef } from 'react'\n\n/**\n * 以指定间隔重复调用回调函数。\n *\n * 当 delay 为 null 时定时器自动暂停,可动态修改 delay 或 callback。\n * 参考 Dan Abramov 的 useInterval 实现,使用 ref 保持 callback 最新引用。\n *\n * @param callback 每次触发时调用的函数\n * @param delay 间隔毫秒数;传入 null 则暂停定时器\n *\n * @example\n * ```tsx\n * const [count, setCount] = useState(0)\n * const [running, setRunning] = useState(true)\n *\n * useInterval(() => setCount(c => c + 1), running ? 1000 : null)\n * ```\n */\nexport function useInterval(callback: () => void, delay: number | null): void {\n const savedCallback = useRef<() => void>(callback)\n\n // 每次渲染都更新 ref,确保 callback 始终最新\n useEffect(() => {\n savedCallback.current = callback\n }, [callback])\n\n useEffect(() => {\n if (delay === null) return\n const id = setInterval(() => savedCallback.current(), delay)\n return () => clearInterval(id)\n }, [delay])\n}\n","/**\n * @description: 延迟执行 hook — delay 为 null 时暂停,组件卸载自动清理\n * @author: UG - 一个斗码大陆苦逼的三段码之气的少年,并没有神秘戒指中码老的帮助,但总有一天,我会成为斗码大陆中码帝一样的存在。三十年河东,三十年河西,莫欺少年穷。\n * @date: 2026-04-17\n */\nimport { useEffect, useRef } from 'react'\n\n/**\n * 在指定延迟后执行一次回调函数。\n *\n * 当 delay 为 null 时定时器不启动(暂停模式)。\n * 每次 delay 变化都会重置定时器;组件卸载时自动清理。\n *\n * @param callback 延迟结束后调用的函数\n * @param delay 延迟毫秒数;传入 null 则不执行\n *\n * @example\n * ```tsx\n * const [show, setShow] = useState(true)\n *\n * // 3 秒后自动隐藏提示\n * useTimeout(() => setShow(false), show ? 3000 : null)\n * ```\n */\nexport function useTimeout(callback: () => void, delay: number | null): void {\n const savedCallback = useRef<() => void>(callback)\n\n // 每次渲染都更新 ref,确保 callback 始终最新\n useEffect(() => {\n savedCallback.current = callback\n }, [callback])\n\n useEffect(() => {\n if (delay === null) return\n const id = setTimeout(() => savedCallback.current(), delay)\n return () => clearTimeout(id)\n }, [delay])\n}\n","/**\n * @description: 快捷键绑定 hook — 支持 \"ctrl+k\"、\"cmd+s\"、\"escape\" 等组合键\n * @author: UG - 一个斗码大陆苦逼的三段码之气的少年,并没有神秘戒指中码老的帮助,但总有一天,我会成为斗码大陆中码帝一样的存在。三十年河东,三十年河西,莫欺少年穷。\n * @date: 2026-04-17\n */\nimport { useEffect, useRef } from 'react'\n\nexport interface UseHotkeysOptions {\n /** 是否阻止默认浏览器行为,默认 false */\n preventDefault?: boolean\n /** 监听目标,默认 window */\n target?: HTMLElement | null\n}\n\n/**\n * 解析快捷键字符串,返回规范化的修饰键 + 主键结构。\n * 支持 ctrl/cmd/alt/shift + 任意按键,键名不区分大小写。\n * \"cmd\" 在 Mac 映射为 Meta,Windows 同样可响应 Meta 键。\n */\nfunction parseHotkey(keys: string): {\n ctrl: boolean\n meta: boolean\n alt: boolean\n shift: boolean\n key: string\n} {\n const parts = keys.toLowerCase().split('+').map((s) => s.trim())\n const ctrl = parts.includes('ctrl')\n const meta = parts.includes('cmd') || parts.includes('meta')\n const alt = parts.includes('alt')\n const shift = parts.includes('shift')\n const key = parts.find(\n (p) => !['ctrl', 'cmd', 'meta', 'alt', 'shift'].includes(p),\n ) ?? ''\n\n return { ctrl, meta, alt, shift, key }\n}\n\n/**\n * 将快捷键字符串绑定到回调函数。\n *\n * 支持修饰键组合:ctrl、cmd(Meta)、alt、shift,加主键(不区分大小写)。\n * 组件卸载时自动解绑。\n *\n * @param keys 快捷键字符串,如 \"ctrl+k\"、\"cmd+s\"、\"escape\"\n * @param callback 触发时调用的函数\n * @param options 额外配置项\n *\n * @example\n * ```tsx\n * // 全局搜索快捷键\n * useHotkeys('ctrl+k', () => setSearchOpen(true), { preventDefault: true })\n *\n * // ESC 关闭弹窗\n * useHotkeys('escape', () => setOpen(false))\n *\n * // 仅在特定元素内响应\n * useHotkeys('ctrl+enter', handleSubmit, { target: formRef.current })\n * ```\n */\nexport function useHotkeys(\n keys: string,\n callback: (event: KeyboardEvent) => void,\n options: UseHotkeysOptions = {},\n): void {\n const { preventDefault = false, target = null } = options\n const savedCallback = useRef<(event: KeyboardEvent) => void>(callback)\n\n useEffect(() => {\n savedCallback.current = callback\n }, [callback])\n\n useEffect(() => {\n const parsed = parseHotkey(keys)\n const eventTarget: EventTarget = target ?? window\n\n function handler(event: KeyboardEvent): void {\n const eventKey = event.key.toLowerCase()\n const match =\n eventKey === parsed.key &&\n event.ctrlKey === parsed.ctrl &&\n event.metaKey === parsed.meta &&\n event.altKey === parsed.alt &&\n event.shiftKey === parsed.shift\n\n if (match) {\n if (preventDefault) event.preventDefault()\n savedCallback.current(event)\n }\n }\n\n eventTarget.addEventListener('keydown', handler as EventListener)\n return () => {\n eventTarget.removeEventListener('keydown', handler as EventListener)\n }\n }, [keys, preventDefault, target])\n}\n","/**\n * @description: 事件监听 hook — 自动管理事件绑定与清理,支持 Window/Document/HTMLElement\n * @author: UG - 一个斗码大陆苦逼的三段码之气的少年,并没有神秘戒指中码老的帮助,但总有一天,我会成为斗码大陆中码帝一样的存在。三十年河东,三十年河西,莫欺少年穷。\n * @date: 2026-04-17\n */\nimport { useEffect, useRef } from 'react'\n\n/**\n * 在指定目标上绑定事件监听器,组件卸载时自动清理。\n *\n * 支持三种目标类型:\n * - 不传 target → 默认监听 window\n * - 传入 HTMLElement → 监听该元素\n * - 传入 null → 跳过绑定\n *\n * @typeParam K WindowEventMap 中的事件名称\n * @param event 事件名称,如 \"scroll\"、\"resize\"、\"click\"\n * @param handler 事件处理函数\n * @param target 监听目标;默认 window;传 null 跳过绑定\n *\n * @example\n * ```tsx\n * // 监听全局滚动\n * useEventListener('scroll', () => setScrollY(window.scrollY))\n *\n * // callback ref 用 state 接收节点,挂载及节点替换会触发重新绑定。\n * // 单独读取 ref.current 不会在节点挂载时触发 render。\n * const [target, setTarget] = useState<HTMLDivElement | null>(null)\n * useEventListener('click', handleClick, target)\n * return <div ref={setTarget} />\n * ```\n */\nexport function useEventListener<K extends keyof WindowEventMap>(\n event: K,\n handler: (event: WindowEventMap[K]) => void,\n target?: EventTarget | null,\n): void {\n const savedHandler = useRef<(event: WindowEventMap[K]) => void>(handler)\n\n useEffect(() => {\n savedHandler.current = handler\n }, [handler])\n\n useEffect(() => {\n // target 显式传入 null 时跳过绑定\n if (target === null) return\n const eventTarget: EventTarget = target ?? window\n\n function listener(event: Event): void {\n savedHandler.current(event as WindowEventMap[K])\n }\n\n eventTarget.addEventListener(event, listener)\n return () => {\n eventTarget.removeEventListener(event, listener)\n }\n }, [event, target])\n}\n"]}
@@ -0,0 +1 @@
1
+ "use client";import{useUGThemePortalAttributes as e}from"./chunk-PZ4UH6BC.js";import{useMediaQuery as t}from"./chunk-XN7GQRSF.js";import{Input as a}from"./chunk-KNWHIFJE.js";import{cn as r,isAriaInvalid as n,resolveControlSize as o,resolveDisabled as i,useUIConfig as l}from"./chunk-AQJWS45G.js";import{forwardRef as s,useEffect as d,useId as c,useRef as u,useState as m}from"react";import{Check as f,Minus as g}from"lucide-react";import{cva as v}from"class-variance-authority";import{createContext as p,useContext as h}from"react";var b=p(null);import{jsx as y,jsxs as x}from"react/jsx-runtime";var w=v("peer inline-flex shrink-0 items-center justify-center rounded-[var(--radius-control)] border shadow-sm peer-focus-visible:outline-none peer-focus-visible:ring-2 peer-focus-visible:ring-ring/35 peer-focus-visible:ring-offset-2 peer-focus-visible:ring-offset-surface-0 peer-disabled:cursor-not-allowed peer-disabled:opacity-50",{variants:{size:{sm:"h-[calc(var(--control-height-sm)*0.5)] w-[calc(var(--control-height-sm)*0.5)]",default:"h-[calc(var(--control-height-md)*0.45)] w-[calc(var(--control-height-md)*0.45)]",lg:"h-[calc(var(--control-height-lg)*0.45)] w-[calc(var(--control-height-lg)*0.45)]"},state:{unchecked:"border-border-strong bg-surface-1 text-transparent hover:border-primary/70 hover:bg-surface-2",checked:"border-[color:var(--ug-checkbox-selected-bg)] bg-[var(--ug-checkbox-selected-bg)] text-[color:var(--ug-checkbox-selected-fg)]",indeterminate:"border-[color:var(--ug-checkbox-selected-bg)] bg-[var(--ug-checkbox-selected-bg)] text-[color:var(--ug-checkbox-selected-fg)]"}},defaultVariants:{size:"default",state:"unchecked"}}),N=s(({className:e,size:t,checked:a,defaultChecked:s,indeterminate:v=!1,disabled:p,label:N,labelClassName:C,onChange:k,onCheckedChange:z,id:E,form:T,name:M,value:I,"aria-invalid":R,...S},F)=>{const P=l(),L=function useCheckboxGroupContext(){return h(b)}(),j=u(null),[D,A]=m(Boolean(s)),B=c(),O=E??B,K=L&&void 0!==I?L.values.includes(I):void 0,$=K??a??D,V=void 0!==K||void 0!==a,H=u({checked:$,indeterminate:v});H.current={checked:$,indeterminate:v};const q=L?.form??T,W=L?.name??M;d(()=>{j.current&&(j.current.indeterminate=v)},[v]),d(()=>{const e=j.current,t=e?.form;if(!e||!t)return;const a=new Set;function handleReset(t){const r=setTimeout(()=>{if(a.delete(r),!e||t.defaultPrevented||j.current!==e)return;const n=V?H.current.checked:Boolean(s);V||A(n),e.checked=n,e.indeterminate=H.current.indeterminate},0);a.add(r)}return t.addEventListener("reset",handleReset),()=>{t.removeEventListener("reset",handleReset),a.forEach(clearTimeout)}},[V,s,q]);const G=v?"indeterminate":$?"checked":"unchecked",U=o(t??L?.size,P.size),X=L&&void 0!==I?L.isOptionDisabled(I,$,p):i(p,P.disabled),Q=Boolean(L&&void 0!==I&&$&&X&&!L.disabled&&!p&&W)?y("input",{type:"hidden",name:W,form:q,value:I}):null,J=n(R),Z=[G,J?"invalid":void 0,X?"disabled":void 0].filter(Boolean).join(" "),_=r("shrink-0","sm"===U?"h-[calc(var(--control-height-sm)*0.35)] w-[calc(var(--control-height-sm)*0.35)]":"lg"===U?"h-[calc(var(--control-height-lg)*0.3)] w-[calc(var(--control-height-lg)*0.3)]":"h-[calc(var(--control-height-md)*0.3)] w-[calc(var(--control-height-md)*0.3)]"),Y=x("span",{className:"relative inline-flex","data-ug-slot":"control",children:[y("input",{ref:e=>{j.current=e,"function"==typeof F?F(e):F&&(F.current=e)},id:O,type:"checkbox",form:q,name:W,value:I,className:"peer sr-only",checked:$,"aria-checked":v?"mixed":$,"aria-invalid":R,disabled:X,onChange:e=>{L&&void 0!==I?L.toggleValue(I,e.target.checked):void 0===a&&A(e.target.checked),e.currentTarget.indeterminate=v,k?.(e),z?.(e.target.checked)},"data-ug-slot":"input",...S}),y("span",{"aria-hidden":"true",className:r(w({size:U,state:G}),J&&"border-danger peer-focus-visible:ring-danger/35",e),"data-ug-slot":"indicator",children:v?y(g,{className:_,"data-ug-slot":"icon"}):$?y(f,{className:_,"data-ug-slot":"icon"}):null})]});return x("label",null==N?{className:r("inline-flex cursor-pointer",X&&"cursor-not-allowed opacity-60"),"data-ug":"checkbox","data-state":Z,"data-variant":"default","data-size":U,htmlFor:O,children:[Y,Q]}:{htmlFor:O,className:r("inline-flex min-h-[var(--control-height-sm)] max-w-full min-w-0 cursor-pointer items-start gap-2.5 text-sm leading-5 text-text-primary select-none",X&&"cursor-not-allowed opacity-60",C),"data-ug":"checkbox","data-state":Z,"data-variant":"default","data-size":U,children:[Y,Q,y("span",{className:"min-w-0 pt-px [overflow-wrap:anywhere]","data-ug-slot":"label",children:N})]})});N.displayName="Checkbox";import{forwardRef as C,useCallback as k,useEffect as z,useId as E,useLayoutEffect as T,useMemo as M,useRef as I,useState as R}from"react";import{createPortal as S}from"react-dom";import{Check as F,ChevronDown as P,LoaderCircle as L,X as j}from"lucide-react";import{encodeSelectValue as D,normalizeSelectKeys as A}from"@ug666/ui-core";import{getNextEnabledSelectIndex as B,isControlComposing as O}from"@ug666/ui-web";import{registerEscapeKeyHandler as K,resolveFloatingPosition as $,resolveFloatingZIndex as V,revealFloatingItem as H,trapTabKey as q}from"@ug666/ui-web/overlay";import{useEffect as W}from"react";import{observeFloatingLayout as G}from"@ug666/ui-web/overlay";function useFloatingLayoutObserver(e,t,a,r){W(()=>{if(e)return G([a.current,r?.current],t)},[e,a,r,t])}import{useCallback as U,useEffect as X,useRef as Q,useState as J}from"react";function usePresence(e){const[t,a]=J(e),[r,n]=J(e?"open":"closed"),o=Q(void 0),i=U(()=>{o.current&&clearTimeout(o.current),o.current=void 0},[]),l=U(()=>{i(),a(!1)},[i]);X(()=>i,[i]),X(()=>{if(i(),e)return a(!0),void n("open");t&&(n("closed"),o.current=setTimeout(l,function readExitDuration(){if("undefined"==typeof document)return 0;const e=getComputedStyle(document.documentElement).getPropertyValue("--motion-duration-exit").trim();return e?e.endsWith("ms")?Number.parseFloat(e)||250:e.endsWith("s")?1e3*(Number.parseFloat(e)||0):250:250}()+50))},[i,l,e,t]);const s=U(e=>{"closed"===r&&e.animationName.endsWith("-out")&&l()},[l,r]);return{present:e||t,state:e?"open":r,handleAnimationEnd:s}}import{useEffect as Z,useState as _}from"react";function usePortalContainer(){const[e,t]=_(!1);return Z(()=>{"undefined"!=typeof document&&t(!0)},[]),e&&"undefined"!=typeof document?document.body:null}import{jsx as Y,jsxs as ee}from"react/jsx-runtime";var te={sm:"min-h-[var(--control-height-sm)] px-[var(--control-padding-x-sm)]",default:"min-h-[var(--control-height-md)] px-[var(--control-padding-x-md)]",lg:"min-h-[var(--control-height-lg)] px-[var(--control-padding-x-lg)]"},ae="undefined"==typeof window?z:T,re=C((t,a)=>{const{className:s,label:d,error:c,helperText:u,options:m,placeholder:f="请选择",id:g,value:v,defaultValue:p,onChange:h,onValueChange:b,onOpenChange:y,onClear:x,disabled:w,size:N,name:C,required:T,multiple:W=!1,multipleLimit:G=0,clearable:U=!1,filterable:X=!1,filterMethod:Q,remote:J=!1,remoteMethod:Z,remoteDebounce:_=300,loading:re=!1,loadingText:ne="加载中",reserveKeyword:oe=!1,allowCreate:ie=!1,defaultFirstOption:le=!1,collapseTags:se=!1,maxCollapseTags:de=1,collapseTagsTooltip:ce=!1,noDataText:ue="暂无选项",noMatchText:me="没有匹配项",teleported:fe=!0,appendTo:ge,"aria-label":ve,"aria-labelledby":pe,"aria-describedby":he,"aria-invalid":be,onBlur:ye,onFocus:xe,...we}=t,Ne=l(),Ce=E(),ke=g??Ce,ze=`${ke}-label`,Ee=`${ke}-listbox`,Te=`${ke}-message`,Me=i(w,Ne.disabled),Ie=o(N,Ne.size),Re=Boolean(c)||n(be),Se=I(null),Fe=I(null),Pe=I(null),Le=I(null),je=usePortalContainer(),De=e(),Ae=I(""),Be=I(null),Oe=I(null),Ke="value"in t,[$e,Ve]=R(p??(W?[]:void 0)),[He,qe]=R(!1),{present:We,state:Ge,handleAnimationEnd:Ue}=usePresence(He),[Xe,Qe]=R(),Je=I(""),Ze=I(!1),[_e,Ye]=R(""),[et,tt]=R(!1),[at,rt]=R([]),[nt,ot]=R({top:0,left:0,width:0,zIndex:70,side:"bottom"}),it=je,lt=M(()=>fe&&"undefined"!=typeof document?"string"==typeof ge?document.querySelector(ge)??it:ge??it:null,[ge,it,fe]),st=Ke?v:$e,dt=I({isControlled:Ke,currentValue:st,defaultValue:p,multiple:W});dt.current={isControlled:Ke,currentValue:st,defaultValue:p,multiple:W};const ct=M(()=>{const e=new Set(m.map(e=>D(e.value)));return[...m,...at.filter(t=>!e.has(D(t.value)))]},[at,m]),ut=M(()=>A(st),[st]),mt=M(()=>new Set(ut),[ut]),ft=M(()=>ct.filter(e=>mt.has(D(e.value))),[ct,mt]),gt=M(()=>{const e=_e.trim().toLocaleLowerCase();return!J&&X&&e?ct.filter(t=>Q?Q(_e,t):t.label.toLocaleLowerCase().includes(e)):ct},[ct,Q,X,_e,J]),vt=M(()=>{const e=_e.trim();if(!ie||!X||!e)return;return ct.some(t=>t.label.toLocaleLowerCase()===e.toLocaleLowerCase()||D(t.value)===D(e))?void 0:{label:e,value:e}},[ie,ct,X,_e]),pt=M(()=>vt?[vt,...gt]:gt,[vt,gt]),ht=M(()=>re?[]:pt.flatMap((e,t)=>e.disabled||W&&G>0&&ut.length>=G&&!mt.has(D(e.value))?[]:[t]),[re,W,G,mt,ut.length,pt]),bt=pt.findIndex(e=>D(e.value)===Xe);function setActiveIndex(e){const t=pt[e];Qe(t?D(t.value):void 0)}const yt=[He?"open":void 0,Me?"disabled":void 0,Re?"invalid":void 0].filter(Boolean).join(" ")||"default";function setMenuOpen(e){Me&&e||He!==e&&(qe(e),y?.(e),e&&(Je.current=_e,setActiveIndex(function getInitialActiveIndex(){return ht.find(e=>mt.has(D(pt[e].value)))??(X&&_e&&!le?-1:ht[0]??-1)}())))}function commitKeys(e,t=ct){const a=t.filter(t=>e.includes(D(t.value))),r=W?a.map(e=>e.value):a[0]?.value;Ke||Ve(r),function syncNativeSelection(e){const t=Fe.current;t&&(Array.from(t.options).forEach(t=>{t.selected=e.includes(t.dataset.ugKey??"")}),h?.({target:t,currentTarget:t}))}(e),b?.(r)}function handleSelect(e){if(Me||re||e.disabled)return;const t=D(e.value),a=!ct.some(e=>D(e.value)===t),r=a?[...ct,e]:ct;if(a&&rt(t=>[...t,e]),W){const e=mt.has(t);if(!e&&G>0&&ut.length>=G)return;return commitKeys(e?ut.filter(e=>e!==t):[...ut,t],r),void(oe||Ye(""))}commitKeys([t],r),setMenuOpen(!1),Pe.current?.focus({preventScroll:!0})}const xt=k(()=>{if(!fe||!Pe.current||!Le.current)return;const e=Pe.current.getBoundingClientRect(),t=Math.min(Math.max(0,e.width),Math.max(0,window.innerWidth-16)),a=Le.current.offsetHeight,r=$(e,{width:t,height:a},{width:window.innerWidth,height:window.innerHeight},{side:"bottom",align:"start",offset:4,collisionPadding:8});ot({top:r.top,left:r.left,width:t,zIndex:V(Pe.current),side:r.side})},[fe]);function handleTriggerKeyDown(e){if(!Me&&!O(e.nativeEvent,Ze.current)){if("ArrowDown"===e.key||"ArrowUp"===e.key){if(e.preventDefault(),!He)return void setMenuOpen(!0);const t="ArrowDown"===e.key?1:-1;return void setActiveIndex(B(ht,bt,t))}if("Home"===e.key||"End"===e.key)return e.preventDefault(),He||setMenuOpen(!0),void setActiveIndex(B(ht,-1,"Home"===e.key?1:-1));if("Enter"===e.key||!X&&" "===e.key){if(e.preventDefault(),!He)return void setMenuOpen(!0);const t=pt[bt];return void(t&&handleSelect(t))}if("Tab"===e.key&&He){setMenuOpen(!1),Pe.current?.focus({preventScroll:!0});const t=Pe.current?.closest('[role="dialog"][aria-modal="true"]');return void(q(e,t??null)&&e.stopPropagation())}if("Escape"===e.key&&He)return e.stopPropagation(),e.preventDefault(),setMenuOpen(!1),void Pe.current?.focus({preventScroll:!0});if("Backspace"===e.key&&W&&""===_e&&ut.length>0)return e.preventDefault(),void commitKeys(ut.slice(0,-1));if(!(X||1!==e.key.length||e.altKey||e.ctrlKey||e.metaKey)){Ae.current+=e.key.toLocaleLowerCase(),Be.current&&clearTimeout(Be.current),Be.current=setTimeout(()=>{Ae.current="",Be.current=null},500);const t=pt.findIndex((e,t)=>ht.includes(t)&&e.label.toLocaleLowerCase().startsWith(Ae.current));t>=0&&(setMenuOpen(!0),setActiveIndex(t))}}}z(()=>{if(!He)return;function handlePointerDown(e){const t=e.target;Se.current?.contains(t)||Le.current?.contains(t)||setMenuOpen(!1)}document.addEventListener("pointerdown",handlePointerDown);const e=K(e=>{O(e,Ze.current)||(e.preventDefault(),setMenuOpen(!1),Pe.current?.focus({preventScroll:!0}))},()=>Le.current);return()=>{document.removeEventListener("pointerdown",handlePointerDown),e()}},[He]),ae(()=>{He&&fe&&lt&&xt()},[He,lt,fe,xt,pt]),useFloatingLayoutObserver(He&&fe&&Boolean(lt),xt,Pe,Le),z(()=>{if(J&&Z&&!et)return Oe.current&&clearTimeout(Oe.current),Oe.current=setTimeout(()=>{Promise.resolve(Z(_e)).catch(()=>{}),Oe.current=null},Math.max(0,_)),()=>{Oe.current&&clearTimeout(Oe.current)}},[_e,et,J,_,Z]),z(()=>{if(!He)return;const e=Je.current!==_e;Je.current=_e,Qe(t=>{const a=pt.findIndex(e=>D(e.value)===t);if(!e&&ht.includes(a))return t;const r=e&&X?le?ht[0]??-1:-1:ht.find(e=>mt.has(D(pt[e].value)))??(X&&_e&&!le?-1:ht[0]??-1),n=pt[r];return n?D(n.value):void 0})},[le,ht,X,He,_e,mt,pt]),z(()=>{Me&&He&&setMenuOpen(!1)},[Me,He]),z(()=>{if(!He||bt<0||"undefined"==typeof document)return;const e=document.getElementById(`${Ee}-option-${bt}`);H(Le.current,e)},[bt,Ee,He,pt]),z(()=>{const e=Fe.current?.form;if(!e)return;const t=new Set;function handleReset(e){const a=setTimeout(()=>{if(t.delete(a),e.defaultPrevented)return;const r=dt.current,n=r.isControlled?r.currentValue:r.defaultValue??(r.multiple?[]:void 0);r.isControlled||(Ve(n),rt([])),qe(!1),Ye("");const o=A(n);if(Fe.current)for(const e of Fe.current.options)e.selected=o.includes(e.dataset.ugKey??"")||!r.multiple&&0===o.length&&""===e.value},0);t.add(a)}return e.addEventListener("reset",handleReset),()=>{e.removeEventListener("reset",handleReset),t.forEach(e=>clearTimeout(e))}},[we.form]),z(()=>()=>{Be.current&&clearTimeout(Be.current),Oe.current&&clearTimeout(Oe.current)},[]),z(()=>{He||We||W&&oe||Ye("")},[We,W,He,oe]);const wt=ft.length>0,Nt=Math.max(1,Math.trunc(de)||1),Ct=W&&se?ft.slice(0,Nt):ft,kt=ft.length-Ct.length,zt=ft.slice(Nt).map(e=>e.label).join("、"),Et=W?Ct.map(e=>e.label).join("、"):ft[0]?.label,Tt=We?Y("div",{ref:Le,id:Ee,role:"listbox","aria-multiselectable":W||void 0,"aria-hidden":"closed"===Ge||void 0,inert:"closed"===Ge||void 0,className:r("z-[70] max-h-[calc(var(--control-height-md)*7)] overflow-auto rounded-[var(--radius-panel)] border border-border-strong bg-[var(--ug-overlay-surface)] p-[calc(var(--content-gap)*0.25)] shadow-lg",fe?"fixed":"absolute left-0 right-0 top-full mt-[calc(var(--content-gap)*0.25)]"),style:fe?{top:nt.top,left:nt.left,width:nt.width,zIndex:nt.zIndex}:void 0,...De,"data-ug":"select","data-ug-slot":"content","data-state":Ge,"data-side":nt.side,"data-variant":W?"multiple":"single","data-size":Ie,onAnimationEnd:Ue,onBlurCapture:e=>{const t=e.relatedTarget;Se.current?.contains(t)||e.currentTarget.contains(t)||setMenuOpen(!1)},children:re?Y("div",{className:"px-[var(--control-padding-x-sm)] py-[var(--content-gap)] text-center text-sm text-text-tertiary","data-ug-slot":"loading",children:ne}):0===pt.length?Y("div",{className:"px-[var(--control-padding-x-sm)] py-[var(--content-gap)] text-center text-sm text-text-tertiary","data-ug-slot":"empty",children:0===ct.length?ue:me}):pt.map((e,t)=>{const a=D(e.value),n=mt.has(a),o=pt[t-1]?.group,i=W&&!n&&G>0&&ut.length>=G;return ee("div",{children:[e.group&&e.group!==o?Y("div",{className:"px-[var(--control-padding-x-sm)] py-[calc(var(--content-gap)*0.375)] text-xs font-medium text-text-tertiary","data-ug-slot":"group",children:e.group}):null,ee("button",{id:`${Ee}-option-${t}`,type:"button",role:"option",tabIndex:-1,disabled:e.disabled||i,"aria-disabled":e.disabled||i||void 0,"aria-selected":n,"data-ug-slot":"item","data-active":bt===t,"data-state":e.disabled||i?"disabled":n?"selected":"default",className:r("flex w-full items-center gap-2 rounded-[var(--radius-control)] px-[var(--control-padding-x-sm)] py-[calc(var(--content-gap)*0.5)] text-left text-sm text-text-primary",n?"bg-primary-soft text-primary-soft-fg":"hover:bg-[var(--ug-overlay-surface-hover)]",bt===t&&!n&&"bg-[var(--ug-overlay-surface-hover)]",(e.disabled||i)&&"cursor-not-allowed opacity-50 hover:bg-transparent"),onClick:()=>handleSelect(e),onPointerEnter:()=>!e.disabled&&!i&&setActiveIndex(t),children:[Y("span",{className:"min-w-0 flex-1 truncate",children:e.label}),n?Y(F,{"aria-hidden":"true",className:"size-4 shrink-0","data-ug-slot":"check"}):null]})]},a)})}):null;return ee("div",{ref:Se,className:"relative flex min-w-0 flex-col gap-1.5","data-ug":"select","data-state":yt,"data-variant":W?"multiple":"single","data-size":Ie,"data-filterable":X,onBlurCapture:e=>{const t=e.relatedTarget;e.currentTarget.contains(t)||Le.current?.contains(t)||setMenuOpen(!1)},children:[d?Y("label",{id:ze,htmlFor:ke,className:"min-w-0 text-sm font-medium text-text-primary [overflow-wrap:anywhere]","data-ug-slot":"label",children:d}):null,ee("select",{ref:function setSelectRef(e){Fe.current=e,"function"==typeof a?a(e):a&&(a.current=e)},id:`${ke}-native`,name:C,value:W?ft.map(e=>String(e.value)):ft[0]?String(ft[0].value):"",multiple:W,required:T,disabled:Me,tabIndex:-1,"aria-hidden":"true",className:"sr-only","data-ug-slot":"native",onChange:e=>h?.(e),...we,children:[W?null:Y("option",{value:"",children:f}),ct.map(e=>Y("option",{"data-ug-key":D(e.value),value:String(e.value),disabled:e.disabled,children:e.label},D(e.value)))]}),ee("div",{className:"relative min-w-0","data-ug-slot":"control","data-has-value":wt,"data-clearable":U&&wt&&!Me&&!re,children:[X?Y("input",{ref:Pe,type:"text",id:ke,disabled:Me,"aria-label":ve,"aria-labelledby":pe??(!ve&&d?ze:void 0),"aria-describedby":he??(c||u?Te:void 0),"aria-invalid":be??(!!c||void 0),role:"combobox","aria-autocomplete":"list","aria-haspopup":"listbox","aria-expanded":He,"aria-controls":Ee,"aria-required":T||void 0,"aria-activedescendant":He&&bt>=0?`${Ee}-option-${bt}`:void 0,value:He?_e:Et??"",placeholder:He&&Et||f,className:r("block w-full min-w-0 text-left",te[Ie],s),onClick:()=>setMenuOpen(!0),onChange:e=>{Ye(e.target.value),setMenuOpen(!0)},onCompositionEnd:e=>{Ze.current=!1,tt(!1),Ye(e.currentTarget.value)},onCompositionStart:()=>{Ze.current=!0,tt(!0)},onBlur:ye,onFocus:xe,onKeyDown:handleTriggerKeyDown,"data-ug-slot":"trigger","data-state":yt,"data-variant":W?"multiple":"single","data-size":Ie}):ee("button",{ref:Pe,type:"button",id:ke,disabled:Me,"aria-label":ve,"aria-labelledby":pe??(!ve&&d?ze:void 0),"aria-describedby":he??(c||u?Te:void 0),"aria-invalid":be??(!!c||void 0),role:"combobox","aria-haspopup":"listbox","aria-expanded":He,"aria-controls":Ee,"aria-required":T||void 0,"aria-activedescendant":He&&bt>=0?`${Ee}-option-${bt}`:void 0,className:r("flex w-full min-w-0 items-center gap-2 py-0 text-left",te[Ie],s),onClick:()=>setMenuOpen(!He),onBlur:ye,onFocus:xe,onKeyDown:handleTriggerKeyDown,"data-ug-slot":"trigger","data-state":yt,"data-variant":W?"multiple":"single","data-size":Ie,children:[Y("span",{className:"min-w-0 flex-1 truncate","data-ug-slot":"value",children:Et||f}),W&&se&&kt>0?ee("span",{className:"shrink-0 text-xs text-text-secondary","data-ug-slot":"count",title:ce?zt:void 0,children:["+",kt]}):null]}),Y("span",{"aria-hidden":"true","data-ug-slot":"indicator",children:re?Y(L,{className:"size-4 animate-spin text-text-tertiary motion-reduce:animate-none","data-ug-slot":"loading"}):Y(P,{className:r("size-4 text-text-tertiary transition-transform duration-[var(--motion-duration-state)] ease-[var(--motion-easing-state)] motion-reduce:transition-none",He&&"rotate-180"),"data-ug-slot":"icon"})}),U&&wt&&!Me&&!re?Y("button",{type:"button","aria-label":"清空选择",className:"absolute right-[var(--control-padding-x-sm)] top-1/2 inline-flex size-6 -translate-y-1/2 items-center justify-center rounded-[var(--radius-control)] text-text-tertiary hover:bg-surface-2 hover:text-text-primary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/30",onClick:function clearSelection(e){e?.stopPropagation(),Me||0===ut.length||(commitKeys([]),x?.(),Ye(""),Pe.current?.focus({preventScroll:!0}))},"data-ug-slot":"clear",children:Y(j,{"aria-hidden":"true",className:"size-3.5"})}):null]}),fe&&lt&&Tt?S(Tt,lt):Tt,c?Y("p",{id:Te,className:"min-w-0 text-xs text-danger [overflow-wrap:anywhere]","data-ug-slot":"message",children:c}):null,!c&&u?Y("p",{id:Te,className:"min-w-0 text-xs text-text-secondary [overflow-wrap:anywhere]","data-ug-slot":"message",children:u}):null]})});re.displayName="Select";import{createContext as ne,forwardRef as oe,useContext as ie,useId as le,useRef as se}from"react";import{createPortal as de}from"react-dom";import{X as ce}from"lucide-react";import{useEffect as ue,useRef as me}from"react";import{acquireBodyScrollLock as fe,registerEscapeKeyHandler as ge}from"@ug666/ui-web/overlay";function useEscapeKey(e,t,a=e,r){const n=me(t);n.current=t,ue(()=>{if(!a||"undefined"==typeof document)return;const e=fe();return()=>{e()}},[a]),ue(()=>{if(e&&"undefined"!=typeof document)return ge(e=>{e.isComposing||n.current()},r?()=>r.current:void 0)},[e,r])}import{createContext as ve,useCallback as pe,useContext as he,useEffect as be,useRef as ye}from"react";import{acquireModalBackgroundIsolation as xe,focusFirstElement as we,observeInitialFocusTarget as Ne,restoreModalFocus as Ce,trapTabKey as ke}from"@ug666/ui-web/overlay";var ze=ve(null);function useOverlayFocus(e,t,a){const r=ye(null),n=he(ze);return be(()=>{if(!e||"undefined"==typeof document)return;r.current=document.activeElement instanceof HTMLElement?document.activeElement:null;const o=t.current;o?.closest('[inert], [aria-hidden="true"]')||we(o,a);const i=xe(o,()=>n?.current??null);o?.closest('[inert], [aria-hidden="true"]')||o?.contains(document.activeElement)||we(o,a);const l=Ne(o,a);return()=>{l(),i(),Ce(r.current),r.current=null}},[t,a,e,n]),pe(e=>{e.defaultPrevented||ke(e,t.current)},[t])}import{jsx as Ee,jsxs as Te}from"react/jsx-runtime";var Me=ne(null);function useModalContext(){const e=ie(Me);if(!e)throw new Error("Modal 子组件必须在 <Modal> 内使用");return e}var Ie=oe(({open:t,onClose:a,children:n,className:o,ariaLabel:i="对话框",size:l="md",width:s,placement:d="center",topOffset:c="6vh",closeOnOverlay:u=!0,closeOnEsc:m=!0,initialFocusSelector:f},g)=>{const{present:v,state:p,handleAnimationEnd:h}=usePresence(t),b=se(null);useEscapeKey(t,()=>{m&&a()},v,b);const y=usePortalContainer(),x=`ug-modal-title-${le().replace(/:/g,"")}`,w=useOverlayFocus(v&&Boolean(y),b,f),N=e();return v&&y?de(Ee(ze.Provider,{value:b,children:Ee(Me.Provider,{value:{onClose:a,titleId:x,size:l,width:s},children:Te("div",{ref:e=>{b.current=e,"function"==typeof g?g(e):g&&(g.current=e)},...N,className:r("fixed inset-0 z-[80] flex justify-center p-[var(--content-gap)]","top"===d?"items-start":"items-center",o),role:"dialog",style:"top"===d?{paddingBlockStart:c}:void 0,"aria-modal":"true","aria-label":i,"aria-labelledby":x,tabIndex:-1,onKeyDown:w,onAnimationEnd:h,"data-ug":"modal","data-state":p,"data-variant":"default","data-size":l,children:[Ee("div",{className:"absolute inset-0 bg-overlay",onClick:u?a:void 0,"aria-hidden":"true","data-ug-slot":"overlay"}),Ee("div",{className:"relative z-10 flex w-full max-w-full justify-center",children:n})]})})}),y):null}),Re=oe(({className:e,maxWidth:t,children:a,style:n,...o},i)=>{const{size:l,width:s}=useModalContext();return Ee("div",{ref:i,...o,style:{maxInlineSize:s,...n},className:r("flex max-h-[85vh] w-full flex-col rounded-[var(--radius-overlay)] border-[length:var(--ug-modal-border-width)] border-border-base bg-[var(--ug-overlay-surface)] p-[var(--ug-modal-padding)] shadow-xl",t,e),"data-ug-slot":"content","data-size":l,children:a})}),Se=oe(({className:e,...t},a)=>Ee("div",{ref:a,...t,className:r("flex shrink-0 items-center justify-between border-b-[length:var(--ug-modal-divider-width)] border-border-base p-[var(--ug-modal-section-padding)] pb-[var(--ug-modal-header-gap)]",e),"data-ug-slot":"header"})),Fe=oe(({className:e,...t},a)=>Ee("div",{ref:a,...t,className:r("min-h-[0] flex-1 overflow-y-auto p-[var(--ug-modal-section-padding)]",e),"data-ug-slot":"body"})),Pe=oe(({className:e,...t},a)=>{const{titleId:n}=useModalContext();return Ee("h2",{ref:a,...t,id:n,className:r("m-0 text-lg font-[var(--ug-modal-title-weight)] leading-[var(--ug-modal-title-line-height)] text-text-primary",e),"data-ug-slot":"title"})}),Le=oe(({className:e,...t},a)=>Ee("div",{ref:a,...t,className:r("flex shrink-0 items-center justify-end gap-2 border-t-[length:var(--ug-modal-divider-width)] border-border-base p-[var(--ug-modal-section-padding)] pt-[var(--ug-modal-footer-gap)]",e),"data-ug-slot":"footer"})),je=oe(({onClick:e,className:t,type:a="button",...n},o)=>{const{onClose:i}=useModalContext();return Ee("button",{ref:o,type:a,onClick:t=>{e?.(t),t.defaultPrevented||i()},className:r("inline-flex h-[var(--control-height-md)] w-[var(--control-height-md)] shrink-0 items-center justify-center rounded-[var(--radius-control)] border-0 bg-transparent text-text-tertiary hover:bg-surface-3 hover:text-text-secondary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/30",t),"aria-label":"关闭","data-ug-slot":"close","data-size":"md",...n,children:Ee(ce,{"aria-hidden":"true",focusable:"false",size:18})})});Ie.displayName="Modal",Re.displayName="ModalContent",Se.displayName="ModalHeader",Fe.displayName="ModalBody",Pe.displayName="ModalTitle",Le.displayName="ModalFooter",je.displayName="ModalCloseButton";import{forwardRef as De}from"react";import{jsx as Ae}from"react/jsx-runtime";var Be={sm:"gap-[calc(var(--content-gap)*0.75)] p-[calc(var(--content-gap)*0.875)]",md:"gap-[var(--content-gap)] p-[calc(var(--content-gap)*1.25)]",lg:"gap-[calc(var(--content-gap)*1.25)] p-[calc(var(--content-gap)*1.5)]"},Oe=De(({className:e,children:t,disabled:a,size:n="md",variant:o="plain",...i},l)=>Ae("fieldset",{ref:l,className:r("m-0 grid min-w-0 border-0 text-text-primary","card"===o&&"border border-border-base bg-surface-1 [border-radius:var(--radius-panel)]","card"===o?Be[n]:"gap-[var(--content-gap)] p-0",a&&"opacity-60",e),disabled:a,"data-ug":"fieldset","data-state":a?"disabled":"default","data-size":n,"data-variant":o,...i,children:t}));Oe.displayName="Fieldset";var Ke=De(({className:e,children:t,...a},n)=>Ae("legend",{ref:n,className:r("max-w-full [padding-inline:0] text-sm font-medium leading-5 text-text-primary [overflow-wrap:anywhere]",e),"data-ug-slot":"legend",...a,children:t}));Ke.displayName="FieldsetLegend";var $e=De(({className:e,children:t,...a},n)=>Ae("p",{ref:n,className:r("m-0 text-xs leading-5 text-text-secondary [overflow-wrap:anywhere]",e),"data-ug-slot":"description",...a,children:t}));$e.displayName="FieldsetDescription";import{forwardRef as Ve,useId as He}from"react";import{jsx as qe,jsxs as We}from"react/jsx-runtime";var Ge={sm:20,md:28,lg:32},Ue=Ve(({icon:e,title:t,description:a,action:n,size:o="md",className:i,role:l="status","aria-label":s,"aria-labelledby":d,"aria-describedby":c,...u},m)=>{const f=He(),g=`${f}-title`,v=`${f}-description`;return We("div",{ref:m,...u,className:r("flex min-w-0 flex-col items-center justify-center text-center",i),role:l,"aria-label":s,"aria-labelledby":d??(s?void 0:g),"aria-describedby":c??(a?v:void 0),"data-ug":"empty-state","data-state":"default","data-variant":"default","data-size":o,children:[e&&qe("div",{className:"flex items-center justify-center bg-surface-2 [border-radius:calc(var(--radius-overlay)*999)]","data-ug-slot":"icon",children:qe(e,{size:Ge[o],className:"text-text-tertiary","aria-hidden":"true"})}),We("div",{className:"flex min-w-0 max-w-full flex-col gap-1","data-ug-slot":"content",children:[qe("p",{id:g,className:"font-semibold text-text-primary [overflow-wrap:anywhere]","data-ug-slot":"title",children:t}),a&&qe("p",{id:v,className:"text-text-secondary [overflow-wrap:anywhere]","data-ug-slot":"description",children:a})]}),n&&qe("div",{className:"mt-1","data-ug-slot":"action",children:n})]})});Ue.displayName="EmptyState";import{forwardRef as Xe}from"react";import{jsx as Qe}from"react/jsx-runtime";var Je=Xe(({className:e,scrollRegionLabel:t="数据表格滚动区域",scrollRegionTabIndex:a=0,size:n="md",bordered:o=!1,striped:i=!1,hoverable:l=!0,...s},d)=>{const c=["default",o?"bordered":void 0,i?"striped":void 0,l?"hoverable":void 0].filter(Boolean).join(" ")||"default";return Qe("div",{className:"w-full overflow-auto",role:"region","aria-label":t,tabIndex:a,"data-ug":"table","data-state":c,"data-variant":o?"bordered":"default","data-size":n,children:Qe("table",{ref:d,className:r("w-full caption-bottom",e),"data-ug-slot":"table",...s})})}),Ze=Xe(({className:e,...t},a)=>Qe("thead",{ref:a,className:e,"data-ug-slot":"header",...t})),_e=Xe(({className:e,...t},a)=>Qe("tbody",{ref:a,className:e,"data-ug-slot":"body",...t})),Ye=Xe(({className:e,...t},a)=>Qe("tr",{ref:a,className:r(e),"data-ug-slot":"row","data-state":"default",...t})),et=Xe(({className:e,...t},a)=>Qe("th",{ref:a,className:r("text-left align-middle font-medium",e),"data-ug-slot":"head",...t})),tt=Xe(({className:e,...t},a)=>Qe("td",{ref:a,className:r("align-middle text-text-primary",e),"data-ug-slot":"cell",...t}));Je.displayName="Table",Ze.displayName="TableHeader",_e.displayName="TableBody",Ye.displayName="TableRow",et.displayName="TableHead",tt.displayName="TableCell";import{createContext as at,forwardRef as rt,useCallback as nt,useContext as ot,useEffect as it,useId as lt,useLayoutEffect as st,useRef as dt,useState as ct}from"react";import{createPortal as ut}from"react-dom";import{bindOwnedDescriptionToken as mt,resolveFloatingPosition as ft,resolveFloatingZIndex as gt}from"@ug666/ui-web/overlay";import{SIDEBAR_OVERLAY_OFFSET as vt}from"@ug666/ui-web/sidebar";import{jsx as pt,jsxs as ht}from"react/jsx-runtime";var bt=at(null),yt="undefined"==typeof window?it:st;function assignRef(e,t){"function"!=typeof e?e&&(e.current=t):e(t)}function useTooltipContext(){const e=ot(bt);if(!e)throw new Error("Tooltip 子组件必须在 <Tooltip> 内使用");return e}var xt=rt(({children:e,delayDuration:t=200,className:a},n)=>{const[o,i]=ct(!1),l=dt(null),s=dt(null),d=`ug-tooltip-${lt().replace(/:/g,"")}`,c=Number.isFinite(t)?Math.max(0,Math.round(t)):200;return it(()=>()=>{s.current&&clearTimeout(s.current)},[]),pt(bt.Provider,{value:{open:o,setOpen:i,triggerRef:l,delayRef:s,delayDuration:c,contentId:d},children:pt("span",{ref:n,className:r("relative inline-flex",a),"data-ug":"tooltip","data-state":o?"open":"default","data-variant":"default","data-size":"md",children:e})})}),wt=rt(({children:e,className:t},a)=>{const{open:n,setOpen:o,triggerRef:i,delayRef:l,delayDuration:s,contentId:d}=useTooltipContext(),c=nt(e=>{i.current=e,assignRef(a,e)},[a,i]);return it(()=>{if(n)return mt(i.current,d)},[d,n,i]),pt("span",{ref:c,className:r("inline-flex",t),onMouseEnter:function handleMouseEnter(){l.current&&clearTimeout(l.current),0!==s?l.current=setTimeout(()=>o(!0),s):o(!0)},onMouseLeave:function handleMouseLeave(){l.current&&clearTimeout(l.current),i.current?.contains(document.activeElement)||o(!1)},onFocus:()=>o(!0),onBlur:e=>{e.currentTarget.contains(e.relatedTarget)||o(!1)},onKeyDown:e=>{"Escape"===e.key&&n&&(e.preventDefault(),o(!1))},"data-ug-slot":"trigger","data-state":n?"open":"default",children:e})}),Nt={top:"after:absolute after:top-full after:left-1/2 after:-translate-x-1/2 after:border-4 after:border-transparent after:border-t-text-primary",bottom:"after:absolute after:bottom-full after:left-1/2 after:-translate-x-1/2 after:border-4 after:border-transparent after:border-b-text-primary",left:"after:absolute after:left-full after:top-1/2 after:-translate-y-1/2 after:border-4 after:border-transparent after:border-l-text-primary",right:"after:absolute after:right-full after:top-1/2 after:-translate-y-1/2 after:border-4 after:border-transparent after:border-r-text-primary"},Ct=rt(({children:t,side:a="top",className:n,style:o,...i},l)=>{const{open:s,triggerRef:d,contentId:c}=useTooltipContext(),u="sidebar"===i["data-ug-context"],m=dt(null),f=usePortalContainer(),g=e(),{present:v,state:p,handleAnimationEnd:h}=usePresence(s),[b,y]=ct({top:0,left:0,side:a,zIndex:50}),x=nt(e=>{m.current=e,assignRef(l,e)},[l]),w=nt(()=>{if(!d.current||!m.current)return;const e=d.current.getBoundingClientRect(),t=ft(e,{width:m.current.offsetWidth,height:m.current.offsetHeight},{width:window.innerWidth,height:window.innerHeight},{side:a,align:"center",offset:u?vt:8});y({...t,zIndex:gt(d.current,50)})},[u,a,d]);return yt(()=>{s&&w()},[s,w]),useFloatingLayoutObserver(s,w,d,m),v&&f?ut(ht("div",{ref:x,id:c,role:"tooltip",...g,...i,style:{...o,top:b.top,left:b.left,zIndex:o?.zIndex??b.zIndex},className:r("fixed z-50 max-w-[min(20rem,calc(100vw-1rem))] [overflow-wrap:anywhere]",u?null:"rounded-[var(--radius-control)] bg-text-primary px-[var(--control-padding-x-sm)] py-[calc(var(--content-gap)*0.375)] text-xs text-surface-1 shadow-md",!u&&Nt[b.side],n),"aria-hidden":"closed"===p||void 0,inert:"closed"===p||void 0,"data-ug":"tooltip","data-ug-slot":"content","data-state":p,"data-side":b.side,"data-variant":"default","data-size":"md",onAnimationEnd:h,children:[u?pt("span",{"aria-hidden":"true","data-ug-slot":"arrow"}):null,t]}),f):null});xt.displayName="Tooltip",wt.displayName="TooltipTrigger",Ct.displayName="TooltipContent";import{forwardRef as kt,useCallback as zt,useEffect as Et,useId as Tt,useLayoutEffect as Mt,useMemo as It,useRef as Rt,useState as St}from"react";import{createPortal as Ft}from"react-dom";import{focusFirstElement as Pt,resolveFloatingPosition as Lt,trapTabKey as jt}from"@ug666/ui-web/overlay";import{clampSidebarWidth as Dt,createSidebarTreeMeta as At,filterSidebarItems as Bt,focusSidebarMenuBoundary as Ot,getSidebarNavigationStyle as Kt,getSidebarUtilityRegionClass as $t,moveSidebarMenuFocus as Vt,normalizeSidebarRange as Ht,normalizeSidebarSearch as qt,resolveSidebarStyles as Wt,SIDEBAR_OVERLAY_OFFSET as Gt}from"@ug666/ui-web/sidebar";import{ChevronLeft as Ut,ChevronRight as Xt,PanelLeftClose as Qt,PanelLeftOpen as Jt,Search as Zt,X as _t}from"lucide-react";import{useState as Yt}from"react";import{ChevronDown as ea,ChevronRight as ta}from"lucide-react";import{getSidebarItemKey as aa,syncSidebarOverflowTitle as ra}from"@ug666/ui-web/sidebar";import{Fragment as na,jsx as oa,jsxs as ia}from"react/jsx-runtime";function SidebarNavList({items:e,depth:t=0,parentKey:a="root",listId:n,renderChildren:o=!0,...i}){const[l,s]=Yt(o);return o&&!l&&s(!0),oa("ul",{id:n,"data-depth":t,"data-ug-slot":"list",children:(l||o)&&e.map((e,n)=>{const o=aa(e,n,a),l=Boolean(e.children?.length),s=`${i.instanceId}-list-${encodeURIComponent(o)}`,d=Boolean(e.active),c=i.activeBranches.has(e),u=l&&(i.normalizedQuery.length>0||(i.expandedOverrides.get(o)??(d||c))),m=!i.collapsed&&u,f=i.collapsed?i.collapsedFlyoutKey===o:u,g=ia(na,{children:[oa("span",{className:r("flex shrink-0 items-center justify-center [height:var(--control-height-sm)] [width:var(--control-height-sm)] [border-radius:var(--radius-control)]",i.styles.icon),"data-ug-slot":"icon",children:oa(e.icon,{"aria-hidden":"true",size:16})}),oa("span",{"aria-hidden":i.collapsed,className:"min-w-0 flex-1 truncate text-left","data-state":i.collapsed?"hidden":"visible","data-ug-slot":"label",children:e.label}),void 0!==e.badge?oa("span",{"aria-hidden":i.collapsed,className:r("shrink-0 rounded-full px-[calc(var(--control-padding-x-sm)*0.75)] py-0.5 text-xs font-semibold leading-none",i.styles.badge),"data-state":i.collapsed?"hidden":"visible","data-ug-slot":"badge",children:e.badge}):null]}),v=l?i.collapsed?oa(ta,{"aria-hidden":"true",className:r("shrink-0",i.styles.chevron),"data-state":f?"open":"closed","data-ug-slot":"collapsed-chevron",size:11}):oa(ea,{"aria-hidden":"true",className:r("shrink-0 transition-transform duration-[var(--motion-duration-state)] ease-[var(--motion-easing-state)] motion-reduce:transition-none",i.styles.chevron,u&&"rotate-180"),"data-state":"visible","data-ug-slot":"chevron",size:15}):null,p=r("group relative flex w-full min-w-0 items-center gap-[calc(var(--control-padding-x-sm)*0.5)] overflow-hidden px-[var(--control-padding-x-sm)] text-sm font-normal no-underline outline-none [border-radius:var(--radius-control)] focus-visible:ring-2",i.styles.focusRing,"compact"===i.density?"min-h-[var(--control-height-sm)] py-0":"min-h-[var(--control-height-md)] py-[calc(var(--control-height-sm)*0.125)]",d?r(i.styles.active,"indicator"===i.activeStyle?i.styles.activeIndicator:i.styles.activeHighlight):c?i.styles.branchActive:i.styles.inactive),h=oa("a",{"aria-current":e.active?"page":void 0,"aria-label":i.collapsed?e.label:void 0,className:p,href:e.href??"#",onClick:i.onNavigate,onFocus:t=>ra(t.currentTarget,e.label,i.collapsed),onMouseEnter:t=>ra(t.currentTarget,e.label,i.collapsed),children:g});return ia("li",{"data-depth":t,"data-state":d?"active":c?"contains-active":"default","data-ug-slot":"item",children:[l?ia("button",{"aria-controls":i.collapsed?`${i.instanceId}-flyout`:s,"aria-expanded":f,"aria-haspopup":i.collapsed?"menu":void 0,"aria-label":`${f?"收起":"展开"}${e.label}${i.collapsed||void 0===e.badge?"":` ${e.badge}`}菜单`,className:r("m-0 w-full cursor-pointer appearance-none border-0 bg-transparent p-0 text-left",p),onClick:t=>{if(i.collapsed)return i.onOpenCollapsedFlyout(e,o,t.currentTarget),void(0===t.detail&&i.onFocusFlyoutItem("first"));i.onToggle(o,u)},onFocus:t=>{ra(t.currentTarget,e.label,i.collapsed),i.onOpenCollapsedFlyout(e,o,t.currentTarget)},onKeyDown:t=>{if("Escape"===t.key&&i.collapsedFlyoutKey)return t.preventDefault(),t.stopPropagation(),void i.onCloseFlyout();!i.collapsed||"ArrowRight"!==t.key&&"ArrowDown"!==t.key||(t.preventDefault(),i.onOpenCollapsedFlyout(e,o,t.currentTarget),i.onFocusFlyoutItem("first"))},onMouseEnter:t=>{ra(t.currentTarget,e.label,i.collapsed),i.onOpenCollapsedFlyout(e,o,t.currentTarget,"hover")},onMouseLeave:i.onScheduleFlyoutClose,type:"button",children:[g,v]}):i.collapsed?ia(xt,{className:"flex",delayDuration:0,children:[oa(wt,{className:"flex",children:h}),oa(Ct,{"data-custom-colors":i.customColors?"true":"false","data-navigation-variant":i.variant,"data-ug-context":"sidebar",side:"right",style:i.navigationColorStyle,children:e.label})]}):h,l&&e.children?oa("div",{"aria-hidden":!m,"data-state":m?"open":"closed","data-ug-slot":"submenu",inert:!m||void 0,children:oa("div",{"data-ug-slot":"submenu-clip",children:oa(SidebarNavList,{...i,depth:t+1,items:e.children,listId:s,parentKey:o,renderChildren:m})})}):null]},o)})})}function SidebarCollapsedFlyoutItems({items:e,parentKey:t,depth:a=0,groupLabel:n,...o}){return oa("ul",{"aria-label":n,"data-depth":a,"data-ug-slot":0===a?"flyout-list":"flyout-group",role:0===a?"none":"group",children:e.map((e,n)=>{const i=aa(e,n,t),l=Boolean(e.children?.length),s=Boolean(e.active),d=o.activeBranches.has(e),c=ia(na,{children:[oa("span",{className:r("flex shrink-0 items-center justify-center [height:var(--control-height-sm)] [width:var(--control-height-sm)] [border-radius:var(--radius-control)]",o.styles.icon),"data-ug-slot":"icon",children:oa(e.icon,{"aria-hidden":"true",size:16})}),oa("span",{className:"min-w-0 flex-1 truncate",children:e.label}),void 0!==e.badge?oa("span",{className:r("shrink-0 rounded-full px-[calc(var(--control-padding-x-sm)*0.75)] py-0.5 text-xs font-semibold leading-none",o.styles.badge),children:e.badge}):null]});return l&&e.children?ia("li",{role:"none",children:[oa("div",{"data-depth":a,"data-state":d?"contains-active":"default","data-ug-slot":"flyout-group-label",role:"presentation",children:c}),oa(SidebarCollapsedFlyoutItems,{...o,depth:a+1,groupLabel:e.label,items:e.children,parentKey:i})]},i):oa("li",{role:"none",children:oa("a",{"aria-current":s?"page":void 0,className:r("focus-visible:ring-2",o.styles.focusRing,s?r(o.styles.active,"indicator"===o.activeStyle?o.styles.activeIndicator:o.styles.activeHighlight):o.styles.inactive),"data-depth":a,"data-state":s?"active":"default","data-ug-slot":"flyout-item",href:e.href??"#",onClick:o.onNavigate,role:"menuitem",children:c})},i)})})}import{Fragment as la,jsx as sa,jsxs as da}from"react/jsx-runtime";var ca="undefined"==typeof window?Et:Mt,ua=kt(({items:a,variant:n="primary",activeStyle:o="highlight",density:i="comfortable",colors:l,collapsed:s,defaultCollapsed:d=!1,onCollapsedChange:c,collapsible:u=!1,bottomCollapsible:m=!1,resizable:f=!1,width:g,defaultWidth:v=256,minWidth:p=208,maxWidth:h=480,onWidthChange:b,searchable:y=!1,searchPlaceholder:x="搜索菜单...",responsive:w=!1,mobileOpen:N=!1,onMobileOpenChange:C,header:k,headerAlign:z="start",headerDivider:E=!0,collapsedHeader:T,contextSwitcher:M,contextSwitcherVisible:I=!1,contextSwitcherDividers:R=!1,contextSwitcherPlacement:S="after-search",scrollActiveItemIntoView:F=!0,footer:P,searchDividers:L=!0,className:j,style:D,...A},B)=>{const O=Wt(n,Boolean(l)),K=`ug-sidebar-${Tt().replace(/:/g,"")}`,$=`${K}-search`,[V,H]=St(d),[q,W]=St(()=>new Map),[G,U]=St(""),X=It(()=>Ht(p,h),[h,p]),[Q,J]=St(()=>Dt(v,X.min,X.max)),[Z,_]=St(!1),Y=Rt(null),ee=Rt(null),te=Rt(null),ae=Rt(null),re=Rt(null),ne=Rt(!1),oe=Rt(!1),ie=Rt(null),le=Rt(null),se=Rt(null),de=Rt(null),[ce,ue]=St(null),[me,fe]=St({top:0,left:0,side:"right",arrowOffset:0}),ge=usePortalContainer(),ve=e(),pe=s??V,he=w&&N,be=pe&&!he,ye=t("(max-width: 767px)"),xe=w&&ye&&!N,we=Dt(g??Q,X.min,X.max),Ne=qt(G),Ce=It(()=>Bt(a,Ne),[a,Ne]),ke=It(()=>At(a),[a]),ze=It(()=>Ce===a?ke:At(Ce),[a,ke,Ce]),Ee=It(()=>l?Kt(l):void 0,[l]);function cancelFlyoutClose(){se.current&&(clearTimeout(se.current),se.current=null)}function scheduleFlyoutClose(){cancelFlyoutClose(),se.current=setTimeout(()=>ue(null),80)}ca(()=>{0!==ke.activeBranchKeys.length&&W(e=>{let t=e;return ke.activeBranchKeys.forEach(a=>{t.has(a)||(t===e&&(t=new Map(e)),t.set(a,!0))}),t})},[ke.activeBranchSignal]),Et(()=>{if(!F||be||Ne)return;const e=window.requestAnimationFrame(()=>{const e=le.current,t=e?.querySelector('[aria-current="page"]');if(!e||!t||0===e.clientHeight)return;const a=e.getBoundingClientRect(),r=t.getBoundingClientRect();(r.top<a.top+24||r.bottom>a.bottom-24)&&(e.scrollTop+=r.top-a.top-e.clientHeight/2+r.height/2)});return()=>window.cancelAnimationFrame(e)},[Ne,be,F,ze.activeItemSignal]);const Te=zt(()=>{if(!ae.current||!re.current)return;const e=ae.current.getBoundingClientRect(),t=Lt(e,{width:re.current.offsetWidth,height:re.current.offsetHeight},{width:window.innerWidth,height:window.innerHeight},{side:"right",align:"start",offset:Gt});fe({...t,arrowOffset:e.top+e.height/2-t.top})},[]),Me=zt(()=>{null===de.current&&(de.current=window.requestAnimationFrame(()=>{de.current=null,Te()}))},[Te]);function setCollapsedState(e){H(e),c?.(e)}ca(()=>{ce&&Te()},[ce,Te]),useFloatingLayoutObserver(Boolean(ce),Me,ae,re),Et(()=>{be?U(""):ue(null)},[be]),Et(()=>{if(ce&&"undefined"!=typeof document)return document.addEventListener("pointerdown",handleDocumentPointerDown,!0),()=>{document.removeEventListener("pointerdown",handleDocumentPointerDown,!0)};function handleDocumentPointerDown(e){const t=e.target;t instanceof Node&&(ie.current?.contains(t)||re.current?.contains(t)||function closeFlyout(){se.current&&(clearTimeout(se.current),se.current=null),ue(null)}())}},[ce]),Et(()=>{if("undefined"==typeof document)return;function handleResize(){ne.current=!0,se.current&&(clearTimeout(se.current),se.current=null),ue(null)}const releaseHoverSuppression=()=>{ne.current=!1};return window.addEventListener("resize",handleResize),document.addEventListener("pointermove",releaseHoverSuppression,!0),document.addEventListener("pointerdown",releaseHoverSuppression,!0),()=>{window.removeEventListener("resize",handleResize),document.removeEventListener("pointermove",releaseHoverSuppression,!0),document.removeEventListener("pointerdown",releaseHoverSuppression,!0)}},[]),useEscapeKey(he,closeMobile),Et(()=>{if(!he||"undefined"==typeof document)return;const e=document.activeElement instanceof HTMLElement?document.activeElement:null,t=window.requestAnimationFrame(()=>Pt(ie.current));return()=>{window.cancelAnimationFrame(t),e?.isConnected&&e.focus({preventScroll:!0})}},[he]),Et(()=>()=>{se.current&&clearTimeout(se.current),null!==de.current&&window.cancelAnimationFrame(de.current)},[]);const Ie=zt(e=>{const t=Dt(e,X.min,X.max);void 0===g&&J(t),b?.(t)},[b,g,X.max,X.min]);function closeMobile(){C?.(!1)}function closeFlyoutAndRestoreFocus(){ue(null),oe.current=!0,ae.current?.focus({preventScroll:!0}),oe.current=!1}Et(()=>{if(!Z||!ge)return;const e=ge.style.cursor,t=ge.style.userSelect;function handlePointerMove(e){const t=Y.current;t&&(te.current=t.width+e.clientX-t.x,null===ee.current&&(ee.current=window.requestAnimationFrame(()=>{ee.current=null;const e=te.current;te.current=null,null!==e&&Ie(e)})))}function stopResizing(){null!==ee.current&&window.cancelAnimationFrame(ee.current),ee.current=null;const e=te.current;te.current=null,null!==e&&Ie(e),Y.current=null,_(!1)}return ge.style.cursor="col-resize",ge.style.userSelect="none",window.addEventListener("pointermove",handlePointerMove),window.addEventListener("pointerup",stopResizing),window.addEventListener("pointercancel",stopResizing),()=>{window.removeEventListener("pointermove",handlePointerMove),window.removeEventListener("pointerup",stopResizing),window.removeEventListener("pointercancel",stopResizing),null!==ee.current&&window.cancelAnimationFrame(ee.current),ee.current=null,te.current=null,ge.style.cursor=e,ge.style.userSelect=t}},[Z,ge,Ie]);const Re=I&&Boolean(M),Se=y&&Re,utilityRegionClassName=e=>$t(e,Se,S),Fe=Re?sa("div",{"aria-hidden":be,className:r("shrink-0",utilityRegionClassName("context-switcher"),R&&"border-y",O.divider),"data-dividers":R?"visible":"hidden","data-state":be?"closed":"open","data-ug-slot":"context-switcher",inert:!!be||void 0,children:M},"context-switcher"):null,Pe=y?da("div",{"aria-hidden":be,className:r(utilityRegionClassName("search"),L&&"border-y",O.divider),"data-dividers":L?"visible":"hidden","data-state":be?"closed":"open","data-ug-slot":"search",inert:!!be||void 0,children:[sa("label",{className:"sr-only",htmlFor:$,children:"搜索菜单"}),da("div",{className:"relative",children:[sa(Zt,{className:r("pointer-events-none absolute left-3 top-1/2 -translate-y-1/2 [height:calc(var(--control-height-sm)*0.5)] [width:calc(var(--control-height-sm)*0.5)]",O.searchIcon),"aria-hidden":"true"}),sa("input",{id:$,value:G,onChange:e=>U(e.target.value),placeholder:x,autoComplete:"off",className:r("w-full border px-[var(--control-padding-x-sm)] pl-9 pr-9 text-sm outline-none [height:var(--control-height-md)] [border-radius:var(--radius-control)] focus:ring-2",O.searchInput),type:"text",role:"searchbox"}),G?sa("button",{type:"button",className:r("absolute right-1 top-1/2 flex -translate-y-1/2 items-center justify-center [height:var(--control-height-sm)] [width:var(--control-height-sm)] [border-radius:var(--radius-control)]",O.clear),"aria-label":"清空搜索","data-ug-slot":"clear",onClick:()=>U(""),children:sa(_t,{size:14})}):null]})]},"search"):null,Le="before-search"===S?[Fe,Pe]:[Pe,Fe];const je=da("aside",{ref:e=>{ie.current=e,"function"==typeof B?B(e):B&&(B.current=e)},...A,"aria-hidden":!!xe||void 0,"aria-label":A["aria-label"]??"主导航","aria-modal":!!he||void 0,className:r("relative flex flex-col overflow-hidden",O.container,w&&["fixed inset-y-0 left-0 z-50 md:relative md:inset-auto md:z-auto",N?"translate-x-0":"-translate-x-full md:translate-x-0"],j),"data-ug":"sidebar","data-state":[be?"collapsed":"expanded",w&&N?"mobile-open":null].filter(Boolean).join(" "),"data-variant":n,"data-active-style":o,"data-density":i,"data-size":"md","data-resizable":f?"true":"false","data-resizing":Z?"true":"false",inert:!!xe||void 0,onKeyDown:function handleSidebarKeyDown(e){he&&jt(e,ie.current),A.onKeyDown?.(e)},role:he?"dialog":A.role,style:{...D,...Ee,width:be?72:we},tabIndex:he?-1:A.tabIndex,children:[(k||T||u||w&&N)&&da("div",{className:r("relative flex min-h-[var(--ug-sidebar-header-height)] items-center gap-2 px-[var(--control-padding-x-sm)]",E&&"border-b",O.divider),"data-align":z,"data-divider":E?"visible":"hidden","data-ug-slot":"header",children:[k?sa("div",{"aria-hidden":be,className:r("flex min-w-0 flex-1","center"===z?"justify-center":"justify-start"),"data-state":be?"hidden":"visible","data-ug-slot":"header-content",inert:!!be||void 0,children:k}):null,T&&!u?sa("div",{"aria-hidden":!be,className:"flex min-w-0 items-center justify-center","data-state":be?"visible":"hidden","data-ug-slot":"collapsed-header",inert:!be||void 0,children:T}):null,be||k?null:sa("div",{className:"flex-1"}),u&&sa("button",{type:"button",className:r("shrink-0 items-center justify-center border [height:var(--control-height-md)] [width:var(--control-height-md)] [border-radius:var(--radius-control)]",w?"hidden md:flex":"flex",O.control),"aria-label":pe?"展开侧边栏":"折叠侧边栏","data-ug-slot":"toggle",onClick:()=>setCollapsedState(!pe),children:sa(pe?Jt:Qt,{size:17})}),w&&sa("button",{type:"button",className:r("flex shrink-0 items-center justify-center border [height:var(--control-height-md)] [width:var(--control-height-md)] [border-radius:var(--radius-control)] md:hidden",O.control),"aria-label":"关闭侧边栏","data-ug-slot":"close",onClick:closeMobile,children:sa(_t,{size:17})})]}),Le,sa("nav",{ref:le,className:r("flex-1 overflow-x-hidden overflow-y-auto overscroll-contain","compact"===i?!y&&!Re||be?"pb-3 pt-2":"pb-3 pt-0.5":!y&&!Re||be?"pb-5 pt-3":"pb-5 pt-0.5"),"data-ug-slot":"nav",children:Ce.length>0?sa(SidebarNavList,{activeBranches:ze.activeBranches,activeStyle:o,collapsed:be,collapsedFlyoutKey:ce?.key,customColors:Boolean(l),density:i,expandedOverrides:q,instanceId:K,items:Ce,navigationColorStyle:Ee,normalizedQuery:Ne,onCloseFlyout:closeFlyoutAndRestoreFocus,onFocusFlyoutItem:function focusFlyoutItem(e="first"){window.requestAnimationFrame(()=>{Ot(re.current,e)})},onNavigate:closeMobile,onOpenCollapsedFlyout:function openCollapsedFlyout(e,t,a,r="interaction"){be&&("hover"===r&&ne.current||oe.current||(cancelFlyoutClose(),ae.current=a,ue(a=>a?.key===t?a:{item:e,key:t})))},onScheduleFlyoutClose:scheduleFlyoutClose,onToggle:function toggleExpanded(e,t){W(a=>{const r=new Map(a);return r.set(e,!t),r})},styles:O,variant:n}):sa("p",{className:r("mx-3 border border-dashed px-[var(--control-padding-x-sm)] py-[calc(var(--content-gap)*0.75)] text-sm [border-radius:var(--radius-panel)]",O.empty),"data-ug-slot":"empty",children:"没有匹配的菜单"})}),P&&sa("div",{className:r("border-t px-[calc(var(--control-padding-x-sm)*0.8)] py-[calc(var(--content-gap)*0.75)]",O.divider,be&&"flex justify-center"),"data-ug-slot":"footer",children:P}),m?sa("div",{className:r("shrink-0 border-t p-2",w?"hidden md:block":"block",O.divider),"data-ug-slot":"bottom-toggle",children:sa("button",{type:"button",className:r("flex w-full items-center justify-center border-0 bg-transparent [height:var(--control-height-md)] [border-radius:var(--radius-control)]",O.inactive),"aria-label":pe?"展开侧边栏":"折叠侧边栏","data-ug-slot":"toggle",onClick:()=>setCollapsedState(!pe),children:sa(pe?Xt:Ut,{"aria-hidden":"true",size:17})})}):null,f&&!be?sa("div",{"aria-label":"调整侧边栏宽度","aria-orientation":"vertical","aria-valuemax":X.max,"aria-valuemin":X.min,"aria-valuenow":we,className:"group absolute inset-y-0 right-0 z-20 hidden w-2 cursor-col-resize touch-none outline-none md:block","data-ug-slot":"resize-handle",onDoubleClick:()=>Ie(v),onKeyDown:function handleResizeKeyDown(e){const t=e.shiftKey?16:8;let a;"ArrowLeft"===e.key&&(a=we-t),"ArrowRight"===e.key&&(a=we+t),"Home"===e.key&&(a=X.min),"End"===e.key&&(a=X.max),void 0!==a&&(e.preventDefault(),Ie(a))},onPointerDown:e=>{0===e.button&&(e.preventDefault(),Y.current={x:e.clientX,width:we},_(!0))},role:"separator",tabIndex:0,children:sa("span",{"aria-hidden":"true",className:r("absolute inset-y-0 right-0 w-px group-hover:w-0.5 group-focus-visible:w-0.5",O.resizeHandle)})}):null]});return da(la,{children:[w&&N?sa("button",{type:"button",className:"fixed inset-0 z-40 bg-overlay md:hidden","aria-label":"关闭侧边栏遮罩","data-ug-slot":"overlay",onClick:closeMobile,tabIndex:-1}):null,je,be&&ce&&ge?Ft(da("div",{...ve,"aria-label":`${ce.item.label}菜单`,"data-active-style":o,"data-custom-colors":l?"true":"false","data-density":i,"data-side":me.side,"data-state":"open","data-ug":"sidebar-flyout","data-ug-slot":"content","data-variant":n,id:`${K}-flyout`,onBlur:e=>{const t=e.relatedTarget;t instanceof Node&&(e.currentTarget.contains(t)||ae.current?.contains(t))||ue(null)},onKeyDown:function handleFlyoutKeyDown(e){if("Escape"===e.key||"ArrowLeft"===e.key)return e.preventDefault(),e.stopPropagation(),void closeFlyoutAndRestoreFocus();Vt(e.currentTarget,e.key)&&e.preventDefault()},onMouseEnter:cancelFlyoutClose,onMouseLeave:scheduleFlyoutClose,ref:re,role:"menu",style:{...Ee,"--ug-sidebar-flyout-arrow-offset":`${me.arrowOffset}px`,top:me.top,left:me.left},children:[sa("span",{"aria-hidden":"true","data-ug-slot":"arrow"}),da("div",{"data-ug-slot":"panel",children:[da("div",{"data-ug-slot":"title",children:[sa("span",{"data-ug-slot":"title-icon",children:sa(ce.item.icon,{"aria-hidden":"true",size:16})}),sa("span",{"data-ug-slot":"title-label",children:ce.item.label})]}),sa(SidebarCollapsedFlyoutItems,{activeBranches:ze.activeBranches,activeStyle:o,items:ce.item.children??[],onNavigate:()=>{ue(null),closeMobile()},parentKey:ce.key,styles:O})]})]}),ge):null]})});ua.displayName="Sidebar";import{forwardRef as ma,useEffect as fa,useRef as ga,useState as va}from"react";import{ChevronLeft as pa,ChevronRight as ha}from"lucide-react";import{jsx as ba,jsxs as ya}from"react/jsx-runtime";var integer=(e,t)=>"number"==typeof e&&Number.isFinite(e)?Math.floor(e):t;function pageNumbers(e,t){return t<=5?Array.from({length:t},(e,t)=>t+1):e<=3?[1,2,3,"...",t]:e>=t-2?[1,"...",t-2,t-1,t]:[1,"...",e,"...",t]}var xa=ma(function Pagination2({page:e,totalPages:t,total:r,pageSize:n,defaultPageSize:o=10,pageSizeOptions:s,onPageChange:d,onPageSizeChange:c,showTotal:u=!1,showJumper:m=!1,hideOnSingle:f=!1,disabled:g,size:v,className:p,...h},b){const y=l(),x=i(g,y.disabled),w=v??("small"===y.size?"sm":"large"===y.size?"lg":"md"),N="md"===w?"default":w,[C,k]=va(Math.max(1,integer(o,10))),z=Math.max(1,integer(n??C,10)),E=Math.max(0,integer(r,0)),T=void 0!==t?Math.max(0,integer(t,0)):Math.ceil(E/z),M=0===T?0:Math.min(T,Math.max(1,integer(e,1))),[I,R]=va(String(M||1)),S=ga(void 0);fa(()=>{R(String(M||1)),S.current=void 0},[M]);const F=[...new Set([...s??[],z].filter(Number.isFinite).map(Math.floor).filter(e=>e>0))];function changePage(e){if(x||0===T)return;const t=Math.min(T,Math.max(1,integer(e,M)));t!==M&&d(t)}function jump(){const e=Number(I),t=Number.isFinite(e)&&I.trim()?Math.min(T,Math.max(1,Math.floor(e))):M;R(String(t||1)),t!==S.current&&(S.current=t,changePage(t))}return f&&T<=1?null:ya("nav",{...h,ref:b,"aria-label":h["aria-label"]??"分页导航",className:p,"data-ug":"pagination","data-state":x?"disabled":"default","data-variant":"default","data-size":w,"data-layout":u||s||m?"full":"simple",children:[u&&ya("span",{"data-ug-slot":"total",children:["共 ",E," 条"]}),s&&ba("span",{"data-ug-slot":"sizes",children:ba(re,{"aria-label":"每页条数",size:N,disabled:x,value:z,options:F.map(e=>({value:e,label:`每页 ${e} 条`})),onValueChange:e=>"number"==typeof e&&function changeSize(e){x||e===z||!Number.isFinite(e)||e<=0||(void 0===n&&k(Math.floor(e)),c?.(Math.floor(e)),1!==M&&d(1),R("1"))}(e)})}),ya("span",{"data-ug-slot":"pages",children:[ba("button",{type:"button",disabled:x||M<=1,onClick:()=>changePage(M-1),"aria-label":"上一页","data-ug-slot":"prev","data-state":x||M<=1?"disabled":"default",children:ba(pa,{size:16,"aria-hidden":"true"})}),pageNumbers(M,T).map((e,t)=>"..."===e?ba("span",{"data-ug-slot":"ellipsis",children:"…"},`ellipsis-${t}`):ba("button",{type:"button",disabled:x,onClick:()=>changePage(e),"aria-label":`第 ${e} 页`,"aria-current":e===M?"page":void 0,"data-ug-slot":"item","data-state":x?"disabled":e===M?"active":"default",children:e},e)),ba("button",{type:"button",disabled:x||0===T||M>=T,onClick:()=>changePage(M+1),"aria-label":"下一页","data-ug-slot":"next","data-state":x||0===T||M>=T?"disabled":"default",children:ba(ha,{size:16,"aria-hidden":"true"})})]}),m&&ya("label",{"data-ug-slot":"jumper",children:["前往",ba(a,{"aria-label":"跳转页码",type:"number",min:1,max:T||1,step:1,size:N,disabled:x||0===T,value:I,onChange:e=>{S.current=void 0,R(e.target.value)},onBlur:jump,onKeyDown:e=>{"Enter"!==e.key||e.nativeEvent.isComposing||(e.preventDefault(),jump())}}),"页"]})]})});xa.displayName="Pagination";import{forwardRef as wa,useEffect as Na,useMemo as Ca,useRef as ka,useState as za}from"react";import{jsx as Ea}from"react/jsx-runtime";var Ta=wa(({children:e,className:t,defaultValue:a=[],disabled:n,form:s,max:d,min:c=0,name:u,onValueChange:m,orientation:f="horizontal",size:g,value:v,...p},h)=>{const y=l(),x=ka(null),[w,N]=za([...a]),C=void 0===v?w:v,k=i(n,y.disabled),z=o(g,y.size),E=Math.max(0,c),T=void 0===d?void 0:Math.max(E,d),M=ka({value:v,defaultValue:a});M.current={value:v,defaultValue:a},Na(()=>{const e=s?document.getElementById(s):x.current?.closest("form")??null;if(!e)return;const t=new Set;function handleReset(e){const a=setTimeout(()=>{t.delete(a);const r=M.current;e.defaultPrevented||void 0!==r.value||N([...r.defaultValue])},0);t.add(a)}return e.addEventListener("reset",handleReset),()=>{e.removeEventListener("reset",handleReset),t.forEach(clearTimeout)}},[s]);const I=Ca(()=>({values:C,form:s,name:u,size:z,disabled:k,isOptionDisabled:(e,t,a=!1)=>!(!k&&!a)||(t?C.length<=E:void 0!==T&&C.length>=T&&!C.includes(e)),toggleValue(e,t){const a=t?C.includes(e)?[...C]:[...C,e]:C.filter(t=>t!==e);a.length<E||void 0!==T&&a.length>T||(void 0===v&&N(a),m?.(a))}}),[u,s,T,E,m,k,z,v,C]);return Ea(b.Provider,{value:I,children:Ea("div",{...p,ref:e=>{x.current=e,function assignRef2(e,t){"function"==typeof e?e(t):e&&(e.current=t)}(h,e)},className:r("flex","vertical"===f?"flex-col items-start gap-2":"flex-row flex-wrap items-center gap-x-5 gap-y-2",t),"data-size":z,"data-state":k?"disabled":"default","data-ug":"checkbox-group","data-ug-slot":"root","data-variant":f,role:"group","aria-disabled":k||void 0,children:e})})});Ta.displayName="CheckboxGroup";import{createContext as Ma,forwardRef as Ia,useContext as Ra,useEffect as Sa,useId as Fa,useRef as Pa,useState as La}from"react";import{cva as ja}from"class-variance-authority";import{jsx as Da,jsxs as Aa}from"react/jsx-runtime";var Ba=Ma(null);function assignRef3(e,t){"function"==typeof e?e(t):e&&(e.current=t)}var Oa=ja("relative inline-flex shrink-0 items-center justify-center rounded-[var(--ug-radio-radius)] border shadow-sm peer-focus-visible:outline-none peer-focus-visible:ring-2 peer-focus-visible:ring-ring/35 peer-focus-visible:ring-offset-2 peer-focus-visible:ring-offset-surface-0 peer-disabled:cursor-not-allowed peer-disabled:opacity-50",{variants:{size:{sm:"h-[calc(var(--control-height-sm)*0.5)] w-[calc(var(--control-height-sm)*0.5)]",default:"h-[calc(var(--control-height-md)*0.45)] w-[calc(var(--control-height-md)*0.45)]",lg:"h-[calc(var(--control-height-lg)*0.45)] w-[calc(var(--control-height-lg)*0.45)]"},checked:{true:"border-primary bg-surface-1",false:"border-border-strong bg-surface-1 hover:border-primary/70 hover:bg-surface-2"}},defaultVariants:{size:"default",checked:!1}}),Ka=Ia(({className:e,size:t,value:a,checked:s,defaultChecked:d=!1,disabled:c,label:u,variant:m="default",labelClassName:f,controlClassName:g,name:v,form:p,required:h,onChange:b,id:y,"aria-invalid":x,...w},N)=>{const C=function useRadioGroupContext(){return Ra(Ba)}(),k=l(),z=Fa(),E=Pa(null),T=y??z,[M,I]=La(Boolean(d)),R=C?C.value===a:s??M,S=C?C.disabled||Boolean(c):i(c,k.disabled),F=C?C.name:v,P=C?.form??p,L=C?.required??Boolean(h),j=Pa({checkedProp:s,defaultChecked:d});j.current={checkedProp:s,defaultChecked:d},Sa(()=>{const e=E.current?.form;if(!e||C)return;const t=new Set;function handleReset(a){const r=setTimeout(()=>{t.delete(r);const n=E.current;if(a.defaultPrevented||!n||n.form!==e)return;const o=j.current,i=Boolean(o.checkedProp??o.defaultChecked);void 0===o.checkedProp&&I(i),n.checked=i},0);t.add(r)}return e.addEventListener("reset",handleReset),()=>{e.removeEventListener("reset",handleReset);for(const e of t)clearTimeout(e)}},[Boolean(C),P]);const D=o(t??C?.size,k.size),A=n(x),B=[R?"checked":"unchecked",A?"invalid":void 0,S?"disabled":void 0].filter(Boolean).join(" "),O="sm"===D?"h-[calc(var(--control-height-sm)*0.2)] w-[calc(var(--control-height-sm)*0.2)]":"lg"===D?"h-[calc(var(--control-height-lg)*0.22)] w-[calc(var(--control-height-lg)*0.22)]":"h-[calc(var(--control-height-md)*0.2)] w-[calc(var(--control-height-md)*0.2)]",K=Aa("span",{className:"relative inline-flex","data-ug-slot":"control",children:[Da("input",{ref:e=>{E.current=e,assignRef3(N,e)},id:T,type:"radio",className:"peer sr-only",value:a,checked:R,"aria-invalid":x,disabled:S,name:F,form:P,required:L,onChange:function handleChange(){C?C.onValueChange(a):(void 0===s&&I(!0),b?.(a))},"data-ug-slot":"input",...w,"data-ug-value-type":typeof a}),Da("span",{"aria-hidden":"true",className:r(Oa({size:D,checked:R}),A&&"border-danger peer-focus-visible:ring-danger/35",e),"data-ug-slot":"indicator",children:R&&Da("span",{className:r("rounded-[var(--ug-radio-radius)] bg-primary",O),"data-ug-slot":"dot"})})]});return null==u?Da("span",{"data-ug":"radio","data-state":B,"data-variant":"default","data-size":D,children:K}):Aa("label",{htmlFor:T,className:r("card"===m?"flex min-h-[calc(var(--control-height-lg)*1.75)] w-full cursor-pointer select-none items-start gap-3 rounded-[var(--radius-panel)] border border-border-base bg-surface-1 p-[var(--content-gap)] text-sm leading-5 text-text-primary shadow-xs hover:border-border-strong hover:bg-surface-2 focus-within:border-primary focus-within:ring-2 focus-within:ring-ring/30":"segmented"===m?"inline-flex w-full min-w-0 cursor-pointer select-none items-center justify-center gap-0 rounded-[calc(var(--radius-control)*0.75)] border border-transparent bg-transparent text-center leading-5 text-text-secondary shadow-none transition-[background-color,border-color,box-shadow,color] duration-[var(--motion-duration-state)] hover:bg-surface-3 hover:text-text-primary focus-within:z-10 focus-within:outline-none focus-within:ring-2 focus-within:ring-ring/30":"inline-flex min-h-[var(--control-height-sm)] max-w-full min-w-0 cursor-pointer items-start gap-2.5 text-sm leading-5 text-text-primary select-none","segmented"===m&&("sm"===D?"min-h-[var(--control-height-sm)] px-[var(--control-padding-x-sm)] text-sm":"lg"===D?"min-h-[var(--control-height-lg)] px-[var(--control-padding-x-lg)] text-base":"min-h-[var(--control-height-md)] px-[var(--control-padding-x-md)] text-sm"),"card"===m&&R&&"border-primary bg-primary-soft shadow-sm","segmented"===m&&R&&"border-primary/25 bg-surface-1 text-primary-soft-fg shadow-xs","card"===m&&A&&"border-danger focus-within:ring-danger/30","segmented"===m&&A&&"border-danger focus-within:ring-danger/30",S&&"cursor-not-allowed opacity-60",f),"data-ug":"radio","data-state":B,"data-variant":m,"data-size":D,children:[Da("span",{className:r("card"===m&&"mt-0.5","segmented"===m&&"sr-only",g),"data-ug-slot":"control",children:K}),Da("span",{className:r("min-w-0 pt-px [overflow-wrap:anywhere]","card"===m&&"flex-1"),"data-ug-slot":"label",children:u})]})});Ka.displayName="Radio";var $a=Ia(({className:e,value:t,defaultValue:a,onValueChange:n,disabled:s,size:d,name:c,form:u,required:m=!1,orientation:f="vertical",presentation:g="default",sizing:v="fill",children:p,...h},b)=>{const y=l(),x=Pa(null),w=Fa(),[N,C]=La(a),k=void 0!==t,z=k?t:N,E=i(s,y.disabled),T=o(d,y.size),M=Pa({defaultValue:a,currentValue:z,isControlled:k});return M.current={defaultValue:a,currentValue:z,isControlled:k},Sa(()=>{const e=u?document.getElementById(u):x.current?.closest("form")??null;if(!e)return;const t=new Set;function handleReset(a){const r=setTimeout(()=>{if(t.delete(r),a.defaultPrevented||!x.current)return;const n=M.current,o=n.isControlled?n.currentValue:n.defaultValue;n.isControlled||C(o);for(const t of x.current.querySelectorAll('input[type="radio"]'))t.form===e&&t.closest('[data-ug="radio-group"]')===x.current&&(t.checked=t.dataset.ugValueType===typeof o&&("number"==typeof o?Number(t.value)===o:t.value===o))},0);t.add(r)}return e.addEventListener("reset",handleReset),()=>{e.removeEventListener("reset",handleReset);for(const e of t)clearTimeout(e)}},[u]),Da(Ba.Provider,{value:{value:z,onValueChange:function handleValueChange(e){k||C(e),n?.(e)},name:c??`ug-radio-${w}`,form:u,required:m,disabled:E,size:T},children:Da("div",{ref:e=>{x.current=e,assignRef3(b,e)},role:"radiogroup","aria-disabled":E||void 0,"aria-required":m||void 0,className:r("segmented"===g?r("grid max-w-full grid-flow-col auto-cols-fr gap-1 rounded-[var(--radius-control)] border border-border-base bg-surface-2 p-1","content"===v?"w-fit":"w-full"):r("flex","vertical"===f?"flex-col gap-2.5":"flex-row flex-wrap gap-x-5 gap-y-2.5"),e),...h,"data-ug":"radio-group","data-state":E?"disabled":"default","data-variant":f,"data-presentation":g,"data-sizing":v,"data-size":T,children:p})})});$a.displayName="RadioGroup";import{createContext as Va,forwardRef as Ha,useCallback as qa,useContext as Wa,useId as Ga,useLayoutEffect as Ua,useRef as Xa,useState as Qa}from"react";import{createPortal as Ja}from"react-dom";import{Plus as Za,X as _a}from"lucide-react";import{Fragment as Ya,jsx as er,jsxs as tr}from"react/jsx-runtime";var ar=Va(null),rr=Va(null);function useTabsContext(){const e=Wa(ar);if(!e)throw new Error("Tabs 子组件必须在 <Tabs> 内使用");return e}function getTabsPartId(e,t,a){return`${e}-${a}-${encodeURIComponent(t)}`}var nr=(()=>{const e=Ha(({value:e,onValueChange:t,children:a,className:n,size:o="md",variant:i="default",onClose:l,onAdd:s,addLabel:d="添加标签",...c},u)=>{const m=`ug-tabs-${Ga().replace(/:/g,"")}`;return er(ar.Provider,{value:{value:e,onValueChange:t,baseId:m,size:o,variant:i,onClose:l,onAdd:s,addLabel:d},children:er("div",{ref:u,className:r("w-full",n),...c,"data-ug":"tabs","data-state":"default","data-variant":i,"data-size":o,children:a})})});return e.displayName="Tabs",e})(),or=(()=>{const e=Ha(({className:e,children:t,orientation:a="horizontal",...n},o)=>{const{variant:i,size:l,onAdd:s,addLabel:d}=useTabsContext(),c=Xa(null),u=qa(e=>{c.current=e,"function"==typeof o?o(e):o&&(o.current=e)},[o]),[m,f]=Qa(null),[g,v]=Qa(!0);return Ua(()=>{const e=c.current;if(!e)return;const update=()=>v(Boolean(e.querySelector('[role="tab"]')));update();const t=new MutationObserver(update);return t.observe(e,{childList:!0,subtree:!0}),()=>t.disconnect()},[]),er(rr.Provider,{value:{listRef:c,host:m},children:tr("div",{"data-ug-slot":"list-frame","data-orientation":a,children:[tr("div",{"data-ug-slot":"list-viewport",children:[er("div",{ref:u,role:g?"tablist":void 0,"aria-orientation":g?a:void 0,tabIndex:-1,className:r("flex w-full min-w-0 items-center overflow-x-auto","rail"===i&&"flex-col items-stretch gap-1 overflow-visible p-0",e),...n,"data-ug-slot":"list","data-variant":i,"data-size":l,children:t}),er("div",{ref:f,"data-ug-slot":"edit-actions"})]}),s&&er("button",{type:"button",onClick:s,"aria-label":d,"data-ug-slot":"add",children:er(Za,{size:14,"aria-hidden":"true"})})]})})});return e.displayName="TabsList",e})(),ir=(()=>{const t=Ha(({value:t,className:a,children:n,disabled:o,onClick:i,onKeyDown:l,id:s,closable:d=!1,closeLabel:c,"aria-controls":u,...m},f)=>{const{value:g,onValueChange:v,baseId:p,size:h,variant:b,onClose:y}=useTabsContext(),x=Wa(rr),w=Xa(null),N=function useClosePosition(e,t,a){const[r,n]=Qa();return Ua(()=>{const r=e.current,o=t?.host,i=t?.listRef.current??r?.closest('[data-ug-slot="list"]');if(!(a&&r&&o&&i))return;function update(){const e=r.getBoundingClientRect(),t=o.getBoundingClientRect(),a={left:e.right-t.left-e.height,top:e.top-t.top,width:e.height,height:e.height};n(e=>e&&Object.keys(a).every(t=>e[t]===a[t])?e:a)}update();const l="undefined"==typeof ResizeObserver?void 0:new ResizeObserver(update);l?.observe(r),l?.observe(o),l?.observe(i);const s=new MutationObserver(update);return s.observe(i,{childList:!0,subtree:!0,characterData:!0}),i.addEventListener("scroll",update,{passive:!0}),window.addEventListener("resize",update),()=>{l?.disconnect(),s.disconnect(),i.removeEventListener("scroll",update),window.removeEventListener("resize",update)}},[t,a,e]),r}(w,x,d),C=usePortalContainer(),k=e(),z=g===t,E=getTabsPartId(p,t,"trigger"),T=getTabsPartId(p,t,"panel"),M=[z?"selected":void 0,o?"disabled":void 0].filter(Boolean).join(" ")||"default";function closeTab(e){if(o||!y)return;const a=x?.listRef.current??e.closest('[role="tablist"]'),r=Array.from(a?.querySelectorAll('[role="tab"]:not(:disabled)')??[]),n=r.find(e=>e.id===(s??E)),i=n?r.indexOf(n):-1,l=r[i+1]??r[i-1];y(t),z&&l?.dataset.value&&v(l.dataset.value),setTimeout(()=>{if(l?.isConnected)l.focus();else{const e=a?.closest('[data-ug-slot="list-frame"]'),t=e?.querySelector('[data-ug-slot="add"]');(t??a)?.focus()}},0)}const I=er("button",{ref:e=>{w.current=e,"function"==typeof f?f(e):f&&(f.current=e)},type:"button",role:"tab",id:s??E,"aria-controls":u??T,"aria-selected":z,tabIndex:z?0:-1,disabled:o,onClick:e=>{o||(v(t),i?.(e))},onKeyDown:e=>{l?.(e);const t=e.currentTarget.closest('[role="tablist"]'),a=t?.getAttribute("aria-orientation")??"horizontal",r="vertical"===a?"ArrowUp":"ArrowLeft",n="vertical"===a?"ArrowDown":"ArrowRight";if(!e.defaultPrevented&&d&&"Delete"===e.key)return e.preventDefault(),void closeTab(e.currentTarget);if(e.defaultPrevented||![r,n,"Home","End"].includes(e.key))return;const o=Array.from(t?.querySelectorAll('[role="tab"]:not(:disabled)')??[]),i=o.indexOf(e.currentTarget);if(i<0||0===o.length)return;e.preventDefault();const s="Home"===e.key?0:"End"===e.key?o.length-1:(i+(e.key===n?1:-1)+o.length)%o.length;o[s]?.focus(),o[s]?.click()},className:r("relative shrink-0 whitespace-nowrap border-0 bg-transparent font-medium focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/30 focus-visible:ring-offset-1 disabled:pointer-events-none disabled:opacity-50","rail"===b&&"flex w-full items-center justify-start rounded-[var(--radius-control)] border border-transparent text-left text-text-secondary shadow-none hover:bg-surface-3 hover:text-text-primary data-[state=selected]:border-primary/25 data-[state=selected]:bg-primary-soft data-[state=selected]:text-primary-soft-fg","rail"===b&&("sm"===h?"px-[var(--control-padding-x-sm)] text-sm":"lg"===h?"px-[var(--control-padding-x-lg)] text-base":"px-[var(--control-padding-x-md)] text-sm"),a),...m,"data-closable":d||void 0,"data-value":t,"data-ug-slot":"trigger","data-state":M,"data-variant":b,"data-size":h,children:n});return tr(Ya,{children:[I,d&&C&&x?.host&&Ja(er("button",{...k,type:"button",disabled:o,style:N,"aria-label":c??`关闭 ${"string"==typeof n?n:t}`,"data-ug-slot":"close",onFocus:function revealClose(){const e=w.current,t=x?.listRef.current;if(!e||!t)return;const a=e.getBoundingClientRect(),r=t.getBoundingClientRect();a.left<r.left?t.scrollLeft-=r.left-a.left:a.right>r.right&&(t.scrollLeft+=a.right-r.right),a.top<r.top?t.scrollTop-=r.top-a.top:a.bottom>r.bottom&&(t.scrollTop+=a.bottom-r.bottom),t.dispatchEvent(new Event("scroll"))},onClick:e=>closeTab(e.currentTarget),children:er(_a,{size:12,"aria-hidden":"true"})}),x.host)]})});return t.displayName="TabsTrigger",t})(),lr=(()=>{const e=Ha(({value:e,className:t,children:a,id:n,style:o,"aria-labelledby":i,...l},s)=>{const{value:d,baseId:c}=useTabsContext(),u=d===e;return er("div",{ref:s,role:"tabpanel",id:n??getTabsPartId(c,e,"panel"),"aria-labelledby":i??getTabsPartId(c,e,"trigger"),hidden:!u,tabIndex:u?0:-1,style:u?o:{...o,display:"none"},className:r("focus-visible:outline-none",t),...l,"data-ug-slot":"content","data-state":u?"selected":"inactive",children:a})});return e.displayName="TabsContent",e})();import{createContext as sr,forwardRef as dr,useCallback as cr,useContext as ur,useEffect as mr,useId as fr,useRef as gr,useState as vr}from"react";import{ChevronDown as pr}from"lucide-react";import{jsx as hr,jsxs as br}from"react/jsx-runtime";var yr=sr(null);function useNavigationMenuContext(){const e=ur(yr);if(!e)throw new Error("NavigationMenu 子组件必须在 <NavigationMenu> 内使用");return e}var xr=sr(null);function useNavigationMenuItemContext(){const e=ur(xr);if(!e)throw new Error("NavigationMenuTrigger/Content 必须在 <NavigationMenuItem> 内使用");return e}var wr=(()=>{const e=dr(({activation:e="hover",tone:t="default",orientation:a="horizontal",collapsed:n=!1,onNavigate:o,className:i,children:l,...s},d)=>{const[c,u]=vr(null),m=gr(null);return mr(()=>{if("click"===e&&c)return document.addEventListener("pointerdown",handlePointerDown,!0),()=>document.removeEventListener("pointerdown",handlePointerDown,!0);function handlePointerDown(e){m.current?.contains(e.target)||u(null)}},[e,c]),hr(yr.Provider,{value:{activation:e,activeItem:c,setActiveItem:u,tone:t,orientation:a,collapsed:n&&"vertical"===a,onNavigate:o},children:hr("nav",{ref:e=>{m.current=e,function assignRef4(e,t){"function"==typeof e?e(t):e&&(e.current=t)}(d,e)},"aria-label":"主导航",className:r("relative flex gap-1","vertical"===a?"w-full flex-col items-stretch":"items-center",i),"data-ug":"navigation-menu","data-state":"default","data-variant":"default","data-size":"md","data-activation":e,"data-tone":t,"data-orientation":a,"data-collapsed":n&&"vertical"===a||void 0,...s,children:l})})});return e.displayName="NavigationMenu",e})(),Nr=(()=>{const e=dr(({className:e,children:t,onMouseEnter:a,onMouseLeave:n,onBlur:o,...i},l)=>{const s=`ug-navigation-item-${fr().replace(/:/g,"")}`,{activation:d,activeItem:c,setActiveItem:u}=useNavigationMenuContext(),m=c===s,f=gr(!1),g=cr(e=>{"hover"===d?(f.current=!m,u(s),a?.(e)):a?.(e)},[d,m,s,a,u]),v=cr(e=>{"hover"===d?(f.current=!1,u(null),n?.(e)):n?.(e)},[d,n,u]);return hr(xr.Provider,{value:{itemId:s,hoverOpened:f},children:hr("div",{ref:l,className:r("relative",e),onMouseEnter:g,onMouseLeave:v,onBlur:e=>{e.currentTarget.contains(e.relatedTarget)||u(null),o?.(e)},"data-ug-slot":"item","data-state":m?"open":"closed",...i,children:t})})});return e.displayName="NavigationMenuItem",e})(),Cr=(()=>{const e=dr(({className:e,active:t=!1,children:a,onClick:n,icon:o,collapsedLabel:i,...l},s)=>{const{setActiveItem:d,tone:c,collapsed:u,onNavigate:m}=useNavigationMenuContext();return br("a",{ref:s,className:r("inline-flex items-center px-[var(--control-padding-x-sm)] py-[calc(var(--control-height-sm)*0.2)] text-sm font-medium [border-radius:var(--radius-control)] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/30 focus-visible:ring-offset-1","default"===c?t?"bg-[var(--ug-navigation-menu-item-surface,hsl(var(--surface-3)))] text-text-primary":"text-text-secondary hover:bg-[var(--ug-navigation-menu-item-surface,hsl(var(--surface-3)))] hover:text-text-primary":void 0,e),"data-ug-slot":"link","data-state":t?"active":"default","aria-current":t?"page":void 0,title:u?i:l.title,"aria-label":u?i??l["aria-label"]:l["aria-label"],onClick:e=>{d(null),n?.(e),e.defaultPrevented||m?.(l.href,e)},...l,children:[(o||u)&&hr("span",{"aria-hidden":"true","data-ug-slot":"icon",children:o??(i??("string"==typeof a?a:"…")).slice(0,1)}),hr("span",{"data-ug-slot":"label",children:a})]})});return e.displayName="NavigationMenuLink",e})(),kr=(()=>{const e=dr(({active:e=!1,className:t,children:a,id:n,onClick:o,onKeyDown:i,icon:l,collapsedLabel:s,"aria-controls":d,...c},u)=>{const{activeItem:m,setActiveItem:f,tone:g,collapsed:v}=useNavigationMenuContext(),{itemId:p,hoverOpened:h}=useNavigationMenuItemContext(),b=m===p,y=`${p}-content`;return br("button",{ref:u,type:"button",id:n??`${p}-trigger`,"aria-controls":d??y,"aria-expanded":b,title:v?s:c.title,"aria-label":v?s??c["aria-label"]:c["aria-label"],onClick:e=>{h.current?(h.current=!1,f(p)):f(b?null:p),o?.(e)},onKeyDown:e=>{i?.(e),e.defaultPrevented||("Escape"===e.key?(e.preventDefault(),f(null)):"ArrowDown"!==e.key&&"ArrowUp"!==e.key||(e.preventDefault(),f(p),function focusContent(e){requestAnimationFrame(()=>{const t=Array.from(document.getElementById(y)?.querySelectorAll('a[href], button:not(:disabled), [tabindex]:not([tabindex="-1"])')??[]),a="first"===e?t[0]:t.at(-1);a?.focus()})}("ArrowDown"===e.key?"first":"last")))},className:r("inline-flex items-center gap-1 border-0 bg-transparent px-[var(--control-padding-x-sm)] py-[calc(var(--control-height-sm)*0.2)] text-sm font-medium [border-radius:var(--radius-control)] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/30 focus-visible:ring-offset-1","default"===g?b||e?"bg-[var(--ug-navigation-menu-item-surface,hsl(var(--surface-3)))] text-text-primary":"text-text-secondary hover:bg-[var(--ug-navigation-menu-item-surface,hsl(var(--surface-3)))] hover:text-text-primary":void 0,t),"data-ug-slot":"trigger","data-state":b?"open":"closed","data-active":e?"true":"false",...c,children:[(l||v)&&hr("span",{"aria-hidden":"true","data-ug-slot":"icon",children:l??(s??("string"==typeof a?a:"…")).slice(0,1)}),hr("span",{"data-ug-slot":"label",children:a}),hr(pr,{"aria-hidden":"true",focusable:"false",size:14,className:void 0,"data-ug-slot":"indicator"})]})});return e.displayName="NavigationMenuTrigger",e})(),zr=(()=>{const e=dr(({className:e,children:t,id:a,onKeyDown:n,onAnimationEnd:o,role:i="region","aria-labelledby":l,...s},d)=>{const c=useNavigationMenuContext(),{activeItem:u,setActiveItem:m}=c,{itemId:f}=useNavigationMenuItemContext(),g=u===f,{present:v,state:p,handleAnimationEnd:h}=usePresence(g),b="horizontal"===c.orientation||c.collapsed;return v?hr(yr.Provider,{value:{...c,collapsed:!1},children:hr("div",{ref:d,id:a??`${f}-content`,role:i,"aria-labelledby":l??`${f}-trigger`,onKeyDown:e=>{n?.(e),e.defaultPrevented||"Escape"!==e.key||(e.preventDefault(),m(null),document.getElementById(`${f}-trigger`)?.focus())},onAnimationEnd:e=>{h(e),o?.(e)},className:r("py-[calc(var(--content-gap)*0.25)] [border-radius:var(--radius-panel)]",b?"absolute left-0 top-full z-50 mt-1 min-w-40 border border-border-base shadow-lg":"static m-0 min-w-0 border-0 shadow-none",b&&"default"===c.tone?"bg-[var(--ug-overlay-surface)]":"bg-surface-1",e),"data-ug-slot":"content","data-state":p,...s,children:t})}):null});return e.displayName="NavigationMenuContent",e})();import{forwardRef as Er}from"react";import{Info as Tr,CheckCircle as Mr,AlertTriangle as Ir,AlertCircle as Rr}from"lucide-react";import{cva as Sr}from"class-variance-authority";import{jsx as Fr,jsxs as Pr}from"react/jsx-runtime";var Lr=Sr("relative flex gap-3 rounded-[var(--radius-panel)] border-l-4 p-[var(--content-gap)]",{variants:{variant:{default:"border-l-primary bg-primary-soft text-primary-soft-fg",info:"border-l-info bg-info-soft text-info-soft-fg",success:"border-l-success bg-success-soft text-success-soft-fg",warning:"border-l-warning bg-warning-soft text-warning-soft-fg",destructive:"border-l-danger bg-danger-soft text-danger-soft-fg"}},defaultVariants:{variant:"default"}}),jr={default:Tr,info:Tr,success:Mr,warning:Ir,destructive:Rr},Dr={default:"text-primary",info:"text-info",success:"text-success",warning:"text-warning",destructive:"text-danger"},Ar=Er(({variant:e="default",className:t,children:a,role:n,...o},i)=>{const l=jr[e??"default"],s=Dr[e??"default"];return Pr("div",{ref:i,role:n??("warning"===e||"destructive"===e?"alert":"status"),...o,className:r(Lr({variant:e}),t),"data-ug":"alert","data-state":"default","data-variant":e??"default","data-size":"md",children:[Fr(l,{"aria-hidden":"true",focusable:"false","data-ug-slot":"icon",size:18,className:r("mt-0.5 shrink-0",s)}),Fr("div",{"data-ug-slot":"content",className:"flex min-w-0 flex-1 flex-col gap-0.5 [overflow-wrap:anywhere]",children:a})]})}),Br=Er(({className:e,...t},a)=>Fr("p",{ref:a,...t,className:r("text-sm font-semibold leading-5",e),"data-ug-slot":"title"})),Or=Er(({className:e,...t},a)=>Fr("p",{ref:a,...t,className:r("text-sm leading-5 opacity-90",e),"data-ug-slot":"description"}));Ar.displayName="Alert",Br.displayName="AlertTitle",Or.displayName="AlertDescription";import{forwardRef as Kr}from"react";import{cva as $r}from"class-variance-authority";import{jsx as Vr}from"react/jsx-runtime";var Hr=$r("animate-pulse bg-surface-3 motion-reduce:animate-none",{variants:{variant:{text:"w-full [height:calc(var(--control-height-sm)*0.5)] [border-radius:calc(var(--radius-control)*0.5)]",circle:"[border-radius:calc(var(--radius-overlay)*999)]",rect:"[border-radius:var(--radius-panel)]"}},defaultVariants:{variant:"rect"}}),qr=Kr(({variant:e,className:t,...a},n)=>{const o=e??"rect";return Vr("div",{ref:n,...a,className:r(Hr({variant:e}),t),"aria-hidden":"true","data-ug":"skeleton","data-ug-slot":"placeholder","data-state":"loading","data-variant":o,"data-size":"md"})});qr.displayName="Skeleton";export{useFloatingLayoutObserver,usePresence,usePortalContainer,w as checkboxVariants,N as Checkbox,re as Select,useEscapeKey,ze as OverlayFocusScope,useOverlayFocus,Ie as Modal,Re as ModalContent,Se as ModalHeader,Fe as ModalBody,Pe as ModalTitle,Le as ModalFooter,je as ModalCloseButton,Oe as Fieldset,Ke as FieldsetLegend,$e as FieldsetDescription,Ue as EmptyState,Je as Table,Ze as TableHeader,_e as TableBody,Ye as TableRow,et as TableHead,tt as TableCell,xt as Tooltip,wt as TooltipTrigger,Ct as TooltipContent,ua as Sidebar,xa as Pagination,Ta as CheckboxGroup,Ka as Radio,$a as RadioGroup,nr as Tabs,or as TabsList,ir as TabsTrigger,lr as TabsContent,wr as NavigationMenu,Nr as NavigationMenuItem,Cr as NavigationMenuLink,kr as NavigationMenuTrigger,zr as NavigationMenuContent,Ar as Alert,Br as AlertTitle,Or as AlertDescription,qr as Skeleton};//# sourceMappingURL=chunk-DJDACMBD.js.map