tinacms 0.66.1 → 0.66.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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,19 @@
1
1
  # tinacms
2
2
 
3
+ ## 0.66.2
4
+
5
+ ### Patch Changes
6
+
7
+ - 102628c7f: Fixes admin page wrapper scrolling
8
+ - 55cb0c5ec: Updates the relativePath field for clarity
9
+ - 9e77273d2: use collection name as fallback for label
10
+ - Updated dependencies [8c18edd5c]
11
+ - Updated dependencies [0773f6486]
12
+ - Updated dependencies [d8cd60f65]
13
+ - Updated dependencies [9e77273d2]
14
+ - Updated dependencies [63a74aece]
15
+ - @tinacms/toolkit@0.56.12
16
+
3
17
  ## 0.66.1
4
18
 
5
19
  ### Patch Changes
package/dist/index.es.js CHANGED
@@ -2763,7 +2763,7 @@ class ErrorBoundary extends React.Component {
2763
2763
  return { hasError: true, message: error.message };
2764
2764
  }
2765
2765
  render() {
2766
- const branchData = window.localStorage.getItem("tinacms-current-branch");
2766
+ const branchData = window.localStorage && window.localStorage.getItem("tinacms-current-branch");
2767
2767
  const hasBranchData = branchData && branchData.length > 0;
2768
2768
  if (this.state.hasError && !this.state.pageRefresh) {
2769
2769
  return /* @__PURE__ */ React.createElement("div", {
@@ -3204,7 +3204,7 @@ const Sidebar = ({ cms }) => {
3204
3204
  Icon: view.Icon ? view.Icon : ImFilesEmpty
3205
3205
  }),
3206
3206
  RenderNavCollection: ({ collection }) => /* @__PURE__ */ React.createElement(SidebarLink, {
3207
- label: collection.label,
3207
+ label: collection.label ? collection.label : collection.name,
3208
3208
  to: `collections/${collection.name}`,
3209
3209
  Icon: ImFilesEmpty
3210
3210
  })
@@ -3316,7 +3316,7 @@ const PageWrapper = ({
3316
3316
  children
3317
3317
  }) => {
3318
3318
  return /* @__PURE__ */ React.createElement("div", {
3319
- className: "relative left-0 w-full h-full bg-gray-50 shadow-2xl overflow-hidden transition-opacity duration-300 ease-out flex flex-col opacity-100"
3319
+ className: "relative left-0 w-full h-full bg-gray-50 shadow-2xl overflow-y-auto transition-opacity duration-300 ease-out flex flex-col opacity-100"
3320
3320
  }, children);
3321
3321
  };
3322
3322
  const PageHeader = ({
@@ -3423,7 +3423,7 @@ const CollectionListPage = () => {
3423
3423
  isLocalMode: (_b = (_a = cms == null ? void 0 : cms.api) == null ? void 0 : _a.tina) == null ? void 0 : _b.isLocalMode
3424
3424
  }, /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("h3", {
3425
3425
  className: "text-2xl text-gray-700"
3426
- }, collection.label), !collection.templates && /* @__PURE__ */ React.createElement(Link, {
3426
+ }, collection.label ? collection.label : collection.name), !collection.templates && /* @__PURE__ */ React.createElement(Link, {
3427
3427
  to: `new`,
3428
3428
  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 shadow text-white bg-blue-500 hover:bg-blue-600 focus:ring-blue-500 text-sm h-10 px-6"
3429
3429
  }, "Create New", " ", /* @__PURE__ */ React.createElement(BiPlus, {
@@ -3572,8 +3572,9 @@ const GetDocumentFields = ({
3572
3572
  };
3573
3573
  const createDocument = async (cms, collection, template, mutationInfo, values) => {
3574
3574
  const api = new TinaAdminApi(cms);
3575
- const _a = values, { relativePath } = _a, leftover = __objRest(_a, ["relativePath"]);
3575
+ const _a = values, { filename } = _a, leftover = __objRest(_a, ["filename"]);
3576
3576
  const { includeCollection, includeTemplate } = mutationInfo;
3577
+ const relativePath = `${filename}.${collection.format}`;
3577
3578
  const params = transformDocumentIntoMutationRequestPayload(__spreadValues(__spreadValues({
3578
3579
  _collection: collection.name
3579
3580
  }, template && { _template: template.name }), leftover), {
@@ -3606,11 +3607,23 @@ const RenderForm$1 = ({ cms, collection, template, fields, mutationInfo }) => {
3606
3607
  label: "form",
3607
3608
  fields: [
3608
3609
  {
3609
- name: "relativePath",
3610
- label: "Relative Path",
3610
+ name: "filename",
3611
+ label: "Filename",
3611
3612
  component: "text",
3612
- required: true,
3613
- defaultValue: `${collection.name}${Date.now()}.${collection.format}`
3613
+ description: `A unique filename for the content. Example: My_Document`,
3614
+ placeholder: `My_Document`,
3615
+ validate: (value, allValues, meta) => {
3616
+ if (!value) {
3617
+ if (meta.dirty) {
3618
+ return "Required";
3619
+ }
3620
+ return true;
3621
+ }
3622
+ const isValid = /^[_a-zA-Z][-,_a-zA-Z0-9]*$/.test(value);
3623
+ if (value && !isValid) {
3624
+ return "Must begin with a-z, A-Z, or _ and contain only a-z, A-Z, 0-9, - or _";
3625
+ }
3626
+ }
3614
3627
  },
3615
3628
  ...fields
3616
3629
  ],
@@ -3631,7 +3644,7 @@ const RenderForm$1 = ({ cms, collection, template, fields, mutationInfo }) => {
3631
3644
  }, /* @__PURE__ */ React.createElement(Link, {
3632
3645
  to: `/collections/${collection.name}`,
3633
3646
  className: "inline-block text-current hover:text-blue-400 focus:underline focus:outline-none focus:text-blue-400 font-medium transition-colors duration-150 ease-out"
3634
- }, collection.label), /* @__PURE__ */ React.createElement(HiChevronRight, {
3647
+ }, collection.label ? collection.label : collection.name), /* @__PURE__ */ React.createElement(HiChevronRight, {
3635
3648
  className: "inline-block -mt-0.5 opacity-50"
3636
3649
  })), /* @__PURE__ */ React.createElement("span", {
3637
3650
  className: "text-xl text-gray-700 font-medium leading-tight"
@@ -3730,7 +3743,7 @@ const RenderForm = ({
3730
3743
  }, /* @__PURE__ */ React.createElement(Link, {
3731
3744
  to: `/collections/${collection.name}`,
3732
3745
  className: "inline-block text-current hover:text-blue-400 focus:underline focus:outline-none focus:text-blue-400 font-medium transition-colors duration-150 ease-out"
3733
- }, collection.label), /* @__PURE__ */ React.createElement(HiChevronRight, {
3746
+ }, collection.label ? collection.label : collection.name), /* @__PURE__ */ React.createElement(HiChevronRight, {
3734
3747
  className: "inline-block -mt-0.5 opacity-50"
3735
3748
  })), /* @__PURE__ */ React.createElement("span", {
3736
3749
  className: "text-xl text-gray-700 font-medium leading-tight"
package/dist/index.js CHANGED
@@ -2783,7 +2783,7 @@ Document
2783
2783
  return { hasError: true, message: error.message };
2784
2784
  }
2785
2785
  render() {
2786
- const branchData = window.localStorage.getItem("tinacms-current-branch");
2786
+ const branchData = window.localStorage && window.localStorage.getItem("tinacms-current-branch");
2787
2787
  const hasBranchData = branchData && branchData.length > 0;
2788
2788
  if (this.state.hasError && !this.state.pageRefresh) {
2789
2789
  return /* @__PURE__ */ React__default["default"].createElement("div", {
@@ -3224,7 +3224,7 @@ This will work when developing locally but NOT when deployed to production.
3224
3224
  Icon: view.Icon ? view.Icon : ImFilesEmpty
3225
3225
  }),
3226
3226
  RenderNavCollection: ({ collection }) => /* @__PURE__ */ React__default["default"].createElement(SidebarLink, {
3227
- label: collection.label,
3227
+ label: collection.label ? collection.label : collection.name,
3228
3228
  to: `collections/${collection.name}`,
3229
3229
  Icon: ImFilesEmpty
3230
3230
  })
@@ -3336,7 +3336,7 @@ This will work when developing locally but NOT when deployed to production.
3336
3336
  children
3337
3337
  }) => {
3338
3338
  return /* @__PURE__ */ React__default["default"].createElement("div", {
3339
- className: "relative left-0 w-full h-full bg-gray-50 shadow-2xl overflow-hidden transition-opacity duration-300 ease-out flex flex-col opacity-100"
3339
+ className: "relative left-0 w-full h-full bg-gray-50 shadow-2xl overflow-y-auto transition-opacity duration-300 ease-out flex flex-col opacity-100"
3340
3340
  }, children);
3341
3341
  };
3342
3342
  const PageHeader = ({
@@ -3443,7 +3443,7 @@ This will work when developing locally but NOT when deployed to production.
3443
3443
  isLocalMode: (_b = (_a = cms == null ? void 0 : cms.api) == null ? void 0 : _a.tina) == null ? void 0 : _b.isLocalMode
3444
3444
  }, /* @__PURE__ */ React__default["default"].createElement(React__default["default"].Fragment, null, /* @__PURE__ */ React__default["default"].createElement("h3", {
3445
3445
  className: "text-2xl text-gray-700"
3446
- }, collection.label), !collection.templates && /* @__PURE__ */ React__default["default"].createElement(reactRouterDom.Link, {
3446
+ }, collection.label ? collection.label : collection.name), !collection.templates && /* @__PURE__ */ React__default["default"].createElement(reactRouterDom.Link, {
3447
3447
  to: `new`,
3448
3448
  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 shadow text-white bg-blue-500 hover:bg-blue-600 focus:ring-blue-500 text-sm h-10 px-6"
3449
3449
  }, "Create New", " ", /* @__PURE__ */ React__default["default"].createElement(BiPlus, {
@@ -3592,8 +3592,9 @@ This will work when developing locally but NOT when deployed to production.
3592
3592
  };
3593
3593
  const createDocument = async (cms, collection, template, mutationInfo, values) => {
3594
3594
  const api = new TinaAdminApi(cms);
3595
- const _a = values, { relativePath } = _a, leftover = __objRest(_a, ["relativePath"]);
3595
+ const _a = values, { filename } = _a, leftover = __objRest(_a, ["filename"]);
3596
3596
  const { includeCollection, includeTemplate } = mutationInfo;
3597
+ const relativePath = `${filename}.${collection.format}`;
3597
3598
  const params = transformDocumentIntoMutationRequestPayload(__spreadValues(__spreadValues({
3598
3599
  _collection: collection.name
3599
3600
  }, template && { _template: template.name }), leftover), {
@@ -3626,11 +3627,23 @@ This will work when developing locally but NOT when deployed to production.
3626
3627
  label: "form",
3627
3628
  fields: [
3628
3629
  {
3629
- name: "relativePath",
3630
- label: "Relative Path",
3630
+ name: "filename",
3631
+ label: "Filename",
3631
3632
  component: "text",
3632
- required: true,
3633
- defaultValue: `${collection.name}${Date.now()}.${collection.format}`
3633
+ description: `A unique filename for the content. Example: My_Document`,
3634
+ placeholder: `My_Document`,
3635
+ validate: (value, allValues, meta) => {
3636
+ if (!value) {
3637
+ if (meta.dirty) {
3638
+ return "Required";
3639
+ }
3640
+ return true;
3641
+ }
3642
+ const isValid = /^[_a-zA-Z][-,_a-zA-Z0-9]*$/.test(value);
3643
+ if (value && !isValid) {
3644
+ return "Must begin with a-z, A-Z, or _ and contain only a-z, A-Z, 0-9, - or _";
3645
+ }
3646
+ }
3634
3647
  },
3635
3648
  ...fields
3636
3649
  ],
@@ -3651,7 +3664,7 @@ This will work when developing locally but NOT when deployed to production.
3651
3664
  }, /* @__PURE__ */ React__default["default"].createElement(reactRouterDom.Link, {
3652
3665
  to: `/collections/${collection.name}`,
3653
3666
  className: "inline-block text-current hover:text-blue-400 focus:underline focus:outline-none focus:text-blue-400 font-medium transition-colors duration-150 ease-out"
3654
- }, collection.label), /* @__PURE__ */ React__default["default"].createElement(HiChevronRight, {
3667
+ }, collection.label ? collection.label : collection.name), /* @__PURE__ */ React__default["default"].createElement(HiChevronRight, {
3655
3668
  className: "inline-block -mt-0.5 opacity-50"
3656
3669
  })), /* @__PURE__ */ React__default["default"].createElement("span", {
3657
3670
  className: "text-xl text-gray-700 font-medium leading-tight"
@@ -3750,7 +3763,7 @@ This will work when developing locally but NOT when deployed to production.
3750
3763
  }, /* @__PURE__ */ React__default["default"].createElement(reactRouterDom.Link, {
3751
3764
  to: `/collections/${collection.name}`,
3752
3765
  className: "inline-block text-current hover:text-blue-400 focus:underline focus:outline-none focus:text-blue-400 font-medium transition-colors duration-150 ease-out"
3753
- }, collection.label), /* @__PURE__ */ React__default["default"].createElement(HiChevronRight, {
3766
+ }, collection.label ? collection.label : collection.name), /* @__PURE__ */ React__default["default"].createElement(HiChevronRight, {
3754
3767
  className: "inline-block -mt-0.5 opacity-50"
3755
3768
  })), /* @__PURE__ */ React__default["default"].createElement("span", {
3756
3769
  className: "text-xl text-gray-700 font-medium leading-tight"
@@ -70,6 +70,9 @@ declare type BaseComponents = {
70
70
  alt?: string;
71
71
  };
72
72
  hr?: {};
73
+ maybe_mdx?: {
74
+ children: JSX.Element;
75
+ };
73
76
  component_missing?: {
74
77
  name: string;
75
78
  };
@@ -113,7 +113,8 @@ const TinaMarkdown = ({
113
113
  }));
114
114
  case "code_block":
115
115
  const value = child.children.map((item) => {
116
- return item.children[0].text;
116
+ var _a2;
117
+ return ((_a2 = item.children[0]) == null ? void 0 : _a2.text) || "";
117
118
  }).join("\n");
118
119
  if (components[child.type]) {
119
120
  const Component2 = components[child.type];
@@ -160,6 +161,8 @@ const TinaMarkdown = ({
160
161
  throw new Error(`No component provided for ${child.name}`);
161
162
  }
162
163
  }
164
+ case "maybe_mdx":
165
+ return null;
163
166
  default:
164
167
  if (typeof child.text === "string") {
165
168
  return /* @__PURE__ */ React.createElement(Leaf, __spreadValues({
package/dist/rich-text.js CHANGED
@@ -120,7 +120,8 @@ var __objRest = (source, exclude) => {
120
120
  }));
121
121
  case "code_block":
122
122
  const value = child.children.map((item) => {
123
- return item.children[0].text;
123
+ var _a2;
124
+ return ((_a2 = item.children[0]) == null ? void 0 : _a2.text) || "";
124
125
  }).join("\n");
125
126
  if (components[child.type]) {
126
127
  const Component2 = components[child.type];
@@ -167,6 +168,8 @@ var __objRest = (source, exclude) => {
167
168
  throw new Error(`No component provided for ${child.name}`);
168
169
  }
169
170
  }
171
+ case "maybe_mdx":
172
+ return null;
170
173
  default:
171
174
  if (typeof child.text === "string") {
172
175
  return /* @__PURE__ */ React__default["default"].createElement(Leaf, __spreadValues({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tinacms",
3
- "version": "0.66.1",
3
+ "version": "0.66.2",
4
4
  "main": "dist/index.js",
5
5
  "files": [
6
6
  "dist"
@@ -24,7 +24,7 @@
24
24
  "@headlessui/react": "^1.4.1",
25
25
  "@heroicons/react": "^1.0.4",
26
26
  "@tinacms/sharedctx": "0.1.0",
27
- "@tinacms/toolkit": "0.56.11",
27
+ "@tinacms/toolkit": "0.56.12",
28
28
  "crypto-js": "^4.0.0",
29
29
  "final-form": "4.20.1",
30
30
  "graphql": "^15.1.0",