tinacms 1.2.0 → 1.2.1

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/dist/index.es.js CHANGED
@@ -1,4 +1,4 @@
1
- import { useCMS, Form, GlobalFormPlugin, EventBus, Modal, ModalPopup, ModalHeader, ModalBody, ModalActions, Button, LoadingDots, useLocalStorage, TinaCMS, BranchSwitcherPlugin, BranchDataProvider, TinaProvider, TinaMediaStore, DummyMediaStore, Nav, LocalWarning, BillingWarning, Select, Input, ReactDateTimeWithStyles, textFieldClasses, Toggle, OverflowMenu, CursorPaginator, PopupModal, BaseTextField, wrapFieldsWithMeta, FormStatus, FormBuilder } from "@tinacms/toolkit";
1
+ import { useCMS, Form, GlobalFormPlugin, EventBus, Modal, ModalPopup, ModalHeader, ModalBody, ModalActions, Button, LoadingDots, useLocalStorage, TinaCMS, BranchSwitcherPlugin, BranchDataProvider, TinaProvider, TinaMediaStore, DummyMediaStore, Nav, BranchBanner, LocalWarning, BillingWarning, Select, Input, ReactDateTimeWithStyles, textFieldClasses, Toggle, OverflowMenu, CursorPaginator, PopupModal, BaseTextField, wrapFieldsWithMeta, FormStatus, FormBuilder } from "@tinacms/toolkit";
2
2
  export * from "@tinacms/toolkit";
3
3
  export { MdxFieldPluginExtendible } from "@tinacms/toolkit";
4
4
  import * as G from "graphql";
