@orion-studios/payload-admin-components 0.2.0-beta.12 → 0.2.0-beta.14

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/client.d.mts CHANGED
@@ -97,4 +97,14 @@ declare function AdminStudioMediaView(props: AnyRecord$1): react_jsx_runtime.JSX
97
97
  type AnyRecord = Record<string, unknown>;
98
98
  declare function AdminStudioToolsView(props: AnyRecord): react_jsx_runtime.JSX.Element;
99
99
 
100
- export { AdminStudioDashboard, AdminStudioGlobalsView, AdminStudioMediaView, AdminStudioNav, AdminStudioPageEditView, AdminStudioPagesListView, AdminStudioToolsView, BlockPicker, Dashboard, EmptyState, HelpTooltip, Icon, Logo, OrionBlocksField, SectionTabs, StatusBadge, type ThemeOption, ThemeProvider, ThemeSwitcher, WelcomeHeader, useTheme };
100
+ type Props$1 = {
101
+ pagesPathBase?: string;
102
+ };
103
+ declare function OpenInStudioMenuItem({ pagesPathBase }: Props$1): react_jsx_runtime.JSX.Element | null;
104
+
105
+ type Props = {
106
+ pagesPathBase?: string;
107
+ };
108
+ declare function PageEditRedirectToStudio({ pagesPathBase }: Props): react_jsx_runtime.JSX.Element;
109
+
110
+ export { AdminStudioDashboard, AdminStudioGlobalsView, AdminStudioMediaView, AdminStudioNav, AdminStudioPageEditView, AdminStudioPagesListView, AdminStudioToolsView, BlockPicker, Dashboard, EmptyState, HelpTooltip, Icon, Logo, OpenInStudioMenuItem, OrionBlocksField, PageEditRedirectToStudio, SectionTabs, StatusBadge, type ThemeOption, ThemeProvider, ThemeSwitcher, WelcomeHeader, useTheme };
package/dist/client.d.ts CHANGED
@@ -97,4 +97,14 @@ declare function AdminStudioMediaView(props: AnyRecord$1): react_jsx_runtime.JSX
97
97
  type AnyRecord = Record<string, unknown>;
98
98
  declare function AdminStudioToolsView(props: AnyRecord): react_jsx_runtime.JSX.Element;
99
99
 
100
- export { AdminStudioDashboard, AdminStudioGlobalsView, AdminStudioMediaView, AdminStudioNav, AdminStudioPageEditView, AdminStudioPagesListView, AdminStudioToolsView, BlockPicker, Dashboard, EmptyState, HelpTooltip, Icon, Logo, OrionBlocksField, SectionTabs, StatusBadge, type ThemeOption, ThemeProvider, ThemeSwitcher, WelcomeHeader, useTheme };
100
+ type Props$1 = {
101
+ pagesPathBase?: string;
102
+ };
103
+ declare function OpenInStudioMenuItem({ pagesPathBase }: Props$1): react_jsx_runtime.JSX.Element | null;
104
+
105
+ type Props = {
106
+ pagesPathBase?: string;
107
+ };
108
+ declare function PageEditRedirectToStudio({ pagesPathBase }: Props): react_jsx_runtime.JSX.Element;
109
+
110
+ export { AdminStudioDashboard, AdminStudioGlobalsView, AdminStudioMediaView, AdminStudioNav, AdminStudioPageEditView, AdminStudioPagesListView, AdminStudioToolsView, BlockPicker, Dashboard, EmptyState, HelpTooltip, Icon, Logo, OpenInStudioMenuItem, OrionBlocksField, PageEditRedirectToStudio, SectionTabs, StatusBadge, type ThemeOption, ThemeProvider, ThemeSwitcher, WelcomeHeader, useTheme };
package/dist/client.js CHANGED
@@ -1169,7 +1169,9 @@ __export(client_exports, {
1169
1169
  HelpTooltip: () => HelpTooltip,
1170
1170
  Icon: () => Icon,
1171
1171
  Logo: () => Logo,
1172
+ OpenInStudioMenuItem: () => OpenInStudioMenuItem,
1172
1173
  OrionBlocksField: () => OrionBlocksField,
1174
+ PageEditRedirectToStudio: () => PageEditRedirectToStudio,
1173
1175
  SectionTabs: () => SectionTabs,
1174
1176
  StatusBadge: () => StatusBadge,
1175
1177
  ThemeProvider: () => ThemeProvider,
@@ -2753,6 +2755,66 @@ function AdminStudioToolsView(props) {
2753
2755
  )) })
2754
2756
  ] });
2755
2757
  }
