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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (347) hide show
  1. package/dist/THIRD_PARTY_NOTICES.txt +98 -0
  2. package/dist/aliases.d.ts +62 -14
  3. package/dist/aliases.d.ts.map +1 -1
  4. package/dist/blocks/feature-grid.d.ts +8 -0
  5. package/dist/blocks/feature-grid.d.ts.map +1 -1
  6. package/dist/blocks/index.cjs +1 -467
  7. package/dist/blocks/index.cjs.map +1 -1
  8. package/dist/blocks/index.js +1 -194
  9. package/dist/blocks/index.js.map +1 -1
  10. package/dist/blocks/landing-hero.d.ts +6 -0
  11. package/dist/blocks/landing-hero.d.ts.map +1 -1
  12. package/dist/chunk-2EJWWTLH.cjs +1 -0
  13. package/dist/chunk-2EJWWTLH.cjs.map +1 -0
  14. package/dist/chunk-D63UPGP5.cjs +1 -0
  15. package/dist/chunk-D63UPGP5.cjs.map +1 -0
  16. package/dist/chunk-J4NAYP4L.cjs +1 -0
  17. package/dist/chunk-J4NAYP4L.cjs.map +1 -0
  18. package/dist/chunk-JY5S7YLF.cjs +1 -0
  19. package/dist/chunk-JY5S7YLF.cjs.map +1 -0
  20. package/dist/chunk-NRCPYVJW.js +1 -0
  21. package/dist/chunk-NRCPYVJW.js.map +1 -0
  22. package/dist/chunk-PXVCZ6AZ.js +1 -0
  23. package/dist/chunk-PXVCZ6AZ.js.map +1 -0
  24. package/dist/chunk-PZ4UH6BC.js +1 -0
  25. package/dist/chunk-PZ4UH6BC.js.map +1 -0
  26. package/dist/chunk-UBZ2ZCEJ.cjs +1 -0
  27. package/dist/chunk-UBZ2ZCEJ.cjs.map +1 -0
  28. package/dist/chunk-UEJM2SLH.js +1 -0
  29. package/dist/chunk-UEJM2SLH.js.map +1 -0
  30. package/dist/chunk-UESSLLSC.js +1 -0
  31. package/dist/chunk-UESSLLSC.js.map +1 -0
  32. package/dist/chunk-VDBATAZ3.js +1 -0
  33. package/dist/chunk-VDBATAZ3.js.map +1 -0
  34. package/dist/chunk-WQHHSYYD.js +1 -0
  35. package/dist/chunk-WQHHSYYD.js.map +1 -0
  36. package/dist/chunk-X4EMYHLY.cjs +1 -0
  37. package/dist/chunk-X4EMYHLY.cjs.map +1 -0
  38. package/dist/chunk-XN7GQRSF.js +1 -0
  39. package/dist/chunk-XN7GQRSF.js.map +1 -0
  40. package/dist/chunk-XVFRKGM7.cjs +1 -0
  41. package/dist/chunk-XVFRKGM7.cjs.map +1 -0
  42. package/dist/chunk-ZDO5A2IZ.cjs +1 -0
  43. package/dist/chunk-ZDO5A2IZ.cjs.map +1 -0
  44. package/dist/components/accordion.d.ts +8 -2
  45. package/dist/components/accordion.d.ts.map +1 -1
  46. package/dist/components/alert.d.ts.map +1 -1
  47. package/dist/components/autocomplete.d.ts +21 -0
  48. package/dist/components/autocomplete.d.ts.map +1 -0
  49. package/dist/components/avatar.d.ts.map +1 -1
  50. package/dist/components/backtop.d.ts +11 -0
  51. package/dist/components/backtop.d.ts.map +1 -0
  52. package/dist/components/badge.d.ts +16 -0
  53. package/dist/components/badge.d.ts.map +1 -1
  54. package/dist/components/bar-chart.d.ts +23 -0
  55. package/dist/components/bar-chart.d.ts.map +1 -0
  56. package/dist/components/breadcrumb.d.ts +5 -1
  57. package/dist/components/breadcrumb.d.ts.map +1 -1
  58. package/dist/components/button-group.d.ts.map +1 -1
  59. package/dist/components/button.d.ts +7 -5
  60. package/dist/components/button.d.ts.map +1 -1
  61. package/dist/components/calendar.d.ts +40 -0
  62. package/dist/components/calendar.d.ts.map +1 -0
  63. package/dist/components/card.d.ts +8 -1
  64. package/dist/components/card.d.ts.map +1 -1
  65. package/dist/components/carousel.d.ts +29 -0
  66. package/dist/components/carousel.d.ts.map +1 -0
  67. package/dist/components/cascader.d.ts +54 -0
  68. package/dist/components/cascader.d.ts.map +1 -0
  69. package/dist/components/checkbox-group.d.ts.map +1 -1
  70. package/dist/components/checkbox.d.ts.map +1 -1
  71. package/dist/components/collapsible.d.ts +23 -0
  72. package/dist/components/collapsible.d.ts.map +1 -0
  73. package/dist/components/color-picker.d.ts +19 -0
  74. package/dist/components/color-picker.d.ts.map +1 -0
  75. package/dist/components/config-provider.d.ts +2 -0
  76. package/dist/components/config-provider.d.ts.map +1 -1
  77. package/dist/components/context/form-context.d.ts.map +1 -1
  78. package/dist/components/context-menu.d.ts +1 -1
  79. package/dist/components/context-menu.d.ts.map +1 -1
  80. package/dist/components/data-panel.d.ts +38 -0
  81. package/dist/components/data-panel.d.ts.map +1 -0
  82. package/dist/components/date-picker.d.ts +16 -0
  83. package/dist/components/date-picker.d.ts.map +1 -0
  84. package/dist/components/date-range-picker.d.ts +42 -0
  85. package/dist/components/date-range-picker.d.ts.map +1 -0
  86. package/dist/components/date-time-picker.d.ts +12 -0
  87. package/dist/components/date-time-picker.d.ts.map +1 -0
  88. package/dist/components/descriptions.d.ts.map +1 -1
  89. package/dist/components/dialog.d.ts +9 -0
  90. package/dist/components/dialog.d.ts.map +1 -1
  91. package/dist/components/dock.d.ts +29 -0
  92. package/dist/components/dock.d.ts.map +1 -0
  93. package/dist/components/donut-chart.d.ts +30 -0
  94. package/dist/components/donut-chart.d.ts.map +1 -0
  95. package/dist/components/drawer.d.ts +11 -2
  96. package/dist/components/drawer.d.ts.map +1 -1
  97. package/dist/components/dropdown.d.ts +9 -1
  98. package/dist/components/dropdown.d.ts.map +1 -1
  99. package/dist/components/empty-state.d.ts +3 -0
  100. package/dist/components/empty-state.d.ts.map +1 -1
  101. package/dist/components/fab.d.ts +38 -0
  102. package/dist/components/fab.d.ts.map +1 -0
  103. package/dist/components/fieldset.d.ts +13 -0
  104. package/dist/components/fieldset.d.ts.map +1 -0
  105. package/dist/components/file-input.d.ts +17 -0
  106. package/dist/components/file-input.d.ts.map +1 -0
  107. package/dist/components/form.d.ts +2 -2
  108. package/dist/components/form.d.ts.map +1 -1
  109. package/dist/components/gauge-chart.d.ts +19 -0
  110. package/dist/components/gauge-chart.d.ts.map +1 -0
  111. package/dist/components/heatmap-chart.d.ts +28 -0
  112. package/dist/components/heatmap-chart.d.ts.map +1 -0
  113. package/dist/components/image-viewer.d.ts +15 -0
  114. package/dist/components/image-viewer.d.ts.map +1 -0
  115. package/dist/components/image.d.ts +14 -0
  116. package/dist/components/image.d.ts.map +1 -0
  117. package/dist/components/index.cjs +1 -8684
  118. package/dist/components/index.cjs.map +1 -1
  119. package/dist/components/index.d.ts +49 -1
  120. package/dist/components/index.d.ts.map +1 -1
  121. package/dist/components/index.js +1 -391
  122. package/dist/components/indicator.d.ts +20 -0
  123. package/dist/components/indicator.d.ts.map +1 -0
  124. package/dist/components/infinite-scroll.d.ts +20 -0
  125. package/dist/components/infinite-scroll.d.ts.map +1 -0
  126. package/dist/components/input.d.ts.map +1 -1
  127. package/dist/components/join.d.ts +20 -0
  128. package/dist/components/join.d.ts.map +1 -0
  129. package/dist/components/kbd.d.ts +8 -0
  130. package/dist/components/kbd.d.ts.map +1 -0
  131. package/dist/components/label.d.ts.map +1 -1
  132. package/dist/components/list.d.ts +21 -0
  133. package/dist/components/list.d.ts.map +1 -0
  134. package/dist/components/loading.d.ts +10 -0
  135. package/dist/components/loading.d.ts.map +1 -0
  136. package/dist/components/modal.d.ts +20 -3
  137. package/dist/components/modal.d.ts.map +1 -1
  138. package/dist/components/navbar.d.ts +23 -0
  139. package/dist/components/navbar.d.ts.map +1 -0
  140. package/dist/components/navigation-menu.d.ts +15 -0
  141. package/dist/components/navigation-menu.d.ts.map +1 -1
  142. package/dist/components/notification.d.ts +22 -0
  143. package/dist/components/notification.d.ts.map +1 -0
  144. package/dist/components/number-input.d.ts.map +1 -1
  145. package/dist/components/otp-input.d.ts +13 -3
  146. package/dist/components/otp-input.d.ts.map +1 -1
  147. package/dist/components/pagination.d.ts +12 -9
  148. package/dist/components/pagination.d.ts.map +1 -1
  149. package/dist/components/popconfirm.d.ts +20 -0
  150. package/dist/components/popconfirm.d.ts.map +1 -0
  151. package/dist/components/popover.d.ts +3 -2
  152. package/dist/components/popover.d.ts.map +1 -1
  153. package/dist/components/progress.d.ts +9 -0
  154. package/dist/components/progress.d.ts.map +1 -1
  155. package/dist/components/radar-chart.d.ts +24 -0
  156. package/dist/components/radar-chart.d.ts.map +1 -0
  157. package/dist/components/radial-progress.d.ts +18 -0
  158. package/dist/components/radial-progress.d.ts.map +1 -0
  159. package/dist/components/radio.d.ts +11 -0
  160. package/dist/components/radio.d.ts.map +1 -1
  161. package/dist/components/ranking-list.d.ts +31 -0
  162. package/dist/components/ranking-list.d.ts.map +1 -0
  163. package/dist/components/rating.d.ts +20 -0
  164. package/dist/components/rating.d.ts.map +1 -0
  165. package/dist/components/result.d.ts +13 -0
  166. package/dist/components/result.d.ts.map +1 -0
  167. package/dist/components/select.d.ts +2 -2
  168. package/dist/components/select.d.ts.map +1 -1
  169. package/dist/components/sheet.d.ts +11 -0
  170. package/dist/components/sheet.d.ts.map +1 -1
  171. package/dist/components/sidebar.d.ts +46 -10
  172. package/dist/components/sidebar.d.ts.map +1 -1
  173. package/dist/components/slider.d.ts.map +1 -1
  174. package/dist/components/space.d.ts.map +1 -1
  175. package/dist/components/spinner.d.ts +4 -0
  176. package/dist/components/spinner.d.ts.map +1 -1
  177. package/dist/components/splitter.d.ts +1 -0
  178. package/dist/components/splitter.d.ts.map +1 -1
  179. package/dist/components/stack.d.ts +16 -0
  180. package/dist/components/stack.d.ts.map +1 -0
  181. package/dist/components/stacked-bar-chart.d.ts +25 -0
  182. package/dist/components/stacked-bar-chart.d.ts.map +1 -0
  183. package/dist/components/statistic-card.d.ts +50 -0
  184. package/dist/components/statistic-card.d.ts.map +1 -0
  185. package/dist/components/statistic.d.ts +6 -1
  186. package/dist/components/statistic.d.ts.map +1 -1
  187. package/dist/components/steps.d.ts +3 -1
  188. package/dist/components/steps.d.ts.map +1 -1
  189. package/dist/components/switch.d.ts.map +1 -1
  190. package/dist/components/table.d.ts +15 -1
  191. package/dist/components/table.d.ts.map +1 -1
  192. package/dist/components/tabs.d.ts +13 -0
  193. package/dist/components/tabs.d.ts.map +1 -1
  194. package/dist/components/tag.d.ts +4 -2
  195. package/dist/components/tag.d.ts.map +1 -1
  196. package/dist/components/text.d.ts.map +1 -1
  197. package/dist/components/textarea.d.ts.map +1 -1
  198. package/dist/components/theme-controller.d.ts +24 -0
  199. package/dist/components/theme-controller.d.ts.map +1 -0
  200. package/dist/components/time-picker.d.ts +8 -0
  201. package/dist/components/time-picker.d.ts.map +1 -0
  202. package/dist/components/time-range-picker.d.ts +30 -0
  203. package/dist/components/time-range-picker.d.ts.map +1 -0
  204. package/dist/components/time-select.d.ts +15 -0
  205. package/dist/components/time-select.d.ts.map +1 -0
  206. package/dist/components/timeline.d.ts +22 -0
  207. package/dist/components/timeline.d.ts.map +1 -0
  208. package/dist/components/toast.d.ts +52 -6
  209. package/dist/components/toast.d.ts.map +1 -1
  210. package/dist/components/tooltip.d.ts +5 -2
  211. package/dist/components/tooltip.d.ts.map +1 -1
  212. package/dist/components/transfer.d.ts +51 -0
  213. package/dist/components/transfer.d.ts.map +1 -0
  214. package/dist/components/tree-select.d.ts +29 -0
  215. package/dist/components/tree-select.d.ts.map +1 -0
  216. package/dist/components/tree.d.ts +56 -0
  217. package/dist/components/tree.d.ts.map +1 -0
  218. package/dist/components/trend-chart.d.ts +43 -0
  219. package/dist/components/trend-chart.d.ts.map +1 -0
  220. package/dist/components/upload.d.ts +28 -0
  221. package/dist/components/upload.d.ts.map +1 -0
  222. package/dist/hooks/index.cjs +1 -553
  223. package/dist/hooks/index.cjs.map +1 -1
  224. package/dist/hooks/index.js +1 -32
  225. package/dist/hooks/use-copy-to-clipboard.d.ts.map +1 -1
  226. package/dist/hooks/use-escape-key.d.ts +8 -1
  227. package/dist/hooks/use-escape-key.d.ts.map +1 -1
  228. package/dist/hooks/use-event-listener.d.ts +6 -7
  229. package/dist/hooks/use-event-listener.d.ts.map +1 -1
  230. package/dist/hooks/use-form.d.ts +17 -16
  231. package/dist/hooks/use-form.d.ts.map +1 -1
  232. package/dist/hooks/use-local-storage.d.ts.map +1 -1
  233. package/dist/hooks/use-media-query.d.ts.map +1 -1
  234. package/dist/hooks/use-pagination.d.ts.map +1 -1
  235. package/dist/index.cjs +1 -9206
  236. package/dist/index.cjs.map +1 -1
  237. package/dist/index.d.ts +64 -17
  238. package/dist/index.d.ts.map +1 -1
  239. package/dist/index.js +1 -419
  240. package/dist/internal/admin-horizontal-navigation.d.ts +9 -0
  241. package/dist/internal/admin-horizontal-navigation.d.ts.map +1 -0
  242. package/dist/internal/data-table-header.d.ts +20 -0
  243. package/dist/internal/data-table-header.d.ts.map +1 -0
  244. package/dist/internal/date-mode-panel.d.ts +9 -0
  245. package/dist/internal/date-mode-panel.d.ts.map +1 -0
  246. package/dist/internal/date-time-control.d.ts +33 -0
  247. package/dist/internal/date-time-control.d.ts.map +1 -0
  248. package/dist/internal/date-time-range-control.d.ts +27 -0
  249. package/dist/internal/date-time-range-control.d.ts.map +1 -0
  250. package/dist/internal/option-window.d.ts +9 -0
  251. package/dist/internal/option-window.d.ts.map +1 -0
  252. package/dist/internal/sidebar-navigation.d.ts +55 -0
  253. package/dist/internal/sidebar-navigation.d.ts.map +1 -0
  254. package/dist/internal/time-panel.d.ts +8 -0
  255. package/dist/internal/time-panel.d.ts.map +1 -0
  256. package/dist/internal/use-cascader-lazy.d.ts +8 -0
  257. package/dist/internal/use-cascader-lazy.d.ts.map +1 -0
  258. package/dist/internal/use-floating-layout-observer.d.ts +8 -0
  259. package/dist/internal/use-floating-layout-observer.d.ts.map +1 -0
  260. package/dist/internal/use-overlay-focus.d.ts +2 -1
  261. package/dist/internal/use-overlay-focus.d.ts.map +1 -1
  262. package/dist/internal/use-portal-container.d.ts.map +1 -1
  263. package/dist/internal/use-presence.d.ts +13 -0
  264. package/dist/internal/use-presence.d.ts.map +1 -0
  265. package/dist/internal/use-transfer-remote.d.ts +20 -0
  266. package/dist/internal/use-transfer-remote.d.ts.map +1 -0
  267. package/dist/internal/use-tree-data.d.ts +8 -0
  268. package/dist/internal/use-tree-data.d.ts.map +1 -0
  269. package/dist/patterns/admin-shell.d.ts +68 -2
  270. package/dist/patterns/admin-shell.d.ts.map +1 -1
  271. package/dist/patterns/app-tabs.d.ts +33 -0
  272. package/dist/patterns/app-tabs.d.ts.map +1 -0
  273. package/dist/patterns/attachment-list.d.ts +36 -0
  274. package/dist/patterns/attachment-list.d.ts.map +1 -0
  275. package/dist/patterns/confirm-dialog.d.ts.map +1 -1
  276. package/dist/patterns/conversation-list.d.ts +27 -0
  277. package/dist/patterns/conversation-list.d.ts.map +1 -0
  278. package/dist/patterns/copy-field.d.ts +6 -0
  279. package/dist/patterns/copy-field.d.ts.map +1 -1
  280. package/dist/patterns/data-table-identity.d.ts +14 -0
  281. package/dist/patterns/data-table-identity.d.ts.map +1 -0
  282. package/dist/patterns/data-table-toolbar.d.ts +18 -0
  283. package/dist/patterns/data-table-toolbar.d.ts.map +1 -0
  284. package/dist/patterns/data-table.d.ts +69 -0
  285. package/dist/patterns/data-table.d.ts.map +1 -0
  286. package/dist/patterns/index.cjs +1 -1206
  287. package/dist/patterns/index.cjs.map +1 -1
  288. package/dist/patterns/index.d.ts +14 -1
  289. package/dist/patterns/index.d.ts.map +1 -1
  290. package/dist/patterns/index.js +1 -375
  291. package/dist/patterns/index.js.map +1 -1
  292. package/dist/patterns/message.d.ts +30 -0
  293. package/dist/patterns/message.d.ts.map +1 -0
  294. package/dist/patterns/page-header.d.ts +4 -0
  295. package/dist/patterns/page-header.d.ts.map +1 -1
  296. package/dist/patterns/prompt-composer.d.ts +55 -0
  297. package/dist/patterns/prompt-composer.d.ts.map +1 -0
  298. package/dist/patterns/quick-access.d.ts +39 -0
  299. package/dist/patterns/quick-access.d.ts.map +1 -0
  300. package/dist/patterns/selection-list.d.ts +34 -0
  301. package/dist/patterns/selection-list.d.ts.map +1 -0
  302. package/dist/patterns/theme-configurator-dialog.d.ts +21 -0
  303. package/dist/patterns/theme-configurator-dialog.d.ts.map +1 -0
  304. package/dist/patterns/theme-configurator.d.ts +24 -0
  305. package/dist/patterns/theme-configurator.d.ts.map +1 -0
  306. package/dist/patterns/tree-table.d.ts +18 -0
  307. package/dist/patterns/tree-table.d.ts.map +1 -0
  308. package/dist/primitives/index.cjs +1 -2161
  309. package/dist/primitives/index.cjs.map +1 -1
  310. package/dist/primitives/index.d.ts +6 -2
  311. package/dist/primitives/index.d.ts.map +1 -1
  312. package/dist/primitives/index.js +1 -107
  313. package/dist/styles.css +1 -4364
  314. package/dist/theme.cjs +1 -161
  315. package/dist/theme.cjs.map +1 -1
  316. package/dist/theme.d.ts +7 -0
  317. package/dist/theme.d.ts.map +1 -1
  318. package/dist/theme.js +1 -19
  319. package/dist/themes/default.css +1 -80
  320. package/dist/themes/mecha.css +1 -195
  321. package/dist/themes/minimal.css +1 -160
  322. package/dist/tokens.css +1 -1240
  323. package/package.json +12 -16
  324. package/dist/chunk-AKWJMDCW.js +0 -467
  325. package/dist/chunk-AKWJMDCW.js.map +0 -1
  326. package/dist/chunk-F23X4N6B.js +0 -11
  327. package/dist/chunk-F23X4N6B.js.map +0 -1
  328. package/dist/chunk-HGO3GZ56.js +0 -1777
  329. package/dist/chunk-HGO3GZ56.js.map +0 -1
  330. package/dist/chunk-HXIWD5LQ.js +0 -319
  331. package/dist/chunk-HXIWD5LQ.js.map +0 -1
  332. package/dist/chunk-M6J4PLF4.js +0 -521
  333. package/dist/chunk-M6J4PLF4.js.map +0 -1
  334. package/dist/chunk-N3Z7R6GG.js +0 -139
  335. package/dist/chunk-N3Z7R6GG.js.map +0 -1
  336. package/dist/chunk-UXWCK6M7.js +0 -5757
  337. package/dist/chunk-UXWCK6M7.js.map +0 -1
  338. package/dist/labs/file-preview.d.ts +0 -44
  339. package/dist/labs/file-preview.d.ts.map +0 -1
  340. package/dist/labs/index.cjs +0 -224
  341. package/dist/labs/index.cjs.map +0 -1
  342. package/dist/labs/index.d.ts +0 -14
  343. package/dist/labs/index.d.ts.map +0 -1
  344. package/dist/labs/index.js +0 -188
  345. package/dist/labs/index.js.map +0 -1
  346. package/dist/labs/model-card.d.ts +0 -50
  347. package/dist/labs/model-card.d.ts.map +0 -1