@@ -2867,7 +2867,8 @@ const TinaCloudProvider = (props) => {
2867
2867
  if (branchingEnabled) {
2868
2868
  branchSwitcher = new BranchSwitcherPlugin({
2869
2869
  listBranches: handleListBranches,
2870
- createBranch: handleCreateBranch
2870
+ createBranch: handleCreateBranch,
2871
+ chooseBranch: setCurrentBranch
2871
2872
  });
2872
2873
  cms.plugins.add(branchSwitcher);
2873
2874
  }
@@ -3546,6 +3547,10 @@ var styles = `.tina-tailwind {
3546
3547
  --tw-border-opacity: 1;
3547
3548
  border-color: rgb(225 221 236 / var(--tw-border-opacity));
3548
3549
  }
3550
+ .tina-tailwind .border-gray-100 {
3551
+ --tw-border-opacity: 1;
3552
+ border-color: rgb(237 236 243 / var(--tw-border-opacity));
3553
+ }
3549
3554
  .tina-tailwind .bg-white {
3550
3555
  --tw-bg-opacity: 1;
3551
3556
  background-color: rgb(255 255 255 / var(--tw-bg-opacity));
@@ -3640,6 +3645,10 @@ var styles = `.tina-tailwind {
3640
3645
  padding-left: 12px;
3641
3646
  padding-right: 12px;
3642
3647
  }
3648
+ .tina-tailwind .py-3 {
3649
+ padding-top: 12px;
3650
+ padding-bottom: 12px;
3651
+ }
3643
3652
  .tina-tailwind .py-5 {
3644
3653
  padding-top: 20px;
3645
3654
  padding-bottom: 20px;
@@ -4876,20 +4885,33 @@ const LogoutPage = () => {
4876
4885
  const PageWrapper = ({
4877
4886
  children
4878
4887
  }) => {
4888
+ var _a, _b;
4889
+ const cms = useCMS();
4890
+ const isLocalMode = (_b = (_a = cms.api) == null ? void 0 : _a.tina) == null ? void 0 : _b.isLocalMode;
4891
+ const [branchingEnabled, setBranchingEnabled] = React.useState(() => cms.flags.get("branch-switcher"));
4892
+ React.useEffect(() => {
4893
+ cms.events.subscribe("flag:set", ({ key, value }) => {
4894
+ if (key === "branch-switcher") {
4895
+ setBranchingEnabled(value);
4896
+ }
4897
+ });
4898
+ }, [cms.events]);
4879
4899
  return /* @__PURE__ */ React.createElement("div", {
4880
4900
  className: "relative left-0 w-full h-full bg-gradient-to-b from-gray-50/50 to-gray-50 shadow-2xl overflow-y-auto transition-opacity duration-300 ease-out flex flex-col opacity-100"
4881
- }, children);
4901
+ }, branchingEnabled && !isLocalMode && /* @__PURE__ */ React.createElement(BranchBanner, null), children);
4882
4902
  };
4883
4903
  const PageHeader = ({
4884
4904
  isLocalMode,
4885
4905
  children
4886
- }) => /* @__PURE__ */ React.createElement(React.Fragment, null, isLocalMode && /* @__PURE__ */ React.createElement(LocalWarning, null), !isLocalMode && /* @__PURE__ */ React.createElement(BillingWarning, null), /* @__PURE__ */ React.createElement("div", {
4887
- className: "pt-12 px-12"
4888
- }, /* @__PURE__ */ React.createElement("div", {
4889
- className: "w-full mx-auto max-w-screen-xl"
4890
- }, /* @__PURE__ */ React.createElement("div", {
4891
- className: "w-full flex justify-between items-end"
4892
- }, children))));
4906
+ }) => {
4907
+ return /* @__PURE__ */ React.createElement(React.Fragment, null, isLocalMode && /* @__PURE__ */ React.createElement(LocalWarning, null), !isLocalMode && /* @__PURE__ */ React.createElement(BillingWarning, null), /* @__PURE__ */ React.createElement("div", {
4908
+ className: "pt-12 px-12"
4909
+ }, /* @__PURE__ */ React.createElement("div", {
4910
+ className: "w-full mx-auto max-w-screen-xl"
4911
+ }, /* @__PURE__ */ React.createElement("div", {
4912
+ className: "w-full flex justify-between items-end"
4913
+ }, children))));
4914
+ };
4893
4915
  const PageBody = ({
4894
4916
  children
4895
4917
  }) => /* @__PURE__ */ React.createElement("div", {
@@ -5175,7 +5197,7 @@ const CollectionListPage = () => {
5175
5197
  }
5176
5198
  }, (collection, _loading, reFetchCollection, collectionExtra) => {
5177
5199
  var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k;
5178
- const totalCount = collection.documents.totalCount;
5200
+ collection.documents.totalCount;
5179
5201
  const documents = collection.documents.edges;
5180
5202
  const admin = cms.api.admin;
5181
5203
  const pageInfo = collection.documents.pageInfo;
@@ -5284,7 +5306,7 @@ const CollectionListPage = () => {
5284
5306
  setSortOrder(val.order);
5285
5307
  }
5286
5308
  }
5287
- })), /* @__PURE__ */ React.createElement("div", {
5309
+ })), /* @__PURE__ */ React.createElement("form", {
5288
5310
  className: "flex flex-wrap gap-4 items-end"
5289
5311
  }, /* @__PURE__ */ React.createElement("div", {
5290
5312
  className: "flex flex-shrink-0 flex-col gap-2 items-start"
@@ -5315,6 +5337,9 @@ const CollectionListPage = () => {
5315
5337
  ...old,
5316
5338
  filterField: val
5317
5339
  }));
5340
+ if (!val) {
5341
+ reFetchCollection();
5342
+ }
5318
5343
  }
5319
5344
  }
5320
5345
  })), showStartsWith && /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("div", {
@@ -5403,7 +5428,8 @@ const CollectionListPage = () => {
5403
5428
  setPrevCursors([]);
5404
5429
  reFetchCollection();
5405
5430
  },
5406
- variant: "primary"
5431
+ variant: "primary",
5432
+ type: "submit"
5407
5433
  }, "Search", " ", /* @__PURE__ */ React.createElement(BiSearch, {
5408
5434
  className: "w-5 h-full ml-1.5 opacity-70"
5409
5435
  })), (vars.startsWith || vars.after || vars.before || vars.booleanEquals) && /* @__PURE__ */ React.createElement(Button, {
@@ -5433,7 +5459,7 @@ const CollectionListPage = () => {
5433
5459
  templates: collection.templates
5434
5460
  })))), /* @__PURE__ */ React.createElement(PageBody, null, /* @__PURE__ */ React.createElement("div", {
5435
5461
  className: "w-full mx-auto max-w-screen-xl"
5436
- }, totalCount > 0 && /* @__PURE__ */ React.createElement("table", {
5462
+ }, documents.length > 0 ? /* @__PURE__ */ React.createElement("table", {
5437
5463
  className: "table-auto shadow bg-white border-b border-gray-200 w-full max-w-full rounded-lg"
5438
5464
  }, /* @__PURE__ */ React.createElement("tbody", {
5439
5465
  className: "divide-y divide-gray-150"
@@ -5531,7 +5557,7 @@ const CollectionListPage = () => {
5531
5557
  }
5532
5558
  ].filter(Boolean)
5533
5559
  })));
5534
- }))), /* @__PURE__ */ React.createElement("div", {
5560
+ }))) : /* @__PURE__ */ React.createElement(NoDocumentsPlaceholder, null), /* @__PURE__ */ React.createElement("div", {
5535
5561
  className: "pt-4"
5536
5562
  }, /* @__PURE__ */ React.createElement(CursorPaginator, {
5537
5563
  variant: "white",
@@ -5554,6 +5580,13 @@ const CollectionListPage = () => {
5554
5580
  });
5555
5581
  });
