@underverse-ui/underverse 0.2.52 → 0.2.54

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.
package/dist/index.cjs CHANGED
@@ -5552,33 +5552,15 @@ var variantClasses = {
5552
5552
  primary: "bg-primary/5",
5553
5553
  accent: "bg-accent/10"
5554
5554
  };
5555
- var spacingClasses2 = {
5556
- none: "",
5557
- sm: "p-2",
5558
- md: "p-4",
5559
- lg: "p-6",
5560
- xl: "p-8"
5561
- };
5562
5555
  var ScrollArea = (0, import_react14.forwardRef)(
5563
- ({ className, contentClassName, children, variant = "default", spacing = "none", fullWidth = true, outlined = false, ...props }, ref) => {
5556
+ ({ className, contentClassName, children, variant = "default", outlined = false, ...props }, ref) => {
5564
5557
  return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
5565
5558
  "div",
5566
5559
  {
5567
5560
  ref,
5568
5561
  className: cn("relative overflow-hidden", variantClasses[variant], outlined && "rounded-lg border border-border/60", className),
5569
5562
  ...props,
5570
- children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
5571
- "div",
5572
- {
5573
- className: cn(
5574
- "h-full w-full overflow-y-auto scroll-area-viewport",
5575
- spacingClasses2[spacing],
5576
- !fullWidth && "container mx-auto px-4 md:px-6",
5577
- contentClassName
5578
- ),
5579
- children
5580
- }
5581
- )
5563
+ children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: cn("h-full w-full overflow-y-auto scroll-area-viewport", contentClassName), children })
5582
5564
  }
5583
5565
  );
5584
5566
  }
@@ -9219,10 +9201,10 @@ var React33 = __toESM(require("react"), 1);
9219
9201
  var import_lucide_react22 = require("lucide-react");
9220
9202
  var import_jsx_runtime40 = require("react/jsx-runtime");
9221
9203
  var SIZE_STYLES2 = {
9222
- xs: { itemPad: "px-2 py-1.5", densePad: "px-2 py-1", label: "text-xs", desc: "text-[11px]", icon: "h-3.5 w-3.5", avatar: "h-6 w-6" },
9223
- sm: { itemPad: "px-3 py-2", densePad: "px-3 py-1.5", label: "text-[13px]", desc: "text-[12px]", icon: "h-4 w-4", avatar: "h-8 w-8" },
9224
- md: { itemPad: "px-4 py-2.5", densePad: "px-4 py-2", label: "text-sm", desc: "text-xs", icon: "h-5 w-5", avatar: "h-10 w-10" },
9225
- lg: { itemPad: "px-5 py-3", densePad: "px-5 py-2.5", label: "text-base", desc: "text-sm", icon: "h-5 w-5", avatar: "h-12 w-12" }
9204
+ xs: { label: "text-xs", desc: "text-[11px]", icon: "h-3.5 w-3.5", avatar: "h-6 w-6" },
9205
+ sm: { label: "text-[13px]", desc: "text-[12px]", icon: "h-4 w-4", avatar: "h-8 w-8" },
9206
+ md: { label: "text-sm", desc: "text-xs", icon: "h-5 w-5", avatar: "h-10 w-10" },
9207
+ lg: { label: "text-base", desc: "text-sm", icon: "h-5 w-5", avatar: "h-12 w-12" }
9226
9208
  };
