@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 +44 -67
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +4 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +44 -67
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -1179,6 +1179,8 @@ interface ListProps extends React$1.HTMLAttributes<HTMLUListElement> {
|
|
|
1179
1179
|
emptyText?: string;
|
|
1180
1180
|
/** Make items more compact */
|
|
1181
1181
|
dense?: boolean;
|
|
1182
|
+
/** Class name customization for all list items */
|
|
1183
|
+
itemClassName?: string;
|
|
1182
1184
|
}
|
|
1183
1185
|
interface ListItemProps extends React$1.HTMLAttributes<HTMLLIElement> {
|
|
1184
1186
|
as?: "li" | "div" | "a" | "button";
|
|
@@ -1209,6 +1211,8 @@ interface ListItemProps extends React$1.HTMLAttributes<HTMLLIElement> {
|
|
|
1209
1211
|
onExpandChange?: (expanded: boolean) => void;
|
|
1210
1212
|
/** Content to show when expanded */
|
|
1211
1213
|
expandContent?: React$1.ReactNode;
|
|
1214
|
+
/** Custom class for inner content container (use for padding) */
|
|
1215
|
+
contentClassName?: string;
|
|
1212
1216
|
}
|
|
1213
1217
|
declare const ListItem: React$1.ForwardRefExoticComponent<ListItemProps & React$1.RefAttributes<HTMLLIElement>>;
|
|
1214
1218
|
declare const List: React$1.ForwardRefExoticComponent<ListProps & React$1.RefAttributes<HTMLUListElement>> & {
|
package/dist/index.d.ts
CHANGED
|
@@ -1179,6 +1179,8 @@ interface ListProps extends React$1.HTMLAttributes<HTMLUListElement> {
|
|
|
1179
1179
|
emptyText?: string;
|
|
1180
1180
|
/** Make items more compact */
|
|
1181
1181
|
dense?: boolean;
|
|
1182
|
+
/** Class name customization for all list items */
|
|
1183
|
+
itemClassName?: string;
|
|
1182
1184
|
}
|
|
1183
1185
|
interface ListItemProps extends React$1.HTMLAttributes<HTMLLIElement> {
|
|
1184
1186
|
as?: "li" | "div" | "a" | "button";
|
|
@@ -1209,6 +1211,8 @@ interface ListItemProps extends React$1.HTMLAttributes<HTMLLIElement> {
|
|
|
1209
1211
|
onExpandChange?: (expanded: boolean) => void;
|
|
1210
1212
|
/** Content to show when expanded */
|
|
1211
1213
|
expandContent?: React$1.ReactNode;
|
|
1214
|
+
/** Custom class for inner content container (use for padding) */
|
|
1215
|
+
contentClassName?: string;
|
|
1212
1216
|
}
|
|
1213
1217
|
declare const ListItem: React$1.ForwardRefExoticComponent<ListItemProps & React$1.RefAttributes<HTMLLIElement>>;
|
|
1214
1218
|
declare const List: React$1.ForwardRefExoticComponent<ListProps & React$1.RefAttributes<HTMLUListElement>> & {
|
package/dist/index.js
CHANGED
|
@@ -9029,10 +9029,10 @@ import * as React33 from "react";
|
|
|
9029
9029
|
import { ChevronRight as ChevronRight7 } from "lucide-react";
|
|
9030
9030
|
import { Fragment as Fragment13, jsx as jsx40, jsxs as jsxs35 } from "react/jsx-runtime";
|
|
9031
9031
|
var SIZE_STYLES2 = {
|
|
9032
|
-
xs: {
|
|
9033
|
-
sm: {
|
|
9034
|
-
md: {
|
|
9035
|
-
lg: {
|
|
9032
|
+
xs: { label: "text-xs", desc: "text-[11px]", icon: "h-3.5 w-3.5", avatar: "h-6 w-6" },
|
|
9033
|
+
sm: { label: "text-[13px]", desc: "text-[12px]", icon: "h-4 w-4", avatar: "h-8 w-8" },
|
|
9034
|
+
md: { label: "text-sm", desc: "text-xs", icon: "h-5 w-5", avatar: "h-10 w-10" },
|
|
9035
|
+
lg: { label: "text-base", desc: "text-sm", icon: "h-5 w-5", avatar: "h-12 w-12" }
|
|
9036
9036
|
};
|
|
9037
9037
|
var BADGE_VARIANTS = {
|
|
9038
9038
|
default: "bg-muted text-muted-foreground",
|
|
@@ -9043,7 +9043,7 @@ var BADGE_VARIANTS = {
|
|
|
9043
9043
|
};
|
|
9044
9044
|
var ListItemSkeleton = ({ size }) => {
|
|
9045
9045
|
const sz = SIZE_STYLES2[size];
|
|
9046
|
-
return /* @__PURE__ */ jsxs35("div", { className: cn("flex items-center gap-3 animate-pulse"
|
|
9046
|
+
return /* @__PURE__ */ jsxs35("div", { className: cn("flex items-center gap-3 animate-pulse p-2"), children: [
|
|
9047
9047
|
/* @__PURE__ */ jsx40("div", { className: cn("rounded-full bg-muted shrink-0", sz.avatar) }),
|
|
9048
9048
|
/* @__PURE__ */ jsxs35("div", { className: "flex-1 space-y-2", children: [
|
|
9049
9049
|
/* @__PURE__ */ jsx40("div", { className: "h-4 bg-muted rounded w-3/4" }),
|
|
@@ -9065,6 +9065,8 @@ var ListRoot = React33.forwardRef(
|
|
|
9065
9065
|
emptyText,
|
|
9066
9066
|
dense = false,
|
|
9067
9067
|
className,
|
|
9068
|
+
itemClassName,
|
|
9069
|
+
// New prop
|
|
9068
9070
|
children,
|
|
9069
9071
|
...rest
|
|
9070
9072
|
}, ref) => {
|
|
@@ -9081,7 +9083,15 @@ var ListRoot = React33.forwardRef(
|
|
|
9081
9083
|
striped: "rounded-lg border border-border overflow-hidden"
|
|
9082
9084
|
};
|
|
9083
9085
|
if (loading2) {
|
|
9084
|
-
return /* @__PURE__ */ jsx40(
|
|
9086
|
+
return /* @__PURE__ */ jsx40(
|
|
9087
|
+
Comp,
|
|
9088
|
+
{
|
|
9089
|
+
ref,
|
|
9090
|
+
className: cn("group/list", variantClasses2[variant], inset && "p-1.5 md:p-2", divided && "divide-y divide-border/60", className),
|
|
9091
|
+
...rest,
|
|
9092
|
+
children: Array.from({ length: loadingCount }).map((_, i) => /* @__PURE__ */ jsx40(ListItemSkeleton, { size }, i))
|
|
9093
|
+
}
|
|
9094
|
+
);
|
|
9085
9095
|
}
|
|
9086
9096
|
if (!hasChildren && emptyText) {
|
|
9087
9097
|
return /* @__PURE__ */ jsx40(Comp, { ref, className: cn("group/list", variantClasses2[variant], inset && "p-1.5 md:p-2", className), ...rest, children: /* @__PURE__ */ jsx40("div", { className: "text-center py-8 text-muted-foreground text-sm", children: emptyText }) });
|
|
@@ -9108,6 +9118,8 @@ var ListRoot = React33.forwardRef(
|
|
|
9108
9118
|
);
|
|
9109
9119
|
return React33.cloneElement(child, {
|
|
9110
9120
|
className: childClass,
|
|
9121
|
+
// Pass global item class to contentClassName of ListItem
|
|
9122
|
+
contentClassName: cn(itemClassName, child.props?.contentClassName),
|
|
9111
9123
|
"data-first": idx === 0 ? "true" : void 0,
|
|
9112
9124
|
"data-last": idx === childCount - 1 ? "true" : void 0,
|
|
9113
9125
|
"data-size": size,
|
|
@@ -9138,17 +9150,15 @@ var ListItem = React33.forwardRef(
|
|
|
9138
9150
|
onExpandChange,
|
|
9139
9151
|
expandContent,
|
|
9140
9152
|
className,
|
|
9153
|
+
contentClassName,
|
|
9141
9154
|
children,
|
|
9142
9155
|
...rest
|
|
9143
9156
|
}, ref) => {
|
|
9144
9157
|
const [internalExpanded, setInternalExpanded] = React33.useState(false);
|
|
9145
9158
|
const isExpanded = controlledExpanded !== void 0 ? controlledExpanded : internalExpanded;
|
|
9146
9159
|
const sizeAttr = rest["data-size"];
|
|
9147
|
-
const
|
|
9148
|
-
const isDense = denseAttr === "true";
|
|
9149
|
-
const resolvedSize = sizeAttr && (sizeAttr === "xs" || sizeAttr === "sm" || sizeAttr === "md" || sizeAttr === "lg") ? sizeAttr : "md";
|
|
9160
|
+
const resolvedSize = sizeAttr && ["xs", "sm", "md", "lg"].includes(sizeAttr) ? sizeAttr : "md";
|
|
9150
9161
|
const sz = SIZE_STYLES2[resolvedSize];
|
|
9151
|
-
const padding = isDense ? sz.densePad : sz.itemPad;
|
|
9152
9162
|
const toggleExpanded = () => {
|
|
9153
9163
|
const newExpanded = !isExpanded;
|
|
9154
9164
|
if (onExpandChange) {
|
|
@@ -9170,71 +9180,38 @@ var ListItem = React33.forwardRef(
|
|
|
9170
9180
|
}
|
|
9171
9181
|
} : {};
|
|
9172
9182
|
const inner = /* @__PURE__ */ jsxs35(Fragment13, { children: [
|
|
9173
|
-
/* @__PURE__ */ jsxs35(
|
|
9174
|
-
"div",
|
|
9175
|
-
{
|
|
9176
|
-
|
|
9177
|
-
|
|
9178
|
-
|
|
9179
|
-
|
|
9180
|
-
|
|
9181
|
-
|
|
9182
|
-
|
|
9183
|
-
|
|
9184
|
-
|
|
9185
|
-
|
|
9186
|
-
|
|
9187
|
-
|
|
9188
|
-
|
|
9189
|
-
|
|
9190
|
-
|
|
9191
|
-
|
|
9192
|
-
|
|
9193
|
-
|
|
9194
|
-
"text-muted-foreground shrink-0 transition-transform cursor-pointer select-none",
|
|
9195
|
-
sz.icon,
|
|
9196
|
-
isExpanded && "rotate-90"
|
|
9197
|
-
),
|
|
9198
|
-
children: /* @__PURE__ */ jsx40(ChevronRight7, { className: cn(sz.icon) })
|
|
9199
|
-
}
|
|
9200
|
-
) : Right && /* @__PURE__ */ jsx40("span", { className: cn("text-muted-foreground shrink-0", sz.icon), children: /* @__PURE__ */ jsx40(Right, { className: cn(sz.icon) }) })
|
|
9201
|
-
]
|
|
9202
|
-
}
|
|
9203
|
-
),
|
|
9204
|
-
collapsible && isExpanded && expandContent && /* @__PURE__ */ jsx40("div", { className: cn("border-t border-border/50 bg-muted/20", padding, "pt-3"), children: expandContent })
|
|
9183
|
+
/* @__PURE__ */ jsxs35("div", { className: cn("flex items-center gap-3", contentClassName, "group/item relative"), ...headerProps, children: [
|
|
9184
|
+
avatar && /* @__PURE__ */ jsx40("div", { className: cn("shrink-0", sz.avatar), children: typeof avatar === "string" ? /* @__PURE__ */ jsx40("img", { src: avatar, alt: "", className: cn("rounded-full object-cover", sz.avatar) }) : avatar }),
|
|
9185
|
+
Left && !avatar && /* @__PURE__ */ jsx40("span", { className: cn("text-muted-foreground shrink-0", sz.icon), children: /* @__PURE__ */ jsx40(Left, { className: cn(sz.icon) }) }),
|
|
9186
|
+
/* @__PURE__ */ jsxs35("div", { className: "min-w-0 flex-1", children: [
|
|
9187
|
+
/* @__PURE__ */ jsxs35("div", { className: "flex items-center gap-2", children: [
|
|
9188
|
+
label && /* @__PURE__ */ jsx40("div", { className: cn(sz.label, "text-foreground font-medium truncate"), children: label }),
|
|
9189
|
+
badge && /* @__PURE__ */ jsx40("span", { className: cn("px-2 py-0.5 rounded-full text-[11px] font-medium shrink-0", BADGE_VARIANTS[badgeVariant]), children: badge })
|
|
9190
|
+
] }),
|
|
9191
|
+
description && /* @__PURE__ */ jsx40("div", { className: cn(sz.desc, "text-muted-foreground truncate mt-0.5"), children: description }),
|
|
9192
|
+
children && /* @__PURE__ */ jsx40("div", { className: "mt-1", children })
|
|
9193
|
+
] }),
|
|
9194
|
+
action && /* @__PURE__ */ jsx40("div", { className: "opacity-0 group-hover/item:opacity-100 transition-opacity shrink-0", children: action }),
|
|
9195
|
+
collapsible ? /* @__PURE__ */ jsx40(
|
|
9196
|
+
"span",
|
|
9197
|
+
{
|
|
9198
|
+
className: cn("text-muted-foreground shrink-0 transition-transform cursor-pointer select-none", sz.icon, isExpanded && "rotate-90"),
|
|
9199
|
+
children: /* @__PURE__ */ jsx40(ChevronRight7, { className: cn(sz.icon) })
|
|
9200
|
+
}
|
|
9201
|
+
) : Right && /* @__PURE__ */ jsx40("span", { className: cn("text-muted-foreground shrink-0", sz.icon), children: /* @__PURE__ */ jsx40(Right, { className: cn(sz.icon) }) })
|
|
9202
|
+
] }),
|
|
9203
|
+
collapsible && isExpanded && expandContent && /* @__PURE__ */ jsx40("div", { className: cn("border-t border-border/50 bg-muted/20", contentClassName, "pt-3"), children: expandContent })
|
|
9205
9204
|
] });
|
|
9206
|
-
const baseCls = cn(
|
|
9207
|
-
"relative w-full",
|
|
9208
|
-
selected && "bg-primary/10 ring-1 ring-primary/30",
|
|
9209
|
-
disabled && "opacity-60 cursor-not-allowed",
|
|
9210
|
-
className
|
|
9211
|
-
);
|
|
9205
|
+
const baseCls = cn("relative w-full", selected && "bg-primary/10 ring-1 ring-primary/30", disabled && "opacity-60 cursor-not-allowed", className);
|
|
9212
9206
|
if (href) {
|
|
9213
9207
|
const A = as === "a" ? "a" : "a";
|
|
9214
9208
|
return /* @__PURE__ */ jsx40(A, { ref, href, className: cn(baseCls, "block"), ...rest, children: inner });
|
|
9215
9209
|
}
|
|
9216
9210
|
if (as === "button" && !collapsible) {
|
|
9217
|
-
return /* @__PURE__ */ jsx40(
|
|
9218
|
-
"button",
|
|
9219
|
-
{
|
|
9220
|
-
ref,
|
|
9221
|
-
type: "button",
|
|
9222
|
-
className: cn(baseCls, "text-left block w-full"),
|
|
9223
|
-
...rest,
|
|
9224
|
-
children: inner
|
|
9225
|
-
}
|
|
9226
|
-
);
|
|
9211
|
+
return /* @__PURE__ */ jsx40("button", { ref, type: "button", className: cn(baseCls, "text-left block w-full"), ...rest, children: inner });
|
|
9227
9212
|
}
|
|
9228
9213
|
if (collapsible) {
|
|
9229
|
-
return /* @__PURE__ */ jsx40(
|
|
9230
|
-
"div",
|
|
9231
|
-
{
|
|
9232
|
-
ref,
|
|
9233
|
-
className: cn(baseCls, "text-left block w-full"),
|
|
9234
|
-
...rest,
|
|
9235
|
-
children: inner
|
|
9236
|
-
}
|
|
9237
|
-
);
|
|
9214
|
+
return /* @__PURE__ */ jsx40("div", { ref, className: cn(baseCls, "text-left block w-full"), ...rest, children: inner });
|
|
9238
9215
|
}
|
|
9239
9216
|
const Comp = as;
|
|
9240
9217
|
return /* @__PURE__ */ jsx40(Comp, { ref, className: baseCls, ...rest, children: inner });
|