@delmaredigital/payload-puck 0.1.0

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 (128) hide show
  1. package/LICENSE +73 -0
  2. package/README.md +1580 -0
  3. package/dist/AccordionClient.d.mts +24 -0
  4. package/dist/AccordionClient.d.ts +24 -0
  5. package/dist/AccordionClient.js +786 -0
  6. package/dist/AccordionClient.js.map +1 -0
  7. package/dist/AccordionClient.mjs +784 -0
  8. package/dist/AccordionClient.mjs.map +1 -0
  9. package/dist/AnimatedWrapper.d.mts +30 -0
  10. package/dist/AnimatedWrapper.d.ts +30 -0
  11. package/dist/AnimatedWrapper.js +379 -0
  12. package/dist/AnimatedWrapper.js.map +1 -0
  13. package/dist/AnimatedWrapper.mjs +377 -0
  14. package/dist/AnimatedWrapper.mjs.map +1 -0
  15. package/dist/admin/client.d.mts +108 -0
  16. package/dist/admin/client.d.ts +108 -0
  17. package/dist/admin/client.js +177 -0
  18. package/dist/admin/client.js.map +1 -0
  19. package/dist/admin/client.mjs +173 -0
  20. package/dist/admin/client.mjs.map +1 -0
  21. package/dist/admin/index.d.mts +157 -0
  22. package/dist/admin/index.d.ts +157 -0
  23. package/dist/admin/index.js +31 -0
  24. package/dist/admin/index.js.map +1 -0
  25. package/dist/admin/index.mjs +29 -0
  26. package/dist/admin/index.mjs.map +1 -0
  27. package/dist/api/index.d.mts +460 -0
  28. package/dist/api/index.d.ts +460 -0
  29. package/dist/api/index.js +588 -0
  30. package/dist/api/index.js.map +1 -0
  31. package/dist/api/index.mjs +578 -0
  32. package/dist/api/index.mjs.map +1 -0
  33. package/dist/components/index.css +339 -0
  34. package/dist/components/index.css.map +1 -0
  35. package/dist/components/index.d.mts +222 -0
  36. package/dist/components/index.d.ts +222 -0
  37. package/dist/components/index.js +9177 -0
  38. package/dist/components/index.js.map +1 -0
  39. package/dist/components/index.mjs +9130 -0
  40. package/dist/components/index.mjs.map +1 -0
  41. package/dist/config/config.editor.css +339 -0
  42. package/dist/config/config.editor.css.map +1 -0
  43. package/dist/config/config.editor.d.mts +153 -0
  44. package/dist/config/config.editor.d.ts +153 -0
  45. package/dist/config/config.editor.js +9400 -0
  46. package/dist/config/config.editor.js.map +1 -0
  47. package/dist/config/config.editor.mjs +9368 -0
  48. package/dist/config/config.editor.mjs.map +1 -0
  49. package/dist/config/index.d.mts +68 -0
  50. package/dist/config/index.d.ts +68 -0
  51. package/dist/config/index.js +2017 -0
  52. package/dist/config/index.js.map +1 -0
  53. package/dist/config/index.mjs +1991 -0
  54. package/dist/config/index.mjs.map +1 -0
  55. package/dist/editor/index.d.mts +784 -0
  56. package/dist/editor/index.d.ts +784 -0
  57. package/dist/editor/index.js +4517 -0
  58. package/dist/editor/index.js.map +1 -0
  59. package/dist/editor/index.mjs +4483 -0
  60. package/dist/editor/index.mjs.map +1 -0
  61. package/dist/fields/index.css +339 -0
  62. package/dist/fields/index.css.map +1 -0
  63. package/dist/fields/index.d.mts +600 -0
  64. package/dist/fields/index.d.ts +600 -0
  65. package/dist/fields/index.js +7739 -0
  66. package/dist/fields/index.js.map +1 -0
  67. package/dist/fields/index.mjs +7590 -0
  68. package/dist/fields/index.mjs.map +1 -0
  69. package/dist/index-CQu6SzDg.d.mts +327 -0
  70. package/dist/index-CoUQnyC3.d.ts +327 -0
  71. package/dist/index.d.mts +6 -0
  72. package/dist/index.d.ts +6 -0
  73. package/dist/index.js +569 -0
  74. package/dist/index.js.map +1 -0
  75. package/dist/index.mjs +555 -0
  76. package/dist/index.mjs.map +1 -0
  77. package/dist/layouts/index.d.mts +96 -0
  78. package/dist/layouts/index.d.ts +96 -0
  79. package/dist/layouts/index.js +394 -0
  80. package/dist/layouts/index.js.map +1 -0
  81. package/dist/layouts/index.mjs +378 -0
  82. package/dist/layouts/index.mjs.map +1 -0
  83. package/dist/plugin/index.d.mts +289 -0
  84. package/dist/plugin/index.d.ts +289 -0
  85. package/dist/plugin/index.js +569 -0
  86. package/dist/plugin/index.js.map +1 -0
  87. package/dist/plugin/index.mjs +555 -0
  88. package/dist/plugin/index.mjs.map +1 -0
  89. package/dist/render/index.d.mts +109 -0
  90. package/dist/render/index.d.ts +109 -0
  91. package/dist/render/index.js +2146 -0
  92. package/dist/render/index.js.map +1 -0
  93. package/dist/render/index.mjs +2123 -0
  94. package/dist/render/index.mjs.map +1 -0
  95. package/dist/shared-DMAF1AcH.d.mts +545 -0
  96. package/dist/shared-DMAF1AcH.d.ts +545 -0
  97. package/dist/theme/index.d.mts +155 -0
  98. package/dist/theme/index.d.ts +155 -0
  99. package/dist/theme/index.js +201 -0
  100. package/dist/theme/index.js.map +1 -0
  101. package/dist/theme/index.mjs +186 -0
  102. package/dist/theme/index.mjs.map +1 -0
  103. package/dist/types-D7D3rZ1J.d.mts +116 -0
  104. package/dist/types-D7D3rZ1J.d.ts +116 -0
  105. package/dist/types-_6MvjyKv.d.mts +104 -0
  106. package/dist/types-_6MvjyKv.d.ts +104 -0
  107. package/dist/utils/index.d.mts +267 -0
  108. package/dist/utils/index.d.ts +267 -0
  109. package/dist/utils/index.js +426 -0
  110. package/dist/utils/index.js.map +1 -0
  111. package/dist/utils/index.mjs +412 -0
  112. package/dist/utils/index.mjs.map +1 -0
  113. package/dist/utils-DaRs9t0J.d.mts +85 -0
  114. package/dist/utils-gAvt0Vhw.d.ts +85 -0
  115. package/examples/README.md +240 -0
  116. package/examples/api/puck/pages/[id]/route.ts +64 -0
  117. package/examples/api/puck/pages/[id]/versions/route.ts +47 -0
  118. package/examples/api/puck/pages/route.ts +45 -0
  119. package/examples/app/(frontend)/page.tsx +94 -0
  120. package/examples/app/[...slug]/page.tsx +101 -0
  121. package/examples/app/pages/[id]/edit/page.tsx +148 -0
  122. package/examples/components/CustomBanner.tsx +368 -0
  123. package/examples/config/custom-config.ts +223 -0
  124. package/examples/config/payload.config.example.ts +64 -0
  125. package/examples/lib/puck-layouts.ts +258 -0
  126. package/examples/lib/puck-theme.ts +94 -0
  127. package/examples/styles/puck-theme.css +171 -0
  128. package/package.json +157 -0