2758
+
2759
+ // src/components/studio/OpenInStudioMenuItem.tsx
2760
+ var import_ui7 = require("@payloadcms/ui");
2761
+ var import_jsx_runtime21 = require("react/jsx-runtime");
2762
+ function OpenInStudioMenuItem({ pagesPathBase = "/admin/pages" }) {
2763
+ const documentInfo = (0, import_ui7.useDocumentInfo)();
2764
+ const id = documentInfo?.id;
2765
+ if (!id) {
2766
+ return null;
2767
+ }
2768
+ return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
2769
+ "a",
2770
+ {
2771
+ href: `${pagesPathBase}/${id}`,
2772
+ style: {
2773
+ color: "var(--theme-elevation-800)",
2774
+ display: "block",
2775
+ fontSize: "0.92rem",
2776
+ lineHeight: 1.3,
2777
+ padding: "0.45rem 0.7rem",
2778
+ textDecoration: "none",
2779
+ width: "100%"
2780
+ },
2781
+ children: "Open Editor"
2782
+ }
2783
+ );
2784
+ }
2785
+
2786
+ // src/components/studio/PageEditRedirectToStudio.tsx
2787
+ var import_react13 = require("react");
2788
+ var import_ui8 = require("@payloadcms/ui");
2789
+ var import_jsx_runtime22 = require("react/jsx-runtime");
2790
+ function PageEditRedirectToStudio({ pagesPathBase = "/admin/pages" }) {
2791
+ const documentInfo = (0, import_ui8.useDocumentInfo)();
2792
+ const id = documentInfo?.id;
2793
+ (0, import_react13.useEffect)(() => {
2794
+ if (!id) {
2795
+ return;
2796
+ }
2797
+ window.location.replace(`${pagesPathBase}/${id}`);
2798
+ }, [id, pagesPathBase]);
2799
+ return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
2800
+ "div",
2801
+ {
2802
+ style: {
2803
+ alignItems: "center",
2804
+ display: "flex",
2805
+ flexDirection: "column",
2806
+ gap: "0.75rem",
2807
+ justifyContent: "center",
2808
+ minHeight: "50vh"
2809
+ },
2810
+ children: [
2811
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("h2", { style: { margin: 0 }, children: "Opening Editor..." }),
2812
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("p", { style: { color: "var(--theme-elevation-600)", margin: 0 }, children: "Redirecting to the custom page editor." }),
2813
+ id ? /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("a", { href: `${pagesPathBase}/${id}`, children: "Continue to Editor" }) : /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("a", { href: pagesPathBase, children: "Open Pages" })
2814
+ ]
2815
+ }
2816
+ );
2817
+ }
2756
2818
  // Annotate the CommonJS export names for ESM import in node:
2757
2819
  0 && (module.exports = {
2758
2820
  AdminStudioDashboard,
@@ -2768,7 +2830,9 @@ function AdminStudioToolsView(props) {
2768
2830
  HelpTooltip,
2769
2831
  Icon,
2770
2832
  Logo,
2833
+ OpenInStudioMenuItem,
2771
2834
  OrionBlocksField,
2835
+ PageEditRedirectToStudio,
2772
2836
  SectionTabs,
2773
2837
  StatusBadge,
2774
2838
  ThemeProvider,
package/dist/client.mjs CHANGED
@@ -1575,6 +1575,66 @@ function AdminStudioToolsView(props) {
1575
1575
  )) })
1576
1576
  ] });
1577
1577
  }
