tinacms 2.7.6 → 2.7.8

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.
@@ -0,0 +1,7 @@
1
+ import * as TooltipPrimitive from '@radix-ui/react-tooltip';
2
+ import * as React from 'react';
3
+ declare const TooltipProvider: React.FC<TooltipPrimitive.TooltipProviderProps>;
4
+ declare const Tooltip: React.FC<TooltipPrimitive.TooltipProps>;
5
+ declare const TooltipTrigger: React.ForwardRefExoticComponent<TooltipPrimitive.TooltipTriggerProps & React.RefAttributes<HTMLButtonElement>>;
6
+ declare const TooltipContent: React.ForwardRefExoticComponent<Omit<TooltipPrimitive.TooltipContentProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
7
+ export { Tooltip, TooltipTrigger, TooltipContent, TooltipProvider };
@@ -1,8 +1,8 @@
1
+ import type { Collection } from '@tinacms/schema-tools';
2
+ import { type TinaCMS } from '@tinacms/toolkit';
1
3
  import React from 'react';
2
4
  import { type NavigateFunction } from 'react-router-dom';
3
- import { type TinaCMS } from '@tinacms/toolkit';
4
5
  import type { CollectionResponse, DocumentSys } from '../types';
5
- import type { Collection } from '@tinacms/schema-tools';
6
6
  export declare const handleNavigate: (navigate: NavigateFunction, cms: TinaCMS, collection: CollectionResponse, collectionDefinition: Collection<true>, document: DocumentSys) => Promise<any>;
7
7
  declare const CollectionListPage: () => React.JSX.Element;
8
8
  export default CollectionListPage;
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  (function(global, factory) {
2
- typeof exports === "object" && typeof module !== "undefined" ? factory(exports, require("zod"), require("react"), require("react-dom"), require("@udecode/cn"), require("@udecode/plate"), require("@udecode/plate-common"), require("@udecode/plate-slash-command"), require("slate-react"), require("@udecode/plate-code-block"), require("@monaco-editor/react"), require("@headlessui/react"), require("class-variance-authority"), require("lucide-react"), require("mermaid"), require("@udecode/plate-heading"), require("@ariakit/react"), require("@udecode/plate-combobox"), require("@udecode/plate-table"), require("@udecode/plate-resizable"), require("@radix-ui/react-popover"), require("@radix-ui/react-slot"), require("@radix-ui/react-dropdown-menu"), require("@radix-ui/react-separator"), require("final-form-arrays"), require("final-form-set-field-data"), require("final-form"), require("react-final-form"), require("prop-types"), require("react-beautiful-dnd"), require("react-color"), require("color-string"), require("react-dropzone"), require("clsx"), require("tailwind-merge"), require("cmdk"), require("is-hotkey"), require("slate"), require("@react-hook/window-size"), require("lodash.get"), require("moment"), require("date-fns"), require("@udecode/plate-link"), require("@radix-ui/react-toolbar"), require("@radix-ui/react-tooltip"), require("@udecode/plate-paragraph"), require("@udecode/plate-block-quote"), require("@udecode/plate-floating"), require("graphql"), require("@tinacms/schema-tools"), require("graphql-tag"), require("@graphql-inspector/core"), require("yup"), require("react-router-dom"), require("@tinacms/mdx")) : typeof define === "function" && define.amd ? define(["exports", "zod", "react", "react-dom", "@udecode/cn", "@udecode/plate", "@udecode/plate-common", "@udecode/plate-slash-command", "slate-react", "@udecode/plate-code-block", "@monaco-editor/react", "@headlessui/react", "class-variance-authority", "lucide-react", "mermaid", "@udecode/plate-heading", "@ariakit/react", "@udecode/plate-combobox", "@udecode/plate-table", "@udecode/plate-resizable", "@radix-ui/react-popover", "@radix-ui/react-slot", "@radix-ui/react-dropdown-menu", "@radix-ui/react-separator", "final-form-arrays", "final-form-set-field-data", "final-form", "react-final-form", "prop-types", "react-beautiful-dnd", "react-color", "color-string", "react-dropzone", "clsx", "tailwind-merge", "cmdk", "is-hotkey", "slate", "@react-hook/window-size", "lodash.get", "moment", "date-fns", "@udecode/plate-link", "@radix-ui/react-toolbar", "@radix-ui/react-tooltip", "@udecode/plate-paragraph", "@udecode/plate-block-quote", "@udecode/plate-floating", "graphql", "@tinacms/schema-tools", "graphql-tag", "@graphql-inspector/core", "yup", "react-router-dom", "@tinacms/mdx"], factory) : (global = typeof globalThis !== "undefined" ? globalThis : global || self, factory(global.tinacms = {}, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP));
3
- })(this, function(exports2, zod, React, reactDom, cn$1, plate, plateCommon, plateSlashCommand, slateReact, plateCodeBlock, MonacoEditor, react, classVarianceAuthority, lucideReact, mermaid, plateHeading, react$1, plateCombobox, plateTable, plateResizable, PopoverPrimitive, reactSlot, DropdownMenuPrimitive, SeparatorPrimitive, arrayMutators, setFieldData, finalForm, reactFinalForm, PropTypes, reactBeautifulDnd, pkg$1, pkg, dropzone, clsx, tailwindMerge, cmdk, isHotkey, slate, windowSize, get, moment, dateFns, plateLink, ToolbarPrimitive, TooltipPrimitive, plateParagraph, plateBlockQuote, plateFloating, graphql, schemaTools, gql, core, yup, reactRouterDom, mdx) {
2
+ typeof exports === "object" && typeof module !== "undefined" ? factory(exports, require("zod"), require("react"), require("react-dom"), require("@udecode/cn"), require("@udecode/plate"), require("@udecode/plate-common"), require("@udecode/plate-slash-command"), require("@udecode/plate-code-block"), require("@monaco-editor/react"), require("slate-react"), require("@headlessui/react"), require("class-variance-authority"), require("lucide-react"), require("mermaid"), require("@udecode/plate-heading"), require("@ariakit/react"), require("@udecode/plate-combobox"), require("@udecode/plate-table"), require("@udecode/plate-resizable"), require("@radix-ui/react-popover"), require("@radix-ui/react-slot"), require("@radix-ui/react-dropdown-menu"), require("@radix-ui/react-separator"), require("final-form-arrays"), require("final-form-set-field-data"), require("final-form"), require("react-final-form"), require("prop-types"), require("react-beautiful-dnd"), require("react-color"), require("color-string"), require("react-dropzone"), require("clsx"), require("tailwind-merge"), require("cmdk"), require("is-hotkey"), require("slate"), require("@react-hook/window-size"), require("lodash.get"), require("moment"), require("date-fns"), require("@udecode/plate-link"), require("@radix-ui/react-toolbar"), require("@radix-ui/react-tooltip"), require("@udecode/plate-paragraph"), require("@udecode/plate-block-quote"), require("@udecode/plate-floating"), require("graphql"), require("@tinacms/schema-tools"), require("graphql-tag"), require("@graphql-inspector/core"), require("yup"), require("react-router-dom"), require("@tinacms/mdx")) : typeof define === "function" && define.amd ? define(["exports", "zod", "react", "react-dom", "@udecode/cn", "@udecode/plate", "@udecode/plate-common", "@udecode/plate-slash-command", "@udecode/plate-code-block", "@monaco-editor/react", "slate-react", "@headlessui/react", "class-variance-authority", "lucide-react", "mermaid", "@udecode/plate-heading", "@ariakit/react", "@udecode/plate-combobox", "@udecode/plate-table", "@udecode/plate-resizable", "@radix-ui/react-popover", "@radix-ui/react-slot", "@radix-ui/react-dropdown-menu", "@radix-ui/react-separator", "final-form-arrays", "final-form-set-field-data", "final-form", "react-final-form", "prop-types", "react-beautiful-dnd", "react-color", "color-string", "react-dropzone", "clsx", "tailwind-merge", "cmdk", "is-hotkey", "slate", "@react-hook/window-size", "lodash.get", "moment", "date-fns", "@udecode/plate-link", "@radix-ui/react-toolbar", "@radix-ui/react-tooltip", "@udecode/plate-paragraph", "@udecode/plate-block-quote", "@udecode/plate-floating", "graphql", "@tinacms/schema-tools", "graphql-tag", "@graphql-inspector/core", "yup", "react-router-dom", "@tinacms/mdx"], factory) : (global = typeof globalThis !== "undefined" ? globalThis : global || self, factory(global.tinacms = {}, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP));
3
+ })(this, function(exports2, zod, React, reactDom, cn$1, plate, plateCommon, plateSlashCommand, plateCodeBlock, MonacoEditor, slateReact, react, classVarianceAuthority, lucideReact, mermaid, plateHeading, react$1, plateCombobox, plateTable, plateResizable, PopoverPrimitive, reactSlot, DropdownMenuPrimitive, SeparatorPrimitive, arrayMutators, setFieldData, finalForm, reactFinalForm, PropTypes, reactBeautifulDnd, pkg$1, pkg, dropzone, clsx, tailwindMerge, cmdk, isHotkey, slate, windowSize, get, moment, dateFns, plateLink, ToolbarPrimitive, TooltipPrimitive, plateParagraph, plateBlockQuote, plateFloating, graphql, schemaTools, gql, core, yup, reactRouterDom, mdx) {
4
4
  "use strict";var __defProp = Object.defineProperty;
5
5
  var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
6
6
  var __publicField = (obj, key, value) => {
@@ -2954,7 +2954,6 @@ flowchart TD
2954
2954
  children,
2955
2955
  ...props
2956
2956
  }) => {
2957
- const selected = slateReact.useSelected();
2958
2957
  return /* @__PURE__ */ React.createElement(
2959
2958
  "div",
2960
2959
  {
@@ -2965,8 +2964,7 @@ flowchart TD
2965
2964
  ...attributes,
2966
2965
  ...props
2967
2966
  },
2968
- children,
2969
- selected && /* @__PURE__ */ React.createElement("span", { className: "absolute h-4 -top-2 inset-0 ring-2 ring-blue-100 ring-inset rounded-md z-10 pointer-events-none" })
2967
+ children
2970
2968
  );
2971
2969
  },
2972
2970
  [plate.ELEMENT_TABLE]: TableElement,
@@ -10888,7 +10886,7 @@ flowchart TD
10888
10886
  "Event Log"
10889
10887
  ));