@@ -1,1206 +1 @@
1
- "use strict";
2
- "use client";
3
- var __defProp = Object.defineProperty;
4
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __hasOwnProp = Object.prototype.hasOwnProperty;
7
- var __export = (target, all) => {
8
- for (var name in all)
9
- __defProp(target, name, { get: all[name], enumerable: true });
10
- };
11
- var __copyProps = (to, from, except, desc) => {
12
- if (from && typeof from === "object" || typeof from === "function") {
13
- for (let key of __getOwnPropNames(from))
14
- if (!__hasOwnProp.call(to, key) && key !== except)
15
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
- }
17
- return to;
18
- };
19
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
20
-
21
- // src/patterns/index.ts
22
- var patterns_exports = {};
23
- __export(patterns_exports, {
24
- AdminShell: () => AdminShell,
25
- ConfirmDialog: () => ConfirmDialog,
26
- CopyField: () => CopyField,
27
- PageHeader: () => PageHeader,
28
- UGAdminShell: () => AdminShell,
29
- UGConfirmDialog: () => ConfirmDialog,
30
- UGCopyField: () => CopyField,
31
- UGPageHeader: () => PageHeader
32
- });
33
- module.exports = __toCommonJS(patterns_exports);
34
-
35
- // src/patterns/admin-shell.tsx
36
- var import_react5 = require("react");
37
- var import_lucide_react3 = require("lucide-react");
38
-
39
- // src/components/button.tsx
40
- var import_react3 = require("react");
41
- var import_lucide_react = require("lucide-react");
42
- var import_class_variance_authority = require("class-variance-authority");
43
-
44
- // src/internal/cn.ts
45
- var import_clsx = require("clsx");
46
- var import_tailwind_merge = require("tailwind-merge");
47
- function cn(...inputs) {
48
- return (0, import_tailwind_merge.twMerge)((0, import_clsx.clsx)(inputs));
49
- }
50
-
51
- // src/internal/button-group-context.ts
52
- var import_react = require("react");
53
- var ButtonGroupContext = (0, import_react.createContext)({});
54
- var ButtonGroupProvider = ButtonGroupContext.Provider;
55
- function useButtonGroup() {
56
- return (0, import_react.useContext)(ButtonGroupContext);
57
- }
58
-
59
- // src/components/config-provider.tsx
60
- var import_react2 = require("react");
61
- var import_jsx_runtime = require("react/jsx-runtime");
62
- function resolveDisabled(disabled, configDisabled) {
63
- return disabled ?? configDisabled;
64
- }
65
- var defaultConfig = {
66
- namespace: "ug",
67
- size: "medium",
68
- disabled: false,
69
- button: {},
70
- link: {}
71
- };
72
- var ConfigContext = (0, import_react2.createContext)(defaultConfig);
73
- function useUIConfig() {
74
- return (0, import_react2.useContext)(ConfigContext);
75
- }
76
-
77
- // src/components/button.tsx
78
- var import_jsx_runtime2 = require("react/jsx-runtime");
79
- var buttonVariants = (0, import_class_variance_authority.cva)(
80
- "inline-flex items-center justify-center gap-[var(--button-icon-gap)] whitespace-nowrap border-solid border-transparent font-[var(--button-font-weight)] transition-[background,border-color,color,box-shadow,opacity] duration-[var(--motion-duration-base)] ease-[var(--motion-easing-standard)] motion-reduce:transition-none focus-visible:outline-none focus-visible:ring-[length:var(--button-focus-ring-width)] focus-visible:ring-primary focus-visible:ring-offset-[length:var(--button-focus-ring-offset)] disabled:pointer-events-none disabled:cursor-not-allowed select-none",
81
- {
82
- variants: {
83
- variant: {
84
- solid: "",
85
- soft: "",
86
- // 蓝绿主按钮
87
- primary: "bg-[var(--button-primary-solid)] text-[hsl(var(--button-solid-fg))] shadow-xs hover:bg-[var(--button-primary-solid-hover)] active:bg-[var(--button-primary-solid-active)] focus-visible:ring-primary",
88
- // 成功绿按钮 (主流框架标准绿)
89
- success: "bg-[var(--button-success-solid)] text-[hsl(var(--button-solid-fg))] shadow-xs hover:bg-[var(--button-success-solid-hover)] active:bg-[var(--button-success-solid-active)] focus-visible:ring-success",
90
- // 警告黄/橙按钮 (主流框架标准橙)
91
- warning: "bg-[var(--button-warning-solid)] text-[hsl(var(--button-solid-fg))] shadow-xs hover:bg-[var(--button-warning-solid-hover)] active:bg-[var(--button-warning-solid-active)] focus-visible:ring-warning",
92
- // 危险红按钮 (主流框架标准红)
93
- danger: "bg-[var(--button-danger-solid)] text-[hsl(var(--button-solid-fg))] shadow-xs hover:bg-[var(--button-danger-solid-hover)] active:bg-[var(--button-danger-solid-active)] focus-visible:ring-danger",
94
- destructive: "bg-[var(--button-danger-solid)] text-[hsl(var(--button-solid-fg))] shadow-xs hover:bg-[var(--button-danger-solid-hover)] active:bg-[var(--button-danger-solid-active)] focus-visible:ring-danger",
95
- // 信息蓝按钮 (主流框架标准蓝)
96
- info: "bg-[var(--button-info-solid)] text-[hsl(var(--button-solid-fg))] shadow-xs hover:bg-[var(--button-info-solid-hover)] active:bg-[var(--button-info-solid-active)] focus-visible:ring-info",
97
- // 默认按钮:经典白底/浅灰底 + 1px 标准边框,Hover 时变主色
98
- default: "border-border-base bg-surface-1 text-text-primary shadow-xs hover:border-primary active:bg-surface-2 focus-visible:ring-primary/40",
99
- outline: "bg-transparent",
100
- // 次要按钮:柔和背景
101
- secondary: "border-border-base bg-surface-2 text-text-primary shadow-xs hover:bg-surface-3 active:bg-surface-3 focus-visible:ring-primary/40",
102
- // 虚线按钮:标准 1px 虚线框
103
- dashed: "border-dashed bg-transparent",
104
- // 幽灵与文本按钮的视觉由语义色映射控制
105
- ghost: "",
106
- text: "",
107
- link: ""
108
- },
109
- size: {
110
- default: "h-[var(--control-height-md)] px-[var(--control-padding-x-md)] py-0",
111
- sm: "h-[var(--control-height-sm)] px-[var(--control-padding-x-sm)] py-0",
112
- lg: "h-[var(--control-height-lg)] px-[var(--control-padding-x-lg)] py-0",
113
- icon: "h-[var(--control-height-md)] w-[var(--control-height-md)] p-0"
114
- },
115
- shape: {
116
- default: "rounded-[var(--radius-control)]",
117
- circle: "!rounded-full !p-0 aspect-square",
118
- round: "!rounded-full"
119
- },
120
- block: {
121
- true: "w-full flex",
122
- false: ""
123
- }
124
- },
125
- defaultVariants: {
126
- variant: "default",
127
- size: "default",
128
- shape: "default",
129
- block: false
130
- }
131
- }
132
- );
133
- var TONE_VARIANT_CLASSES = {
134
- neutral: {
135
- solid: "border-border-strong bg-surface-3 text-text-primary shadow-xs hover:bg-surface-2 active:bg-surface-3 focus-visible:ring-primary/40",
136
- soft: "bg-surface-2 text-text-primary shadow-xs hover:bg-surface-3 active:bg-surface-3 focus-visible:ring-primary/40",
137
- outline: "border-border-strong bg-transparent text-text-primary shadow-xs hover:border-primary active:bg-surface-2 focus-visible:ring-primary/40",
138
- dashed: "border-border-strong text-text-primary hover:border-primary active:bg-surface-2 focus-visible:ring-primary/40",
139
- ghost: "text-text-primary hover:bg-surface-2 active:bg-surface-3 focus-visible:ring-primary/40",
140
- text: "text-text-primary hover:opacity-80 active:opacity-70 focus-visible:ring-primary/40",
141
- link: "text-text-primary focus-visible:ring-primary/40"
142
- },
143
- primary: {
144
- solid: "bg-[var(--button-primary-solid)] text-[hsl(var(--button-solid-fg))] shadow-xs hover:bg-[var(--button-primary-solid-hover)] active:bg-[var(--button-primary-solid-active)] focus-visible:ring-primary",
145
- soft: "bg-primary-soft text-text-primary hover:shadow-sm active:bg-primary-soft focus-visible:ring-primary/40",
146
- outline: "border-primary bg-transparent text-text-primary hover:bg-primary-soft active:bg-primary-soft focus-visible:ring-primary/40",
147
- dashed: "border-primary text-text-primary hover:bg-primary-soft active:bg-primary-soft focus-visible:ring-primary/40",
148
- ghost: "text-text-primary hover:bg-primary-soft active:bg-primary-soft focus-visible:ring-primary/40",
149
- text: "text-text-primary hover:opacity-80 active:opacity-70 focus-visible:ring-primary/40",
150
- link: "text-text-primary focus-visible:ring-primary/40"
151
- },
152
- success: {
153
- solid: "bg-[var(--button-success-solid)] text-[hsl(var(--button-solid-fg))] shadow-xs hover:bg-[var(--button-success-solid-hover)] active:bg-[var(--button-success-solid-active)] focus-visible:ring-success",
154
- soft: "bg-success-soft text-text-primary hover:shadow-sm active:bg-success-soft focus-visible:ring-success/40",
155
- outline: "border-success bg-transparent text-text-primary hover:bg-success-soft active:bg-success-soft focus-visible:ring-success/40",
156
- dashed: "border-success text-text-primary hover:bg-success-soft active:bg-success-soft focus-visible:ring-success/40",
157
- ghost: "text-text-primary hover:bg-success-soft active:bg-success-soft focus-visible:ring-success/40",
158
- text: "text-text-primary hover:opacity-80 active:opacity-70 focus-visible:ring-success/40",
159
- link: "text-text-primary focus-visible:ring-success/40"
160
- },
161
- warning: {
162
- solid: "bg-[var(--button-warning-solid)] text-[hsl(var(--button-solid-fg))] shadow-xs hover:bg-[var(--button-warning-solid-hover)] active:bg-[var(--button-warning-solid-active)] focus-visible:ring-warning",
163
- soft: "bg-warning-soft text-text-primary hover:shadow-sm active:bg-warning-soft focus-visible:ring-warning/40",
164
- outline: "border-warning bg-transparent text-text-primary hover:bg-warning-soft active:bg-warning-soft focus-visible:ring-warning/40",
165
- dashed: "border-warning text-text-primary hover:bg-warning-soft active:bg-warning-soft focus-visible:ring-warning/40",
166
- ghost: "text-text-primary hover:bg-warning-soft active:bg-warning-soft focus-visible:ring-warning/40",
167
- text: "text-text-primary hover:opacity-80 active:opacity-70 focus-visible:ring-warning/40",
168
- link: "text-text-primary focus-visible:ring-warning/40"
169
- },
170
- danger: {
171
- solid: "bg-[var(--button-danger-solid)] text-[hsl(var(--button-solid-fg))] shadow-xs hover:bg-[var(--button-danger-solid-hover)] active:bg-[var(--button-danger-solid-active)] focus-visible:ring-danger",
172
- soft: "bg-danger-soft text-text-primary hover:shadow-sm active:bg-danger-soft focus-visible:ring-danger/40",
173
- outline: "border-danger bg-transparent text-text-primary hover:bg-danger-soft active:bg-danger-soft focus-visible:ring-danger/40",
174
- dashed: "border-danger text-text-primary hover:bg-danger-soft active:bg-danger-soft focus-visible:ring-danger/40",
175
- ghost: "text-text-primary hover:bg-danger-soft active:bg-danger-soft focus-visible:ring-danger/40",
176
- text: "text-text-primary hover:opacity-80 active:opacity-70 focus-visible:ring-danger/40",
177
- link: "text-text-primary focus-visible:ring-danger/40"
178
- },
179
- info: {
180
- solid: "bg-[var(--button-info-solid)] text-[hsl(var(--button-solid-fg))] shadow-xs hover:bg-[var(--button-info-solid-hover)] active:bg-[var(--button-info-solid-active)] focus-visible:ring-info",
181
- soft: "bg-info-soft text-text-primary hover:shadow-sm active:bg-info-soft focus-visible:ring-info/40",
182
- outline: "border-info bg-transparent text-text-primary hover:bg-info-soft active:bg-info-soft focus-visible:ring-info/40",
183
- dashed: "border-info text-text-primary hover:bg-info-soft active:bg-info-soft focus-visible:ring-info/40",
184
- ghost: "text-text-primary hover:bg-info-soft active:bg-info-soft focus-visible:ring-info/40",
185
- text: "text-text-primary hover:opacity-80 active:opacity-70 focus-visible:ring-info/40",
186
- link: "text-text-primary focus-visible:ring-info/40"
187
- }
188
- };
189
- var VARIANT_LAYOUT_CLASSES = {
190
- text: "px-[var(--control-padding-x-sm)]",
191
- link: "h-auto p-0 underline-offset-4 hover:underline"
192
- };
193
- var CONFIG_SIZE_TO_BUTTON_SIZE = {
194
- small: "sm",
195
- medium: "default",
196
- large: "lg"
197
- };
198
- var LEGACY_VARIANT_TONES = {
199
- primary: "primary",
200
- success: "success",
201
- warning: "warning",
202
- danger: "danger",
203
- destructive: "danger",
204
- info: "info"
205
- };
206
- function isToneVariant(variant) {
207
- return ["solid", "soft", "outline", "dashed", "ghost", "text", "link"].includes(variant);
208
- }
209
- function getButtonState(loading, disabled) {
210
- const states = [];
211
- if (loading) states.push("loading");
212
- if (disabled || loading) states.push("disabled");
213
- return states.length > 0 ? states.join(" ") : void 0;
214
- }
215
- var Button = (0, import_react3.forwardRef)(
216
- ({
217
- className,
218
- variant,
219
- tone,
220
- size,
221
- shape,
222
- block,
223
- loading = false,
224
- loadingText,
225
- loadingIcon,
226
- loadingPlacement = "start",
227
- disabled,
228
- type = "button",
229
- style,
230
- children,
231
- ...props
232
- }, ref) => {
233
- const group = useButtonGroup();
234
- const config = useUIConfig();
235
- const resolvedVariant = variant ?? group.variant ?? config.button.variant ?? "default";
236
- const resolvedTone = tone ?? group.tone ?? config.button.tone ?? LEGACY_VARIANT_TONES[resolvedVariant] ?? (resolvedVariant === "solid" || resolvedVariant === "soft" ? "primary" : "neutral");
237
- const resolvedSize = size ?? group.size ?? CONFIG_SIZE_TO_BUTTON_SIZE[config.size];
238
- const resolvedShape = shape ?? group.shape ?? config.button.shape ?? "default";
239
- const resolvedDisabled = resolveDisabled(
240
- disabled,
241
- group.disabled ?? config.disabled
242
- );
243
- const state = getButtonState(loading, resolvedDisabled);
244
- const loader = loadingIcon ?? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_lucide_react.Loader2, { className: "animate-spin motion-reduce:animate-none", size: resolvedSize === "sm" ? 14 : 16 });
245
- const label = loading && loadingText !== void 0 ? loadingText : children;
246
- const toneClasses = isToneVariant(resolvedVariant) ? TONE_VARIANT_CLASSES[resolvedTone][resolvedVariant] : void 0;
247
- const loaderNode = loading ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { "data-ug-slot": "loader", className: "inline-flex shrink-0 items-center justify-center", "aria-hidden": "true", children: loader }) : null;
248
- return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
249
- "button",
250
- {
251
- ref,
252
- ...props,
253
- type,
254
- style: { fontWeight: "var(--button-font-weight)", ...style },
255
- className: cn(
256
- buttonVariants({
257
- variant: resolvedVariant,
258
- size: resolvedSize,
259
- shape: resolvedShape,
260
- block
261
- }),
262
- toneClasses,
263
- VARIANT_LAYOUT_CLASSES[resolvedVariant],
264
- className
265
- ),
266
- disabled: resolvedDisabled || loading,
267
- "aria-busy": loading || void 0,
268
- "data-ug": "button",
269
- "data-state": state,
270
- "data-variant": resolvedVariant,
271
- "data-tone": resolvedTone,
272
- "data-size": resolvedSize,
273
- "data-shape": resolvedShape,
274
- "data-block": block ? "true" : void 0,
275
- "data-ug-namespace": config.namespace,
276
- children: [
277
- loadingPlacement === "start" ? loaderNode : null,
278
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { "data-ug-slot": "label", className: "inline-flex min-w-0 items-center justify-center gap-[var(--button-icon-gap)]", children: label }),
279
- loadingPlacement === "end" ? loaderNode : null
280
- ]
281
- }
282
- );
283
- }
284
- );
285
- Button.displayName = "Button";
286
-
287
- // src/components/sidebar.tsx
288
- var import_react4 = require("react");
289
- var import_lucide_react2 = require("lucide-react");
290
- var import_jsx_runtime3 = require("react/jsx-runtime");
291
- var variantStyles = {
292
- primary: {
293
- container: "border-r border-border-base bg-surface-1 text-text-primary shadow-sm",
294
- active: "bg-primary/10 text-primary-soft-fg shadow-sm ring-1 ring-primary/20 before:absolute before:left-0 before:top-1/2 before:h-[calc(var(--control-height-md)*0.6)] before:w-[3px] before:-translate-y-1/2 before:bg-primary before:[border-bottom-right-radius:var(--radius-control)] before:[border-top-right-radius:var(--radius-control)]",
295
- inactive: "text-text-secondary hover:bg-surface-2 hover:text-text-primary",
296
- divider: "border-border-base",
297
- icon: "bg-transparent text-text-tertiary group-hover:bg-surface-3 group-hover:text-primary",
298
- activeIcon: "bg-primary/15 text-primary-soft-fg"
299
- },
300
- dark: {
301
- container: "border-r border-border-base bg-surface-1 text-text-primary shadow-sm",
302
- active: "bg-primary/10 text-primary-soft-fg shadow-sm ring-1 ring-primary/20 before:absolute before:left-0 before:top-1/2 before:h-[calc(var(--control-height-md)*0.6)] before:w-[3px] before:-translate-y-1/2 before:bg-primary before:[border-bottom-right-radius:var(--radius-control)] before:[border-top-right-radius:var(--radius-control)]",
303
- inactive: "text-text-secondary hover:bg-surface-2 hover:text-text-primary",
304
- divider: "border-border-base",
305
- icon: "bg-transparent text-text-tertiary group-hover:bg-surface-3 group-hover:text-primary",
306
- activeIcon: "bg-primary/15 text-primary-soft-fg"
307
- }
308
- };
309
- function getItemKey(item, index, parentKey) {
310
- return item.id ?? item.href ?? `${parentKey}-${index}-${item.label}`;
311
- }
312
- function itemHasActiveChild(item) {
313
- return Boolean(item.children?.some((child) => child.active || itemHasActiveChild(child)));
314
- }
315
- function normalizeSearch(value) {
316
- return value.toLowerCase().replace(/\s+/g, "");
317
- }
318
- function filterSidebarItems(items, query) {
319
- if (!query) return items;
320
- return items.reduce((result, item) => {
321
- const children = item.children ? filterSidebarItems(item.children, query) : [];
322
- const matched = normalizeSearch(item.label).includes(query);
323
- if (matched || children.length > 0) {
324
- result.push({ ...item, children });
325
- }
326
- return result;
327
- }, []);
328
- }
329
- var Sidebar = (0, import_react4.forwardRef)(
330
- ({
331
- items,
332
- variant = "primary",
333
- collapsed,
334
- defaultCollapsed = false,
335
- onCollapsedChange,
336
- collapsible = false,
337
- searchable = false,
338
- searchPlaceholder = "\u641C\u7D22\u83DC\u5355...",
339
- responsive = false,
340
- mobileOpen = false,
341
- onMobileOpenChange,
342
- header,
343
- footer,
344
- className,
345
- ...props
346
- }, ref) => {
347
- const styles = variantStyles[variant];
348
- const instanceId = `ug-sidebar-${(0, import_react4.useId)().replace(/:/g, "")}`;
349
- const searchId = `${instanceId}-search`;
350
- const [internalCollapsed, setInternalCollapsed] = (0, import_react4.useState)(defaultCollapsed);
351
- const [expandedKeys, setExpandedKeys] = (0, import_react4.useState)(() => /* @__PURE__ */ new Set());
352
- const [query, setQuery] = (0, import_react4.useState)("");
353
- const effectiveCollapsed = collapsed ?? internalCollapsed;
354
- const normalizedQuery = normalizeSearch(query);
355
- const visibleItems = (0, import_react4.useMemo)(() => filterSidebarItems(items, normalizedQuery), [items, normalizedQuery]);
356
- function setCollapsedState(nextCollapsed) {
357
- setInternalCollapsed(nextCollapsed);
358
- onCollapsedChange?.(nextCollapsed);
359
- }
360
- function toggleExpanded(key) {
361
- setExpandedKeys((current) => {
362
- const next = new Set(current);
363
- if (next.has(key)) {
364
- next.delete(key);
365
- } else {
366
- next.add(key);
367
- }
368
- return next;
369
- });
370
- }
371
- function closeMobile() {
372
- onMobileOpenChange?.(false);
373
- }
374
- function renderItems(list, depth = 0, parentKey = "root", listId) {
375
- return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
376
- "ul",
377
- {
378
- id: listId,
379
- className: cn(
380
- "flex flex-col gap-1",
381
- depth === 0 ? "px-[calc(var(--control-padding-x-sm)*0.8)]" : "ml-[calc(var(--control-height-md)*0.6)] mt-1 border-l border-border-base pl-[calc(var(--control-padding-x-sm)*0.65)]"
382
- ),
383
- "data-ug-slot": "list",
384
- children: list.map((item, index) => {
385
- const key = getItemKey(item, index, parentKey);
386
- const hasChildren = Boolean(item.children?.length);
387
- const childListId = `${instanceId}-list-${encodeURIComponent(key)}`;
388
- const active = Boolean(item.active || itemHasActiveChild(item));
389
- const expanded = !effectiveCollapsed && hasChildren && (normalizedQuery.length > 0 || active || expandedKeys.has(key));
390
- const itemContent = /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_jsx_runtime3.Fragment, { children: [
391
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
392
- "span",
393
- {
394
- className: cn(
395
- "flex shrink-0 items-center justify-center transition-colors [height:var(--control-height-sm)] [width:var(--control-height-sm)] [border-radius:var(--radius-control)]",
396
- active ? styles.activeIcon : styles.icon
397
- ),
398
- "data-ug-slot": "icon",
399
- children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(item.icon, { size: 16 })
400
- }
401
- ),
402
- !effectiveCollapsed && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "min-w-0 flex-1 truncate text-left", "data-ug-slot": "label", children: item.label }),
403
- !effectiveCollapsed && hasChildren && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
404
- import_lucide_react2.ChevronDown,
405
- {
406
- size: 15,
407
- className: cn("shrink-0 text-text-tertiary transition-transform", expanded && "rotate-180"),
408
- "aria-hidden": "true",
409
- "data-ug-slot": "chevron"
410
- }
411
- )
412
- ] });
413
- const itemClassName = cn(
414
- "group relative flex min-w-0 items-center gap-2.5 px-[var(--control-padding-x-sm)] py-[calc(var(--control-height-sm)*0.18)] text-sm font-medium outline-none transition-all duration-150 [border-radius:var(--radius-control)] focus-visible:ring-2 focus-visible:ring-primary/35",
415
- effectiveCollapsed && "justify-center px-[calc(var(--control-padding-x-sm)*0.75)]",
416
- active ? styles.active : styles.inactive
417
- );
418
- return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("li", { "data-ug-slot": "item", "data-state": active ? "active" : "default", children: [
419
- hasChildren ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
420
- "button",
421
- {
422
- type: "button",
423
- className: cn("w-full", itemClassName),
424
- "aria-expanded": expanded,
425
- "aria-controls": childListId,
426
- title: effectiveCollapsed ? item.label : void 0,
427
- onClick: () => toggleExpanded(key),
428
- children: itemContent
429
- }
430
- ) : /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
431
- "a",
432
- {
433
- href: item.href ?? "#",
434
- "aria-current": item.active ? "page" : void 0,
435
- className: itemClassName,
436
- title: effectiveCollapsed ? item.label : void 0,
437
- onClick: closeMobile,
438
- children: itemContent
439
- }
440
- ),
441
- expanded && item.children ? renderItems(item.children, depth + 1, key, childListId) : null
442
- ] }, key);
443
- })
444
- }
445
- );
446
- }
447
- const sidebar = /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
448
- "aside",
449
- {
450
- ref,
451
- ...props,
452
- className: cn(
453
- "flex flex-col overflow-hidden transition-all duration-300",
454
- styles.container,
455
- effectiveCollapsed ? "w-[72px]" : "w-64",
456
- responsive && [
457
- "fixed inset-y-0 left-0 z-50 md:relative md:inset-auto md:z-auto",
458
- mobileOpen ? "translate-x-0" : "-translate-x-full md:translate-x-0"
459
- ],
460
- className
461
- ),
462
- "data-ug": "sidebar",
463
- "data-state": [
464
- effectiveCollapsed ? "collapsed" : "expanded",
465
- responsive && mobileOpen ? "mobile-open" : null
466
- ].filter(Boolean).join(" "),
467
- "data-variant": variant,
468
- "data-size": "md",
469
- children: [
470
- (header || collapsible || responsive && mobileOpen) && /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
471
- "div",
472
- {
473
- className: cn(
474
- "flex border-b px-[var(--control-padding-x-sm)] py-[calc(var(--content-gap)*0.75)]",
475
- styles.divider,
476
- effectiveCollapsed ? "justify-center" : "items-center gap-2"
477
- ),
478
- "data-ug-slot": "header",
479
- children: [
480
- !effectiveCollapsed && header ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: "min-w-0 flex-1", children: header }) : null,
481
- collapsible && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
482
- "button",
483
- {
484
- type: "button",
485
- className: "flex shrink-0 items-center justify-center border border-border-base bg-surface-2 text-text-secondary transition-colors [height:var(--control-height-md)] [width:var(--control-height-md)] [border-radius:var(--radius-control)] hover:border-primary/40 hover:text-text-primary",
486
- "aria-label": effectiveCollapsed ? "\u5C55\u5F00\u4FA7\u8FB9\u680F" : "\u6298\u53E0\u4FA7\u8FB9\u680F",
487
- "data-ug-slot": "toggle",
488
- onClick: () => setCollapsedState(!effectiveCollapsed),
489
- children: effectiveCollapsed ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_lucide_react2.PanelLeftOpen, { size: 17 }) : /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_lucide_react2.PanelLeftClose, { size: 17 })
490
- }
491
- ),
492
- responsive && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
493
- "button",
494
- {
495
- type: "button",
496
- className: "flex shrink-0 items-center justify-center border border-border-base bg-surface-2 text-text-secondary transition-colors [height:var(--control-height-md)] [width:var(--control-height-md)] [border-radius:var(--radius-control)] hover:border-primary/40 hover:text-text-primary md:hidden",
497
- "aria-label": "\u5173\u95ED\u4FA7\u8FB9\u680F",
498
- "data-ug-slot": "close",
499
- onClick: closeMobile,
500
- children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_lucide_react2.X, { size: 17 })
501
- }
502
- )
503
- ]
504
- }
505
- ),
506
- searchable && !effectiveCollapsed && /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: cn("border-b px-[var(--control-padding-x-sm)] py-[calc(var(--content-gap)*0.75)]", styles.divider), "data-ug-slot": "search", children: [
507
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("label", { className: "sr-only", htmlFor: searchId, children: "\u641C\u7D22\u83DC\u5355" }),
508
- /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "relative", children: [
509
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_lucide_react2.Search, { className: "pointer-events-none absolute left-3 top-1/2 -translate-y-1/2 text-text-tertiary [height:calc(var(--control-height-sm)*0.5)] [width:calc(var(--control-height-sm)*0.5)]", "aria-hidden": "true" }),
510
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
511
- "input",
512
- {
513
- id: searchId,
514
- value: query,
515
- onChange: (event) => setQuery(event.target.value),
516
- placeholder: searchPlaceholder,
517
- autoComplete: "off",
518
- className: "w-full border border-border-base bg-surface-0 px-[var(--control-padding-x-sm)] pl-9 pr-9 text-sm text-text-primary outline-none transition-colors [height:var(--control-height-md)] [border-radius:var(--radius-control)] placeholder:text-text-tertiary focus:border-primary focus:ring-2 focus:ring-primary/20",
519
- type: "text",
520
- role: "searchbox"
521
- }
522
- ),
523
- query ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
524
- "button",
525
- {
526
- type: "button",
527
- className: "absolute right-1 top-1/2 flex -translate-y-1/2 items-center justify-center text-text-tertiary transition-colors [height:var(--control-height-sm)] [width:var(--control-height-sm)] [border-radius:var(--radius-control)] hover:bg-surface-2 hover:text-text-primary",
528
- "aria-label": "\u6E05\u7A7A\u641C\u7D22",
529
- onClick: () => setQuery(""),
530
- children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_lucide_react2.X, { size: 14 })
531
- }
532
- ) : null
533
- ] })
534
- ] }),
535
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("nav", { className: "flex-1 overflow-y-auto py-3.5", "data-ug-slot": "nav", children: visibleItems.length > 0 ? renderItems(visibleItems) : /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("p", { className: "mx-3 border border-dashed border-border-base bg-surface-0 px-[var(--control-padding-x-sm)] py-[calc(var(--content-gap)*0.75)] text-sm text-text-tertiary [border-radius:var(--radius-panel)]", "data-ug-slot": "empty", children: "\u6CA1\u6709\u5339\u914D\u7684\u83DC\u5355" }) }),
536
- footer && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
537
- "div",
538
- {
539
- className: cn(
540
- "border-t px-[calc(var(--control-padding-x-sm)*0.8)] py-[calc(var(--content-gap)*0.75)]",
541
- styles.divider,
542
- effectiveCollapsed && "flex justify-center"
543
- ),
544
- "data-ug-slot": "footer",
545
- children: footer
546
- }
547
- )
548
- ]
549
- }
550
- );
551
- return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_jsx_runtime3.Fragment, { children: [
552
- responsive && mobileOpen ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
553
- "button",
554
- {
555
- type: "button",
556
- className: "fixed inset-0 z-40 bg-overlay md:hidden",
557
- "aria-label": "\u5173\u95ED\u4FA7\u8FB9\u680F\u906E\u7F69",
558
- "data-ug-slot": "overlay",
559
- onClick: closeMobile
560
- }
561
- ) : null,
562
- sidebar
563
- ] });
564
- }
565
- );
566
- Sidebar.displayName = "Sidebar";
567
-
568
- // src/patterns/admin-shell.tsx
569
- var import_jsx_runtime4 = require("react/jsx-runtime");
570
- var AdminShell = (0, import_react5.forwardRef)(
571
- ({
572
- navItems,
573
- sidebarHeader,
574
- sidebarFooter,
575
- sidebarVariant = "dark",
576
- sidebarSearchable = false,
577
- sidebarCollapsible = true,
578
- sidebarCollapsed,
579
- defaultSidebarCollapsed = false,
580
- onSidebarCollapsedChange,
581
- mobileSidebarOpen,
582
- onMobileSidebarOpenChange,
583
- topbarStart,
584
- topbarEnd,
585
- topbar,
586
- mainClassName,
587
- contentClassName,
588
- children,
589
- className,
590
- ...props
591
- }, ref) => {
592
- const [internalMobileOpen, setInternalMobileOpen] = (0, import_react5.useState)(false);
593
- const effectiveMobileOpen = mobileSidebarOpen ?? internalMobileOpen;
594
- function setMobileOpen(open) {
595
- if (mobileSidebarOpen === void 0) {
596
- setInternalMobileOpen(open);
597
- }
598
- onMobileSidebarOpenChange?.(open);
599
- }
600
- return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
601
- "div",
602
- {
603
- ref,
604
- className: cn("min-h-screen bg-surface-0 text-text-primary", className),
605
- ...props,
606
- "data-ug": "admin-shell",
607
- "data-state": effectiveMobileOpen ? "mobile-open" : "default",
608
- "data-variant": sidebarVariant,
609
- "data-size": "md",
610
- children: /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "flex min-h-screen min-w-0", children: [
611
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
612
- Sidebar,
613
- {
614
- items: navItems,
615
- variant: sidebarVariant,
616
- header: sidebarHeader,
617
- footer: sidebarFooter,
618
- searchable: sidebarSearchable,
619
- collapsible: sidebarCollapsible,
620
- collapsed: sidebarCollapsed,
621
- defaultCollapsed: defaultSidebarCollapsed,
622
- onCollapsedChange: onSidebarCollapsedChange,
623
- responsive: true,
624
- mobileOpen: effectiveMobileOpen,
625
- onMobileOpenChange: setMobileOpen,
626
- className: "shrink-0",
627
- "data-ug-slot": "sidebar"
628
- }
629
- ),
630
- /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "flex min-w-0 flex-1 flex-col", children: [
631
- /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
632
- "header",
633
- {
634
- className: "sticky top-0 z-30 flex min-h-[var(--control-height-lg)] items-center gap-[calc(var(--content-gap)*0.75)] border-b border-border-base bg-surface-0/95 px-[var(--content-gap)] backdrop-blur sm:px-[calc(var(--content-gap)*1.25)] lg:px-[calc(var(--content-gap)*1.5)]",
635
- "data-ug-slot": "topbar",
636
- children: [
637
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
638
- Button,
639
- {
640
- type: "button",
641
- variant: "ghost",
642
- size: "icon",
643
- className: "md:hidden",
644
- "aria-label": "\u6253\u5F00\u4FA7\u8FB9\u680F",
645
- onClick: () => setMobileOpen(true),
646
- "data-ug-slot": "mobile-trigger",
647
- children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_lucide_react3.Menu, { "aria-hidden": "true", focusable: "false", size: 18 })
648
- }
649
- ),
650
- topbar ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: "min-w-0 flex-1", "data-ug-slot": "topbar-content", children: topbar }) : /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_jsx_runtime4.Fragment, { children: [
651
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: "min-w-0 flex-1", "data-ug-slot": "topbar-start", children: topbarStart }),
652
- topbarEnd ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: "flex shrink-0 items-center gap-[calc(var(--content-gap)*0.5)]", "data-ug-slot": "topbar-end", children: topbarEnd }) : null
653
- ] })
654
- ]
655
- }
656
- ),
657
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("main", { className: cn("min-w-0 flex-1 overflow-x-clip", mainClassName), "data-ug-slot": "main", children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
658
- "div",
659
- {
660
- className: cn("mx-auto w-full max-w-7xl px-[var(--content-gap)] py-[calc(var(--content-gap)*1.5)] sm:px-[calc(var(--content-gap)*1.25)] lg:px-[calc(var(--content-gap)*1.5)]", contentClassName),
661
- "data-ug-slot": "content",
662
- children
663
- }
664
- ) })
665
- ] })
666
- ] })
667
- }
668
- );
669
- }
670
- );
671
- AdminShell.displayName = "AdminShell";
672
-
673
- // src/patterns/confirm-dialog.tsx
674
- var import_react11 = require("react");
675
- var import_lucide_react5 = require("lucide-react");
676
-
677
- // src/components/modal.tsx
678
- var import_react10 = require("react");
679
- var import_react_dom = require("react-dom");
680
- var import_lucide_react4 = require("lucide-react");
681
-
682
- // src/hooks/use-escape-key.ts
683
- var import_react6 = require("react");
684
- var import_overlay = require("@ug666/ui-web/overlay");
685
- function useEscapeKey(open, onEscape) {
686
- const handleEscape = (0, import_react6.useCallback)(
687
- (e) => {
688
- if (e.key === "Escape") onEscape();
689
- },
690
- [onEscape]
691
- );
692
- (0, import_react6.useEffect)(() => {
693
- if (!open || typeof document === "undefined") return;
694
- const releaseScrollLock = (0, import_overlay.acquireBodyScrollLock)();
695
- const releaseEscapeHandler = (0, import_overlay.registerEscapeKeyHandler)(handleEscape);
696
- return () => {
697
- releaseEscapeHandler();
698
- releaseScrollLock();
699
- };
700
- }, [open, handleEscape]);
701
- }
702
-
703
- // src/internal/use-portal-container.ts
704
- var import_react7 = require("react");
705
- function usePortalContainer() {
706
- const [container, setContainer] = (0, import_react7.useState)(null);
707
- (0, import_react7.useEffect)(() => {
708
- if (typeof document === "undefined") return;
709
- setContainer(document.body);
710
- }, []);
711
- return container;
712
- }
713
-
714
- // src/internal/use-overlay-focus.ts
715
- var import_react8 = require("react");
716
- var import_overlay2 = require("@ug666/ui-web/overlay");
717
- function useOverlayFocus(open, containerRef) {
718
- const previousFocusRef = (0, import_react8.useRef)(null);
719
- (0, import_react8.useEffect)(() => {
720
- if (!open || typeof document === "undefined") return;
721
- previousFocusRef.current = document.activeElement instanceof HTMLElement ? document.activeElement : null;
722
- (0, import_overlay2.focusFirstElement)(containerRef.current);
723
- return () => {
724
- previousFocusRef.current?.focus();
725
- previousFocusRef.current = null;
726
- };
727
- }, [containerRef, open]);
728
- return (0, import_react8.useCallback)(
729
- (event) => {
730
- (0, import_overlay2.trapTabKey)(event, containerRef.current);
731
- },
732
- [containerRef]
733
- );
734
- }
735
-
736
- // src/theme.ts
737
- var import_react9 = require("react");
738
- var import_theme = require("@ug666/ui-core/theme");
739
- var import_theme2 = require("@ug666/ui-web/theme");
740
- var UGThemeContext = (0, import_react9.createContext)(import_theme.defaultUGTheme);
741
- function useUGTheme() {
742
- return (0, import_react9.useContext)(UGThemeContext);
743
- }
744
- var UGThemeProvider = (0, import_react9.forwardRef)(
745
- ({
746
- preset = import_theme.defaultUGTheme.preset,
747
- mode = import_theme.defaultUGTheme.mode,
748
- surface = import_theme.defaultUGTheme.surface,
749
- density = import_theme.defaultUGTheme.density,
750
- radius = import_theme.defaultUGTheme.radius,
751
- shadow = import_theme.defaultUGTheme.shadow,
752
- font = import_theme.defaultUGTheme.font,
753
- contrast = import_theme.defaultUGTheme.contrast,
754
- motion = import_theme.defaultUGTheme.motion,
755
- background = import_theme.defaultUGTheme.background,
756
- accent = import_theme.defaultUGTheme.accent,
757
- children,
758
- ...props
759
- }, ref) => {
760
- const value = {
761
- preset,
762
- mode,
763
- surface,
764
- density,
765
- radius,
766
- shadow,
767
- font,
768
- contrast,
769
- motion,
770
- background,
771
- accent
772
- };
773
- return (0, import_react9.createElement)(
774
- UGThemeContext.Provider,
775
- { value },
776
- (0, import_react9.createElement)("div", {
777
- ...props,
778
- ...(0, import_theme2.getUGThemeDataAttributes)(value),
779
- ref,
780
- children
781
- })
782
- );
783
- }
784
- );
785
- UGThemeProvider.displayName = "UGThemeProvider";
786
- var UGThemeScope = (0, import_react9.forwardRef)(
787
- ({
788
- preset,
789
- mode,
790
- surface,
791
- density,
792
- radius,
793
- shadow,
794
- font,
795
- contrast,
796
- motion,
797
- background,
798
- accent,
799
- children,
800
- ...props
801
- }, ref) => {
802
- const parent = useUGTheme();
803
- const value = (0, import_theme.createUGThemeValue)(parent, {
804
- preset,
805
- mode,
806
- surface,
807
- density,
808
- radius,
809
- shadow,
810
- font,
811
- contrast,
812
- motion,
813
- background,
814
- accent
815
- });
816
- return (0, import_react9.createElement)(
817
- UGThemeContext.Provider,
818
- { value },
819
- (0, import_react9.createElement)("div", {
820
- ...props,
821
- ...(0, import_theme2.getUGThemeDataAttributes)(value),
822
- ref,
823
- children
824
- })
825
- );
826
- }
827
- );
828
- UGThemeScope.displayName = "UGThemeScope";
829
- var UGThemeSurface = (0, import_react9.forwardRef)(
830
- ({ surface = "workspace", density, radius, shadow, font, contrast, motion, background, accent, children, ...props }, ref) => {
831
- const parent = useUGTheme();
832
- const value = (0, import_theme.createUGThemeValue)(parent, {
833
- surface,
834
- density,
835
- radius,
836
- shadow,
837
- font,
838
- contrast,
839
- motion,
840
- background,
841
- accent
842
- });
843
- return (0, import_react9.createElement)(
844
- UGThemeContext.Provider,
845
- { value },
846
- (0, import_react9.createElement)("div", {
847
- ...props,
848
- ...(0, import_theme2.getUGThemeDataAttributes)(value),
849
- ref,
850
- children
851
- })
852
- );
853
- }
854
- );
855
- UGThemeSurface.displayName = "UGThemeSurface";
856
-
857
- // src/components/modal.tsx
858
- var import_jsx_runtime5 = require("react/jsx-runtime");
859
- var ModalContext = (0, import_react10.createContext)(null);
860
- function useModalContext() {
861
- const context = (0, import_react10.useContext)(ModalContext);
862
- if (!context) throw new Error("Modal \u5B50\u7EC4\u4EF6\u5FC5\u987B\u5728 <Modal> \u5185\u4F7F\u7528");
863
- return context;
864
- }
865
- var Modal = (0, import_react10.forwardRef)(({ open, onClose, children, className, ariaLabel = "\u5BF9\u8BDD\u6846" }, ref) => {
866
- useEscapeKey(open, onClose);
867
- const portalContainer = usePortalContainer();
868
- const dialogRef = (0, import_react10.useRef)(null);
869
- const titleId = `ug-modal-title-${(0, import_react10.useId)().replace(/:/g, "")}`;
870
- const handleFocusKeyDown = useOverlayFocus(open && Boolean(portalContainer), dialogRef);
871
- const themeScope = useUGTheme();
872
- const themeAttributes = (0, import_theme2.getUGThemeDataAttributes)(themeScope);
873
- if (!open || !portalContainer) return null;
874
- return (0, import_react_dom.createPortal)(
875
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(ModalContext.Provider, { value: { onClose, titleId }, children: /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
876
- "div",
877
- {
878
- ref: (node) => {
879
- dialogRef.current = node;
880
- if (typeof ref === "function") ref(node);
881
- else if (ref) ref.current = node;
882
- },
883
- ...themeAttributes,
884
- className: cn(
885
- "fixed inset-0 z-[80] flex items-center justify-center p-[var(--content-gap)]",
886
- className
887
- ),
888
- role: "dialog",
889
- "aria-modal": "true",
890
- "aria-label": ariaLabel,
891
- "aria-labelledby": titleId,
892
- tabIndex: -1,
893
- onKeyDown: handleFocusKeyDown,
894
- "data-ug": "modal",
895
- "data-state": "open",
896
- "data-variant": "default",
897
- "data-size": "md",
898
- children: [
899
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
900
- "div",
901
- {
902
- className: "absolute inset-0 bg-overlay",
903
- onClick: onClose,
904
- "aria-hidden": "true",
905
- "data-ug-slot": "overlay"
906
- }
907
- ),
908
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "relative z-10", children })
909
- ]
910
- }
911
- ) }),
912
- portalContainer
913
- );
914
- });
915
- var ModalContent = (0, import_react10.forwardRef)(({ className, maxWidth = "max-w-lg", children, ...props }, ref) => {
916
- return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { ref, ...props, className: cn("flex max-h-[85vh] w-full flex-col rounded-[var(--radius-overlay)] border border-border-base bg-surface-1 shadow-xl", maxWidth, className), "data-ug-slot": "content", children });
917
- });
918
- var ModalHeader = (0, import_react10.forwardRef)(({ className, ...props }, ref) => {
919
- return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { ref, ...props, className: cn("flex shrink-0 items-center justify-between border-b border-border-base p-[var(--content-gap)]", className), "data-ug-slot": "header" });
920
- });
921
- var ModalTitle = (0, import_react10.forwardRef)(({ className, ...props }, ref) => {
922
- const { titleId } = useModalContext();
923
- return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("h2", { ref, ...props, id: titleId, className: cn("text-lg font-semibold text-text-primary", className), "data-ug-slot": "title" });
924
- });
925
- var ModalFooter = (0, import_react10.forwardRef)(({ className, ...props }, ref) => {
926
- return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { ref, ...props, className: cn("flex shrink-0 items-center justify-end gap-2 border-t border-border-base p-[var(--content-gap)]", className), "data-ug-slot": "footer" });
927
- });
928
- var ModalCloseButton = (0, import_react10.forwardRef)(({ onClick, className, type = "button", ...props }, ref) => {
929
- const { onClose } = useModalContext();
930
- return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
931
- "button",
932
- {
933
- ref,
934
- type,
935
- onClick: (event) => {
936
- onClose();
937
- onClick?.(event);
938
- },
939
- className: cn(
940
- "rounded-[var(--radius-control)] p-[calc(var(--content-gap)*0.25)] text-text-tertiary transition-colors hover:bg-surface-3 hover:text-text-secondary",
941
- className
942
- ),
943
- "aria-label": "\u5173\u95ED",
944
- "data-ug-slot": "close",
945
- ...props,
946
- children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_lucide_react4.X, { size: 18 })
947
- }
948
- );
949
- });
950
- Modal.displayName = "Modal";
951
- ModalContent.displayName = "ModalContent";
952
- ModalHeader.displayName = "ModalHeader";
953
- ModalTitle.displayName = "ModalTitle";
954
- ModalFooter.displayName = "ModalFooter";
955
- ModalCloseButton.displayName = "ModalCloseButton";
956
-
957
- // src/patterns/confirm-dialog.tsx
958
- var import_jsx_runtime6 = require("react/jsx-runtime");
959
- var ConfirmDialog = (0, import_react11.forwardRef)(
960
- ({
961
- open,
962
- onOpenChange,
963
- title,
964
- description,
965
- children,
966
- variant = "destructive",
967
- icon,
968
- cancelText = "\u53D6\u6D88",
969
- confirmText = "\u786E\u8BA4",
970
- loading = false,
971
- disabled = false,
972
- closeOnConfirm = true,
973
- onCancel,
974
- onConfirm,
975
- className,
976
- ...props
977
- }, ref) => {
978
- const Icon = icon ?? (variant === "destructive" ? import_lucide_react5.AlertTriangle : import_lucide_react5.HelpCircle);
979
- function handleCancel() {
980
- onCancel?.();
981
- onOpenChange(false);
982
- }
983
- function handleConfirm() {
984
- const result = onConfirm?.();
985
- if (closeOnConfirm) onOpenChange(false);
986
- return result;
987
- }
988
- return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Modal, { open, onClose: handleCancel, children: /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
989
- ModalContent,
990
- {
991
- ref,
992
- className: cn("max-w-md", className),
993
- ...props,
994
- "data-ug": "confirm-dialog",
995
- "data-state": open ? "open" : "default",
996
- "data-variant": variant,
997
- "data-size": "md",
998
- children: [
999
- /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(ModalHeader, { className: "items-start gap-[calc(var(--content-gap)*0.75)]", "data-ug-slot": "header", children: [
1000
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
1001
- "div",
1002
- {
1003
- className: cn(
1004
- "flex h-[var(--control-height-md)] w-[var(--control-height-md)] shrink-0 items-center justify-center rounded-[var(--radius-control)]",
1005
- variant === "destructive" ? "bg-danger-soft text-danger-soft-fg" : "bg-primary-soft text-primary-soft-fg"
1006
- ),
1007
- "data-ug-slot": "icon",
1008
- children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Icon, { size: 20, "aria-hidden": "true" })
1009
- }
1010
- ),
1011
- /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "min-w-0 flex-1 space-y-[calc(var(--content-gap)*0.25)]", "data-ug-slot": "content", children: [
1012
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(ModalTitle, { className: "break-words text-base", "data-ug-slot": "title", children: title }),
1013
- description ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("p", { className: "text-sm leading-6 text-text-secondary", "data-ug-slot": "description", children: description }) : null
1014
- ] })
1015
- ] }),
1016
- children ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: "px-[var(--content-gap)] py-[var(--content-gap)] text-sm text-text-secondary", "data-ug-slot": "body", children }) : null,
1017
- /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(ModalFooter, { className: "flex-col-reverse gap-[calc(var(--content-gap)*0.5)] sm:flex-row", "data-ug-slot": "footer", children: [
1018
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Button, { type: "button", variant: "outline", disabled: loading, onClick: handleCancel, "data-ug-slot": "cancel", children: cancelText }),
1019
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
1020
- Button,
1021
- {
1022
- type: "button",
1023
- variant: variant === "destructive" ? "destructive" : "default",
1024
- loading,
1025
- disabled,
1026
- onClick: handleConfirm,
1027
- "data-ug-slot": "confirm",
1028
- children: confirmText
1029
- }
1030
- )
1031
- ] })
1032
- ]
1033
- }
1034
- ) });
1035
- }
1036
- );
1037
- ConfirmDialog.displayName = "ConfirmDialog";
1038
-
1039
- // src/patterns/copy-field.tsx
1040
- var import_react12 = require("react");
1041
- var import_lucide_react6 = require("lucide-react");
1042
- var import_jsx_runtime7 = require("react/jsx-runtime");
1043
- var CopyField = (0, import_react12.forwardRef)(
1044
- ({
1045
- value,
1046
- label,
1047
- displayValue,
1048
- monospace = true,
1049
- disabled = false,
1050
- copyLabel = "\u590D\u5236",
1051
- copiedLabel = "\u5DF2\u590D\u5236",
1052
- onCopied,
1053
- onCopyError,
1054
- className,
1055
- ...props
1056
- }, ref) => {
1057
- const [copied, setCopied] = (0, import_react12.useState)(false);
1058
- const timeoutRef = (0, import_react12.useRef)(null);
1059
- (0, import_react12.useEffect)(() => {
1060
- return () => {
1061
- if (timeoutRef.current) clearTimeout(timeoutRef.current);
1062
- };
1063
- }, []);
1064
- (0, import_react12.useEffect)(() => {
1065
- setCopied(false);
1066
- if (timeoutRef.current) {
1067
- clearTimeout(timeoutRef.current);
1068
- timeoutRef.current = null;
1069
- }
1070
- }, [value]);
1071
- async function handleCopy() {
1072
- if (disabled) return;
1073
- try {
1074
- if (!navigator.clipboard?.writeText) {
1075
- throw new Error("Clipboard API is not available");
1076
- }
1077
- await navigator.clipboard.writeText(value);
1078
- setCopied(true);
1079
- onCopied?.(value);
1080
- if (timeoutRef.current) clearTimeout(timeoutRef.current);
1081
- timeoutRef.current = setTimeout(() => setCopied(false), 1400);
1082
- } catch (error) {
1083
- onCopyError?.(error);
1084
- }
1085
- }
1086
- return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
1087
- "div",
1088
- {
1089
- ref,
1090
- className: cn("space-y-[calc(var(--content-gap)*0.5)]", className),
1091
- ...props,
1092
- "data-ug": "copy-field",
1093
- "data-state": disabled ? "disabled" : copied ? "copied" : "default",
1094
- "data-variant": monospace ? "monospace" : "default",
1095
- "data-size": "md",
1096
- children: [
1097
- label ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "text-xs font-medium text-text-secondary", "data-ug-slot": "label", children: label }) : null,
1098
- /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
1099
- "div",
1100
- {
1101
- className: cn(
1102
- "flex min-w-0 items-stretch overflow-hidden rounded-[var(--radius-control)] border border-border-base bg-surface-1",
1103
- disabled && "opacity-60"
1104
- ),
1105
- "data-ug-slot": "field",
1106
- children: [
1107
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
1108
- "div",
1109
- {
1110
- className: cn(
1111
- "min-w-0 flex-1 truncate px-[var(--control-padding-x-sm)] py-[calc(var(--content-gap)*0.5)] text-sm text-text-primary",
1112
- monospace && "font-mono"
1113
- ),
1114
- title: typeof displayValue === "string" ? displayValue : value,
1115
- "data-ug-slot": "value",
1116
- children: displayValue ?? value
1117
- }
1118
- ),
1119
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "flex shrink-0 items-center border-l border-border-base bg-surface-2 px-[calc(var(--content-gap)*0.375)]", "data-ug-slot": "action", children: /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
1120
- Button,
1121
- {
1122
- type: "button",
1123
- variant: "ghost",
1124
- size: "sm",
1125
- disabled,
1126
- onClick: handleCopy,
1127
- "aria-live": "polite",
1128
- "data-ug-slot": "button",
1129
- children: [
1130
- copied ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_lucide_react6.Check, { "aria-hidden": "true", focusable: "false", size: 15 }) : /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_lucide_react6.Copy, { "aria-hidden": "true", focusable: "false", size: 15 }),
1131
- copied ? copiedLabel : copyLabel
1132
- ]
1133
- }
1134
- ) })
1135
- ]
1136
- }
1137
- )
1138
- ]
1139
- }
1140
- );
1141
- }
1142
- );
1143
- CopyField.displayName = "CopyField";
1144
-
1145
- // src/patterns/page-header.tsx
1146
- var import_react13 = require("react");
1147
- var import_jsx_runtime8 = require("react/jsx-runtime");
1148
- var PageHeader = (0, import_react13.forwardRef)(
1149
- ({
1150
- eyebrow,
1151
- title,
1152
- description,
1153
- badge,
1154
- breadcrumb,
1155
- actions,
1156
- meta,
1157
- children,
1158
- className,
1159
- ...props
1160
- }, ref) => {
1161
- return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
1162
- "header",
1163
- {
1164
- ref,
1165
- className: cn(
1166
- "flex min-w-0 flex-col gap-[calc(var(--content-gap)*1.25)] border-b border-border-base pb-[calc(var(--content-gap)*1.5)]",
1167
- className
1168
- ),
1169
- ...props,
1170
- "data-ug": "page-header",
1171
- "data-state": "default",
1172
- "data-variant": "default",
1173
- "data-size": "md",
1174
- children: [
1175
- breadcrumb ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: "min-w-0", "data-ug-slot": "breadcrumb", children: breadcrumb }) : null,
1176
- /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "flex min-w-0 flex-col gap-[var(--content-gap)] lg:flex-row lg:items-start lg:justify-between", "data-ug-slot": "body", children: [
1177
- /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "min-w-0 space-y-[calc(var(--content-gap)*0.75)]", "data-ug-slot": "content", children: [
1178
- eyebrow ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: "text-xs font-semibold uppercase text-primary", "data-ug-slot": "eyebrow", children: eyebrow }) : null,
1179
- /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "flex min-w-0 flex-wrap items-center gap-[calc(var(--content-gap)*0.625)]", children: [
1180
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("h1", { className: "min-w-0 break-words text-2xl font-bold leading-tight text-text-primary sm:text-3xl", "data-ug-slot": "title", children: title }),
1181
- badge ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: "shrink-0", "data-ug-slot": "badge", children: badge }) : null
1182
- ] }),
1183
- description ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("p", { className: "max-w-3xl text-sm leading-6 text-text-secondary", "data-ug-slot": "description", children: description }) : null,
1184
- meta ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: "flex min-w-0 flex-wrap items-center gap-x-[var(--content-gap)] gap-y-[calc(var(--content-gap)*0.5)] text-xs text-text-tertiary", "data-ug-slot": "meta", children: meta }) : null
1185
- ] }),
1186
- actions ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: "flex shrink-0 flex-wrap items-center gap-[calc(var(--content-gap)*0.5)] lg:justify-end", "data-ug-slot": "actions", children: actions }) : null
1187
- ] }),
1188
- children ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: "min-w-0", "data-ug-slot": "footer", children }) : null
1189
- ]
1190
- }
1191
- );
1192
- }
1193
- );
1194
- PageHeader.displayName = "PageHeader";
1195
- // Annotate the CommonJS export names for ESM import in node:
1196
- 0 && (module.exports = {
1197
- AdminShell,
1198
- ConfirmDialog,
1199
- CopyField,
1200
- PageHeader,
1201
- UGAdminShell,
1202
- UGConfirmDialog,
1203
- UGCopyField,
1204
- UGPageHeader
1205
- });
1206
- //# sourceMappingURL=index.cjs.map
1
+ "use strict";function _nullishCoalesce(e,a){return null!=e?e:a()}function _optionalChain(e){let a,l=e[0],t=1;for(;t<e.length;){const i=e[t],o=e[t+1];if(t+=2,("optionalAccess"===i||"optionalCall"===i)&&null==l)return;"access"===i||"optionalAccess"===i?(a=l,l=o(l)):"call"!==i&&"optionalCall"!==i||(l=o((...e)=>l.call(a,...e)),a=void 0)}return l}Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../chunk-JY5S7YLF.cjs");require("../chunk-2EJWWTLH.cjs");var a=require("../chunk-X4EMYHLY.cjs"),l=require("../chunk-J4NAYP4L.cjs"),t=require("../chunk-XVFRKGM7.cjs"),i=require("react"),o=require("@ug666/ui-core"),n=require("lucide-react"),s=require("react/jsx-runtime"),r=i.forwardRef.call(void 0,({options:a,value:r,defaultValue:d=[],onValueChange:c,searchable:u=!0,searchPlaceholder:v="搜索选项",emptyLabel:g="没有匹配项",disabled:h,size:p,name:m,form:x,layout:b="stack",collapsibleGroups:f=!1,expandedGroups:j,defaultExpandedGroups:w,onExpandedGroupsChange:C,showSelectAll:y=!0,showSummary:N=!0,showGroupCount:k=!0,className:S,...T},z)=>{const _=t.useUIConfig.call(void 0),A=i.useId.call(void 0),R=i.useRef.call(void 0,null),[M,L]=i.useState.call(void 0,[...d]),[I,D]=i.useState.call(void 0,""),E=i.useRef.call(void 0,{value:r,defaultValue:d});E.current={value:r,defaultValue:d};const[B,F]=i.useState.call(void 0,()=>void 0===w?[]:o.groupSelectionListOptions.call(void 0,a).filter(e=>!w.includes(e.key)).map(e=>e.key)),G=_nullishCoalesce(r,()=>M),V=t.resolveDisabled.call(void 0,h,_.disabled),$=t.resolveControlSize.call(void 0,p,_.size),P=o.filterSelectionListOptions.call(void 0,a,u?I:""),U=o.groupSelectionListOptions.call(void 0,P),O=o.getSelectionListScope.call(void 0,P,G),W=o.groupSelectionListOptions.call(void 0,a),H=_nullishCoalesce(j,()=>W.filter(e=>!B.includes(e.key)).map(e=>e.key)),q=u&&I.trim().length>0,Q=U.every(e=>H.includes(e.key));function changeExpanded(e){void 0===j&&F(W.filter(a=>!e.includes(a.key)).map(e=>e.key)),_optionalChain([C,"optionalCall",a=>a(e)])}function change(e){V||(void 0===r&&L(e),_optionalChain([c,"optionalCall",a=>a(e)]))}return i.useEffect.call(void 0,()=>{const e=x?document.getElementById(x):_optionalChain([R,"access",e=>e.current,"optionalAccess",e=>e.closest,"call",e=>e("form")]);if(!e)return;const a=new Set;function reset(e){const l=setTimeout(()=>{a.delete(l),e.defaultPrevented||(void 0===E.current.value&&L([...E.current.defaultValue]),D(""))},0);a.add(l)}return e.addEventListener("reset",reset),()=>{e.removeEventListener("reset",reset),a.forEach(clearTimeout)}},[x]),s.jsxs.call(void 0,"div",{...T,ref:e=>{R.current=e,"function"==typeof z?z(e):z&&(z.current=e)},className:t.cn.call(void 0,"grid min-w-0 gap-[var(--content-gap)] text-text-primary",S),"data-ug":"selection-list","data-ug-slot":"root","data-size":$,"data-layout":b,"data-state":V?"disabled":0===P.length?"empty":"default","data-variant":"grouped",role:"group","aria-label":_nullishCoalesce(T["aria-label"],()=>"选项列表"),"aria-disabled":V||void 0,children:[u?s.jsx.call(void 0,"div",{"data-ug-slot":"search",children:s.jsx.call(void 0,l.Input,{value:I,onValueChange:D,clearable:!0,"aria-label":v,placeholder:v,size:$,disabled:V})}):null,y||N?s.jsxs.call(void 0,"div",{"data-ug-slot":"bulk",className:"flex flex-wrap items-center justify-between gap-[calc(var(--content-gap)*0.5)]",children:[y?s.jsx.call(void 0,e.Checkbox,{checked:O.checked,indeterminate:O.indeterminate,size:$,disabled:V||0===O.available,"aria-describedby":N?`${A}-summary`:void 0,onCheckedChange:e=>change(o.updateSelectionListScope.call(void 0,G,P,e)),label:"全选当前结果"}):null,N?s.jsxs.call(void 0,"span",{id:`${A}-summary`,"data-ug-slot":"summary",className:"text-xs text-text-secondary","aria-live":"polite",children:["已选 ",new Set(G).size," 项;当前 ",O.total," 项,",O.available," 项可操作",O.disabled>0?`,${O.disabled} 项不可操作`:""]}):null]}):null,f?s.jsxs.call(void 0,"div",{"data-ug-slot":"group-actions",children:[s.jsx.call(void 0,t.Button,{type:"button",size:"default",variant:"ghost",disabled:q||0===U.length,title:q?"清空搜索后可折叠分组":void 0,onClick:()=>changeExpanded(Q?H.filter(e=>!U.some(a=>a.key===e)):[...new Set([...H,...U.map(e=>e.key)])]),children:Q?"全部收起":"全部展开"}),q?s.jsx.call(void 0,"span",{"data-ug-slot":"search-hint",children:"搜索时展开匹配分组"}):null]}):null,s.jsxs.call(void 0,"div",{"data-ug-slot":"groups",className:"grid min-w-0 gap-[var(--content-gap)]",children:[U.map(a=>{const l=o.getSelectionListScope.call(void 0,a.options,G),i=!f||q||H.includes(a.key),r=`${A}-group-${encodeURIComponent(a.key)}`;return s.jsxs.call(void 0,e.Fieldset,{variant:"card",size:"sm","data-ug-slot":"group",children:[s.jsx.call(void 0,e.FieldsetLegend,{children:a.label}),s.jsxs.call(void 0,"div",{"data-ug-slot":"group-heading",className:"flex flex-wrap items-center justify-between gap-[calc(var(--content-gap)*0.5)]",children:[s.jsx.call(void 0,e.Checkbox,{checked:l.checked,indeterminate:l.indeterminate,size:$,disabled:V||0===l.available,onCheckedChange:e=>change(o.updateSelectionListScope.call(void 0,G,a.options,e)),label:`全选${a.label}`}),k?s.jsxs.call(void 0,"span",{"data-ug-slot":"group-count",className:"text-xs text-text-secondary",children:["已选 ",l.selected,"/",l.total,l.disabled>0?`,${l.disabled} 项不可操作`:""]}):null,f?s.jsx.call(void 0,t.Button,{type:"button",variant:"ghost",size:"icon",disabled:q,className:k?void 0:"ml-auto","aria-label":`${i?"收起":"展开"}${a.label}选项`,"aria-expanded":i,"aria-controls":r,title:q?"清空搜索后可折叠分组":`${i?"收起":"展开"}${a.label}选项`,onClick:()=>changeExpanded(i?H.filter(e=>e!==a.key):[...H,a.key]),children:i?s.jsx.call(void 0,n.ChevronDown,{size:16,"aria-hidden":"true"}):s.jsx.call(void 0,n.ChevronRight,{size:16,"aria-hidden":"true"})}):null]}),s.jsx.call(void 0,"div",{id:r,"data-ug-slot":"options",hidden:!i,children:s.jsx.call(void 0,e.CheckboxGroup,{value:G,disabled:V,size:$,orientation:"vertical","aria-label":`${a.label}选项`,onValueChange:e=>change(e.map(String)),children:a.options.map(a=>s.jsx.call(void 0,e.Checkbox,{value:a.id,disabled:a.disabled,"aria-label":a.label,"aria-describedby":[a.description&&`${A}-description-${encodeURIComponent(a.id)}`,a.disabled&&`${A}-locked-${encodeURIComponent(a.id)}`].filter(Boolean).join(" ")||void 0,label:s.jsxs.call(void 0,"span",{"data-ug-slot":"option-label",className:"grid min-w-0 [overflow-wrap:anywhere]",children:[s.jsxs.call(void 0,"span",{children:[a.label,a.disabled?s.jsx.call(void 0,"span",{id:`${A}-locked-${encodeURIComponent(a.id)}`,"data-ug-slot":"locked",className:"ml-1 text-xs text-text-secondary",children:"(不可操作)"}):null]}),a.description?s.jsx.call(void 0,"span",{id:`${A}-description-${encodeURIComponent(a.id)}`,"data-ug-slot":"option-description",className:"text-xs text-text-secondary",children:a.description}):null]})},a.id))})})]},a.key)}),0===P.length?s.jsx.call(void 0,"p",{"data-ug-slot":"empty",className:"text-sm text-text-secondary",role:"status",children:g}):null]}),m?[...new Set(G)].map(e=>s.jsx.call(void 0,"input",{type:"hidden",name:m,form:x,value:e,disabled:V},e)):null]})});r.displayName="SelectionList";var d=require("@ug666/ui-web");function DataTableHeader({headers:a,layout:l,widths:r,offset:d,selection:c,actions:u,sort:v,order:g,onSortChange:h,reorderable:p,move:m}){const x=i.useRef.call(void 0,void 0);return s.jsx.call(void 0,e.TableHeader,{children:a.map((i,b)=>s.jsxs.call(void 0,e.TableRow,{children:[0===b&&null!=c&&s.jsx.call(void 0,e.TableHead,{rowSpan:a.length,scope:"col","data-leaf-index":0,className:"text-center","data-fixed":o.getTableColumnFixed.call(void 0,l[0]),style:o.getTableColumnStyle.call(void 0,l,0,r),children:c}),i.map(a=>{const{column:i,leafIndex:c,colSpan:u,rowSpan:b,siblingIds:f}=a,j=c+d,w=l.slice(j,j+u),C=o.getTableColumnFixed.call(void 0,w[0]),y=w.every(e=>o.getTableColumnFixed.call(void 0,e)===C),N=o.getTableColumnStyle.call(void 0,l,"right"===C?j+u-1:j,r),k=f.indexOf(i.id),S=_nullishCoalesce(i.sortLabel,()=>"string"==typeof i.header||"number"==typeof i.header?String(i.header):i.id),T=Boolean(_optionalChain([i,"access",e=>e.children,"optionalAccess",e=>e.length]));return s.jsx.call(void 0,e.TableHead,{scope:T?"colgroup":"col",colSpan:u,rowSpan:b,"data-leaf-index":T?void 0:j,"data-fixed":y?C:void 0,style:T?{...N,width:void 0,minWidth:void 0}:N,className:i.className,"aria-sort":!T&&i.sortable&&v===i.id?"asc"===g?"ascending":"descending":void 0,draggable:p||void 0,onDragStart:e=>{x.current=i.id,e.dataTransfer.setData("text/plain",i.id),e.dataTransfer.effectAllowed="move"},onDragEnd:()=>{x.current=void 0},onDragOver:e=>{p&&x.current&&f.includes(x.current)&&e.preventDefault()},onDrop:e=>{p&&x.current&&f.includes(x.current)&&(e.preventDefault(),m(x.current,i.id),x.current=void 0)},children:s.jsxs.call(void 0,"span",{"data-ug-slot":"header",className:"contents",children:[!T&&i.sortable&&h?s.jsxs.call(void 0,t.Button,{"aria-label":`按${S}排序`,style:{fontWeight:"inherit"},type:"button",size:"sm",tone:"neutral",variant:"text",onClick:()=>h(i.id,v===i.id&&"asc"===g?"desc":"asc"),children:[i.header,v!==i.id?s.jsx.call(void 0,n.ArrowUpDown,{"aria-hidden":!0,size:14}):"asc"===g?s.jsx.call(void 0,n.ArrowUp,{"aria-hidden":!0,size:14}):s.jsx.call(void 0,n.ArrowDown,{"aria-hidden":!0,size:14})]}):i.header,p&&s.jsxs.call(void 0,"span",{"data-ug-slot":"column-reorder",children:[s.jsx.call(void 0,t.Button,{type:"button",variant:"text",size:"icon-sm","aria-label":`向左移动${S}`,disabled:0===k,onClick:()=>m(i.id,f[k-1]),children:s.jsx.call(void 0,n.ChevronLeft,{size:14,"aria-hidden":!0})}),s.jsx.call(void 0,t.Button,{type:"button",variant:"text",size:"icon-sm","aria-label":`向右移动${S}`,disabled:k===f.length-1,onClick:()=>m(i.id,f[k+1],!0),children:s.jsx.call(void 0,n.ChevronRight,{size:14,"aria-hidden":!0})})]})]})},i.id)}),0===b&&null!=u&&s.jsx.call(void 0,e.TableHead,{rowSpan:a.length,scope:"col","data-leaf-index":l.length-1,className:"whitespace-nowrap text-right","data-ug-slot":"action-column","data-fixed":o.getTableColumnFixed.call(void 0,l.at(-1)),children:u})]},b))})}var c=["loading-a","loading-b","loading-c","loading-d","loading-e"];function DataTable({rows:a,columns:l,getRowId:r,loading:u=!1,error:v,errorTitle:g="数据加载失败",emptyTitle:h="暂无数据",emptyDescription:p="当前条件下没有可展示的记录。",selectedIds:m=new Set,onSelectionChange:x,sort:b,order:f="asc",onSortChange:j,rowActions:w,actionsLabel:C="操作",page:y=1,total:N=a.length,pageSize:k=20,onPageChange:S,pageSizeOptions:T,onPageSizeChange:z,onRetry:_,retryLabel:A="重试",scrollRegionLabel:R="数据表格",size:M="sm",bordered:L=!0,striped:I=!1,tableClassName:D,fill:E=!1,pagination:B=!0,spanMethod:F,summaryMethod:G,columnOrder:V,defaultColumnOrder:$=[],onColumnOrderChange:P,reorderableColumns:U=!1,className:O,...W}){const[H,q]=i.useState.call(void 0,$),Q=o.getTableStructure.call(void 0,l,_nullishCoalesce(V,()=>H)),K=Q.leaves,Y=o.getTableSpanGrid.call(void 0,a.length,K.length,(e,l)=>_optionalChain([F,"optionalCall",t=>t({row:a[e],column:K[l],rowIndex:e,columnIndex:l})])),J=!u&&G?G({rows:a,columns:K}):void 0;const X=i.useRef.call(void 0,null),[Z,ee]=i.useState.call(void 0,{widths:[],regionWidth:1/0}),ae=Z.widths,le=K.some(e=>"left"===o.getTableColumnFixed.call(void 0,e)),te=[...x?[{width:"var(--control-height-lg)",fixed:le?"left":void 0}]:[],...K,...w?[{fixed:"right"}]:[]],ie=x?1:0,oe=o.resolveTableFixedColumns.call(void 0,te,ae,Z.regionWidth,w?te.length-1:void 0),ne=JSON.stringify([Q.order,te.map(({width:e,minWidth:a,align:l,fixed:t})=>({width:e,minWidth:a,align:l,fixed:t}))]),se=a.map(r),re=se.length>0&&se.every(e=>m.has(e)),de=se.some(e=>m.has(e))&&!re,ce=Math.max(Math.ceil(N/Math.max(k,1)),1),ue=[...new Set([..._nullishCoalesce(T,()=>[]),k])].filter(e=>Number.isSafeInteger(e)&&e>0).sort((e,a)=>e-a),ve=v?"error":u?"loading":0===a.length?"empty":"ready";return i.useLayoutEffect.call(void 0,()=>(w||K.some(e=>o.getTableColumnFixed.call(void 0,e)))&&X.current?d.observeTableColumnWidths.call(void 0,X.current,(e,a)=>ee({widths:e,regionWidth:a})):void 0,[ne,ve]),s.jsx.call(void 0,"div",{ref:X,className:t.cn.call(void 0,"min-w-0",!E&&"space-y-[calc(var(--content-gap)*0.75)]",O),"data-ug":"data-table","data-fill":E||void 0,"data-state":ve,"data-variant":L?"bordered":"default","data-size":M,...W,children:v?s.jsxs.call(void 0,"div",{className:"grid min-h-[calc(var(--control-height-lg)*3)] content-center gap-[calc(var(--content-gap)*0.75)]","data-ug-slot":"feedback",children:[s.jsxs.call(void 0,e.Alert,{variant:"destructive",children:[s.jsx.call(void 0,e.AlertTitle,{children:g}),s.jsx.call(void 0,e.AlertDescription,{children:v})]}),_?s.jsx.call(void 0,"div",{children:s.jsxs.call(void 0,t.Button,{onClick:_,size:"sm",type:"button",variant:"default",children:[s.jsx.call(void 0,n.RefreshCw,{"aria-hidden":"true",size:16}),A]})}):null]}):s.jsxs.call(void 0,s.Fragment,{children:[s.jsx.call(void 0,"div",{"data-ug-slot":"table",children:s.jsxs.call(void 0,e.Table,{bordered:L,className:t.cn.call(void 0,"min-w-[48rem] table-auto",D),scrollRegionLabel:R,size:M,striped:I,children:[s.jsx.call(void 0,"colgroup",{children:te.map((e,a)=>s.jsx.call(void 0,"col",{style:{width:o.tableColumnLength.call(void 0,e.width)}},a))}),s.jsx.call(void 0,DataTableHeader,{headers:Q.headers,layout:oe,widths:ae,offset:ie,sort:b,order:f,onSortChange:j,reorderable:U,move:function moveColumn(e,a,t=!1){const i=o.moveTableColumn.call(void 0,l,Q.order,e,a,t);i.every((e,a)=>e===Q.order[a])||(void 0===V&&q(i),_optionalChain([P,"optionalCall",e=>e(i)]))},selection:x?s.jsx.call(void 0,"span",{className:"inline-flex","data-ug-slot":"selection",children:s.jsx.call(void 0,e.Checkbox,{"aria-label":"选择当前页全部记录",checked:re,indeterminate:de,onCheckedChange:function toggleAll(e){const a=new Set(m);for(const l of se)e?a.add(l):a.delete(l);_optionalChain([x,"optionalCall",e=>e(a)])}})}):void 0,actions:w?s.jsx.call(void 0,"span",{"data-ug-slot":"header",children:C}):void 0}),s.jsxs.call(void 0,e.TableBody,{children:[u?c.map(a=>s.jsxs.call(void 0,e.TableRow,{children:[x?s.jsx.call(void 0,e.TableCell,{className:"text-center","data-fixed":o.getTableColumnFixed.call(void 0,oe[0]),style:o.getTableColumnStyle.call(void 0,oe,0,ae),children:s.jsx.call(void 0,"span",{className:"inline-flex","data-ug-slot":"selection",children:s.jsx.call(void 0,e.Skeleton,{className:"size-[calc(var(--control-height-sm)*0.5)]",variant:"rect"})})}):null,K.map((a,l)=>s.jsx.call(void 0,e.TableCell,{className:a.className,"data-fixed":o.getTableColumnFixed.call(void 0,oe[l+ie]),style:o.getTableColumnStyle.call(void 0,oe,l+ie,ae),children:s.jsx.call(void 0,"span",{"data-ug-slot":"loading",children:s.jsx.call(void 0,e.Skeleton,{variant:"text"})})},a.id)),w?s.jsx.call(void 0,e.TableCell,{className:"whitespace-nowrap text-right","data-ug-slot":"action-column","data-fixed":o.getTableColumnFixed.call(void 0,oe[te.length-1]),children:s.jsx.call(void 0,"span",{"data-ug-slot":"loading",children:s.jsx.call(void 0,e.Skeleton,{variant:"text"})})}):null]},a)):a.map((a,l)=>{const t=r(a),i=m.has(t);return s.jsxs.call(void 0,e.TableRow,{"data-state":i?"selected":"default",children:[x?s.jsx.call(void 0,e.TableCell,{className:"text-center","data-fixed":o.getTableColumnFixed.call(void 0,oe[0]),style:o.getTableColumnStyle.call(void 0,oe,0,ae),children:s.jsx.call(void 0,"span",{className:"inline-flex","data-ug-slot":"selection",children:s.jsx.call(void 0,e.Checkbox,{"aria-label":`选择记录 ${t}`,checked:i,onCheckedChange:e=>function toggleOne(e,a){const l=new Set(m);a?l.add(e):l.delete(e),_optionalChain([x,"optionalCall",e=>e(l)])}(t,e)})})}):null,K.map((t,i)=>Y[l][i].rowSpan>0?s.jsx.call(void 0,e.TableCell,{rowSpan:Y[l][i].rowSpan,colSpan:Y[l][i].colSpan,className:t.className,"data-fixed":1===Y[l][i].colSpan?o.getTableColumnFixed.call(void 0,oe[i+ie]):void 0,style:o.getTableColumnStyle.call(void 0,oe,i+ie,ae),children:s.jsx.call(void 0,"span",{className:"contents","data-ug-slot":"cell",children:t.cell?t.cell(a):String(_nullishCoalesce(a[t.id],()=>"—"))})},t.id):null),w?s.jsx.call(void 0,e.TableCell,{className:"whitespace-nowrap text-right","data-ug-slot":"action-column","data-fixed":o.getTableColumnFixed.call(void 0,oe[te.length-1]),children:s.jsx.call(void 0,"div",{"data-ug-slot":"actions",children:w(a)})}):null]},t)}),u||0!==a.length?null:s.jsx.call(void 0,e.TableRow,{children:s.jsx.call(void 0,e.TableCell,{colSpan:K.length+(x?1:0)+(w?1:0),children:s.jsx.call(void 0,"div",{"data-ug-slot":"empty",children:s.jsx.call(void 0,e.EmptyState,{description:p,icon:n.Database,size:"sm",title:h})})})})]}),J&&a.length>0&&s.jsx.call(void 0,"tfoot",{"data-ug-slot":"aggregate",children:s.jsxs.call(void 0,e.TableRow,{children:[x&&s.jsx.call(void 0,e.TableCell,{}),K.map((a,l)=>s.jsx.call(void 0,e.TableCell,{"data-fixed":o.getTableColumnFixed.call(void 0,oe[l+ie]),style:o.getTableColumnStyle.call(void 0,oe,l+ie,ae),children:J[l]},a.id)),w&&s.jsx.call(void 0,e.TableCell,{"data-ug-slot":"action-column","data-fixed":o.getTableColumnFixed.call(void 0,oe[te.length-1])})]})})]})}),B&&!u&&(N>0||T&&z)?s.jsxs.call(void 0,"div",{className:"flex min-w-0 flex-wrap items-center justify-between gap-[var(--content-gap)] text-sm text-text-secondary max-sm:items-stretch max-sm:flex-col","data-ug-slot":"pagination",children:[s.jsxs.call(void 0,"span",{"data-ug-slot":"summary",children:["共 ",N," 条,第 ",y," / ",ce," 页"]}),s.jsxs.call(void 0,"div",{"data-ug-slot":"pagination-controls",children:[T&&z?s.jsx.call(void 0,e.Select,{"aria-label":"每页条数",options:ue.map(e=>({label:`每页 ${e} 条`,value:e})),size:"sm",value:k,onValueChange:e=>{"number"==typeof e&&z(e)}}):null,S&&ce>1?s.jsx.call(void 0,e.Pagination,{onPageChange:S,page:y,totalPages:ce,size:"sm"}):null]})]}):null]})})}function defaultChildren(e){return e.children}function TreeTable({rows:e,columns:a,getRowId:l,getChildren:r=defaultChildren,getRowLabel:d,treeColumnId:c=_optionalChain([o.getTableStructure.call(void 0,a),"access",e=>e.leaves,"access",e=>e[0],"optionalAccess",e=>e.id]),expandedIds:u,defaultExpandedIds:v,defaultExpandAll:g=!1,onExpandedChange:h,onExpandChange:p,indent:m=16,expansionDisabled:x=!1,expansionDisabledReason:b,fill:f=!1,size:j="sm",bordered:w=!0,className:C,...y}){const[N,k]=i.useState.call(void 0,()=>v?new Set(v):void 0),S=_nullishCoalesce(u,()=>N),T=i.useMemo.call(void 0,()=>o.projectTreeTableRows.call(void 0,e,{getRowId:l,getChildren:r,expandedIds:S,defaultExpandAll:g}),[e,l,r,S,g]),z=new Map(T.visibleRows.map(e=>[e.id,e]));function toggle(e,a){if(x)return;const t=l(e),i=new Set(_nullishCoalesce(S,()=>g?T.expandableIds:[]));a?i.add(t):i.delete(t),void 0===u&&k(i),_optionalChain([h,"optionalCall",e=>e(i)]),_optionalChain([p,"optionalCall",l=>l(e,a)])}const decorate=e=>e.map(e=>_optionalChain([e,"access",e=>e.children,"optionalAccess",e=>e.length])?{...e,children:decorate(e.children)}:e.id!==c?e:{...e,cell:a=>{const i=z.get(l(a)),o=_nullishCoalesce(_optionalChain([d,"optionalCall",e=>e(a)]),()=>`记录 ${i.id}`);return s.jsxs.call(void 0,"div",{"data-ug-slot":"tree-cell","data-depth":i.depth,style:{paddingInlineStart:i.depth*Math.max(m,0)},children:[s.jsxs.call(void 0,"span",{"data-ug-slot":"level",children:["层级 ",i.depth+1,","]}),i.hasChildren?s.jsx.call(void 0,t.Button,{type:"button",size:"icon-sm",variant:"ghost",tone:"neutral","aria-label":`${i.expanded?"收起":"展开"}${o}`,"aria-expanded":i.expanded,disabled:x,"aria-description":b,onClick:()=>toggle(a,!i.expanded),onKeyDown:e=>{x||("ArrowRight"!==e.key||i.expanded||(e.preventDefault(),toggle(a,!0)),"ArrowLeft"===e.key&&i.expanded&&(e.preventDefault(),toggle(a,!1)))},children:i.expanded?s.jsx.call(void 0,n.ChevronDown,{size:16,"aria-hidden":!0}):s.jsx.call(void 0,n.ChevronRight,{size:16,"aria-hidden":!0})}):s.jsx.call(void 0,"span",{"data-ug-slot":"tree-spacer","aria-hidden":!0}),s.jsx.call(void 0,"span",{"data-ug-slot":"tree-content",title:o,children:e.cell?e.cell(a):String(_nullishCoalesce(a[e.id],()=>"—"))})]})}}),_=decorate(a);return s.jsx.call(void 0,"div",{className:C,"data-ug":"tree-table","data-ug-slot":"root","data-fill":f||void 0,"data-size":j,"data-variant":w?"bordered":"default","data-state":y.error?"error":y.loading?"loading":T.visibleRows.length?"ready":"empty",children:s.jsx.call(void 0,DataTable,{...y,rows:T.visibleRows.map(e=>e.record),columns:_,getRowId:l,pagination:!1,fill:f,size:j,bordered:w})})}var u=require("@ug666/ui-core/theme"),v=require("@ug666/ui-web/sidebar");function activeClass(e,a){return e?"indicator"===a?"bg-transparent text-[var(--ug-navigation-active-text)] hover:bg-[var(--ug-navigation-hover-bg)] hover:text-[var(--ug-navigation-active-text)] data-[state=open]:bg-[var(--ug-navigation-hover-bg)] data-[state=open]:text-[var(--ug-navigation-active-text)] after:absolute after:inset-x-2 after:bottom-0 after:h-0.5 after:bg-[var(--ug-navigation-active-text)]":"bg-[var(--ug-navigation-active-bg)] text-[var(--ug-navigation-active-text)] hover:bg-[var(--ug-navigation-active-bg)] hover:text-[var(--ug-navigation-active-text)] data-[state=open]:bg-[var(--ug-navigation-active-bg)] data-[state=open]:text-[var(--ug-navigation-active-text)]":"bg-transparent text-[var(--ug-navigation-text)] hover:bg-[var(--ug-navigation-hover-bg)] hover:text-[var(--ug-navigation-text)] data-[state=open]:bg-[var(--ug-navigation-hover-bg)] data-[state=open]:text-[var(--ug-navigation-text)]"}function topItemClass(e,a,l){return t.cn.call(void 0,"relative flex max-w-40 items-center gap-1.5 rounded-[var(--radius-control)] px-2.5 font-medium","compact"===l?"h-8 text-xs":"h-9 text-sm",activeClass(e,a))}function moreItemClass(e,a,l){return t.cn.call(void 0,"relative flex shrink-0 items-center gap-1 px-2.5","compact"===l?"h-8 text-xs":"h-9 text-sm",activeClass(e,a))}var g=i.memo.call(void 0,function DropdownItems2({items:a,level:l=0}){return s.jsx.call(void 0,"div",{className:t.cn.call(void 0,"grid min-w-52 gap-1 p-1.5",l>0&&"min-w-48 border-l border-[var(--ug-navigation-border)] pl-2"),children:a.map((a,i)=>{const o=a.icon,n=_nullishCoalesce(_nullishCoalesce(a.id,()=>a.href),()=>`${l}-${i}-${a.label}`);return _optionalChain([a,"access",e=>e.children,"optionalAccess",e=>e.length])?s.jsxs.call(void 0,"div",{className:"grid gap-1",children:[s.jsxs.call(void 0,"div",{className:"flex items-center gap-2 px-2 py-1.5 text-xs font-semibold text-[var(--ug-navigation-text)] opacity-75",children:[s.jsx.call(void 0,o,{"aria-hidden":"true",size:14}),s.jsx.call(void 0,"span",{className:"truncate",children:a.label})]}),s.jsx.call(void 0,DropdownItems2,{items:a.children,level:l+1})]},n):s.jsxs.call(void 0,e.NavigationMenuLink,{active:a.active,className:t.cn.call(void 0,"flex w-full items-center gap-2 px-2.5 py-2",(r=Boolean(a.active),r?"bg-[var(--ug-navigation-active-bg)] text-[var(--ug-navigation-active-text)] hover:bg-[var(--ug-navigation-active-bg)] hover:text-[var(--ug-navigation-active-text)]":"bg-transparent text-[var(--ug-navigation-text)] hover:bg-[var(--ug-navigation-hover-bg)] hover:text-[var(--ug-navigation-text)]")),href:a.href,children:[s.jsx.call(void 0,o,{"aria-hidden":"true",size:15}),s.jsx.call(void 0,"span",{className:"min-w-0 flex-1 truncate",children:a.label}),void 0!==a.badge?s.jsx.call(void 0,"span",{className:"text-xs opacity-70",children:a.badge}):null]},n);var r})})}),h=i.memo.call(void 0,function TopItem2({item:a,active:l,activeStyle:t,density:i}){const o=a.icon,n=topItemClass(l,t,i);return _optionalChain([a,"access",e=>e.children,"optionalAccess",e=>e.length])?s.jsxs.call(void 0,e.NavigationMenuItem,{children:[s.jsxs.call(void 0,e.NavigationMenuTrigger,{active:l,className:n,children:[s.jsx.call(void 0,o,{"aria-hidden":"true",size:15}),s.jsx.call(void 0,"span",{className:"truncate",children:a.label})]}),s.jsx.call(void 0,e.NavigationMenuContent,{className:"max-h-[min(70dvh,32rem)] overflow-y-auto overscroll-contain border-[var(--ug-navigation-border)] bg-[var(--ug-navigation-bg)] text-[var(--ug-navigation-text)]",children:s.jsx.call(void 0,g,{items:a.children})})]}):s.jsx.call(void 0,e.NavigationMenuItem,{children:s.jsxs.call(void 0,e.NavigationMenuLink,{active:l,className:n,href:a.href,children:[s.jsx.call(void 0,o,{"aria-hidden":"true",size:15}),s.jsx.call(void 0,"span",{className:"truncate",children:a.label})]})})});function AdminHorizontalNavigation({items:a,activeStyle:l,density:o}){const r=i.useMemo.call(void 0,()=>function normalizeItems(e){const a=1===e.length?e[0]:void 0;return _optionalChain([a,"optionalAccess",e=>e.children,"optionalAccess",e=>e.length])?a.href?[{...a,children:void 0},...a.children]:a.children:e}(a),[a]),d=i.useMemo.call(void 0,()=>v.createSidebarTreeMeta.call(void 0,r),[r]),[c,u]=i.useState.call(void 0,()=>Math.min(r.length,6)),p=i.useRef.call(void 0,null),m=i.useRef.call(void 0,null),x=i.useRef.call(void 0,null),b=i.useMemo.call(void 0,()=>r.slice(0,c),[r,c]),f=i.useMemo.call(void 0,()=>r.slice(c),[r,c]),j=i.useCallback.call(void 0,e=>Boolean(e.active||d.activeBranches.has(e)),[d]),w=i.useMemo.call(void 0,()=>f.some(j),[j,f]),C=i.useCallback.call(void 0,()=>{const e=p.current,a=m.current;if(!e||!a||e.clientWidth<=0)return void u(Math.min(r.length,6));const l=Array.from(a.querySelectorAll('[data-ug-navigation-measure="item"]')),t=a.querySelector('[data-ug-navigation-measure="more"]'),i=Number.parseFloat(window.getComputedStyle(a).columnGap)||4,o=_nullishCoalesce(_optionalChain([t,"optionalAccess",e=>e.getBoundingClientRect,"call",e=>e(),"access",e=>e.width]),()=>0);let n=0,s=0;for(let a=0;a<l.length;a+=1){const t=_nullishCoalesce(_optionalChain([l,"access",e=>e[a],"optionalAccess",e=>e.getBoundingClientRect,"call",e=>e(),"access",e=>e.width]),()=>0),r=a>0?i:0;if(n+r+t+(a<l.length-1?i+o:0)>e.clientWidth+.5)break;n+=r+t,s+=1}u(s)},[r]),y=i.useCallback.call(void 0,()=>{null===x.current&&(x.current=window.requestAnimationFrame(()=>{x.current=null,C()}))},[C]);return i.useLayoutEffect.call(void 0,()=>{let e=!1;const a="undefined"==typeof ResizeObserver?void 0:new ResizeObserver(y);return p.current&&_optionalChain([a,"optionalAccess",e=>e.observe,"call",e=>e(p.current)]),y(),_optionalChain([document,"access",e=>e.fonts,"optionalAccess",e=>e.ready,"access",e=>e.then,"call",a=>a(()=>{e||y()})]),()=>{e=!0,null!==x.current&&window.cancelAnimationFrame(x.current),x.current=null,_optionalChain([a,"optionalAccess",e=>e.disconnect,"call",e=>e()])}},[o,y]),s.jsxs.call(void 0,"div",{className:"relative min-w-0 flex-1",ref:p,children:[s.jsxs.call(void 0,"div",{"aria-hidden":"true",className:"pointer-events-none absolute invisible flex max-w-none items-center gap-1 whitespace-nowrap","data-ug-slot":"measure",inert:!0,ref:m,children:[r.map((e,a)=>{const i=e.icon;return s.jsxs.call(void 0,"span",{className:t.cn.call(void 0,topItemClass(j(e),l,o),"max-w-none shrink-0"),"data-ug-navigation-measure":"item",children:[s.jsx.call(void 0,i,{"aria-hidden":"true",size:15}),s.jsx.call(void 0,"span",{children:e.label}),_optionalChain([e,"access",e=>e.children,"optionalAccess",e=>e.length])?s.jsx.call(void 0,n.ChevronDown,{"aria-hidden":"true",size:14}):null]},_nullishCoalesce(_nullishCoalesce(e.id,()=>e.href),()=>`measure-${a}-${e.label}`))}),s.jsxs.call(void 0,"span",{className:moreItemClass(!1,l,o),"data-ug-navigation-measure":"more",children:[s.jsx.call(void 0,n.MoreHorizontal,{"aria-hidden":"true",size:16}),s.jsx.call(void 0,"span",{children:"更多"})]})]}),s.jsxs.call(void 0,e.NavigationMenu,{activation:"click",tone:"inherit",className:"min-w-0 w-full overflow-visible","data-ug-context":"admin-horizontal-navigation",children:[b.map((e,a)=>s.jsx.call(void 0,h,{active:j(e),activeStyle:l,density:o,item:e},_nullishCoalesce(_nullishCoalesce(e.id,()=>e.href),()=>`${a}-${e.label}`))),f.length?s.jsxs.call(void 0,e.NavigationMenuItem,{children:[s.jsxs.call(void 0,e.NavigationMenuTrigger,{active:w,className:moreItemClass(w,l,o),children:[s.jsx.call(void 0,n.MoreHorizontal,{"aria-hidden":"true",size:16}),s.jsx.call(void 0,"span",{children:"更多"})]}),s.jsx.call(void 0,e.NavigationMenuContent,{className:"right-0 left-auto max-h-[min(70dvh,32rem)] overflow-y-auto overscroll-contain border-[var(--ug-navigation-border)] bg-[var(--ug-navigation-bg)] text-[var(--ug-navigation-text)]",children:s.jsx.call(void 0,g,{items:f})})]}):null]})]})}var p=i.forwardRef.call(void 0,({navItems:l,sidebarHeader:o,sidebarCollapsedHeader:r,sidebarHeaderAlign:d="start",sidebarHeaderDivider:c=!0,sidebarContextSwitcher:v,sidebarContextSwitcherVisible:g=!1,sidebarContextSwitcherDividers:h=!1,sidebarContextSwitcherPlacement:p="after-search",sidebarScrollActiveItemIntoView:m=!0,sidebarFooter:x,sidebarVariant:b="dark",navigationMode:f="sidebar",navigationPalette:j,themePreset:w="default",themeMode:C,themeAccent:y="theme",navigationColors:N,navigationActiveStyle:k,navigationDensity:S,sidebarActiveStyle:T="highlight",sidebarDensity:z="comfortable",sidebarSearchable:_=!1,sidebarSearchPlaceholder:A="搜索菜单...",sidebarSearchDividers:R=!0,sidebarCollapsible:M=!0,sidebarTogglePlacement:L="sidebar",sidebarResizable:I=!1,sidebarWidth:D,defaultSidebarWidth:E=256,sidebarMinWidth:B=208,sidebarMaxWidth:F=480,onSidebarWidthChange:G,sidebarCollapsed:V,defaultSidebarCollapsed:$=!1,onSidebarCollapsedChange:P,mobileSidebarOpen:U,onMobileSidebarOpenChange:O,topbarStart:W,topbarEnd:H,topbar:q,secondaryBar:Q,topbarBordered:K=!0,secondaryBarBordered:Y=!1,fluidContent:J=!1,contentPadding:X=!0,mainClassName:Z,contentClassName:ee,children:ae,className:le,...te},ie)=>{const oe=a.useMediaQuery.call(void 0,"(prefers-color-scheme: dark)"),[ne,se]=i.useState.call(void 0,$),[re,de]=i.useState.call(void 0,!1),ce=_nullishCoalesce(V,()=>ne),ue=_nullishCoalesce(U,()=>re),ve=_nullishCoalesce(j,()=>"primary"===b?"light":"dark"),ge=void 0===C?ve:u.resolveUGNavigationPalette.call(void 0,C,oe),he=N?ve:ge,pe=u.resolveUGNavigationColors.call(void 0,w,he,N,y),me=_nullishCoalesce(k,()=>T),xe=_nullishCoalesce(S,()=>z),be="light"===he?"primary":"dark",fe={"--ug-navigation-bg":pe.background,"--ug-navigation-text":pe.text,"--ug-navigation-active-bg":pe.activeBackground,"--ug-navigation-active-text":pe.activeText,"--ug-navigation-hover-bg":pe.hoverBackground,"--ug-navigation-border":`color-mix(in srgb, ${pe.text} 18%, ${pe.background})`};function setSidebarCollapsed(e){void 0===V&&se(e),_optionalChain([P,"optionalCall",a=>a(e)])}function setMobileOpen(e){void 0===U&&de(e),_optionalChain([O,"optionalCall",a=>a(e)])}return s.jsx.call(void 0,"div",{ref:ie,className:t.cn.call(void 0,"text-text-primary",le),...te,"data-ug":"admin-shell","data-state":ue?"mobile-open":"default","data-variant":be,"data-navigation-mode":f,"data-navigation-palette":he,"data-sidebar-active-style":me,"data-sidebar-density":xe,"data-size":"md",children:s.jsxs.call(void 0,"div",{className:"flex min-h-screen min-w-0",children:[s.jsx.call(void 0,e.Sidebar,{items:l,variant:be,activeStyle:me,density:xe,colors:pe,header:o,headerAlign:d,headerDivider:c,collapsedHeader:r,contextSwitcher:v,contextSwitcherVisible:g,contextSwitcherDividers:h,contextSwitcherPlacement:p,scrollActiveItemIntoView:m,footer:x,searchable:_,searchPlaceholder:A,searchDividers:R,collapsible:M&&"sidebar"===L,bottomCollapsible:M&&"bottom"===L,resizable:I,width:D,defaultWidth:E,minWidth:B,maxWidth:F,onWidthChange:G,collapsed:ce,onCollapsedChange:setSidebarCollapsed,responsive:!0,mobileOpen:ue,onMobileOpenChange:setMobileOpen,className:t.cn.call(void 0,"shrink-0","header"===f&&"lg:hidden"),"data-ug-slot":"sidebar"}),s.jsxs.call(void 0,"div",{className:"flex min-w-0 flex-1 flex-col",children:[s.jsxs.call(void 0,"header",{className:t.cn.call(void 0,"sticky top-0 z-30 flex items-center gap-[calc(var(--content-gap)*0.75)] px-[var(--content-gap)] sm:px-[calc(var(--content-gap)*1.25)] lg:px-[calc(var(--content-gap)*1.5)]",K?"border-b":"border-b-0","header"===f?"border-[var(--ug-navigation-border)] bg-[var(--ug-navigation-bg)] text-[var(--ug-navigation-text)]":"border-border-base bg-surface-0"),style:"header"===f?fe:void 0,"data-ug-slot":"topbar",children:[s.jsx.call(void 0,t.Button,{type:"button",variant:"ghost",size:"icon",className:"md:hidden","aria-label":"打开侧边栏",onClick:()=>setMobileOpen(!0),"data-ug-slot":"mobile-trigger",children:s.jsx.call(void 0,n.Menu,{"aria-hidden":"true",focusable:"false",size:18})}),"sidebar"===f&&M&&"topbar"===L?s.jsx.call(void 0,t.Button,{type:"button",variant:"ghost",size:"icon",className:"hidden md:inline-flex","aria-label":ce?"展开侧边栏":"折叠侧边栏",onClick:()=>setSidebarCollapsed(!ce),"data-ug-slot":"desktop-sidebar-trigger",children:ce?s.jsx.call(void 0,n.PanelLeftOpen,{"aria-hidden":"true",focusable:"false",size:18}):s.jsx.call(void 0,n.PanelLeftClose,{"aria-hidden":"true",focusable:"false",size:18})}):null,"header"===f?s.jsxs.call(void 0,s.Fragment,{children:[s.jsx.call(void 0,"div",{className:"hidden shrink-0 items-center lg:flex",children:o}),s.jsx.call(void 0,"div",{className:"hidden min-w-0 flex-1 lg:flex",children:s.jsx.call(void 0,AdminHorizontalNavigation,{activeStyle:me,density:xe,items:l})}),s.jsx.call(void 0,"div",{className:"min-w-0 flex-1 lg:hidden","data-ug-slot":"topbar-start",children:W})]}):q?s.jsx.call(void 0,"div",{className:"min-w-0 flex-1","data-ug-slot":"topbar-content",children:q}):s.jsx.call(void 0,"div",{className:"min-w-0 flex-1","data-ug-slot":"topbar-start",children:W}),"header"!==f&&q||!H?null:s.jsx.call(void 0,"div",{className:"flex shrink-0 items-center gap-[calc(var(--content-gap)*0.5)]","data-ug-slot":"topbar-end",children:H},"topbar-end")]}),Q?s.jsx.call(void 0,"div",{className:t.cn.call(void 0,"sticky top-[var(--ug-admin-shell-topbar-height)] z-20 bg-surface-1",Y&&"border-b border-border-base"),"data-ug-slot":"secondary-bar",children:Q}):null,s.jsx.call(void 0,"main",{className:t.cn.call(void 0,"flex-1 overflow-x-clip",Z),"data-ug-slot":"main",children:s.jsx.call(void 0,"div",{className:t.cn.call(void 0,"mx-auto",J?"max-w-none":"max-w-7xl",X?"px-[var(--content-gap)] py-[calc(var(--content-gap)*1.5)] sm:px-[calc(var(--content-gap)*1.25)] lg:px-[calc(var(--content-gap)*1.5)]":"!p-0",ee),"data-ug-context":"admin-shell","data-ug-slot":"content",children:ae})})]})]})})});function getScrollBehavior(e){return e.closest('[data-ug-motion="reduced"]')||"function"==typeof window.matchMedia&&window.matchMedia("(prefers-reduced-motion: reduce)").matches?"auto":"smooth"}function getTabElements(e){return Array.from(e.children).filter(e=>e instanceof HTMLLIElement&&"item"===e.dataset.ugSlot)}function clearItemMotion(e){delete e.dataset.motion,e.style.removeProperty("--ug-app-tabs-motion-x")}function playItemMotion(e,a,l=0){const t=Boolean(e.dataset.motion);clearItemMotion(e),t&&e.offsetWidth,"move"===a&&e.style.setProperty("--ug-app-tabs-motion-x",`${l}px`),e.dataset.motion=a}p.displayName="AdminShell";var m=i.memo.call(void 0,({active:e,activeItemRef:a,closable:l,closeEnabled:t,icon:i,label:o,onActivate:r,onClose:d,value:c})=>s.jsxs.call(void 0,"li",{"data-closable":l||void 0,"data-state":e?"active":"default","data-ug-slot":"item","data-value":c,ref:e?a:void 0,children:[s.jsxs.call(void 0,"button",{"aria-current":e?"page":void 0,"data-ug-slot":"trigger",onAuxClick:e=>{1===e.button&&l&&t&&(e.preventDefault(),d(c))},onClick:()=>r(c),title:o,type:"button",children:[i?s.jsx.call(void 0,"span",{"aria-hidden":"true","data-ug-slot":"icon",children:i}):null,s.jsx.call(void 0,"span",{"data-ug-slot":"label",children:o})]}),l&&t?s.jsx.call(void 0,"button",{"aria-label":`关闭页面 ${o}`,"data-ug-slot":"close",onClick:()=>d(c),type:"button",children:s.jsx.call(void 0,n.X,{"aria-hidden":"true",size:13})}):null]}));m.displayName="AppTabView";var x=i.forwardRef.call(void 0,({items:e,value:a,density:l="comfortable",showIcons:o=!0,closable:r=!0,bordered:d=!0,onValueChange:c,onClose:u,className:v,"aria-label":g="页面标签",...h},p)=>{const x=i.useRef.call(void 0,null),b=i.useRef.call(void 0,null),f=i.useRef.call(void 0,null),j=i.useRef.call(void 0,null),w=i.useRef.call(void 0,null),C=i.useRef.call(void 0,new Map),y=i.useRef.call(void 0,null),N=i.useRef.call(void 0,e),k=i.useRef.call(void 0,c),S=i.useRef.call(void 0,u),[T,z]=i.useState.call(void 0,{canScrollStart:!1,canScrollEnd:!1}),_=T.canScrollStart||T.canScrollEnd,A=i.useMemo.call(void 0,()=>e.map(e=>`${e.value}${e.label}${r&&e.closable?"1":"0"}${o&&e.icon?"1":"0"}`).join(""),[r,e,o]);N.current=e,k.current=c,S.current=u;const R=i.useCallback.call(void 0,e=>{const a=N.current.find(a=>a.value===e);a&&k.current(a)},[]),M=i.useCallback.call(void 0,e=>{const a=N.current.find(a=>a.value===e);if(!a)return;const l=b.current;_optionalChain([l?getTabElements(l).find(a=>a.dataset.value===e):null,"optionalAccess",e=>e.contains,"call",e=>e(document.activeElement)])&&(y.current=e),_optionalChain([S,"access",e=>e.current,"optionalCall",e=>e(a)])},[]),L=i.useCallback.call(void 0,()=>{null===j.current&&(j.current=window.requestAnimationFrame(()=>{j.current=null;const e=b.current;if(!e)return;const a=Math.max(0,e.scrollWidth-e.clientWidth),l={canScrollStart:e.scrollLeft>1,canScrollEnd:e.scrollLeft<a-1};z(e=>e.canScrollStart===l.canScrollStart&&e.canScrollEnd===l.canScrollEnd?e:l)}))},[]),I=i.useCallback.call(void 0,e=>{const a=b.current,l=f.current;if(!a||!l)return;const t=getTabElements(a);if(l===t[0]&&a.scrollLeft>1)return void a.scrollBy({behavior:e,left:-a.scrollLeft});const i=Math.max(0,a.scrollWidth-a.clientWidth);if(l===t[t.length-1]&&a.scrollLeft<i-1)return void a.scrollBy({behavior:e,left:i-a.scrollLeft});const o=l.offsetLeft-a.scrollLeft,n=o+l.offsetWidth-a.clientWidth;o<0?a.scrollBy({behavior:e,left:o-2}):n>0&&a.scrollBy({behavior:e,left:n+2})},[]);function scrollTabs(e){const a=b.current;a&&a.scrollBy({behavior:getScrollBehavior(a),left:e*Math.max(160,.6*a.clientWidth)})}return i.useLayoutEffect.call(void 0,()=>{const e=b.current;if(!e)return;const a=getTabElements(e),l=new Map;for(const e of a){const a=e.dataset.value;a&&l.set(a,e.offsetLeft)}const t=C.current;if(t.size>0&&"auto"!==getScrollBehavior(e))for(const e of a){const a=e.dataset.value;if(!a)continue;const i=t.get(a),o=_nullishCoalesce(l.get(a),()=>0),n=void 0===i?0:i-o;void 0!==i&&Math.abs(n)<.5||playItemMotion(e,void 0===i?"enter":"move",n)}C.current=l},[A]),i.useLayoutEffect.call(void 0,()=>{const e=y.current;if(!e||N.current.some(a=>a.value===e))return;const a=_optionalChain([b,"access",e=>e.current,"optionalAccess",e=>e.querySelector,"call",e=>e('[data-ug-slot="item"][data-state="active"] [data-ug-slot="trigger"]')]);a&&(y.current=null,a.focus({preventScroll:!0}))},[A,a]),i.useEffect.call(void 0,()=>{const e=x.current,a=b.current;if(!e||!a)return;L(),a.addEventListener("scroll",L,{passive:!0});const handleContainerResize=()=>{L(),null!==w.current&&window.cancelAnimationFrame(w.current),w.current=window.requestAnimationFrame(()=>{w.current=window.requestAnimationFrame(()=>{w.current=null,I("auto"),L()})})},l="undefined"==typeof ResizeObserver?null:new ResizeObserver(handleContainerResize);return l?l.observe(e):window.addEventListener("resize",handleContainerResize),()=>{a.removeEventListener("scroll",L),l?l.disconnect():window.removeEventListener("resize",handleContainerResize),null!==j.current&&(window.cancelAnimationFrame(j.current),j.current=null),null!==w.current&&(window.cancelAnimationFrame(w.current),w.current=null)}},[I,L]),i.useEffect.call(void 0,()=>{if(!e.some(e=>e.value===a))return;const l=b.current;l&&(I(getScrollBehavior(l)),L())},[e,I,L,a]),s.jsx.call(void 0,"nav",{ref:p,...h,"aria-label":g,className:t.cn.call(void 0,"text-text-primary",!d&&"[background-image:none]",v),"data-density":l,"data-overflow":_||void 0,"data-size":"md","data-state":_?"overflow":"default","data-ug":"app-tabs","data-variant":"browser",children:s.jsxs.call(void 0,"div",{"data-ug-slot":"track",ref:x,children:[s.jsx.call(void 0,"button",{"aria-label":"向左滚动页面标签","data-ug-slot":"scroll-start","data-visible":_&&T.canScrollStart||void 0,disabled:!T.canScrollStart,onClick:()=>scrollTabs(-1),type:"button",children:s.jsx.call(void 0,n.ChevronLeft,{"aria-hidden":"true",size:15})}),s.jsx.call(void 0,"ul",{ref:b,"aria-label":"页面标签列表","data-ug-slot":"list",onAnimationEnd:e=>{["ug-motion-app-tab-enter","ug-motion-app-tab-layout-shift"].includes(e.animationName)&&clearItemMotion(e.target)},children:e.map(e=>s.jsx.call(void 0,m,{active:e.value===a,activeItemRef:f,closable:r&&Boolean(e.closable),closeEnabled:r&&Boolean(u),icon:o?e.icon:void 0,label:e.label,onActivate:R,onClose:M,value:e.value},e.value))}),s.jsx.call(void 0,"button",{"aria-label":"向右滚动页面标签","data-ug-slot":"scroll-end","data-visible":_&&T.canScrollEnd||void 0,disabled:!T.canScrollEnd,onClick:()=>scrollTabs(1),type:"button",children:s.jsx.call(void 0,n.ChevronRight,{"aria-hidden":"true",size:15})})]})})});x.displayName="AppTabs";var b=i.forwardRef.call(void 0,({open:a,onOpenChange:l,title:i,description:o,children:r,variant:d="destructive",icon:c,cancelText:u="取消",confirmText:v="确认",loading:g=!1,disabled:h=!1,closeOnConfirm:p=!0,onCancel:m,onConfirm:x,className:b,...f},j)=>{const w=_nullishCoalesce(c,()=>"destructive"===d?n.AlertTriangle:n.HelpCircle);function handleCancel(){g||(_optionalChain([m,"optionalCall",e=>e()]),l(!1))}return s.jsx.call(void 0,e.Modal,{open:a,onClose:handleCancel,closeOnEsc:!g,closeOnOverlay:!g,children:s.jsxs.call(void 0,e.ModalContent,{ref:j,className:t.cn.call(void 0,"max-w-md",b),...f,"data-ug":"confirm-dialog","data-state":a?"open":"default","data-variant":d,"data-size":"md",children:[s.jsxs.call(void 0,e.ModalHeader,{className:"items-start gap-[calc(var(--content-gap)*0.75)]","data-ug-slot":"header",children:[s.jsx.call(void 0,"div",{className:t.cn.call(void 0,"flex h-[var(--control-height-md)] w-[var(--control-height-md)] shrink-0 items-center justify-center rounded-[var(--radius-control)]","destructive"===d?"bg-danger-soft text-danger-soft-fg":"bg-primary-soft text-primary-soft-fg"),"data-ug-slot":"icon",children:s.jsx.call(void 0,w,{size:20,"aria-hidden":"true"})}),s.jsxs.call(void 0,"div",{className:"min-w-0 flex-1 space-y-[calc(var(--content-gap)*0.25)]","data-ug-slot":"content",children:[s.jsx.call(void 0,e.ModalTitle,{className:"break-words text-base","data-ug-slot":"title",children:i}),o?s.jsx.call(void 0,"p",{className:"text-sm leading-6 text-text-secondary","data-ug-slot":"description",children:o}):null]})]}),r?s.jsx.call(void 0,"div",{className:"px-[var(--content-gap)] py-[var(--content-gap)] text-sm text-text-secondary","data-ug-slot":"body",children:r}):null,s.jsxs.call(void 0,e.ModalFooter,{className:"flex-col-reverse gap-[calc(var(--content-gap)*0.5)] sm:flex-row","data-ug-slot":"footer",children:[s.jsx.call(void 0,t.Button,{type:"button",variant:"outline",disabled:g,onClick:handleCancel,"data-ug-slot":"cancel",children:u}),s.jsx.call(void 0,t.Button,{type:"button",variant:"destructive"===d?"destructive":"default",loading:g,disabled:h,onClick:function handleConfirm(){const e=_optionalChain([x,"optionalCall",e=>e()]);return p&&l(!1),e},"data-ug-slot":"confirm",children:v})]})]})})});b.displayName="ConfirmDialog";var f=i.forwardRef.call(void 0,({value:e,label:a,displayValue:l,monospace:o=!0,disabled:r=!1,bordered:d=!0,showIcon:c=!0,showCopyText:u=!0,copyLabel:v="复制",copiedLabel:g="已复制",onCopied:h,onCopyError:p,className:m,...x},b)=>{const[f,j]=i.useState.call(void 0,!1),w=i.useRef.call(void 0,null),C=i.useRef.call(void 0,{value:e,generation:0,mounted:!0});return C.current.value!==e&&(C.current.value=e,C.current.generation++),i.useEffect.call(void 0,()=>(C.current.mounted=!0,()=>{C.current.mounted=!1,C.current.generation++,w.current&&clearTimeout(w.current)}),[]),i.useEffect.call(void 0,()=>{j(!1),w.current&&(clearTimeout(w.current),w.current=null)},[e]),s.jsxs.call(void 0,"div",{ref:b,className:t.cn.call(void 0,"space-y-[calc(var(--content-gap)*0.5)]",m),...x,"data-ug":"copy-field","data-state":r?"disabled":f?"copied":"default","data-variant":o?"monospace":"default","data-bordered":d?"true":"false","data-size":"md",children:[a?s.jsx.call(void 0,"div",{className:"text-xs font-medium text-text-secondary","data-ug-slot":"label",children:a}):null,s.jsxs.call(void 0,"div",{className:t.cn.call(void 0,"flex min-w-0 items-stretch overflow-hidden rounded-[var(--radius-control)] bg-surface-1",d&&"border border-border-base",r&&"opacity-60"),"data-ug-slot":"field",children:[s.jsx.call(void 0,"div",{className:t.cn.call(void 0,"min-w-0 flex-1 self-center truncate px-[var(--control-padding-x-sm)] py-[calc(var(--content-gap)*0.5)] text-sm text-text-primary",o&&"font-mono"),title:"string"==typeof l?l:e,"data-ug-slot":"value",children:_nullishCoalesce(l,()=>e)}),s.jsx.call(void 0,"div",{className:t.cn.call(void 0,"flex shrink-0 items-center bg-surface-2 px-[calc(var(--content-gap)*0.375)]",d&&"border-l border-border-base"),"data-ug-slot":"action",children:s.jsxs.call(void 0,t.Button,{type:"button",variant:"ghost",size:"sm",disabled:r,onClick:async function handleCopy(){if(r)return;const a=e,l=++C.current.generation,isCurrent=()=>C.current.mounted&&C.current.generation===l&&C.current.value===a;j(!1),w.current&&(clearTimeout(w.current),w.current=null);try{if(!_optionalChain([navigator,"access",e=>e.clipboard,"optionalAccess",e=>e.writeText]))throw new Error("Clipboard API is not available");if(await navigator.clipboard.writeText(a),!isCurrent())return;if(j(!0),_optionalChain([h,"optionalCall",e=>e(a)]),!isCurrent())return;w.current&&clearTimeout(w.current),w.current=setTimeout(()=>{isCurrent()&&j(!1),w.current=null},1400)}catch(e){isCurrent()&&_optionalChain([p,"optionalCall",a=>a(e)])}},"aria-label":u?void 0:f?g:v,"aria-live":"polite","data-ug-slot":"button",children:[c?f?s.jsx.call(void 0,n.Check,{"aria-hidden":"true",focusable:"false",size:15}):s.jsx.call(void 0,n.Copy,{"aria-hidden":"true",focusable:"false",size:15}):null,u?f?g:v:null]})})]})]})});function DataTableIdentity({title:e,description:a,leading:l,showLeading:i=!0,showDescription:o=!0,className:n,...r}){return s.jsxs.call(void 0,"span",{className:t.cn.call(void 0,"gap-[calc(var(--content-gap)*0.5)]",n),...r,"data-size":"md","data-state":"default","data-ug":"data-table-identity","data-variant":"default",children:[i&&l?s.jsx.call(void 0,"span",{"data-ug-slot":"leading",children:l}):null,s.jsxs.call(void 0,"span",{"data-ug-slot":"copy",children:[s.jsx.call(void 0,"strong",{"data-ug-slot":"title",children:e}),o&&a?s.jsx.call(void 0,"small",{className:"text-text-secondary","data-ug-slot":"description",children:a}):null]})]})}function DataTableToolbar({title:e,description:a,showDescription:l=!0,bordered:i=!0,compact:o=!1,actions:n,children:r,className:d,...c}){return s.jsxs.call(void 0,"div",{className:t.cn.call(void 0,"gap-[var(--content-gap)] border-border-base",!i&&"border-b-0",o&&"py-[calc(var(--content-gap)*0.5)]",d),...c,"data-size":o?"sm":"md","data-state":"default","data-ug":"data-table-toolbar","data-variant":"default",children:[s.jsxs.call(void 0,"div",{"data-ug-slot":"heading",children:[s.jsx.call(void 0,"strong",{"data-ug-slot":"title",children:e}),l&&a?s.jsx.call(void 0,"span",{"data-ug-slot":"description",children:a}):null]}),r?s.jsx.call(void 0,"div",{"data-ug-slot":"filters",children:r}):null,n?s.jsx.call(void 0,"div",{className:"flex shrink-0 flex-wrap items-center gap-[calc(var(--content-gap)*0.5)]","data-ug-slot":"actions",children:n}):null]})}f.displayName="CopyField";var j=i.forwardRef.call(void 0,({eyebrow:e,title:a,description:l,badge:i,breadcrumb:o,actions:n,meta:r,bordered:d=!0,compact:c=!1,children:u,className:v,...g},h)=>s.jsxs.call(void 0,"header",{ref:h,className:t.cn.call(void 0,"flex min-w-0 flex-col",c?"gap-[calc(var(--content-gap)*0.875)]":"gap-[calc(var(--content-gap)*1.25)]",d&&(c?"border-b border-border-base pb-[var(--content-gap)]":"border-b border-border-base pb-[calc(var(--content-gap)*1.5)]"),v),...g,"data-ug":"page-header","data-state":"default","data-variant":d?"default":"borderless","data-size":c?"sm":"md",children:[o?s.jsx.call(void 0,"div",{className:"min-w-0","data-ug-slot":"breadcrumb",children:o}):null,s.jsxs.call(void 0,"div",{className:"flex min-w-0 flex-col gap-[var(--content-gap)] lg:flex-row lg:items-start lg:justify-between","data-ug-slot":"body",children:[s.jsxs.call(void 0,"div",{className:"min-w-0 space-y-[calc(var(--content-gap)*0.75)]","data-ug-slot":"content",children:[e?s.jsx.call(void 0,"div",{className:"text-xs font-semibold uppercase text-primary","data-ug-slot":"eyebrow",children:e}):null,s.jsxs.call(void 0,"div",{className:"flex min-w-0 flex-wrap items-center gap-[calc(var(--content-gap)*0.625)]",children:[s.jsx.call(void 0,"h1",{className:"min-w-0 break-words text-2xl font-bold leading-tight text-text-primary sm:text-3xl","data-ug-slot":"title",children:a}),i?s.jsx.call(void 0,"div",{className:"shrink-0","data-ug-slot":"badge",children:i}):null]}),l?s.jsx.call(void 0,"p",{className:"max-w-3xl text-sm leading-6 text-text-secondary","data-ug-slot":"description",children:l}):null,r?s.jsx.call(void 0,"div",{className:"flex min-w-0 flex-wrap items-center gap-x-[var(--content-gap)] gap-y-[calc(var(--content-gap)*0.5)] text-xs text-text-tertiary","data-ug-slot":"meta",children:r}):null]}),n?s.jsx.call(void 0,"div",{className:"flex shrink-0 flex-wrap items-center gap-[calc(var(--content-gap)*0.5)] lg:justify-end","data-ug-slot":"actions",children:n}):null]}),u?s.jsx.call(void 0,"div",{className:"min-w-0","data-ug-slot":"footer",children:u}):null]}));j.displayName="PageHeader";var w={2:"md:grid-cols-2 xl:grid-cols-2",3:"md:grid-cols-2 lg:grid-cols-3",4:"md:grid-cols-2 xl:grid-cols-4"};function QuickAccessContent({item:e,showIcon:a,showIndicator:l}){const i=e.icon,o=Boolean(a&&i);return s.jsxs.call(void 0,s.Fragment,{children:[o&&i?s.jsx.call(void 0,"span",{"aria-hidden":"true",className:"flex h-[var(--control-height-lg)] w-[var(--control-height-lg)] shrink-0 items-center justify-center rounded-[var(--radius-control)] bg-primary-soft text-primary-soft-fg","data-ug-slot":"icon",children:s.jsx.call(void 0,i,{size:20})}):null,s.jsxs.call(void 0,"span",{className:t.cn.call(void 0,"min-w-0",!o&&"col-start-1"),"data-ug-slot":"content",children:[s.jsxs.call(void 0,"span",{className:"flex min-w-0 flex-wrap items-center gap-x-[calc(var(--content-gap)*0.5)] gap-y-1",children:[s.jsx.call(void 0,"strong",{className:"min-w-0 break-words text-sm font-semibold leading-5","data-ug-slot":"item-title",children:e.title}),e.meta?s.jsx.call(void 0,"span",{className:"text-xs leading-5 text-text-tertiary","data-ug-slot":"meta",children:e.meta}):null]}),e.description?s.jsx.call(void 0,"span",{className:"mt-1 block break-words text-xs leading-5 text-text-secondary","data-ug-slot":"item-description",children:e.description}):null]}),l?s.jsx.call(void 0,n.ArrowRight,{"aria-hidden":"true",className:t.cn.call(void 0,"shrink-0 text-text-tertiary transition-[color] duration-[var(--motion-duration-state)] ease-[var(--motion-easing-state)] group-hover:text-primary",!o&&"col-start-2"),"data-ug-slot":"indicator",size:16}):null]})}var C=i.forwardRef.call(void 0,({title:e,description:a,items:l,columns:i=4,showIndicator:o=!0,showIcon:n=!0,bordered:r=!0,onSelect:d,className:c,...u},v)=>s.jsxs.call(void 0,"section",{ref:v,...u,className:t.cn.call(void 0,"min-w-0 space-y-[var(--content-gap)]",c),"data-ug":"quick-access","data-state":l.length>0?"ready":"empty","data-variant":i,"data-size":"md",children:[e||a?s.jsxs.call(void 0,"div",{className:"min-w-0 space-y-1","data-ug-slot":"header",children:[e?s.jsx.call(void 0,"h2",{className:"text-base font-semibold leading-6 text-text-primary","data-ug-slot":"title",children:e}):null,a?s.jsx.call(void 0,"p",{className:"text-sm leading-6 text-text-secondary","data-ug-slot":"description",children:a}):null]}):null,s.jsx.call(void 0,"div",{className:t.cn.call(void 0,"grid min-w-0 gap-[var(--content-gap)]",w[i]),"data-ug-slot":"grid",children:l.map(e=>{const a=e.disabled?"disabled":"interactive",l=function getItemClasses(e,a,l){const i=a&&l?"grid-cols-[auto_minmax(0,1fr)_auto]":a?"grid-cols-[auto_minmax(0,1fr)]":l?"grid-cols-[minmax(0,1fr)_auto]":"grid-cols-[minmax(0,1fr)]";return t.cn.call(void 0,"group grid min-h-[calc(var(--control-height-lg)*2)] min-w-0 w-full items-center gap-[var(--content-gap)]",i,"rounded-[var(--radius-panel)] bg-surface-1 p-[var(--content-gap)] text-left text-text-primary shadow-sm",e?"border border-border-base hover:border-border-strong":"border border-transparent","transition-[background-color,border-color,box-shadow] duration-[var(--motion-duration-state)] ease-[var(--motion-easing-state)]","hover:bg-surface-2 hover:shadow-md focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary focus-visible:ring-offset-2","disabled:cursor-not-allowed disabled:opacity-50 disabled:hover:border-border-base disabled:hover:bg-surface-1 disabled:hover:shadow-sm")}(r,Boolean(n&&e.icon),o);return e.href&&!e.disabled?s.jsx.call(void 0,"a",{className:l,"data-state":a,"data-ug-slot":"item",href:e.href,onClick:()=>_optionalChain([d,"optionalCall",a=>a(e)]),children:s.jsx.call(void 0,QuickAccessContent,{item:e,showIcon:n,showIndicator:o})},e.id):s.jsx.call(void 0,"button",{className:l,"data-state":a,"data-ug-slot":"item",disabled:e.disabled,onClick:()=>_optionalChain([d,"optionalCall",a=>a(e)]),type:"button",children:s.jsx.call(void 0,QuickAccessContent,{item:e,showIcon:n,showIndicator:o})},e.id)})})]}));C.displayName="QuickAccess";var y=i.forwardRef.call(void 0,({value:a,onValueChange:l,onSubmit:i,onStop:o,onPasteFiles:r,header:d,leading:c,trailing:u,footer:v,submitting:g=!1,disabled:h=!1,submitDisabled:p=!1,allowEmpty:m=!1,submitOnEnter:x=!0,inputLabel:b="消息输入",placeholder:f,submitLabel:j="发送",stopLabel:w="停止",bordered:C=!0,showCharacterCount:y=!1,maxLength:N,shortcutHint:k,showShortcutHint:S,textareaProps:T,className:z,..._},A)=>{const R=!h&&!g&&!p&&(m||a.trim().length>0);function submit(){R&&i(a)}const M=_nullishCoalesce(S,()=>Boolean(k))?_nullishCoalesce(k,()=>x?"Enter 发送 · Shift+Enter 换行":null):null,L=y||Boolean(M);return s.jsxs.call(void 0,"div",{className:t.cn.call(void 0,"grid min-w-0 gap-[calc(var(--content-gap)*0.625)] rounded-[var(--radius-panel)] bg-surface-1 p-[calc(var(--content-gap)*0.75)] shadow-sm transition-[border-color,box-shadow]",C?"border border-border-strong focus-within:border-primary/70":"border border-transparent",h&&"opacity-60",z),..._,"data-ug":"prompt-composer","data-state":h?"disabled":g?"submitting":"default","data-variant":"default","data-size":"md",children:[d?s.jsx.call(void 0,"div",{className:"min-w-0","data-ug-slot":"header",children:d}):null,s.jsxs.call(void 0,"div",{className:"flex min-w-0 items-end gap-[calc(var(--content-gap)*0.5)]","data-ug-slot":"body",children:[c?s.jsx.call(void 0,"div",{className:"flex h-[var(--control-height-md)] shrink-0 items-center","data-ug-slot":"leading",children:c}):null,s.jsx.call(void 0,"div",{className:"min-w-0 flex-1","data-ug-slot":"input",children:s.jsx.call(void 0,e.Textarea,{...T,ref:A,"aria-label":_nullishCoalesce(_optionalChain([T,"optionalAccess",e=>e["aria-label"]]),()=>b),autosize:_nullishCoalesce(_optionalChain([T,"optionalAccess",e=>e.autosize]),()=>({minRows:1,maxRows:8})),className:t.cn.call(void 0,"min-h-[var(--control-height-md)] border-transparent bg-transparent px-[calc(var(--control-padding-x-sm)*0.5)] py-[var(--ug-prompt-input-padding-y)] shadow-none focus-visible:!border-transparent focus-visible:!ring-0 focus-visible:!ring-offset-0",_optionalChain([T,"optionalAccess",e=>e.className])),disabled:h,maxLength:_nullishCoalesce(N,()=>_optionalChain([T,"optionalAccess",e=>e.maxLength])),onKeyDown:function handleKeyDown(e){x&&"Enter"===e.key&&(e.shiftKey||e.nativeEvent.isComposing||(e.preventDefault(),submit()))},onPaste:function handlePaste(e){if(!r)return;const a=Array.from(e.clipboardData.files);a.length>0&&r(a,e)},onValueChange:l,placeholder:_nullishCoalesce(f,()=>_optionalChain([T,"optionalAccess",e=>e.placeholder])),resize:"none",value:a})}),u?s.jsx.call(void 0,"div",{className:"flex h-[var(--control-height-md)] shrink-0 items-center gap-1","data-ug-slot":"trailing",children:u}):null,g&&o?s.jsx.call(void 0,t.Button,{"aria-label":w,onClick:o,size:"icon",tone:"danger",type:"button",variant:"soft","data-ug-slot":"submit",children:s.jsx.call(void 0,n.Square,{"aria-hidden":"true",size:15})}):s.jsx.call(void 0,t.Button,{"aria-label":j,disabled:!R,onClick:submit,size:"icon",tone:"primary",type:"button",variant:"solid","data-ug-slot":"submit",children:s.jsx.call(void 0,n.Send,{"aria-hidden":"true",size:16})})]}),v||L?s.jsxs.call(void 0,"div",{className:"flex min-w-0 flex-wrap items-center justify-between gap-2 text-xs text-text-tertiary","data-ug-slot":"footer",children:[v?s.jsx.call(void 0,"div",{className:"min-w-0 flex-1",children:v}):null,L?s.jsxs.call(void 0,"div",{className:"ml-auto flex shrink-0 items-center gap-3 tabular-nums","data-ug-slot":"footer-meta",children:[M?s.jsx.call(void 0,"span",{"data-ug-slot":"shortcut-hint",children:M}):null,y?s.jsx.call(void 0,"span",{"data-ug-slot":"character-count",children:void 0!==N?`${a.length}/${N}`:`${a.length}`}):null]}):null]}):null]})});y.displayName="PromptComposer";var N=i.forwardRef.call(void 0,({messageRole:e,status:a="idle",avatar:l,header:i,footer:o,children:n,className:r,...d},c)=>s.jsxs.call(void 0,"article",{ref:c,className:t.cn.call(void 0,"flex min-w-0 gap-[calc(var(--content-gap)*0.75)]","user"===e&&"justify-end",r),...d,"data-ug":"message","data-state":a,"data-variant":e,"data-size":"md",children:[l&&"user"!==e?s.jsx.call(void 0,"div",{className:"shrink-0","data-ug-slot":"avatar",children:l}):null,s.jsxs.call(void 0,"div",{className:t.cn.call(void 0,"grid min-w-0 gap-[calc(var(--content-gap)*0.5)]","user"===e?"max-w-[min(85%,44rem)] rounded-[var(--radius-panel)] bg-surface-2 px-[var(--control-padding-x-lg)] py-[calc(var(--content-gap)*0.75)]":"w-full","error"===a&&"text-danger"),"data-ug-slot":"body",children:[i?s.jsx.call(void 0,"div",{className:"text-xs font-medium text-text-secondary","data-ug-slot":"header",children:i}):null,s.jsxs.call(void 0,"div",{className:"min-w-0 break-words text-sm leading-7 text-text-primary","data-ug-slot":"content",children:[n,"streaming"===a?s.jsx.call(void 0,"span",{"aria-label":"正在生成",className:"ml-1 inline-block size-1.5 animate-pulse rounded-full bg-primary motion-reduce:animate-none","data-ug-slot":"streaming"}):null]}),o?s.jsx.call(void 0,"div",{className:"flex min-w-0 flex-wrap items-center gap-2 text-xs text-text-tertiary","data-ug-slot":"footer",children:o}):null]}),l&&"user"===e?s.jsx.call(void 0,"div",{className:"shrink-0","data-ug-slot":"avatar",children:l}):null]}));N.displayName="Message";var k=i.forwardRef.call(void 0,({empty:e,followOutput:a=!0,followThreshold:l=80,children:o,className:n,onScroll:r,...d},c)=>{const u=i.useRef.call(void 0,null),v=i.useRef.call(void 0,!0),g=i.Children.count(o)>0;return i.useEffect.call(void 0,()=>{const e=u.current;a&&e&&v.current&&_optionalChain([e,"access",e=>e.scrollTo,"optionalCall",a=>a({top:e.scrollHeight,behavior:"auto"})])},[o,a]),s.jsx.call(void 0,"div",{ref:function setRef(e){u.current=e,"function"==typeof c?c(e):c&&(c.current=e)},"aria-live":"polite","aria-relevant":"additions text",className:t.cn.call(void 0,"grid min-w-0 gap-[calc(var(--content-gap)*1.5)] overflow-y-auto overscroll-contain [min-height:0] [scrollbar-color:var(--color-border-strong)_transparent] [scrollbar-width:thin]",g?"content-start":"content-center",n),onScroll:function handleScroll(e){const a=e.currentTarget;v.current=a.scrollHeight-a.scrollTop-a.clientHeight<=Math.max(0,l),_optionalChain([r,"optionalCall",a=>a(e)])},role:"log",tabIndex:0,...d,"data-ug":"message-list","data-state":g?"populated":"empty","data-variant":a?"follow":"static","data-size":"md",children:g?o:s.jsx.call(void 0,"div",{className:"grid place-items-center text-center text-sm text-text-secondary [min-height:calc(var(--control-height-lg)*4)]","data-ug-slot":"empty",children:e})})});k.displayName="MessageList";var S=i.forwardRef.call(void 0,({items:e,onRemove:a,renderPreview:l,orientation:i="horizontal",showPreview:o=!0,showStatus:r=!0,showMeta:d=!0,bordered:c=!0,compact:u=!1,getRemoveLabel:v=e=>`移除附件:${e.name}`,empty:g,className:h,tabIndex:p,...m},x)=>0!==e.length||g?s.jsx.call(void 0,"ul",{ref:x,"aria-label":"附件",className:t.cn.call(void 0,"min-w-0 gap-[calc(var(--content-gap)*0.5)]","horizontal"===i?"flex overflow-x-auto pb-1 [scrollbar-width:thin]":"grid",h),tabIndex:_nullishCoalesce(p,()=>"horizontal"===i?0:void 0),...m,"data-ug":"attachment-list","data-state":e.length>0?"populated":"empty","data-variant":i,"data-size":u?"xs":"sm",children:0===e.length?s.jsx.call(void 0,"li",{className:"text-sm text-text-secondary","data-ug-slot":"empty",children:g}):e.map(e=>{const g=_optionalChain([e,"access",e=>e.mime,"optionalAccess",e=>e.startsWith,"call",e=>e("image/")])&&e.previewUrl,h=_nullishCoalesce(e.status,()=>"ready"),p=r?_nullishCoalesce(e.statusLabel,()=>({uploading:"正在上传",success:"上传完成",error:"上传失败"}[h])):void 0,m="uploading"===h?n.LoaderCircle:"success"===h?n.CircleCheck:"error"===h?n.TriangleAlert:null,x=d?e.meta:null;return s.jsxs.call(void 0,"li",{"aria-busy":"uploading"===h||void 0,"aria-invalid":"error"===h||void 0,className:t.cn.call(void 0,"group flex shrink-0 items-center rounded-[var(--radius-control)] bg-surface-2","horizontal"===i?"min-w-52 max-w-72":"w-full min-w-0",c?"border border-border-base":"border border-transparent",u?"gap-1.5 p-1.5":"gap-2 p-2"),"data-state":h,"data-ug-slot":"item",children:[o?s.jsx.call(void 0,"div",{className:t.cn.call(void 0,"grid shrink-0 place-items-center overflow-hidden rounded-[var(--radius-control)] bg-surface-1 text-text-secondary",u?"size-[var(--control-height-md)]":"size-[var(--control-height-lg)]"),"data-ug-slot":"preview",children:l?l(e):g?s.jsx.call(void 0,"img",{alt:e.name,className:"size-full object-cover",src:e.previewUrl}):s.jsx.call(void 0,n.File,{"aria-hidden":"true",size:u?15:17})}):null,s.jsxs.call(void 0,"div",{className:"min-w-0 flex-1","data-ug-slot":"content",children:[s.jsx.call(void 0,"p",{className:"truncate text-xs font-medium text-text-primary",title:e.name,children:e.name}),p||x?s.jsxs.call(void 0,"div",{className:"mt-1 flex min-w-0 items-center gap-1.5 text-xs text-text-tertiary","data-ug-slot":"meta",children:[p?s.jsxs.call(void 0,"span",{className:t.cn.call(void 0,"inline-flex min-w-0 items-center gap-1 truncate","uploading"===h&&"text-primary","success"===h&&"text-success-soft-fg","error"===h&&"text-danger"),"data-ug-slot":"status",role:"ready"===h?void 0:"status",children:[m?s.jsx.call(void 0,m,{"aria-hidden":"true",className:t.cn.call(void 0,"size-3.5 shrink-0","uploading"===h&&"animate-spin motion-reduce:animate-none")}):null,s.jsx.call(void 0,"span",{className:"truncate",children:p})]}):null,x?s.jsx.call(void 0,"span",{className:"min-w-0 truncate","data-ug-slot":"detail",children:x}):null]}):null]}),a?s.jsx.call(void 0,t.Button,{"aria-label":v(e),onClick:()=>a(e),size:"icon-sm",type:"button",variant:"ghost","data-ug-slot":"remove",children:s.jsx.call(void 0,n.X,{"aria-hidden":"true",size:13})}):null]},e.id)})}):null);S.displayName="AttachmentList";var T=i.forwardRef.call(void 0,({items:e,activeId:a,onSelect:l,renderActions:i,empty:o="暂无会话",orientation:n="vertical",activeStyle:r="soft",showBadge:d=!0,showDescription:c=!0,listLabel:u="会话列表",className:v,tabIndex:g,...h},p)=>s.jsx.call(void 0,"div",{ref:p,"aria-label":u,className:t.cn.call(void 0,"horizontal"===n?"flex min-w-0 gap-1 overflow-x-auto pb-1 [scrollbar-width:thin]":"grid min-w-0 content-start gap-1",v),role:"list",tabIndex:_nullishCoalesce(g,()=>"horizontal"===n?0:void 0),...h,"data-ug":"conversation-list","data-active-style":r,"data-state":e.length>0?"populated":"empty","data-variant":n,"data-size":"md",children:0===e.length?s.jsx.call(void 0,"div",{className:"px-[var(--control-padding-x-md)] py-[var(--content-gap)] text-sm text-text-secondary","data-ug-slot":"empty",children:o}):e.map(e=>{const o=e.id===a;return s.jsxs.call(void 0,"div",{className:t.cn.call(void 0,"group relative flex min-w-0 items-center rounded-[var(--radius-control)] transition-[background-color,color] duration-[var(--motion-duration-state)] ease-[var(--motion-easing-state)] motion-reduce:transition-none","horizontal"===n&&"min-w-52 shrink-0",o?t.cn.call(void 0,"bg-primary-soft","bordered"===r&&"ring-1 ring-inset ring-primary/30","indicator"===r&&"before:absolute before:left-0 before:top-1/2 before:h-[calc(var(--control-height-sm)*0.6)] before:w-[3px] before:-translate-y-1/2 before:rounded-r-[var(--radius-control)] before:bg-primary before:content-['']"):"hover:bg-surface-2",e.disabled&&"opacity-50"),"data-state":e.disabled?"disabled":o?"active":"default","data-ug-slot":"item",role:"listitem",children:[s.jsxs.call(void 0,"button",{"aria-current":o?"page":void 0,className:"min-w-0 flex-1 rounded-[var(--radius-control)] px-[var(--control-padding-x-md)] py-[calc(var(--content-gap)*0.625)] text-left focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring/40",disabled:e.disabled,onClick:()=>l(e),type:"button","data-ug-slot":"trigger",children:[s.jsxs.call(void 0,"span",{className:"flex min-w-0 items-center gap-2",children:[s.jsx.call(void 0,"span",{className:t.cn.call(void 0,"min-w-0 flex-1 truncate text-sm text-text-primary",o?"font-semibold":"font-medium"),"data-ug-slot":"title",children:e.title}),d&&e.badge?s.jsx.call(void 0,"span",{className:"shrink-0","data-ug-slot":"badge",children:e.badge}):null]}),c&&e.description?s.jsx.call(void 0,"span",{className:t.cn.call(void 0,"mt-0.5 block truncate text-xs",o?"text-primary-soft-fg":"text-text-tertiary"),"data-ug-slot":"description",children:e.description}):null]}),i?s.jsx.call(void 0,"div",{className:"flex shrink-0 items-center gap-1 pr-2","data-ug-slot":"actions",children:i(e)}):null]},e.id)})}));T.displayName="ConversationList";var z=[{value:"sidebar",label:"左侧导航"},{value:"header",label:"顶部导航"}],_=[{value:"light",label:"浅色"},{value:"dark",label:"深色"}],A=[{value:"highlight",label:"主题色块",description:"使用柔和主题底色突出当前菜单。"},{value:"indicator",label:"侧边标记",description:"使用淡色背景叠加左侧标记,定位更清楚。"}],R=[{value:"comfortable",label:"舒适"},{value:"compact",label:"紧凑"}];function ModeIcon({value:e}){return"system"===e?s.jsx.call(void 0,n.Monitor,{"aria-hidden":"true",size:16}):"light"===e?s.jsx.call(void 0,n.Sun,{"aria-hidden":"true",size:16}):"dark"===e?s.jsx.call(void 0,n.Moon,{"aria-hidden":"true",size:16}):null}function ThemePresetPreview({selected:e,value:a}){const l="mecha"===a;return s.jsxs.call(void 0,"span",{"aria-hidden":"true",className:t.cn.call(void 0,"relative flex h-[calc(var(--control-height-lg)*1.75)] w-full overflow-hidden rounded-[calc(var(--radius-control)*0.75)] border bg-surface-0 transition-[border-color,box-shadow,transform] duration-[var(--motion-duration-state)] ease-[var(--motion-easing-state)]",e?"border-primary shadow-sm ring-1 ring-primary/20":"border-border-base shadow-xs"),"data-ug-mode":"light","data-ug":"theme-preview","data-ug-theme":a,children:[e?s.jsx.call(void 0,"span",{className:"absolute right-1.5 top-1.5 z-10 inline-flex h-[calc(var(--control-height-sm)*0.75)] w-[calc(var(--control-height-sm)*0.75)] items-center justify-center rounded-full bg-primary text-primary-fg shadow-sm",children:s.jsx.call(void 0,n.Check,{"aria-hidden":"true",size:12,strokeWidth:3})}):null,s.jsxs.call(void 0,"span",{className:"flex w-[24%] flex-col gap-1 border-r border-border-base bg-text-primary p-[calc(var(--content-gap)*0.375)]",children:[s.jsx.call(void 0,"span",{className:"h-[calc(var(--control-height-sm)*0.2)] w-8 rounded-full bg-primary"}),s.jsx.call(void 0,"span",{className:"mt-1 h-[calc(var(--control-height-sm)*0.16)] w-full rounded-full bg-surface-3"}),s.jsx.call(void 0,"span",{className:"h-[calc(var(--control-height-sm)*0.16)] w-4/5 rounded-full bg-surface-3"}),s.jsx.call(void 0,"span",{className:"h-[calc(var(--control-height-sm)*0.16)] w-3/4 rounded-full bg-surface-3"}),s.jsx.call(void 0,"span",{className:"mt-auto h-[calc(var(--control-height-sm)*0.16)] w-2/3 rounded-full bg-surface-3"})]}),s.jsxs.call(void 0,"span",{className:t.cn.call(void 0,"flex min-w-0 flex-1 flex-col",l?"bg-text-primary":"bg-surface-0"),children:[s.jsx.call(void 0,"span",{className:t.cn.call(void 0,"h-[calc(var(--control-height-sm)*0.48)] border-b border-border-base",l?"bg-text-primary":"bg-surface-1")}),s.jsxs.call(void 0,"span",{className:"grid flex-1 grid-cols-3 gap-1.5 p-[calc(var(--content-gap)*0.375)]",children:[[0,1,2].map(e=>s.jsx.call(void 0,"span",{className:t.cn.call(void 0,"h-[calc(var(--control-height-sm)*0.42)] rounded-[calc(var(--radius-control)*0.35)] border border-border-base",l?"bg-text-secondary":1===e?"bg-primary-soft":"bg-surface-1")},e)),s.jsxs.call(void 0,"span",{className:t.cn.call(void 0,"relative col-span-3 overflow-hidden rounded-[calc(var(--radius-control)*0.4)] border border-border-base",l?"bg-text-secondary":"bg-surface-1"),children:[s.jsx.call(void 0,"span",{className:"absolute inset-x-2 bottom-2 top-2 border-b border-l border-border-base"}),s.jsx.call(void 0,"svg",{className:"absolute inset-2 h-[calc(100%_-_var(--content-gap))] w-[calc(100%_-_var(--content-gap))] overflow-visible text-primary",preserveAspectRatio:"none",viewBox:"0 0 100 32",children:s.jsx.call(void 0,"path",{d:"M0 25 C12 22, 16 14, 28 18 S45 27, 56 14 S74 8, 100 4",fill:"none",stroke:"currentColor",strokeWidth:"2",vectorEffect:"non-scaling-stroke"})})]})]})]})]})}function ChoiceGroup({title:a,description:l,value:o,options:r,onValueChange:d,presentation:c="compact",swatch:u,iconSet:v}){const g=i.useId.call(void 0),h=i.useId.call(void 0),p="card"===c,m="preview"===c,x=void 0!==u,b=!p&&!m&&!x;return s.jsxs.call(void 0,"section",{className:t.cn.call(void 0,"min-w-0",(b||x)&&"ug-theme-config-row"),"data-presentation":x?"swatch":c,"data-ug-slot":"group",children:[s.jsxs.call(void 0,"div",{className:"min-w-0",children:[s.jsx.call(void 0,"h3",{id:g,className:"m-0 text-sm font-semibold leading-5 text-text-primary",children:a}),s.jsx.call(void 0,"p",{id:h,className:"ug-theme-config-description",children:l})]}),s.jsx.call(void 0,e.RadioGroup,{"aria-describedby":h,"aria-labelledby":g,className:t.cn.call(void 0,"min-w-0",m&&"mt-2.5 grid grid-cols-1 gap-2.5 sm:grid-cols-3",p&&"mt-2 grid grid-cols-1 gap-2 sm:grid-cols-2",x&&"flex flex-wrap items-center gap-2.5",b&&"auto-cols-[minmax(max-content,1fr)]"),"data-ug-slot":"options",onValueChange:e=>d(String(e)),orientation:"horizontal",presentation:b?"segmented":"default",size:"default",sizing:b?"fill":"content",value:o,children:r.map(a=>s.jsx.call(void 0,e.Radio,{"aria-label":x?a.label:void 0,className:"hidden",controlClassName:x?void 0:"absolute",value:a.value,variant:p||m?"card":b?"segmented":"default",labelClassName:m?"group/theme flex min-h-[0] w-full cursor-pointer flex-col items-stretch gap-1.5 rounded-[var(--radius-control)] border-0 bg-transparent p-0 text-center shadow-none hover:bg-transparent focus-within:outline-none focus-within:ring-2 focus-within:ring-ring/30 data-[state=checked]:border-0 data-[state=checked]:bg-transparent data-[state=checked]:shadow-none":p?"min-h-[calc(var(--control-height-lg)*1.5)] gap-0 rounded-[var(--radius-control)] px-[calc(var(--content-gap)*0.75)] py-[calc(var(--content-gap)*0.5)]":x?"group/swatch min-h-[0] cursor-pointer gap-0 rounded-full p-0 focus-within:outline-none":b?"min-w-max px-[calc(var(--control-padding-x-sm)*0.75)]":void 0,label:s.jsxs.call(void 0,"span",{className:t.cn.call(void 0,"flex min-w-0",p||m?"flex-col gap-1":"items-center gap-2",x&&"block"),children:[m?s.jsx.call(void 0,ThemePresetPreview,{selected:a.value===o,value:a.value}):null,s.jsxs.call(void 0,"span",{className:"inline-flex min-w-0 items-center gap-2",children:["mode"===v?s.jsx.call(void 0,ModeIcon,{value:a.value}):null,x?s.jsx.call(void 0,"span",{"aria-hidden":"true","data-ug-swatch":"accent","data-ug-accent":a.value,children:s.jsx.call(void 0,n.Check,{"aria-hidden":"true",className:a.value===o?void 0:"invisible","data-ug-swatch-check":a.value===o?"":void 0,size:13,strokeWidth:3})}):null,s.jsx.call(void 0,"span",{className:t.cn.call(void 0,"min-w-0",p?"font-semibold text-text-primary":m?"w-full text-center font-medium text-text-primary":x?"sr-only":"truncate"),children:a.label})]}),p&&a.description?s.jsx.call(void 0,"span",{className:"text-xs font-normal leading-4 text-text-secondary",children:a.description}):null]})},a.value))})]})}var M=[{key:"background",label:"导航背景"},{key:"text",label:"普通文字"},{key:"activeBackground",label:"选中背景"},{key:"activeText",label:"选中文字"},{key:"hoverBackground",label:"悬停背景"}];function NavigationColorInput({label:e,value:a,onValueCommit:l}){const t=i.useRef.call(void 0,null),o=i.useRef.call(void 0,l);return o.current=l,i.useEffect.call(void 0,()=>{const e=t.current;if(!e)return;const commitValue=()=>o.current(e.value);return e.addEventListener("change",commitValue),()=>e.removeEventListener("change",commitValue)},[]),i.useEffect.call(void 0,()=>{t.current&&t.current.value!==a&&(t.current.value=a)},[a]),s.jsx.call(void 0,"input",{ref:t,"aria-label":e,"data-ug-slot":"color-swatch",defaultValue:a,type:"color"})}function NavigationColorGroup({customized:e,value:a,onReset:l,onValueChange:i}){return s.jsxs.call(void 0,"section",{className:"ug-theme-config-row min-w-0","data-presentation":"colors","data-ug":"navigation-colors","data-ug-slot":"group",children:[s.jsxs.call(void 0,"div",{className:"min-w-0","data-ug-slot":"group-label",children:[s.jsx.call(void 0,"h3",{className:"m-0 text-sm font-semibold leading-5 text-text-primary",children:"导航颜色"}),e?s.jsx.call(void 0,t.Button,{onClick:l,size:"sm",tone:"neutral",variant:"ghost",children:"恢复主题配色"}):null]}),s.jsx.call(void 0,"div",{"data-ug-slot":"options",children:M.map(e=>s.jsxs.call(void 0,"label",{"data-ug-slot":"color-option",children:[s.jsx.call(void 0,NavigationColorInput,{label:e.label,onValueCommit:l=>i({...a,[e.key]:l}),value:a[e.key]}),s.jsx.call(void 0,"span",{"data-ug-slot":"color-label",children:e.label}),s.jsx.call(void 0,"code",{"data-ug-slot":"color-value",children:a[e.key].toUpperCase()})]},e.key))})]})}function TabLabel({icon:e,children:a}){return s.jsxs.call(void 0,"span",{className:"gap-[calc(var(--content-gap)*0.625)]","data-ug-slot":"tab-label",children:[s.jsx.call(void 0,"span",{"data-ug-slot":"tab-icon",children:e}),s.jsx.call(void 0,"span",{className:"truncate",children:a})]})}var L=i.forwardRef.call(void 0,({value:l,onValueChange:o,options:r,sidebarValue:d,onSidebarValueChange:c,appearanceAddon:v,sidebarAddon:g,className:h,...p},m)=>{const[x,b]=i.useState.call(void 0,"appearance"),f=a.useMediaQuery.call(void 0,"(prefers-color-scheme: dark)"),j=i.useMemo.call(void 0,()=>({...u.defaultUGThemeConfiguratorOptions,...r}),[r]),w=_nullishCoalesce(d.palette,()=>"primary"===d.variant?"light":"dark"),C=d.colors?w:u.resolveUGNavigationPalette.call(void 0,l.mode,f),y=u.resolveUGNavigationColors.call(void 0,l.preset,C,d.colors,l.accent);function updateField(e,a){o({...l,[e]:a})}function updateSidebarField(e,a){c({...d,[e]:a})}return s.jsx.call(void 0,"div",{ref:m,className:t.cn.call(void 0,"h-full min-h-[0] min-w-0 text-text-primary",h),"data-ug":"theme-configurator","data-state":"ready","data-variant":"panel","data-size":"default",...p,children:s.jsx.call(void 0,e.Tabs,{className:"h-full",onValueChange:e=>b(e),size:"md",value:x,variant:"rail",children:s.jsxs.call(void 0,"div",{"data-ug-slot":"configurator-layout",children:[s.jsx.call(void 0,"div",{"data-ug-slot":"navigation",children:s.jsxs.call(void 0,e.TabsList,{"aria-label":"外观设置分类",orientation:"vertical",children:[s.jsx.call(void 0,e.TabsTrigger,{value:"appearance",children:s.jsx.call(void 0,TabLabel,{icon:s.jsx.call(void 0,n.SwatchBook,{"aria-hidden":"true",size:16}),children:"主题外观"})}),s.jsx.call(void 0,e.TabsTrigger,{value:"sidebar",children:s.jsx.call(void 0,TabLabel,{icon:s.jsx.call(void 0,n.PanelTop,{"aria-hidden":"true",size:16}),children:"导航菜单"})})]})}),s.jsxs.call(void 0,"div",{className:"min-h-[0]","data-ug-slot":"settings",children:[s.jsxs.call(void 0,e.TabsContent,{className:"ug-theme-config-appearance min-w-0",value:"appearance",children:[s.jsx.call(void 0,ChoiceGroup,{title:"主题风格",description:"选择整套界面的基础视觉气质。",value:l.preset,options:j.presets,presentation:"preview",onValueChange:e=>updateField("preset",e)}),s.jsx.call(void 0,ChoiceGroup,{title:"显示模式",description:"使用亮色、暗色,或自动跟随操作系统。",value:l.mode,options:j.modes,iconSet:"mode",onValueChange:e=>updateField("mode",e)}),s.jsx.call(void 0,ChoiceGroup,{title:"主题色",description:"统一按钮、链接、当前项和焦点状态。",value:l.accent,options:j.accents,swatch:"accent",onValueChange:e=>updateField("accent",e)}),s.jsxs.call(void 0,"section",{"data-ug-slot":"detail-section",children:[s.jsx.call(void 0,"div",{"data-ug-slot":"section-heading",children:s.jsx.call(void 0,"h3",{className:"m-0 text-sm font-semibold leading-5 text-text-primary",children:"界面细节"})}),s.jsxs.call(void 0,"div",{"data-ug-slot":"detail-grid",children:[s.jsx.call(void 0,ChoiceGroup,{title:"界面密度",description:"控制页面留白与控件间距。",value:l.density,options:j.densities,onValueChange:e=>updateField("density",e)}),s.jsx.call(void 0,ChoiceGroup,{title:"圆角风格",description:"统一控件和面板的边角语言。",value:l.radius,options:j.radii,onValueChange:e=>updateField("radius",e)}),s.jsx.call(void 0,ChoiceGroup,{title:"阴影层级",description:"调整浮层与卡片的空间层次。",value:l.shadow,options:j.shadows,onValueChange:e=>updateField("shadow",e)}),s.jsx.call(void 0,ChoiceGroup,{title:"字体排版",description:"选择阅读性或信息密度取向。",value:l.font,options:j.fonts,onValueChange:e=>updateField("font",e)}),s.jsx.call(void 0,ChoiceGroup,{title:"文字对比",description:"调整正文和次要信息的清晰度。",value:l.contrast,options:j.contrasts,onValueChange:e=>updateField("contrast",e)}),s.jsx.call(void 0,ChoiceGroup,{title:"界面动效",description:"控制过渡反馈的强弱。",value:l.motion,options:j.motions,onValueChange:e=>updateField("motion",e)}),s.jsx.call(void 0,ChoiceGroup,{title:"页面背景",description:"选择纯净、网格或柔光背景。",value:l.background,options:j.backgrounds,onValueChange:e=>updateField("background",e)})]})]}),v?s.jsx.call(void 0,"div",{"data-ug-slot":"appearance-addon",children:v}):null]}),s.jsxs.call(void 0,e.TabsContent,{className:"min-w-0",value:"sidebar",children:[s.jsxs.call(void 0,"div",{className:"ug-theme-config-sidebar-grid",children:[s.jsx.call(void 0,ChoiceGroup,{title:"导航位置",description:"选择左侧栏或桌面端顶栏导航。",value:_nullishCoalesce(d.mode,()=>"sidebar"),options:z,onValueChange:e=>updateSidebarField("mode",e)}),s.jsx.call(void 0,ChoiceGroup,{title:"配色基准",description:"默认跟随显示模式;选择后作为导航颜色覆盖。",value:C,options:_,onValueChange:e=>c({...d,palette:e,variant:"light"===e?"primary":"dark",colors:u.resolveUGNavigationColors.call(void 0,l.preset,e,void 0,l.accent)})}),s.jsx.call(void 0,NavigationColorGroup,{customized:Boolean(d.colors),value:y,onReset:()=>updateSidebarField("colors",void 0),onValueChange:e=>c({...d,palette:C,variant:"light"===C?"primary":"dark",colors:e})}),s.jsx.call(void 0,ChoiceGroup,{title:"当前菜单",description:"选择当前页面在导航中的强调方式。",value:d.activeStyle,options:A,onValueChange:e=>updateSidebarField("activeStyle",e)}),s.jsx.call(void 0,ChoiceGroup,{title:"菜单密度",description:"调整导航菜单的行高与间距。",value:d.density,options:R,onValueChange:e=>updateSidebarField("density",e)})]}),g?s.jsx.call(void 0,"div",{"data-ug-slot":"sidebar-addon",children:g}):null]})]})]})})})});function DefaultThemePreview({value:e,sidebarValue:l}){const t=a.useMediaQuery.call(void 0,"(prefers-color-scheme: dark)"),i=_nullishCoalesce(l.palette,()=>"primary"===l.variant?"light":"dark"),o=l.colors?i:u.resolveUGNavigationPalette.call(void 0,e.mode,t),n=u.resolveUGNavigationColors.call(void 0,e.preset,o,l.colors,e.accent),r={"--ug-preview-navigation-bg":n.background,"--ug-preview-navigation-text":n.text,"--ug-preview-navigation-active-bg":n.activeBackground,"--ug-preview-navigation-active-text":n.activeText,"--ug-preview-navigation-hover-bg":n.hoverBackground};return s.jsxs.call(void 0,"section",{"aria-label":"实时预览",className:"[--ug-theme-preview-gap:var(--content-gap)] border-border-base","data-ug":"theme-configurator-preview",children:[s.jsx.call(void 0,"h3",{"data-ug-preview":"title",children:"实时预览"}),s.jsxs.call(void 0,"div",{"data-navigation-active-style":l.activeStyle,"data-navigation-density":l.density,"data-navigation-mode":_nullishCoalesce(l.mode,()=>"sidebar"),"data-ug-accent":e.accent,"data-ug-background":e.background,"data-ug-contrast":e.contrast,"data-ug-density":e.density,"data-ug-font":e.font,"data-ug-mode":e.mode,"data-ug-motion":e.motion,"data-ug-radius":e.radius,"data-ug-shadow":e.shadow,"data-ug-preview":"frame","data-ug-surface":e.surface,"data-ug-theme":e.preset,style:r,children:[s.jsxs.call(void 0,"aside",{"data-ug-preview":"navigation",children:[s.jsx.call(void 0,"strong",{"data-ug-preview":"brand",children:"UG Admin"}),s.jsx.call(void 0,"div",{"data-ug-preview":"menu",children:["工作台","任务中心","数据分析","系统设置"].map((e,a)=>s.jsxs.call(void 0,"span",{"data-state":0===a?"active":"default","data-ug-preview":"menu-item",children:[s.jsx.call(void 0,"i",{"aria-hidden":"true","data-ug-preview":"menu-icon"}),s.jsx.call(void 0,"span",{children:e})]},e))})]}),s.jsxs.call(void 0,"div",{"data-ug-preview":"content",children:[s.jsxs.call(void 0,"header",{"data-ug-preview":"topbar",children:[s.jsx.call(void 0,"strong",{"data-ug-preview":"topbar-title",children:"工作台"}),s.jsxs.call(void 0,"span",{"aria-hidden":"true","data-ug-preview":"topbar-actions",children:[s.jsx.call(void 0,"i",{}),s.jsx.call(void 0,"i",{}),s.jsx.call(void 0,"i",{})]})]}),s.jsxs.call(void 0,"div",{"data-ug-preview":"tabs",children:[s.jsx.call(void 0,"span",{"data-state":"active",children:"工作台"}),s.jsx.call(void 0,"span",{children:"任务中心"}),s.jsx.call(void 0,"span",{children:"报表"})]}),s.jsxs.call(void 0,"main",{"data-ug-preview":"main",children:[s.jsx.call(void 0,"div",{"data-ug-preview":"stats",children:[["待办任务","12"],["团队成员","8"],["进行项目","24"]].map(([e,a])=>s.jsxs.call(void 0,"span",{"data-ug-preview":"stat",children:[s.jsx.call(void 0,"small",{children:e}),s.jsx.call(void 0,"strong",{children:a})]},e))}),s.jsxs.call(void 0,"div",{"data-ug-preview":"chart",children:[s.jsx.call(void 0,"strong",{children:"工作概览"}),s.jsx.call(void 0,"svg",{"aria-hidden":"true",preserveAspectRatio:"none",viewBox:"0 0 240 72",children:s.jsx.call(void 0,"path",{d:"M0 58 C28 48, 38 24, 66 36 S102 58, 130 28 S172 42, 240 12",fill:"none",stroke:"currentColor",strokeWidth:"3",vectorEffect:"non-scaling-stroke"})})]}),s.jsx.call(void 0,"div",{"data-ug-preview":"table",children:["整理发布计划","复核访问权限","更新项目进度"].map((e,a)=>s.jsxs.call(void 0,"span",{"data-ug-preview":"table-row",children:[s.jsx.call(void 0,"span",{children:e}),s.jsx.call(void 0,"i",{"data-state":1===a?"warning":"success",children:1===a?"待处理":"已完成"})]},e))})]})]})]})]})}function ThemeConfiguratorDialog({open:a,onOpenChange:l,onReset:i,onCancel:o,onApply:r,title:d="外观设置",preview:c,showPreview:u=!0,resetLabel:v="恢复默认",cancelLabel:g="取消",applyLabel:h,doneLabel:p,...m}){const x=_nullishCoalesce(_nullishCoalesce(h,()=>p),()=>"应用"),b=void 0===c?s.jsx.call(void 0,DefaultThemePreview,{value:m.value,sidebarValue:m.sidebarValue}):c,f=u&&null!==b&&!1!==b;function closeAsCancel(){_optionalChain([o,"optionalCall",e=>e()]),l(!1)}return s.jsx.call(void 0,e.Modal,{ariaLabel:"string"==typeof d?d:"外观设置",onClose:closeAsCancel,open:a,size:"2xl",children:s.jsxs.call(void 0,e.ModalContent,{"data-ug":"theme-configurator-dialog","data-state":a?"open":"closed","data-variant":f?"preview":"default","data-size":"2xl",children:[s.jsxs.call(void 0,e.ModalHeader,{children:[s.jsx.call(void 0,e.ModalTitle,{children:d}),s.jsx.call(void 0,e.ModalCloseButton,{})]}),s.jsx.call(void 0,e.ModalBody,{className:"overflow-hidden p-0",children:s.jsxs.call(void 0,"div",{"data-ug-layout":"dialog",children:[s.jsx.call(void 0,"div",{className:"h-full min-h-[0] min-w-0","data-ug-slot":"panel",children:s.jsx.call(void 0,L,{...m})}),f?s.jsx.call(void 0,"div",{"data-ug-slot":"preview",children:b}):null]})}),s.jsxs.call(void 0,e.ModalFooter,{className:"justify-between",children:[s.jsx.call(void 0,"div",{className:"flex min-w-0 items-center gap-3",children:i?s.jsxs.call(void 0,t.Button,{onClick:i,type:"button",variant:"default",children:[s.jsx.call(void 0,n.RotateCcw,{"aria-hidden":"true",size:16}),v]}):null}),s.jsxs.call(void 0,"div",{className:"flex shrink-0 items-center gap-2",children:[o?s.jsx.call(void 0,t.Button,{onClick:closeAsCancel,type:"button",variant:"default",children:g}):null,s.jsx.call(void 0,t.Button,{onClick:function closeAsApply(){_optionalChain([r,"optionalCall",e=>e()]),l(!1)},type:"button",variant:"primary",children:x})]})]})]})})}L.displayName="ThemeConfigurator",exports.AdminShell=p,exports.AppTabs=x,exports.AttachmentList=S,exports.ConfirmDialog=b,exports.ConversationList=T,exports.CopyField=f,exports.DataTable=DataTable,exports.DataTableIdentity=DataTableIdentity,exports.DataTableToolbar=DataTableToolbar,exports.Message=N,exports.MessageList=k,exports.PageHeader=j,exports.PromptComposer=y,exports.QuickAccess=C,exports.SelectionList=r,exports.ThemeConfigurator=L,exports.ThemeConfiguratorDialog=ThemeConfiguratorDialog,exports.TreeTable=TreeTable,exports.UGAdminShell=p,exports.UGAppTabs=x,exports.UGAttachmentList=S,exports.UGConfirmDialog=b,exports.UGConversationList=T,exports.UGCopyField=f,exports.UGDataTable=DataTable,exports.UGDataTableIdentity=DataTableIdentity,exports.UGDataTableToolbar=DataTableToolbar,exports.UGMessage=N,exports.UGMessageList=k,exports.UGPageHeader=j,exports.UGPromptComposer=y,exports.UGQuickAccess=C,exports.UGSelectionList=r,exports.UGThemeConfigurator=L,exports.UGThemeConfiguratorDialog=ThemeConfiguratorDialog,exports.UGTreeTable=TreeTable;//# sourceMappingURL=index.cjs.map