next-tinacms-dos 1.2.0 → 1.3.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/handlers.js +53 -33
- package/dist/index.es.js +418 -120
- package/dist/index.js +418 -120
- package/package.json +5 -4
package/dist/index.es.js
CHANGED
|
@@ -52675,11 +52675,13 @@ const PopupModal = ({ className = "", style = {}, ...props }) => /* @__PURE__ */
|
|
|
52675
52675
|
const ERROR_MISSING_CMS = `useCMS could not find an instance of CMS`;
|
|
52676
52676
|
const CMSContext = react.exports.createContext(null);
|
|
52677
52677
|
function useCMS$1() {
|
|
52678
|
-
const cms = react.exports.useContext(CMSContext);
|
|
52678
|
+
const { cms, dispatch, state } = react.exports.useContext(CMSContext);
|
|
52679
52679
|
if (!cms) {
|
|
52680
52680
|
throw new Error(ERROR_MISSING_CMS);
|
|
52681
52681
|
}
|
|
52682
52682
|
const [, setEnabled] = react.exports.useState(cms.enabled);
|
|
52683
|
+
cms.dispatch = dispatch;
|
|
52684
|
+
cms.state = state;
|
|
52683
52685
|
react.exports.useEffect(() => {
|
|
52684
52686
|
return cms.events.subscribe("cms", () => {
|
|
52685
52687
|
setEnabled(cms.enabled);
|
|
@@ -52739,7 +52741,8 @@ const Button = ({
|
|
|
52739
52741
|
const roundedClasses = {
|
|
52740
52742
|
full: `rounded-full`,
|
|
52741
52743
|
left: `rounded-l-full`,
|
|
52742
|
-
right: `rounded-r-full
|
|
52744
|
+
right: `rounded-r-full`,
|
|
52745
|
+
custom: ""
|
|
52743
52746
|
};
|
|
52744
52747
|
const sizeClasses = {
|
|
52745
52748
|
small: `text-xs h-8 px-3`,
|
|
@@ -52888,12 +52891,24 @@ function IconBase(props) {
|
|
|
52888
52891
|
return elem(conf);
|
|
52889
52892
|
}) : elem(DefaultContext);
|
|
52890
52893
|
}
|
|
52894
|
+
function IoMdRefresh(props) {
|
|
52895
|
+
return GenIcon({ "tag": "svg", "attr": { "viewBox": "0 0 512 512" }, "child": [{ "tag": "path", "attr": { "d": "M256 388c-72.597 0-132-59.405-132-132 0-72.601 59.403-132 132-132 36.3 0 69.299 15.4 92.406 39.601L278 234h154V80l-51.698 51.702C348.406 99.798 304.406 80 256 80c-96.797 0-176 79.203-176 176s78.094 176 176 176c81.045 0 148.287-54.134 169.401-128H378.85c-18.745 49.561-67.138 84-122.85 84z" } }] })(props);
|
|
52896
|
+
}
|
|
52897
|
+
function IoMdSync(props) {
|
|
52898
|
+
return GenIcon({ "tag": "svg", "attr": { "viewBox": "0 0 512 512" }, "child": [{ "tag": "path", "attr": { "d": "M256 93.09V32l-80 81.454 80 81.456v-61.093c65.996 0 120 54.982 120 122.183 0 20.363-5 39.714-14.004 57.016L391 342.547c15.996-25.457 25-54.988 25-86.547 0-89.599-72.002-162.91-160-162.91zm0 285.094c-66.001 0-120-54.988-120-122.184 0-20.363 5-39.709 13.999-57.02L121 169.454C104.999 193.89 96 224.436 96 256c0 89.599 72.002 162.91 160 162.91V480l80-81.453-80-81.457v61.094z" } }] })(props);
|
|
52899
|
+
}
|
|
52891
52900
|
function BiArrowToBottom(props) {
|
|
52892
52901
|
return GenIcon({ "tag": "svg", "attr": { "viewBox": "0 0 24 24" }, "child": [{ "tag": "path", "attr": { "d": "M6 18h12v2H6zm5-14v8.586L6.707 8.293 5.293 9.707 12 16.414l6.707-6.707-1.414-1.414L13 12.586V4z" } }] })(props);
|
|
52893
52902
|
}
|
|
52894
52903
|
function BiCloudUpload(props) {
|
|
52895
52904
|
return GenIcon({ "tag": "svg", "attr": { "viewBox": "0 0 24 24" }, "child": [{ "tag": "path", "attr": { "d": "M13 19v-4h3l-4-5-4 5h3v4z" } }, { "tag": "path", "attr": { "d": "M7 19h2v-2H7c-1.654 0-3-1.346-3-3 0-1.404 1.199-2.756 2.673-3.015l.581-.102.192-.558C8.149 8.274 9.895 7 12 7c2.757 0 5 2.243 5 5v1h1c1.103 0 2 .897 2 2s-.897 2-2 2h-3v2h3c2.206 0 4-1.794 4-4a4.01 4.01 0 0 0-3.056-3.888C18.507 7.67 15.56 5 12 5 9.244 5 6.85 6.611 5.757 9.15 3.609 9.792 2 11.82 2 14c0 2.757 2.243 5 5 5z" } }] })(props);
|
|
52896
52905
|
}
|
|
52906
|
+
function BiCopyAlt(props) {
|
|
52907
|
+
return GenIcon({ "tag": "svg", "attr": { "viewBox": "0 0 24 24" }, "child": [{ "tag": "path", "attr": { "d": "M20 2H10c-1.103 0-2 .897-2 2v4H4c-1.103 0-2 .897-2 2v10c0 1.103.897 2 2 2h10c1.103 0 2-.897 2-2v-4h4c1.103 0 2-.897 2-2V4c0-1.103-.897-2-2-2zM4 20V10h10l.002 10H4zm16-6h-4v-4c0-1.103-.897-2-2-2h-4V4h10v10z" } }, { "tag": "path", "attr": { "d": "M6 12h6v2H6zm0 4h6v2H6z" } }] })(props);
|
|
52908
|
+
}
|
|
52909
|
+
function BiFileBlank(props) {
|
|
52910
|
+
return GenIcon({ "tag": "svg", "attr": { "viewBox": "0 0 24 24" }, "child": [{ "tag": "path", "attr": { "d": "M19.937 8.68c-.011-.032-.02-.063-.033-.094a.997.997 0 0 0-.196-.293l-6-6a.997.997 0 0 0-.293-.196c-.03-.014-.062-.022-.094-.033a.991.991 0 0 0-.259-.051C13.04 2.011 13.021 2 13 2H6c-1.103 0-2 .897-2 2v16c0 1.103.897 2 2 2h12c1.103 0 2-.897 2-2V9c0-.021-.011-.04-.013-.062a.99.99 0 0 0-.05-.258zM16.586 8H14V5.414L16.586 8zM6 20V4h6v5a1 1 0 0 0 1 1h5l.002 10H6z" } }] })(props);
|
|
52911
|
+
}
|
|
52897
52912
|
function BiFile(props) {
|
|
52898
52913
|
return GenIcon({ "tag": "svg", "attr": { "viewBox": "0 0 24 24" }, "child": [{ "tag": "path", "attr": { "d": "M19.903 8.586a.997.997 0 0 0-.196-.293l-6-6a.997.997 0 0 0-.293-.196c-.03-.014-.062-.022-.094-.033a.991.991 0 0 0-.259-.051C13.04 2.011 13.021 2 13 2H6c-1.103 0-2 .897-2 2v16c0 1.103.897 2 2 2h12c1.103 0 2-.897 2-2V9c0-.021-.011-.04-.013-.062a.952.952 0 0 0-.051-.259c-.01-.032-.019-.063-.033-.093zM16.586 8H14V5.414L16.586 8zM6 20V4h6v5a1 1 0 0 0 1 1h5l.002 10H6z" } }, { "tag": "path", "attr": { "d": "M8 12h8v2H8zm0 4h8v2H8zm0-8h2v2H8z" } }] })(props);
|
|
52899
52914
|
}
|
|
@@ -52912,8 +52927,8 @@ function BiListUl(props) {
|
|
|
52912
52927
|
function BiRightArrowAlt(props) {
|
|
52913
52928
|
return GenIcon({ "tag": "svg", "attr": { "viewBox": "0 0 24 24" }, "child": [{ "tag": "path", "attr": { "d": "m11.293 17.293 1.414 1.414L19.414 12l-6.707-6.707-1.414 1.414L15.586 11H6v2h9.586z" } }] })(props);
|
|
52914
52929
|
}
|
|
52915
|
-
function
|
|
52916
|
-
return GenIcon({ "tag": "svg", "attr": { "viewBox": "0 0
|
|
52930
|
+
function BiX(props) {
|
|
52931
|
+
return GenIcon({ "tag": "svg", "attr": { "viewBox": "0 0 24 24" }, "child": [{ "tag": "path", "attr": { "d": "m16.192 6.344-4.243 4.242-4.242-4.242-1.414 1.414L10.535 12l-4.242 4.242 1.414 1.414 4.242-4.242 4.243 4.242 1.414-1.414L13.364 12l4.242-4.242z" } }] })(props);
|
|
52917
52932
|
}
|
|
52918
52933
|
React__default.createContext({
|
|
52919
52934
|
rawMode: false,
|
|
@@ -52939,9 +52954,33 @@ const createHTMLInlinePlugin = createPluginFactory({
|
|
|
52939
52954
|
isVoid: true,
|
|
52940
52955
|
isInline: true
|
|
52941
52956
|
});
|
|
52957
|
+
const textFieldClasses = "shadow-inner focus:shadow-outline focus:border-blue-500 focus:outline-none block text-base placeholder:text-gray-300 px-3 py-2 text-gray-600 w-full bg-white border border-gray-200 transition-all ease-out duration-150 focus:text-gray-900 rounded-md";
|
|
52958
|
+
const disabledClasses = "opacity-50 pointer-events-none cursor-not-allowed";
|
|
52959
|
+
react.exports.forwardRef(({ className, disabled, ...rest }, ref) => {
|
|
52960
|
+
return /* @__PURE__ */ react.exports.createElement("input", {
|
|
52961
|
+
ref,
|
|
52962
|
+
type: "text",
|
|
52963
|
+
className: `${textFieldClasses} ${disabled ? disabledClasses : ""} ${className}`,
|
|
52964
|
+
...rest
|
|
52965
|
+
});
|
|
52966
|
+
});
|
|
52967
|
+
react.exports.forwardRef(({ ...props }, ref) => {
|
|
52968
|
+
return /* @__PURE__ */ react.exports.createElement("textarea", {
|
|
52969
|
+
...props,
|
|
52970
|
+
className: "shadow-inner text-base px-3 py-2 text-gray-600 resize-y focus:shadow-outline focus:border-blue-500 block w-full border border-gray-200 focus:text-gray-900 rounded-md",
|
|
52971
|
+
ref,
|
|
52972
|
+
style: { minHeight: "160px" }
|
|
52973
|
+
});
|
|
52974
|
+
});
|
|
52942
52975
|
function MdOutlinePhotoLibrary(props) {
|
|
52943
52976
|
return GenIcon({ "tag": "svg", "attr": { "viewBox": "0 0 24 24" }, "child": [{ "tag": "path", "attr": { "fill": "none", "d": "M0 0h24v24H0V0z" } }, { "tag": "path", "attr": { "d": "M20 4v12H8V4h12m0-2H8c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2zm-8.5 9.67l1.69 2.26 2.48-3.1L19 15H9zM2 6v14c0 1.1.9 2 2 2h14v-2H4V6H2z" } }] })(props);
|
|
52944
52977
|
}
|
|
52978
|
+
const Input = ({ ...props }) => {
|
|
52979
|
+
return /* @__PURE__ */ react.exports.createElement("input", {
|
|
52980
|
+
className: textFieldClasses,
|
|
52981
|
+
...props
|
|
52982
|
+
});
|
|
52983
|
+
};
|
|
52945
52984
|
function useCMS() {
|
|
52946
52985
|
return useCMS$1();
|
|
52947
52986
|
}
|
|
@@ -52962,8 +53001,79 @@ const dropzoneAcceptFromString = (str) => {
|
|
|
52962
53001
|
return Object.assign({}, ...(str || DEFAULT_MEDIA_UPLOAD_TYPES).split(",").map((x2) => ({ [x2]: [] })));
|
|
52963
53002
|
};
|
|
52964
53003
|
const isImage = (filename) => {
|
|
52965
|
-
return /\.(gif|jpg|jpeg|tiff|png|svg|webp)
|
|
53004
|
+
return /\.(gif|jpg|jpeg|tiff|png|svg|webp|avif)(\?.*)?$/i.test(filename);
|
|
52966
53005
|
};
|
|
53006
|
+
const absoluteImgURL = (str) => {
|
|
53007
|
+
if (str.startsWith("http"))
|
|
53008
|
+
return str;
|
|
53009
|
+
return `${window.location.origin}${str}`;
|
|
53010
|
+
};
|
|
53011
|
+
const StyledImage = ({ src }) => {
|
|
53012
|
+
const isSvg = /\.svg$/.test(src);
|
|
53013
|
+
return /* @__PURE__ */ react.exports.createElement("img", {
|
|
53014
|
+
src,
|
|
53015
|
+
className: `"block max-w-full rounded shadow overflow-hidden max-h-48 h-auto object-contain transition-opacity duration-100 ease-out m-0 bg-gray-200 bg-auto bg-center bg-no-repeat ${isSvg ? "min-w-[12rem]" : ""}`
|
|
53016
|
+
});
|
|
53017
|
+
};
|
|
53018
|
+
const StyledFile = ({ src }) => {
|
|
53019
|
+
return /* @__PURE__ */ react.exports.createElement("div", {
|
|
53020
|
+
className: "max-w-full w-full overflow-hidden flex-1 flex justify-start items-center gap-3"
|
|
53021
|
+
}, /* @__PURE__ */ react.exports.createElement("div", {
|
|
53022
|
+
className: "w-14 h-14 bg-gray-50 shadow border border-gray-100 rounded flex justify-center flex-none"
|
|
53023
|
+
}, /* @__PURE__ */ react.exports.createElement(BiFileBlank, {
|
|
53024
|
+
className: "w-3/5 h-full fill-gray-300"
|
|
53025
|
+
})), /* @__PURE__ */ react.exports.createElement("span", {
|
|
53026
|
+
className: "text-base text-left flex-1 text-gray-500 w-full break-words truncate"
|
|
53027
|
+
}, src));
|
|
53028
|
+
};
|
|
53029
|
+
react.exports.forwardRef(({ onDrop, onClear, onClick, value, src, loading }, ref) => {
|
|
53030
|
+
const cms = useCMS();
|
|
53031
|
+
const { getRootProps, getInputProps } = useDropzone({
|
|
53032
|
+
accept: dropzoneAcceptFromString(cms.media.accept || DEFAULT_MEDIA_UPLOAD_TYPES),
|
|
53033
|
+
onDrop,
|
|
53034
|
+
noClick: !!onClick
|
|
53035
|
+
});
|
|
53036
|
+
return /* @__PURE__ */ react.exports.createElement("div", {
|
|
53037
|
+
className: "w-full max-w-full",
|
|
53038
|
+
...getRootProps()
|
|
53039
|
+
}, /* @__PURE__ */ react.exports.createElement("input", {
|
|
53040
|
+
...getInputProps()
|
|
53041
|
+
}), value ? loading ? /* @__PURE__ */ react.exports.createElement(ImageLoadingIndicator, null) : /* @__PURE__ */ react.exports.createElement("div", {
|
|
53042
|
+
className: `relative w-full max-w-full flex justify-start gap-3 ${isImage(src) ? `items-start` : `items-center`}`
|
|
53043
|
+
}, /* @__PURE__ */ react.exports.createElement("button", {
|
|
53044
|
+
className: "shadow-inner focus-within:shadow-outline focus-within:border-blue-500 outline-none overflow-visible cursor-pointer border-none hover:opacity-60 transition ease-out duration-100",
|
|
53045
|
+
onClick,
|
|
53046
|
+
ref
|
|
53047
|
+
}, isImage(src) ? /* @__PURE__ */ react.exports.createElement(StyledImage, {
|
|
53048
|
+
src
|
|
53049
|
+
}) : /* @__PURE__ */ react.exports.createElement(StyledFile, {
|
|
53050
|
+
src
|
|
53051
|
+
})), onClear && /* @__PURE__ */ react.exports.createElement(DeleteImageButton, {
|
|
53052
|
+
onClick: (e2) => {
|
|
53053
|
+
e2.stopPropagation();
|
|
53054
|
+
onClear();
|
|
53055
|
+
}
|
|
53056
|
+
})) : /* @__PURE__ */ react.exports.createElement("button", {
|
|
53057
|
+
className: "outline-none relative hover:opacity-60 w-full",
|
|
53058
|
+
onClick
|
|
53059
|
+
}, loading ? /* @__PURE__ */ react.exports.createElement(ImageLoadingIndicator, null) : /* @__PURE__ */ react.exports.createElement("div", {
|
|
53060
|
+
className: "text-center rounded-[5px] bg-gray-100 text-gray-300 leading-[1.35] py-3 text-[15px] font-normal transition-all ease-out duration-100 hover:opacity-60"
|
|
53061
|
+
}, "Drag 'n' drop a file here,", /* @__PURE__ */ react.exports.createElement("br", null), "or click to select a file")));
|
|
53062
|
+
});
|
|
53063
|
+
const DeleteImageButton = ({
|
|
53064
|
+
onClick
|
|
53065
|
+
}) => {
|
|
53066
|
+
return /* @__PURE__ */ react.exports.createElement(IconButton, {
|
|
53067
|
+
variant: "white",
|
|
53068
|
+
className: "flex-none",
|
|
53069
|
+
onClick
|
|
53070
|
+
}, /* @__PURE__ */ react.exports.createElement(TrashIcon, {
|
|
53071
|
+
className: "w-7 h-auto"
|
|
53072
|
+
}));
|
|
53073
|
+
};
|
|
53074
|
+
const ImageLoadingIndicator = () => /* @__PURE__ */ react.exports.createElement("div", {
|
|
53075
|
+
className: "p-4 w-full min-h-[96px] flex flex-col justify-center items-center"
|
|
53076
|
+
}, /* @__PURE__ */ react.exports.createElement(LoadingDots, null));
|
|
52967
53077
|
const onKeyDownSoftBreak = (editor, { options: { rules = [] } }) => (event) => {
|
|
52968
53078
|
const entry = getBlockAbove(editor);
|
|
52969
53079
|
if (!entry)
|
|
@@ -54343,12 +54453,6 @@ class ClickOutBase extends React__default.Component {
|
|
|
54343
54453
|
}
|
|
54344
54454
|
}
|
|
54345
54455
|
const ClickableWrapper = onClickOutsideHOC(ClickOutBase);
|
|
54346
|
-
react.exports.createContext({
|
|
54347
|
-
currentBranch: null,
|
|
54348
|
-
setCurrentBranch: (branch) => {
|
|
54349
|
-
console.warn("BranchContext not initialized");
|
|
54350
|
-
}
|
|
54351
|
-
});
|
|
54352
54456
|
function CursorPaginator({
|
|
54353
54457
|
navigateNext,
|
|
54354
54458
|
navigatePrev,
|
|
@@ -54372,50 +54476,41 @@ function CursorPaginator({
|
|
|
54372
54476
|
className: "w-6 h-full ml-2 opacity-70"
|
|
54373
54477
|
})));
|
|
54374
54478
|
}
|
|
54375
|
-
function ListMediaItem({
|
|
54376
|
-
item,
|
|
54377
|
-
onClick,
|
|
54378
|
-
onSelect,
|
|
54379
|
-
onDelete
|
|
54380
|
-
}) {
|
|
54479
|
+
function ListMediaItem({ item, onClick, active: active3 }) {
|
|
54381
54480
|
const FileIcon = item.type === "dir" ? BiFolder : BiFile;
|
|
54481
|
+
const thumbnail = (item.thumbnails || {})["75x75"];
|
|
54382
54482
|
return /* @__PURE__ */ React__default.createElement("li", {
|
|
54383
|
-
className:
|
|
54384
|
-
onClick: () =>
|
|
54385
|
-
|
|
54483
|
+
className: `relative flex shrink-0 gap-3 items-center py-2 pl-2 pr-3 transition duration-150 ease-out cursor-pointer border-b border-gray-150 ${active3 ? "bg-gradient-to-r from-white to-gray-50/50 text-blue-500 hover:bg-gray-50" : "bg-white hover:bg-gray-50/50"}`,
|
|
54484
|
+
onClick: () => {
|
|
54485
|
+
if (!active3) {
|
|
54486
|
+
onClick(item);
|
|
54487
|
+
} else {
|
|
54488
|
+
onClick(false);
|
|
54489
|
+
}
|
|
54490
|
+
}
|
|
54491
|
+
}, item.new && /* @__PURE__ */ React__default.createElement("span", {
|
|
54492
|
+
className: "absolute top-1.5 left-1.5 rounded-full shadow bg-green-100 border border-green-200 text-[10px] tracking-wide font-bold text-green-600 px-1.5 py-0.5 z-10"
|
|
54493
|
+
}, "NEW"), /* @__PURE__ */ React__default.createElement("div", {
|
|
54386
54494
|
className: "w-20 h-20 bg-gray-50 shadow border border-gray-100 rounded overflow-hidden flex justify-center flex-shrink-0"
|
|
54387
|
-
}, isImage(
|
|
54495
|
+
}, isImage(thumbnail) ? /* @__PURE__ */ React__default.createElement("img", {
|
|
54388
54496
|
className: "object-cover w-full h-full object-center",
|
|
54389
|
-
src:
|
|
54497
|
+
src: thumbnail,
|
|
54390
54498
|
alt: item.filename
|
|
54391
54499
|
}) : /* @__PURE__ */ React__default.createElement(FileIcon, {
|
|
54392
54500
|
className: "w-3/5 h-full fill-gray-300"
|
|
54393
|
-
})), /* @__PURE__ */ React__default.createElement(
|
|
54394
|
-
className: "
|
|
54395
|
-
},
|
|
54396
|
-
size: "medium",
|
|
54397
|
-
variant: "white",
|
|
54398
|
-
onClick: () => onSelect(item)
|
|
54399
|
-
}, "Insert", " ", /* @__PURE__ */ React__default.createElement(BiArrowToBottom, {
|
|
54400
|
-
className: "ml-1 -mr-0.5 w-6 h-auto text-blue-500 opacity-70"
|
|
54401
|
-
})), onDelete && item.type === "file" && /* @__PURE__ */ React__default.createElement(IconButton, {
|
|
54402
|
-
variant: "ghost",
|
|
54403
|
-
size: "medium",
|
|
54404
|
-
onClick: () => onDelete(item)
|
|
54405
|
-
}, /* @__PURE__ */ React__default.createElement(TrashIcon, {
|
|
54406
|
-
className: "w-6 h-auto"
|
|
54407
|
-
}))));
|
|
54501
|
+
})), /* @__PURE__ */ React__default.createElement("span", {
|
|
54502
|
+
className: "text-base flex-grow w-full break-words truncate"
|
|
54503
|
+
}, item.filename));
|
|
54408
54504
|
}
|
|
54409
|
-
const Filename = ({ className = "", ...props }) => /* @__PURE__ */ React__default.createElement("span", {
|
|
54410
|
-
className: "text-base flex-grow w-full break-words truncate " + className,
|
|
54411
|
-
...props
|
|
54412
|
-
});
|
|
54413
54505
|
function GridMediaItem({ item, active: active3, onClick }) {
|
|
54414
54506
|
const FileIcon = item.type === "dir" ? BiFolder : BiFile;
|
|
54507
|
+
const thumbnail = (item.thumbnails || {})["400x400"];
|
|
54415
54508
|
return /* @__PURE__ */ React__default.createElement("li", {
|
|
54416
|
-
className: `relative pb-[100%] h-0 block
|
|
54417
|
-
}, /* @__PURE__ */ React__default.createElement("
|
|
54418
|
-
className: "absolute
|
|
54509
|
+
className: `relative pb-[100%] h-0 block border border-gray-100 rounded-md overflow-hidden flex justify-center shrink-0 w-full transition duration-150 ease-out ${active3 ? "shadow-outline" : "shadow hover:shadow-md hover:scale-103 hover:border-gray-150"} ${item.type === "dir" ? "cursor-pointer" : ""}`
|
|
54510
|
+
}, item.new && /* @__PURE__ */ React__default.createElement("span", {
|
|
54511
|
+
className: "absolute top-1.5 left-1.5 rounded-full shadow bg-green-100 border border-green-200 text-[10px] tracking-wide font-bold text-green-600 px-1.5 py-0.5 z-10"
|
|
54512
|
+
}, "NEW"), /* @__PURE__ */ React__default.createElement("button", {
|
|
54513
|
+
className: "absolute w-full h-full flex items-center justify-center bg-white",
|
|
54419
54514
|
onClick: () => {
|
|
54420
54515
|
if (!active3) {
|
|
54421
54516
|
onClick(item);
|
|
@@ -54423,9 +54518,9 @@ function GridMediaItem({ item, active: active3, onClick }) {
|
|
|
54423
54518
|
onClick(false);
|
|
54424
54519
|
}
|
|
54425
54520
|
}
|
|
54426
|
-
}, isImage(
|
|
54521
|
+
}, isImage(thumbnail) ? /* @__PURE__ */ React__default.createElement("img", {
|
|
54427
54522
|
className: "object-cover w-full h-full object-center",
|
|
54428
|
-
src:
|
|
54523
|
+
src: thumbnail,
|
|
54429
54524
|
alt: item.filename
|
|
54430
54525
|
}) : /* @__PURE__ */ React__default.createElement("div", {
|
|
54431
54526
|
className: "p-4 w-full flex flex-col gap-4 items-center justify-center"
|
|
@@ -54472,6 +54567,106 @@ function Breadcrumb({ directory = "", setDirectory }) {
|
|
|
54472
54567
|
}, part);
|
|
54473
54568
|
}));
|
|
54474
54569
|
}
|
|
54570
|
+
const DeleteModal = ({
|
|
54571
|
+
close,
|
|
54572
|
+
deleteFunc,
|
|
54573
|
+
filename
|
|
54574
|
+
}) => {
|
|
54575
|
+
return /* @__PURE__ */ React__default.createElement(Modal, null, /* @__PURE__ */ React__default.createElement(PopupModal, null, /* @__PURE__ */ React__default.createElement(ModalHeader, {
|
|
54576
|
+
close
|
|
54577
|
+
}, "Delete ", filename), /* @__PURE__ */ React__default.createElement(ModalBody, {
|
|
54578
|
+
padded: true
|
|
54579
|
+
}, /* @__PURE__ */ React__default.createElement("p", null, "Are you sure you want to delete ", /* @__PURE__ */ React__default.createElement("strong", null, filename), "?")), /* @__PURE__ */ React__default.createElement(ModalActions, null, /* @__PURE__ */ React__default.createElement(Button, {
|
|
54580
|
+
style: { flexGrow: 2 },
|
|
54581
|
+
onClick: close
|
|
54582
|
+
}, "Cancel"), /* @__PURE__ */ React__default.createElement(Button, {
|
|
54583
|
+
style: { flexGrow: 3 },
|
|
54584
|
+
variant: "danger",
|
|
54585
|
+
onClick: () => {
|
|
54586
|
+
deleteFunc();
|
|
54587
|
+
close();
|
|
54588
|
+
}
|
|
54589
|
+
}, "Delete"))));
|
|
54590
|
+
};
|
|
54591
|
+
const NewFolderModal = ({ onSubmit, close }) => {
|
|
54592
|
+
const [folderName, setFolderName] = React__default.useState("");
|
|
54593
|
+
return /* @__PURE__ */ React__default.createElement(Modal, null, /* @__PURE__ */ React__default.createElement(PopupModal, null, /* @__PURE__ */ React__default.createElement(ModalHeader, {
|
|
54594
|
+
close
|
|
54595
|
+
}, "New Folder"), /* @__PURE__ */ React__default.createElement(ModalBody, {
|
|
54596
|
+
padded: true
|
|
54597
|
+
}, /* @__PURE__ */ React__default.createElement("p", {
|
|
54598
|
+
className: "text-base text-gray-700 mb-2"
|
|
54599
|
+
}, "Please provide a name for your folder."), /* @__PURE__ */ React__default.createElement("p", {
|
|
54600
|
+
className: "text-sm text-gray-500 mb-4 italic"
|
|
54601
|
+
}, /* @__PURE__ */ React__default.createElement("span", {
|
|
54602
|
+
className: "font-bold"
|
|
54603
|
+
}, "Note"), " \u2013 If you navigate away before uploading a media item, the folder will disappear."), /* @__PURE__ */ React__default.createElement(Input, {
|
|
54604
|
+
value: folderName,
|
|
54605
|
+
placeholder: "Folder Name",
|
|
54606
|
+
required: true,
|
|
54607
|
+
onChange: (e2) => setFolderName(e2.target.value)
|
|
54608
|
+
})), /* @__PURE__ */ React__default.createElement(ModalActions, null, /* @__PURE__ */ React__default.createElement(Button, {
|
|
54609
|
+
style: { flexGrow: 2 },
|
|
54610
|
+
onClick: close
|
|
54611
|
+
}, "Cancel"), /* @__PURE__ */ React__default.createElement(Button, {
|
|
54612
|
+
disabled: !folderName,
|
|
54613
|
+
style: { flexGrow: 3 },
|
|
54614
|
+
variant: "primary",
|
|
54615
|
+
onClick: () => {
|
|
54616
|
+
if (!folderName)
|
|
54617
|
+
return;
|
|
54618
|
+
onSubmit(folderName);
|
|
54619
|
+
close();
|
|
54620
|
+
}
|
|
54621
|
+
}, "Create New Folder"))));
|
|
54622
|
+
};
|
|
54623
|
+
const SyncModal = ({ close, syncFunc, folder, branch }) => {
|
|
54624
|
+
return /* @__PURE__ */ React__default.createElement(Modal, null, /* @__PURE__ */ React__default.createElement(PopupModal, null, /* @__PURE__ */ React__default.createElement(ModalHeader, {
|
|
54625
|
+
close
|
|
54626
|
+
}, "Sync Media"), /* @__PURE__ */ React__default.createElement(ModalBody, {
|
|
54627
|
+
padded: true
|
|
54628
|
+
}, /* @__PURE__ */ React__default.createElement("p", null, `This will copy media assets from the \`${folder}\` folder on branch \`${branch}\` in your git repository to Tina Cloud's asset service. This will allow you to use these assets in your site with Tina Cloud`)), /* @__PURE__ */ React__default.createElement(ModalActions, null, /* @__PURE__ */ React__default.createElement(Button, {
|
|
54629
|
+
style: { flexGrow: 2 },
|
|
54630
|
+
onClick: close
|
|
54631
|
+
}, "Cancel"), /* @__PURE__ */ React__default.createElement(Button, {
|
|
54632
|
+
style: { flexGrow: 3 },
|
|
54633
|
+
variant: "primary",
|
|
54634
|
+
onClick: async () => {
|
|
54635
|
+
await syncFunc();
|
|
54636
|
+
close();
|
|
54637
|
+
}
|
|
54638
|
+
}, "Sync Media"))));
|
|
54639
|
+
};
|
|
54640
|
+
const CopyField = ({ label, description, value }) => {
|
|
54641
|
+
const [copied, setCopied] = React__default.useState(false);
|
|
54642
|
+
const [fadeOut, setFadeOut] = React__default.useState(false);
|
|
54643
|
+
return /* @__PURE__ */ React__default.createElement("div", {
|
|
54644
|
+
className: "w-full"
|
|
54645
|
+
}, label && /* @__PURE__ */ React__default.createElement("label", {
|
|
54646
|
+
className: "w-full mb-1 block flex-1 text-sm font-bold leading-5 text-gray-700"
|
|
54647
|
+
}, label), /* @__PURE__ */ React__default.createElement("span", {
|
|
54648
|
+
onClick: () => {
|
|
54649
|
+
if (copied === true)
|
|
54650
|
+
return;
|
|
54651
|
+
setCopied(true);
|
|
54652
|
+
setTimeout(() => {
|
|
54653
|
+
setFadeOut(true);
|
|
54654
|
+
}, 2500);
|
|
54655
|
+
setTimeout(() => {
|
|
54656
|
+
setCopied(false);
|
|
54657
|
+
setFadeOut(false);
|
|
54658
|
+
}, 3e3);
|
|
54659
|
+
navigator.clipboard.writeText(value);
|
|
54660
|
+
},
|
|
54661
|
+
className: `shadow-inner text-base leading-5 whitespace-normal break-all px-3 py-2 text-gray-600 w-full bg-gray-50 border border-gray-200 transition-all ease-out duration-150 rounded-md relative overflow-hidden appearance-none flex items-center w-full cursor-pointer hover:bg-white hover:text-blue-500 ${copied ? `pointer-events-none` : ``}`
|
|
54662
|
+
}, /* @__PURE__ */ React__default.createElement(BiCopyAlt, {
|
|
54663
|
+
className: "relative text-blue-500 shrink-0 w-5 h-auto mr-1.5 -ml-0.5 z-20"
|
|
54664
|
+
}), " ", value, " ", copied && /* @__PURE__ */ React__default.createElement("span", {
|
|
54665
|
+
className: `${fadeOut ? `opacity-0` : `opacity-100`} text-blue-500 transition-opacity duration-500 absolute right-0 w-full h-full px-3 py-2 bg-white bg-opacity-90 flex items-center justify-center text-center tracking-wide font-medium z-10`
|
|
54666
|
+
}, /* @__PURE__ */ React__default.createElement("span", null, "Copied to clipboard!"))), description && /* @__PURE__ */ React__default.createElement("p", {
|
|
54667
|
+
className: "mt-2 text-sm text-gray-500"
|
|
54668
|
+
}, description));
|
|
54669
|
+
};
|
|
54475
54670
|
async function poll(fn2, timeout, interval) {
|
|
54476
54671
|
const endTime = Number(new Date()) + (timeout || 2e3);
|
|
54477
54672
|
interval = interval || 100;
|
|
@@ -54520,6 +54715,8 @@ function MediaPicker({
|
|
|
54520
54715
|
return "loading";
|
|
54521
54716
|
return "not-configured";
|
|
54522
54717
|
});
|
|
54718
|
+
const [deleteModalOpen, setDeleteModalOpen] = React__default.useState(false);
|
|
54719
|
+
const [newFolderModalOpen, setNewFolderModalOpen] = React__default.useState(false);
|
|
54523
54720
|
const [listError, setListError] = react.exports.useState(defaultListError);
|
|
54524
54721
|
const [directory, setDirectory] = react.exports.useState(props.directory);
|
|
54525
54722
|
const [list2, setList] = react.exports.useState({
|
|
@@ -54529,6 +54726,7 @@ function MediaPicker({
|
|
|
54529
54726
|
const [showSync, setShowSync] = react.exports.useState(false);
|
|
54530
54727
|
const [viewMode, setViewMode] = react.exports.useState("grid");
|
|
54531
54728
|
const [activeItem, setActiveItem] = react.exports.useState(false);
|
|
54729
|
+
const closePreview = () => setActiveItem(false);
|
|
54532
54730
|
const [offsetHistory, setOffsetHistory] = react.exports.useState([]);
|
|
54533
54731
|
const [loadingText, setLoadingText] = react.exports.useState("");
|
|
54534
54732
|
const offset2 = offsetHistory[offsetHistory.length - 1];
|
|
@@ -54550,7 +54748,16 @@ function MediaPicker({
|
|
|
54550
54748
|
const branch = (_m = cms.api.tina) == null ? void 0 : _m.branch;
|
|
54551
54749
|
function loadMedia() {
|
|
54552
54750
|
setListState("loading");
|
|
54553
|
-
cms.media.list({
|
|
54751
|
+
cms.media.list({
|
|
54752
|
+
offset: offset2,
|
|
54753
|
+
limit: cms.media.pageSize,
|
|
54754
|
+
directory,
|
|
54755
|
+
thumbnailSizes: [
|
|
54756
|
+
{ w: 75, h: 75 },
|
|
54757
|
+
{ w: 400, h: 400 },
|
|
54758
|
+
{ w: 1e3, h: 1e3 }
|
|
54759
|
+
]
|
|
54760
|
+
}).then((list22) => {
|
|
54554
54761
|
setList(list22);
|
|
54555
54762
|
setListState("loaded");
|
|
54556
54763
|
}).catch((e2) => {
|
|
@@ -54567,15 +54774,9 @@ function MediaPicker({
|
|
|
54567
54774
|
if (!cms.media.isConfigured)
|
|
54568
54775
|
return;
|
|
54569
54776
|
loadMedia();
|
|
54570
|
-
return cms.events.subscribe(["media:
|
|
54777
|
+
return cms.events.subscribe(["media:delete:success", "media:pageSize"], loadMedia);
|
|
54571
54778
|
}, [offset2, directory, cms.media.isConfigured]);
|
|
54572
54779
|
const onClickMediaItem = (item) => {
|
|
54573
|
-
if (item.type === "dir") {
|
|
54574
|
-
setDirectory(item.directory === "." || item.directory === "" ? item.filename : join(item.directory, item.filename));
|
|
54575
|
-
resetOffset();
|
|
54576
|
-
}
|
|
54577
|
-
};
|
|
54578
|
-
const onClickGridMediaItem = (item) => {
|
|
54579
54780
|
if (!item) {
|
|
54580
54781
|
setActiveItem(false);
|
|
54581
54782
|
} else if (item.type === "dir") {
|
|
@@ -54588,9 +54789,7 @@ function MediaPicker({
|
|
|
54588
54789
|
let deleteMediaItem;
|
|
54589
54790
|
if (allowDelete) {
|
|
54590
54791
|
deleteMediaItem = (item) => {
|
|
54591
|
-
|
|
54592
|
-
cms.media.delete(item);
|
|
54593
|
-
}
|
|
54792
|
+
cms.media.delete(item);
|
|
54594
54793
|
};
|
|
54595
54794
|
}
|
|
54596
54795
|
let selectMediaItem;
|
|
@@ -54605,15 +54804,50 @@ function MediaPicker({
|
|
|
54605
54804
|
const { getRootProps, getInputProps, isDragActive } = useDropzone({
|
|
54606
54805
|
accept: dropzoneAcceptFromString(cms.media.accept || DEFAULT_MEDIA_UPLOAD_TYPES),
|
|
54607
54806
|
multiple: true,
|
|
54608
|
-
onDrop: async (files) => {
|
|
54807
|
+
onDrop: async (files, fileRejections) => {
|
|
54609
54808
|
try {
|
|
54610
54809
|
setUploading(true);
|
|
54611
|
-
await cms.media.persist(files.map((file) => {
|
|
54810
|
+
const mediaItems = await cms.media.persist(files.map((file) => {
|
|
54612
54811
|
return {
|
|
54613
54812
|
directory: directory || "/",
|
|
54614
54813
|
file
|
|
54615
54814
|
};
|
|
54616
54815
|
}));
|
|
54816
|
+
const errorCodes = {
|
|
54817
|
+
"file-invalid-type": "Invalid file type",
|
|
54818
|
+
"file-too-large": "File too large",
|
|
54819
|
+
"file-too-small": "File too small",
|
|
54820
|
+
"too-many-files": "Too many files"
|
|
54821
|
+
};
|
|
54822
|
+
const printError = (error) => {
|
|
54823
|
+
const message2 = errorCodes[error.code];
|
|
54824
|
+
if (message2) {
|
|
54825
|
+
return message2;
|
|
54826
|
+
}
|
|
54827
|
+
console.error(error);
|
|
54828
|
+
return "Unknown error";
|
|
54829
|
+
};
|
|
54830
|
+
if (fileRejections.length > 0) {
|
|
54831
|
+
const messages = [];
|
|
54832
|
+
fileRejections.map((fileRejection) => {
|
|
54833
|
+
messages.push(`${fileRejection.file.name}: ${fileRejection.errors.map((error) => printError(error)).join(", ")}`);
|
|
54834
|
+
});
|
|
54835
|
+
cms.alerts.error(() => {
|
|
54836
|
+
return /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, "Upload Failed. ", /* @__PURE__ */ React__default.createElement("br", null), messages.join(". "), ".");
|
|
54837
|
+
});
|
|
54838
|
+
}
|
|
54839
|
+
if (mediaItems.length !== 0) {
|
|
54840
|
+
setActiveItem(mediaItems[0]);
|
|
54841
|
+
setList((mediaList) => {
|
|
54842
|
+
return {
|
|
54843
|
+
items: [
|
|
54844
|
+
...mediaItems.map((x2) => ({ ...x2, new: true })),
|
|
54845
|
+
...mediaList.items
|
|
54846
|
+
],
|
|
54847
|
+
nextOffset: mediaList.nextOffset
|
|
54848
|
+
};
|
|
54849
|
+
});
|
|
54850
|
+
}
|
|
54617
54851
|
} catch {
|
|
54618
54852
|
}
|
|
54619
54853
|
setUploading(false);
|
|
@@ -54678,28 +54912,56 @@ function MediaPicker({
|
|
|
54678
54912
|
docsLink
|
|
54679
54913
|
});
|
|
54680
54914
|
}
|
|
54681
|
-
return /* @__PURE__ */ React__default.createElement(React__default.Fragment, null,
|
|
54682
|
-
|
|
54915
|
+
return /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, deleteModalOpen && /* @__PURE__ */ React__default.createElement(DeleteModal, {
|
|
54916
|
+
filename: activeItem ? activeItem.filename : "",
|
|
54917
|
+
deleteFunc: () => {
|
|
54918
|
+
if (activeItem) {
|
|
54919
|
+
deleteMediaItem(activeItem);
|
|
54920
|
+
setActiveItem(false);
|
|
54921
|
+
}
|
|
54922
|
+
},
|
|
54923
|
+
close: () => setDeleteModalOpen(false)
|
|
54924
|
+
}), newFolderModalOpen && /* @__PURE__ */ React__default.createElement(NewFolderModal, {
|
|
54925
|
+
onSubmit: (name) => {
|
|
54926
|
+
setDirectory((oldDir) => {
|
|
54927
|
+
if (oldDir) {
|
|
54928
|
+
return join(oldDir, name);
|
|
54929
|
+
} else {
|
|
54930
|
+
return name;
|
|
54931
|
+
}
|
|
54932
|
+
});
|
|
54933
|
+
resetOffset();
|
|
54934
|
+
},
|
|
54935
|
+
close: () => setNewFolderModalOpen(false)
|
|
54936
|
+
}), /* @__PURE__ */ React__default.createElement(MediaPickerWrap, null, /* @__PURE__ */ React__default.createElement("div", {
|
|
54937
|
+
className: "flex flex-wrap items-center bg-gray-50 border-b border-gray-150 gap-4 py-3 px-5 shadow-sm flex-shrink-0"
|
|
54683
54938
|
}, /* @__PURE__ */ React__default.createElement("div", {
|
|
54684
|
-
className:
|
|
54685
|
-
}, /* @__PURE__ */ React__default.createElement(
|
|
54686
|
-
|
|
54687
|
-
|
|
54688
|
-
|
|
54689
|
-
}
|
|
54690
|
-
}, /* @__PURE__ */ React__default.createElement(BiGridAlt, {
|
|
54691
|
-
className: "w-6 h-full opacity-70"
|
|
54692
|
-
})), /* @__PURE__ */ React__default.createElement("button", {
|
|
54693
|
-
className: `relative whitespace-nowrap flex items-center justify-center flex-1 block font-medium text-base px-2 py-1 transition-all ease-out duration-150 rounded-r-md ${viewMode === "list" ? "bg-white text-blue-500 shadow" : "text-gray-400"}`,
|
|
54694
|
-
onClick: () => {
|
|
54695
|
-
setViewMode("list");
|
|
54696
|
-
}
|
|
54697
|
-
}, /* @__PURE__ */ React__default.createElement(BiListUl, {
|
|
54698
|
-
className: "w-8 h-full opacity-70"
|
|
54699
|
-
}))), /* @__PURE__ */ React__default.createElement(Breadcrumb, {
|
|
54939
|
+
className: "flex flex-1 items-center gap-4"
|
|
54940
|
+
}, /* @__PURE__ */ React__default.createElement(ViewModeToggle, {
|
|
54941
|
+
viewMode,
|
|
54942
|
+
setViewMode
|
|
54943
|
+
}), /* @__PURE__ */ React__default.createElement(Breadcrumb, {
|
|
54700
54944
|
directory,
|
|
54701
54945
|
setDirectory
|
|
54702
|
-
}),
|
|
54946
|
+
})), /* @__PURE__ */ React__default.createElement("div", {
|
|
54947
|
+
className: "flex items-center gap-4"
|
|
54948
|
+
}, /* @__PURE__ */ React__default.createElement(Button, {
|
|
54949
|
+
busy: false,
|
|
54950
|
+
variant: "white",
|
|
54951
|
+
onClick: loadMedia,
|
|
54952
|
+
className: "whitespace-nowrap"
|
|
54953
|
+
}, "Refresh", /* @__PURE__ */ React__default.createElement(IoMdRefresh, {
|
|
54954
|
+
className: "w-6 h-full ml-2 opacity-70 text-blue-500"
|
|
54955
|
+
})), /* @__PURE__ */ React__default.createElement(Button, {
|
|
54956
|
+
busy: false,
|
|
54957
|
+
variant: "white",
|
|
54958
|
+
onClick: () => {
|
|
54959
|
+
setNewFolderModalOpen(true);
|
|
54960
|
+
},
|
|
54961
|
+
className: "whitespace-nowrap"
|
|
54962
|
+
}, "New Folder", /* @__PURE__ */ React__default.createElement(BiFolder, {
|
|
54963
|
+
className: "w-6 h-full ml-2 opacity-70 text-blue-500"
|
|
54964
|
+
})), !isLocal2 && hasTinaMedia && /* @__PURE__ */ React__default.createElement(Button, {
|
|
54703
54965
|
busy: false,
|
|
54704
54966
|
variant: "white",
|
|
54705
54967
|
onClick: () => {
|
|
@@ -54710,11 +54972,13 @@ function MediaPicker({
|
|
|
54710
54972
|
})), /* @__PURE__ */ React__default.createElement(UploadButton, {
|
|
54711
54973
|
onClick,
|
|
54712
54974
|
uploading
|
|
54713
|
-
})), /* @__PURE__ */ React__default.createElement("div", {
|
|
54714
|
-
className: "flex h-full overflow-hidden"
|
|
54975
|
+
}))), /* @__PURE__ */ React__default.createElement("div", {
|
|
54976
|
+
className: "flex h-full overflow-hidden bg-white"
|
|
54977
|
+
}, /* @__PURE__ */ React__default.createElement("div", {
|
|
54978
|
+
className: "flex w-full flex-col h-full @container"
|
|
54715
54979
|
}, /* @__PURE__ */ React__default.createElement("ul", {
|
|
54716
54980
|
...rootProps,
|
|
54717
|
-
className: `h-full
|
|
54981
|
+
className: `h-full grow overflow-y-auto transition duration-150 ease-out bg-gradient-to-b from-gray-50/50 to-gray-50 ${list2.items.length === 0 || viewMode === "list" && "w-full flex flex-1 flex-col justify-start -mb-px"} ${list2.items.length > 0 && viewMode === "grid" && "w-full p-4 gap-4 grid grid-cols-1 @sm:grid-cols-2 @lg:grid-cols-3 @2xl:grid-cols-4 @4xl:grid-cols-6 @6xl:grid-cols-8 auto-rows-auto content-start justify-start"} ${isDragActive ? `border-2 border-blue-500 rounded-lg` : ``}`
|
|
54718
54982
|
}, /* @__PURE__ */ React__default.createElement("input", {
|
|
54719
54983
|
...getInputProps()
|
|
54720
54984
|
}), listState === "loaded" && list2.items.length === 0 && /* @__PURE__ */ React__default.createElement(EmptyMediaList, {
|
|
@@ -54723,24 +54987,27 @@ function MediaPicker({
|
|
|
54723
54987
|
key: item.id,
|
|
54724
54988
|
item,
|
|
54725
54989
|
onClick: onClickMediaItem,
|
|
54726
|
-
|
|
54727
|
-
onDelete: deleteMediaItem
|
|
54990
|
+
active: activeItem && activeItem.id === item.id
|
|
54728
54991
|
})), viewMode === "grid" && list2.items.map((item) => /* @__PURE__ */ React__default.createElement(GridMediaItem, {
|
|
54729
54992
|
key: item.id,
|
|
54730
54993
|
item,
|
|
54731
|
-
onClick:
|
|
54994
|
+
onClick: onClickMediaItem,
|
|
54732
54995
|
active: activeItem && activeItem.id === item.id
|
|
54733
|
-
}))),
|
|
54734
|
-
|
|
54735
|
-
selectMediaItem,
|
|
54736
|
-
deleteMediaItem
|
|
54737
|
-
})), /* @__PURE__ */ React__default.createElement("div", {
|
|
54738
|
-
className: "bg-gray-50 border-t border-gray-150 py-3 px-5 shadow-sm z-10"
|
|
54996
|
+
}))), /* @__PURE__ */ React__default.createElement("div", {
|
|
54997
|
+
className: "bg-gradient-to-r to-gray-50/50 from-gray-50 shrink-0 grow-0 border-t border-gray-150 py-3 px-5 shadow-sm z-10"
|
|
54739
54998
|
}, /* @__PURE__ */ React__default.createElement(CursorPaginator, {
|
|
54740
54999
|
hasNext,
|
|
54741
55000
|
navigateNext,
|
|
54742
55001
|
hasPrev,
|
|
54743
55002
|
navigatePrev
|
|
55003
|
+
}))), /* @__PURE__ */ React__default.createElement(ActiveItemPreview, {
|
|
55004
|
+
activeItem,
|
|
55005
|
+
close: closePreview,
|
|
55006
|
+
selectMediaItem,
|
|
55007
|
+
allowDelete,
|
|
55008
|
+
deleteMediaItem: () => {
|
|
55009
|
+
setDeleteModalOpen(true);
|
|
55010
|
+
}
|
|
54744
55011
|
}))), showSync && /* @__PURE__ */ React__default.createElement(SyncModal, {
|
|
54745
55012
|
folder,
|
|
54746
55013
|
branch,
|
|
@@ -54752,23 +55019,41 @@ function MediaPicker({
|
|
|
54752
55019
|
}
|
|
54753
55020
|
const ActiveItemPreview = ({
|
|
54754
55021
|
activeItem,
|
|
55022
|
+
close,
|
|
54755
55023
|
selectMediaItem,
|
|
54756
|
-
deleteMediaItem
|
|
55024
|
+
deleteMediaItem,
|
|
55025
|
+
allowDelete
|
|
54757
55026
|
}) => {
|
|
55027
|
+
const thumbnail = activeItem ? (activeItem.thumbnails || {})["1000x1000"] : "";
|
|
54758
55028
|
return /* @__PURE__ */ React__default.createElement("div", {
|
|
54759
|
-
className:
|
|
54760
|
-
},
|
|
54761
|
-
className: "
|
|
54762
|
-
|
|
55029
|
+
className: `shrink-0 h-full flex flex-col items-start gap-3 overflow-y-auto bg-white border-l border-gray-100 bg-white shadow-md transition ease-out duration-150 ${activeItem ? `p-4 opacity-100 w-[35%] max-w-[560px] min-w-[240px]` : `translate-x-8 opacity-0 w-[0px]`}`
|
|
55030
|
+
}, activeItem && /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, /* @__PURE__ */ React__default.createElement("div", {
|
|
55031
|
+
className: "flex grow-0 shrink-0 gap-2 w-full items-center justify-between"
|
|
55032
|
+
}, /* @__PURE__ */ React__default.createElement("h3", {
|
|
55033
|
+
className: "text-lg text-gray-600 w-full max-w-full break-words block truncate flex-1"
|
|
55034
|
+
}, activeItem.filename), /* @__PURE__ */ React__default.createElement(IconButton, {
|
|
55035
|
+
variant: "ghost",
|
|
55036
|
+
className: "group grow-0 shrink-0",
|
|
55037
|
+
onClick: close
|
|
55038
|
+
}, /* @__PURE__ */ React__default.createElement(BiX, {
|
|
55039
|
+
className: `w-7 h-auto text-gray-500 opacity-50 group-hover:opacity-100 transition duration-150 ease-out`
|
|
55040
|
+
}))), isImage(thumbnail) ? /* @__PURE__ */ React__default.createElement("div", {
|
|
55041
|
+
className: "w-full max-h-[75%]"
|
|
55042
|
+
}, /* @__PURE__ */ React__default.createElement("img", {
|
|
55043
|
+
className: "block border border-gray-100 rounded-md overflow-hidden max-w-full max-h-full object-fit h-auto shadow",
|
|
55044
|
+
src: thumbnail,
|
|
54763
55045
|
alt: activeItem.filename
|
|
54764
|
-
}) : /* @__PURE__ */ React__default.createElement("span", {
|
|
55046
|
+
})) : /* @__PURE__ */ React__default.createElement("span", {
|
|
54765
55047
|
className: "p-3 border border-gray-100 rounded-md overflow-hidden bg-gray-50 shadow"
|
|
54766
55048
|
}, /* @__PURE__ */ React__default.createElement(BiFile, {
|
|
54767
55049
|
className: "w-14 h-auto fill-gray-300"
|
|
54768
|
-
})), /* @__PURE__ */ React__default.createElement("
|
|
54769
|
-
className: "
|
|
54770
|
-
},
|
|
54771
|
-
|
|
55050
|
+
})), /* @__PURE__ */ React__default.createElement("div", {
|
|
55051
|
+
className: "grow h-full w-full shrink flex flex-col gap-3 items-start justify-start"
|
|
55052
|
+
}, /* @__PURE__ */ React__default.createElement(CopyField, {
|
|
55053
|
+
value: absoluteImgURL(activeItem.src),
|
|
55054
|
+
label: "URL"
|
|
55055
|
+
})), /* @__PURE__ */ React__default.createElement("div", {
|
|
55056
|
+
className: "shrink-0 w-full flex flex-col justify-end items-start"
|
|
54772
55057
|
}, /* @__PURE__ */ React__default.createElement("div", {
|
|
54773
55058
|
className: "flex w-full gap-3"
|
|
54774
55059
|
}, selectMediaItem && /* @__PURE__ */ React__default.createElement(Button, {
|
|
@@ -54778,14 +55063,14 @@ const ActiveItemPreview = ({
|
|
|
54778
55063
|
onClick: () => selectMediaItem(activeItem)
|
|
54779
55064
|
}, "Insert", /* @__PURE__ */ React__default.createElement(BiArrowToBottom, {
|
|
54780
55065
|
className: "ml-1 -mr-0.5 w-6 h-auto text-white opacity-70"
|
|
54781
|
-
})), /* @__PURE__ */ React__default.createElement(Button, {
|
|
55066
|
+
})), allowDelete && /* @__PURE__ */ React__default.createElement(Button, {
|
|
54782
55067
|
variant: "white",
|
|
54783
55068
|
size: "medium",
|
|
54784
55069
|
className: "grow max-w-[40%]",
|
|
54785
|
-
onClick:
|
|
55070
|
+
onClick: deleteMediaItem
|
|
54786
55071
|
}, "Delete", /* @__PURE__ */ React__default.createElement(TrashIcon, {
|
|
54787
55072
|
className: "ml-1 -mr-0.5 w-6 h-auto text-red-500 opacity-70"
|
|
54788
|
-
})))));
|
|
55073
|
+
}))))));
|
|
54789
55074
|
};
|
|
54790
55075
|
const UploadButton = ({ onClick, uploading }) => {
|
|
54791
55076
|
return /* @__PURE__ */ React__default.createElement(Button, {
|
|
@@ -54813,9 +55098,9 @@ const MediaPickerWrap = ({ children }) => {
|
|
|
54813
55098
|
};
|
|
54814
55099
|
const EmptyMediaList = (props) => {
|
|
54815
55100
|
return /* @__PURE__ */ React__default.createElement("div", {
|
|
54816
|
-
className: `text-
|
|
55101
|
+
className: `p-12 text-xl opacity-50 text-center`,
|
|
54817
55102
|
...props
|
|
54818
|
-
}, "Drag and
|
|
55103
|
+
}, "Drag and drop assets here", props.hasTinaMedia && " or click 'Sync' to sync your media to Tina Cloud.");
|
|
54819
55104
|
};
|
|
54820
55105
|
const DocsLink = ({ title, message: message2, docsLink, ...props }) => {
|
|
54821
55106
|
return /* @__PURE__ */ React__default.createElement("div", {
|
|
@@ -54832,22 +55117,29 @@ const DocsLink = ({ title, message: message2, docsLink, ...props }) => {
|
|
|
54832
55117
|
className: "font-bold text-blue-500 hover:text-blue-600 hover:underline transition-all ease-out duration-150"
|
|
54833
55118
|
}, "Learn More"));
|
|
54834
55119
|
};
|
|
54835
|
-
const
|
|
54836
|
-
|
|
54837
|
-
|
|
54838
|
-
|
|
54839
|
-
|
|
54840
|
-
}
|
|
54841
|
-
|
|
54842
|
-
|
|
54843
|
-
},
|
|
54844
|
-
|
|
54845
|
-
|
|
54846
|
-
|
|
54847
|
-
await syncFunc();
|
|
54848
|
-
close();
|
|
55120
|
+
const ViewModeToggle = ({ viewMode, setViewMode }) => {
|
|
55121
|
+
const toggleClasses = {
|
|
55122
|
+
base: "relative whitespace-nowrap flex items-center justify-center flex-1 block font-medium text-base py-1 transition-all ease-out duration-150 border",
|
|
55123
|
+
active: "bg-white text-blue-500 shadow-inner border-gray-50 border-t-gray-100",
|
|
55124
|
+
inactive: "bg-gray-50 text-gray-400 shadow border-gray-100 border-t-white"
|
|
55125
|
+
};
|
|
55126
|
+
return /* @__PURE__ */ React__default.createElement("div", {
|
|
55127
|
+
className: `grow-0 flex justify-between rounded-md border border-gray-100`
|
|
55128
|
+
}, /* @__PURE__ */ React__default.createElement("button", {
|
|
55129
|
+
className: `${toggleClasses.base} px-2.5 rounded-l-md ${viewMode === "grid" ? toggleClasses.active : toggleClasses.inactive}`,
|
|
55130
|
+
onClick: () => {
|
|
55131
|
+
setViewMode("grid");
|
|
54849
55132
|
}
|
|
54850
|
-
},
|
|
55133
|
+
}, /* @__PURE__ */ React__default.createElement(BiGridAlt, {
|
|
55134
|
+
className: "w-6 h-full opacity-70"
|
|
55135
|
+
})), /* @__PURE__ */ React__default.createElement("button", {
|
|
55136
|
+
className: `${toggleClasses.base} px-2 rounded-r-md ${viewMode === "list" ? toggleClasses.active : toggleClasses.inactive}`,
|
|
55137
|
+
onClick: () => {
|
|
55138
|
+
setViewMode("list");
|
|
55139
|
+
}
|
|
55140
|
+
}, /* @__PURE__ */ React__default.createElement(BiListUl, {
|
|
55141
|
+
className: "w-8 h-full opacity-70"
|
|
55142
|
+
})));
|
|
54851
55143
|
};
|
|
54852
55144
|
createScreen({
|
|
54853
55145
|
name: "Media Manager",
|
|
@@ -54859,6 +55151,12 @@ createScreen({
|
|
|
54859
55151
|
}
|
|
54860
55152
|
});
|
|
54861
55153
|
react.exports.createContext(-1);
|
|
55154
|
+
react.exports.createContext({
|
|
55155
|
+
currentBranch: null,
|
|
55156
|
+
setCurrentBranch: (branch) => {
|
|
55157
|
+
console.warn("BranchContext not initialized");
|
|
55158
|
+
}
|
|
55159
|
+
});
|
|
54862
55160
|
react.exports.createContext(null);
|
|
54863
55161
|
class MediaListError extends Error {
|
|
54864
55162
|
constructor(config2) {
|