5556
5582
  };
5583
+ const NoDocumentsPlaceholder = () => {
5584
+ return /* @__PURE__ */ React.createElement("div", {
5585
+ className: "text-center px-5 py-3 flex flex-col items-center justify-center shadow border border-gray-100 bg-gray-50 border-b border-gray-200 w-full max-w-full rounded-lg"
5586
+ }, /* @__PURE__ */ React.createElement("p", {
5587
+ className: "text-base italic font-medium text-gray-300"
5588
+ }, "No documents found."));
5589
+ };
5557
5590
  const DeleteModal = ({ close: close2, deleteFunc, filename }) => {
5558
5591
  return /* @__PURE__ */ React.createElement(Modal, null, /* @__PURE__ */ React.createElement(PopupModal, null, /* @__PURE__ */ React.createElement(ModalHeader, {
5559
5592
  close: close2
package/dist/index.js CHANGED
@@ -2883,7 +2883,8 @@ mutation addPendingDocumentMutation(
2883
2883
  if (branchingEnabled) {
2884
2884
  branchSwitcher = new toolkit.BranchSwitcherPlugin({
2885
2885
  listBranches: handleListBranches,
2886
- createBranch: handleCreateBranch
2886
+ createBranch: handleCreateBranch,
2887
+ chooseBranch: setCurrentBranch
2887
2888
  });
2888
2889
  cms.plugins.add(branchSwitcher);
2889
2890
  }
@@ -3562,6 +3563,10 @@ mutation addPendingDocumentMutation(
3562
3563
  --tw-border-opacity: 1;
3563
3564
  border-color: rgb(225 221 236 / var(--tw-border-opacity));
3564
3565
  }
3566
+ .tina-tailwind .border-gray-100 {
3567
+ --tw-border-opacity: 1;
3568
+ border-color: rgb(237 236 243 / var(--tw-border-opacity));
3569
+ }
3565
3570
  .tina-tailwind .bg-white {
3566
3571
  --tw-bg-opacity: 1;
3567
3572
  background-color: rgb(255 255 255 / var(--tw-bg-opacity));
@@ -3656,6 +3661,10 @@ mutation addPendingDocumentMutation(
3656
3661
  padding-left: 12px;
3657
3662
  padding-right: 12px;
3658
3663
  }
3664
+ .tina-tailwind .py-3 {
3665
+ padding-top: 12px;
3666
+ padding-bottom: 12px;
3667
+ }
3659
3668
  .tina-tailwind .py-5 {
3660
3669
  padding-top: 20px;
3661
3670
  padding-bottom: 20px;
@@ -4892,20 +4901,33 @@ This will work when developing locally but NOT when deployed to production.
4892
4901
  const PageWrapper = ({
4893
4902
  children
4894
4903
  }) => {
4904
+ var _a, _b;
4905
+ const cms = toolkit.useCMS();
4906
+ const isLocalMode = (_b = (_a = cms.api) == null ? void 0 : _a.tina) == null ? void 0 : _b.isLocalMode;
4907
+ const [branchingEnabled, setBranchingEnabled] = React__default["default"].useState(() => cms.flags.get("branch-switcher"));
4908
+ React__default["default"].useEffect(() => {
4909
+ cms.events.subscribe("flag:set", ({ key, value }) => {
4910
+ if (key === "branch-switcher") {
4911
+ setBranchingEnabled(value);
4912
+ }
4913
+ });
4914
+ }, [cms.events]);
4895
4915
  return /* @__PURE__ */ React__default["default"].createElement("div", {
4896
4916
  className: "relative left-0 w-full h-full bg-gradient-to-b from-gray-50/50 to-gray-50 shadow-2xl overflow-y-auto transition-opacity duration-300 ease-out flex flex-col opacity-100"
4897
- }, children);
4917
+ }, branchingEnabled && !isLocalMode && /* @__PURE__ */ React__default["default"].createElement(toolkit.BranchBanner, null), children);
4898
4918
  };
4899
4919
  const PageHeader = ({
4900
4920
  isLocalMode,
4901
4921
  children
4902
- }) => /* @__PURE__ */ React__default["default"].createElement(React__default["default"].Fragment, null, isLocalMode && /* @__PURE__ */ React__default["default"].createElement(toolkit.LocalWarning, null), !isLocalMode && /* @__PURE__ */ React__default["default"].createElement(toolkit.BillingWarning, null), /* @__PURE__ */ React__default["default"].createElement("div", {
4903
- className: "pt-12 px-12"
4904
- }, /* @__PURE__ */ React__default["default"].createElement("div", {
4905
- className: "w-full mx-auto max-w-screen-xl"
4906
- }, /* @__PURE__ */ React__default["default"].createElement("div", {
4907
- className: "w-full flex justify-between items-end"
4908
- }, children))));
4922
+ }) => {
4923
+ return /* @__PURE__ */ React__default["default"].createElement(React__default["default"].Fragment, null, isLocalMode && /* @__PURE__ */ React__default["default"].createElement(toolkit.LocalWarning, null), !isLocalMode && /* @__PURE__ */ React__default["default"].createElement(toolkit.BillingWarning, null), /* @__PURE__ */ React__default["default"].createElement("div", {
4924
+ className: "pt-12 px-12"
4925
+ }, /* @__PURE__ */ React__default["default"].createElement("div", {
4926
+ className: "w-full mx-auto max-w-screen-xl"
4927
+ }, /* @__PURE__ */ React__default["default"].createElement("div", {
4928
+ className: "w-full flex justify-between items-end"
4929
+ }, children))));
4930
+ };
4909
4931
  const PageBody = ({
4910
4932
  children
4911
4933
  }) => /* @__PURE__ */ React__default["default"].createElement("div", {
@@ -5191,7 +5213,7 @@ This will work when developing locally but NOT when deployed to production.
5191
5213
  }
5192
5214
  }, (collection, _loading, reFetchCollection, collectionExtra) => {
5193
5215
  var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k;
5194
- const totalCount = collection.documents.totalCount;
5216
+ collection.documents.totalCount;
5195
5217
  const documents = collection.documents.edges;
5196
5218
  const admin = cms.api.admin;
5197
5219
  const pageInfo = collection.documents.pageInfo;
@@ -5300,7 +5322,7 @@ This will work when developing locally but NOT when deployed to production.
5300
5322
  setSortOrder(val.order);
5301
5323
  }
5302
5324
  }
5303
- })), /* @__PURE__ */ React__default["default"].createElement("div", {
5325
+ })), /* @__PURE__ */ React__default["default"].createElement("form", {
5304
5326
  className: "flex flex-wrap gap-4 items-end"
5305
5327
  }, /* @__PURE__ */ React__default["default"].createElement("div", {
5306
5328
  className: "flex flex-shrink-0 flex-col gap-2 items-start"
@@ -5331,6 +5353,9 @@ This will work when developing locally but NOT when deployed to production.
5331
5353
  ...old,
5332
5354
  filterField: val
5333
5355
  }));
