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

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 (250) hide show
  1. package/dist/aliases.d.ts +59 -0
  2. package/dist/aliases.d.ts.map +1 -0
  3. package/dist/blocks/feature-grid.d.ts +40 -0
  4. package/dist/blocks/feature-grid.d.ts.map +1 -0
  5. package/dist/blocks/index.cjs +293 -64
  6. package/dist/blocks/index.cjs.map +1 -1
  7. package/dist/blocks/index.d.ts +6 -84
  8. package/dist/blocks/index.d.ts.map +1 -0
  9. package/dist/blocks/index.js +80 -39
  10. package/dist/blocks/index.js.map +1 -1
  11. package/dist/blocks/landing-hero.d.ts +55 -0
  12. package/dist/blocks/landing-hero.d.ts.map +1 -0
  13. package/dist/chunk-AKWJMDCW.js +467 -0
  14. package/dist/chunk-AKWJMDCW.js.map +1 -0
  15. package/dist/chunk-F23X4N6B.js +11 -0
  16. package/dist/chunk-F23X4N6B.js.map +1 -0
  17. package/dist/chunk-HGO3GZ56.js +1777 -0
  18. package/dist/chunk-HGO3GZ56.js.map +1 -0
  19. package/dist/chunk-HXIWD5LQ.js +319 -0
  20. package/dist/chunk-HXIWD5LQ.js.map +1 -0
  21. package/dist/chunk-M6J4PLF4.js +521 -0
  22. package/dist/chunk-M6J4PLF4.js.map +1 -0
  23. package/dist/chunk-N3Z7R6GG.js +139 -0
  24. package/dist/chunk-N3Z7R6GG.js.map +1 -0
  25. package/dist/chunk-UXWCK6M7.js +5757 -0
  26. package/dist/chunk-UXWCK6M7.js.map +1 -0
  27. package/dist/components/accordion.d.ts +59 -0
  28. package/dist/components/accordion.d.ts.map +1 -0
  29. package/dist/components/alert.d.ts +23 -0
  30. package/dist/components/alert.d.ts.map +1 -0
  31. package/dist/components/avatar-group.d.ts +20 -0
  32. package/dist/components/avatar-group.d.ts.map +1 -0
  33. package/dist/components/avatar.d.ts +34 -0
  34. package/dist/components/avatar.d.ts.map +1 -0
  35. package/dist/components/badge.d.ts +17 -0
  36. package/dist/components/badge.d.ts.map +1 -0
  37. package/dist/components/breadcrumb.d.ts +33 -0
  38. package/dist/components/breadcrumb.d.ts.map +1 -0
  39. package/dist/components/button-group.d.ts +26 -0
  40. package/dist/components/button-group.d.ts.map +1 -0
  41. package/dist/components/button.d.ts +43 -0
  42. package/dist/components/button.d.ts.map +1 -0
  43. package/dist/components/card.d.ts +26 -0
  44. package/dist/components/card.d.ts.map +1 -0
  45. package/dist/components/checkbox-group-context.d.ts +14 -0
  46. package/dist/components/checkbox-group-context.d.ts.map +1 -0
  47. package/dist/components/checkbox-group.d.ts +18 -0
  48. package/dist/components/checkbox-group.d.ts.map +1 -0
  49. package/dist/components/checkbox.d.ts +32 -0
  50. package/dist/components/checkbox.d.ts.map +1 -0
  51. package/dist/components/config-provider.d.ts +29 -0
  52. package/dist/components/config-provider.d.ts.map +1 -0
  53. package/dist/components/container.d.ts +27 -0
  54. package/dist/components/container.d.ts.map +1 -0
  55. package/dist/components/context/form-context.d.ts +41 -0
  56. package/dist/components/context/form-context.d.ts.map +1 -0
  57. package/dist/components/context-menu.d.ts +39 -0
  58. package/dist/components/context-menu.d.ts.map +1 -0
  59. package/dist/components/descriptions.d.ts +40 -0
  60. package/dist/components/descriptions.d.ts.map +1 -0
  61. package/dist/components/dialog.d.ts +55 -0
  62. package/dist/components/dialog.d.ts.map +1 -0
  63. package/dist/components/drawer.d.ts +38 -0
  64. package/dist/components/drawer.d.ts.map +1 -0
  65. package/dist/components/dropdown.d.ts +42 -0
  66. package/dist/components/dropdown.d.ts.map +1 -0
  67. package/dist/components/empty-state.d.ts +24 -0
  68. package/dist/components/empty-state.d.ts.map +1 -0
  69. package/dist/components/form.d.ts +127 -0
  70. package/dist/components/form.d.ts.map +1 -0
  71. package/dist/components/icon.d.ts +16 -0
  72. package/dist/components/icon.d.ts.map +1 -0
  73. package/dist/components/index.cjs +6173 -1482
  74. package/dist/components/index.cjs.map +1 -1
  75. package/dist/components/index.d.ts +59 -1096
  76. package/dist/components/index.d.ts.map +1 -0
  77. package/dist/components/index.js +67 -6
  78. package/dist/components/input.d.ts +28 -0
  79. package/dist/components/input.d.ts.map +1 -0
  80. package/dist/components/label.d.ts +18 -0
  81. package/dist/components/label.d.ts.map +1 -0
  82. package/dist/components/layout.d.ts +34 -0
  83. package/dist/components/layout.d.ts.map +1 -0
  84. package/dist/components/link.d.ts +18 -0
  85. package/dist/components/link.d.ts.map +1 -0
  86. package/dist/components/modal.d.ts +46 -0
  87. package/dist/components/modal.d.ts.map +1 -0
  88. package/dist/components/navigation-menu.d.ts +39 -0
  89. package/dist/components/navigation-menu.d.ts.map +1 -0
  90. package/dist/components/number-input.d.ts +35 -0
  91. package/dist/components/number-input.d.ts.map +1 -0
  92. package/dist/components/otp-input.d.ts +35 -0
  93. package/dist/components/otp-input.d.ts.map +1 -0
  94. package/dist/components/pagination.d.ts +16 -0
  95. package/dist/components/pagination.d.ts.map +1 -0
  96. package/dist/components/popover.d.ts +36 -0
  97. package/dist/components/popover.d.ts.map +1 -0
  98. package/dist/components/progress.d.ts +21 -0
  99. package/dist/components/progress.d.ts.map +1 -0
  100. package/dist/components/radio.d.ts +68 -0
  101. package/dist/components/radio.d.ts.map +1 -0
  102. package/dist/components/scrollbar.d.ts +29 -0
  103. package/dist/components/scrollbar.d.ts.map +1 -0
  104. package/dist/components/select.d.ts +48 -0
  105. package/dist/components/select.d.ts.map +1 -0
  106. package/dist/components/separator.d.ts +28 -0
  107. package/dist/components/separator.d.ts.map +1 -0
  108. package/dist/components/sheet.d.ts +24 -0
  109. package/dist/components/sheet.d.ts.map +1 -0
  110. package/dist/components/sidebar.d.ts +48 -0
  111. package/dist/components/sidebar.d.ts.map +1 -0
  112. package/dist/components/skeleton.d.ts +16 -0
  113. package/dist/components/skeleton.d.ts.map +1 -0
  114. package/dist/components/slider.d.ts +44 -0
  115. package/dist/components/slider.d.ts.map +1 -0
  116. package/dist/components/space.d.ts +19 -0
  117. package/dist/components/space.d.ts.map +1 -0
  118. package/dist/components/spinner.d.ts +18 -0
  119. package/dist/components/spinner.d.ts.map +1 -0
  120. package/dist/components/splitter.d.ts +51 -0
  121. package/dist/components/splitter.d.ts.map +1 -0
  122. package/dist/components/statistic.d.ts +30 -0
  123. package/dist/components/statistic.d.ts.map +1 -0
  124. package/dist/components/steps.d.ts +33 -0
  125. package/dist/components/steps.d.ts.map +1 -0
  126. package/dist/components/switch.d.ts +49 -0
  127. package/dist/components/switch.d.ts.map +1 -0
  128. package/dist/components/table.d.ts +32 -0
  129. package/dist/components/table.d.ts.map +1 -0
  130. package/dist/components/tabs.d.ts +27 -0
  131. package/dist/components/tabs.d.ts.map +1 -0
  132. package/dist/components/tag.d.ts +27 -0
  133. package/dist/components/tag.d.ts.map +1 -0
  134. package/dist/components/text.d.ts +16 -0
  135. package/dist/components/text.d.ts.map +1 -0
  136. package/dist/components/textarea.d.ts +26 -0
  137. package/dist/components/textarea.d.ts.map +1 -0
  138. package/dist/components/toast.d.ts +26 -0
  139. package/dist/components/toast.d.ts.map +1 -0
  140. package/dist/components/tooltip.d.ts +29 -0
  141. package/dist/components/tooltip.d.ts.map +1 -0
  142. package/dist/hooks/index.cjs +228 -27
  143. package/dist/hooks/index.cjs.map +1 -1
  144. package/dist/hooks/index.d.ts +19 -231
  145. package/dist/hooks/index.d.ts.map +1 -0
  146. package/dist/hooks/index.js +1 -1
  147. package/dist/hooks/use-click-outside.d.ts +9 -0
  148. package/dist/hooks/use-click-outside.d.ts.map +1 -0
  149. package/dist/hooks/use-copy-to-clipboard.d.ts +12 -0
  150. package/dist/hooks/use-copy-to-clipboard.d.ts.map +1 -0
  151. package/dist/hooks/use-debounce.d.ts +7 -0
  152. package/dist/hooks/use-debounce.d.ts.map +1 -0
  153. package/dist/hooks/use-escape-key.d.ts +10 -0
  154. package/dist/hooks/use-escape-key.d.ts.map +1 -0
  155. package/dist/hooks/use-event-listener.d.ts +28 -0
  156. package/dist/hooks/use-event-listener.d.ts.map +1 -0
  157. package/dist/hooks/use-form.d.ts +48 -0
  158. package/dist/hooks/use-form.d.ts.map +1 -0
  159. package/dist/hooks/use-hotkeys.d.ts +30 -0
  160. package/dist/hooks/use-hotkeys.d.ts.map +1 -0
  161. package/dist/hooks/use-interval.d.ts +19 -0
  162. package/dist/hooks/use-interval.d.ts.map +1 -0
  163. package/dist/hooks/use-local-storage.d.ts +9 -0
  164. package/dist/hooks/use-local-storage.d.ts.map +1 -0
  165. package/dist/hooks/use-media-query.d.ts +8 -0
  166. package/dist/hooks/use-media-query.d.ts.map +1 -0
  167. package/dist/hooks/use-mounted.d.ts +18 -0
  168. package/dist/hooks/use-mounted.d.ts.map +1 -0
  169. package/dist/hooks/use-pagination.d.ts +36 -0
  170. package/dist/hooks/use-pagination.d.ts.map +1 -0
  171. package/dist/hooks/use-timeout.d.ts +19 -0
  172. package/dist/hooks/use-timeout.d.ts.map +1 -0
  173. package/dist/hooks/use-toggle.d.ts +9 -0
  174. package/dist/hooks/use-toggle.d.ts.map +1 -0
  175. package/dist/index.cjs +6475 -1768
  176. package/dist/index.cjs.map +1 -1
  177. package/dist/index.d.ts +73 -294
  178. package/dist/index.d.ts.map +1 -0
  179. package/dist/index.js +64 -184
  180. package/dist/index.js.map +1 -1
  181. package/dist/internal/button-group-context.d.ts +11 -0
  182. package/dist/internal/button-group-context.d.ts.map +1 -0
  183. package/dist/internal/cn.d.ts +8 -0
  184. package/dist/internal/cn.d.ts.map +1 -0
  185. package/dist/internal/use-overlay-focus.d.ts +8 -0
  186. package/dist/internal/use-overlay-focus.d.ts.map +1 -0
  187. package/dist/internal/use-portal-container.d.ts +2 -0
  188. package/dist/internal/use-portal-container.d.ts.map +1 -0
  189. package/dist/labs/file-preview.d.ts +44 -0
  190. package/dist/labs/file-preview.d.ts.map +1 -0
  191. package/dist/labs/index.cjs +191 -1
  192. package/dist/labs/index.cjs.map +1 -1
  193. package/dist/labs/index.d.ts +8 -6
  194. package/dist/labs/index.d.ts.map +1 -0
  195. package/dist/labs/index.js +180 -1
  196. package/dist/labs/index.js.map +1 -1
  197. package/dist/labs/model-card.d.ts +50 -0
  198. package/dist/labs/model-card.d.ts.map +1 -0
  199. package/dist/patterns/admin-shell.d.ts +52 -0
  200. package/dist/patterns/admin-shell.d.ts.map +1 -0
  201. package/dist/patterns/confirm-dialog.d.ts +50 -0
  202. package/dist/patterns/confirm-dialog.d.ts.map +1 -0
  203. package/dist/patterns/copy-field.d.ts +29 -0
  204. package/dist/patterns/copy-field.d.ts.map +1 -0
  205. package/dist/patterns/index.cjs +699 -251
  206. package/dist/patterns/index.cjs.map +1 -1
  207. package/dist/patterns/index.d.ts +5 -158
  208. package/dist/patterns/index.d.ts.map +1 -0
  209. package/dist/patterns/index.js +137 -82
  210. package/dist/patterns/index.js.map +1 -1
  211. package/dist/patterns/page-header.d.ts +37 -0
  212. package/dist/patterns/page-header.d.ts.map +1 -0
  213. package/dist/primitives/index.cjs +1889 -112
  214. package/dist/primitives/index.cjs.map +1 -1
  215. package/dist/primitives/index.d.ts +22 -135
  216. package/dist/primitives/index.d.ts.map +1 -0
  217. package/dist/primitives/index.js +55 -4
  218. package/dist/styles.css +2819 -953
  219. package/dist/theme.cjs +161 -0
  220. package/dist/theme.cjs.map +1 -0
  221. package/dist/theme.d.ts +39 -0
  222. package/dist/theme.d.ts.map +1 -0
  223. package/dist/theme.js +19 -0
  224. package/dist/theme.js.map +1 -0
  225. package/dist/themes/default.css +80 -0
  226. package/dist/themes/mecha.css +195 -0
  227. package/dist/themes/minimal.css +160 -0
  228. package/dist/tokens.css +1173 -18
  229. package/package.json +22 -12
  230. package/dist/blocks/index.d.cts +0 -86
  231. package/dist/button-CaLZig8j.d.cts +0 -22
  232. package/dist/button-CaLZig8j.d.ts +0 -22
  233. package/dist/chunk-2IVRUJKO.js +0 -377
  234. package/dist/chunk-2IVRUJKO.js.map +0 -1
  235. package/dist/chunk-73WQAE3E.js +0 -3003
  236. package/dist/chunk-73WQAE3E.js.map +0 -1
  237. package/dist/chunk-MGXIF756.js +0 -313
  238. package/dist/chunk-MGXIF756.js.map +0 -1
  239. package/dist/chunk-RUDEZA5Q.js +0 -62
  240. package/dist/chunk-RUDEZA5Q.js.map +0 -1
  241. package/dist/chunk-S45GP6IB.js +0 -254
  242. package/dist/chunk-S45GP6IB.js.map +0 -1
  243. package/dist/components/index.d.cts +0 -1097
  244. package/dist/hooks/index.d.cts +0 -232
  245. package/dist/index.d.cts +0 -297
  246. package/dist/labs/index.d.cts +0 -12
  247. package/dist/patterns/index.d.cts +0 -158
  248. package/dist/primitives/index.d.cts +0 -137
  249. package/dist/sidebar-vl00Z2o-.d.cts +0 -93
  250. package/dist/sidebar-vl00Z2o-.d.ts +0 -93
