@rh-support/components 2.5.226 → 2.5.231

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 (61) hide show
  1. package/lib/esm/ConfirmationModal/ConfirmationDialog.js +1 -1
  2. package/lib/esm/Functional/CaseContactsSelectorExternal.d.ts +0 -2
  3. package/lib/esm/Functional/CaseContactsSelectorExternal.d.ts.map +1 -1
  4. package/lib/esm/Functional/CaseContactsSelectorExternal.js +82 -156
  5. package/lib/esm/InlineEdit/NewInlineEdit.d.ts +0 -2
  6. package/lib/esm/InlineEdit/NewInlineEdit.d.ts.map +1 -1
  7. package/lib/esm/InlineEdit/NewInlineEdit.js +2 -7
  8. package/lib/esm/MarkdownEditor/MarkdownEditor.d.ts +49 -0
  9. package/lib/esm/MarkdownEditor/MarkdownEditor.d.ts.map +1 -0
  10. package/lib/esm/MarkdownEditor/MarkdownEditor.js +601 -0
  11. package/lib/esm/MarkdownEditor/index.d.ts +2 -0
  12. package/lib/esm/MarkdownEditor/index.d.ts.map +1 -0
  13. package/lib/esm/MarkdownEditor/index.js +1 -0
  14. package/lib/esm/MarkdownEditor/markdownEditor.css +223 -0
  15. package/lib/esm/OwnerTypeaheadDropdown/OwnerTypeaheadDropdown.d.ts +0 -2
  16. package/lib/esm/OwnerTypeaheadDropdown/OwnerTypeaheadDropdown.d.ts.map +1 -1
  17. package/lib/esm/OwnerTypeaheadDropdown/OwnerTypeaheadDropdown.js +3 -8
  18. package/lib/esm/PhoneInput/PhoneInput.d.ts.map +1 -1
  19. package/lib/esm/PhoneInput/PhoneInput.js +1 -38
  20. package/lib/esm/SingleSelectDropdown/SingleSelectDropdown.d.ts +0 -2
  21. package/lib/esm/SingleSelectDropdown/SingleSelectDropdown.d.ts.map +1 -1
  22. package/lib/esm/SingleSelectDropdown/SingleSelectDropdown.js +3 -6
  23. package/lib/esm/SupportFeedbackForm/SupportFeedbackModal.d.ts.map +1 -1
  24. package/lib/esm/SupportFeedbackForm/SupportFeedbackModal.js +80 -62
  25. package/lib/esm/Table/TablePagination.d.ts +0 -1
  26. package/lib/esm/Table/TablePagination.d.ts.map +1 -1
  27. package/lib/esm/Table/TablePagination.js +1 -1
  28. package/lib/esm/helperFunctions/errorMessage.d.ts +1 -2
  29. package/lib/esm/helperFunctions/errorMessage.d.ts.map +1 -1
  30. package/lib/esm/helperFunctions/errorMessage.js +5 -19
  31. package/lib/esm/hooks/useCopyToClipboard.d.ts +1 -1
  32. package/lib/esm/hooks/useCopyToClipboard.d.ts.map +1 -1
  33. package/lib/esm/hooks/useCopyToClipboard.js +1 -3
  34. package/lib/esm/index.d.ts +1 -3
  35. package/lib/esm/index.d.ts.map +1 -1
  36. package/lib/esm/index.js +1 -4
  37. package/package.json +6 -9
  38. package/lib/esm/CaseLabelLoadErrorModal/CaseLabelLoadErrorModal.d.ts +0 -10
  39. package/lib/esm/CaseLabelLoadErrorModal/CaseLabelLoadErrorModal.d.ts.map +0 -1
  40. package/lib/esm/CaseLabelLoadErrorModal/CaseLabelLoadErrorModal.js +0 -17
  41. package/lib/esm/CaseLabelLoadErrorModal/CaseLabelLoadErrorModal.scss +0 -13
  42. package/lib/esm/CaseLabelLoadErrorModal/index.d.ts +0 -2
  43. package/lib/esm/CaseLabelLoadErrorModal/index.d.ts.map +0 -1
  44. package/lib/esm/CaseLabelLoadErrorModal/index.js +0 -1
  45. package/lib/esm/CustomDatePicker/CustomDatePicker.d.ts +0 -18
  46. package/lib/esm/CustomDatePicker/CustomDatePicker.d.ts.map +0 -1
  47. package/lib/esm/CustomDatePicker/CustomDatePicker.js +0 -27
  48. package/lib/esm/CustomDatePicker/customDatePicker.css +0 -52
  49. package/lib/esm/CustomDatePicker/index.d.ts +0 -2
  50. package/lib/esm/CustomDatePicker/index.d.ts.map +0 -1
  51. package/lib/esm/CustomDatePicker/index.js +0 -1
  52. package/lib/esm/RichTextEditor/RichTextEditor.d.ts +0 -45
  53. package/lib/esm/RichTextEditor/RichTextEditor.d.ts.map +0 -1
  54. package/lib/esm/RichTextEditor/RichTextEditor.js +0 -463
  55. package/lib/esm/RichTextEditor/index.d.ts +0 -4
  56. package/lib/esm/RichTextEditor/index.d.ts.map +0 -1
  57. package/lib/esm/RichTextEditor/index.js +0 -2
  58. package/lib/esm/RichTextEditor/richTextEditor.css +0 -153
  59. package/lib/esm/RichTextEditor/useQuillEditor.d.ts +0 -20
  60. package/lib/esm/RichTextEditor/useQuillEditor.d.ts.map +0 -1
  61. package/lib/esm/RichTextEditor/useQuillEditor.js +0 -81
