@proveanything/smartlinks-utils-ui 1.13.4 → 1.13.6

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.
@@ -3,7 +3,7 @@ import { cn } from './chunk-L7FQ52F5.js';
3
3
  import React7, { useState, useRef, useEffect, useCallback, useMemo, useLayoutEffect } from 'react';
4
4
  import { createPortal } from 'react-dom';
5
5
  import * as SL from '@proveanything/smartlinks';
6
- import { Filter, Search, LayoutGrid, List, Loader2, AlertCircle, Tag, X, ImageOff, Wand2, Maximize2, Clipboard, Pencil, Check, Upload, Link, MicOff, Mic, ChevronDown, ChevronRight, Sparkles, Image as Image$1, Plus, FileIcon, Film, Music, FileText, AppWindow, MoreVertical, Trash2 } from 'lucide-react';
6
+ import { Filter, Search, LayoutGrid, List, Loader2, AlertCircle, Tag, X, ImageOff, Wand2, Maximize2, Clipboard, Pencil, Check, Upload, Link, MicOff, Mic, ChevronDown, ChevronRight, Sparkles, Image as Image$1, Plus, AlertTriangle, FileIcon, Film, Music, FileText, AppWindow, MoreVertical, Trash2 } from 'lucide-react';
7
7
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
8
8
 
9
9
  // src/components/AssetPicker/types.ts
@@ -408,7 +408,7 @@ var CardMenu = ({ onRename, onReplace, onEditTags, onDelete, position = "absolut
408
408
  {
409
409
  ref,
410
410
  className: cn(
411
- position === "absolute" ? "absolute top-1.5 right-1.5 z-10" : "relative flex-shrink-0"
411
+ position === "absolute" ? "absolute top-1.5 left-1.5 z-10" : "relative flex-shrink-0"
412
412
  ),
413
413
  onClick: (e) => e.stopPropagation(),
414
414
  onDoubleClick: (e) => e.stopPropagation(),
@@ -424,7 +424,11 @@ var CardMenu = ({ onRename, onReplace, onEditTags, onDelete, position = "absolut
424
424
  },
425
425
  className: cn(
426
426
  "w-6 h-6 rounded-full flex items-center justify-center transition-all",
427
- "bg-background/90 border border-border text-foreground hover:bg-background shadow-sm"
427
+ // Frosted pill so the button stays legible over both light and dark
428
+ // thumbnails. Backdrop blur + slight white tint + ring gives a clear
429
+ // outline regardless of the underlying image.
430
+ "bg-background/80 backdrop-blur-sm border border-border text-foreground",
431
+ "hover:bg-background shadow-sm ring-1 ring-black/10 dark:ring-white/20"
428
432
  ),
429
433
  title: "Asset actions",
430
434
  "aria-label": "Asset actions",
@@ -593,7 +597,7 @@ var AssetGridItem = ({ asset: asset2, selected, onToggle, onDoubleClick, onDelet
593
597
  ] })
594
598
  ] })
595
599
  ] }),
596
- selected && /* @__PURE__ */ jsx("div", { className: "absolute top-2 left-2 w-5 h-5 rounded-full bg-primary flex items-center justify-center z-10", children: /* @__PURE__ */ jsx(Check, { className: "w-3 h-3 text-primary-foreground" }) }),
600
+ selected && /* @__PURE__ */ jsx("div", { className: "absolute top-2 right-2 w-5 h-5 rounded-full bg-primary flex items-center justify-center z-10 shadow-sm ring-1 ring-black/10 dark:ring-white/20", children: /* @__PURE__ */ jsx(Check, { className: "w-3 h-3 text-primary-foreground" }) }),
597
601
  /* @__PURE__ */ jsx(
598
602
  CardMenu,
599
603
  {
@@ -2058,6 +2062,78 @@ var TagEditor = ({ initial, suggestions, assetName, onCancel, onSave }) => {
2058
2062
  }
2059
2063
  );
2060
2064
  };
