@mattisvensson/strapi-plugin-webatlas 0.6.1 → 0.6.2

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.
Files changed (32) hide show
  1. package/README.md +9 -2
  2. package/dist/_chunks/{index-BKds0CRq.mjs → index-13yB9fna.mjs} +1 -1
  3. package/dist/_chunks/{index-mUDowsKQ.mjs → index-AIXu4HZz.mjs} +2 -2
  4. package/dist/_chunks/{index-mUDowsKQ.mjs.map → index-AIXu4HZz.mjs.map} +1 -1
  5. package/dist/_chunks/{index-Bfu5AVqu.mjs → index-B9OfSpne.mjs} +70 -49
  6. package/dist/_chunks/{index-Cp_UPsle.js → index-BDoljrOj.js} +2 -2
  7. package/dist/_chunks/{index-Cp_UPsle.js.map → index-BDoljrOj.js.map} +1 -1
  8. package/dist/_chunks/{index-BEwslndX.js → index-BOF-1QDH.js} +2 -2
  9. package/dist/_chunks/{index-BEwslndX.js.map → index-BOF-1QDH.js.map} +1 -1
  10. package/dist/_chunks/{index-DesLqdi-.mjs → index-BPIdov2N.mjs} +4 -4
  11. package/dist/_chunks/{index-C-4C6ezO.mjs → index-BluRjThy.mjs} +1 -1
  12. package/dist/_chunks/{index-DCCE7rxt.js → index-Bw2Yq-Hx.js} +70 -50
  13. package/dist/_chunks/{index-C2V-ZFHK.mjs → index-C4-VBSgi.mjs} +71 -50
  14. package/dist/_chunks/index-C4-VBSgi.mjs.map +1 -0
  15. package/dist/_chunks/{index-DYKhGn15.mjs → index-CC1UR_w8.mjs} +2 -2
  16. package/dist/_chunks/{index-DYKhGn15.mjs.map → index-CC1UR_w8.mjs.map} +1 -1
  17. package/dist/_chunks/{index-B5ji2Qhs.js → index-Ch8tSWp4.js} +4 -4
  18. package/dist/_chunks/{index-D2CkoDhN.js → index-CjA6bLGU.js} +1 -1
  19. package/dist/_chunks/{index-BJHlAfrS.js → index-D1zlwukG.js} +71 -49
  20. package/dist/_chunks/index-D1zlwukG.js.map +1 -0
  21. package/dist/_chunks/{index-DBVU2KOj.js → index-DeNZkmpv.js} +1 -1
  22. package/dist/_chunks/{index-BvqWnL1-.js → index-Z3yKckP0.js} +5 -5
  23. package/dist/_chunks/{index-BvqWnL1-.js.map → index-Z3yKckP0.js.map} +1 -1
  24. package/dist/_chunks/{index-JVvkmiKE.mjs → index-iF1y6Mhe.mjs} +5 -5
  25. package/dist/_chunks/{index-JVvkmiKE.mjs.map → index-iF1y6Mhe.mjs.map} +1 -1
  26. package/dist/admin/index.js +1 -1
  27. package/dist/admin/index.mjs +1 -1
  28. package/dist/server/index.js +1 -1
  29. package/dist/server/index.mjs +1 -1
  30. package/package.json +1 -1
  31. package/dist/_chunks/index-C2V-ZFHK.mjs.map +0 -1
  32. package/dist/_chunks/index-DCCE7rxt.js.map +0 -1
@@ -7,9 +7,10 @@ const designSystem = require("@strapi/design-system");
7
7
  const React = require("react");
8
8
  const ReactDOM = require("react-dom");
9
9
  const reactIntl = require("react-intl");
10
- const index = require("./index-BvqWnL1-.js");
10
+ const index = require("./index-Ch8tSWp4.js");
11
11
  const admin = require("@strapi/strapi/admin");
12
12
  const FullLoader = require("./FullLoader-Cmsf8xS6.js");
13
+ require("@strapi/icons/symbols");
13
14
  const EmptyBox = require("./EmptyBox-T8t29l25.js");
14
15
  const core = require("@dnd-kit/core");
15
16
  const sortable = require("@dnd-kit/sortable");
