@01.software/sdk 0.2.9-dev.260310.cf511cb → 0.2.9-dev.260311.892250f
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/README.md +21 -8
- package/dist/auth.cjs +3 -1
- package/dist/auth.cjs.map +1 -1
- package/dist/auth.d.cts +36 -3
- package/dist/auth.d.ts +36 -3
- package/dist/auth.js +3 -1
- package/dist/auth.js.map +1 -1
- package/dist/index.cjs +214 -231
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +321 -155
- package/dist/index.d.ts +321 -155
- package/dist/index.js +217 -231
- package/dist/index.js.map +1 -1
- package/dist/{payload-types-Cq93wqIe.d.cts → payload-types-BjvBwB8Z.d.cts} +1601 -1373
- package/dist/{payload-types-Cq93wqIe.d.ts → payload-types-BjvBwB8Z.d.ts} +1601 -1373
- package/dist/ui/code-block.cjs +182 -0
- package/dist/ui/code-block.cjs.map +1 -0
- package/dist/ui/code-block.d.cts +62 -0
- package/dist/ui/code-block.d.ts +62 -0
- package/dist/ui/code-block.js +152 -0
- package/dist/ui/code-block.js.map +1 -0
- package/dist/{flow.cjs → ui/flow.cjs} +120 -96
- package/dist/ui/flow.cjs.map +1 -0
- package/dist/{flow.d.cts → ui/flow.d.cts} +27 -11
- package/dist/{flow.d.ts → ui/flow.d.ts} +27 -11
- package/dist/{flow.js → ui/flow.js} +119 -94
- package/dist/ui/flow.js.map +1 -0
- package/dist/{components.cjs → ui/form.cjs} +27 -520
- package/dist/ui/form.cjs.map +1 -0
- package/dist/ui/form.d.cts +37 -0
- package/dist/ui/form.d.ts +37 -0
- package/dist/{components.js → ui/form.js} +20 -516
- package/dist/ui/form.js.map +1 -0
- package/dist/ui/image.cjs +208 -0
- package/dist/ui/image.cjs.map +1 -0
- package/dist/ui/image.d.cts +44 -0
- package/dist/ui/image.d.ts +44 -0
- package/dist/ui/image.js +180 -0
- package/dist/ui/image.js.map +1 -0
- package/dist/ui/rich-text.cjs +258 -0
- package/dist/ui/rich-text.cjs.map +1 -0
- package/dist/ui/rich-text.d.cts +110 -0
- package/dist/ui/rich-text.d.ts +110 -0
- package/dist/ui/rich-text.js +235 -0
- package/dist/ui/rich-text.js.map +1 -0
- package/dist/{webhook-NRdVwXN7.d.cts → webhook-CszIpUKn.d.cts} +2 -2
- package/dist/{webhook-C_7s0K66.d.ts → webhook-_LdLdjGa.d.ts} +2 -2
- package/dist/webhook.d.cts +2 -2
- package/dist/webhook.d.ts +2 -2
- package/package.json +47 -12
- package/dist/auth-CVVo5UT5.d.ts +0 -298
- package/dist/auth-CqgrT1qd.d.cts +0 -298
- package/dist/components.cjs.map +0 -1
- package/dist/components.d.cts +0 -240
- package/dist/components.d.ts +0 -240
- package/dist/components.js.map +0 -1
- package/dist/flow.cjs.map +0 -1
- package/dist/flow.js.map +0 -1
|
@@ -0,0 +1,258 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
"use client";
|
|
3
|
+
var __create = Object.create;
|
|
4
|
+
var __defProp = Object.defineProperty;
|
|
5
|
+
var __defProps = Object.defineProperties;
|
|
6
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
7
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
8
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
9
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
10
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
11
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
12
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
13
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
14
|
+
var __spreadValues = (a, b) => {
|
|
15
|
+
for (var prop in b || (b = {}))
|
|
16
|
+
if (__hasOwnProp.call(b, prop))
|
|
17
|
+
__defNormalProp(a, prop, b[prop]);
|
|
18
|
+
if (__getOwnPropSymbols)
|
|
19
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
20
|
+
if (__propIsEnum.call(b, prop))
|
|
21
|
+
__defNormalProp(a, prop, b[prop]);
|
|
22
|
+
}
|
|
23
|
+
return a;
|
|
24
|
+
};
|
|
25
|
+
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
26
|
+
var __objRest = (source, exclude) => {
|
|
27
|
+
var target = {};
|
|
28
|
+
for (var prop in source)
|
|
29
|
+
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
30
|
+
target[prop] = source[prop];
|
|
31
|
+
if (source != null && __getOwnPropSymbols)
|
|
32
|
+
for (var prop of __getOwnPropSymbols(source)) {
|
|
33
|
+
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
|
|
34
|
+
target[prop] = source[prop];
|
|
35
|
+
}
|
|
36
|
+
return target;
|
|
37
|
+
};
|
|
38
|
+
var __export = (target, all) => {
|
|
39
|
+
for (var name in all)
|
|
40
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
41
|
+
};
|
|
42
|
+
var __copyProps = (to, from, except, desc) => {
|
|
43
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
44
|
+
for (let key of __getOwnPropNames(from))
|
|
45
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
46
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
47
|
+
}
|
|
48
|
+
return to;
|
|
49
|
+
};
|
|
50
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
51
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
52
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
53
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
54
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
55
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
56
|
+
mod
|
|
57
|
+
));
|
|
58
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
59
|
+
|
|
60
|
+
// src/ui/RichText/index.tsx
|
|
61
|
+
var RichText_exports = {};
|
|
62
|
+
__export(RichText_exports, {
|
|
63
|
+
RichTextContent: () => RichTextContent,
|
|
64
|
+
StyledRichTextContent: () => StyledRichTextContent
|
|
65
|
+
});
|
|
66
|
+
module.exports = __toCommonJS(RichText_exports);
|
|
67
|
+
var import_react2 = __toESM(require("react"), 1);
|
|
68
|
+
var import_react3 = require("@payloadcms/richtext-lexical/react");
|
|
69
|
+
|
|
70
|
+
// src/ui/RichText/styled.tsx
|
|
71
|
+
var import_react = __toESM(require("react"), 1);
|
|
72
|
+
function createComponentConverters(components, internalDocToHref) {
|
|
73
|
+
const converters = {};
|
|
74
|
+
if (components.Heading) {
|
|
75
|
+
const Heading = components.Heading;
|
|
76
|
+
converters.heading = ({ node, nodesToJSX }) => /* @__PURE__ */ import_react.default.createElement(Heading, { tag: node.tag, node }, nodesToJSX({ nodes: node.children }));
|
|
77
|
+
}
|
|
78
|
+
if (components.Paragraph) {
|
|
79
|
+
const Paragraph = components.Paragraph;
|
|
80
|
+
converters.paragraph = ({ node, nodesToJSX }) => {
|
|
81
|
+
const children = nodesToJSX({ nodes: node.children });
|
|
82
|
+
return /* @__PURE__ */ import_react.default.createElement(Paragraph, { isEmpty: !(children == null ? void 0 : children.length), node }, (children == null ? void 0 : children.length) ? children : /* @__PURE__ */ import_react.default.createElement("br", null));
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
if (components.Blockquote) {
|
|
86
|
+
const Blockquote = components.Blockquote;
|
|
87
|
+
converters.quote = ({ node, nodesToJSX }) => /* @__PURE__ */ import_react.default.createElement(Blockquote, { node }, nodesToJSX({ nodes: node.children }));
|
|
88
|
+
}
|
|
89
|
+
if (components.List) {
|
|
90
|
+
const List = components.List;
|
|
91
|
+
converters.list = ({ node, nodesToJSX }) => /* @__PURE__ */ import_react.default.createElement(List, { tag: node.tag, listType: node.listType, node }, nodesToJSX({ nodes: node.children }));
|
|
92
|
+
}
|
|
93
|
+
if (components.ListItem) {
|
|
94
|
+
const ListItem = components.ListItem;
|
|
95
|
+
converters.listitem = ({ node, nodesToJSX }) => {
|
|
96
|
+
const hasSubLists = node.children.some(
|
|
97
|
+
(child) => child.type === "list"
|
|
98
|
+
);
|
|
99
|
+
return /* @__PURE__ */ import_react.default.createElement(
|
|
100
|
+
ListItem,
|
|
101
|
+
{
|
|
102
|
+
hasSubLists,
|
|
103
|
+
checked: node.checked,
|
|
104
|
+
value: node.value,
|
|
105
|
+
node
|
|
106
|
+
},
|
|
107
|
+
nodesToJSX({ nodes: node.children })
|
|
108
|
+
);
|
|
109
|
+
};
|
|
110
|
+
}
|
|
111
|
+
if (components.Link) {
|
|
112
|
+
const Link = components.Link;
|
|
113
|
+
const resolveHref = (node) => {
|
|
114
|
+
var _a;
|
|
115
|
+
if (node.fields.linkType === "internal") {
|
|
116
|
+
return internalDocToHref ? internalDocToHref({ linkNode: node }) : "#";
|
|
117
|
+
}
|
|
118
|
+
return (_a = node.fields.url) != null ? _a : "";
|
|
119
|
+
};
|
|
120
|
+
converters.link = ({ node, nodesToJSX }) => /* @__PURE__ */ import_react.default.createElement(
|
|
121
|
+
Link,
|
|
122
|
+
{
|
|
123
|
+
href: resolveHref(node),
|
|
124
|
+
rel: node.fields.newTab ? "noopener noreferrer" : void 0,
|
|
125
|
+
target: node.fields.newTab ? "_blank" : void 0,
|
|
126
|
+
node
|
|
127
|
+
},
|
|
128
|
+
nodesToJSX({ nodes: node.children })
|
|
129
|
+
);
|
|
130
|
+
converters.autolink = ({ node, nodesToJSX }) => {
|
|
131
|
+
var _a;
|
|
132
|
+
return /* @__PURE__ */ import_react.default.createElement(
|
|
133
|
+
Link,
|
|
134
|
+
{
|
|
135
|
+
href: (_a = node.fields.url) != null ? _a : "",
|
|
136
|
+
rel: node.fields.newTab ? "noopener noreferrer" : void 0,
|
|
137
|
+
target: node.fields.newTab ? "_blank" : void 0,
|
|
138
|
+
node
|
|
139
|
+
},
|
|
140
|
+
nodesToJSX({ nodes: node.children })
|
|
141
|
+
);
|
|
142
|
+
};
|
|
143
|
+
}
|
|
144
|
+
if (components.HorizontalRule) {
|
|
145
|
+
const HorizontalRule = components.HorizontalRule;
|
|
146
|
+
converters.horizontalrule = /* @__PURE__ */ import_react.default.createElement(HorizontalRule, null);
|
|
147
|
+
}
|
|
148
|
+
if (components.Upload) {
|
|
149
|
+
const Upload = components.Upload;
|
|
150
|
+
converters.upload = ({ node }) => {
|
|
151
|
+
var _a;
|
|
152
|
+
const uploadNode = node;
|
|
153
|
+
if (typeof uploadNode.value !== "object") return null;
|
|
154
|
+
const doc = uploadNode.value;
|
|
155
|
+
return /* @__PURE__ */ import_react.default.createElement(
|
|
156
|
+
Upload,
|
|
157
|
+
{
|
|
158
|
+
src: doc.url,
|
|
159
|
+
alt: ((_a = uploadNode.fields) == null ? void 0 : _a.alt) || (doc == null ? void 0 : doc.alt) || "",
|
|
160
|
+
width: doc.width,
|
|
161
|
+
height: doc.height,
|
|
162
|
+
mimeType: doc.mimeType,
|
|
163
|
+
filename: doc.filename,
|
|
164
|
+
sizes: doc.sizes,
|
|
165
|
+
node
|
|
166
|
+
}
|
|
167
|
+
);
|
|
168
|
+
};
|
|
169
|
+
}
|
|
170
|
+
if (components.Table) {
|
|
171
|
+
const Table = components.Table;
|
|
172
|
+
converters.table = ({ node, nodesToJSX }) => /* @__PURE__ */ import_react.default.createElement(Table, { node }, nodesToJSX({ nodes: node.children }));
|
|
173
|
+
}
|
|
174
|
+
if (components.TableRow) {
|
|
175
|
+
const TableRow = components.TableRow;
|
|
176
|
+
converters.tablerow = ({ node, nodesToJSX }) => /* @__PURE__ */ import_react.default.createElement(TableRow, { node }, nodesToJSX({ nodes: node.children }));
|
|
177
|
+
}
|
|
178
|
+
if (components.TableCell) {
|
|
179
|
+
const TableCell = components.TableCell;
|
|
180
|
+
converters.tablecell = ({ node, nodesToJSX }) => /* @__PURE__ */ import_react.default.createElement(
|
|
181
|
+
TableCell,
|
|
182
|
+
{
|
|
183
|
+
tag: node.headerState > 0 ? "th" : "td",
|
|
184
|
+
colSpan: node.colSpan > 1 ? node.colSpan : void 0,
|
|
185
|
+
rowSpan: node.rowSpan > 1 ? node.rowSpan : void 0,
|
|
186
|
+
backgroundColor: node.backgroundColor || void 0,
|
|
187
|
+
node
|
|
188
|
+
},
|
|
189
|
+
nodesToJSX({ nodes: node.children })
|
|
190
|
+
);
|
|
191
|
+
}
|
|
192
|
+
return converters;
|
|
193
|
+
}
|
|
194
|
+
function StyledRichTextContent(_a) {
|
|
195
|
+
var _b = _a, {
|
|
196
|
+
components = {},
|
|
197
|
+
internalDocToHref,
|
|
198
|
+
blocks,
|
|
199
|
+
textState
|
|
200
|
+
} = _b, props = __objRest(_b, [
|
|
201
|
+
"components",
|
|
202
|
+
"internalDocToHref",
|
|
203
|
+
"blocks",
|
|
204
|
+
"textState"
|
|
205
|
+
]);
|
|
206
|
+
const converters = createComponentConverters(components, internalDocToHref);
|
|
207
|
+
return /* @__PURE__ */ import_react.default.createElement(
|
|
208
|
+
RichTextContent,
|
|
209
|
+
__spreadProps(__spreadValues({}, props), {
|
|
210
|
+
internalDocToHref,
|
|
211
|
+
converters,
|
|
212
|
+
blocks,
|
|
213
|
+
textState
|
|
214
|
+
})
|
|
215
|
+
);
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
// src/ui/RichText/index.tsx
|
|
219
|
+
function hyphenToCamel(str) {
|
|
220
|
+
return str.replace(/-([a-z])/g, (_, c) => c.toUpperCase());
|
|
221
|
+
}
|
|
222
|
+
function createTextStateConverter(state) {
|
|
223
|
+
const defaultTextConverter = import_react3.TextJSXConverter.text;
|
|
224
|
+
return (_a) => {
|
|
225
|
+
var _b = _a, { node } = _b, rest = __objRest(_b, ["node"]);
|
|
226
|
+
var _a2, _b2;
|
|
227
|
+
const base = defaultTextConverter(__spreadValues({ node }, rest));
|
|
228
|
+
const nodeState = node.$;
|
|
229
|
+
if (!nodeState || typeof nodeState !== "object") return base;
|
|
230
|
+
const style = {};
|
|
231
|
+
for (const stateKey in nodeState) {
|
|
232
|
+
const stateValue = nodeState[stateKey];
|
|
233
|
+
if (!stateValue) continue;
|
|
234
|
+
const css = (_b2 = (_a2 = state[stateKey]) == null ? void 0 : _a2[stateValue]) == null ? void 0 : _b2.css;
|
|
235
|
+
if (css) {
|
|
236
|
+
for (const prop in css) {
|
|
237
|
+
const val = css[prop];
|
|
238
|
+
if (val) style[hyphenToCamel(prop)] = val;
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
if (Object.keys(style).length === 0) return base;
|
|
243
|
+
return /* @__PURE__ */ import_react2.default.createElement("span", { style }, base);
|
|
244
|
+
};
|
|
245
|
+
}
|
|
246
|
+
function RichTextContent({
|
|
247
|
+
data,
|
|
248
|
+
className,
|
|
249
|
+
internalDocToHref,
|
|
250
|
+
converters,
|
|
251
|
+
blocks,
|
|
252
|
+
disableDefaultConverters,
|
|
253
|
+
textState
|
|
254
|
+
}) {
|
|
255
|
+
const baseConverters = __spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues({}, disableDefaultConverters ? {} : import_react3.defaultJSXConverters), (0, import_react3.LinkJSXConverter)({ internalDocToHref })), textState ? { text: createTextStateConverter(textState) } : {}), converters), blocks ? { blocks } : {});
|
|
256
|
+
return /* @__PURE__ */ import_react2.default.createElement(import_react3.RichText, { data, className, converters: baseConverters });
|
|
257
|
+
}
|
|
258
|
+
//# sourceMappingURL=rich-text.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/ui/RichText/index.tsx","../../src/ui/RichText/styled.tsx"],"sourcesContent":["'use client'\n\nimport React from 'react'\nimport {\n SerializedBlockNode,\n SerializedLinkNode,\n} from '@payloadcms/richtext-lexical'\nimport {\n SerializedEditorState,\n SerializedLexicalNode,\n} from '@payloadcms/richtext-lexical/lexical'\nimport {\n defaultJSXConverters,\n JSXConverter,\n JSXConverters,\n LinkJSXConverter,\n RichText,\n TextJSXConverter,\n} from '@payloadcms/richtext-lexical/react'\n\nexport type RichTextData = SerializedEditorState<SerializedLexicalNode>\n\nexport type TextStateConfig = {\n [stateKey: string]: {\n [stateValue: string]: {\n css: Record<string, string>\n label: string\n }\n }\n}\n\nexport interface RichTextContentProps {\n data: RichTextData\n className?: string\n internalDocToHref?: (args: { linkNode: SerializedLinkNode }) => string\n converters?: Partial<JSXConverters>\n blocks?: Record<string, JSXConverter<SerializedBlockNode>>\n disableDefaultConverters?: boolean\n textState?: TextStateConfig\n}\n\nexport { StyledRichTextContent } from './styled'\nexport type {\n RichTextComponents,\n StyledRichTextContentProps,\n HeadingSlotProps,\n ParagraphSlotProps,\n BlockquoteSlotProps,\n ListSlotProps,\n ListItemSlotProps,\n LinkSlotProps,\n HorizontalRuleSlotProps,\n UploadSlotProps,\n TableSlotProps,\n TableRowSlotProps,\n TableCellSlotProps,\n} from './styled'\n\nfunction hyphenToCamel(str: string): string {\n return str.replace(/-([a-z])/g, (_, c) => c.toUpperCase())\n}\n\nfunction createTextStateConverter(\n state: TextStateConfig,\n): JSXConverters['text'] {\n const defaultTextConverter = TextJSXConverter.text\n // eslint-disable-next-line react/display-name\n return ({ node, ...rest }) => {\n const base = (\n defaultTextConverter as (...args: unknown[]) => React.ReactNode\n )({ node, ...rest })\n const nodeState = (node as Record<string, unknown>).$ as\n | Record<string, string>\n | undefined\n if (!nodeState || typeof nodeState !== 'object') return base\n\n const style: Record<string, string> = {}\n for (const stateKey in nodeState) {\n const stateValue = nodeState[stateKey]\n if (!stateValue) continue\n const css = state[stateKey]?.[stateValue]?.css\n if (css) {\n for (const prop in css) {\n const val = css[prop]\n if (val) style[hyphenToCamel(prop)] = val\n }\n }\n }\n\n if (Object.keys(style).length === 0) return base\n return <span style={style}>{base}</span>\n }\n}\n\nexport function RichTextContent({\n data,\n className,\n internalDocToHref,\n converters,\n blocks,\n disableDefaultConverters,\n textState,\n}: RichTextContentProps) {\n const baseConverters: JSXConverters = {\n ...(disableDefaultConverters ? {} : defaultJSXConverters),\n ...LinkJSXConverter({ internalDocToHref }),\n ...(textState ? { text: createTextStateConverter(textState) } : {}),\n ...converters,\n ...(blocks ? { blocks } : {}),\n }\n\n return (\n <RichText data={data} className={className} converters={baseConverters} />\n )\n}\n","'use client'\n\n/* eslint-disable @typescript-eslint/no-explicit-any */\nimport React from 'react'\nimport { SerializedLinkNode } from '@payloadcms/richtext-lexical'\nimport { JSXConverters } from '@payloadcms/richtext-lexical/react'\nimport { RichTextContent, RichTextContentProps } from './index'\n\n// --- Slot prop types (each slot gets structured data + raw node) ---\n\nexport interface HeadingSlotProps {\n tag: 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6'\n children: React.ReactNode\n node: any\n}\n\nexport interface ParagraphSlotProps {\n children: React.ReactNode\n isEmpty: boolean\n node: any\n}\n\nexport interface BlockquoteSlotProps {\n children: React.ReactNode\n node: any\n}\n\nexport interface ListSlotProps {\n tag: 'ul' | 'ol'\n listType: string\n children: React.ReactNode\n node: any\n}\n\nexport interface ListItemSlotProps {\n children: React.ReactNode\n hasSubLists: boolean\n checked?: boolean\n value?: number\n node: any\n}\n\nexport interface LinkSlotProps {\n href: string\n target?: string\n rel?: string\n children: React.ReactNode\n node: any\n}\n\nexport interface HorizontalRuleSlotProps {\n node?: any\n}\n\nexport interface UploadSlotProps {\n src: string\n alt: string\n width?: number\n height?: number\n mimeType: string\n filename: string\n sizes?: Record<string, any>\n node: any\n}\n\nexport interface TableSlotProps {\n children: React.ReactNode\n node: any\n}\n\nexport interface TableRowSlotProps {\n children: React.ReactNode\n node: any\n}\n\nexport interface TableCellSlotProps {\n tag: 'th' | 'td'\n children: React.ReactNode\n colSpan?: number\n rowSpan?: number\n backgroundColor?: string\n node: any\n}\n\n// --- Components map ---\n\nexport interface RichTextComponents {\n Heading?: React.ComponentType<HeadingSlotProps>\n Paragraph?: React.ComponentType<ParagraphSlotProps>\n Blockquote?: React.ComponentType<BlockquoteSlotProps>\n List?: React.ComponentType<ListSlotProps>\n ListItem?: React.ComponentType<ListItemSlotProps>\n Link?: React.ComponentType<LinkSlotProps>\n HorizontalRule?: React.ComponentType<HorizontalRuleSlotProps>\n Upload?: React.ComponentType<UploadSlotProps>\n Table?: React.ComponentType<TableSlotProps>\n TableRow?: React.ComponentType<TableRowSlotProps>\n TableCell?: React.ComponentType<TableCellSlotProps>\n}\n\nexport interface StyledRichTextContentProps\n extends Omit<RichTextContentProps, 'converters' | 'disableDefaultConverters'> {\n components?: RichTextComponents\n}\n\nfunction createComponentConverters(\n components: RichTextComponents,\n internalDocToHref?: (args: { linkNode: SerializedLinkNode }) => string,\n): Partial<JSXConverters> {\n const converters: Partial<JSXConverters> = {}\n\n if (components.Heading) {\n const Heading = components.Heading\n converters.heading = ({ node, nodesToJSX }) => (\n <Heading tag={node.tag} node={node}>\n {nodesToJSX({ nodes: node.children })}\n </Heading>\n )\n }\n\n if (components.Paragraph) {\n const Paragraph = components.Paragraph\n converters.paragraph = ({ node, nodesToJSX }) => {\n const children = nodesToJSX({ nodes: node.children })\n return (\n <Paragraph isEmpty={!children?.length} node={node}>\n {children?.length ? children : <br />}\n </Paragraph>\n )\n }\n }\n\n if (components.Blockquote) {\n const Blockquote = components.Blockquote\n converters.quote = ({ node, nodesToJSX }) => (\n <Blockquote node={node}>\n {nodesToJSX({ nodes: node.children })}\n </Blockquote>\n )\n }\n\n if (components.List) {\n const List = components.List\n converters.list = ({ node, nodesToJSX }) => (\n <List tag={node.tag} listType={node.listType} node={node}>\n {nodesToJSX({ nodes: node.children })}\n </List>\n )\n }\n\n if (components.ListItem) {\n const ListItem = components.ListItem\n converters.listitem = ({ node, nodesToJSX }) => {\n const hasSubLists = node.children.some(\n (child: { type: string }) => child.type === 'list',\n )\n return (\n <ListItem\n hasSubLists={hasSubLists}\n checked={node.checked}\n value={node.value}\n node={node}\n >\n {nodesToJSX({ nodes: node.children })}\n </ListItem>\n )\n }\n }\n\n if (components.Link) {\n const Link = components.Link\n\n const resolveHref = (node: any): string => {\n if (node.fields.linkType === 'internal') {\n return internalDocToHref ? internalDocToHref({ linkNode: node }) : '#'\n }\n return node.fields.url ?? ''\n }\n\n converters.link = ({ node, nodesToJSX }) => (\n <Link\n href={resolveHref(node)}\n rel={node.fields.newTab ? 'noopener noreferrer' : undefined}\n target={node.fields.newTab ? '_blank' : undefined}\n node={node}\n >\n {nodesToJSX({ nodes: node.children })}\n </Link>\n )\n\n converters.autolink = ({ node, nodesToJSX }) => (\n <Link\n href={node.fields.url ?? ''}\n rel={node.fields.newTab ? 'noopener noreferrer' : undefined}\n target={node.fields.newTab ? '_blank' : undefined}\n node={node}\n >\n {nodesToJSX({ nodes: node.children })}\n </Link>\n )\n }\n\n if (components.HorizontalRule) {\n const HorizontalRule = components.HorizontalRule\n converters.horizontalrule = <HorizontalRule />\n }\n\n if (components.Upload) {\n const Upload = components.Upload\n converters.upload = ({ node }) => {\n const uploadNode = node as any\n if (typeof uploadNode.value !== 'object') return null\n const doc = uploadNode.value\n return (\n <Upload\n src={doc.url}\n alt={uploadNode.fields?.alt || doc?.alt || ''}\n width={doc.width}\n height={doc.height}\n mimeType={doc.mimeType}\n filename={doc.filename}\n sizes={doc.sizes}\n node={node}\n />\n )\n }\n }\n\n if (components.Table) {\n const Table = components.Table\n converters.table = ({ node, nodesToJSX }) => (\n <Table node={node}>{nodesToJSX({ nodes: node.children })}</Table>\n )\n }\n\n if (components.TableRow) {\n const TableRow = components.TableRow\n converters.tablerow = ({ node, nodesToJSX }) => (\n <TableRow node={node}>{nodesToJSX({ nodes: node.children })}</TableRow>\n )\n }\n\n if (components.TableCell) {\n const TableCell = components.TableCell\n converters.tablecell = ({ node, nodesToJSX }) => (\n <TableCell\n tag={node.headerState > 0 ? 'th' : 'td'}\n colSpan={node.colSpan > 1 ? node.colSpan : undefined}\n rowSpan={node.rowSpan > 1 ? node.rowSpan : undefined}\n backgroundColor={node.backgroundColor || undefined}\n node={node}\n >\n {nodesToJSX({ nodes: node.children })}\n </TableCell>\n )\n }\n\n return converters\n}\n\nexport function StyledRichTextContent({\n components = {},\n internalDocToHref,\n blocks,\n textState,\n ...props\n}: StyledRichTextContentProps) {\n const converters = createComponentConverters(components, internalDocToHref)\n\n return (\n <RichTextContent\n {...props}\n internalDocToHref={internalDocToHref}\n converters={converters}\n blocks={blocks}\n textState={textState}\n />\n )\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,IAAAA,gBAAkB;AASlB,IAAAA,gBAOO;;;ACfP,mBAAkB;AAsGlB,SAAS,0BACP,YACA,mBACwB;AACxB,QAAM,aAAqC,CAAC;AAE5C,MAAI,WAAW,SAAS;AACtB,UAAM,UAAU,WAAW;AAC3B,eAAW,UAAU,CAAC,EAAE,MAAM,WAAW,MACvC,6BAAAC,QAAA,cAAC,WAAQ,KAAK,KAAK,KAAK,QACrB,WAAW,EAAE,OAAO,KAAK,SAAS,CAAC,CACtC;AAAA,EAEJ;AAEA,MAAI,WAAW,WAAW;AACxB,UAAM,YAAY,WAAW;AAC7B,eAAW,YAAY,CAAC,EAAE,MAAM,WAAW,MAAM;AAC/C,YAAM,WAAW,WAAW,EAAE,OAAO,KAAK,SAAS,CAAC;AACpD,aACE,6BAAAA,QAAA,cAAC,aAAU,SAAS,EAAC,qCAAU,SAAQ,SACpC,qCAAU,UAAS,WAAW,6BAAAA,QAAA,cAAC,UAAG,CACrC;AAAA,IAEJ;AAAA,EACF;AAEA,MAAI,WAAW,YAAY;AACzB,UAAM,aAAa,WAAW;AAC9B,eAAW,QAAQ,CAAC,EAAE,MAAM,WAAW,MACrC,6BAAAA,QAAA,cAAC,cAAW,QACT,WAAW,EAAE,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AAC,WAAY;AACjB,YAAM,OAAMA,OAAAD,MAAA,MAAM,QAAQ,MAAd,gBAAAA,IAAkB,gBAAlB,gBAAAC,IAA+B;AAC3C,UAAI,KAAK;AACP,mBAAW,QAAQ,KAAK;AACtB,gBAAM,MAAM,IAAI,IAAI;AACpB,cAAI,IAAK,OAAM,cAAc,IAAI,CAAC,IAAI;AAAA,QACxC;AAAA,MACF;AAAA,IACF;AAEA,QAAI,OAAO,KAAK,KAAK,EAAE,WAAW,EAAG,QAAO;AAC5C,WAAO,8BAAAC,QAAA,cAAC,UAAK,SAAe,IAAK;AAAA,EACnC;AACF;AAEO,SAAS,gBAAgB;AAAA,EAC9B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,GAAyB;AACvB,QAAM,iBAAgC,+EAChC,2BAA2B,CAAC,IAAI,yCACjC,gCAAiB,EAAE,kBAAkB,CAAC,IACrC,YAAY,EAAE,MAAM,yBAAyB,SAAS,EAAE,IAAI,CAAC,IAC9D,aACC,SAAS,EAAE,OAAO,IAAI,CAAC;AAG7B,SACE,8BAAAA,QAAA,cAAC,0BAAS,MAAY,WAAsB,YAAY,gBAAgB;AAE5E;","names":["import_react","React","_a","_b","React"]}
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { SerializedLinkNode, SerializedBlockNode } from '@payloadcms/richtext-lexical';
|
|
3
|
+
import { SerializedEditorState, SerializedLexicalNode } from '@payloadcms/richtext-lexical/lexical';
|
|
4
|
+
import { JSXConverters, JSXConverter } from '@payloadcms/richtext-lexical/react';
|
|
5
|
+
|
|
6
|
+
interface HeadingSlotProps {
|
|
7
|
+
tag: 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6';
|
|
8
|
+
children: React.ReactNode;
|
|
9
|
+
node: any;
|
|
10
|
+
}
|
|
11
|
+
interface ParagraphSlotProps {
|
|
12
|
+
children: React.ReactNode;
|
|
13
|
+
isEmpty: boolean;
|
|
14
|
+
node: any;
|
|
15
|
+
}
|
|
16
|
+
interface BlockquoteSlotProps {
|
|
17
|
+
children: React.ReactNode;
|
|
18
|
+
node: any;
|
|
19
|
+
}
|
|
20
|
+
interface ListSlotProps {
|
|
21
|
+
tag: 'ul' | 'ol';
|
|
22
|
+
listType: string;
|
|
23
|
+
children: React.ReactNode;
|
|
24
|
+
node: any;
|
|
25
|
+
}
|
|
26
|
+
interface ListItemSlotProps {
|
|
27
|
+
children: React.ReactNode;
|
|
28
|
+
hasSubLists: boolean;
|
|
29
|
+
checked?: boolean;
|
|
30
|
+
value?: number;
|
|
31
|
+
node: any;
|
|
32
|
+
}
|
|
33
|
+
interface LinkSlotProps {
|
|
34
|
+
href: string;
|
|
35
|
+
target?: string;
|
|
36
|
+
rel?: string;
|
|
37
|
+
children: React.ReactNode;
|
|
38
|
+
node: any;
|
|
39
|
+
}
|
|
40
|
+
interface HorizontalRuleSlotProps {
|
|
41
|
+
node?: any;
|
|
42
|
+
}
|
|
43
|
+
interface UploadSlotProps {
|
|
44
|
+
src: string;
|
|
45
|
+
alt: string;
|
|
46
|
+
width?: number;
|
|
47
|
+
height?: number;
|
|
48
|
+
mimeType: string;
|
|
49
|
+
filename: string;
|
|
50
|
+
sizes?: Record<string, any>;
|
|
51
|
+
node: any;
|
|
52
|
+
}
|
|
53
|
+
interface TableSlotProps {
|
|
54
|
+
children: React.ReactNode;
|
|
55
|
+
node: any;
|
|
56
|
+
}
|
|
57
|
+
interface TableRowSlotProps {
|
|
58
|
+
children: React.ReactNode;
|
|
59
|
+
node: any;
|
|
60
|
+
}
|
|
61
|
+
interface TableCellSlotProps {
|
|
62
|
+
tag: 'th' | 'td';
|
|
63
|
+
children: React.ReactNode;
|
|
64
|
+
colSpan?: number;
|
|
65
|
+
rowSpan?: number;
|
|
66
|
+
backgroundColor?: string;
|
|
67
|
+
node: any;
|
|
68
|
+
}
|
|
69
|
+
interface RichTextComponents {
|
|
70
|
+
Heading?: React.ComponentType<HeadingSlotProps>;
|
|
71
|
+
Paragraph?: React.ComponentType<ParagraphSlotProps>;
|
|
72
|
+
Blockquote?: React.ComponentType<BlockquoteSlotProps>;
|
|
73
|
+
List?: React.ComponentType<ListSlotProps>;
|
|
74
|
+
ListItem?: React.ComponentType<ListItemSlotProps>;
|
|
75
|
+
Link?: React.ComponentType<LinkSlotProps>;
|
|
76
|
+
HorizontalRule?: React.ComponentType<HorizontalRuleSlotProps>;
|
|
77
|
+
Upload?: React.ComponentType<UploadSlotProps>;
|
|
78
|
+
Table?: React.ComponentType<TableSlotProps>;
|
|
79
|
+
TableRow?: React.ComponentType<TableRowSlotProps>;
|
|
80
|
+
TableCell?: React.ComponentType<TableCellSlotProps>;
|
|
81
|
+
}
|
|
82
|
+
interface StyledRichTextContentProps extends Omit<RichTextContentProps, 'converters' | 'disableDefaultConverters'> {
|
|
83
|
+
components?: RichTextComponents;
|
|
84
|
+
}
|
|
85
|
+
declare function StyledRichTextContent({ components, internalDocToHref, blocks, textState, ...props }: StyledRichTextContentProps): React.JSX.Element;
|
|
86
|
+
|
|
87
|
+
type RichTextData = SerializedEditorState<SerializedLexicalNode>;
|
|
88
|
+
type TextStateConfig = {
|
|
89
|
+
[stateKey: string]: {
|
|
90
|
+
[stateValue: string]: {
|
|
91
|
+
css: Record<string, string>;
|
|
92
|
+
label: string;
|
|
93
|
+
};
|
|
94
|
+
};
|
|
95
|
+
};
|
|
96
|
+
interface RichTextContentProps {
|
|
97
|
+
data: RichTextData;
|
|
98
|
+
className?: string;
|
|
99
|
+
internalDocToHref?: (args: {
|
|
100
|
+
linkNode: SerializedLinkNode;
|
|
101
|
+
}) => string;
|
|
102
|
+
converters?: Partial<JSXConverters>;
|
|
103
|
+
blocks?: Record<string, JSXConverter<SerializedBlockNode>>;
|
|
104
|
+
disableDefaultConverters?: boolean;
|
|
105
|
+
textState?: TextStateConfig;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
declare function RichTextContent({ data, className, internalDocToHref, converters, blocks, disableDefaultConverters, textState, }: RichTextContentProps): React.JSX.Element;
|
|
109
|
+
|
|
110
|
+
export { type BlockquoteSlotProps, type HeadingSlotProps, type HorizontalRuleSlotProps, type LinkSlotProps, type ListItemSlotProps, type ListSlotProps, type ParagraphSlotProps, type RichTextComponents, RichTextContent, type RichTextContentProps, type RichTextData, StyledRichTextContent, type StyledRichTextContentProps, type TableCellSlotProps, type TableRowSlotProps, type TableSlotProps, type TextStateConfig, type UploadSlotProps };
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { SerializedLinkNode, SerializedBlockNode } from '@payloadcms/richtext-lexical';
|
|
3
|
+
import { SerializedEditorState, SerializedLexicalNode } from '@payloadcms/richtext-lexical/lexical';
|
|
4
|
+
import { JSXConverters, JSXConverter } from '@payloadcms/richtext-lexical/react';
|
|
5
|
+
|
|
6
|
+
interface HeadingSlotProps {
|
|
7
|
+
tag: 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6';
|
|
8
|
+
children: React.ReactNode;
|
|
9
|
+
node: any;
|
|
10
|
+
}
|
|
11
|
+
interface ParagraphSlotProps {
|
|
12
|
+
children: React.ReactNode;
|
|
13
|
+
isEmpty: boolean;
|
|
14
|
+
node: any;
|
|
15
|
+
}
|
|
16
|
+
interface BlockquoteSlotProps {
|
|
17
|
+
children: React.ReactNode;
|
|
18
|
+
node: any;
|
|
19
|
+
}
|
|
20
|
+
interface ListSlotProps {
|
|
21
|
+
tag: 'ul' | 'ol';
|
|
22
|
+
listType: string;
|
|
23
|
+
children: React.ReactNode;
|
|
24
|
+
node: any;
|
|
25
|
+
}
|
|
26
|
+
interface ListItemSlotProps {
|
|
27
|
+
children: React.ReactNode;
|
|
28
|
+
hasSubLists: boolean;
|
|
29
|
+
checked?: boolean;
|
|
30
|
+
value?: number;
|
|
31
|
+
node: any;
|
|
32
|
+
}
|
|
33
|
+
interface LinkSlotProps {
|
|
34
|
+
href: string;
|
|
35
|
+
target?: string;
|
|
36
|
+
rel?: string;
|
|
37
|
+
children: React.ReactNode;
|
|
38
|
+
node: any;
|
|
39
|
+
}
|
|
40
|
+
interface HorizontalRuleSlotProps {
|
|
41
|
+
node?: any;
|
|
42
|
+
}
|
|
43
|
+
interface UploadSlotProps {
|
|
44
|
+
src: string;
|
|
45
|
+
alt: string;
|
|
46
|
+
width?: number;
|
|
47
|
+
height?: number;
|
|
48
|
+
mimeType: string;
|
|
49
|
+
filename: string;
|
|
50
|
+
sizes?: Record<string, any>;
|
|
51
|
+
node: any;
|
|
52
|
+
}
|
|
53
|
+
interface TableSlotProps {
|
|
54
|
+
children: React.ReactNode;
|
|
55
|
+
node: any;
|
|
56
|
+
}
|
|
57
|
+
interface TableRowSlotProps {
|
|
58
|
+
children: React.ReactNode;
|
|
59
|
+
node: any;
|
|
60
|
+
}
|
|
61
|
+
interface TableCellSlotProps {
|
|
62
|
+
tag: 'th' | 'td';
|
|
63
|
+
children: React.ReactNode;
|
|
64
|
+
colSpan?: number;
|
|
65
|
+
rowSpan?: number;
|
|
66
|
+
backgroundColor?: string;
|
|
67
|
+
node: any;
|
|
68
|
+
}
|
|
69
|
+
interface RichTextComponents {
|
|
70
|
+
Heading?: React.ComponentType<HeadingSlotProps>;
|
|
71
|
+
Paragraph?: React.ComponentType<ParagraphSlotProps>;
|
|
72
|
+
Blockquote?: React.ComponentType<BlockquoteSlotProps>;
|
|
73
|
+
List?: React.ComponentType<ListSlotProps>;
|
|
74
|
+
ListItem?: React.ComponentType<ListItemSlotProps>;
|
|
75
|
+
Link?: React.ComponentType<LinkSlotProps>;
|
|
76
|
+
HorizontalRule?: React.ComponentType<HorizontalRuleSlotProps>;
|
|
77
|
+
Upload?: React.ComponentType<UploadSlotProps>;
|
|
78
|
+
Table?: React.ComponentType<TableSlotProps>;
|
|
79
|
+
TableRow?: React.ComponentType<TableRowSlotProps>;
|
|
80
|
+
TableCell?: React.ComponentType<TableCellSlotProps>;
|
|
81
|
+
}
|
|
82
|
+
interface StyledRichTextContentProps extends Omit<RichTextContentProps, 'converters' | 'disableDefaultConverters'> {
|
|
83
|
+
components?: RichTextComponents;
|
|
84
|
+
}
|
|
85
|
+
declare function StyledRichTextContent({ components, internalDocToHref, blocks, textState, ...props }: StyledRichTextContentProps): React.JSX.Element;
|
|
86
|
+
|
|
87
|
+
type RichTextData = SerializedEditorState<SerializedLexicalNode>;
|
|
88
|
+
type TextStateConfig = {
|
|
89
|
+
[stateKey: string]: {
|
|
90
|
+
[stateValue: string]: {
|
|
91
|
+
css: Record<string, string>;
|
|
92
|
+
label: string;
|
|
93
|
+
};
|
|
94
|
+
};
|
|
95
|
+
};
|
|
96
|
+
interface RichTextContentProps {
|
|
97
|
+
data: RichTextData;
|
|
98
|
+
className?: string;
|
|
99
|
+
internalDocToHref?: (args: {
|
|
100
|
+
linkNode: SerializedLinkNode;
|
|
101
|
+
}) => string;
|
|
102
|
+
converters?: Partial<JSXConverters>;
|
|
103
|
+
blocks?: Record<string, JSXConverter<SerializedBlockNode>>;
|
|
104
|
+
disableDefaultConverters?: boolean;
|
|
105
|
+
textState?: TextStateConfig;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
declare function RichTextContent({ data, className, internalDocToHref, converters, blocks, disableDefaultConverters, textState, }: RichTextContentProps): React.JSX.Element;
|
|
109
|
+
|
|
110
|
+
export { type BlockquoteSlotProps, type HeadingSlotProps, type HorizontalRuleSlotProps, type LinkSlotProps, type ListItemSlotProps, type ListSlotProps, type ParagraphSlotProps, type RichTextComponents, RichTextContent, type RichTextContentProps, type RichTextData, StyledRichTextContent, type StyledRichTextContentProps, type TableCellSlotProps, type TableRowSlotProps, type TableSlotProps, type TextStateConfig, type UploadSlotProps };
|