2065
+ var InlineConfirm = ({ open, title, body, confirmLabel = "Confirm", cancelLabel = "Cancel", destructive, onConfirm, onCancel }) => {
2066
+ React7.useEffect(() => {
2067
+ if (!open) return;
2068
+ const onKey = (e) => {
2069
+ if (e.key === "Escape") {
2070
+ e.stopPropagation();
2071
+ onCancel();
2072
+ }
2073
+ };
2074
+ window.addEventListener("keydown", onKey, true);
2075
+ return () => window.removeEventListener("keydown", onKey, true);
2076
+ }, [open, onCancel]);
2077
+ if (!open || typeof document === "undefined") return null;
2078
+ return createPortal(
2079
+ /* @__PURE__ */ jsxs(
2080
+ "div",
2081
+ {
2082
+ className: "fixed inset-0 z-[2147483646] flex items-center justify-center p-4",
2083
+ onMouseDown: (e) => e.stopPropagation(),
2084
+ onClick: (e) => e.stopPropagation(),
2085
+ children: [
2086
+ /* @__PURE__ */ jsx("div", { className: "absolute inset-0 bg-black/50", onClick: onCancel }),
2087
+ /* @__PURE__ */ jsxs(
2088
+ "div",
2089
+ {
2090
+ role: "alertdialog",
2091
+ "aria-modal": "true",
2092
+ className: "relative w-full max-w-sm rounded-lg border border-border bg-popover text-popover-foreground shadow-xl p-4",
2093
+ children: [
2094
+ /* @__PURE__ */ jsxs("div", { className: "flex items-start gap-3", children: [
2095
+ /* @__PURE__ */ jsx("span", { className: cn(
2096
+ "flex-shrink-0 w-8 h-8 rounded-full flex items-center justify-center",
2097
+ destructive ? "bg-destructive/10 text-destructive" : "bg-muted text-muted-foreground"
2098
+ ), children: /* @__PURE__ */ jsx(AlertTriangle, { className: "w-4 h-4" }) }),
2099
+ /* @__PURE__ */ jsxs("div", { className: "min-w-0 flex-1", children: [
2100
+ /* @__PURE__ */ jsx("h3", { className: "text-sm font-semibold", children: title }),
2101
+ /* @__PURE__ */ jsx("p", { className: "mt-1 text-xs text-muted-foreground", children: body })
2102
+ ] })
2103
+ ] }),
2104
+ /* @__PURE__ */ jsxs("div", { className: "mt-4 flex justify-end gap-2", children: [
2105
+ /* @__PURE__ */ jsx(
2106
+ "button",
2107
+ {
2108
+ type: "button",
2109
+ onClick: onCancel,
2110
+ className: "px-3 py-1.5 text-xs rounded-md border border-border bg-background hover:bg-accent",
2111
+ children: cancelLabel
2112
+ }
2113
+ ),
2114
+ /* @__PURE__ */ jsx(
2115
+ "button",
2116
+ {
2117
+ type: "button",
2118
+ autoFocus: true,
2119
+ onClick: onConfirm,
2120
+ className: cn(
2121
+ "px-3 py-1.5 text-xs rounded-md",
2122
+ destructive ? "bg-destructive text-destructive-foreground hover:bg-destructive/90" : "bg-primary text-primary-foreground hover:bg-primary/90"
2123
+ ),
2124
+ children: confirmLabel
2125
+ }
2126
+ )
2127
+ ] })
2128
+ ]
2129
+ }
2130
+ )
2131
+ ]
2132
+ }
2133
+ ),
2134
+ document.body
2135
+ );
2136
+ };
2061
2137
  var GlobalUploadToggle = ({ checked, onChange, appName }) => /* @__PURE__ */ jsxs("label", { className: "flex items-start gap-2 text-xs text-muted-foreground cursor-pointer select-none p-2 rounded-md border border-border bg-muted/30", children: [
2062
2138
  /* @__PURE__ */ jsx(
2063
2139
  "input",
@@ -2114,11 +2190,17 @@ var ScopedAssetBrowser = ({ scope: _scope, accept: _accept, pageSize: _pageSize,
2114
2190
  if (!file || !assetId) return;
2115
2191
  await replaceFile(assetId, file);
2116
2192
  }, [replaceFile]);
2117
- const handleDeleteWithConfirm = useCallback(async (assetId) => {
2118
- if (!window.confirm("Delete this asset? It can be restored from the asset manager within 30 days.")) return;
2119
- const ok = await remove(assetId);
2120
- if (ok) onDelete?.(assetId);
2121
- }, [remove, onDelete]);
2193
+ const [pendingDeleteId, setPendingDeleteId] = useState(null);
2194
+ const handleDeleteWithConfirm = useCallback((assetId) => {
2195
+ setPendingDeleteId(assetId);
2196
+ }, []);
2197
+ const confirmDelete = useCallback(async () => {
2198
+ const id = pendingDeleteId;
2199
+ setPendingDeleteId(null);
2200
+ if (!id) return;
2201
+ const ok = await remove(id);
2202
+ if (ok) onDelete?.(id);
2203
+ }, [pendingDeleteId, remove, onDelete]);
2122
2204
  const [tagEditorAsset, setTagEditorAsset] = useState(null);
2123
2205
  const handleEditTags = useCallback((asset2) => {
2124
2206
  setTagEditorAsset(asset2);
@@ -2252,6 +2334,19 @@ var ScopedAssetBrowser = ({ scope: _scope, accept: _accept, pageSize: _pageSize,
2252
2334
  onCancel: () => setTagEditorAsset(null),
2253
2335
  onSave: handleSaveTags
2254
2336
  }
2337
+ ),
2338
+ /* @__PURE__ */ jsx(
2339
+ InlineConfirm,
2340
+ {
2341
+ open: pendingDeleteId !== null,
2342
+ title: "Delete asset?",
2343
+ body: "This asset can be restored from the asset manager within 30 days.",
2344
+ confirmLabel: "Delete",
2345
+ cancelLabel: "Cancel",
2346
+ destructive: true,
2347
+ onConfirm: confirmDelete,
2348
+ onCancel: () => setPendingDeleteId(null)
2349
+ }
2255
2350
  )
2256
2351
  ] });
2257
2352
  };
@@ -2270,7 +2365,7 @@ var AssetPickerContent = ({
2270
2365
  showTypeFilter,
2271
2366
  value,
2272
2367
  onSelect,
2273
- allowDelete = false,
2368
+ allowDelete = true,
2274
2369
  defaultView = "grid",
2275
2370
  emptyText,
2276
2371
  pageSize = 50,
@@ -2833,5 +2928,5 @@ var AssetPicker = (props) => {
2833
2928
  assertStylesLoaded();
2834
2929
 
2835
2930
  export { ASSET_MIME_FILTERS, AssetPicker, useAppRegistry, useAssets };
2836
- //# sourceMappingURL=chunk-R3B5CK2M.js.map
2837
- //# sourceMappingURL=chunk-R3B5CK2M.js.map
2931
+ //# sourceMappingURL=chunk-N2FPPTHH.js.map
2932
+ //# sourceMappingURL=chunk-N2FPPTHH.js.map