@@ -4631,6 +4632,7 @@ function ItemCreateComponent({
4631
4632
  onCreate
4632
4633
  }) {
4633
4634
  const [loading, setLoading] = React.useState(false);
4635
+ const [loadingRoute, setLoadingRoute] = React.useState(true);
4634
4636
  const { formatMessage } = reactIntl.useIntl();
4635
4637
  React.useEffect(() => {
4636
4638
  if (!entities) return;
@@ -4646,9 +4648,10 @@ function ItemCreateComponent({
4646
4648
  React.useEffect(() => {
4647
4649
  async function fetchRoute() {
4648
4650
  if (selectedContentType?.contentType && selectedEntity?.id) {
4651
+ setLoadingRoute(true);
4649
4652
  try {
4650
4653
  const route = await getRelatedRoute(selectedEntity.documentId);
4651
- if (!route) return;
4654
+ if (!route) throw new Error("No route found for the selected entity");
4652
4655
  dispatchPath({ type: "NO_URL_CHECK", payload: route.fullPath });
4653
4656
  dispatchPath({ type: "SET_UIDPATH", payload: route.uidPath });
4654
4657
  dispatchPath({ type: "SET_INITIALPATH", payload: route.fullPath });
@@ -4666,6 +4669,8 @@ function ItemCreateComponent({
4666
4669
  setEntityRoute(route);
4667
4670
  } catch (err) {
4668
4671
  console.log(err);
4672
+ } finally {
4673
+ setLoadingRoute(false);
4669
4674
  }
4670
4675
  }
4671
4676
  }
@@ -4692,6 +4697,68 @@ function ItemCreateComponent({
4692
4697
  setLoading(false);
4693
4698
  }
4694
4699
  };
4700
+ function ItemDetails() {
4701
+ if (loadingRoute) return /* @__PURE__ */ jsxRuntime.jsx(FullLoader.FullLoader, { height: 50 });
4702
+ return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Grid.Root, { gap: 4, children: [
4703
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Grid.Item, { col: 6, s: 12, alignItems: "baseline", children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { width: "100%", children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Field.Root, { children: [
4704
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Label, { children: formatMessage({
4705
+ id: index.getTranslation("modal.item.titleField.label"),
4706
+ defaultMessage: "Title"
4707
+ }) }),
4708
+ /* @__PURE__ */ jsxRuntime.jsx(
4709
+ designSystem.Field.Input,
4710
+ {
4711
+ placeholder: formatMessage({
4712
+ id: index.getTranslation("modal.item.titleField.placeholder"),
4713
+ defaultMessage: "e.g. About us"
4714
+ }),
4715
+ name: "title",
4716
+ value: navItemState.title || "",
4717
+ onChange: (e) => dispatchItemState({ type: "SET_TITLE", payload: e.target.value }),
4718
+ required: true
4719
+ }
4720
+ )
4721
+ ] }) }) }),
4722
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Grid.Item, { col: 6, s: 12, children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Box, { width: "100%", children: [
4723
+ /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Field.Root, { children: [
4724
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Label, { children: formatMessage({
4725
+ id: index.getTranslation("modal.item.routeField.label"),
4726
+ defaultMessage: "Route"
4727
+ }) }),
4728
+ /* @__PURE__ */ jsxRuntime.jsx(
4729
+ designSystem.Field.Input,
4730
+ {
4731
+ required: true,
4732
+ placeholder: formatMessage({
4733
+ id: index.getTranslation("modal.item.routeField.placeholder"),
4734
+ defaultMessage: "e.g. about/"
4735
+ }),
4736
+ name: "slug",
4737
+ value: path?.value || "",
4738
+ onChange: (e) => dispatchPath({ type: "NO_TRANSFORM_AND_CHECK", payload: e.target.value }),
4739
+ onBlur: (e) => {
4740
+ if (e.target.value === path.prevValue) return;
4741
+ dispatchPath({ type: "DEFAULT", payload: e.target.value });
4742
+ }
4743
+ }
4744
+ )
4745
+ ] }),
4746
+ /* @__PURE__ */ jsxRuntime.jsx(index.URLInfo, { validationState, replacement })
4747
+ ] }) })
4748
+ ] }) });
4749
+ }
4750
+ if (availableEntities && availableEntities.length === 0) {
4751
+ return /* @__PURE__ */ jsxRuntime.jsx(
4752
+ NavModal,
4753
+ {
4754
+ confirmText: formatMessage({ id: index.getTranslation("add"), defaultMessage: "Add" }),
4755
+ closeText: formatMessage({ id: index.getTranslation("cancel"), defaultMessage: "Cancel" }),
4756
+ titleText: formatMessage({ id: index.getTranslation("modal.internalItem.titleText.create"), defaultMessage: "Add new navigation item" }),
4757
+ footer: /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, {}),
4758
+ children: /* @__PURE__ */ jsxRuntime.jsx(FullLoader.FullLoader, { height: 50 })
4759
+ }
4760
+ );
4761
+ }
4695
4762
  return /* @__PURE__ */ jsxRuntime.jsxs(
4696
4763
  NavModal,
4697
4764
  {
@@ -4762,53 +4829,7 @@ function ItemCreateComponent({
4762
4829
  ] }),
4763
4830
  selectedEntity && selectedContentType && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
4764
4831
  /* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { paddingBottom: 6, paddingTop: 6, children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Divider, {}) }),
4765
- /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Grid.Root, { gap: 4, paddingBottom: 6, children: [
4766
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Grid.Item, { col: 6, s: 12, alignItems: "baseline", children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { width: "100%", children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Field.Root, { children: [
4767
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Label, { children: formatMessage({
4768
- id: index.getTranslation("modal.item.titleField.label"),
4769
- defaultMessage: "Title"
4770
- }) }),
4771
- /* @__PURE__ */ jsxRuntime.jsx(
4772
- designSystem.Field.Input,
4773
- {
4774
- placeholder: formatMessage({
4775
- id: index.getTranslation("modal.item.titleField.placeholder"),
4776
- defaultMessage: "e.g. About us"
4777
- }),
4778
- name: "title",
4779
- value: navItemState.title || "",
4780
- onChange: (e) => dispatchItemState({ type: "SET_TITLE", payload: e.target.value }),
4781
- required: true
4782
- }
4783
- )
4784
- ] }) }) }),
4785
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Grid.Item, { col: 6, s: 12, children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Box, { width: "100%", children: [
4786
- /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Field.Root, { children: [
4787
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Label, { children: formatMessage({
4788
- id: index.getTranslation("modal.item.routeField.label"),
4789
- defaultMessage: "Route"
4790
- }) }),
4791
- /* @__PURE__ */ jsxRuntime.jsx(
4792
- designSystem.Field.Input,
4793
- {
4794
- required: true,
4795
- placeholder: formatMessage({
4796
- id: index.getTranslation("modal.item.routeField.placeholder"),
4797
- defaultMessage: "e.g. about/"
4798
- }),
4799
- name: "slug",
4800
- value: path?.value || "",
4801
- onChange: (e) => dispatchPath({ type: "NO_TRANSFORM_AND_CHECK", payload: e.target.value }),
4802
- onBlur: (e) => {
4803
- if (e.target.value === path.prevValue) return;
4804
- dispatchPath({ type: "DEFAULT", payload: e.target.value });
4805
- }
4806
- }
4807
- )
4808
- ] }),
4809
- /* @__PURE__ */ jsxRuntime.jsx(index.URLInfo, { validationState, replacement })
4810
- ] }) })
4811
- ] })
4832
+ /* @__PURE__ */ jsxRuntime.jsx(ItemDetails, {})
4812
4833
  ] })
