@webdevarif/dashui 0.2.1 → 0.2.2
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.d.mts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +165 -151
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +165 -151
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -378,6 +378,7 @@ interface MediaPickerDialogProps {
|
|
|
378
378
|
onLoadMore?: () => void;
|
|
379
379
|
hasMore?: boolean;
|
|
380
380
|
multiple?: boolean;
|
|
381
|
+
/** "images" = only show image type tabs; "all" = show all type tabs */
|
|
381
382
|
accept?: "images" | "all";
|
|
382
383
|
onSelect: (files: MediaCardFile[]) => void;
|
|
383
384
|
}
|
package/dist/index.d.ts
CHANGED
|
@@ -378,6 +378,7 @@ interface MediaPickerDialogProps {
|
|
|
378
378
|
onLoadMore?: () => void;
|
|
379
379
|
hasMore?: boolean;
|
|
380
380
|
multiple?: boolean;
|
|
381
|
+
/** "images" = only show image type tabs; "all" = show all type tabs */
|
|
381
382
|
accept?: "images" | "all";
|
|
382
383
|
onSelect: (files: MediaCardFile[]) => void;
|
|
383
384
|
}
|
package/dist/index.js
CHANGED
|
@@ -2016,11 +2016,10 @@ function MediaGrid({
|
|
|
2016
2016
|
// src/components/media/media-picker-dialog.tsx
|
|
2017
2017
|
var React20 = __toESM(require("react"));
|
|
2018
2018
|
var import_jsx_runtime34 = require("react/jsx-runtime");
|
|
2019
|
-
var
|
|
2019
|
+
var ALL_TYPE_OPTIONS = [
|
|
2020
2020
|
{ value: "all", label: "All" },
|
|
2021
2021
|
{ value: "images", label: "Images" },
|
|
2022
2022
|
{ value: "videos", label: "Videos" },
|
|
2023
|
-
{ value: "audio", label: "Audio" },
|
|
2024
2023
|
{ value: "documents", label: "Docs" }
|
|
2025
2024
|
];
|
|
2026
2025
|
function MediaPickerDialog({
|
|
@@ -2047,22 +2046,21 @@ function MediaPickerDialog({
|
|
|
2047
2046
|
}) {
|
|
2048
2047
|
const [localSelected, setLocalSelected] = React20.useState(/* @__PURE__ */ new Set());
|
|
2049
2048
|
const fileInputRef = React20.useRef(null);
|
|
2049
|
+
React20.useEffect(() => {
|
|
2050
|
+
if (!open) setLocalSelected(/* @__PURE__ */ new Set());
|
|
2051
|
+
}, [open]);
|
|
2052
|
+
const typeOptions = ALL_TYPE_OPTIONS.filter(
|
|
2053
|
+
(o) => accept === "images" ? o.value === "all" || o.value === "images" : true
|
|
2054
|
+
);
|
|
2050
2055
|
const handleFileSelect = (file) => {
|
|
2051
|
-
|
|
2052
|
-
|
|
2056
|
+
setLocalSelected((prev) => {
|
|
2057
|
+
if (multiple) {
|
|
2053
2058
|
const next = new Set(prev);
|
|
2054
|
-
|
|
2055
|
-
next.delete(file.id);
|
|
2056
|
-
} else {
|
|
2057
|
-
next.add(file.id);
|
|
2058
|
-
}
|
|
2059
|
+
next.has(file.id) ? next.delete(file.id) : next.add(file.id);
|
|
2059
2060
|
return next;
|
|
2060
|
-
}
|
|
2061
|
-
|
|
2062
|
-
|
|
2063
|
-
onSelect(selected);
|
|
2064
|
-
onOpenChange(false);
|
|
2065
|
-
}
|
|
2061
|
+
}
|
|
2062
|
+
return prev.has(file.id) ? /* @__PURE__ */ new Set() : /* @__PURE__ */ new Set([file.id]);
|
|
2063
|
+
});
|
|
2066
2064
|
};
|
|
2067
2065
|
const handleConfirm = () => {
|
|
2068
2066
|
const selected = files.filter((f) => localSelected.has(f.id));
|
|
@@ -2075,163 +2073,179 @@ function MediaPickerDialog({
|
|
|
2075
2073
|
}
|
|
2076
2074
|
};
|
|
2077
2075
|
const activeUploads = uploads.filter((u) => u.status === "uploading");
|
|
2078
|
-
|
|
2079
|
-
|
|
2080
|
-
|
|
2081
|
-
|
|
2082
|
-
|
|
2083
|
-
|
|
2084
|
-
|
|
2085
|
-
|
|
2086
|
-
|
|
2087
|
-
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
2088
|
-
"input",
|
|
2089
|
-
{
|
|
2090
|
-
ref: fileInputRef,
|
|
2091
|
-
type: "file",
|
|
2092
|
-
className: "hidden",
|
|
2093
|
-
multiple: true,
|
|
2094
|
-
accept: accept === "images" ? "image/*" : void 0,
|
|
2095
|
-
onChange: handleUploadChange
|
|
2096
|
-
}
|
|
2097
|
-
),
|
|
2098
|
-
/* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(
|
|
2099
|
-
"button",
|
|
2100
|
-
{
|
|
2101
|
-
onClick: () => fileInputRef.current?.click(),
|
|
2102
|
-
className: "flex items-center gap-1.5 rounded-md bg-primary px-3 py-1.5 text-xs font-medium text-primary-foreground transition-opacity hover:opacity-90",
|
|
2103
|
-
children: [
|
|
2104
|
-
/* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("svg", { className: "h-3.5 w-3.5", xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [
|
|
2105
|
-
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("path", { d: "M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4" }),
|
|
2106
|
-
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("polyline", { points: "17 8 12 3 7 8" }),
|
|
2107
|
-
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("line", { x1: "12", y1: "3", x2: "12", y2: "15" })
|
|
2108
|
-
] }),
|
|
2109
|
-
"Upload"
|
|
2110
|
-
]
|
|
2111
|
-
}
|
|
2112
|
-
)
|
|
2113
|
-
] })
|
|
2114
|
-
] })
|
|
2115
|
-
] }),
|
|
2116
|
-
/* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: "flex flex-1 overflow-hidden", children: [
|
|
2117
|
-
folders.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("aside", { className: "flex w-44 shrink-0 flex-col gap-0.5 overflow-y-auto border-r p-2", children: [
|
|
2118
|
-
/* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(
|
|
2119
|
-
"button",
|
|
2120
|
-
{
|
|
2121
|
-
onClick: () => onFolderChange?.(""),
|
|
2122
|
-
className: cn(
|
|
2123
|
-
"flex w-full items-center gap-2 rounded-md px-2.5 py-1.5 text-sm transition-colors",
|
|
2124
|
-
!activeFolderId ? "bg-primary/10 font-medium text-primary" : "text-muted-foreground hover:bg-accent"
|
|
2125
|
-
),
|
|
2126
|
-
children: [
|
|
2127
|
-
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("svg", { className: "h-3.5 w-3.5", xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("path", { d: "M3 9l9-7 9 7v11a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z" }) }),
|
|
2128
|
-
"All files"
|
|
2129
|
-
]
|
|
2130
|
-
}
|
|
2131
|
-
),
|
|
2132
|
-
folders.map((folder) => /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(
|
|
2133
|
-
"button",
|
|
2134
|
-
{
|
|
2135
|
-
onClick: () => onFolderChange?.(folder.id),
|
|
2136
|
-
className: cn(
|
|
2137
|
-
"flex w-full items-center gap-2 rounded-md px-2.5 py-1.5 text-sm transition-colors",
|
|
2138
|
-
activeFolderId === folder.id ? "bg-primary/10 font-medium text-primary" : "text-muted-foreground hover:bg-accent"
|
|
2139
|
-
),
|
|
2140
|
-
children: [
|
|
2141
|
-
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("span", { className: "text-base leading-none", children: folder.icon ?? "\u{1F4C1}" }),
|
|
2142
|
-
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("span", { className: "truncate", children: folder.name })
|
|
2143
|
-
]
|
|
2144
|
-
},
|
|
2145
|
-
folder.id
|
|
2146
|
-
))
|
|
2147
|
-
] }),
|
|
2148
|
-
/* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: "flex flex-1 flex-col overflow-hidden", children: [
|
|
2149
|
-
/* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: "flex items-center gap-2 border-b px-4 py-2", children: [
|
|
2150
|
-
/* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: "relative flex-1", children: [
|
|
2151
|
-
/* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("svg", { className: "pointer-events-none absolute left-2.5 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-muted-foreground", xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [
|
|
2152
|
-
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("circle", { cx: "11", cy: "11", r: "8" }),
|
|
2153
|
-
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("path", { d: "m21 21-4.35-4.35" })
|
|
2154
|
-
] }),
|
|
2076
|
+
const firstSelected = files.find((f) => localSelected.has(f.id));
|
|
2077
|
+
return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(Dialog, { open, onOpenChange, children: /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(
|
|
2078
|
+
DialogContent,
|
|
2079
|
+
{
|
|
2080
|
+
"aria-describedby": void 0,
|
|
2081
|
+
className: "flex h-[85vh] max-h-[700px] max-w-4xl flex-col gap-0 p-0",
|
|
2082
|
+
children: [
|
|
2083
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(DialogHeader, { className: "flex-row items-center gap-3 border-b px-5 py-3 pr-12 space-y-0 shrink-0", children: [
|
|
2084
|
+
onUpload && /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(import_jsx_runtime34.Fragment, { children: [
|
|
2155
2085
|
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
2156
2086
|
"input",
|
|
2157
2087
|
{
|
|
2158
|
-
|
|
2159
|
-
|
|
2160
|
-
|
|
2161
|
-
|
|
2162
|
-
|
|
2088
|
+
ref: fileInputRef,
|
|
2089
|
+
type: "file",
|
|
2090
|
+
className: "hidden",
|
|
2091
|
+
multiple: true,
|
|
2092
|
+
accept: accept === "images" ? "image/*" : void 0,
|
|
2093
|
+
onChange: handleUploadChange
|
|
2094
|
+
}
|
|
2095
|
+
),
|
|
2096
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(
|
|
2097
|
+
"button",
|
|
2098
|
+
{
|
|
2099
|
+
onClick: () => fileInputRef.current?.click(),
|
|
2100
|
+
className: "flex shrink-0 items-center gap-1.5 rounded-md bg-primary px-3 py-1.5 text-xs font-medium text-primary-foreground transition-opacity hover:opacity-90",
|
|
2101
|
+
children: [
|
|
2102
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("svg", { className: "h-3.5 w-3.5", xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [
|
|
2103
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("path", { d: "M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4" }),
|
|
2104
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("polyline", { points: "17 8 12 3 7 8" }),
|
|
2105
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("line", { x1: "12", y1: "3", x2: "12", y2: "15" })
|
|
2106
|
+
] }),
|
|
2107
|
+
"Upload"
|
|
2108
|
+
]
|
|
2163
2109
|
}
|
|
2164
2110
|
)
|
|
2165
2111
|
] }),
|
|
2166
|
-
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
2167
|
-
|
|
2168
|
-
|
|
2169
|
-
|
|
2170
|
-
|
|
2171
|
-
"rounded px-2 py-1 text-xs transition-colors",
|
|
2172
|
-
typeFilter === opt.value ? "bg-primary text-primary-foreground" : "text-muted-foreground hover:bg-accent"
|
|
2173
|
-
),
|
|
2174
|
-
children: opt.label
|
|
2175
|
-
},
|
|
2176
|
-
opt.value
|
|
2177
|
-
)) })
|
|
2112
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(DialogTitle, { className: "text-sm font-semibold flex-1", children: title }),
|
|
2113
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("span", { className: "text-xs text-muted-foreground shrink-0", children: [
|
|
2114
|
+
total,
|
|
2115
|
+
" files"
|
|
2116
|
+
] })
|
|
2178
2117
|
] }),
|
|
2179
|
-
|
|
2180
|
-
/* @__PURE__ */ (0, import_jsx_runtime34.
|
|
2181
|
-
|
|
2182
|
-
|
|
2183
|
-
|
|
2184
|
-
|
|
2185
|
-
|
|
2186
|
-
|
|
2187
|
-
|
|
2188
|
-
|
|
2189
|
-
|
|
2190
|
-
|
|
2118
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: "flex flex-1 overflow-hidden min-h-0", children: [
|
|
2119
|
+
folders.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("aside", { className: "flex w-44 shrink-0 flex-col gap-0.5 overflow-y-auto border-r p-2", children: [
|
|
2120
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(
|
|
2121
|
+
"button",
|
|
2122
|
+
{
|
|
2123
|
+
onClick: () => onFolderChange?.(""),
|
|
2124
|
+
className: cn(
|
|
2125
|
+
"flex w-full items-center gap-2 rounded-md px-2.5 py-1.5 text-sm transition-colors",
|
|
2126
|
+
!activeFolderId ? "bg-primary/10 font-medium text-primary" : "text-muted-foreground hover:bg-accent"
|
|
2127
|
+
),
|
|
2128
|
+
children: [
|
|
2129
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("svg", { className: "h-3.5 w-3.5 shrink-0", xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("path", { d: "M22 19a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h5l2 3h9a2 2 0 0 1 2 2z" }) }),
|
|
2130
|
+
"All files"
|
|
2131
|
+
]
|
|
2132
|
+
}
|
|
2133
|
+
),
|
|
2134
|
+
folders.map((folder) => /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(
|
|
2135
|
+
"button",
|
|
2136
|
+
{
|
|
2137
|
+
onClick: () => onFolderChange?.(folder.id),
|
|
2138
|
+
className: cn(
|
|
2139
|
+
"flex w-full items-center gap-2 rounded-md px-2.5 py-1.5 text-sm transition-colors",
|
|
2140
|
+
activeFolderId === folder.id ? "bg-primary/10 font-medium text-primary" : "text-muted-foreground hover:bg-accent"
|
|
2141
|
+
),
|
|
2142
|
+
children: [
|
|
2143
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("span", { className: "text-base leading-none", children: folder.icon ?? "\u{1F4C1}" }),
|
|
2144
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("span", { className: "truncate", children: folder.name })
|
|
2145
|
+
]
|
|
2146
|
+
},
|
|
2147
|
+
folder.id
|
|
2148
|
+
))
|
|
2149
|
+
] }),
|
|
2150
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: "flex flex-1 flex-col overflow-hidden min-w-0", children: [
|
|
2151
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: "flex items-center gap-2 border-b px-4 py-2 shrink-0", children: [
|
|
2152
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: "flex items-center gap-0.5 rounded-lg border border-input bg-muted/50 p-0.5", children: typeOptions.map((opt) => /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
2153
|
+
"button",
|
|
2154
|
+
{
|
|
2155
|
+
onClick: () => onTypeChange?.(opt.value),
|
|
2156
|
+
className: cn(
|
|
2157
|
+
"rounded-md px-2.5 py-1 text-xs font-medium transition-colors",
|
|
2158
|
+
typeFilter === opt.value ? "bg-background text-foreground shadow-sm" : "text-muted-foreground hover:text-foreground"
|
|
2159
|
+
),
|
|
2160
|
+
children: opt.label
|
|
2161
|
+
},
|
|
2162
|
+
opt.value
|
|
2163
|
+
)) }),
|
|
2164
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: "relative flex-1 max-w-xs ml-auto", children: [
|
|
2165
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("svg", { className: "pointer-events-none absolute left-2.5 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-muted-foreground", xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [
|
|
2166
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("circle", { cx: "11", cy: "11", r: "8" }),
|
|
2167
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("path", { d: "m21 21-4.35-4.35" })
|
|
2168
|
+
] }),
|
|
2169
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
2170
|
+
"input",
|
|
2171
|
+
{
|
|
2172
|
+
type: "search",
|
|
2173
|
+
value: search,
|
|
2174
|
+
onChange: (e) => onSearch?.(e.target.value),
|
|
2175
|
+
placeholder: "Search\u2026",
|
|
2176
|
+
className: "h-8 w-full rounded-lg border border-input bg-background pl-8 pr-3 text-xs outline-none focus:border-primary focus:ring-1 focus:ring-primary/30"
|
|
2177
|
+
}
|
|
2178
|
+
)
|
|
2179
|
+
] })
|
|
2180
|
+
] }),
|
|
2181
|
+
activeUploads.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: "border-b px-4 py-2 space-y-1.5 shrink-0", children: activeUploads.map((u, i) => /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
2182
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("span", { className: "flex-1 truncate text-xs text-muted-foreground", children: u.name }),
|
|
2183
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: "h-1.5 w-24 overflow-hidden rounded-full bg-muted", children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
2184
|
+
"div",
|
|
2185
|
+
{
|
|
2186
|
+
className: "h-full rounded-full bg-primary transition-all duration-200",
|
|
2187
|
+
style: { width: `${u.progress}%` }
|
|
2188
|
+
}
|
|
2189
|
+
) }),
|
|
2190
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("span", { className: "text-[10px] text-muted-foreground w-6 text-right", children: [
|
|
2191
|
+
u.progress,
|
|
2192
|
+
"%"
|
|
2193
|
+
] })
|
|
2194
|
+
] }, i)) }),
|
|
2195
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: "flex-1 overflow-y-auto p-4", children: [
|
|
2196
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
2197
|
+
MediaGrid,
|
|
2198
|
+
{
|
|
2199
|
+
files,
|
|
2200
|
+
selected: localSelected,
|
|
2201
|
+
onSelect: handleFileSelect,
|
|
2202
|
+
loading,
|
|
2203
|
+
columns: 5,
|
|
2204
|
+
onUploadClick: onUpload ? () => fileInputRef.current?.click() : void 0
|
|
2205
|
+
}
|
|
2206
|
+
),
|
|
2207
|
+
hasMore && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: "mt-4 flex justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
2208
|
+
"button",
|
|
2209
|
+
{
|
|
2210
|
+
onClick: onLoadMore,
|
|
2211
|
+
className: "rounded-lg border px-4 py-2 text-xs text-muted-foreground transition-colors hover:bg-accent",
|
|
2212
|
+
children: "Load more"
|
|
2213
|
+
}
|
|
2214
|
+
) })
|
|
2215
|
+
] })
|
|
2191
2216
|
] })
|
|
2192
|
-
] }, i)) }),
|
|
2193
|
-
/* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: "flex-1 overflow-y-auto p-4", children: [
|
|
2194
|
-
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
2195
|
-
MediaGrid,
|
|
2196
|
-
{
|
|
2197
|
-
files,
|
|
2198
|
-
selected: localSelected,
|
|
2199
|
-
onSelect: handleFileSelect,
|
|
2200
|
-
loading,
|
|
2201
|
-
columns: 5,
|
|
2202
|
-
onUploadClick: onUpload ? () => fileInputRef.current?.click() : void 0
|
|
2203
|
-
}
|
|
2204
|
-
),
|
|
2205
|
-
hasMore && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: "mt-4 flex justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
2206
|
-
"button",
|
|
2207
|
-
{
|
|
2208
|
-
onClick: onLoadMore,
|
|
2209
|
-
className: "rounded-md border px-4 py-2 text-sm text-muted-foreground transition-colors hover:bg-accent",
|
|
2210
|
-
children: "Load more"
|
|
2211
|
-
}
|
|
2212
|
-
) })
|
|
2213
2217
|
] }),
|
|
2214
|
-
|
|
2218
|
+
localSelected.size > 0 && /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: "flex items-center justify-between gap-4 border-t px-5 py-3 shrink-0 bg-muted/20", children: [
|
|
2215
2219
|
/* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("span", { className: "text-sm text-muted-foreground", children: [
|
|
2216
2220
|
localSelected.size,
|
|
2221
|
+
" file",
|
|
2222
|
+
localSelected.size !== 1 ? "s" : "",
|
|
2217
2223
|
" selected"
|
|
2218
2224
|
] }),
|
|
2219
|
-
/* @__PURE__ */ (0, import_jsx_runtime34.
|
|
2225
|
+
firstSelected && firstSelected.mimeType.startsWith("image/") && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
2226
|
+
"img",
|
|
2227
|
+
{
|
|
2228
|
+
src: firstSelected.url,
|
|
2229
|
+
alt: firstSelected.name,
|
|
2230
|
+
className: "h-9 w-9 rounded-lg border border-border object-cover shadow-sm"
|
|
2231
|
+
}
|
|
2232
|
+
),
|
|
2233
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
2220
2234
|
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
2221
2235
|
"button",
|
|
2222
2236
|
{
|
|
2223
2237
|
onClick: () => setLocalSelected(/* @__PURE__ */ new Set()),
|
|
2224
|
-
className: "rounded-
|
|
2225
|
-
children: "
|
|
2238
|
+
className: "rounded-lg px-3 py-1.5 text-sm text-muted-foreground transition-colors hover:bg-accent",
|
|
2239
|
+
children: "Cancel"
|
|
2226
2240
|
}
|
|
2227
2241
|
),
|
|
2228
2242
|
/* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(
|
|
2229
2243
|
"button",
|
|
2230
2244
|
{
|
|
2231
2245
|
onClick: handleConfirm,
|
|
2232
|
-
className: "rounded-
|
|
2246
|
+
className: "rounded-lg bg-primary px-4 py-1.5 text-sm font-medium text-primary-foreground transition-opacity hover:opacity-90",
|
|
2233
2247
|
children: [
|
|
2234
|
-
"
|
|
2248
|
+
"Use ",
|
|
2235
2249
|
localSelected.size,
|
|
2236
2250
|
" file",
|
|
2237
2251
|
localSelected.size !== 1 ? "s" : ""
|
|
@@ -2240,9 +2254,9 @@ function MediaPickerDialog({
|
|
|
2240
2254
|
)
|
|
2241
2255
|
] })
|
|
2242
2256
|
] })
|
|
2243
|
-
]
|
|
2244
|
-
|
|
2245
|
-
|
|
2257
|
+
]
|
|
2258
|
+
}
|
|
2259
|
+
) });
|
|
2246
2260
|
}
|
|
2247
2261
|
|
|
2248
2262
|
// src/components/media/image-picker-field.tsx
|