1578
+
1579
+ // src/components/studio/OpenInStudioMenuItem.tsx
1580
+ import { useDocumentInfo } from "@payloadcms/ui";
1581
+ import { jsx as jsx17 } from "react/jsx-runtime";
1582
+ function OpenInStudioMenuItem({ pagesPathBase = "/admin/pages" }) {
1583
+ const documentInfo = useDocumentInfo();
1584
+ const id = documentInfo?.id;
1585
+ if (!id) {
1586
+ return null;
1587
+ }
1588
+ return /* @__PURE__ */ jsx17(
1589
+ "a",
1590
+ {
1591
+ href: `${pagesPathBase}/${id}`,
1592
+ style: {
1593
+ color: "var(--theme-elevation-800)",
1594
+ display: "block",
1595
+ fontSize: "0.92rem",
1596
+ lineHeight: 1.3,
1597
+ padding: "0.45rem 0.7rem",
1598
+ textDecoration: "none",
1599
+ width: "100%"
1600
+ },
1601
+ children: "Open Editor"
1602
+ }
1603
+ );
1604
+ }
1605
+
1606
+ // src/components/studio/PageEditRedirectToStudio.tsx
1607
+ import { useEffect as useEffect8 } from "react";
1608
+ import { useDocumentInfo as useDocumentInfo2 } from "@payloadcms/ui";
1609
+ import { jsx as jsx18, jsxs as jsxs16 } from "react/jsx-runtime";
1610
+ function PageEditRedirectToStudio({ pagesPathBase = "/admin/pages" }) {
1611
+ const documentInfo = useDocumentInfo2();
1612
+ const id = documentInfo?.id;
1613
+ useEffect8(() => {
1614
+ if (!id) {
1615
+ return;
1616
+ }
1617
+ window.location.replace(`${pagesPathBase}/${id}`);
1618
+ }, [id, pagesPathBase]);
1619
+ return /* @__PURE__ */ jsxs16(
1620
+ "div",
1621
+ {
1622
+ style: {
1623
+ alignItems: "center",
1624
+ display: "flex",
1625
+ flexDirection: "column",
1626
+ gap: "0.75rem",
1627
+ justifyContent: "center",
1628
+ minHeight: "50vh"
1629
+ },
1630
+ children: [
1631
+ /* @__PURE__ */ jsx18("h2", { style: { margin: 0 }, children: "Opening Editor..." }),
1632
+ /* @__PURE__ */ jsx18("p", { style: { color: "var(--theme-elevation-600)", margin: 0 }, children: "Redirecting to the custom page editor." }),
1633
+ id ? /* @__PURE__ */ jsx18("a", { href: `${pagesPathBase}/${id}`, children: "Continue to Editor" }) : /* @__PURE__ */ jsx18("a", { href: pagesPathBase, children: "Open Pages" })
1634
+ ]
1635
+ }
1636
+ );
1637
+ }
1578
1638
  export {
1579
1639
  AdminStudioDashboard,
1580
1640
  AdminStudioGlobalsView,
@@ -1589,7 +1649,9 @@ export {
1589
1649
  HelpTooltip,
1590
1650
  Icon,
1591
1651
  Logo,
1652
+ OpenInStudioMenuItem,
1592
1653
  OrionBlocksField,
1654
+ PageEditRedirectToStudio,
1593
1655
  SectionTabs,
1594
1656
  StatusBadge,
1595
1657
  ThemeProvider,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@orion-studios/payload-admin-components",
3
- "version": "0.2.0-beta.12",
3
+ "version": "0.2.0-beta.14",
4
4
  "description": "Custom admin UI components for Payload CMS",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",
package/src/client.ts CHANGED
@@ -19,6 +19,8 @@ export { AdminStudioPageEditView } from './components/studio/AdminStudioPageEdit
19
19
  export { AdminStudioGlobalsView } from './components/studio/AdminStudioGlobalsView'
20
20
  export { AdminStudioMediaView } from './components/studio/AdminStudioMediaView'
21
21
  export { AdminStudioToolsView } from './components/studio/AdminStudioToolsView'
22
+ export { OpenInStudioMenuItem } from './components/studio/OpenInStudioMenuItem'
23
+ export { PageEditRedirectToStudio } from './components/studio/PageEditRedirectToStudio'
22
24
 
23
25
  export { useTheme } from './hooks/useTheme'
24
26
  export type { ThemeOption } from './hooks/useTheme'
@@ -0,0 +1,35 @@
1
+ 'use client'
2
+
3
+ import { useDocumentInfo } from '@payloadcms/ui'
4
+
5
+ type Props = {
6
+ /** Defaults to `/admin/pages`. */
7
+ pagesPathBase?: string
8
+ }
9
+
10
+ export function OpenInStudioMenuItem({ pagesPathBase = '/admin/pages' }: Props) {
11
+ const documentInfo = useDocumentInfo()
12
+ const id = documentInfo?.id
13
+
14
+ if (!id) {
15
+ return null
16
+ }
17
+
18
+ return (
19
+ <a
20
+ href={`${pagesPathBase}/${id}`}
21
+ style={{
22
+ color: 'var(--theme-elevation-800)',
23
+ display: 'block',
24
+ fontSize: '0.92rem',
25
+ lineHeight: 1.3,
26
+ padding: '0.45rem 0.7rem',
27
+ textDecoration: 'none',
28
+ width: '100%',
29
+ }}
30
+ >
31
+ Open Editor
32
+ </a>
33
+ )
34
+ }
35
+
@@ -0,0 +1,46 @@
1
+ 'use client'
2
+
3
+ import { useEffect } from 'react'
4
+
5
+ import { useDocumentInfo } from '@payloadcms/ui'
6
+
7
+ type Props = {
8
+ /** Defaults to `/admin/pages`. */
9
+ pagesPathBase?: string
10
+ }
11
+
12
+ export function PageEditRedirectToStudio({ pagesPathBase = '/admin/pages' }: Props) {
13
+ const documentInfo = useDocumentInfo()
14
+ const id = documentInfo?.id
15
+
16
+ useEffect(() => {
17
+ if (!id) {
18
+ return
19
+ }
20
+
21
+ window.location.replace(`${pagesPathBase}/${id}`)
22
+ }, [id, pagesPathBase])
23
+
24
+ return (
25
+ <div
26
+ style={{
27
+ alignItems: 'center',
28
+ display: 'flex',
29
+ flexDirection: 'column',
30
+ gap: '0.75rem',
31
+ justifyContent: 'center',
32
+ minHeight: '50vh',
33
+ }}
34
+ >
35
+ <h2 style={{ margin: 0 }}>Opening Editor...</h2>
36
+ <p style={{ color: 'var(--theme-elevation-600)', margin: 0 }}>
37
+ Redirecting to the custom page editor.
38
+ </p>
39
+ {id ? (
40
+ <a href={`${pagesPathBase}/${id}`}>Continue to Editor</a>
41
+ ) : (
42
+ <a href={pagesPathBase}>Open Pages</a>
43
+ )}
44
+ </div>
45
+ )
46
+ }