tinacms 2.7.8 → 2.7.10
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/admin/components/Page.d.ts +3 -9
- package/dist/admin/components/Sidebar.d.ts +0 -3
- package/dist/admin/pages/CollectionCreatePage.d.ts +1 -1
- package/dist/admin/pages/DashboardPage.d.ts +0 -3
- package/dist/admin/pages/ScreenPage.d.ts +0 -3
- package/dist/index.js +7363 -6711
- package/dist/index.mjs +7467 -6816
- package/dist/internalClient/index.d.ts +6 -0
- package/dist/react.d.ts +13 -6
- package/dist/react.js +60 -52
- package/dist/react.mjs +60 -52
- package/dist/rich-text/static.d.ts +148 -0
- package/dist/rich-text/static.js +239 -0
- package/dist/rich-text/static.mjs +236 -0
- package/dist/toolkit/components/media/media-item.d.ts +1 -1
- package/dist/toolkit/components/ui/breadcrumb.d.ts +11 -0
- package/dist/toolkit/components/ui/dropdown-menu.d.ts +25 -0
- package/dist/toolkit/fields/components/password-field.d.ts +1 -1
- package/dist/toolkit/fields/components/reference/components/button.d.ts +1 -1
- package/dist/toolkit/fields/components/reference/components/popover.d.ts +1 -1
- package/dist/toolkit/fields/components/reference/model/reference-link-props.d.ts +2 -0
- package/dist/toolkit/fields/components/select.d.ts +2 -2
- package/dist/toolkit/fields/components/text-field.d.ts +1 -1
- package/dist/toolkit/fields/plugins/group-field-plugin.d.ts +1 -1
- package/dist/toolkit/fields/plugins/list-field-meta.d.ts +1 -1
- package/dist/toolkit/fields/plugins/mdx-field-plugin/index.d.ts +2 -2
- package/dist/toolkit/form-builder/fields-builder.d.ts +1 -1
- package/dist/toolkit/form-builder/form-builder.d.ts +4 -5
- package/dist/toolkit/forms/field.d.ts +3 -0
- package/dist/toolkit/forms/form.d.ts +22 -3
- package/dist/toolkit/git-client/git-client.d.ts +25 -2
- package/dist/toolkit/git-client/git-file.d.ts +18 -0
- package/dist/toolkit/git-client/git-media-store.d.ts +13 -0
- package/dist/toolkit/git-client/use-git-file.d.ts +4 -0
- package/dist/toolkit/icons/Tina.d.ts +0 -5
- package/dist/toolkit/index.d.ts +1 -1
- package/dist/toolkit/plugin-branch-switcher/branch-button.d.ts +1 -0
- package/dist/toolkit/plugin-branch-switcher/index.d.ts +0 -1
- package/dist/toolkit/react-sidebar/components/VersionInfo.d.ts +2 -0
- package/dist/toolkit/react-sidebar/components/alert.d.ts +5 -0
- package/dist/toolkit/react-sidebar/components/form-list.d.ts +1 -1
- package/dist/toolkit/react-sidebar/components/nav.d.ts +5 -3
- package/dist/toolkit/react-sidebar/components/resize-handle.d.ts +0 -5
- package/dist/toolkit/react-sidebar/components/sidebar-body.d.ts +3 -7
- package/dist/toolkit/react-sidebar/components/sidebar.d.ts +0 -7
- package/dist/toolkit/react-sidebar/components/sync-status.d.ts +5 -8
- package/dist/toolkit/react-sidebar/index.d.ts +1 -1
- package/dist/toolkit/styles/button.d.ts +2 -2
- package/dist/toolkit/tina-state.d.ts +11 -0
- package/dist/utils/cn.d.ts +2 -0
- package/package.json +11 -4
- package/dist/toolkit/plugin-branch-switcher/branch-banner.d.ts +0 -2
|
@@ -0,0 +1,239 @@
|
|
|
1
|
+
(function(global, factory) {
|
|
2
|
+
typeof exports === "object" && typeof module !== "undefined" ? factory(exports, require("react")) : typeof define === "function" && define.amd ? define(["exports", "react"], factory) : (global = typeof globalThis !== "undefined" ? globalThis : global || self, factory(global.tinacms = {}, global.NOOP));
|
|
3
|
+
})(this, function(exports2, React) {
|
|
4
|
+
"use strict";
|
|
5
|
+
const StaticTinaMarkdown = ({
|
|
6
|
+
content,
|
|
7
|
+
components = {}
|
|
8
|
+
}) => {
|
|
9
|
+
if (!content) {
|
|
10
|
+
return null;
|
|
11
|
+
}
|
|
12
|
+
const nodes = Array.isArray(content) ? content : content.children;
|
|
13
|
+
if (!nodes) {
|
|
14
|
+
return null;
|
|
15
|
+
}
|
|
16
|
+
return /* @__PURE__ */ React.createElement(React.Fragment, null, nodes.map((child, index) => {
|
|
17
|
+
return /* @__PURE__ */ React.createElement(Node, { components, key: index, child });
|
|
18
|
+
}));
|
|
19
|
+
};
|
|
20
|
+
const Leaf = (props) => {
|
|
21
|
+
let el = /* @__PURE__ */ React.createElement(React.Fragment, null, props.text);
|
|
22
|
+
if (props.components.text) {
|
|
23
|
+
const Component = props.components.text;
|
|
24
|
+
el = /* @__PURE__ */ React.createElement(Component, null, props.text);
|
|
25
|
+
}
|
|
26
|
+
if (props.bold) {
|
|
27
|
+
const Component = props.components.bold || "strong";
|
|
28
|
+
el = /* @__PURE__ */ React.createElement(Component, null, el);
|
|
29
|
+
}
|
|
30
|
+
if (props.italic) {
|
|
31
|
+
const Component = props.components.italic || "em";
|
|
32
|
+
el = /* @__PURE__ */ React.createElement(Component, null, el);
|
|
33
|
+
}
|
|
34
|
+
if (props.underline) {
|
|
35
|
+
const Component = props.components.underline || "u";
|
|
36
|
+
el = /* @__PURE__ */ React.createElement(Component, null, el);
|
|
37
|
+
}
|
|
38
|
+
if (props.strikethrough) {
|
|
39
|
+
const Component = props.components.strikethrough || "s";
|
|
40
|
+
el = /* @__PURE__ */ React.createElement(Component, null, el);
|
|
41
|
+
}
|
|
42
|
+
if (props.code) {
|
|
43
|
+
const Component = props.components.code || "code";
|
|
44
|
+
el = /* @__PURE__ */ React.createElement(Component, null, el);
|
|
45
|
+
}
|
|
46
|
+
return el;
|
|
47
|
+
};
|
|
48
|
+
const Node = ({
|
|
49
|
+
components,
|
|
50
|
+
child
|
|
51
|
+
}) => {
|
|
52
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
53
|
+
const { children, ...props } = child;
|
|
54
|
+
switch (child.type) {
|
|
55
|
+
case "h1":
|
|
56
|
+
case "h2":
|
|
57
|
+
case "h3":
|
|
58
|
+
case "h4":
|
|
59
|
+
case "h5":
|
|
60
|
+
case "h6":
|
|
61
|
+
case "p":
|
|
62
|
+
case "blockquote":
|
|
63
|
+
case "ol":
|
|
64
|
+
case "ul":
|
|
65
|
+
case "li":
|
|
66
|
+
if (components[child.type]) {
|
|
67
|
+
const Component2 = components[child.type];
|
|
68
|
+
return /* @__PURE__ */ React.createElement(Component2, { ...props }, /* @__PURE__ */ React.createElement(StaticTinaMarkdown, { components, content: children }));
|
|
69
|
+
}
|
|
70
|
+
return React.createElement(child.type, {
|
|
71
|
+
children: /* @__PURE__ */ React.createElement(StaticTinaMarkdown, { components, content: children })
|
|
72
|
+
});
|
|
73
|
+
case "lic":
|
|
74
|
+
if (components.lic) {
|
|
75
|
+
const Component2 = components.lic;
|
|
76
|
+
return /* @__PURE__ */ React.createElement(Component2, { ...props }, /* @__PURE__ */ React.createElement(StaticTinaMarkdown, { components, content: children }));
|
|
77
|
+
}
|
|
78
|
+
return /* @__PURE__ */ React.createElement("div", null, /* @__PURE__ */ React.createElement(
|
|
79
|
+
StaticTinaMarkdown,
|
|
80
|
+
{
|
|
81
|
+
components,
|
|
82
|
+
content: child.children
|
|
83
|
+
}
|
|
84
|
+
));
|
|
85
|
+
case "img":
|
|
86
|
+
if (components[child.type]) {
|
|
87
|
+
const Component2 = components[child.type];
|
|
88
|
+
return /* @__PURE__ */ React.createElement(Component2, { ...props });
|
|
89
|
+
}
|
|
90
|
+
return /* @__PURE__ */ React.createElement("img", { src: child.url, alt: child.alt });
|
|
91
|
+
case "a":
|
|
92
|
+
if (components[child.type]) {
|
|
93
|
+
const Component2 = components[child.type];
|
|
94
|
+
return (
|
|
95
|
+
//@ts-ignore Same issue with TinaMarkdown
|
|
96
|
+
/* @__PURE__ */ React.createElement(Component2, { ...props }, /* @__PURE__ */ React.createElement(StaticTinaMarkdown, { components, content: children }))
|
|
97
|
+
);
|
|
98
|
+
}
|
|
99
|
+
return /* @__PURE__ */ React.createElement("a", { href: child.url }, /* @__PURE__ */ React.createElement(StaticTinaMarkdown, { components, content: children }));
|
|
100
|
+
case "code_block": {
|
|
101
|
+
let codeString = "";
|
|
102
|
+
if (Array.isArray(child.children)) {
|
|
103
|
+
codeString = child.children.map(
|
|
104
|
+
(line) => Array.isArray(line.children) ? line.children.map((t) => t.text).join("") : ""
|
|
105
|
+
).join("\n");
|
|
106
|
+
} else if (typeof child.value === "string") {
|
|
107
|
+
codeString = child.value;
|
|
108
|
+
}
|
|
109
|
+
if (components[child.type]) {
|
|
110
|
+
const Component2 = components[child.type];
|
|
111
|
+
return /* @__PURE__ */ React.createElement(Component2, { ...props, value: codeString });
|
|
112
|
+
}
|
|
113
|
+
return /* @__PURE__ */ React.createElement("pre", null, /* @__PURE__ */ React.createElement("code", null, codeString));
|
|
114
|
+
}
|
|
115
|
+
case "hr":
|
|
116
|
+
if (components[child.type]) {
|
|
117
|
+
const Component2 = components[child.type];
|
|
118
|
+
return /* @__PURE__ */ React.createElement(Component2, { ...props });
|
|
119
|
+
}
|
|
120
|
+
return /* @__PURE__ */ React.createElement("hr", null);
|
|
121
|
+
case "break":
|
|
122
|
+
if (components[child.type]) {
|
|
123
|
+
const Component2 = components[child.type];
|
|
124
|
+
return /* @__PURE__ */ React.createElement(Component2, { ...props });
|
|
125
|
+
}
|
|
126
|
+
return /* @__PURE__ */ React.createElement("br", null);
|
|
127
|
+
case "text":
|
|
128
|
+
return /* @__PURE__ */ React.createElement(Leaf, { components, ...child });
|
|
129
|
+
case "mdxJsxTextElement":
|
|
130
|
+
case "mdxJsxFlowElement":
|
|
131
|
+
const Component = components[child.name];
|
|
132
|
+
if (Component) {
|
|
133
|
+
const props2 = child.props ? child.props : {};
|
|
134
|
+
return /* @__PURE__ */ React.createElement(Component, { ...props2 });
|
|
135
|
+
} else {
|
|
136
|
+
if (child.name === "table") {
|
|
137
|
+
const firstRowHeader = (_a = child.props) == null ? void 0 : _a.firstRowHeader;
|
|
138
|
+
const rows2 = (firstRowHeader ? (_b = child.props) == null ? void 0 : _b.tableRows.filter((_, i) => i !== 0) : (_c = child.props) == null ? void 0 : _c.tableRows) || [];
|
|
139
|
+
const header = (_e = (_d = child.props) == null ? void 0 : _d.tableRows) == null ? void 0 : _e.at(0);
|
|
140
|
+
const TableComponent2 = (
|
|
141
|
+
//@ts-ignore Same issue with TinaMarkdown
|
|
142
|
+
components["table"] || ((props2) => /* @__PURE__ */ React.createElement("table", { ...props2 }))
|
|
143
|
+
);
|
|
144
|
+
const TrComponent2 = components["tr"] || ((props2) => /* @__PURE__ */ React.createElement("tr", { ...props2 }));
|
|
145
|
+
const ThComponent = components["th"] || ((props2) => /* @__PURE__ */ React.createElement("th", { style: { textAlign: (props2 == null ? void 0 : props2.align) || "auto" }, ...props2 }));
|
|
146
|
+
const TdComponent2 = components["td"] || ((props2) => /* @__PURE__ */ React.createElement("td", { style: { textAlign: (props2 == null ? void 0 : props2.align) || "auto" }, ...props2 }));
|
|
147
|
+
const align2 = ((_f = child.props) == null ? void 0 : _f.align) || [];
|
|
148
|
+
return (
|
|
149
|
+
//@ts-ignore Same issue with TinaMarkdown
|
|
150
|
+
/* @__PURE__ */ React.createElement(TableComponent2, null, firstRowHeader && /* @__PURE__ */ React.createElement("thead", null, /* @__PURE__ */ React.createElement(TrComponent2, null, header.tableCells.map((c, i) => {
|
|
151
|
+
return /* @__PURE__ */ React.createElement(
|
|
152
|
+
StaticTinaMarkdown,
|
|
153
|
+
{
|
|
154
|
+
key: i,
|
|
155
|
+
components: {
|
|
156
|
+
p: (props2) => /* @__PURE__ */ React.createElement(ThComponent, { align: align2[i], ...props2 })
|
|
157
|
+
},
|
|
158
|
+
content: c.value
|
|
159
|
+
}
|
|
160
|
+
);
|
|
161
|
+
}))), /* @__PURE__ */ React.createElement("tbody", null, rows2.map((row, i) => {
|
|
162
|
+
var _a2;
|
|
163
|
+
return /* @__PURE__ */ React.createElement(TrComponent2, { key: i }, (_a2 = row == null ? void 0 : row.tableCells) == null ? void 0 : _a2.map((c, i2) => {
|
|
164
|
+
return /* @__PURE__ */ React.createElement(
|
|
165
|
+
StaticTinaMarkdown,
|
|
166
|
+
{
|
|
167
|
+
key: i2,
|
|
168
|
+
components: {
|
|
169
|
+
p: (props2) => /* @__PURE__ */ React.createElement(TdComponent2, { align: align2[i2], ...props2 })
|
|
170
|
+
},
|
|
171
|
+
content: c.value
|
|
172
|
+
}
|
|
173
|
+
);
|
|
174
|
+
}));
|
|
175
|
+
})))
|
|
176
|
+
);
|
|
177
|
+
}
|
|
178
|
+
const ComponentMissing = components["component_missing"];
|
|
179
|
+
if (ComponentMissing) {
|
|
180
|
+
return /* @__PURE__ */ React.createElement(ComponentMissing, { name: child.name });
|
|
181
|
+
} else {
|
|
182
|
+
return /* @__PURE__ */ React.createElement("span", null, `No component provided for ${child.name}`);
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
case "table":
|
|
186
|
+
const rows = child.children || [];
|
|
187
|
+
const TableComponent = components["table"] || ((props2) => /* @__PURE__ */ React.createElement("table", { style: { border: "1px solid #EDECF3" }, ...props2 }));
|
|
188
|
+
const TrComponent = components["tr"] || ((props2) => /* @__PURE__ */ React.createElement("tr", { ...props2 }));
|
|
189
|
+
const TdComponent = components["td"] || ((props2) => /* @__PURE__ */ React.createElement(
|
|
190
|
+
"td",
|
|
191
|
+
{
|
|
192
|
+
style: {
|
|
193
|
+
textAlign: (props2 == null ? void 0 : props2.align) || "auto",
|
|
194
|
+
border: "1px solid #EDECF3",
|
|
195
|
+
padding: "0.25rem"
|
|
196
|
+
},
|
|
197
|
+
...props2
|
|
198
|
+
}
|
|
199
|
+
));
|
|
200
|
+
const align = ((_g = child.props) == null ? void 0 : _g.align) || [];
|
|
201
|
+
return (
|
|
202
|
+
//@ts-ignore Same issue with TinaMarkdown
|
|
203
|
+
/* @__PURE__ */ React.createElement(TableComponent, null, /* @__PURE__ */ React.createElement("tbody", null, rows.map((row, i) => {
|
|
204
|
+
var _a2;
|
|
205
|
+
return /* @__PURE__ */ React.createElement(TrComponent, { key: i }, (_a2 = row.children) == null ? void 0 : _a2.map((cell, i2) => {
|
|
206
|
+
return /* @__PURE__ */ React.createElement(
|
|
207
|
+
StaticTinaMarkdown,
|
|
208
|
+
{
|
|
209
|
+
key: i2,
|
|
210
|
+
components: {
|
|
211
|
+
p: (props2) => /* @__PURE__ */ React.createElement(TdComponent, { align: align[i2], ...props2 })
|
|
212
|
+
},
|
|
213
|
+
content: cell.children
|
|
214
|
+
}
|
|
215
|
+
);
|
|
216
|
+
}));
|
|
217
|
+
})))
|
|
218
|
+
);
|
|
219
|
+
case "maybe_mdx":
|
|
220
|
+
return null;
|
|
221
|
+
case "html":
|
|
222
|
+
case "html_inline":
|
|
223
|
+
if (components[child.type]) {
|
|
224
|
+
const Component2 = components[child.type];
|
|
225
|
+
return /* @__PURE__ */ React.createElement(Component2, { ...props });
|
|
226
|
+
}
|
|
227
|
+
return child.value;
|
|
228
|
+
case "invalid_markdown":
|
|
229
|
+
return /* @__PURE__ */ React.createElement("pre", null, child.value);
|
|
230
|
+
default:
|
|
231
|
+
if (typeof child.text === "string") {
|
|
232
|
+
return /* @__PURE__ */ React.createElement(Leaf, { components, ...child });
|
|
233
|
+
}
|
|
234
|
+
return null;
|
|
235
|
+
}
|
|
236
|
+
};
|
|
237
|
+
exports2.StaticTinaMarkdown = StaticTinaMarkdown;
|
|
238
|
+
Object.defineProperty(exports2, Symbol.toStringTag, { value: "Module" });
|
|
239
|
+
});
|
|
@@ -0,0 +1,236 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
const StaticTinaMarkdown = ({
|
|
3
|
+
content,
|
|
4
|
+
components = {}
|
|
5
|
+
}) => {
|
|
6
|
+
if (!content) {
|
|
7
|
+
return null;
|
|
8
|
+
}
|
|
9
|
+
const nodes = Array.isArray(content) ? content : content.children;
|
|
10
|
+
if (!nodes) {
|
|
11
|
+
return null;
|
|
12
|
+
}
|
|
13
|
+
return /* @__PURE__ */ React.createElement(React.Fragment, null, nodes.map((child, index) => {
|
|
14
|
+
return /* @__PURE__ */ React.createElement(Node, { components, key: index, child });
|
|
15
|
+
}));
|
|
16
|
+
};
|
|
17
|
+
const Leaf = (props) => {
|
|
18
|
+
let el = /* @__PURE__ */ React.createElement(React.Fragment, null, props.text);
|
|
19
|
+
if (props.components.text) {
|
|
20
|
+
const Component = props.components.text;
|
|
21
|
+
el = /* @__PURE__ */ React.createElement(Component, null, props.text);
|
|
22
|
+
}
|
|
23
|
+
if (props.bold) {
|
|
24
|
+
const Component = props.components.bold || "strong";
|
|
25
|
+
el = /* @__PURE__ */ React.createElement(Component, null, el);
|
|
26
|
+
}
|
|
27
|
+
if (props.italic) {
|
|
28
|
+
const Component = props.components.italic || "em";
|
|
29
|
+
el = /* @__PURE__ */ React.createElement(Component, null, el);
|
|
30
|
+
}
|
|
31
|
+
if (props.underline) {
|
|
32
|
+
const Component = props.components.underline || "u";
|
|
33
|
+
el = /* @__PURE__ */ React.createElement(Component, null, el);
|
|
34
|
+
}
|
|
35
|
+
if (props.strikethrough) {
|
|
36
|
+
const Component = props.components.strikethrough || "s";
|
|
37
|
+
el = /* @__PURE__ */ React.createElement(Component, null, el);
|
|
38
|
+
}
|
|
39
|
+
if (props.code) {
|
|
40
|
+
const Component = props.components.code || "code";
|
|
41
|
+
el = /* @__PURE__ */ React.createElement(Component, null, el);
|
|
42
|
+
}
|
|
43
|
+
return el;
|
|
44
|
+
};
|
|
45
|
+
const Node = ({
|
|
46
|
+
components,
|
|
47
|
+
child
|
|
48
|
+
}) => {
|
|
49
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
50
|
+
const { children, ...props } = child;
|
|
51
|
+
switch (child.type) {
|
|
52
|
+
case "h1":
|
|
53
|
+
case "h2":
|
|
54
|
+
case "h3":
|
|
55
|
+
case "h4":
|
|
56
|
+
case "h5":
|
|
57
|
+
case "h6":
|
|
58
|
+
case "p":
|
|
59
|
+
case "blockquote":
|
|
60
|
+
case "ol":
|
|
61
|
+
case "ul":
|
|
62
|
+
case "li":
|
|
63
|
+
if (components[child.type]) {
|
|
64
|
+
const Component2 = components[child.type];
|
|
65
|
+
return /* @__PURE__ */ React.createElement(Component2, { ...props }, /* @__PURE__ */ React.createElement(StaticTinaMarkdown, { components, content: children }));
|
|
66
|
+
}
|
|
67
|
+
return React.createElement(child.type, {
|
|
68
|
+
children: /* @__PURE__ */ React.createElement(StaticTinaMarkdown, { components, content: children })
|
|
69
|
+
});
|
|
70
|
+
case "lic":
|
|
71
|
+
if (components.lic) {
|
|
72
|
+
const Component2 = components.lic;
|
|
73
|
+
return /* @__PURE__ */ React.createElement(Component2, { ...props }, /* @__PURE__ */ React.createElement(StaticTinaMarkdown, { components, content: children }));
|
|
74
|
+
}
|
|
75
|
+
return /* @__PURE__ */ React.createElement("div", null, /* @__PURE__ */ React.createElement(
|
|
76
|
+
StaticTinaMarkdown,
|
|
77
|
+
{
|
|
78
|
+
components,
|
|
79
|
+
content: child.children
|
|
80
|
+
}
|
|
81
|
+
));
|
|
82
|
+
case "img":
|
|
83
|
+
if (components[child.type]) {
|
|
84
|
+
const Component2 = components[child.type];
|
|
85
|
+
return /* @__PURE__ */ React.createElement(Component2, { ...props });
|
|
86
|
+
}
|
|
87
|
+
return /* @__PURE__ */ React.createElement("img", { src: child.url, alt: child.alt });
|
|
88
|
+
case "a":
|
|
89
|
+
if (components[child.type]) {
|
|
90
|
+
const Component2 = components[child.type];
|
|
91
|
+
return (
|
|
92
|
+
//@ts-ignore Same issue with TinaMarkdown
|
|
93
|
+
/* @__PURE__ */ React.createElement(Component2, { ...props }, /* @__PURE__ */ React.createElement(StaticTinaMarkdown, { components, content: children }))
|
|
94
|
+
);
|
|
95
|
+
}
|
|
96
|
+
return /* @__PURE__ */ React.createElement("a", { href: child.url }, /* @__PURE__ */ React.createElement(StaticTinaMarkdown, { components, content: children }));
|
|
97
|
+
case "code_block": {
|
|
98
|
+
let codeString = "";
|
|
99
|
+
if (Array.isArray(child.children)) {
|
|
100
|
+
codeString = child.children.map(
|
|
101
|
+
(line) => Array.isArray(line.children) ? line.children.map((t) => t.text).join("") : ""
|
|
102
|
+
).join("\n");
|
|
103
|
+
} else if (typeof child.value === "string") {
|
|
104
|
+
codeString = child.value;
|
|
105
|
+
}
|
|
106
|
+
if (components[child.type]) {
|
|
107
|
+
const Component2 = components[child.type];
|
|
108
|
+
return /* @__PURE__ */ React.createElement(Component2, { ...props, value: codeString });
|
|
109
|
+
}
|
|
110
|
+
return /* @__PURE__ */ React.createElement("pre", null, /* @__PURE__ */ React.createElement("code", null, codeString));
|
|
111
|
+
}
|
|
112
|
+
case "hr":
|
|
113
|
+
if (components[child.type]) {
|
|
114
|
+
const Component2 = components[child.type];
|
|
115
|
+
return /* @__PURE__ */ React.createElement(Component2, { ...props });
|
|
116
|
+
}
|
|
117
|
+
return /* @__PURE__ */ React.createElement("hr", null);
|
|
118
|
+
case "break":
|
|
119
|
+
if (components[child.type]) {
|
|
120
|
+
const Component2 = components[child.type];
|
|
121
|
+
return /* @__PURE__ */ React.createElement(Component2, { ...props });
|
|
122
|
+
}
|
|
123
|
+
return /* @__PURE__ */ React.createElement("br", null);
|
|
124
|
+
case "text":
|
|
125
|
+
return /* @__PURE__ */ React.createElement(Leaf, { components, ...child });
|
|
126
|
+
case "mdxJsxTextElement":
|
|
127
|
+
case "mdxJsxFlowElement":
|
|
128
|
+
const Component = components[child.name];
|
|
129
|
+
if (Component) {
|
|
130
|
+
const props2 = child.props ? child.props : {};
|
|
131
|
+
return /* @__PURE__ */ React.createElement(Component, { ...props2 });
|
|
132
|
+
} else {
|
|
133
|
+
if (child.name === "table") {
|
|
134
|
+
const firstRowHeader = (_a = child.props) == null ? void 0 : _a.firstRowHeader;
|
|
135
|
+
const rows2 = (firstRowHeader ? (_b = child.props) == null ? void 0 : _b.tableRows.filter((_, i) => i !== 0) : (_c = child.props) == null ? void 0 : _c.tableRows) || [];
|
|
136
|
+
const header = (_e = (_d = child.props) == null ? void 0 : _d.tableRows) == null ? void 0 : _e.at(0);
|
|
137
|
+
const TableComponent2 = (
|
|
138
|
+
//@ts-ignore Same issue with TinaMarkdown
|
|
139
|
+
components["table"] || ((props2) => /* @__PURE__ */ React.createElement("table", { ...props2 }))
|
|
140
|
+
);
|
|
141
|
+
const TrComponent2 = components["tr"] || ((props2) => /* @__PURE__ */ React.createElement("tr", { ...props2 }));
|
|
142
|
+
const ThComponent = components["th"] || ((props2) => /* @__PURE__ */ React.createElement("th", { style: { textAlign: (props2 == null ? void 0 : props2.align) || "auto" }, ...props2 }));
|
|
143
|
+
const TdComponent2 = components["td"] || ((props2) => /* @__PURE__ */ React.createElement("td", { style: { textAlign: (props2 == null ? void 0 : props2.align) || "auto" }, ...props2 }));
|
|
144
|
+
const align2 = ((_f = child.props) == null ? void 0 : _f.align) || [];
|
|
145
|
+
return (
|
|
146
|
+
//@ts-ignore Same issue with TinaMarkdown
|
|
147
|
+
/* @__PURE__ */ React.createElement(TableComponent2, null, firstRowHeader && /* @__PURE__ */ React.createElement("thead", null, /* @__PURE__ */ React.createElement(TrComponent2, null, header.tableCells.map((c, i) => {
|
|
148
|
+
return /* @__PURE__ */ React.createElement(
|
|
149
|
+
StaticTinaMarkdown,
|
|
150
|
+
{
|
|
151
|
+
key: i,
|
|
152
|
+
components: {
|
|
153
|
+
p: (props2) => /* @__PURE__ */ React.createElement(ThComponent, { align: align2[i], ...props2 })
|
|
154
|
+
},
|
|
155
|
+
content: c.value
|
|
156
|
+
}
|
|
157
|
+
);
|
|
158
|
+
}))), /* @__PURE__ */ React.createElement("tbody", null, rows2.map((row, i) => {
|
|
159
|
+
var _a2;
|
|
160
|
+
return /* @__PURE__ */ React.createElement(TrComponent2, { key: i }, (_a2 = row == null ? void 0 : row.tableCells) == null ? void 0 : _a2.map((c, i2) => {
|
|
161
|
+
return /* @__PURE__ */ React.createElement(
|
|
162
|
+
StaticTinaMarkdown,
|
|
163
|
+
{
|
|
164
|
+
key: i2,
|
|
165
|
+
components: {
|
|
166
|
+
p: (props2) => /* @__PURE__ */ React.createElement(TdComponent2, { align: align2[i2], ...props2 })
|
|
167
|
+
},
|
|
168
|
+
content: c.value
|
|
169
|
+
}
|
|
170
|
+
);
|
|
171
|
+
}));
|
|
172
|
+
})))
|
|
173
|
+
);
|
|
174
|
+
}
|
|
175
|
+
const ComponentMissing = components["component_missing"];
|
|
176
|
+
if (ComponentMissing) {
|
|
177
|
+
return /* @__PURE__ */ React.createElement(ComponentMissing, { name: child.name });
|
|
178
|
+
} else {
|
|
179
|
+
return /* @__PURE__ */ React.createElement("span", null, `No component provided for ${child.name}`);
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
case "table":
|
|
183
|
+
const rows = child.children || [];
|
|
184
|
+
const TableComponent = components["table"] || ((props2) => /* @__PURE__ */ React.createElement("table", { style: { border: "1px solid #EDECF3" }, ...props2 }));
|
|
185
|
+
const TrComponent = components["tr"] || ((props2) => /* @__PURE__ */ React.createElement("tr", { ...props2 }));
|
|
186
|
+
const TdComponent = components["td"] || ((props2) => /* @__PURE__ */ React.createElement(
|
|
187
|
+
"td",
|
|
188
|
+
{
|
|
189
|
+
style: {
|
|
190
|
+
textAlign: (props2 == null ? void 0 : props2.align) || "auto",
|
|
191
|
+
border: "1px solid #EDECF3",
|
|
192
|
+
padding: "0.25rem"
|
|
193
|
+
},
|
|
194
|
+
...props2
|
|
195
|
+
}
|
|
196
|
+
));
|
|
197
|
+
const align = ((_g = child.props) == null ? void 0 : _g.align) || [];
|
|
198
|
+
return (
|
|
199
|
+
//@ts-ignore Same issue with TinaMarkdown
|
|
200
|
+
/* @__PURE__ */ React.createElement(TableComponent, null, /* @__PURE__ */ React.createElement("tbody", null, rows.map((row, i) => {
|
|
201
|
+
var _a2;
|
|
202
|
+
return /* @__PURE__ */ React.createElement(TrComponent, { key: i }, (_a2 = row.children) == null ? void 0 : _a2.map((cell, i2) => {
|
|
203
|
+
return /* @__PURE__ */ React.createElement(
|
|
204
|
+
StaticTinaMarkdown,
|
|
205
|
+
{
|
|
206
|
+
key: i2,
|
|
207
|
+
components: {
|
|
208
|
+
p: (props2) => /* @__PURE__ */ React.createElement(TdComponent, { align: align[i2], ...props2 })
|
|
209
|
+
},
|
|
210
|
+
content: cell.children
|
|
211
|
+
}
|
|
212
|
+
);
|
|
213
|
+
}));
|
|
214
|
+
})))
|
|
215
|
+
);
|
|
216
|
+
case "maybe_mdx":
|
|
217
|
+
return null;
|
|
218
|
+
case "html":
|
|
219
|
+
case "html_inline":
|
|
220
|
+
if (components[child.type]) {
|
|
221
|
+
const Component2 = components[child.type];
|
|
222
|
+
return /* @__PURE__ */ React.createElement(Component2, { ...props });
|
|
223
|
+
}
|
|
224
|
+
return child.value;
|
|
225
|
+
case "invalid_markdown":
|
|
226
|
+
return /* @__PURE__ */ React.createElement("pre", null, child.value);
|
|
227
|
+
default:
|
|
228
|
+
if (typeof child.text === "string") {
|
|
229
|
+
return /* @__PURE__ */ React.createElement(Leaf, { components, ...child });
|
|
230
|
+
}
|
|
231
|
+
return null;
|
|
232
|
+
}
|
|
233
|
+
};
|
|
234
|
+
export {
|
|
235
|
+
StaticTinaMarkdown
|
|
236
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
declare function Breadcrumb({ ...props }: React.ComponentProps<'nav'>): React.JSX.Element;
|
|
3
|
+
declare function BreadcrumbList({ className, ...props }: React.ComponentProps<'ol'>): React.JSX.Element;
|
|
4
|
+
declare function BreadcrumbItem({ className, ...props }: React.ComponentProps<'li'>): React.JSX.Element;
|
|
5
|
+
declare function BreadcrumbLink({ asChild, className, ...props }: React.ComponentProps<'a'> & {
|
|
6
|
+
asChild?: boolean;
|
|
7
|
+
}): React.JSX.Element;
|
|
8
|
+
declare function BreadcrumbPage({ className, ...props }: React.ComponentProps<'span'>): React.JSX.Element;
|
|
9
|
+
declare function BreadcrumbSeparator({ children, className, ...props }: React.ComponentProps<'li'>): React.JSX.Element;
|
|
10
|
+
declare function BreadcrumbEllipsis({ className, ...props }: React.ComponentProps<'span'>): React.JSX.Element;
|
|
11
|
+
export { Breadcrumb, BreadcrumbList, BreadcrumbItem, BreadcrumbLink, BreadcrumbPage, BreadcrumbSeparator, BreadcrumbEllipsis, };
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import * as DropdownMenuPrimitive from '@radix-ui/react-dropdown-menu';
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
declare function DropdownMenu({ ...props }: React.ComponentProps<typeof DropdownMenuPrimitive.Root>): React.JSX.Element;
|
|
4
|
+
declare function DropdownMenuPortal({ ...props }: React.ComponentProps<typeof DropdownMenuPrimitive.Portal>): React.JSX.Element;
|
|
5
|
+
declare function DropdownMenuTrigger({ ...props }: React.ComponentProps<typeof DropdownMenuPrimitive.Trigger>): React.JSX.Element;
|
|
6
|
+
declare function DropdownMenuContent({ className, sideOffset, ...props }: React.ComponentProps<typeof DropdownMenuPrimitive.Content>): React.JSX.Element;
|
|
7
|
+
declare function DropdownMenuGroup({ ...props }: React.ComponentProps<typeof DropdownMenuPrimitive.Group>): React.JSX.Element;
|
|
8
|
+
declare function DropdownMenuItem({ className, inset, variant, ...props }: React.ComponentProps<typeof DropdownMenuPrimitive.Item> & {
|
|
9
|
+
inset?: boolean;
|
|
10
|
+
variant?: 'default' | 'destructive';
|
|
11
|
+
}): React.JSX.Element;
|
|
12
|
+
declare function DropdownMenuCheckboxItem({ className, children, checked, ...props }: React.ComponentProps<typeof DropdownMenuPrimitive.CheckboxItem>): React.JSX.Element;
|
|
13
|
+
declare function DropdownMenuRadioGroup({ ...props }: React.ComponentProps<typeof DropdownMenuPrimitive.RadioGroup>): React.JSX.Element;
|
|
14
|
+
declare function DropdownMenuRadioItem({ className, children, ...props }: React.ComponentProps<typeof DropdownMenuPrimitive.RadioItem>): React.JSX.Element;
|
|
15
|
+
declare function DropdownMenuLabel({ className, inset, ...props }: React.ComponentProps<typeof DropdownMenuPrimitive.Label> & {
|
|
16
|
+
inset?: boolean;
|
|
17
|
+
}): React.JSX.Element;
|
|
18
|
+
declare function DropdownMenuSeparator({ className, ...props }: React.ComponentProps<typeof DropdownMenuPrimitive.Separator>): React.JSX.Element;
|
|
19
|
+
declare function DropdownMenuShortcut({ className, ...props }: React.ComponentProps<'span'>): React.JSX.Element;
|
|
20
|
+
declare function DropdownMenuSub({ ...props }: React.ComponentProps<typeof DropdownMenuPrimitive.Sub>): React.JSX.Element;
|
|
21
|
+
declare function DropdownMenuSubTrigger({ className, inset, children, ...props }: React.ComponentProps<typeof DropdownMenuPrimitive.SubTrigger> & {
|
|
22
|
+
inset?: boolean;
|
|
23
|
+
}): React.JSX.Element;
|
|
24
|
+
declare function DropdownMenuSubContent({ className, ...props }: React.ComponentProps<typeof DropdownMenuPrimitive.SubContent>): React.JSX.Element;
|
|
25
|
+
export { DropdownMenu, DropdownMenuPortal, DropdownMenuTrigger, DropdownMenuContent, DropdownMenuGroup, DropdownMenuLabel, DropdownMenuItem, DropdownMenuCheckboxItem, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubTrigger, DropdownMenuSubContent, };
|
|
@@ -4,6 +4,6 @@ export interface PasswordFieldProps extends a {
|
|
|
4
4
|
error?: boolean;
|
|
5
5
|
ref?: any;
|
|
6
6
|
}
|
|
7
|
-
export declare const passwordFieldClasses = "shadow-inner focus:shadow-outline focus:border-blue-500 focus:outline-none block text-base placeholder:text-gray-300 px-3 py-2 text-gray-600 w-full bg-white border border-gray-200 transition-all ease-out duration-150 focus:text-gray-900 rounded
|
|
7
|
+
export declare const passwordFieldClasses = "shadow-inner focus:shadow-outline focus:border-blue-500 focus:outline-none block text-base placeholder:text-gray-300 px-3 py-2 text-gray-600 w-full bg-white border border-gray-200 transition-all ease-out duration-150 focus:text-gray-900 rounded";
|
|
8
8
|
export declare const BasePasswordField: React.ForwardRefExoticComponent<Omit<PasswordFieldProps, "ref"> & React.RefAttributes<HTMLInputElement>>;
|
|
9
9
|
export {};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
1
|
import * as PopoverPrimitive from '@radix-ui/react-popover';
|
|
2
|
+
import * as React from 'react';
|
|
3
3
|
declare const Popover: React.FC<PopoverPrimitive.PopoverProps>;
|
|
4
4
|
declare const PopoverTrigger: React.ForwardRefExoticComponent<PopoverPrimitive.PopoverTriggerProps & React.RefAttributes<HTMLButtonElement>>;
|
|
5
5
|
declare const PopoverContent: React.ForwardRefExoticComponent<Omit<PopoverPrimitive.PopoverContentProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
1
|
import type { Field } from '../../forms';
|
|
2
|
+
import * as React from 'react';
|
|
3
3
|
type Option = {
|
|
4
4
|
value: string;
|
|
5
5
|
label: string;
|
|
@@ -18,6 +18,6 @@ export interface SelectProps {
|
|
|
18
18
|
options?: (Option | string)[];
|
|
19
19
|
className?: string;
|
|
20
20
|
}
|
|
21
|
-
export declare const selectFieldClasses = "shadow appearance-none bg-white block pl-3 pr-8 py-2 truncate w-full text-base cursor-pointer border border-gray-200 focus:outline-none focus:shadow-outline focus:ring-blue-500 focus:border-blue-500 sm:text-sm rounded
|
|
21
|
+
export declare const selectFieldClasses = "shadow appearance-none bg-white block pl-3 pr-8 py-2 truncate w-full text-base cursor-pointer border border-gray-200 focus:outline-none focus:shadow-outline focus:ring-blue-500 focus:border-blue-500 sm:text-sm rounded";
|
|
22
22
|
export declare const Select: React.FC<SelectProps>;
|
|
23
23
|
export {};
|
|
@@ -4,6 +4,6 @@ export interface TextFieldProps extends a {
|
|
|
4
4
|
error?: boolean;
|
|
5
5
|
ref?: any;
|
|
6
6
|
}
|
|
7
|
-
export declare const textFieldClasses = "shadow-inner focus:shadow-outline focus:border-blue-500 focus:outline-none block text-base placeholder:text-gray-300 px-3 py-2 text-gray-600 w-full bg-white border border-gray-200 transition-all ease-out duration-150 focus:text-gray-900 rounded
|
|
7
|
+
export declare const textFieldClasses = "shadow-inner focus:shadow-outline focus:border-blue-500 focus:outline-none block text-base placeholder:text-gray-300 px-3 py-2 text-gray-600 w-full bg-white border border-gray-200 transition-all ease-out duration-150 focus:text-gray-900 rounded";
|
|
8
8
|
export declare const BaseTextField: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>, "ref"> & React.RefAttributes<HTMLInputElement>>;
|
|
9
9
|
export {};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { type InputFieldType } from '../wrap-field-with-meta';
|
|
3
|
-
import type { MdxTemplate } from './plate/types';
|
|
4
3
|
import type { InputProps } from '../../../fields/components';
|
|
5
|
-
import type {
|
|
4
|
+
import type { ToolbarOverrideType, ToolbarOverrides } from './plate/toolbar/toolbar-overrides';
|
|
5
|
+
import type { MdxTemplate } from './plate/types';
|
|
6
6
|
export type RichTextType = React.PropsWithChildren<InputFieldType<InputProps, {
|
|
7
7
|
templates: MdxTemplate[];
|
|
8
8
|
toolbarOverride?: ToolbarOverrideType[];
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import type { Form } from '../forms';
|
|
1
2
|
import * as React from 'react';
|
|
2
3
|
import { type FC } from 'react';
|
|
3
|
-
import type { Form } from '../forms';
|
|
4
4
|
export interface FormBuilderProps {
|
|
5
5
|
form: {
|
|
6
6
|
tinaForm: Form;
|
|
@@ -12,12 +12,11 @@ export interface FormBuilderProps {
|
|
|
12
12
|
}
|
|
13
13
|
export declare const FormBuilder: FC<FormBuilderProps>;
|
|
14
14
|
export declare const FormStatus: ({ pristine }: {
|
|
15
|
-
pristine:
|
|
15
|
+
pristine: boolean;
|
|
16
16
|
}) => React.JSX.Element;
|
|
17
|
-
export declare const FormWrapper: ({
|
|
18
|
-
header?: React.ReactNode;
|
|
19
|
-
children: React.ReactNode;
|
|
17
|
+
export declare const FormWrapper: ({ id, children, }: {
|
|
20
18
|
id: string;
|
|
19
|
+
children: React.ReactNode;
|
|
21
20
|
}) => React.JSX.Element;
|
|
22
21
|
/**
|
|
23
22
|
* @deprecated
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { Parser } from '@tinacms/schema-tools';
|
|
1
2
|
export type AnyField = Field & {
|
|
2
3
|
[key: string]: any;
|
|
3
4
|
};
|
|
@@ -7,10 +8,12 @@ export interface Field<F extends Field = AnyField> {
|
|
|
7
8
|
description?: string;
|
|
8
9
|
component: React.FC<any> | string | null;
|
|
9
10
|
inlineComponent?: React.FC<any>;
|
|
11
|
+
parser?: Parser;
|
|
10
12
|
parse?: (value: any, name: string, field: F) => any;
|
|
11
13
|
format?: (value: any, name: string, field: F) => any;
|
|
12
14
|
validate?(value: any, allValues: any, meta: any, field: Field): string | object | undefined;
|
|
13
15
|
defaultValue?: any;
|
|
16
|
+
namespace?: string[];
|
|
14
17
|
fields?: F[];
|
|
15
18
|
/**
|
|
16
19
|
* Focus events can come from outside of the component, this is not
|