@manuscripts/style-guide 2.1.8-LEAN-4344.0 → 2.1.9
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/cjs/components/AlertMessage.js +49 -13
- package/dist/cjs/components/AutoSaveInput.js +53 -30
- package/dist/cjs/components/Avatar.js +40 -3
- package/dist/cjs/components/ContextMenu.js +22 -5
- package/dist/cjs/components/DatePicker/CalendarDatePicker.js +105 -87
- package/dist/cjs/components/Dialog.js +68 -24
- package/dist/cjs/components/DraggableModal.js +42 -4
- package/dist/cjs/components/Drawer.js +21 -2
- package/dist/cjs/components/Dropdown.js +1 -3
- package/dist/cjs/components/InspectorSection.js +48 -5
- package/dist/cjs/components/LoadingOverlay.js +5 -3
- package/dist/cjs/components/Menus/Menus.js +28 -9
- package/dist/cjs/components/Menus/Shortcut.js +18 -3
- package/dist/cjs/components/Menus/Submenu.js +28 -7
- package/dist/cjs/components/MultiValueInput.js +29 -3
- package/dist/cjs/components/NavDropdown.js +26 -3
- package/dist/cjs/components/RadioButton.js +19 -2
- package/dist/cjs/components/RelativeDate.js +20 -2
- package/dist/cjs/components/Resizer/Resizer.js +92 -100
- package/dist/cjs/components/Resizer/ResizerButton.js +12 -7
- package/dist/cjs/components/RichText/RichText.js +25 -3
- package/dist/cjs/components/RichText/RichTextField.js +25 -3
- package/dist/cjs/components/SaveStatus.js +31 -5
- package/dist/cjs/components/SelectField.js +17 -2
- package/dist/cjs/components/SelectedItemsBox.js +5 -2
- package/dist/cjs/components/StyledModal.js +17 -2
- package/dist/cjs/components/SystemUserAvatar.js +40 -3
- package/dist/cjs/components/TextField.js +22 -2
- package/dist/cjs/components/TextFieldContainer.js +22 -2
- package/dist/cjs/components/TextFieldError.js +19 -2
- package/dist/cjs/components/TextFieldGroupContainer.js +22 -2
- package/dist/cjs/components/Tooltip.js +4 -3
- package/dist/cjs/components/icons/add-author.js +23 -2
- package/dist/cjs/components/icons/add-comment.js +25 -2
- package/dist/cjs/components/icons/add-institution.js +20 -2
- package/dist/cjs/components/icons/add-new.js +7 -2
- package/dist/cjs/components/icons/add-outline.js +8 -2
- package/dist/cjs/components/icons/add-user.js +8 -2
- package/dist/cjs/components/icons/add.js +8 -2
- package/dist/cjs/components/icons/added.js +7 -2
- package/dist/cjs/components/icons/affiliation-placeholder.js +39 -2
- package/dist/cjs/components/icons/affiliation.js +7 -2
- package/dist/cjs/components/icons/alert.js +6 -2
- package/dist/cjs/components/icons/arrow-down-circle.js +7 -2
- package/dist/cjs/components/icons/arrow-down.js +6 -2
- package/dist/cjs/components/icons/arrow-left.js +6 -2
- package/dist/cjs/components/icons/arrow-up.js +6 -2
- package/dist/cjs/components/icons/attach.js +21 -2
- package/dist/cjs/components/icons/attention-blue.js +10 -2
- package/dist/cjs/components/icons/attention-green.js +7 -2
- package/dist/cjs/components/icons/attention-orange.js +12 -2
- package/dist/cjs/components/icons/attention-red.js +10 -2
- package/dist/cjs/components/icons/author-placeholder.js +46 -2
- package/dist/cjs/components/icons/avatar.js +8 -2
- package/dist/cjs/components/icons/book.js +22 -2
- package/dist/cjs/components/icons/circle-tick-animation.js +7 -2
- package/dist/cjs/components/icons/citation-count.js +6 -2
- package/dist/cjs/components/icons/comment-reply.js +6 -2
- package/dist/cjs/components/icons/comment-resolve.js +21 -2
- package/dist/cjs/components/icons/comment.js +25 -2
- package/dist/cjs/components/icons/corresponding-author.js +12 -2
- package/dist/cjs/components/icons/delete-solid.js +6 -2
- package/dist/cjs/components/icons/deleted.js +11 -2
- package/dist/cjs/components/icons/dots.js +23 -2
- package/dist/cjs/components/icons/draggable-icon.js +13 -2
- package/dist/cjs/components/icons/edit-attrs-tracking.js +7 -2
- package/dist/cjs/components/icons/edit.js +6 -2
- package/dist/cjs/components/icons/file-audio.js +23 -2
- package/dist/cjs/components/icons/file-code.js +23 -2
- package/dist/cjs/components/icons/file-compressed.js +30 -2
- package/dist/cjs/components/icons/file-corrupted.js +24 -2
- package/dist/cjs/components/icons/file-document.js +24 -2
- package/dist/cjs/components/icons/file-figure.js +23 -2
- package/dist/cjs/components/icons/file-graphical-abstract.js +8 -2
- package/dist/cjs/components/icons/file-image.js +6 -2
- package/dist/cjs/components/icons/file-latex-icon.js +25 -2
- package/dist/cjs/components/icons/file-main-document.js +10 -2
- package/dist/cjs/components/icons/file-pdf.js +22 -2
- package/dist/cjs/components/icons/file-table.js +21 -2
- package/dist/cjs/components/icons/file-unknown.js +22 -2
- package/dist/cjs/components/icons/file-video.js +21 -2
- package/dist/cjs/components/icons/handle-inspector.js +6 -2
- package/dist/cjs/components/icons/handle-outline.js +11 -2
- package/dist/cjs/components/icons/help.js +8 -2
- package/dist/cjs/components/icons/image-default.js +9 -2
- package/dist/cjs/components/icons/image-left.js +9 -2
- package/dist/cjs/components/icons/image-right.js +9 -2
- package/dist/cjs/components/icons/link.js +7 -2
- package/dist/cjs/components/icons/lock.js +9 -2
- package/dist/cjs/components/icons/logout.js +6 -2
- package/dist/cjs/components/icons/manuscript.js +24 -2
- package/dist/cjs/components/icons/outline-block-quote.js +8 -2
- package/dist/cjs/components/icons/outline-code.js +7 -2
- package/dist/cjs/components/icons/outline-embed.js +7 -2
- package/dist/cjs/components/icons/outline-equation.js +6 -2
- package/dist/cjs/components/icons/outline-figure.js +12 -2
- package/dist/cjs/components/icons/outline-manuscript.js +9 -2
- package/dist/cjs/components/icons/outline-ordered-list.js +6 -2
- package/dist/cjs/components/icons/outline-paragraph.js +6 -2
- package/dist/cjs/components/icons/outline-pull-quote.js +8 -2
- package/dist/cjs/components/icons/outline-section.js +6 -2
- package/dist/cjs/components/icons/outline-table.js +8 -2
- package/dist/cjs/components/icons/outline-unordered-list.js +8 -2
- package/dist/cjs/components/icons/plus.js +22 -2
- package/dist/cjs/components/icons/profile-avatar.js +6 -2
- package/dist/cjs/components/icons/role-annotating.js +8 -2
- package/dist/cjs/components/icons/role-reading.js +10 -2
- package/dist/cjs/components/icons/save-status-offline.js +23 -2
- package/dist/cjs/components/icons/save-status-saved.js +22 -2
- package/dist/cjs/components/icons/save-status-saving.js +24 -2
- package/dist/cjs/components/icons/scroll.js +10 -2
- package/dist/cjs/components/icons/search.js +22 -2
- package/dist/cjs/components/icons/section-category.js +21 -2
- package/dist/cjs/components/icons/slider-off.js +7 -2
- package/dist/cjs/components/icons/slider-on.js +7 -2
- package/dist/cjs/components/icons/system-user-avatar.js +9 -2
- package/dist/cjs/components/icons/task-step-done.js +22 -2
- package/dist/cjs/components/icons/tick.js +6 -2
- package/dist/cjs/components/icons/toolbar-bold.js +6 -2
- package/dist/cjs/components/icons/toolbar-citation.js +6 -2
- package/dist/cjs/components/icons/toolbar-code.js +7 -2
- package/dist/cjs/components/icons/toolbar-equation.js +6 -2
- package/dist/cjs/components/icons/toolbar-figure.js +6 -2
- package/dist/cjs/components/icons/toolbar-indent.js +11 -2
- package/dist/cjs/components/icons/toolbar-italic.js +6 -2
- package/dist/cjs/components/icons/toolbar-ordered-list.js +6 -2
- package/dist/cjs/components/icons/toolbar-subscript.js +6 -2
- package/dist/cjs/components/icons/toolbar-superscript.js +6 -2
- package/dist/cjs/components/icons/toolbar-symbol.js +6 -2
- package/dist/cjs/components/icons/toolbar-table.js +6 -2
- package/dist/cjs/components/icons/toolbar-underline.js +6 -2
- package/dist/cjs/components/icons/toolbar-unindent.js +11 -2
- package/dist/cjs/components/icons/toolbar-unordered-list.js +6 -2
- package/dist/cjs/components/icons/triangle-collapsed.js +6 -2
- package/dist/cjs/components/icons/triangle-expanded.js +6 -2
- package/dist/cjs/components/icons/upload.js +8 -2
- package/dist/cjs/components/icons/vertical-ellipsis.js +8 -2
- package/dist/cjs/components/icons/x.js +7 -2
- package/dist/cjs/hooks/use-scroll-detection.js +2 -2
- package/dist/cjs/lib/capabilities.js +5 -6
- package/dist/cjs/lib/files.js +17 -14
- package/dist/es/components/AlertMessage.js +47 -14
- package/dist/es/components/AutoSaveInput.js +50 -30
- package/dist/es/components/Avatar.js +17 -3
- package/dist/es/components/ContextMenu.js +22 -5
- package/dist/es/components/DatePicker/CalendarDatePicker.js +80 -86
- package/dist/es/components/Dialog.js +68 -24
- package/dist/es/components/DraggableModal.js +19 -4
- package/dist/es/components/Drawer.js +18 -2
- package/dist/es/components/Dropdown.js +1 -3
- package/dist/es/components/InspectorSection.js +25 -5
- package/dist/es/components/LoadingOverlay.js +5 -3
- package/dist/es/components/Menus/Menus.js +28 -9
- package/dist/es/components/Menus/Shortcut.js +18 -3
- package/dist/es/components/Menus/Submenu.js +28 -7
- package/dist/es/components/MultiValueInput.js +6 -3
- package/dist/es/components/NavDropdown.js +23 -3
- package/dist/es/components/RadioButton.js +19 -2
- package/dist/es/components/RelativeDate.js +17 -2
- package/dist/es/components/Resizer/Resizer.js +90 -78
- package/dist/es/components/Resizer/ResizerButton.js +11 -7
- package/dist/es/components/RichText/RichText.js +2 -3
- package/dist/es/components/RichText/RichTextField.js +2 -3
- package/dist/es/components/SaveStatus.js +31 -5
- package/dist/es/components/SelectField.js +17 -2
- package/dist/es/components/SelectedItemsBox.js +5 -2
- package/dist/es/components/StyledModal.js +17 -2
- package/dist/es/components/SystemUserAvatar.js +17 -3
- package/dist/es/components/TextField.js +19 -2
- package/dist/es/components/TextFieldContainer.js +22 -2
- package/dist/es/components/TextFieldError.js +19 -2
- package/dist/es/components/TextFieldGroupContainer.js +19 -2
- package/dist/es/components/Tooltip.js +4 -3
- package/dist/es/components/icons/add-author.js +20 -2
- package/dist/es/components/icons/add-comment.js +22 -2
- package/dist/es/components/icons/add-institution.js +17 -2
- package/dist/es/components/icons/add-new.js +4 -2
- package/dist/es/components/icons/add-outline.js +5 -2
- package/dist/es/components/icons/add-user.js +5 -2
- package/dist/es/components/icons/add.js +5 -2
- package/dist/es/components/icons/added.js +4 -2
- package/dist/es/components/icons/affiliation-placeholder.js +36 -2
- package/dist/es/components/icons/affiliation.js +4 -2
- package/dist/es/components/icons/alert.js +3 -2
- package/dist/es/components/icons/arrow-down-circle.js +4 -2
- package/dist/es/components/icons/arrow-down.js +3 -2
- package/dist/es/components/icons/arrow-left.js +3 -2
- package/dist/es/components/icons/arrow-up.js +3 -2
- package/dist/es/components/icons/attach.js +18 -2
- package/dist/es/components/icons/attention-blue.js +7 -2
- package/dist/es/components/icons/attention-green.js +4 -2
- package/dist/es/components/icons/attention-orange.js +9 -2
- package/dist/es/components/icons/attention-red.js +7 -2
- package/dist/es/components/icons/author-placeholder.js +43 -2
- package/dist/es/components/icons/avatar.js +5 -2
- package/dist/es/components/icons/book.js +19 -2
- package/dist/es/components/icons/circle-tick-animation.js +4 -2
- package/dist/es/components/icons/citation-count.js +3 -2
- package/dist/es/components/icons/comment-reply.js +3 -2
- package/dist/es/components/icons/comment-resolve.js +18 -2
- package/dist/es/components/icons/comment.js +22 -2
- package/dist/es/components/icons/corresponding-author.js +9 -2
- package/dist/es/components/icons/delete-solid.js +3 -2
- package/dist/es/components/icons/deleted.js +8 -2
- package/dist/es/components/icons/dots.js +20 -2
- package/dist/es/components/icons/draggable-icon.js +10 -2
- package/dist/es/components/icons/edit-attrs-tracking.js +4 -2
- package/dist/es/components/icons/edit.js +3 -2
- package/dist/es/components/icons/file-audio.js +20 -2
- package/dist/es/components/icons/file-code.js +20 -2
- package/dist/es/components/icons/file-compressed.js +27 -2
- package/dist/es/components/icons/file-corrupted.js +21 -2
- package/dist/es/components/icons/file-document.js +21 -2
- package/dist/es/components/icons/file-figure.js +20 -2
- package/dist/es/components/icons/file-graphical-abstract.js +5 -2
- package/dist/es/components/icons/file-image.js +3 -2
- package/dist/es/components/icons/file-latex-icon.js +22 -2
- package/dist/es/components/icons/file-main-document.js +7 -2
- package/dist/es/components/icons/file-pdf.js +19 -2
- package/dist/es/components/icons/file-table.js +18 -2
- package/dist/es/components/icons/file-unknown.js +19 -2
- package/dist/es/components/icons/file-video.js +18 -2
- package/dist/es/components/icons/handle-inspector.js +3 -2
- package/dist/es/components/icons/handle-outline.js +8 -2
- package/dist/es/components/icons/help.js +5 -2
- package/dist/es/components/icons/image-default.js +6 -2
- package/dist/es/components/icons/image-left.js +6 -2
- package/dist/es/components/icons/image-right.js +6 -2
- package/dist/es/components/icons/link.js +4 -2
- package/dist/es/components/icons/lock.js +6 -2
- package/dist/es/components/icons/logout.js +3 -2
- package/dist/es/components/icons/manuscript.js +21 -2
- package/dist/es/components/icons/outline-block-quote.js +5 -2
- package/dist/es/components/icons/outline-code.js +4 -2
- package/dist/es/components/icons/outline-embed.js +4 -2
- package/dist/es/components/icons/outline-equation.js +3 -2
- package/dist/es/components/icons/outline-figure.js +9 -2
- package/dist/es/components/icons/outline-manuscript.js +6 -2
- package/dist/es/components/icons/outline-ordered-list.js +3 -2
- package/dist/es/components/icons/outline-paragraph.js +3 -2
- package/dist/es/components/icons/outline-pull-quote.js +5 -2
- package/dist/es/components/icons/outline-section.js +3 -2
- package/dist/es/components/icons/outline-table.js +5 -2
- package/dist/es/components/icons/outline-unordered-list.js +5 -2
- package/dist/es/components/icons/plus.js +19 -2
- package/dist/es/components/icons/profile-avatar.js +3 -2
- package/dist/es/components/icons/role-annotating.js +5 -2
- package/dist/es/components/icons/role-reading.js +7 -2
- package/dist/es/components/icons/save-status-offline.js +20 -2
- package/dist/es/components/icons/save-status-saved.js +19 -2
- package/dist/es/components/icons/save-status-saving.js +21 -2
- package/dist/es/components/icons/scroll.js +7 -2
- package/dist/es/components/icons/search.js +19 -2
- package/dist/es/components/icons/section-category.js +18 -2
- package/dist/es/components/icons/slider-off.js +4 -2
- package/dist/es/components/icons/slider-on.js +4 -2
- package/dist/es/components/icons/system-user-avatar.js +6 -2
- package/dist/es/components/icons/task-step-done.js +19 -2
- package/dist/es/components/icons/tick.js +3 -2
- package/dist/es/components/icons/toolbar-bold.js +3 -2
- package/dist/es/components/icons/toolbar-citation.js +3 -2
- package/dist/es/components/icons/toolbar-code.js +4 -2
- package/dist/es/components/icons/toolbar-equation.js +3 -2
- package/dist/es/components/icons/toolbar-figure.js +3 -2
- package/dist/es/components/icons/toolbar-indent.js +8 -2
- package/dist/es/components/icons/toolbar-italic.js +3 -2
- package/dist/es/components/icons/toolbar-ordered-list.js +3 -2
- package/dist/es/components/icons/toolbar-subscript.js +3 -2
- package/dist/es/components/icons/toolbar-superscript.js +3 -2
- package/dist/es/components/icons/toolbar-symbol.js +3 -2
- package/dist/es/components/icons/toolbar-table.js +3 -2
- package/dist/es/components/icons/toolbar-underline.js +3 -2
- package/dist/es/components/icons/toolbar-unindent.js +8 -2
- package/dist/es/components/icons/toolbar-unordered-list.js +3 -2
- package/dist/es/components/icons/triangle-collapsed.js +3 -2
- package/dist/es/components/icons/triangle-expanded.js +3 -2
- package/dist/es/components/icons/upload.js +5 -2
- package/dist/es/components/icons/vertical-ellipsis.js +5 -2
- package/dist/es/components/icons/x.js +4 -2
- package/dist/es/hooks/use-scroll-detection.js +2 -2
- package/dist/es/lib/capabilities.js +5 -6
- package/dist/es/lib/files.js +14 -14
- package/dist/types/components/AlertMessage.d.ts +13 -14
- package/dist/types/components/AutoSaveInput.d.ts +14 -1
- package/dist/types/components/Badge.d.ts +1 -2
- package/dist/types/components/Button.d.ts +80 -30
- package/dist/types/components/Checkbox.d.ts +6 -5
- package/dist/types/components/DatePicker/CalendarDatePicker.d.ts +18 -19
- package/dist/types/components/Dialog.d.ts +14 -3
- package/dist/types/components/Dropdown.d.ts +6 -9
- package/dist/types/components/Form.d.ts +4 -4
- package/dist/types/components/Inspector.d.ts +10 -1720
- package/dist/types/components/InspectorSection.d.ts +10 -35
- package/dist/types/components/Menus/Shortcut.d.ts +1 -1
- package/dist/types/components/Menus/Submenu.d.ts +5 -5
- package/dist/types/components/NavDropdown.d.ts +19 -26
- package/dist/types/components/RadioButton.d.ts +1 -1
- package/dist/types/components/Resizer/Resizer.d.ts +23 -1
- package/dist/types/components/Resizer/ResizerButton.d.ts +7 -1
- package/dist/types/components/Resizer/ResizerButtonInner.d.ts +4 -5
- package/dist/types/components/Resizer/ResizerInner.d.ts +4 -5
- package/dist/types/components/Sidebar.d.ts +2 -3
- package/dist/types/components/StyledModal.d.ts +30 -43
- package/dist/types/components/Text.d.ts +4 -5
- package/dist/types/components/TextField.d.ts +6 -6
- package/dist/types/components/TextFieldError.d.ts +1 -1
- package/dist/types/components/Tooltip.d.ts +1 -1
- package/dist/types/components/icons/add-author.d.ts +2 -1
- package/dist/types/components/icons/affiliation-placeholder.d.ts +2 -1
- package/dist/types/components/icons/author-placeholder.d.ts +2 -1
- package/dist/types/components/icons/section-category.d.ts +2 -1
- package/dist/types/components/icons/x.d.ts +2 -1
- package/dist/types/hooks/use-dropdown.d.ts +1 -1
- package/dist/types/hooks/use-menus.d.ts +1 -1
- package/dist/types/lib/capabilities.d.ts +3 -2
- package/dist/types/lib/files.d.ts +3 -3
- package/package.json +23 -25
package/dist/cjs/lib/files.js
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
2
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
6
|
exports.isImageFile = exports.getFileTypeIcon = exports.getFileIcon = exports.getFileType = exports.FileType = void 0;
|
|
4
|
-
const
|
|
7
|
+
const react_1 = __importDefault(require("react"));
|
|
5
8
|
const icons_1 = require("../components/icons");
|
|
6
9
|
var FileType;
|
|
7
10
|
(function (FileType) {
|
|
@@ -57,53 +60,53 @@ const extension2type = new Map([
|
|
|
57
60
|
const type2icon = new Map([
|
|
58
61
|
[
|
|
59
62
|
FileType.Audio,
|
|
60
|
-
|
|
63
|
+
react_1.default.createElement(icons_1.FileAudioIcon, { key: FileType.Audio, className: "file-icon" }),
|
|
61
64
|
],
|
|
62
65
|
[
|
|
63
66
|
FileType.Video,
|
|
64
|
-
|
|
67
|
+
react_1.default.createElement(icons_1.FileVideoIcon, { key: FileType.Video, className: "file-icon" }),
|
|
65
68
|
],
|
|
66
69
|
[
|
|
67
70
|
FileType.PlainDocument,
|
|
68
|
-
|
|
71
|
+
react_1.default.createElement(icons_1.FileDocumentIcon, { key: FileType.PlainDocument, color: "#1A9BC7", className: "file-icon" }),
|
|
69
72
|
],
|
|
70
73
|
[
|
|
71
74
|
FileType.SheetsWorkbooks,
|
|
72
|
-
|
|
75
|
+
react_1.default.createElement(icons_1.FileTableIcon, { key: FileType.SheetsWorkbooks, className: "file-icon" }),
|
|
73
76
|
],
|
|
74
77
|
[
|
|
75
78
|
FileType.Latex,
|
|
76
|
-
|
|
79
|
+
react_1.default.createElement(icons_1.FileLatexIcon, { key: FileType.Latex, color: "#1A9BC7", className: "file-icon" }),
|
|
77
80
|
],
|
|
78
81
|
[
|
|
79
82
|
FileType.CodeFile,
|
|
80
|
-
|
|
83
|
+
react_1.default.createElement(icons_1.FileCodeIcon, { key: FileType.CodeFile, className: "file-icon" }),
|
|
81
84
|
],
|
|
82
85
|
[
|
|
83
86
|
FileType.PdfFile,
|
|
84
|
-
|
|
87
|
+
react_1.default.createElement(icons_1.FilePdfIcon, { key: FileType.PdfFile, className: "file-icon" }),
|
|
85
88
|
],
|
|
86
89
|
[
|
|
87
90
|
FileType.CompressedFile,
|
|
88
|
-
|
|
91
|
+
react_1.default.createElement(icons_1.FileCompressedIcon, { key: FileType.CompressedFile, className: "file-icon" }),
|
|
89
92
|
],
|
|
90
93
|
[
|
|
91
94
|
FileType.PlainText,
|
|
92
|
-
|
|
95
|
+
react_1.default.createElement(icons_1.FileDocumentIcon, { key: FileType.PlainText, color: "#FFBD26", className: "file-icon" }),
|
|
93
96
|
],
|
|
94
97
|
[
|
|
95
98
|
FileType.Image,
|
|
96
|
-
|
|
99
|
+
react_1.default.createElement(icons_1.FileImageIcon, { key: FileType.Image, className: "file-icon" }),
|
|
97
100
|
],
|
|
98
101
|
[
|
|
99
102
|
FileType.Figure,
|
|
100
|
-
|
|
103
|
+
react_1.default.createElement(icons_1.FileFigureIcon, { key: FileType.Figure, className: "file-icon" }),
|
|
101
104
|
],
|
|
102
105
|
[
|
|
103
106
|
FileType.GraphicalAbstract,
|
|
104
|
-
|
|
107
|
+
react_1.default.createElement(icons_1.FileGraphicalAbstractIcon, { key: FileType.GraphicalAbstract, className: "file-icon" }),
|
|
105
108
|
],
|
|
106
|
-
[undefined,
|
|
109
|
+
[undefined, react_1.default.createElement(icons_1.FileUnknownIcon, { key: undefined, className: "file-icon" })],
|
|
107
110
|
]);
|
|
108
111
|
const getFileType = (name) => {
|
|
109
112
|
const extension = getExtension(name);
|
|
@@ -1,7 +1,22 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
/*!
|
|
2
|
+
* © 2019 Atypon Systems LLC
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
import React from 'react';
|
|
17
|
+
import { SizeMe } from 'react-sizeme';
|
|
3
18
|
import styled, { css } from 'styled-components';
|
|
4
|
-
import { IconTextButton } from './Button';
|
|
19
|
+
import { IconButton, IconTextButton } from './Button';
|
|
5
20
|
import { AttentionBlueIcon, AttentionGreenIcon, AttentionOrangeIcon, AttentionRedIcon, } from './icons';
|
|
6
21
|
const buttonStyles = css `
|
|
7
22
|
color: inherit;
|
|
@@ -20,6 +35,12 @@ const buttonStyles = css `
|
|
|
20
35
|
export const TextButton = styled(IconTextButton) `
|
|
21
36
|
${buttonStyles}
|
|
22
37
|
`;
|
|
38
|
+
const CloseIconButton = styled(IconButton).attrs({
|
|
39
|
+
defaultColor: true,
|
|
40
|
+
size: 16,
|
|
41
|
+
}) `
|
|
42
|
+
${buttonStyles}
|
|
43
|
+
`;
|
|
23
44
|
const InformativeIcon = styled.div `
|
|
24
45
|
height: 24px;
|
|
25
46
|
margin-right: ${(props) => props.theme.grid.unit * 3}px;
|
|
@@ -91,15 +112,27 @@ const alertContainers = {
|
|
|
91
112
|
info: InfoAlertContainer,
|
|
92
113
|
warning: WarningAlertContainer,
|
|
93
114
|
};
|
|
94
|
-
export
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
115
|
+
export class AlertMessage extends React.Component {
|
|
116
|
+
constructor() {
|
|
117
|
+
super(...arguments);
|
|
118
|
+
this.state = {
|
|
119
|
+
isOpen: true,
|
|
120
|
+
};
|
|
121
|
+
this.handleClose = () => {
|
|
122
|
+
this.setState({ isOpen: false });
|
|
123
|
+
};
|
|
101
124
|
}
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
125
|
+
render() {
|
|
126
|
+
const { hideCloseButton, dismissButton, children, type } = this.props;
|
|
127
|
+
const { isOpen } = this.state;
|
|
128
|
+
const AlertContainer = alertContainers[type];
|
|
129
|
+
const AlertIcon = alertIcons[type];
|
|
130
|
+
return (isOpen && (React.createElement(SizeMe, null, () => (React.createElement(AlertContainer, { className: 'alert-message' },
|
|
131
|
+
React.createElement(InnerContainer, null,
|
|
132
|
+
React.createElement(InformativeIcon, null, React.createElement(AlertIcon, null)),
|
|
133
|
+
React.createElement(TextContainer, null, children),
|
|
134
|
+
dismissButton && (React.createElement(TextButton, { onClick: dismissButton.action
|
|
135
|
+
? dismissButton.action
|
|
136
|
+
: this.handleClose }, dismissButton.text))))))));
|
|
137
|
+
}
|
|
138
|
+
}
|
|
@@ -1,32 +1,52 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
1
|
+
/*!
|
|
2
|
+
* © 2019 Atypon Systems LLC
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
import React from 'react';
|
|
17
|
+
export class AutoSaveInput extends React.Component {
|
|
18
|
+
constructor() {
|
|
19
|
+
super(...arguments);
|
|
20
|
+
this.state = {
|
|
21
|
+
focused: false,
|
|
22
|
+
};
|
|
23
|
+
this.handleSubmit = () => {
|
|
24
|
+
window.setTimeout(this.props.form.submitForm, 10);
|
|
25
|
+
};
|
|
26
|
+
this.handleFocus = () => {
|
|
27
|
+
this.setState({ focused: true });
|
|
28
|
+
};
|
|
29
|
+
this.handleBlur = (event) => {
|
|
30
|
+
this.setState({ focused: false });
|
|
31
|
+
this.props.field.onBlur(event);
|
|
32
|
+
if (this.props.saveOn === 'blur') {
|
|
33
|
+
this.handleSubmit();
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
this.handleChange = (event) => {
|
|
37
|
+
this.props.field.onChange(event);
|
|
38
|
+
if (this.props.saveOn === 'change') {
|
|
39
|
+
this.handleSubmit();
|
|
28
40
|
}
|
|
29
41
|
};
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
|
|
42
|
+
}
|
|
43
|
+
componentWillUnmount() {
|
|
44
|
+
if (this.state.focused) {
|
|
45
|
+
this.handleSubmit();
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
render() {
|
|
49
|
+
const { component: Component, field, placeholder, disabled, testId, } = this.props;
|
|
50
|
+
return (React.createElement(Component, Object.assign({}, field, { placeholder: placeholder, disabled: disabled, checked: !!field.value, onFocus: this.handleFocus, onBlur: this.handleBlur, onChange: this.handleChange, "data-testid": testId && `${testId}__input`, "aria-invalid": this.props.isInvalid || undefined })));
|
|
51
|
+
}
|
|
52
|
+
}
|
|
@@ -1,5 +1,19 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
/*!
|
|
2
|
+
* © 2019 Atypon Systems LLC
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
import React, { useCallback, useState } from 'react';
|
|
3
17
|
import styled from 'styled-components';
|
|
4
18
|
import { ProfileIcon } from './icons';
|
|
5
19
|
const AvatarContainer = styled.div `
|
|
@@ -30,5 +44,5 @@ export const Avatar = (props) => {
|
|
|
30
44
|
const handleSrcError = useCallback(() => {
|
|
31
45
|
setSrcError(true);
|
|
32
46
|
}, []);
|
|
33
|
-
return (
|
|
47
|
+
return (React.createElement(AvatarContainer, { opacity: props.opacity || 1 }, props.src && !srcError ? (React.createElement(RoundedImage, { src: props.src, size: props.size, onError: handleSrcError })) : (React.createElement(StyledAvatar, { height: props.size, width: props.size, color: props.color }))));
|
|
34
48
|
};
|
|
@@ -1,4 +1,19 @@
|
|
|
1
|
-
|
|
1
|
+
/*!
|
|
2
|
+
* © 2024 Atypon Systems LLC
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
import React from 'react';
|
|
2
17
|
import styled from 'styled-components';
|
|
3
18
|
import { IconButton, IconButtonGroup } from './Button';
|
|
4
19
|
import * as Icons from './icons';
|
|
@@ -20,7 +35,9 @@ const icons = Object.entries(Icons).reduce((acc, [name, IconComponent]) => {
|
|
|
20
35
|
acc[iconName] = IconComponent;
|
|
21
36
|
return acc;
|
|
22
37
|
}, {});
|
|
23
|
-
export const ContextMenu = ({ actions }) => (
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
38
|
+
export const ContextMenu = ({ actions }) => (React.createElement(IconButtonGroup, { size: 32 }, actions.map((action) => {
|
|
39
|
+
const Icon = icons[action.icon];
|
|
40
|
+
return (React.createElement(ContextMenuIconButton, { key: action.icon, "data-tooltip-id": action.icon, onClick: action.action, className: action.selected ? 'selected' : '' },
|
|
41
|
+
React.createElement(Icon, { width: 18, height: 18 }),
|
|
42
|
+
React.createElement(Tooltip, { id: action.icon, place: "bottom" }, action.label)));
|
|
43
|
+
})));
|
|
@@ -1,103 +1,62 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
import {
|
|
4
|
-
import
|
|
5
|
-
import { useCallback, useEffect, useMemo, useState } from 'react';
|
|
6
|
-
import { DayPicker } from 'react-day-picker';
|
|
1
|
+
import 'react-modern-calendar-datepicker/lib/DatePicker.css';
|
|
2
|
+
import { add, format, intervalToDuration } from 'date-fns';
|
|
3
|
+
import React, { useCallback, useMemo, useState } from 'react';
|
|
4
|
+
import DatePicker from 'react-modern-calendar-datepicker';
|
|
7
5
|
import styled from 'styled-components';
|
|
8
6
|
import { Category, Dialog, MessageContainer } from '../Dialog';
|
|
9
|
-
const
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
7
|
+
const calendarGetDay = (date) => ({
|
|
8
|
+
year: date.getFullYear(),
|
|
9
|
+
month: date.getMonth() + 1,
|
|
10
|
+
day: date.getDate(),
|
|
11
|
+
});
|
|
12
|
+
const calendarPotentialDueDate = (stepDueDate, dueDate, submissionDueDate) => {
|
|
13
13
|
const duration = intervalToDuration({
|
|
14
14
|
start: stepDueDate,
|
|
15
|
-
end:
|
|
15
|
+
end: new Date(`${dueDate.year}-${dueDate.month < 10 ? `0${dueDate.month}` : dueDate.month}-${dueDate.day < 10 ? `0${dueDate.day}` : dueDate.day}`),
|
|
16
16
|
});
|
|
17
17
|
return add(submissionDueDate, duration);
|
|
18
18
|
};
|
|
19
19
|
const calendarDatePickerDefaultDateFormat = 'd MMM, EEEE';
|
|
20
|
-
const CalendarDatePicker = ({ handleDateChange, originalDueDate, currentDueDate, dialogConfigs, primaryButtonTitle = 'Reschedule', secondaryButtonTitle = 'Cancel',
|
|
20
|
+
const CalendarDatePicker = ({ Button, handleDateChange, originalDueDate, currentDueDate, datePickerConfigs, dialogConfigs, primaryButtonTitle = 'Reschedule', secondaryButtonTitle = 'Cancel', }) => {
|
|
21
|
+
datePickerConfigs = Object.assign({ position: 'bottom', color: '#f2fbfc', selectedDayClassName: 'selected-day', calendarClassName: 'responsive-calendar' }, datePickerConfigs);
|
|
21
22
|
const dialog = Object.assign({}, dialogConfigs, {
|
|
22
23
|
header: 'Change the task due date?',
|
|
23
24
|
});
|
|
24
|
-
const [
|
|
25
|
-
const [potentialNewDate, setPotentialNewDate] = useState(undefined);
|
|
25
|
+
const [dueDate, setDueDate] = useState();
|
|
26
26
|
const [toggleDialog, setToggleDialog] = useState(false);
|
|
27
27
|
const onConfirmClick = useCallback(() => {
|
|
28
|
-
|
|
29
|
-
handleDateChange(potentialNewDate);
|
|
30
|
-
setSelectedDay(potentialNewDate);
|
|
31
|
-
}
|
|
28
|
+
handleDateChange(dueDate);
|
|
32
29
|
setToggleDialog(false);
|
|
33
|
-
}, [
|
|
34
|
-
const
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
},
|
|
63
|
-
} })] }));
|
|
30
|
+
}, [dueDate, setToggleDialog, handleDateChange]);
|
|
31
|
+
const formattedDueDate = useMemo(() => dueDate &&
|
|
32
|
+
format(new Date(dueDate.year, dueDate.month, dueDate.day), calendarDatePickerDefaultDateFormat), [dueDate]);
|
|
33
|
+
const formattedPotentialDueDate = useMemo(() => dueDate &&
|
|
34
|
+
format(calendarPotentialDueDate(currentDueDate, dueDate, originalDueDate), calendarDatePickerDefaultDateFormat), [originalDueDate, currentDueDate, dueDate]);
|
|
35
|
+
const onDatePickerChange = useCallback((date) => {
|
|
36
|
+
setDueDate(date);
|
|
37
|
+
setToggleDialog(true);
|
|
38
|
+
const button = document.querySelector('.DatePicker button');
|
|
39
|
+
button.blur();
|
|
40
|
+
}, []);
|
|
41
|
+
return (React.createElement(React.Fragment, null,
|
|
42
|
+
React.createElement(Calendar, null,
|
|
43
|
+
React.createElement(DatePicker, { value: calendarGetDay(currentDueDate), onChange: onDatePickerChange, calendarPopperPosition: datePickerConfigs.position, colorPrimary: datePickerConfigs.color, calendarSelectedDayClassName: datePickerConfigs.selectedDayClassName, calendarClassName: datePickerConfigs.calendarClassName, renderInput: Button })),
|
|
44
|
+
React.createElement(Dialog, { isOpen: toggleDialog, category: Category.confirmation, header: dialog.header, message: React.createElement(React.Fragment, null,
|
|
45
|
+
React.createElement(UpdatedDueDate, null, formattedDueDate),
|
|
46
|
+
dialog.dueDateMessage && (React.createElement(DueDateMessage, null, dialog.dueDateMessage)),
|
|
47
|
+
React.createElement(Value, null,
|
|
48
|
+
React.createElement(StrikeDueDate, { as: 'del' }, format(originalDueDate, calendarDatePickerDefaultDateFormat)),
|
|
49
|
+
formattedPotentialDueDate)), actions: {
|
|
50
|
+
primary: {
|
|
51
|
+
action: onConfirmClick,
|
|
52
|
+
title: primaryButtonTitle,
|
|
53
|
+
},
|
|
54
|
+
secondary: {
|
|
55
|
+
action: () => setToggleDialog(false),
|
|
56
|
+
title: secondaryButtonTitle,
|
|
57
|
+
},
|
|
58
|
+
} })));
|
|
64
59
|
};
|
|
65
|
-
const CalendarPopoverButton = styled(PopoverButton) `
|
|
66
|
-
/* Add styles similar to your original PrimaryButton or specific needs */
|
|
67
|
-
border: 1px solid
|
|
68
|
-
${(props) => props.theme.colors.button.default.border.default};
|
|
69
|
-
background: ${(props) => props.theme.colors.button.default.background.default};
|
|
70
|
-
color: ${(props) => props.theme.colors.button.default.color.default};
|
|
71
|
-
padding: 10px 15px;
|
|
72
|
-
border-radius: ${(props) => props.theme.grid.radius.small};
|
|
73
|
-
cursor: pointer;
|
|
74
|
-
font-family: ${(props) => props.theme.font.family.sans};
|
|
75
|
-
font-size: ${(props) => props.theme.font.size.medium};
|
|
76
|
-
|
|
77
|
-
&:hover {
|
|
78
|
-
background: ${(props) => props.theme.colors.button.default.background.hover};
|
|
79
|
-
}
|
|
80
|
-
`;
|
|
81
|
-
const CalendarPopoverPanel = styled(PopoverPanel) `
|
|
82
|
-
background: ${(props) => props.theme.colors.background.primary};
|
|
83
|
-
border: 1px solid ${(props) => props.theme.colors.border.secondary};
|
|
84
|
-
border-radius: ${(props) => props.theme.grid.radius.default};
|
|
85
|
-
box-shadow: ${(props) => props.theme.shadow.dropShadow};
|
|
86
|
-
z-index: 10; /* Ensure it's above other content */
|
|
87
|
-
margin-top: 4px;
|
|
88
|
-
|
|
89
|
-
/* Target react-day-picker internal classes for styling */
|
|
90
|
-
.rdp {
|
|
91
|
-
--rdp-cell-size: 36px; /* Adjust size */
|
|
92
|
-
--rdp-accent-color: ${(props) => props.theme.colors.brand.default};
|
|
93
|
-
--rdp-background-color: ${(props) => props.theme.colors.brand.xlight};
|
|
94
|
-
/* Add more overrides as needed */
|
|
95
|
-
margin: ${(props) => props.theme.grid.unit * 2}px; /* Add some padding */
|
|
96
|
-
}
|
|
97
|
-
.rdp-day_selected {
|
|
98
|
-
font-weight: bold;
|
|
99
|
-
}
|
|
100
|
-
`;
|
|
101
60
|
const StrikeDueDate = styled(MessageContainer) `
|
|
102
61
|
margin: 0;
|
|
103
62
|
min-height: min-content;
|
|
@@ -110,6 +69,41 @@ const Value = styled.div `
|
|
|
110
69
|
align-items: center;
|
|
111
70
|
line-height: 1;
|
|
112
71
|
`;
|
|
72
|
+
const Calendar = styled.div `
|
|
73
|
+
flex: 1;
|
|
74
|
+
|
|
75
|
+
.DatePicker {
|
|
76
|
+
width: 100%;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
.DatePicker__calendarContainer {
|
|
80
|
+
position: absolute;
|
|
81
|
+
top: unset;
|
|
82
|
+
left: unset !important;
|
|
83
|
+
right: 0 !important;
|
|
84
|
+
transform: unset !important;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
.Calendar__weekDay {
|
|
88
|
+
color: #e6e6e6;
|
|
89
|
+
font-size: ${(props) => props.theme.font.size.normal};
|
|
90
|
+
line-height: ${(props) => props.theme.font.lineHeight.large};
|
|
91
|
+
font-weight: ${(props) => props.theme.font.weight.medium};
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
.Calendar__day:not(.-blank):not(.-selected):hover {
|
|
95
|
+
background: #f2fbfc !important;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
.Calendar__day.-today:hover::after {
|
|
99
|
+
opacity: 0.5 !important;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
.selected-day {
|
|
103
|
+
color: ${(props) => props.theme.colors.text.primary} !important;
|
|
104
|
+
border: 1px solid ${(props) => props.theme.colors.border.primary} !important;
|
|
105
|
+
}
|
|
106
|
+
`;
|
|
113
107
|
const UpdatedDueDate = styled.div `
|
|
114
108
|
background: ${(props) => props.theme.colors.background.secondary};
|
|
115
109
|
color: ${(props) => props.theme.colors.text.primary};
|
|
@@ -124,4 +118,4 @@ const DueDateMessage = styled(MessageContainer) `
|
|
|
124
118
|
min-height: min-content;
|
|
125
119
|
margin: ${(props) => props.theme.grid.unit * 6}px 0 0 0;
|
|
126
120
|
`;
|
|
127
|
-
export { calendarPotentialDueDate, calendarDatePickerDefaultDateFormat, CalendarDatePicker, };
|
|
121
|
+
export { calendarGetDay, calendarPotentialDueDate, calendarDatePickerDefaultDateFormat, CalendarDatePicker, };
|
|
@@ -1,3 +1,18 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* © 2019 Atypon Systems LLC
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
1
16
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
17
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
18
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
@@ -7,8 +22,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
7
22
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
23
|
});
|
|
9
24
|
};
|
|
10
|
-
import
|
|
11
|
-
import { useCallback, useEffect, useState } from 'react';
|
|
25
|
+
import React from 'react';
|
|
12
26
|
import styled from 'styled-components';
|
|
13
27
|
import { ButtonGroup, PrimaryButton, SecondaryButton } from './Button';
|
|
14
28
|
import { AttentionOrangeIcon, AttentionRedIcon } from './icons';
|
|
@@ -65,25 +79,55 @@ export var Category;
|
|
|
65
79
|
Category["confirmation"] = "confirmation";
|
|
66
80
|
Category["warning"] = "warning";
|
|
67
81
|
})(Category || (Category = {}));
|
|
68
|
-
const PrimaryAction = (props) => props.isDestructive ? (props.hasForm ? (
|
|
69
|
-
const SecondaryAction = (props) => (
|
|
70
|
-
export
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
};
|
|
82
|
+
const PrimaryAction = (props) => props.isDestructive ? (props.hasForm ? (React.createElement(PrimaryButton, { danger: true, disabled: props.disabled, form: "formDialog", type: "submit" }, props.title)) : (React.createElement(PrimaryButton, { danger: true, disabled: props.disabled, onClick: props.action, autoFocus: true }, props.title))) : props.hasForm ? (React.createElement(PrimaryButton, { disabled: props.disabled, form: "formDialog", type: "submit" }, props.title)) : (React.createElement(PrimaryButton, { disabled: props.disabled, onClick: props.action, autoFocus: true }, props.title));
|
|
83
|
+
const SecondaryAction = (props) => (React.createElement(SecondaryButton, { disabled: props.disabled, onClick: props.action }, props.title));
|
|
84
|
+
export class Dialog extends React.Component {
|
|
85
|
+
constructor() {
|
|
86
|
+
super(...arguments);
|
|
87
|
+
this.state = {
|
|
88
|
+
primaryActionDisabled: true,
|
|
89
|
+
};
|
|
90
|
+
this.renderButtons = (props, disabled) => (React.createElement(ButtonsContainer, null, props.actions.secondary ? (!props.actions.primary.isDestructive ? (React.createElement(React.Fragment, null,
|
|
91
|
+
React.createElement(SecondaryAction, { action: props.actions.secondary.action, hasForm: !!this.props.confirmFieldText, title: props.actions.secondary.title }),
|
|
92
|
+
React.createElement(PrimaryAction, { action: props.actions.primary.action, disabled: disabled, title: props.actions.primary.title || 'Dismiss' }))) : (React.createElement(React.Fragment, null,
|
|
93
|
+
React.createElement(PrimaryAction, { action: props.actions.primary.action, disabled: disabled, isDestructive: true, hasForm: !!this.props.confirmFieldText, title: props.actions.primary.title || 'Dismiss' }),
|
|
94
|
+
React.createElement(SecondaryAction, { action: props.actions.secondary.action, title: props.actions.secondary.title })))) : (React.createElement(PrimaryAction, { action: props.actions.primary.action, disabled: disabled, isDestructive: props.actions.primary.isDestructive, hasForm: !!this.props.confirmFieldText, title: props.actions.primary.title || 'Dismiss' }))));
|
|
95
|
+
this.checkInputValue = (event) => {
|
|
96
|
+
const testingVal = this.props.confirmFieldText && this.props.confirmFieldText.toUpperCase();
|
|
97
|
+
const target = event.target;
|
|
98
|
+
const newVal = target.value.toUpperCase();
|
|
99
|
+
this.setDisabledBtnState(newVal !== testingVal);
|
|
100
|
+
};
|
|
101
|
+
this.setDisabledBtnState = (state) => {
|
|
102
|
+
this.setState({ primaryActionDisabled: state });
|
|
103
|
+
};
|
|
104
|
+
this.handleSubmit = (e) => __awaiter(this, void 0, void 0, function* () {
|
|
105
|
+
const { primaryActionDisabled } = this.state;
|
|
106
|
+
e.preventDefault();
|
|
107
|
+
if (!primaryActionDisabled) {
|
|
108
|
+
this.props.actions.primary.action();
|
|
109
|
+
}
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
componentDidMount() {
|
|
113
|
+
this.setDisabledBtnState(!!this.props.confirmFieldText);
|
|
114
|
+
}
|
|
115
|
+
render() {
|
|
116
|
+
const { actions, isOpen, header, message, category, children, confirmFieldText, className, } = this.props;
|
|
117
|
+
const { primaryActionDisabled } = this.state;
|
|
118
|
+
return (React.createElement(StyledModal, { isOpen: isOpen, onRequestClose: actions.onClose, shouldCloseOnOverlayClick: true, className: className },
|
|
119
|
+
React.createElement(DialogModalBody, null,
|
|
120
|
+
React.createElement(HeaderContainer, null,
|
|
121
|
+
category === Category.error && (React.createElement(Icon, null,
|
|
122
|
+
React.createElement(AttentionRedIcon, null))),
|
|
123
|
+
category === Category.warning && (React.createElement(Icon, null,
|
|
124
|
+
React.createElement(AttentionOrangeIcon, null))),
|
|
125
|
+
header),
|
|
126
|
+
React.createElement(MessageContainer, null,
|
|
127
|
+
message,
|
|
128
|
+
confirmFieldText && (React.createElement("form", { id: "formDialog", onSubmit: this.handleSubmit },
|
|
129
|
+
React.createElement(ConfirmationTextField, { autoFocus: true, onChange: this.checkInputValue, placeholder: 'Please type: ' + confirmFieldText, required: true }))),
|
|
130
|
+
children),
|
|
131
|
+
this.renderButtons(this.props, primaryActionDisabled))));
|
|
132
|
+
}
|
|
133
|
+
}
|