10890
10888
  };
10891
- const version = "2.7.6";
10889
+ const version = "2.7.8";
10892
10890
  const Nav = ({
10893
10891
  isLocalMode,
10894
10892
  className = "",
@@ -12763,11 +12761,11 @@ flowchart TD
12763
12761
  }
12764
12762
  };
12765
12763
  return /* @__PURE__ */ React__namespace.createElement(React__namespace.Fragment, null, createBranchModalOpen && /* @__PURE__ */ React__namespace.createElement(
12766
- CreateBranchModel,
12764
+ CreateBranchModal,
12767
12765
  {
12768
12766
  safeSubmit,
12769
12767
  crudType: tinaForm.crudType,
12770
- relativePath: tinaForm.relativePath,
12768
+ path: tinaForm.relativePath,
12771
12769
  values: tinaForm.values,
12772
12770
  close: () => setCreateBranchModalOpen(false)
12773
12771
  }
@@ -12883,6 +12881,22 @@ flowchart TD
12883
12881
  relativePath: relativePath2,
12884
12882
  values,
12885
12883
  crudType
12884
+ }) => /* @__PURE__ */ React__namespace.createElement(
12885
+ CreateBranchModal,
12886
+ {
12887
+ close: close2,
12888
+ safeSubmit,
12889
+ path: relativePath2,
12890
+ values,
12891
+ crudType
12892
+ }
12893
+ );
12894
+ const CreateBranchModal = ({
12895
+ close: close2,
12896
+ safeSubmit,
12897
+ path,
12898
+ values,
12899
+ crudType
12886
12900
  }) => {
12887
12901
  const cms = useCMS$1();
12888
12902
  const tinaApi = cms.api.tina;
@@ -12891,7 +12905,7 @@ flowchart TD
12891
12905
  const [error, setError] = React__namespace.useState("");
12892
12906
  const onCreateBranch = (newBranchName2) => {
12893
12907
  localStorage.setItem("tina.createBranchState", "starting");
12894
- localStorage.setItem("tina.createBranchState.fullPath", relativePath2);
12908
+ localStorage.setItem("tina.createBranchState.fullPath", path);
12895
12909
  localStorage.setItem(
12896
12910
  "tina.createBranchState.values",
12897
12911
  JSON.stringify(values)
@@ -13971,11 +13985,11 @@ flowchart TD
13971
13985
  }
13972
13986
  );
13973
13987
  Editor.displayName = "Editor";
13974
- const TooltipProvider = TooltipPrimitive__namespace.Provider;
13975
- const Tooltip = TooltipPrimitive__namespace.Root;
13976
- const TooltipTrigger = TooltipPrimitive__namespace.Trigger;
13988
+ const TooltipProvider$1 = TooltipPrimitive__namespace.Provider;
13989
+ const Tooltip$1 = TooltipPrimitive__namespace.Root;
13990
+ const TooltipTrigger$1 = TooltipPrimitive__namespace.Trigger;
13977
13991
  const TooltipPortal = TooltipPrimitive__namespace.Portal;
13978
- const TooltipContent = cn$1.withCn(
13992
+ const TooltipContent$1 = cn$1.withCn(
13979
13993
  cn$1.withProps(TooltipPrimitive__namespace.Content, {
13980
13994
  sideOffset: 4
13981
13995
  }),
@@ -13989,7 +14003,7 @@ flowchart TD
13989
14003
  }, []);
13990
14004
  const component = /* @__PURE__ */ React.createElement(Component, { ref, ...props });
13991
14005
  if (tooltip && mounted) {
13992
- return /* @__PURE__ */ React.createElement(Tooltip, { ...tooltipProps }, /* @__PURE__ */ React.createElement(TooltipTrigger, { asChild: true }, component), /* @__PURE__ */ React.createElement(TooltipPortal, null, /* @__PURE__ */ React.createElement(TooltipContent, { ...tooltipContentProps }, tooltip)));
14006
+ return /* @__PURE__ */ React.createElement(Tooltip$1, { ...tooltipProps }, /* @__PURE__ */ React.createElement(TooltipTrigger$1, { asChild: true }, component), /* @__PURE__ */ React.createElement(TooltipPortal, null, /* @__PURE__ */ React.createElement(TooltipContent$1, { ...tooltipContentProps }, tooltip)));
13993
14007
  }
13994
14008
  return component;
13995
14009
  });
@@ -15028,6 +15042,7 @@ flowchart TD
15028
15042
  }
15029
15043
  const protocolAndDomainRE = /^(?:\w+:)?\/\/(\S+)$/;
15030
15044
  const emailLintRE = /mailto:([^?\\]+)/;
15045
+ const telLintRE = /tel:([\d-]+)/;
15031
15046
  const localhostDomainRE = /^localhost[\d:?]*(?:[^\d:?]\S*)?$/;
15032
15047
  const nonLocalhostDomainRE = /^[^\s.]+\.\S{2,}$/;