5356
+ if (!val) {
5357
+ reFetchCollection();
5358
+ }
5334
5359
  }
5335
5360
  }
5336
5361
  })), showStartsWith && /* @__PURE__ */ React__default["default"].createElement(React__default["default"].Fragment, null, /* @__PURE__ */ React__default["default"].createElement("div", {
@@ -5419,7 +5444,8 @@ This will work when developing locally but NOT when deployed to production.
5419
5444
  setPrevCursors([]);
5420
5445
  reFetchCollection();
5421
5446
  },
5422
- variant: "primary"
5447
+ variant: "primary",
5448
+ type: "submit"
5423
5449
  }, "Search", " ", /* @__PURE__ */ React__default["default"].createElement(BiSearch, {
5424
5450
  className: "w-5 h-full ml-1.5 opacity-70"
5425
5451
  })), (vars.startsWith || vars.after || vars.before || vars.booleanEquals) && /* @__PURE__ */ React__default["default"].createElement(toolkit.Button, {
@@ -5449,7 +5475,7 @@ This will work when developing locally but NOT when deployed to production.
5449
5475
  templates: collection.templates
5450
5476
  })))), /* @__PURE__ */ React__default["default"].createElement(PageBody, null, /* @__PURE__ */ React__default["default"].createElement("div", {
5451
5477
  className: "w-full mx-auto max-w-screen-xl"
5452
- }, totalCount > 0 && /* @__PURE__ */ React__default["default"].createElement("table", {
5478
+ }, documents.length > 0 ? /* @__PURE__ */ React__default["default"].createElement("table", {
5453
5479
  className: "table-auto shadow bg-white border-b border-gray-200 w-full max-w-full rounded-lg"
5454
5480
  }, /* @__PURE__ */ React__default["default"].createElement("tbody", {
5455
5481
  className: "divide-y divide-gray-150"
@@ -5547,7 +5573,7 @@ This will work when developing locally but NOT when deployed to production.
5547
5573
  }
5548
5574
  ].filter(Boolean)
5549
5575
  })));
