@underverse-ui/underverse 0.2.53 → 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
@@ -9201,10 +9201,10 @@ var React33 = __toESM(require("react"), 1);
9201
9201
  var import_lucide_react22 = require("lucide-react");
9202
9202
  var import_jsx_runtime40 = require("react/jsx-runtime");
9203
9203
  var SIZE_STYLES2 = {
9204
- 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" },
9205
- 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" },
9206
- 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" },
9207
- 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" }
9208
9208
  };
9209
9209
  var BADGE_VARIANTS = {
9210
9210
  default: "bg-muted text-muted-foreground",
@@ -9215,7 +9215,7 @@ var BADGE_VARIANTS = {
9215
9215
  };
9216
9216
  var ListItemSkeleton = ({ size }) => {
9217
9217
  const sz = SIZE_STYLES2[size];
9218
- 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: [
9219
9219
  /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("div", { className: cn("rounded-full bg-muted shrink-0", sz.avatar) }),
9220
9220
  /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)("div", { className: "flex-1 space-y-2", children: [
9221
9221
  /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("div", { className: "h-4 bg-muted rounded w-3/4" }),
@@ -9237,6 +9237,8 @@ var ListRoot = React33.forwardRef(
9237
9237
  emptyText,
9238
9238
  dense = false,
9239
9239
  className,
9240
+ itemClassName,
9241
+ // New prop
9240
9242
  children,
9241
9243
  ...rest
9242
9244
  }, ref) => {
@@ -9253,7 +9255,15 @@ var ListRoot = React33.forwardRef(
9253
9255
  striped: "rounded-lg border border-border overflow-hidden"
9254
9256
  };
9255
9257
  if (loading2) {
9256
- 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
+ );
9257
9267
  }
9258
9268
  if (!hasChildren && emptyText) {
9259
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 }) });
@@ -9280,6 +9290,8 @@ var ListRoot = React33.forwardRef(
9280
9290
  );
9281
9291
  return React33.cloneElement(child, {
9282
9292
  className: childClass,
9293
+ // Pass global item class to contentClassName of ListItem
9294
+ contentClassName: cn(itemClassName, child.props?.contentClassName),
9283
9295
  "data-first": idx === 0 ? "true" : void 0,
9284
9296
  "data-last": idx === childCount - 1 ? "true" : void 0,
9285
9297
  "data-size": size,
@@ -9310,17 +9322,15 @@ var ListItem = React33.forwardRef(
9310
9322
  onExpandChange,
9311
9323
  expandContent,
9312
9324
  className,
9325
+ contentClassName,
9313
9326
  children,
9314
9327
  ...rest
9315
9328
  }, ref) => {
9316
9329
  const [internalExpanded, setInternalExpanded] = React33.useState(false);
9317
9330
  const isExpanded = controlledExpanded !== void 0 ? controlledExpanded : internalExpanded;
9318
9331
  const sizeAttr = rest["data-size"];
9319
- const denseAttr = rest["data-dense"];
9320
- const isDense = denseAttr === "true";
9321
- 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";
9322
9333
  const sz = SIZE_STYLES2[resolvedSize];
9323
- const padding = isDense ? sz.densePad : sz.itemPad;
9324
9334
  const toggleExpanded = () => {
9325
9335
  const newExpanded = !isExpanded;
9326
9336
  if (onExpandChange) {
@@ -9342,71 +9352,38 @@ var ListItem = React33.forwardRef(
9342
9352
  }
9343
9353
  } : {};
9344
9354
  const inner = /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)(import_jsx_runtime40.Fragment, { children: [
9345
- /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)(
9346
- "div",
9347
- {
9348
- className: cn("flex items-center gap-3", padding, "group/item relative"),
9349
- ...headerProps,
9350
- children: [
9351
- 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 }),
9352
- 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) }) }),
9353
- /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)("div", { className: "min-w-0 flex-1", children: [
9354
- /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)("div", { className: "flex items-center gap-2", children: [
9355
- label && /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("div", { className: cn(sz.label, "text-foreground font-medium truncate"), children: label }),
9356
- 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 })
9357
- ] }),
9358
- description && /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("div", { className: cn(sz.desc, "text-muted-foreground truncate mt-0.5"), children: description }),
9359
- children && /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("div", { className: "mt-1", children })
9360
- ] }),
9361
- action && /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("div", { className: "opacity-0 group-hover/item:opacity-100 transition-opacity shrink-0", children: action }),
9362
- collapsible ? /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
9363
- "span",
9364
- {
9365
- className: cn(
9366
- "text-muted-foreground shrink-0 transition-transform cursor-pointer select-none",
9367
- sz.icon,
9368
- isExpanded && "rotate-90"
9369
- ),
9370
- children: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(import_lucide_react22.ChevronRight, { className: cn(sz.icon) })
9371
- }
9372
- ) : 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) }) })
9373
- ]
9374
- }
9375
- ),
9376
- 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 })
9377
9376
  ] });
9378
- const baseCls = cn(
9379
- "relative w-full",
9380
- selected && "bg-primary/10 ring-1 ring-primary/30",
9381
- disabled && "opacity-60 cursor-not-allowed",
9382
- className
9383
- );
9377
+ const baseCls = cn("relative w-full", selected && "bg-primary/10 ring-1 ring-primary/30", disabled && "opacity-60 cursor-not-allowed", className);
9384
9378
  if (href) {
9385
9379
  const A = as === "a" ? "a" : "a";
9386
9380
  return /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(A, { ref, href, className: cn(baseCls, "block"), ...rest, children: inner });
9387
9381
  }
9388
9382
  if (as === "button" && !collapsible) {
9389
- return /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
9390
- "button",
9391
- {
9392
- ref,
9393
- type: "button",
9394
- className: cn(baseCls, "text-left block w-full"),
9395
- ...rest,
9396
- children: inner
9397
- }
9398
- );
9383
+ return /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("button", { ref, type: "button", className: cn(baseCls, "text-left block w-full"), ...rest, children: inner });
9399
9384
  }
9400
9385
  if (collapsible) {
9401
- return /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
9402
- "div",
9403
- {
9404
- ref,
9405
- className: cn(baseCls, "text-left block w-full"),
9406
- ...rest,
9407
- children: inner
9408
- }
9409
- );
9386
+ return /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("div", { ref, className: cn(baseCls, "text-left block w-full"), ...rest, children: inner });
9410
9387
  }
9411
9388
  const Comp = as;
9412
9389
  return /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(Comp, { ref, className: baseCls, ...rest, children: inner });