@blitheforge/media-library 1.0.8 → 1.1.1

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.js CHANGED
@@ -107,13 +107,6 @@ function isImagePath(path) {
107
107
  // src/components/media-library-modal.tsx
108
108
  import { createPortal as createPortal2 } from "react-dom";
109
109
 
110
- // src/utils/cn.ts
111
- import { clsx } from "clsx";
112
- import { twMerge } from "tailwind-merge";
113
- function cn(...inputs) {
114
- return twMerge(clsx(inputs));
115
- }
116
-
117
110
  // src/utils/bfml-theme.ts
118
111
  function bfmlRootProps(theme = "sync") {
119
112
  return {
@@ -129,6 +122,13 @@ function resolveThemeMode(theme) {
129
122
  import { useEffect as useEffect2, useMemo, useRef, useState as useState2 } from "react";
130
123
  import { ChevronRight, Folder, ImagePlus, LoaderCircle as LoaderCircle2, PanelLeft, Search, Trash2, Upload, X as X2 } from "lucide-react";
131
124
 
125
+ // src/utils/cn.ts
126
+ import { clsx } from "clsx";
127
+ import { twMerge } from "tailwind-merge";
128
+ function cn(...inputs) {
129
+ return twMerge(clsx(inputs));
130
+ }
131
+
132
132
  // src/components/ui/button.tsx
133
133
  import { jsx } from "react/jsx-runtime";
134
134
  var variants = {
@@ -170,11 +170,10 @@ function ConfirmDialog({
170
170
  if (!open || typeof document === "undefined") return null;
171
171
  const rootProps = bfmlRootProps(theme);
172
172
  return createPortal(
173
- /* @__PURE__ */ jsx2(
173
+ /* @__PURE__ */ jsx2("div", { ...rootProps, children: /* @__PURE__ */ jsx2(
174
174
  "div",
175
175
  {
176
- ...rootProps,
177
- className: cn(rootProps.className, "fixed inset-0 z-[10001] flex items-end justify-center p-0 backdrop-blur-sm sm:items-center sm:p-4"),
176
+ className: "fixed inset-0 z-[10060] flex items-end justify-center p-0 backdrop-blur-sm sm:items-center sm:p-4",
178
177
  style: { backgroundColor: "var(--bfml-overlay)" },
179
178
  role: "presentation",
180
179
  onClick: onCancel,
@@ -198,7 +197,7 @@ function ConfirmDialog({
198
197
  }
199
198
  )
200
199
  }
201
- ),
200
+ ) }),
202
201
  document.body
203
202
  );
204
203
  }
@@ -295,19 +294,12 @@ function ToastCard({ toast }) {
295
294
  }
296
295
  function ToastContainer({ theme = "sync" }) {
297
296
  const [items, setItems] = useState([]);
298
- const rootProps = bfmlRootProps(theme);
297
+ void theme;
299
298
  useEffect(() => {
300
299
  return subscribeToasts(setItems);
301
300
  }, []);
302
301
  if (items.length === 0) return null;
303
- return /* @__PURE__ */ jsx4(
304
- "div",
305
- {
306
- ...rootProps,
307
- className: cn(rootProps.className, "pointer-events-none absolute right-3 top-3 z-[45] flex w-[min(100%,20rem)] flex-col items-end gap-2 sm:right-4 sm:top-4"),
308
- children: items.map((toast) => /* @__PURE__ */ jsx4(ToastCard, { toast }, toast.id))
309
- }
310
- );
302
+ return /* @__PURE__ */ jsx4("div", { className: "pointer-events-none absolute right-3 top-3 z-[45] flex w-[min(100%,20rem)] flex-col items-end gap-2 sm:right-4 sm:top-4", children: items.map((toast) => /* @__PURE__ */ jsx4(ToastCard, { toast }, toast.id)) });
311
303
  }
312
304
 
313
305
  // src/components/upload-preview.tsx
@@ -734,12 +726,10 @@ function MediaLibraryPanel({
734
726
  folder.path || "root"
735
727
  );
736
728
  }) });
737
- return /* @__PURE__ */ jsxs4(
729
+ return /* @__PURE__ */ jsx6("div", { ...rootProps, className: "h-full min-h-0", children: /* @__PURE__ */ jsxs4(
738
730
  "section",
739
731
  {
740
- ...rootProps,
741
732
  className: cn(
742
- rootProps.className,
743
733
  "relative flex h-full min-h-0 flex-col overflow-hidden bg-[var(--bfml-surface)]",
744
734
  variant === "modal" && "h-[100dvh] w-full max-w-none border-0 shadow-[var(--bfml-shadow-lg)] sm:h-[min(92vh,760px)] sm:max-w-6xl sm:rounded-2xl sm:border sm:border-[var(--bfml-border)]",
745
735
  variant === "embedded" && "rounded-none border-0 shadow-none",
@@ -1006,7 +996,7 @@ function MediaLibraryPanel({
1006
996
  )
1007
997
  ]
1008
998
  }
1009
- );
999
+ ) });
1010
1000
  }
1011
1001
 
1012
1002
  // src/components/media-library-modal.tsx
@@ -1031,14 +1021,10 @@ function MediaLibraryModal({
1031
1021
  const rootProps = bfmlRootProps(themeMode);
1032
1022
  if (!open || typeof document === "undefined") return null;
1033
1023
  return createPortal2(
1034
- /* @__PURE__ */ jsx7(
1024
+ /* @__PURE__ */ jsx7("div", { ...rootProps, children: /* @__PURE__ */ jsx7(
1035
1025
  "div",
1036
1026
  {
1037
- ...rootProps,
1038
- className: cn(
1039
- rootProps.className,
1040
- "fixed inset-0 z-[9999] flex items-stretch justify-center p-0 backdrop-blur-sm sm:items-center sm:p-2 md:p-4"
1041
- ),
1027
+ className: "fixed inset-0 z-[10050] flex items-stretch justify-center p-0 backdrop-blur-sm sm:items-center sm:p-2 md:p-4",
1042
1028
  style: { backgroundColor: "var(--bfml-overlay)" },
1043
1029
  children: /* @__PURE__ */ jsx7(
1044
1030
  MediaLibraryPanel,
@@ -1061,7 +1047,7 @@ function MediaLibraryModal({
1061
1047
  }
1062
1048
  )
1063
1049
  }
1064
- ),
1050
+ ) }),
1065
1051
  document.body
1066
1052
  );
1067
1053
  }
@@ -1093,12 +1079,10 @@ function MediaLibraryWidget({
1093
1079
  const resolved = { ...defaultMediaLibraryConfig, ...config };
1094
1080
  const themeMode = resolveThemeMode(theme ?? resolved.theme);
1095
1081
  const rootProps = bfmlRootProps(themeMode);
1096
- return /* @__PURE__ */ jsx8(
1082
+ return /* @__PURE__ */ jsx8("div", { ...rootProps, children: /* @__PURE__ */ jsx8(
1097
1083
  "div",
1098
1084
  {
1099
- ...rootProps,
1100
1085
  className: cn(
1101
- rootProps.className,
1102
1086
  "overflow-hidden rounded-2xl border border-[var(--bfml-border)] bg-[var(--bfml-surface)] shadow-[var(--bfml-shadow-lg)]",
1103
1087
  className
1104
1088
  ),
@@ -1122,7 +1106,7 @@ function MediaLibraryWidget({
1122
1106
  }
1123
1107
  )
1124
1108
  }
1125
- );
1109
+ ) });
1126
1110
  }
1127
1111
 
1128
1112
  // src/components/media-picker.tsx
@@ -1218,7 +1202,7 @@ function MediaPicker({
1218
1202
  }
1219
1203
  const currentValue = value ?? selectedPath;
1220
1204
  const fileName = currentValue ? fileNameFromPath(currentValue) : null;
1221
- return /* @__PURE__ */ jsxs6("div", { ...rootProps, className: cn(rootProps.className, "space-y-2", className), children: [
1205
+ return /* @__PURE__ */ jsx10("div", { ...rootProps, children: /* @__PURE__ */ jsxs6("div", { className: cn("space-y-2", className), children: [
1222
1206
  label ? /* @__PURE__ */ jsx10("label", { className: "text-sm font-medium text-[var(--bfml-foreground)]", children: label }) : null,
1223
1207
  /* @__PURE__ */ jsxs6(
1224
1208
  "button",
@@ -1250,7 +1234,7 @@ function MediaPicker({
1250
1234
  accept
1251
1235
  }
1252
1236
  )
1253
- ] });
1237
+ ] }) });
1254
1238
  }
1255
1239
 
1256
1240
  // src/components/media-picker-multi.tsx
@@ -1299,7 +1283,7 @@ function MediaPickerMulti({
1299
1283
  return next;
1300
1284
  });
1301
1285
  }
1302
- return /* @__PURE__ */ jsxs7("div", { ...rootProps, className: cn(rootProps.className, "space-y-2", className), children: [
1286
+ return /* @__PURE__ */ jsx11("div", { ...rootProps, children: /* @__PURE__ */ jsxs7("div", { className: cn("space-y-2", className), children: [
1303
1287
  label ? /* @__PURE__ */ jsx11("label", { className: "text-sm font-medium text-[var(--bfml-foreground)]", children: label }) : null,
1304
1288
  /* @__PURE__ */ jsxs7("div", { className: "overflow-hidden rounded-xl border border-[var(--bfml-border)] bg-[var(--bfml-surface-soft)]", children: [
1305
1289
  /* @__PURE__ */ jsxs7(
@@ -1362,7 +1346,7 @@ function MediaPickerMulti({
1362
1346
  accept
1363
1347
  }
1364
1348
  )
1365
- ] });
1349
+ ] }) });
1366
1350
  }
1367
1351
  export {
1368
1352
  MAX_MEDIA_UPLOAD_BYTES,