@@ -1,81 +0,0 @@
1
- import DOMPurify from 'dompurify';
2
- import Quill from 'quill';
3
- import { useCallback, useEffect, useRef, useState } from 'react';
4
- const ALLOWED_FORMATS = ['header', 'bold', 'italic', 'underline', 'strike', 'list', 'indent', 'align', 'link', 'image'];
5
- export function useQuillEditor(options) {
6
- const editorRef = useRef(null);
7
- const quillRef = useRef(null);
8
- const [activeFormat, setActiveFormat] = useState({});
9
- const optionsRef = useRef(options);
10
- optionsRef.current = options;
11
- // Track whether the last change was internal (from Quill) to avoid echo loops
12
- const isInternalChange = useRef(false);
13
- useEffect(() => {
14
- if (!editorRef.current || quillRef.current)
15
- return;
16
- const quill = new Quill(editorRef.current, {
17
- theme: false,
18
- modules: {
19
- toolbar: false,
20
- clipboard: { matchVisual: false },
21
- },
22
- formats: ALLOWED_FORMATS,
23
- placeholder: optionsRef.current.placeholder,
24
- readOnly: optionsRef.current.readOnly,
25
- });
26
- quill.on('text-change', () => {
27
- var _a, _b, _c, _d;
28
- isInternalChange.current = true;
29
- const html = DOMPurify.sanitize(quill.getSemanticHTML());
30
- (_b = (_a = optionsRef.current).onChange) === null || _b === void 0 ? void 0 : _b.call(_a, html);
31
- (_d = (_c = optionsRef.current).onChangePlainText) === null || _d === void 0 ? void 0 : _d.call(_c, quill.getText().trim());
32
- const sel = quill.getSelection();
33
- if (sel) {
34
- setActiveFormat(quill.getFormat(sel));
35
- }
36
- isInternalChange.current = false;
37
- });
38
- quill.on('selection-change', (range) => {
39
- var _a, _b, _c, _d, _e, _f;
40
- if (range) {
41
- setActiveFormat(quill.getFormat(range));
42
- (_b = (_a = optionsRef.current).onSelectionChange) === null || _b === void 0 ? void 0 : _b.call(_a, quill.getFormat(range));
43
- if (range.length === 0) {
44
- (_d = (_c = optionsRef.current).onFocus) === null || _d === void 0 ? void 0 : _d.call(_c);
45
- }
46
- }
47
- else {
48
- (_f = (_e = optionsRef.current).onBlur) === null || _f === void 0 ? void 0 : _f.call(_e);
49
- }
50
- });
51
- quillRef.current = quill;
52
- return () => {
53
- quillRef.current = null;
54
- };
55
- // eslint-disable-next-line react-hooks/exhaustive-deps
56
- }, []);
57
- const setContents = useCallback((html) => {
58
- const quill = quillRef.current;
59
- if (!quill || isInternalChange.current)
60
- return;
61
- const currentHtml = DOMPurify.sanitize(quill.getSemanticHTML());
62
- if (currentHtml === html)
63
- return;
64
- const selection = quill.getSelection();
65
- quill.clipboard.dangerouslyPasteHTML(html);
66
- if (selection) {
67
- const length = quill.getLength();
68
- const safeIndex = Math.min(selection.index, length - 1);
69
- quill.setSelection(safeIndex, 0, 'silent');
70
- }
71
- }, []);
72
- const setReadOnly = useCallback((readOnly) => {
73
- var _a;
74
- (_a = quillRef.current) === null || _a === void 0 ? void 0 : _a.enable(!readOnly);
75
- }, []);
76
- const getPlainText = useCallback(() => {
77
- var _a, _b;
78
- return (_b = (_a = quillRef.current) === null || _a === void 0 ? void 0 : _a.getText().trim()) !== null && _b !== void 0 ? _b : '';
79
- }, []);
80
- return { editorRef, quillRef, activeFormat, setActiveFormat, setContents, setReadOnly, getPlainText };
81
- }