@ug666/ui-react 0.1.0 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (54) hide show
  1. package/dist/blocks/index.cjs +238 -0
  2. package/dist/blocks/index.cjs.map +1 -0
  3. package/dist/blocks/index.d.cts +86 -0
  4. package/dist/blocks/index.d.ts +86 -0
  5. package/dist/blocks/index.js +153 -0
  6. package/dist/blocks/index.js.map +1 -0
  7. package/dist/button-CaLZig8j.d.cts +22 -0
  8. package/dist/button-CaLZig8j.d.ts +22 -0
  9. package/dist/chunk-2IVRUJKO.js +377 -0
  10. package/dist/chunk-2IVRUJKO.js.map +1 -0
  11. package/dist/chunk-73WQAE3E.js +3003 -0
  12. package/dist/chunk-73WQAE3E.js.map +1 -0
  13. package/dist/chunk-RUDEZA5Q.js +62 -0
  14. package/dist/chunk-RUDEZA5Q.js.map +1 -0
  15. package/dist/chunk-S45GP6IB.js +254 -0
  16. package/dist/chunk-S45GP6IB.js.map +1 -0
  17. package/dist/components/index.cjs +3993 -0
  18. package/dist/components/index.cjs.map +1 -0
  19. package/dist/components/index.d.cts +1097 -0
  20. package/dist/components/index.d.ts +1097 -0
  21. package/dist/components/index.js +330 -0
  22. package/dist/components/index.js.map +1 -0
  23. package/dist/hooks/index.cjs +1 -0
  24. package/dist/hooks/index.cjs.map +1 -1
  25. package/dist/hooks/index.js +1 -0
  26. package/dist/index.cjs +1410 -710
  27. package/dist/index.cjs.map +1 -1
  28. package/dist/index.d.cts +274 -1340
  29. package/dist/index.d.ts +274 -1340
  30. package/dist/index.js +385 -3229
  31. package/dist/index.js.map +1 -1
  32. package/dist/labs/index.cjs +34 -0
  33. package/dist/labs/index.cjs.map +1 -0
  34. package/dist/labs/index.d.cts +12 -0
  35. package/dist/labs/index.d.ts +12 -0
  36. package/dist/labs/index.js +9 -0
  37. package/dist/labs/index.js.map +1 -0
  38. package/dist/patterns/index.cjs +758 -0
  39. package/dist/patterns/index.cjs.map +1 -0
  40. package/dist/patterns/index.d.cts +158 -0
  41. package/dist/patterns/index.d.ts +158 -0
  42. package/dist/patterns/index.js +320 -0
  43. package/dist/patterns/index.js.map +1 -0
  44. package/dist/primitives/index.cjs +384 -0
  45. package/dist/primitives/index.cjs.map +1 -0
  46. package/dist/primitives/index.d.cts +137 -0
  47. package/dist/primitives/index.d.ts +137 -0
  48. package/dist/primitives/index.js +56 -0
  49. package/dist/primitives/index.js.map +1 -0
  50. package/dist/sidebar-vl00Z2o-.d.cts +93 -0
  51. package/dist/sidebar-vl00Z2o-.d.ts +93 -0
  52. package/dist/styles.css +2499 -0
  53. package/dist/tokens.css +86 -9
  54. package/package.json +36 -6
package/dist/index.cjs CHANGED
@@ -1,4 +1,5 @@
1
1
  "use strict";
2
+ "use client";
2
3
  var __defProp = Object.defineProperty;
3
4
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
5
  var __getOwnPropNames = Object.getOwnPropertyNames;