15033
15048
  const localUrlRE = /^\/\S+/;
@@ -15040,24 +15055,24 @@ flowchart TD
15040
15055
  }
15041
15056
  const generalMatch = string.match(protocolAndDomainRE);
15042
15057
  const emailLinkMatch = string.match(emailLintRE);
15058
+ const telLinkMatch = string.match(telLintRE);
15043
15059
  const localUrlMatch = string.match(localUrlRE);
15044
- const match = generalMatch || emailLinkMatch || localUrlMatch;
15045
- if (!match) {
15046
- return false;
15047
- }
15048
- if (localUrlMatch) {
15060
+ if (emailLinkMatch || telLinkMatch || localUrlMatch) {
15049
15061
  return true;
15050
15062
  }
15051
- const everythingAfterProtocol = match[1];
15052
- if (!everythingAfterProtocol) {
15053
- return false;
15054
- }
15055
- try {
15056
- new URL(string);
15057
- } catch {
15058
- return false;
15063
+ if (generalMatch) {
15064
+ const everythingAfterProtocol = generalMatch[1];
15065
+ if (!everythingAfterProtocol) {
15066
+ return false;
15067
+ }
15068
+ try {
15069
+ new URL(string);
15070
+ } catch {
15071
+ return false;
15072
+ }
15073
+ return localhostDomainRE.test(everythingAfterProtocol) || nonLocalhostDomainRE.test(everythingAfterProtocol);
15059
15074
  }
15060
- return localhostDomainRE.test(everythingAfterProtocol) || nonLocalhostDomainRE.test(everythingAfterProtocol);
15075
+ return false;
15061
15076
  };
15062
15077
  const RichEditor = ({ input, tinaForm, field }) => {
15063
15078
  var _a;
@@ -15122,7 +15137,7 @@ flowchart TD
15122
15137
  });
15123
15138
  }
15124
15139
  },