@@ -21,43 +21,76 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
21
21
  // src/primitives/index.ts
22
22
  var primitives_exports = {};
23
23
  __export(primitives_exports, {
24
+ Aside: () => Aside,
24
25
  Badge: () => Badge,
25
26
  Button: () => Button,
27
+ ButtonGroup: () => ButtonGroup,
26
28
  Card: () => Card,
27
29
  CardContent: () => CardContent,
28
30
  CardDescription: () => CardDescription,
29
31
  CardFooter: () => CardFooter,
30
32
  CardHeader: () => CardHeader,
31
33
  CardTitle: () => CardTitle,
34
+ Col: () => Col,
35
+ ConfigProvider: () => ConfigProvider,
36
+ Container: () => Container,
37
+ Footer: () => Footer,
38
+ Header: () => Header,
39
+ Icon: () => Icon,
32
40
  Input: () => Input,
33
41
  Label: () => Label,
42
+ Link: () => Link,
43
+ Main: () => Main,
44
+ Row: () => Row,
45
+ Scrollbar: () => Scrollbar,
34
46
  Separator: () => Separator,
47
+ Space: () => Space,
35
48
  Spinner: () => Spinner,
49
+ Splitter: () => Splitter,
50
+ SplitterPanel: () => SplitterPanel,
36
51
  Tag: () => Tag,
52
+ Text: () => Text,
53
+ UGAside: () => Aside,
37
54
  UGBadge: () => Badge,
38
55
  UGButton: () => Button,
56
+ UGButtonGroup: () => ButtonGroup,
39
57
  UGCard: () => Card,
40
58
  UGCardContent: () => CardContent,
41
59
  UGCardDescription: () => CardDescription,
42
60
  UGCardFooter: () => CardFooter,
43
61
  UGCardHeader: () => CardHeader,
44
62
  UGCardTitle: () => CardTitle,
63
+ UGCol: () => Col,
64
+ UGConfigProvider: () => ConfigProvider,
65
+ UGContainer: () => Container,
66
+ UGFooter: () => Footer,
67
+ UGHeader: () => Header,
68
+ UGIcon: () => Icon,
45
69
  UGInput: () => Input,
46
70
  UGLabel: () => Label,
71
+ UGLink: () => Link,
72
+ UGMain: () => Main,
73
+ UGRow: () => Row,
74
+ UGScrollbar: () => Scrollbar,
47
75
  UGSeparator: () => Separator,
76
+ UGSpace: () => Space,
48
77
  UGSpinner: () => Spinner,
78
+ UGSplitter: () => Splitter,
79
+ UGSplitterPanel: () => SplitterPanel,
49
80
  UGTag: () => Tag,
81
+ UGText: () => Text,
50
82
  badgeVariants: () => badgeVariants,
51
83
  buttonVariants: () => buttonVariants,
52
84
  tagVariants: () => tagVariants,
53
85
  ugBadgeVariants: () => badgeVariants,
54
86
  ugButtonVariants: () => buttonVariants,
55
- ugTagVariants: () => tagVariants
87
+ ugTagVariants: () => tagVariants,
88
+ useUIConfig: () => useUIConfig
56
89
  });
57
90
  module.exports = __toCommonJS(primitives_exports);
58
91
 
59
92
  // src/components/button.tsx
60
- var import_react = require("react");
93
+ var import_react3 = require("react");
61
94
  var import_lucide_react = require("lucide-react");
62
95
  var import_class_variance_authority = require("class-variance-authority");
63
96
 
@@ -68,45 +101,286 @@ function cn(...inputs) {
68
101
  return (0, import_tailwind_merge.twMerge)((0, import_clsx.clsx)(inputs));
69
102
  }
70
103
 
71
- // src/components/button.tsx
104
+ // src/internal/button-group-context.ts
105
+ var import_react = require("react");
106
+ var ButtonGroupContext = (0, import_react.createContext)({});
107
+ var ButtonGroupProvider = ButtonGroupContext.Provider;
108
+ function useButtonGroup() {
109
+ return (0, import_react.useContext)(ButtonGroupContext);
110
+ }
111
+
112
+ // src/components/config-provider.tsx
113
+ var import_react2 = require("react");
72
114
  var import_jsx_runtime = require("react/jsx-runtime");
115
+ var CONFIG_SIZE_TO_CONTROL_SIZE = {
116
+ small: "sm",
117
+ medium: "default",
118
+ large: "lg"
119
+ };
120
+ function resolveControlSize(size, configSize) {
121
+ return size ?? CONFIG_SIZE_TO_CONTROL_SIZE[configSize];
122
+ }
123
+ function resolveDisabled(disabled, configDisabled) {
124
+ return disabled ?? configDisabled;
125
+ }
126
+ var defaultConfig = {
127
+ namespace: "ug",
128
+ size: "medium",
129
+ disabled: false,
130
+ button: {},
131
+ link: {}
132
+ };
133
+ var ConfigContext = (0, import_react2.createContext)(defaultConfig);
134
+ function mergeDefined(parent, current) {
135
+ const merged = { ...parent };
136
+ if (!current) return merged;
137
+ Object.entries(current).forEach(([key, value]) => {
138
+ if (value !== void 0) Object.assign(merged, { [key]: value });
139
+ });
140
+ return merged;
141
+ }
142
+ function ConfigProvider({
143
+ children,
144
+ className,
145
+ disabled,
146
+ button,
147
+ link,
148
+ namespace,
149
+ size,
150
+ style,
151
+ ...containerProps
152
+ }) {
153
+ const parent = (0, import_react2.useContext)(ConfigContext);
154
+ const value = (0, import_react2.useMemo)(() => ({
155
+ namespace: namespace ?? parent.namespace,
156
+ size: size ?? parent.size,
157
+ disabled: disabled ?? parent.disabled,
158
+ button: mergeDefined(parent.button, button),
159
+ link: mergeDefined(parent.link, link)
160
+ }), [button, disabled, link, namespace, parent, size]);
161
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ConfigContext.Provider, { value, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
162
+ "div",
163
+ {
164
+ ...containerProps,
165
+ className: ["[display:contents]", className].filter(Boolean).join(" "),
166
+ style,
167
+ "data-size": value.size,
168
+ "data-state": value.disabled ? "disabled" : "default",
169
+ "data-ug": "config-provider",
170
+ "data-ug-namespace": value.namespace,
171
+ "data-ug-slot": "root",
172
+ "data-variant": "default",
173
+ children
174
+ }
175
+ ) });
176
+ }
177
+ function useUIConfig() {
178
+ return (0, import_react2.useContext)(ConfigContext);
179
+ }
180
+
181
+ // src/components/button.tsx
182
+ var import_jsx_runtime2 = require("react/jsx-runtime");
73
183
  var buttonVariants = (0, import_class_variance_authority.cva)(
74
- "inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-lg text-sm font-medium transition-[background,border-color,color,box-shadow,transform] duration-150 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50",
184
+ "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",
75
185
  {
76
186
  variants: {
77
187
  variant: {
78
- default: "bg-primary text-primary-fg shadow-sm hover:bg-primary-hover hover:shadow-md focus-visible:ring-ring",
79
- destructive: "bg-danger text-danger-fg shadow-sm hover:bg-danger-hover hover:shadow-md focus-visible:ring-danger",
80
- outline: "border border-border-strong bg-surface-1 text-text-primary shadow-sm hover:border-primary/55 hover:bg-surface-2 focus-visible:ring-ring/30",
81
- secondary: "border border-border-base bg-surface-2 text-text-primary shadow-sm hover:bg-surface-3 focus-visible:ring-ring/30",
82
- ghost: "text-text-primary hover:bg-surface-2 focus-visible:ring-ring/30",
83
- link: "text-text-primary underline-offset-4 hover:underline focus-visible:ring-ring/30"
188
+ solid: "",
189
+ soft: "",
190
+ // 蓝绿主按钮
191
+ 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",
192
+ // 成功绿按钮 (主流框架标准绿)
193
+ 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",
194
+ // 警告黄/橙按钮 (主流框架标准橙)
195
+ 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",
196
+ // 危险红按钮 (主流框架标准红)
197
+ 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",
198
+ 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",
199
+ // 信息蓝按钮 (主流框架标准蓝)
200
+ 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",
201
+ // 默认按钮:经典白底/浅灰底 + 1px 标准边框,Hover 时变主色
202
+ default: "border-border-base bg-surface-1 text-text-primary shadow-xs hover:border-primary active:bg-surface-2 focus-visible:ring-primary/40",
203
+ outline: "bg-transparent",
204
+ // 次要按钮:柔和背景
205
+ 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",
206
+ // 虚线按钮:标准 1px 虚线框
207
+ dashed: "border-dashed bg-transparent",
208
+ // 幽灵与文本按钮的视觉由语义色映射控制
209
+ ghost: "",
210
+ text: "",
211
+ link: ""
84
212
  },
85
213
  size: {
86
- default: "h-9 px-4 py-2",
87
- sm: "h-8 px-3 text-xs",
88
- lg: "h-11 px-5 text-base",
89
- icon: "h-9 w-9"
214
+ default: "h-[var(--control-height-md)] px-[var(--control-padding-x-md)] py-0",
215
+ sm: "h-[var(--control-height-sm)] px-[var(--control-padding-x-sm)] py-0",
216
+ lg: "h-[var(--control-height-lg)] px-[var(--control-padding-x-lg)] py-0",
217
+ icon: "h-[var(--control-height-md)] w-[var(--control-height-md)] p-0"
218
+ },
219
+ shape: {
220
+ default: "rounded-[var(--radius-control)]",
221
+ circle: "!rounded-full !p-0 aspect-square",
222
+ round: "!rounded-full"
223
+ },
224
+ block: {
225
+ true: "w-full flex",
226
+ false: ""
90
227
  }
91
228
  },
92
229
  defaultVariants: {
93
230
  variant: "default",
94
- size: "default"
231
+ size: "default",
232
+ shape: "default",
233
+ block: false
95
234
  }
96
235
  }
97
236
  );
