@prokodo/ui 0.1.10 → 0.1.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (107) hide show
  1. package/README.md +3 -0
  2. package/dist/_virtual/_commonjsHelpers.js +2 -0
  3. package/dist/_virtual/quill.js +34 -0
  4. package/dist/_virtual/quill2.js +4 -0
  5. package/dist/components/RTE/RTE.client.js +367 -0
  6. package/dist/components/RTE/RTE.css +473 -0
  7. package/dist/components/RTE/RTE.js +12 -0
  8. package/dist/components/RTE/RTE.lazy.js +12 -0
  9. package/dist/components/RTE/RTE.module.css +473 -0
  10. package/dist/components/RTE/RTE.module.scss.js +22 -0
  11. package/dist/components/RTE/RTE.server.js +19 -0
  12. package/dist/components/RTE/RTE.styles.js +21 -0
  13. package/dist/components/RTE/RTE.theme.js +4 -0
  14. package/dist/components/RTE/RTE.utils.js +73 -0
  15. package/dist/components/RTE/RTE.view.js +107 -0
  16. package/dist/components/RTE/index.js +4 -0
  17. package/dist/components/avatar/Avatar.css +1 -3
  18. package/dist/components/avatar/Avatar.module.css +1 -3
  19. package/dist/components/avatar/Avatar.view.js +30 -17
  20. package/dist/components/base-link/BaseLink.client.js +11 -1
  21. package/dist/components/button/Button.css +1 -0
  22. package/dist/components/button/Button.module.css +1 -0
  23. package/dist/components/button/Button.view.js +1 -0
  24. package/dist/components/card/Card.css +10 -1
  25. package/dist/components/card/Card.module.css +10 -1
  26. package/dist/components/card/Card.module.scss.js +1 -0
  27. package/dist/components/chip/Chip.css +2 -2
  28. package/dist/components/chip/Chip.module.css +2 -2
  29. package/dist/components/chip/Chip.view.js +1 -1
  30. package/dist/components/input/Input.css +21 -2
  31. package/dist/components/input/Input.module.css +21 -2
  32. package/dist/components/input/Input.view.js +21 -13
  33. package/dist/components/pagination/Pagination.client.js +14 -0
  34. package/dist/components/pagination/Pagination.css +191 -0
  35. package/dist/components/pagination/Pagination.js +12 -0
  36. package/dist/components/pagination/Pagination.lazy.js +12 -0
  37. package/dist/components/pagination/Pagination.module.css +191 -0
  38. package/dist/components/pagination/Pagination.module.scss.js +12 -0
  39. package/dist/components/pagination/Pagination.server.js +11 -0
  40. package/dist/components/pagination/Pagination.utils.js +55 -0
  41. package/dist/components/pagination/Pagination.view.js +98 -0
  42. package/dist/components/pagination/index.js +4 -0
  43. package/dist/components/rich-text/RichText.client.js +31 -0
  44. package/dist/components/rich-text/RichText.css +13 -1
  45. package/dist/components/rich-text/RichText.module.css +13 -1
  46. package/dist/components/rich-text/RichText.module.scss.js +2 -0
  47. package/dist/components/rich-text/RichText.server.js +1 -0
  48. package/dist/components/select/Select.client.js +230 -8
  49. package/dist/components/select/Select.css +47 -16
  50. package/dist/components/select/Select.module.css +47 -16
  51. package/dist/components/select/Select.module.scss.js +2 -0
  52. package/dist/components/select/Select.view.js +20 -57
  53. package/dist/components/switch/Switch.css +1 -1
  54. package/dist/components/switch/Switch.module.css +1 -1
  55. package/dist/components/switch/Switch.view.js +3 -1
  56. package/dist/components/tooltip/Tooltip.client.js +373 -0
  57. package/dist/components/tooltip/Tooltip.css +241 -0
  58. package/dist/components/tooltip/Tooltip.js +16 -0
  59. package/dist/components/tooltip/Tooltip.module.css +241 -0
  60. package/dist/components/tooltip/Tooltip.module.scss.js +15 -0
  61. package/dist/components/tooltip/Tooltip.server.js +12 -0
  62. package/dist/components/tooltip/Tooltip.view.js +127 -0
  63. package/dist/components/tooltip/index.js +4 -0
  64. package/dist/constants/project.js +1 -1
  65. package/dist/index.js +6 -0
  66. package/dist/node_modules/.pnpm/quill@2.0.3/node_modules/quill/dist/quill.js +6133 -0
  67. package/dist/node_modules/.pnpm/quill@2.0.3/node_modules/quill/dist/quill.snow.css.js +12 -0
  68. package/dist/theme.css +214 -26
  69. package/dist/tsconfig.build.tsbuildinfo +1 -1
  70. package/dist/types/components/RTE/RTE.client.d.ts +6 -0
  71. package/dist/types/components/RTE/RTE.d.ts +339 -0
  72. package/dist/types/components/RTE/RTE.lazy.d.ts +340 -0
  73. package/dist/types/components/RTE/RTE.model.d.ts +17 -0
  74. package/dist/types/components/RTE/RTE.server.d.ts +3 -0
  75. package/dist/types/components/RTE/RTE.styles.d.ts +1 -0
  76. package/dist/types/components/RTE/RTE.theme.d.ts +2 -0
  77. package/dist/types/components/RTE/RTE.utils.d.ts +5 -0
  78. package/dist/types/components/RTE/RTE.view.d.ts +11 -0
  79. package/dist/types/components/RTE/index.d.ts +2 -0
  80. package/dist/types/components/avatar/Avatar.model.d.ts +1 -1
  81. package/dist/types/components/card/Card.model.d.ts +1 -1
  82. package/dist/types/components/grid/Grid.model.d.ts +37 -7
  83. package/dist/types/components/input/Input.model.d.ts +13 -1
  84. package/dist/types/components/input/Input.view.d.ts +1 -1
  85. package/dist/types/components/pagination/Pagination.client.d.ts +5 -0
  86. package/dist/types/components/pagination/Pagination.d.ts +4 -0
  87. package/dist/types/components/pagination/Pagination.lazy.d.ts +5 -0
  88. package/dist/types/components/pagination/Pagination.model.d.ts +22 -0
  89. package/dist/types/components/pagination/Pagination.server.d.ts +3 -0
  90. package/dist/types/components/pagination/Pagination.utils.d.ts +13 -0
  91. package/dist/types/components/pagination/Pagination.view.d.ts +3 -0
  92. package/dist/types/components/pagination/index.d.ts +2 -0
  93. package/dist/types/components/rich-text/RichText.client.d.ts +1 -1
  94. package/dist/types/components/rich-text/RichText.d.ts +1 -0
  95. package/dist/types/components/rich-text/RichText.lazy.d.ts +1 -0
  96. package/dist/types/components/rich-text/RichText.model.d.ts +1 -0
  97. package/dist/types/components/select/Select.model.d.ts +16 -1
  98. package/dist/types/components/tooltip/Tooltip.client.d.ts +5 -0
  99. package/dist/types/components/tooltip/Tooltip.d.ts +4 -0
  100. package/dist/types/components/tooltip/Tooltip.lazy.d.ts +5 -0
  101. package/dist/types/components/tooltip/Tooltip.model.d.ts +47 -0
  102. package/dist/types/components/tooltip/Tooltip.server.d.ts +3 -0
  103. package/dist/types/components/tooltip/Tooltip.view.d.ts +3 -0
  104. package/dist/types/components/tooltip/index.d.ts +2 -0
  105. package/dist/types/helpers/validations.d.ts +2 -2
  106. package/dist/types/index.d.ts +3 -0
  107. package/package.json +19 -2
