@raketa-builder/file-input 0.6.0 → 0.7.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/.turbo/turbo-build.log +3 -3
- package/dist/index.js +91 -35
- package/package.json +1 -1
- package/.turbo/turbo-format.log +0 -21
- package/.turbo/turbo-lint.log +0 -4
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
> @raketa-builder/file-input@0.
|
|
2
|
+
> @raketa-builder/file-input@0.7.0 build
|
|
3
3
|
> tsup src/index.js --format cjs --loader ".js=jsx"
|
|
4
4
|
|
|
5
5
|
CLI Building entry: src/index.js
|
|
@@ -7,5 +7,5 @@ CLI Using tsconfig: tsconfig.json
|
|
|
7
7
|
CLI tsup v6.5.0
|
|
8
8
|
CLI Target: es6
|
|
9
9
|
CJS Build start
|
|
10
|
-
CJS dist/index.js
|
|
11
|
-
CJS ⚡️ Build success in
|
|
10
|
+
CJS dist/index.js 72.99 KB
|
|
11
|
+
CJS ⚡️ Build success in 109ms
|
package/dist/index.js
CHANGED
|
@@ -122,6 +122,7 @@ var require_dist = __commonJS({
|
|
|
122
122
|
var src_exports2 = {};
|
|
123
123
|
__export2(src_exports2, {
|
|
124
124
|
Button: () => Button_default,
|
|
125
|
+
CategoriesMenu: () => CategoriesMenu_default,
|
|
125
126
|
Col: () => Col,
|
|
126
127
|
Container: () => Container_default,
|
|
127
128
|
DataGrid: () => DataGrid_default,
|
|
@@ -227,11 +228,24 @@ var require_dist = __commonJS({
|
|
|
227
228
|
var import_react32 = __toESM2(require("react"));
|
|
228
229
|
var import_jsx_runtime32 = require("react/jsx-runtime");
|
|
229
230
|
var Button4 = (_a) => {
|
|
230
|
-
var _b = _a, {
|
|
231
|
+
var _b = _a, {
|
|
232
|
+
as = "button",
|
|
233
|
+
size = "md",
|
|
234
|
+
variant = "primary",
|
|
235
|
+
className,
|
|
236
|
+
type = "button"
|
|
237
|
+
} = _b, rest = __objRest(_b, [
|
|
238
|
+
"as",
|
|
239
|
+
"size",
|
|
240
|
+
"variant",
|
|
241
|
+
"className",
|
|
242
|
+
"type"
|
|
243
|
+
]);
|
|
231
244
|
const Component = as;
|
|
232
245
|
return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
233
246
|
Component,
|
|
234
247
|
__spreadValues2({
|
|
248
|
+
type,
|
|
235
249
|
className: cn6(
|
|
236
250
|
"r-reset",
|
|
237
251
|
"r-reset-button",
|
|
@@ -243,11 +257,6 @@ var require_dist = __commonJS({
|
|
|
243
257
|
}, rest)
|
|
244
258
|
);
|
|
245
259
|
};
|
|
246
|
-
Button4.defaultProps = {
|
|
247
|
-
type: "button",
|
|
248
|
-
size: "md",
|
|
249
|
-
variant: "primary"
|
|
250
|
-
};
|
|
251
260
|
Button4.variants = ["primary", "secondary", "success", "danger"];
|
|
252
261
|
Button4.sizes = {
|
|
253
262
|
sm: "sm",
|
|
@@ -461,6 +470,7 @@ var require_dist = __commonJS({
|
|
|
461
470
|
return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
462
471
|
"button",
|
|
463
472
|
__spreadValues2({
|
|
473
|
+
type: "button",
|
|
464
474
|
className: cn6("r-reset-button r-modal-close-btn", className)
|
|
465
475
|
}, props)
|
|
466
476
|
);
|
|
@@ -473,37 +483,47 @@ var require_dist = __commonJS({
|
|
|
473
483
|
var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
|
|
474
484
|
return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", __spreadValues2({ className: cn6("r-reset", "r-modal-content", className) }, props));
|
|
475
485
|
};
|
|
486
|
+
function checkForChanges(hasChanges, onClose) {
|
|
487
|
+
if (!hasChanges) {
|
|
488
|
+
onClose();
|
|
489
|
+
return;
|
|
490
|
+
}
|
|
491
|
+
if (!confirm(
|
|
492
|
+
"You\u2019ve made changes to the widget. Are you sure you want to cancel?"
|
|
493
|
+
))
|
|
494
|
+
return;
|
|
495
|
+
onClose();
|
|
496
|
+
}
|
|
476
497
|
var Modal2 = (_a) => {
|
|
477
498
|
var _b = _a, {
|
|
478
499
|
title,
|
|
479
500
|
children,
|
|
480
501
|
customWrapper,
|
|
481
502
|
FooterContent,
|
|
482
|
-
onClose
|
|
503
|
+
onClose,
|
|
504
|
+
areChanges
|
|
483
505
|
} = _b, rest = __objRest(_b, [
|
|
484
506
|
"title",
|
|
485
507
|
"children",
|
|
486
508
|
"customWrapper",
|
|
487
509
|
"FooterContent",
|
|
488
|
-
"onClose"
|
|
510
|
+
"onClose",
|
|
511
|
+
"areChanges"
|
|
489
512
|
]);
|
|
490
|
-
const handleKeyUp = ({ key }) => {
|
|
491
|
-
if (key === "Escape")
|
|
492
|
-
onClose();
|
|
493
|
-
};
|
|
494
|
-
import_react17.default.useEffect(() => {
|
|
495
|
-
document.addEventListener("keyup", handleKeyUp);
|
|
496
|
-
return () => {
|
|
497
|
-
document.removeEventListener("keyup", handleKeyUp);
|
|
498
|
-
};
|
|
499
|
-
});
|
|
500
513
|
const ModalWrapper = customWrapper ? customWrapper : Wrapper;
|
|
501
514
|
return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_react17.default.Fragment, { children: [
|
|
502
|
-
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(Overlay, {
|
|
515
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(Overlay, {}),
|
|
503
516
|
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(ModalWrapper, __spreadProps2(__spreadValues2({}, rest), { children: /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(Inner, { children: [
|
|
504
517
|
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(TitleBar, { children: [
|
|
505
518
|
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(Title, { children: title }),
|
|
506
|
-
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
519
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
520
|
+
CloseButton,
|
|
521
|
+
{
|
|
522
|
+
type: "button",
|
|
523
|
+
onClick: () => checkForChanges(areChanges, onClose),
|
|
524
|
+
children: "\xD7"
|
|
525
|
+
}
|
|
526
|
+
)
|
|
507
527
|
] }),
|
|
508
528
|
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(Content, { children }),
|
|
509
529
|
FooterContent && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(FooterBar, { children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(FooterContent, {}) })
|
|
@@ -738,7 +758,7 @@ var require_dist = __commonJS({
|
|
|
738
758
|
var import_react24 = __toESM2(require("react"));
|
|
739
759
|
var import_jsx_runtime24 = require("react/jsx-runtime");
|
|
740
760
|
var ImageAvatar = (_a) => {
|
|
741
|
-
var _b = _a, { size, className } = _b, props = __objRest(_b, ["size", "className"]);
|
|
761
|
+
var _b = _a, { size = "24px", className } = _b, props = __objRest(_b, ["size", "className"]);
|
|
742
762
|
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
743
763
|
"img",
|
|
744
764
|
__spreadValues2({
|
|
@@ -751,9 +771,6 @@ var require_dist = __commonJS({
|
|
|
751
771
|
}, props)
|
|
752
772
|
);
|
|
753
773
|
};
|
|
754
|
-
ImageAvatar.defaultProps = {
|
|
755
|
-
size: "24px"
|
|
756
|
-
};
|
|
757
774
|
var ImageAvatar_default = ImageAvatar;
|
|
758
775
|
var import_react25 = __toESM2(require("react"));
|
|
759
776
|
var import_jsx_runtime25 = require("react/jsx-runtime");
|
|
@@ -794,14 +811,53 @@ var require_dist = __commonJS({
|
|
|
794
811
|
);
|
|
795
812
|
};
|
|
796
813
|
var DefaultAvatar = (_a) => {
|
|
797
|
-
var _b = _a, { initials } = _b, props = __objRest(_b, ["initials"]);
|
|
798
|
-
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(DefaultAvatarStyles, __spreadProps2(__spreadValues2({ initials }, props), { children: initials }));
|
|
799
|
-
};
|
|
800
|
-
DefaultAvatar.defaultProps = {
|
|
801
|
-
size: "24px",
|
|
802
|
-
initials: "AA"
|
|
814
|
+
var _b = _a, { initials = "AA", size = "24px" } = _b, props = __objRest(_b, ["initials", "size"]);
|
|
815
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(DefaultAvatarStyles, __spreadProps2(__spreadValues2({ initials, size }, props), { children: initials }));
|
|
803
816
|
};
|
|
804
817
|
var DefaultAvatar_default = DefaultAvatar;
|
|
818
|
+
var import_react26 = __toESM2(require("react"));
|
|
819
|
+
var import_jsx_runtime26 = require("react/jsx-runtime");
|
|
820
|
+
var IconsWrapper = () => /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "r-reset r-categories-icons-wrapper", children: [
|
|
821
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
822
|
+
"img",
|
|
823
|
+
{
|
|
824
|
+
style: {
|
|
825
|
+
color: "#fff",
|
|
826
|
+
width: "24px",
|
|
827
|
+
height: "24px",
|
|
828
|
+
filter: "invert(1)"
|
|
829
|
+
},
|
|
830
|
+
alt: "directions",
|
|
831
|
+
src: "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyNCIgaGVpZ2h0PSIyNCIgdmlld0JveD0iMCAwIDI0IDI0IiBmaWxsPSJub25lIiBzdHJva2U9ImN1cnJlbnRDb2xvciIgc3Ryb2tlLXdpZHRoPSIyIiBzdHJva2UtbGluZWNhcD0icm91bmQiIHN0cm9rZS1saW5lam9pbj0icm91bmQiIGNsYXNzPSJmZWF0aGVyIGZlYXRoZXItZ3JpZCI+PHJlY3QgeD0iMyIgeT0iMyIgd2lkdGg9IjciIGhlaWdodD0iNyI+PC9yZWN0PjxyZWN0IHg9IjE0IiB5PSIzIiB3aWR0aD0iNyIgaGVpZ2h0PSI3Ij48L3JlY3Q+PHJlY3QgeD0iMTQiIHk9IjE0IiB3aWR0aD0iNyIgaGVpZ2h0PSI3Ij48L3JlY3Q+PHJlY3QgeD0iMyIgeT0iMTQiIHdpZHRoPSI3IiBoZWlnaHQ9IjciPjwvcmVjdD48L3N2Zz4="
|
|
832
|
+
}
|
|
833
|
+
),
|
|
834
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
835
|
+
"img",
|
|
836
|
+
{
|
|
837
|
+
className: "r-reset r-category-chevron",
|
|
838
|
+
alt: "directions",
|
|
839
|
+
src: "data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjIiIGhlaWdodD0iMTMiIHZpZXdCb3g9IjAgMCAyMiAxMyIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHBhdGggZD0iTTIxIDExLjVMMTEgMS41TDEgMTEuNSIgc3Ryb2tlPSIjMEMwQTA5IiBzdHJva2Utd2lkdGg9IjIiLz4KPC9zdmc+Cg=="
|
|
840
|
+
}
|
|
841
|
+
)
|
|
842
|
+
] });
|
|
843
|
+
var Title2 = () => /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: "r-categories-title", children: "Categories" });
|
|
844
|
+
var CategoriesInner = (_a) => {
|
|
845
|
+
var props = __objRest(_a, []);
|
|
846
|
+
return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", __spreadProps2(__spreadValues2({}, props), { className: "r-reset r-categories-inner" }));
|
|
847
|
+
};
|
|
848
|
+
var CategoriesHiddenMenu = ({ paths }) => /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: "r-reset r-categories-hidden-menu", children: paths.map(({ title, link }, idx) => /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("a", { href: link, className: "r-reset r-category-link", children: title }, `${idx}-${link}`)) });
|
|
849
|
+
var CategoriesMenuWrapper = (_a) => {
|
|
850
|
+
var props = __objRest(_a, []);
|
|
851
|
+
return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", __spreadValues2({ className: "r-reset r-categories-menu" }, props));
|
|
852
|
+
};
|
|
853
|
+
var CategoriesMenu = ({ paths }) => /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(CategoriesMenuWrapper, { children: [
|
|
854
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(CategoriesInner, { children: [
|
|
855
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(IconsWrapper, {}),
|
|
856
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(Title2, {})
|
|
857
|
+
] }),
|
|
858
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(CategoriesHiddenMenu, { paths })
|
|
859
|
+
] });
|
|
860
|
+
var CategoriesMenu_default = CategoriesMenu;
|
|
805
861
|
}
|
|
806
862
|
});
|
|
807
863
|
|
|
@@ -1817,7 +1873,7 @@ var DELETE_DOCUMENT_MUTATION = `
|
|
|
1817
1873
|
}
|
|
1818
1874
|
}
|
|
1819
1875
|
`;
|
|
1820
|
-
function uploadFile(file,
|
|
1876
|
+
function uploadFile(file, document, progressCallback) {
|
|
1821
1877
|
return __async(this, null, function* () {
|
|
1822
1878
|
const xhr = new XMLHttpRequest();
|
|
1823
1879
|
return new Promise((resolve) => {
|
|
@@ -1849,7 +1905,7 @@ function uploadFile(file, document2, progressCallback) {
|
|
|
1849
1905
|
resolve(xhr.readyState === 4 && xhr.status === 200);
|
|
1850
1906
|
});
|
|
1851
1907
|
xhr.withCredentials = false;
|
|
1852
|
-
xhr.open("PUT",
|
|
1908
|
+
xhr.open("PUT", document.uploadUrl, true);
|
|
1853
1909
|
xhr.setRequestHeader("content-type", file.type);
|
|
1854
1910
|
const reader = new FileReader();
|
|
1855
1911
|
reader.onload = (event) => {
|
|
@@ -1919,7 +1975,7 @@ var FileManager = class {
|
|
|
1919
1975
|
createAndUpload(fileInfo, progressCallback) {
|
|
1920
1976
|
return __async(this, null, function* () {
|
|
1921
1977
|
const { file, id } = fileInfo;
|
|
1922
|
-
const { document
|
|
1978
|
+
const { document, errors } = yield this.create({
|
|
1923
1979
|
filename: file.name,
|
|
1924
1980
|
mime_type: file.type,
|
|
1925
1981
|
size: file.size
|
|
@@ -1935,11 +1991,11 @@ var FileManager = class {
|
|
|
1935
1991
|
}
|
|
1936
1992
|
const result = yield uploadFile(
|
|
1937
1993
|
file,
|
|
1938
|
-
|
|
1994
|
+
document,
|
|
1939
1995
|
(state) => progressCallback(id, state)
|
|
1940
1996
|
);
|
|
1941
1997
|
if (result) {
|
|
1942
|
-
const notify = yield this.notifyUploaded(
|
|
1998
|
+
const notify = yield this.notifyUploaded(document.id);
|
|
1943
1999
|
if (notify.errors) {
|
|
1944
2000
|
progressCallback(id, {
|
|
1945
2001
|
type: "errored",
|
package/package.json
CHANGED
package/.turbo/turbo-format.log
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
> @raketa-builder/file-input@0.4.0 format
|
|
3
|
-
> prettier --write .
|
|
4
|
-
|
|
5
|
-
biome.json 573ms (unchanged)
|
|
6
|
-
dist/index.js 5084ms (unchanged)
|
|
7
|
-
package.json 43ms (unchanged)
|
|
8
|
-
src/FileManager.js 258ms (unchanged)
|
|
9
|
-
src/FilePicker/Dialog.js 147ms (unchanged)
|
|
10
|
-
src/FilePicker/FileCategory.js 85ms (unchanged)
|
|
11
|
-
src/FilePicker/FileInput.js 20ms (unchanged)
|
|
12
|
-
src/FilePicker/FileList.js 60ms (unchanged)
|
|
13
|
-
src/FilePicker/FileSearch.js 141ms (unchanged)
|
|
14
|
-
src/FilePicker/index.js 154ms (unchanged)
|
|
15
|
-
src/FilePicker/stateManagement.js 126ms (unchanged)
|
|
16
|
-
src/FilePicker/UploadFilesButton.js 30ms (unchanged)
|
|
17
|
-
src/FilePicker/UploadProgress.js 69ms (unchanged)
|
|
18
|
-
src/FilePicker/utils.js 20ms (unchanged)
|
|
19
|
-
src/index.js 2ms (unchanged)
|
|
20
|
-
src/styles.css 300ms (unchanged)
|
|
21
|
-
tsconfig.json 3ms (unchanged)
|
package/.turbo/turbo-lint.log
DELETED