@@ -0,0 +1,108 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import { UIFieldClientComponent, DefaultCellComponentProps } from 'payload';
3
+
4
+ /**
5
+ * Props for EditWithPuckButton when used standalone
6
+ */
7
+ interface EditWithPuckButtonProps {
8
+ /**
9
+ * Document ID to edit
10
+ */
11
+ id?: string;
12
+ /**
13
+ * Collection slug
14
+ * @default 'pages'
15
+ */
16
+ collectionSlug?: string;
17
+ /**
18
+ * Custom path pattern for the Puck editor
19
+ * Use {id} as placeholder for the document ID
20
+ * @default '/pages/{id}/edit'
21
+ */
22
+ editorPathPattern?: string;
23
+ /**
24
+ * Button label
25
+ * @default 'Edit with Puck'
26
+ */
27
+ label?: string;
28
+ /**
29
+ * Whether to show as icon only
30
+ * @default false
31
+ */
32
+ iconOnly?: boolean;
33
+ }
34
+ /**
35
+ * Edit with Puck button for use in Payload admin document edit views
36
+ *
37
+ * Links to a Puck editor page outside of Payload admin. Configure the
38
+ * `editorPathPattern` to match your editor route.
39
+ *
40
+ * @example
41
+ * ```tsx
42
+ * // In your Payload collection config:
43
+ * {
44
+ * name: 'puckEdit',
45
+ * type: 'ui',
46
+ * admin: {
47
+ * position: 'sidebar',
48
+ * components: {
49
+ * Field: '@delmaredigital/payload-puck/admin/client#EditWithPuckButton',
50
+ * },
51
+ * custom: {
52
+ * editorPathPattern: '/pages/{id}/edit', // Your editor route
53
+ * label: 'Visual Editor',
54
+ * },
55
+ * },
56
+ * }
57
+ * ```
58
+ */
59
+ declare const EditWithPuckButton: UIFieldClientComponent;
60
+ /**
61
+ * Standalone version of the button that doesn't rely on Payload context
62
+ */
63
+ declare function EditWithPuckLink({ id, editorPathPattern, label, iconOnly, }: EditWithPuckButtonProps & {
64
+ id: string;
65
+ }): react_jsx_runtime.JSX.Element;
66
+
67
+ /**
68
+ * Props for configuring the EditWithPuckCell component
69
+ */
70
+ interface EditWithPuckCellConfig {
71
+ /**
72
+ * Collection slug for building the editor URL
73
+ * @default 'pages'
74
+ */
75
+ collectionSlug?: string;
76
+ /**
77
+ * Custom editor path pattern
78
+ * Use {id} as placeholder for the document ID
79
+ * @default '/admin/puck/{collectionSlug}/{id}/edit'
80
+ */
81
+ editorPathPattern?: string;
82
+ }
83
+ /**
84
+ * Custom cell component that renders an "Edit with Puck" button in list views
85
+ *
86
+ * Add this to a UI field in your collection to show the visual editor button
87
+ * in the list view table.
88
+ *
89
+ * @example
90
+ * ```ts
91
+ * // In your collection config:
92
+ * {
93
+ * name: 'puckEdit',
94
+ * type: 'ui',
95
+ * admin: {
96
+ * components: {
97
+ * Cell: '@delmaredigital/payload-puck/admin#EditWithPuckCell',
98
+ * },
99
+ * custom: {
100
+ * collectionSlug: 'pages',
101
+ * },
102
+ * },
103
+ * }
104
+ * ```
105
+ */
106
+ declare const EditWithPuckCell: React.FC<DefaultCellComponentProps>;
107
+
108
+ export { EditWithPuckButton, type EditWithPuckButtonProps, EditWithPuckCell, type EditWithPuckCellConfig, EditWithPuckLink };
@@ -0,0 +1,108 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import { UIFieldClientComponent, DefaultCellComponentProps } from 'payload';
3
+
4
+ /**
5
+ * Props for EditWithPuckButton when used standalone
6
+ */
7
+ interface EditWithPuckButtonProps {
8
+ /**
9
+ * Document ID to edit
10
+ */
11
+ id?: string;
12
+ /**
13
+ * Collection slug
14
+ * @default 'pages'
15
+ */
16
+ collectionSlug?: string;
17
+ /**
18
+ * Custom path pattern for the Puck editor
19
+ * Use {id} as placeholder for the document ID
20
+ * @default '/pages/{id}/edit'
21
+ */
22
+ editorPathPattern?: string;
23
+ /**
24
+ * Button label
25
+ * @default 'Edit with Puck'
26
+ */
27
+ label?: string;
28
+ /**
29
+ * Whether to show as icon only
30
+ * @default false
31
+ */
32
+ iconOnly?: boolean;
33
+ }
34
+ /**
35
+ * Edit with Puck button for use in Payload admin document edit views
36
+ *
37
+ * Links to a Puck editor page outside of Payload admin. Configure the
38
+ * `editorPathPattern` to match your editor route.
39
+ *
40
+ * @example
41
+ * ```tsx
42
+ * // In your Payload collection config:
43
+ * {
44
+ * name: 'puckEdit',
45
+ * type: 'ui',
46
+ * admin: {
47
+ * position: 'sidebar',
48
+ * components: {
49
+ * Field: '@delmaredigital/payload-puck/admin/client#EditWithPuckButton',
50
+ * },
51
+ * custom: {
52
+ * editorPathPattern: '/pages/{id}/edit', // Your editor route
53
+ * label: 'Visual Editor',
54
+ * },
55
+ * },
56
+ * }
57
+ * ```
58
+ */
59
+ declare const EditWithPuckButton: UIFieldClientComponent;
60
+ /**
61
+ * Standalone version of the button that doesn't rely on Payload context
62
+ */
63
+ declare function EditWithPuckLink({ id, editorPathPattern, label, iconOnly, }: EditWithPuckButtonProps & {
64
+ id: string;
65
+ }): react_jsx_runtime.JSX.Element;
66
+
67
+ /**
68
+ * Props for configuring the EditWithPuckCell component
69
+ */
70
+ interface EditWithPuckCellConfig {
71
+ /**
72
+ * Collection slug for building the editor URL
73
+ * @default 'pages'
74
+ */
75
+ collectionSlug?: string;
76
+ /**
77
+ * Custom editor path pattern
78
+ * Use {id} as placeholder for the document ID
79
+ * @default '/admin/puck/{collectionSlug}/{id}/edit'
80
+ */
81
+ editorPathPattern?: string;
82
+ }
83
+ /**
84
+ * Custom cell component that renders an "Edit with Puck" button in list views
85
+ *
86
+ * Add this to a UI field in your collection to show the visual editor button
87
+ * in the list view table.
88
+ *
89
+ * @example
90
+ * ```ts
91
+ * // In your collection config:
92
+ * {
93
+ * name: 'puckEdit',
94
+ * type: 'ui',
95
+ * admin: {
96
+ * components: {
97
+ * Cell: '@delmaredigital/payload-puck/admin#EditWithPuckCell',
98
+ * },
99
+ * custom: {
100
+ * collectionSlug: 'pages',
101
+ * },
102
+ * },
103
+ * }
104
+ * ```
105
+ */
106
+ declare const EditWithPuckCell: React.FC<DefaultCellComponentProps>;
107
+
108
+ export { EditWithPuckButton, type EditWithPuckButtonProps, EditWithPuckCell, type EditWithPuckCellConfig, EditWithPuckLink };
@@ -0,0 +1,177 @@
1
+ "use client";
2
+ 'use strict';
3
+
4
+ var ui = require('@payloadcms/ui');
5
+ var jsxRuntime = require('react/jsx-runtime');
6
+
7
+ function PuckIcon({ size = 18 }) {
8
+ return /* @__PURE__ */ jsxRuntime.jsxs(
9
+ "svg",
10
+ {
11
+ xmlns: "http://www.w3.org/2000/svg",
12
+ width: size,
13
+ height: size,
14
+ viewBox: "0 0 24 24",
15
+ fill: "none",
16
+ stroke: "currentColor",
17
+ strokeWidth: "2",
18
+ strokeLinecap: "round",
19
+ strokeLinejoin: "round",
20
+ children: [
21
+ /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7" }),
22
+ /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M18.375 2.625a2.121 2.121 0 1 1 3 3L12 15l-4 1 1-4Z" })
23
+ ]
24
+ }
25
+ );
26
+ }
27
+ var EditWithPuckButton = (props) => {
28
+ const { id } = ui.useDocumentInfo();
29
+ const customProps = props?.field?.custom;
30
+ const label = customProps?.label || "Edit with Puck";
31
+ const iconOnly = customProps?.iconOnly || false;
32
+ const pattern = customProps?.editorPathPattern || "/pages/{id}/edit";
33
+ const editorPath = pattern.replace("{id}", String(id));
34
+ if (!id) {
35
+ return null;
36
+ }
37
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { style: { marginBottom: "1rem" }, children: /* @__PURE__ */ jsxRuntime.jsxs(
38
+ "a",
39
+ {
40
+ href: editorPath,
41
+ style: {
42
+ display: "inline-flex",
43
+ alignItems: "center",
44
+ gap: "8px",
45
+ padding: iconOnly ? "8px" : "10px 16px",
46
+ backgroundColor: "#2563eb",
47
+ color: "#fff",
48
+ borderRadius: "6px",
49
+ textDecoration: "none",
50
+ fontSize: "14px",
51
+ fontWeight: 500,
52
+ transition: "background-color 0.2s"
53
+ },
54
+ onMouseEnter: (e) => {
55
+ e.currentTarget.style.backgroundColor = "#1d4ed8";
56
+ },
57
+ onMouseLeave: (e) => {
58
+ e.currentTarget.style.backgroundColor = "#2563eb";
59
+ },
60
+ title: iconOnly ? label : void 0,
61
+ children: [
62
+ /* @__PURE__ */ jsxRuntime.jsx(PuckIcon, { size: iconOnly ? 20 : 18 }),
63
+ !iconOnly && label
64
+ ]
65
+ }
66
+ ) });
67
+ };
68
+ function EditWithPuckLink({
69
+ id,
70
+ editorPathPattern = "/pages/{id}/edit",
71
+ label = "Edit with Puck",
72
+ iconOnly = false
73
+ }) {
74
+ const path = editorPathPattern.replace("{id}", id);
75
+ return /* @__PURE__ */ jsxRuntime.jsxs(
76
+ "a",
77
+ {
78
+ href: path,
79
+ style: {
80
+ display: "inline-flex",
81
+ alignItems: "center",
82
+ gap: "8px",
83
+ padding: iconOnly ? "8px" : "10px 16px",
84
+ backgroundColor: "#2563eb",
85
+ color: "#fff",
86
+ borderRadius: "6px",
87
+ textDecoration: "none",
88
+ fontSize: "14px",
89
+ fontWeight: 500,
90
+ transition: "background-color 0.2s"
91
+ },
92
+ onMouseEnter: (e) => {
93
+ e.currentTarget.style.backgroundColor = "#1d4ed8";
94
+ },
95
+ onMouseLeave: (e) => {
96
+ e.currentTarget.style.backgroundColor = "#2563eb";
97
+ },
98
+ title: iconOnly ? label : void 0,
99
+ children: [
100
+ /* @__PURE__ */ jsxRuntime.jsx(PuckIcon, { size: iconOnly ? 20 : 18 }),
101
+ !iconOnly && label
102
+ ]
103
+ }
104
+ );
105
+ }
106
+ function PuckIcon2({ size = 16 }) {
107
+ return /* @__PURE__ */ jsxRuntime.jsxs(
108
+ "svg",
109
+ {
110
+ xmlns: "http://www.w3.org/2000/svg",
111
+ width: size,
112
+ height: size,
113
+ viewBox: "0 0 24 24",
114
+ fill: "none",
115
+ stroke: "currentColor",
116
+ strokeWidth: "2",
117
+ strokeLinecap: "round",
118
+ strokeLinejoin: "round",
119
+ children: [
120
+ /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7" }),
121
+ /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M18.375 2.625a2.121 2.121 0 1 1 3 3L12 15l-4 1 1-4Z" })
122
+ ]
123
+ }
124
+ );
125
+ }
126
+ var EditWithPuckCell = ({
127
+ rowData,
128
+ field,
129
+ collectionSlug: contextCollectionSlug
130
+ }) => {
131
+ const id = rowData?.id;
132
+ const customConfig = field?.custom;
133
+ const collectionSlug = customConfig?.collectionSlug || contextCollectionSlug || "pages";
134
+ if (!id) {
135
+ return null;
136
+ }
137
+ const editorPath = customConfig?.editorPathPattern ? customConfig.editorPathPattern.replace("{id}", id).replace("{collectionSlug}", collectionSlug) : `/admin/puck/${collectionSlug}/${id}/edit`;
138
+ return /* @__PURE__ */ jsxRuntime.jsxs(
139
+ "a",
140
+ {
141
+ href: editorPath,
142
+ onClick: (e) => e.stopPropagation(),
143
+ style: {
144
+ display: "inline-flex",
145
+ alignItems: "center",
146
+ justifyContent: "center",
147
+ padding: "6px 10px",
148
+ backgroundColor: "#2563eb",
149
+ color: "#fff",
150
+ borderRadius: "4px",
151
+ textDecoration: "none",
152
+ fontSize: "12px",
153
+ fontWeight: 500,
154
+ gap: "4px",
155
+ transition: "background-color 0.2s",
156
+ whiteSpace: "nowrap"
157
+ },
158
+ onMouseEnter: (e) => {
159
+ e.currentTarget.style.backgroundColor = "#1d4ed8";
160
+ },
161
+ onMouseLeave: (e) => {
162
+ e.currentTarget.style.backgroundColor = "#2563eb";
163
+ },
164
+ title: "Edit with Puck Visual Editor",
165
+ children: [
166
+ /* @__PURE__ */ jsxRuntime.jsx(PuckIcon2, { size: 14 }),
167
+ /* @__PURE__ */ jsxRuntime.jsx("span", { children: "Visual Editor" })
168
+ ]
169
+ }
170
+ );
171
+ };
172
+
173
+ exports.EditWithPuckButton = EditWithPuckButton;
174
+ exports.EditWithPuckCell = EditWithPuckCell;
175
+ exports.EditWithPuckLink = EditWithPuckLink;
176
+ //# sourceMappingURL=client.js.map
177
+ //# sourceMappingURL=client.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/admin/EditWithPuckButton.tsx","../../src/admin/EditWithPuckCell.tsx"],"names":["jsxs","jsx","useDocumentInfo","PuckIcon"],"mappings":";;;;;AAuCA,SAAS,QAAA,CAAS,EAAE,IAAA,GAAO,EAAA,EAAG,EAAsB;AAClD,EAAA,uBACEA,eAAA;AAAA,IAAC,KAAA;AAAA,IAAA;AAAA,MACC,KAAA,EAAM,4BAAA;AAAA,MACN,KAAA,EAAO,IAAA;AAAA,MACP,MAAA,EAAQ,IAAA;AAAA,MACR,OAAA,EAAQ,WAAA;AAAA,MACR,IAAA,EAAK,MAAA;AAAA,MACL,MAAA,EAAO,cAAA;AAAA,MACP,WAAA,EAAY,GAAA;AAAA,MACZ,aAAA,EAAc,OAAA;AAAA,MACd,cAAA,EAAe,OAAA;AAAA,MAEf,QAAA,EAAA;AAAA,wBAAAC,cAAA,CAAC,MAAA,EAAA,EAAK,GAAE,4DAAA,EAA6D,CAAA;AAAA,wBACrEA,cAAA,CAAC,MAAA,EAAA,EAAK,CAAA,EAAE,qDAAA,EAAsD;AAAA;AAAA;AAAA,GAChE;AAEJ;AA2BO,IAAM,kBAAA,GAA6C,CAAC,KAAA,KAAU;AAEnE,EAAA,MAAM,EAAE,EAAA,EAAG,GAAIC,kBAAA,EAAgB;AAG/B,EAAA,MAAM,WAAA,GAAe,OAAe,KAAA,EAAO,MAAA;AAC3C,EAAA,MAAM,KAAA,GAAQ,aAAa,KAAA,IAAS,gBAAA;AACpC,EAAA,MAAM,QAAA,GAAW,aAAa,QAAA,IAAY,KAAA;AAG1C,EAAA,MAAM,OAAA,GAAU,aAAa,iBAAA,IAAqB,kBAAA;AAClD,EAAA,MAAM,aAAa,OAAA,CAAQ,OAAA,CAAQ,MAAA,EAAQ,MAAA,CAAO,EAAE,CAAC,CAAA;AAErD,EAAA,IAAI,CAAC,EAAA,EAAI;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QACjB,KAAA,EAAO,MAAA;AAAA,QACP,YAAA,EAAc,KAAA;AAAA,QACd,cAAA,EAAgB,MAAA;AAAA,QAChB,QAAA,EAAU,MAAA;AAAA,QACV,UAAA,EAAY,GAAA;AAAA,QACZ,GAAA,EAAK,KAAA;AAAA,QACL,UAAA,EAAY,uBAAA;AAAA,QACZ,UAAA,EAAY;AAAA,OACd;AAAA,MACA,YAAA,EAAc,CAAC,CAAA,KAAM;AACnB,QAAA,CAAA,CAAE,aAAA,CAAc,MAAM,eAAA,GAAkB,SAAA;AAAA,MAC1C,CAAA;AAAA,MACA,YAAA,EAAc,CAAC,CAAA,KAAM;AACnB,QAAA,CAAA,CAAE,aAAA,CAAc,MAAM,eAAA,GAAkB,SAAA;AAAA,MAC1C,CAAA;AAAA,MACA,KAAA,EAAM,8BAAA;AAAA,MAEN,QAAA,EAAA;AAAA,wBAAAC,cAAAA,CAACE,SAAAA,EAAA,EAAS,IAAA,EAAM,EAAA,EAAI,CAAA;AAAA,wBACpBF,cAAAA,CAAC,MAAA,EAAA,EAAK,QAAA,EAAA,eAAA,EAAa;AAAA;AAAA;AAAA,GACrB;AAEJ","file":"client.js","sourcesContent":["'use client'\n\nimport type { UIFieldClientComponent } from 'payload'\nimport { useDocumentInfo } from '@payloadcms/ui'\n\n/**\n * Props for EditWithPuckButton when used standalone\n */\nexport interface EditWithPuckButtonProps {\n /**\n * Document ID to edit\n */\n id?: string\n /**\n * Collection slug\n * @default 'pages'\n */\n collectionSlug?: string\n /**\n * Custom path pattern for the Puck editor\n * Use {id} as placeholder for the document ID\n * @default '/pages/{id}/edit'\n */\n editorPathPattern?: string\n /**\n * Button label\n * @default 'Edit with Puck'\n */\n label?: string\n /**\n * Whether to show as icon only\n * @default false\n */\n iconOnly?: boolean\n}\n\n/**\n * Pencil/Edit icon component\n */\nfunction PuckIcon({ size = 18 }: { size?: number }) {\n return (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n width={size}\n height={size}\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n >\n <path d=\"M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7\" />\n <path d=\"M18.375 2.625a2.121 2.121 0 1 1 3 3L12 15l-4 1 1-4Z\" />\n </svg>\n )\n}\n\n/**\n * Edit with Puck button for use in Payload admin document edit views\n *\n * Links to a Puck editor page outside of Payload admin. Configure the\n * `editorPathPattern` to match your editor route.\n *\n * @example\n * ```tsx\n * // In your Payload collection config:\n * {\n * name: 'puckEdit',\n * type: 'ui',\n * admin: {\n * position: 'sidebar',\n * components: {\n * Field: '@delmaredigital/payload-puck/admin/client#EditWithPuckButton',\n * },\n * custom: {\n * editorPathPattern: '/pages/{id}/edit', // Your editor route\n * label: 'Visual Editor',\n * },\n * },\n * }\n * ```\n */\nexport const EditWithPuckButton: UIFieldClientComponent = (props) => {\n // Get document context from Payload\n const { id } = useDocumentInfo()\n\n // Extract custom props passed via field config\n const customProps = (props as any)?.field?.custom as EditWithPuckButtonProps | undefined\n const label = customProps?.label || 'Edit with Puck'\n const iconOnly = customProps?.iconOnly || false\n\n // Build editor URL from pattern (default: /pages/{id}/edit)\n const pattern = customProps?.editorPathPattern || '/pages/{id}/edit'\n const editorPath = pattern.replace('{id}', String(id))\n\n if (!id) {\n return null\n }\n\n return (\n <div style={{ marginBottom: '1rem' }}>\n <a\n href={editorPath}\n style={{\n display: 'inline-flex',\n alignItems: 'center',\n gap: '8px',\n padding: iconOnly ? '8px' : '10px 16px',\n backgroundColor: '#2563eb',\n color: '#fff',\n borderRadius: '6px',\n textDecoration: 'none',\n fontSize: '14px',\n fontWeight: 500,\n transition: 'background-color 0.2s',\n }}\n onMouseEnter={(e) => {\n e.currentTarget.style.backgroundColor = '#1d4ed8'\n }}\n onMouseLeave={(e) => {\n e.currentTarget.style.backgroundColor = '#2563eb'\n }}\n title={iconOnly ? label : undefined}\n >\n <PuckIcon size={iconOnly ? 20 : 18} />\n {!iconOnly && label}\n </a>\n </div>\n )\n}\n\n/**\n * Standalone version of the button that doesn't rely on Payload context\n */\nexport function EditWithPuckLink({\n id,\n editorPathPattern = '/pages/{id}/edit',\n label = 'Edit with Puck',\n iconOnly = false,\n}: EditWithPuckButtonProps & { id: string }) {\n const path = editorPathPattern.replace('{id}', id)\n\n return (\n <a\n href={path}\n style={{\n display: 'inline-flex',\n alignItems: 'center',\n gap: '8px',\n padding: iconOnly ? '8px' : '10px 16px',\n backgroundColor: '#2563eb',\n color: '#fff',\n borderRadius: '6px',\n textDecoration: 'none',\n fontSize: '14px',\n fontWeight: 500,\n transition: 'background-color 0.2s',\n }}\n onMouseEnter={(e) => {\n e.currentTarget.style.backgroundColor = '#1d4ed8'\n }}\n onMouseLeave={(e) => {\n e.currentTarget.style.backgroundColor = '#2563eb'\n }}\n title={iconOnly ? label : undefined}\n >\n <PuckIcon size={iconOnly ? 20 : 18} />\n {!iconOnly && label}\n </a>\n )\n}\n\nexport default EditWithPuckButton\n","'use client'\n\nimport type { DefaultCellComponentProps } from 'payload'\n\n/**\n * Props for configuring the EditWithPuckCell component\n */\nexport interface EditWithPuckCellConfig {\n /**\n * Collection slug for building the editor URL\n * @default 'pages'\n */\n collectionSlug?: string\n /**\n * Custom editor path pattern\n * Use {id} as placeholder for the document ID\n * @default '/admin/puck/{collectionSlug}/{id}/edit'\n */\n editorPathPattern?: string\n}\n\n/**\n * Pencil/Edit icon component\n */\nfunction PuckIcon({ size = 16 }: { size?: number }) {\n return (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n width={size}\n height={size}\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n >\n <path d=\"M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7\" />\n <path d=\"M18.375 2.625a2.121 2.121 0 1 1 3 3L12 15l-4 1 1-4Z\" />\n </svg>\n )\n}\n\n/**\n * Custom cell component that renders an \"Edit with Puck\" button in list views\n *\n * Add this to a UI field in your collection to show the visual editor button\n * in the list view table.\n *\n * @example\n * ```ts\n * // In your collection config:\n * {\n * name: 'puckEdit',\n * type: 'ui',\n * admin: {\n * components: {\n * Cell: '@delmaredigital/payload-puck/admin#EditWithPuckCell',\n * },\n * custom: {\n * collectionSlug: 'pages',\n * },\n * },\n * }\n * ```\n */\nexport const EditWithPuckCell: React.FC<DefaultCellComponentProps> = ({\n rowData,\n field,\n collectionSlug: contextCollectionSlug,\n}) => {\n // Get document ID from row data\n const id = rowData?.id as string | undefined\n\n // Get custom config from field\n const customConfig = (field as any)?.custom as EditWithPuckCellConfig | undefined\n const collectionSlug = customConfig?.collectionSlug || contextCollectionSlug || 'pages'\n\n if (!id) {\n return null\n }\n\n // Build editor URL\n const editorPath = customConfig?.editorPathPattern\n ? customConfig.editorPathPattern.replace('{id}', id).replace('{collectionSlug}', collectionSlug)\n : `/admin/puck/${collectionSlug}/${id}/edit`\n\n return (\n <a\n href={editorPath}\n onClick={(e) => e.stopPropagation()}\n style={{\n display: 'inline-flex',\n alignItems: 'center',\n justifyContent: 'center',\n padding: '6px 10px',\n backgroundColor: '#2563eb',\n color: '#fff',\n borderRadius: '4px',\n textDecoration: 'none',\n fontSize: '12px',\n fontWeight: 500,\n gap: '4px',\n transition: 'background-color 0.2s',\n whiteSpace: 'nowrap',\n }}\n onMouseEnter={(e) => {\n e.currentTarget.style.backgroundColor = '#1d4ed8'\n }}\n onMouseLeave={(e) => {\n e.currentTarget.style.backgroundColor = '#2563eb'\n }}\n title=\"Edit with Puck Visual Editor\"\n >\n <PuckIcon size={14} />\n <span>Visual Editor</span>\n </a>\n )\n}\n\nexport default EditWithPuckCell\n"]}
@@ -0,0 +1,173 @@
1
+ "use client";
2
+ import { useDocumentInfo } from '@payloadcms/ui';
3
+ import { jsx, jsxs } from 'react/jsx-runtime';
4
+
5
+ function PuckIcon({ size = 18 }) {
6
+ return /* @__PURE__ */ jsxs(
7
+ "svg",
8
+ {
9
+ xmlns: "http://www.w3.org/2000/svg",
10
+ width: size,
11
+ height: size,
12
+ viewBox: "0 0 24 24",
13
+ fill: "none",
14
+ stroke: "currentColor",
15
+ strokeWidth: "2",
16
+ strokeLinecap: "round",
17
+ strokeLinejoin: "round",
18
+ children: [
19
+ /* @__PURE__ */ jsx("path", { d: "M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7" }),
20
+ /* @__PURE__ */ jsx("path", { d: "M18.375 2.625a2.121 2.121 0 1 1 3 3L12 15l-4 1 1-4Z" })
21
+ ]
22
+ }
23
+ );
24
+ }
25
+ var EditWithPuckButton = (props) => {
26
+ const { id } = useDocumentInfo();
27
+ const customProps = props?.field?.custom;
28
+ const label = customProps?.label || "Edit with Puck";
29
+ const iconOnly = customProps?.iconOnly || false;
30
+ const pattern = customProps?.editorPathPattern || "/pages/{id}/edit";
31
+ const editorPath = pattern.replace("{id}", String(id));
32
+ if (!id) {
33
+ return null;
34
+ }
35
+ return /* @__PURE__ */ jsx("div", { style: { marginBottom: "1rem" }, children: /* @__PURE__ */ jsxs(
36
+ "a",
37
+ {
38
+ href: editorPath,
39
+ style: {
40
+ display: "inline-flex",
41
+ alignItems: "center",
42
+ gap: "8px",
43
+ padding: iconOnly ? "8px" : "10px 16px",
44
+ backgroundColor: "#2563eb",
45
+ color: "#fff",
46
+ borderRadius: "6px",
47
+ textDecoration: "none",
48
+ fontSize: "14px",
49
+ fontWeight: 500,
50
+ transition: "background-color 0.2s"
51
+ },
52
+ onMouseEnter: (e) => {
53
+ e.currentTarget.style.backgroundColor = "#1d4ed8";
54
+ },
55
+ onMouseLeave: (e) => {
56
+ e.currentTarget.style.backgroundColor = "#2563eb";
57
+ },
58
+ title: iconOnly ? label : void 0,
59
+ children: [
60
+ /* @__PURE__ */ jsx(PuckIcon, { size: iconOnly ? 20 : 18 }),
61
+ !iconOnly && label
62
+ ]
63
+ }
64
+ ) });
65
+ };
66
+ function EditWithPuckLink({
67
+ id,
68
+ editorPathPattern = "/pages/{id}/edit",
69
+ label = "Edit with Puck",
70
+ iconOnly = false
71
+ }) {
72
+ const path = editorPathPattern.replace("{id}", id);
73
+ return /* @__PURE__ */ jsxs(
74
+ "a",
75
+ {
76
+ href: path,
77
+ style: {
78
+ display: "inline-flex",
79
+ alignItems: "center",
80
+ gap: "8px",
81
+ padding: iconOnly ? "8px" : "10px 16px",
82
+ backgroundColor: "#2563eb",
83
+ color: "#fff",
84
+ borderRadius: "6px",
85
+ textDecoration: "none",
86
+ fontSize: "14px",
87
+ fontWeight: 500,
88
+ transition: "background-color 0.2s"
89
+ },
90
+ onMouseEnter: (e) => {
91
+ e.currentTarget.style.backgroundColor = "#1d4ed8";
92
+ },
93
+ onMouseLeave: (e) => {
94
+ e.currentTarget.style.backgroundColor = "#2563eb";
95
+ },
96
+ title: iconOnly ? label : void 0,
97
+ children: [
98
+ /* @__PURE__ */ jsx(PuckIcon, { size: iconOnly ? 20 : 18 }),
99
+ !iconOnly && label
100
+ ]
101
+ }
102
+ );
103
+ }
104
+ function PuckIcon2({ size = 16 }) {
105
+ return /* @__PURE__ */ jsxs(
106
+ "svg",
107
+ {
108
+ xmlns: "http://www.w3.org/2000/svg",
109
+ width: size,
110
+ height: size,
111
+ viewBox: "0 0 24 24",
112
+ fill: "none",
113
+ stroke: "currentColor",
114
+ strokeWidth: "2",
115
+ strokeLinecap: "round",
116
+ strokeLinejoin: "round",
117
+ children: [
118
+ /* @__PURE__ */ jsx("path", { d: "M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7" }),
119
+ /* @__PURE__ */ jsx("path", { d: "M18.375 2.625a2.121 2.121 0 1 1 3 3L12 15l-4 1 1-4Z" })
120
+ ]
121
+ }
122
+ );
123
+ }
124
+ var EditWithPuckCell = ({
125
+ rowData,
126
+ field,
127
+ collectionSlug: contextCollectionSlug
128
+ }) => {
129
+ const id = rowData?.id;
130
+ const customConfig = field?.custom;
131
+ const collectionSlug = customConfig?.collectionSlug || contextCollectionSlug || "pages";
132
+ if (!id) {
133
+ return null;
134
+ }
135
+ const editorPath = customConfig?.editorPathPattern ? customConfig.editorPathPattern.replace("{id}", id).replace("{collectionSlug}", collectionSlug) : `/admin/puck/${collectionSlug}/${id}/edit`;
136
+ return /* @__PURE__ */ jsxs(
137
+ "a",
138
+ {
139
+ href: editorPath,
140
+ onClick: (e) => e.stopPropagation(),
141
+ style: {
142
+ display: "inline-flex",
143
+ alignItems: "center",
144
+ justifyContent: "center",
145
+ padding: "6px 10px",
146
+ backgroundColor: "#2563eb",
147
+ color: "#fff",
148
+ borderRadius: "4px",
149
+ textDecoration: "none",
150
+ fontSize: "12px",
151
+ fontWeight: 500,
152
+ gap: "4px",
153
+ transition: "background-color 0.2s",
154
+ whiteSpace: "nowrap"
155
+ },
156
+ onMouseEnter: (e) => {
157
+ e.currentTarget.style.backgroundColor = "#1d4ed8";
158
+ },
159
+ onMouseLeave: (e) => {
160
+ e.currentTarget.style.backgroundColor = "#2563eb";
161
+ },
162
+ title: "Edit with Puck Visual Editor",
163
+ children: [
164
+ /* @__PURE__ */ jsx(PuckIcon2, { size: 14 }),
165
+ /* @__PURE__ */ jsx("span", { children: "Visual Editor" })
166
+ ]
167
+ }
168
+ );
169
+ };
170
+
171
+ export { EditWithPuckButton, EditWithPuckCell, EditWithPuckLink };
172
+ //# sourceMappingURL=client.mjs.map
173
+ //# sourceMappingURL=client.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/admin/EditWithPuckButton.tsx","../../src/admin/EditWithPuckCell.tsx"],"names":["PuckIcon","jsxs","jsx"],"mappings":";;;AAuCA,SAAS,QAAA,CAAS,EAAE,IAAA,GAAO,EAAA,EAAG,EAAsB;AAClD,EAAA,uBACE,IAAA;AAAA,IAAC,KAAA;AAAA,IAA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AAM,eAAA,GAAkB,SAAA;AAAA,MAC1C,CAAA;AAAA,MACA,YAAA,EAAc,CAAC,CAAA,KAAM;AACnB,QAAA,CAAA,CAAE,aAAA,CAAc,MAAM,eAAA,GAAkB,SAAA;AAAA,MAC1C,CAAA;AAAA,MACA,KAAA,EAAM,8BAAA;AAAA,MAEN,QAAA,EAAA;AAAA,wBAAAC,GAAAA,CAACF,SAAAA,EAAA,EAAS,IAAA,EAAM,EAAA,EAAI,CAAA;AAAA,wBACpBE,GAAAA,CAAC,MAAA,EAAA,EAAK,QAAA,EAAA,eAAA,EAAa;AAAA;AAAA;AAAA,GACrB;AAEJ","file":"client.mjs","sourcesContent":["'use client'\n\nimport type { UIFieldClientComponent } from 'payload'\nimport { useDocumentInfo } from '@payloadcms/ui'\n\n/**\n * Props for EditWithPuckButton when used standalone\n */\nexport interface EditWithPuckButtonProps {\n /**\n * Document ID to edit\n */\n id?: string\n /**\n * Collection slug\n * @default 'pages'\n */\n collectionSlug?: string\n /**\n * Custom path pattern for the Puck editor\n * Use {id} as placeholder for the document ID\n * @default '/pages/{id}/edit'\n */\n editorPathPattern?: string\n /**\n * Button label\n * @default 'Edit with Puck'\n */\n label?: string\n /**\n * Whether to show as icon only\n * @default false\n */\n iconOnly?: boolean\n}\n\n/**\n * Pencil/Edit icon component\n */\nfunction PuckIcon({ size = 18 }: { size?: number }) {\n return (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n width={size}\n height={size}\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n >\n <path d=\"M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7\" />\n <path d=\"M18.375 2.625a2.121 2.121 0 1 1 3 3L12 15l-4 1 1-4Z\" />\n </svg>\n )\n}\n\n/**\n * Edit with Puck button for use in Payload admin document edit views\n *\n * Links to a Puck editor page outside of Payload admin. Configure the\n * `editorPathPattern` to match your editor route.\n *\n * @example\n * ```tsx\n * // In your Payload collection config:\n * {\n * name: 'puckEdit',\n * type: 'ui',\n * admin: {\n * position: 'sidebar',\n * components: {\n * Field: '@delmaredigital/payload-puck/admin/client#EditWithPuckButton',\n * },\n * custom: {\n * editorPathPattern: '/pages/{id}/edit', // Your editor route\n * label: 'Visual Editor',\n * },\n * },\n * }\n * ```\n */\nexport const EditWithPuckButton: UIFieldClientComponent = (props) => {\n // Get document context from Payload\n const { id } = useDocumentInfo()\n\n // Extract custom props passed via field config\n const customProps = (props as any)?.field?.custom as EditWithPuckButtonProps | undefined\n const label = customProps?.label || 'Edit with Puck'\n const iconOnly = customProps?.iconOnly || false\n\n // Build editor URL from pattern (default: /pages/{id}/edit)\n const pattern = customProps?.editorPathPattern || '/pages/{id}/edit'\n const editorPath = pattern.replace('{id}', String(id))\n\n if (!id) {\n return null\n }\n\n return (\n <div style={{ marginBottom: '1rem' }}>\n <a\n href={editorPath}\n style={{\n display: 'inline-flex',\n alignItems: 'center',\n gap: '8px',\n padding: iconOnly ? '8px' : '10px 16px',\n backgroundColor: '#2563eb',\n color: '#fff',\n borderRadius: '6px',\n textDecoration: 'none',\n fontSize: '14px',\n fontWeight: 500,\n transition: 'background-color 0.2s',\n }}\n onMouseEnter={(e) => {\n e.currentTarget.style.backgroundColor = '#1d4ed8'\n }}\n onMouseLeave={(e) => {\n e.currentTarget.style.backgroundColor = '#2563eb'\n }}\n title={iconOnly ? label : undefined}\n >\n <PuckIcon size={iconOnly ? 20 : 18} />\n {!iconOnly && label}\n </a>\n </div>\n )\n}\n\n/**\n * Standalone version of the button that doesn't rely on Payload context\n */\nexport function EditWithPuckLink({\n id,\n editorPathPattern = '/pages/{id}/edit',\n label = 'Edit with Puck',\n iconOnly = false,\n}: EditWithPuckButtonProps & { id: string }) {\n const path = editorPathPattern.replace('{id}', id)\n\n return (\n <a\n href={path}\n style={{\n display: 'inline-flex',\n alignItems: 'center',\n gap: '8px',\n padding: iconOnly ? '8px' : '10px 16px',\n backgroundColor: '#2563eb',\n color: '#fff',\n borderRadius: '6px',\n textDecoration: 'none',\n fontSize: '14px',\n fontWeight: 500,\n transition: 'background-color 0.2s',\n }}\n onMouseEnter={(e) => {\n e.currentTarget.style.backgroundColor = '#1d4ed8'\n }}\n onMouseLeave={(e) => {\n e.currentTarget.style.backgroundColor = '#2563eb'\n }}\n title={iconOnly ? label : undefined}\n >\n <PuckIcon size={iconOnly ? 20 : 18} />\n {!iconOnly && label}\n </a>\n )\n}\n\nexport default EditWithPuckButton\n","'use client'\n\nimport type { DefaultCellComponentProps } from 'payload'\n\n/**\n * Props for configuring the EditWithPuckCell component\n */\nexport interface EditWithPuckCellConfig {\n /**\n * Collection slug for building the editor URL\n * @default 'pages'\n */\n collectionSlug?: string\n /**\n * Custom editor path pattern\n * Use {id} as placeholder for the document ID\n * @default '/admin/puck/{collectionSlug}/{id}/edit'\n */\n editorPathPattern?: string\n}\n\n/**\n * Pencil/Edit icon component\n */\nfunction PuckIcon({ size = 16 }: { size?: number }) {\n return (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n width={size}\n height={size}\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n >\n <path d=\"M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7\" />\n <path d=\"M18.375 2.625a2.121 2.121 0 1 1 3 3L12 15l-4 1 1-4Z\" />\n </svg>\n )\n}\n\n/**\n * Custom cell component that renders an \"Edit with Puck\" button in list views\n *\n * Add this to a UI field in your collection to show the visual editor button\n * in the list view table.\n *\n * @example\n * ```ts\n * // In your collection config:\n * {\n * name: 'puckEdit',\n * type: 'ui',\n * admin: {\n * components: {\n * Cell: '@delmaredigital/payload-puck/admin#EditWithPuckCell',\n * },\n * custom: {\n * collectionSlug: 'pages',\n * },\n * },\n * }\n * ```\n */\nexport const EditWithPuckCell: React.FC<DefaultCellComponentProps> = ({\n rowData,\n field,\n collectionSlug: contextCollectionSlug,\n}) => {\n // Get document ID from row data\n const id = rowData?.id as string | undefined\n\n // Get custom config from field\n const customConfig = (field as any)?.custom as EditWithPuckCellConfig | undefined\n const collectionSlug = customConfig?.collectionSlug || contextCollectionSlug || 'pages'\n\n if (!id) {\n return null\n }\n\n // Build editor URL\n const editorPath = customConfig?.editorPathPattern\n ? customConfig.editorPathPattern.replace('{id}', id).replace('{collectionSlug}', collectionSlug)\n : `/admin/puck/${collectionSlug}/${id}/edit`\n\n return (\n <a\n href={editorPath}\n onClick={(e) => e.stopPropagation()}\n style={{\n display: 'inline-flex',\n alignItems: 'center',\n justifyContent: 'center',\n padding: '6px 10px',\n backgroundColor: '#2563eb',\n color: '#fff',\n borderRadius: '4px',\n textDecoration: 'none',\n fontSize: '12px',\n fontWeight: 500,\n gap: '4px',\n transition: 'background-color 0.2s',\n whiteSpace: 'nowrap',\n }}\n onMouseEnter={(e) => {\n e.currentTarget.style.backgroundColor = '#1d4ed8'\n }}\n onMouseLeave={(e) => {\n e.currentTarget.style.backgroundColor = '#2563eb'\n }}\n title=\"Edit with Puck Visual Editor\"\n >\n <PuckIcon size={14} />\n <span>Visual Editor</span>\n </a>\n )\n}\n\nexport default EditWithPuckCell\n"]}