package/README.md CHANGED
@@ -186,6 +186,7 @@ export default function GalleryPage() {
186
186
  | Loading | ✅ | – |
187
187
  | Lottie | ❌ | ✅ |
188
188
  | Map | ❌ | ✅ |
189
+ | Pagination | ✅ | ✅ |
189
190
  | PostItem | ✅ | ✅ |
190
191
  | PostTeaser | ✅ | ✅ |
191
192
  | PostWidget | ✅ | ✅ |
@@ -194,6 +195,7 @@ export default function GalleryPage() {
194
195
  | Quote | ✅ | – |
195
196
  | Rating | ✅ | ✅ |
196
197
  | RichText | ✅ | ✅ |
198
+ | RTE (Beta) | ✅ | ✅ |
197
199
  | Select | ✅ | ✅ |
198
200
  | SideNav | ✅ | ✅ |
199
201
  | Skeleton | ✅ | – |
@@ -203,6 +205,7 @@ export default function GalleryPage() {
203
205
  | Switch | ✅ | ✅ |
204
206
  | Table | ✅ | – |
205
207
  | Teaser | ✅ | - |
208
+ | Tooltip | ✅ | ✅ |
206
209
 
207
210
  ## Since Next.js 16
208
211
 
@@ -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,4 @@
1
+ var quill = { exports: {} };
2
+ export {
3
+ quill as __module
4
+ };
@@ -0,0 +1,367 @@
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, syncPickerSelected } from "./RTE.utils.js";
15
+ import { RTEView } from "./RTE.view.js";
16
+ const bem = create(styles, "RTE");
17
+ const ALLOWED_FORMATS = [
18
+ "header",
19
+ "bold",
20
+ "italic",
21
+ "underline",
22
+ "strike",
23
+ "list",
24
+ "link",
25
+ "code-block",
26
+ "image"
27
+ ];
28
+ function RTEClient(props) {
29
+ const {
30
+ name,
31
+ value,
32
+ onChange,
33
+ onValidate,
34
+ required,
35
+ maxLength,
36
+ errorTranslations,
37
+ errorText,
38
+ disabled,
39
+ readOnly,
40
+ placeholder,
41
+ rteOptions,
42
+ rteToolbar,
43
+ ...rest
44
+ } = props;
45
+ const mountRef = useRef(null);
46
+ const surfaceRef = useRef(null);
47
+ const quillRef = useRef(null);
48
+ const htmlRef = useRef(value ?? "");
49
+ const onChangeRef = useRef(onChange);
50
+ const onValidateRef = useRef(onValidate);
51
+ const validationCfgRef = useRef({ name, required, errorTranslations });
52
+ useEffect(() => {
53
+ onChangeRef.current = onChange;
54
+ }, [onChange]);
55
+ useEffect(() => {
56
+ onValidateRef.current = onValidate;
57
+ }, [onValidate]);
58
+ useEffect(() => {
59
+ validationCfgRef.current = { name, required, errorTranslations };
60
+ }, [name, required, errorTranslations]);
61
+ const rteOptionsRef = useRef(rteOptions);
62
+ const rteToolbarRef = useRef(rteToolbar);
63
+ useEffect(() => {
64
+ rteOptionsRef.current = rteOptions;
65
+ }, [rteOptions]);
66
+ useEffect(() => {
67
+ rteToolbarRef.current = rteToolbar;
68
+ }, [rteToolbar]);
69
+ const startYRef = useRef(0);
70
+ const startHRef = useRef(0);
71
+ const rootClickHandlerRef = useRef(null);
72
+ const [err, setErr] = useState(errorText);
73
+ const lastEmittedHtmlRef = useRef("");
74
+ useEffect(() => {
75
+ if (isString(errorText)) setErr(errorText);
76
+ }, [errorText]);
77
+ const emitValidation = useCallback((plainText) => {
78
+ const cfg = validationCfgRef.current;
79
+ handleValidation(
80
+ "text",
81
+ cfg.name,
82
+ plainText,
83
+ cfg.required,
84
+ void 0,
85
+ void 0,
86
+ void 0,
87
+ cfg.errorTranslations,
88
+ (n, e) => {
89
+ var _a;
90
+ setErr(e);
91
+ (_a = onValidateRef.current) == null ? void 0 : _a.call(onValidateRef, n, e);
92
+ }
93
+ );
94
+ }, []);
95
+ const syncFromQuill = useCallback(() => {
96
+ var _a, _b, _c;
97
+ const q = quillRef.current;
98
+ if (!q) return;
99
+ const html = q.root.innerHTML;
100
+ const text = ((_b = (_a = q.getText()) == null ? void 0 : _a.trim) == null ? void 0 : _b.call(_a)) ?? "";
101
+ htmlRef.current = html;
102
+ lastEmittedHtmlRef.current = html;
103
+ emitValidation(text);
104
+ (_c = onChangeRef.current) == null ? void 0 : _c.call(onChangeRef, html, { text });
105
+ }, [emitValidation]);
106
+ const getQuillContainer = useCallback(() => {
107
+ const surface = surfaceRef.current;
108
+ if (!surface) return null;
109
+ return surface.querySelector(".ql-container");
110
+ }, []);
111
+ const startResize = useCallback(
112
+ (e) => {
113
+ e.preventDefault();
114
+ e.stopPropagation();
115
+ if (Boolean(disabled) || Boolean(readOnly)) return;
116
+ const container = getQuillContainer();
117
+ if (!container) return;
118
+ startYRef.current = e.clientY;
119
+ startHRef.current = container.getBoundingClientRect().height;
120
+ const onMove = /* @__PURE__ */ __name((ev) => {
121
+ const dy = ev.clientY - startYRef.current;
122
+ const next = Math.max(160, startHRef.current + dy);
123
+ container.style.height = `${next}px`;
124
+ }, "onMove");
125
+ const onUp = /* @__PURE__ */ __name(() => {
126
+ window.removeEventListener("mousemove", onMove);
127
+ window.removeEventListener("mouseup", onUp);
128
+ }, "onUp");
129
+ window.addEventListener("mousemove", onMove);
130
+ window.addEventListener("mouseup", onUp);
131
+ },
132
+ [disabled, readOnly, getQuillContainer]
133
+ );
134
+ useEffect(() => {
135
+ ensureQuillSnowStyles(cssText);
136
+ let cancelled = false;
137
+ const mountEl = mountRef.current;
138
+ const surfaceEl = surfaceRef.current;
139
+ async function init() {
140
+ var _a, _b, _c, _d, _e, _f;
141
+ if (!mountEl || !surfaceEl) return;
142
+ if (Boolean(disabled) || Boolean(readOnly)) return;
143
+ cleanupQuill(surfaceEl, mountEl);
144
+ const QuillImport = await import("../../_virtual/quill.js").then((n) => n.q);
145
+ const Quill = (QuillImport == null ? void 0 : QuillImport.default) ?? QuillImport;
146
+ if (cancelled) return;
147
+ try {
148
+ const BaseImage = Quill.import("formats/image");
149
+ const _ImageWithAlt = class _ImageWithAlt extends BaseImage {
150
+ static formats(domNode) {
151
+ var _a2;
152
+ const formats = ((_a2 = super.formats) == null ? void 0 : _a2.call(this, domNode)) ?? {};
153
+ const alt = domNode.getAttribute("alt");
154
+ const title = domNode.getAttribute("title");
155
+ if (alt != null) formats.alt = alt;
156
+ if (title != null) formats.title = title;
157
+ return formats;
158
+ }
159
+ format(name2, value2) {
160
+ if (name2 === "alt") {
161
+ const v = typeof value2 === "string" ? value2.trim() : "";
162
+ if (v) this.domNode.setAttribute("alt", v);
163
+ else this.domNode.removeAttribute("alt");
164
+ return;
165
+ }
166
+ if (name2 === "title") {
167
+ const v = typeof value2 === "string" ? value2.trim() : "";
168
+ if (v) this.domNode.setAttribute("title", v);
169
+ else this.domNode.removeAttribute("title");
170
+ return;
171
+ }
172
+ super.format(name2, value2);
173
+ }
174
+ };
175
+ __name(_ImageWithAlt, "ImageWithAlt");
176
+ __publicField(_ImageWithAlt, "blotName", "image");
177
+ __publicField(_ImageWithAlt, "tagName", "IMG");
178
+ let ImageWithAlt = _ImageWithAlt;
179
+ Quill.register("formats/image", ImageWithAlt, true);
180
+ } catch {
181
+ }
182
+ const opts = rteOptionsRef.current;
183
+ const extraToolbar = rteToolbarRef.current;
184
+ const baseToolbar = [
185
+ [{ header: [3, 4, false] }],
186
+ ["bold", "italic", "underline", "strike"],
187
+ [{ list: "ordered" }, { list: "bullet" }],
188
+ ["link", "code-block", "image"],
189
+ ["clean"]
190
+ ];
191
+ const toolbarContainer = Array.isArray(extraToolbar) && extraToolbar.length ? [...baseToolbar, extraToolbar] : baseToolbar;
192
+ const q = new Quill(mountEl, {
193
+ ...opts,
194
+ theme: "snow",
195
+ placeholder: placeholder ?? "",
196
+ formats: ALLOWED_FORMATS,
197
+ modules: {
198
+ history: {
199
+ delay: 1e3,
200
+ maxStack: 200,
201
+ userOnly: true,
202
+ ...((_a = opts == null ? void 0 : opts.modules) == null ? void 0 : _a.history) ?? {}
203
+ },
204
+ ...opts == null ? void 0 : opts.modules,
205
+ toolbar: toolbarContainer,
206
+ clipboard: {
207
+ ...((_b = opts == null ? void 0 : opts.modules) == null ? void 0 : _b.clipboard) ?? {}
208
+ }
209
+ }
210
+ });
211
+ quillRef.current = q;
212
+ const Keyboard = q.getModule("keyboard");
213
+ (_c = Keyboard == null ? void 0 : Keyboard.addBinding) == null ? void 0 : _c.call(
214
+ Keyboard,
215
+ {
216
+ key: 13,
217
+ // Enter
218
+ shiftKey: false,
219
+ collapsed: true
220
+ },
221
+ (range, ctx) => {
222
+ var _a2;
223
+ const header = (_a2 = ctx == null ? void 0 : ctx.format) == null ? void 0 : _a2.header;
224
+ if (!header) return true;
225
+ q.insertText(range.index, "\n", "user");
226
+ q.formatLine(range.index + 1, 1, { header: false }, "user");
227
+ q.setSelection(range.index + 1, 0, "silent");
228
+ return false;
229
+ }
230
+ );
231
+ (_d = opts == null ? void 0 : opts.onInit) == null ? void 0 : _d.call(opts, q);
232
+ addClasses(q.root, bem("editor"));
233
+ const toolbarModule = q.getModule("toolbar");
234
+ addClasses((toolbarModule == null ? void 0 : toolbarModule.container) ?? null, bem("toolbar"));
235
+ const toolbarEl = (toolbarModule == null ? void 0 : toolbarModule.container) ?? null;
236
+ if (toolbarEl) {
237
+ decorateToolbar(toolbarEl);
238
+ syncPickerSelected(toolbarEl);
239
+ const obs = new MutationObserver(() => syncPickerSelected(toolbarEl));
240
+ obs.observe(toolbarEl, {
241
+ subtree: true,
242
+ attributes: true,
243
+ attributeFilter: ["class"]
244
+ });
245
+ }
246
+ const tooltipEl = q.container.querySelector(
247
+ ".ql-tooltip"
248
+ );
249
+ addClasses(tooltipEl, bem("tooltip"));
250
+ const mo = new MutationObserver(() => {
251
+ const t = q.container.querySelector(".ql-tooltip");
252
+ if (t) addClasses(t, bem("tooltip"));
253
+ });
254
+ mo.observe(q.container, { subtree: true, childList: true });
255
+ const container = getQuillContainer();
256
+ if (container && !container.style.height) container.style.height = "220px";
257
+ if (htmlRef.current)
258
+ q.clipboard.dangerouslyPasteHTML(htmlRef.current, "silent");
259
+ emitValidation(((_f = (_e = q.getText()) == null ? void 0 : _e.trim) == null ? void 0 : _f.call(_e)) ?? "");
260
+ q.on("text-change", (_d2, _o, source) => {
261
+ if (source === "user") syncFromQuill();
262
+ });
263
+ const root = q.root;
264
+ const onRootClick = /* @__PURE__ */ __name((ev) => {
265
+ var _a2, _b2;
266
+ if (Boolean(disabled) || Boolean(readOnly)) return;
267
+ const el = ev.target;
268
+ if (!el || el.tagName !== "IMG") return;
269
+ const img = el;
270
+ const currentAlt = img.getAttribute("alt") ?? "";
271
+ const nextAlt = window.prompt("Alt text", currentAlt);
272
+ if (nextAlt == null) return;
273
+ const v = nextAlt.trim();
274
+ try {
275
+ const blot = Quill.find(img);
276
+ if (!isNull(blot == null ? void 0 : blot.format)) {
277
+ blot.format("alt", v);
278
+ (_a2 = q.update) == null ? void 0 : _a2.call(q, "user");
279
+ syncFromQuill();
280
+ return;
281
+ }
282
+ } catch {
283
+ }
284
+ if (v) img.setAttribute("alt", v);
285
+ else img.removeAttribute("alt");
286
+ (_b2 = q.update) == null ? void 0 : _b2.call(q, "user");
287
+ syncFromQuill();
288
+ }, "onRootClick");
289
+ rootClickHandlerRef.current = onRootClick;
290
+ root.addEventListener("click", onRootClick);
291
+ }
292
+ __name(init, "init");
293
+ void init();
294
+ return () => {
295
+ cancelled = true;
296
+ const q = quillRef.current;
297
+ const h = rootClickHandlerRef.current;
298
+ if ((q == null ? void 0 : q.root) && h) q.root.removeEventListener("click", h);
299
+ rootClickHandlerRef.current = null;
300
+ quillRef.current = null;
301
+ cleanupQuill(surfaceEl, mountEl);
302
+ };
303
+ }, [
304
+ disabled,
305
+ readOnly,
306
+ placeholder,
307
+ emitValidation,
308
+ syncFromQuill,
309
+ getQuillContainer
310
+ ]);
311
+ useEffect(() => {
312
+ var _a, _b, _c;
313
+ if (isNull(value)) return;
314
+ const q = quillRef.current;
315
+ if (Boolean((_a = q == null ? void 0 : q.hasFocus) == null ? void 0 : _a.call(q))) return;
316
+ const next = String(value);
317
+ if (next === htmlRef.current) return;
318
+ if (next === lastEmittedHtmlRef.current) {
319
+ htmlRef.current = next;
320
+ return;
321
+ }
322
+ htmlRef.current = next;
323
+ if (q) {
324
+ q.clipboard.dangerouslyPasteHTML(next, "silent");
325
+ emitValidation(((_c = (_b = q.getText()) == null ? void 0 : _b.trim) == null ? void 0 : _c.call(_b)) ?? "");
326
+ }
327
+ }, [value, emitValidation]);
328
+ return /* @__PURE__ */ jsx(
329
+ RTEView,
330
+ {
331
+ ...rest,
332
+ disabled,
333
+ errorText: err,
334
+ errorTranslations,
335
+ htmlValue: htmlRef.current,
336
+ maxLength,
337
+ mountRef,
338
+ name,
339
+ placeholder,
340
+ readOnly,
341
+ required,
342
+ rteToolbar,
343
+ showResize: !Boolean(disabled) && !Boolean(readOnly),
344
+ surfaceRef,
345
+ value: htmlRef.current,
346
+ onChange,
347
+ onStartResize: startResize,
348
+ onValidate,
349
+ onBlur: /* @__PURE__ */ __name((e) => {
350
+ var _a, _b, _c;
351
+ const q = quillRef.current;
352
+ if (q) emitValidation(((_b = (_a = q.getText()) == null ? void 0 : _a.trim) == null ? void 0 : _b.call(_a)) ?? "");
353
+ (_c = rest.onBlur) == null ? void 0 : _c.call(rest, e);
354
+ }, "onBlur"),
355
+ onFocus: /* @__PURE__ */ __name((e) => {
356
+ var _a;
357
+ (_a = rest.onFocus) == null ? void 0 : _a.call(rest, e);
358
+ }, "onFocus")
359
+ }
360
+ );
361
+ }
362
+ __name(RTEClient, "RTEClient");
363
+ const RTEClient$1 = memo(RTEClient);
364
+ export {
365
+ bem,
366
+ RTEClient$1 as default
367
+ };