@raketa-builder/next-form 0.5.0 → 0.6.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/next-form@0.5.0 build
2
+ > @raketa-builder/next-form@0.6.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 43.23 KB
11
- CJS ⚡️ Build success in 85ms
10
+ CJS dist/index.js 46.33 KB
11
+ CJS ⚡️ Build success in 72ms
package/dist/index.js CHANGED
@@ -114,6 +114,7 @@ var require_dist = __commonJS({
114
114
  var src_exports2 = {};
115
115
  __export2(src_exports2, {
116
116
  Button: () => Button_default,
117
+ CategoriesMenu: () => CategoriesMenu_default,
117
118
  Col: () => Col,
118
119
  Container: () => Container_default,
119
120
  DataGrid: () => DataGrid_default,
@@ -219,11 +220,24 @@ var require_dist = __commonJS({
219
220
  var import_react32 = __toESM2(require("react"));
220
221
  var import_jsx_runtime32 = require("react/jsx-runtime");
221
222
  var Button2 = (_a) => {
222
- var _b = _a, { as = "button", size, variant, className } = _b, rest = __objRest2(_b, ["as", "size", "variant", "className"]);
223
+ var _b = _a, {
224
+ as = "button",
225
+ size = "md",
226
+ variant = "primary",
227
+ className,
228
+ type = "button"
229
+ } = _b, rest = __objRest2(_b, [
230
+ "as",
231
+ "size",
232
+ "variant",
233
+ "className",
234
+ "type"
235
+ ]);
223
236
  const Component = as;
224
237
  return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
225
238
  Component,
226
239
  __spreadValues2({
240
+ type,
227
241
  className: cn4(
228
242
  "r-reset",
229
243
  "r-reset-button",
@@ -235,11 +249,6 @@ var require_dist = __commonJS({
235
249
  }, rest)
236
250
  );
237
251
  };
238
- Button2.defaultProps = {
239
- type: "button",
240
- size: "md",
241
- variant: "primary"
242
- };
243
252
  Button2.variants = ["primary", "secondary", "success", "danger"];
244
253
  Button2.sizes = {
245
254
  sm: "sm",
@@ -453,6 +462,7 @@ var require_dist = __commonJS({
453
462
  return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
454
463
  "button",
455
464
  __spreadValues2({
465
+ type: "button",
456
466
  className: cn4("r-reset-button r-modal-close-btn", className)
457
467
  }, props)
458
468
  );
@@ -465,37 +475,47 @@ var require_dist = __commonJS({
465
475
  var _b = _a, { className } = _b, props = __objRest2(_b, ["className"]);
466
476
  return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", __spreadValues2({ className: cn4("r-reset", "r-modal-content", className) }, props));
467
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
+ }
468
489
  var Modal = (_a) => {
469
490
  var _b = _a, {
470
491
  title,
471
492
  children,
472
493
  customWrapper,
473
494
  FooterContent,
474
- onClose
495
+ onClose,
496
+ areChanges
475
497
  } = _b, rest = __objRest2(_b, [
476
498
  "title",
477
499
  "children",
478
500
  "customWrapper",
479
501
  "FooterContent",
480
- "onClose"
502
+ "onClose",
503
+ "areChanges"
481
504
  ]);
482
- const handleKeyUp = ({ key }) => {
483
- if (key === "Escape")
484
- onClose();
485
- };
486
- import_react17.default.useEffect(() => {
487
- document.addEventListener("keyup", handleKeyUp);
488
- return () => {
489
- document.removeEventListener("keyup", handleKeyUp);
490
- };
491
- });
492
505
  const ModalWrapper = customWrapper ? customWrapper : Wrapper3;
493
506
  return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_react17.default.Fragment, { children: [
494
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(Overlay, { onClick: onClose }),
507
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(Overlay, {}),
495
508
  /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(ModalWrapper, __spreadProps2(__spreadValues2({}, rest), { children: /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(Inner, { children: [
496
509
  /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(TitleBar, { children: [
497
510
  /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(Title, { children: title }),
498
- /* @__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
+ )
499
519
  ] }),
500
520
  /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(Content, { children }),
501
521
  FooterContent && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(FooterBar, { children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(FooterContent, {}) })
@@ -730,7 +750,7 @@ var require_dist = __commonJS({
730
750
  var import_react24 = __toESM2(require("react"));
731
751
  var import_jsx_runtime24 = require("react/jsx-runtime");
732
752
  var ImageAvatar = (_a) => {
733
- var _b = _a, { size, className } = _b, props = __objRest2(_b, ["size", "className"]);
753
+ var _b = _a, { size = "24px", className } = _b, props = __objRest2(_b, ["size", "className"]);
734
754
  return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
735
755
  "img",
736
756
  __spreadValues2({
@@ -743,9 +763,6 @@ var require_dist = __commonJS({
743
763
  }, props)
744
764
  );
745
765
  };
746
- ImageAvatar.defaultProps = {
747
- size: "24px"
748
- };
749
766
  var ImageAvatar_default = ImageAvatar;
750
767
  var import_react25 = __toESM2(require("react"));
751
768
  var import_jsx_runtime25 = require("react/jsx-runtime");
@@ -786,14 +803,53 @@ var require_dist = __commonJS({
786
803
  );
787
804
  };
788
805
  var DefaultAvatar = (_a) => {
789
- var _b = _a, { initials } = _b, props = __objRest2(_b, ["initials"]);
790
- return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(DefaultAvatarStyles, __spreadProps2(__spreadValues2({ initials }, props), { children: initials }));
791
- };
792
- DefaultAvatar.defaultProps = {
793
- size: "24px",
794
- initials: "AA"
806
+ var _b = _a, { initials = "AA", size = "24px" } = _b, props = __objRest2(_b, ["initials", "size"]);
807
+ return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(DefaultAvatarStyles, __spreadProps2(__spreadValues2({ initials, size }, props), { children: initials }));
795
808
  };
796
809
  var DefaultAvatar_default = DefaultAvatar;
810
+ var import_react26 = __toESM2(require("react"));
811
+ var import_jsx_runtime26 = require("react/jsx-runtime");
812
+ var IconsWrapper = () => /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "r-reset r-categories-icons-wrapper", children: [
813
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
814
+ "img",
815
+ {
816
+ style: {
817
+ color: "#fff",
818
+ width: "24px",
819
+ height: "24px",
820
+ filter: "invert(1)"
821
+ },
822
+ alt: "directions",
823
+ src: "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyNCIgaGVpZ2h0PSIyNCIgdmlld0JveD0iMCAwIDI0IDI0IiBmaWxsPSJub25lIiBzdHJva2U9ImN1cnJlbnRDb2xvciIgc3Ryb2tlLXdpZHRoPSIyIiBzdHJva2UtbGluZWNhcD0icm91bmQiIHN0cm9rZS1saW5lam9pbj0icm91bmQiIGNsYXNzPSJmZWF0aGVyIGZlYXRoZXItZ3JpZCI+PHJlY3QgeD0iMyIgeT0iMyIgd2lkdGg9IjciIGhlaWdodD0iNyI+PC9yZWN0PjxyZWN0IHg9IjE0IiB5PSIzIiB3aWR0aD0iNyIgaGVpZ2h0PSI3Ij48L3JlY3Q+PHJlY3QgeD0iMTQiIHk9IjE0IiB3aWR0aD0iNyIgaGVpZ2h0PSI3Ij48L3JlY3Q+PHJlY3QgeD0iMyIgeT0iMTQiIHdpZHRoPSI3IiBoZWlnaHQ9IjciPjwvcmVjdD48L3N2Zz4="
824
+ }
825
+ ),
826
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
827
+ "img",
828
+ {
829
+ className: "r-reset r-category-chevron",
830
+ alt: "directions",
831
+ src: "data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjIiIGhlaWdodD0iMTMiIHZpZXdCb3g9IjAgMCAyMiAxMyIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHBhdGggZD0iTTIxIDExLjVMMTEgMS41TDEgMTEuNSIgc3Ryb2tlPSIjMEMwQTA5IiBzdHJva2Utd2lkdGg9IjIiLz4KPC9zdmc+Cg=="
832
+ }
833
+ )
834
+ ] });
835
+ var Title2 = () => /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: "r-categories-title", children: "Categories" });
836
+ var CategoriesInner = (_a) => {
837
+ var props = __objRest2(_a, []);
838
+ return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", __spreadProps2(__spreadValues2({}, props), { className: "r-reset r-categories-inner" }));
839
+ };
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}`)) });
841
+ var CategoriesMenuWrapper = (_a) => {
842
+ var props = __objRest2(_a, []);
843
+ return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", __spreadValues2({ className: "r-reset r-categories-menu" }, props));
844
+ };
845
+ var CategoriesMenu = ({ paths }) => /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(CategoriesMenuWrapper, { children: [
846
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(CategoriesInner, { children: [
847
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(IconsWrapper, {}),
848
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(Title2, {})
849
+ ] }),
850
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(CategoriesHiddenMenu, { paths })
851
+ ] });
852
+ var CategoriesMenu_default = CategoriesMenu;
797
853
  }
798
854
  });
799
855
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@raketa-builder/next-form",
3
- "version": "0.5.0",
3
+ "version": "0.6.0",
4
4
  "main": "./dist/index.js",
5
5
  "types": "./dist/index.d.ts",
6
6
  "license": "MIT",
@@ -1,18 +0,0 @@
1
-
2
- > @raketa-builder/next-form@0.4.0 format
3
- > prettier --write .
4
-
5
- biome.json 263ms (unchanged)
6
- CHANGELOG.md 251ms (unchanged)
7
- dist/index.js 3210ms
8
- package.json 35ms (unchanged)
9
- src/Context.js 23ms (unchanged)
10
- src/Fields.js 494ms (unchanged)
11
- src/Fieldset.js 92ms (unchanged)
12
- src/Form.js 112ms (unchanged)
13
- src/FormNavigation.js 73ms (unchanged)
14
- src/index.js 16ms (unchanged)
15
- src/styles.css 443ms (unchanged)
16
- src/Submit.js 6ms (unchanged)
17
- src/utils/slugify.js 4ms (unchanged)
18
- tsconfig.json 7ms
@@ -1,4 +0,0 @@
1
-
2
- > @raketa-builder/next-form@0.4.0 lint
3
- > biome lint --max-diagnostics=5000 .
4
-