@raketa-builder/image-input 0.11.0 → 0.12.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.
@@ -1,5 +1,5 @@
1
1
 
2
- > @raketa-builder/image-input@0.11.0 build
2
+ > @raketa-builder/image-input@0.12.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 321.20 KB
11
- CJS ⚡️ Build success in 306ms
10
+ CJS dist/index.js 321.38 KB
11
+ CJS ⚡️ Build success in 65ms
package/dist/index.js CHANGED
@@ -237,6 +237,7 @@ var require_dist = __commonJS({
237
237
  return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
238
238
  Component,
239
239
  __spreadValues2({
240
+ type,
240
241
  className: cn7(
241
242
  "r-reset",
242
243
  "r-reset-button",
@@ -461,6 +462,7 @@ var require_dist = __commonJS({
461
462
  return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
462
463
  "button",
463
464
  __spreadValues2({
465
+ type: "button",
464
466
  className: cn7("r-reset-button r-modal-close-btn", className)
465
467
  }, props)
466
468
  );
@@ -473,37 +475,47 @@ var require_dist = __commonJS({
473
475
  var _b = _a, { className } = _b, props = __objRest2(_b, ["className"]);
474
476
  return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", __spreadValues2({ className: cn7("r-reset", "r-modal-content", className) }, props));
475
477
  };
478
+ function checkForChanges(hasChanges, onClose) {
479
+ if (!hasChanges) {
480
+ onClose();
481
+ return;
482
+ }
483
+ if (!confirm(
484
+ "You\u2019ve made changes to the widget. Are you sure you want to cancel?"
485
+ ))
486
+ return;
487
+ onClose();
488
+ }
476
489
  var Modal2 = (_a) => {
477
490
  var _b = _a, {
478
491
  title,
479
492
  children,
480
493
  customWrapper,
481
494
  FooterContent,
482
- onClose
495
+ onClose,
496
+ areChanges
483
497
  } = _b, rest = __objRest2(_b, [
484
498
  "title",
485
499
  "children",
486
500
  "customWrapper",
487
501
  "FooterContent",
488
- "onClose"
502
+ "onClose",
503
+ "areChanges"
489
504
  ]);
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
505
  const ModalWrapper = customWrapper ? customWrapper : Wrapper;
501
506
  return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_react17.default.Fragment, { children: [
502
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(Overlay, { onClick: onClose }),
507
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(Overlay, {}),
503
508
  /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(ModalWrapper, __spreadProps2(__spreadValues2({}, rest), { children: /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(Inner, { children: [
504
509
  /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(TitleBar, { children: [
505
510
  /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(Title, { children: title }),
506
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(CloseButton, { type: "button", onClick: onClose, children: "\xD7" })
511
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
512
+ CloseButton,
513
+ {
514
+ type: "button",
515
+ onClick: () => checkForChanges(areChanges, onClose),
516
+ children: "\xD7"
517
+ }
518
+ )
507
519
  ] }),
508
520
  /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(Content, { children }),
509
521
  FooterContent && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(FooterBar, { children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(FooterContent, {}) })
@@ -825,7 +837,7 @@ var require_dist = __commonJS({
825
837
  var props = __objRest2(_a, []);
826
838
  return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", __spreadProps2(__spreadValues2({}, props), { className: "r-reset r-categories-inner" }));
827
839
  };
828
- var CategoriesHiddenMenu = ({ paths }) => /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: "r-reset r-categories-hidden-menu", children: paths.map(({ title, link }) => /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("a", { href: link, className: "r-reset r-category-link", children: title })) });
840
+ 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}`)) });
829
841
  var CategoriesMenuWrapper = (_a) => {
830
842
  var props = __objRest2(_a, []);
831
843
  return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", __spreadValues2({ className: "r-reset r-categories-menu" }, props));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@raketa-builder/image-input",
3
- "version": "0.11.0",
3
+ "version": "0.12.0",
4
4
  "main": "./dist/index.js",
5
5
  "types": "./dist/index.d.ts",
6
6
  "license": "MIT",
@@ -1,22 +0,0 @@
1
-
2
- > @raketa-builder/image-input@0.6.0 format
3
- > prettier --write .
4
-
5
- biome.json 432ms (unchanged)
6
- CHANGELOG.md 357ms (unchanged)
7
- dist/index.js 4221ms
8
- package.json 43ms (unchanged)
9
- src/dialogs/Dialog.js 111ms (unchanged)
10
- src/forms/TextInput.js 47ms (unchanged)
11
- src/index.js 4ms (unchanged)
12
- src/lib/Dropbox.js 96ms (unchanged)
13
- src/lib/ProgressBar.js 54ms (unchanged)
14
- src/lists/index.js 90ms
15
- src/MediaManager.js 152ms
16
- src/MediaManagerContext.js 3ms (unchanged)
17
- src/pickers/ImagePicker/BrowseTab.js 51ms (unchanged)
18
- src/pickers/ImagePicker/ImageInput.js 71ms (unchanged)
19
- src/pickers/ImagePicker/ImagePicker.js 175ms (unchanged)
20
- src/pickers/ImagePicker/UploadTab.js 86ms (unchanged)
21
- src/styles.css 590ms
22
- tsconfig.json 4ms
File without changes