@mieweb/ui 0.6.1-dev.146 → 0.6.1-dev.147
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 +80 -11
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +11 -1
- package/dist/index.d.ts +11 -1
- package/dist/index.js +80 -11
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -2373,8 +2373,77 @@ function ContentBlock({
|
|
|
2373
2373
|
}
|
|
2374
2374
|
);
|
|
2375
2375
|
}
|
|
2376
|
+
if (content.type === "image" && content.imageUrl) {
|
|
2377
|
+
const safeHref = /^\s*javascript:/i.test(content.imageUrl) ? void 0 : content.imageUrl;
|
|
2378
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
2379
|
+
"a",
|
|
2380
|
+
{
|
|
2381
|
+
href: safeHref,
|
|
2382
|
+
target: "_blank",
|
|
2383
|
+
rel: "noopener noreferrer",
|
|
2384
|
+
className: "block w-fit transition-transform hover:scale-[1.02]",
|
|
2385
|
+
"aria-label": `View ${content.name || "Uploaded image"}`,
|
|
2386
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
2387
|
+
"img",
|
|
2388
|
+
{
|
|
2389
|
+
src: content.imageUrl,
|
|
2390
|
+
alt: content.name || "Uploaded image",
|
|
2391
|
+
loading: "lazy",
|
|
2392
|
+
className: "my-1 max-h-64 w-auto rounded-lg object-cover"
|
|
2393
|
+
}
|
|
2394
|
+
)
|
|
2395
|
+
}
|
|
2396
|
+
);
|
|
2397
|
+
}
|
|
2398
|
+
if (content.type === "file") {
|
|
2399
|
+
const sizeLabel = typeof content.fileSize === "number" ? formatFileSize(content.fileSize) : void 0;
|
|
2400
|
+
const card = /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "my-1 flex items-center gap-3 rounded-lg bg-neutral-100 p-3 transition-colors dark:bg-neutral-800", children: [
|
|
2401
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "rounded-lg bg-neutral-200 p-2 dark:bg-neutral-700", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
2402
|
+
"svg",
|
|
2403
|
+
{
|
|
2404
|
+
"aria-hidden": "true",
|
|
2405
|
+
className: "h-6 w-6",
|
|
2406
|
+
fill: "none",
|
|
2407
|
+
viewBox: "0 0 24 24",
|
|
2408
|
+
stroke: "currentColor",
|
|
2409
|
+
strokeWidth: 2,
|
|
2410
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
2411
|
+
"path",
|
|
2412
|
+
{
|
|
2413
|
+
strokeLinecap: "round",
|
|
2414
|
+
strokeLinejoin: "round",
|
|
2415
|
+
d: "M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z"
|
|
2416
|
+
}
|
|
2417
|
+
)
|
|
2418
|
+
}
|
|
2419
|
+
) }),
|
|
2420
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "min-w-0 flex-1", children: [
|
|
2421
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "truncate text-sm font-medium", children: content.name || "Document" }),
|
|
2422
|
+
sizeLabel && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-xs opacity-70", children: sizeLabel })
|
|
2423
|
+
] })
|
|
2424
|
+
] });
|
|
2425
|
+
if (content.fileUrl) {
|
|
2426
|
+
const safeFileHref = /^\s*javascript:/i.test(content.fileUrl) ? void 0 : content.fileUrl;
|
|
2427
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
2428
|
+
"a",
|
|
2429
|
+
{
|
|
2430
|
+
href: safeFileHref,
|
|
2431
|
+
target: "_blank",
|
|
2432
|
+
rel: "noopener noreferrer",
|
|
2433
|
+
className: "block w-fit no-underline",
|
|
2434
|
+
children: card
|
|
2435
|
+
}
|
|
2436
|
+
);
|
|
2437
|
+
}
|
|
2438
|
+
return card;
|
|
2439
|
+
}
|
|
2376
2440
|
return null;
|
|
2377
2441
|
}
|
|
2442
|
+
function formatFileSize(bytes) {
|
|
2443
|
+
if (bytes < 1024) return `${bytes} B`;
|
|
2444
|
+
if (bytes < 1024 * 1024) return `${(bytes / 1024).toFixed(1)} KB`;
|
|
2445
|
+
return `${(bytes / (1024 * 1024)).toFixed(1)} MB`;
|
|
2446
|
+
}
|
|
2378
2447
|
var messageVariants = classVarianceAuthority.cva("flex gap-3", {
|
|
2379
2448
|
variants: {
|
|
2380
2449
|
role: {
|
|
@@ -2505,7 +2574,7 @@ function getFileType(mimeType) {
|
|
|
2505
2574
|
}
|
|
2506
2575
|
return "file";
|
|
2507
2576
|
}
|
|
2508
|
-
function
|
|
2577
|
+
function formatFileSize2(bytes) {
|
|
2509
2578
|
if (bytes < 1024) return `${bytes} B`;
|
|
2510
2579
|
if (bytes < 1024 * 1024) return `${(bytes / 1024).toFixed(1)} KB`;
|
|
2511
2580
|
return `${(bytes / (1024 * 1024)).toFixed(1)} MB`;
|
|
@@ -2528,7 +2597,7 @@ function validateFile(file, acceptedTypes, maxSize) {
|
|
|
2528
2597
|
if (maxSize && file.size > maxSize) {
|
|
2529
2598
|
return {
|
|
2530
2599
|
valid: false,
|
|
2531
|
-
error: `File too large (max ${
|
|
2600
|
+
error: `File too large (max ${formatFileSize2(maxSize)})`
|
|
2532
2601
|
};
|
|
2533
2602
|
}
|
|
2534
2603
|
return { valid: true };
|
|
@@ -3789,13 +3858,13 @@ function AttachmentPreview({
|
|
|
3789
3858
|
) }),
|
|
3790
3859
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "min-w-0 flex-1 text-left", children: [
|
|
3791
3860
|
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "truncate text-sm font-medium", children: attachment.filename }),
|
|
3792
|
-
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-xs opacity-70", children:
|
|
3861
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-xs opacity-70", children: formatFileSize3(attachment.size) })
|
|
3793
3862
|
] })
|
|
3794
3863
|
]
|
|
3795
3864
|
}
|
|
3796
3865
|
);
|
|
3797
3866
|
}
|
|
3798
|
-
function
|
|
3867
|
+
function formatFileSize3(bytes) {
|
|
3799
3868
|
if (bytes < 1024) return `${bytes} B`;
|
|
3800
3869
|
if (bytes < 1024 * 1024) return `${(bytes / 1024).toFixed(1)} KB`;
|
|
3801
3870
|
return `${(bytes / (1024 * 1024)).toFixed(1)} MB`;
|
|
@@ -13165,13 +13234,13 @@ function FilePreviewItem({ file, onRemove, disabled }) {
|
|
|
13165
13234
|
children: file.file.name
|
|
13166
13235
|
}
|
|
13167
13236
|
),
|
|
13168
|
-
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-muted-foreground text-xs", children:
|
|
13237
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-muted-foreground text-xs", children: formatFileSize4(file.file.size) })
|
|
13169
13238
|
] })
|
|
13170
13239
|
]
|
|
13171
13240
|
}
|
|
13172
13241
|
);
|
|
13173
13242
|
}
|
|
13174
|
-
function
|
|
13243
|
+
function formatFileSize4(bytes) {
|
|
13175
13244
|
if (bytes === 0) return "0 Bytes";
|
|
13176
13245
|
const k = 1024;
|
|
13177
13246
|
const sizes = ["Bytes", "KB", "MB", "GB"];
|
|
@@ -18318,7 +18387,7 @@ function AlertIcon({ className }) {
|
|
|
18318
18387
|
}
|
|
18319
18388
|
);
|
|
18320
18389
|
}
|
|
18321
|
-
function
|
|
18390
|
+
function formatFileSize5(bytes) {
|
|
18322
18391
|
if (bytes === 0) return "0 B";
|
|
18323
18392
|
const k = 1024;
|
|
18324
18393
|
const sizes = ["B", "KB", "MB", "GB"];
|
|
@@ -18549,11 +18618,11 @@ function FileManager({
|
|
|
18549
18618
|
children: /* @__PURE__ */ jsxRuntime.jsxs("p", { className: "text-muted-foreground text-sm", children: [
|
|
18550
18619
|
"Used Storage:",
|
|
18551
18620
|
" ",
|
|
18552
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "font-semibold text-gray-900 dark:text-white", children:
|
|
18621
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "font-semibold text-gray-900 dark:text-white", children: formatFileSize5(totalStorageUsed) }),
|
|
18553
18622
|
storageLimit && /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "text-muted-foreground", children: [
|
|
18554
18623
|
" ",
|
|
18555
18624
|
"/ ",
|
|
18556
|
-
|
|
18625
|
+
formatFileSize5(storageLimit)
|
|
18557
18626
|
] })
|
|
18558
18627
|
] })
|
|
18559
18628
|
}
|
|
@@ -18571,7 +18640,7 @@ function FileManager({
|
|
|
18571
18640
|
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "max-w-xs truncate text-sm text-gray-900 dark:text-white", children: file.filename })
|
|
18572
18641
|
] }) }),
|
|
18573
18642
|
/* @__PURE__ */ jsxRuntime.jsx(chunkTN33E2VN_cjs.TableCell, { className: "text-center", children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-muted-foreground text-xs uppercase", children: file.fileExtension.replace(".", "") }) }),
|
|
18574
|
-
/* @__PURE__ */ jsxRuntime.jsx(chunkTN33E2VN_cjs.TableCell, { className: "text-center", children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-muted-foreground text-sm", children:
|
|
18643
|
+
/* @__PURE__ */ jsxRuntime.jsx(chunkTN33E2VN_cjs.TableCell, { className: "text-center", children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-muted-foreground text-sm", children: formatFileSize5(file.fileSize) }) }),
|
|
18575
18644
|
hasActions && /* @__PURE__ */ jsxRuntime.jsx(
|
|
18576
18645
|
chunkTN33E2VN_cjs.TableCell,
|
|
18577
18646
|
{
|
|
@@ -41222,7 +41291,7 @@ exports.formatAddressSingleLine = formatAddressSingleLine;
|
|
|
41222
41291
|
exports.formatCityState = formatCityState;
|
|
41223
41292
|
exports.formatCityStateZip = formatCityStateZip;
|
|
41224
41293
|
exports.formatDateLabel = formatDateLabel;
|
|
41225
|
-
exports.formatFileSize =
|
|
41294
|
+
exports.formatFileSize = formatFileSize3;
|
|
41226
41295
|
exports.formatLastSeen = formatLastSeen;
|
|
41227
41296
|
exports.generateAttachmentId = generateAttachmentId;
|
|
41228
41297
|
exports.generateId = generateId;
|