@@ -120,14 +121,121 @@ __export(index_exports, {
120
121
  Tooltip: () => Tooltip,
121
122
  TooltipContent: () => TooltipContent,
122
123
  TooltipTrigger: () => TooltipTrigger,
124
+ UGAccordion: () => Accordion,
125
+ UGAccordionContent: () => AccordionContent,
126
+ UGAccordionItem: () => AccordionItem,
127
+ UGAccordionTrigger: () => AccordionTrigger,
128
+ UGAlert: () => Alert,
129
+ UGAlertDescription: () => AlertDescription,
130
+ UGAlertTitle: () => AlertTitle,
131
+ UGAvatar: () => Avatar,
132
+ UGAvatarFallback: () => AvatarFallback,
133
+ UGAvatarGroup: () => AvatarGroup,
134
+ UGAvatarImage: () => AvatarImage,
135
+ UGBadge: () => Badge,
136
+ UGBreadcrumb: () => Breadcrumb,
137
+ UGBreadcrumbItem: () => BreadcrumbItem,
138
+ UGBreadcrumbLink: () => BreadcrumbLink,
139
+ UGBreadcrumbSeparator: () => BreadcrumbSeparator,
140
+ UGButton: () => Button,
141
+ UGCard: () => Card,
142
+ UGCardContent: () => CardContent,
143
+ UGCardDescription: () => CardDescription,
144
+ UGCardFooter: () => CardFooter,
145
+ UGCardHeader: () => CardHeader,
146
+ UGCardTitle: () => CardTitle,
147
+ UGCheckbox: () => Checkbox,
148
+ UGContextMenu: () => ContextMenu,
149
+ UGContextMenuContent: () => ContextMenuContent,
150
+ UGContextMenuItem: () => ContextMenuItem,
151
+ UGContextMenuSeparator: () => ContextMenuSeparator,
152
+ UGContextMenuTrigger: () => ContextMenuTrigger,
153
+ UGDescriptions: () => Descriptions,
154
+ UGDescriptionsItem: () => DescriptionsItem,
155
+ UGDialog: () => Dialog,
156
+ UGDrawer: () => Drawer,
157
+ UGDrawerClose: () => DrawerClose,
158
+ UGDrawerContent: () => DrawerContent,
159
+ UGDrawerDescription: () => DrawerDescription,
160
+ UGDrawerFooter: () => DrawerFooter,
161
+ UGDrawerHeader: () => DrawerHeader,
162
+ UGDrawerTitle: () => DrawerTitle,
163
+ UGDropdown: () => DropdownMenu,
164
+ UGDropdownContent: () => DropdownContent,
165
+ UGDropdownItem: () => DropdownItem,
166
+ UGDropdownMenu: () => DropdownMenu,
167
+ UGDropdownSeparator: () => DropdownSeparator,
168
+ UGDropdownTrigger: () => DropdownTrigger,
169
+ UGEmptyState: () => EmptyState,
170
+ UGForm: () => Form,
171
+ UGFormControl: () => FormControl,
172
+ UGFormDescription: () => FormDescription,
173
+ UGFormField: () => FormField,
174
+ UGFormItem: () => FormItem,
175
+ UGFormLabel: () => FormLabel,
176
+ UGFormMessage: () => FormMessage,
177
+ UGInput: () => Input,
178
+ UGLabel: () => Label,
179
+ UGModal: () => Modal,
180
+ UGModalCloseButton: () => ModalCloseButton,
181
+ UGModalContent: () => ModalContent,
182
+ UGModalFooter: () => ModalFooter,
183
+ UGModalHeader: () => ModalHeader,
184
+ UGModalTitle: () => ModalTitle,
185
+ UGNavigationMenu: () => NavigationMenu,
186
+ UGNavigationMenuContent: () => NavigationMenuContent,
187
+ UGNavigationMenuItem: () => NavigationMenuItem,
188
+ UGNavigationMenuLink: () => NavigationMenuLink,
189
+ UGNavigationMenuTrigger: () => NavigationMenuTrigger,
190
+ UGNumberInput: () => NumberInput,
191
+ UGOTPInput: () => OTPInput,
192
+ UGPagination: () => Pagination,
193
+ UGPopover: () => Popover,
194
+ UGPopoverContent: () => PopoverContent,
195
+ UGPopoverTrigger: () => PopoverTrigger,
196
+ UGProgress: () => Progress,
197
+ UGRadio: () => Radio,
198
+ UGRadioGroup: () => RadioGroup,
199
+ UGSelect: () => Select,
200
+ UGSeparator: () => Separator,
201
+ UGSheet: () => Sheet,
202
+ UGSidebar: () => Sidebar,
203
+ UGSkeleton: () => Skeleton,
204
+ UGSlider: () => Slider,
205
+ UGSpinner: () => Spinner,
206
+ UGStatistic: () => Statistic,
207
+ UGSteps: () => Steps,
208
+ UGSwitch: () => Switch,
209
+ UGTable: () => Table,
210
+ UGTableBody: () => TableBody,
211
+ UGTableCell: () => TableCell,
212
+ UGTableHead: () => TableHead,
213
+ UGTableHeader: () => TableHeader,
214
+ UGTableRow: () => TableRow,
215
+ UGTabs: () => Tabs,
216
+ UGTabsContent: () => TabsContent,
217
+ UGTabsList: () => TabsList,
218
+ UGTabsTrigger: () => TabsTrigger,
219
+ UGTag: () => Tag,
220
+ UGTextarea: () => Textarea,
221
+ UGToaster: () => Toaster,
222
+ UGTooltip: () => Tooltip,
223
+ UGTooltipContent: () => TooltipContent,
224
+ UGTooltipTrigger: () => TooltipTrigger,
123
225
  badgeVariants: () => badgeVariants,
124
226
  buttonVariants: () => buttonVariants,
125
227
  checkboxVariants: () => checkboxVariants,
126
- cn: () => import_ui_utils43.cn,
228
+ cn: () => cn,
127
229
  numberInputVariants: () => numberInputVariants,
230
+ reactComponentLayers: () => reactComponentLayers,
128
231
  tagVariants: () => tagVariants,
129
232
  theme: () => theme,
130
233
  toast: () => toast,
234
+ ugBadgeVariants: () => badgeVariants,
235
+ ugButtonVariants: () => buttonVariants,
236
+ ugCheckboxVariants: () => checkboxVariants,
237
+ ugNumberInputVariants: () => numberInputVariants,
238
+ ugTagVariants: () => tagVariants,
131
239
  useClickOutside: () => useClickOutside,
132
240
  useCopyToClipboard: () => useCopyToClipboard,
133
241
  useDebounce: () => useDebounce,
@@ -148,24 +256,32 @@ module.exports = __toCommonJS(index_exports);
148
256
  var import_react = require("react");
149
257
  var import_lucide_react = require("lucide-react");
150
258
  var import_class_variance_authority = require("class-variance-authority");
151
- var import_ui_utils = require("@ug666/ui-utils");
259
+
260
+ // src/internal/cn.ts
261
+ var import_clsx = require("clsx");
262
+ var import_tailwind_merge = require("tailwind-merge");
263
+ function cn(...inputs) {
264
+ return (0, import_tailwind_merge.twMerge)((0, import_clsx.clsx)(inputs));
265
+ }
266
+
267
+ // src/components/button.tsx
152
268
  var import_jsx_runtime = require("react/jsx-runtime");
153
269
  var buttonVariants = (0, import_class_variance_authority.cva)(
154
- "inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50",
270
+ "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",
155
271
  {
156
272
  variants: {
157
273
  variant: {
158
- default: "bg-primary text-primary-fg hover:bg-primary-hover focus-visible:ring-ring",
159
- destructive: "bg-danger text-danger-fg hover:bg-danger-hover focus-visible:ring-danger",
160
- outline: "border border-border-strong bg-surface-1 text-text-primary hover:bg-surface-2 focus-visible:ring-ring/30",
161
- secondary: "bg-surface-2 text-text-primary hover:bg-surface-3 focus-visible:ring-ring/30",
274
+ default: "bg-primary text-primary-fg shadow-sm hover:bg-primary-hover hover:shadow-md focus-visible:ring-ring",
275
+ destructive: "bg-danger text-danger-fg shadow-sm hover:bg-danger-hover hover:shadow-md focus-visible:ring-danger",
276
+ 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",
277
+ secondary: "border border-border-base bg-surface-2 text-text-primary shadow-sm hover:bg-surface-3 focus-visible:ring-ring/30",
162
278
  ghost: "text-text-primary hover:bg-surface-2 focus-visible:ring-ring/30",
163
279
  link: "text-text-primary underline-offset-4 hover:underline focus-visible:ring-ring/30"
164
280
  },
165
281
  size: {
166
282
  default: "h-9 px-4 py-2",
167
- sm: "h-8 rounded-md px-3 text-xs",
168
- lg: "h-12 rounded-md px-6 text-base",
283
+ sm: "h-8 px-3 text-xs",
284
+ lg: "h-11 px-5 text-base",
169
285
  icon: "h-9 w-9"
170
286
  }
171
287
  },
@@ -181,7 +297,7 @@ var Button = (0, import_react.forwardRef)(
181
297
  "button",
182
298
  {
183
299
  ref,
184
- className: (0, import_ui_utils.cn)(buttonVariants({ variant, size }), className),
300
+ className: cn(buttonVariants({ variant, size }), className),
185
301
  disabled: disabled || loading,
186
302
  ...props,
187
303
  children: [
@@ -196,7 +312,6 @@ Button.displayName = "Button";
196
312
 
197
313
  // src/components/input.tsx
198
314
  var import_react2 = require("react");
199
- var import_ui_utils2 = require("@ug666/ui-utils");
200
315
  var import_jsx_runtime2 = require("react/jsx-runtime");
201
316
  var Input = (0, import_react2.forwardRef)(
202
317
  ({ className, label, error, helperText, id, ...props }, ref) => {
@@ -216,7 +331,7 @@ var Input = (0, import_react2.forwardRef)(
216
331
  {
217
332
  ref,
218
333
  id: inputId,
219
- className: (0, import_ui_utils2.cn)(
334
+ className: cn(
220
335
  "flex h-9 w-full rounded-md border bg-surface-1 px-3 py-2 text-sm text-text-primary placeholder:text-text-tertiary",
221
336
  "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-offset-1",
222
337
  "disabled:cursor-not-allowed disabled:opacity-50",
@@ -235,14 +350,13 @@ Input.displayName = "Input";
235
350
 
236
351
  // src/components/label.tsx
237
352
  var import_react3 = require("react");
238
- var import_ui_utils3 = require("@ug666/ui-utils");
239
353
  var import_jsx_runtime3 = require("react/jsx-runtime");
240
354
  var Label = (0, import_react3.forwardRef)(({ className, required, children, ...props }, ref) => {
241
355
  return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
242
356
  "label",
243
357
  {
244
358
  ref,
245
- className: (0, import_ui_utils3.cn)(
359
+ className: cn(
246
360
  "leading-none text-sm font-medium text-text-primary peer-disabled:cursor-not-allowed peer-disabled:opacity-70",
247
361
  className
248
362
  ),
@@ -258,25 +372,24 @@ Label.displayName = "Label";
258
372
 
259
373
  // src/components/card.tsx
260
374
  var import_react4 = require("react");
261
- var import_ui_utils4 = require("@ug666/ui-utils");
262
375
  var import_jsx_runtime4 = require("react/jsx-runtime");
263
376
  var Card = (0, import_react4.forwardRef)(({ className, ...props }, ref) => {
264
- return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { ref, className: (0, import_ui_utils4.cn)("rounded-lg border border-border-base bg-surface-1", className), ...props });
377
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { ref, className: cn("rounded-lg border border-border-base bg-surface-1 shadow-sm", className), ...props });
265
378
  });
266
379
  var CardHeader = (0, import_react4.forwardRef)(({ className, ...props }, ref) => {
267
- return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { ref, className: (0, import_ui_utils4.cn)("flex flex-col gap-1 px-5 py-4 border-b border-border-base", className), ...props });
380
+ 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 });
268
381
  });
269
382
  var CardTitle = (0, import_react4.forwardRef)(({ className, ...props }, ref) => {
270
- return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("h3", { ref, className: (0, import_ui_utils4.cn)("leading-none font-semibold tracking-tight text-text-primary", className), ...props });
383
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("h3", { ref, className: cn("leading-none font-semibold text-text-primary", className), ...props });
271
384
  });
272
385
  var CardDescription = (0, import_react4.forwardRef)(({ className, ...props }, ref) => {
273
- return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("p", { ref, className: (0, import_ui_utils4.cn)("text-sm text-text-secondary", className), ...props });
386
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("p", { ref, className: cn("text-sm text-text-secondary", className), ...props });
274
387
  });
275
388
  var CardContent = (0, import_react4.forwardRef)(({ className, ...props }, ref) => {
276
- return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { ref, className: (0, import_ui_utils4.cn)("px-5 py-4", className), ...props });
389
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { ref, className: cn("px-5 py-4", className), ...props });
277
390
  });
278
391
  var CardFooter = (0, import_react4.forwardRef)(({ className, ...props }, ref) => {
279
- return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { ref, className: (0, import_ui_utils4.cn)("flex items-center px-5 py-4 border-t border-border-base", className), ...props });
392
+ 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 });
280
393
  });
281
394
  Card.displayName = "Card";
282
395
  CardHeader.displayName = "CardHeader";
@@ -288,19 +401,18 @@ CardFooter.displayName = "CardFooter";
288
401
  // src/components/badge.tsx
289
402
  var import_react5 = require("react");
290
403
  var import_class_variance_authority2 = require("class-variance-authority");
291
- var import_ui_utils5 = require("@ug666/ui-utils");
292
404
  var import_jsx_runtime5 = require("react/jsx-runtime");
293
405
  var badgeVariants = (0, import_class_variance_authority2.cva)(
294
- "inline-flex items-center rounded-md px-2.5 py-0.5 text-xs font-semibold transition-colors",
406
+ "inline-flex min-h-6 items-center rounded-md px-2.5 py-0.5 text-xs font-semibold leading-none transition-colors",
295
407
  {
296
408
  variants: {
297
409
  variant: {
298
- default: "bg-primary text-primary-fg",
299
- secondary: "bg-surface-3 text-text-primary",
300
- destructive: "bg-danger-soft text-danger-soft-fg",
301
- outline: "border border-border-strong text-text-primary bg-transparent",
302
- success: "bg-success-soft text-success-soft-fg",
303
- warning: "bg-warning-soft text-warning-soft-fg"
410
+ default: "border border-primary/20 bg-primary-soft text-primary-soft-fg",
411
+ secondary: "border border-border-base bg-surface-2 text-text-primary",
412
+ destructive: "border border-danger/20 bg-danger-soft text-danger-soft-fg",
413
+ outline: "border border-border-strong bg-transparent text-text-primary",
414
+ success: "border border-success/20 bg-success-soft text-success-soft-fg",
415
+ warning: "border border-warning/20 bg-warning-soft text-warning-soft-fg"
304
416
  }
305
417
  },
306
418
  defaultVariants: {
@@ -309,7 +421,7 @@ var badgeVariants = (0, import_class_variance_authority2.cva)(
309
421
  }
310
422
  );
311
423
  var Badge = (0, import_react5.forwardRef)(({ className, variant, ...props }, ref) => {
312
- return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { ref, className: (0, import_ui_utils5.cn)(badgeVariants({ variant }), className), ...props });
424
+ return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { ref, className: cn(badgeVariants({ variant }), className), ...props });
313
425
  });
314
426
  Badge.displayName = "Badge";
315
427
 
@@ -317,23 +429,22 @@ Badge.displayName = "Badge";
317
429
  var import_react6 = require("react");
318
430
  var import_lucide_react2 = require("lucide-react");
319
431
  var import_class_variance_authority3 = require("class-variance-authority");
320
- var import_ui_utils6 = require("@ug666/ui-utils");
321
432
  var import_jsx_runtime6 = require("react/jsx-runtime");
322
433
  var tagVariants = (0, import_class_variance_authority3.cva)(
323
- "inline-flex items-center gap-1 rounded font-medium transition-colors",
434
+ "inline-flex items-center gap-1.5 rounded-md border font-medium leading-none transition-colors",
324
435
  {
325
436
  variants: {
326
437
  variant: {
327
- default: "bg-surface-3 text-text-primary",
328
- primary: "bg-success-soft text-success-soft-fg",
329
- success: "bg-success-soft text-success-soft-fg",
330
- warning: "bg-warning-soft text-warning-soft-fg",
331
- destructive: "bg-danger-soft text-danger-soft-fg",
332
- outline: "border border-border-strong bg-transparent text-text-primary"
438
+ default: "border-border-base bg-surface-2 text-text-primary",
439
+ primary: "border-primary/20 bg-primary-soft text-primary-soft-fg",
440
+ success: "border-success/20 bg-success-soft text-success-soft-fg",
441
+ warning: "border-warning/20 bg-warning-soft text-warning-soft-fg",
442
+ destructive: "border-danger/20 bg-danger-soft text-danger-soft-fg",
443
+ outline: "border-border-strong bg-transparent text-text-primary"
333
444
  },
334
445
  size: {
335
- sm: "px-1.5 py-0 text-xs",
336
- default: "px-2 py-0.5 text-xs"
446
+ sm: "min-h-6 px-2 text-[11px]",
447
+ default: "min-h-7 px-2.5 text-xs"
337
448
  }
338
449
  },
339
450
  defaultVariants: {
@@ -344,7 +455,7 @@ var tagVariants = (0, import_class_variance_authority3.cva)(
344
455
  );
345
456
  var Tag = (0, import_react6.forwardRef)(
346
457
  ({ variant, size, closable = false, disabled = false, color, onClose, className, children, style, ...props }, ref) => {
347
- const customStyle = color ? { backgroundColor: color, color: "#fff", borderColor: color, ...style } : style ?? {};
458
+ const customStyle = color ? { backgroundColor: color, color: "hsl(var(--primary-fg))", borderColor: color, ...style } : style ?? {};
348
459
  function handleClose(event) {
349
460
  event.stopPropagation();
350
461
  if (!disabled) {
@@ -355,7 +466,7 @@ var Tag = (0, import_react6.forwardRef)(
355
466
  "span",
356
467
  {
357
468
  ref,
358
- className: (0, import_ui_utils6.cn)(tagVariants({ variant, size }), disabled && "cursor-not-allowed opacity-50", className),
469
+ className: cn(tagVariants({ variant, size }), disabled && "cursor-not-allowed opacity-50", className),
359
470
  style: customStyle,
360
471
  ...props,
361
472
  children: [
@@ -366,7 +477,7 @@ var Tag = (0, import_react6.forwardRef)(
366
477
  type: "button",
367
478
  onClick: handleClose,
368
479
  disabled,
369
- className: "inline-flex items-center justify-center rounded-sm opacity-60 transition-opacity hover:opacity-100 focus-visible:outline-none disabled:pointer-events-none",
480
+ 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",
370
481
  "aria-label": "\u5173\u95ED\u6807\u7B7E",
371
482
  children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_lucide_react2.X, { size: 10, strokeWidth: 2.5 })
372
483
  }
@@ -379,10 +490,9 @@ var Tag = (0, import_react6.forwardRef)(
379
490
  Tag.displayName = "Tag";
380
491
 
381
492
  // src/components/modal.tsx
382
- var import_react8 = require("react");
493
+ var import_react9 = require("react");
383
494
  var import_react_dom = require("react-dom");
384
495
  var import_lucide_react3 = require("lucide-react");
385
- var import_ui_utils7 = require("@ug666/ui-utils");
386
496
 
387
497
  // src/hooks/use-escape-key.ts
388
498
  var import_react7 = require("react");
@@ -394,7 +504,7 @@ function useEscapeKey(open, onEscape) {
394
504
  [onEscape]
395
505
  );
396
506
  (0, import_react7.useEffect)(() => {
397
- if (!open) return;
507
+ if (!open || typeof document === "undefined") return;
398
508
  document.addEventListener("keydown", handleEscape);
399
509
  document.body.style.overflow = "hidden";
400
510
  return () => {
@@ -404,18 +514,30 @@ function useEscapeKey(open, onEscape) {
404
514
  }, [open, handleEscape]);
405
515
  }
406
516
 
517
+ // src/internal/use-portal-container.ts
518
+ var import_react8 = require("react");
519
+ function usePortalContainer() {
520
+ const [container, setContainer] = (0, import_react8.useState)(null);
521
+ (0, import_react8.useEffect)(() => {
522
+ if (typeof document === "undefined") return;
523
+ setContainer(document.body);
524
+ }, []);
525
+ return container;
526
+ }
527
+
407
528
  // src/components/modal.tsx
408
529
  var import_jsx_runtime7 = require("react/jsx-runtime");
409
- var Modal = (0, import_react8.forwardRef)(({ open, onClose, children, className }, ref) => {
530
+ var Modal = (0, import_react9.forwardRef)(({ open, onClose, children, className }, ref) => {
410
531
  useEscapeKey(open, onClose);
411
- if (!open) return null;
532
+ const portalContainer = usePortalContainer();
533
+ if (!open || !portalContainer) return null;
412
534
  return (0, import_react_dom.createPortal)(
413
535
  /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
414
536
  "div",
415
537
  {
416
538
  ref,
417
- className: (0, import_ui_utils7.cn)(
418
- "fixed inset-0 z-50 flex items-center justify-center",
539
+ className: cn(
540
+ "fixed inset-0 z-[80] flex items-center justify-center p-4",
419
541
  className
420
542
  ),
421
543
  role: "dialog",
@@ -433,29 +555,29 @@ var Modal = (0, import_react8.forwardRef)(({ open, onClose, children, className
433
555
  ]
434
556
  }
435
557
  ),
436
- document.body
558
+ portalContainer
437
559
  );
438
560
  });
439
- var ModalContent = (0, import_react8.forwardRef)(({ className, maxWidth = "max-w-lg", children, ...props }, ref) => {
440
- return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { ref, className: (0, import_ui_utils7.cn)("w-full rounded-lg bg-surface-1 shadow-lg", maxWidth, className), ...props, children });
561
+ var ModalContent = (0, import_react9.forwardRef)(({ className, maxWidth = "max-w-lg", children, ...props }, ref) => {
562
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { ref, className: cn("flex max-h-[85vh] w-full flex-col rounded-lg border border-border-base bg-surface-1 shadow-xl", maxWidth, className), ...props, children });
441
563
  });
442
- var ModalHeader = (0, import_react8.forwardRef)(({ className, ...props }, ref) => {
443
- return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { ref, className: (0, import_ui_utils7.cn)("flex items-center justify-between border-b border-border-base px-6 py-4", className), ...props });
564
+ var ModalHeader = (0, import_react9.forwardRef)(({ className, ...props }, ref) => {
565
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { ref, className: cn("flex shrink-0 items-center justify-between border-b border-border-base px-6 py-4", className), ...props });
444
566
  });
445
- var ModalTitle = (0, import_react8.forwardRef)(({ className, ...props }, ref) => {
446
- return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("h2", { ref, className: (0, import_ui_utils7.cn)("text-lg font-semibold text-text-primary", className), ...props });
567
+ var ModalTitle = (0, import_react9.forwardRef)(({ className, ...props }, ref) => {
568
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("h2", { ref, className: cn("text-lg font-semibold text-text-primary", className), ...props });
447
569
  });
448
- var ModalFooter = (0, import_react8.forwardRef)(({ className, ...props }, ref) => {
449
- return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { ref, className: (0, import_ui_utils7.cn)("flex items-center justify-end gap-2 border-t border-border-base px-6 py-4", className), ...props });
570
+ var ModalFooter = (0, import_react9.forwardRef)(({ className, ...props }, ref) => {
571
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { ref, className: cn("flex shrink-0 items-center justify-end gap-2 border-t border-border-base px-6 py-4", className), ...props });
450
572
  });
451
- var ModalCloseButton = (0, import_react8.forwardRef)(({ onClick, className, type = "button", ...props }, ref) => {
573
+ var ModalCloseButton = (0, import_react9.forwardRef)(({ onClick, className, type = "button", ...props }, ref) => {
452
574
  return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
453
575
  "button",
454
576
  {
455
577
  ref,
456
578
  type,
457
579
  onClick,
458
- className: (0, import_ui_utils7.cn)(
580
+ className: cn(
459
581
  "rounded-md p-1 text-text-tertiary transition-colors hover:bg-surface-3 hover:text-text-secondary",
460
582
  className
461
583
  ),
@@ -473,15 +595,14 @@ ModalFooter.displayName = "ModalFooter";
473
595
  ModalCloseButton.displayName = "ModalCloseButton";
474
596
 
475
597
  // src/components/dialog.tsx
476
- var import_react9 = require("react");
598
+ var import_react10 = require("react");
477
599
  var import_react_dom2 = require("react-dom");
478
- var import_ui_utils8 = require("@ug666/ui-utils");
479
600
  var import_jsx_runtime8 = require("react/jsx-runtime");
480
601
  var CONFIRM_VARIANT_CLASSES = {
481
602
  default: "bg-primary text-primary-fg hover:bg-primary-hover focus-visible:ring-ring",
482
603
  destructive: "bg-danger text-danger-fg hover:bg-danger-hover focus-visible:ring-danger"
483
604
  };
484
- var Dialog = (0, import_react9.forwardRef)(
605
+ var Dialog = (0, import_react10.forwardRef)(
485
606
  ({
486
607
  open,
487
608
  onOpenChange,
@@ -494,40 +615,27 @@ var Dialog = (0, import_react9.forwardRef)(
494
615
  onCancel,
495
616
  className
496
617
  }, ref) => {
497
- const handleClose = (0, import_react9.useCallback)(() => {
618
+ const portalContainer = usePortalContainer();
619
+ const handleClose = (0, import_react10.useCallback)(() => {
498
620
  onOpenChange(false);
499
621
  }, [onOpenChange]);
500
- const handleCancel = (0, import_react9.useCallback)(() => {
622
+ const handleCancel = (0, import_react10.useCallback)(() => {
501
623
  onCancel?.();
502
624
  handleClose();
503
625
  }, [onCancel, handleClose]);
504
- const handleConfirm = (0, import_react9.useCallback)(() => {
626
+ const handleConfirm = (0, import_react10.useCallback)(() => {
505
627
  onConfirm?.();
506
628
  handleClose();
507
629
  }, [onConfirm, handleClose]);
508
- const handleEscape = (0, import_react9.useCallback)(
509
- (e) => {
510
- if (e.key === "Escape") handleCancel();
511
- },
512
- [handleCancel]
513
- );
514
- (0, import_react9.useEffect)(() => {
515
- if (!open) return;
516
- document.addEventListener("keydown", handleEscape);
517
- document.body.style.overflow = "hidden";
518
- return () => {
519
- document.removeEventListener("keydown", handleEscape);
520
- document.body.style.overflow = "";
521
- };
522
- }, [open, handleEscape]);
523
- if (!open) return null;
630
+ useEscapeKey(open, handleCancel);
631
+ if (!open || !portalContainer) return null;
524
632
  return (0, import_react_dom2.createPortal)(
525
633
  /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
526
634
  "div",
527
635
  {
528
636
  ref,
529
- className: (0, import_ui_utils8.cn)(
530
- "fixed inset-0 z-50 flex items-center justify-center p-4",
637
+ className: cn(
638
+ "fixed inset-0 z-[90] flex items-center justify-center p-4",
531
639
  className
532
640
  ),
533
641
  role: "alertdialog",
@@ -543,7 +651,7 @@ var Dialog = (0, import_react9.forwardRef)(
543
651
  "aria-hidden": "true"
544
652
  }
545
653
  ),
546
- /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "relative z-10 w-full max-w-sm rounded-lg bg-surface-1 shadow-lg", children: [
654
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "relative z-10 w-full max-w-sm rounded-lg border border-border-base bg-surface-1 shadow-xl", children: [
547
655
  /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "px-6 pt-6 pb-4", children: [
548
656
  /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
549
657
  "h2",
@@ -568,7 +676,7 @@ var Dialog = (0, import_react9.forwardRef)(
568
676
  {
569
677
  type: "button",
570
678
  onClick: handleCancel,
571
- className: (0, import_ui_utils8.cn)(
679
+ className: cn(
572
680
  "inline-flex h-9 items-center justify-center rounded-md border border-border-strong bg-surface-1 px-4 text-sm font-medium text-text-secondary transition-colors",
573
681
  "hover:bg-surface-2 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:ring-ring/30"
574
682
  ),
@@ -580,7 +688,7 @@ var Dialog = (0, import_react9.forwardRef)(
580
688
  {
581
689
  type: "button",
582
690
  onClick: handleConfirm,
583
- className: (0, import_ui_utils8.cn)(
691
+ className: cn(
584
692
  "inline-flex h-9 items-center justify-center rounded-md px-4 text-sm font-medium transition-colors",
585
693
  "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-offset-2",
586
694
  CONFIRM_VARIANT_CLASSES[variant]
@@ -593,21 +701,20 @@ var Dialog = (0, import_react9.forwardRef)(
593
701
  ]
594
702
  }
595
703
  ),
596
- document.body
704
+ portalContainer
597
705
  );
598
706
  }
599
707
  );
600
708
  Dialog.displayName = "Dialog";
601
709
 
602
710
  // src/components/drawer.tsx
603
- var import_react10 = require("react");
711
+ var import_react11 = require("react");
604
712
  var import_react_dom3 = require("react-dom");
605
713
  var import_lucide_react4 = require("lucide-react");
606
- var import_ui_utils9 = require("@ug666/ui-utils");
607
714
  var import_jsx_runtime9 = require("react/jsx-runtime");
608
- var DrawerContext = (0, import_react10.createContext)(null);
715
+ var DrawerContext = (0, import_react11.createContext)(null);
609
716
  function useDrawerContext() {
610
- const ctx = (0, import_react10.useContext)(DrawerContext);
717
+ const ctx = (0, import_react11.useContext)(DrawerContext);
611
718
  if (!ctx) throw new Error("Drawer \u5B50\u7EC4\u4EF6\u5FC5\u987B\u5728 <Drawer> \u5185\u4F7F\u7528");
612
719
  return ctx;
613
720
  }
@@ -622,9 +729,10 @@ var Drawer = ({ open, onOpenChange, side = "right", children }) => {
622
729
  return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(DrawerContext.Provider, { value: { open, onOpenChange, side }, children });
623
730
  };
624
731
  Drawer.displayName = "Drawer";
625
- var DrawerContent = (0, import_react10.forwardRef)(({ className, children, ...props }, ref) => {
732
+ var DrawerContent = (0, import_react11.forwardRef)(({ className, children, ...props }, ref) => {
626
733
  const { open, onOpenChange, side } = useDrawerContext();
627
- if (!open) return null;
734
+ const portalContainer = usePortalContainer();
735
+ if (!open || !portalContainer) return null;
628
736
  return (0, import_react_dom3.createPortal)(
629
737
  /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "fixed inset-0 z-50", role: "dialog", "aria-modal": "true", children: [
630
738
  /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
@@ -639,7 +747,7 @@ var DrawerContent = (0, import_react10.forwardRef)(({ className, children, ...pr
639
747
  "div",
640
748
  {
641
749
  ref,
642
- className: (0, import_ui_utils9.cn)(
750
+ className: cn(
643
751
  "absolute flex flex-col bg-surface-1 shadow-xl transition-transform duration-300 ease-in-out",
644
752
  SIDE_CLASSES[side],
645
753
  className
@@ -650,41 +758,41 @@ var DrawerContent = (0, import_react10.forwardRef)(({ className, children, ...pr
650
758
  }
651
759
  )
652
760
  ] }),
653
- document.body
761
+ portalContainer
654
762
  );
655
763
  });
656
764
  DrawerContent.displayName = "DrawerContent";
657
- var DrawerHeader = (0, import_react10.forwardRef)(({ className, ...props }, ref) => {
765
+ var DrawerHeader = (0, import_react11.forwardRef)(({ className, ...props }, ref) => {
658
766
  return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
659
767
  "div",
660
768
  {
661
769
  ref,
662
- className: (0, import_ui_utils9.cn)("flex flex-col gap-1.5 border-b border-border-base px-6 py-4", className),
770
+ className: cn("flex flex-col gap-1.5 border-b border-border-base px-6 py-4", className),
663
771
  ...props
664
772
  }
665
773
  );
666
774
  });
667
775
  DrawerHeader.displayName = "DrawerHeader";
668
- var DrawerTitle = (0, import_react10.forwardRef)(({ className, ...props }, ref) => {
669
- return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("h2", { ref, className: (0, import_ui_utils9.cn)("text-lg font-semibold text-text-primary", className), ...props });
776
+ var DrawerTitle = (0, import_react11.forwardRef)(({ className, ...props }, ref) => {
777
+ return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("h2", { ref, className: cn("text-lg font-semibold text-text-primary", className), ...props });
670
778
  });
671
779
  DrawerTitle.displayName = "DrawerTitle";
672
- var DrawerDescription = (0, import_react10.forwardRef)(({ className, ...props }, ref) => {
673
- return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("p", { ref, className: (0, import_ui_utils9.cn)("text-sm text-text-secondary", className), ...props });
780
+ var DrawerDescription = (0, import_react11.forwardRef)(({ className, ...props }, ref) => {
781
+ return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("p", { ref, className: cn("text-sm text-text-secondary", className), ...props });
674
782
  });
675
783
  DrawerDescription.displayName = "DrawerDescription";
676
- var DrawerFooter = (0, import_react10.forwardRef)(({ className, ...props }, ref) => {
784
+ var DrawerFooter = (0, import_react11.forwardRef)(({ className, ...props }, ref) => {
677
785
  return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
678
786
  "div",
679
787
  {
680
788
  ref,
681
- className: (0, import_ui_utils9.cn)("mt-auto flex items-center justify-end gap-2 border-t border-border-base px-6 py-4", className),
789
+ className: cn("mt-auto flex items-center justify-end gap-2 border-t border-border-base px-6 py-4", className),
682
790
  ...props
683
791
  }
684
792
  );
685
793
  });
686
794
  DrawerFooter.displayName = "DrawerFooter";
687
- var DrawerClose = (0, import_react10.forwardRef)(({ className, children, type = "button", ...props }, ref) => {
795
+ var DrawerClose = (0, import_react11.forwardRef)(({ className, children, type = "button", ...props }, ref) => {
688
796
  const { onOpenChange } = useDrawerContext();
689
797
  return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
690
798
  "button",
@@ -692,7 +800,7 @@ var DrawerClose = (0, import_react10.forwardRef)(({ className, children, type =
692
800
  ref,
693
801
  type,
694
802
  onClick: () => onOpenChange(false),
695
- className: (0, import_ui_utils9.cn)(
803
+ className: cn(
696
804
  "inline-flex items-center justify-center rounded-md px-4 py-2 text-sm font-medium text-text-secondary transition-colors hover:bg-surface-3 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/30",
697
805
  className
698
806
  ),
@@ -704,33 +812,32 @@ var DrawerClose = (0, import_react10.forwardRef)(({ className, children, type =
704
812
  DrawerClose.displayName = "DrawerClose";
705
813
 
706
814
  // src/components/table.tsx
707
- var import_react11 = require("react");
708
- var import_ui_utils10 = require("@ug666/ui-utils");
815
+ var import_react12 = require("react");
709
816
  var import_jsx_runtime10 = require("react/jsx-runtime");
710
- var Table = (0, import_react11.forwardRef)(({ className, ...props }, ref) => {
817
+ var Table = (0, import_react12.forwardRef)(({ className, ...props }, ref) => {
711
818
  return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "w-full overflow-auto", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
712
819
  "table",
713
820
  {
714
821
  ref,
715
- className: (0, import_ui_utils10.cn)("w-full caption-bottom text-sm", className),
822
+ className: cn("w-full caption-bottom text-sm", className),
716
823
  ...props
717
824
  }
718
825
  ) });
719
826
  });
720
- var TableHeader = (0, import_react11.forwardRef)(({ className, ...props }, ref) => {
721
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("thead", { ref, className: (0, import_ui_utils10.cn)("[&_tr]:border-b border-border-base", className), ...props });
827
+ var TableHeader = (0, import_react12.forwardRef)(({ className, ...props }, ref) => {
828
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("thead", { ref, className: cn("[&_tr]:border-b border-border-base", className), ...props });
722
829
  });
723
- var TableBody = (0, import_react11.forwardRef)(({ className, ...props }, ref) => {
724
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("tbody", { ref, className: (0, import_ui_utils10.cn)("[&_tr:last-child]:border-0", className), ...props });
830
+ var TableBody = (0, import_react12.forwardRef)(({ className, ...props }, ref) => {
831
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("tbody", { ref, className: cn("[&_tr:last-child]:border-0", className), ...props });
725
832
  });
726
- var TableRow = (0, import_react11.forwardRef)(({ className, ...props }, ref) => {
727
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("tr", { ref, className: (0, import_ui_utils10.cn)("border-b border-border-base transition-colors hover:bg-surface-2", className), ...props });
833
+ var TableRow = (0, import_react12.forwardRef)(({ className, ...props }, ref) => {
834
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("tr", { ref, className: cn("border-b border-border-base transition-colors hover:bg-surface-2", className), ...props });
728
835
  });
729
- var TableHead = (0, import_react11.forwardRef)(({ className, ...props }, ref) => {
730
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("th", { ref, className: (0, import_ui_utils10.cn)("h-10 px-4 text-left align-middle font-medium text-text-secondary [&:has([role=checkbox])]:pr-0", className), ...props });
836
+ var TableHead = (0, import_react12.forwardRef)(({ className, ...props }, ref) => {
837
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("th", { ref, className: cn("h-10 px-4 text-left align-middle font-medium text-text-secondary [&:has([role=checkbox])]:pr-0", className), ...props });
731
838
  });
732
- var TableCell = (0, import_react11.forwardRef)(({ className, ...props }, ref) => {
733
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("td", { ref, className: (0, import_ui_utils10.cn)("px-4 py-3 align-middle text-text-primary [&:has([role=checkbox])]:pr-0", className), ...props });
839
+ var TableCell = (0, import_react12.forwardRef)(({ className, ...props }, ref) => {
840
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("td", { ref, className: cn("px-4 py-3 align-middle text-text-primary [&:has([role=checkbox])]:pr-0", className), ...props });
734
841
  });
735
842
  Table.displayName = "Table";
736
843
  TableHeader.displayName = "TableHeader";
@@ -740,10 +847,9 @@ TableHead.displayName = "TableHead";
740
847
  TableCell.displayName = "TableCell";
741
848
 
742
849
  // src/components/toast.tsx
743
- var import_react12 = require("react");
850
+ var import_react13 = require("react");
744
851
  var import_react_dom4 = require("react-dom");
745
852
  var import_lucide_react5 = require("lucide-react");
746
- var import_ui_utils11 = require("@ug666/ui-utils");
747
853
  var import_jsx_runtime11 = require("react/jsx-runtime");
748
854
  var listeners = /* @__PURE__ */ new Set();
749
855
  var toastItems = [];
@@ -782,35 +888,36 @@ var typeLabel = {
782
888
  error: "\u9519\u8BEF",
783
889
  info: "\u63D0\u793A"
784
890
  };
785
- var Toaster = (0, import_react12.forwardRef)(({ className, ...props }, ref) => {
786
- const [items, setItems] = (0, import_react12.useState)([]);
787
- const mountedRef = (0, import_react12.useRef)(true);
788
- const handleUpdate = (0, import_react12.useCallback)((next) => {
891
+ var Toaster = (0, import_react13.forwardRef)(({ className, ...props }, ref) => {
892
+ const [items, setItems] = (0, import_react13.useState)([]);
893
+ const mountedRef = (0, import_react13.useRef)(true);
894
+ const portalContainer = usePortalContainer();
895
+ const handleUpdate = (0, import_react13.useCallback)((next) => {
789
896
  if (mountedRef.current) {
790
897
  setItems(next);
791
898
  }
792
899
  }, []);
793
- (0, import_react12.useEffect)(() => {
900
+ (0, import_react13.useEffect)(() => {
794
901
  listeners.add(handleUpdate);
795
902
  return () => {
796
903
  mountedRef.current = false;
797
904
  listeners.delete(handleUpdate);
798
905
  };
799
906
  }, [handleUpdate]);
800
- if (items.length === 0) return null;
907
+ if (items.length === 0 || !portalContainer) return null;
801
908
  return (0, import_react_dom4.createPortal)(
802
909
  /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
803
910
  "div",
804
911
  {
805
912
  ref,
806
- className: (0, import_ui_utils11.cn)("fixed top-4 right-4 z-[9999] flex w-80 flex-col gap-2", className),
913
+ className: cn("fixed top-4 right-4 z-[9999] flex w-80 flex-col gap-2", className),
807
914
  role: "region",
808
915
  "aria-label": "\u901A\u77E5",
809
916
  ...props,
810
917
  children: items.map((item) => /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
811
918
  "div",
812
919
  {
813
- className: (0, import_ui_utils11.cn)(
920
+ className: cn(
814
921
  "flex items-start justify-between gap-2 rounded-md border px-4 py-3 text-sm shadow-md",
815
922
  typeStyles[item.type]
816
923
  ),
@@ -839,65 +946,238 @@ var Toaster = (0, import_react12.forwardRef)(({ className, ...props }, ref) => {
839
946
  ))
840
947
  }
841
948
  ),
842
- document.body
949
+ portalContainer
843
950
  );
844
951
  });
845
952
  Toaster.displayName = "Toaster";
846
953
 
847
954
  // src/components/sidebar.tsx
848
- var import_react13 = require("react");
849
- var import_ui_utils12 = require("@ug666/ui-utils");
955
+ var import_react14 = require("react");
956
+ var import_lucide_react6 = require("lucide-react");
850
957
  var import_jsx_runtime12 = require("react/jsx-runtime");
851
958
  var variantStyles = {
852
959
  primary: {
853
- container: "bg-primary text-primary-fg",
854
- active: "bg-primary-active text-primary-fg",
855
- inactive: "text-primary-fg/70 hover:bg-primary-hover hover:text-primary-fg",
856
- divider: "border-primary-active"
960
+ container: "border-r border-border-base bg-surface-1 text-text-primary shadow-sm",
961
+ active: "bg-primary/10 text-primary shadow-sm ring-1 ring-primary/20 before:absolute before:left-0 before:top-1/2 before:h-6 before:w-[3px] before:-translate-y-1/2 before:rounded-r-full before:bg-primary",
962
+ inactive: "text-text-secondary hover:bg-surface-2 hover:text-text-primary",
963
+ divider: "border-border-base",
964
+ icon: "bg-transparent text-text-tertiary group-hover:bg-surface-3 group-hover:text-primary",
965
+ activeIcon: "bg-primary/15 text-primary"
857
966
  },
858
967
  dark: {
859
- container: "bg-slate-950 text-slate-100",
860
- active: "bg-slate-800/80 text-white before:absolute before:left-0 before:top-1/2 before:-translate-y-1/2 before:h-5 before:w-[3px] before:rounded-r-full before:bg-primary",
861
- inactive: "text-slate-400 hover:bg-slate-800/40 hover:text-slate-100",
862
- divider: "border-slate-800/80"
968
+ container: "border-r border-border-base bg-surface-1 text-text-primary shadow-sm",
969
+ active: "bg-primary/10 text-primary shadow-sm ring-1 ring-primary/20 before:absolute before:left-0 before:top-1/2 before:h-6 before:w-[3px] before:-translate-y-1/2 before:rounded-r-full before:bg-primary",
970
+ inactive: "text-text-secondary hover:bg-surface-2 hover:text-text-primary",
971
+ divider: "border-border-base",
972
+ icon: "bg-transparent text-text-tertiary group-hover:bg-surface-3 group-hover:text-primary",
973
+ activeIcon: "bg-primary/15 text-primary"
863
974
  }
864
975
  };
865
- var Sidebar = (0, import_react13.forwardRef)(
866
- ({ items, variant = "primary", collapsed = false, footer, className }, ref) => {
976
+ function getItemKey(item, index, parentKey) {
977
+ return item.id ?? item.href ?? `${parentKey}-${index}-${item.label}`;
978
+ }
979
+ function itemHasActiveChild(item) {
980
+ return Boolean(item.children?.some((child) => child.active || itemHasActiveChild(child)));
981
+ }
982
+ function normalizeSearch(value) {
983
+ return value.toLowerCase().replace(/\s+/g, "");
984
+ }
985
+ function filterSidebarItems(items, query) {
986
+ if (!query) return items;
987
+ return items.reduce((result, item) => {
988
+ const children = item.children ? filterSidebarItems(item.children, query) : [];
989
+ const matched = normalizeSearch(item.label).includes(query);
990
+ if (matched || children.length > 0) {
991
+ result.push({ ...item, children });
992
+ }
993
+ return result;
994
+ }, []);
995
+ }
996
+ var Sidebar = (0, import_react14.forwardRef)(
997
+ ({
998
+ items,
999
+ variant = "primary",
1000
+ collapsed,
1001
+ defaultCollapsed = false,
1002
+ onCollapsedChange,
1003
+ collapsible = false,
1004
+ searchable = false,
1005
+ searchPlaceholder = "\u641C\u7D22\u83DC\u5355...",
1006
+ responsive = false,
1007
+ mobileOpen = false,
1008
+ onMobileOpenChange,
1009
+ header,
1010
+ footer,
1011
+ className
1012
+ }, ref) => {
867
1013
  const styles = variantStyles[variant];
868
- return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
1014
+ const [internalCollapsed, setInternalCollapsed] = (0, import_react14.useState)(defaultCollapsed);
1015
+ const [expandedKeys, setExpandedKeys] = (0, import_react14.useState)(() => /* @__PURE__ */ new Set());
1016
+ const [query, setQuery] = (0, import_react14.useState)("");
1017
+ const effectiveCollapsed = collapsed ?? internalCollapsed;
1018
+ const normalizedQuery = normalizeSearch(query);
1019
+ const visibleItems = (0, import_react14.useMemo)(() => filterSidebarItems(items, normalizedQuery), [items, normalizedQuery]);
1020
+ function setCollapsedState(nextCollapsed) {
1021
+ setInternalCollapsed(nextCollapsed);
1022
+ onCollapsedChange?.(nextCollapsed);
1023
+ }
1024
+ function toggleExpanded(key) {
1025
+ setExpandedKeys((current) => {
1026
+ const next = new Set(current);
1027
+ if (next.has(key)) {
1028
+ next.delete(key);
1029
+ } else {
1030
+ next.add(key);
1031
+ }
1032
+ return next;
1033
+ });
1034
+ }
1035
+ function closeMobile() {
1036
+ onMobileOpenChange?.(false);
1037
+ }
1038
+ function renderItems(list, depth = 0, parentKey = "root") {
1039
+ return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("ul", { className: cn("flex flex-col gap-1", depth === 0 ? "px-2.5" : "ml-6 mt-1 border-l border-border-base pl-2"), children: list.map((item, index) => {
1040
+ const key = getItemKey(item, index, parentKey);
1041
+ const hasChildren = Boolean(item.children?.length);
1042
+ const active = Boolean(item.active || itemHasActiveChild(item));
1043
+ const expanded = !effectiveCollapsed && hasChildren && (normalizedQuery.length > 0 || active || expandedKeys.has(key));
1044
+ const itemContent = /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(import_jsx_runtime12.Fragment, { children: [
1045
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
1046
+ "span",
1047
+ {
1048
+ className: cn(
1049
+ "flex h-8 w-8 shrink-0 items-center justify-center rounded-lg transition-colors",
1050
+ active ? styles.activeIcon : styles.icon
1051
+ ),
1052
+ children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(item.icon, { size: 16 })
1053
+ }
1054
+ ),
1055
+ !effectiveCollapsed && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { className: "min-w-0 flex-1 truncate text-left", children: item.label }),
1056
+ !effectiveCollapsed && hasChildren && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
1057
+ import_lucide_react6.ChevronDown,
1058
+ {
1059
+ size: 15,
1060
+ className: cn("shrink-0 text-text-tertiary transition-transform", expanded && "rotate-180"),
1061
+ "aria-hidden": "true"
1062
+ }
1063
+ )
1064
+ ] });
1065
+ const itemClassName = cn(
1066
+ "group relative flex min-w-0 items-center gap-2.5 rounded-lg px-2.5 py-2 text-sm font-medium outline-none transition-all duration-150 focus-visible:ring-2 focus-visible:ring-primary/35",
1067
+ effectiveCollapsed && "justify-center px-2",
1068
+ active ? styles.active : styles.inactive
1069
+ );
1070
+ return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("li", { children: [
1071
+ hasChildren ? /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
1072
+ "button",
1073
+ {
1074
+ type: "button",
1075
+ className: cn("w-full", itemClassName),
1076
+ "aria-expanded": expanded,
1077
+ title: effectiveCollapsed ? item.label : void 0,
1078
+ onClick: () => toggleExpanded(key),
1079
+ children: itemContent
1080
+ }
1081
+ ) : /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
1082
+ "a",
1083
+ {
1084
+ href: item.href ?? "#",
1085
+ "aria-current": item.active ? "page" : void 0,
1086
+ className: itemClassName,
1087
+ title: effectiveCollapsed ? item.label : void 0,
1088
+ onClick: closeMobile,
1089
+ children: itemContent
1090
+ }
1091
+ ),
1092
+ expanded && item.children ? renderItems(item.children, depth + 1, key) : null
1093
+ ] }, key);
1094
+ }) });
1095
+ }
1096
+ const sidebar = /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
869
1097
  "aside",
870
1098
  {
871
1099
  ref,
872
- className: (0, import_ui_utils12.cn)(
873
- "flex flex-col transition-all duration-300",
1100
+ className: cn(
1101
+ "flex flex-col overflow-hidden transition-all duration-300",
874
1102
  styles.container,
875
- collapsed ? "w-16" : "w-60",
1103
+ effectiveCollapsed ? "w-[72px]" : "w-64",
1104
+ responsive && [
1105
+ "fixed inset-y-0 left-0 z-50 md:relative md:inset-auto md:z-auto",
1106
+ mobileOpen ? "translate-x-0" : "-translate-x-full md:translate-x-0"
1107
+ ],
876
1108
  className
877
1109
  ),
878
1110
  children: [
879
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("nav", { className: "flex-1 overflow-y-auto py-4", children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("ul", { className: "flex flex-col gap-1 px-2", children: items.map((item) => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("li", { children: /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
880
- "a",
1111
+ (header || collapsible || responsive && mobileOpen) && /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
1112
+ "div",
881
1113
  {
882
- href: item.href,
883
- className: (0, import_ui_utils12.cn)(
884
- "relative flex items-center gap-3 rounded-md px-3 py-2 text-sm font-medium transition-colors duration-150",
885
- item.active ? styles.active : styles.inactive
1114
+ className: cn(
1115
+ "flex border-b px-3 py-3",
1116
+ styles.divider,
1117
+ effectiveCollapsed ? "justify-center" : "items-center gap-2"
886
1118
  ),
887
- title: collapsed ? item.label : void 0,
888
1119
  children: [
889
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(item.icon, { size: 17, className: "shrink-0" }),
890
- !collapsed && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { className: "truncate", children: item.label })
1120
+ !effectiveCollapsed && header ? /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "min-w-0 flex-1", children: header }) : null,
1121
+ collapsible && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
1122
+ "button",
1123
+ {
1124
+ type: "button",
1125
+ className: "flex h-9 w-9 shrink-0 items-center justify-center rounded-lg border border-border-base bg-surface-2 text-text-secondary transition-colors hover:border-primary/40 hover:text-text-primary",
1126
+ "aria-label": effectiveCollapsed ? "\u5C55\u5F00\u4FA7\u8FB9\u680F" : "\u6298\u53E0\u4FA7\u8FB9\u680F",
1127
+ onClick: () => setCollapsedState(!effectiveCollapsed),
1128
+ children: effectiveCollapsed ? /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_lucide_react6.PanelLeftOpen, { size: 17 }) : /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_lucide_react6.PanelLeftClose, { size: 17 })
1129
+ }
1130
+ ),
1131
+ responsive && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
1132
+ "button",
1133
+ {
1134
+ type: "button",
1135
+ className: "flex h-9 w-9 shrink-0 items-center justify-center rounded-lg border border-border-base bg-surface-2 text-text-secondary transition-colors hover:border-primary/40 hover:text-text-primary md:hidden",
1136
+ "aria-label": "\u5173\u95ED\u4FA7\u8FB9\u680F",
1137
+ onClick: closeMobile,
1138
+ children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_lucide_react6.X, { size: 17 })
1139
+ }
1140
+ )
891
1141
  ]
892
1142
  }
893
- ) }, item.href)) }) }),
1143
+ ),
1144
+ searchable && !effectiveCollapsed && /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: cn("border-b px-3 py-3", styles.divider), children: [
1145
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("label", { className: "sr-only", htmlFor: "ug-sidebar-search", children: "\u641C\u7D22\u83DC\u5355" }),
1146
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "relative", children: [
1147
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_lucide_react6.Search, { className: "pointer-events-none absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-text-tertiary", "aria-hidden": "true" }),
1148
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
1149
+ "input",
1150
+ {
1151
+ id: "ug-sidebar-search",
1152
+ value: query,
1153
+ onChange: (event) => setQuery(event.target.value),
1154
+ placeholder: searchPlaceholder,
1155
+ autoComplete: "off",
1156
+ className: "h-10 w-full rounded-lg border border-border-base bg-surface-0 px-3 pl-9 pr-9 text-sm text-text-primary outline-none transition-colors placeholder:text-text-tertiary focus:border-primary focus:ring-2 focus:ring-primary/20",
1157
+ type: "text",
1158
+ role: "searchbox"
1159
+ }
1160
+ ),
1161
+ query ? /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
1162
+ "button",
1163
+ {
1164
+ type: "button",
1165
+ className: "absolute right-1 top-1/2 flex h-8 w-8 -translate-y-1/2 items-center justify-center rounded-md text-text-tertiary transition-colors hover:bg-surface-2 hover:text-text-primary",
1166
+ "aria-label": "\u6E05\u7A7A\u641C\u7D22",
1167
+ onClick: () => setQuery(""),
1168
+ children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_lucide_react6.X, { size: 14 })
1169
+ }
1170
+ ) : null
1171
+ ] })
1172
+ ] }),
1173
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("nav", { className: "flex-1 overflow-y-auto py-3.5", children: visibleItems.length > 0 ? renderItems(visibleItems) : /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("p", { className: "mx-3 rounded-lg border border-dashed border-border-base bg-surface-0 px-3 py-3 text-sm text-text-tertiary", children: "\u6CA1\u6709\u5339\u914D\u7684\u83DC\u5355" }) }),
894
1174
  footer && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
895
1175
  "div",
896
1176
  {
897
- className: (0, import_ui_utils12.cn)(
898
- "border-t px-2 py-4",
1177
+ className: cn(
1178
+ "border-t px-2.5 py-3",
899
1179
  styles.divider,
900
- collapsed && "flex justify-center"
1180
+ effectiveCollapsed && "flex justify-center"
901
1181
  ),
902
1182
  children: footer
903
1183
  }
@@ -905,61 +1185,62 @@ var Sidebar = (0, import_react13.forwardRef)(
905
1185
  ]
906
1186
  }
907
1187
  );
1188
+ return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(import_jsx_runtime12.Fragment, { children: [
1189
+ responsive && mobileOpen ? /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
1190
+ "button",
1191
+ {
1192
+ type: "button",
1193
+ className: "fixed inset-0 z-40 bg-overlay md:hidden",
1194
+ "aria-label": "\u5173\u95ED\u4FA7\u8FB9\u680F\u906E\u7F69",
1195
+ onClick: closeMobile
1196
+ }
1197
+ ) : null,
1198
+ sidebar
1199
+ ] });
908
1200
  }
909
1201
  );
910
1202
  Sidebar.displayName = "Sidebar";
911
1203
 
912
1204
  // src/components/pagination.tsx
913
- var import_react14 = require("react");
914
- var import_lucide_react6 = require("lucide-react");
915
- var import_ui_utils13 = require("@ug666/ui-utils");
1205
+ var import_react15 = require("react");
1206
+ var import_lucide_react7 = require("lucide-react");
916
1207
  var import_jsx_runtime13 = require("react/jsx-runtime");
917
- var MAX_VISIBLE_PAGES = 5;
918
1208
  function getPageNumbers(page, totalPages) {
919
- if (totalPages <= MAX_VISIBLE_PAGES) {
1209
+ if (totalPages <= 5) {
920
1210
  return Array.from({ length: totalPages }, (_, i) => i + 1);
921
1211
  }
922
- const half = Math.floor(MAX_VISIBLE_PAGES / 2);
923
- let start = Math.max(1, page - half);
924
- const end = Math.min(totalPages, start + MAX_VISIBLE_PAGES - 1);
925
- if (end - start < MAX_VISIBLE_PAGES - 1) {
926
- start = Math.max(1, end - MAX_VISIBLE_PAGES + 1);
927
- }
928
- const pages = [];
929
- if (start > 1) {
930
- pages.push(1);
931
- if (start > 2) pages.push("...");
1212
+ if (page <= 3) {
1213
+ return [1, 2, 3, "...", totalPages];
932
1214
  }
933
- for (let i = start; i <= end; i++) pages.push(i);
934
- if (end < totalPages) {
935
- if (end < totalPages - 1) pages.push("...");
936
- pages.push(totalPages);
1215
+ if (page >= totalPages - 2) {
1216
+ return [1, "...", totalPages - 2, totalPages - 1, totalPages];
937
1217
  }
938
- return pages;
1218
+ return [1, "...", page, "...", totalPages];
939
1219
  }
940
- var Pagination = (0, import_react14.forwardRef)(({ page, totalPages, onPageChange, className }, ref) => {
1220
+ var Pagination = (0, import_react15.forwardRef)(({ page, totalPages, onPageChange, className }, ref) => {
941
1221
  const pageNumbers = getPageNumbers(page, totalPages);
942
- const btnBase = "inline-flex h-8 min-w-8 items-center justify-center rounded-md px-2 text-sm transition-colors disabled:pointer-events-none disabled:opacity-40";
943
- return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { ref, className: (0, import_ui_utils13.cn)("flex items-center gap-1", className), children: [
1222
+ const btnBase = "inline-flex h-8 min-w-8 shrink-0 items-center justify-center rounded-lg px-2 text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/30 focus-visible:ring-offset-2 focus-visible:ring-offset-surface-0 disabled:pointer-events-none disabled:opacity-40";
1223
+ const btnGhost = "border border-border-strong bg-surface-1 text-text-primary hover:border-primary/60 hover:bg-surface-2";
1224
+ return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { ref, className: cn("flex max-w-full flex-wrap items-center gap-1", className), children: [
944
1225
  /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
945
1226
  "button",
946
1227
  {
947
1228
  type: "button",
948
- className: (0, import_ui_utils13.cn)(btnBase, "border border-border-strong bg-surface-1 text-text-primary hover:bg-surface-3"),
1229
+ className: cn(btnBase, btnGhost),
949
1230
  disabled: page <= 1,
950
1231
  onClick: () => onPageChange(page - 1),
951
1232
  "aria-label": "\u4E0A\u4E00\u9875",
952
- children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_lucide_react6.ChevronLeft, { size: 16 })
1233
+ children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_lucide_react7.ChevronLeft, { size: 16 })
953
1234
  }
954
1235
  ),
955
1236
  pageNumbers.map(
956
- (p, idx) => p === "..." ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { className: "px-1 text-text-tertiary select-none", children: "\u2026" }, `ellipsis-${idx}`) : /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
1237
+ (p, idx) => p === "..." ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { className: "inline-flex h-8 min-w-6 shrink-0 items-center justify-center text-text-tertiary select-none", children: "\u2026" }, `ellipsis-${idx}`) : /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
957
1238
  "button",
958
1239
  {
959
1240
  type: "button",
960
- className: (0, import_ui_utils13.cn)(
1241
+ className: cn(
961
1242
  btnBase,
962
- p === page ? "bg-primary text-primary-fg" : "border border-border-strong bg-surface-1 text-text-primary hover:bg-surface-3"
1243
+ p === page ? "bg-primary text-primary-fg shadow-sm" : btnGhost
963
1244
  ),
964
1245
  onClick: () => onPageChange(p),
965
1246
  "aria-current": p === page ? "page" : void 0,
@@ -972,11 +1253,11 @@ var Pagination = (0, import_react14.forwardRef)(({ page, totalPages, onPageChang
972
1253
  "button",
973
1254
  {
974
1255
  type: "button",
975
- className: (0, import_ui_utils13.cn)(btnBase, "border border-border-strong bg-surface-1 text-text-primary hover:bg-surface-3"),
1256
+ className: cn(btnBase, btnGhost),
976
1257
  disabled: page >= totalPages,
977
1258
  onClick: () => onPageChange(page + 1),
978
1259
  "aria-label": "\u4E0B\u4E00\u9875",
979
- children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_lucide_react6.ChevronRight, { size: 16 })
1260
+ children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_lucide_react7.ChevronRight, { size: 16 })
980
1261
  }
981
1262
  )
982
1263
  ] });
@@ -984,34 +1265,190 @@ var Pagination = (0, import_react14.forwardRef)(({ page, totalPages, onPageChang
984
1265
  Pagination.displayName = "Pagination";
985
1266
 
986
1267
  // src/components/select.tsx
987
- var import_react15 = require("react");
988
- var import_ui_utils14 = require("@ug666/ui-utils");
1268
+ var import_react16 = require("react");
1269
+ var import_lucide_react8 = require("lucide-react");
989
1270
  var import_jsx_runtime14 = require("react/jsx-runtime");
990
- var Select = (0, import_react15.forwardRef)(
991
- ({ className, label, error, helperText, options, placeholder, id, ...props }, ref) => {
992
- const generatedId = (0, import_react15.useId)();
1271
+ var Select = (0, import_react16.forwardRef)(
1272
+ ({
1273
+ className,
1274
+ label,
1275
+ error,
1276
+ helperText,
1277
+ options,
1278
+ placeholder,
1279
+ id,
1280
+ value,
1281
+ defaultValue,
1282
+ onChange,
1283
+ disabled,
1284
+ name,
1285
+ required,
1286
+ ...props
1287
+ }, ref) => {
1288
+ const generatedId = (0, import_react16.useId)();
993
1289
  const selectId = id ?? generatedId;
994
- return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "flex flex-col gap-1", children: [
1290
+ const listboxId = `${selectId}-listbox`;
1291
+ const rootRef = (0, import_react16.useRef)(null);
1292
+ const hiddenSelectRef = (0, import_react16.useRef)(null);
1293
+ const isControlled = value !== void 0;
1294
+ const [open, setOpen] = (0, import_react16.useState)(false);
1295
+ const [internalValue, setInternalValue] = (0, import_react16.useState)(() => String(defaultValue ?? ""));
1296
+ const selectedValue = String(isControlled ? value : internalValue);
1297
+ const selectedOption = (0, import_react16.useMemo)(
1298
+ () => options.find((option) => String(option.value) === selectedValue),
1299
+ [options, selectedValue]
1300
+ );
1301
+ function setSelectRef(node) {
1302
+ hiddenSelectRef.current = node;
1303
+ if (typeof ref === "function") {
1304
+ ref(node);
1305
+ } else if (ref) {
1306
+ ref.current = node;
1307
+ }
1308
+ }
1309
+ function handleSelect(nextValue) {
1310
+ if (disabled) return;
1311
+ if (!isControlled) {
1312
+ setInternalValue(nextValue);
1313
+ }
1314
+ if (hiddenSelectRef.current) {
1315
+ hiddenSelectRef.current.value = nextValue;
1316
+ onChange?.({ target: hiddenSelectRef.current, currentTarget: hiddenSelectRef.current });
1317
+ }
1318
+ setOpen(false);
1319
+ }
1320
+ function toggleOpen() {
1321
+ if (disabled) return;
1322
+ setOpen((current) => !current);
1323
+ }
1324
+ function handleTriggerKeyDown(event) {
1325
+ if (event.key === "Enter" || event.key === " " || event.key === "ArrowDown") {
1326
+ event.preventDefault();
1327
+ setOpen(true);
1328
+ return;
1329
+ }
1330
+ if (event.key === "Escape") {
1331
+ event.preventDefault();
1332
+ setOpen(false);
1333
+ }
1334
+ }
1335
+ (0, import_react16.useEffect)(() => {
1336
+ if (!open) return;
1337
+ function handlePointerDown(event) {
1338
+ if (!rootRef.current?.contains(event.target)) {
1339
+ setOpen(false);
1340
+ }
1341
+ }
1342
+ function handleKeyDown(event) {
1343
+ if (event.key === "Escape") {
1344
+ setOpen(false);
1345
+ }
1346
+ }
1347
+ document.addEventListener("pointerdown", handlePointerDown);
1348
+ document.addEventListener("keydown", handleKeyDown);
1349
+ return () => {
1350
+ document.removeEventListener("pointerdown", handlePointerDown);
1351
+ document.removeEventListener("keydown", handleKeyDown);
1352
+ };
1353
+ }, [open]);
1354
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { ref: rootRef, className: "relative flex flex-col gap-1.5", children: [
995
1355
  label && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("label", { htmlFor: selectId, className: "text-sm font-medium text-text-primary", children: label }),
996
1356
  /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
997
1357
  "select",
998
1358
  {
999
- ref,
1000
- id: selectId,
1001
- className: (0, import_ui_utils14.cn)(
1002
- "flex h-9 w-full rounded-md border bg-surface-1 px-3 py-1.5 text-sm text-text-primary",
1003
- "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-offset-1",
1004
- "disabled:cursor-not-allowed disabled:opacity-50",
1005
- error ? "border-red-400 focus-visible:ring-red-400" : "border-border-strong focus-visible:ring-ring/30",
1006
- className
1007
- ),
1359
+ ref: setSelectRef,
1360
+ id: `${selectId}-native`,
1361
+ name,
1362
+ value: selectedValue,
1363
+ required,
1364
+ disabled,
1365
+ tabIndex: -1,
1366
+ "aria-hidden": "true",
1367
+ className: "sr-only",
1368
+ onChange,
1008
1369
  ...props,
1009
1370
  children: [
1010
- placeholder && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("option", { value: "", disabled: true, children: placeholder }),
1371
+ placeholder && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("option", { value: "", children: placeholder }),
1011
1372
  options.map((opt) => /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("option", { value: opt.value, children: opt.label }, opt.value))
1012
1373
  ]
1013
1374
  }
1014
1375
  ),
1376
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "relative", children: [
1377
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
1378
+ "button",
1379
+ {
1380
+ type: "button",
1381
+ id: selectId,
1382
+ disabled,
1383
+ "aria-haspopup": "listbox",
1384
+ "aria-expanded": open,
1385
+ "aria-controls": listboxId,
1386
+ className: cn(
1387
+ "flex h-10 w-full items-center justify-between rounded-lg border bg-surface-1 px-3 py-2 text-left text-sm leading-5 text-text-primary shadow-sm",
1388
+ "transition-colors hover:border-primary/60",
1389
+ "focus-visible:border-primary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/25 focus-visible:ring-offset-1 focus-visible:ring-offset-surface-0",
1390
+ "disabled:cursor-not-allowed disabled:bg-surface-2 disabled:text-text-tertiary disabled:opacity-70",
1391
+ error ? "border-danger focus-visible:ring-danger/25" : "border-border-strong",
1392
+ className
1393
+ ),
1394
+ onClick: toggleOpen,
1395
+ onKeyDown: handleTriggerKeyDown,
1396
+ children: [
1397
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: cn("truncate", !selectedOption && "text-text-tertiary"), children: selectedOption?.label ?? placeholder ?? "\u8BF7\u9009\u62E9" }),
1398
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
1399
+ import_lucide_react8.ChevronDown,
1400
+ {
1401
+ "aria-hidden": "true",
1402
+ className: cn("h-4 w-4 shrink-0 text-text-tertiary transition-transform", open && "rotate-180")
1403
+ }
1404
+ )
1405
+ ]
1406
+ }
1407
+ ),
1408
+ open && /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
1409
+ "div",
1410
+ {
1411
+ id: listboxId,
1412
+ role: "listbox",
1413
+ className: "absolute left-0 right-0 top-full z-[70] mt-1 max-h-60 overflow-auto rounded-lg border border-border-strong bg-surface-1 p-1 shadow-xl",
1414
+ children: [
1415
+ placeholder && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
1416
+ "button",
1417
+ {
1418
+ type: "button",
1419
+ role: "option",
1420
+ "aria-selected": selectedValue === "",
1421
+ className: cn(
1422
+ "flex w-full items-center rounded-md px-2.5 py-2 text-left text-sm text-text-tertiary transition-colors hover:bg-surface-2",
1423
+ selectedValue === "" && "bg-surface-2 text-text-primary"
1424
+ ),
1425
+ onClick: () => handleSelect(""),
1426
+ children: placeholder
1427
+ }
1428
+ ),
1429
+ options.map((option) => {
1430
+ const optionValue = String(option.value);
1431
+ const selected = optionValue === selectedValue;
1432
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
1433
+ "button",
1434
+ {
1435
+ type: "button",
1436
+ role: "option",
1437
+ "aria-selected": selected,
1438
+ className: cn(
1439
+ "flex w-full items-center rounded-md px-2.5 py-2 text-left text-sm text-text-primary transition-colors hover:bg-surface-2",
1440
+ selected && "bg-primary-soft text-primary-soft-fg"
1441
+ ),
1442
+ onClick: () => handleSelect(optionValue),
1443
+ children: option.label
1444
+ },
1445
+ option.value
1446
+ );
1447
+ })
1448
+ ]
1449
+ }
1450
+ )
1451
+ ] }),
1015
1452
  error && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("p", { className: "text-xs text-danger", children: error }),
1016
1453
  !error && helperText && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("p", { className: "text-xs text-text-secondary", children: helperText })
1017
1454
  ] });
@@ -1020,10 +1457,9 @@ var Select = (0, import_react15.forwardRef)(
1020
1457
  Select.displayName = "Select";
1021
1458
 
1022
1459
  // src/components/spinner.tsx
1023
- var import_react16 = require("react");
1024
- var import_lucide_react7 = require("lucide-react");
1460
+ var import_react17 = require("react");
1461
+ var import_lucide_react9 = require("lucide-react");
1025
1462
  var import_class_variance_authority4 = require("class-variance-authority");
1026
- var import_ui_utils15 = require("@ug666/ui-utils");
1027
1463
  var import_jsx_runtime15 = require("react/jsx-runtime");
1028
1464
  var spinnerVariants = (0, import_class_variance_authority4.cva)("animate-spin text-text-tertiary", {
1029
1465
  variants: {
@@ -1037,12 +1473,12 @@ var spinnerVariants = (0, import_class_variance_authority4.cva)("animate-spin te
1037
1473
  size: "md"
1038
1474
  }
1039
1475
  });
1040
- var Spinner = (0, import_react16.forwardRef)(({ className, size, label = "\u52A0\u8F7D\u4E2D", ...props }, ref) => {
1476
+ var Spinner = (0, import_react17.forwardRef)(({ className, size, label = "\u52A0\u8F7D\u4E2D", ...props }, ref) => {
1041
1477
  return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
1042
- import_lucide_react7.Loader2,
1478
+ import_lucide_react9.Loader2,
1043
1479
  {
1044
1480
  ref,
1045
- className: (0, import_ui_utils15.cn)(spinnerVariants({ size }), className),
1481
+ className: cn(spinnerVariants({ size }), className),
1046
1482
  "aria-label": label,
1047
1483
  role: "status",
1048
1484
  ...props
@@ -1052,24 +1488,23 @@ var Spinner = (0, import_react16.forwardRef)(({ className, size, label = "\u52A0
1052
1488
  Spinner.displayName = "Spinner";
1053
1489
 
1054
1490
  // src/components/checkbox.tsx
1055
- var import_react17 = require("react");
1056
- var import_lucide_react8 = require("lucide-react");
1491
+ var import_react18 = require("react");
1492
+ var import_lucide_react10 = require("lucide-react");
1057
1493
  var import_class_variance_authority5 = require("class-variance-authority");
1058
- var import_ui_utils16 = require("@ug666/ui-utils");
1059
1494
  var import_jsx_runtime16 = require("react/jsx-runtime");
1060
1495
  var checkboxVariants = (0, import_class_variance_authority5.cva)(
1061
- "peer inline-flex shrink-0 items-center justify-center rounded border transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",
1496
+ "peer inline-flex shrink-0 items-center justify-center rounded-md border shadow-sm transition-colors peer-focus-visible:outline-none peer-focus-visible:ring-2 peer-focus-visible:ring-ring/35 peer-focus-visible:ring-offset-2 peer-focus-visible:ring-offset-surface-0 peer-disabled:cursor-not-allowed peer-disabled:opacity-50",
1062
1497
  {
1063
1498
  variants: {
1064
1499
  size: {
1065
- sm: "h-3.5 w-3.5",
1066
- default: "h-4 w-4",
1500
+ sm: "h-4 w-4",
1501
+ default: "h-[18px] w-[18px]",
1067
1502
  lg: "h-5 w-5"
1068
1503
  },
1069
1504
  state: {
1070
- unchecked: "border-border-strong bg-surface-1 hover:border-border-strong",
1071
- checked: "border-primary bg-primary text-primary-fg focus-visible:ring-ring",
1072
- indeterminate: "border-primary bg-primary text-primary-fg focus-visible:ring-ring"
1505
+ unchecked: "border-border-strong bg-surface-1 text-transparent hover:border-primary/70 hover:bg-surface-2",
1506
+ checked: "border-primary bg-primary text-primary-fg",
1507
+ indeterminate: "border-primary bg-primary text-primary-fg"
1073
1508
  }
1074
1509
  },
1075
1510
  defaultVariants: {
@@ -1078,7 +1513,7 @@ var checkboxVariants = (0, import_class_variance_authority5.cva)(
1078
1513
  }
1079
1514
  }
1080
1515
  );
1081
- var Checkbox = (0, import_react17.forwardRef)(
1516
+ var Checkbox = (0, import_react18.forwardRef)(
1082
1517
  ({
1083
1518
  className,
1084
1519
  size,
@@ -1091,14 +1526,16 @@ var Checkbox = (0, import_react17.forwardRef)(
1091
1526
  id,
1092
1527
  ...props
1093
1528
  }, ref) => {
1094
- const innerRef = (0, import_react17.useRef)(null);
1095
- (0, import_react17.useEffect)(() => {
1529
+ const innerRef = (0, import_react18.useRef)(null);
1530
+ const generatedId = (0, import_react18.useId)();
1531
+ const inputId = id ?? generatedId;
1532
+ (0, import_react18.useEffect)(() => {
1096
1533
  if (innerRef.current) {
1097
1534
  innerRef.current.indeterminate = indeterminate;
1098
1535
  }
1099
1536
  }, [indeterminate]);
1100
1537
  const state = indeterminate ? "indeterminate" : checked ? "checked" : "unchecked";
1101
- const iconSize = size === "sm" ? 10 : size === "lg" ? 14 : 12;
1538
+ const iconSize = size === "sm" ? 11 : size === "lg" ? 14 : 12;
1102
1539
  const control = /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("span", { className: "relative inline-flex", children: [
1103
1540
  /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
1104
1541
  "input",
@@ -1108,7 +1545,7 @@ var Checkbox = (0, import_react17.forwardRef)(
1108
1545
  if (typeof ref === "function") ref(node);
1109
1546
  else if (ref) ref.current = node;
1110
1547
  },
1111
- id,
1548
+ id: inputId,
1112
1549
  type: "checkbox",
1113
1550
  className: "peer sr-only",
1114
1551
  checked: checked ?? false,
@@ -1121,8 +1558,8 @@ var Checkbox = (0, import_react17.forwardRef)(
1121
1558
  "span",
1122
1559
  {
1123
1560
  "aria-hidden": "true",
1124
- className: (0, import_ui_utils16.cn)(checkboxVariants({ size, state }), className),
1125
- children: indeterminate ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_lucide_react8.Minus, { size: iconSize }) : checked ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_lucide_react8.Check, { size: iconSize }) : null
1561
+ className: cn(checkboxVariants({ size, state }), className),
1562
+ children: indeterminate ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_lucide_react10.Minus, { size: iconSize }) : checked ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_lucide_react10.Check, { size: iconSize }) : null
1126
1563
  }
1127
1564
  )
1128
1565
  ] });
@@ -1130,15 +1567,15 @@ var Checkbox = (0, import_react17.forwardRef)(
1130
1567
  return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
1131
1568
  "label",
1132
1569
  {
1133
- htmlFor: id,
1134
- className: (0, import_ui_utils16.cn)(
1135
- "inline-flex cursor-pointer items-center gap-2 text-sm text-text-primary select-none",
1570
+ htmlFor: inputId,
1571
+ className: cn(
1572
+ "inline-flex min-h-5 cursor-pointer items-center gap-2.5 text-sm leading-5 text-text-primary select-none",
1136
1573
  disabled && "cursor-not-allowed opacity-60",
1137
1574
  labelClassName
1138
1575
  ),
1139
1576
  children: [
1140
1577
  control,
1141
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { children: label })
1578
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: "pt-px", children: label })
1142
1579
  ]
1143
1580
  }
1144
1581
  );
@@ -1147,26 +1584,25 @@ var Checkbox = (0, import_react17.forwardRef)(
1147
1584
  Checkbox.displayName = "Checkbox";
1148
1585
 
1149
1586
  // src/components/radio.tsx
1150
- var import_react18 = require("react");
1587
+ var import_react19 = require("react");
1151
1588
  var import_class_variance_authority6 = require("class-variance-authority");
1152
- var import_ui_utils17 = require("@ug666/ui-utils");
1153
1589
  var import_jsx_runtime17 = require("react/jsx-runtime");
1154
- var RadioGroupContext = (0, import_react18.createContext)(null);
1590
+ var RadioGroupContext = (0, import_react19.createContext)(null);
1155
1591
  function useRadioGroupContext() {
1156
- return (0, import_react18.useContext)(RadioGroupContext);
1592
+ return (0, import_react19.useContext)(RadioGroupContext);
1157
1593
  }
1158
1594
  var radioVariants = (0, import_class_variance_authority6.cva)(
1159
- "relative inline-flex shrink-0 items-center justify-center rounded-full border transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",
1595
+ "relative inline-flex shrink-0 items-center justify-center rounded-full border shadow-sm transition-colors peer-focus-visible:outline-none peer-focus-visible:ring-2 peer-focus-visible:ring-ring/35 peer-focus-visible:ring-offset-2 peer-focus-visible:ring-offset-surface-0 peer-disabled:cursor-not-allowed peer-disabled:opacity-50",
1160
1596
  {
1161
1597
  variants: {
1162
1598
  size: {
1163
- sm: "h-3.5 w-3.5",
1164
- default: "h-4 w-4",
1599
+ sm: "h-4 w-4",
1600
+ default: "h-[18px] w-[18px]",
1165
1601
  lg: "h-5 w-5"
1166
1602
  },
1167
1603
  checked: {
1168
- true: "border-primary bg-primary focus-visible:ring-ring",
1169
- false: "border-border-strong bg-surface-1 hover:border-border-strong"
1604
+ true: "border-primary bg-surface-1",
1605
+ false: "border-border-strong bg-surface-1 hover:border-primary/70 hover:bg-surface-2"
1170
1606
  }
1171
1607
  },
1172
1608
  defaultVariants: {
@@ -1175,7 +1611,7 @@ var radioVariants = (0, import_class_variance_authority6.cva)(
1175
1611
  }
1176
1612
  }
1177
1613
  );
1178
- var Radio = (0, import_react18.forwardRef)(
1614
+ var Radio = (0, import_react19.forwardRef)(
1179
1615
  ({
1180
1616
  className,
1181
1617
  size,
@@ -1189,7 +1625,7 @@ var Radio = (0, import_react18.forwardRef)(
1189
1625
  ...props
1190
1626
  }, ref) => {
1191
1627
  const group = useRadioGroupContext();
1192
- const generatedId = (0, import_react18.useId)();
1628
+ const generatedId = (0, import_react19.useId)();
1193
1629
  const inputId = id ?? generatedId;
1194
1630
  const isChecked = group ? group.value === value : checkedProp ?? false;
1195
1631
  const isDisabled = group ? group.disabled || (disabledProp ?? false) : disabledProp ?? false;
@@ -1222,8 +1658,8 @@ var Radio = (0, import_react18.forwardRef)(
1222
1658
  "span",
1223
1659
  {
1224
1660
  "aria-hidden": "true",
1225
- className: (0, import_ui_utils17.cn)(radioVariants({ size, checked: isChecked }), className),
1226
- children: isChecked && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: (0, import_ui_utils17.cn)("rounded-full bg-white", dotSize) })
1661
+ className: cn(radioVariants({ size, checked: isChecked }), className),
1662
+ children: isChecked && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: cn("rounded-full bg-primary", dotSize) })
1227
1663
  }
1228
1664
  )
1229
1665
  ] });
@@ -1232,20 +1668,20 @@ var Radio = (0, import_react18.forwardRef)(
1232
1668
  "label",
1233
1669
  {
1234
1670
  htmlFor: inputId,
1235
- className: (0, import_ui_utils17.cn)(
1236
- "inline-flex cursor-pointer items-center gap-2 text-sm text-text-primary select-none",
1671
+ className: cn(
1672
+ "inline-flex min-h-5 cursor-pointer items-center gap-2.5 text-sm leading-5 text-text-primary select-none",
1237
1673
  isDisabled && "cursor-not-allowed opacity-60"
1238
1674
  ),
1239
1675
  children: [
1240
1676
  control,
1241
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { children: label })
1677
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "pt-px", children: label })
1242
1678
  ]
1243
1679
  }
1244
1680
  );
1245
1681
  }
1246
1682
  );
1247
1683
  Radio.displayName = "Radio";
1248
- var RadioGroup = (0, import_react18.forwardRef)(
1684
+ var RadioGroup = (0, import_react19.forwardRef)(
1249
1685
  ({
1250
1686
  className,
1251
1687
  value: valueProp,
@@ -1257,7 +1693,7 @@ var RadioGroup = (0, import_react18.forwardRef)(
1257
1693
  children,
1258
1694
  ...props
1259
1695
  }, ref) => {
1260
- const [uncontrolledValue, setUncontrolledValue] = (0, import_react18.useState)(defaultValue);
1696
+ const [uncontrolledValue, setUncontrolledValue] = (0, import_react19.useState)(defaultValue);
1261
1697
  const isControlled = valueProp !== void 0;
1262
1698
  const currentValue = isControlled ? valueProp : uncontrolledValue;
1263
1699
  function handleValueChange(newValue) {
@@ -1280,9 +1716,9 @@ var RadioGroup = (0, import_react18.forwardRef)(
1280
1716
  {
1281
1717
  ref,
1282
1718
  role: "radiogroup",
1283
- className: (0, import_ui_utils17.cn)(
1719
+ className: cn(
1284
1720
  "flex",
1285
- orientation === "vertical" ? "flex-col gap-2" : "flex-row flex-wrap gap-4",
1721
+ orientation === "vertical" ? "flex-col gap-2.5" : "flex-row flex-wrap gap-x-5 gap-y-2.5",
1286
1722
  className
1287
1723
  ),
1288
1724
  ...props,
@@ -1296,10 +1732,9 @@ var RadioGroup = (0, import_react18.forwardRef)(
1296
1732
  RadioGroup.displayName = "RadioGroup";
1297
1733
 
1298
1734
  // src/components/slider.tsx
1299
- var import_react19 = require("react");
1300
- var import_ui_utils18 = require("@ug666/ui-utils");
1735
+ var import_react20 = require("react");
1301
1736
  var import_jsx_runtime18 = require("react/jsx-runtime");
1302
- var Slider = (0, import_react19.forwardRef)(
1737
+ var Slider = (0, import_react20.forwardRef)(
1303
1738
  ({
1304
1739
  className,
1305
1740
  value: valueProp,
@@ -1313,20 +1748,29 @@ var Slider = (0, import_react19.forwardRef)(
1313
1748
  ...props
1314
1749
  }, ref) => {
1315
1750
  const isControlled = valueProp !== void 0;
1316
- const [uncontrolledValue, setUncontrolledValue] = (0, import_react19.useState)(defaultValue);
1751
+ const [uncontrolledValue, setUncontrolledValue] = (0, import_react20.useState)(defaultValue);
1317
1752
  const currentValue = isControlled ? valueProp : uncontrolledValue;
1318
1753
  const fillPercent = max === min ? 0 : (currentValue - min) / (max - min) * 100;
1754
+ function updateValue(nextValue) {
1755
+ if (!isControlled) {
1756
+ setUncontrolledValue(nextValue);
1757
+ }
1758
+ onValueChange?.(nextValue);
1759
+ }
1760
+ function handleInput(e) {
1761
+ updateValue(Number(e.currentTarget.value));
1762
+ }
1319
1763
  function handleChange(e) {
1320
1764
  const newValue = Number(e.target.value);
1321
- if (!isControlled) {
1322
- setUncontrolledValue(newValue);
1765
+ if (newValue === currentValue) {
1766
+ return;
1323
1767
  }
1324
- onValueChange?.(newValue);
1768
+ updateValue(newValue);
1325
1769
  }
1326
- return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: (0, import_ui_utils18.cn)("flex flex-col gap-1", className), children: [
1327
- showValue && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "self-start text-xs font-medium text-text-primary", children: currentValue }),
1328
- /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "relative flex h-5 w-full items-center", children: [
1329
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: "pointer-events-none absolute h-1.5 w-full overflow-hidden rounded-full bg-surface-3", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
1770
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: cn("flex flex-col gap-1.5", className), children: [
1771
+ showValue && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "self-start text-xs font-semibold leading-none text-text-primary", children: currentValue }),
1772
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "relative flex h-6 w-full items-center", children: [
1773
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: "pointer-events-none absolute h-2 w-full overflow-hidden rounded-full bg-surface-3", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
1330
1774
  "div",
1331
1775
  {
1332
1776
  className: "h-full rounded-full bg-primary transition-all",
@@ -1343,17 +1787,18 @@ var Slider = (0, import_react19.forwardRef)(
1343
1787
  step,
1344
1788
  value: currentValue,
1345
1789
  disabled,
1790
+ onInput: handleInput,
1346
1791
  onChange: handleChange,
1347
- className: (0, import_ui_utils18.cn)(
1348
- "relative h-5 w-full cursor-pointer appearance-none bg-transparent",
1792
+ className: cn(
1793
+ "relative h-6 w-full cursor-pointer appearance-none bg-transparent",
1349
1794
  // thumb 样式
1350
- "[&::-webkit-slider-thumb]:h-4 [&::-webkit-slider-thumb]:w-4 [&::-webkit-slider-thumb]:appearance-none [&::-webkit-slider-thumb]:rounded-full [&::-webkit-slider-thumb]:border-2 [&::-webkit-slider-thumb]:border-border-strong [&::-webkit-slider-thumb]:bg-surface-1 [&::-webkit-slider-thumb]:shadow-sm [&::-webkit-slider-thumb]:transition-transform [&::-webkit-slider-thumb]:hover:scale-110",
1351
- "[&::-moz-range-thumb]:h-4 [&::-moz-range-thumb]:w-4 [&::-moz-range-thumb]:appearance-none [&::-moz-range-thumb]:rounded-full [&::-moz-range-thumb]:border-2 [&::-moz-range-thumb]:border-border-strong [&::-moz-range-thumb]:bg-surface-1 [&::-moz-range-thumb]:shadow-sm",
1795
+ "[&::-webkit-slider-thumb]:h-[18px] [&::-webkit-slider-thumb]:w-[18px] [&::-webkit-slider-thumb]:appearance-none [&::-webkit-slider-thumb]:rounded-full [&::-webkit-slider-thumb]:border-2 [&::-webkit-slider-thumb]:border-primary [&::-webkit-slider-thumb]:bg-surface-1 [&::-webkit-slider-thumb]:shadow-md [&::-webkit-slider-thumb]:transition-transform [&::-webkit-slider-thumb]:hover:scale-110",
1796
+ "[&::-moz-range-thumb]:h-[18px] [&::-moz-range-thumb]:w-[18px] [&::-moz-range-thumb]:appearance-none [&::-moz-range-thumb]:rounded-full [&::-moz-range-thumb]:border-2 [&::-moz-range-thumb]:border-primary [&::-moz-range-thumb]:bg-surface-1 [&::-moz-range-thumb]:shadow-md",
1352
1797
  // track 透明(用自定义 div 代替)
1353
1798
  "[&::-webkit-slider-runnable-track]:bg-transparent",
1354
1799
  "[&::-moz-range-track]:bg-transparent",
1355
1800
  // focus
1356
- "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",
1801
+ "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/30 focus-visible:ring-offset-2 focus-visible:ring-offset-surface-0",
1357
1802
  // disabled
1358
1803
  "disabled:cursor-not-allowed disabled:opacity-50"
1359
1804
  ),
@@ -1367,13 +1812,12 @@ var Slider = (0, import_react19.forwardRef)(
1367
1812
  Slider.displayName = "Slider";
1368
1813
 
1369
1814
  // src/components/number-input.tsx
1370
- var import_react20 = require("react");
1371
- var import_lucide_react9 = require("lucide-react");
1815
+ var import_react21 = require("react");
1816
+ var import_lucide_react11 = require("lucide-react");
1372
1817
  var import_class_variance_authority7 = require("class-variance-authority");
1373
- var import_ui_utils19 = require("@ug666/ui-utils");
1374
1818
  var import_jsx_runtime19 = require("react/jsx-runtime");
1375
1819
  var numberInputVariants = (0, import_class_variance_authority7.cva)(
1376
- "inline-flex items-center rounded-md border border-border-strong bg-surface-1 transition-colors focus-within:ring-2 focus-within:ring-ring focus-within:ring-offset-1 has-[:disabled]:pointer-events-none has-[:disabled]:opacity-50",
1820
+ "inline-flex items-center overflow-hidden rounded-lg border border-border-strong bg-surface-1 shadow-sm transition-colors focus-within:border-primary focus-within:ring-2 focus-within:ring-ring/25 has-[:disabled]:pointer-events-none has-[:disabled]:opacity-60",
1377
1821
  {
1378
1822
  variants: {
1379
1823
  size: {
@@ -1387,7 +1831,7 @@ var numberInputVariants = (0, import_class_variance_authority7.cva)(
1387
1831
  }
1388
1832
  }
1389
1833
  );
1390
- var NumberInput = (0, import_react20.forwardRef)(
1834
+ var NumberInput = (0, import_react21.forwardRef)(
1391
1835
  ({
1392
1836
  className,
1393
1837
  size,
@@ -1403,7 +1847,7 @@ var NumberInput = (0, import_react20.forwardRef)(
1403
1847
  ...props
1404
1848
  }, ref) => {
1405
1849
  const isControlled = valueProp !== void 0;
1406
- const [uncontrolledValue, setUncontrolledValue] = (0, import_react20.useState)(defaultValue);
1850
+ const [uncontrolledValue, setUncontrolledValue] = (0, import_react21.useState)(defaultValue);
1407
1851
  const currentValue = isControlled ? valueProp : uncontrolledValue;
1408
1852
  function clamp(val) {
1409
1853
  let result = val;
@@ -1445,10 +1889,10 @@ var NumberInput = (0, import_react20.forwardRef)(
1445
1889
  }
1446
1890
  const atMin = min !== void 0 && currentValue <= min;
1447
1891
  const atMax = max !== void 0 && currentValue >= max;
1448
- const btnBase = "inline-flex shrink-0 items-center justify-center text-text-secondary transition-colors hover:bg-surface-3 hover:text-text-primary disabled:pointer-events-none disabled:opacity-40";
1449
- const btnSizeCls = size === "sm" ? "h-8 w-7" : size === "lg" ? "h-11 w-9" : "h-9 w-8";
1892
+ const btnBase = "inline-flex shrink-0 items-center justify-center bg-surface-2 text-text-secondary transition-colors hover:bg-surface-3 hover:text-text-primary disabled:pointer-events-none disabled:opacity-40";
1893
+ const btnSizeCls = size === "sm" ? "h-8 w-7" : size === "lg" ? "h-11 w-10" : "h-9 w-9";
1450
1894
  const iconSize = size === "sm" ? 12 : size === "lg" ? 16 : 14;
1451
- return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: (0, import_ui_utils19.cn)(numberInputVariants({ size }), className), children: [
1895
+ return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: cn(numberInputVariants({ size }), className), children: [
1452
1896
  /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
1453
1897
  "button",
1454
1898
  {
@@ -1456,9 +1900,9 @@ var NumberInput = (0, import_react20.forwardRef)(
1456
1900
  "aria-label": "\u51CF\u5C11\u6570\u503C",
1457
1901
  disabled: disabled || atMin,
1458
1902
  onClick: handleDecrement,
1459
- className: (0, import_ui_utils19.cn)(btnBase, btnSizeCls, "rounded-l-md border-r border-border-base"),
1903
+ className: cn(btnBase, btnSizeCls, "border-r border-border-base"),
1460
1904
  tabIndex: -1,
1461
- children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_lucide_react9.Minus, { size: iconSize })
1905
+ children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_lucide_react11.Minus, { size: iconSize })
1462
1906
  }
1463
1907
  ),
1464
1908
  /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
@@ -1466,8 +1910,8 @@ var NumberInput = (0, import_react20.forwardRef)(
1466
1910
  {
1467
1911
  ref,
1468
1912
  type: "number",
1469
- className: (0, import_ui_utils19.cn)(
1470
- "min-w-0 flex-1 bg-transparent text-center text-text-primary outline-none",
1913
+ className: cn(
1914
+ "min-w-0 flex-1 bg-transparent px-2 text-center font-medium text-text-primary outline-none",
1471
1915
  "placeholder:text-text-tertiary",
1472
1916
  // 隐藏原生 spinner
1473
1917
  "[appearance:textfield] [&::-webkit-inner-spin-button]:appearance-none [&::-webkit-outer-spin-button]:appearance-none"
@@ -1490,9 +1934,9 @@ var NumberInput = (0, import_react20.forwardRef)(
1490
1934
  "aria-label": "\u589E\u52A0\u6570\u503C",
1491
1935
  disabled: disabled || atMax,
1492
1936
  onClick: handleIncrement,
1493
- className: (0, import_ui_utils19.cn)(btnBase, btnSizeCls, "rounded-r-md border-l border-border-base"),
1937
+ className: cn(btnBase, btnSizeCls, "border-l border-border-base"),
1494
1938
  tabIndex: -1,
1495
- children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_lucide_react9.Plus, { size: iconSize })
1939
+ children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_lucide_react11.Plus, { size: iconSize })
1496
1940
  }
1497
1941
  )
1498
1942
  ] });
@@ -1501,10 +1945,9 @@ var NumberInput = (0, import_react20.forwardRef)(
1501
1945
  NumberInput.displayName = "NumberInput";
1502
1946
 
1503
1947
  // src/components/otp-input.tsx
1504
- var import_react21 = require("react");
1505
- var import_ui_utils20 = require("@ug666/ui-utils");
1948
+ var import_react22 = require("react");
1506
1949
  var import_jsx_runtime20 = require("react/jsx-runtime");
1507
- var OTPInput = (0, import_react21.forwardRef)(
1950
+ var OTPInput = (0, import_react22.forwardRef)(
1508
1951
  ({
1509
1952
  value,
1510
1953
  onValueChange,
@@ -1513,15 +1956,15 @@ var OTPInput = (0, import_react21.forwardRef)(
1513
1956
  onComplete,
1514
1957
  className
1515
1958
  }, ref) => {
1516
- const inputRefs = (0, import_react21.useRef)([]);
1517
- const focusAt = (0, import_react21.useCallback)((index) => {
1959
+ const inputRefs = (0, import_react22.useRef)([]);
1960
+ const focusAt = (0, import_react22.useCallback)((index) => {
1518
1961
  const el = inputRefs.current[index];
1519
1962
  if (el) {
1520
1963
  el.focus();
1521
1964
  el.setSelectionRange(el.value.length, el.value.length);
1522
1965
  }
1523
1966
  }, []);
1524
- const updateValueAt = (0, import_react21.useCallback)(
1967
+ const updateValueAt = (0, import_react22.useCallback)(
1525
1968
  (index, char) => {
1526
1969
  const chars = value.padEnd(length, "").split("").slice(0, length);
1527
1970
  chars[index] = char;
@@ -1533,7 +1976,7 @@ var OTPInput = (0, import_react21.forwardRef)(
1533
1976
  },
1534
1977
  [value, length, onValueChange, onComplete]
1535
1978
  );
1536
- const handleChange = (0, import_react21.useCallback)(
1979
+ const handleChange = (0, import_react22.useCallback)(
1537
1980
  (index, e) => {
1538
1981
  const raw = e.target.value;
1539
1982
  const digit = raw.replace(/\D/g, "").slice(-1);
@@ -1544,7 +1987,7 @@ var OTPInput = (0, import_react21.forwardRef)(
1544
1987
  },
1545
1988
  [length, updateValueAt, focusAt]
1546
1989
  );
1547
- const handleKeyDown = (0, import_react21.useCallback)(
1990
+ const handleKeyDown = (0, import_react22.useCallback)(
1548
1991
  (index, e) => {
1549
1992
  if (e.key === "ArrowLeft") {
1550
1993
  e.preventDefault();
@@ -1565,7 +2008,7 @@ var OTPInput = (0, import_react21.forwardRef)(
1565
2008
  },
1566
2009
  [value, length, focusAt, updateValueAt]
1567
2010
  );
1568
- const handlePaste = (0, import_react21.useCallback)(
2011
+ const handlePaste = (0, import_react22.useCallback)(
1569
2012
  (e) => {
1570
2013
  e.preventDefault();
1571
2014
  const pasted = e.clipboardData.getData("text").replace(/\D/g, "").slice(0, length);
@@ -1585,7 +2028,7 @@ var OTPInput = (0, import_react21.forwardRef)(
1585
2028
  "div",
1586
2029
  {
1587
2030
  ref,
1588
- className: (0, import_ui_utils20.cn)("flex items-center gap-2", className),
2031
+ className: cn("flex items-center gap-2", className),
1589
2032
  role: "group",
1590
2033
  "aria-label": "\u9A8C\u8BC1\u7801\u8F93\u5165",
1591
2034
  children: Array.from({ length }, (_, i) => {
@@ -1604,7 +2047,7 @@ var OTPInput = (0, import_react21.forwardRef)(
1604
2047
  value: char,
1605
2048
  disabled,
1606
2049
  "aria-label": `\u9A8C\u8BC1\u7801\u7B2C ${i + 1} \u4F4D`,
1607
- className: (0, import_ui_utils20.cn)(
2050
+ className: cn(
1608
2051
  "h-10 w-10 rounded-md border text-center text-sm font-medium text-text-primary transition-colors",
1609
2052
  "outline-none focus:border-primary focus:ring-2 focus:ring-ring/20",
1610
2053
  "disabled:cursor-not-allowed disabled:opacity-50",
@@ -1625,18 +2068,17 @@ var OTPInput = (0, import_react21.forwardRef)(
1625
2068
  OTPInput.displayName = "OTPInput";
1626
2069
 
1627
2070
  // src/components/form.tsx
1628
- var import_react22 = require("react");
1629
- var import_ui_utils21 = require("@ug666/ui-utils");
2071
+ var import_react23 = require("react");
1630
2072
  var import_jsx_runtime21 = require("react/jsx-runtime");
1631
- var FormFieldContext = (0, import_react22.createContext)(null);
2073
+ var FormFieldContext = (0, import_react23.createContext)(null);
1632
2074
  function useFormFieldContext() {
1633
- const ctx = (0, import_react22.useContext)(FormFieldContext);
2075
+ const ctx = (0, import_react23.useContext)(FormFieldContext);
1634
2076
  if (!ctx) {
1635
2077
  throw new Error("FormField \u5B50\u7EC4\u4EF6\u5FC5\u987B\u5728 <FormField> \u5185\u4F7F\u7528");
1636
2078
  }
1637
2079
  return ctx;
1638
2080
  }
1639
- var Form = (0, import_react22.forwardRef)(
2081
+ var Form = (0, import_react23.forwardRef)(
1640
2082
  ({ className, onSubmit, children, ...props }, ref) => {
1641
2083
  function handleSubmit(event) {
1642
2084
  event.preventDefault();
@@ -1646,7 +2088,7 @@ var Form = (0, import_react22.forwardRef)(
1646
2088
  "form",
1647
2089
  {
1648
2090
  ref,
1649
- className: (0, import_ui_utils21.cn)(className),
2091
+ className: cn(className),
1650
2092
  onSubmit: handleSubmit,
1651
2093
  ...props,
1652
2094
  children
@@ -1655,20 +2097,20 @@ var Form = (0, import_react22.forwardRef)(
1655
2097
  }
1656
2098
  );
1657
2099
  Form.displayName = "Form";
1658
- var FormField = (0, import_react22.forwardRef)(
2100
+ var FormField = (0, import_react23.forwardRef)(
1659
2101
  ({ name, error, className, children, ...props }, ref) => {
1660
- const generatedId = (0, import_react22.useId)();
1661
- return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(FormFieldContext.Provider, { value: { name, error, id: generatedId }, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { ref, className: (0, import_ui_utils21.cn)(className), ...props, children }) });
2102
+ const generatedId = (0, import_react23.useId)();
2103
+ return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(FormFieldContext.Provider, { value: { name, error, id: generatedId }, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { ref, className: cn(className), ...props, children }) });
1662
2104
  }
1663
2105
  );
1664
2106
  FormField.displayName = "FormField";
1665
- var FormItem = (0, import_react22.forwardRef)(
2107
+ var FormItem = (0, import_react23.forwardRef)(
1666
2108
  ({ className, children, ...props }, ref) => {
1667
2109
  return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
1668
2110
  "div",
1669
2111
  {
1670
2112
  ref,
1671
- className: (0, import_ui_utils21.cn)("flex flex-col gap-1.5", className),
2113
+ className: cn("flex flex-col gap-1.5", className),
1672
2114
  ...props,
1673
2115
  children
1674
2116
  }
@@ -1676,7 +2118,7 @@ var FormItem = (0, import_react22.forwardRef)(
1676
2118
  }
1677
2119
  );
1678
2120
  FormItem.displayName = "FormItem";
1679
- var FormLabel = (0, import_react22.forwardRef)(
2121
+ var FormLabel = (0, import_react23.forwardRef)(
1680
2122
  ({ className, required, children, htmlFor, ...props }, ref) => {
1681
2123
  const ctx = useFormFieldContext();
1682
2124
  return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
@@ -1685,7 +2127,7 @@ var FormLabel = (0, import_react22.forwardRef)(
1685
2127
  ref,
1686
2128
  htmlFor: htmlFor ?? ctx.id,
1687
2129
  required,
1688
- className: (0, import_ui_utils21.cn)(className),
2130
+ className: cn(className),
1689
2131
  ...props,
1690
2132
  children
1691
2133
  }
@@ -1697,14 +2139,14 @@ function FormControl({ children }) {
1697
2139
  const ctx = useFormFieldContext();
1698
2140
  const descriptionId = `${ctx.id}-description`;
1699
2141
  const messageId = `${ctx.id}-message`;
1700
- return (0, import_react22.cloneElement)(children, {
2142
+ return (0, import_react23.cloneElement)(children, {
1701
2143
  id: ctx.id,
1702
2144
  "aria-describedby": ctx.error ? `${descriptionId} ${messageId}` : descriptionId,
1703
2145
  "aria-invalid": ctx.error ? true : void 0
1704
2146
  });
1705
2147
  }
1706
2148
  FormControl.displayName = "FormControl";
1707
- var FormDescription = (0, import_react22.forwardRef)(
2149
+ var FormDescription = (0, import_react23.forwardRef)(
1708
2150
  ({ className, children, ...props }, ref) => {
1709
2151
  const ctx = useFormFieldContext();
1710
2152
  return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
@@ -1712,7 +2154,7 @@ var FormDescription = (0, import_react22.forwardRef)(
1712
2154
  {
1713
2155
  ref,
1714
2156
  id: `${ctx.id}-description`,
1715
- className: (0, import_ui_utils21.cn)("text-xs text-text-secondary", className),
2157
+ className: cn("text-xs text-text-secondary", className),
1716
2158
  ...props,
1717
2159
  children
1718
2160
  }
@@ -1720,7 +2162,7 @@ var FormDescription = (0, import_react22.forwardRef)(
1720
2162
  }
1721
2163
  );
1722
2164
  FormDescription.displayName = "FormDescription";
1723
- var FormMessage = (0, import_react22.forwardRef)(
2165
+ var FormMessage = (0, import_react23.forwardRef)(
1724
2166
  ({ className, children, ...props }, ref) => {
1725
2167
  const ctx = useFormFieldContext();
1726
2168
  const message = ctx.error ?? (typeof children === "string" ? children : void 0);
@@ -1730,7 +2172,7 @@ var FormMessage = (0, import_react22.forwardRef)(
1730
2172
  {
1731
2173
  ref,
1732
2174
  id: `${ctx.id}-message`,
1733
- className: (0, import_ui_utils21.cn)("text-xs text-danger-soft-fg", className),
2175
+ className: cn("text-xs text-danger-soft-fg", className),
1734
2176
  role: "alert",
1735
2177
  ...props,
1736
2178
  children: message
@@ -1741,31 +2183,30 @@ var FormMessage = (0, import_react22.forwardRef)(
1741
2183
  FormMessage.displayName = "FormMessage";
1742
2184
 
1743
2185
  // src/components/tabs.tsx
1744
- var import_react23 = require("react");
1745
- var import_ui_utils22 = require("@ug666/ui-utils");
2186
+ var import_react24 = require("react");
1746
2187
  var import_jsx_runtime22 = require("react/jsx-runtime");
1747
- var TabsContext = (0, import_react23.createContext)(null);
2188
+ var TabsContext = (0, import_react24.createContext)(null);
1748
2189
  function useTabsContext() {
1749
- const ctx = (0, import_react23.useContext)(TabsContext);
2190
+ const ctx = (0, import_react24.useContext)(TabsContext);
1750
2191
  if (!ctx) throw new Error("Tabs \u5B50\u7EC4\u4EF6\u5FC5\u987B\u5728 <Tabs> \u5185\u4F7F\u7528");
1751
2192
  return ctx;
1752
2193
  }
1753
- var Tabs = (0, import_react23.forwardRef)(({ value, onValueChange, children, className }, ref) => {
1754
- return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(TabsContext.Provider, { value: { value, onValueChange }, children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { ref, className: (0, import_ui_utils22.cn)("w-full", className), children }) });
2194
+ var Tabs = (0, import_react24.forwardRef)(({ value, onValueChange, children, className }, ref) => {
2195
+ return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(TabsContext.Provider, { value: { value, onValueChange }, children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { ref, className: cn("w-full", className), children }) });
1755
2196
  });
1756
- var TabsList = (0, import_react23.forwardRef)(({ className, children, ...props }, ref) => {
2197
+ var TabsList = (0, import_react24.forwardRef)(({ className, children, ...props }, ref) => {
1757
2198
  return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
1758
2199
  "div",
1759
2200
  {
1760
2201
  ref,
1761
2202
  role: "tablist",
1762
- className: (0, import_ui_utils22.cn)("inline-flex w-full items-center gap-0 border-b border-border-base", className),
2203
+ className: cn("inline-flex w-full items-center gap-0 border-b border-border-base", className),
1763
2204
  ...props,
1764
2205
  children
1765
2206
  }
1766
2207
  );
1767
2208
  });
1768
- var TabsTrigger = (0, import_react23.forwardRef)(({ value, className, children, ...props }, ref) => {
2209
+ var TabsTrigger = (0, import_react24.forwardRef)(({ value, className, children, ...props }, ref) => {
1769
2210
  const { value: activeValue, onValueChange } = useTabsContext();
1770
2211
  const isActive = activeValue === value;
1771
2212
  return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
@@ -1777,7 +2218,7 @@ var TabsTrigger = (0, import_react23.forwardRef)(({ value, className, children,
1777
2218
  "aria-selected": isActive,
1778
2219
  tabIndex: isActive ? 0 : -1,
1779
2220
  onClick: () => onValueChange(value),
1780
- className: (0, import_ui_utils22.cn)(
2221
+ className: cn(
1781
2222
  "relative px-4 py-2 text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/30 focus-visible:ring-offset-1",
1782
2223
  "after:absolute after:bottom-0 after:left-0 after:h-0.5 after:w-full after:transition-colors",
1783
2224
  isActive ? "text-text-primary after:bg-primary" : "text-text-secondary hover:text-text-primary after:bg-transparent",
@@ -1788,7 +2229,7 @@ var TabsTrigger = (0, import_react23.forwardRef)(({ value, className, children,
1788
2229
  }
1789
2230
  );
1790
2231
  });
1791
- var TabsContent = (0, import_react23.forwardRef)(({ value, className, children, ...props }, ref) => {
2232
+ var TabsContent = (0, import_react24.forwardRef)(({ value, className, children, ...props }, ref) => {
1792
2233
  const { value: activeValue } = useTabsContext();
1793
2234
  if (activeValue !== value) return null;
1794
2235
  return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
@@ -1797,7 +2238,7 @@ var TabsContent = (0, import_react23.forwardRef)(({ value, className, children,
1797
2238
  ref,
1798
2239
  role: "tabpanel",
1799
2240
  tabIndex: 0,
1800
- className: (0, import_ui_utils22.cn)("mt-4 focus-visible:outline-none", className),
2241
+ className: cn("mt-4 focus-visible:outline-none", className),
1801
2242
  ...props,
1802
2243
  children
1803
2244
  }
@@ -1809,30 +2250,29 @@ TabsTrigger.displayName = "TabsTrigger";
1809
2250
  TabsContent.displayName = "TabsContent";
1810
2251
 
1811
2252
  // src/components/accordion.tsx
1812
- var import_react24 = require("react");
1813
- var import_lucide_react10 = require("lucide-react");
1814
- var import_ui_utils23 = require("@ug666/ui-utils");
2253
+ var import_react25 = require("react");
2254
+ var import_lucide_react12 = require("lucide-react");
1815
2255
  var import_jsx_runtime23 = require("react/jsx-runtime");
1816
- var AccordionContext = (0, import_react24.createContext)(null);
1817
- var AccordionItemContext = (0, import_react24.createContext)(null);
2256
+ var AccordionContext = (0, import_react25.createContext)(null);
2257
+ var AccordionItemContext = (0, import_react25.createContext)(null);
1818
2258
  function useAccordionContext() {
1819
- const ctx = (0, import_react24.useContext)(AccordionContext);
2259
+ const ctx = (0, import_react25.useContext)(AccordionContext);
1820
2260
  if (!ctx) throw new Error("Accordion \u5B50\u7EC4\u4EF6\u5FC5\u987B\u5728 <Accordion> \u5185\u4F7F\u7528");
1821
2261
  return ctx;
1822
2262
  }
1823
2263
  function useAccordionItemContext() {
1824
- const ctx = (0, import_react24.useContext)(AccordionItemContext);
2264
+ const ctx = (0, import_react25.useContext)(AccordionItemContext);
1825
2265
  if (!ctx) throw new Error("AccordionTrigger/AccordionContent \u5FC5\u987B\u5728 <AccordionItem> \u5185\u4F7F\u7528");
1826
2266
  return ctx;
1827
2267
  }
1828
- var Accordion = (0, import_react24.forwardRef)(
2268
+ var Accordion = (0, import_react25.forwardRef)(
1829
2269
  (props, ref) => {
1830
2270
  const { type, children, className, ...rest } = props;
1831
2271
  const isSingle = type === "single";
1832
2272
  const singleProps = isSingle ? props : null;
1833
2273
  const multiProps = !isSingle ? props : null;
1834
- const [internalSingle, setInternalSingle] = (0, import_react24.useState)(singleProps?.defaultValue ?? "");
1835
- const [internalMulti, setInternalMulti] = (0, import_react24.useState)(multiProps?.defaultValue ?? []);
2274
+ const [internalSingle, setInternalSingle] = (0, import_react25.useState)(singleProps?.defaultValue ?? "");
2275
+ const [internalMulti, setInternalMulti] = (0, import_react25.useState)(multiProps?.defaultValue ?? []);
1836
2276
  const isControlledSingle = isSingle && singleProps?.value !== void 0;
1837
2277
  const isControlledMulti = !isSingle && multiProps?.value !== void 0;
1838
2278
  const value = isSingle ? isControlledSingle ? singleProps.value ?? "" : internalSingle : isControlledMulti ? multiProps.value ?? [] : internalMulti;
@@ -1854,17 +2294,17 @@ var Accordion = (0, import_react24.forwardRef)(
1854
2294
  void _dv;
1855
2295
  void _ov;
1856
2296
  void _col;
1857
- return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(AccordionContext.Provider, { value: { type, value, onValueChange: handleValueChange, collapsible }, children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { ref, className: (0, import_ui_utils23.cn)("w-full divide-y divide-border-base rounded-md border border-border-base", className), ...domRest, children }) });
2297
+ return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(AccordionContext.Provider, { value: { type, value, onValueChange: handleValueChange, collapsible }, children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { ref, className: cn("w-full divide-y divide-border-base rounded-md border border-border-base", className), ...domRest, children }) });
1858
2298
  }
1859
2299
  );
1860
2300
  Accordion.displayName = "Accordion";
1861
- var AccordionItem = (0, import_react24.forwardRef)(({ value, className, children, ...props }, ref) => {
2301
+ var AccordionItem = (0, import_react25.forwardRef)(({ value, className, children, ...props }, ref) => {
1862
2302
  const { value: activeValue, type } = useAccordionContext();
1863
2303
  const isOpen = type === "single" ? activeValue === value : activeValue.includes(value);
1864
- return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(AccordionItemContext.Provider, { value: { value, isOpen }, children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { ref, className: (0, import_ui_utils23.cn)("", className), ...props, children }) });
2304
+ return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(AccordionItemContext.Provider, { value: { value, isOpen }, children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { ref, className: cn("", className), ...props, children }) });
1865
2305
  });
1866
2306
  AccordionItem.displayName = "AccordionItem";
1867
- var AccordionTrigger = (0, import_react24.forwardRef)(({ className, children, ...props }, ref) => {
2307
+ var AccordionTrigger = (0, import_react25.forwardRef)(({ className, children, ...props }, ref) => {
1868
2308
  const { onValueChange } = useAccordionContext();
1869
2309
  const { value, isOpen } = useAccordionItemContext();
1870
2310
  return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
@@ -1874,7 +2314,7 @@ var AccordionTrigger = (0, import_react24.forwardRef)(({ className, children, ..
1874
2314
  type: "button",
1875
2315
  "aria-expanded": isOpen,
1876
2316
  onClick: () => onValueChange(value),
1877
- className: (0, import_ui_utils23.cn)(
2317
+ className: cn(
1878
2318
  "flex w-full items-center justify-between px-4 py-3 text-left text-sm font-medium text-text-primary transition-colors hover:bg-surface-2 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/30 focus-visible:ring-inset",
1879
2319
  className
1880
2320
  ),
@@ -1882,10 +2322,10 @@ var AccordionTrigger = (0, import_react24.forwardRef)(({ className, children, ..
1882
2322
  children: [
1883
2323
  children,
1884
2324
  /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
1885
- import_lucide_react10.ChevronDown,
2325
+ import_lucide_react12.ChevronDown,
1886
2326
  {
1887
2327
  size: 16,
1888
- className: (0, import_ui_utils23.cn)("shrink-0 text-text-secondary transition-transform duration-200", isOpen && "rotate-180")
2328
+ className: cn("shrink-0 text-text-secondary transition-transform duration-200", isOpen && "rotate-180")
1889
2329
  }
1890
2330
  )
1891
2331
  ]
@@ -1893,14 +2333,14 @@ var AccordionTrigger = (0, import_react24.forwardRef)(({ className, children, ..
1893
2333
  );
1894
2334
  });
1895
2335
  AccordionTrigger.displayName = "AccordionTrigger";
1896
- var AccordionContent = (0, import_react24.forwardRef)(({ className, children, ...props }, ref) => {
2336
+ var AccordionContent = (0, import_react25.forwardRef)(({ className, children, ...props }, ref) => {
1897
2337
  const { isOpen } = useAccordionItemContext();
1898
2338
  if (!isOpen) return null;
1899
2339
  return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
1900
2340
  "div",
1901
2341
  {
1902
2342
  ref,
1903
- className: (0, import_ui_utils23.cn)("px-4 pb-4 pt-1 text-sm text-text-secondary", className),
2343
+ className: cn("px-4 pb-4 pt-1 text-sm text-text-secondary", className),
1904
2344
  ...props,
1905
2345
  children
1906
2346
  }
@@ -1909,19 +2349,18 @@ var AccordionContent = (0, import_react24.forwardRef)(({ className, children, ..
1909
2349
  AccordionContent.displayName = "AccordionContent";
1910
2350
 
1911
2351
  // src/components/steps.tsx
1912
- var import_react25 = require("react");
1913
- var import_lucide_react11 = require("lucide-react");
1914
- var import_ui_utils24 = require("@ug666/ui-utils");
2352
+ var import_react26 = require("react");
2353
+ var import_lucide_react13 = require("lucide-react");
1915
2354
  var import_jsx_runtime24 = require("react/jsx-runtime");
1916
- var Steps = (0, import_react25.forwardRef)(
2355
+ var Steps = (0, import_react26.forwardRef)(
1917
2356
  ({ current, items, direction = "horizontal", status = "process", className, ...props }, ref) => {
1918
2357
  const isHorizontal = direction === "horizontal";
1919
2358
  return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
1920
2359
  "div",
1921
2360
  {
1922
2361
  ref,
1923
- className: (0, import_ui_utils24.cn)(
1924
- isHorizontal ? "flex items-start" : "flex flex-col",
2362
+ className: cn(
2363
+ isHorizontal ? "flex items-start" : "flex flex-col gap-1",
1925
2364
  className
1926
2365
  ),
1927
2366
  ...props,
@@ -1933,51 +2372,51 @@ var Steps = (0, import_react25.forwardRef)(
1933
2372
  return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
1934
2373
  "div",
1935
2374
  {
1936
- className: (0, import_ui_utils24.cn)(
2375
+ className: cn(
1937
2376
  isHorizontal ? "flex flex-1 items-start" : "flex items-start"
1938
2377
  ),
1939
2378
  children: [
1940
- /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: (0, import_ui_utils24.cn)("flex", isHorizontal ? "flex-col items-center" : "items-start"), children: [
2379
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: cn("flex", isHorizontal ? "flex-col items-center" : "items-start"), children: [
1941
2380
  /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
1942
2381
  "div",
1943
2382
  {
1944
- className: (0, import_ui_utils24.cn)(
1945
- "flex h-8 w-8 shrink-0 items-center justify-center rounded-full border-2 text-sm font-semibold transition-colors",
1946
- isFinished && "border-primary bg-primary text-primary-fg",
1947
- isCurrent && !isError && "border-primary bg-surface-1 text-text-primary",
1948
- isError && "border-red-500 bg-surface-1 text-red-500",
2383
+ className: cn(
2384
+ "flex h-9 w-9 shrink-0 items-center justify-center rounded-full border-2 text-sm font-semibold shadow-sm transition-colors",
2385
+ isFinished && "border-primary bg-primary text-primary-fg shadow-primary/20",
2386
+ isCurrent && !isError && "border-primary bg-primary-soft text-primary-soft-fg shadow-primary/10",
2387
+ isError && "border-danger bg-danger-soft text-danger-soft-fg shadow-danger/10",
1949
2388
  !isFinished && !isCurrent && !isError && "border-border-strong bg-surface-1 text-text-tertiary"
1950
2389
  ),
1951
- children: isFinished ? /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_lucide_react11.Check, { size: 16, strokeWidth: 2.5 }) : item.icon ?? /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { children: index + 1 })
2390
+ children: isFinished ? /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_lucide_react13.Check, { size: 16, strokeWidth: 2.5 }) : item.icon ?? /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { children: index + 1 })
1952
2391
  }
1953
2392
  ),
1954
2393
  !isLast && !isHorizontal && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
1955
2394
  "div",
1956
2395
  {
1957
- className: (0, import_ui_utils24.cn)(
1958
- "ml-[15px] mt-1 w-0.5 flex-1 self-stretch",
1959
- isFinished ? "bg-primary" : "bg-border-base"
2396
+ className: cn(
2397
+ "ml-[17px] mt-1 w-0.5 flex-1 self-stretch rounded-full",
2398
+ isFinished ? "bg-primary" : "bg-border-strong"
1960
2399
  ),
1961
- style: { minHeight: "24px" }
2400
+ style: { minHeight: "26px" }
1962
2401
  }
1963
2402
  )
1964
2403
  ] }),
1965
2404
  /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
1966
2405
  "div",
1967
2406
  {
1968
- className: (0, import_ui_utils24.cn)(
1969
- isHorizontal ? "mt-2 text-center" : "ml-3 pb-6",
2407
+ className: cn(
2408
+ isHorizontal ? "mt-2 text-center" : "ml-3.5 pb-5",
1970
2409
  isLast && !isHorizontal && "pb-0"
1971
2410
  ),
1972
2411
  children: [
1973
2412
  /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
1974
2413
  "p",
1975
2414
  {
1976
- className: (0, import_ui_utils24.cn)(
1977
- "text-sm font-medium",
2415
+ className: cn(
2416
+ "text-sm font-semibold leading-5",
1978
2417
  isFinished && "text-text-primary",
1979
- isCurrent && !isError && "text-text-primary",
1980
- isError && "text-red-500",
2418
+ isCurrent && !isError && "text-primary",
2419
+ isError && "text-danger",
1981
2420
  !isFinished && !isCurrent && !isError && "text-text-tertiary"
1982
2421
  ),
1983
2422
  children: item.title
@@ -1986,9 +2425,9 @@ var Steps = (0, import_react25.forwardRef)(
1986
2425
  item.description && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
1987
2426
  "p",
1988
2427
  {
1989
- className: (0, import_ui_utils24.cn)(
1990
- "mt-0.5 text-xs",
1991
- isError ? "text-red-400" : "text-text-secondary"
2428
+ className: cn(
2429
+ "mt-0.5 text-xs leading-5",
2430
+ isError ? "text-danger" : "text-text-secondary"
1992
2431
  ),
1993
2432
  children: item.description
1994
2433
  }
@@ -1999,7 +2438,7 @@ var Steps = (0, import_react25.forwardRef)(
1999
2438
  !isLast && isHorizontal && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
2000
2439
  "div",
2001
2440
  {
2002
- className: (0, import_ui_utils24.cn)(
2441
+ className: cn(
2003
2442
  "mx-2 mt-4 h-0.5 flex-1",
2004
2443
  isFinished ? "bg-primary" : "bg-border-base"
2005
2444
  )
@@ -2017,11 +2456,10 @@ var Steps = (0, import_react25.forwardRef)(
2017
2456
  Steps.displayName = "Steps";
2018
2457
 
2019
2458
  // src/components/dropdown.tsx
2020
- var import_react26 = require("react");
2459
+ var import_react27 = require("react");
2021
2460
  var import_react_dom5 = require("react-dom");
2022
- var import_ui_utils25 = require("@ug666/ui-utils");
2023
2461
  var import_jsx_runtime25 = require("react/jsx-runtime");
2024
- var DropdownContext = (0, import_react26.createContext)(null);
2462
+ var DropdownContext = (0, import_react27.createContext)(null);
2025
2463
  function assignRef(ref, value) {
2026
2464
  if (typeof ref === "function") {
2027
2465
  ref(value);
@@ -2032,18 +2470,18 @@ function assignRef(ref, value) {
2032
2470
  }
2033
2471
  }
2034
2472
  function useDropdownContext() {
2035
- const ctx = (0, import_react26.useContext)(DropdownContext);
2473
+ const ctx = (0, import_react27.useContext)(DropdownContext);
2036
2474
  if (!ctx) throw new Error("Dropdown \u5B50\u7EC4\u4EF6\u5FC5\u987B\u5728 <DropdownMenu> \u5185\u4F7F\u7528");
2037
2475
  return ctx;
2038
2476
  }
2039
- var DropdownMenu = (0, import_react26.forwardRef)(({ children, className }, ref) => {
2040
- const [open, setOpen] = (0, import_react26.useState)(false);
2041
- const triggerRef = (0, import_react26.useRef)(null);
2042
- return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(DropdownContext.Provider, { value: { open, setOpen, triggerRef }, children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { ref, className: (0, import_ui_utils25.cn)("relative inline-block", className), children }) });
2477
+ var DropdownMenu = (0, import_react27.forwardRef)(({ children, className }, ref) => {
2478
+ const [open, setOpen] = (0, import_react27.useState)(false);
2479
+ const triggerRef = (0, import_react27.useRef)(null);
2480
+ return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(DropdownContext.Provider, { value: { open, setOpen, triggerRef }, children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { ref, className: cn("relative inline-block", className), children }) });
2043
2481
  });
2044
- var DropdownTrigger = (0, import_react26.forwardRef)(({ children, className }, ref) => {
2482
+ var DropdownTrigger = (0, import_react27.forwardRef)(({ children, className }, ref) => {
2045
2483
  const { setOpen, open, triggerRef } = useDropdownContext();
2046
- const handleRef = (0, import_react26.useCallback)(
2484
+ const handleRef = (0, import_react27.useCallback)(
2047
2485
  (node) => {
2048
2486
  triggerRef.current = node;
2049
2487
  assignRef(ref, node);
@@ -2054,35 +2492,36 @@ var DropdownTrigger = (0, import_react26.forwardRef)(({ children, className }, r
2054
2492
  "div",
2055
2493
  {
2056
2494
  ref: handleRef,
2057
- className: (0, import_ui_utils25.cn)("inline-flex", className),
2495
+ className: cn("inline-flex cursor-pointer", className),
2058
2496
  onClick: () => setOpen(!open),
2059
2497
  children
2060
2498
  }
2061
2499
  );
2062
2500
  });
2063
- var DropdownContent = (0, import_react26.forwardRef)(({ children, className, align = "start" }, ref) => {
2501
+ var DropdownContent = (0, import_react27.forwardRef)(({ children, className, align = "start" }, ref) => {
2064
2502
  const { open, setOpen, triggerRef } = useDropdownContext();
2065
- const contentRef = (0, import_react26.useRef)(null);
2066
- const [position, setPosition] = (0, import_react26.useState)({ top: 0, left: 0 });
2067
- const handleRef = (0, import_react26.useCallback)(
2503
+ const contentRef = (0, import_react27.useRef)(null);
2504
+ const portalContainer = usePortalContainer();
2505
+ const [position, setPosition] = (0, import_react27.useState)({ top: 0, left: 0 });
2506
+ const handleRef = (0, import_react27.useCallback)(
2068
2507
  (node) => {
2069
2508
  contentRef.current = node;
2070
2509
  assignRef(ref, node);
2071
2510
  },
2072
2511
  [ref]
2073
2512
  );
2074
- const updatePosition = (0, import_react26.useCallback)(() => {
2513
+ const updatePosition = (0, import_react27.useCallback)(() => {
2075
2514
  if (!triggerRef.current) return;
2076
2515
  const rect = triggerRef.current.getBoundingClientRect();
2077
2516
  const top = rect.bottom + window.scrollY + 4;
2078
2517
  const left = align === "end" ? rect.right + window.scrollX - (contentRef.current?.offsetWidth ?? 0) : rect.left + window.scrollX;
2079
2518
  setPosition({ top, left });
2080
2519
  }, [align, triggerRef]);
2081
- (0, import_react26.useEffect)(() => {
2520
+ (0, import_react27.useEffect)(() => {
2082
2521
  if (!open) return;
2083
2522
  updatePosition();
2084
2523
  }, [open, updatePosition]);
2085
- (0, import_react26.useEffect)(() => {
2524
+ (0, import_react27.useEffect)(() => {
2086
2525
  if (!open) return;
2087
2526
  function handleClickOutside(e) {
2088
2527
  if (contentRef.current && !contentRef.current.contains(e.target) && triggerRef.current && !triggerRef.current.contains(e.target)) {
@@ -2092,24 +2531,24 @@ var DropdownContent = (0, import_react26.forwardRef)(({ children, className, ali
2092
2531
  document.addEventListener("mousedown", handleClickOutside);
2093
2532
  return () => document.removeEventListener("mousedown", handleClickOutside);
2094
2533
  }, [open, setOpen, triggerRef]);
2095
- if (!open) return null;
2534
+ if (!open || !portalContainer) return null;
2096
2535
  return (0, import_react_dom5.createPortal)(
2097
2536
  /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
2098
2537
  "div",
2099
2538
  {
2100
2539
  ref: handleRef,
2101
2540
  style: { top: position.top, left: position.left },
2102
- className: (0, import_ui_utils25.cn)(
2103
- "absolute z-50 min-w-40 rounded-md border border-border-base bg-surface-1 py-1 shadow-lg",
2541
+ className: cn(
2542
+ "absolute z-50 min-w-44 overflow-hidden rounded-lg border border-border-base bg-surface-1 p-1 text-text-primary shadow-xl",
2104
2543
  className
2105
2544
  ),
2106
2545
  children
2107
2546
  }
2108
2547
  ),
2109
- document.body
2548
+ portalContainer
2110
2549
  );
2111
2550
  });
2112
- var DropdownItem = (0, import_react26.forwardRef)(({ children, className, destructive = false, onClick, ...props }, ref) => {
2551
+ var DropdownItem = (0, import_react27.forwardRef)(({ children, className, destructive = false, onClick, ...props }, ref) => {
2113
2552
  const { setOpen } = useDropdownContext();
2114
2553
  function handleClick(e) {
2115
2554
  setOpen(false);
@@ -2120,9 +2559,9 @@ var DropdownItem = (0, import_react26.forwardRef)(({ children, className, destru
2120
2559
  {
2121
2560
  ref,
2122
2561
  type: "button",
2123
- className: (0, import_ui_utils25.cn)(
2124
- "w-full px-3 py-1.5 text-left text-sm transition-colors focus-visible:outline-none focus-visible:bg-surface-3",
2125
- destructive ? "text-red-600 hover:bg-red-50" : "text-text-primary hover:bg-surface-3",
2562
+ className: cn(
2563
+ "flex min-h-8 w-full items-center gap-2 rounded-md px-2.5 py-2 text-left text-sm leading-none transition-colors focus-visible:outline-none disabled:pointer-events-none disabled:opacity-50",
2564
+ destructive ? "text-danger hover:bg-danger-soft focus-visible:bg-danger-soft" : "text-text-primary hover:bg-surface-2 focus-visible:bg-surface-2",
2126
2565
  className
2127
2566
  ),
2128
2567
  onClick: handleClick,
@@ -2131,8 +2570,8 @@ var DropdownItem = (0, import_react26.forwardRef)(({ children, className, destru
2131
2570
  }
2132
2571
  );
2133
2572
  });
2134
- var DropdownSeparator = (0, import_react26.forwardRef)(({ className, ...props }, ref) => {
2135
- return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { ref, className: (0, import_ui_utils25.cn)("my-1 h-px bg-border-base", className), ...props });
2573
+ var DropdownSeparator = (0, import_react27.forwardRef)(({ className, ...props }, ref) => {
2574
+ return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { ref, className: cn("-mx-1 my-1 h-px bg-border-base", className), ...props });
2136
2575
  });
2137
2576
  DropdownMenu.displayName = "DropdownMenu";
2138
2577
  DropdownTrigger.displayName = "DropdownTrigger";
@@ -2141,13 +2580,12 @@ DropdownItem.displayName = "DropdownItem";
2141
2580
  DropdownSeparator.displayName = "DropdownSeparator";
2142
2581
 
2143
2582
  // src/components/popover.tsx
2144
- var import_react27 = require("react");
2583
+ var import_react28 = require("react");
2145
2584
  var import_react_dom6 = require("react-dom");
2146
- var import_ui_utils26 = require("@ug666/ui-utils");
2147
2585
  var import_jsx_runtime26 = require("react/jsx-runtime");
2148
- var PopoverContext = (0, import_react27.createContext)(null);
2586
+ var PopoverContext = (0, import_react28.createContext)(null);
2149
2587
  function usePopoverContext() {
2150
- const ctx = (0, import_react27.useContext)(PopoverContext);
2588
+ const ctx = (0, import_react28.useContext)(PopoverContext);
2151
2589
  if (!ctx) throw new Error("Popover \u5B50\u7EC4\u4EF6\u5FC5\u987B\u5728 <Popover> \u5185\u4F7F\u7528");
2152
2590
  return ctx;
2153
2591
  }
@@ -2161,11 +2599,11 @@ function assignRef2(ref, value) {
2161
2599
  }
2162
2600
  }
2163
2601
  var Popover = ({ open: controlledOpen, defaultOpen = false, onOpenChange, children }) => {
2164
- const [internalOpen, setInternalOpen] = (0, import_react27.useState)(defaultOpen);
2165
- const triggerRef = (0, import_react27.useRef)(null);
2602
+ const [internalOpen, setInternalOpen] = (0, import_react28.useState)(defaultOpen);
2603
+ const triggerRef = (0, import_react28.useRef)(null);
2166
2604
  const isControlled = controlledOpen !== void 0;
2167
2605
  const open = isControlled ? controlledOpen : internalOpen;
2168
- const setOpen = (0, import_react27.useCallback)(
2606
+ const setOpen = (0, import_react28.useCallback)(
2169
2607
  (value) => {
2170
2608
  if (!isControlled) setInternalOpen(value);
2171
2609
  onOpenChange?.(value);
@@ -2175,9 +2613,9 @@ var Popover = ({ open: controlledOpen, defaultOpen = false, onOpenChange, childr
2175
2613
  return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(PopoverContext.Provider, { value: { open, setOpen, triggerRef }, children });
2176
2614
  };
2177
2615
  Popover.displayName = "Popover";
2178
- var PopoverTrigger = (0, import_react27.forwardRef)(({ children, className }, ref) => {
2616
+ var PopoverTrigger = (0, import_react28.forwardRef)(({ children, className }, ref) => {
2179
2617
  const { setOpen, open, triggerRef } = usePopoverContext();
2180
- const handleRef = (0, import_react27.useCallback)(
2618
+ const handleRef = (0, import_react28.useCallback)(
2181
2619
  (node) => {
2182
2620
  triggerRef.current = node;
2183
2621
  assignRef2(ref, node);
@@ -2188,7 +2626,7 @@ var PopoverTrigger = (0, import_react27.forwardRef)(({ children, className }, re
2188
2626
  "div",
2189
2627
  {
2190
2628
  ref: handleRef,
2191
- className: (0, import_ui_utils26.cn)("inline-flex", className),
2629
+ className: cn("inline-flex", className),
2192
2630
  onClick: () => setOpen(!open),
2193
2631
  children
2194
2632
  }
@@ -2222,27 +2660,28 @@ function calcPosition(triggerRect, contentEl, side, align, sideOffset) {
2222
2660
  }
2223
2661
  return { top, left };
2224
2662
  }
2225
- var PopoverContent = (0, import_react27.forwardRef)(
2663
+ var PopoverContent = (0, import_react28.forwardRef)(
2226
2664
  ({ children, className, side = "bottom", align = "center", sideOffset = 4, ...props }, ref) => {
2227
2665
  const { open, setOpen, triggerRef } = usePopoverContext();
2228
- const contentRef = (0, import_react27.useRef)(null);
2229
- const [pos, setPos] = (0, import_react27.useState)({ top: 0, left: 0 });
2230
- const handleRef = (0, import_react27.useCallback)(
2666
+ const contentRef = (0, import_react28.useRef)(null);
2667
+ const portalContainer = usePortalContainer();
2668
+ const [pos, setPos] = (0, import_react28.useState)({ top: 0, left: 0 });
2669
+ const handleRef = (0, import_react28.useCallback)(
2231
2670
  (node) => {
2232
2671
  contentRef.current = node;
2233
2672
  assignRef2(ref, node);
2234
2673
  },
2235
2674
  [ref]
2236
2675
  );
2237
- const updatePos = (0, import_react27.useCallback)(() => {
2676
+ const updatePos = (0, import_react28.useCallback)(() => {
2238
2677
  if (!triggerRef.current || !contentRef.current) return;
2239
2678
  const rect = triggerRef.current.getBoundingClientRect();
2240
2679
  setPos(calcPosition(rect, contentRef.current, side, align, sideOffset));
2241
2680
  }, [side, align, sideOffset, triggerRef]);
2242
- (0, import_react27.useEffect)(() => {
2681
+ (0, import_react28.useEffect)(() => {
2243
2682
  if (open) updatePos();
2244
2683
  }, [open, updatePos]);
2245
- (0, import_react27.useEffect)(() => {
2684
+ (0, import_react28.useEffect)(() => {
2246
2685
  if (!open) return;
2247
2686
  function handleMouseDown(e) {
2248
2687
  if (contentRef.current && !contentRef.current.contains(e.target) && triggerRef.current && !triggerRef.current.contains(e.target)) {
@@ -2252,14 +2691,14 @@ var PopoverContent = (0, import_react27.forwardRef)(
2252
2691
  document.addEventListener("mousedown", handleMouseDown);
2253
2692
  return () => document.removeEventListener("mousedown", handleMouseDown);
2254
2693
  }, [open, setOpen, triggerRef]);
2255
- if (!open) return null;
2694
+ if (!open || !portalContainer) return null;
2256
2695
  return (0, import_react_dom6.createPortal)(
2257
2696
  /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
2258
2697
  "div",
2259
2698
  {
2260
2699
  ref: handleRef,
2261
2700
  style: { top: pos.top, left: pos.left },
2262
- className: (0, import_ui_utils26.cn)(
2701
+ className: cn(
2263
2702
  "absolute z-50 min-w-40 rounded-md border border-border-base bg-surface-1 p-3 shadow-lg",
2264
2703
  className
2265
2704
  ),
@@ -2267,20 +2706,19 @@ var PopoverContent = (0, import_react27.forwardRef)(
2267
2706
  children
2268
2707
  }
2269
2708
  ),
2270
- document.body
2709
+ portalContainer
2271
2710
  );
2272
2711
  }
2273
2712
  );
2274
2713
  PopoverContent.displayName = "PopoverContent";
2275
2714
 
2276
2715
  // src/components/context-menu.tsx
2277
- var import_react28 = require("react");
2716
+ var import_react29 = require("react");
2278
2717
  var import_react_dom7 = require("react-dom");
2279
- var import_ui_utils27 = require("@ug666/ui-utils");
2280
2718
  var import_jsx_runtime27 = require("react/jsx-runtime");
2281
- var ContextMenuContext = (0, import_react28.createContext)(null);
2719
+ var ContextMenuContext = (0, import_react29.createContext)(null);
2282
2720
  function useContextMenuContext() {
2283
- const ctx = (0, import_react28.useContext)(ContextMenuContext);
2721
+ const ctx = (0, import_react29.useContext)(ContextMenuContext);
2284
2722
  if (!ctx) throw new Error("ContextMenu \u5B50\u7EC4\u4EF6\u5FC5\u987B\u5728 <ContextMenu> \u5185\u4F7F\u7528");
2285
2723
  return ctx;
2286
2724
  }
@@ -2293,18 +2731,18 @@ function assignRef3(ref, value) {
2293
2731
  ref.current = value;
2294
2732
  }
2295
2733
  }
2296
- var ContextMenu = (0, import_react28.forwardRef)(
2734
+ var ContextMenu = (0, import_react29.forwardRef)(
2297
2735
  ({ children, className }, ref) => {
2298
- const [open, setOpen] = (0, import_react28.useState)(false);
2299
- const [position, setPosition] = (0, import_react28.useState)({ x: 0, y: 0 });
2300
- const openAt = (0, import_react28.useCallback)((pos) => {
2736
+ const [open, setOpen] = (0, import_react29.useState)(false);
2737
+ const [position, setPosition] = (0, import_react29.useState)({ x: 0, y: 0 });
2738
+ const openAt = (0, import_react29.useCallback)((pos) => {
2301
2739
  setPosition(pos);
2302
2740
  setOpen(true);
2303
2741
  }, []);
2304
- return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(ContextMenuContext.Provider, { value: { open, position, setOpen, openAt }, children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { ref, className: (0, import_ui_utils27.cn)("relative", className), children }) });
2742
+ return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(ContextMenuContext.Provider, { value: { open, position, setOpen, openAt }, children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { ref, className: cn("relative", className), children }) });
2305
2743
  }
2306
2744
  );
2307
- var ContextMenuTrigger = (0, import_react28.forwardRef)(
2745
+ var ContextMenuTrigger = (0, import_react29.forwardRef)(
2308
2746
  ({ children, className, ...props }, ref) => {
2309
2747
  const { openAt } = useContextMenuContext();
2310
2748
  function handleContextMenu(e) {
@@ -2315,7 +2753,7 @@ var ContextMenuTrigger = (0, import_react28.forwardRef)(
2315
2753
  "div",
2316
2754
  {
2317
2755
  ref,
2318
- className: (0, import_ui_utils27.cn)(className),
2756
+ className: cn(className),
2319
2757
  onContextMenu: handleContextMenu,
2320
2758
  ...props,
2321
2759
  children
@@ -2323,18 +2761,19 @@ var ContextMenuTrigger = (0, import_react28.forwardRef)(
2323
2761
  );
2324
2762
  }
2325
2763
  );
2326
- var ContextMenuContent = (0, import_react28.forwardRef)(
2764
+ var ContextMenuContent = (0, import_react29.forwardRef)(
2327
2765
  ({ children, className, ...props }, ref) => {
2328
2766
  const { open, position, setOpen } = useContextMenuContext();
2329
- const contentRef = (0, import_react28.useRef)(null);
2330
- const handleRef = (0, import_react28.useCallback)(
2767
+ const contentRef = (0, import_react29.useRef)(null);
2768
+ const portalContainer = usePortalContainer();
2769
+ const handleRef = (0, import_react29.useCallback)(
2331
2770
  (node) => {
2332
2771
  contentRef.current = node;
2333
2772
  assignRef3(ref, node);
2334
2773
  },
2335
2774
  [ref]
2336
2775
  );
2337
- (0, import_react28.useEffect)(() => {
2776
+ (0, import_react29.useEffect)(() => {
2338
2777
  if (!open) return;
2339
2778
  function handleMouseDown(e) {
2340
2779
  if (contentRef.current && !contentRef.current.contains(e.target)) {
@@ -2353,14 +2792,14 @@ var ContextMenuContent = (0, import_react28.forwardRef)(
2353
2792
  document.removeEventListener("keydown", handleKeyDown);
2354
2793
  };
2355
2794
  }, [open, setOpen]);
2356
- if (!open) return null;
2795
+ if (!open || !portalContainer) return null;
2357
2796
  return (0, import_react_dom7.createPortal)(
2358
2797
  /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
2359
2798
  "div",
2360
2799
  {
2361
2800
  ref: handleRef,
2362
2801
  style: { top: position.y, left: position.x },
2363
- className: (0, import_ui_utils27.cn)(
2802
+ className: cn(
2364
2803
  "fixed z-50 min-w-40 rounded-md border border-border-base bg-surface-1 py-1 shadow-lg",
2365
2804
  className
2366
2805
  ),
@@ -2368,11 +2807,11 @@ var ContextMenuContent = (0, import_react28.forwardRef)(
2368
2807
  children
2369
2808
  }
2370
2809
  ),
2371
- document.body
2810
+ portalContainer
2372
2811
  );
2373
2812
  }
2374
2813
  );
2375
- var ContextMenuItem = (0, import_react28.forwardRef)(
2814
+ var ContextMenuItem = (0, import_react29.forwardRef)(
2376
2815
  ({ children, className, destructive = false, onClick, ...props }, ref) => {
2377
2816
  const { setOpen } = useContextMenuContext();
2378
2817
  function handleClick(e) {
@@ -2384,9 +2823,9 @@ var ContextMenuItem = (0, import_react28.forwardRef)(
2384
2823
  {
2385
2824
  ref,
2386
2825
  type: "button",
2387
- className: (0, import_ui_utils27.cn)(
2826
+ className: cn(
2388
2827
  "w-full px-3 py-1.5 text-left text-sm transition-colors focus-visible:outline-none focus-visible:bg-surface-3",
2389
- destructive ? "text-red-600 hover:bg-red-50" : "text-text-primary hover:bg-surface-3",
2828
+ destructive ? "text-danger hover:bg-danger-soft/10" : "text-text-primary hover:bg-surface-3",
2390
2829
  className
2391
2830
  ),
2392
2831
  onClick: handleClick,
@@ -2396,9 +2835,9 @@ var ContextMenuItem = (0, import_react28.forwardRef)(
2396
2835
  );
2397
2836
  }
2398
2837
  );
2399
- var ContextMenuSeparator = (0, import_react28.forwardRef)(
2838
+ var ContextMenuSeparator = (0, import_react29.forwardRef)(
2400
2839
  ({ className, ...props }, ref) => {
2401
- return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { ref, className: (0, import_ui_utils27.cn)("my-1 h-px bg-border-base", className), ...props });
2840
+ return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { ref, className: cn("my-1 h-px bg-border-base", className), ...props });
2402
2841
  }
2403
2842
  );
2404
2843
  ContextMenu.displayName = "ContextMenu";
@@ -2408,53 +2847,52 @@ ContextMenuItem.displayName = "ContextMenuItem";
2408
2847
  ContextMenuSeparator.displayName = "ContextMenuSeparator";
2409
2848
 
2410
2849
  // src/components/navigation-menu.tsx
2411
- var import_react29 = require("react");
2412
- var import_lucide_react12 = require("lucide-react");
2413
- var import_ui_utils28 = require("@ug666/ui-utils");
2850
+ var import_react30 = require("react");
2851
+ var import_lucide_react14 = require("lucide-react");
2414
2852
  var import_jsx_runtime28 = require("react/jsx-runtime");
2415
- var NavigationMenuContext = (0, import_react29.createContext)(null);
2853
+ var NavigationMenuContext = (0, import_react30.createContext)(null);
2416
2854
  function useNavigationMenuContext() {
2417
- const ctx = (0, import_react29.useContext)(NavigationMenuContext);
2855
+ const ctx = (0, import_react30.useContext)(NavigationMenuContext);
2418
2856
  if (!ctx) throw new Error("NavigationMenu \u5B50\u7EC4\u4EF6\u5FC5\u987B\u5728 <NavigationMenu> \u5185\u4F7F\u7528");
2419
2857
  return ctx;
2420
2858
  }
2421
- var NavigationMenuItemContext = (0, import_react29.createContext)(null);
2859
+ var NavigationMenuItemContext = (0, import_react30.createContext)(null);
2422
2860
  function useNavigationMenuItemContext() {
2423
- const ctx = (0, import_react29.useContext)(NavigationMenuItemContext);
2861
+ const ctx = (0, import_react30.useContext)(NavigationMenuItemContext);
2424
2862
  if (!ctx) throw new Error("NavigationMenuTrigger/Content \u5FC5\u987B\u5728 <NavigationMenuItem> \u5185\u4F7F\u7528");
2425
2863
  return ctx;
2426
2864
  }
2427
2865
  var _idCounter = 0;
2428
- var NavigationMenu = (0, import_react29.forwardRef)(
2866
+ var NavigationMenu = (0, import_react30.forwardRef)(
2429
2867
  ({ className, children, ...props }, ref) => {
2430
- const [activeItem, setActiveItem] = (0, import_react29.useState)(null);
2868
+ const [activeItem, setActiveItem] = (0, import_react30.useState)(null);
2431
2869
  return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(NavigationMenuContext.Provider, { value: { activeItem, setActiveItem }, children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
2432
2870
  "nav",
2433
2871
  {
2434
2872
  ref,
2435
- className: (0, import_ui_utils28.cn)("relative flex items-center gap-1", className),
2873
+ className: cn("relative flex items-center gap-1", className),
2436
2874
  ...props,
2437
2875
  children
2438
2876
  }
2439
2877
  ) });
2440
2878
  }
2441
2879
  );
2442
- var NavigationMenuItem = (0, import_react29.forwardRef)(
2880
+ var NavigationMenuItem = (0, import_react30.forwardRef)(
2443
2881
  ({ className, children, ...props }, ref) => {
2444
- const itemIdRef = (0, import_react29.useRef)(`nav-item-${++_idCounter}`);
2882
+ const itemIdRef = (0, import_react30.useRef)(`nav-item-${++_idCounter}`);
2445
2883
  const { activeItem, setActiveItem } = useNavigationMenuContext();
2446
2884
  const isOpen = activeItem === itemIdRef.current;
2447
- const handleMouseEnter = (0, import_react29.useCallback)(() => {
2885
+ const handleMouseEnter = (0, import_react30.useCallback)(() => {
2448
2886
  setActiveItem(itemIdRef.current);
2449
2887
  }, [setActiveItem]);
2450
- const handleMouseLeave = (0, import_react29.useCallback)(() => {
2888
+ const handleMouseLeave = (0, import_react30.useCallback)(() => {
2451
2889
  setActiveItem(null);
2452
2890
  }, [setActiveItem]);
2453
2891
  return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(NavigationMenuItemContext.Provider, { value: { itemId: itemIdRef.current }, children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
2454
2892
  "div",
2455
2893
  {
2456
2894
  ref,
2457
- className: (0, import_ui_utils28.cn)("relative", className),
2895
+ className: cn("relative", className),
2458
2896
  onMouseEnter: handleMouseEnter,
2459
2897
  onMouseLeave: handleMouseLeave,
2460
2898
  "data-state": isOpen ? "open" : "closed",
@@ -2464,13 +2902,13 @@ var NavigationMenuItem = (0, import_react29.forwardRef)(
2464
2902
  ) });
2465
2903
  }
2466
2904
  );
2467
- var NavigationMenuLink = (0, import_react29.forwardRef)(
2905
+ var NavigationMenuLink = (0, import_react30.forwardRef)(
2468
2906
  ({ className, active = false, children, ...props }, ref) => {
2469
2907
  return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
2470
2908
  "a",
2471
2909
  {
2472
2910
  ref,
2473
- className: (0, import_ui_utils28.cn)(
2911
+ className: cn(
2474
2912
  "inline-flex items-center rounded-md px-3 py-2 text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/30 focus-visible:ring-offset-1",
2475
2913
  active ? "bg-surface-3 text-text-primary" : "text-text-secondary hover:bg-surface-3 hover:text-text-primary",
2476
2914
  className
@@ -2481,7 +2919,7 @@ var NavigationMenuLink = (0, import_react29.forwardRef)(
2481
2919
  );
2482
2920
  }
2483
2921
  );
2484
- var NavigationMenuTrigger = (0, import_react29.forwardRef)(
2922
+ var NavigationMenuTrigger = (0, import_react30.forwardRef)(
2485
2923
  ({ className, children, ...props }, ref) => {
2486
2924
  const { activeItem } = useNavigationMenuContext();
2487
2925
  const { itemId } = useNavigationMenuItemContext();
@@ -2492,7 +2930,7 @@ var NavigationMenuTrigger = (0, import_react29.forwardRef)(
2492
2930
  ref,
2493
2931
  type: "button",
2494
2932
  "aria-expanded": isOpen,
2495
- className: (0, import_ui_utils28.cn)(
2933
+ className: cn(
2496
2934
  "inline-flex items-center gap-1 rounded-md px-3 py-2 text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/30 focus-visible:ring-offset-1",
2497
2935
  isOpen ? "bg-surface-3 text-text-primary" : "text-text-secondary hover:bg-surface-3 hover:text-text-primary",
2498
2936
  className
@@ -2501,10 +2939,10 @@ var NavigationMenuTrigger = (0, import_react29.forwardRef)(
2501
2939
  children: [
2502
2940
  children,
2503
2941
  /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
2504
- import_lucide_react12.ChevronDown,
2942
+ import_lucide_react14.ChevronDown,
2505
2943
  {
2506
2944
  size: 14,
2507
- className: (0, import_ui_utils28.cn)("transition-transform duration-200", isOpen && "rotate-180")
2945
+ className: cn("transition-transform duration-200", isOpen && "rotate-180")
2508
2946
  }
2509
2947
  )
2510
2948
  ]
@@ -2512,7 +2950,7 @@ var NavigationMenuTrigger = (0, import_react29.forwardRef)(
2512
2950
  );
2513
2951
  }
2514
2952
  );
2515
- var NavigationMenuContent = (0, import_react29.forwardRef)(
2953
+ var NavigationMenuContent = (0, import_react30.forwardRef)(
2516
2954
  ({ className, children, ...props }, ref) => {
2517
2955
  const { activeItem } = useNavigationMenuContext();
2518
2956
  const { itemId } = useNavigationMenuItemContext();
@@ -2522,7 +2960,7 @@ var NavigationMenuContent = (0, import_react29.forwardRef)(
2522
2960
  "div",
2523
2961
  {
2524
2962
  ref,
2525
- className: (0, import_ui_utils28.cn)(
2963
+ className: cn(
2526
2964
  "absolute left-0 top-full z-50 mt-1 min-w-40 rounded-md border border-border-base bg-surface-1 py-1 shadow-lg",
2527
2965
  className
2528
2966
  ),
@@ -2539,14 +2977,13 @@ NavigationMenuTrigger.displayName = "NavigationMenuTrigger";
2539
2977
  NavigationMenuContent.displayName = "NavigationMenuContent";
2540
2978
 
2541
2979
  // src/components/avatar.tsx
2542
- var import_react30 = require("react");
2543
- var import_lucide_react13 = require("lucide-react");
2980
+ var import_react31 = require("react");
2981
+ var import_lucide_react15 = require("lucide-react");
2544
2982
  var import_class_variance_authority8 = require("class-variance-authority");
2545
- var import_ui_utils29 = require("@ug666/ui-utils");
2546
2983
  var import_jsx_runtime29 = require("react/jsx-runtime");
2547
- var AvatarContext = (0, import_react30.createContext)(null);
2984
+ var AvatarContext = (0, import_react31.createContext)(null);
2548
2985
  function useAvatarContext(componentName) {
2549
- const ctx = (0, import_react30.useContext)(AvatarContext);
2986
+ const ctx = (0, import_react31.useContext)(AvatarContext);
2550
2987
  if (!ctx) {
2551
2988
  throw new Error(`<${componentName}> \u5FC5\u987B\u5728 <Avatar> \u5185\u4F7F\u7528`);
2552
2989
  }
@@ -2566,16 +3003,16 @@ var avatarVariants = (0, import_class_variance_authority8.cva)(
2566
3003
  defaultVariants: { size: "md" }
2567
3004
  }
2568
3005
  );
2569
- var Avatar = (0, import_react30.forwardRef)(
3006
+ var Avatar = (0, import_react31.forwardRef)(
2570
3007
  ({ size, className, children, ...props }, ref) => {
2571
- const [imageLoadingStatus, setImageLoadingStatus] = (0, import_react30.useState)("idle");
2572
- return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(AvatarContext.Provider, { value: { imageLoadingStatus, setImageLoadingStatus }, children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("span", { ref, className: (0, import_ui_utils29.cn)(avatarVariants({ size }), className), ...props, children }) });
3008
+ const [imageLoadingStatus, setImageLoadingStatus] = (0, import_react31.useState)("idle");
3009
+ return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(AvatarContext.Provider, { value: { imageLoadingStatus, setImageLoadingStatus }, children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("span", { ref, className: cn(avatarVariants({ size }), className), ...props, children }) });
2573
3010
  }
2574
3011
  );
2575
- var AvatarImage = (0, import_react30.forwardRef)(
3012
+ var AvatarImage = (0, import_react31.forwardRef)(
2576
3013
  ({ src, alt = "", className, onLoad, onError, ...props }, ref) => {
2577
3014
  const { imageLoadingStatus, setImageLoadingStatus } = useAvatarContext("AvatarImage");
2578
- (0, import_react30.useEffect)(() => {
3015
+ (0, import_react31.useEffect)(() => {
2579
3016
  if (!src) {
2580
3017
  setImageLoadingStatus("error");
2581
3018
  return;
@@ -2599,7 +3036,7 @@ var AvatarImage = (0, import_react30.forwardRef)(
2599
3036
  setImageLoadingStatus("error");
2600
3037
  onError?.(event);
2601
3038
  },
2602
- className: (0, import_ui_utils29.cn)(
3039
+ className: cn(
2603
3040
  "h-full w-full object-cover",
2604
3041
  imageLoadingStatus === "loading" && "invisible",
2605
3042
  className
@@ -2609,7 +3046,7 @@ var AvatarImage = (0, import_react30.forwardRef)(
2609
3046
  );
2610
3047
  }
2611
3048
  );
2612
- var AvatarFallback = (0, import_react30.forwardRef)(
3049
+ var AvatarFallback = (0, import_react31.forwardRef)(
2613
3050
  ({ className, children, ...props }, ref) => {
2614
3051
  const { imageLoadingStatus } = useAvatarContext("AvatarFallback");
2615
3052
  if (imageLoadingStatus === "loaded") return null;
@@ -2617,12 +3054,12 @@ var AvatarFallback = (0, import_react30.forwardRef)(
2617
3054
  "span",
2618
3055
  {
2619
3056
  ref,
2620
- className: (0, import_ui_utils29.cn)(
3057
+ className: cn(
2621
3058
  "absolute inset-0 flex items-center justify-center font-medium text-text-secondary",
2622
3059
  className
2623
3060
  ),
2624
3061
  ...props,
2625
- children: children ?? /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(import_lucide_react13.User, { size: 16 })
3062
+ children: children ?? /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(import_lucide_react15.User, { size: 16 })
2626
3063
  }
2627
3064
  );
2628
3065
  }
@@ -2632,8 +3069,7 @@ AvatarImage.displayName = "AvatarImage";
2632
3069
  AvatarFallback.displayName = "AvatarFallback";
2633
3070
 
2634
3071
  // src/components/avatar-group.tsx
2635
- var import_react31 = require("react");
2636
- var import_ui_utils30 = require("@ug666/ui-utils");
3072
+ var import_react32 = require("react");
2637
3073
  var import_jsx_runtime30 = require("react/jsx-runtime");
2638
3074
  var SIZE_CLASSES = {
2639
3075
  sm: "h-8 w-8 text-xs",
@@ -2646,27 +3082,27 @@ var RING_SIZE_CLASSES = {
2646
3082
  lg: "ring-[3px]"
2647
3083
  };
2648
3084
  var OVERLAP_CLASSES = {
2649
- sm: "-ml-2",
2650
- default: "-ml-3",
2651
- lg: "-ml-4"
3085
+ sm: "-ml-1.5",
3086
+ default: "-ml-2",
3087
+ lg: "-ml-3"
2652
3088
  };
2653
- var AvatarGroup = (0, import_react31.forwardRef)(
3089
+ var AvatarGroup = (0, import_react32.forwardRef)(
2654
3090
  ({ max = 5, size = "default", className, children, ...props }, ref) => {
2655
- const allItems = import_react31.Children.toArray(children).filter(import_react31.isValidElement);
3091
+ const allItems = import_react32.Children.toArray(children).filter(import_react32.isValidElement);
2656
3092
  const visibleItems = allItems.slice(0, max);
2657
3093
  const overflowCount = allItems.length - max;
2658
3094
  return /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(
2659
3095
  "div",
2660
3096
  {
2661
3097
  ref,
2662
- className: (0, import_ui_utils30.cn)("flex items-center", className),
3098
+ className: cn("flex max-w-full items-center overflow-hidden py-0.5", className),
2663
3099
  ...props,
2664
3100
  children: [
2665
3101
  visibleItems.map((child, idx) => /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
2666
3102
  "span",
2667
3103
  {
2668
- className: (0, import_ui_utils30.cn)(
2669
- "relative inline-flex shrink-0 overflow-hidden rounded-full ring-surface-1",
3104
+ className: cn(
3105
+ "relative inline-flex shrink-0 overflow-hidden rounded-full border border-border-base bg-surface-2 ring-surface-1",
2670
3106
  SIZE_CLASSES[size],
2671
3107
  RING_SIZE_CLASSES[size],
2672
3108
  idx > 0 && OVERLAP_CLASSES[size]
@@ -2678,8 +3114,8 @@ var AvatarGroup = (0, import_react31.forwardRef)(
2678
3114
  overflowCount > 0 && /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(
2679
3115
  "span",
2680
3116
  {
2681
- className: (0, import_ui_utils30.cn)(
2682
- "relative inline-flex shrink-0 items-center justify-center rounded-full bg-surface-3 font-medium text-text-secondary ring-surface-1",
3117
+ className: cn(
3118
+ "relative inline-flex shrink-0 items-center justify-center rounded-full border border-border-base bg-surface-2 font-medium text-text-secondary ring-surface-1",
2683
3119
  SIZE_CLASSES[size],
2684
3120
  RING_SIZE_CLASSES[size],
2685
3121
  OVERLAP_CLASSES[size]
@@ -2699,11 +3135,10 @@ var AvatarGroup = (0, import_react31.forwardRef)(
2699
3135
  AvatarGroup.displayName = "AvatarGroup";
2700
3136
 
2701
3137
  // src/components/tooltip.tsx
2702
- var import_react32 = require("react");
3138
+ var import_react33 = require("react");
2703
3139
  var import_react_dom8 = require("react-dom");
2704
- var import_ui_utils31 = require("@ug666/ui-utils");
2705
3140
  var import_jsx_runtime31 = require("react/jsx-runtime");
2706
- var TooltipContext = (0, import_react32.createContext)(null);
3141
+ var TooltipContext = (0, import_react33.createContext)(null);
2707
3142
  function assignRef4(ref, value) {
2708
3143
  if (typeof ref === "function") {
2709
3144
  ref(value);
@@ -2714,26 +3149,26 @@ function assignRef4(ref, value) {
2714
3149
  }
2715
3150
  }
2716
3151
  function useTooltipContext() {
2717
- const ctx = (0, import_react32.useContext)(TooltipContext);
3152
+ const ctx = (0, import_react33.useContext)(TooltipContext);
2718
3153
  if (!ctx) throw new Error("Tooltip \u5B50\u7EC4\u4EF6\u5FC5\u987B\u5728 <Tooltip> \u5185\u4F7F\u7528");
2719
3154
  return ctx;
2720
3155
  }
2721
- var Tooltip = (0, import_react32.forwardRef)(({ children, className }, ref) => {
2722
- const [open, setOpen] = (0, import_react32.useState)(false);
2723
- const triggerRef = (0, import_react32.useRef)(null);
2724
- const delayRef = (0, import_react32.useRef)(null);
2725
- (0, import_react32.useEffect)(() => {
3156
+ var Tooltip = (0, import_react33.forwardRef)(({ children, className }, ref) => {
3157
+ const [open, setOpen] = (0, import_react33.useState)(false);
3158
+ const triggerRef = (0, import_react33.useRef)(null);
3159
+ const delayRef = (0, import_react33.useRef)(null);
3160
+ (0, import_react33.useEffect)(() => {
2726
3161
  return () => {
2727
3162
  if (delayRef.current) {
2728
3163
  clearTimeout(delayRef.current);
2729
3164
  }
2730
3165
  };
2731
3166
  }, []);
2732
- return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(TooltipContext.Provider, { value: { open, setOpen, triggerRef, delayRef }, children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("span", { ref, className: (0, import_ui_utils31.cn)("relative inline-flex", className), children }) });
3167
+ return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(TooltipContext.Provider, { value: { open, setOpen, triggerRef, delayRef }, children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("span", { ref, className: cn("relative inline-flex", className), children }) });
2733
3168
  });
2734
- var TooltipTrigger = (0, import_react32.forwardRef)(({ children, className }, ref) => {
3169
+ var TooltipTrigger = (0, import_react33.forwardRef)(({ children, className }, ref) => {
2735
3170
  const { setOpen, triggerRef, delayRef } = useTooltipContext();
2736
- const handleRef = (0, import_react32.useCallback)(
3171
+ const handleRef = (0, import_react33.useCallback)(
2737
3172
  (node) => {
2738
3173
  triggerRef.current = node;
2739
3174
  assignRef4(ref, node);
@@ -2751,7 +3186,7 @@ var TooltipTrigger = (0, import_react32.forwardRef)(({ children, className }, re
2751
3186
  "span",
2752
3187
  {
2753
3188
  ref: handleRef,
2754
- className: (0, import_ui_utils31.cn)("inline-flex", className),
3189
+ className: cn("inline-flex", className),
2755
3190
  onMouseEnter: handleMouseEnter,
2756
3191
  onMouseLeave: handleMouseLeave,
2757
3192
  children
@@ -2764,18 +3199,19 @@ var arrowPositionClasses = {
2764
3199
  left: "after:absolute after:left-full after:top-1/2 after:-translate-y-1/2 after:border-4 after:border-transparent after:border-l-text-primary",
2765
3200
  right: "after:absolute after:right-full after:top-1/2 after:-translate-y-1/2 after:border-4 after:border-transparent after:border-r-text-primary"
2766
3201
  };
2767
- var TooltipContent = (0, import_react32.forwardRef)(({ children, side = "top", className }, ref) => {
3202
+ var TooltipContent = (0, import_react33.forwardRef)(({ children, side = "top", className }, ref) => {
2768
3203
  const { open, triggerRef } = useTooltipContext();
2769
- const contentRef = (0, import_react32.useRef)(null);
2770
- const [pos, setPos] = (0, import_react32.useState)({ top: 0, left: 0 });
2771
- const handleRef = (0, import_react32.useCallback)(
3204
+ const contentRef = (0, import_react33.useRef)(null);
3205
+ const portalContainer = usePortalContainer();
3206
+ const [pos, setPos] = (0, import_react33.useState)({ top: 0, left: 0 });
3207
+ const handleRef = (0, import_react33.useCallback)(
2772
3208
  (node) => {
2773
3209
  contentRef.current = node;
2774
3210
  assignRef4(ref, node);
2775
3211
  },
2776
3212
  [ref]
2777
3213
  );
2778
- const updatePos = (0, import_react32.useCallback)(() => {
3214
+ const updatePos = (0, import_react33.useCallback)(() => {
2779
3215
  if (!triggerRef.current || !contentRef.current) return;
2780
3216
  const rect = triggerRef.current.getBoundingClientRect();
2781
3217
  const cw = contentRef.current.offsetWidth;
@@ -2798,17 +3234,17 @@ var TooltipContent = (0, import_react32.forwardRef)(({ children, side = "top", c
2798
3234
  }
2799
3235
  setPos({ top, left });
2800
3236
  }, [side, triggerRef]);
2801
- (0, import_react32.useEffect)(() => {
3237
+ (0, import_react33.useEffect)(() => {
2802
3238
  if (open) updatePos();
2803
3239
  }, [open, updatePos]);
2804
- if (!open) return null;
3240
+ if (!open || !portalContainer) return null;
2805
3241
  return (0, import_react_dom8.createPortal)(
2806
3242
  /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
2807
3243
  "div",
2808
3244
  {
2809
3245
  ref: handleRef,
2810
3246
  style: { top: pos.top, left: pos.left },
2811
- className: (0, import_ui_utils31.cn)(
3247
+ className: cn(
2812
3248
  "absolute z-50 rounded-md bg-text-primary px-2.5 py-1.5 text-xs text-surface-1 shadow-md",
2813
3249
  arrowPositionClasses[side],
2814
3250
  className
@@ -2816,7 +3252,7 @@ var TooltipContent = (0, import_react32.forwardRef)(({ children, side = "top", c
2816
3252
  children
2817
3253
  }
2818
3254
  ),
2819
- document.body
3255
+ portalContainer
2820
3256
  );
2821
3257
  });
2822
3258
  Tooltip.displayName = "Tooltip";
@@ -2824,10 +3260,9 @@ TooltipTrigger.displayName = "TooltipTrigger";
2824
3260
  TooltipContent.displayName = "TooltipContent";
2825
3261
 
2826
3262
  // src/components/alert.tsx
2827
- var import_react33 = require("react");
2828
- var import_lucide_react14 = require("lucide-react");
3263
+ var import_react34 = require("react");
3264
+ var import_lucide_react16 = require("lucide-react");
2829
3265
  var import_class_variance_authority9 = require("class-variance-authority");
2830
- var import_ui_utils32 = require("@ug666/ui-utils");
2831
3266
  var import_jsx_runtime32 = require("react/jsx-runtime");
2832
3267
  var alertVariants = (0, import_class_variance_authority9.cva)(
2833
3268
  "relative flex gap-3 rounded-md border-l-4 p-4",
@@ -2845,11 +3280,11 @@ var alertVariants = (0, import_class_variance_authority9.cva)(
2845
3280
  }
2846
3281
  );
2847
3282
  var iconMap = {
2848
- default: import_lucide_react14.AlertCircle,
2849
- info: import_lucide_react14.Info,
2850
- success: import_lucide_react14.CheckCircle,
2851
- warning: import_lucide_react14.AlertTriangle,
2852
- destructive: import_lucide_react14.AlertCircle
3283
+ default: import_lucide_react16.AlertCircle,
3284
+ info: import_lucide_react16.Info,
3285
+ success: import_lucide_react16.CheckCircle,
3286
+ warning: import_lucide_react16.AlertTriangle,
3287
+ destructive: import_lucide_react16.AlertCircle
2853
3288
  };
2854
3289
  var iconColorMap = {
2855
3290
  default: "text-info",
@@ -2858,7 +3293,7 @@ var iconColorMap = {
2858
3293
  warning: "text-warning",
2859
3294
  destructive: "text-danger"
2860
3295
  };
2861
- var Alert = (0, import_react33.forwardRef)(
3296
+ var Alert = (0, import_react34.forwardRef)(
2862
3297
  ({ variant = "default", className, children, ...props }, ref) => {
2863
3298
  const Icon = iconMap[variant ?? "default"];
2864
3299
  const iconColor = iconColorMap[variant ?? "default"];
@@ -2867,55 +3302,54 @@ var Alert = (0, import_react33.forwardRef)(
2867
3302
  {
2868
3303
  ref,
2869
3304
  role: "alert",
2870
- className: (0, import_ui_utils32.cn)(alertVariants({ variant }), className),
3305
+ className: cn(alertVariants({ variant }), className),
2871
3306
  ...props,
2872
3307
  children: [
2873
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(Icon, { size: 18, className: (0, import_ui_utils32.cn)("mt-0.5 shrink-0", iconColor) }),
3308
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(Icon, { size: 18, className: cn("mt-0.5 shrink-0", iconColor) }),
2874
3309
  /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { className: "flex flex-col gap-0.5", children })
2875
3310
  ]
2876
3311
  }
2877
3312
  );
2878
3313
  }
2879
3314
  );
2880
- var AlertTitle = (0, import_react33.forwardRef)(({ className, ...props }, ref) => {
2881
- return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("p", { ref, className: (0, import_ui_utils32.cn)("text-sm font-semibold leading-5", className), ...props });
3315
+ var AlertTitle = (0, import_react34.forwardRef)(({ className, ...props }, ref) => {
3316
+ return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("p", { ref, className: cn("text-sm font-semibold leading-5", className), ...props });
2882
3317
  });
2883
- var AlertDescription = (0, import_react33.forwardRef)(({ className, ...props }, ref) => {
2884
- return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("p", { ref, className: (0, import_ui_utils32.cn)("text-sm leading-5 opacity-90", className), ...props });
3318
+ var AlertDescription = (0, import_react34.forwardRef)(({ className, ...props }, ref) => {
3319
+ return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("p", { ref, className: cn("text-sm leading-5 opacity-90", className), ...props });
2885
3320
  });
2886
3321
  Alert.displayName = "Alert";
2887
3322
  AlertTitle.displayName = "AlertTitle";
2888
3323
  AlertDescription.displayName = "AlertDescription";
2889
3324
 
2890
3325
  // src/components/breadcrumb.tsx
2891
- var import_react34 = require("react");
2892
- var import_lucide_react15 = require("lucide-react");
2893
- var import_ui_utils33 = require("@ug666/ui-utils");
3326
+ var import_react35 = require("react");
3327
+ var import_lucide_react17 = require("lucide-react");
2894
3328
  var import_jsx_runtime33 = require("react/jsx-runtime");
2895
- var Breadcrumb = (0, import_react34.forwardRef)(({ className, children, ...props }, ref) => {
2896
- return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("nav", { ref, "aria-label": "\u9762\u5305\u5C51\u5BFC\u822A", className: (0, import_ui_utils33.cn)(className), ...props, children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("ol", { className: "flex flex-wrap items-center gap-0 text-sm text-text-secondary", children }) });
3329
+ var Breadcrumb = (0, import_react35.forwardRef)(({ className, children, ...props }, ref) => {
3330
+ return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("nav", { ref, "aria-label": "\u9762\u5305\u5C51\u5BFC\u822A", className: cn(className), ...props, children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("ol", { className: "flex flex-wrap items-center gap-0 text-sm text-text-secondary", children }) });
2897
3331
  });
2898
- var BreadcrumbItem = (0, import_react34.forwardRef)(({ className, ...props }, ref) => {
2899
- return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("li", { ref, className: (0, import_ui_utils33.cn)("flex items-center gap-1", className), ...props });
3332
+ var BreadcrumbItem = (0, import_react35.forwardRef)(({ className, ...props }, ref) => {
3333
+ return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("li", { ref, className: cn("flex items-center gap-1", className), ...props });
2900
3334
  });
2901
- var BreadcrumbLink = (0, import_react34.forwardRef)(
3335
+ var BreadcrumbLink = (0, import_react35.forwardRef)(
2902
3336
  ({ current = false, className, children, href, ...props }, ref) => {
2903
3337
  if (current) {
2904
- return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("span", { "aria-current": "page", className: (0, import_ui_utils33.cn)("font-medium text-text-primary", className), children });
3338
+ return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("span", { "aria-current": "page", className: cn("font-medium text-text-primary", className), children });
2905
3339
  }
2906
3340
  return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
2907
3341
  "a",
2908
3342
  {
2909
3343
  ref,
2910
3344
  href,
2911
- className: (0, import_ui_utils33.cn)("transition-colors hover:text-text-primary", className),
3345
+ className: cn("transition-colors hover:text-text-primary", className),
2912
3346
  ...props,
2913
3347
  children
2914
3348
  }
2915
3349
  );
2916
3350
  }
2917
3351
  );
2918
- var BreadcrumbSeparator = (0, import_react34.forwardRef)(
3352
+ var BreadcrumbSeparator = (0, import_react35.forwardRef)(
2919
3353
  ({ className, children, ...props }, ref) => {
2920
3354
  return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
2921
3355
  "li",
@@ -2923,9 +3357,9 @@ var BreadcrumbSeparator = (0, import_react34.forwardRef)(
2923
3357
  ref,
2924
3358
  role: "presentation",
2925
3359
  "aria-hidden": "true",
2926
- className: (0, import_ui_utils33.cn)("text-text-tertiary", className),
3360
+ className: cn("text-text-tertiary", className),
2927
3361
  ...props,
2928
- children: children ?? /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_lucide_react15.ChevronRight, { size: 14 })
3362
+ children: children ?? /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_lucide_react17.ChevronRight, { size: 14 })
2929
3363
  }
2930
3364
  );
2931
3365
  }
@@ -2936,10 +3370,9 @@ BreadcrumbLink.displayName = "BreadcrumbLink";
2936
3370
  BreadcrumbSeparator.displayName = "BreadcrumbSeparator";
2937
3371
 
2938
3372
  // src/components/switch.tsx
2939
- var import_react35 = require("react");
2940
- var import_ui_utils34 = require("@ug666/ui-utils");
3373
+ var import_react36 = require("react");
2941
3374
  var import_jsx_runtime34 = require("react/jsx-runtime");
2942
- var Switch = (0, import_react35.forwardRef)(
3375
+ var Switch = (0, import_react36.forwardRef)(
2943
3376
  ({
2944
3377
  checked,
2945
3378
  onCheckedChange,
@@ -2950,7 +3383,7 @@ var Switch = (0, import_react35.forwardRef)(
2950
3383
  id,
2951
3384
  ...props
2952
3385
  }, ref) => {
2953
- const generatedId = (0, import_react35.useId)();
3386
+ const generatedId = (0, import_react36.useId)();
2954
3387
  const switchId = id ?? generatedId;
2955
3388
  const track = /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
2956
3389
  "button",
@@ -2962,19 +3395,19 @@ var Switch = (0, import_react35.forwardRef)(
2962
3395
  "aria-checked": checked,
2963
3396
  disabled,
2964
3397
  onClick: () => !disabled && onCheckedChange(!checked),
2965
- className: (0, import_ui_utils34.cn)(
2966
- "relative inline-flex h-6 w-11 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent transition-colors duration-200",
2967
- "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",
3398
+ className: cn(
3399
+ "relative inline-flex h-6 w-11 shrink-0 cursor-pointer items-center rounded-full border border-transparent p-0.5 shadow-sm transition-colors duration-200",
3400
+ "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/35 focus-visible:ring-offset-2 focus-visible:ring-offset-surface-0",
2968
3401
  "disabled:cursor-not-allowed disabled:opacity-50",
2969
- checked ? "bg-primary" : "bg-surface-3",
3402
+ checked ? "bg-primary hover:bg-primary-hover" : "bg-surface-3 hover:bg-border-strong",
2970
3403
  className
2971
3404
  ),
2972
3405
  ...props,
2973
3406
  children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
2974
3407
  "span",
2975
3408
  {
2976
- className: (0, import_ui_utils34.cn)(
2977
- "pointer-events-none block h-5 w-5 rounded-full bg-white shadow-sm ring-0 transition-transform duration-200",
3409
+ className: cn(
3410
+ "pointer-events-none block h-5 w-5 rounded-full bg-primary-fg shadow-md ring-0 transition-transform duration-200",
2978
3411
  checked ? "translate-x-5" : "translate-x-0"
2979
3412
  )
2980
3413
  }
@@ -2986,14 +3419,14 @@ var Switch = (0, import_react35.forwardRef)(
2986
3419
  "label",
2987
3420
  {
2988
3421
  htmlFor: switchId,
2989
- className: (0, import_ui_utils34.cn)(
2990
- "inline-flex items-center gap-2 cursor-pointer",
3422
+ className: cn(
3423
+ "inline-flex cursor-pointer items-center gap-2.5 text-sm font-medium leading-5 text-text-primary",
2991
3424
  disabled && "cursor-not-allowed opacity-50"
2992
3425
  ),
2993
3426
  children: [
2994
- labelPlacement === "left" && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("span", { className: "text-sm font-medium text-text-primary", children: label }),
3427
+ labelPlacement === "left" && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("span", { children: label }),
2995
3428
  track,
2996
- labelPlacement === "right" && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("span", { className: "text-sm font-medium text-text-primary", children: label })
3429
+ labelPlacement === "right" && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("span", { children: label })
2997
3430
  ]
2998
3431
  }
2999
3432
  );
@@ -3002,12 +3435,11 @@ var Switch = (0, import_react35.forwardRef)(
3002
3435
  Switch.displayName = "Switch";
3003
3436
 
3004
3437
  // src/components/textarea.tsx
3005
- var import_react36 = require("react");
3006
- var import_ui_utils35 = require("@ug666/ui-utils");
3438
+ var import_react37 = require("react");
3007
3439
  var import_jsx_runtime35 = require("react/jsx-runtime");
3008
- var Textarea = (0, import_react36.forwardRef)(
3440
+ var Textarea = (0, import_react37.forwardRef)(
3009
3441
  ({ className, label, error, helperText, id, rows = 3, ...props }, ref) => {
3010
- const generatedId = (0, import_react36.useId)();
3442
+ const generatedId = (0, import_react37.useId)();
3011
3443
  const textareaId = id ?? generatedId;
3012
3444
  return /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: "flex flex-col gap-1", children: [
3013
3445
  label && /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("label", { htmlFor: textareaId, className: "text-sm font-medium text-text-primary", children: label }),
@@ -3017,7 +3449,7 @@ var Textarea = (0, import_react36.forwardRef)(
3017
3449
  ref,
3018
3450
  id: textareaId,
3019
3451
  rows,
3020
- className: (0, import_ui_utils35.cn)(
3452
+ className: cn(
3021
3453
  "w-full rounded-md border bg-surface-1 px-3 py-2 text-sm text-text-primary placeholder:text-text-tertiary",
3022
3454
  "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-offset-1",
3023
3455
  "disabled:cursor-not-allowed disabled:opacity-50",
@@ -3036,9 +3468,8 @@ var Textarea = (0, import_react36.forwardRef)(
3036
3468
  Textarea.displayName = "Textarea";
3037
3469
 
3038
3470
  // src/components/skeleton.tsx
3039
- var import_react37 = require("react");
3471
+ var import_react38 = require("react");
3040
3472
  var import_class_variance_authority10 = require("class-variance-authority");
3041
- var import_ui_utils36 = require("@ug666/ui-utils");
3042
3473
  var import_jsx_runtime36 = require("react/jsx-runtime");
3043
3474
  var skeletonVariants = (0, import_class_variance_authority10.cva)(
3044
3475
  "animate-pulse bg-surface-3",
@@ -3053,26 +3484,32 @@ var skeletonVariants = (0, import_class_variance_authority10.cva)(
3053
3484
  defaultVariants: { variant: "rect" }
3054
3485
  }
3055
3486
  );
3056
- var Skeleton = (0, import_react37.forwardRef)(({ variant, className, ...props }, ref) => {
3057
- return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("div", { ref, className: (0, import_ui_utils36.cn)(skeletonVariants({ variant }), className), "aria-hidden": "true", ...props });
3487
+ var Skeleton = (0, import_react38.forwardRef)(({ variant, className, ...props }, ref) => {
3488
+ return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("div", { ref, className: cn(skeletonVariants({ variant }), className), "aria-hidden": "true", ...props });
3058
3489
  });
3059
3490
  Skeleton.displayName = "Skeleton";
3060
3491
 
3061
3492
  // src/components/progress.tsx
3062
- var import_react38 = require("react");
3063
- var import_ui_utils37 = require("@ug666/ui-utils");
3493
+ var import_react39 = require("react");
3064
3494
  var import_jsx_runtime37 = require("react/jsx-runtime");
3065
- var Progress = (0, import_react38.forwardRef)(({
3495
+ var progressColorClasses = {
3496
+ primary: "bg-primary",
3497
+ success: "bg-success",
3498
+ warning: "bg-warning",
3499
+ danger: "bg-danger",
3500
+ info: "bg-info"
3501
+ };
3502
+ var Progress = (0, import_react39.forwardRef)(({
3066
3503
  value,
3067
3504
  max = 100,
3068
3505
  showLabel = false,
3069
- color = "bg-indigo-500",
3506
+ color = "primary",
3070
3507
  className,
3071
3508
  ...props
3072
3509
  }, ref) => {
3073
3510
  const clamped = Math.min(Math.max(value, 0), max);
3074
3511
  const percent = Math.round(clamped / max * 100);
3075
- return /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { ref, className: (0, import_ui_utils37.cn)("flex items-center gap-3", className), ...props, children: [
3512
+ return /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { ref, className: cn("flex items-center gap-3", className), ...props, children: [
3076
3513
  /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
3077
3514
  "div",
3078
3515
  {
@@ -3084,7 +3521,7 @@ var Progress = (0, import_react38.forwardRef)(({
3084
3521
  children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
3085
3522
  "div",
3086
3523
  {
3087
- className: (0, import_ui_utils37.cn)("h-full rounded-full transition-all duration-500 ease-out", color),
3524
+ className: cn("h-full rounded-full transition-all duration-500 ease-out", progressColorClasses[color]),
3088
3525
  style: { width: `${percent}%` }
3089
3526
  }
3090
3527
  )
@@ -3099,14 +3536,14 @@ var Progress = (0, import_react38.forwardRef)(({
3099
3536
  Progress.displayName = "Progress";
3100
3537
 
3101
3538
  // src/components/sheet.tsx
3102
- var import_react39 = require("react");
3539
+ var import_react40 = require("react");
3103
3540
  var import_react_dom9 = require("react-dom");
3104
- var import_lucide_react16 = require("lucide-react");
3105
- var import_ui_utils38 = require("@ug666/ui-utils");
3541
+ var import_lucide_react18 = require("lucide-react");
3106
3542
  var import_jsx_runtime38 = require("react/jsx-runtime");
3107
- var Sheet = (0, import_react39.forwardRef)(({ open, onClose, side = "right", title, children, className }, ref) => {
3543
+ var Sheet = (0, import_react40.forwardRef)(({ open, onClose, side = "right", title, children, className }, ref) => {
3108
3544
  useEscapeKey(open, onClose);
3109
- if (!open) return null;
3545
+ const portalContainer = usePortalContainer();
3546
+ if (!open || !portalContainer) return null;
3110
3547
  return (0, import_react_dom9.createPortal)(
3111
3548
  /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: "fixed inset-0 z-50 flex", role: "dialog", "aria-modal": "true", children: [
3112
3549
  /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
@@ -3121,7 +3558,7 @@ var Sheet = (0, import_react39.forwardRef)(({ open, onClose, side = "right", tit
3121
3558
  "div",
3122
3559
  {
3123
3560
  ref,
3124
- className: (0, import_ui_utils38.cn)(
3561
+ className: cn(
3125
3562
  "relative flex h-full w-80 max-w-full flex-col bg-surface-1 shadow-xl",
3126
3563
  "transition-transform duration-300 ease-in-out",
3127
3564
  side === "right" ? "ml-auto translate-x-0" : "mr-auto translate-x-0",
@@ -3137,7 +3574,7 @@ var Sheet = (0, import_react39.forwardRef)(({ open, onClose, side = "right", tit
3137
3574
  onClick: onClose,
3138
3575
  className: "rounded-md p-1 text-text-tertiary hover:bg-surface-3 hover:text-text-secondary transition-colors",
3139
3576
  "aria-label": "\u5173\u95ED",
3140
- children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(import_lucide_react16.X, { size: 18 })
3577
+ children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(import_lucide_react18.X, { size: 18 })
3141
3578
  }
3142
3579
  )
3143
3580
  ] }),
@@ -3146,22 +3583,21 @@ var Sheet = (0, import_react39.forwardRef)(({ open, onClose, side = "right", tit
3146
3583
  }
3147
3584
  )
3148
3585
  ] }),
3149
- document.body
3586
+ portalContainer
3150
3587
  );
3151
3588
  });
3152
3589
  Sheet.displayName = "Sheet";
3153
3590
 
3154
3591
  // src/components/empty-state.tsx
3155
- var import_react40 = require("react");
3156
- var import_ui_utils39 = require("@ug666/ui-utils");
3592
+ var import_react41 = require("react");
3157
3593
  var import_jsx_runtime39 = require("react/jsx-runtime");
3158
- var EmptyState = (0, import_react40.forwardRef)(
3594
+ var EmptyState = (0, import_react41.forwardRef)(
3159
3595
  ({ icon: Icon, title, description, action, className, ...props }, ref) => {
3160
3596
  return /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)(
3161
3597
  "div",
3162
3598
  {
3163
3599
  ref,
3164
- className: (0, import_ui_utils39.cn)(
3600
+ className: cn(
3165
3601
  "flex flex-col items-center justify-center gap-3 py-16 text-center",
3166
3602
  className
3167
3603
  ),
@@ -3181,14 +3617,13 @@ var EmptyState = (0, import_react40.forwardRef)(
3181
3617
  EmptyState.displayName = "EmptyState";
3182
3618
 
3183
3619
  // src/components/separator.tsx
3184
- var import_react41 = require("react");
3185
- var import_ui_utils40 = require("@ug666/ui-utils");
3620
+ var import_react42 = require("react");
3186
3621
  var import_jsx_runtime40 = require("react/jsx-runtime");
3187
3622
  var ORIENTATION_CLASSES = {
3188
3623
  horizontal: "h-px w-full bg-border-base",
3189
3624
  vertical: "w-px h-full bg-border-base"
3190
3625
  };
3191
- var Separator = (0, import_react41.forwardRef)(
3626
+ var Separator = (0, import_react42.forwardRef)(
3192
3627
  ({ orientation = "horizontal", className, ...props }, ref) => {
3193
3628
  return /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
3194
3629
  "div",
@@ -3196,7 +3631,7 @@ var Separator = (0, import_react41.forwardRef)(
3196
3631
  ref,
3197
3632
  role: "separator",
3198
3633
  "aria-orientation": orientation,
3199
- className: (0, import_ui_utils40.cn)(ORIENTATION_CLASSES[orientation], className),
3634
+ className: cn(ORIENTATION_CLASSES[orientation], className),
3200
3635
  ...props
3201
3636
  }
3202
3637
  );
@@ -3205,20 +3640,19 @@ var Separator = (0, import_react41.forwardRef)(
3205
3640
  Separator.displayName = "Separator";
3206
3641
 
3207
3642
  // src/components/descriptions.tsx
3208
- var import_react42 = require("react");
3209
- var import_ui_utils41 = require("@ug666/ui-utils");
3643
+ var import_react43 = require("react");
3210
3644
  var import_jsx_runtime41 = require("react/jsx-runtime");
3211
3645
  var SIZE_LABEL_CLASSES = {
3212
- sm: "text-xs py-1 px-2",
3213
- default: "text-sm py-2 px-3",
3214
- lg: "text-base py-3 px-4"
3646
+ sm: "px-3 py-2 text-xs",
3647
+ default: "px-3.5 py-2.5 text-sm",
3648
+ lg: "px-4 py-3 text-base"
3215
3649
  };
3216
3650
  var SIZE_VALUE_CLASSES = {
3217
- sm: "text-xs py-1 px-2",
3218
- default: "text-sm py-2 px-3",
3219
- lg: "text-base py-3 px-4"
3651
+ sm: "px-3 py-2 text-xs",
3652
+ default: "px-3.5 py-2.5 text-sm",
3653
+ lg: "px-4 py-3 text-base"
3220
3654
  };
3221
- var DescriptionsItem = (0, import_react42.forwardRef)(
3655
+ var DescriptionsItem = (0, import_react43.forwardRef)(
3222
3656
  ({ label, children, className, span: _span, ...props }, ref) => {
3223
3657
  return /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("div", { ref, className, ...props, children: [
3224
3658
  /* @__PURE__ */ (0, import_jsx_runtime41.jsx)("span", { className: "text-text-secondary", children: label }),
@@ -3227,10 +3661,10 @@ var DescriptionsItem = (0, import_react42.forwardRef)(
3227
3661
  }
3228
3662
  );
3229
3663
  DescriptionsItem.displayName = "DescriptionsItem";
3230
- var Descriptions = (0, import_react42.forwardRef)(
3664
+ var Descriptions = (0, import_react43.forwardRef)(
3231
3665
  ({ column = 2, bordered = false, size = "default", title, className, children, ...props }, ref) => {
3232
- const items = import_react42.Children.toArray(children).filter(
3233
- (child) => (0, import_react42.isValidElement)(child) && child.type.displayName === "DescriptionsItem"
3666
+ const items = import_react43.Children.toArray(children).filter(
3667
+ (child) => (0, import_react43.isValidElement)(child) && child.type.displayName === "DescriptionsItem"
3234
3668
  );
3235
3669
  if (bordered) {
3236
3670
  const rows = [];
@@ -3247,34 +3681,38 @@ var Descriptions = (0, import_react42.forwardRef)(
3247
3681
  currentColCount += span;
3248
3682
  }
3249
3683
  if (currentRow.length > 0) rows.push(currentRow);
3250
- return /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("div", { ref, className: (0, import_ui_utils41.cn)("w-full", className), ...props, children: [
3684
+ const labelColumnWidth = column === 1 ? "34%" : `${Math.max(12, 100 / (column * 2))}%`;
3685
+ return /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("div", { ref, className: cn("w-full", className), ...props, children: [
3251
3686
  title && /* @__PURE__ */ (0, import_jsx_runtime41.jsx)("div", { className: "mb-3 text-base font-semibold text-text-primary", children: title }),
3252
- /* @__PURE__ */ (0, import_jsx_runtime41.jsx)("table", { className: "w-full border-collapse border border-border-base", children: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)("tbody", { children: rows.map((row, rowIdx) => /* @__PURE__ */ (0, import_jsx_runtime41.jsx)("tr", { children: row.map((cell, cellIdx) => /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)(import_jsx_runtime41.Fragment, { children: [
3253
- /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
3254
- "td",
3255
- {
3256
- className: (0, import_ui_utils41.cn)(
3257
- "border border-border-base bg-surface-2 font-medium text-text-secondary",
3258
- SIZE_LABEL_CLASSES[size]
3259
- ),
3260
- style: { width: `${1 / (column * 2) * 100}%` },
3261
- children: cell.label
3262
- },
3263
- `label-${cellIdx}`
3264
- ),
3265
- /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
3266
- "td",
3267
- {
3268
- className: (0, import_ui_utils41.cn)(
3269
- "border border-border-base text-text-primary",
3270
- SIZE_VALUE_CLASSES[size]
3271
- ),
3272
- colSpan: cell.span > 1 ? cell.span * 2 - 1 : 1,
3273
- children: cell.value
3274
- },
3275
- `value-${cellIdx}`
3276
- )
3277
- ] })) }, rowIdx)) }) })
3687
+ /* @__PURE__ */ (0, import_jsx_runtime41.jsx)("div", { className: "overflow-hidden rounded-lg border border-border-base bg-surface-1", children: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)("table", { className: "w-full table-fixed border-separate border-spacing-0", children: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)("tbody", { children: rows.map((row, rowIdx) => /* @__PURE__ */ (0, import_jsx_runtime41.jsx)("tr", { children: row.map((cell, cellIdx) => {
3688
+ const hasRowDivider = rowIdx < rows.length - 1;
3689
+ return /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)(import_react43.Fragment, { children: [
3690
+ /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
3691
+ "td",
3692
+ {
3693
+ className: cn(
3694
+ "border-r border-border-base bg-surface-2/80 font-medium text-text-secondary",
3695
+ hasRowDivider && "border-b",
3696
+ SIZE_LABEL_CLASSES[size]
3697
+ ),
3698
+ style: { width: labelColumnWidth },
3699
+ children: cell.label
3700
+ }
3701
+ ),
3702
+ /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
3703
+ "td",
3704
+ {
3705
+ className: cn(
3706
+ "break-words font-medium text-text-primary",
3707
+ hasRowDivider && "border-b border-border-base",
3708
+ SIZE_VALUE_CLASSES[size]
3709
+ ),
3710
+ colSpan: cell.span > 1 ? cell.span * 2 - 1 : 1,
3711
+ children: cell.value
3712
+ }
3713
+ )
3714
+ ] }, `${rowIdx}-${cellIdx}`);
3715
+ }) }, rowIdx)) }) }) })
3278
3716
  ] });
3279
3717
  }
3280
3718
  const GRID_COLS = {
@@ -3283,14 +3721,14 @@ var Descriptions = (0, import_react42.forwardRef)(
3283
3721
  3: "grid-cols-3",
3284
3722
  4: "grid-cols-4"
3285
3723
  };
3286
- return /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("div", { ref, className: (0, import_ui_utils41.cn)("w-full", className), ...props, children: [
3724
+ return /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("div", { ref, className: cn("w-full", className), ...props, children: [
3287
3725
  title && /* @__PURE__ */ (0, import_jsx_runtime41.jsx)("div", { className: "mb-3 text-base font-semibold text-text-primary", children: title }),
3288
- /* @__PURE__ */ (0, import_jsx_runtime41.jsx)("div", { className: (0, import_ui_utils41.cn)("grid gap-x-6 gap-y-4", GRID_COLS[column]), children: items.map((item, idx) => {
3726
+ /* @__PURE__ */ (0, import_jsx_runtime41.jsx)("div", { className: cn("grid gap-x-6 gap-y-4", GRID_COLS[column]), children: items.map((item, idx) => {
3289
3727
  const span = item.props.span ?? 1;
3290
3728
  const colSpanClass = span === 2 ? "col-span-2" : span === 3 ? "col-span-3" : span === 4 ? "col-span-4" : "";
3291
- return /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("div", { className: (0, import_ui_utils41.cn)("flex flex-col gap-0.5", colSpanClass, item.props.className), children: [
3292
- /* @__PURE__ */ (0, import_jsx_runtime41.jsx)("span", { className: (0, import_ui_utils41.cn)("font-medium text-text-secondary", size === "sm" ? "text-xs" : size === "lg" ? "text-sm" : "text-xs"), children: item.props.label }),
3293
- /* @__PURE__ */ (0, import_jsx_runtime41.jsx)("span", { className: (0, import_ui_utils41.cn)("text-text-primary", size === "sm" ? "text-sm" : size === "lg" ? "text-base" : "text-sm"), children: item.props.children })
3729
+ return /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("div", { className: cn("flex flex-col gap-0.5", colSpanClass, item.props.className), children: [
3730
+ /* @__PURE__ */ (0, import_jsx_runtime41.jsx)("span", { className: cn("font-medium text-text-secondary", size === "sm" ? "text-xs" : size === "lg" ? "text-sm" : "text-xs"), children: item.props.label }),
3731
+ /* @__PURE__ */ (0, import_jsx_runtime41.jsx)("span", { className: cn("text-text-primary", size === "sm" ? "text-sm" : size === "lg" ? "text-base" : "text-sm"), children: item.props.children })
3294
3732
  ] }, idx);
3295
3733
  }) })
3296
3734
  ] });
@@ -3299,9 +3737,8 @@ var Descriptions = (0, import_react42.forwardRef)(
3299
3737
  Descriptions.displayName = "Descriptions";
3300
3738
 
3301
3739
  // src/components/statistic.tsx
3302
- var import_react43 = require("react");
3303
- var import_lucide_react17 = require("lucide-react");
3304
- var import_ui_utils42 = require("@ug666/ui-utils");
3740
+ var import_react44 = require("react");
3741
+ var import_lucide_react19 = require("lucide-react");
3305
3742
  var import_jsx_runtime42 = require("react/jsx-runtime");
3306
3743
  var SIZE_TITLE_CLASSES = {
3307
3744
  sm: "text-xs",
@@ -3335,20 +3772,20 @@ function formatValue(value, precision) {
3335
3772
  maximumFractionDigits: precision ?? 0
3336
3773
  }).format(value);
3337
3774
  }
3338
- var Statistic = (0, import_react43.forwardRef)(
3775
+ var Statistic = (0, import_react44.forwardRef)(
3339
3776
  ({ title, value, precision, prefix, suffix, trend, change, size = "default", className, ...props }, ref) => {
3340
- const TrendIcon = trend === "up" ? import_lucide_react17.TrendingUp : trend === "down" ? import_lucide_react17.TrendingDown : trend === "flat" ? import_lucide_react17.Minus : null;
3777
+ const TrendIcon = trend === "up" ? import_lucide_react19.TrendingUp : trend === "down" ? import_lucide_react19.TrendingDown : trend === "flat" ? import_lucide_react19.Minus : null;
3341
3778
  const iconSize = size === "sm" ? 14 : size === "lg" ? 18 : 16;
3342
- return /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("div", { ref, className: (0, import_ui_utils42.cn)("flex flex-col gap-1", className), ...props, children: [
3343
- title && /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("span", { className: (0, import_ui_utils42.cn)("font-medium text-text-secondary", SIZE_TITLE_CLASSES[size]), children: title }),
3779
+ return /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("div", { ref, className: cn("flex flex-col gap-1", className), ...props, children: [
3780
+ title && /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("span", { className: cn("font-medium text-text-secondary", SIZE_TITLE_CLASSES[size]), children: title }),
3344
3781
  /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("div", { className: "flex items-baseline gap-1", children: [
3345
- prefix && /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("span", { className: (0, import_ui_utils42.cn)("text-text-primary", SIZE_SUFFIX_CLASSES[size]), children: prefix }),
3346
- /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("span", { className: (0, import_ui_utils42.cn)("font-bold tabular-nums text-text-primary", SIZE_VALUE_CLASSES2[size]), children: formatValue(value, precision) }),
3347
- suffix && /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("span", { className: (0, import_ui_utils42.cn)("text-text-secondary", SIZE_SUFFIX_CLASSES[size]), children: suffix })
3782
+ prefix && /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("span", { className: cn("text-text-primary", SIZE_SUFFIX_CLASSES[size]), children: prefix }),
3783
+ /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("span", { className: cn("font-bold tabular-nums text-text-primary", SIZE_VALUE_CLASSES2[size]), children: formatValue(value, precision) }),
3784
+ suffix && /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("span", { className: cn("text-text-secondary", SIZE_SUFFIX_CLASSES[size]), children: suffix })
3348
3785
  ] }),
3349
3786
  (trend || change) && /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("div", { className: "flex items-center gap-1", children: [
3350
3787
  TrendIcon && trend && /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(TrendIcon, { size: iconSize, className: TREND_ICON_COLOR[trend] }),
3351
- change && trend && /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("span", { className: (0, import_ui_utils42.cn)("text-xs font-medium", TREND_TEXT_COLOR[trend]), children: change })
3788
+ change && trend && /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("span", { className: cn("text-xs font-medium", TREND_TEXT_COLOR[trend]), children: change })
3352
3789
  ] })
3353
3790
  ] });
3354
3791
  }
@@ -3358,29 +3795,185 @@ Statistic.displayName = "Statistic";
3358
3795
  // src/theme.ts
3359
3796
  var theme = {
3360
3797
  colors: {
3361
- primary: { DEFAULT: "#6366f1", hover: "#4f46e5", light: "#eef2ff" },
3362
- secondary: { DEFAULT: "#64748b", hover: "#475569", light: "#f1f5f9" },
3363
- destructive: { DEFAULT: "#ef4444", hover: "#dc2626", light: "#fef2f2" },
3364
- success: { DEFAULT: "#22c55e", hover: "#16a34a", light: "#f0fdf4" },
3365
- warning: { DEFAULT: "#f59e0b", hover: "#d97706", light: "#fffbeb" },
3366
- background: "#ffffff",
3367
- foreground: "#0f172a",
3368
- muted: "#f1f5f9",
3369
- border: "#e2e8f0",
3370
- ring: "#6366f1"
3798
+ primary: {
3799
+ DEFAULT: "hsl(var(--primary))",
3800
+ hover: "hsl(var(--primary-hover))",
3801
+ active: "hsl(var(--primary-active))",
3802
+ foreground: "hsl(var(--primary-fg))",
3803
+ soft: "hsl(var(--primary-soft) / 0.12)",
3804
+ softForeground: "hsl(var(--primary-soft-fg))"
3805
+ },
3806
+ success: {
3807
+ DEFAULT: "hsl(var(--success))",
3808
+ hover: "hsl(var(--success-hover))",
3809
+ foreground: "hsl(var(--success-fg))",
3810
+ soft: "hsl(var(--success-soft) / 0.12)",
3811
+ softForeground: "hsl(var(--success-soft-fg))"
3812
+ },
3813
+ warning: {
3814
+ DEFAULT: "hsl(var(--warning))",
3815
+ hover: "hsl(var(--warning-hover))",
3816
+ foreground: "hsl(var(--warning-fg))",
3817
+ soft: "hsl(var(--warning-soft) / 0.12)",
3818
+ softForeground: "hsl(var(--warning-soft-fg))"
3819
+ },
3820
+ danger: {
3821
+ DEFAULT: "hsl(var(--danger))",
3822
+ hover: "hsl(var(--danger-hover))",
3823
+ foreground: "hsl(var(--danger-fg))",
3824
+ soft: "hsl(var(--danger-soft) / 0.12)",
3825
+ softForeground: "hsl(var(--danger-soft-fg))"
3826
+ },
3827
+ info: {
3828
+ DEFAULT: "hsl(var(--info))",
3829
+ hover: "hsl(var(--info-hover))",
3830
+ foreground: "hsl(var(--info-fg))",
3831
+ soft: "hsl(var(--info-soft) / 0.12)",
3832
+ softForeground: "hsl(var(--info-soft-fg))"
3833
+ },
3834
+ surface: {
3835
+ 0: "hsl(var(--surface-0))",
3836
+ 1: "hsl(var(--surface-1))",
3837
+ 2: "hsl(var(--surface-2))",
3838
+ 3: "hsl(var(--surface-3))"
3839
+ },
3840
+ text: {
3841
+ primary: "hsl(var(--text-primary))",
3842
+ secondary: "hsl(var(--text-secondary))",
3843
+ tertiary: "hsl(var(--text-tertiary))",
3844
+ inverted: "hsl(var(--text-inverted))"
3845
+ },
3846
+ border: {
3847
+ strong: "hsl(var(--border-strong))",
3848
+ base: "hsl(var(--border-base))",
3849
+ subtle: "hsl(var(--border-subtle))"
3850
+ },
3851
+ ring: "hsl(var(--ring))",
3852
+ overlay: "hsl(var(--overlay) / var(--overlay-alpha))"
3371
3853
  },
3372
- radius: { sm: "0.375rem", md: "0.5rem", lg: "0.75rem", full: "9999px" },
3373
- fontFamily: { sans: "system-ui, -apple-system, sans-serif", mono: "ui-monospace, monospace" }
3854
+ radius: { sm: "var(--radius-sm)", md: "var(--radius-md)", lg: "var(--radius-lg)", xl: "var(--radius-xl)", full: "9999px" },
3855
+ fontFamily: { sans: "var(--font-sans)", mono: "var(--font-mono)" }
3374
3856
  };
3375
3857
 
3376
- // src/index.ts
3377
- var import_ui_utils43 = require("@ug666/ui-utils");
3858
+ // src/component-layers.ts
3859
+ var reactComponentLayers = [
3860
+ {
3861
+ id: "primitives",
3862
+ label: "\u57FA\u7840\u7EC4\u4EF6",
3863
+ description: "\u6700\u5C0F\u53EF\u590D\u7528\u89C6\u89C9\u5355\u5143\uFF0C\u8D1F\u8D23\u6309\u94AE\u3001\u5BB9\u5668\u3001\u6807\u7B7E\u3001\u5206\u9694\u548C\u52A0\u8F7D\u57FA\u7840\u72B6\u6001\u3002",
3864
+ components: [
3865
+ { name: "UGButton", route: "/react/components/button" },
3866
+ { name: "UGInput", route: "/react/components/input" },
3867
+ { name: "UGLabel", route: "/react/components/label" },
3868
+ { name: "UGCard", route: "/react/components/card" },
3869
+ { name: "UGBadge", route: "/react/components/badge" },
3870
+ { name: "UGTag", route: "/react/components/tag" },
3871
+ { name: "UGSeparator", route: "/react/components/separator" },
3872
+ { name: "UGSpinner", route: "/react/components/spinner" }
3873
+ ]
3874
+ },
3875
+ {
3876
+ id: "forms",
3877
+ label: "\u8868\u5355\u8F93\u5165",
3878
+ description: "\u6536\u96C6\u3001\u6821\u9A8C\u548C\u7F16\u8F91\u7528\u6237\u8F93\u5165\uFF0C\u8981\u6C42\u6807\u7B7E\u3001\u5E2E\u52A9\u6587\u672C\u3001\u9519\u8BEF\u72B6\u6001\u7A33\u5B9A\u5BF9\u9F50\u3002",
3879
+ components: [
3880
+ { name: "UGTextarea", route: "/react/components/textarea" },
3881
+ { name: "UGSelect", route: "/react/components/select" },
3882
+ { name: "UGCheckbox", route: "/react/components/checkbox" },
3883
+ { name: "UGRadio", route: "/react/components/radio" },
3884
+ { name: "UGSwitch", route: "/react/components/switch" },
3885
+ { name: "UGSlider", route: "/react/components/slider" },
3886
+ { name: "UGNumberInput", route: "/react/components/number-input" },
3887
+ { name: "UGOTPInput", route: "/react/components/otp-input" },
3888
+ { name: "UGForm", route: "/react/components/form" }
3889
+ ]
3890
+ },
3891
+ {
3892
+ id: "navigation",
3893
+ label: "\u5BFC\u822A\u6D41\u7A0B",
3894
+ description: "\u9875\u9762\u5B9A\u4F4D\u3001\u533A\u57DF\u5207\u6362\u3001\u5206\u9875\u548C\u6D41\u7A0B\u8868\u8FBE\uFF0C\u8981\u6C42\u9009\u4E2D\u6001\u660E\u786E\u4E14\u79FB\u52A8\u7AEF\u4E0D\u6EA2\u51FA\u3002",
3895
+ components: [
3896
+ { name: "UGTabs", route: "/react/components/tabs" },
3897
+ { name: "UGBreadcrumb", route: "/react/components/breadcrumb" },
3898
+ { name: "UGPagination", route: "/react/components/pagination" },
3899
+ { name: "UGNavigationMenu", route: "/react/components/navigation-menu" },
3900
+ { name: "UGSidebar", route: "/react/components/sidebar" },
3901
+ { name: "UGSteps", route: "/react/components/steps" }
3902
+ ]
3903
+ },
3904
+ {
3905
+ id: "overlays",
3906
+ label: "\u6D6E\u5C42\u5F39\u5C42",
3907
+ description: "\u4E34\u65F6\u627F\u8F7D\u64CD\u4F5C\u548C\u4E0A\u4E0B\u6587\u4FE1\u606F\uFF0C\u8981\u6C42\u5B9A\u4F4D\u3001\u5173\u95ED\u3001\u7126\u70B9\u548C\u906E\u7F69\u884C\u4E3A\u53EF\u9760\u3002",
3908
+ components: [
3909
+ { name: "UGModal", route: "/react/components/modal" },
3910
+ { name: "UGDialog", route: "/react/components/dialog" },
3911
+ { name: "UGDrawer", route: "/react/components/drawer" },
3912
+ { name: "UGSheet", route: "/react/components/sheet" },
3913
+ { name: "UGDropdownMenu", route: "/react/components/dropdown" },
3914
+ { name: "UGContextMenu", route: "/react/components/context-menu" },
3915
+ { name: "UGPopover", route: "/react/components/popover" },
3916
+ { name: "UGTooltip", route: "/react/components/tooltip" }
3917
+ ]
3918
+ },
3919
+ {
3920
+ id: "feedback",
3921
+ label: "\u53CD\u9988\u72B6\u6001",
3922
+ description: "\u8868\u8FBE\u6210\u529F\u3001\u8B66\u544A\u3001\u9519\u8BEF\u3001\u7A7A\u72B6\u6001\u548C\u52A0\u8F7D\u8FC7\u7A0B\uFF0C\u8981\u6C42\u8BED\u4E49\u6587\u6848\u548C\u89C6\u89C9\u72B6\u6001\u4E00\u81F4\u3002",
3923
+ components: [
3924
+ { name: "UGAlert", route: "/react/components/alert" },
3925
+ { name: "UGToaster", route: "/react/components/toast" },
3926
+ { name: "UGProgress", route: "/react/components/progress" },
3927
+ { name: "UGSkeleton", route: "/react/components/skeleton" },
3928
+ { name: "UGEmptyState", route: "/react/components/empty-state" }
3929
+ ]
3930
+ },
3931
+ {
3932
+ id: "data",
3933
+ label: "\u6570\u636E\u5C55\u793A",
3934
+ description: "\u5C55\u793A\u5217\u8868\u3001\u5BF9\u8C61\u8BE6\u60C5\u3001\u5934\u50CF\u3001\u6307\u6807\u548C\u6298\u53E0\u4FE1\u606F\uFF0C\u8981\u6C42\u5BC6\u5EA6\u6E05\u6670\u4E14\u6587\u672C\u4E0D\u6324\u51FA\u3002",
3935
+ components: [
3936
+ { name: "UGTable", route: "/react/components/table" },
3937
+ { name: "UGDescriptions", route: "/react/components/descriptions" },
3938
+ { name: "UGStatistic", route: "/react/components/statistic" },
3939
+ { name: "UGAvatar", route: "/react/components/avatar" },
3940
+ { name: "UGAvatarGroup", route: "/react/components/avatar-group" },
3941
+ { name: "UGAccordion", route: "/react/components/accordion" }
3942
+ ]
3943
+ },
3944
+ {
3945
+ id: "patterns",
3946
+ label: "\u6846\u67B6\u6A21\u5F0F",
3947
+ description: "\u540E\u53F0\u3001\u5DE5\u5177\u578B\u548C\u8DE8\u4E1A\u52A1\u901A\u7528\u6A21\u5F0F\uFF0C\u901A\u8FC7\u5B50\u5165\u53E3 @ug666/ui-react/patterns \u4F7F\u7528\u3002",
3948
+ components: [
3949
+ { name: "UGAdminShell", route: "/react/patterns#adminshell" },
3950
+ { name: "UGPageHeader", route: "/react/patterns#pageheader" },
3951
+ { name: "UGCopyField", route: "/react/patterns#copyfield" },
3952
+ { name: "UGConfirmDialog", route: "/react/patterns#confirmdialog" }
3953
+ ]
3954
+ },
3955
+ {
3956
+ id: "blocks",
3957
+ label: "\u5C55\u793A\u533A\u5757",
3958
+ description: "\u5C55\u793A\u9875\u3001\u4EA7\u54C1\u9875\u548C\u4ECB\u7ECD\u9875\u533A\u5757\uFF0C\u901A\u8FC7\u5B50\u5165\u53E3 @ug666/ui-react/blocks \u4F7F\u7528\u3002",
3959
+ components: [
3960
+ { name: "UGLandingHero", route: "/react/blocks#landinghero" },
3961
+ { name: "UGFeatureGrid", route: "/react/blocks#featuregrid" }
3962
+ ]
3963
+ },
3964
+ {
3965
+ id: "labs",
3966
+ label: "\u5B9E\u9A8C\u7EC4\u4EF6",
3967
+ description: "\u5C1A\u672A\u7A33\u5B9A\u627F\u8BFA\u7684\u5B9E\u9A8C\u7EC4\u4EF6\uFF0C\u901A\u8FC7\u5B50\u5165\u53E3 @ug666/ui-react/labs \u4F7F\u7528\u3002",
3968
+ components: []
3969
+ }
3970
+ ];
3378
3971
 
3379
3972
  // src/hooks/use-debounce.ts
3380
- var import_react44 = require("react");
3973
+ var import_react45 = require("react");
3381
3974
  function useDebounce(value, delay = 300) {
3382
- const [debounced, setDebounced] = (0, import_react44.useState)(value);
3383
- (0, import_react44.useEffect)(() => {
3975
+ const [debounced, setDebounced] = (0, import_react45.useState)(value);
3976
+ (0, import_react45.useEffect)(() => {
3384
3977
  const timer = setTimeout(() => setDebounced(value), delay);
3385
3978
  return () => clearTimeout(timer);
3386
3979
  }, [value, delay]);
@@ -3388,9 +3981,9 @@ function useDebounce(value, delay = 300) {
3388
3981
  }
3389
3982
 
3390
3983
  // src/hooks/use-local-storage.ts
3391
- var import_react45 = require("react");
3984
+ var import_react46 = require("react");
3392
3985
  function useLocalStorage(key, initialValue) {
3393
- const [storedValue, setStoredValue] = (0, import_react45.useState)(() => {
3986
+ const [storedValue, setStoredValue] = (0, import_react46.useState)(() => {
3394
3987
  if (typeof window === "undefined") return initialValue;
3395
3988
  try {
3396
3989
  const item = window.localStorage.getItem(key);
@@ -3399,7 +3992,7 @@ function useLocalStorage(key, initialValue) {
3399
3992
  return initialValue;
3400
3993
  }
3401
3994
  });
3402
- const setValue = (0, import_react45.useCallback)((value) => {
3995
+ const setValue = (0, import_react46.useCallback)((value) => {
3403
3996
  setStoredValue((prev) => {
3404
3997
  const next = value instanceof Function ? value(prev) : value;
3405
3998
  if (typeof window !== "undefined") {
@@ -3408,7 +4001,7 @@ function useLocalStorage(key, initialValue) {
3408
4001
  return next;
3409
4002
  });
3410
4003
  }, [key]);
3411
- const removeValue = (0, import_react45.useCallback)(() => {
4004
+ const removeValue = (0, import_react46.useCallback)(() => {
3412
4005
  setStoredValue(initialValue);
3413
4006
  if (typeof window !== "undefined") {
3414
4007
  window.localStorage.removeItem(key);
@@ -3418,13 +4011,13 @@ function useLocalStorage(key, initialValue) {
3418
4011
  }
3419
4012
 
3420
4013
  // src/hooks/use-media-query.ts
3421
- var import_react46 = require("react");
4014
+ var import_react47 = require("react");
3422
4015
  function useMediaQuery(query) {
3423
- const [matches, setMatches] = (0, import_react46.useState)(() => {
4016
+ const [matches, setMatches] = (0, import_react47.useState)(() => {
3424
4017
  if (typeof window === "undefined") return false;
3425
4018
  return window.matchMedia(query).matches;
3426
4019
  });
3427
- (0, import_react46.useEffect)(() => {
4020
+ (0, import_react47.useEffect)(() => {
3428
4021
  if (typeof window === "undefined") return;
3429
4022
  const mediaQueryList = window.matchMedia(query);
3430
4023
  setMatches(mediaQueryList.matches);
@@ -3438,9 +4031,9 @@ function useMediaQuery(query) {
3438
4031
  }
3439
4032
 
3440
4033
  // src/hooks/use-click-outside.ts
3441
- var import_react47 = require("react");
4034
+ var import_react48 = require("react");
3442
4035
  function useClickOutside(ref, handler) {
3443
- (0, import_react47.useEffect)(() => {
4036
+ (0, import_react48.useEffect)(() => {
3444
4037
  const handleMouseDown = (event) => {
3445
4038
  if (ref.current && !ref.current.contains(event.target)) {
3446
4039
  handler();
@@ -3461,18 +4054,18 @@ function useClickOutside(ref, handler) {
3461
4054
  }
3462
4055
 
3463
4056
  // src/hooks/use-copy-to-clipboard.ts
3464
- var import_react48 = require("react");
4057
+ var import_react49 = require("react");
3465
4058
  function useCopyToClipboard() {
3466
- const [copied, setCopied] = (0, import_react48.useState)(false);
3467
- const timerRef = (0, import_react48.useRef)(null);
3468
- (0, import_react48.useEffect)(() => {
4059
+ const [copied, setCopied] = (0, import_react49.useState)(false);
4060
+ const timerRef = (0, import_react49.useRef)(null);
4061
+ (0, import_react49.useEffect)(() => {
3469
4062
  return () => {
3470
4063
  if (timerRef.current) {
3471
4064
  clearTimeout(timerRef.current);
3472
4065
  }
3473
4066
  };
3474
4067
  }, []);
3475
- const copy = (0, import_react48.useCallback)(async (text) => {
4068
+ const copy = (0, import_react49.useCallback)(async (text) => {
3476
4069
  if (typeof navigator === "undefined" || !navigator.clipboard) {
3477
4070
  console.error("\u526A\u8D34\u677F API \u4E0D\u53EF\u7528");
3478
4071
  return;
@@ -3492,42 +4085,42 @@ function useCopyToClipboard() {
3492
4085
  }
3493
4086
 
3494
4087
  // src/hooks/use-toggle.ts
3495
- var import_react49 = require("react");
4088
+ var import_react50 = require("react");
3496
4089
  function useToggle(initial = false) {
3497
- const [value, setValue] = (0, import_react49.useState)(initial);
3498
- const toggle = (0, import_react49.useCallback)(() => {
4090
+ const [value, setValue] = (0, import_react50.useState)(initial);
4091
+ const toggle = (0, import_react50.useCallback)(() => {
3499
4092
  setValue((prev) => !prev);
3500
4093
  }, []);
3501
4094
  return [value, toggle, setValue];
3502
4095
  }
3503
4096
 
3504
4097
  // src/hooks/use-pagination.ts
3505
- var import_react50 = require("react");
4098
+ var import_react51 = require("react");
3506
4099
  function usePagination({
3507
4100
  total,
3508
4101
  pageSize = 10,
3509
4102
  initialPage = 1
3510
4103
  }) {
3511
- const totalPages = (0, import_react50.useMemo)(
4104
+ const totalPages = (0, import_react51.useMemo)(
3512
4105
  () => Math.max(1, Math.ceil(total / pageSize)),
3513
4106
  [total, pageSize]
3514
4107
  );
3515
- const [page, setPageState] = (0, import_react50.useState)(
4108
+ const [page, setPageState] = (0, import_react51.useState)(
3516
4109
  () => Math.min(Math.max(1, initialPage), Math.max(1, Math.ceil(total / pageSize)))
3517
4110
  );
3518
- (0, import_react50.useEffect)(() => {
4111
+ (0, import_react51.useEffect)(() => {
3519
4112
  setPageState((prev) => Math.min(prev, totalPages));
3520
4113
  }, [totalPages]);
3521
- const setPage = (0, import_react50.useCallback)(
4114
+ const setPage = (0, import_react51.useCallback)(
3522
4115
  (p) => {
3523
4116
  setPageState(Math.min(Math.max(1, p), totalPages));
3524
4117
  },
3525
4118
  [totalPages]
3526
4119
  );
3527
- const nextPage = (0, import_react50.useCallback)(() => {
4120
+ const nextPage = (0, import_react51.useCallback)(() => {
3528
4121
  setPageState((prev) => Math.min(prev + 1, totalPages));
3529
4122
  }, [totalPages]);
3530
- const prevPage = (0, import_react50.useCallback)(() => {
4123
+ const prevPage = (0, import_react51.useCallback)(() => {
3531
4124
  setPageState((prev) => Math.max(prev - 1, 1));
3532
4125
  }, []);
3533
4126
  const startIndex = (page - 1) * pageSize;
@@ -3546,17 +4139,17 @@ function usePagination({
3546
4139
  }
3547
4140
 
3548
4141
  // src/hooks/use-form.ts
3549
- var import_react51 = require("react");
4142
+ var import_react52 = require("react");
3550
4143
  function useForm(initialValues) {
3551
- const [values, setValues] = (0, import_react51.useState)(initialValues);
3552
- const [errors, setErrors] = (0, import_react51.useState)({});
3553
- const isDirty = (0, import_react51.useMemo)(
4144
+ const [values, setValues] = (0, import_react52.useState)(initialValues);
4145
+ const [errors, setErrors] = (0, import_react52.useState)({});
4146
+ const isDirty = (0, import_react52.useMemo)(
3554
4147
  () => Object.keys(initialValues).some(
3555
4148
  (key) => values[key] !== initialValues[key]
3556
4149
  ),
3557
4150
  [values, initialValues]
3558
4151
  );
3559
- const handleChange = (0, import_react51.useCallback)((name, value) => {
4152
+ const handleChange = (0, import_react52.useCallback)((name, value) => {
3560
4153
  setValues((prev) => ({ ...prev, [name]: value }));
3561
4154
  setErrors((prev) => {
3562
4155
  if (!prev[name]) return prev;
@@ -3565,13 +4158,13 @@ function useForm(initialValues) {
3565
4158
  return next;
3566
4159
  });
3567
4160
  }, []);
3568
- const setError = (0, import_react51.useCallback)((name, message) => {
4161
+ const setError = (0, import_react52.useCallback)((name, message) => {
3569
4162
  setErrors((prev) => ({ ...prev, [name]: message }));
3570
4163
  }, []);
3571
- const clearErrors = (0, import_react51.useCallback)(() => {
4164
+ const clearErrors = (0, import_react52.useCallback)(() => {
3572
4165
  setErrors({});
3573
4166
  }, []);
3574
- const reset = (0, import_react51.useCallback)(() => {
4167
+ const reset = (0, import_react52.useCallback)(() => {
3575
4168
  setValues(initialValues);
3576
4169
  setErrors({});
3577
4170
  }, [initialValues]);
@@ -3579,23 +4172,23 @@ function useForm(initialValues) {
3579
4172
  }
3580
4173
 
3581
4174
  // src/hooks/use-mounted.ts
3582
- var import_react52 = require("react");
4175
+ var import_react53 = require("react");
3583
4176
  function useMounted() {
3584
- const [mounted, setMounted] = (0, import_react52.useState)(false);
3585
- (0, import_react52.useEffect)(() => {
4177
+ const [mounted, setMounted] = (0, import_react53.useState)(false);
4178
+ (0, import_react53.useEffect)(() => {
3586
4179
  setMounted(true);
3587
4180
  }, []);
3588
4181
  return mounted;
3589
4182
  }
3590
4183
 
3591
4184
  // src/hooks/use-interval.ts
3592
- var import_react53 = require("react");
4185
+ var import_react54 = require("react");
3593
4186
  function useInterval(callback, delay) {
3594
- const savedCallback = (0, import_react53.useRef)(callback);
3595
- (0, import_react53.useEffect)(() => {
4187
+ const savedCallback = (0, import_react54.useRef)(callback);
4188
+ (0, import_react54.useEffect)(() => {
3596
4189
  savedCallback.current = callback;
3597
4190
  }, [callback]);
3598
- (0, import_react53.useEffect)(() => {
4191
+ (0, import_react54.useEffect)(() => {
3599
4192
  if (delay === null) return;
3600
4193
  const id = setInterval(() => savedCallback.current(), delay);
3601
4194
  return () => clearInterval(id);
@@ -3603,13 +4196,13 @@ function useInterval(callback, delay) {
3603
4196
  }
3604
4197
 
3605
4198
  // src/hooks/use-timeout.ts
3606
- var import_react54 = require("react");
4199
+ var import_react55 = require("react");
3607
4200
  function useTimeout(callback, delay) {
3608
- const savedCallback = (0, import_react54.useRef)(callback);
3609
- (0, import_react54.useEffect)(() => {
4201
+ const savedCallback = (0, import_react55.useRef)(callback);
4202
+ (0, import_react55.useEffect)(() => {
3610
4203
  savedCallback.current = callback;
3611
4204
  }, [callback]);
3612
- (0, import_react54.useEffect)(() => {
4205
+ (0, import_react55.useEffect)(() => {
3613
4206
  if (delay === null) return;
3614
4207
  const id = setTimeout(() => savedCallback.current(), delay);
3615
4208
  return () => clearTimeout(id);
@@ -3617,7 +4210,7 @@ function useTimeout(callback, delay) {
3617
4210
  }
3618
4211
 
3619
4212
  // src/hooks/use-hotkeys.ts
3620
- var import_react55 = require("react");
4213
+ var import_react56 = require("react");
3621
4214
  function parseHotkey(keys) {
3622
4215
  const parts = keys.toLowerCase().split("+").map((s) => s.trim());
3623
4216
  const ctrl = parts.includes("ctrl");
@@ -3631,11 +4224,11 @@ function parseHotkey(keys) {
3631
4224
  }
3632
4225
  function useHotkeys(keys, callback, options = {}) {
3633
4226
  const { preventDefault = false, target = null } = options;
3634
- const savedCallback = (0, import_react55.useRef)(callback);
3635
- (0, import_react55.useEffect)(() => {
4227
+ const savedCallback = (0, import_react56.useRef)(callback);
4228
+ (0, import_react56.useEffect)(() => {
3636
4229
  savedCallback.current = callback;
3637
4230
  }, [callback]);
3638
- (0, import_react55.useEffect)(() => {
4231
+ (0, import_react56.useEffect)(() => {
3639
4232
  const parsed = parseHotkey(keys);
3640
4233
  const eventTarget = target ?? window;
3641
4234
  function handler(event) {
@@ -3654,13 +4247,13 @@ function useHotkeys(keys, callback, options = {}) {
3654
4247
  }
3655
4248
 
3656
4249
  // src/hooks/use-event-listener.ts
3657
- var import_react56 = require("react");
4250
+ var import_react57 = require("react");
3658
4251
  function useEventListener(event, handler, target) {
3659
- const savedHandler = (0, import_react56.useRef)(handler);
3660
- (0, import_react56.useEffect)(() => {
4252
+ const savedHandler = (0, import_react57.useRef)(handler);
4253
+ (0, import_react57.useEffect)(() => {
3661
4254
  savedHandler.current = handler;
3662
4255
  }, [handler]);
3663
- (0, import_react56.useEffect)(() => {
4256
+ (0, import_react57.useEffect)(() => {
3664
4257
  if (target === null) return;
3665
4258
  const eventTarget = target ?? window;
3666
4259
  function listener(event2) {
@@ -3774,14 +4367,121 @@ function useEventListener(event, handler, target) {
3774
4367
  Tooltip,
3775
4368
  TooltipContent,
3776
4369
  TooltipTrigger,
4370
+ UGAccordion,
4371
+ UGAccordionContent,
4372
+ UGAccordionItem,
4373
+ UGAccordionTrigger,
4374
+ UGAlert,
4375
+ UGAlertDescription,
4376
+ UGAlertTitle,
4377
+ UGAvatar,
4378
+ UGAvatarFallback,
4379
+ UGAvatarGroup,
4380
+ UGAvatarImage,
4381
+ UGBadge,
4382
+ UGBreadcrumb,
4383
+ UGBreadcrumbItem,
4384
+ UGBreadcrumbLink,
4385
+ UGBreadcrumbSeparator,
4386
+ UGButton,
4387
+ UGCard,
4388
+ UGCardContent,
4389
+ UGCardDescription,
4390
+ UGCardFooter,
4391
+ UGCardHeader,
4392
+ UGCardTitle,
4393
+ UGCheckbox,
4394
+ UGContextMenu,
4395
+ UGContextMenuContent,
4396
+ UGContextMenuItem,
4397
+ UGContextMenuSeparator,
4398
+ UGContextMenuTrigger,
4399
+ UGDescriptions,
4400
+ UGDescriptionsItem,
4401
+ UGDialog,
4402
+ UGDrawer,
4403
+ UGDrawerClose,
4404
+ UGDrawerContent,
4405
+ UGDrawerDescription,
4406
+ UGDrawerFooter,
4407
+ UGDrawerHeader,
4408
+ UGDrawerTitle,
4409
+ UGDropdown,
4410
+ UGDropdownContent,
4411
+ UGDropdownItem,
4412
+ UGDropdownMenu,
4413
+ UGDropdownSeparator,
4414
+ UGDropdownTrigger,
4415
+ UGEmptyState,
4416
+ UGForm,
4417
+ UGFormControl,
4418
+ UGFormDescription,
4419
+ UGFormField,
4420
+ UGFormItem,
4421
+ UGFormLabel,
4422
+ UGFormMessage,
4423
+ UGInput,
4424
+ UGLabel,
4425
+ UGModal,
4426
+ UGModalCloseButton,
4427
+ UGModalContent,
4428
+ UGModalFooter,
4429
+ UGModalHeader,
4430
+ UGModalTitle,
4431
+ UGNavigationMenu,
4432
+ UGNavigationMenuContent,
4433
+ UGNavigationMenuItem,
4434
+ UGNavigationMenuLink,
4435
+ UGNavigationMenuTrigger,
4436
+ UGNumberInput,
4437
+ UGOTPInput,
4438
+ UGPagination,
4439
+ UGPopover,
4440
+ UGPopoverContent,
4441
+ UGPopoverTrigger,
4442
+ UGProgress,
4443
+ UGRadio,
4444
+ UGRadioGroup,
4445
+ UGSelect,
4446
+ UGSeparator,
4447
+ UGSheet,
4448
+ UGSidebar,
4449
+ UGSkeleton,
4450
+ UGSlider,
4451
+ UGSpinner,
4452
+ UGStatistic,
4453
+ UGSteps,
4454
+ UGSwitch,
4455
+ UGTable,
4456
+ UGTableBody,
4457
+ UGTableCell,
4458
+ UGTableHead,
4459
+ UGTableHeader,
4460
+ UGTableRow,
4461
+ UGTabs,
4462
+ UGTabsContent,
4463
+ UGTabsList,
4464
+ UGTabsTrigger,
4465
+ UGTag,
4466
+ UGTextarea,
4467
+ UGToaster,
4468
+ UGTooltip,
4469
+ UGTooltipContent,
4470
+ UGTooltipTrigger,
3777
4471
  badgeVariants,
3778
4472
  buttonVariants,
3779
4473
  checkboxVariants,
3780
4474
  cn,
3781
4475
  numberInputVariants,
4476
+ reactComponentLayers,
3782
4477
  tagVariants,
3783
4478
  theme,
3784
4479
  toast,
4480
+ ugBadgeVariants,
4481
+ ugButtonVariants,
4482
+ ugCheckboxVariants,
4483
+ ugNumberInputVariants,
4484
+ ugTagVariants,
3785
4485
  useClickOutside,
3786
4486
  useCopyToClipboard,
3787
4487
  useDebounce,