9227
9209
  var BADGE_VARIANTS = {
9228
9210
  default: "bg-muted text-muted-foreground",
@@ -9233,7 +9215,7 @@ var BADGE_VARIANTS = {
9233
9215
  };
9234
9216
  var ListItemSkeleton = ({ size }) => {
9235
9217
  const sz = SIZE_STYLES2[size];
9236
- return /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)("div", { className: cn("flex items-center gap-3 animate-pulse", sz.itemPad), children: [
9218
+ return /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)("div", { className: cn("flex items-center gap-3 animate-pulse p-2"), children: [
9237
9219
  /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("div", { className: cn("rounded-full bg-muted shrink-0", sz.avatar) }),
9238
9220
  /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)("div", { className: "flex-1 space-y-2", children: [
9239
9221
  /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("div", { className: "h-4 bg-muted rounded w-3/4" }),
@@ -9255,6 +9237,8 @@ var ListRoot = React33.forwardRef(
9255
9237
  emptyText,
9256
9238
  dense = false,
9257
9239
  className,
9240
+ itemClassName,
9241
+ // New prop
9258
9242
  children,
9259
9243
  ...rest
9260
9244
  }, ref) => {
@@ -9271,7 +9255,15 @@ var ListRoot = React33.forwardRef(
9271
9255
  striped: "rounded-lg border border-border overflow-hidden"
9272
9256
  };
9273
9257
  if (loading2) {
9274
- return /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(Comp, { ref, className: cn("group/list", variantClasses2[variant], inset && "p-1.5 md:p-2", divided && "divide-y divide-border/60", className), ...rest, children: Array.from({ length: loadingCount }).map((_, i) => /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(ListItemSkeleton, { size }, i)) });
9258
+ return /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
9259
+ Comp,
9260
+ {
9261
+ ref,
9262
+ className: cn("group/list", variantClasses2[variant], inset && "p-1.5 md:p-2", divided && "divide-y divide-border/60", className),
9263
+ ...rest,
9264
+ children: Array.from({ length: loadingCount }).map((_, i) => /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(ListItemSkeleton, { size }, i))
9265
+ }
9266
+ );
9275
9267
  }
9276
9268
  if (!hasChildren && emptyText) {
9277
9269
  return /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(Comp, { ref, className: cn("group/list", variantClasses2[variant], inset && "p-1.5 md:p-2", className), ...rest, children: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("div", { className: "text-center py-8 text-muted-foreground text-sm", children: emptyText }) });
@@ -9298,6 +9290,8 @@ var ListRoot = React33.forwardRef(
9298
9290
  );
9299
9291
  return React33.cloneElement(child, {
9300
9292
  className: childClass,
9293
+ // Pass global item class to contentClassName of ListItem
9294
+ contentClassName: cn(itemClassName, child.props?.contentClassName),
9301
9295
  "data-first": idx === 0 ? "true" : void 0,
9302
9296
  "data-last": idx === childCount - 1 ? "true" : void 0,
9303
9297
  "data-size": size,
@@ -9328,17 +9322,15 @@ var ListItem = React33.forwardRef(
9328
9322
  onExpandChange,
9329
9323
  expandContent,
9330
9324
  className,
9325
+ contentClassName,
9331
9326
  children,
9332
9327
  ...rest
9333
9328
  }, ref) => {
9334
9329
  const [internalExpanded, setInternalExpanded] = React33.useState(false);
9335
9330
  const isExpanded = controlledExpanded !== void 0 ? controlledExpanded : internalExpanded;
9336
9331
  const sizeAttr = rest["data-size"];
9337
- const denseAttr = rest["data-dense"];
9338
- const isDense = denseAttr === "true";
9339
- const resolvedSize = sizeAttr && (sizeAttr === "xs" || sizeAttr === "sm" || sizeAttr === "md" || sizeAttr === "lg") ? sizeAttr : "md";
9332
+ const resolvedSize = sizeAttr && ["xs", "sm", "md", "lg"].includes(sizeAttr) ? sizeAttr : "md";
9340
9333
  const sz = SIZE_STYLES2[resolvedSize];
9341
- const padding = isDense ? sz.densePad : sz.itemPad;
9342
9334
  const toggleExpanded = () => {
9343
9335
  const newExpanded = !isExpanded;
9344
9336
  if (onExpandChange) {
@@ -9360,71 +9352,38 @@ var ListItem = React33.forwardRef(
9360
9352
  }
9361
9353
  } : {};
9362
9354
  const inner = /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)(import_jsx_runtime40.Fragment, { children: [
9363
- /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)(
9364
- "div",
9365
- {
9366
- className: cn("flex items-center gap-3", padding, "group/item relative"),
9367
- ...headerProps,
9368
- children: [
9369
- avatar && /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("div", { className: cn("shrink-0", sz.avatar), children: typeof avatar === "string" ? /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("img", { src: avatar, alt: "", className: cn("rounded-full object-cover", sz.avatar) }) : avatar }),
9370
- Left && !avatar && /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("span", { className: cn("text-muted-foreground shrink-0", sz.icon), children: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(Left, { className: cn(sz.icon) }) }),
9371
- /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)("div", { className: "min-w-0 flex-1", children: [
9372
- /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)("div", { className: "flex items-center gap-2", children: [
9373
- label && /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("div", { className: cn(sz.label, "text-foreground font-medium truncate"), children: label }),
9374
- badge && /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("span", { className: cn("px-2 py-0.5 rounded-full text-[11px] font-medium shrink-0", BADGE_VARIANTS[badgeVariant]), children: badge })
9375
- ] }),
9376
- description && /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("div", { className: cn(sz.desc, "text-muted-foreground truncate mt-0.5"), children: description }),
9377
- children && /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("div", { className: "mt-1", children })
9378
- ] }),
9379
- action && /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("div", { className: "opacity-0 group-hover/item:opacity-100 transition-opacity shrink-0", children: action }),
9380
- collapsible ? /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
9381
- "span",
9382
- {
9383
- className: cn(
9384
- "text-muted-foreground shrink-0 transition-transform cursor-pointer select-none",
9385
- sz.icon,
9386
- isExpanded && "rotate-90"
9387
- ),
9388
- children: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(import_lucide_react22.ChevronRight, { className: cn(sz.icon) })
9389
- }
9390
- ) : Right && /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("span", { className: cn("text-muted-foreground shrink-0", sz.icon), children: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(Right, { className: cn(sz.icon) }) })
9391
- ]
9392
- }
9393
- ),
9394
- collapsible && isExpanded && expandContent && /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("div", { className: cn("border-t border-border/50 bg-muted/20", padding, "pt-3"), children: expandContent })
9355
+ /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)("div", { className: cn("flex items-center gap-3", contentClassName, "group/item relative"), ...headerProps, children: [
9356
+ avatar && /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("div", { className: cn("shrink-0", sz.avatar), children: typeof avatar === "string" ? /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("img", { src: avatar, alt: "", className: cn("rounded-full object-cover", sz.avatar) }) : avatar }),
9357
+ Left && !avatar && /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("span", { className: cn("text-muted-foreground shrink-0", sz.icon), children: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(Left, { className: cn(sz.icon) }) }),
9358
+ /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)("div", { className: "min-w-0 flex-1", children: [
9359
+ /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)("div", { className: "flex items-center gap-2", children: [
9360
+ label && /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("div", { className: cn(sz.label, "text-foreground font-medium truncate"), children: label }),
9361
+ badge && /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("span", { className: cn("px-2 py-0.5 rounded-full text-[11px] font-medium shrink-0", BADGE_VARIANTS[badgeVariant]), children: badge })
9362
+ ] }),
9363
+ description && /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("div", { className: cn(sz.desc, "text-muted-foreground truncate mt-0.5"), children: description }),
9364
+ children && /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("div", { className: "mt-1", children })
9365
+ ] }),
9366
+ action && /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("div", { className: "opacity-0 group-hover/item:opacity-100 transition-opacity shrink-0", children: action }),
9367
+ collapsible ? /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
9368
+ "span",
9369
+ {
9370
+ className: cn("text-muted-foreground shrink-0 transition-transform cursor-pointer select-none", sz.icon, isExpanded && "rotate-90"),
9371
+ children: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(import_lucide_react22.ChevronRight, { className: cn(sz.icon) })
9372
+ }
9373
+ ) : Right && /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("span", { className: cn("text-muted-foreground shrink-0", sz.icon), children: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(Right, { className: cn(sz.icon) }) })
9374
+ ] }),
9375
+ collapsible && isExpanded && expandContent && /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("div", { className: cn("border-t border-border/50 bg-muted/20", contentClassName, "pt-3"), children: expandContent })
9395
9376
  ] });
9396
- const baseCls = cn(
9397
- "relative w-full",
9398
- selected && "bg-primary/10 ring-1 ring-primary/30",
9399
- disabled && "opacity-60 cursor-not-allowed",
9400
- className
9401
- );
9377
+ const baseCls = cn("relative w-full", selected && "bg-primary/10 ring-1 ring-primary/30", disabled && "opacity-60 cursor-not-allowed", className);
9402
9378
  if (href) {
9403
9379
  const A = as === "a" ? "a" : "a";
9404
9380
  return /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(A, { ref, href, className: cn(baseCls, "block"), ...rest, children: inner });
9405
9381
  }
9406
9382
  if (as === "button" && !collapsible) {
9407
- return /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
9408
- "button",
9409
- {
9410
- ref,
9411
- type: "button",
9412
- className: cn(baseCls, "text-left block w-full"),
9413
- ...rest,
9414
- children: inner
9415
- }
9416
- );
9383
+ return /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("button", { ref, type: "button", className: cn(baseCls, "text-left block w-full"), ...rest, children: inner });
9417
9384
  }
9418
9385
  if (collapsible) {
9419
- return /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
9420
- "div",
9421
- {
9422
- ref,
9423
- className: cn(baseCls, "text-left block w-full"),
9424
- ...rest,
9425
- children: inner
9426
- }
9427
- );
9386
+ return /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("div", { ref, className: cn(baseCls, "text-left block w-full"), ...rest, children: inner });
9428
9387
  }
9429
9388
  const Comp = as;
9430
9389
  return /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(Comp, { ref, className: baseCls, ...rest, children: inner });