@prokodo/ui 0.1.9 → 0.1.11
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 +1 -0
- package/dist/_virtual/_commonjsHelpers.js +2 -0
- package/dist/_virtual/quill.js +34 -0
- package/dist/_virtual/quill2.js +4 -0
- package/dist/components/RTE/RTE.client.js +326 -0
- package/dist/components/RTE/RTE.css +253 -0
- package/dist/components/RTE/RTE.js +12 -0
- package/dist/components/RTE/RTE.lazy.js +12 -0
- package/dist/components/RTE/RTE.module.css +253 -0
- package/dist/components/RTE/RTE.module.scss.js +19 -0
- package/dist/components/RTE/RTE.server.js +19 -0
- package/dist/components/RTE/RTE.styles.js +21 -0
- package/dist/components/RTE/RTE.theme.js +4 -0
- package/dist/components/RTE/RTE.utils.js +51 -0
- package/dist/components/RTE/RTE.view.js +107 -0
- package/dist/components/RTE/index.js +4 -0
- package/dist/components/avatar/Avatar.css +1 -3
- package/dist/components/avatar/Avatar.module.css +1 -3
- package/dist/components/avatar/Avatar.view.js +30 -15
- package/dist/components/base-link/BaseLink.client.js +11 -1
- package/dist/components/button/Button.view.js +1 -0
- package/dist/components/card/Card.css +6 -5
- package/dist/components/card/Card.module.css +6 -5
- package/dist/components/chip/Chip.css +2 -2
- package/dist/components/chip/Chip.module.css +2 -2
- package/dist/components/chip/Chip.view.js +1 -1
- package/dist/components/headline/Headline.css +1 -1
- package/dist/components/headline/Headline.module.css +1 -1
- package/dist/components/input/Input.view.js +21 -13
- package/dist/components/link/Link.view.js +1 -1
- package/dist/components/rich-text/RichText.client.js +31 -0
- package/dist/components/rich-text/RichText.css +13 -1
- package/dist/components/rich-text/RichText.module.css +13 -1
- package/dist/components/rich-text/RichText.module.scss.js +2 -0
- package/dist/components/rich-text/RichText.server.js +1 -0
- package/dist/components/sidenav/SideNav.css +40 -32
- package/dist/components/sidenav/SideNav.module.css +40 -32
- package/dist/components/sidenav/SideNav.module.scss.js +4 -2
- package/dist/components/sidenav/SideNav.view.js +6 -3
- package/dist/components/skeleton/Skeleton.css +9 -2
- package/dist/components/skeleton/Skeleton.module.css +9 -2
- package/dist/components/table/Table.css +3 -2
- package/dist/components/table/Table.js +2 -1
- package/dist/components/table/Table.module.css +3 -2
- package/dist/constants/project.js +1 -1
- package/dist/index.js +2 -0
- package/dist/node_modules/.pnpm/quill@2.0.3/node_modules/quill/dist/quill.js +6133 -0
- package/dist/node_modules/.pnpm/quill@2.0.3/node_modules/quill/dist/quill.snow.css.js +12 -0
- package/dist/theme.css +79 -48
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/dist/types/components/RTE/RTE.client.d.ts +6 -0
- package/dist/types/components/RTE/RTE.d.ts +339 -0
- package/dist/types/components/RTE/RTE.lazy.d.ts +340 -0
- package/dist/types/components/RTE/RTE.model.d.ts +17 -0
- package/dist/types/components/RTE/RTE.server.d.ts +3 -0
- package/dist/types/components/RTE/RTE.styles.d.ts +1 -0
- package/dist/types/components/RTE/RTE.theme.d.ts +2 -0
- package/dist/types/components/RTE/RTE.utils.d.ts +4 -0
- package/dist/types/components/RTE/RTE.view.d.ts +11 -0
- package/dist/types/components/RTE/index.d.ts +2 -0
- package/dist/types/components/avatar/Avatar.model.d.ts +1 -1
- package/dist/types/components/input/Input.model.d.ts +13 -1
- package/dist/types/components/input/Input.view.d.ts +1 -1
- package/dist/types/components/rich-text/RichText.client.d.ts +1 -1
- package/dist/types/components/rich-text/RichText.d.ts +1 -0
- package/dist/types/components/rich-text/RichText.lazy.d.ts +1 -0
- package/dist/types/components/rich-text/RichText.model.d.ts +1 -0
- package/dist/types/components/sidenav/SideNav.model.d.ts +2 -0
- package/dist/types/components/sidenav/SideNav.view.d.ts +1 -1
- package/dist/types/components/table/Table.model.d.ts +2 -0
- package/dist/types/helpers/validations.d.ts +2 -2
- package/dist/types/index.d.ts +1 -0
- package/package.json +8 -2
package/README.md
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
var __defProp = Object.defineProperty;
|
|
2
2
|
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
|
+
var commonjsGlobal = typeof globalThis !== "undefined" ? globalThis : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : {};
|
|
3
4
|
function getDefaultExportFromCjs(x) {
|
|
4
5
|
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, "default") ? x["default"] : x;
|
|
5
6
|
}
|
|
6
7
|
__name(getDefaultExportFromCjs, "getDefaultExportFromCjs");
|
|
7
8
|
export {
|
|
9
|
+
commonjsGlobal,
|
|
8
10
|
getDefaultExportFromCjs
|
|
9
11
|
};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
|
+
import { getDefaultExportFromCjs } from "./_commonjsHelpers.js";
|
|
4
|
+
import { __require as requireQuill } from "../node_modules/.pnpm/quill@2.0.3/node_modules/quill/dist/quill.js";
|
|
5
|
+
function _mergeNamespaces(n, m) {
|
|
6
|
+
for (var i = 0; i < m.length; i++) {
|
|
7
|
+
const e = m[i];
|
|
8
|
+
if (typeof e !== "string" && !Array.isArray(e)) {
|
|
9
|
+
for (const k in e) {
|
|
10
|
+
if (k !== "default" && !(k in n)) {
|
|
11
|
+
const d = Object.getOwnPropertyDescriptor(e, k);
|
|
12
|
+
if (d) {
|
|
13
|
+
Object.defineProperty(n, k, d.get ? d : {
|
|
14
|
+
enumerable: true,
|
|
15
|
+
get: /* @__PURE__ */ __name(() => e[k], "get")
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
return Object.freeze(Object.defineProperty(n, Symbol.toStringTag, { value: "Module" }));
|
|
23
|
+
}
|
|
24
|
+
__name(_mergeNamespaces, "_mergeNamespaces");
|
|
25
|
+
var quillExports = /* @__PURE__ */ requireQuill();
|
|
26
|
+
const quill = /* @__PURE__ */ getDefaultExportFromCjs(quillExports);
|
|
27
|
+
const quill$1 = /* @__PURE__ */ _mergeNamespaces({
|
|
28
|
+
__proto__: null,
|
|
29
|
+
default: quill
|
|
30
|
+
}, [quillExports]);
|
|
31
|
+
export {
|
|
32
|
+
quill as default,
|
|
33
|
+
quill$1 as q
|
|
34
|
+
};
|
|
@@ -0,0 +1,326 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
4
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
5
|
+
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
6
|
+
import { jsx } from "react/jsx-runtime";
|
|
7
|
+
import { memo, useRef, useEffect, useState, useCallback } from "react";
|
|
8
|
+
import { handleValidation } from "../input/InputValidation.js";
|
|
9
|
+
import { create } from "../../helpers/bem.js";
|
|
10
|
+
import { isString, isNull } from "../../helpers/validations.js";
|
|
11
|
+
import styles from "./RTE.module.scss.js";
|
|
12
|
+
import { ensureQuillSnowStyles } from "./RTE.styles.js";
|
|
13
|
+
import cssText from "../../node_modules/.pnpm/quill@2.0.3/node_modules/quill/dist/quill.snow.css.js";
|
|
14
|
+
import { cleanupQuill, addClasses, decorateToolbar } from "./RTE.utils.js";
|
|
15
|
+
import { RTEView } from "./RTE.view.js";
|
|
16
|
+
const bem = create(styles, "RTE");
|
|
17
|
+
function RTEClient(props) {
|
|
18
|
+
const {
|
|
19
|
+
name,
|
|
20
|
+
value,
|
|
21
|
+
onChange,
|
|
22
|
+
onValidate,
|
|
23
|
+
required,
|
|
24
|
+
maxLength,
|
|
25
|
+
errorTranslations,
|
|
26
|
+
errorText,
|
|
27
|
+
disabled,
|
|
28
|
+
readOnly,
|
|
29
|
+
placeholder,
|
|
30
|
+
rteOptions,
|
|
31
|
+
rteToolbar,
|
|
32
|
+
...rest
|
|
33
|
+
} = props;
|
|
34
|
+
const mountRef = useRef(null);
|
|
35
|
+
const surfaceRef = useRef(null);
|
|
36
|
+
const quillRef = useRef(null);
|
|
37
|
+
const htmlRef = useRef(value ?? "");
|
|
38
|
+
const onChangeRef = useRef(onChange);
|
|
39
|
+
const onValidateRef = useRef(onValidate);
|
|
40
|
+
const validationCfgRef = useRef({ name, required, errorTranslations });
|
|
41
|
+
useEffect(() => {
|
|
42
|
+
onChangeRef.current = onChange;
|
|
43
|
+
}, [onChange]);
|
|
44
|
+
useEffect(() => {
|
|
45
|
+
onValidateRef.current = onValidate;
|
|
46
|
+
}, [onValidate]);
|
|
47
|
+
useEffect(() => {
|
|
48
|
+
validationCfgRef.current = { name, required, errorTranslations };
|
|
49
|
+
}, [name, required, errorTranslations]);
|
|
50
|
+
const rteOptionsRef = useRef(rteOptions);
|
|
51
|
+
const rteToolbarRef = useRef(rteToolbar);
|
|
52
|
+
useEffect(() => {
|
|
53
|
+
rteOptionsRef.current = rteOptions;
|
|
54
|
+
}, [rteOptions]);
|
|
55
|
+
useEffect(() => {
|
|
56
|
+
rteToolbarRef.current = rteToolbar;
|
|
57
|
+
}, [rteToolbar]);
|
|
58
|
+
const startYRef = useRef(0);
|
|
59
|
+
const startHRef = useRef(0);
|
|
60
|
+
const rootClickHandlerRef = useRef(null);
|
|
61
|
+
const [err, setErr] = useState(errorText);
|
|
62
|
+
const lastEmittedHtmlRef = useRef("");
|
|
63
|
+
useEffect(() => {
|
|
64
|
+
if (isString(errorText)) setErr(errorText);
|
|
65
|
+
}, [errorText]);
|
|
66
|
+
const emitValidation = useCallback((plainText) => {
|
|
67
|
+
const cfg = validationCfgRef.current;
|
|
68
|
+
handleValidation(
|
|
69
|
+
"text",
|
|
70
|
+
cfg.name,
|
|
71
|
+
plainText,
|
|
72
|
+
cfg.required,
|
|
73
|
+
void 0,
|
|
74
|
+
void 0,
|
|
75
|
+
void 0,
|
|
76
|
+
cfg.errorTranslations,
|
|
77
|
+
(n, e) => {
|
|
78
|
+
var _a;
|
|
79
|
+
setErr(e);
|
|
80
|
+
(_a = onValidateRef.current) == null ? void 0 : _a.call(onValidateRef, n, e);
|
|
81
|
+
}
|
|
82
|
+
);
|
|
83
|
+
}, []);
|
|
84
|
+
const syncFromQuill = useCallback(() => {
|
|
85
|
+
var _a, _b, _c;
|
|
86
|
+
const q = quillRef.current;
|
|
87
|
+
if (!q) return;
|
|
88
|
+
const html = q.root.innerHTML;
|
|
89
|
+
const text = ((_b = (_a = q.getText()) == null ? void 0 : _a.trim) == null ? void 0 : _b.call(_a)) ?? "";
|
|
90
|
+
htmlRef.current = html;
|
|
91
|
+
lastEmittedHtmlRef.current = html;
|
|
92
|
+
emitValidation(text);
|
|
93
|
+
(_c = onChangeRef.current) == null ? void 0 : _c.call(onChangeRef, html, { text });
|
|
94
|
+
}, [emitValidation]);
|
|
95
|
+
const getQuillContainer = useCallback(() => {
|
|
96
|
+
const surface = surfaceRef.current;
|
|
97
|
+
if (!surface) return null;
|
|
98
|
+
return surface.querySelector(".ql-container");
|
|
99
|
+
}, []);
|
|
100
|
+
const startResize = useCallback(
|
|
101
|
+
(e) => {
|
|
102
|
+
e.preventDefault();
|
|
103
|
+
e.stopPropagation();
|
|
104
|
+
if (Boolean(disabled) || Boolean(readOnly)) return;
|
|
105
|
+
const container = getQuillContainer();
|
|
106
|
+
if (!container) return;
|
|
107
|
+
startYRef.current = e.clientY;
|
|
108
|
+
startHRef.current = container.getBoundingClientRect().height;
|
|
109
|
+
const onMove = /* @__PURE__ */ __name((ev) => {
|
|
110
|
+
const dy = ev.clientY - startYRef.current;
|
|
111
|
+
const next = Math.max(160, startHRef.current + dy);
|
|
112
|
+
container.style.height = `${next}px`;
|
|
113
|
+
}, "onMove");
|
|
114
|
+
const onUp = /* @__PURE__ */ __name(() => {
|
|
115
|
+
window.removeEventListener("mousemove", onMove);
|
|
116
|
+
window.removeEventListener("mouseup", onUp);
|
|
117
|
+
}, "onUp");
|
|
118
|
+
window.addEventListener("mousemove", onMove);
|
|
119
|
+
window.addEventListener("mouseup", onUp);
|
|
120
|
+
},
|
|
121
|
+
[disabled, readOnly, getQuillContainer]
|
|
122
|
+
);
|
|
123
|
+
useEffect(() => {
|
|
124
|
+
ensureQuillSnowStyles(cssText);
|
|
125
|
+
let cancelled = false;
|
|
126
|
+
const mountEl = mountRef.current;
|
|
127
|
+
const surfaceEl = surfaceRef.current;
|
|
128
|
+
async function init() {
|
|
129
|
+
var _a, _b, _c, _d, _e;
|
|
130
|
+
if (!mountEl || !surfaceEl) return;
|
|
131
|
+
if (Boolean(disabled) || Boolean(readOnly)) return;
|
|
132
|
+
cleanupQuill(surfaceEl, mountEl);
|
|
133
|
+
const QuillImport = await import("../../_virtual/quill.js").then((n) => n.q);
|
|
134
|
+
const Quill = (QuillImport == null ? void 0 : QuillImport.default) ?? QuillImport;
|
|
135
|
+
if (cancelled) return;
|
|
136
|
+
try {
|
|
137
|
+
const BaseImage = Quill.import("formats/image");
|
|
138
|
+
const _ImageWithAlt = class _ImageWithAlt extends BaseImage {
|
|
139
|
+
static formats(domNode) {
|
|
140
|
+
var _a2;
|
|
141
|
+
const formats = ((_a2 = super.formats) == null ? void 0 : _a2.call(this, domNode)) ?? {};
|
|
142
|
+
const alt = domNode.getAttribute("alt");
|
|
143
|
+
const title = domNode.getAttribute("title");
|
|
144
|
+
if (alt != null) formats.alt = alt;
|
|
145
|
+
if (title != null) formats.title = title;
|
|
146
|
+
return formats;
|
|
147
|
+
}
|
|
148
|
+
format(name2, value2) {
|
|
149
|
+
if (name2 === "alt") {
|
|
150
|
+
const v = typeof value2 === "string" ? value2.trim() : "";
|
|
151
|
+
if (v) this.domNode.setAttribute("alt", v);
|
|
152
|
+
else this.domNode.removeAttribute("alt");
|
|
153
|
+
return;
|
|
154
|
+
}
|
|
155
|
+
if (name2 === "title") {
|
|
156
|
+
const v = typeof value2 === "string" ? value2.trim() : "";
|
|
157
|
+
if (v) this.domNode.setAttribute("title", v);
|
|
158
|
+
else this.domNode.removeAttribute("title");
|
|
159
|
+
return;
|
|
160
|
+
}
|
|
161
|
+
super.format(name2, value2);
|
|
162
|
+
}
|
|
163
|
+
};
|
|
164
|
+
__name(_ImageWithAlt, "ImageWithAlt");
|
|
165
|
+
__publicField(_ImageWithAlt, "blotName", "image");
|
|
166
|
+
__publicField(_ImageWithAlt, "tagName", "IMG");
|
|
167
|
+
let ImageWithAlt = _ImageWithAlt;
|
|
168
|
+
Quill.register("formats/image", ImageWithAlt, true);
|
|
169
|
+
} catch {
|
|
170
|
+
}
|
|
171
|
+
const opts = rteOptionsRef.current;
|
|
172
|
+
const extraToolbar = rteToolbarRef.current;
|
|
173
|
+
const baseToolbar = [
|
|
174
|
+
["bold", "italic", "underline", "strike"],
|
|
175
|
+
[{ list: "ordered" }, { list: "bullet" }],
|
|
176
|
+
["link", "code-block", "image"],
|
|
177
|
+
["clean"]
|
|
178
|
+
];
|
|
179
|
+
const toolbarContainer = Array.isArray(extraToolbar) && extraToolbar.length ? [...baseToolbar, extraToolbar] : baseToolbar;
|
|
180
|
+
const q = new Quill(mountEl, {
|
|
181
|
+
...opts,
|
|
182
|
+
theme: "snow",
|
|
183
|
+
placeholder: placeholder ?? "",
|
|
184
|
+
modules: {
|
|
185
|
+
history: {
|
|
186
|
+
delay: 1e3,
|
|
187
|
+
maxStack: 200,
|
|
188
|
+
userOnly: true,
|
|
189
|
+
...((_a = opts == null ? void 0 : opts.modules) == null ? void 0 : _a.history) ?? {}
|
|
190
|
+
},
|
|
191
|
+
...opts == null ? void 0 : opts.modules,
|
|
192
|
+
toolbar: toolbarContainer,
|
|
193
|
+
clipboard: {
|
|
194
|
+
...((_b = opts == null ? void 0 : opts.modules) == null ? void 0 : _b.clipboard) ?? {}
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
});
|
|
198
|
+
quillRef.current = q;
|
|
199
|
+
(_c = opts == null ? void 0 : opts.onInit) == null ? void 0 : _c.call(opts, q);
|
|
200
|
+
addClasses(q.root, bem("editor"));
|
|
201
|
+
const toolbarModule = q.getModule("toolbar");
|
|
202
|
+
addClasses((toolbarModule == null ? void 0 : toolbarModule.container) ?? null, bem("toolbar"));
|
|
203
|
+
const toolbarEl = (toolbarModule == null ? void 0 : toolbarModule.container) ?? null;
|
|
204
|
+
if (toolbarEl) decorateToolbar(toolbarEl);
|
|
205
|
+
const tooltipEl = q.container.querySelector(
|
|
206
|
+
".ql-tooltip"
|
|
207
|
+
);
|
|
208
|
+
addClasses(tooltipEl, bem("tooltip"));
|
|
209
|
+
const mo = new MutationObserver(() => {
|
|
210
|
+
const t = q.container.querySelector(".ql-tooltip");
|
|
211
|
+
if (t) addClasses(t, bem("tooltip"));
|
|
212
|
+
});
|
|
213
|
+
mo.observe(q.container, { subtree: true, childList: true });
|
|
214
|
+
const container = getQuillContainer();
|
|
215
|
+
if (container && !container.style.height) container.style.height = "220px";
|
|
216
|
+
if (htmlRef.current)
|
|
217
|
+
q.clipboard.dangerouslyPasteHTML(htmlRef.current, "silent");
|
|
218
|
+
emitValidation(((_e = (_d = q.getText()) == null ? void 0 : _d.trim) == null ? void 0 : _e.call(_d)) ?? "");
|
|
219
|
+
q.on("text-change", (_d2, _o, source) => {
|
|
220
|
+
if (source === "user") syncFromQuill();
|
|
221
|
+
});
|
|
222
|
+
const root = q.root;
|
|
223
|
+
const onRootClick = /* @__PURE__ */ __name((ev) => {
|
|
224
|
+
var _a2, _b2;
|
|
225
|
+
if (Boolean(disabled) || Boolean(readOnly)) return;
|
|
226
|
+
const el = ev.target;
|
|
227
|
+
if (!el || el.tagName !== "IMG") return;
|
|
228
|
+
const img = el;
|
|
229
|
+
const currentAlt = img.getAttribute("alt") ?? "";
|
|
230
|
+
const nextAlt = window.prompt("Alt text", currentAlt);
|
|
231
|
+
if (nextAlt == null) return;
|
|
232
|
+
const v = nextAlt.trim();
|
|
233
|
+
try {
|
|
234
|
+
const blot = Quill.find(img);
|
|
235
|
+
if (!isNull(blot == null ? void 0 : blot.format)) {
|
|
236
|
+
blot.format("alt", v);
|
|
237
|
+
(_a2 = q.update) == null ? void 0 : _a2.call(q, "user");
|
|
238
|
+
syncFromQuill();
|
|
239
|
+
return;
|
|
240
|
+
}
|
|
241
|
+
} catch {
|
|
242
|
+
}
|
|
243
|
+
if (v) img.setAttribute("alt", v);
|
|
244
|
+
else img.removeAttribute("alt");
|
|
245
|
+
(_b2 = q.update) == null ? void 0 : _b2.call(q, "user");
|
|
246
|
+
syncFromQuill();
|
|
247
|
+
}, "onRootClick");
|
|
248
|
+
rootClickHandlerRef.current = onRootClick;
|
|
249
|
+
root.addEventListener("click", onRootClick);
|
|
250
|
+
}
|
|
251
|
+
__name(init, "init");
|
|
252
|
+
void init();
|
|
253
|
+
return () => {
|
|
254
|
+
cancelled = true;
|
|
255
|
+
const q = quillRef.current;
|
|
256
|
+
const h = rootClickHandlerRef.current;
|
|
257
|
+
if ((q == null ? void 0 : q.root) && h) q.root.removeEventListener("click", h);
|
|
258
|
+
rootClickHandlerRef.current = null;
|
|
259
|
+
quillRef.current = null;
|
|
260
|
+
cleanupQuill(surfaceEl, mountEl);
|
|
261
|
+
};
|
|
262
|
+
}, [
|
|
263
|
+
disabled,
|
|
264
|
+
readOnly,
|
|
265
|
+
placeholder,
|
|
266
|
+
emitValidation,
|
|
267
|
+
syncFromQuill,
|
|
268
|
+
getQuillContainer
|
|
269
|
+
]);
|
|
270
|
+
useEffect(() => {
|
|
271
|
+
var _a, _b, _c;
|
|
272
|
+
if (isNull(value)) return;
|
|
273
|
+
const q = quillRef.current;
|
|
274
|
+
if (Boolean((_a = q == null ? void 0 : q.hasFocus) == null ? void 0 : _a.call(q))) return;
|
|
275
|
+
const next = String(value);
|
|
276
|
+
if (next === htmlRef.current) return;
|
|
277
|
+
if (next === lastEmittedHtmlRef.current) {
|
|
278
|
+
htmlRef.current = next;
|
|
279
|
+
return;
|
|
280
|
+
}
|
|
281
|
+
htmlRef.current = next;
|
|
282
|
+
if (q) {
|
|
283
|
+
q.clipboard.dangerouslyPasteHTML(next, "silent");
|
|
284
|
+
emitValidation(((_c = (_b = q.getText()) == null ? void 0 : _b.trim) == null ? void 0 : _c.call(_b)) ?? "");
|
|
285
|
+
}
|
|
286
|
+
}, [value, emitValidation]);
|
|
287
|
+
return /* @__PURE__ */ jsx(
|
|
288
|
+
RTEView,
|
|
289
|
+
{
|
|
290
|
+
...rest,
|
|
291
|
+
disabled,
|
|
292
|
+
errorText: err,
|
|
293
|
+
errorTranslations,
|
|
294
|
+
htmlValue: htmlRef.current,
|
|
295
|
+
maxLength,
|
|
296
|
+
mountRef,
|
|
297
|
+
name,
|
|
298
|
+
placeholder,
|
|
299
|
+
readOnly,
|
|
300
|
+
required,
|
|
301
|
+
rteToolbar,
|
|
302
|
+
showResize: !Boolean(disabled) && !Boolean(readOnly),
|
|
303
|
+
surfaceRef,
|
|
304
|
+
value: htmlRef.current,
|
|
305
|
+
onChange,
|
|
306
|
+
onStartResize: startResize,
|
|
307
|
+
onValidate,
|
|
308
|
+
onBlur: /* @__PURE__ */ __name((e) => {
|
|
309
|
+
var _a, _b, _c;
|
|
310
|
+
const q = quillRef.current;
|
|
311
|
+
if (q) emitValidation(((_b = (_a = q.getText()) == null ? void 0 : _a.trim) == null ? void 0 : _b.call(_a)) ?? "");
|
|
312
|
+
(_c = rest.onBlur) == null ? void 0 : _c.call(rest, e);
|
|
313
|
+
}, "onBlur"),
|
|
314
|
+
onFocus: /* @__PURE__ */ __name((e) => {
|
|
315
|
+
var _a;
|
|
316
|
+
(_a = rest.onFocus) == null ? void 0 : _a.call(rest, e);
|
|
317
|
+
}, "onFocus")
|
|
318
|
+
}
|
|
319
|
+
);
|
|
320
|
+
}
|
|
321
|
+
__name(RTEClient, "RTEClient");
|
|
322
|
+
const RTEClient$1 = memo(RTEClient);
|
|
323
|
+
export {
|
|
324
|
+
bem,
|
|
325
|
+
RTEClient$1 as default
|
|
326
|
+
};
|
|
@@ -0,0 +1,253 @@
|
|
|
1
|
+
/* stylelint-disable */
|
|
2
|
+
/**
|
|
3
|
+
* Calculates a rem-based value by a given pixel size.
|
|
4
|
+
*/
|
|
5
|
+
/* stylelint-disable */
|
|
6
|
+
/**
|
|
7
|
+
* Applies flex-column and gap.
|
|
8
|
+
*/
|
|
9
|
+
/*
|
|
10
|
+
As example (light, primary)
|
|
11
|
+
See defined modes in designsystem/config/gradients
|
|
12
|
+
*/
|
|
13
|
+
/**
|
|
14
|
+
* Mixin that renders a media query that target screens that are larger than the
|
|
15
|
+
* given size.
|
|
16
|
+
*/
|
|
17
|
+
/**
|
|
18
|
+
* Mixin that renders a media query that target screens that are smaller than the
|
|
19
|
+
* given size.
|
|
20
|
+
*/
|
|
21
|
+
/**
|
|
22
|
+
* Mixin that renders a media query that target screens in between the given range.
|
|
23
|
+
*/
|
|
24
|
+
/**
|
|
25
|
+
* Mixin that renders a media query that target screens that have height larger than the
|
|
26
|
+
* given size.
|
|
27
|
+
*/
|
|
28
|
+
/**
|
|
29
|
+
* Mixin that renders a media query that target screens that have height smaller than the
|
|
30
|
+
* given size.
|
|
31
|
+
*/
|
|
32
|
+
/* stylelint-disable */
|
|
33
|
+
/* M3/Elevation Light/1 */
|
|
34
|
+
/* M3/Elevation Light/2 */
|
|
35
|
+
/* M3/Elevation/5 */
|
|
36
|
+
/* M3/Elevation/1 Text */
|
|
37
|
+
/* Inner elevations */
|
|
38
|
+
/* stylelint-disable */
|
|
39
|
+
/**
|
|
40
|
+
* Visually hides an element but not removes them for screen readers.
|
|
41
|
+
*/
|
|
42
|
+
/**
|
|
43
|
+
* The inverse of the `hidden` helper to reset a previously hidden element to be
|
|
44
|
+
* visible for users.
|
|
45
|
+
*/
|
|
46
|
+
/**
|
|
47
|
+
* Creates a selector for :hover effects depending on the current user input
|
|
48
|
+
* device. If the input device is a mouse, this hover effect will appear.
|
|
49
|
+
* Keyboard and touch inputs are ignored.
|
|
50
|
+
*
|
|
51
|
+
* Example usage:
|
|
52
|
+
* .link {
|
|
53
|
+
* color: blue;
|
|
54
|
+
*
|
|
55
|
+
* @include when-hovered() {
|
|
56
|
+
* color: green;
|
|
57
|
+
* }
|
|
58
|
+
* }
|
|
59
|
+
*/
|
|
60
|
+
/**
|
|
61
|
+
* Creates a selector for :active effects depending on the current user input
|
|
62
|
+
* device. The state applies when the input device is a mouse or keyboard. Touch
|
|
63
|
+
* devices will not show a pressed state.
|
|
64
|
+
*
|
|
65
|
+
* Example usage:
|
|
66
|
+
* .link {
|
|
67
|
+
* box-shadow: none;
|
|
68
|
+
*
|
|
69
|
+
* @include when-pressed() {
|
|
70
|
+
* box-shadow: inset 0 2px 4px grey;
|
|
71
|
+
* }
|
|
72
|
+
* }
|
|
73
|
+
*/
|
|
74
|
+
/**
|
|
75
|
+
* Creates a selector for :focus effects depending on the current user input
|
|
76
|
+
* device. When the user navigates using a keyboard, the focus effect defined in
|
|
77
|
+
* here is applied. For other input devices they don't show up.
|
|
78
|
+
*
|
|
79
|
+
* Example usage:
|
|
80
|
+
* .link {
|
|
81
|
+
* text-decoration: none;
|
|
82
|
+
*
|
|
83
|
+
* @include when-focused() {
|
|
84
|
+
* text-decoration: underline;
|
|
85
|
+
* }
|
|
86
|
+
* }
|
|
87
|
+
*/
|
|
88
|
+
/**
|
|
89
|
+
* Creates a selector for :focus-within effects depending on the current user
|
|
90
|
+
* input device. When the user navigates using a keyboard, the focus effect
|
|
91
|
+
* defined in here is applied. For other input devices they don't show up.
|
|
92
|
+
*
|
|
93
|
+
* Example usage:
|
|
94
|
+
* .link {
|
|
95
|
+
* img {
|
|
96
|
+
* opacity: 0.75;
|
|
97
|
+
*
|
|
98
|
+
* @include when-focused-within() {
|
|
99
|
+
* opacity: 1;
|
|
100
|
+
* }
|
|
101
|
+
* }
|
|
102
|
+
* }
|
|
103
|
+
*/
|
|
104
|
+
/**
|
|
105
|
+
* Wrapper for media query "prefers-reduced-motion".
|
|
106
|
+
*/
|
|
107
|
+
/**
|
|
108
|
+
* This helper hides the outline but still makes it visible for
|
|
109
|
+
* Windows high-contrast users. Use this instead of `outline: 0;`.
|
|
110
|
+
*/
|
|
111
|
+
/**
|
|
112
|
+
* This helper hides the outline but still makes it visible for
|
|
113
|
+
* Windows high-contrast users. Use this instead of `outline: 0;`.
|
|
114
|
+
*/
|
|
115
|
+
/**
|
|
116
|
+
* Renders an alternative, but application consistent focus-ring.
|
|
117
|
+
*/
|
|
118
|
+
/**
|
|
119
|
+
* Specifies the outer layout for all contents across breakpoints. Apply this
|
|
120
|
+
* mixin to the container element, to center the contents on the screen within
|
|
121
|
+
* the layout offsets.
|
|
122
|
+
*/
|
|
123
|
+
/**
|
|
124
|
+
* This mixin specifies basic text-styles for components that render a richtext
|
|
125
|
+
* content.
|
|
126
|
+
*/
|
|
127
|
+
.prokodo-RTE {
|
|
128
|
+
display: flex;
|
|
129
|
+
flex-direction: column;
|
|
130
|
+
width: 100%;
|
|
131
|
+
}
|
|
132
|
+
.prokodo-RTE__surface {
|
|
133
|
+
position: relative;
|
|
134
|
+
width: calc(100% - 4px);
|
|
135
|
+
padding: 0;
|
|
136
|
+
overflow: hidden;
|
|
137
|
+
background-color: var(--color-primary-40);
|
|
138
|
+
}
|
|
139
|
+
.prokodo-RTE__surface::after {
|
|
140
|
+
content: none;
|
|
141
|
+
}
|
|
142
|
+
.prokodo-RTE__toolbar {
|
|
143
|
+
border: none !important;
|
|
144
|
+
background-color: var(--color-primary-50);
|
|
145
|
+
}
|
|
146
|
+
.prokodo-RTE__toolbar__icon__part__stroke, .prokodo-RTE__toolbar__icon__part__stroke__miter {
|
|
147
|
+
stroke: var(--color-grey-900) !important;
|
|
148
|
+
opacity: 0.7;
|
|
149
|
+
}
|
|
150
|
+
.prokodo-RTE__toolbar__icon__part__fill {
|
|
151
|
+
fill: var(--color-grey-900) !important;
|
|
152
|
+
opacity: 0.7;
|
|
153
|
+
}
|
|
154
|
+
.prokodo-RTE__resize {
|
|
155
|
+
position: absolute;
|
|
156
|
+
right: 0.5rem;
|
|
157
|
+
bottom: 0.5rem;
|
|
158
|
+
width: 18px;
|
|
159
|
+
height: 18px;
|
|
160
|
+
padding: 0;
|
|
161
|
+
border: none;
|
|
162
|
+
background: transparent;
|
|
163
|
+
color: var(--color-grey-900);
|
|
164
|
+
cursor: ns-resize;
|
|
165
|
+
opacity: 0.55;
|
|
166
|
+
}
|
|
167
|
+
.prokodo-RTE__mount {
|
|
168
|
+
position: relative;
|
|
169
|
+
height: 200px;
|
|
170
|
+
border: none;
|
|
171
|
+
background: transparent;
|
|
172
|
+
width: 100%;
|
|
173
|
+
border: none !important;
|
|
174
|
+
}
|
|
175
|
+
.prokodo-RTE__mount--disabled {
|
|
176
|
+
cursor: not-allowed;
|
|
177
|
+
opacity: 0.85;
|
|
178
|
+
}
|
|
179
|
+
.prokodo-RTE__tooltip {
|
|
180
|
+
max-width: calc(100% - 0.75rem - 0.75rem);
|
|
181
|
+
box-sizing: border-box;
|
|
182
|
+
border-radius: 14px;
|
|
183
|
+
overflow: hidden;
|
|
184
|
+
}
|
|
185
|
+
.prokodo-RTE__editor {
|
|
186
|
+
height: 100%;
|
|
187
|
+
padding: 0.75rem;
|
|
188
|
+
outline: none;
|
|
189
|
+
overflow-y: auto;
|
|
190
|
+
font-weight: 400;
|
|
191
|
+
font-size: 1.125rem;
|
|
192
|
+
font-family: var(--font-secondary), -apple-system, system-ui, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
|
|
193
|
+
font-style: normal;
|
|
194
|
+
line-height: 1.55;
|
|
195
|
+
letter-spacing: 0.03em;
|
|
196
|
+
text-transform: none;
|
|
197
|
+
text-align: left;
|
|
198
|
+
text-decoration: none;
|
|
199
|
+
}
|
|
200
|
+
@media screen and (min-width: 480px) {
|
|
201
|
+
.prokodo-RTE__editor {
|
|
202
|
+
font-size: 1rem;
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
@media screen and (min-width: 960px) {
|
|
206
|
+
.prokodo-RTE__editor {
|
|
207
|
+
font-size: 1rem;
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
.prokodo-RTE__editor p {
|
|
211
|
+
margin: 0 0 0.5rem 0;
|
|
212
|
+
}
|
|
213
|
+
.prokodo-RTE__editor p:last-child {
|
|
214
|
+
margin-bottom: 0;
|
|
215
|
+
}
|
|
216
|
+
.prokodo-RTE__editor ul,
|
|
217
|
+
.prokodo-RTE__editor ol {
|
|
218
|
+
margin: 0 0 0.5rem 1.25rem;
|
|
219
|
+
padding: 0;
|
|
220
|
+
}
|
|
221
|
+
.prokodo-RTE__editor pre {
|
|
222
|
+
margin: 0.5rem 0;
|
|
223
|
+
padding: 0.5rem;
|
|
224
|
+
border-radius: 14px;
|
|
225
|
+
overflow: auto;
|
|
226
|
+
background: rgba(0, 0, 0, 0.06);
|
|
227
|
+
}
|
|
228
|
+
.prokodo-RTE__editor code {
|
|
229
|
+
background: rgba(0, 0, 0, 0.06);
|
|
230
|
+
padding: 0 6px;
|
|
231
|
+
border-radius: 8px;
|
|
232
|
+
}
|
|
233
|
+
.prokodo-RTE__editor img {
|
|
234
|
+
max-width: 100%;
|
|
235
|
+
height: auto;
|
|
236
|
+
border-radius: 14px;
|
|
237
|
+
display: block;
|
|
238
|
+
margin: 0.5rem 0;
|
|
239
|
+
}
|
|
240
|
+
.prokodo-RTE--disabled {
|
|
241
|
+
opacity: 0.9;
|
|
242
|
+
}
|
|
243
|
+
.prokodo-RTE--readonly {
|
|
244
|
+
opacity: 0.95;
|
|
245
|
+
}
|
|
246
|
+
.prokodo-RTE__hidden {
|
|
247
|
+
position: absolute;
|
|
248
|
+
top: auto;
|
|
249
|
+
left: -99999px;
|
|
250
|
+
width: 0;
|
|
251
|
+
height: 0;
|
|
252
|
+
text-indent: -99999px;
|
|
253
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
|
+
import { createIsland } from "../../helpers/createIsland.js";
|
|
4
|
+
import RTEServer from "./RTE.server.js";
|
|
5
|
+
const RTE = createIsland({
|
|
6
|
+
name: "RTE",
|
|
7
|
+
Server: RTEServer,
|
|
8
|
+
loadLazy: /* @__PURE__ */ __name(() => import("./RTE.lazy.js"), "loadLazy")
|
|
9
|
+
});
|
|
10
|
+
export {
|
|
11
|
+
RTE
|
|
12
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { createLazyWrapper } from "../../helpers/createLazyWrapper.js";
|
|
3
|
+
import RTEClient from "./RTE.client.js";
|
|
4
|
+
import RTEServer from "./RTE.server.js";
|
|
5
|
+
const RTE_lazy = createLazyWrapper({
|
|
6
|
+
name: "RTE",
|
|
7
|
+
Client: RTEClient,
|
|
8
|
+
Server: RTEServer
|
|
9
|
+
});
|
|
10
|
+
export {
|
|
11
|
+
RTE_lazy as default
|
|
12
|
+
};
|