tinacms 1.1.5 → 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.
Files changed (58) hide show
  1. package/LICENSE +8 -0
  2. package/dist/admin/api.d.ts +9 -11
  3. package/dist/admin/components/AuthTemplate.d.ts +2 -10
  4. package/dist/admin/components/GetCMS.d.ts +2 -10
  5. package/dist/admin/components/GetCollection.d.ts +6 -12
  6. package/dist/admin/components/GetCollections.d.ts +2 -10
  7. package/dist/admin/components/GetDocument.d.ts +2 -10
  8. package/dist/admin/components/Layout.d.ts +2 -10
  9. package/dist/admin/components/LoadingPage.d.ts +2 -10
  10. package/dist/admin/components/Page.d.ts +1 -10
  11. package/dist/admin/components/Sidebar.d.ts +2 -10
  12. package/dist/admin/index.d.ts +2 -10
  13. package/dist/admin/pages/CollectionCreatePage.d.ts +2 -10
  14. package/dist/admin/pages/CollectionListPage.d.ts +2 -10
  15. package/dist/admin/pages/CollectionUpdatePage.d.ts +2 -10
  16. package/dist/admin/pages/DashboardPage.d.ts +2 -10
  17. package/dist/admin/pages/LoginPage.d.ts +2 -10
  18. package/dist/admin/pages/LogoutPage.d.ts +2 -10
  19. package/dist/admin/pages/ScreenPage.d.ts +2 -10
  20. package/dist/admin/plugins/route-mapping.d.ts +1 -10
  21. package/dist/admin/types.d.ts +1 -10
  22. package/dist/auth/AuthModal.d.ts +2 -10
  23. package/dist/auth/TinaCloudProvider.d.ts +1 -10
  24. package/dist/auth/authenticate.d.ts +3 -12
  25. package/dist/auth/index.d.ts +1 -10
  26. package/dist/auth/popupWindow.d.ts +1 -10
  27. package/dist/auth/useGenerator.d.ts +1 -10
  28. package/dist/auth/useTinaAuthRedirect.d.ts +1 -10
  29. package/dist/client.d.ts +1 -10
  30. package/dist/client.es.js +1 -29
  31. package/dist/client.js +3 -31
  32. package/dist/edit-state.d.ts +1 -10
  33. package/dist/hooks/create-page-plugin.d.ts +1 -10
  34. package/dist/hooks/formify/formify-utils.d.ts +1 -10
  35. package/dist/hooks/formify/formify.d.ts +1 -10
  36. package/dist/hooks/formify/index.d.ts +1 -10
  37. package/dist/hooks/formify/reducer.d.ts +1 -10
  38. package/dist/hooks/formify/spec/runner.d.ts +1 -10
  39. package/dist/hooks/formify/spec/util.d.ts +1 -10
  40. package/dist/hooks/formify/types.d.ts +1 -10
  41. package/dist/hooks/formify/util.d.ts +1 -10
  42. package/dist/hooks/use-content-creator.d.ts +1 -10
  43. package/dist/hooks/use-graphql-forms.d.ts +1 -10
  44. package/dist/index.d.ts +1 -10
  45. package/dist/index.es.js +369 -87
  46. package/dist/index.js +370 -88
  47. package/dist/internalClient/formify.d.ts +1 -10
  48. package/dist/internalClient/index.d.ts +2 -13
  49. package/dist/rich-text/index.d.ts +2 -10
  50. package/dist/rich-text/prism.d.ts +2 -10
  51. package/dist/style.css +46 -8
  52. package/dist/tina-cms.d.ts +2 -10
  53. package/dist/types/cms.d.ts +1 -10
  54. package/dist/unifiedClient/index.d.ts +1 -11
  55. package/dist/utils/client.d.ts +1 -10
  56. package/dist/utils/index.d.ts +1 -10
  57. package/package.json +5 -6
  58. package/dist/utils/parseUrl.d.ts +0 -18
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  (function(global, factory) {
2
- typeof exports === "object" && typeof module !== "undefined" ? factory(exports, require("@tinacms/toolkit"), require("graphql"), require("lodash.set"), require("react"), require("final-form"), require("@tinacms/schema-tools"), require("graphql-tag"), require("yup"), require("@tinacms/sharedctx"), require("url-pattern"), require("react-router-dom"), require("@headlessui/react"), require("@react-hook/window-size")) : typeof define === "function" && define.amd ? define(["exports", "@tinacms/toolkit", "graphql", "lodash.set", "react", "final-form", "@tinacms/schema-tools", "graphql-tag", "yup", "@tinacms/sharedctx", "url-pattern", "react-router-dom", "@headlessui/react", "@react-hook/window-size"], 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));
3
- })(this, function(exports2, toolkit, G, set, React, finalForm, schemaTools, gql$1, yup, sharedctx, UrlPattern, reactRouterDom, react, windowSize) {
2
+ typeof exports === "object" && typeof module !== "undefined" ? factory(exports, require("@tinacms/toolkit"), require("graphql"), require("lodash.set"), require("react"), require("final-form"), require("@tinacms/schema-tools"), require("graphql-tag"), require("yup"), require("@tinacms/sharedctx"), require("react-router-dom"), require("@headlessui/react"), require("@react-hook/window-size")) : typeof define === "function" && define.amd ? define(["exports", "@tinacms/toolkit", "graphql", "lodash.set", "react", "final-form", "@tinacms/schema-tools", "graphql-tag", "yup", "@tinacms/sharedctx", "react-router-dom", "@headlessui/react", "@react-hook/window-size"], 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));
3
+ })(this, function(exports2, toolkit, G, set, React, finalForm, schemaTools, gql$1, yup, sharedctx, reactRouterDom, react, windowSize) {
4
4
  "use strict";
5
5
  function _interopDefaultLegacy(e) {
6
6
  return e && typeof e === "object" && "default" in e ? e : { "default": e };
@@ -30,7 +30,6 @@
30
30
  var React__default = /* @__PURE__ */ _interopDefaultLegacy(React);
31
31
  var gql__default = /* @__PURE__ */ _interopDefaultLegacy(gql$1);
32
32
  var yup__namespace = /* @__PURE__ */ _interopNamespace(yup);
33
- var UrlPattern__default = /* @__PURE__ */ _interopDefaultLegacy(UrlPattern);
34
33
  function popupWindow(url, title, window2, w, h) {
35
34
  const y = window2.top.outerHeight / 2 + window2.top.screenY - h / 2;
36
35
  const x = window2.top.outerWidth / 2 + window2.top.screenX - w / 2;
@@ -2133,7 +2132,7 @@
2133
2132
  };
2134
2133
  class Client {
2135
2134
  constructor({ tokenStorage = "MEMORY", ...options }) {
2136
- var _a, _b, _c, _d, _e, _f, _g, _h;
2135
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _A, _B, _C, _D, _E, _F, _G, _H, _I, _J, _K, _L, _M, _N, _O, _P;
2137
2136
  this.events = new toolkit.EventBus();
2138
2137
  this.addPendingContent = async (props) => {
2139
2138
  const mutation = `#graphql
@@ -2183,6 +2182,15 @@ mutation addPendingDocumentMutation(
2183
2182
  };
2184
2183
  this.onLogin = (_d = (_c = (_b = (_a = options.schema) == null ? void 0 : _a.config) == null ? void 0 : _b.admin) == null ? void 0 : _c.auth) == null ? void 0 : _d.onLogin;
2185
2184
  this.onLogout = (_h = (_g = (_f = (_e = options.schema) == null ? void 0 : _e.config) == null ? void 0 : _f.admin) == null ? void 0 : _g.auth) == null ? void 0 : _h.onLogout;
2185
+ if ((_l = (_k = (_j = (_i = options.schema) == null ? void 0 : _i.config) == null ? void 0 : _j.admin) == null ? void 0 : _k.auth) == null ? void 0 : _l.logout) {
2186
+ this.onLogout = (_p = (_o = (_n = (_m = options.schema) == null ? void 0 : _m.config) == null ? void 0 : _n.admin) == null ? void 0 : _o.auth) == null ? void 0 : _p.logout;
2187
+ }
2188
+ if ((_t = (_s = (_r = (_q = options.schema) == null ? void 0 : _q.config) == null ? void 0 : _r.admin) == null ? void 0 : _s.auth) == null ? void 0 : _t.getUser) {
2189
+ this.getUser = (_x = (_w = (_v = (_u = options.schema) == null ? void 0 : _u.config) == null ? void 0 : _v.admin) == null ? void 0 : _w.auth) == null ? void 0 : _x.getUser;
2190
+ }
2191
+ if ((_B = (_A = (_z = (_y = options.schema) == null ? void 0 : _y.config) == null ? void 0 : _z.admin) == null ? void 0 : _A.auth) == null ? void 0 : _B.authenticate) {
2192
+ this.authenticate = (_F = (_E = (_D = (_C = options.schema) == null ? void 0 : _C.config) == null ? void 0 : _D.admin) == null ? void 0 : _E.auth) == null ? void 0 : _F.authenticate;
2193
+ }
2186
2194
  if (options.schema) {
2187
2195
  const enrichedSchema = new schemaTools.TinaSchema({
2188
2196
  version: { fullVersion: "", major: "", minor: "", patch: "" },
@@ -2192,6 +2200,9 @@ mutation addPendingDocumentMutation(
2192
2200
  this.schema = enrichedSchema;
2193
2201
  }
2194
2202
  this.options = options;
2203
+ if ((_H = (_G = options.schema) == null ? void 0 : _G.config) == null ? void 0 : _H.contentApiUrlOverride) {
2204
+ this.options.customContentApiUrl = options.schema.config.contentApiUrlOverride;
2205
+ }
2195
2206
  this.setBranch(options.branch);
2196
2207
  this.events.subscribe("branch:change", ({ branchName }) => {
2197
2208
  this.setBranch(branchName);
@@ -2238,6 +2249,9 @@ mutation addPendingDocumentMutation(
2238
2249
  this.getToken = options.getTokenFn;
2239
2250
  break;
2240
2251
  }
2252
+ if ((_L = (_K = (_J = (_I = options.schema) == null ? void 0 : _I.config) == null ? void 0 : _J.admin) == null ? void 0 : _K.auth) == null ? void 0 : _L.getToken) {
2253
+ this.getToken = (_P = (_O = (_N = (_M = options.schema) == null ? void 0 : _M.config) == null ? void 0 : _N.admin) == null ? void 0 : _O.auth) == null ? void 0 : _P.getToken;
2254
+ }
2241
2255
  }
2242
2256
  get isLocalMode() {
2243
2257
  return false;
@@ -2482,10 +2496,7 @@ mutation addPendingDocumentMutation(
2482
2496
  localStorage.setItem(LOCAL_CLIENT_KEY, "true");
2483
2497
  return { access_token: "LOCAL", id_token: "LOCAL", refresh_token: "LOCAL" };
2484
2498
  }
2485
- async isAuthorized() {
2486
- return localStorage.getItem(LOCAL_CLIENT_KEY) === "true";
2487
- }
2488
- async isAuthenticated() {
2499
+ async getUser() {
2489
2500
  return localStorage.getItem(LOCAL_CLIENT_KEY) === "true";
2490
2501
  }
2491
2502
  }
@@ -2566,17 +2577,50 @@ mutation addPendingDocumentMutation(
2566
2577
  }
2567
2578
  }`, { variables: { collection, relativePath } });
2568
2579
  }
2569
- async fetchCollection(collectionName, includeDocuments, after, sortKey, order) {
2580
+ async fetchCollection(collectionName, includeDocuments, after, sortKey, order, filterArgs) {
2581
+ let filter = null;
2582
+ const filterField = filterArgs == null ? void 0 : filterArgs.filterField;
2583
+ if (filterField) {
2584
+ filter = {
2585
+ [collectionName]: {
2586
+ [filterField]: {}
2587
+ }
2588
+ };
2589
+ }
2590
+ if (filterField && (filterArgs == null ? void 0 : filterArgs.startsWith)) {
2591
+ filter[collectionName][filterField] = {
2592
+ ...filter[collectionName][filterField] || {},
2593
+ startsWith: filterArgs.startsWith
2594
+ };
2595
+ }
2596
+ if (filterField && (filterArgs == null ? void 0 : filterArgs.before)) {
2597
+ filter[collectionName][filterField] = {
2598
+ ...filter[collectionName][filterField] || {},
2599
+ before: filterArgs.before
2600
+ };
2601
+ }
2602
+ if (filterField && (filterArgs == null ? void 0 : filterArgs.after)) {
2603
+ filter[collectionName][filterField] = {
2604
+ ...filter[collectionName][filterField] || {},
2605
+ after: filterArgs.after
2606
+ };
2607
+ }
2608
+ if (filterField && (filterArgs == null ? void 0 : filterArgs.booleanEquals) !== null && (filterArgs == null ? void 0 : filterArgs.booleanEquals) !== void 0) {
2609
+ filter[collectionName][filterField] = {
2610
+ ...filter[collectionName][filterField] || {},
2611
+ eq: filterArgs.booleanEquals
2612
+ };
2613
+ }
2570
2614
  if (includeDocuments === true) {
2571
2615
  const sort = sortKey || this.schema.getIsTitleFieldName(collectionName);
2572
2616
  const response = order === "asc" ? await this.api.request(`#graphql
2573
- query($collection: String!, $includeDocuments: Boolean!, $sort: String, $limit: Float, $after: String){
2617
+ query($collection: String!, $includeDocuments: Boolean!, $sort: String, $limit: Float, $after: String, $filter: DocumentFilter){
2574
2618
  collection(collection: $collection){
2575
2619
  name
2576
2620
  label
2577
2621
  format
2578
2622
  templates
2579
- documents(sort: $sort, after: $after, first: $limit) @include(if: $includeDocuments) {
2623
+ documents(sort: $sort, after: $after, first: $limit, filter: $filter) @include(if: $includeDocuments) {
2580
2624
  totalCount
2581
2625
  pageInfo {
2582
2626
  hasPreviousPage
@@ -2608,16 +2652,17 @@ mutation addPendingDocumentMutation(
2608
2652
  includeDocuments,
2609
2653
  sort,
2610
2654
  limit: 50,
2611
- after
2655
+ after,
2656
+ filter
2612
2657
  }
2613
2658
  }) : await this.api.request(`#graphql
2614
- query($collection: String!, $includeDocuments: Boolean!, $sort: String, $limit: Float, $after: String){
2659
+ query($collection: String!, $includeDocuments: Boolean!, $sort: String, $limit: Float, $after: String, $filter: DocumentFilter){
2615
2660
  collection(collection: $collection){
2616
2661
  name
2617
2662
  label
2618
2663
  format
2619
2664
  templates
2620
- documents(sort: $sort, before: $after, last: $limit) @include(if: $includeDocuments) {
2665
+ documents(sort: $sort, before: $after, last: $limit, filter: $filter) @include(if: $includeDocuments) {
2621
2666
  totalCount
2622
2667
  pageInfo {
2623
2668
  hasPreviousPage
@@ -2649,7 +2694,8 @@ mutation addPendingDocumentMutation(
2649
2694
  includeDocuments,
2650
2695
  sort,
2651
2696
  limit: 50,
2652
- after
2697
+ after,
2698
+ filter
2653
2699
  }
2654
2700
  });
2655
2701
  return response.collection;
@@ -2718,8 +2764,9 @@ mutation addPendingDocumentMutation(
2718
2764
  loginScreen,
2719
2765
  getModalActions
2720
2766
  }) => {
2767
+ var _a, _b, _c, _d, _e;
2721
2768
  const client = cms.api.tina;
2722
- const isLocal = client.isLocalMode;
2769
+ const isTinaCloud = !client.isLocalMode && !((_e = (_d = (_c = (_b = (_a = client.schema) == null ? void 0 : _a.config) == null ? void 0 : _b.config) == null ? void 0 : _c.admin) == null ? void 0 : _d.auth) == null ? void 0 : _e.customAuth);
2723
2770
  const [activeModal, setActiveModal] = React.useState(null);
2724
2771
  const [showChildren, setShowChildren] = React.useState(false);
2725
2772
  React__default["default"].useEffect(() => {
@@ -2748,8 +2795,8 @@ mutation addPendingDocumentMutation(
2748
2795
  }
2749
2796
  }) : [];
2750
2797
  return /* @__PURE__ */ React__default["default"].createElement(React__default["default"].Fragment, null, activeModal === "authenticate" && /* @__PURE__ */ React__default["default"].createElement(ModalBuilder, {
2751
- title: isLocal ? "Enter into edit mode" : "Tina Cloud Authorization",
2752
- message: isLocal ? "To save edits, enter into edit mode. On save, changes will saved to the local filesystem." : "To save edits, Tina Cloud authorization is required. On save, changes will get commited using your account.",
2798
+ title: isTinaCloud ? "Tina Cloud Authorization" : "Enter into edit mode",
2799
+ message: isTinaCloud ? "To save edits, Tina Cloud authorization is required. On save, changes will get commited using your account." : "To save edits, enter into edit mode. On save, changes will saved to the local filesystem.",
2753
2800
  close,
2754
2801
  actions: [
2755
2802
  ...otherModalActions,
@@ -2762,7 +2809,7 @@ mutation addPendingDocumentMutation(
2762
2809
  primary: false
2763
2810
  },
2764
2811
  {
2765
- name: isLocal ? "Enter Edit Mode" : "Continue to Tina Cloud",
2812
+ name: isTinaCloud ? "Continue to Tina Cloud" : "Enter Edit Mode",
2766
2813
  action: async () => {
2767
2814
  const token = await client.authenticate();
2768
2815
  if (typeof (client == null ? void 0 : client.onLogin) === "function") {
@@ -2836,7 +2883,8 @@ mutation addPendingDocumentMutation(
2836
2883
  if (branchingEnabled) {
2837
2884
  branchSwitcher = new toolkit.BranchSwitcherPlugin({
2838
2885
  listBranches: handleListBranches,
2839
- createBranch: handleCreateBranch
2886
+ createBranch: handleCreateBranch,
2887
+ chooseBranch: setCurrentBranch
2840
2888
  });
2841
2889
  cms.plugins.add(branchSwitcher);
2842
2890
  }
@@ -3265,6 +3313,9 @@ mutation addPendingDocumentMutation(
3265
3313
  .tina-tailwind .mt-2 {
3266
3314
  margin-top: 8px;
3267
3315
  }
3316
+ .tina-tailwind .ml-1\\.5 {
3317
+ margin-left: 6px;
3318
+ }
3268
3319
  .tina-tailwind .mb-4 {
3269
3320
  margin-bottom: 16px;
3270
3321
  }
@@ -3292,6 +3343,9 @@ mutation addPendingDocumentMutation(
3292
3343
  .tina-tailwind .table {
3293
3344
  display: table;
3294
3345
  }
3346
+ .tina-tailwind .grid {
3347
+ display: grid;
3348
+ }
3295
3349
  .tina-tailwind .h-screen {
3296
3350
  height: 100vh;
3297
3351
  }
@@ -3402,9 +3456,18 @@ mutation addPendingDocumentMutation(
3402
3456
  .tina-tailwind .cursor-pointer {
3403
3457
  cursor: pointer;
3404
3458
  }
3459
+ .tina-tailwind .grid-flow-col {
3460
+ grid-auto-flow: column;
3461
+ }
3405
3462
  .tina-tailwind .flex-col {
3406
3463
  flex-direction: column;
3407
3464
  }
3465
+ .tina-tailwind .flex-wrap {
3466
+ flex-wrap: wrap;
3467
+ }
3468
+ .tina-tailwind .items-start {
3469
+ align-items: flex-start;
3470
+ }
3408
3471
  .tina-tailwind .items-end {
3409
3472
  align-items: flex-end;
3410
3473
  }
@@ -3447,6 +3510,12 @@ mutation addPendingDocumentMutation(
3447
3510
  --tw-divide-opacity: 1;
3448
3511
  border-color: rgb(230 227 239 / var(--tw-divide-opacity));
3449
3512
  }
3513
+ .tina-tailwind .self-end {
3514
+ align-self: flex-end;
3515
+ }
3516
+ .tina-tailwind .justify-self-end {
3517
+ justify-self: end;
3518
+ }
3450
3519
  .tina-tailwind .overflow-hidden {
3451
3520
  overflow: hidden;
3452
3521
  }
@@ -3461,6 +3530,9 @@ mutation addPendingDocumentMutation(
3461
3530
  .tina-tailwind .whitespace-normal {
3462
3531
  white-space: normal;
3463
3532
  }
3533
+ .tina-tailwind .whitespace-nowrap {
3534
+ white-space: nowrap;
3535
+ }
3464
3536
  .tina-tailwind .rounded-lg {
3465
3537
  border-radius: 8px;
3466
3538
  }
@@ -3491,6 +3563,10 @@ mutation addPendingDocumentMutation(
3491
3563
  --tw-border-opacity: 1;
3492
3564
  border-color: rgb(225 221 236 / var(--tw-border-opacity));
3493
3565
  }
3566
+ .tina-tailwind .border-gray-100 {
3567
+ --tw-border-opacity: 1;
3568
+ border-color: rgb(237 236 243 / var(--tw-border-opacity));
3569
+ }
3494
3570
  .tina-tailwind .bg-white {
3495
3571
  --tw-bg-opacity: 1;
3496
3572
  background-color: rgb(255 255 255 / var(--tw-bg-opacity));
@@ -3514,6 +3590,11 @@ mutation addPendingDocumentMutation(
3514
3590
  --tw-gradient-to: rgb(29 44 108 / 0);
3515
3591
  --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to);
3516
3592
  }
3593
+ .tina-tailwind .from-gray-50\\/50 {
3594
+ --tw-gradient-from: rgb(246 246 249 / .5);
3595
+ --tw-gradient-to: rgb(246 246 249 / 0);
3596
+ --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to);
3597
+ }
3517
3598
  .tina-tailwind .from-gray-800 {
3518
3599
  --tw-gradient-from: #363145;
3519
3600
  --tw-gradient-to: rgb(54 49 69 / 0);
@@ -3526,6 +3607,9 @@ mutation addPendingDocumentMutation(
3526
3607
  .tina-tailwind .to-gray-900 {
3527
3608
  --tw-gradient-to: #252336;
3528
3609
  }
3610
+ .tina-tailwind .to-gray-50 {
3611
+ --tw-gradient-to: #F6F6F9;
3612
+ }
3529
3613
  .tina-tailwind .to-black {
3530
3614
  --tw-gradient-to: #000;
3531
3615
  }
@@ -3549,6 +3633,10 @@ mutation addPendingDocumentMutation(
3549
3633
  padding-left: 48px;
3550
3634
  padding-right: 48px;
3551
3635
  }
3636
+ .tina-tailwind .py-8 {
3637
+ padding-top: 32px;
3638
+ padding-bottom: 32px;
3639
+ }
3552
3640
  .tina-tailwind .py-10 {
3553
3641
  padding-top: 40px;
3554
3642
  padding-bottom: 40px;
@@ -3573,6 +3661,10 @@ mutation addPendingDocumentMutation(
3573
3661
  padding-left: 12px;
3574
3662
  padding-right: 12px;
3575
3663
  }
3664
+ .tina-tailwind .py-3 {
3665
+ padding-top: 12px;
3666
+ padding-bottom: 12px;
3667
+ }
3576
3668
  .tina-tailwind .py-5 {
3577
3669
  padding-top: 20px;
3578
3670
  padding-bottom: 20px;
@@ -3580,11 +3672,8 @@ mutation addPendingDocumentMutation(
3580
3672
  .tina-tailwind .pt-4 {
3581
3673
  padding-top: 16px;
3582
3674
  }
3583
- .tina-tailwind .pb-4 {
3584
- padding-bottom: 16px;
3585
- }
3586
- .tina-tailwind .pt-16 {
3587
- padding-top: 64px;
3675
+ .tina-tailwind .pt-12 {
3676
+ padding-top: 48px;
3588
3677
  }
3589
3678
  .tina-tailwind .pr-3 {
3590
3679
  padding-right: 12px;
@@ -3598,9 +3687,6 @@ mutation addPendingDocumentMutation(
3598
3687
  .tina-tailwind .pl-5 {
3599
3688
  padding-left: 20px;
3600
3689
  }
3601
- .tina-tailwind .pt-3 {
3602
- padding-top: 12px;
3603
- }
3604
3690
  .tina-tailwind .pl-18 {
3605
3691
  padding-left: 72px;
3606
3692
  }
@@ -4092,26 +4178,6 @@ mutation addPendingDocumentMutation(
4092
4178
  isLoading
4093
4179
  };
4094
4180
  }
4095
- const parseURL = (url) => {
4096
- if (url.includes("localhost")) {
4097
- return { branch: null, isLocalClient: true, clientId: null };
4098
- }
4099
- const params = new URL(url);
4100
- const pattern = new UrlPattern__default["default"]("/content/:clientId/github/*", {
4101
- escapeChar: " "
4102
- });
4103
- const result = pattern.match(params.pathname);
4104
- const branch = result == null ? void 0 : result._;
4105
- const clientId = result == null ? void 0 : result.clientId;
4106
- if (!branch || !clientId) {
4107
- throw new Error(`Invalid URL format provided. Expected: https://content.tinajs.io/content/<ClientID>/github/<Branch> but but received ${url}`);
4108
- }
4109
- return {
4110
- branch,
4111
- clientId,
4112
- isLocalClient: false
4113
- };
4114
- };
4115
4181
  const errorButtonStyles = {
4116
4182
  background: "#eb6337",
4117
4183
  padding: "12px 18px",
@@ -4198,7 +4264,7 @@ mutation addPendingDocumentMutation(
4198
4264
  schema,
4199
4265
  ...props
4200
4266
  }) => {
4201
- var _a;
4267
+ var _a, _b, _c, _d, _e;
4202
4268
  React__default["default"].useEffect(() => {
4203
4269
  console.warn(`
4204
4270
  * Tina no longer requires wrapping your site in the TinaProvider
@@ -4209,12 +4275,13 @@ mutation addPendingDocumentMutation(
4209
4275
  console.warn("The apiURL prop is deprecated. Please see https://tina.io/blog/tina-v-0.68.14 for information on how to upgrade to the new API");
4210
4276
  }
4211
4277
  const apiURL = ((_a = props == null ? void 0 : props.client) == null ? void 0 : _a.apiUrl) || (props == null ? void 0 : props.apiURL);
4212
- const { branch, clientId, isLocalClient } = apiURL ? parseURL(apiURL) : {
4278
+ const isLocalOverride = (_d = (_c = (_b = schema == null ? void 0 : schema.config) == null ? void 0 : _b.admin) == null ? void 0 : _c.auth) == null ? void 0 : _d.useLocalAuth;
4279
+ const { branch, clientId, isLocalClient } = apiURL ? schemaTools.parseURL(apiURL) : {
4213
4280
  branch: props.branch,
4214
4281
  clientId: props.clientId,
4215
4282
  isLocalClient: props == null ? void 0 : props.isLocalClient
4216
4283
  };
4217
- if (typeof isLocalClient === "undefined" || !isLocalClient && (!branch || !clientId)) {
4284
+ if (typeof isLocalClient === "undefined" || !isLocalClient && (!branch || !clientId) && !schema.config.contentApiUrlOverride) {
4218
4285
  throw new Error("Invalid setup. See https://tina.io/docs/tina-cloud/connecting-site/ for more information.");
4219
4286
  }
4220
4287
  if (!schema) {
@@ -4222,9 +4289,9 @@ mutation addPendingDocumentMutation(
4222
4289
  }
4223
4290
  return /* @__PURE__ */ React__default["default"].createElement(React__default["default"].Fragment, null, /* @__PURE__ */ React__default["default"].createElement(TinaCloudProvider, {
4224
4291
  branch,
4225
- clientId,
4292
+ clientId: clientId || ((_e = schema == null ? void 0 : schema.config) == null ? void 0 : _e.clientId),
4226
4293
  tinaioConfig: props.tinaioConfig,
4227
- isLocalClient,
4294
+ isLocalClient: isLocalOverride || isLocalClient,
4228
4295
  cmsCallback: props.cmsCallback,
4229
4296
  mediaStore: props.mediaStore,
4230
4297
  apiUrl: apiURL,
@@ -4568,9 +4635,15 @@ This will work when developing locally but NOT when deployed to production.
4568
4635
  function BiRename(props) {
4569
4636
  return GenIcon({ "tag": "svg", "attr": { "viewBox": "0 0 24 24" }, "child": [{ "tag": "path", "attr": { "d": "M20.005 5.995h-1v2h1v8h-1v2h1c1.103 0 2-.897 2-2v-8c0-1.102-.898-2-2-2zm-14 4H15v4H6.005z" } }, { "tag": "path", "attr": { "d": "M17.005 17.995V4H20V2h-8v2h3.005v1.995h-11c-1.103 0-2 .897-2 2v8c0 1.103.897 2 2 2h11V20H12v2h8v-2h-2.995v-2.005zm-13-2v-8h11v8h-11z" } }] })(props);
4570
4637
  }
4638
+ function BiSearch(props) {
4639
+ return GenIcon({ "tag": "svg", "attr": { "viewBox": "0 0 24 24" }, "child": [{ "tag": "path", "attr": { "d": "M10 18a7.952 7.952 0 0 0 4.897-1.688l4.396 4.396 1.414-1.414-4.396-4.396A7.952 7.952 0 0 0 18 10c0-4.411-3.589-8-8-8s-8 3.589-8 8 3.589 8 8 8zm0-14c3.309 0 6 2.691 6 6s-2.691 6-6 6-6-2.691-6-6 2.691-6 6-6z" } }] })(props);
4640
+ }
4571
4641
  function BiTrash(props) {
4572
4642
  return GenIcon({ "tag": "svg", "attr": { "viewBox": "0 0 24 24" }, "child": [{ "tag": "path", "attr": { "d": "M5 20a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V8h2V6h-4V4a2 2 0 0 0-2-2H9a2 2 0 0 0-2 2v2H3v2h2zM9 4h6v2H9zM8 8h9v12H7V8z" } }, { "tag": "path", "attr": { "d": "M9 10h2v8H9zm4 0h2v8h-2z" } }] })(props);
4573
4643
  }
4644
+ function BiX(props) {
4645
+ return GenIcon({ "tag": "svg", "attr": { "viewBox": "0 0 24 24" }, "child": [{ "tag": "path", "attr": { "d": "m16.192 6.344-4.243 4.242-4.242-4.242-1.414 1.414L10.535 12l-4.242 4.242 1.414 1.414 4.242-4.242 4.243 4.242 1.414-1.414L13.364 12l4.242-4.242z" } }] })(props);
4646
+ }
4574
4647
  const slugify = (text) => {
4575
4648
  return text.toString().toLowerCase().trim().replace(/[^\w\s-]/g, "").replace(/[\s_-]+/g, "_").replace(/^-+|-+$/g, "");
4576
4649
  };
@@ -4828,24 +4901,37 @@ This will work when developing locally but NOT when deployed to production.
4828
4901
  const PageWrapper = ({
4829
4902
  children
4830
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]);
4831
4915
  return /* @__PURE__ */ React__default["default"].createElement("div", {
4832
- 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"
4833
- }, children);
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"
4917
+ }, branchingEnabled && !isLocalMode && /* @__PURE__ */ React__default["default"].createElement(toolkit.BranchBanner, null), children);
4834
4918
  };
4835
4919
  const PageHeader = ({
4836
4920
  isLocalMode,
4837
4921
  children
4838
- }) => /* @__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", {
4839
- className: "bg-white pb-4 pt-16 border-b border-gray-200 px-12"
4840
- }, /* @__PURE__ */ React__default["default"].createElement("div", {
4841
- className: "w-full mx-auto max-w-screen-xl"
4842
- }, /* @__PURE__ */ React__default["default"].createElement("div", {
4843
- className: "w-full flex justify-between items-end"
4844
- }, 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
+ };
4845
4931
  const PageBody = ({
4846
4932
  children
4847
4933
  }) => /* @__PURE__ */ React__default["default"].createElement("div", {
4848
- className: "py-10 px-12"
4934
+ className: "py-8 px-12"
4849
4935
  }, children);
4850
4936
  const PageBodyNarrow = ({
4851
4937
  children
@@ -4963,7 +5049,7 @@ This will work when developing locally but NOT when deployed to production.
4963
5049
  fontWeight: "normal"
4964
5050
  }
4965
5051
  }, "Please wait, Tina is loading data..."))));
4966
- const useGetCollection = (cms, collectionName, includeDocuments = true, after = "", sortKey) => {
5052
+ const useGetCollection = (cms, collectionName, includeDocuments = true, after = "", sortKey, filterArgs) => {
4967
5053
  const api = new TinaAdminApi(cms);
4968
5054
  const schema = cms.api.tina.schema;
4969
5055
  const collectionExtra = schema.getCollection(collectionName);
@@ -4978,7 +5064,7 @@ This will work when developing locally but NOT when deployed to production.
4978
5064
  const { name, order } = JSON.parse(sortKey || "{}");
4979
5065
  const validSortKey = ((_a = collectionExtra.fields) == null ? void 0 : _a.map((x) => x.name).includes(name)) ? name : void 0;
4980
5066
  try {
4981
- const collection2 = await api.fetchCollection(collectionName, includeDocuments, after, validSortKey, order);
5067
+ const collection2 = await api.fetchCollection(collectionName, includeDocuments, after, validSortKey, order, filterArgs);
4982
5068
  setCollection(collection2);
4983
5069
  } catch (error2) {
4984
5070
  cms.alerts.error(`[${error2.name}] GetCollection failed: ${error2.message}`);
@@ -5001,9 +5087,10 @@ This will work when developing locally but NOT when deployed to production.
5001
5087
  includeDocuments = true,
5002
5088
  startCursor,
5003
5089
  sortKey,
5004
- children
5090
+ children,
5091
+ filterArgs
5005
5092
  }) => {
5006
- const { collection, loading, error, reFetchCollection, collectionExtra } = useGetCollection(cms, collectionName, includeDocuments, startCursor || "", sortKey) || {};
5093
+ const { collection, loading, error, reFetchCollection, collectionExtra } = useGetCollection(cms, collectionName, includeDocuments, startCursor || "", sortKey, filterArgs) || {};
5007
5094
  if (error) {
5008
5095
  return null;
5009
5096
  }
@@ -5068,7 +5155,13 @@ This will work when developing locally but NOT when deployed to production.
5068
5155
  const [vars, setVars] = React__default["default"].useState({
5069
5156
  collection: collectionName,
5070
5157
  relativePath: "",
5071
- newRelativePath: ""
5158
+ newRelativePath: "",
5159
+ filterField: "",
5160
+ startsWith: "",
5161
+ endsWith: "",
5162
+ before: "",
5163
+ after: "",
5164
+ booleanEquals: null
5072
5165
  });
5073
5166
  const [endCursor, setEndCursor] = React.useState("");
5074
5167
  const [prevCursors, setPrevCursors] = React.useState([]);
@@ -5086,23 +5179,55 @@ This will work when developing locally but NOT when deployed to production.
5086
5179
  setEndCursor("");
5087
5180
  setPrevCursors([]);
5088
5181
  }, [loc]);
5182
+ React.useEffect(() => {
5183
+ setVars((old) => ({
5184
+ ...old,
5185
+ collection: collectionName,
5186
+ relativePath: "",
5187
+ newRelativePath: "",
5188
+ filterField: "",
5189
+ startsWith: "",
5190
+ endsWith: "",
5191
+ before: "",
5192
+ after: "",
5193
+ booleanEquals: null
5194
+ }));
5195
+ }, [collectionName]);
5089
5196
  return /* @__PURE__ */ React__default["default"].createElement(GetCMS, null, (cms) => {
5090
5197
  return /* @__PURE__ */ React__default["default"].createElement(GetCollection, {
5091
5198
  cms,
5092
5199
  collectionName,
5093
5200
  includeDocuments: true,
5094
5201
  startCursor: endCursor,
5095
- sortKey
5202
+ sortKey,
5203
+ filterArgs: collectionName === vars.collection ? vars : {
5204
+ collection: collectionName,
5205
+ relativePath: "",
5206
+ newRelativePath: "",
5207
+ filterField: "",
5208
+ startsWith: "",
5209
+ endsWith: "",
5210
+ before: "",
5211
+ after: "",
5212
+ booleanEquals: null
5213
+ }
5096
5214
  }, (collection, _loading, reFetchCollection, collectionExtra) => {
5097
- var _a, _b, _c, _d, _e, _f, _g, _h, _i;
5098
- const totalCount = collection.documents.totalCount;
5215
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k;
5216
+ collection.documents.totalCount;
5099
5217
  const documents = collection.documents.edges;
5100
5218
  const admin = cms.api.admin;
5101
5219
  const pageInfo = collection.documents.pageInfo;
5102
5220
  const fields = (_a = collectionExtra.fields) == null ? void 0 : _a.filter((x) => ["string", "number", "datetime", "boolean"].includes(x.type));
5221
+ const filterFields = (_b = collectionExtra.fields) == null ? void 0 : _b.filter((x) => {
5222
+ return ["string", "datetime", "boolean"].includes(x.type) && !x.list;
5223
+ });
5224
+ const filterField = filterFields == null ? void 0 : filterFields.find((x) => x.name === vars.filterField);
5225
+ const showStartsWith = (filterField == null ? void 0 : filterField.type) === "string" && !filterField.list;
5226
+ const showDateFilter = (filterField == null ? void 0 : filterField.type) === "datetime";
5227
+ const showBooleanToggle = (filterField == null ? void 0 : filterField.type) === "boolean" && !filterField.list;
5103
5228
  const collectionDefinition = cms.api.tina.schema.getCollection(collection.name);
5104
- const allowCreate = (_d = (_c = (_b = collectionDefinition == null ? void 0 : collectionDefinition.ui) == null ? void 0 : _b.allowedActions) == null ? void 0 : _c.create) != null ? _d : true;
5105
- const allowDelete = (_g = (_f = (_e = collectionDefinition == null ? void 0 : collectionDefinition.ui) == null ? void 0 : _e.allowedActions) == null ? void 0 : _f.delete) != null ? _g : true;
5229
+ const allowCreate = (_e = (_d = (_c = collectionDefinition == null ? void 0 : collectionDefinition.ui) == null ? void 0 : _c.allowedActions) == null ? void 0 : _d.create) != null ? _e : true;
5230
+ const allowDelete = (_h = (_g = (_f = collectionDefinition == null ? void 0 : collectionDefinition.ui) == null ? void 0 : _f.allowedActions) == null ? void 0 : _g.delete) != null ? _h : true;
5106
5231
  return /* @__PURE__ */ React__default["default"].createElement(PageWrapper, null, /* @__PURE__ */ React__default["default"].createElement(React__default["default"].Fragment, null, deleteModalOpen && /* @__PURE__ */ React__default["default"].createElement(DeleteModal, {
5107
5232
  filename: vars.relativePath,
5108
5233
  deleteFunc: async () => {
@@ -5143,13 +5268,17 @@ This will work when developing locally but NOT when deployed to production.
5143
5268
  },
5144
5269
  close: () => setRenameModalOpen(false)
5145
5270
  }), /* @__PURE__ */ React__default["default"].createElement(PageHeader, {
5146
- isLocalMode: (_i = (_h = cms == null ? void 0 : cms.api) == null ? void 0 : _h.tina) == null ? void 0 : _i.isLocalMode
5147
- }, /* @__PURE__ */ React__default["default"].createElement(React__default["default"].Fragment, null, /* @__PURE__ */ React__default["default"].createElement("div", {
5271
+ isLocalMode: (_j = (_i = cms == null ? void 0 : cms.api) == null ? void 0 : _i.tina) == null ? void 0 : _j.isLocalMode
5272
+ }, /* @__PURE__ */ React__default["default"].createElement("div", {
5273
+ className: "w-full grid grid-flow-col items-end gap-4"
5274
+ }, /* @__PURE__ */ React__default["default"].createElement("div", {
5148
5275
  className: "flex flex-col gap-4"
5149
5276
  }, /* @__PURE__ */ React__default["default"].createElement("h3", {
5150
5277
  className: "font-sans text-2xl text-gray-700"
5151
5278
  }, collection.label ? collection.label : collection.name), (fields == null ? void 0 : fields.length) > 0 && /* @__PURE__ */ React__default["default"].createElement("div", {
5152
- className: "flex gap-2 items-center"
5279
+ className: "flex gap-4 items-end flex-wrap"
5280
+ }, /* @__PURE__ */ React__default["default"].createElement("div", {
5281
+ className: "flex flex-col gap-2 items-start"
5153
5282
  }, /* @__PURE__ */ React__default["default"].createElement("label", {
5154
5283
  htmlFor: "sort",
5155
5284
  className: "block font-sans text-xs font-semibold text-gray-500 whitespace-normal"
@@ -5165,14 +5294,14 @@ This will work when developing locally but NOT when deployed to production.
5165
5294
  },
5166
5295
  ...fields.map((x) => [
5167
5296
  {
5168
- label: (x.label || x.name) + " (Ascending)",
5297
+ label: (x.label || x.name) + (x.type === "datetime" ? " (Oldest First)" : " (Ascending)"),
5169
5298
  value: JSON.stringify({
5170
5299
  name: x.name,
5171
5300
  order: "asc"
5172
5301
  })
5173
5302
  },
5174
5303
  {
5175
- label: (x.label || x.name) + " (Descending)",
5304
+ label: (x.label || x.name) + (x.type === "datetime" ? " (Newest First)" : " (Descending)"),
5176
5305
  value: JSON.stringify({
5177
5306
  name: x.name,
5178
5307
  order: "desc"
@@ -5193,16 +5322,160 @@ This will work when developing locally but NOT when deployed to production.
5193
5322
  setSortOrder(val.order);
5194
5323
  }
5195
5324
  }
5196
- }))), !collection.templates && allowCreate && /* @__PURE__ */ React__default["default"].createElement(reactRouterDom.Link, {
5325
+ })), /* @__PURE__ */ React__default["default"].createElement("form", {
5326
+ className: "flex flex-wrap gap-4 items-end"
5327
+ }, /* @__PURE__ */ React__default["default"].createElement("div", {
5328
+ className: "flex flex-shrink-0 flex-col gap-2 items-start"
5329
+ }, /* @__PURE__ */ React__default["default"].createElement("label", {
5330
+ htmlFor: "filter",
5331
+ className: "block font-sans text-xs font-semibold text-gray-500 whitespace-normal"
5332
+ }, "Filter by"), /* @__PURE__ */ React__default["default"].createElement(toolkit.Select, {
5333
+ name: "filter",
5334
+ options: [
5335
+ {
5336
+ label: "None",
5337
+ value: ""
5338
+ },
5339
+ ...filterFields.map((x) => ({
5340
+ label: x.label || x.name,
5341
+ value: x.name
5342
+ }))
5343
+ ],
5344
+ input: {
5345
+ id: "filter",
5346
+ name: "filter",
5347
+ value: vars.filterField,
5348
+ onChange: (e) => {
5349
+ const val = e.target.value;
5350
+ setEndCursor("");
5351
+ setPrevCursors([]);
5352
+ setVars((old) => ({
5353
+ ...old,
5354
+ filterField: val
5355
+ }));
5356
+ if (!val) {
5357
+ reFetchCollection();
5358
+ }
5359
+ }
5360
+ }
5361
+ })), showStartsWith && /* @__PURE__ */ React__default["default"].createElement(React__default["default"].Fragment, null, /* @__PURE__ */ React__default["default"].createElement("div", {
5362
+ className: "flex flex-shrink-0 flex-col gap-2 items-start"
5363
+ }, /* @__PURE__ */ React__default["default"].createElement("label", {
5364
+ htmlFor: "startsWith",
5365
+ className: "block font-sans text-xs font-semibold text-gray-500 whitespace-normal"
5366
+ }, "Starts with"), /* @__PURE__ */ React__default["default"].createElement(toolkit.Input, {
5367
+ name: "startsWith",
5368
+ id: "startsWith",
5369
+ value: vars.startsWith,
5370
+ onChange: (e) => {
5371
+ const val = e.target.value;
5372
+ setVars((old) => ({
5373
+ ...old,
5374
+ startsWith: val,
5375
+ after: "",
5376
+ before: "",
5377
+ booleanEquals: null
5378
+ }));
5379
+ }
5380
+ }))), showDateFilter && /* @__PURE__ */ React__default["default"].createElement("div", {
5381
+ className: "flex flex-shrink-0 gap-4"
5382
+ }, /* @__PURE__ */ React__default["default"].createElement("div", {
5383
+ className: "flex flex-col gap-2 items-start"
5384
+ }, /* @__PURE__ */ React__default["default"].createElement("label", {
5385
+ htmlFor: "dateAfter",
5386
+ className: "block font-sans text-xs font-semibold text-gray-500 whitespace-normal"
5387
+ }, "After"), /* @__PURE__ */ React__default["default"].createElement(toolkit.ReactDateTimeWithStyles, {
5388
+ inputProps: {
5389
+ className: toolkit.textFieldClasses
5390
+ },
5391
+ value: vars.after,
5392
+ onChange: (e) => {
5393
+ setVars((old) => ({
5394
+ ...old,
5395
+ after: e.format(),
5396
+ booleanEquals: null,
5397
+ startsWith: ""
5398
+ }));
5399
+ }
5400
+ })), /* @__PURE__ */ React__default["default"].createElement("div", {
5401
+ className: "flex flex-col gap-2 items-start"
5402
+ }, /* @__PURE__ */ React__default["default"].createElement("label", {
5403
+ htmlFor: "dateBefore",
5404
+ className: "block font-sans text-xs font-semibold text-gray-500 whitespace-normal"
5405
+ }, "Before"), /* @__PURE__ */ React__default["default"].createElement(toolkit.ReactDateTimeWithStyles, {
5406
+ inputProps: {
5407
+ className: toolkit.textFieldClasses
5408
+ },
5409
+ value: vars.before,
5410
+ onChange: (e) => {
5411
+ setVars((old) => ({
5412
+ ...old,
5413
+ before: e.format(),
5414
+ booleanEquals: null,
5415
+ startsWith: ""
5416
+ }));
5417
+ }
5418
+ }))), showBooleanToggle && /* @__PURE__ */ React__default["default"].createElement(React__default["default"].Fragment, null, /* @__PURE__ */ React__default["default"].createElement("div", {
5419
+ className: "flex flex-col gap-2 items-start"
5420
+ }, /* @__PURE__ */ React__default["default"].createElement("label", {
5421
+ htmlFor: "toggle",
5422
+ className: "block font-sans text-xs font-semibold text-gray-500 whitespace-normal"
5423
+ }, filterField.label || filterField.name), /* @__PURE__ */ React__default["default"].createElement(toolkit.Toggle, {
5424
+ field: filterField,
5425
+ input: {
5426
+ name: "toggle",
5427
+ value: (_k = vars.booleanEquals) != null ? _k : false,
5428
+ onChange: () => {
5429
+ setVars((old) => ({
5430
+ ...old,
5431
+ booleanEquals: !old.booleanEquals,
5432
+ after: "",
5433
+ before: "",
5434
+ startsWith: ""
5435
+ }));
5436
+ }
5437
+ },
5438
+ name: "toggle"
5439
+ }))), (showStartsWith || showDateFilter || showBooleanToggle) && /* @__PURE__ */ React__default["default"].createElement("div", {
5440
+ className: "flex gap-3"
5441
+ }, /* @__PURE__ */ React__default["default"].createElement(toolkit.Button, {
5442
+ onClick: () => {
5443
+ setEndCursor("");
5444
+ setPrevCursors([]);
5445
+ reFetchCollection();
5446
+ },
5447
+ variant: "primary",
5448
+ type: "submit"
5449
+ }, "Search", " ", /* @__PURE__ */ React__default["default"].createElement(BiSearch, {
5450
+ className: "w-5 h-full ml-1.5 opacity-70"
5451
+ })), (vars.startsWith || vars.after || vars.before || vars.booleanEquals) && /* @__PURE__ */ React__default["default"].createElement(toolkit.Button, {
5452
+ onClick: () => {
5453
+ setVars((old) => ({
5454
+ ...old,
5455
+ startsWith: "",
5456
+ after: "",
5457
+ before: "",
5458
+ booleanEquals: null
5459
+ }));
5460
+ setEndCursor("");
5461
+ setPrevCursors([]);
5462
+ reFetchCollection();
5463
+ },
5464
+ variant: "white"
5465
+ }, "Clear", " ", /* @__PURE__ */ React__default["default"].createElement(BiX, {
5466
+ className: "w-5 h-full ml-1 opacity-70"
5467
+ })))))), /* @__PURE__ */ React__default["default"].createElement("div", {
5468
+ className: "flex self-end justify-self-end"
5469
+ }, !collection.templates && allowCreate && /* @__PURE__ */ React__default["default"].createElement(reactRouterDom.Link, {
5197
5470
  to: `new`,
5198
- 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"
5471
+ 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-white bg-blue-500 hover:bg-blue-600 focus:ring-blue-500 text-sm h-10 px-6"
5199
5472
  }, "Create New", " ", /* @__PURE__ */ React__default["default"].createElement(BiPlus, {
5200
5473
  className: "w-5 h-full ml-1 opacity-70"
5201
5474
  })), collection.templates && allowCreate && /* @__PURE__ */ React__default["default"].createElement(TemplateMenu, {
5202
5475
  templates: collection.templates
5203
- }))), /* @__PURE__ */ React__default["default"].createElement(PageBody, null, /* @__PURE__ */ React__default["default"].createElement("div", {
5476
+ })))), /* @__PURE__ */ React__default["default"].createElement(PageBody, null, /* @__PURE__ */ React__default["default"].createElement("div", {
5204
5477
  className: "w-full mx-auto max-w-screen-xl"
5205
- }, totalCount > 0 && /* @__PURE__ */ React__default["default"].createElement("table", {
5478
+ }, documents.length > 0 ? /* @__PURE__ */ React__default["default"].createElement("table", {
5206
5479
  className: "table-auto shadow bg-white border-b border-gray-200 w-full max-w-full rounded-lg"
5207
5480
  }, /* @__PURE__ */ React__default["default"].createElement("tbody", {
5208
5481
  className: "divide-y divide-gray-150"
@@ -5272,11 +5545,12 @@ This will work when developing locally but NOT when deployed to production.
5272
5545
  className: "text-red-500"
5273
5546
  }),
5274
5547
  onMouseDown: () => {
5275
- setVars({
5548
+ setVars((old) => ({
5549
+ ...old,
5276
5550
  collection: collectionName,
5277
5551
  relativePath: document.node._sys.breadcrumbs.join("/") + document.node._sys.extension,
5278
5552
  newRelativePath: ""
5279
- });
5553
+ }));
5280
5554
  setDeleteModalOpen(true);
5281
5555
  }
5282
5556
  },
@@ -5288,18 +5562,19 @@ This will work when developing locally but NOT when deployed to production.
5288
5562
  className: "text-red-500"
5289
5563
  }),
5290
5564
  onMouseDown: () => {
5291
- setVars({
5565
+ setVars((old) => ({
5566
+ ...old,
5292
5567
  collection: collectionName,
5293
5568
  relativePath: document.node._sys.breadcrumbs.join("/") + document.node._sys.extension,
5294
5569
  newRelativePath: ""
5295
- });
5570
+ }));
5296
5571
  setRenameModalOpen(true);
5297
5572
  }
5298
5573
  }
5299
5574
  ].filter(Boolean)
5300
5575
  })));
5301
- }))), /* @__PURE__ */ React__default["default"].createElement("div", {
5302
- className: "pt-3"
5576
+ }))) : /* @__PURE__ */ React__default["default"].createElement(NoDocumentsPlaceholder, null), /* @__PURE__ */ React__default["default"].createElement("div", {
5577
+ className: "pt-4"
5303
5578
  }, /* @__PURE__ */ React__default["default"].createElement(toolkit.CursorPaginator, {
5304
5579
  variant: "white",
5305
5580
  hasNext: sortOrder === "asc" ? pageInfo == null ? void 0 : pageInfo.hasNextPage : pageInfo.hasPreviousPage,
@@ -5321,6 +5596,13 @@ This will work when developing locally but NOT when deployed to production.
5321
5596
  });
5322
5597
  });
5323
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
+ };
5324
5606
  const DeleteModal = ({ close: close2, deleteFunc, filename }) => {
5325
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, {
5326
5608
  close: close2