@arbidocs/blocks 0.3.129 → 0.3.130

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
@@ -1058,7 +1058,6 @@ function MetricCard({
1058
1058
  ] });
1059
1059
  }
1060
1060
  var MAX_AVATARS = 3;
1061
- var ON_HOVER = "opacity-0 transition-opacity group-hover/workspace-card:opacity-100 group-focus-within/workspace-card:opacity-100";
1062
1061
  function WorkspaceCard({
1063
1062
  name,
1064
1063
  matterRef,
@@ -1086,6 +1085,10 @@ function WorkspaceCard({
1086
1085
  const extraMembers = totalMembers - shownMembers.length;
1087
1086
  const actionTestId = buttonTestId ?? (testId ? `${testId}-open` : void 0);
1088
1087
  const canOpen = Boolean(onOpen) && !busy;
1088
+ const [isHoverPointerActive, setIsHoverPointerActive] = react$1.useState(false);
1089
+ const [isKeyboardFocused, setIsKeyboardFocused] = react$1.useState(false);
1090
+ const revealInteractiveContent = isHoverPointerActive || isKeyboardFocused;
1091
+ const showOpenAction = busy || revealInteractiveContent;
1089
1092
  const hue = accent && accent !== "default" ? `var(--color-${accent})` : null;
1090
1093
  const tileStyle = hue ? { backgroundColor: `color-mix(in oklab, ${hue} 14%, transparent)`, color: hue } : void 0;
1091
1094
  const openStyle = hue ? { backgroundColor: hue, color: "var(--color-background)" } : void 0;
@@ -1096,12 +1099,20 @@ function WorkspaceCard({
1096
1099
  onOpen?.();
1097
1100
  }
1098
1101
  };
1102
+ const handleFocusCapture = (event) => {
1103
+ setIsKeyboardFocused(event.target instanceof Element && event.target.matches(":focus-visible"));
1104
+ };
1105
+ const handleBlurCapture = (event) => {
1106
+ if (!event.currentTarget.contains(event.relatedTarget)) {
1107
+ setIsKeyboardFocused(false);
1108
+ }
1109
+ };
1099
1110
  return /* @__PURE__ */ jsxRuntime.jsxs(
1100
1111
  react.Card,
1101
1112
  {
1102
1113
  variant: "flat",
1103
1114
  className: react.cn(
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",
1115
+ "card-hover relative flex h-48 w-full flex-col gap-3 overflow-hidden rounded-xl bg-card p-4 shadow-sm",
1105
1116
  canOpen && "cursor-pointer focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary focus-visible:ring-offset-2",
1106
1117
  active && "bg-primary/10 shadow-md",
1107
1118
  className
@@ -1115,6 +1126,12 @@ function WorkspaceCard({
1115
1126
  "aria-busy": busy || void 0,
1116
1127
  onClick: canOpen ? onOpen : void 0,
1117
1128
  onKeyDown: handleKeyDown,
1129
+ onPointerEnter: (event) => {
1130
+ if (event.pointerType !== "touch") setIsHoverPointerActive(true);
1131
+ },
1132
+ onPointerLeave: () => setIsHoverPointerActive(false),
1133
+ onFocusCapture: handleFocusCapture,
1134
+ onBlurCapture: handleBlurCapture,
1118
1135
  children: [
1119
1136
  /* @__PURE__ */ jsxRuntime.jsxs(react.CardHeader, { className: "flex flex-row items-center gap-3 space-y-0 p-0", children: [
1120
1137
  iconSlot ?? /* @__PURE__ */ jsxRuntime.jsx(
@@ -1136,11 +1153,29 @@ function WorkspaceCard({
1136
1153
  ),
1137
1154
  matterRef && /* @__PURE__ */ jsxRuntime.jsx(react.CardDescription, { className: "mt-0.5 truncate text-xs font-medium uppercase tracking-wide text-muted-foreground", children: matterRef })
1138
1155
  ] }),
1139
- cornerSlot && /* @__PURE__ */ jsxRuntime.jsx("div", { className: react.cn("shrink-0", ON_HOVER), children: cornerSlot })
1156
+ cornerSlot && /* @__PURE__ */ jsxRuntime.jsx(
1157
+ "div",
1158
+ {
1159
+ className: react.cn(
1160
+ "shrink-0 opacity-0 transition-opacity",
1161
+ revealInteractiveContent && "opacity-100"
1162
+ ),
1163
+ children: cornerSlot
1164
+ }
1165
+ )
1140
1166
  ] }),
1141
1167
  /* @__PURE__ */ jsxRuntime.jsxs(react.CardContent, { className: "relative flex min-h-0 flex-1 flex-col p-0", children: [
1142
1168
  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 }) }),
1169
+ /* @__PURE__ */ jsxRuntime.jsx(react.TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(
1170
+ "p",
1171
+ {
1172
+ className: react.cn(
1173
+ "line-clamp-2 text-sm text-muted-foreground opacity-100 transition-opacity",
1174
+ showOpenAction && "opacity-0"
1175
+ ),
1176
+ children: description
1177
+ }
1178
+ ) }),
1144
1179
  /* @__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
1180
  /* @__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
1181
  /* @__PURE__ */ jsxRuntime.jsx("p", { className: "px-3 py-3 text-sm leading-relaxed text-foreground/90", children: description })
@@ -1150,8 +1185,8 @@ function WorkspaceCard({
1150
1185
  "span",
1151
1186
  {
1152
1187
  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"
1188
+ "pointer-events-none absolute inset-0 z-10 inline-flex items-center justify-center whitespace-nowrap opacity-0 transition-opacity",
1189
+ showOpenAction && "opacity-100"
1155
1190
  ),
1156
1191
  "data-testid": actionTestId,
1157
1192
  children: /* @__PURE__ */ jsxRuntime.jsx(