@orion-studios/payload-studio 0.5.0-beta.114 → 0.5.0-beta.116

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.
@@ -1565,7 +1565,13 @@ var buttonActive = {
1565
1565
  borderColor: "var(--theme-success-500)",
1566
1566
  color: "var(--theme-success-500)"
1567
1567
  };
1568
- function ThemeSwitcher({ defaultTheme = "brand-light" }) {
1568
+ function ThemeSwitcher({
1569
+ allowThemePreference = false,
1570
+ defaultTheme = "brand-light"
1571
+ }) {
1572
+ if (!allowThemePreference) {
1573
+ return null;
1574
+ }
1569
1575
  const { isDark, isBrand, hasMounted, toggleDarkMode, toggleBrandMode } = useTheme(defaultTheme);
1570
1576
  const showDark = hasMounted && isDark;
1571
1577
  const showBrand = hasMounted && isBrand;
@@ -1605,10 +1611,14 @@ function ThemeSwitcher({ defaultTheme = "brand-light" }) {
1605
1611
  }
1606
1612
  );
1607
1613
  }
1608
- function ThemeProvider({ children, defaultTheme = "brand-light" }) {
1609
- (0, import_react3.useEffect)(() => {
1614
+ function ThemeProvider({
1615
+ children,
1616
+ defaultTheme = "brand-light",
1617
+ allowThemePreference = false
1618
+ }) {
1619
+ (0, import_react3.useLayoutEffect)(() => {
1610
1620
  try {
1611
- const stored = localStorage.getItem("orion-admin-theme");
1621
+ const stored = allowThemePreference ? localStorage.getItem("orion-admin-theme") : null;
1612
1622
  const html = document.documentElement;
1613
1623
  const resolvedTheme = stored && ["light", "dark", "brand-light", "brand-dark"].includes(stored) ? stored : defaultTheme;
1614
1624
  const isDark = resolvedTheme === "dark" || resolvedTheme === "brand-dark";
@@ -1626,7 +1636,7 @@ function ThemeProvider({ children, defaultTheme = "brand-light" }) {
1626
1636
  localStorage.setItem("orion-admin-theme", resolvedTheme);
1627
1637
  } catch {
1628
1638
  }
1629
- }, [defaultTheme]);
1639
+ }, [allowThemePreference, defaultTheme]);
1630
1640
  return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_jsx_runtime3.Fragment, { children });
1631
1641
  }
1632
1642
 
@@ -2750,28 +2760,26 @@ function AdminStudioNav(props) {
2750
2760
 
2751
2761
  // src/admin/components/studio/StudioSectionLayout.tsx
2752
2762
  var import_jsx_runtime15 = require("react/jsx-runtime");
2753
- var STORAGE_KEY2 = "orion-studio-sidebar-collapsed";
2754
- var ACTIVE_CLASS = "orion-studio-shell-active";
2763
+ var STORAGE_KEY2 = "orion-studio-shell-collapsed";
2764
+ var readStoredCollapsed = () => {
2765
+ try {
2766
+ return window.localStorage.getItem(STORAGE_KEY2) === "1";
2767
+ } catch {
2768
+ return false;
2769
+ }
2770
+ };
2755
2771
  function StudioSectionLayout({ children, navProps }) {
2756
2772
  const [collapsed, setCollapsed] = (0, import_react13.useState)(false);
2757
- (0, import_react13.useEffect)(() => {
2758
- try {
2759
- const stored = window.localStorage.getItem(STORAGE_KEY2);
2760
- if (stored === "1") {
2761
- setCollapsed(true);
2762
- }
2763
- } catch {
2764
- }
2765
- }, []);
2766
- (0, import_react13.useEffect)(() => {
2767
- document.body.classList.add(ACTIVE_CLASS);
2773
+ (0, import_react13.useLayoutEffect)(() => {
2774
+ document.body.classList.add("orion-studio-shell-active");
2775
+ setCollapsed(readStoredCollapsed());
2768
2776
  return () => {
2769
- document.body.classList.remove(ACTIVE_CLASS);
2777
+ document.body.classList.remove("orion-studio-shell-active");
2770
2778
  };
2771
2779
  }, []);
2772
- const toggle = () => {
2773
- setCollapsed((prev) => {
2774
- const next = !prev;
2780
+ const toggleSidebar = () => {
2781
+ setCollapsed((current) => {
2782
+ const next = !current;
2775
2783
  try {
2776
2784
  window.localStorage.setItem(STORAGE_KEY2, next ? "1" : "0");
2777
2785
  } catch {
@@ -2782,10 +2790,11 @@ function StudioSectionLayout({ children, navProps }) {
2782
2790
  return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
2783
2791
  "div",
2784
2792
  {
2785
- className: `orion-studio-shell ${collapsed ? "is-collapsed" : ""}`,
2793
+ className: `orion-studio-shell${collapsed ? " is-collapsed" : ""}`,
2786
2794
  style: {
2787
2795
  display: "grid",
2788
- gridTemplateColumns: collapsed ? "84px minmax(0, 1fr)" : "260px minmax(0, 1fr)",
2796
+ gap: 0,
2797
+ gridTemplateColumns: collapsed ? "92px minmax(0, 1fr)" : "280px minmax(0, 1fr)",
2789
2798
  minHeight: "100vh"
2790
2799
  },
2791
2800
  children: [
@@ -2795,7 +2804,7 @@ function StudioSectionLayout({ children, navProps }) {
2795
2804
  {
2796
2805
  "aria-label": collapsed ? "Expand sidebar" : "Collapse sidebar",
2797
2806
  className: "orion-studio-sidebar-toggle",
2798
- onClick: toggle,
2807
+ onClick: toggleSidebar,
2799
2808
  type: "button",
2800
2809
  children: collapsed ? ">" : "<"
2801
2810
  }
@@ -219,10 +219,10 @@ function Icon({ brandName = "Orion Studio", logoUrl } = {}) {
219
219
  }
220
220
 
221
221
  // src/admin/components/Dashboard.tsx
222
- import { useEffect as useEffect5, useState as useState4 } from "react";
222
+ import { useEffect as useEffect4, useState as useState4 } from "react";
223
223
 
224
224
  // src/admin/components/ThemeSwitcher.tsx
225
- import { useEffect as useEffect3 } from "react";
225
+ import { useLayoutEffect } from "react";
226
226
 
227
227
  // src/admin/hooks/useTheme.ts
228
228
  import { useCallback, useEffect as useEffect2, useRef, useState as useState2 } from "react";
@@ -388,7 +388,13 @@ var buttonActive = {
388
388
  borderColor: "var(--theme-success-500)",
389
389
  color: "var(--theme-success-500)"
390
390
  };
391
- function ThemeSwitcher({ defaultTheme = "brand-light" }) {
391
+ function ThemeSwitcher({
392
+ allowThemePreference = false,
393
+ defaultTheme = "brand-light"
394
+ }) {
395
+ if (!allowThemePreference) {
396
+ return null;
397
+ }
392
398
  const { isDark, isBrand, hasMounted, toggleDarkMode, toggleBrandMode } = useTheme(defaultTheme);
393
399
  const showDark = hasMounted && isDark;
394
400
  const showBrand = hasMounted && isBrand;
@@ -428,10 +434,14 @@ function ThemeSwitcher({ defaultTheme = "brand-light" }) {
428
434
  }
429
435
  );
430
436
  }
431
- function ThemeProvider({ children, defaultTheme = "brand-light" }) {
432
- useEffect3(() => {
437
+ function ThemeProvider({
438
+ children,
439
+ defaultTheme = "brand-light",
440
+ allowThemePreference = false
441
+ }) {
442
+ useLayoutEffect(() => {
433
443
  try {
434
- const stored = localStorage.getItem("orion-admin-theme");
444
+ const stored = allowThemePreference ? localStorage.getItem("orion-admin-theme") : null;
435
445
  const html = document.documentElement;
436
446
  const resolvedTheme = stored && ["light", "dark", "brand-light", "brand-dark"].includes(stored) ? stored : defaultTheme;
437
447
  const isDark = resolvedTheme === "dark" || resolvedTheme === "brand-dark";
@@ -449,12 +459,12 @@ function ThemeProvider({ children, defaultTheme = "brand-light" }) {
449
459
  localStorage.setItem("orion-admin-theme", resolvedTheme);
450
460
  } catch {
451
461
  }
452
- }, [defaultTheme]);
462
+ }, [allowThemePreference, defaultTheme]);
453
463
  return /* @__PURE__ */ jsx3(Fragment, { children });
454
464
  }
455
465
 
456
466
  // src/admin/components/HelpTooltip.tsx
457
- import { useCallback as useCallback2, useEffect as useEffect4, useRef as useRef2, useState as useState3 } from "react";
467
+ import { useCallback as useCallback2, useEffect as useEffect3, useRef as useRef2, useState as useState3 } from "react";
458
468
  import { jsx as jsx4, jsxs as jsxs4 } from "react/jsx-runtime";
459
469
  function HelpTooltip({
460
470
  content,
@@ -467,7 +477,7 @@ function HelpTooltip({
467
477
  const show = useCallback2(() => setIsVisible(true), []);
468
478
  const hide = useCallback2(() => setIsVisible(false), []);
469
479
  const toggle = useCallback2(() => setIsVisible((v) => !v), []);
470
- useEffect4(() => {
480
+ useEffect3(() => {
471
481
  if (!isVisible) return;
472
482
  const handleKeyDown = (e) => {
473
483
  if (e.key === "Escape") setIsVisible(false);
@@ -475,7 +485,7 @@ function HelpTooltip({
475
485
  document.addEventListener("keydown", handleKeyDown);
476
486
  return () => document.removeEventListener("keydown", handleKeyDown);
477
487
  }, [isVisible]);
478
- useEffect4(() => {
488
+ useEffect3(() => {
479
489
  if (!isVisible) return;
480
490
  const handleClick = (e) => {
481
491
  if (triggerRef.current && !triggerRef.current.contains(e.target) && tooltipRef.current && !tooltipRef.current.contains(e.target)) {
@@ -672,7 +682,7 @@ function Dashboard() {
672
682
  const [recentPages, setRecentPages] = useState4([]);
673
683
  const [pageCount, setPageCount] = useState4(null);
674
684
  const [mediaCount, setMediaCount] = useState4(null);
675
- useEffect5(() => {
685
+ useEffect4(() => {
676
686
  fetch("/api/users/me", { credentials: "include" }).then((res) => res.json()).then((data) => {
677
687
  const user = data?.user || data;
678
688
  setUserName(user?.fullName || user?.email?.split("@")[0] || "");
@@ -1178,7 +1188,7 @@ var resolveStudioSections = (value) => {
1178
1188
  };
1179
1189
 
1180
1190
  // src/admin/components/studio/adminPathUtils.ts
1181
- import { useEffect as useEffect6, useState as useState5 } from "react";
1191
+ import { useEffect as useEffect5, useState as useState5 } from "react";
1182
1192
  var DEFAULT_ADMIN_BASE_PATH = "/admin";
1183
1193
  var normalizePath = (value) => {
1184
1194
  if (!value || value === "/") return "/";
@@ -1241,7 +1251,7 @@ var resolveAdminPath = (adminBasePath, targetPath) => {
1241
1251
  };
1242
1252
  var useAdminBasePath = (fallback = DEFAULT_ADMIN_BASE_PATH) => {
1243
1253
  const [adminBasePath, setAdminBasePath] = useState5(normalizeAdminBasePath(fallback));
1244
- useEffect6(() => {
1254
+ useEffect5(() => {
1245
1255
  const update = () => {
1246
1256
  setAdminBasePath(detectAdminBasePath(window.location.pathname, fallback));
1247
1257
  };
@@ -1253,10 +1263,10 @@ var useAdminBasePath = (fallback = DEFAULT_ADMIN_BASE_PATH) => {
1253
1263
  };
1254
1264
 
1255
1265
  // src/admin/components/studio/StudioSectionLayout.tsx
1256
- import { useEffect as useEffect8, useState as useState7 } from "react";
1266
+ import { useLayoutEffect as useLayoutEffect2, useState as useState7 } from "react";
1257
1267
 
1258
1268
  // src/admin/components/studio/AdminStudioNav.tsx
1259
- import { useEffect as useEffect7, useMemo, useState as useState6 } from "react";
1269
+ import { useEffect as useEffect6, useMemo, useState as useState6 } from "react";
1260
1270
  import { Logout, useAuth } from "@payloadcms/ui";
1261
1271
  import { Fragment as Fragment2, jsx as jsx10, jsxs as jsxs9 } from "react/jsx-runtime";
1262
1272
  var iconSize2 = 18;
@@ -1392,7 +1402,7 @@ function AdminStudioNav(props) {
1392
1402
  const branding = useSiteBranding(brandName, logoUrl || void 0);
1393
1403
  const resolvedName = branding.siteName || brandName;
1394
1404
  const [pathname, setPathname] = useState6("");
1395
- useEffect7(() => {
1405
+ useEffect6(() => {
1396
1406
  const update = () => setPathname(window.location.pathname);
1397
1407
  update();
1398
1408
  window.addEventListener("popstate", update);
@@ -1569,28 +1579,26 @@ function AdminStudioNav(props) {
1569
1579
 
1570
1580
  // src/admin/components/studio/StudioSectionLayout.tsx
1571
1581
  import { jsx as jsx11, jsxs as jsxs10 } from "react/jsx-runtime";
1572
- var STORAGE_KEY2 = "orion-studio-sidebar-collapsed";
1573
- var ACTIVE_CLASS = "orion-studio-shell-active";
1582
+ var STORAGE_KEY2 = "orion-studio-shell-collapsed";
1583
+ var readStoredCollapsed = () => {
1584
+ try {
1585
+ return window.localStorage.getItem(STORAGE_KEY2) === "1";
1586
+ } catch {
1587
+ return false;
1588
+ }
1589
+ };
1574
1590
  function StudioSectionLayout({ children, navProps }) {
1575
1591
  const [collapsed, setCollapsed] = useState7(false);
1576
- useEffect8(() => {
1577
- try {
1578
- const stored = window.localStorage.getItem(STORAGE_KEY2);
1579
- if (stored === "1") {
1580
- setCollapsed(true);
1581
- }
1582
- } catch {
1583
- }
1584
- }, []);
1585
- useEffect8(() => {
1586
- document.body.classList.add(ACTIVE_CLASS);
1592
+ useLayoutEffect2(() => {
1593
+ document.body.classList.add("orion-studio-shell-active");
1594
+ setCollapsed(readStoredCollapsed());
1587
1595
  return () => {
1588
- document.body.classList.remove(ACTIVE_CLASS);
1596
+ document.body.classList.remove("orion-studio-shell-active");
1589
1597
  };
1590
1598
  }, []);
1591
- const toggle = () => {
1592
- setCollapsed((prev) => {
1593
- const next = !prev;
1599
+ const toggleSidebar = () => {
1600
+ setCollapsed((current) => {
1601
+ const next = !current;
1594
1602
  try {
1595
1603
  window.localStorage.setItem(STORAGE_KEY2, next ? "1" : "0");
1596
1604
  } catch {
@@ -1601,10 +1609,11 @@ function StudioSectionLayout({ children, navProps }) {
1601
1609
  return /* @__PURE__ */ jsxs10(
1602
1610
  "div",
1603
1611
  {
1604
- className: `orion-studio-shell ${collapsed ? "is-collapsed" : ""}`,
1612
+ className: `orion-studio-shell${collapsed ? " is-collapsed" : ""}`,
1605
1613
  style: {
1606
1614
  display: "grid",
1607
- gridTemplateColumns: collapsed ? "84px minmax(0, 1fr)" : "260px minmax(0, 1fr)",
1615
+ gap: 0,
1616
+ gridTemplateColumns: collapsed ? "92px minmax(0, 1fr)" : "280px minmax(0, 1fr)",
1608
1617
  minHeight: "100vh"
1609
1618
  },
1610
1619
  children: [
@@ -1614,7 +1623,7 @@ function StudioSectionLayout({ children, navProps }) {
1614
1623
  {
1615
1624
  "aria-label": collapsed ? "Expand sidebar" : "Collapse sidebar",
1616
1625
  className: "orion-studio-sidebar-toggle",
1617
- onClick: toggle,
1626
+ onClick: toggleSidebar,
1618
1627
  type: "button",
1619
1628
  children: collapsed ? ">" : "<"
1620
1629
  }
@@ -1729,7 +1738,7 @@ function AdminStudioDashboard(props) {
1729
1738
  }
1730
1739
 
1731
1740
  // src/admin/components/studio/AdminStudioPagesListView.tsx
1732
- import { useEffect as useEffect9, useMemo as useMemo2, useState as useState8 } from "react";
1741
+ import { useEffect as useEffect7, useMemo as useMemo2, useState as useState8 } from "react";
1733
1742
  import { SetStepNav as SetStepNav2, useAuth as useAuth2 } from "@payloadcms/ui";
1734
1743
  import { Fragment as Fragment3, jsx as jsx13, jsxs as jsxs12 } from "react/jsx-runtime";
1735
1744
  var isAdmin = (user) => {
@@ -1766,7 +1775,7 @@ function AdminStudioPagesListView(props) {
1766
1775
  });
1767
1776
  return `/api/${pagesCollectionSlug}?${params.toString()}`;
1768
1777
  }, [pagesCollectionSlug]);
1769
- useEffect9(() => {
1778
+ useEffect7(() => {
1770
1779
  let cancelled = false;
1771
1780
  const run = async () => {
1772
1781
  setLoading(true);
@@ -1905,7 +1914,7 @@ function AdminStudioPagesListView(props) {
1905
1914
  }
1906
1915
 
1907
1916
  // src/admin/components/studio/AdminStudioPageEditView.tsx
1908
- import { useEffect as useEffect10, useMemo as useMemo3, useRef as useRef3, useState as useState9 } from "react";
1917
+ import { useEffect as useEffect8, useMemo as useMemo3, useRef as useRef3, useState as useState9 } from "react";
1909
1918
  import { SetStepNav as SetStepNav3, toast, useAuth as useAuth3 } from "@payloadcms/ui";
1910
1919
  import { Fragment as Fragment4, jsx as jsx14, jsxs as jsxs13 } from "react/jsx-runtime";
1911
1920
  var isAdmin2 = (user) => {
@@ -1958,7 +1967,7 @@ function AdminStudioPageEditView(props) {
1958
1967
  const pageIDFromParams = useMemo3(() => getParam(props.params, "id"), [props.params]);
1959
1968
  const [pageID, setPageID] = useState9(pageIDFromParams);
1960
1969
  const [didResolvePathFallback, setDidResolvePathFallback] = useState9(false);
1961
- useEffect10(() => {
1970
+ useEffect8(() => {
1962
1971
  if (pageIDFromParams) {
1963
1972
  setPageID(pageIDFromParams);
1964
1973
  setDidResolvePathFallback(true);
@@ -2002,7 +2011,7 @@ function AdminStudioPageEditView(props) {
2002
2011
  } catch {
2003
2012
  }
2004
2013
  };
2005
- useEffect10(() => {
2014
+ useEffect8(() => {
2006
2015
  if (!pageID) {
2007
2016
  return;
2008
2017
  }
@@ -2025,7 +2034,7 @@ function AdminStudioPageEditView(props) {
2025
2034
  }
2026
2035
  iframe.contentWindow.postMessage({ source: "payload-visual-builder-parent", type }, "*");
2027
2036
  };
2028
- useEffect10(() => {
2037
+ useEffect8(() => {
2029
2038
  const onMessage = (event) => {
2030
2039
  const data = event.data;
2031
2040
  if (!data || data.source !== "payload-visual-builder-child" || typeof data.type !== "string") {
@@ -2319,7 +2328,7 @@ function AdminStudioGlobalsView(props) {
2319
2328
  }
2320
2329
 
2321
2330
  // src/admin/components/studio/AdminStudioHeaderGlobalView.tsx
2322
- import { useEffect as useEffect11, useMemo as useMemo4, useState as useState10 } from "react";
2331
+ import { useEffect as useEffect9, useMemo as useMemo4, useState as useState10 } from "react";
2323
2332
  import { SetStepNav as SetStepNav5 } from "@payloadcms/ui";
2324
2333
 
2325
2334
  // src/shared/socialMedia.ts
@@ -2503,7 +2512,7 @@ function AdminStudioHeaderGlobalView(props) {
2503
2512
  const [pages, setPages] = useState10([]);
2504
2513
  const [siteSettings, setSiteSettings] = useState10({});
2505
2514
  const [socialMedia, setSocialMedia] = useState10({});
2506
- useEffect11(() => {
2515
+ useEffect9(() => {
2507
2516
  let cancelled = false;
2508
2517
  const run = async () => {
2509
2518
  setLoading(true);
@@ -2669,7 +2678,7 @@ function AdminStudioHeaderGlobalView(props) {
2669
2678
  }
2670
2679
 
2671
2680
  // src/admin/components/studio/AdminStudioFooterGlobalView.tsx
2672
- import { useEffect as useEffect12, useMemo as useMemo5, useState as useState11 } from "react";
2681
+ import { useEffect as useEffect10, useMemo as useMemo5, useState as useState11 } from "react";
2673
2682
  import { SetStepNav as SetStepNav6 } from "@payloadcms/ui";
2674
2683
  import { jsx as jsx17, jsxs as jsxs16 } from "react/jsx-runtime";
2675
2684
  var getPropString7 = (props, key, fallback) => {
@@ -2788,7 +2797,7 @@ function AdminStudioFooterGlobalView(props) {
2788
2797
  });
2789
2798
  const [siteSettings, setSiteSettings] = useState11({});
2790
2799
  const [socialMedia, setSocialMedia] = useState11({});
2791
- useEffect12(() => {
2800
+ useEffect10(() => {
2792
2801
  let cancelled = false;
2793
2802
  const run = async () => {
2794
2803
  setLoading(true);
@@ -3044,7 +3053,7 @@ function AdminStudioFooterGlobalView(props) {
3044
3053
  }
3045
3054
 
3046
3055
  // src/admin/components/studio/AdminStudioContactFormView.tsx
3047
- import { useEffect as useEffect13, useMemo as useMemo6, useState as useState12 } from "react";
3056
+ import { useEffect as useEffect11, useMemo as useMemo6, useState as useState12 } from "react";
3048
3057
  import { SetStepNav as SetStepNav7 } from "@payloadcms/ui";
3049
3058
  import { jsx as jsx18, jsxs as jsxs17 } from "react/jsx-runtime";
3050
3059
  var defaultDoc = {
@@ -3140,7 +3149,7 @@ function AdminStudioContactFormView(props) {
3140
3149
  const [isLoading, setIsLoading] = useState12(true);
3141
3150
  const [isSaving, setIsSaving] = useState12(false);
3142
3151
  const [savedMessage, setSavedMessage] = useState12(null);
3143
- useEffect13(() => {
3152
+ useEffect11(() => {
3144
3153
  let mounted = true;
3145
3154
  const load = async () => {
3146
3155
  setIsLoading(true);
@@ -3414,7 +3423,7 @@ function AdminStudioMediaView(props) {
3414
3423
  }
3415
3424
 
3416
3425
  // src/admin/components/studio/AdminStudioFormsView.tsx
3417
- import { useEffect as useEffect14, useMemo as useMemo7, useState as useState13 } from "react";
3426
+ import { useEffect as useEffect12, useMemo as useMemo7, useState as useState13 } from "react";
3418
3427
  import { SetStepNav as SetStepNav9, useAuth as useAuth4 } from "@payloadcms/ui";
3419
3428
  import { Fragment as Fragment7, jsx as jsx20, jsxs as jsxs19 } from "react/jsx-runtime";
3420
3429
  var isAdmin3 = (user) => {
@@ -3584,7 +3593,7 @@ function AdminStudioFormsView(props) {
3584
3593
  }) || null,
3585
3594
  [forms, selectedFormID]
3586
3595
  );
3587
- useEffect14(() => {
3596
+ useEffect12(() => {
3588
3597
  if (typeof window === "undefined") {
3589
3598
  return;
3590
3599
  }
@@ -3594,7 +3603,7 @@ function AdminStudioFormsView(props) {
3594
3603
  setSelectedFormID(formID);
3595
3604
  }
3596
3605
  }, []);
3597
- useEffect14(() => {
3606
+ useEffect12(() => {
3598
3607
  if (!canReviewForms(user)) {
3599
3608
  return;
3600
3609
  }
@@ -3648,7 +3657,7 @@ function AdminStudioFormsView(props) {
3648
3657
  cancelled = true;
3649
3658
  };
3650
3659
  }, [formsCollectionSlug, user]);
3651
- useEffect14(() => {
3660
+ useEffect12(() => {
3652
3661
  if (!selectedFormID || !canReviewForms(user)) {
3653
3662
  setSubmissions([]);
3654
3663
  return;
@@ -3692,7 +3701,7 @@ function AdminStudioFormsView(props) {
3692
3701
  cancelled = true;
3693
3702
  };
3694
3703
  }, [formSubmissionsCollectionSlug, selectedFormID, user]);
3695
- useEffect14(() => {
3704
+ useEffect12(() => {
3696
3705
  if (typeof window === "undefined" || !selectedFormID) {
3697
3706
  return;
3698
3707
  }
@@ -4253,13 +4262,13 @@ function OpenInStudioMenuItem({ pagesPathBase = "/pages" }) {
4253
4262
  }
4254
4263
 
4255
4264
  // src/admin/components/studio/PageEditRedirectToStudio.tsx
4256
- import { useEffect as useEffect15 } from "react";
4265
+ import { useEffect as useEffect13 } from "react";
4257
4266
  import { useDocumentInfo as useDocumentInfo2 } from "@payloadcms/ui";
4258
4267
  import { jsx as jsx23, jsxs as jsxs21 } from "react/jsx-runtime";
4259
4268
  function PageEditRedirectToStudio({ pagesPathBase = "/pages" }) {
4260
4269
  const documentInfo = useDocumentInfo2();
4261
4270
  const id = documentInfo?.id;
4262
- useEffect15(() => {
4271
+ useEffect13(() => {
4263
4272
  if (!id) {
4264
4273
  return;
4265
4274
  }
@@ -4286,7 +4295,7 @@ function PageEditRedirectToStudio({ pagesPathBase = "/pages" }) {
4286
4295
  }
4287
4296
 
4288
4297
  // src/admin/components/studio/StudioBackBreadcrumb.tsx
4289
- import { useEffect as useEffect16, useState as useState14 } from "react";
4298
+ import { useEffect as useEffect14, useState as useState14 } from "react";
4290
4299
  import { SetStepNav as SetStepNav11 } from "@payloadcms/ui";
4291
4300
  import { jsx as jsx24 } from "react/jsx-runtime";
4292
4301
  var toTitle = (slug) => slug.split("-").filter(Boolean).map((part) => part.charAt(0).toUpperCase() + part.slice(1)).join(" ");
@@ -4334,7 +4343,7 @@ var buildNav = (pathname, adminBasePath) => {
4334
4343
  function StudioBackBreadcrumb() {
4335
4344
  const adminBasePath = useAdminBasePath();
4336
4345
  const [pathname, setPathname] = useState14("");
4337
- useEffect16(() => {
4346
+ useEffect14(() => {
4338
4347
  const update = () => setPathname(window.location.pathname);
4339
4348
  update();
4340
4349
  window.addEventListener("popstate", update);
@@ -4346,7 +4355,7 @@ function StudioBackBreadcrumb() {
4346
4355
  }
4347
4356
 
4348
4357
  // src/admin/components/studio/StudioContactFormRedirect.tsx
4349
- import { useEffect as useEffect17 } from "react";
4358
+ import { useEffect as useEffect15 } from "react";
4350
4359
  import { jsx as jsx25, jsxs as jsxs22 } from "react/jsx-runtime";
4351
4360
  var getPropString12 = (props, key, fallback) => {
4352
4361
  if (!props || typeof props !== "object") return fallback;
@@ -4363,7 +4372,7 @@ function StudioContactFormRedirect(props) {
4363
4372
  const adminBasePath = useAdminBasePath();
4364
4373
  const studioContactFormPath = getPropString12(props, "studioContactFormPath", "/contact-form");
4365
4374
  const targetPath = resolveAdminPath(adminBasePath, studioContactFormPath);
4366
- useEffect17(() => {
4375
+ useEffect15(() => {
4367
4376
  if (window.location.pathname === targetPath) return;
4368
4377
  window.location.replace(targetPath);
4369
4378
  }, [targetPath]);
@@ -1,4 +1,4 @@
1
- export { A as AdminConfig, a as AdminStudioConfig, b as AdminStudioFooterPreviewConfig, c as AdminStudioHeaderPreviewConfig, d as AdminStudioSitePreviewConfig, C as CreateSocialMediaConnectionsFieldOptions, e as CreateSocialMediaGlobalOptions, R as ResolvedStudioSection, S as StudioGlobalLink, f as StudioSection, g as StudioSectionCard, h as StudioSectionComponent, j as StudioSectionRole, k as StudioSectionView, l as configureAdmin, m as createHeaderNavItemsField, n as createSocialMediaConnectionsField, o as createSocialMediaGlobal, p as createThemePreferenceField, s as socialMediaConnectionsField, t as themePreferenceField, w as withTooltips } from '../index-DH9KGEZ8.mjs';
1
+ export { A as AdminConfig, a as AdminStudioConfig, b as AdminStudioFooterPreviewConfig, c as AdminStudioHeaderPreviewConfig, d as AdminStudioSitePreviewConfig, C as CreateSocialMediaConnectionsFieldOptions, e as CreateSocialMediaGlobalOptions, R as ResolvedStudioSection, S as StudioGlobalLink, f as StudioSection, g as StudioSectionCard, h as StudioSectionComponent, j as StudioSectionRole, k as StudioSectionView, l as configureAdmin, m as createHeaderNavItemsField, n as createSocialMediaConnectionsField, o as createSocialMediaGlobal, p as createThemePreferenceField, s as socialMediaConnectionsField, t as themePreferenceField, w as withTooltips } from '../index-C3FgxbEL.mjs';
2
2
  export { b as SOCIAL_MEDIA_DEFAULT_ICON_BY_PLATFORM, c as SOCIAL_MEDIA_ICON_OPTIONS, d as SOCIAL_MEDIA_PLATFORMS, e as SOCIAL_MEDIA_PLATFORM_LABELS, S as SocialMediaGlobalData, f as SocialMediaIconLibrary, g as SocialMediaIconOption, a as SocialMediaPlatform, h as SocialMediaProfileData, i as SocialMediaProfilesData } from '../socialMedia-C05Iy-SV.mjs';
3
3
  import 'payload';
4
4
  import '../sitePreviewTypes-BECnq9xI.mjs';
@@ -1,4 +1,4 @@
1
- export { A as AdminConfig, a as AdminStudioConfig, b as AdminStudioFooterPreviewConfig, c as AdminStudioHeaderPreviewConfig, d as AdminStudioSitePreviewConfig, C as CreateSocialMediaConnectionsFieldOptions, e as CreateSocialMediaGlobalOptions, R as ResolvedStudioSection, S as StudioGlobalLink, f as StudioSection, g as StudioSectionCard, h as StudioSectionComponent, j as StudioSectionRole, k as StudioSectionView, l as configureAdmin, m as createHeaderNavItemsField, n as createSocialMediaConnectionsField, o as createSocialMediaGlobal, p as createThemePreferenceField, s as socialMediaConnectionsField, t as themePreferenceField, w as withTooltips } from '../index-D5yjivF7.js';
1
+ export { A as AdminConfig, a as AdminStudioConfig, b as AdminStudioFooterPreviewConfig, c as AdminStudioHeaderPreviewConfig, d as AdminStudioSitePreviewConfig, C as CreateSocialMediaConnectionsFieldOptions, e as CreateSocialMediaGlobalOptions, R as ResolvedStudioSection, S as StudioGlobalLink, f as StudioSection, g as StudioSectionCard, h as StudioSectionComponent, j as StudioSectionRole, k as StudioSectionView, l as configureAdmin, m as createHeaderNavItemsField, n as createSocialMediaConnectionsField, o as createSocialMediaGlobal, p as createThemePreferenceField, s as socialMediaConnectionsField, t as themePreferenceField, w as withTooltips } from '../index-3jBpt6ZT.js';
2
2
  export { b as SOCIAL_MEDIA_DEFAULT_ICON_BY_PLATFORM, c as SOCIAL_MEDIA_ICON_OPTIONS, d as SOCIAL_MEDIA_PLATFORMS, e as SOCIAL_MEDIA_PLATFORM_LABELS, S as SocialMediaGlobalData, f as SocialMediaIconLibrary, g as SocialMediaIconOption, a as SocialMediaPlatform, h as SocialMediaProfileData, i as SocialMediaProfilesData } from '../socialMedia-C05Iy-SV.js';
3
3
  import 'payload';
4
4
  import '../sitePreviewTypes-BECnq9xI.js';
@@ -200,7 +200,8 @@ function configureAdmin(config) {
200
200
  brandPrimary = "#3b82f6",
201
201
  brandSecondary = "#8b5cf6",
202
202
  defaultTheme = "brand-light",
203
- logoUrl
203
+ logoUrl,
204
+ allowThemePreference = false
204
205
  } = config;
205
206
  const studioEnabled = config.studio?.enabled ?? true;
206
207
  const formsEnabled = config.studio?.forms?.enabled ?? false;
@@ -210,7 +211,7 @@ function configureAdmin(config) {
210
211
  const pagesCollectionSlug = config.studio?.pages?.collectionSlug || "pages";
211
212
  const builderBasePath = config.studio?.pages?.builderBasePath || "/builder";
212
213
  const mediaCollectionSlug = config.studio?.media?.collectionSlug || "media";
213
- const globalsBasePath = "/globals";
214
+ const globalsBasePath = "/site-globals";
214
215
  const pagesBasePath = "/pages";
215
216
  const formsBasePath = "/forms";
216
217
  const mediaBasePath = "/media";
@@ -440,19 +441,23 @@ function configureAdmin(config) {
440
441
  exportName: "ThemeProvider",
441
442
  path: clientPath,
442
443
  clientProps: {
444
+ allowThemePreference,
443
445
  defaultTheme
444
446
  }
445
447
  }
446
448
  ],
447
- afterNavLinks: [
448
- {
449
- exportName: "ThemeSwitcher",
450
- path: clientPath,
451
- clientProps: {
452
- defaultTheme
449
+ ...allowThemePreference ? {
450
+ afterNavLinks: [
451
+ {
452
+ exportName: "ThemeSwitcher",
453
+ path: clientPath,
454
+ clientProps: {
455
+ allowThemePreference,
456
+ defaultTheme
457
+ }
453
458
  }
454
- }
455
- ]
459
+ ]
460
+ } : {}
456
461
  },
457
462
  meta: {
458
463
  titleSuffix: ` \u2014 ${brandName}`
@@ -7,7 +7,7 @@ import {
7
7
  socialMediaConnectionsField,
8
8
  themePreferenceField,
9
9
  withTooltips
10
- } from "../chunk-4YPHQYRR.mjs";
10
+ } from "../chunk-T5PBXPES.mjs";
11
11
  import {
12
12
  SOCIAL_MEDIA_DEFAULT_ICON_BY_PLATFORM,
13
13
  SOCIAL_MEDIA_ICON_OPTIONS,
package/dist/admin.css CHANGED
@@ -358,6 +358,10 @@ body.orion-studio-shell-active .nav {
358
358
  display: none !important;
359
359
  }
360
360
 
361
+ body.orion-studio-shell-active .app-header {
362
+ display: none !important;
363
+ }
364
+
361
365
  /* Hide Payload default toggler while custom shell is active */
362
366
  body.orion-studio-shell-active .template-default__nav-toggler-wrapper {
363
367
  display: none !important;
@@ -408,6 +412,10 @@ body.orion-studio-shell-active .template-default__nav-toggler-wrapper {
408
412
  background: var(--theme-elevation-0);
409
413
  }
410
414
 
415
+ .orion-studio-shell.is-collapsed {
416
+ grid-template-columns: 92px minmax(0, 1fr);
417
+ }
418
+
411
419
  .orion-studio-sidebar {
412
420
  border-right: 1px solid var(--theme-elevation-150);
413
421
  height: 100vh;
@@ -180,7 +180,8 @@ function configureAdmin(config) {
180
180
  brandPrimary = "#3b82f6",
181
181
  brandSecondary = "#8b5cf6",
182
182
  defaultTheme = "brand-light",
183
- logoUrl
183
+ logoUrl,
184
+ allowThemePreference = false
184
185
  } = config;
185
186
  const studioEnabled = config.studio?.enabled ?? true;
186
187
  const formsEnabled = config.studio?.forms?.enabled ?? false;
@@ -190,7 +191,7 @@ function configureAdmin(config) {
190
191
  const pagesCollectionSlug = config.studio?.pages?.collectionSlug || "pages";
191
192
  const builderBasePath = config.studio?.pages?.builderBasePath || "/builder";
192
193
  const mediaCollectionSlug = config.studio?.media?.collectionSlug || "media";
193
- const globalsBasePath = "/globals";
194
+ const globalsBasePath = "/site-globals";
194
195
  const pagesBasePath = "/pages";
195
196
  const formsBasePath = "/forms";
196
197
  const mediaBasePath = "/media";
@@ -420,19 +421,23 @@ function configureAdmin(config) {
420
421
  exportName: "ThemeProvider",
421
422
  path: clientPath,
422
423
  clientProps: {
424
+ allowThemePreference,
423
425
  defaultTheme
424
426
  }
425
427
  }
426
428
  ],
427
- afterNavLinks: [
428
- {
429
- exportName: "ThemeSwitcher",
430
- path: clientPath,
431
- clientProps: {
432
- defaultTheme
429
+ ...allowThemePreference ? {
430
+ afterNavLinks: [
431
+ {
432
+ exportName: "ThemeSwitcher",
433
+ path: clientPath,
434
+ clientProps: {
435
+ allowThemePreference,
436
+ defaultTheme
437
+ }
433
438
  }
434
- }
435
- ]
439
+ ]
440
+ } : {}
436
441
  },
437
442
  meta: {
438
443
  titleSuffix: ` \u2014 ${brandName}`
@@ -80,6 +80,7 @@ interface AdminStudioConfig {
80
80
  sections?: StudioSection[];
81
81
  }
82
82
  interface AdminConfig {
83
+ allowThemePreference?: boolean;
83
84
  brandName: string;
84
85
  brandPrimary?: string;
85
86
  brandSecondary?: string;
@@ -92,6 +93,14 @@ declare function configureAdmin(config: AdminConfig): {
92
93
  admin: {
93
94
  css: string;
94
95
  components: {
96
+ afterNavLinks?: {
97
+ exportName: string;
98
+ path: string;
99
+ clientProps: {
100
+ allowThemePreference: true;
101
+ defaultTheme: ThemeOption;
102
+ };
103
+ }[] | undefined;
95
104
  graphics: {
96
105
  Logo: {
97
106
  exportName: string;
@@ -278,13 +287,7 @@ declare function configureAdmin(config: AdminConfig): {
278
287
  exportName: string;
279
288
  path: string;
280
289
  clientProps: {
281
- defaultTheme: ThemeOption;
282
- };
283
- }[];
284
- afterNavLinks: {
285
- exportName: string;
286
- path: string;
287
- clientProps: {
290
+ allowThemePreference: boolean;
288
291
  defaultTheme: ThemeOption;
289
292
  };
290
293
  }[];
@@ -80,6 +80,7 @@ interface AdminStudioConfig {
80
80
  sections?: StudioSection[];
81
81
  }
82
82
  interface AdminConfig {
83
+ allowThemePreference?: boolean;
83
84
  brandName: string;
84
85
  brandPrimary?: string;
85
86
  brandSecondary?: string;
@@ -92,6 +93,14 @@ declare function configureAdmin(config: AdminConfig): {
92
93
  admin: {
93
94
  css: string;
94
95
  components: {
96
+ afterNavLinks?: {
97
+ exportName: string;
98
+ path: string;
99
+ clientProps: {
100
+ allowThemePreference: true;
101
+ defaultTheme: ThemeOption;
102
+ };
103
+ }[] | undefined;
95
104
  graphics: {
96
105
  Logo: {
97
106
  exportName: string;
@@ -278,13 +287,7 @@ declare function configureAdmin(config: AdminConfig): {
278
287
  exportName: string;
279
288
  path: string;
280
289
  clientProps: {
281
- defaultTheme: ThemeOption;
282
- };
283
- }[];
284
- afterNavLinks: {
285
- exportName: string;
286
- path: string;
287
- clientProps: {
290
+ allowThemePreference: boolean;
288
291
  defaultTheme: ThemeOption;
289
292
  };
290
293
  }[];
package/dist/index.d.mts CHANGED
@@ -1,4 +1,4 @@
1
- export { i as admin } from './index-DH9KGEZ8.mjs';
1
+ export { i as admin } from './index-C3FgxbEL.mjs';
2
2
  export { i as adminApp } from './index-c5-qTRbH.mjs';
3
3
  export { i as blocks } from './index-CluwY0ZQ.mjs';
4
4
  export { i as nextjs } from './index-D8BNfUJb.mjs';
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- export { i as admin } from './index-D5yjivF7.js';
1
+ export { i as admin } from './index-3jBpt6ZT.js';
2
2
  export { i as adminApp } from './index-yfpxsgUu.js';
3
3
  export { i as blocks } from './index-CluwY0ZQ.js';
4
4
  export { i as nextjs } from './index-DD_E2UfJ.js';
package/dist/index.js CHANGED
@@ -211,7 +211,8 @@ function configureAdmin(config) {
211
211
  brandPrimary = "#3b82f6",
212
212
  brandSecondary = "#8b5cf6",
213
213
  defaultTheme = "brand-light",
214
- logoUrl
214
+ logoUrl,
215
+ allowThemePreference = false
215
216
  } = config;
216
217
  const studioEnabled = config.studio?.enabled ?? true;
217
218
  const formsEnabled = config.studio?.forms?.enabled ?? false;
@@ -221,7 +222,7 @@ function configureAdmin(config) {
221
222
  const pagesCollectionSlug = config.studio?.pages?.collectionSlug || "pages";
222
223
  const builderBasePath = config.studio?.pages?.builderBasePath || "/builder";
223
224
  const mediaCollectionSlug = config.studio?.media?.collectionSlug || "media";
224
- const globalsBasePath = "/globals";
225
+ const globalsBasePath = "/site-globals";
225
226
  const pagesBasePath = "/pages";
226
227
  const formsBasePath = "/forms";
227
228
  const mediaBasePath = "/media";
@@ -451,19 +452,23 @@ function configureAdmin(config) {
451
452
  exportName: "ThemeProvider",
452
453
  path: clientPath,
453
454
  clientProps: {
455
+ allowThemePreference,
454
456
  defaultTheme
455
457
  }
456
458
  }
457
459
  ],
458
- afterNavLinks: [
459
- {
460
- exportName: "ThemeSwitcher",
461
- path: clientPath,
462
- clientProps: {
463
- defaultTheme
460
+ ...allowThemePreference ? {
461
+ afterNavLinks: [
462
+ {
463
+ exportName: "ThemeSwitcher",
464
+ path: clientPath,
465
+ clientProps: {
466
+ allowThemePreference,
467
+ defaultTheme
468
+ }
464
469
  }
465
- }
466
- ]
470
+ ]
471
+ } : {}
467
472
  },
468
473
  meta: {
469
474
  titleSuffix: ` \u2014 ${brandName}`
package/dist/index.mjs CHANGED
@@ -1,6 +1,9 @@
1
1
  import {
2
2
  admin_exports
3
- } from "./chunk-4YPHQYRR.mjs";
3
+ } from "./chunk-T5PBXPES.mjs";
4
+ import {
5
+ admin_app_exports
6
+ } from "./chunk-XVH5SCBD.mjs";
4
7
  import {
5
8
  blocks_exports
6
9
  } from "./chunk-JQAHXYAM.mjs";
@@ -16,9 +19,6 @@ import "./chunk-PF3EBZXF.mjs";
16
19
  import {
17
20
  studio_exports
18
21
  } from "./chunk-ADIIWIYL.mjs";
19
- import {
20
- admin_app_exports
21
- } from "./chunk-XVH5SCBD.mjs";
22
22
  import "./chunk-6BWS3CLP.mjs";
23
23
  export {
24
24
  admin_exports as admin,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@orion-studios/payload-studio",
3
- "version": "0.5.0-beta.114",
3
+ "version": "0.5.0-beta.116",
4
4
  "description": "Base CMS, builder, and custom admin toolkit for Orion Studios websites",
5
5
  "types": "./dist/index.d.ts",
6
6
  "main": "./dist/index.js",