98
- var Button = (0, import_react.forwardRef)(
99
- ({ className, variant, size, loading = false, disabled, children, ...props }, ref) => {
100
- return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
237
+ var TONE_VARIANT_CLASSES = {
238
+ neutral: {
239
+ 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",
240
+ soft: "bg-surface-2 text-text-primary shadow-xs hover:bg-surface-3 active:bg-surface-3 focus-visible:ring-primary/40",
241
+ outline: "border-border-strong bg-transparent text-text-primary shadow-xs hover:border-primary active:bg-surface-2 focus-visible:ring-primary/40",
242
+ dashed: "border-border-strong text-text-primary hover:border-primary active:bg-surface-2 focus-visible:ring-primary/40",
243
+ ghost: "text-text-primary hover:bg-surface-2 active:bg-surface-3 focus-visible:ring-primary/40",
244
+ text: "text-text-primary hover:opacity-80 active:opacity-70 focus-visible:ring-primary/40",
245
+ link: "text-text-primary focus-visible:ring-primary/40"
246
+ },
247
+ primary: {
248
+ 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",
249
+ soft: "bg-primary-soft text-text-primary hover:shadow-sm active:bg-primary-soft focus-visible:ring-primary/40",
250
+ outline: "border-primary bg-transparent text-text-primary hover:bg-primary-soft active:bg-primary-soft focus-visible:ring-primary/40",
251
+ dashed: "border-primary text-text-primary hover:bg-primary-soft active:bg-primary-soft focus-visible:ring-primary/40",
252
+ ghost: "text-text-primary hover:bg-primary-soft active:bg-primary-soft focus-visible:ring-primary/40",
253
+ text: "text-text-primary hover:opacity-80 active:opacity-70 focus-visible:ring-primary/40",
254
+ link: "text-text-primary focus-visible:ring-primary/40"
255
+ },
256
+ success: {
257
+ 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",
258
+ soft: "bg-success-soft text-text-primary hover:shadow-sm active:bg-success-soft focus-visible:ring-success/40",
259
+ outline: "border-success bg-transparent text-text-primary hover:bg-success-soft active:bg-success-soft focus-visible:ring-success/40",
260
+ dashed: "border-success text-text-primary hover:bg-success-soft active:bg-success-soft focus-visible:ring-success/40",
261
+ ghost: "text-text-primary hover:bg-success-soft active:bg-success-soft focus-visible:ring-success/40",
262
+ text: "text-text-primary hover:opacity-80 active:opacity-70 focus-visible:ring-success/40",
263
+ link: "text-text-primary focus-visible:ring-success/40"
264
+ },
265
+ warning: {
266
+ 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",
267
+ soft: "bg-warning-soft text-text-primary hover:shadow-sm active:bg-warning-soft focus-visible:ring-warning/40",
268
+ outline: "border-warning bg-transparent text-text-primary hover:bg-warning-soft active:bg-warning-soft focus-visible:ring-warning/40",
269
+ dashed: "border-warning text-text-primary hover:bg-warning-soft active:bg-warning-soft focus-visible:ring-warning/40",
270
+ ghost: "text-text-primary hover:bg-warning-soft active:bg-warning-soft focus-visible:ring-warning/40",
271
+ text: "text-text-primary hover:opacity-80 active:opacity-70 focus-visible:ring-warning/40",
272
+ link: "text-text-primary focus-visible:ring-warning/40"
273
+ },
274
+ danger: {
275
+ 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",
276
+ soft: "bg-danger-soft text-text-primary hover:shadow-sm active:bg-danger-soft focus-visible:ring-danger/40",
277
+ outline: "border-danger bg-transparent text-text-primary hover:bg-danger-soft active:bg-danger-soft focus-visible:ring-danger/40",
278
+ dashed: "border-danger text-text-primary hover:bg-danger-soft active:bg-danger-soft focus-visible:ring-danger/40",
279
+ ghost: "text-text-primary hover:bg-danger-soft active:bg-danger-soft focus-visible:ring-danger/40",
280
+ text: "text-text-primary hover:opacity-80 active:opacity-70 focus-visible:ring-danger/40",
281
+ link: "text-text-primary focus-visible:ring-danger/40"
282
+ },
283
+ info: {
284
+ 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",
285
+ soft: "bg-info-soft text-text-primary hover:shadow-sm active:bg-info-soft focus-visible:ring-info/40",
286
+ outline: "border-info bg-transparent text-text-primary hover:bg-info-soft active:bg-info-soft focus-visible:ring-info/40",
287
+ dashed: "border-info text-text-primary hover:bg-info-soft active:bg-info-soft focus-visible:ring-info/40",
288
+ ghost: "text-text-primary hover:bg-info-soft active:bg-info-soft focus-visible:ring-info/40",
289
+ text: "text-text-primary hover:opacity-80 active:opacity-70 focus-visible:ring-info/40",
290
+ link: "text-text-primary focus-visible:ring-info/40"
291
+ }
292
+ };
293
+ var VARIANT_LAYOUT_CLASSES = {
294
+ text: "px-[var(--control-padding-x-sm)]",
295
+ link: "h-auto p-0 underline-offset-4 hover:underline"
296
+ };
297
+ var CONFIG_SIZE_TO_BUTTON_SIZE = {
298
+ small: "sm",
299
+ medium: "default",
300
+ large: "lg"
301
+ };
302
+ var LEGACY_VARIANT_TONES = {
303
+ primary: "primary",
304
+ success: "success",
305
+ warning: "warning",
306
+ danger: "danger",
307
+ destructive: "danger",
308
+ info: "info"
309
+ };
310
+ function isToneVariant(variant) {
311
+ return ["solid", "soft", "outline", "dashed", "ghost", "text", "link"].includes(variant);
312
+ }
313
+ function getButtonState(loading, disabled) {
314
+ const states = [];
315
+ if (loading) states.push("loading");
316
+ if (disabled || loading) states.push("disabled");
317
+ return states.length > 0 ? states.join(" ") : void 0;
318
+ }
319
+ var Button = (0, import_react3.forwardRef)(
320
+ ({
321
+ className,
322
+ variant,
323
+ tone,
324
+ size,
325
+ shape,
326
+ block,
327
+ loading = false,
328
+ loadingText,
329
+ loadingIcon,
330
+ loadingPlacement = "start",
331
+ disabled,
332
+ type = "button",
333
+ style,
334
+ children,
335
+ ...props
336
+ }, ref) => {
337
+ const group = useButtonGroup();
338
+ const config = useUIConfig();
339
+ const resolvedVariant = variant ?? group.variant ?? config.button.variant ?? "default";
340
+ const resolvedTone = tone ?? group.tone ?? config.button.tone ?? LEGACY_VARIANT_TONES[resolvedVariant] ?? (resolvedVariant === "solid" || resolvedVariant === "soft" ? "primary" : "neutral");
341
+ const resolvedSize = size ?? group.size ?? CONFIG_SIZE_TO_BUTTON_SIZE[config.size];
342
+ const resolvedShape = shape ?? group.shape ?? config.button.shape ?? "default";
343
+ const resolvedDisabled = resolveDisabled(
344
+ disabled,
345
+ group.disabled ?? config.disabled
346
+ );
347
+ const state = getButtonState(loading, resolvedDisabled);
348
+ 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 });
349
+ const label = loading && loadingText !== void 0 ? loadingText : children;
350
+ const toneClasses2 = isToneVariant(resolvedVariant) ? TONE_VARIANT_CLASSES[resolvedTone][resolvedVariant] : void 0;
351
+ 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;
352
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
101
353
  "button",
102
354
  {
103
355
  ref,
104
- className: cn(buttonVariants({ variant, size }), className),
105
- disabled: disabled || loading,
106
356
  ...props,
357
+ type,
358
+ style: { fontWeight: "var(--button-font-weight)", ...style },
359
+ className: cn(
360
+ buttonVariants({
361
+ variant: resolvedVariant,
362
+ size: resolvedSize,
363
+ shape: resolvedShape,
364
+ block
365
+ }),
366
+ toneClasses2,
367
+ VARIANT_LAYOUT_CLASSES[resolvedVariant],
368
+ className
369
+ ),
370
+ disabled: resolvedDisabled || loading,
371
+ "aria-busy": loading || void 0,
372
+ "data-ug": "button",
373
+ "data-state": state,
374
+ "data-variant": resolvedVariant,
375
+ "data-tone": resolvedTone,
376
+ "data-size": resolvedSize,
377
+ "data-shape": resolvedShape,
378
+ "data-block": block ? "true" : void 0,
379
+ "data-ug-namespace": config.namespace,
107
380
  children: [
108
- loading && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_lucide_react.Loader2, { className: "animate-spin", size: 16 }),
109
- children
381
+ loadingPlacement === "start" ? loaderNode : null,
382
+ /* @__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 }),
383
+ loadingPlacement === "end" ? loaderNode : null
110
384
  ]
111
385
  }
112
386
  );
@@ -114,60 +388,443 @@ var Button = (0, import_react.forwardRef)(
114
388
  );
115
389
  Button.displayName = "Button";
116
390
 
391
+ // src/components/button-group.tsx
392
+ var import_react4 = require("react");
393
+ var import_jsx_runtime3 = require("react/jsx-runtime");
394
+ var attachedClasses = {
395
+ horizontal: "[&>[data-ug=button]]:[border-radius:0] [&>[data-ug=button]:first-child]:[border-radius:var(--radius-control)_0_0_var(--radius-control)] [&>[data-ug=button]:last-child]:[border-radius:0_var(--radius-control)_var(--radius-control)_0] [&>[data-ug=button]+[data-ug=button]]:-ml-px",
396
+ vertical: "[&>[data-ug=button]]:[border-radius:0] [&>[data-ug=button]:first-child]:[border-radius:var(--radius-control)_var(--radius-control)_0_0] [&>[data-ug=button]:last-child]:[border-radius:0_0_var(--radius-control)_var(--radius-control)] [&>[data-ug=button]+[data-ug=button]]:-mt-px"
397
+ };
398
+ var CONFIG_SIZE_TO_BUTTON_SIZE2 = {
399
+ small: "sm",
400
+ medium: "default",
401
+ large: "lg"
402
+ };
403
+ var ButtonGroup = (0, import_react4.forwardRef)(
404
+ ({
405
+ className,
406
+ variant,
407
+ tone,
408
+ size,
409
+ shape,
410
+ disabled,
411
+ orientation = "horizontal",
412
+ attached = false,
413
+ children,
414
+ ...props
415
+ }, ref) => {
416
+ const config = useUIConfig();
417
+ const resolvedSize = size ?? CONFIG_SIZE_TO_BUTTON_SIZE2[config.size];
418
+ const resolvedDisabled = resolveDisabled(disabled, config.disabled);
419
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(ButtonGroupProvider, { value: {
420
+ variant,
421
+ tone,
422
+ size: resolvedSize,
423
+ shape,
424
+ disabled: resolvedDisabled
425
+ }, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
426
+ "div",
427
+ {
428
+ ref,
429
+ role: "group",
430
+ ...props,
431
+ className: cn(
432
+ "inline-flex",
433
+ orientation === "horizontal" ? "flex-row items-center" : "flex-col items-stretch",
434
+ attached ? attachedClasses[orientation] : "gap-2",
435
+ className
436
+ ),
437
+ "aria-disabled": resolvedDisabled || void 0,
438
+ "aria-orientation": orientation,
439
+ "data-ug": "button-group",
440
+ "data-ug-slot": "root",
441
+ "data-state": resolvedDisabled ? "disabled" : "default",
442
+ "data-variant": variant,
443
+ "data-tone": tone,
444
+ "data-size": resolvedSize,
445
+ "data-shape": shape,
446
+ "data-orientation": orientation,
447
+ "data-attached": attached ? "true" : "false",
448
+ "data-ug-namespace": config.namespace,
449
+ children
450
+ }
451
+ ) });
452
+ }
453
+ );
454
+ ButtonGroup.displayName = "ButtonGroup";
455
+
117
456
  // src/components/input.tsx
118
- var import_react2 = require("react");
119
- var import_jsx_runtime2 = require("react/jsx-runtime");
120
- var Input = (0, import_react2.forwardRef)(
121
- ({ className, label, error, helperText, id, ...props }, ref) => {
122
- const generatedId = (0, import_react2.useId)();
457
+ var import_react5 = require("react");
458
+ var import_lucide_react2 = require("lucide-react");
459
+ var import_ui_core = require("@ug666/ui-core");
460
+ var import_jsx_runtime4 = require("react/jsx-runtime");
461
+ var inputSizeClasses = {
462
+ sm: "h-[var(--control-height-sm)] text-xs",
463
+ default: "h-[var(--control-height-md)] text-sm",
464
+ lg: "h-[var(--control-height-lg)] text-base"
465
+ };
466
+ var inputPaddingClasses = {
467
+ sm: "px-[var(--control-padding-x-sm)]",
468
+ default: "px-[var(--control-padding-x-md)]",
469
+ lg: "px-[var(--control-padding-x-lg)]"
470
+ };
471
+ function assignRef(ref, value) {
472
+ if (typeof ref === "function") ref(value);
473
+ else if (ref) ref.current = value;
474
+ }
475
+ function normalizeValue(value) {
476
+ if (value === void 0 || value === null) return "";
477
+ return Array.isArray(value) ? value.join(",") : String(value);
478
+ }
479
+ function getInputState(disabled, invalid, readonly, focused) {
480
+ return [
481
+ disabled && "disabled",
482
+ invalid && "invalid",
483
+ readonly && "readonly",
484
+ focused && "focused"
485
+ ].filter(Boolean).join(" ") || "default";
486
+ }
487
+ var Input = (0, import_react5.forwardRef)(
488
+ ({
489
+ append,
490
+ className,
491
+ clearable = false,
492
+ clearIcon,
493
+ countCharacters,
494
+ defaultValue,
495
+ disabled,
496
+ error,
497
+ formatter,
498
+ helperText,
499
+ id,
500
+ label,
501
+ maxLength,
502
+ onBlur,
503
+ onChange,
504
+ onClear,
505
+ onCompositionEnd,
506
+ onCompositionStart,
507
+ onFocus,
508
+ onValueChange,
509
+ parser,
510
+ passwordHiddenIcon,
511
+ passwordVisibleIcon,
512
+ prefix,
513
+ prepend,
514
+ readOnly = false,
515
+ showPassword = false,
516
+ showWordLimit = false,
517
+ size,
518
+ suffix,
519
+ type = "text",
520
+ value,
521
+ wordLimitPosition = "inside",
522
+ "aria-describedby": describedBy,
523
+ "aria-invalid": invalid,
524
+ form,
525
+ name,
526
+ ...props
527
+ }, forwardedRef) => {
528
+ const config = useUIConfig();
529
+ const generatedId = (0, import_react5.useId)();
123
530
  const inputId = id ?? generatedId;
124
- return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "flex flex-col gap-1", children: [
125
- label && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
126
- "label",
127
- {
128
- htmlFor: inputId,
129
- className: "text-sm font-medium text-text-primary",
130
- children: label
131
- }
132
- ),
133
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
134
- "input",
135
- {
136
- ref,
137
- id: inputId,
138
- className: cn(
139
- "flex h-9 w-full rounded-md border bg-surface-1 px-3 py-2 text-sm text-text-primary placeholder:text-text-tertiary",
140
- "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-offset-1",
141
- "disabled:cursor-not-allowed disabled:opacity-50",
142
- error ? "border-danger focus-visible:ring-danger" : "border-border-strong focus-visible:ring-ring/30",
143
- className
144
- ),
145
- ...props
146
- }
147
- ),
148
- error && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("p", { className: "text-xs text-danger", children: error }),
149
- !error && helperText && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("p", { className: "text-xs text-text-secondary", children: helperText })
150
- ] });
531
+ const messageId = `${inputId}-message`;
532
+ const [focused, setFocused] = (0, import_react5.useState)(false);
533
+ const [composing, setComposing] = (0, import_react5.useState)(false);
534
+ const [passwordVisible, setPasswordVisible] = (0, import_react5.useState)(false);
535
+ const [uncontrolledValue, setUncontrolledValue] = (0, import_react5.useState)(() => normalizeValue(defaultValue));
536
+ const inputRef = (0, import_react5.useRef)(null);
537
+ const resolvedDisabled = resolveDisabled(disabled, config.disabled);
538
+ const resolvedSize = resolveControlSize(size, config.size);
539
+ const rawValue = value === void 0 ? uncontrolledValue : normalizeValue(value);
540
+ const displayValue = formatter && !composing && rawValue !== "" ? formatter(rawValue) : rawValue;
541
+ const hasValue = rawValue.length > 0;
542
+ const canClear = clearable && hasValue && !resolvedDisabled && !readOnly;
543
+ const canTogglePassword = showPassword && type === "password" && !resolvedDisabled;
544
+ const resolvedType = showPassword && type === "password" && passwordVisible ? "text" : type;
545
+ const hasMessage = Boolean(error || helperText || showWordLimit && maxLength);
546
+ const state = getInputState(resolvedDisabled, Boolean(error), readOnly, focused);
547
+ const characterCount = (0, import_ui_core.countTextCharacters)(rawValue, countCharacters);
548
+ const hasInsideCount = Boolean(
549
+ showWordLimit && maxLength && wordLimitPosition === "inside"
550
+ );
551
+ const usesCanonicalSubmitValue = Boolean(formatter && name);
552
+ (0, import_react5.useEffect)(() => {
553
+ const form2 = inputRef.current?.form;
554
+ if (!form2) return;
555
+ function handleReset() {
556
+ setUncontrolledValue(normalizeValue(defaultValue));
557
+ setPasswordVisible(false);
558
+ }
559
+ form2.addEventListener("reset", handleReset);
560
+ return () => form2.removeEventListener("reset", handleReset);
561
+ }, [defaultValue]);
562
+ function setInputRef(node) {
563
+ inputRef.current = node;
564
+ assignRef(forwardedRef, node);
565
+ }
566
+ function handleChange(event) {
567
+ const inputValue = event.currentTarget.value;
568
+ const isComposing = composing || event.nativeEvent.isComposing;
569
+ const parsedValue = isComposing || !parser ? inputValue : parser(inputValue);
570
+ const nextValue = isComposing ? parsedValue : (0, import_ui_core.limitTextByCount)(parsedValue, maxLength, countCharacters);
571
+ if (nextValue !== event.currentTarget.value) event.currentTarget.value = nextValue;
572
+ setUncontrolledValue(nextValue);
573
+ onValueChange?.(nextValue);
574
+ onChange?.(event);
575
+ }
576
+ function handleCompositionStart(event) {
577
+ setComposing(true);
578
+ onCompositionStart?.(event);
579
+ }
580
+ function handleCompositionEnd(event) {
581
+ setComposing(false);
582
+ const parsedValue = parser ? parser(event.currentTarget.value) : event.currentTarget.value;
583
+ const nextValue = (0, import_ui_core.limitTextByCount)(parsedValue, maxLength, countCharacters);
584
+ if (nextValue !== event.currentTarget.value) event.currentTarget.value = nextValue;
585
+ setUncontrolledValue(nextValue);
586
+ onValueChange?.(nextValue);
587
+ onCompositionEnd?.(event);
588
+ }
589
+ function handleFocus(event) {
590
+ setFocused(true);
591
+ onFocus?.(event);
592
+ }
593
+ function handleBlur(event) {
594
+ setFocused(false);
595
+ onBlur?.(event);
596
+ }
597
+ function handleClear() {
598
+ setUncontrolledValue("");
599
+ onValueChange?.("");
600
+ onClear?.();
601
+ inputRef.current?.focus();
602
+ }
603
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
604
+ "div",
605
+ {
606
+ className: "flex min-w-0 flex-col gap-1",
607
+ "data-size": resolvedSize,
608
+ "data-state": state,
609
+ "data-ug": "input",
610
+ "data-ug-slot": "root",
611
+ "data-variant": "default",
612
+ children: [
613
+ label ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
614
+ "label",
615
+ {
616
+ className: "text-sm font-medium text-text-primary",
617
+ "data-ug-slot": "label",
618
+ htmlFor: inputId,
619
+ children: label
620
+ }
621
+ ) : null,
622
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "flex w-full min-w-0", "data-ug-slot": "group", children: [
623
+ prepend ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
624
+ "span",
625
+ {
626
+ className: cn(
627
+ "inline-flex shrink-0 items-center border border-r-0 border-border-strong bg-surface-2 text-text-secondary [border-end-start-radius:var(--radius-control)] [border-start-start-radius:var(--radius-control)]",
628
+ inputSizeClasses[resolvedSize],
629
+ inputPaddingClasses[resolvedSize]
630
+ ),
631
+ "data-ug-slot": "prepend",
632
+ children: prepend
633
+ }
634
+ ) : null,
635
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
636
+ "div",
637
+ {
638
+ className: cn(
639
+ "flex min-w-0 flex-1 items-center rounded-[var(--radius-control)] border bg-surface-1",
640
+ inputSizeClasses[resolvedSize],
641
+ "transition-[background,border-color,box-shadow] duration-[var(--motion-duration-base)] ease-[var(--motion-easing-standard)] motion-reduce:transition-none",
642
+ "focus-within:ring-2 focus-within:ring-offset-1",
643
+ error ? "border-danger focus-within:ring-danger/30" : "border-border-strong focus-within:border-primary focus-within:ring-ring/30",
644
+ resolvedDisabled && "cursor-not-allowed opacity-50",
645
+ readOnly && "bg-surface-2",
646
+ prepend && "[border-end-start-radius:0] [border-start-start-radius:0]",
647
+ append && "[border-end-end-radius:0] [border-start-end-radius:0]"
648
+ ),
649
+ "data-has-append": append ? "true" : void 0,
650
+ "data-has-prepend": prepend ? "true" : void 0,
651
+ "data-ug-slot": "wrapper",
652
+ children: [
653
+ prefix ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
654
+ "span",
655
+ {
656
+ "aria-hidden": "true",
657
+ className: cn("inline-flex shrink-0 items-center text-text-secondary", inputPaddingClasses[resolvedSize], "pr-0"),
658
+ "data-ug-slot": "prefix",
659
+ children: prefix
660
+ }
661
+ ) : null,
662
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
663
+ "input",
664
+ {
665
+ ...props,
666
+ ref: setInputRef,
667
+ "aria-describedby": describedBy ?? (hasMessage ? messageId : void 0),
668
+ "aria-invalid": invalid ?? (error ? true : void 0),
669
+ className: cn(
670
+ "h-full min-w-0 flex-1 border-0 bg-transparent py-0 text-text-primary outline-none placeholder:text-text-tertiary",
671
+ inputPaddingClasses[resolvedSize],
672
+ prefix && "pl-2",
673
+ (suffix || canClear || canTogglePassword || hasInsideCount) && "pr-2",
674
+ resolvedDisabled && "cursor-not-allowed",
675
+ className
676
+ ),
677
+ "data-ug-slot": "control",
678
+ disabled: resolvedDisabled,
679
+ form,
680
+ id: inputId,
681
+ maxLength: countCharacters ? void 0 : maxLength,
682
+ name: usesCanonicalSubmitValue ? void 0 : name,
683
+ onBlur: handleBlur,
684
+ onChange: handleChange,
685
+ onCompositionEnd: handleCompositionEnd,
686
+ onCompositionStart: handleCompositionStart,
687
+ onFocus: handleFocus,
688
+ readOnly,
689
+ type: resolvedType,
690
+ value: displayValue
691
+ }
692
+ ),
693
+ hasInsideCount ? /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
694
+ "span",
695
+ {
696
+ "aria-hidden": "true",
697
+ className: "shrink-0 whitespace-nowrap text-xs tabular-nums text-text-tertiary",
698
+ "data-ug-slot": "count",
699
+ children: [
700
+ characterCount,
701
+ "/",
702
+ maxLength
703
+ ]
704
+ }
705
+ ) : null,
706
+ canClear ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
707
+ "button",
708
+ {
709
+ "aria-label": "\u6E05\u7A7A\u8F93\u5165",
710
+ className: "inline-flex h-full shrink-0 items-center justify-center px-[calc(var(--control-padding-x-sm)*0.5)] text-text-secondary hover:text-text-primary",
711
+ "data-ug-slot": "clear",
712
+ onClick: handleClear,
713
+ tabIndex: -1,
714
+ type: "button",
715
+ children: clearIcon ?? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_lucide_react2.X, { "aria-hidden": "true", size: 14 })
716
+ }
717
+ ) : null,
718
+ canTogglePassword ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
719
+ "button",
720
+ {
721
+ "aria-label": passwordVisible ? "\u9690\u85CF\u5BC6\u7801" : "\u663E\u793A\u5BC6\u7801",
722
+ "aria-pressed": passwordVisible,
723
+ className: "inline-flex h-full shrink-0 items-center justify-center px-[calc(var(--control-padding-x-sm)*0.5)] text-text-secondary hover:text-text-primary",
724
+ "data-ug-slot": "password-toggle",
725
+ onClick: () => setPasswordVisible((current) => !current),
726
+ tabIndex: -1,
727
+ type: "button",
728
+ children: passwordVisible ? passwordVisibleIcon ?? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_lucide_react2.EyeOff, { "aria-hidden": "true", size: 15 }) : passwordHiddenIcon ?? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_lucide_react2.Eye, { "aria-hidden": "true", size: 15 })
729
+ }
730
+ ) : null,
731
+ suffix ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
732
+ "span",
733
+ {
734
+ "aria-hidden": "true",
735
+ className: cn("inline-flex shrink-0 items-center text-text-secondary", inputPaddingClasses[resolvedSize], "pl-0"),
736
+ "data-ug-slot": "suffix",
737
+ children: suffix
738
+ }
739
+ ) : null
740
+ ]
741
+ }
742
+ ),
743
+ append ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
744
+ "span",
745
+ {
746
+ className: cn(
747
+ "inline-flex shrink-0 items-center border border-l-0 border-border-strong bg-surface-2 text-text-secondary [border-end-end-radius:var(--radius-control)] [border-start-end-radius:var(--radius-control)]",
748
+ inputSizeClasses[resolvedSize],
749
+ inputPaddingClasses[resolvedSize]
750
+ ),
751
+ "data-ug-slot": "append",
752
+ children: append
753
+ }
754
+ ) : null
755
+ ] }),
756
+ usesCanonicalSubmitValue ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
757
+ "input",
758
+ {
759
+ disabled: resolvedDisabled,
760
+ form,
761
+ name,
762
+ type: "hidden",
763
+ value: rawValue
764
+ }
765
+ ) : null,
766
+ showWordLimit && maxLength && wordLimitPosition === "outside" ? /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
767
+ "span",
768
+ {
769
+ "aria-hidden": "true",
770
+ className: "self-end text-xs tabular-nums text-text-tertiary",
771
+ "data-ug-slot": "count",
772
+ children: [
773
+ characterCount,
774
+ "/",
775
+ maxLength
776
+ ]
777
+ }
778
+ ) : null,
779
+ error ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("p", { id: messageId, className: "text-xs text-danger", "data-ug-slot": "message", children: error }) : null,
780
+ !error && helperText ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("p", { id: messageId, className: "text-xs text-text-secondary", "data-ug-slot": "message", children: helperText }) : null
781
+ ]
782
+ }
783
+ );
151
784
  }
152
785
  );
153
786
  Input.displayName = "Input";
154
787
 
155
788
  // src/components/label.tsx
156
- var import_react3 = require("react");
157
- var import_jsx_runtime3 = require("react/jsx-runtime");
158
- var Label = (0, import_react3.forwardRef)(({ className, required, children, ...props }, ref) => {
159
- return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
789
+ var import_react6 = require("react");
790
+ var import_jsx_runtime5 = require("react/jsx-runtime");
791
+ var labelSizeClasses = {
792
+ sm: "text-xs",
793
+ default: "text-sm",
794
+ lg: "text-base"
795
+ };
796
+ var Label = (0, import_react6.forwardRef)(({
797
+ className,
798
+ required,
799
+ size,
800
+ disabled,
801
+ children,
802
+ ...props
803
+ }, ref) => {
804
+ const config = useUIConfig();
805
+ const resolvedSize = resolveControlSize(size, config.size);
806
+ const resolvedDisabled = resolveDisabled(disabled, config.disabled);
807
+ const state = resolvedDisabled ? "disabled" : required ? "required" : "default";
808
+ return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
160
809
  "label",
161
810
  {
162
811
  ref,
163
812
  className: cn(
164
- "leading-none text-sm font-medium text-text-primary peer-disabled:cursor-not-allowed peer-disabled:opacity-70",
813
+ "leading-none font-medium text-text-primary",
814
+ resolvedDisabled && "cursor-not-allowed opacity-60",
815
+ labelSizeClasses[resolvedSize],
165
816
  className
166
817
  ),
167
818
  ...props,
819
+ "data-ug": "label",
820
+ "data-state": state,
821
+ "data-required": required || void 0,
822
+ "data-variant": "default",
823
+ "data-size": resolvedSize,
824
+ "aria-disabled": resolvedDisabled || void 0,
168
825
  children: [
169
- children,
170
- required && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "ml-0.5 text-danger", "aria-hidden": "true", children: "*" })
826
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { "data-ug-slot": "label", children }),
827
+ required && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "ml-[calc(var(--content-gap)*0.125)] text-danger", "aria-hidden": "true", "data-ug-slot": "marker", children: "*" })
171
828
  ]
172
829
  }
173
830
  );
@@ -175,25 +832,25 @@ var Label = (0, import_react3.forwardRef)(({ className, required, children, ...p
175
832
  Label.displayName = "Label";
176
833
 
177
834
  // src/components/card.tsx
178
- var import_react4 = require("react");
179
- var import_jsx_runtime4 = require("react/jsx-runtime");
180
- var Card = (0, import_react4.forwardRef)(({ className, ...props }, ref) => {
181
- return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { ref, className: cn("rounded-lg border border-border-base bg-surface-1 shadow-sm", className), ...props });
835
+ var import_react7 = require("react");
836
+ var import_jsx_runtime6 = require("react/jsx-runtime");
837
+ var Card = (0, import_react7.forwardRef)(({ className, ...props }, ref) => {
838
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { ref, ...props, className: cn("overflow-hidden rounded-[var(--radius-panel)] border border-border-base bg-surface-1 shadow-sm", className), "data-ug": "card", "data-state": "default", "data-variant": "default", "data-size": "md" });
182
839
  });
183
- var CardHeader = (0, import_react4.forwardRef)(({ className, ...props }, ref) => {
184
- return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { ref, className: cn("flex flex-col gap-1 px-5 py-4 border-b border-border-base", className), ...props });
840
+ var CardHeader = (0, import_react7.forwardRef)(({ className, ...props }, ref) => {
841
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { ref, ...props, className: cn("flex flex-col gap-1.5 p-[var(--content-gap)] pb-[calc(var(--content-gap)*0.5)]", className), "data-ug-slot": "header" });
185
842
  });
186
- var CardTitle = (0, import_react4.forwardRef)(({ className, ...props }, ref) => {
187
- return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("h3", { ref, className: cn("leading-none font-semibold text-text-primary", className), ...props });
843
+ var CardTitle = (0, import_react7.forwardRef)(({ className, ...props }, ref) => {
844
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("h3", { ref, ...props, className: cn("leading-none font-semibold text-text-primary", className), "data-ug-slot": "title" });
188
845
  });
189
- var CardDescription = (0, import_react4.forwardRef)(({ className, ...props }, ref) => {
190
- return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("p", { ref, className: cn("text-sm text-text-secondary", className), ...props });
846
+ var CardDescription = (0, import_react7.forwardRef)(({ className, ...props }, ref) => {
847
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("p", { ref, ...props, className: cn("text-sm text-text-secondary", className), "data-ug-slot": "description" });
191
848
  });
192
- var CardContent = (0, import_react4.forwardRef)(({ className, ...props }, ref) => {
193
- return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { ref, className: cn("px-5 py-4", className), ...props });
849
+ var CardContent = (0, import_react7.forwardRef)(({ className, ...props }, ref) => {
850
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { ref, ...props, className: cn("px-[var(--content-gap)] pb-[var(--content-gap)] pt-[calc(var(--content-gap)*0.5)]", className), "data-ug-slot": "content" });
194
851
  });
195
- var CardFooter = (0, import_react4.forwardRef)(({ className, ...props }, ref) => {
196
- return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { ref, className: cn("flex items-center px-5 py-4 border-t border-border-base", className), ...props });
852
+ var CardFooter = (0, import_react7.forwardRef)(({ className, ...props }, ref) => {
853
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { ref, ...props, className: cn("flex items-center gap-2 px-[var(--content-gap)] pb-[var(--content-gap)]", className), "data-ug-slot": "footer" });
197
854
  });
198
855
  Card.displayName = "Card";
199
856
  CardHeader.displayName = "CardHeader";
@@ -203,11 +860,11 @@ CardContent.displayName = "CardContent";
203
860
  CardFooter.displayName = "CardFooter";
204
861
 
205
862
  // src/components/badge.tsx
206
- var import_react5 = require("react");
863
+ var import_react8 = require("react");
207
864
  var import_class_variance_authority2 = require("class-variance-authority");
208
- var import_jsx_runtime5 = require("react/jsx-runtime");
865
+ var import_jsx_runtime7 = require("react/jsx-runtime");
209
866
  var badgeVariants = (0, import_class_variance_authority2.cva)(
210
- "inline-flex min-h-6 items-center rounded-md px-2.5 py-0.5 text-xs font-semibold leading-none transition-colors",
867
+ "inline-flex min-h-[calc(var(--control-height-sm)*0.75)] items-center rounded-[var(--radius-control)] px-[var(--control-padding-x-sm)] py-[calc(var(--content-gap)*0.125)] text-xs font-semibold leading-none transition-colors",
211
868
  {
212
869
  variants: {
213
870
  variant: {
@@ -224,18 +881,31 @@ var badgeVariants = (0, import_class_variance_authority2.cva)(
224
881
  }
225
882
  }
226
883
  );
227
- var Badge = (0, import_react5.forwardRef)(({ className, variant, ...props }, ref) => {
228
- return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { ref, className: cn(badgeVariants({ variant }), className), ...props });
884
+ var Badge = (0, import_react8.forwardRef)(({ className, variant, children, ...props }, ref) => {
885
+ const resolvedVariant = variant ?? "default";
886
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
887
+ "span",
888
+ {
889
+ ref,
890
+ className: cn(badgeVariants({ variant }), className),
891
+ ...props,
892
+ "data-ug": "badge",
893
+ "data-state": "default",
894
+ "data-variant": resolvedVariant,
895
+ "data-size": "md",
896
+ children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { "data-ug-slot": "label", children })
897
+ }
898
+ );
229
899
  });
230
900
  Badge.displayName = "Badge";
231
901
 
232
902
  // src/components/tag.tsx
233
- var import_react6 = require("react");
234
- var import_lucide_react2 = require("lucide-react");
903
+ var import_react9 = require("react");
904
+ var import_lucide_react3 = require("lucide-react");
235
905
  var import_class_variance_authority3 = require("class-variance-authority");
236
- var import_jsx_runtime6 = require("react/jsx-runtime");
906
+ var import_jsx_runtime8 = require("react/jsx-runtime");
237
907
  var tagVariants = (0, import_class_variance_authority3.cva)(
238
- "inline-flex items-center gap-1.5 rounded-md border font-medium leading-none transition-colors",
908
+ "inline-flex items-center gap-1.5 rounded-[var(--radius-control)] border font-medium leading-none transition-colors",
239
909
  {
240
910
  variants: {
241
911
  variant: {
@@ -247,8 +917,8 @@ var tagVariants = (0, import_class_variance_authority3.cva)(
247
917
  outline: "border-border-strong bg-transparent text-text-primary"
248
918
  },
249
919
  size: {
250
- sm: "min-h-6 px-2 text-[11px]",
251
- default: "min-h-7 px-2.5 text-xs"
920
+ sm: "min-h-[calc(var(--control-height-sm)*0.75)] px-[var(--control-padding-x-sm)] text-[11px]",
921
+ default: "min-h-[calc(var(--control-height-sm)*0.875)] px-[var(--control-padding-x-sm)] text-xs"
252
922
  }
253
923
  },
254
924
  defaultVariants: {
@@ -257,33 +927,44 @@ var tagVariants = (0, import_class_variance_authority3.cva)(
257
927
  }
258
928
  }
259
929
  );
260
- var Tag = (0, import_react6.forwardRef)(
930
+ var Tag = (0, import_react9.forwardRef)(
261
931
  ({ variant, size, closable = false, disabled = false, color, onClose, className, children, style, ...props }, ref) => {
262
932
  const customStyle = color ? { backgroundColor: color, color: "hsl(var(--primary-fg))", borderColor: color, ...style } : style ?? {};
933
+ const resolvedVariant = variant ?? "default";
934
+ const resolvedSize = size ?? "default";
935
+ const state = disabled ? "disabled" : "default";
263
936
  function handleClose(event) {
264
937
  event.stopPropagation();
265
938
  if (!disabled) {
266
939
  onClose?.(event);
267
940
  }
268
941
  }
269
- return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
942
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
270
943
  "span",
271
944
  {
272
945
  ref,
273
946
  className: cn(tagVariants({ variant, size }), disabled && "cursor-not-allowed opacity-50", className),
274
947
  style: customStyle,
275
948
  ...props,
949
+ "data-ug": "tag",
950
+ "data-state": state,
951
+ "data-variant": resolvedVariant,
952
+ "data-size": resolvedSize,
276
953
  children: [
277
- children,
278
- closable && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
954
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { "data-ug-slot": "label", children }),
955
+ closable && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
279
956
  "button",
280
957
  {
281
958
  type: "button",
282
959
  onClick: handleClose,
283
960
  disabled,
284
- className: "-mr-1 inline-flex h-4 w-4 items-center justify-center rounded-sm opacity-70 transition hover:bg-surface-3 hover:opacity-100 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-current disabled:pointer-events-none",
961
+ className: "-mr-[calc(var(--control-padding-x-sm)*0.33)] inline-flex h-[calc(var(--control-height-sm)*0.5)] w-[calc(var(--control-height-sm)*0.5)] items-center justify-center rounded-[calc(var(--radius-control)*0.5)] opacity-70 transition hover:bg-surface-3 hover:opacity-100 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-current disabled:pointer-events-none",
285
962
  "aria-label": "\u5173\u95ED\u6807\u7B7E",
286
- children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_lucide_react2.X, { size: 10, strokeWidth: 2.5 })
963
+ "data-ug-slot": "close",
964
+ "data-state": state,
965
+ "data-variant": resolvedVariant,
966
+ "data-size": resolvedSize,
967
+ children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_lucide_react3.X, { size: 10, strokeWidth: 2.5 })
287
968
  }
288
969
  )
289
970
  ]
@@ -294,22 +975,51 @@ var Tag = (0, import_react6.forwardRef)(
294
975
  Tag.displayName = "Tag";
295
976
 
296
977
  // src/components/separator.tsx
297
- var import_react7 = require("react");
298
- var import_jsx_runtime7 = require("react/jsx-runtime");
299
- var ORIENTATION_CLASSES = {
300
- horizontal: "h-px w-full bg-border-base",
301
- vertical: "w-px h-full bg-border-base"
978
+ var import_react10 = require("react");
979
+ var import_jsx_runtime9 = require("react/jsx-runtime");
980
+ var contentPositionClasses = {
981
+ start: "after:flex-[1_1_auto] before:flex-[0_1_5%]",
982
+ center: "after:flex-1 before:flex-1",
983
+ end: "after:flex-[0_1_5%] before:flex-[1_1_auto]"
302
984
  };
303
- var Separator = (0, import_react7.forwardRef)(
304
- ({ orientation = "horizontal", className, ...props }, ref) => {
305
- return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
985
+ var lineStyleClasses = {
986
+ solid: "border-solid before:border-solid after:border-solid",
987
+ dashed: "border-dashed before:border-dashed after:border-dashed",
988
+ dotted: "border-dotted before:border-dotted after:border-dotted"
989
+ };
990
+ var Separator = (0, import_react10.forwardRef)(
991
+ ({
992
+ orientation = "horizontal",
993
+ lineStyle = "solid",
994
+ contentPosition = "center",
995
+ children,
996
+ className,
997
+ style,
998
+ ...props
999
+ }, ref) => {
1000
+ const hasContent = orientation === "horizontal" && import_react10.Children.toArray(children).some(
1001
+ (child) => typeof child !== "string" || child.trim().length > 0
1002
+ );
1003
+ return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
306
1004
  "div",
307
1005
  {
308
1006
  ref,
309
1007
  role: "separator",
310
1008
  "aria-orientation": orientation,
311
- className: cn(ORIENTATION_CLASSES[orientation], className),
312
- ...props
1009
+ className: cn(
1010
+ orientation === "vertical" ? "h-full min-h-[1em] w-0 shrink-0 border-l border-border-base" : hasContent ? "flex w-full items-center gap-3 text-xs text-text-secondary before:min-w-4 before:border-t before:border-border-base after:min-w-4 after:border-t after:border-border-base" : "w-full border-t border-border-base",
1011
+ hasContent && contentPositionClasses[contentPosition],
1012
+ lineStyleClasses[lineStyle],
1013
+ className
1014
+ ),
1015
+ style,
1016
+ ...props,
1017
+ "data-ug": "separator",
1018
+ "data-ug-slot": "line",
1019
+ "data-state": "default",
1020
+ "data-variant": `${orientation} ${lineStyle}`,
1021
+ "data-size": "md",
1022
+ children: hasContent ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: "shrink-0", "data-ug-slot": "content", children }) : null
313
1023
  }
314
1024
  );
315
1025
  }
@@ -317,68 +1027,1135 @@ var Separator = (0, import_react7.forwardRef)(
317
1027
  Separator.displayName = "Separator";
318
1028
 
319
1029
  // src/components/spinner.tsx
320
- var import_react8 = require("react");
321
- var import_lucide_react3 = require("lucide-react");
1030
+ var import_react11 = require("react");
1031
+ var import_lucide_react4 = require("lucide-react");
322
1032
  var import_class_variance_authority4 = require("class-variance-authority");
323
- var import_jsx_runtime8 = require("react/jsx-runtime");
1033
+ var import_jsx_runtime10 = require("react/jsx-runtime");
324
1034
  var spinnerVariants = (0, import_class_variance_authority4.cva)("animate-spin text-text-tertiary", {
325
1035
  variants: {
326
1036
  size: {
327
- sm: "h-4 w-4",
328
- md: "h-6 w-6",
329
- lg: "h-10 w-10"
1037
+ sm: "h-[calc(var(--control-height-sm)*0.5)] w-[calc(var(--control-height-sm)*0.5)]",
1038
+ md: "h-[calc(var(--control-height-md)*0.6)] w-[calc(var(--control-height-md)*0.6)]",
1039
+ lg: "h-[calc(var(--control-height-lg)*0.75)] w-[calc(var(--control-height-lg)*0.75)]"
330
1040
  }
331
1041
  },
332
1042
  defaultVariants: {
333
1043
  size: "md"
334
1044
  }
335
1045
  });
336
- var Spinner = (0, import_react8.forwardRef)(({ className, size, label = "\u52A0\u8F7D\u4E2D", ...props }, ref) => {
337
- return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
338
- import_lucide_react3.Loader2,
1046
+ var Spinner = (0, import_react11.forwardRef)(({ className, size, label = "\u52A0\u8F7D\u4E2D", ...props }, ref) => {
1047
+ const resolvedSize = size ?? "md";
1048
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
1049
+ import_lucide_react4.Loader2,
339
1050
  {
340
1051
  ref,
341
1052
  className: cn(spinnerVariants({ size }), className),
342
1053
  "aria-label": label,
343
1054
  role: "status",
1055
+ "data-ug": "spinner",
1056
+ "data-ug-slot": "icon",
1057
+ "data-state": "loading",
1058
+ "data-variant": "default",
1059
+ "data-size": resolvedSize,
344
1060
  ...props
345
1061
  }
346
1062
  );
347
1063
  });
348
1064
  Spinner.displayName = "Spinner";
1065
+
1066
+ // src/components/link.tsx
1067
+ var import_react12 = require("react");
1068
+ var import_lucide_react5 = require("lucide-react");
1069
+ var import_jsx_runtime11 = require("react/jsx-runtime");
1070
+ var linkSizeClasses = {
1071
+ sm: "text-xs",
1072
+ default: "text-sm",
1073
+ lg: "text-base"
1074
+ };
1075
+ var linkToneClasses = {
1076
+ neutral: "text-[hsl(var(--link-neutral))]",
1077
+ primary: "text-[hsl(var(--link-primary))]",
1078
+ success: "text-[hsl(var(--link-success))]",
1079
+ warning: "text-[hsl(var(--link-warning))]",
1080
+ danger: "text-[hsl(var(--link-danger))]",
1081
+ info: "text-[hsl(var(--link-info))]",
1082
+ inherit: "text-inherit"
1083
+ };
1084
+ function resolveLinkRel(target, rel) {
1085
+ if (target !== "_blank") return rel;
1086
+ const tokens = new Set(rel?.split(/\s+/).filter(Boolean) ?? []);
1087
+ tokens.add("noopener");
1088
+ tokens.add("noreferrer");
1089
+ return Array.from(tokens).join(" ");
1090
+ }
1091
+ var Link = (0, import_react12.forwardRef)(
1092
+ ({
1093
+ children,
1094
+ className,
1095
+ disabled,
1096
+ external = false,
1097
+ endIcon,
1098
+ href,
1099
+ onClick,
1100
+ rel,
1101
+ showExternalIcon = false,
1102
+ size,
1103
+ startIcon,
1104
+ tabIndex,
1105
+ target,
1106
+ tone,
1107
+ underline,
1108
+ ...props
1109
+ }, ref) => {
1110
+ const config = useUIConfig();
1111
+ const resolvedDisabled = resolveDisabled(disabled, config.disabled);
1112
+ const resolvedSize = resolveControlSize(size, config.size);
1113
+ const resolvedTone = tone ?? config.link.tone ?? "primary";
1114
+ const resolvedUnderline = underline ?? config.link.underline ?? "hover";
1115
+ const resolvedTarget = external ? target ?? "_blank" : target;
1116
+ const resolvedRel = resolveLinkRel(resolvedTarget, rel);
1117
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
1118
+ "a",
1119
+ {
1120
+ ref,
1121
+ ...props,
1122
+ "aria-disabled": resolvedDisabled || void 0,
1123
+ "data-external": external || void 0,
1124
+ "data-size": resolvedSize,
1125
+ "data-state": resolvedDisabled ? "disabled" : "default",
1126
+ "data-tone": resolvedTone,
1127
+ "data-ug": "link",
1128
+ "data-ug-slot": "root",
1129
+ "data-variant": resolvedUnderline,
1130
+ href: resolvedDisabled ? void 0 : href,
1131
+ className: cn(
1132
+ "inline-flex items-center gap-1 rounded-[var(--radius-sm)] outline-none transition-[color,text-decoration-color,opacity] duration-[var(--motion-duration-base)] ease-[var(--motion-easing-standard)] motion-reduce:transition-none",
1133
+ linkSizeClasses[resolvedSize],
1134
+ linkToneClasses[resolvedTone],
1135
+ "focus-visible:ring-2 focus-visible:ring-primary/40 focus-visible:ring-offset-2 focus-visible:ring-offset-background",
1136
+ resolvedUnderline === "always" && "underline decoration-current underline-offset-4",
1137
+ resolvedUnderline === "hover" && "decoration-transparent underline underline-offset-4 hover:decoration-current",
1138
+ resolvedUnderline === "never" && "no-underline",
1139
+ resolvedDisabled && "cursor-not-allowed opacity-50",
1140
+ className
1141
+ ),
1142
+ onClick: (event) => {
1143
+ if (resolvedDisabled) {
1144
+ event.preventDefault();
1145
+ event.stopPropagation();
1146
+ return;
1147
+ }
1148
+ onClick?.(event);
1149
+ },
1150
+ rel: resolvedRel,
1151
+ tabIndex: resolvedDisabled ? -1 : tabIndex,
1152
+ target: resolvedTarget,
1153
+ children: [
1154
+ startIcon ? /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { "aria-hidden": "true", className: "inline-flex shrink-0", "data-ug-slot": "start-icon", children: startIcon }) : null,
1155
+ children,
1156
+ endIcon ? /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { "aria-hidden": "true", className: "inline-flex shrink-0", "data-ug-slot": "end-icon", children: endIcon }) : null,
1157
+ external && showExternalIcon ? /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
1158
+ import_lucide_react5.ExternalLink,
1159
+ {
1160
+ "aria-hidden": "true",
1161
+ className: "h-[1em] w-[1em]",
1162
+ "data-ug-slot": "external-icon",
1163
+ size: 16,
1164
+ strokeWidth: 1.8
1165
+ }
1166
+ ) : null
1167
+ ]
1168
+ }
1169
+ );
1170
+ }
1171
+ );
1172
+ Link.displayName = "Link";
1173
+
1174
+ // src/components/text.tsx
1175
+ var import_react13 = require("react");
1176
+ var import_jsx_runtime12 = require("react/jsx-runtime");
1177
+ var toneClasses = {
1178
+ default: "text-text-primary",
1179
+ primary: "text-primary",
1180
+ secondary: "text-text-secondary",
1181
+ tertiary: "text-text-tertiary",
1182
+ success: "text-success",
1183
+ warning: "text-warning",
1184
+ danger: "text-danger",
1185
+ info: "text-info",
1186
+ inherit: "text-inherit"
1187
+ };
1188
+ var sizeClasses = {
1189
+ xs: "text-[11px]",
1190
+ sm: "text-xs",
1191
+ default: "text-sm",
1192
+ md: "text-[15px]",
1193
+ lg: "text-base"
1194
+ };
1195
+ function normalizeLineClamp(value) {
1196
+ if (value === void 0 || value === null || value === "") return void 0;
1197
+ const parsed = typeof value === "number" ? value : Number(value);
1198
+ return Number.isFinite(parsed) && parsed > 0 ? Math.floor(parsed) : void 0;
1199
+ }
1200
+ var Text = (0, import_react13.forwardRef)(
1201
+ ({
1202
+ as: Component = "span",
1203
+ className,
1204
+ lineClamp,
1205
+ style,
1206
+ tone = "default",
1207
+ size,
1208
+ truncate = false,
1209
+ ...props
1210
+ }, ref) => {
1211
+ const config = useUIConfig();
1212
+ const resolvedSize = size ?? resolveControlSize(void 0, config.size);
1213
+ const normalizedLineClamp = normalizeLineClamp(lineClamp);
1214
+ const clampStyle = normalizedLineClamp ? {
1215
+ display: "-webkit-box",
1216
+ WebkitBoxOrient: "vertical",
1217
+ WebkitLineClamp: normalizedLineClamp,
1218
+ overflow: "hidden"
1219
+ } : void 0;
1220
+ return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
1221
+ Component,
1222
+ {
1223
+ ref,
1224
+ className: cn(
1225
+ toneClasses[tone],
1226
+ sizeClasses[resolvedSize],
1227
+ truncate && !normalizedLineClamp && "inline-block min-w-0 max-w-full truncate align-bottom",
1228
+ className
1229
+ ),
1230
+ style: { ...clampStyle, ...style },
1231
+ "data-size": resolvedSize,
1232
+ "data-state": truncate || normalizedLineClamp ? "truncated" : "default",
1233
+ "data-ug": "text",
1234
+ "data-ug-slot": "root",
1235
+ "data-variant": tone,
1236
+ ...props
1237
+ }
1238
+ );
1239
+ }
1240
+ );
1241
+ Text.displayName = "Text";
1242
+
1243
+ // src/components/space.tsx
1244
+ var import_react14 = require("react");
1245
+ var import_jsx_runtime13 = require("react/jsx-runtime");
1246
+ var gapSizes = {
1247
+ xs: 4,
1248
+ sm: 8,
1249
+ md: 12,
1250
+ lg: 16,
1251
+ small: 8,
1252
+ default: 12,
1253
+ large: 16
1254
+ };
1255
+ var alignClasses = {
1256
+ start: "items-start",
1257
+ center: "items-center",
1258
+ end: "items-end",
1259
+ baseline: "items-baseline",
1260
+ stretch: "items-stretch"
1261
+ };
1262
+ function resolveGap(gap) {
1263
+ return typeof gap === "number" ? Number.isFinite(gap) ? Math.max(0, gap) : 0 : gapSizes[gap];
1264
+ }
1265
+ function resolveGaps(size) {
1266
+ if (Array.isArray(size)) {
1267
+ return [resolveGap(size[0]), resolveGap(size[1])];
1268
+ }
1269
+ const gap = resolveGap(size);
1270
+ return [gap, gap];
1271
+ }
1272
+ function resolveFillRatio(fillRatio) {
1273
+ return Number.isFinite(fillRatio) ? Math.min(100, Math.max(1, fillRatio)) : 100;
1274
+ }
1275
+ function flattenSpaceItems(children) {
1276
+ return import_react14.Children.toArray(children).flatMap((item) => {
1277
+ if (typeof item === "string" && item.trim() === "") return [];
1278
+ if ((0, import_react14.isValidElement)(item) && item.type === import_react14.Fragment) {
1279
+ return flattenSpaceItems(item.props.children);
1280
+ }
1281
+ return [item];
1282
+ });
1283
+ }
1284
+ var Space = (0, import_react14.forwardRef)(
1285
+ ({
1286
+ align = "center",
1287
+ children,
1288
+ className,
1289
+ direction = "horizontal",
1290
+ fill = false,
1291
+ fillRatio = 100,
1292
+ inline = false,
1293
+ separator,
1294
+ size = "default",
1295
+ style,
1296
+ wrap = false,
1297
+ ...props
1298
+ }, ref) => {
1299
+ const items = flattenSpaceItems(children);
1300
+ const hasSeparator = separator !== void 0 && separator !== null && separator !== false;
1301
+ const shouldWrapItems = fill || hasSeparator;
1302
+ const [horizontalGap, verticalGap] = resolveGaps(size);
1303
+ const gapDivisor = hasSeparator ? 2 : 1;
1304
+ const normalizedFillRatio = resolveFillRatio(fillRatio);
1305
+ const itemStyle = fill ? direction === "horizontal" ? { flex: `1 1 ${normalizedFillRatio}%`, minWidth: 0 } : { width: `${normalizedFillRatio}%` } : void 0;
1306
+ return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
1307
+ "div",
1308
+ {
1309
+ ref,
1310
+ "data-fill": fill ? "true" : "false",
1311
+ "data-size": typeof size === "string" ? size : "custom",
1312
+ "data-state": wrap ? "wrap" : "default",
1313
+ "data-ug": "space",
1314
+ "data-ug-slot": "root",
1315
+ "data-variant": direction,
1316
+ className: cn(
1317
+ inline ? "inline-flex" : "flex",
1318
+ direction === "vertical" && "flex-col",
1319
+ alignClasses[align],
1320
+ wrap && "flex-wrap",
1321
+ className
1322
+ ),
1323
+ style: {
1324
+ columnGap: horizontalGap / gapDivisor,
1325
+ rowGap: verticalGap / gapDivisor,
1326
+ ...style
1327
+ },
1328
+ ...props,
1329
+ children: shouldWrapItems ? items.map((item, index) => /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(import_react14.Fragment, { children: [
1330
+ index > 0 && hasSeparator ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
1331
+ "span",
1332
+ {
1333
+ "aria-hidden": "true",
1334
+ className: "inline-flex shrink-0 items-center text-text-tertiary",
1335
+ "data-ug-slot": "separator",
1336
+ children: separator
1337
+ }
1338
+ ) : null,
1339
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { "data-ug-slot": "item", style: itemStyle, children: item })
1340
+ ] }, item.key ?? index)) : items
1341
+ }
1342
+ );
1343
+ }
1344
+ );
1345
+ Space.displayName = "Space";
1346
+
1347
+ // src/components/scrollbar.tsx
1348
+ var import_react15 = require("react");
1349
+ var import_jsx_runtime14 = require("react/jsx-runtime");
1350
+ var orientationClasses = {
1351
+ vertical: "overflow-y-auto overflow-x-hidden",
1352
+ horizontal: "overflow-x-auto overflow-y-hidden",
1353
+ both: "overflow-auto"
1354
+ };
1355
+ var appearanceClasses = {
1356
+ auto: "[scrollbar-width:auto]",
1357
+ thin: "[scrollbar-color:var(--color-border-strong)_transparent] [scrollbar-width:thin]",
1358
+ hidden: "[scrollbar-width:none] [&::-webkit-scrollbar]:hidden"
1359
+ };
1360
+ var overscrollClasses = {
1361
+ auto: "overscroll-auto",
1362
+ contain: "overscroll-contain",
1363
+ none: "overscroll-none"
1364
+ };
1365
+ function toCssSize(value) {
1366
+ return typeof value === "number" ? Number.isFinite(value) ? `${Math.max(0, value)}px` : void 0 : value;
1367
+ }
1368
+ function normalizeDistance(value) {
1369
+ return Number.isFinite(value) ? Math.max(0, value) : 0;
1370
+ }
1371
+ function assignRef2(ref, value) {
1372
+ if (typeof ref === "function") {
1373
+ ref(value);
1374
+ return;
1375
+ }
1376
+ if (ref) ref.current = value;
1377
+ }
1378
+ var Scrollbar = (0, import_react15.forwardRef)(
1379
+ ({
1380
+ className,
1381
+ height,
1382
+ horizontal = false,
1383
+ maxHeight,
1384
+ maxWidth,
1385
+ onEndReached,
1386
+ onScroll,
1387
+ onScrollPosition,
1388
+ orientation,
1389
+ overscroll = "contain",
1390
+ distance = 0,
1391
+ scrollbar = "thin",
1392
+ style,
1393
+ tabIndex = 0,
1394
+ width,
1395
+ ...props
1396
+ }, forwardedRef) => {
1397
+ const viewportRef = (0, import_react15.useRef)(null);
1398
+ const reachedDirectionsRef = (0, import_react15.useRef)(/* @__PURE__ */ new Set());
1399
+ const resolvedOrientation = orientation ?? (horizontal ? "horizontal" : "vertical");
1400
+ function setViewportRef(node) {
1401
+ viewportRef.current = node;
1402
+ assignRef2(forwardedRef, node);
1403
+ }
1404
+ function handleScroll(event) {
1405
+ onScroll?.(event);
1406
+ onScrollPosition?.({
1407
+ scrollTop: event.currentTarget.scrollTop,
1408
+ scrollLeft: event.currentTarget.scrollLeft
1409
+ });
1410
+ if (!onEndReached) return;
1411
+ const viewport = event.currentTarget;
1412
+ const threshold = normalizeDistance(distance);
1413
+ const checks = [];
1414
+ const activeDirections = /* @__PURE__ */ new Set();
1415
+ if (resolvedOrientation !== "horizontal" && viewport.scrollHeight > viewport.clientHeight) {
1416
+ activeDirections.add("top");
1417
+ activeDirections.add("bottom");
1418
+ checks.push(
1419
+ ["top", viewport.scrollTop <= threshold],
1420
+ ["bottom", viewport.scrollHeight - viewport.clientHeight - viewport.scrollTop <= threshold]
1421
+ );
1422
+ }
1423
+ if (resolvedOrientation !== "vertical" && viewport.scrollWidth > viewport.clientWidth) {
1424
+ activeDirections.add("left");
1425
+ activeDirections.add("right");
1426
+ checks.push(
1427
+ ["left", viewport.scrollLeft <= threshold],
1428
+ ["right", viewport.scrollWidth - viewport.clientWidth - viewport.scrollLeft <= threshold]
1429
+ );
1430
+ }
1431
+ reachedDirectionsRef.current.forEach((direction) => {
1432
+ if (!activeDirections.has(direction)) reachedDirectionsRef.current.delete(direction);
1433
+ });
1434
+ checks.forEach(([direction, reached]) => {
1435
+ if (!reached) {
1436
+ reachedDirectionsRef.current.delete(direction);
1437
+ return;
1438
+ }
1439
+ if (reachedDirectionsRef.current.has(direction)) return;
1440
+ reachedDirectionsRef.current.add(direction);
1441
+ onEndReached(direction);
1442
+ });
1443
+ }
1444
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
1445
+ "div",
1446
+ {
1447
+ ref: setViewportRef,
1448
+ "data-size": "auto",
1449
+ "data-state": "default",
1450
+ "data-ug": "scrollbar",
1451
+ "data-ug-slot": "viewport",
1452
+ "data-variant": resolvedOrientation,
1453
+ tabIndex,
1454
+ className: cn(
1455
+ orientationClasses[resolvedOrientation],
1456
+ appearanceClasses[scrollbar],
1457
+ overscrollClasses[overscroll],
1458
+ className
1459
+ ),
1460
+ style: {
1461
+ height: toCssSize(height),
1462
+ maxHeight: toCssSize(maxHeight),
1463
+ width: toCssSize(width),
1464
+ maxWidth: toCssSize(maxWidth),
1465
+ ...style
1466
+ },
1467
+ onScroll: handleScroll,
1468
+ ...props
1469
+ }
1470
+ );
1471
+ }
1472
+ );
1473
+ Scrollbar.displayName = "Scrollbar";
1474
+
1475
+ // src/components/layout.tsx
1476
+ var import_react16 = require("react");
1477
+ var import_jsx_runtime15 = require("react/jsx-runtime");
1478
+ var justifyClasses = {
1479
+ start: "justify-start",
1480
+ center: "justify-center",
1481
+ end: "justify-end",
1482
+ between: "justify-between",
1483
+ around: "justify-around",
1484
+ evenly: "justify-evenly"
1485
+ };
1486
+ var alignClasses2 = {
1487
+ start: "items-start",
1488
+ center: "items-center",
1489
+ end: "items-end",
1490
+ stretch: "items-stretch"
1491
+ };
1492
+ var clampGridValue = (value, fallback) => {
1493
+ const resolvedValue = value ?? fallback;
1494
+ return Number.isFinite(resolvedValue) ? Math.min(24, Math.max(0, Math.round(resolvedValue))) : fallback;
1495
+ };
1496
+ var normalizeGutter = (value) => Number.isFinite(value) ? Math.max(0, value ?? 0) : 0;
1497
+ function normalizeColSize(value, fallback) {
1498
+ if (typeof value === "number") {
1499
+ return { ...fallback, span: clampGridValue(value, fallback.span) };
1500
+ }
1501
+ return {
1502
+ span: clampGridValue(value?.span, fallback.span),
1503
+ offset: clampGridValue(value?.offset, fallback.offset),
1504
+ push: clampGridValue(value?.push, fallback.push),
1505
+ pull: clampGridValue(value?.pull, fallback.pull)
1506
+ };
1507
+ }
1508
+ var toPercent = (value) => `${value / 24 * 100}%`;
1509
+ var toShift = ({ pull, push }) => `${(push - pull) / 24 * 100}%`;
1510
+ var Row = (0, import_react16.forwardRef)(
1511
+ ({ align = "stretch", as: Component = "div", className, gutter = 0, justify = "start", style, wrap = true, ...props }, ref) => {
1512
+ const [horizontalGutter, verticalGutter] = Array.isArray(gutter) ? [normalizeGutter(gutter[0]), normalizeGutter(gutter[1])] : [normalizeGutter(gutter), 0];
1513
+ const halfHorizontalGutter = horizontalGutter / 2;
1514
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
1515
+ Component,
1516
+ {
1517
+ ref,
1518
+ "data-size": "24",
1519
+ "data-state": wrap ? "wrap" : "default",
1520
+ "data-ug": "layout",
1521
+ "data-ug-slot": "row",
1522
+ "data-variant": "grid",
1523
+ className: cn("flex", justifyClasses[justify], alignClasses2[align], wrap && "flex-wrap", className),
1524
+ style: {
1525
+ marginInlineStart: horizontalGutter ? `${-halfHorizontalGutter}px` : void 0,
1526
+ marginInlineEnd: horizontalGutter ? `${-halfHorizontalGutter}px` : void 0,
1527
+ rowGap: `${verticalGutter}px`,
1528
+ "--ug-row-gutter": `${horizontalGutter}px`,
1529
+ ...style
1530
+ },
1531
+ ...props
1532
+ }
1533
+ );
1534
+ }
1535
+ );
1536
+ var Col = (0, import_react16.forwardRef)(
1537
+ ({ as: Component = "div", className, offset = 0, pull = 0, push = 0, span = 24, style, xs, sm, md, lg, xl, ...props }, ref) => {
1538
+ const base = normalizeColSize({ span, offset, push, pull }, { span: 24, offset: 0, push: 0, pull: 0 });
1539
+ const xsSize = normalizeColSize(xs, base);
1540
+ const smSize = normalizeColSize(sm, xsSize);
1541
+ const mdSize = normalizeColSize(md, smSize);
1542
+ const lgSize = normalizeColSize(lg, mdSize);
1543
+ const xlSize = normalizeColSize(xl, lgSize);
1544
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
1545
+ Component,
1546
+ {
1547
+ ref,
1548
+ "data-size": base.span,
1549
+ "data-state": "default",
1550
+ "data-ug": "layout",
1551
+ "data-ug-slot": "col",
1552
+ "data-variant": "grid",
1553
+ className: cn(
1554
+ "relative min-w-0 flex-none px-[calc(var(--ug-row-gutter,0px)/2)]",
1555
+ "[flex-basis:var(--ug-col-base)] [max-width:var(--ug-col-base)]",
1556
+ "[display:var(--ug-col-display-base)]",
1557
+ "[margin-inline-start:var(--ug-col-offset-base)] [inset-inline-start:var(--ug-col-shift-base)]",
1558
+ "max-sm:[flex-basis:var(--ug-col-xs)] max-sm:[max-width:var(--ug-col-xs)]",
1559
+ "max-sm:[display:var(--ug-col-display-xs)]",
1560
+ "max-sm:[margin-inline-start:var(--ug-col-offset-xs)] max-sm:[inset-inline-start:var(--ug-col-shift-xs)]",
1561
+ "sm:[flex-basis:var(--ug-col-sm)] sm:[max-width:var(--ug-col-sm)]",
1562
+ "sm:[display:var(--ug-col-display-sm)]",
1563
+ "sm:[margin-inline-start:var(--ug-col-offset-sm)] sm:[inset-inline-start:var(--ug-col-shift-sm)]",
1564
+ "md:[flex-basis:var(--ug-col-md)] md:[max-width:var(--ug-col-md)]",
1565
+ "md:[display:var(--ug-col-display-md)]",
1566
+ "md:[margin-inline-start:var(--ug-col-offset-md)] md:[inset-inline-start:var(--ug-col-shift-md)]",
1567
+ "lg:[flex-basis:var(--ug-col-lg)] lg:[max-width:var(--ug-col-lg)]",
1568
+ "lg:[display:var(--ug-col-display-lg)]",
1569
+ "lg:[margin-inline-start:var(--ug-col-offset-lg)] lg:[inset-inline-start:var(--ug-col-shift-lg)]",
1570
+ "xl:[flex-basis:var(--ug-col-xl)] xl:[max-width:var(--ug-col-xl)]",
1571
+ "xl:[display:var(--ug-col-display-xl)]",
1572
+ "xl:[margin-inline-start:var(--ug-col-offset-xl)] xl:[inset-inline-start:var(--ug-col-shift-xl)]",
1573
+ className
1574
+ ),
1575
+ style: {
1576
+ "--ug-col-base": toPercent(base.span),
1577
+ "--ug-col-display-base": base.span === 0 ? "none" : "block",
1578
+ "--ug-col-offset-base": toPercent(base.offset),
1579
+ "--ug-col-shift-base": toShift(base),
1580
+ "--ug-col-xs": toPercent(xsSize.span),
1581
+ "--ug-col-display-xs": xsSize.span === 0 ? "none" : "block",
1582
+ "--ug-col-offset-xs": toPercent(xsSize.offset),
1583
+ "--ug-col-shift-xs": toShift(xsSize),
1584
+ "--ug-col-sm": toPercent(smSize.span),
1585
+ "--ug-col-display-sm": smSize.span === 0 ? "none" : "block",
1586
+ "--ug-col-offset-sm": toPercent(smSize.offset),
1587
+ "--ug-col-shift-sm": toShift(smSize),
1588
+ "--ug-col-md": toPercent(mdSize.span),
1589
+ "--ug-col-display-md": mdSize.span === 0 ? "none" : "block",
1590
+ "--ug-col-offset-md": toPercent(mdSize.offset),
1591
+ "--ug-col-shift-md": toShift(mdSize),
1592
+ "--ug-col-lg": toPercent(lgSize.span),
1593
+ "--ug-col-display-lg": lgSize.span === 0 ? "none" : "block",
1594
+ "--ug-col-offset-lg": toPercent(lgSize.offset),
1595
+ "--ug-col-shift-lg": toShift(lgSize),
1596
+ "--ug-col-xl": toPercent(xlSize.span),
1597
+ "--ug-col-display-xl": xlSize.span === 0 ? "none" : "block",
1598
+ "--ug-col-offset-xl": toPercent(xlSize.offset),
1599
+ "--ug-col-shift-xl": toShift(xlSize),
1600
+ ...style
1601
+ },
1602
+ ...props
1603
+ }
1604
+ );
1605
+ }
1606
+ );
1607
+ Row.displayName = "Row";
1608
+ Col.displayName = "Col";
1609
+
1610
+ // src/components/container.tsx
1611
+ var import_react17 = require("react");
1612
+ var import_jsx_runtime16 = require("react/jsx-runtime");
1613
+ var toCssSize2 = (value) => typeof value === "number" ? Number.isFinite(value) ? `${Math.max(0, value)}px` : void 0 : value;
1614
+ function hasVerticalRegion(children) {
1615
+ return import_react17.Children.toArray(children).some((child) => {
1616
+ if (!(0, import_react17.isValidElement)(child)) return false;
1617
+ if (child.type === Header || child.type === Footer) return true;
1618
+ if (child.type !== import_react17.Fragment) return false;
1619
+ return hasVerticalRegion(child.props.children);
1620
+ });
1621
+ }
1622
+ var Header = (0, import_react17.forwardRef)(
1623
+ ({ as: Component = "header", className, height = 60, style, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
1624
+ Component,
1625
+ {
1626
+ ref,
1627
+ className: cn("shrink-0", className),
1628
+ style: { height: toCssSize2(height), ...style },
1629
+ "data-ug-slot": "header",
1630
+ ...props
1631
+ }
1632
+ )
1633
+ );
1634
+ var Aside = (0, import_react17.forwardRef)(
1635
+ ({ as: Component = "aside", className, width = 300, style, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
1636
+ Component,
1637
+ {
1638
+ ref,
1639
+ className: cn("min-h-[0] shrink-0", className),
1640
+ style: { width: toCssSize2(width), ...style },
1641
+ "data-ug-slot": "aside",
1642
+ ...props
1643
+ }
1644
+ )
1645
+ );
1646
+ var Main = (0, import_react17.forwardRef)(
1647
+ ({ as: Component = "main", className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
1648
+ Component,
1649
+ {
1650
+ ref,
1651
+ className: cn("min-h-[0] min-w-0 flex-1", className),
1652
+ "data-ug-slot": "main",
1653
+ ...props
1654
+ }
1655
+ )
1656
+ );
1657
+ var Footer = (0, import_react17.forwardRef)(
1658
+ ({ as: Component = "footer", className, height = 60, style, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
1659
+ Component,
1660
+ {
1661
+ ref,
1662
+ className: cn("shrink-0", className),
1663
+ style: { height: toCssSize2(height), ...style },
1664
+ "data-ug-slot": "footer",
1665
+ ...props
1666
+ }
1667
+ )
1668
+ );
1669
+ var Container = (0, import_react17.forwardRef)(
1670
+ ({ as: Component = "div", children, className, direction = "auto", ...props }, ref) => {
1671
+ const resolvedDirection = direction === "auto" ? hasVerticalRegion(children) ? "vertical" : "horizontal" : direction;
1672
+ return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
1673
+ Component,
1674
+ {
1675
+ ref,
1676
+ "data-size": "auto",
1677
+ "data-state": "default",
1678
+ "data-ug": "container",
1679
+ "data-ug-slot": "root",
1680
+ "data-variant": resolvedDirection,
1681
+ className: cn(
1682
+ "flex min-h-[0] min-w-0 flex-1",
1683
+ resolvedDirection === "vertical" ? "flex-col" : "flex-row",
1684
+ className
1685
+ ),
1686
+ ...props,
1687
+ children
1688
+ }
1689
+ );
1690
+ }
1691
+ );
1692
+ Container.displayName = "Container";
1693
+ Header.displayName = "Header";
1694
+ Aside.displayName = "Aside";
1695
+ Main.displayName = "Main";
1696
+ Footer.displayName = "Footer";
1697
+
1698
+ // src/components/splitter.tsx
1699
+ var import_react18 = require("react");
1700
+ var import_jsx_runtime17 = require("react/jsx-runtime");
1701
+ var clamp = (value, min, max) => Math.min(max, Math.max(min, Number.isFinite(value) ? value : min));
1702
+ function normalizeSizes(values, count) {
1703
+ if (count <= 0) return [];
1704
+ const source = Array.from({ length: count }, (_, index) => Math.max(0, values[index] ?? 0));
1705
+ const total = source.reduce((sum, value) => sum + value, 0);
1706
+ if (total <= 0) return Array.from({ length: count }, () => 100 / count);
1707
+ return source.map((value) => value / total * 100);
1708
+ }
1709
+ function constrainSizes(values, configs) {
1710
+ if (configs.length === 0) return [];
1711
+ const normalized = normalizeSizes(values, configs.length);
1712
+ const declaredMins = configs.map((config, index) => {
1713
+ const min = config.collapsible && normalized[index] <= config.collapsedSize + 0.01 ? config.collapsedSize : config.min;
1714
+ return Math.min(min, config.max);
1715
+ });
1716
+ const declaredMaxs = configs.map((config) => Math.max(config.min, config.max));
1717
+ const minTotal = declaredMins.reduce((sum, value) => sum + value, 0);
1718
+ const maxTotal = declaredMaxs.reduce((sum, value) => sum + value, 0);
1719
+ const mins = minTotal > 100 ? declaredMins.map((value) => value / minTotal * 100) : declaredMins;
1720
+ const maxs = maxTotal < 100 ? declaredMaxs.map((value) => value / maxTotal * 100) : declaredMaxs;
1721
+ const next = normalized.map((value, index) => clamp(value, mins[index], maxs[index]));
1722
+ for (let attempt = 0; attempt < configs.length * 2; attempt += 1) {
1723
+ const delta = 100 - next.reduce((sum, value) => sum + value, 0);
1724
+ if (Math.abs(delta) < 1e-4) break;
1725
+ const capacities = next.map(
1726
+ (value, index) => delta > 0 ? Math.max(0, maxs[index] - value) : Math.max(0, value - mins[index])
1727
+ );
1728
+ const capacityTotal = capacities.reduce((sum, value) => sum + value, 0);
1729
+ if (capacityTotal <= 0) break;
1730
+ next.forEach((value, index) => {
1731
+ next[index] = value + delta * (capacities[index] / capacityTotal);
1732
+ });
1733
+ }
1734
+ return normalizeSizes(next, configs.length);
1735
+ }
1736
+ function buildDefaultSizes(configs, defaults) {
1737
+ const values = configs.map((config, index) => defaults?.[index] ?? config.defaultSize);
1738
+ const specifiedTotal = values.reduce((sum, value) => sum + (value ?? 0), 0);
1739
+ const unspecifiedCount = values.filter((value) => value === void 0).length;
1740
+ const remainder = Math.max(0, 100 - specifiedTotal);
1741
+ const fallback = unspecifiedCount > 0 ? remainder / unspecifiedCount : 0;
1742
+ return constrainSizes(values.map((value) => value ?? fallback), configs);
1743
+ }
1744
+ function resizePair(sizes, configs, separatorIndex, requestedFirstSize, overrides) {
1745
+ const first = configs[separatorIndex];
1746
+ const second = configs[separatorIndex + 1];
1747
+ if (!first || !second || !first.resizable || !second.resizable) return [...sizes];
1748
+ const pairSize = sizes[separatorIndex] + sizes[separatorIndex + 1];
1749
+ const firstMin = overrides?.firstMin ?? first.min;
1750
+ const secondMin = overrides?.secondMin ?? second.min;
1751
+ const lowerBound = Math.max(firstMin, pairSize - second.max);
1752
+ const upperBound = Math.min(first.max, pairSize - secondMin);
1753
+ const nextFirst = clamp(requestedFirstSize, lowerBound, upperBound);
1754
+ const next = [...sizes];
1755
+ next[separatorIndex] = nextFirst;
1756
+ next[separatorIndex + 1] = pairSize - nextFirst;
1757
+ return next;
1758
+ }
1759
+ function getEffectivePanelMin(config, size) {
1760
+ return config.collapsible && size <= config.collapsedSize + 0.01 ? config.collapsedSize : config.min;
1761
+ }
1762
+ function getPairBounds(sizes, configs, separatorIndex) {
1763
+ const first = configs[separatorIndex];
1764
+ const second = configs[separatorIndex + 1];
1765
+ if (!first || !second) return { min: 0, max: 100 };
1766
+ const pairSize = sizes[separatorIndex] + sizes[separatorIndex + 1];
1767
+ const prefix = sizes.slice(0, separatorIndex).reduce((sum, value) => sum + value, 0);
1768
+ const firstMin = getEffectivePanelMin(first, sizes[separatorIndex]);
1769
+ const secondMin = getEffectivePanelMin(second, sizes[separatorIndex + 1]);
1770
+ return {
1771
+ min: prefix + Math.max(firstMin, pairSize - second.max),
1772
+ max: prefix + Math.min(first.max, pairSize - secondMin)
1773
+ };
1774
+ }
1775
+ var SplitterPanel = (0, import_react18.forwardRef)(
1776
+ ({
1777
+ children,
1778
+ className,
1779
+ collapsible: _collapsible,
1780
+ collapsedSize: _collapsedSize,
1781
+ defaultSize: _defaultSize,
1782
+ max: _max,
1783
+ min: _min,
1784
+ onCollapseChange: _onCollapseChange,
1785
+ resizable: _resizable,
1786
+ ...props
1787
+ }, ref) => /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
1788
+ "div",
1789
+ {
1790
+ ref,
1791
+ className: cn("min-h-[0] min-w-[0] overflow-auto", className),
1792
+ "data-ug-slot": "panel",
1793
+ ...props,
1794
+ children
1795
+ }
1796
+ )
1797
+ );
1798
+ SplitterPanel.displayName = "SplitterPanel";
1799
+ function getPanelElements(children) {
1800
+ return import_react18.Children.toArray(children).flatMap((child) => {
1801
+ if (!(0, import_react18.isValidElement)(child)) return [];
1802
+ if (child.type === import_react18.Fragment) {
1803
+ return getPanelElements(child.props.children);
1804
+ }
1805
+ return child.type === SplitterPanel ? [child] : [];
1806
+ });
1807
+ }
1808
+ var Splitter = (0, import_react18.forwardRef)(
1809
+ ({
1810
+ children,
1811
+ className,
1812
+ defaultSize = 50,
1813
+ defaultSizes,
1814
+ direction = "horizontal",
1815
+ first,
1816
+ keyboardStep = 2,
1817
+ lazy = false,
1818
+ max = 90,
1819
+ min = 10,
1820
+ onChange,
1821
+ onCollapse,
1822
+ onResize,
1823
+ onResizeEnd,
1824
+ onResizeStart,
1825
+ onSizesChange,
1826
+ second,
1827
+ size,
1828
+ sizes,
1829
+ ...props
1830
+ }, ref) => {
1831
+ const rootRef = (0, import_react18.useRef)(null);
1832
+ const dragRef = (0, import_react18.useRef)(null);
1833
+ const restoreSizesRef = (0, import_react18.useRef)({});
1834
+ const generatedId = (0, import_react18.useId)();
1835
+ const configs = (0, import_react18.useMemo)(() => {
1836
+ const compoundPanels = getPanelElements(children);
1837
+ const elements = compoundPanels.length > 0 ? compoundPanels : [
1838
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(SplitterPanel, { defaultSize, min, max, children: first }, "legacy-first"),
1839
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(SplitterPanel, { min: 100 - max, max: 100 - min, children: second }, "legacy-second")
1840
+ ];
1841
+ return elements.map((element) => {
1842
+ const rawMin = clamp(element.props.min ?? 0, 0, 100);
1843
+ const rawMax = clamp(element.props.max ?? 100, 0, 100);
1844
+ const minSize = Math.min(rawMin, rawMax);
1845
+ const maxSize = Math.max(rawMin, rawMax);
1846
+ return {
1847
+ element,
1848
+ min: minSize,
1849
+ max: maxSize,
1850
+ defaultSize: element.props.defaultSize,
1851
+ collapsible: element.props.collapsible ?? false,
1852
+ collapsedSize: clamp(element.props.collapsedSize ?? 0, 0, minSize),
1853
+ resizable: element.props.resizable ?? true
1854
+ };
1855
+ });
1856
+ }, [children, defaultSize, first, max, min, second]);
1857
+ const defaultSignature = configs.map((config) => `${config.defaultSize ?? ""}:${config.min}:${config.max}`).join("|");
1858
+ const [internalSizes, setInternalSizes] = (0, import_react18.useState)(() => buildDefaultSizes(configs, defaultSizes));
1859
+ (0, import_react18.useEffect)(() => {
1860
+ setInternalSizes(
1861
+ (current) => current.length === configs.length ? constrainSizes(current, configs) : buildDefaultSizes(configs, defaultSizes)
1862
+ );
1863
+ }, [configs, configs.length, defaultSignature, defaultSizes]);
1864
+ const controlledSizes = sizes ? constrainSizes(sizes, configs) : size !== void 0 && configs.length === 2 ? constrainSizes([clamp(size, min, max), 100 - clamp(size, min, max)], configs) : void 0;
1865
+ const currentSizes = controlledSizes ?? internalSizes;
1866
+ const emitSizes = (next, separatorIndex, phase) => {
1867
+ const normalized = constrainSizes(next, configs);
1868
+ if (!controlledSizes) setInternalSizes(normalized);
1869
+ onSizesChange?.(normalized);
1870
+ onChange?.(normalized[0] ?? 0);
1871
+ const detail = { separatorIndex, sizes: normalized };
1872
+ if (phase === "resize") onResize?.(detail);
1873
+ if (phase === "end") onResizeEnd?.(detail);
1874
+ return normalized;
1875
+ };
1876
+ const finishDrag = (separatorIndex) => {
1877
+ const drag = dragRef.current;
1878
+ if (!drag) return;
1879
+ dragRef.current = null;
1880
+ emitSizes(drag.latestSizes, separatorIndex, "end");
1881
+ };
1882
+ const toggleCollapsedPanel = (separatorIndex) => {
1883
+ const candidateIndex = configs[separatorIndex]?.collapsible ? separatorIndex : configs[separatorIndex + 1]?.collapsible ? separatorIndex + 1 : -1;
1884
+ if (candidateIndex < 0) return;
1885
+ const pairIndex = candidateIndex === separatorIndex ? separatorIndex : separatorIndex;
1886
+ const config = configs[candidateIndex];
1887
+ const current = currentSizes[candidateIndex];
1888
+ const collapsed = current <= config.collapsedSize + 0.01;
1889
+ const pairTotal = currentSizes[pairIndex] + currentSizes[pairIndex + 1];
1890
+ let requestedFirstSize;
1891
+ if (candidateIndex === pairIndex) {
1892
+ if (!collapsed) restoreSizesRef.current[candidateIndex] = current;
1893
+ requestedFirstSize = collapsed ? restoreSizesRef.current[candidateIndex] ?? config.defaultSize ?? pairTotal / 2 : config.collapsedSize;
1894
+ } else {
1895
+ if (!collapsed) restoreSizesRef.current[candidateIndex] = current;
1896
+ const nextSecond = collapsed ? restoreSizesRef.current[candidateIndex] ?? config.defaultSize ?? pairTotal / 2 : config.collapsedSize;
1897
+ requestedFirstSize = pairTotal - nextSecond;
1898
+ }
1899
+ const next = resizePair(
1900
+ currentSizes,
1901
+ configs,
1902
+ pairIndex,
1903
+ requestedFirstSize,
1904
+ collapsed ? void 0 : candidateIndex === pairIndex ? { firstMin: config.collapsedSize } : { secondMin: config.collapsedSize }
1905
+ );
1906
+ const nextCollapsed = next[candidateIndex] <= config.collapsedSize + 0.01;
1907
+ if (nextCollapsed === collapsed) return;
1908
+ emitSizes(next, pairIndex, "change");
1909
+ config.element.props.onCollapseChange?.(nextCollapsed);
1910
+ onCollapse?.({
1911
+ panelIndex: candidateIndex,
1912
+ collapsed: nextCollapsed,
1913
+ sizes: next
1914
+ });
1915
+ };
1916
+ return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
1917
+ "div",
1918
+ {
1919
+ ref: (node) => {
1920
+ rootRef.current = node;
1921
+ if (typeof ref === "function") ref(node);
1922
+ else if (ref) ref.current = node;
1923
+ },
1924
+ className: cn(
1925
+ "flex min-h-[0] min-w-[0] overflow-hidden",
1926
+ direction === "vertical" && "flex-col",
1927
+ className
1928
+ ),
1929
+ "data-panel-count": configs.length,
1930
+ "data-size": "auto",
1931
+ "data-state": "default",
1932
+ "data-ug": "splitter",
1933
+ "data-ug-slot": "root",
1934
+ "data-variant": direction,
1935
+ ...props,
1936
+ children: configs.flatMap((config, index) => {
1937
+ const panelId = config.element.props.id ?? `${generatedId}-panel-${index}`;
1938
+ const panel = (0, import_react18.cloneElement)(config.element, {
1939
+ id: panelId,
1940
+ "aria-hidden": currentSizes[index] <= config.collapsedSize + 0.01 || void 0,
1941
+ "data-state": currentSizes[index] <= config.collapsedSize + 0.01 ? "collapsed" : "expanded",
1942
+ style: {
1943
+ flexBasis: `${currentSizes[index]}%`,
1944
+ flexGrow: 0,
1945
+ flexShrink: 0,
1946
+ ...config.element.props.style
1947
+ }
1948
+ });
1949
+ if (index === configs.length - 1) return [panel];
1950
+ const disabled = !config.resizable || !configs[index + 1]?.resizable;
1951
+ const position = currentSizes.slice(0, index + 1).reduce((sum, value) => sum + value, 0);
1952
+ const bounds = getPairBounds(currentSizes, configs, index);
1953
+ const separator = /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
1954
+ "div",
1955
+ {
1956
+ "aria-controls": `${panelId} ${configs[index + 1]?.element.props.id ?? `${generatedId}-panel-${index + 1}`}`,
1957
+ "aria-disabled": disabled || void 0,
1958
+ "aria-label": `\u8C03\u6574\u7B2C ${index + 1} \u4E0E\u7B2C ${index + 2} \u4E2A\u9762\u677F`,
1959
+ "aria-orientation": direction,
1960
+ "aria-valuemax": Math.round(bounds.max),
1961
+ "aria-valuemin": Math.round(bounds.min),
1962
+ "aria-valuenow": Math.round(position),
1963
+ className: cn(
1964
+ "group relative shrink-0 touch-none bg-border-base outline-none",
1965
+ !disabled && "focus-visible:bg-primary",
1966
+ direction === "horizontal" ? "w-[var(--control-border-width)] cursor-col-resize" : "h-[var(--control-border-width)] cursor-row-resize",
1967
+ disabled && "cursor-default opacity-disabled"
1968
+ ),
1969
+ "data-ug-slot": "separator",
1970
+ onDoubleClick: () => toggleCollapsedPanel(index),
1971
+ onKeyDown: (event) => {
1972
+ if (disabled) return;
1973
+ const decrease = direction === "horizontal" ? "ArrowLeft" : "ArrowUp";
1974
+ const increase = direction === "horizontal" ? "ArrowRight" : "ArrowDown";
1975
+ if (event.key === decrease || event.key === increase) {
1976
+ event.preventDefault();
1977
+ const next = resizePair(
1978
+ currentSizes,
1979
+ configs,
1980
+ index,
1981
+ currentSizes[index] + (event.key === increase ? keyboardStep : -keyboardStep)
1982
+ );
1983
+ emitSizes(next, index, "change");
1984
+ } else if (event.key === "Home") {
1985
+ event.preventDefault();
1986
+ emitSizes(resizePair(currentSizes, configs, index, config.min), index, "change");
1987
+ } else if (event.key === "End") {
1988
+ event.preventDefault();
1989
+ emitSizes(resizePair(currentSizes, configs, index, config.max), index, "change");
1990
+ } else if (event.key === "Enter") {
1991
+ event.preventDefault();
1992
+ toggleCollapsedPanel(index);
1993
+ }
1994
+ },
1995
+ onLostPointerCapture: () => finishDrag(index),
1996
+ onPointerCancel: () => finishDrag(index),
1997
+ onPointerDown: (event) => {
1998
+ if (disabled || !rootRef.current) return;
1999
+ event.preventDefault();
2000
+ const rect = rootRef.current.getBoundingClientRect();
2001
+ dragRef.current = {
2002
+ pointerId: event.pointerId,
2003
+ separatorIndex: index,
2004
+ pointerStart: direction === "horizontal" ? event.clientX : event.clientY,
2005
+ sizes: [...currentSizes],
2006
+ latestSizes: [...currentSizes]
2007
+ };
2008
+ event.currentTarget.setPointerCapture(event.pointerId);
2009
+ onResizeStart?.({ separatorIndex: index, sizes: [...currentSizes] });
2010
+ },
2011
+ onPointerMove: (event) => {
2012
+ const drag = dragRef.current;
2013
+ if (!drag || drag.pointerId !== event.pointerId || drag.separatorIndex !== index || !rootRef.current) return;
2014
+ const rect = rootRef.current.getBoundingClientRect();
2015
+ const total = direction === "horizontal" ? rect.width : rect.height;
2016
+ if (total <= 0) return;
2017
+ const pointer = direction === "horizontal" ? event.clientX : event.clientY;
2018
+ const delta = (pointer - drag.pointerStart) / total * 100;
2019
+ const next = resizePair(drag.sizes, configs, index, drag.sizes[index] + delta);
2020
+ drag.latestSizes = next;
2021
+ if (lazy) {
2022
+ onResize?.({ separatorIndex: index, sizes: normalizeSizes(next, configs.length) });
2023
+ return;
2024
+ }
2025
+ emitSizes(next, index, "resize");
2026
+ },
2027
+ onPointerUp: (event) => {
2028
+ if (event.currentTarget.hasPointerCapture(event.pointerId)) {
2029
+ event.currentTarget.releasePointerCapture(event.pointerId);
2030
+ }
2031
+ finishDrag(index);
2032
+ },
2033
+ role: "separator",
2034
+ tabIndex: disabled ? -1 : 0,
2035
+ children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
2036
+ "span",
2037
+ {
2038
+ className: cn(
2039
+ "absolute rounded-full bg-border-strong transition-colors duration-150 group-hover:bg-primary",
2040
+ direction === "horizontal" ? "left-1/2 top-1/2 h-[var(--control-height-sm)] w-[calc(var(--control-border-width)*4)] -translate-x-1/2 -translate-y-1/2" : "left-1/2 top-1/2 h-[calc(var(--control-border-width)*4)] w-[var(--control-height-sm)] -translate-x-1/2 -translate-y-1/2"
2041
+ )
2042
+ }
2043
+ )
2044
+ },
2045
+ `${generatedId}-separator-${index}`
2046
+ );
2047
+ return [panel, separator];
2048
+ })
2049
+ }
2050
+ );
2051
+ }
2052
+ );
2053
+ Splitter.displayName = "Splitter";
2054
+
2055
+ // src/components/icon.tsx
2056
+ var import_react19 = require("react");
2057
+ var import_jsx_runtime18 = require("react/jsx-runtime");
2058
+ var Icon = (0, import_react19.forwardRef)(
2059
+ ({
2060
+ children,
2061
+ className,
2062
+ color,
2063
+ decorative = true,
2064
+ icon: Graphic,
2065
+ size = 16,
2066
+ spin = false,
2067
+ strokeWidth = 2,
2068
+ style,
2069
+ ...props
2070
+ }, ref) => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
2071
+ "span",
2072
+ {
2073
+ ref,
2074
+ "aria-hidden": decorative || void 0,
2075
+ className: cn(
2076
+ "inline-flex shrink-0 items-center justify-center text-current [&_svg]:h-[1em] [&_svg]:w-[1em]",
2077
+ spin && "animate-spin motion-reduce:animate-none",
2078
+ className
2079
+ ),
2080
+ "data-size": size,
2081
+ "data-state": spin ? "spinning" : "default",
2082
+ "data-ug": "icon",
2083
+ "data-ug-slot": "root",
2084
+ "data-variant": decorative ? "decorative" : "semantic",
2085
+ role: decorative ? void 0 : "img",
2086
+ style: { color, fontSize: size, height: size, width: size, ...style },
2087
+ ...props,
2088
+ children: Graphic ? /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Graphic, { "aria-hidden": "true", focusable: "false", size, strokeWidth }) : /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { "aria-hidden": "true", className: "contents", children })
2089
+ }
2090
+ )
2091
+ );
2092
+ Icon.displayName = "Icon";
349
2093
  // Annotate the CommonJS export names for ESM import in node:
