@muhgholy/next-drive 1.1.5 → 1.2.0
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/client/index.js +22 -10
- package/dist/client/index.js.map +1 -1
- package/dist/server/index.js.map +1 -1
- package/package.json +4 -2
package/dist/client/index.js
CHANGED
|
@@ -2543,7 +2543,7 @@ var DriveFileChooser = (props) => {
|
|
|
2543
2543
|
disabled: false,
|
|
2544
2544
|
...props
|
|
2545
2545
|
};
|
|
2546
|
-
const { items, selectedFileIds, setSelectedFileIds } = useDrive();
|
|
2546
|
+
const { items, selectedFileIds, setSelectedFileIds, createUrl } = useDrive();
|
|
2547
2547
|
const [isOpen, setIsOpen] = useState6(false);
|
|
2548
2548
|
useEffect5(() => {
|
|
2549
2549
|
if (isOpen) {
|
|
@@ -2576,17 +2576,15 @@ var DriveFileChooser = (props) => {
|
|
|
2576
2576
|
const isSingle = !multiple;
|
|
2577
2577
|
return /* @__PURE__ */ jsxs12("div", { className: cn("space-y-1.5", className), children: [
|
|
2578
2578
|
!hasSelection && /* @__PURE__ */ jsxs12(
|
|
2579
|
-
|
|
2579
|
+
Button,
|
|
2580
2580
|
{
|
|
2581
2581
|
type: "button",
|
|
2582
|
-
|
|
2582
|
+
variant: "outline",
|
|
2583
|
+
onClick: () => setIsOpen(true),
|
|
2583
2584
|
disabled,
|
|
2584
2585
|
className: cn(
|
|
2585
|
-
"w-full
|
|
2586
|
-
"
|
|
2587
|
-
"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
|
|
2588
|
-
error && "border-destructive bg-destructive/5 hover:bg-destructive/10",
|
|
2589
|
-
disabled && "opacity-50 cursor-not-allowed hover:bg-transparent"
|
|
2586
|
+
"w-full h-auto justify-start gap-3 px-3 py-2.5 border-dashed",
|
|
2587
|
+
error && "border-destructive"
|
|
2590
2588
|
),
|
|
2591
2589
|
children: [
|
|
2592
2590
|
/* @__PURE__ */ jsx19("div", { className: cn(
|
|
@@ -2605,7 +2603,14 @@ var DriveFileChooser = (props) => {
|
|
|
2605
2603
|
error && "border-destructive",
|
|
2606
2604
|
disabled && "opacity-50"
|
|
2607
2605
|
), children: [
|
|
2608
|
-
/* @__PURE__ */ jsx19("div", { className: "size-10 shrink-0 rounded overflow-hidden bg-muted flex items-center justify-center", children:
|
|
2606
|
+
/* @__PURE__ */ jsx19("div", { className: "size-10 shrink-0 rounded overflow-hidden bg-muted flex items-center justify-center", children: displayFiles[0].file.mime.startsWith("image/") ? /* @__PURE__ */ jsx19(
|
|
2607
|
+
"img",
|
|
2608
|
+
{
|
|
2609
|
+
src: createUrl({ id: displayFiles[0].id, file: displayFiles[0].file }, { quality: "low", format: "webp" }),
|
|
2610
|
+
alt: displayFiles[0].file.name,
|
|
2611
|
+
className: "size-full object-cover"
|
|
2612
|
+
}
|
|
2613
|
+
) : getFileIcon(displayFiles[0].file.mime, false, "size-5 text-muted-foreground") }),
|
|
2609
2614
|
/* @__PURE__ */ jsxs12("div", { className: "flex-1 min-w-0", children: [
|
|
2610
2615
|
/* @__PURE__ */ jsx19("p", { className: "text-sm font-medium truncate", children: displayFiles[0].file.name }),
|
|
2611
2616
|
/* @__PURE__ */ jsx19("p", { className: "text-xs text-muted-foreground truncate", children: displayFiles[0].file.mime })
|
|
@@ -2669,7 +2674,14 @@ var DriveFileChooser = (props) => {
|
|
|
2669
2674
|
] })
|
|
2670
2675
|
] }),
|
|
2671
2676
|
/* @__PURE__ */ jsx19("div", { className: "divide-y max-h-40 overflow-y-auto", children: displayFiles.map((file) => /* @__PURE__ */ jsxs12("div", { className: "flex items-center gap-2 px-2.5 py-1.5 hover:bg-muted/30", children: [
|
|
2672
|
-
/* @__PURE__ */ jsx19("div", { className: "size-7 shrink-0 rounded overflow-hidden bg-muted flex items-center justify-center", children:
|
|
2677
|
+
/* @__PURE__ */ jsx19("div", { className: "size-7 shrink-0 rounded overflow-hidden bg-muted flex items-center justify-center", children: file.file.mime.startsWith("image/") ? /* @__PURE__ */ jsx19(
|
|
2678
|
+
"img",
|
|
2679
|
+
{
|
|
2680
|
+
src: createUrl({ id: file.id, file: file.file }, { quality: "ultralow", format: "webp" }),
|
|
2681
|
+
alt: file.file.name,
|
|
2682
|
+
className: "size-full object-cover"
|
|
2683
|
+
}
|
|
2684
|
+
) : getFileIcon(file.file.mime, false, "size-3.5 text-muted-foreground") }),
|
|
2673
2685
|
/* @__PURE__ */ jsx19("span", { className: "flex-1 text-sm truncate", children: file.file.name }),
|
|
2674
2686
|
!disabled && /* @__PURE__ */ jsx19(
|
|
2675
2687
|
Button,
|