4813
4834
  ]
4814
4835
  }
@@ -12201,4 +12222,3 @@ const App = () => {
12201
12222
  ] });
12202
12223
  };
12203
12224
  exports.default = App;
12204
- //# sourceMappingURL=index-DCCE7rxt.js.map
@@ -5,9 +5,10 @@ import { Dialog, Typography, Button, Modal, Flex, SingleSelect, SingleSelectOpti
5
5
  import { useState, useEffect, createContext, useRef, useContext, useReducer, useCallback, useMemo, forwardRef } from "react";
6
6
  import { createPortal } from "react-dom";
7
7
  import { useIntl } from "react-intl";
8
- import { u as useApi, g as getTranslation, d as debounce, a as duplicateCheck, t as transformToUrl, U as URLInfo } from "./index-JVvkmiKE.mjs";
8
+ import { u as useApi, g as getTranslation, d as debounce, a as duplicateCheck, t as transformToUrl, U as URLInfo } from "./index-iF1y6Mhe.mjs";
9
9
  import { useFetchClient, useNotification, Page, Layouts } from "@strapi/strapi/admin";
10
10
  import { C as Center, F as FullLoader } from "./FullLoader-CrPED_dY.mjs";
11
+ import "@strapi/icons/symbols";
11
12
  import { E as EmptyBox } from "./EmptyBox-BM4IscSk.mjs";
12
13
  import { MeasuringStrategy, DndContext, closestCenter, DragOverlay } from "@dnd-kit/core";
13
14
  import { arrayMove, useSortable, SortableContext, verticalListSortingStrategy } from "@dnd-kit/sortable";
@@ -4629,6 +4630,7 @@ function ItemCreateComponent({
4629
4630
  onCreate
4630
4631
  }) {
4631
4632
  const [loading, setLoading] = useState(false);
4633
+ const [loadingRoute, setLoadingRoute] = useState(true);
4632
4634
  const { formatMessage } = useIntl();
4633
4635
  useEffect(() => {
4634
4636
  if (!entities) return;
@@ -4644,9 +4646,10 @@ function ItemCreateComponent({
4644
4646
  useEffect(() => {
4645
4647
  async function fetchRoute() {
4646
4648
  if (selectedContentType?.contentType && selectedEntity?.id) {
4649
+ setLoadingRoute(true);
4647
4650
  try {
4648
4651
  const route = await getRelatedRoute(selectedEntity.documentId);
4649
- if (!route) return;
4652
+ if (!route) throw new Error("No route found for the selected entity");
4650
4653
  dispatchPath({ type: "NO_URL_CHECK", payload: route.fullPath });
4651
4654
  dispatchPath({ type: "SET_UIDPATH", payload: route.uidPath });
4652
4655
  dispatchPath({ type: "SET_INITIALPATH", payload: route.fullPath });
@@ -4664,6 +4667,8 @@ function ItemCreateComponent({
4664
4667
  setEntityRoute(route);
4665
4668
  } catch (err) {
4666
4669
  console.log(err);
4670
+ } finally {
4671
+ setLoadingRoute(false);
4667
4672
  }
4668
4673
  }
4669
4674
  }
@@ -4690,6 +4695,68 @@ function ItemCreateComponent({
4690
4695
  setLoading(false);
4691
4696
  }
4692
4697
  };
4698
+ function ItemDetails() {
4699
+ if (loadingRoute) return /* @__PURE__ */ jsx(FullLoader, { height: 50 });
4700
+ return /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsxs(Grid.Root, { gap: 4, children: [
4701
+ /* @__PURE__ */ jsx(Grid.Item, { col: 6, s: 12, alignItems: "baseline", children: /* @__PURE__ */ jsx(Box, { width: "100%", children: /* @__PURE__ */ jsxs(Field.Root, { children: [
4702
+ /* @__PURE__ */ jsx(Field.Label, { children: formatMessage({
4703
+ id: getTranslation("modal.item.titleField.label"),
4704
+ defaultMessage: "Title"
4705
+ }) }),
4706
+ /* @__PURE__ */ jsx(
4707
+ Field.Input,
4708
+ {
4709
+ placeholder: formatMessage({
4710
+ id: getTranslation("modal.item.titleField.placeholder"),
4711
+ defaultMessage: "e.g. About us"
4712
+ }),
4713
+ name: "title",
4714
+ value: navItemState.title || "",
4715
+ onChange: (e) => dispatchItemState({ type: "SET_TITLE", payload: e.target.value }),
4716
+ required: true
4717
+ }
4718
+ )
4719
+ ] }) }) }),
4720
+ /* @__PURE__ */ jsx(Grid.Item, { col: 6, s: 12, children: /* @__PURE__ */ jsxs(Box, { width: "100%", children: [
4721
+ /* @__PURE__ */ jsxs(Field.Root, { children: [
4722
+ /* @__PURE__ */ jsx(Field.Label, { children: formatMessage({
4723
+ id: getTranslation("modal.item.routeField.label"),
4724
+ defaultMessage: "Route"
4725
+ }) }),
4726
+ /* @__PURE__ */ jsx(
4727
+ Field.Input,
4728
+ {
4729
+ required: true,
4730
+ placeholder: formatMessage({
4731
+ id: getTranslation("modal.item.routeField.placeholder"),
4732
+ defaultMessage: "e.g. about/"
4733
+ }),
4734
+ name: "slug",
4735
+ value: path?.value || "",
4736
+ onChange: (e) => dispatchPath({ type: "NO_TRANSFORM_AND_CHECK", payload: e.target.value }),
4737
+ onBlur: (e) => {
4738
+ if (e.target.value === path.prevValue) return;
4739
+ dispatchPath({ type: "DEFAULT", payload: e.target.value });
4740
+ }
4741
+ }
4742
+ )
4743
+ ] }),
4744
+ /* @__PURE__ */ jsx(URLInfo, { validationState, replacement })
4745
+ ] }) })
4746
+ ] }) });
4747
+ }
4748
+ if (availableEntities && availableEntities.length === 0) {
4749
+ return /* @__PURE__ */ jsx(
4750
+ NavModal,
4751
+ {
4752
+ confirmText: formatMessage({ id: getTranslation("add"), defaultMessage: "Add" }),
4753
+ closeText: formatMessage({ id: getTranslation("cancel"), defaultMessage: "Cancel" }),
4754
+ titleText: formatMessage({ id: getTranslation("modal.internalItem.titleText.create"), defaultMessage: "Add new navigation item" }),
4755
+ footer: /* @__PURE__ */ jsx(Fragment, {}),
4756
+ children: /* @__PURE__ */ jsx(FullLoader, { height: 50 })
4757
+ }
4758
+ );
4759
+ }
4693
4760
  return /* @__PURE__ */ jsxs(
4694
4761
  NavModal,
4695
4762
  {
@@ -4760,53 +4827,7 @@ function ItemCreateComponent({
4760
4827
  ] }),
4761
4828
  selectedEntity && selectedContentType && /* @__PURE__ */ jsxs(Fragment, { children: [
4762
4829
  /* @__PURE__ */ jsx(Box, { paddingBottom: 6, paddingTop: 6, children: /* @__PURE__ */ jsx(Divider, {}) }),
4763
- /* @__PURE__ */ jsxs(Grid.Root, { gap: 4, paddingBottom: 6, children: [
4764
- /* @__PURE__ */ jsx(Grid.Item, { col: 6, s: 12, alignItems: "baseline", children: /* @__PURE__ */ jsx(Box, { width: "100%", children: /* @__PURE__ */ jsxs(Field.Root, { children: [
4765
- /* @__PURE__ */ jsx(Field.Label, { children: formatMessage({
4766
- id: getTranslation("modal.item.titleField.label"),
4767
- defaultMessage: "Title"
4768
- }) }),
4769
- /* @__PURE__ */ jsx(
4770
- Field.Input,
4771
- {
4772
- placeholder: formatMessage({
4773
- id: getTranslation("modal.item.titleField.placeholder"),
4774
- defaultMessage: "e.g. About us"
4775
- }),
4776
- name: "title",
4777
- value: navItemState.title || "",
4778
- onChange: (e) => dispatchItemState({ type: "SET_TITLE", payload: e.target.value }),
4779
- required: true
4780
- }
4781
- )
4782
- ] }) }) }),
4783
- /* @__PURE__ */ jsx(Grid.Item, { col: 6, s: 12, children: /* @__PURE__ */ jsxs(Box, { width: "100%", children: [
4784
- /* @__PURE__ */ jsxs(Field.Root, { children: [
4785
- /* @__PURE__ */ jsx(Field.Label, { children: formatMessage({
4786
- id: getTranslation("modal.item.routeField.label"),
4787
- defaultMessage: "Route"
4788
- }) }),
4789
- /* @__PURE__ */ jsx(
4790
- Field.Input,
4791
- {
4792
- required: true,
4793
- placeholder: formatMessage({
4794
- id: getTranslation("modal.item.routeField.placeholder"),
4795
- defaultMessage: "e.g. about/"
4796
- }),
4797
- name: "slug",
4798
- value: path?.value || "",
4799
- onChange: (e) => dispatchPath({ type: "NO_TRANSFORM_AND_CHECK", payload: e.target.value }),
4800
- onBlur: (e) => {
4801
- if (e.target.value === path.prevValue) return;
4802
- dispatchPath({ type: "DEFAULT", payload: e.target.value });
4803
- }
4804
- }
4805
- )
4806
- ] }),
4807
- /* @__PURE__ */ jsx(URLInfo, { validationState, replacement })
4808
- ] }) })
4809
- ] })
4830
+ /* @__PURE__ */ jsx(ItemDetails, {})
4810
4831
  ] })
4811
4832
  ]
4812
4833
  }
@@ -12201,4 +12222,4 @@ const App = () => {
12201
12222
  export {
12202
12223
  App as default
12203
12224
  };
12204
- //# sourceMappingURL=index-C2V-ZFHK.mjs.map
12225
+ //# sourceMappingURL=index-C4-VBSgi.mjs.map