350
2094
  0 && (module.exports = {
2095
+ Aside,
351
2096
  Badge,
352
2097
  Button,
2098
+ ButtonGroup,
353
2099
  Card,
354
2100
  CardContent,
355
2101
  CardDescription,
356
2102
  CardFooter,
357
2103
  CardHeader,
358
2104
  CardTitle,
2105
+ Col,
2106
+ ConfigProvider,
2107
+ Container,
2108
+ Footer,
2109
+ Header,
2110
+ Icon,
359
2111
  Input,
360
2112
  Label,
2113
+ Link,
2114
+ Main,
2115
+ Row,
2116
+ Scrollbar,
361
2117
  Separator,
2118
+ Space,
362
2119
  Spinner,
2120
+ Splitter,
2121
+ SplitterPanel,
363
2122
  Tag,
2123
+ Text,
2124
+ UGAside,
364
2125
  UGBadge,
365
2126
  UGButton,
2127
+ UGButtonGroup,
366
2128
  UGCard,
367
2129
  UGCardContent,
368
2130
  UGCardDescription,
369
2131
  UGCardFooter,
370
2132
  UGCardHeader,
371
2133
  UGCardTitle,
2134
+ UGCol,
2135
+ UGConfigProvider,
2136
+ UGContainer,
2137
+ UGFooter,
2138
+ UGHeader,
2139
+ UGIcon,
372
2140
  UGInput,
373
2141
  UGLabel,
2142
+ UGLink,
2143
+ UGMain,
2144
+ UGRow,
2145
+ UGScrollbar,
374
2146
  UGSeparator,
2147
+ UGSpace,
375
2148
  UGSpinner,
2149
+ UGSplitter,
2150
+ UGSplitterPanel,
376
2151
  UGTag,
2152
+ UGText,
377
2153
  badgeVariants,
378
2154
  buttonVariants,
379
2155
  tagVariants,
380
2156
  ugBadgeVariants,
381
2157
  ugButtonVariants,
382
- ugTagVariants
2158
+ ugTagVariants,
2159
+ useUIConfig
383
2160
  });
384
2161
  //# sourceMappingURL=index.cjs.map