@arbidocs/blocks 0.3.128 → 0.3.129
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 +102 -76
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +13 -14
- package/dist/index.d.ts +13 -14
- package/dist/index.js +104 -78
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/dist/index.cjs
CHANGED
|
@@ -1058,7 +1058,7 @@ function MetricCard({
|
|
|
1058
1058
|
] });
|
|
1059
1059
|
}
|
|
1060
1060
|
var MAX_AVATARS = 3;
|
|
1061
|
-
var ON_HOVER = "opacity-0 transition-opacity group-hover:opacity-100 group-focus-within:opacity-100";
|
|
1061
|
+
var ON_HOVER = "opacity-0 transition-opacity group-hover/workspace-card:opacity-100 group-focus-within/workspace-card:opacity-100";
|
|
1062
1062
|
function WorkspaceCard({
|
|
1063
1063
|
name,
|
|
1064
1064
|
matterRef,
|
|
@@ -1074,6 +1074,7 @@ function WorkspaceCard({
|
|
|
1074
1074
|
onOpen,
|
|
1075
1075
|
icon: Icon = lucideReact.FolderLock,
|
|
1076
1076
|
iconSlot,
|
|
1077
|
+
tooltipEntitySlot,
|
|
1077
1078
|
cornerSlot,
|
|
1078
1079
|
accent = "default",
|
|
1079
1080
|
testId,
|
|
@@ -1083,24 +1084,39 @@ function WorkspaceCard({
|
|
|
1083
1084
|
const totalMembers = memberCount ?? members.length;
|
|
1084
1085
|
const shownMembers = membersHidden ? [] : members.slice(0, MAX_AVATARS);
|
|
1085
1086
|
const extraMembers = totalMembers - shownMembers.length;
|
|
1086
|
-
const
|
|
1087
|
+
const actionTestId = buttonTestId ?? (testId ? `${testId}-open` : void 0);
|
|
1088
|
+
const canOpen = Boolean(onOpen) && !busy;
|
|
1087
1089
|
const hue = accent && accent !== "default" ? `var(--color-${accent})` : null;
|
|
1088
1090
|
const tileStyle = hue ? { backgroundColor: `color-mix(in oklab, ${hue} 14%, transparent)`, color: hue } : void 0;
|
|
1089
|
-
const
|
|
1091
|
+
const openStyle = hue ? { backgroundColor: hue, color: "var(--color-background)" } : void 0;
|
|
1092
|
+
const handleKeyDown = (event) => {
|
|
1093
|
+
if (!canOpen || event.target !== event.currentTarget) return;
|
|
1094
|
+
if (event.key === "Enter" || event.key === " ") {
|
|
1095
|
+
event.preventDefault();
|
|
1096
|
+
onOpen?.();
|
|
1097
|
+
}
|
|
1098
|
+
};
|
|
1090
1099
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1091
1100
|
react.Card,
|
|
1092
1101
|
{
|
|
1093
|
-
variant: "
|
|
1102
|
+
variant: "flat",
|
|
1094
1103
|
className: react.cn(
|
|
1095
|
-
"card-hover group flex flex-col gap-3 p-4",
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
active && "ring-1 ring-primary",
|
|
1104
|
+
"card-hover group/workspace-card relative flex h-48 w-full flex-col gap-3 overflow-hidden rounded-xl bg-card p-4 shadow-sm",
|
|
1105
|
+
canOpen && "cursor-pointer focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary focus-visible:ring-offset-2",
|
|
1106
|
+
active && "bg-primary/10 shadow-md",
|
|
1099
1107
|
className
|
|
1100
1108
|
),
|
|
1101
1109
|
"data-testid": testId,
|
|
1110
|
+
"data-active": active || void 0,
|
|
1111
|
+
role: canOpen ? "button" : void 0,
|
|
1112
|
+
tabIndex: canOpen ? 0 : void 0,
|
|
1113
|
+
"aria-current": active ? "page" : void 0,
|
|
1114
|
+
"aria-label": canOpen ? `Open workspace ${name}` : void 0,
|
|
1115
|
+
"aria-busy": busy || void 0,
|
|
1116
|
+
onClick: canOpen ? onOpen : void 0,
|
|
1117
|
+
onKeyDown: handleKeyDown,
|
|
1102
1118
|
children: [
|
|
1103
|
-
/* @__PURE__ */ jsxRuntime.jsxs(react.CardHeader, { className: "flex flex-row items-
|
|
1119
|
+
/* @__PURE__ */ jsxRuntime.jsxs(react.CardHeader, { className: "flex flex-row items-center gap-3 space-y-0 p-0", children: [
|
|
1104
1120
|
iconSlot ?? /* @__PURE__ */ jsxRuntime.jsx(
|
|
1105
1121
|
"div",
|
|
1106
1122
|
{
|
|
@@ -1113,7 +1129,7 @@ function WorkspaceCard({
|
|
|
1113
1129
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1114
1130
|
react.CardTitle,
|
|
1115
1131
|
{
|
|
1116
|
-
className: "line-clamp-2 text-base leading-tight",
|
|
1132
|
+
className: "line-clamp-2 text-base font-bold leading-tight",
|
|
1117
1133
|
"data-testid": testId && `${testId}-title`,
|
|
1118
1134
|
children: name
|
|
1119
1135
|
}
|
|
@@ -1122,88 +1138,98 @@ function WorkspaceCard({
|
|
|
1122
1138
|
] }),
|
|
1123
1139
|
cornerSlot && /* @__PURE__ */ jsxRuntime.jsx("div", { className: react.cn("shrink-0", ON_HOVER), children: cornerSlot })
|
|
1124
1140
|
] }),
|
|
1125
|
-
/* @__PURE__ */ jsxRuntime.jsxs(react.CardContent, { className: "flex flex-1 flex-col
|
|
1126
|
-
description && /* @__PURE__ */ jsxRuntime.
|
|
1127
|
-
|
|
1128
|
-
/* @__PURE__ */ jsxRuntime.
|
|
1129
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1130
|
-
/* @__PURE__ */ jsxRuntime.jsx("
|
|
1131
|
-
] })
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1141
|
+
/* @__PURE__ */ jsxRuntime.jsxs(react.CardContent, { className: "relative flex min-h-0 flex-1 flex-col p-0", children: [
|
|
1142
|
+
description && /* @__PURE__ */ jsxRuntime.jsxs(react.Tooltip, { children: [
|
|
1143
|
+
/* @__PURE__ */ jsxRuntime.jsx(react.TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx("p", { className: "line-clamp-2 text-sm text-muted-foreground transition-opacity group-hover/workspace-card:opacity-0 group-focus-within/workspace-card:opacity-0", children: description }) }),
|
|
1144
|
+
/* @__PURE__ */ jsxRuntime.jsx(react.TooltipContent, { side: "top", className: "max-w-sm p-0", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "overflow-hidden rounded-md", children: [
|
|
1145
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex items-center bg-muted/70 px-3 py-2.5", children: tooltipEntitySlot ?? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-sm font-semibold", children: name }) }),
|
|
1146
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "px-3 py-3 text-sm leading-relaxed text-foreground/90", children: description })
|
|
1147
|
+
] }) })
|
|
1148
|
+
] }),
|
|
1149
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1150
|
+
"span",
|
|
1151
|
+
{
|
|
1152
|
+
className: react.cn(
|
|
1153
|
+
"pointer-events-none absolute inset-0 z-10 inline-flex items-center justify-center whitespace-nowrap",
|
|
1154
|
+
!busy && "opacity-0 transition-opacity group-hover/workspace-card:opacity-100 group-focus-within/workspace-card:opacity-100"
|
|
1155
|
+
),
|
|
1156
|
+
"data-testid": actionTestId,
|
|
1157
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1139
1158
|
"span",
|
|
1140
1159
|
{
|
|
1141
|
-
className:
|
|
1142
|
-
|
|
1143
|
-
|
|
1160
|
+
className: react.cn(
|
|
1161
|
+
"inline-flex w-full items-center justify-center gap-2 rounded-md px-4 py-2 text-base font-semibold shadow-md",
|
|
1162
|
+
active ? "bg-muted-foreground text-background" : "bg-primary text-primary-foreground"
|
|
1163
|
+
),
|
|
1164
|
+
style: active ? void 0 : openStyle,
|
|
1165
|
+
children: active ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
1166
|
+
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.CheckCircle2, { className: "size-4" }),
|
|
1167
|
+
" Current workspace"
|
|
1168
|
+
] }) : busy ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
1169
|
+
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.Loader2, { className: "size-4 animate-spin" }),
|
|
1170
|
+
" Opening"
|
|
1171
|
+
] }) : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
1172
|
+
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.ArrowLeftRight, { className: "size-4" }),
|
|
1173
|
+
" Open"
|
|
1174
|
+
] })
|
|
1144
1175
|
}
|
|
1145
1176
|
)
|
|
1146
|
-
] }),
|
|
1147
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "ml-auto flex shrink-0 -space-x-2", children: [
|
|
1148
|
-
shownMembers.map((m, i) => /* @__PURE__ */ jsxRuntime.jsxs(react.Avatar, { className: "size-6 border-2 border-card", title: m.name, children: [
|
|
1149
|
-
m.picture && /* @__PURE__ */ jsxRuntime.jsx(react.AvatarImage, { src: m.picture, alt: m.name }),
|
|
1150
|
-
/* @__PURE__ */ jsxRuntime.jsx(react.AvatarFallback, { className: "bg-foreground text-[9px] font-medium text-background", children: chunkAHWIZJ4M_cjs.initials(m.name || "?") })
|
|
1151
|
-
] }, i)),
|
|
1152
|
-
!membersHidden && extraMembers > 0 && /* @__PURE__ */ jsxRuntime.jsx(react.Avatar, { className: "size-6 border-2 border-card", children: /* @__PURE__ */ jsxRuntime.jsxs(react.AvatarFallback, { className: "bg-accent text-[9px] font-medium text-muted-foreground", children: [
|
|
1153
|
-
"+",
|
|
1154
|
-
extraMembers
|
|
1155
|
-
] }) })
|
|
1156
|
-
] })
|
|
1157
|
-
] })
|
|
1158
|
-
] }),
|
|
1159
|
-
/* @__PURE__ */ jsxRuntime.jsx(react.CardFooter, { className: "grid min-h-8 place-items-center p-0", children: active ? (
|
|
1160
|
-
// Reads as a statement, not a call to action — but stays clickable, so
|
|
1161
|
-
// re-entering the workspace you're already in still works.
|
|
1162
|
-
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
1163
|
-
react.Button,
|
|
1164
|
-
{
|
|
1165
|
-
variant: "ghost",
|
|
1166
|
-
size: "sm",
|
|
1167
|
-
className: "col-start-1 row-start-1 h-8 whitespace-nowrap px-2 text-xs font-medium text-primary hover:bg-primary/10",
|
|
1168
|
-
onClick: onOpen,
|
|
1169
|
-
"data-testid": btnTestId,
|
|
1170
|
-
children: [
|
|
1171
|
-
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.CheckCircle2, { className: "size-3.5" }),
|
|
1172
|
-
" Current workspace"
|
|
1173
|
-
]
|
|
1174
1177
|
}
|
|
1175
1178
|
)
|
|
1176
|
-
)
|
|
1179
|
+
] }),
|
|
1180
|
+
/* @__PURE__ */ jsxRuntime.jsxs(react.CardFooter, { className: "mt-auto flex w-full min-w-0 flex-col items-stretch gap-3 overflow-hidden p-0", children: [
|
|
1181
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex w-full items-center gap-x-3 text-sm", children: [
|
|
1182
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-x-3", children: [
|
|
1183
|
+
/* @__PURE__ */ jsxRuntime.jsxs("span", { className: "inline-flex items-center gap-1 text-foreground", title: "Documents", children: [
|
|
1184
|
+
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.FileText, { className: "size-3.5 text-muted-foreground" }),
|
|
1185
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "font-medium tabular-nums", children: docCount.toLocaleString() })
|
|
1186
|
+
] }),
|
|
1187
|
+
chatCount !== void 0 && /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "inline-flex items-center gap-1 text-foreground", title: "Chats", children: [
|
|
1188
|
+
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.MessagesSquare, { className: "size-3.5 text-muted-foreground" }),
|
|
1189
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "font-medium tabular-nums", children: chatCount.toLocaleString() })
|
|
1190
|
+
] }),
|
|
1191
|
+
/* @__PURE__ */ jsxRuntime.jsxs("span", { className: "inline-flex items-center gap-1 text-foreground", title: "Members", children: [
|
|
1192
|
+
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.Users, { className: "size-3.5 text-muted-foreground" }),
|
|
1193
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1194
|
+
"span",
|
|
1195
|
+
{
|
|
1196
|
+
className: "font-medium tabular-nums",
|
|
1197
|
+
"data-testid": testId && `${testId}-member-count`,
|
|
1198
|
+
children: membersHidden ? "\u2014" : totalMembers
|
|
1199
|
+
}
|
|
1200
|
+
)
|
|
1201
|
+
] })
|
|
1202
|
+
] }),
|
|
1203
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
1204
|
+
"div",
|
|
1205
|
+
{
|
|
1206
|
+
className: "ml-auto flex shrink-0 -space-x-2",
|
|
1207
|
+
"data-testid": testId && `${testId}-member-avatars`,
|
|
1208
|
+
children: [
|
|
1209
|
+
shownMembers.map((m, i) => /* @__PURE__ */ jsxRuntime.jsxs(react.Avatar, { className: "size-6 border-2 border-card", title: m.name, children: [
|
|
1210
|
+
m.picture && /* @__PURE__ */ jsxRuntime.jsx(react.AvatarImage, { src: m.picture, alt: m.name }),
|
|
1211
|
+
/* @__PURE__ */ jsxRuntime.jsx(react.AvatarFallback, { className: "bg-foreground text-[9px] font-medium text-background", children: chunkAHWIZJ4M_cjs.initials(m.name || "?") })
|
|
1212
|
+
] }, i)),
|
|
1213
|
+
!membersHidden && extraMembers > 0 && /* @__PURE__ */ jsxRuntime.jsx(react.Avatar, { className: "size-6 border-2 border-card", children: /* @__PURE__ */ jsxRuntime.jsxs(react.AvatarFallback, { className: "bg-accent text-[9px] font-medium text-muted-foreground", children: [
|
|
1214
|
+
"+",
|
|
1215
|
+
extraMembers
|
|
1216
|
+
] }) })
|
|
1217
|
+
]
|
|
1218
|
+
}
|
|
1219
|
+
)
|
|
1220
|
+
] }),
|
|
1177
1221
|
updatedAt && /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1178
1222
|
"span",
|
|
1179
1223
|
{
|
|
1180
|
-
className:
|
|
1181
|
-
"col-start-1 row-start-1 whitespace-nowrap text-xs text-muted-foreground",
|
|
1182
|
-
"transition-opacity group-hover:opacity-0 group-focus-within:opacity-0"
|
|
1183
|
-
),
|
|
1224
|
+
className: "min-w-0 max-w-full self-start truncate text-left text-xs text-muted-foreground",
|
|
1184
1225
|
title: chunkAHWIZJ4M_cjs.fmtDate(updatedAt),
|
|
1185
1226
|
children: [
|
|
1186
1227
|
"Updated ",
|
|
1187
1228
|
chunkAHWIZJ4M_cjs.fromNow(updatedAt)
|
|
1188
1229
|
]
|
|
1189
1230
|
}
|
|
1190
|
-
),
|
|
1191
|
-
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
1192
|
-
react.Button,
|
|
1193
|
-
{
|
|
1194
|
-
size: "sm",
|
|
1195
|
-
className: react.cn("col-start-1 row-start-1 whitespace-nowrap", ON_HOVER),
|
|
1196
|
-
style: buttonStyle,
|
|
1197
|
-
onClick: onOpen,
|
|
1198
|
-
disabled: busy,
|
|
1199
|
-
"data-testid": btnTestId,
|
|
1200
|
-
children: [
|
|
1201
|
-
busy ? /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Loader2, { className: "size-3.5 animate-spin" }) : /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ArrowLeftRight, { className: "size-3.5" }),
|
|
1202
|
-
"Open"
|
|
1203
|
-
]
|
|
1204
|
-
}
|
|
1205
1231
|
)
|
|
1206
|
-
] })
|
|
1232
|
+
] })
|
|
1207
1233
|
]
|
|
1208
1234
|
}
|
|
1209
1235
|
);
|