@rh-support/components 2.5.222 → 2.5.225
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/lib/esm/ConfirmationModal/ConfirmationDialog.js +1 -1
- package/lib/esm/CustomDatePicker/CustomDatePicker.d.ts +18 -0
- package/lib/esm/CustomDatePicker/CustomDatePicker.d.ts.map +1 -0
- package/lib/esm/CustomDatePicker/CustomDatePicker.js +27 -0
- package/lib/esm/CustomDatePicker/customDatePicker.css +52 -0
- package/lib/esm/CustomDatePicker/index.d.ts +2 -0
- package/lib/esm/CustomDatePicker/index.d.ts.map +1 -0
- package/lib/esm/CustomDatePicker/index.js +1 -0
- package/lib/esm/Functional/CaseContactsSelectorExternal.d.ts +2 -0
- package/lib/esm/Functional/CaseContactsSelectorExternal.d.ts.map +1 -1
- package/lib/esm/Functional/CaseContactsSelectorExternal.js +156 -82
- package/lib/esm/InlineEdit/NewInlineEdit.d.ts +2 -0
- package/lib/esm/InlineEdit/NewInlineEdit.d.ts.map +1 -1
- package/lib/esm/InlineEdit/NewInlineEdit.js +7 -2
- package/lib/esm/OwnerTypeaheadDropdown/OwnerTypeaheadDropdown.d.ts +2 -0
- package/lib/esm/OwnerTypeaheadDropdown/OwnerTypeaheadDropdown.d.ts.map +1 -1
- package/lib/esm/OwnerTypeaheadDropdown/OwnerTypeaheadDropdown.js +8 -3
- package/lib/esm/PhoneInput/PhoneInput.d.ts.map +1 -1
- package/lib/esm/PhoneInput/PhoneInput.js +38 -1
- package/lib/esm/RichTextEditor/RichTextEditor.d.ts +45 -0
- package/lib/esm/RichTextEditor/RichTextEditor.d.ts.map +1 -0
- package/lib/esm/RichTextEditor/RichTextEditor.js +463 -0
- package/lib/esm/RichTextEditor/index.d.ts +4 -0
- package/lib/esm/RichTextEditor/index.d.ts.map +1 -0
- package/lib/esm/RichTextEditor/index.js +2 -0
- package/lib/esm/RichTextEditor/richTextEditor.css +153 -0
- package/lib/esm/RichTextEditor/useQuillEditor.d.ts +20 -0
- package/lib/esm/RichTextEditor/useQuillEditor.d.ts.map +1 -0
- package/lib/esm/RichTextEditor/useQuillEditor.js +81 -0
- package/lib/esm/Table/TablePagination.d.ts +1 -0
- package/lib/esm/Table/TablePagination.d.ts.map +1 -1
- package/lib/esm/Table/TablePagination.js +1 -1
- package/lib/esm/helperFunctions/errorMessage.d.ts +2 -1
- package/lib/esm/helperFunctions/errorMessage.d.ts.map +1 -1
- package/lib/esm/helperFunctions/errorMessage.js +19 -5
- package/lib/esm/hooks/useCopyToClipboard.d.ts +1 -1
- package/lib/esm/hooks/useCopyToClipboard.d.ts.map +1 -1
- package/lib/esm/hooks/useCopyToClipboard.js +3 -1
- package/lib/esm/index.d.ts +2 -1
- package/lib/esm/index.d.ts.map +1 -1
- package/lib/esm/index.js +3 -1
- package/package.json +9 -7
- package/lib/esm/MarkdownEditor/MarkdownEditor.d.ts +0 -49
- package/lib/esm/MarkdownEditor/MarkdownEditor.d.ts.map +0 -1
- package/lib/esm/MarkdownEditor/MarkdownEditor.js +0 -601
- package/lib/esm/MarkdownEditor/index.d.ts +0 -2
- package/lib/esm/MarkdownEditor/index.d.ts.map +0 -1
- package/lib/esm/MarkdownEditor/index.js +0 -1
- package/lib/esm/MarkdownEditor/markdownEditor.css +0 -223
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
.richtext-editor-container {
|
|
2
|
+
background: var(--pf-t--global--background--color--primary--default, #fff);
|
|
3
|
+
border: 1px solid var(--pf-t--global--border--color--default, #d2d2d2);
|
|
4
|
+
border-radius: var(--pf-t--global--border--radius--small, 3px);
|
|
5
|
+
display: block;
|
|
6
|
+
min-height: 100px;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
.richtext-editor-container--disabled {
|
|
10
|
+
background: var(--pf-t--global--background--color--disabled--default, #f0f0f0);
|
|
11
|
+
pointer-events: none;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
.richtext-editor-content {
|
|
15
|
+
resize: vertical;
|
|
16
|
+
overflow: auto;
|
|
17
|
+
font-size: 15px;
|
|
18
|
+
min-width: 100%;
|
|
19
|
+
outline: none;
|
|
20
|
+
border: none;
|
|
21
|
+
min-height: 100px;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
.richtext-editor-content.ql-container,
|
|
25
|
+
.richtext-editor-container .ql-container.ql-container {
|
|
26
|
+
border: none !important;
|
|
27
|
+
outline: none !important;
|
|
28
|
+
font-size: 15px;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
.richtext-editor-content .ql-editor {
|
|
32
|
+
padding: 0.8rem;
|
|
33
|
+
outline: none;
|
|
34
|
+
border: none;
|
|
35
|
+
min-height: 100px;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
.richtext-editor-content .ql-editor:focus {
|
|
39
|
+
outline: none;
|
|
40
|
+
border: none;
|
|
41
|
+
box-shadow: none;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
.richtext-editor-content:empty::before {
|
|
45
|
+
content: attr(data-placeholder);
|
|
46
|
+
color: var(--pf-t--global--text--color--placeholder, #6a6e73);
|
|
47
|
+
pointer-events: none;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
.richtext-editor-content ul,
|
|
51
|
+
.richtext-editor-content ol {
|
|
52
|
+
padding-left: 24px;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
.richtext-editor-content li[data-list='bullet'] {
|
|
56
|
+
list-style-type: disc;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
.richtext-editor-content li[data-list='ordered'] {
|
|
60
|
+
list-style-type: decimal;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
.richtext-editor-content .ql-align-center {
|
|
64
|
+
text-align: center;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
.richtext-editor-content .ql-align-right {
|
|
68
|
+
text-align: right;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
.richtext-editor-content .ql-align-justify {
|
|
72
|
+
text-align: justify;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
.richtext-editor-content .ql-indent-1 {
|
|
76
|
+
padding-left: 3em;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
.richtext-editor-content .ql-indent-2 {
|
|
80
|
+
padding-left: 6em;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
.richtext-editor-content .ql-indent-3 {
|
|
84
|
+
padding-left: 9em;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
.richtext-editor-content .ql-indent-4 {
|
|
88
|
+
padding-left: 12em;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
.richtext-editor-content .ql-indent-5 {
|
|
92
|
+
padding-left: 15em;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
.richtext-editor-content a {
|
|
96
|
+
color: var(--pf-t--global--text--color--link--default, #0066cc);
|
|
97
|
+
text-decoration: underline;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
.richtext-editor-content img {
|
|
101
|
+
max-width: 100%;
|
|
102
|
+
height: auto;
|
|
103
|
+
display: block;
|
|
104
|
+
margin: 8px 0;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
.richtext-editor-container.is-private .richtext-editor-content {
|
|
108
|
+
background-color: #f5eeee;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
.richtext-toolbar {
|
|
112
|
+
border-bottom: 1px solid var(--pf-t--global--border--color--default, #d2d2d2);
|
|
113
|
+
padding: 4px 8px;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
.richtext-toolbar-left-section {
|
|
117
|
+
display: flex;
|
|
118
|
+
align-items: center;
|
|
119
|
+
flex-wrap: wrap;
|
|
120
|
+
gap: 2px;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
.btn-group-separator {
|
|
124
|
+
display: inline-block;
|
|
125
|
+
width: 1px;
|
|
126
|
+
height: 24px;
|
|
127
|
+
margin: 0 8px;
|
|
128
|
+
background-color: var(--pf-t--global--border--color--default, #ccc);
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
.toggle-content {
|
|
132
|
+
display: inline-flex;
|
|
133
|
+
align-items: center;
|
|
134
|
+
gap: 4px;
|
|
135
|
+
font-size: 14px;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
.dropdown-caret {
|
|
139
|
+
font-size: 12px;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
.richtext-char-counter {
|
|
143
|
+
padding: 4px 8px;
|
|
144
|
+
font-size: 12px;
|
|
145
|
+
text-align: right;
|
|
146
|
+
color: var(--pf-t--global--text--color--subtle, #6a6e73);
|
|
147
|
+
border-top: 1px solid var(--pf-t--global--border--color--default, #d2d2d2);
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
.richtext-char-counter--exceeded {
|
|
151
|
+
color: var(--pf-t--global--color--status--danger--default, #c9190b);
|
|
152
|
+
font-weight: bold;
|
|
153
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import Quill from 'quill';
|
|
2
|
+
export interface UseQuillEditorOptions {
|
|
3
|
+
placeholder?: string;
|
|
4
|
+
readOnly?: boolean;
|
|
5
|
+
onChange?: (html: string) => void;
|
|
6
|
+
onChangePlainText?: (text: string) => void;
|
|
7
|
+
onSelectionChange?: (format: Record<string, unknown>) => void;
|
|
8
|
+
onFocus?: () => void;
|
|
9
|
+
onBlur?: () => void;
|
|
10
|
+
}
|
|
11
|
+
export declare function useQuillEditor(options: UseQuillEditorOptions): {
|
|
12
|
+
editorRef: import("react").MutableRefObject<HTMLDivElement>;
|
|
13
|
+
quillRef: import("react").MutableRefObject<Quill>;
|
|
14
|
+
activeFormat: Record<string, unknown>;
|
|
15
|
+
setActiveFormat: import("react").Dispatch<import("react").SetStateAction<Record<string, unknown>>>;
|
|
16
|
+
setContents: (html: string) => void;
|
|
17
|
+
setReadOnly: (readOnly: boolean) => void;
|
|
18
|
+
getPlainText: () => string;
|
|
19
|
+
};
|
|
20
|
+
//# sourceMappingURL=useQuillEditor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useQuillEditor.d.ts","sourceRoot":"","sources":["../../../src/RichTextEditor/useQuillEditor.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,MAAM,WAAW,qBAAqB;IAClC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IAClC,iBAAiB,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IAC3C,iBAAiB,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,IAAI,CAAC;IAC9D,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,MAAM,CAAC,EAAE,MAAM,IAAI,CAAC;CACvB;AAID,wBAAgB,cAAc,CAAC,OAAO,EAAE,qBAAqB;;;;;wBAwDlB,MAAM;4BAgBF,OAAO;;EASrD"}
|
|
@@ -0,0 +1,81 @@
|
|
|
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
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TablePagination.d.ts","sourceRoot":"","sources":["../../../src/Table/TablePagination.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAc,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AACvE,OAAO,KAAoB,MAAM,OAAO,CAAC;AAIzC,UAAU,MAAM;IACZ,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,CAAC,EAAE,QAAQ,EAAE,WAAW,EAAE;;;KAAA,KAAK,IAAI,CAAC;IAChD,eAAe,CAAC,EAAE,CAAC,EAAE,QAAQ,EAAE,WAAW,EAAE;;;KAAA,KAAK,IAAI,CAAC;IACtD,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,OAAO,EAAE,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"TablePagination.d.ts","sourceRoot":"","sources":["../../../src/Table/TablePagination.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAc,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AACvE,OAAO,KAAoB,MAAM,OAAO,CAAC;AAIzC,UAAU,MAAM;IACZ,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,CAAC,EAAE,QAAQ,EAAE,WAAW,EAAE;;;KAAA,KAAK,IAAI,CAAC;IAChD,eAAe,CAAC,EAAE,CAAC,EAAE,QAAQ,EAAE,WAAW,EAAE;;;KAAA,KAAK,IAAI,CAAC;IACtD,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,OAAO,EAAE,iBAAiB,CAAC;IAC3B,SAAS,CAAC,EAAE,OAAO,CAAC;CACvB;AAED,wBAAgB,eAAe,CAAC,KAAK,EAAE,MAAM,qBAiC5C"}
|
|
@@ -17,7 +17,7 @@ export function TablePagination(props) {
|
|
|
17
17
|
props.currentPage && props.currentPage !== currentPage && setSelectedPage(props.currentPage);
|
|
18
18
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
19
19
|
}, [props.perPage, props.currentPage]);
|
|
20
|
-
return (React.createElement(Pagination, { itemCount: props.itemCount || (data || []).length, widgetId: "pagination-options-menu-top", perPage: perPage, page: currentPage, variant: props.variant, titles: {
|
|
20
|
+
return (React.createElement(Pagination, { itemCount: props.itemCount || (data || []).length, widgetId: "pagination-options-menu-top", perPage: perPage, page: currentPage, variant: props.variant, isCompact: props.isCompact, titles: {
|
|
21
21
|
paginationAriaLabel: props.variant === PaginationVariant.top ? 'Upper pagination' : 'Lower pagination',
|
|
22
22
|
}, onSetPage: onSetPage, onPerPageSelect: onPerPageSelect }));
|
|
23
23
|
}
|
|
@@ -6,7 +6,8 @@ export interface IAppErrorObj {
|
|
|
6
6
|
export interface IAppError {
|
|
7
7
|
[key: string]: Partial<IAppErrorObj>;
|
|
8
8
|
}
|
|
9
|
+
declare function getDirectErrorMessage(error: any): string;
|
|
9
10
|
declare function formattedApiErrorMessage(error: any, customMessage?: IAppError, canManageCase?: boolean): string | JSX.Element;
|
|
10
11
|
declare function errorMessageTitle(error: any, customError?: IAppError, canManageCase?: boolean): string;
|
|
11
|
-
export { formattedApiErrorMessage, errorMessageTitle };
|
|
12
|
+
export { formattedApiErrorMessage, errorMessageTitle, getDirectErrorMessage };
|
|
12
13
|
//# sourceMappingURL=errorMessage.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errorMessage.d.ts","sourceRoot":"","sources":["../../../src/helperFunctions/errorMessage.tsx"],"names":[],"mappings":"AAAA,OAAO,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"errorMessage.d.ts","sourceRoot":"","sources":["../../../src/helperFunctions/errorMessage.tsx"],"names":[],"mappings":"AAAA,OAAO,qBAAqB,CAAC;AAQ7B,MAAM,WAAW,YAAY;IACzB,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,GAAG,GAAG,CAAC,OAAO,CAAC;CACjC;AAED,MAAM,WAAW,SAAS;IACtB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,CAAC,CAAC;CACxC;AAmED,iBAAS,qBAAqB,CAAC,KAAK,KAAA,GAAG,MAAM,CAI5C;AAGD,iBAAS,wBAAwB,CAAC,KAAK,KAAA,EAAE,aAAa,CAAC,EAAE,SAAS,EAAE,aAAa,CAAC,EAAE,OAAO,GAAG,MAAM,GAAG,GAAG,CAAC,OAAO,CAmDjH;AAED,iBAAS,iBAAiB,CAAC,KAAK,KAAA,EAAE,WAAW,CAAC,EAAE,SAAS,EAAE,aAAa,CAAC,EAAE,OAAO,GAAG,MAAM,CAa1F;AAED,OAAO,EAAE,wBAAwB,EAAE,iBAAiB,EAAE,qBAAqB,EAAE,CAAC"}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import './errorMessage.scss';
|
|
2
2
|
import { Button } from '@patternfly/react-core';
|
|
3
3
|
import ExternalLinkAltIcon from '@patternfly/react-icons/dist/js/icons/external-link-alt-icon';
|
|
4
|
-
import isEmpty from 'lodash/isEmpty';
|
|
5
4
|
import React from 'react';
|
|
6
5
|
import { SupportFeedbackForm } from '../SupportFeedbackForm';
|
|
7
6
|
const defaultTitle = "Sorry, we're experiencing an error";
|
|
@@ -43,6 +42,15 @@ const defaultErrorObj = {
|
|
|
43
42
|
" for assistance.")),
|
|
44
43
|
},
|
|
45
44
|
};
|
|
45
|
+
function getApiErrorMessage(error) {
|
|
46
|
+
return [error === null || error === void 0 ? void 0 : error.message, error === null || error === void 0 ? void 0 : error.detailMessage].filter(Boolean).join(' ').trim();
|
|
47
|
+
}
|
|
48
|
+
// TODO: helper to pass API or status message directly in error popup
|
|
49
|
+
function getDirectErrorMessage(error) {
|
|
50
|
+
const apiMessage = getApiErrorMessage(error);
|
|
51
|
+
const message = (error === null || error === void 0 ? void 0 : error.statusText) || (error === null || error === void 0 ? void 0 : error.responseText) || '';
|
|
52
|
+
return apiMessage || message;
|
|
53
|
+
}
|
|
46
54
|
// the error argument need a better typing here. We want to make sure that user is passing an error object and not an error string
|
|
47
55
|
function formattedApiErrorMessage(error, customMessage, canManageCase) {
|
|
48
56
|
var _a, _b, _c;
|
|
@@ -84,9 +92,15 @@ function formattedApiErrorMessage(error, customMessage, canManageCase) {
|
|
|
84
92
|
}
|
|
85
93
|
// api call error
|
|
86
94
|
const message = (error === null || error === void 0 ? void 0 : error.statusText) || (error === null || error === void 0 ? void 0 : error.responseText) || '';
|
|
87
|
-
// error.message
|
|
88
|
-
|
|
89
|
-
|
|
95
|
+
// TODO: original logic — showed default when error.message existed
|
|
96
|
+
// // error.message -> javascript error
|
|
97
|
+
// const isNotProperUXError = isEmpty(message) || message?.length > 200 || error?.message || error?.detailMessage;
|
|
98
|
+
// return isNotProperUXError ? defaultErrorMessage : message;
|
|
99
|
+
const apiMessage = getApiErrorMessage(error);
|
|
100
|
+
if (apiMessage || message) {
|
|
101
|
+
return apiMessage || message;
|
|
102
|
+
}
|
|
103
|
+
return defaultErrorMessage;
|
|
90
104
|
}
|
|
91
105
|
}
|
|
92
106
|
function errorMessageTitle(error, customError, canManageCase) {
|
|
@@ -102,4 +116,4 @@ function errorMessageTitle(error, customError, canManageCase) {
|
|
|
102
116
|
}
|
|
103
117
|
return defaultTitle;
|
|
104
118
|
}
|
|
105
|
-
export { formattedApiErrorMessage, errorMessageTitle };
|
|
119
|
+
export { formattedApiErrorMessage, errorMessageTitle, getDirectErrorMessage };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useCopyToClipboard.d.ts","sourceRoot":"","sources":["../../../src/hooks/useCopyToClipboard.ts"],"names":[],"mappings":"AAGA,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,KAAK,CAAC,SAAS,CAAC,
|
|
1
|
+
{"version":3,"file":"useCopyToClipboard.d.ts","sourceRoot":"","sources":["../../../src/hooks/useCopyToClipboard.ts"],"names":[],"mappings":"AAGA,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,KAAK,CAAC,SAAS,CAAC,WAAW,CAAC;;;EA6BnE"}
|
|
@@ -14,9 +14,11 @@ export function useCopyToClipboard(ref) {
|
|
|
14
14
|
// @ts-ignore
|
|
15
15
|
const { t } = useTranslation();
|
|
16
16
|
const copyToClipboard = () => __awaiter(this, void 0, void 0, function* () {
|
|
17
|
+
var _a;
|
|
17
18
|
if (!ref.current)
|
|
18
19
|
return;
|
|
19
|
-
const
|
|
20
|
+
const el = ref.current;
|
|
21
|
+
const textToCopy = el instanceof HTMLInputElement || el instanceof HTMLTextAreaElement ? el.value : (_a = el.textContent) !== null && _a !== void 0 ? _a : '';
|
|
20
22
|
try {
|
|
21
23
|
yield navigator.clipboard.writeText(textToCopy);
|
|
22
24
|
setClipboardText(t('Copied!'));
|
package/lib/esm/index.d.ts
CHANGED
|
@@ -5,7 +5,7 @@ export * from './ErrorBoundary';
|
|
|
5
5
|
export * from './ErrorPages';
|
|
6
6
|
export * from './LoginModal';
|
|
7
7
|
export * from './Table';
|
|
8
|
-
export * from './
|
|
8
|
+
export * from './RichTextEditor';
|
|
9
9
|
export * from './InlineEdit';
|
|
10
10
|
export * from './CoverSpinner';
|
|
11
11
|
export * from './hooks';
|
|
@@ -29,6 +29,7 @@ export * from './SubscriptionAbuse';
|
|
|
29
29
|
export * from './TermsAndConditions';
|
|
30
30
|
export * from './TextAreaResizable';
|
|
31
31
|
export * from './CustomTextInput';
|
|
32
|
+
export * from './CustomDatePicker';
|
|
32
33
|
export * from './PhoneInput';
|
|
33
34
|
export * from './TagsSelector';
|
|
34
35
|
export * from './SingleSelectDropdown';
|
package/lib/esm/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AACA,cAAc,oBAAoB,CAAC;AACnC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,eAAe,CAAC;AAC9B,cAAc,iBAAiB,CAAC;AAChC,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC;AAC7B,cAAc,SAAS,CAAC;AACxB,cAAc,kBAAkB,CAAC;AACjC,cAAc,cAAc,CAAC;AAC7B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,SAAS,CAAC;AACxB,cAAc,cAAc,CAAC;AAC7B,cAAc,qBAAqB,CAAC;AACpC,cAAc,uBAAuB,CAAC;AACtC,cAAc,oBAAoB,CAAC;AACnC,cAAc,iBAAiB,CAAC;AAChC,cAAc,cAAc,CAAC;AAC7B,cAAc,oBAAoB,CAAC;AACnC,cAAc,eAAe,CAAC;AAC9B,cAAc,oBAAoB,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AAC;AACrC,cAAc,qBAAqB,CAAC;AACpC,cAAc,mBAAmB,CAAC;AAClC,cAAc,oBAAoB,CAAC;AACnC,cAAc,cAAc,CAAC;AAC7B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,wBAAwB,CAAC;AACvC,cAAc,0BAA0B,CAAC"}
|
package/lib/esm/index.js
CHANGED
|
@@ -6,7 +6,7 @@ export * from './ErrorBoundary';
|
|
|
6
6
|
export * from './ErrorPages';
|
|
7
7
|
export * from './LoginModal';
|
|
8
8
|
export * from './Table';
|
|
9
|
-
export * from './
|
|
9
|
+
export * from './RichTextEditor';
|
|
10
10
|
export * from './InlineEdit';
|
|
11
11
|
export * from './CoverSpinner';
|
|
12
12
|
export * from './hooks';
|
|
@@ -30,7 +30,9 @@ export * from './SubscriptionAbuse';
|
|
|
30
30
|
export * from './TermsAndConditions';
|
|
31
31
|
export * from './TextAreaResizable';
|
|
32
32
|
export * from './CustomTextInput';
|
|
33
|
+
export * from './CustomDatePicker';
|
|
33
34
|
export * from './PhoneInput';
|
|
34
35
|
export * from './TagsSelector';
|
|
35
36
|
export * from './SingleSelectDropdown';
|
|
36
37
|
export * from './OwnerTypeaheadDropdown';
|
|
38
|
+
// dummy change for publish
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rh-support/components",
|
|
3
|
-
"version": "2.5.
|
|
3
|
+
"version": "2.5.225",
|
|
4
4
|
"description": "Contains all reusabel components for support app",
|
|
5
5
|
"author": "Vikas Rathee <vrathee@redhat.com>",
|
|
6
6
|
"license": "ISC",
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
"prepublishOnly": "npm run build"
|
|
41
41
|
},
|
|
42
42
|
"peerDependencies": {
|
|
43
|
-
"@
|
|
43
|
+
"@apollo/client": "^4.1.6",
|
|
44
44
|
"@cee-eng/ui-toolkit": "1.1.9",
|
|
45
45
|
"@patternfly/patternfly": "6.2.1",
|
|
46
46
|
"@patternfly/react-core": "6.2.1",
|
|
@@ -55,21 +55,21 @@
|
|
|
55
55
|
"use-deep-compare-effect": "^1.6.1"
|
|
56
56
|
},
|
|
57
57
|
"dependencies": {
|
|
58
|
-
"@cee-eng/hydrajs": "4.18.
|
|
58
|
+
"@cee-eng/hydrajs": "^4.18.114",
|
|
59
59
|
"@cee-eng/ui-toolkit": "1.1.9",
|
|
60
60
|
"@patternfly/patternfly": "6.2.1",
|
|
61
61
|
"@patternfly/react-core": "6.2.1",
|
|
62
62
|
"@patternfly/react-icons": "6.2.1",
|
|
63
63
|
"@patternfly/react-table": "6.2.1",
|
|
64
|
-
"@patternfly/react-tokens": "6.2.1",
|
|
65
64
|
"@rh-support/types": "2.0.26",
|
|
66
|
-
"@rh-support/user-permissions": "2.5.
|
|
67
|
-
"@rh-support/utils": "2.5.
|
|
65
|
+
"@rh-support/user-permissions": "2.5.173",
|
|
66
|
+
"@rh-support/utils": "2.5.152",
|
|
68
67
|
"dompurify": "^2.2.6",
|
|
69
68
|
"js-worker-search": "^1.4.1",
|
|
70
69
|
"lazysizes": "^5.3.2",
|
|
71
70
|
"lodash": "^4.17.21",
|
|
72
71
|
"mark.js": "^8.11.1",
|
|
72
|
+
"quill": "~2.0.3",
|
|
73
73
|
"react": "18.2.0",
|
|
74
74
|
"react-dom": "18.2.0",
|
|
75
75
|
"react-i18next": "15.6.0",
|
|
@@ -83,6 +83,8 @@
|
|
|
83
83
|
"@types/react-dom": "^18.2.18"
|
|
84
84
|
},
|
|
85
85
|
"devDependencies": {
|
|
86
|
+
"@patternfly/react-styles": "^6.2.1",
|
|
87
|
+
"@patternfly/react-tokens": "^6.2.1",
|
|
86
88
|
"@testing-library/jest-dom": "^6.2.0",
|
|
87
89
|
"@testing-library/react": "^14.1.2",
|
|
88
90
|
"@testing-library/user-event": "^14.5.1",
|
|
@@ -101,5 +103,5 @@
|
|
|
101
103
|
"defaults and supports es6-module",
|
|
102
104
|
"maintained node versions"
|
|
103
105
|
],
|
|
104
|
-
"gitHead": "
|
|
106
|
+
"gitHead": "4cb198056cdf53141dcdf4d9b55d9cbb36940e05"
|
|
105
107
|
}
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
import './markdownEditor.css';
|
|
2
|
-
import { IAttachment } from '@cee-eng/hydrajs/@types/models/attachment';
|
|
3
|
-
import { IMarkdownOptions } from '@cee-eng/ui-toolkit';
|
|
4
|
-
import React, { HTMLProps } from 'react';
|
|
5
|
-
export declare enum EditorMode {
|
|
6
|
-
PLAIN = "plaintext",
|
|
7
|
-
MARKDOWN = "markdown"
|
|
8
|
-
}
|
|
9
|
-
interface IFileSelectorProps {
|
|
10
|
-
showFileSelectorInToolbar: boolean;
|
|
11
|
-
filesList: Partial<IAttachment>[];
|
|
12
|
-
onFileSelect: (file: Partial<IAttachment>) => void;
|
|
13
|
-
onFileDelete: (file: Partial<IAttachment>) => void;
|
|
14
|
-
onClipboardPaste: (file: any) => void;
|
|
15
|
-
isSupportedFile: (extension: string) => boolean;
|
|
16
|
-
attachFileBtn: React.ReactNode;
|
|
17
|
-
isUploadingFile: boolean;
|
|
18
|
-
}
|
|
19
|
-
export interface IMDEditorProps extends Omit<HTMLProps<HTMLTextAreaElement>, 'onChange' | 'value' | 'ref'> {
|
|
20
|
-
value: string;
|
|
21
|
-
onChange: (value: string, mode?: EditorMode) => void;
|
|
22
|
-
className?: string;
|
|
23
|
-
id?: string;
|
|
24
|
-
hidePreviewText?: string;
|
|
25
|
-
showPreviewText?: string;
|
|
26
|
-
bindTextArea?: (ref: HTMLTextAreaElement) => void;
|
|
27
|
-
textAreaClassName?: string;
|
|
28
|
-
mdPlaceholder?: string;
|
|
29
|
-
plainTextPlaceholder?: string;
|
|
30
|
-
allowEmoji?: boolean;
|
|
31
|
-
hideHeadingOptions?: boolean;
|
|
32
|
-
markedownOptions?: IMarkdownOptions;
|
|
33
|
-
showMarkdownPlainTextToggle?: boolean;
|
|
34
|
-
editorMode?: EditorMode;
|
|
35
|
-
charLimit?: number;
|
|
36
|
-
minCharsForCounter?: number;
|
|
37
|
-
onCommentExceedCharsLimit: (val: boolean) => void;
|
|
38
|
-
fileSelectorProps?: Partial<IFileSelectorProps>;
|
|
39
|
-
}
|
|
40
|
-
export declare const validateFile: (file: Partial<IAttachment>) => {
|
|
41
|
-
isValid: boolean;
|
|
42
|
-
errorMsg: string;
|
|
43
|
-
};
|
|
44
|
-
declare function MarkdownEditor(props: IMDEditorProps): React.JSX.Element;
|
|
45
|
-
declare namespace MarkdownEditor {
|
|
46
|
-
var defaultProps: Partial<IMDEditorProps>;
|
|
47
|
-
}
|
|
48
|
-
export { MarkdownEditor };
|
|
49
|
-
//# sourceMappingURL=MarkdownEditor.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"MarkdownEditor.d.ts","sourceRoot":"","sources":["../../../src/MarkdownEditor/MarkdownEditor.tsx"],"names":[],"mappings":"AAAA,OAAO,sBAAsB,CAAC;AAE9B,OAAO,EAAE,WAAW,EAAE,MAAM,2CAA2C,CAAC;AACxE,OAAO,EAAE,gBAAgB,EAAwB,MAAM,qBAAqB,CAAC;AAiC7E,OAAO,KAAK,EAAE,EAAE,SAAS,EAA+B,MAAM,OAAO,CAAC;AAMtE,oBAAY,UAAU;IAClB,KAAK,cAAc;IACnB,QAAQ,aAAa;CACxB;AAED,UAAU,kBAAkB;IACxB,yBAAyB,EAAE,OAAO,CAAC;IACnC,SAAS,EAAE,OAAO,CAAC,WAAW,CAAC,EAAE,CAAC;IAClC,YAAY,EAAE,CAAC,IAAI,EAAE,OAAO,CAAC,WAAW,CAAC,KAAK,IAAI,CAAC;IACnD,YAAY,EAAE,CAAC,IAAI,EAAE,OAAO,CAAC,WAAW,CAAC,KAAK,IAAI,CAAC;IACnD,gBAAgB,EAAE,CAAC,IAAI,KAAA,KAAK,IAAI,CAAC;IACjC,eAAe,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,OAAO,CAAC;IAChD,aAAa,EAAE,KAAK,CAAC,SAAS,CAA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