5550
- }))), /* @__PURE__ */ React__default["default"].createElement("div", {
5576
+ }))) : /* @__PURE__ */ React__default["default"].createElement(NoDocumentsPlaceholder, null), /* @__PURE__ */ React__default["default"].createElement("div", {
5551
5577
  className: "pt-4"
5552
5578
  }, /* @__PURE__ */ React__default["default"].createElement(toolkit.CursorPaginator, {
5553
5579
  variant: "white",
@@ -5570,6 +5596,13 @@ This will work when developing locally but NOT when deployed to production.
5570
5596
  });
5571
5597
  });
5572
5598
  };
5599
+ const NoDocumentsPlaceholder = () => {
5600
+ return /* @__PURE__ */ React__default["default"].createElement("div", {
5601
+ className: "text-center px-5 py-3 flex flex-col items-center justify-center shadow border border-gray-100 bg-gray-50 border-b border-gray-200 w-full max-w-full rounded-lg"
5602
+ }, /* @__PURE__ */ React__default["default"].createElement("p", {
5603
+ className: "text-base italic font-medium text-gray-300"
5604
+ }, "No documents found."));
5605
+ };
5573
5606
  const DeleteModal = ({ close: close2, deleteFunc, filename }) => {
5574
5607
  return /* @__PURE__ */ React__default["default"].createElement(toolkit.Modal, null, /* @__PURE__ */ React__default["default"].createElement(toolkit.PopupModal, null, /* @__PURE__ */ React__default["default"].createElement(toolkit.ModalHeader, {
5575
5608
  close: close2
package/dist/style.css CHANGED
@@ -649,6 +649,10 @@
649
649
  --tw-border-opacity: 1;
650
650
  border-color: rgb(225 221 236 / var(--tw-border-opacity));
651
651
  }
652
+ .tina-tailwind .border-gray-100 {
653
+ --tw-border-opacity: 1;
654
+ border-color: rgb(237 236 243 / var(--tw-border-opacity));
655
+ }
652
656
  .tina-tailwind .bg-white {
653
657
  --tw-bg-opacity: 1;
654
658
  background-color: rgb(255 255 255 / var(--tw-bg-opacity));
@@ -743,6 +747,10 @@
743
747
  padding-left: 12px;
744
748
  padding-right: 12px;
745
749
  }
750
+ .tina-tailwind .py-3 {
751
+ padding-top: 12px;
752
+ padding-bottom: 12px;
753
+ }
746
754
  .tina-tailwind .py-5 {
747
755
  padding-top: 20px;
748
756
  padding-bottom: 20px;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tinacms",
3
- "version": "1.2.0",
3
+ "version": "1.2.1",
4
4
  "main": "dist/index.js",
5
5
  "module": "./dist/index.es.js",
6
6
  "exports": {
@@ -55,9 +55,9 @@
55
55
  "@headlessui/react": "^1.5.0",
56
56
  "@heroicons/react": "^1.0.4",
57
57
  "@react-hook/window-size": "^3.0.7",
58
- "@tinacms/schema-tools": "1.3.0",
58
+ "@tinacms/schema-tools": "1.3.1",
59
59
  "@tinacms/sharedctx": "1.0.1",
60
- "@tinacms/toolkit": "1.3.2",
60
+ "@tinacms/toolkit": "1.3.3",
61
61
  "crypto-js": "^4.0.0",
62
62
  "encoding": "0.1.13",
63
63
  "fetch-ponyfill": "^7.1.0",