@masters-union/union-stack 0.3.4 → 0.3.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.
- package/dist/cdn/loader.v1.global.js +2 -2
- package/dist/cdn/loader.v1.global.js.map +1 -1
- package/dist/{chunk-752WX4LP.cjs → chunk-DFXYQU7F.cjs} +3 -3
- package/dist/{chunk-752WX4LP.cjs.map → chunk-DFXYQU7F.cjs.map} +1 -1
- package/dist/{chunk-V3WGAWVR.js → chunk-OXMJVFTZ.js} +3 -3
- package/dist/{chunk-V3WGAWVR.js.map → chunk-OXMJVFTZ.js.map} +1 -1
- package/dist/index.cjs +3 -3
- package/dist/index.js +2 -2
- package/dist/picker.cjs +60 -4
- package/dist/picker.cjs.map +1 -1
- package/dist/picker.js +60 -4
- package/dist/picker.js.map +1 -1
- package/dist/react.cjs +2 -2
- package/dist/react.js +1 -1
- package/package.json +1 -1
package/dist/picker.js
CHANGED
|
@@ -1312,13 +1312,26 @@ var Picker = class {
|
|
|
1312
1312
|
if (this.opts.maxFileSize) constraintBits.push(`max ${formatBytes(this.opts.maxFileSize)}`);
|
|
1313
1313
|
if (this.opts.accept) {
|
|
1314
1314
|
if (typeof this.opts.accept !== "string") this.opts.accept = this.opts.accept.join(",");
|
|
1315
|
-
const
|
|
1316
|
-
|
|
1317
|
-
|
|
1315
|
+
const labels = [];
|
|
1316
|
+
const seen = /* @__PURE__ */ new Set();
|
|
1317
|
+
for (const part of this.opts.accept.split(",")) {
|
|
1318
|
+
const raw = part.trim();
|
|
1319
|
+
if (!raw || raw === "*/*") continue;
|
|
1320
|
+
const label = mimeLabel(raw);
|
|
1321
|
+
if (label && !seen.has(label)) {
|
|
1322
|
+
seen.add(label);
|
|
1323
|
+
labels.push(label);
|
|
1324
|
+
}
|
|
1325
|
+
}
|
|
1326
|
+
if (labels.length > 0) {
|
|
1327
|
+
const MAX = 5;
|
|
1328
|
+
constraintBits.push(
|
|
1329
|
+
labels.length > MAX ? `${labels.slice(0, MAX).join(", ")} +${labels.length - MAX}` : labels.join(", ")
|
|
1330
|
+
);
|
|
1318
1331
|
}
|
|
1319
1332
|
}
|
|
1320
1333
|
if (constraintBits.length > 0) {
|
|
1321
|
-
dz.appendChild(el2("div", "us-dropzone-constraints", constraintBits.join("
|
|
1334
|
+
dz.appendChild(el2("div", "us-dropzone-constraints", constraintBits.join(" \xB7 ")));
|
|
1322
1335
|
}
|
|
1323
1336
|
const input = document.createElement("input");
|
|
1324
1337
|
input.type = "file";
|
|
@@ -1704,6 +1717,49 @@ function el2(tag, className, text) {
|
|
|
1704
1717
|
if (text !== void 0) node.textContent = text;
|
|
1705
1718
|
return node;
|
|
1706
1719
|
}
|
|
1720
|
+
var MIME_LABELS = {
|
|
1721
|
+
"application/pdf": "PDF",
|
|
1722
|
+
"application/msword": "DOC",
|
|
1723
|
+
"application/vnd.openxmlformats-officedocument.wordprocessingml.document": "DOCX",
|
|
1724
|
+
"application/vnd.ms-excel": "XLS",
|
|
1725
|
+
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet": "XLSX",
|
|
1726
|
+
"application/vnd.ms-powerpoint": "PPT",
|
|
1727
|
+
"application/vnd.openxmlformats-officedocument.presentationml.presentation": "PPTX",
|
|
1728
|
+
"application/zip": "ZIP",
|
|
1729
|
+
"application/json": "JSON",
|
|
1730
|
+
"application/rtf": "RTF",
|
|
1731
|
+
"text/plain": "TXT",
|
|
1732
|
+
"text/csv": "CSV",
|
|
1733
|
+
"text/html": "HTML",
|
|
1734
|
+
"text/markdown": "MD",
|
|
1735
|
+
"image/jpeg": "JPG",
|
|
1736
|
+
"image/png": "PNG",
|
|
1737
|
+
"image/gif": "GIF",
|
|
1738
|
+
"image/webp": "WEBP",
|
|
1739
|
+
"image/svg+xml": "SVG",
|
|
1740
|
+
"image/heic": "HEIC",
|
|
1741
|
+
"video/mp4": "MP4",
|
|
1742
|
+
"audio/mpeg": "MP3"
|
|
1743
|
+
};
|
|
1744
|
+
var MIME_GROUP_LABELS = {
|
|
1745
|
+
image: "Images",
|
|
1746
|
+
video: "Video",
|
|
1747
|
+
audio: "Audio",
|
|
1748
|
+
text: "Text",
|
|
1749
|
+
font: "Fonts"
|
|
1750
|
+
};
|
|
1751
|
+
function mimeLabel(raw) {
|
|
1752
|
+
const type = raw.trim().toLowerCase();
|
|
1753
|
+
if (!type) return "";
|
|
1754
|
+
if (type.endsWith("/*") || !type.includes("/")) {
|
|
1755
|
+
const group = type.replace("/*", "");
|
|
1756
|
+
return MIME_GROUP_LABELS[group] ?? group.charAt(0).toUpperCase() + group.slice(1);
|
|
1757
|
+
}
|
|
1758
|
+
if (MIME_LABELS[type]) return MIME_LABELS[type];
|
|
1759
|
+
if (type.startsWith(".")) return type.slice(1).toUpperCase();
|
|
1760
|
+
const subtype = type.split("/")[1] ?? type;
|
|
1761
|
+
return (subtype.split("+")[0].split(".").pop() ?? subtype).toUpperCase();
|
|
1762
|
+
}
|
|
1707
1763
|
function formatBytes(n) {
|
|
1708
1764
|
if (n < 1024) return `${n} B`;
|
|
1709
1765
|
if (n < 1024 * 1024) return `${(n / 1024).toFixed(1)} KB`;
|