15125
- /* @__PURE__ */ React.createElement(TooltipProvider, null, /* @__PURE__ */ React.createElement(
15140
+ /* @__PURE__ */ React.createElement(TooltipProvider$1, null, /* @__PURE__ */ React.createElement(
15126
15141
  ToolbarProvider,
15127
15142
  {
15128
15143
  tinaForm,
@@ -32299,8 +32314,8 @@ This will work when developing locally but NOT when deployed to production.
32299
32314
  return client.request(query, { variables });
32300
32315
  };
32301
32316
  const GetCMS = ({ children }) => {
32317
+ const cms = useCMS$1();
32302
32318
  try {
32303
- const cms = useCMS$1();
32304
32319
  return /* @__PURE__ */ React.createElement(React.Fragment, null, children(cms));
32305
32320
  } catch (e) {
32306
32321
  return null;
@@ -32653,6 +32668,22 @@ This will work when developing locally but NOT when deployed to production.
32653
32668
  };
32654
32669
  const PageBody = ({ children }) => /* @__PURE__ */ React.createElement("div", { className: "py-8 px-6 xl:px-12" }, children);
32655
32670
  const PageBodyNarrow = ({ children }) => /* @__PURE__ */ React.createElement("div", { className: "py-10 px-6 xl:px-12" }, /* @__PURE__ */ React.createElement("div", { className: "w-full mx-auto max-w-screen-xl" }, children));
32671
+ const TooltipProvider = TooltipPrimitive__namespace.Provider;
32672
+ const Tooltip = TooltipPrimitive__namespace.Root;
32673
+ const TooltipTrigger = TooltipPrimitive__namespace.Trigger;
32674
+ const TooltipContent = React__namespace.forwardRef(({ className, sideOffset = 4, ...props }, ref) => /* @__PURE__ */ React__namespace.createElement(TooltipPrimitive__namespace.Portal, null, /* @__PURE__ */ React__namespace.createElement(
32675
+ TooltipPrimitive__namespace.Content,
32676
+ {
32677
+ ref,
32678
+ sideOffset,
32679
+ className: cn(
32680
+ "z-[10000] overflow-hidden rounded-md bg-[#FFF] px-3 py-1.5 text-xs text-[#504E5E] shadow-sm animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-[--radix-tooltip-content-transform-origin]",
32681
+ className
32682
+ ),
32683
+ ...props
32684
+ }
32685
+ )));
32686
+ TooltipContent.displayName = TooltipPrimitive__namespace.Content.displayName;
32656
32687
  const folderRegex = /^.*\/~\/*(.*)$/;
32657
32688
  const parentFolder = (folder) => {
32658
32689
  return {
@@ -32919,10 +32950,10 @@ This will work when developing locally but NOT when deployed to production.
32919
32950
  close: () => setDeleteModalOpen(false)
32920
32951
  }
32921
32952
  ), deleteModalOpen && cms.api.tina.usingProtectedBranch() && /* @__PURE__ */ React.createElement(
32922
- CreateBranchModel,
32953
+ CreateBranchModal,
32923
32954
  {
32924
32955
  crudType: "delete",
32925
- relativePath: `${collectionExtra.path}/${vars.relativePath}`,
32956
+ path: `${collectionExtra.path}/${vars.relativePath}`,
32926
32957
  values: vars,
32927
32958
  close: () => setDeleteModalOpen(false),
32928
32959
  safeSubmit: async () => {
@@ -33093,10 +33124,14 @@ This will work when developing locally but NOT when deployed to production.
33093
33124
  size: "small"
33094
33125
  },
33095
33126
  "Search not configured."
33096
- )))), /* @__PURE__ */ React.createElement("div", { className: "flex flex-col md:flex-row items-start md:items-end gap-2 md:gap-0 pt-4 lg:pt-0" }, !collection.templates && allowCreate && /* @__PURE__ */ React.createElement(React.Fragment, null, allowCreateNestedFolder && /* @__PURE__ */ React.createElement(
33127
+ )))), allowCreate && /* @__PURE__ */ React.createElement("div", { className: "flex flex-col md:flex-row items-start md:items-end gap-2 md:gap-0 pt-4 lg:pt-0" }, allowCreateNestedFolder && /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(TooltipProvider, null, /* @__PURE__ */ React.createElement(Tooltip, null, /* @__PURE__ */ React.createElement(TooltipTrigger, { asChild: true }, /* @__PURE__ */ React.createElement("span", null, /* @__PURE__ */ React.createElement(
33097
33128
  reactRouterDom.Link,
33098
33129
  {
33099
33130
  onMouseDown: (evt) => {
33131
+ if (collection.templates) {
33132
+ evt.preventDefault();
33133
+ return;
33134
+ }
33100
33135
  setVars((old) => ({
33101
33136
  ...old,
33102
33137
  collection: collectionName,
@@ -33106,12 +33141,32 @@ This will work when developing locally but NOT when deployed to production.
33106
33141
  evt.stopPropagation();
33107
33142
  },
33108
33143
  to: "/collections/new-folder",
33109
- className: "icon-parent inline-flex items-center font-medium focus:outline-none focus:ring-2 focus:shadow-outline text-center rounded-full justify-center transition-all duration-150 ease-out whitespace-nowrap shadow text-blue-500 bg-white hover:bg-[#f1f5f9] focus:ring-white focus:ring-blue-500 w-full md:w-auto text-sm h-10 px-6 mr-4"
33144
+ className: cn(
33145
+ "icon-parent inline-flex items-center font-medium focus:outline-none focus:ring-2 focus:shadow-outline text-center rounded-full justify-center transition-all duration-150 ease-out whitespace-nowrap shadow text-blue-500 bg-white hover:bg-[#f1f5f9] focus:ring-white focus:ring-blue-500 w-full md:w-auto text-sm h-10 px-6 mr-4",
33146
+ collection.templates && "opacity-50 pointer-events-none cursor-not-allowed"
33147
+ ),
33148
+ "aria-disabled": !!collection.templates,
33149
+ tabIndex: collection.templates ? -1 : 0
33110
33150
  },
33111
33151
  /* @__PURE__ */ React.createElement(FaFolder, { className: "mr-2" }),
33112
- "Add Folder",
33113
- " "
33114
- ), /* @__PURE__ */ React.createElement(
33152
+ "Add Folder"
33153
+ ))), collection.templates && /* @__PURE__ */ React.createElement(
33154
+ TooltipContent,
33155
+ {
33156
+ side: "top",
33157
+ align: "center"
33158
+ },
33159
+ /* @__PURE__ */ React.createElement("p", null, "Folders can’t be manually added when using templates.", /* @__PURE__ */ React.createElement("br", null), "See the docs -", " ", /* @__PURE__ */ React.createElement(
33160
+ "a",
33161
+ {
33162
+ href: "https://tina.io/docs/reference/templates",
33163
+ target: "_blank",
33164
+ rel: "noopener noreferrer",
33165
+ className: "underline text-blue-500"
33166
+ },
33167
+ "https://tina.io/docs/reference/templates"
33168
+ ))
33169
+ )))), !collection.templates && /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(
33115
33170
  reactRouterDom.Link,
33116
33171
  {
33117
33172
  to: `/${folder.fullyQualifiedName ? [
@@ -33130,7 +33185,7 @@ This will work when developing locally but NOT when deployed to production.
33130
33185
  /* @__PURE__ */ React.createElement(FaFile, { className: "mr-2" }),
33131
33186
  "Add Files",
33132
33187
  " "
33133
- )), collection.templates && allowCreate && /* @__PURE__ */ React.createElement(
33188
+ )), collection.templates && /* @__PURE__ */ React.createElement(
33134
33189
  TemplateMenu,
33135
33190
  {
33136
33191
  collectionName,
@@ -33708,22 +33763,28 @@ This will work when developing locally but NOT when deployed to production.
33708
33763
  search
33709
33764
  }) => {
33710
33765
  const navigate = reactRouterDom.useNavigate();
33711
- const { collection, loading, error, reFetchCollection, collectionExtra } = search ? useSearchCollection(
33712
- cms,
33713
- collectionName,
33714
- includeDocuments,
33715
- folder,
33716
- startCursor || "",
33717
- search
33718
- ) : useGetCollection(
33719
- cms,
33720
- collectionName,
33721
- includeDocuments,
33722
- folder,
33723
- startCursor || "",
33724
- sortKey,
33725
- filterArgs
33726
- ) || {};
33766
+ const { collection, loading, error, reFetchCollection, collectionExtra } = search ? (
33767
+ // biome-ignore lint/correctness/useHookAtTopLevel: not ready to fix these yet
33768
+ useSearchCollection(
33769
+ cms,
33770
+ collectionName,
33771
+ includeDocuments,
33772
+ folder,
33773
+ startCursor || "",
33774
+ search
33775
+ )
33776
+ ) : (
33777
+ // biome-ignore lint/correctness/useHookAtTopLevel: not ready to fix these yet
33778
+ useGetCollection(
33779
+ cms,
33780
+ collectionName,
33781
+ includeDocuments,
33782
+ folder,
33783
+ startCursor || "",
33784
+ sortKey,
33785
+ filterArgs
33786
+ ) || {}
33787
+ );
33727
33788
  React.useEffect(() => {
33728
33789
  var _a, _b, _c, _d, _e, _f, _g, _h, _i;
33729
33790
  if (loading)
@@ -34239,7 +34300,7 @@ This will work when developing locally but NOT when deployed to production.
34239
34300
  const form = React.useMemo(() => {
34240
34301
  return new Form({
34241
34302
  // id is the full document path
34242
- id: `${schemaCollection.path}/${relativePath2}`,
34303
+ id: schemaTools.canonicalPath(`${schemaCollection.path}/${relativePath2}`),
34243
34304
  label: "form",
34244
34305
  fields: formInfo.fields,
34245
34306
  initialValues: document2._values,
@@ -34402,7 +34463,10 @@ This will work when developing locally but NOT when deployed to production.
34402
34463
  const collection = tinaApi.schema.getCollectionByFullPath(fullPath);
34403
34464
  const api = new TinaAdminApi(cms);
34404
34465
  const params = api.schema.transformPayload(collection.name, values);
34405
- const relativePath2 = fullPath.replace(`${collection.path}/`, "");
34466
+ const relativePath2 = pathRelativeToCollection(
34467
+ collection.path,
34468
+ fullPath
34469
+ );
34406
34470
  if (await api.isAuthenticated()) {
34407
34471
  if (kind === "delete") {
34408
34472
  await api.deleteDocument(values);
@@ -34468,6 +34532,16 @@ This will work when developing locally but NOT when deployed to production.
34468
34532
  ), (state === "starting" || state === "creatingBranch") && /* @__PURE__ */ React.createElement("p", null, "Creating branch…"), state === "indexing" && /* @__PURE__ */ React.createElement("p", null, "Indexing Content…"), state === "submitting" && /* @__PURE__ */ React.createElement("p", null, "Saving content…"), state === "creatingPR" && /* @__PURE__ */ React.createElement("p", null, "Creating Pull Request…"), state === "error" && /* @__PURE__ */ React.createElement("p", { className: "flex items-center gap-1 text-red-700" }, /* @__PURE__ */ React.createElement(BiError, { className: "w-7 h-auto text-red-400 flex-shrink-0" }), " ", /* @__PURE__ */ React.createElement("b", null, "Error:"), " ", errorMessage, " "));
34469
34533
  };
34470
34534
  const Wrapper = ({ children }) => /* @__PURE__ */ React.createElement("div", { className: "w-full h-full flex flex-col justify-center items-center gap-4 p-6 text-xl text-gray-700" }, children);
34535
+ const pathRelativeToCollection = (collectionPath, fullPath) => {
34536
+ const cleanCollectionPath = schemaTools.canonicalPath(collectionPath) + "/";
34537
+ const cleanFullPath = schemaTools.canonicalPath(fullPath);
34538
+ if (cleanFullPath.startsWith(cleanCollectionPath)) {
34539
+ return cleanFullPath.substring(cleanCollectionPath.length);
34540
+ }
34541
+ throw new Error(
34542
+ `Path ${fullPath} not within collection path ${collectionPath}`
34543
+ );
34544
+ };
34471
34545
  const Redirect = () => {
34472
34546
  React.useEffect(() => {
34473
34547
  if (window) {
@@ -34894,6 +34968,7 @@ This will work when developing locally but NOT when deployed to production.
34894
34968
  exports2.ColorField = ColorField;
34895
34969
  exports2.ColorFieldPlugin = ColorFieldPlugin;
34896
34970
  exports2.ColorPicker = ColorPicker;
34971
+ exports2.CreateBranchModal = CreateBranchModal;
34897
34972
  exports2.CreateBranchModel = CreateBranchModel;
34898
34973
  exports2.CursorPaginator = CursorPaginator;
34899
34974
  exports2.DEFAULT_LOCAL_TINA_GQL_SERVER_URL = DEFAULT_LOCAL_TINA_GQL_SERVER_URL;
package/dist/index.mjs CHANGED
@@ -12,9 +12,9 @@ import { withRef, cn as cn$1, withVariants, withProps, withCn, createPrimitiveEl
12
12
  import { toggleList, ELEMENT_UL, ELEMENT_OL, ELEMENT_H1 as ELEMENT_H1$1, ELEMENT_H2 as ELEMENT_H2$1, ELEMENT_H3 as ELEMENT_H3$1, ELEMENT_H4, ELEMENT_H5, ELEMENT_H6, ELEMENT_PARAGRAPH, ELEMENT_BLOCKQUOTE, ELEMENT_CODE_BLOCK, ELEMENT_CODE_LINE, ELEMENT_CODE_SYNTAX, ELEMENT_LI, ELEMENT_LINK, MARK_CODE, MARK_UNDERLINE, MARK_STRIKETHROUGH, MARK_ITALIC, MARK_BOLD, ELEMENT_HR, ELEMENT_TABLE, ELEMENT_TR, ELEMENT_TD, ELEMENT_TH, unwrapList, ELEMENT_TODO_LI, createTrailingBlockPlugin, createAutoformatPlugin, createExitBreakPlugin, KEYS_HEADING, createResetNodePlugin, createBasicMarksPlugin, createHeadingPlugin, createParagraphPlugin, createBlockquotePlugin, createUnderlinePlugin, createListPlugin, createIndentListPlugin, createHorizontalRulePlugin, createNodeIdPlugin, createTablePlugin, getListItemEntry, useListToolbarButtonState, useListToolbarButton } from "@udecode/plate";
13
13
  import { PlateElement, isCollapsed, findNodePath, getPointAfter, insertNodes, ELEMENT_DEFAULT, focusEditor, getPointBefore, setNodes, isElement, PlateLeaf, createPluginFactory, useComposedRef, useEditorRef, createPointRef, insertText, moveSelection, toggleNodeType, useElement, useRemoveNodeButton, useEditorSelector, isSelectionExpanded, withHOC, normalizeEditor, getBlockAbove, queryNode, getParentNode, isType, someNode, isSelectionAtBlockStart, setElements, insertNode, getPluginType, isBlock, isBlockAboveEmpty, findNode, PlateContent, getNodeEntries, useEditorState, collapseSelection, insertEmptyElement, useMarkToolbarButtonState, useMarkToolbarButton, usePlateSelectors, useEventEditorSelectors, PortalBody, useFormInputProps, createPlugins, Plate } from "@udecode/plate-common";
14
14
  import { ELEMENT_SLASH_INPUT, createSlashPlugin } from "@udecode/plate-slash-command";
15
- import { useSelected, useReadOnly, ReactEditor } from "slate-react";
16
15
  import { useCodeBlockElementState, useCodeSyntaxLeaf, ELEMENT_CODE_BLOCK as ELEMENT_CODE_BLOCK$1 } from "@udecode/plate-code-block";
17
16
  import MonacoEditor, { loader, useMonaco } from "@monaco-editor/react";
17
+ import { useSelected, useReadOnly, ReactEditor } from "slate-react";
18
18
  import { Combobox as Combobox$1, ComboboxInput, ComboboxButton, Transition, ComboboxOptions, ComboboxOption, Popover as Popover$3, PopoverButton, PopoverPanel, TransitionChild, Disclosure, DisclosureButton, DisclosurePanel, Menu, MenuButton, MenuItems, MenuItem } from "@headlessui/react";
19
19
  import { cva } from "class-variance-authority";
20
20
  import { Eye, SquarePen, Plus, AlignCenter as AlignCenter$1, AlignJustify, AlignLeft as AlignLeft$1, AlignRight as AlignRight$1, ChevronDown, PaintBucket, Quote, Check, ChevronRight, ChevronsUpDown, X, FileCode, Baseline, RectangleVertical, Combine, Ungroup, MessageSquare, MessageSquarePlus, Trash, GripVertical, Edit2, Smile, ExternalLink, Heading1, Heading2, Heading3, Heading4, Heading5, Heading6, Indent, Keyboard, WrapText, Minus, MoreHorizontal, Outdent, Pilcrow, RotateCcw, RectangleHorizontal, Search, Settings, Strikethrough, Subscript, Superscript, Table, Text, Underline, Link2Off, Moon, SunMedium, Twitter } from "lucide-react";
@@ -54,7 +54,7 @@ import { ELEMENT_PARAGRAPH as ELEMENT_PARAGRAPH$1 } from "@udecode/plate-paragra
54
54
  import { ELEMENT_BLOCKQUOTE as ELEMENT_BLOCKQUOTE$1 } from "@udecode/plate-block-quote";
55
55
  import { useFloatingToolbarState, offset, flip, useFloatingToolbar } from "@udecode/plate-floating";
56
56
  import { getIntrospectionQuery, buildClientSchema, print, parse as parse$3, buildSchema } from "graphql";
57
- import { TinaSchema, addNamespaceToSchema, parseURL, resolveForm, normalizePath, validateSchema } from "@tinacms/schema-tools";
57
+ import { TinaSchema, addNamespaceToSchema, parseURL, resolveForm, normalizePath, canonicalPath, validateSchema } from "@tinacms/schema-tools";
58
58
  import { NAMER, resolveField } from "@tinacms/schema-tools";
59
59
  import gql from "graphql-tag";
60
60
  import { diff } from "@graphql-inspector/core";
@@ -2981,7 +2981,6 @@ const Components = () => {
2981
2981
  children,
2982
2982
  ...props
2983
2983
  }) => {
2984
- const selected = useSelected();
2985
2984
  return /* @__PURE__ */ React__default.createElement(
2986
2985
  "div",
2987
2986
  {
@@ -2992,8 +2991,7 @@ const Components = () => {
2992
2991
  ...attributes,
2993
2992
  ...props
2994
2993
  },
2995
- children,
2996
- selected && /* @__PURE__ */ React__default.createElement("span", { className: "absolute h-4 -top-2 inset-0 ring-2 ring-blue-100 ring-inset rounded-md z-10 pointer-events-none" })
2994
+ children
2997
2995
  );
2998
2996
  },
2999
2997
  [ELEMENT_TABLE]: TableElement,
@@ -10915,7 +10913,7 @@ const SyncStatus = ({ cms, setEventsOpen }) => {
10915
10913
  "Event Log"
10916
10914
  ));
10917
10915
  };
10918
- const version = "2.7.6";
10916
+ const version = "2.7.8";
10919
10917
  const Nav = ({
10920
10918
  isLocalMode,
10921
10919
  className = "",
@@ -12790,11 +12788,11 @@ const FormBuilder = ({
12790
12788
  }
12791
12789
  };
12792
12790
  return /* @__PURE__ */ React.createElement(React.Fragment, null, createBranchModalOpen && /* @__PURE__ */ React.createElement(
12793
- CreateBranchModel,
12791
+ CreateBranchModal,
12794
12792
  {
12795
12793
  safeSubmit,
12796
12794
  crudType: tinaForm.crudType,
12797
- relativePath: tinaForm.relativePath,
12795
+ path: tinaForm.relativePath,
12798
12796
  values: tinaForm.values,
12799
12797
  close: () => setCreateBranchModalOpen(false)
12800
12798
  }
@@ -12910,6 +12908,22 @@ const CreateBranchModel = ({
12910
12908
  relativePath: relativePath2,
12911
12909
  values,
12912
12910
  crudType
12911
+ }) => /* @__PURE__ */ React.createElement(
12912
+ CreateBranchModal,
12913
+ {
12914
+ close: close2,
12915
+ safeSubmit,
12916
+ path: relativePath2,
12917
+ values,
12918
+ crudType
12919
+ }
12920
+ );
12921
+ const CreateBranchModal = ({
12922
+ close: close2,
12923
+ safeSubmit,
12924
+ path,
12925
+ values,
12926
+ crudType
12913
12927
  }) => {
12914
12928
  const cms = useCMS$1();
12915
12929
  const tinaApi = cms.api.tina;
@@ -12918,7 +12932,7 @@ const CreateBranchModel = ({
12918
12932
  const [error, setError] = React.useState("");
12919
12933
  const onCreateBranch = (newBranchName2) => {
12920
12934
  localStorage.setItem("tina.createBranchState", "starting");
12921
- localStorage.setItem("tina.createBranchState.fullPath", relativePath2);
12935
+ localStorage.setItem("tina.createBranchState.fullPath", path);
12922
12936
  localStorage.setItem(
12923
12937
  "tina.createBranchState.values",
12924
12938
  JSON.stringify(values)
@@ -13998,11 +14012,11 @@ const Editor = React__default.forwardRef(
13998
14012
  }
13999
14013
  );
14000
14014
  Editor.displayName = "Editor";
14001
- const TooltipProvider = TooltipPrimitive.Provider;
14002
- const Tooltip = TooltipPrimitive.Root;
14003
- const TooltipTrigger = TooltipPrimitive.Trigger;
14015
+ const TooltipProvider$1 = TooltipPrimitive.Provider;
14016
+ const Tooltip$1 = TooltipPrimitive.Root;
14017
+ const TooltipTrigger$1 = TooltipPrimitive.Trigger;
14004
14018
  const TooltipPortal = TooltipPrimitive.Portal;
14005
- const TooltipContent = withCn(
14019
+ const TooltipContent$1 = withCn(
14006
14020
  withProps(TooltipPrimitive.Content, {
14007
14021
  sideOffset: 4
14008
14022
  }),
@@ -14016,7 +14030,7 @@ function withTooltip(Component) {
14016
14030
  }, []);
14017
14031
  const component = /* @__PURE__ */ React__default.createElement(Component, { ref, ...props });
14018
14032
  if (tooltip && mounted) {
14019
- return /* @__PURE__ */ React__default.createElement(Tooltip, { ...tooltipProps }, /* @__PURE__ */ React__default.createElement(TooltipTrigger, { asChild: true }, component), /* @__PURE__ */ React__default.createElement(TooltipPortal, null, /* @__PURE__ */ React__default.createElement(TooltipContent, { ...tooltipContentProps }, tooltip)));
14033
+ return /* @__PURE__ */ React__default.createElement(Tooltip$1, { ...tooltipProps }, /* @__PURE__ */ React__default.createElement(TooltipTrigger$1, { asChild: true }, component), /* @__PURE__ */ React__default.createElement(TooltipPortal, null, /* @__PURE__ */ React__default.createElement(TooltipContent$1, { ...tooltipContentProps }, tooltip)));
14020
14034
  }
14021
14035
  return component;
14022
14036
  });
@@ -15055,6 +15069,7 @@ function LinkFloatingToolbar({ state }) {
15055
15069
  }
15056
15070
  const protocolAndDomainRE = /^(?:\w+:)?\/\/(\S+)$/;
15057
15071
  const emailLintRE = /mailto:([^?\\]+)/;
15072
+ const telLintRE = /tel:([\d-]+)/;
15058
15073
  const localhostDomainRE = /^localhost[\d:?]*(?:[^\d:?]\S*)?$/;
15059
15074
  const nonLocalhostDomainRE = /^[^\s.]+\.\S{2,}$/;
15060
15075
  const localUrlRE = /^\/\S+/;
@@ -15067,24 +15082,24 @@ const isUrl = (string) => {
15067
15082
  }
15068
15083
  const generalMatch = string.match(protocolAndDomainRE);
15069
15084
  const emailLinkMatch = string.match(emailLintRE);
15085
+ const telLinkMatch = string.match(telLintRE);
15070
15086
  const localUrlMatch = string.match(localUrlRE);
15071
- const match = generalMatch || emailLinkMatch || localUrlMatch;
15072
- if (!match) {
15073
- return false;
15074
- }
15075
- if (localUrlMatch) {
15087
+ if (emailLinkMatch || telLinkMatch || localUrlMatch) {
15076
15088
  return true;
15077
15089
  }
15078
- const everythingAfterProtocol = match[1];
15079
- if (!everythingAfterProtocol) {
15080
- return false;
15081
- }
15082
- try {
15083
- new URL(string);
15084
- } catch {
15085
- return false;
15090
+ if (generalMatch) {
15091
+ const everythingAfterProtocol = generalMatch[1];
15092
+ if (!everythingAfterProtocol) {
15093
+ return false;
15094
+ }
15095
+ try {
15096
+ new URL(string);
15097
+ } catch {
15098
+ return false;
15099
+ }
15100
+ return localhostDomainRE.test(everythingAfterProtocol) || nonLocalhostDomainRE.test(everythingAfterProtocol);
15086
15101
  }
15087
- return localhostDomainRE.test(everythingAfterProtocol) || nonLocalhostDomainRE.test(everythingAfterProtocol);
15102
+ return false;
15088
15103
  };
15089
15104
  const RichEditor = ({ input, tinaForm, field }) => {
15090
15105
  var _a;
@@ -15149,7 +15164,7 @@ const RichEditor = ({ input, tinaForm, field }) => {
15149
15164
  });
15150
15165
  }
15151
15166
  },
15152
- /* @__PURE__ */ React__default.createElement(TooltipProvider, null, /* @__PURE__ */ React__default.createElement(
15167
+ /* @__PURE__ */ React__default.createElement(TooltipProvider$1, null, /* @__PURE__ */ React__default.createElement(
15153
15168
  ToolbarProvider,
15154
15169
  {
15155
15170
  tinaForm,
@@ -32326,8 +32341,8 @@ This will work when developing locally but NOT when deployed to production.
32326
32341
  return client.request(query, { variables });
32327
32342
  };
32328
32343
  const GetCMS = ({ children }) => {
32344
+ const cms = useCMS$1();
32329
32345
  try {
32330
- const cms = useCMS$1();
32331
32346
  return /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, children(cms));
32332
32347
  } catch (e) {
32333
32348
  return null;
@@ -32680,6 +32695,22 @@ const PageHeader = ({
32680
32695
  };
32681
32696
  const PageBody = ({ children }) => /* @__PURE__ */ React__default.createElement("div", { className: "py-8 px-6 xl:px-12" }, children);
32682
32697
  const PageBodyNarrow = ({ children }) => /* @__PURE__ */ React__default.createElement("div", { className: "py-10 px-6 xl:px-12" }, /* @__PURE__ */ React__default.createElement("div", { className: "w-full mx-auto max-w-screen-xl" }, children));
32698
+ const TooltipProvider = TooltipPrimitive.Provider;
32699
+ const Tooltip = TooltipPrimitive.Root;
32700
+ const TooltipTrigger = TooltipPrimitive.Trigger;
32701
+ const TooltipContent = React.forwardRef(({ className, sideOffset = 4, ...props }, ref) => /* @__PURE__ */ React.createElement(TooltipPrimitive.Portal, null, /* @__PURE__ */ React.createElement(
32702
+ TooltipPrimitive.Content,
32703
+ {
32704
+ ref,
32705
+ sideOffset,
32706
+ className: cn(
32707
+ "z-[10000] overflow-hidden rounded-md bg-[#FFF] px-3 py-1.5 text-xs text-[#504E5E] shadow-sm animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-[--radix-tooltip-content-transform-origin]",
32708
+ className
32709
+ ),
32710
+ ...props
32711
+ }
32712
+ )));
32713
+ TooltipContent.displayName = TooltipPrimitive.Content.displayName;
32683
32714
  const folderRegex = /^.*\/~\/*(.*)$/;
32684
32715
  const parentFolder = (folder) => {
32685
32716
  return {
@@ -32946,10 +32977,10 @@ const CollectionListPage = () => {
32946
32977
  close: () => setDeleteModalOpen(false)
32947
32978
  }
32948
32979
  ), deleteModalOpen && cms.api.tina.usingProtectedBranch() && /* @__PURE__ */ React__default.createElement(
32949
- CreateBranchModel,
32980
+ CreateBranchModal,
32950
32981
  {
32951
32982
  crudType: "delete",
32952
- relativePath: `${collectionExtra.path}/${vars.relativePath}`,
32983
+ path: `${collectionExtra.path}/${vars.relativePath}`,
32953
32984
  values: vars,
32954
32985
  close: () => setDeleteModalOpen(false),
32955
32986
  safeSubmit: async () => {
@@ -33120,10 +33151,14 @@ const CollectionListPage = () => {
33120
33151
  size: "small"
33121
33152
  },
33122
33153
  "Search not configured."
33123
- )))), /* @__PURE__ */ React__default.createElement("div", { className: "flex flex-col md:flex-row items-start md:items-end gap-2 md:gap-0 pt-4 lg:pt-0" }, !collection.templates && allowCreate && /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, allowCreateNestedFolder && /* @__PURE__ */ React__default.createElement(
33154
+ )))), allowCreate && /* @__PURE__ */ React__default.createElement("div", { className: "flex flex-col md:flex-row items-start md:items-end gap-2 md:gap-0 pt-4 lg:pt-0" }, allowCreateNestedFolder && /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, /* @__PURE__ */ React__default.createElement(TooltipProvider, null, /* @__PURE__ */ React__default.createElement(Tooltip, null, /* @__PURE__ */ React__default.createElement(TooltipTrigger, { asChild: true }, /* @__PURE__ */ React__default.createElement("span", null, /* @__PURE__ */ React__default.createElement(
33124
33155
  Link,
33125
33156
  {
33126
33157
  onMouseDown: (evt) => {
33158
+ if (collection.templates) {
33159
+ evt.preventDefault();
33160
+ return;
33161
+ }
33127
33162
  setVars((old) => ({
33128
33163
  ...old,
33129
33164
  collection: collectionName,
@@ -33133,12 +33168,32 @@ const CollectionListPage = () => {
33133
33168
  evt.stopPropagation();
33134
33169
  },
33135
33170
  to: "/collections/new-folder",
33136
- className: "icon-parent inline-flex items-center font-medium focus:outline-none focus:ring-2 focus:shadow-outline text-center rounded-full justify-center transition-all duration-150 ease-out whitespace-nowrap shadow text-blue-500 bg-white hover:bg-[#f1f5f9] focus:ring-white focus:ring-blue-500 w-full md:w-auto text-sm h-10 px-6 mr-4"
33171
+ className: cn(
33172
+ "icon-parent inline-flex items-center font-medium focus:outline-none focus:ring-2 focus:shadow-outline text-center rounded-full justify-center transition-all duration-150 ease-out whitespace-nowrap shadow text-blue-500 bg-white hover:bg-[#f1f5f9] focus:ring-white focus:ring-blue-500 w-full md:w-auto text-sm h-10 px-6 mr-4",
33173
+ collection.templates && "opacity-50 pointer-events-none cursor-not-allowed"
33174
+ ),
33175
+ "aria-disabled": !!collection.templates,
33176
+ tabIndex: collection.templates ? -1 : 0
33137
33177
  },
33138
33178
  /* @__PURE__ */ React__default.createElement(FaFolder, { className: "mr-2" }),
33139
- "Add Folder",
33140
- " "
33141
- ), /* @__PURE__ */ React__default.createElement(
33179
+ "Add Folder"
33180
+ ))), collection.templates && /* @__PURE__ */ React__default.createElement(
33181
+ TooltipContent,
33182
+ {
33183
+ side: "top",
33184
+ align: "center"
33185
+ },
33186
+ /* @__PURE__ */ React__default.createElement("p", null, "Folders can’t be manually added when using templates.", /* @__PURE__ */ React__default.createElement("br", null), "See the docs -", " ", /* @__PURE__ */ React__default.createElement(
33187
+ "a",
33188
+ {
33189
+ href: "https://tina.io/docs/reference/templates",
33190
+ target: "_blank",
33191
+ rel: "noopener noreferrer",
33192
+ className: "underline text-blue-500"
33193
+ },
33194
+ "https://tina.io/docs/reference/templates"
33195
+ ))
33196
+ )))), !collection.templates && /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, /* @__PURE__ */ React__default.createElement(
33142
33197
  Link,
33143
33198
  {
33144
33199
  to: `/${folder.fullyQualifiedName ? [
@@ -33157,7 +33212,7 @@ const CollectionListPage = () => {
33157
33212
  /* @__PURE__ */ React__default.createElement(FaFile, { className: "mr-2" }),
33158
33213
  "Add Files",
33159
33214
  " "
33160
- )), collection.templates && allowCreate && /* @__PURE__ */ React__default.createElement(
33215
+ )), collection.templates && /* @__PURE__ */ React__default.createElement(
33161
33216
  TemplateMenu,
33162
33217
  {
33163
33218
  collectionName,
@@ -33735,22 +33790,28 @@ const GetCollection = ({
33735
33790
  search
33736
33791
  }) => {
33737
33792
  const navigate = useNavigate();
33738
- const { collection, loading, error, reFetchCollection, collectionExtra } = search ? useSearchCollection(
33739
- cms,
33740
- collectionName,
33741
- includeDocuments,
33742
- folder,
33743
- startCursor || "",
33744
- search
33745
- ) : useGetCollection(
33746
- cms,
33747
- collectionName,
33748
- includeDocuments,
33749
- folder,
33750
- startCursor || "",
33751
- sortKey,
33752
- filterArgs
33753
- ) || {};
33793
+ const { collection, loading, error, reFetchCollection, collectionExtra } = search ? (
33794
+ // biome-ignore lint/correctness/useHookAtTopLevel: not ready to fix these yet
33795
+ useSearchCollection(
33796
+ cms,
33797
+ collectionName,
33798
+ includeDocuments,
33799
+ folder,
33800
+ startCursor || "",
33801
+ search
33802
+ )
33803
+ ) : (
33804
+ // biome-ignore lint/correctness/useHookAtTopLevel: not ready to fix these yet
33805
+ useGetCollection(
33806
+ cms,
33807
+ collectionName,
33808
+ includeDocuments,
33809
+ folder,
33810
+ startCursor || "",
33811
+ sortKey,
33812
+ filterArgs
33813
+ ) || {}
33814
+ );
33754
33815
  useEffect(() => {
33755
33816
  var _a, _b, _c, _d, _e, _f, _g, _h, _i;
33756
33817
  if (loading)
@@ -34266,7 +34327,7 @@ const RenderForm = ({
34266
34327
  const form = useMemo(() => {
34267
34328
  return new Form({
34268
34329
  // id is the full document path
34269
- id: `${schemaCollection.path}/${relativePath2}`,
34330
+ id: canonicalPath(`${schemaCollection.path}/${relativePath2}`),
34270
34331
  label: "form",
34271
34332
  fields: formInfo.fields,
34272
34333
  initialValues: document2._values,
@@ -34429,7 +34490,10 @@ const IndexingPage = () => {
34429
34490
  const collection = tinaApi.schema.getCollectionByFullPath(fullPath);
34430
34491
  const api = new TinaAdminApi(cms);
34431
34492
  const params = api.schema.transformPayload(collection.name, values);
34432
- const relativePath2 = fullPath.replace(`${collection.path}/`, "");
34493
+ const relativePath2 = pathRelativeToCollection(
34494
+ collection.path,
34495
+ fullPath
34496
+ );
34433
34497
  if (await api.isAuthenticated()) {
34434
34498
  if (kind === "delete") {
34435
34499
  await api.deleteDocument(values);
@@ -34495,6 +34559,16 @@ const IndexingPage = () => {
34495
34559
  ), (state === "starting" || state === "creatingBranch") && /* @__PURE__ */ React__default.createElement("p", null, "Creating branch…"), state === "indexing" && /* @__PURE__ */ React__default.createElement("p", null, "Indexing Content…"), state === "submitting" && /* @__PURE__ */ React__default.createElement("p", null, "Saving content…"), state === "creatingPR" && /* @__PURE__ */ React__default.createElement("p", null, "Creating Pull Request…"), state === "error" && /* @__PURE__ */ React__default.createElement("p", { className: "flex items-center gap-1 text-red-700" }, /* @__PURE__ */ React__default.createElement(BiError, { className: "w-7 h-auto text-red-400 flex-shrink-0" }), " ", /* @__PURE__ */ React__default.createElement("b", null, "Error:"), " ", errorMessage, " "));
34496
34560
  };
34497
34561
  const Wrapper = ({ children }) => /* @__PURE__ */ React__default.createElement("div", { className: "w-full h-full flex flex-col justify-center items-center gap-4 p-6 text-xl text-gray-700" }, children);
34562
+ const pathRelativeToCollection = (collectionPath, fullPath) => {
34563
+ const cleanCollectionPath = canonicalPath(collectionPath) + "/";
34564
+ const cleanFullPath = canonicalPath(fullPath);
34565
+ if (cleanFullPath.startsWith(cleanCollectionPath)) {
34566
+ return cleanFullPath.substring(cleanCollectionPath.length);
34567
+ }
34568
+ throw new Error(
34569
+ `Path ${fullPath} not within collection path ${collectionPath}`
34570
+ );
34571
+ };
34498
34572
  const Redirect = () => {
34499
34573
  React__default.useEffect(() => {
34500
34574
  if (window) {
@@ -34914,6 +34988,7 @@ export {
34914
34988
  ColorField,
34915
34989
  ColorFieldPlugin,
34916
34990
  ColorPicker,
34991
+ CreateBranchModal,
34917
34992
  CreateBranchModel,
34918
34993
  CursorPaginator,
34919
34994
  DEFAULT_LOCAL_TINA_GQL_SERVER_URL,
@@ -7,7 +7,7 @@
7
7
  prismReactRenderer.Highlight,
8
8
  {
9
9
  theme: prismReactRenderer.themes[props.theme || "github"],
10
- code: props.value,
10
+ code: props.value || "",
11
11
  language: props.lang || ""
12
12
  },
13
13
  ({ className, style, tokens, getLineProps, getTokenProps }) => /* @__PURE__ */ React.createElement("pre", { className, style }, tokens.map((line, i) => /* @__PURE__ */ React.createElement("div", { ...getLineProps({ line, key: i }) }, line.map((token, key) => /* @__PURE__ */ React.createElement("span", { ...getTokenProps({ token, key }) })))))
@@ -5,7 +5,7 @@ const Prism = (props) => {
5
5
  Highlight,
6
6
  {
7
7
  theme: themes[props.theme || "github"],
8
- code: props.value,
8
+ code: props.value || "",
9
9
  language: props.lang || ""
10
10
  },
11
11
  ({ className, style, tokens, getLineProps, getTokenProps }) => /* @__PURE__ */ React.createElement("pre", { className, style }, tokens.map((line, i) => /* @__PURE__ */ React.createElement("div", { ...getLineProps({ line, key: i }) }, line.map((token, key) => /* @__PURE__ */ React.createElement("span", { ...getTokenProps({ token, key }) })))))
@@ -1,6 +1,5 @@
1
1
  /**
2
- * RegExps. A URL must match #1 and then at least one of #2/#3. Use two levels
3
- * of REs to avoid REDOS.
2
+ * RegExps. A URL must match #1 or #2 or #3 or #4.
4
3
  */
5
4
  /** Loosely validate a URL `string`. */
6
5
  export declare const isUrl: (string: any) => boolean;
@@ -19,6 +19,10 @@ export declare const FormWrapper: ({ header, children, id, }: {
19
19
  children: React.ReactNode;
20
20
  id: string;
21
21
  }) => React.JSX.Element;
22
+ /**
23
+ * @deprecated
24
+ * Original misspelt version of CreateBranchModal
25
+ */
22
26
  export declare const CreateBranchModel: ({ close, safeSubmit, relativePath, values, crudType, }: {
23
27
  safeSubmit: () => Promise<void>;
24
28
  close: () => void;
@@ -26,6 +30,13 @@ export declare const CreateBranchModel: ({ close, safeSubmit, relativePath, valu
26
30
  values: Record<string, unknown>;
27
31
  crudType: string;
28
32
  }) => React.JSX.Element;
33
+ export declare const CreateBranchModal: ({ close, safeSubmit, path, values, crudType, }: {
34
+ safeSubmit: () => Promise<void>;
35
+ close: () => void;
36
+ path: string;
37
+ values: Record<string, unknown>;
38
+ crudType: string;
39
+ }) => React.JSX.Element;
29
40
  export declare const PrefixedTextField: ({ prefix, ...props }: {
30
41
  [x: string]: any;
31
42
  prefix?: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tinacms",
3
- "version": "2.7.6",
3
+ "version": "2.7.8",
4
4
  "main": "dist/index.js",
5
5
  "module": "./dist/index.mjs",
6
6
  "exports": {
@@ -66,7 +66,7 @@
66
66
  "@graphql-inspector/core": "^6.2.1",
67
67
  "@headlessui/react": "2.1.8",
68
68
  "@heroicons/react": "^1.0.6",
69
- "@monaco-editor/react": "4.4.5",
69
+ "@monaco-editor/react": "4.7.0-rc.0",
70
70
  "@radix-ui/react-checkbox": "^1.1.4",
71
71
  "@radix-ui/react-dialog": "^1.1.6",
72
72
  "@radix-ui/react-dropdown-menu": "^2.1.6",
@@ -74,7 +74,7 @@
74
74
  "@radix-ui/react-separator": "^1.1.2",
75
75
  "@radix-ui/react-slot": "^1.1.2",
76
76
  "@radix-ui/react-toolbar": "^1.1.2",
77
- "@radix-ui/react-tooltip": "^1.1.8",
77
+ "@radix-ui/react-tooltip": "^1.2.6",
78
78
  "@react-hook/window-size": "^3.1.1",
79
79
  "@udecode/cn": "^33.0.0",
80
80
  "@udecode/plate": "^36.5.9",
@@ -129,9 +129,9 @@
129
129
  "webfontloader": "1.6.28",
130
130
  "yup": "^1.6.1",
131
131
  "zod": "^3.24.2",
132
- "@tinacms/mdx": "1.6.2",
133
- "@tinacms/search": "1.0.44",
134
- "@tinacms/schema-tools": "1.7.3"
132
+ "@tinacms/mdx": "1.6.3",
133
+ "@tinacms/search": "1.0.45",
134
+ "@tinacms/schema-tools": "1.7.4"
135
135
  },
136
136
  "devDependencies": {
137
137
  "@graphql-tools/utils": "^10.8.1",
@@ -164,7 +164,7 @@
164
164
  "typescript": "^5.7.3",
165
165
  "vite": "^5.4.14",
166
166
  "vitest": "^2.1.9",
167
- "@tinacms/scripts": "1.3.4"
167
+ "@tinacms/scripts": "1.3.5"
168
168
  },
169
169
  "peerDependencies": {
170
170
  "react": ">=16.14.0",