@manuscripts/style-guide 2.1.7 → 2.1.8-LEAN-4344.0
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 +13 -49
- package/dist/cjs/components/AutoSaveInput.js +30 -53
- package/dist/cjs/components/Avatar.js +3 -40
- package/dist/cjs/components/ContextMenu.js +5 -22
- package/dist/cjs/components/DatePicker/CalendarDatePicker.js +87 -105
- package/dist/cjs/components/Dialog.js +24 -68
- package/dist/cjs/components/DraggableModal.js +4 -42
- package/dist/cjs/components/Drawer.js +2 -21
- package/dist/cjs/components/Dropdown.js +3 -1
- package/dist/cjs/components/InspectorSection.js +5 -48
- package/dist/cjs/components/LoadingOverlay.js +3 -5
- package/dist/cjs/components/Menus/Menus.js +9 -28
- package/dist/cjs/components/Menus/Shortcut.js +3 -18
- package/dist/cjs/components/Menus/Submenu.js +7 -28
- package/dist/cjs/components/MultiValueInput.js +3 -29
- package/dist/cjs/components/NavDropdown.js +3 -26
- package/dist/cjs/components/RadioButton.js +2 -19
- package/dist/cjs/components/RelativeDate.js +2 -20
- package/dist/cjs/components/Resizer/Resizer.js +100 -92
- package/dist/cjs/components/Resizer/ResizerButton.js +7 -12
- package/dist/cjs/components/RichText/RichText.js +3 -25
- package/dist/cjs/components/RichText/RichTextField.js +3 -25
- package/dist/cjs/components/SaveStatus.js +5 -31
- package/dist/cjs/components/SelectField.js +2 -17
- package/dist/cjs/components/SelectedItemsBox.js +2 -5
- package/dist/cjs/components/StyledModal.js +2 -17
- package/dist/cjs/components/SystemUserAvatar.js +3 -40
- package/dist/cjs/components/TextField.js +2 -22
- package/dist/cjs/components/TextFieldContainer.js +2 -22
- package/dist/cjs/components/TextFieldError.js +2 -19
- package/dist/cjs/components/TextFieldGroupContainer.js +2 -22
- package/dist/cjs/components/Tooltip.js +3 -4
- package/dist/cjs/components/icons/add-author.js +2 -23
- package/dist/cjs/components/icons/add-comment.js +2 -25
- package/dist/cjs/components/icons/add-institution.js +2 -20
- package/dist/cjs/components/icons/add-new.js +2 -7
- package/dist/cjs/components/icons/add-outline.js +2 -8
- package/dist/cjs/components/icons/add-user.js +2 -8
- package/dist/cjs/components/icons/add.js +2 -8
- package/dist/cjs/components/icons/added.js +2 -7
- package/dist/cjs/components/icons/affiliation-placeholder.js +2 -39
- package/dist/cjs/components/icons/affiliation.js +2 -7
- package/dist/cjs/components/icons/alert.js +2 -6
- package/dist/cjs/components/icons/arrow-down-circle.js +2 -7
- package/dist/cjs/components/icons/arrow-down.js +2 -6
- package/dist/cjs/components/icons/arrow-left.js +2 -6
- package/dist/cjs/components/icons/arrow-up.js +2 -6
- package/dist/cjs/components/icons/attach.js +2 -21
- package/dist/cjs/components/icons/attention-blue.js +2 -10
- package/dist/cjs/components/icons/attention-green.js +2 -7
- package/dist/cjs/components/icons/attention-orange.js +2 -12
- package/dist/cjs/components/icons/attention-red.js +2 -10
- package/dist/cjs/components/icons/author-placeholder.js +2 -46
- package/dist/cjs/components/icons/avatar.js +2 -8
- package/dist/cjs/components/icons/book.js +2 -22
- package/dist/cjs/components/icons/circle-tick-animation.js +2 -7
- package/dist/cjs/components/icons/citation-count.js +2 -6
- package/dist/cjs/components/icons/comment-reply.js +2 -6
- package/dist/cjs/components/icons/comment-resolve.js +2 -21
- package/dist/cjs/components/icons/comment.js +2 -25
- package/dist/cjs/components/icons/corresponding-author.js +2 -12
- package/dist/cjs/components/icons/delete-solid.js +2 -6
- package/dist/cjs/components/icons/deleted.js +2 -11
- package/dist/cjs/components/icons/dots.js +2 -23
- package/dist/cjs/components/icons/draggable-icon.js +2 -13
- package/dist/cjs/components/icons/edit-attrs-tracking.js +2 -7
- package/dist/cjs/components/icons/edit.js +2 -6
- package/dist/cjs/components/icons/file-audio.js +2 -23
- package/dist/cjs/components/icons/file-code.js +2 -23
- package/dist/cjs/components/icons/file-compressed.js +2 -30
- package/dist/cjs/components/icons/file-corrupted.js +2 -24
- package/dist/cjs/components/icons/file-document.js +2 -24
- package/dist/cjs/components/icons/file-figure.js +2 -23
- package/dist/cjs/components/icons/file-graphical-abstract.js +2 -8
- package/dist/cjs/components/icons/file-image.js +2 -6
- package/dist/cjs/components/icons/file-latex-icon.js +2 -25
- package/dist/cjs/components/icons/file-main-document.js +2 -10
- package/dist/cjs/components/icons/file-pdf.js +2 -22
- package/dist/cjs/components/icons/file-table.js +2 -21
- package/dist/cjs/components/icons/file-unknown.js +2 -22
- package/dist/cjs/components/icons/file-video.js +2 -21
- package/dist/cjs/components/icons/handle-inspector.js +2 -6
- package/dist/cjs/components/icons/handle-outline.js +2 -11
- package/dist/cjs/components/icons/help.js +2 -8
- package/dist/cjs/components/icons/image-default.js +2 -9
- package/dist/cjs/components/icons/image-left.js +2 -9
- package/dist/cjs/components/icons/image-right.js +2 -9
- package/dist/cjs/components/icons/link.js +2 -7
- package/dist/cjs/components/icons/lock.js +2 -9
- package/dist/cjs/components/icons/logout.js +2 -6
- package/dist/cjs/components/icons/manuscript.js +2 -24
- package/dist/cjs/components/icons/outline-block-quote.js +2 -8
- package/dist/cjs/components/icons/outline-code.js +2 -7
- package/dist/cjs/components/icons/outline-embed.js +2 -7
- package/dist/cjs/components/icons/outline-equation.js +2 -6
- package/dist/cjs/components/icons/outline-figure.js +2 -12
- package/dist/cjs/components/icons/outline-manuscript.js +2 -9
- package/dist/cjs/components/icons/outline-ordered-list.js +2 -6
- package/dist/cjs/components/icons/outline-paragraph.js +2 -6
- package/dist/cjs/components/icons/outline-pull-quote.js +2 -8
- package/dist/cjs/components/icons/outline-section.js +2 -6
- package/dist/cjs/components/icons/outline-table.js +2 -8
- package/dist/cjs/components/icons/outline-unordered-list.js +2 -8
- package/dist/cjs/components/icons/plus.js +2 -22
- package/dist/cjs/components/icons/profile-avatar.js +2 -6
- package/dist/cjs/components/icons/role-annotating.js +2 -8
- package/dist/cjs/components/icons/role-reading.js +2 -10
- package/dist/cjs/components/icons/save-status-offline.js +2 -23
- package/dist/cjs/components/icons/save-status-saved.js +2 -22
- package/dist/cjs/components/icons/save-status-saving.js +2 -24
- package/dist/cjs/components/icons/scroll.js +2 -10
- package/dist/cjs/components/icons/search.js +2 -22
- package/dist/cjs/components/icons/section-category.js +2 -21
- package/dist/cjs/components/icons/slider-off.js +2 -7
- package/dist/cjs/components/icons/slider-on.js +2 -7
- package/dist/cjs/components/icons/system-user-avatar.js +2 -9
- package/dist/cjs/components/icons/task-step-done.js +2 -22
- package/dist/cjs/components/icons/tick.js +2 -6
- package/dist/cjs/components/icons/toolbar-bold.js +2 -6
- package/dist/cjs/components/icons/toolbar-citation.js +2 -6
- package/dist/cjs/components/icons/toolbar-code.js +2 -7
- package/dist/cjs/components/icons/toolbar-equation.js +2 -6
- package/dist/cjs/components/icons/toolbar-figure.js +2 -6
- package/dist/cjs/components/icons/toolbar-indent.js +2 -11
- package/dist/cjs/components/icons/toolbar-italic.js +2 -6
- package/dist/cjs/components/icons/toolbar-ordered-list.js +2 -6
- package/dist/cjs/components/icons/toolbar-subscript.js +2 -6
- package/dist/cjs/components/icons/toolbar-superscript.js +2 -6
- package/dist/cjs/components/icons/toolbar-symbol.js +2 -6
- package/dist/cjs/components/icons/toolbar-table.js +2 -6
- package/dist/cjs/components/icons/toolbar-underline.js +2 -6
- package/dist/cjs/components/icons/toolbar-unindent.js +2 -11
- package/dist/cjs/components/icons/toolbar-unordered-list.js +2 -6
- package/dist/cjs/components/icons/triangle-collapsed.js +2 -6
- package/dist/cjs/components/icons/triangle-expanded.js +2 -6
- package/dist/cjs/components/icons/upload.js +2 -8
- package/dist/cjs/components/icons/vertical-ellipsis.js +2 -8
- package/dist/cjs/components/icons/x.js +2 -7
- package/dist/cjs/hooks/use-scroll-detection.js +2 -2
- package/dist/cjs/lib/capabilities.js +2 -1
- package/dist/cjs/lib/files.js +14 -17
- package/dist/es/components/AlertMessage.js +14 -47
- package/dist/es/components/AutoSaveInput.js +30 -50
- package/dist/es/components/Avatar.js +3 -17
- package/dist/es/components/ContextMenu.js +5 -22
- package/dist/es/components/DatePicker/CalendarDatePicker.js +86 -80
- package/dist/es/components/Dialog.js +24 -68
- package/dist/es/components/DraggableModal.js +4 -19
- package/dist/es/components/Drawer.js +2 -18
- package/dist/es/components/Dropdown.js +3 -1
- package/dist/es/components/InspectorSection.js +5 -25
- package/dist/es/components/LoadingOverlay.js +3 -5
- package/dist/es/components/Menus/Menus.js +9 -28
- package/dist/es/components/Menus/Shortcut.js +3 -18
- package/dist/es/components/Menus/Submenu.js +7 -28
- package/dist/es/components/MultiValueInput.js +3 -6
- package/dist/es/components/NavDropdown.js +3 -23
- package/dist/es/components/RadioButton.js +2 -19
- package/dist/es/components/RelativeDate.js +2 -17
- package/dist/es/components/Resizer/Resizer.js +78 -90
- package/dist/es/components/Resizer/ResizerButton.js +7 -11
- package/dist/es/components/RichText/RichText.js +3 -2
- package/dist/es/components/RichText/RichTextField.js +3 -2
- package/dist/es/components/SaveStatus.js +5 -31
- package/dist/es/components/SelectField.js +2 -17
- package/dist/es/components/SelectedItemsBox.js +2 -5
- package/dist/es/components/StyledModal.js +2 -17
- package/dist/es/components/SystemUserAvatar.js +3 -17
- package/dist/es/components/TextField.js +2 -19
- package/dist/es/components/TextFieldContainer.js +2 -22
- package/dist/es/components/TextFieldError.js +2 -19
- package/dist/es/components/TextFieldGroupContainer.js +2 -19
- package/dist/es/components/Tooltip.js +3 -4
- package/dist/es/components/icons/add-author.js +2 -20
- package/dist/es/components/icons/add-comment.js +2 -22
- package/dist/es/components/icons/add-institution.js +2 -17
- package/dist/es/components/icons/add-new.js +2 -4
- package/dist/es/components/icons/add-outline.js +2 -5
- package/dist/es/components/icons/add-user.js +2 -5
- package/dist/es/components/icons/add.js +2 -5
- package/dist/es/components/icons/added.js +2 -4
- package/dist/es/components/icons/affiliation-placeholder.js +2 -36
- package/dist/es/components/icons/affiliation.js +2 -4
- package/dist/es/components/icons/alert.js +2 -3
- package/dist/es/components/icons/arrow-down-circle.js +2 -4
- package/dist/es/components/icons/arrow-down.js +2 -3
- package/dist/es/components/icons/arrow-left.js +2 -3
- package/dist/es/components/icons/arrow-up.js +2 -3
- package/dist/es/components/icons/attach.js +2 -18
- package/dist/es/components/icons/attention-blue.js +2 -7
- package/dist/es/components/icons/attention-green.js +2 -4
- package/dist/es/components/icons/attention-orange.js +2 -9
- package/dist/es/components/icons/attention-red.js +2 -7
- package/dist/es/components/icons/author-placeholder.js +2 -43
- package/dist/es/components/icons/avatar.js +2 -5
- package/dist/es/components/icons/book.js +2 -19
- package/dist/es/components/icons/circle-tick-animation.js +2 -4
- package/dist/es/components/icons/citation-count.js +2 -3
- package/dist/es/components/icons/comment-reply.js +2 -3
- package/dist/es/components/icons/comment-resolve.js +2 -18
- package/dist/es/components/icons/comment.js +2 -22
- package/dist/es/components/icons/corresponding-author.js +2 -9
- package/dist/es/components/icons/delete-solid.js +2 -3
- package/dist/es/components/icons/deleted.js +2 -8
- package/dist/es/components/icons/dots.js +2 -20
- package/dist/es/components/icons/draggable-icon.js +2 -10
- package/dist/es/components/icons/edit-attrs-tracking.js +2 -4
- package/dist/es/components/icons/edit.js +2 -3
- package/dist/es/components/icons/file-audio.js +2 -20
- package/dist/es/components/icons/file-code.js +2 -20
- package/dist/es/components/icons/file-compressed.js +2 -27
- package/dist/es/components/icons/file-corrupted.js +2 -21
- package/dist/es/components/icons/file-document.js +2 -21
- package/dist/es/components/icons/file-figure.js +2 -20
- package/dist/es/components/icons/file-graphical-abstract.js +2 -5
- package/dist/es/components/icons/file-image.js +2 -3
- package/dist/es/components/icons/file-latex-icon.js +2 -22
- package/dist/es/components/icons/file-main-document.js +2 -7
- package/dist/es/components/icons/file-pdf.js +2 -19
- package/dist/es/components/icons/file-table.js +2 -18
- package/dist/es/components/icons/file-unknown.js +2 -19
- package/dist/es/components/icons/file-video.js +2 -18
- package/dist/es/components/icons/handle-inspector.js +2 -3
- package/dist/es/components/icons/handle-outline.js +2 -8
- package/dist/es/components/icons/help.js +2 -5
- package/dist/es/components/icons/image-default.js +2 -6
- package/dist/es/components/icons/image-left.js +2 -6
- package/dist/es/components/icons/image-right.js +2 -6
- package/dist/es/components/icons/link.js +2 -4
- package/dist/es/components/icons/lock.js +2 -6
- package/dist/es/components/icons/logout.js +2 -3
- package/dist/es/components/icons/manuscript.js +2 -21
- package/dist/es/components/icons/outline-block-quote.js +2 -5
- package/dist/es/components/icons/outline-code.js +2 -4
- package/dist/es/components/icons/outline-embed.js +2 -4
- package/dist/es/components/icons/outline-equation.js +2 -3
- package/dist/es/components/icons/outline-figure.js +2 -9
- package/dist/es/components/icons/outline-manuscript.js +2 -6
- package/dist/es/components/icons/outline-ordered-list.js +2 -3
- package/dist/es/components/icons/outline-paragraph.js +2 -3
- package/dist/es/components/icons/outline-pull-quote.js +2 -5
- package/dist/es/components/icons/outline-section.js +2 -3
- package/dist/es/components/icons/outline-table.js +2 -5
- package/dist/es/components/icons/outline-unordered-list.js +2 -5
- package/dist/es/components/icons/plus.js +2 -19
- package/dist/es/components/icons/profile-avatar.js +2 -3
- package/dist/es/components/icons/role-annotating.js +2 -5
- package/dist/es/components/icons/role-reading.js +2 -7
- package/dist/es/components/icons/save-status-offline.js +2 -20
- package/dist/es/components/icons/save-status-saved.js +2 -19
- package/dist/es/components/icons/save-status-saving.js +2 -21
- package/dist/es/components/icons/scroll.js +2 -7
- package/dist/es/components/icons/search.js +2 -19
- package/dist/es/components/icons/section-category.js +2 -18
- package/dist/es/components/icons/slider-off.js +2 -4
- package/dist/es/components/icons/slider-on.js +2 -4
- package/dist/es/components/icons/system-user-avatar.js +2 -6
- package/dist/es/components/icons/task-step-done.js +2 -19
- package/dist/es/components/icons/tick.js +2 -3
- package/dist/es/components/icons/toolbar-bold.js +2 -3
- package/dist/es/components/icons/toolbar-citation.js +2 -3
- package/dist/es/components/icons/toolbar-code.js +2 -4
- package/dist/es/components/icons/toolbar-equation.js +2 -3
- package/dist/es/components/icons/toolbar-figure.js +2 -3
- package/dist/es/components/icons/toolbar-indent.js +2 -8
- package/dist/es/components/icons/toolbar-italic.js +2 -3
- package/dist/es/components/icons/toolbar-ordered-list.js +2 -3
- package/dist/es/components/icons/toolbar-subscript.js +2 -3
- package/dist/es/components/icons/toolbar-superscript.js +2 -3
- package/dist/es/components/icons/toolbar-symbol.js +2 -3
- package/dist/es/components/icons/toolbar-table.js +2 -3
- package/dist/es/components/icons/toolbar-underline.js +2 -3
- package/dist/es/components/icons/toolbar-unindent.js +2 -8
- package/dist/es/components/icons/toolbar-unordered-list.js +2 -3
- package/dist/es/components/icons/triangle-collapsed.js +2 -3
- package/dist/es/components/icons/triangle-expanded.js +2 -3
- package/dist/es/components/icons/upload.js +2 -5
- package/dist/es/components/icons/vertical-ellipsis.js +2 -5
- package/dist/es/components/icons/x.js +2 -4
- package/dist/es/hooks/use-scroll-detection.js +2 -2
- package/dist/es/lib/capabilities.js +2 -1
- package/dist/es/lib/files.js +14 -14
- package/dist/types/components/AlertMessage.d.ts +14 -13
- package/dist/types/components/AutoSaveInput.d.ts +1 -14
- package/dist/types/components/Badge.d.ts +2 -1
- package/dist/types/components/Button.d.ts +30 -80
- package/dist/types/components/Checkbox.d.ts +5 -6
- package/dist/types/components/DatePicker/CalendarDatePicker.d.ts +19 -18
- package/dist/types/components/Dialog.d.ts +3 -14
- package/dist/types/components/Dropdown.d.ts +9 -6
- package/dist/types/components/Form.d.ts +4 -4
- package/dist/types/components/Inspector.d.ts +1720 -10
- package/dist/types/components/InspectorSection.d.ts +35 -10
- 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 +26 -19
- package/dist/types/components/RadioButton.d.ts +1 -1
- package/dist/types/components/Resizer/Resizer.d.ts +1 -23
- package/dist/types/components/Resizer/ResizerButton.d.ts +1 -7
- package/dist/types/components/Resizer/ResizerButtonInner.d.ts +5 -4
- package/dist/types/components/Resizer/ResizerInner.d.ts +5 -4
- package/dist/types/components/Sidebar.d.ts +3 -2
- package/dist/types/components/StyledModal.d.ts +43 -30
- package/dist/types/components/Text.d.ts +5 -4
- 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 +1 -2
- package/dist/types/components/icons/affiliation-placeholder.d.ts +1 -2
- package/dist/types/components/icons/author-placeholder.d.ts +1 -2
- package/dist/types/components/icons/section-category.d.ts +1 -2
- package/dist/types/components/icons/x.d.ts +1 -2
- package/dist/types/hooks/use-dropdown.d.ts +1 -1
- package/dist/types/hooks/use-menus.d.ts +1 -1
- package/dist/types/lib/files.d.ts +3 -3
- package/package.json +25 -23
package/dist/cjs/lib/files.js
CHANGED
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
3
|
exports.isImageFile = exports.getFileTypeIcon = exports.getFileIcon = exports.getFileType = exports.FileType = void 0;
|
|
7
|
-
const
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
8
5
|
const icons_1 = require("../components/icons");
|
|
9
6
|
var FileType;
|
|
10
7
|
(function (FileType) {
|
|
@@ -60,53 +57,53 @@ const extension2type = new Map([
|
|
|
60
57
|
const type2icon = new Map([
|
|
61
58
|
[
|
|
62
59
|
FileType.Audio,
|
|
63
|
-
|
|
60
|
+
(0, jsx_runtime_1.jsx)(icons_1.FileAudioIcon, { className: "file-icon" }, FileType.Audio),
|
|
64
61
|
],
|
|
65
62
|
[
|
|
66
63
|
FileType.Video,
|
|
67
|
-
|
|
64
|
+
(0, jsx_runtime_1.jsx)(icons_1.FileVideoIcon, { className: "file-icon" }, FileType.Video),
|
|
68
65
|
],
|
|
69
66
|
[
|
|
70
67
|
FileType.PlainDocument,
|
|
71
|
-
|
|
68
|
+
(0, jsx_runtime_1.jsx)(icons_1.FileDocumentIcon, { color: "#1A9BC7", className: "file-icon" }, FileType.PlainDocument),
|
|
72
69
|
],
|
|
73
70
|
[
|
|
74
71
|
FileType.SheetsWorkbooks,
|
|
75
|
-
|
|
72
|
+
(0, jsx_runtime_1.jsx)(icons_1.FileTableIcon, { className: "file-icon" }, FileType.SheetsWorkbooks),
|
|
76
73
|
],
|
|
77
74
|
[
|
|
78
75
|
FileType.Latex,
|
|
79
|
-
|
|
76
|
+
(0, jsx_runtime_1.jsx)(icons_1.FileLatexIcon, { color: "#1A9BC7", className: "file-icon" }, FileType.Latex),
|
|
80
77
|
],
|
|
81
78
|
[
|
|
82
79
|
FileType.CodeFile,
|
|
83
|
-
|
|
80
|
+
(0, jsx_runtime_1.jsx)(icons_1.FileCodeIcon, { className: "file-icon" }, FileType.CodeFile),
|
|
84
81
|
],
|
|
85
82
|
[
|
|
86
83
|
FileType.PdfFile,
|
|
87
|
-
|
|
84
|
+
(0, jsx_runtime_1.jsx)(icons_1.FilePdfIcon, { className: "file-icon" }, FileType.PdfFile),
|
|
88
85
|
],
|
|
89
86
|
[
|
|
90
87
|
FileType.CompressedFile,
|
|
91
|
-
|
|
88
|
+
(0, jsx_runtime_1.jsx)(icons_1.FileCompressedIcon, { className: "file-icon" }, FileType.CompressedFile),
|
|
92
89
|
],
|
|
93
90
|
[
|
|
94
91
|
FileType.PlainText,
|
|
95
|
-
|
|
92
|
+
(0, jsx_runtime_1.jsx)(icons_1.FileDocumentIcon, { color: "#FFBD26", className: "file-icon" }, FileType.PlainText),
|
|
96
93
|
],
|
|
97
94
|
[
|
|
98
95
|
FileType.Image,
|
|
99
|
-
|
|
96
|
+
(0, jsx_runtime_1.jsx)(icons_1.FileImageIcon, { className: "file-icon" }, FileType.Image),
|
|
100
97
|
],
|
|
101
98
|
[
|
|
102
99
|
FileType.Figure,
|
|
103
|
-
|
|
100
|
+
(0, jsx_runtime_1.jsx)(icons_1.FileFigureIcon, { className: "file-icon" }, FileType.Figure),
|
|
104
101
|
],
|
|
105
102
|
[
|
|
106
103
|
FileType.GraphicalAbstract,
|
|
107
|
-
|
|
104
|
+
(0, jsx_runtime_1.jsx)(icons_1.FileGraphicalAbstractIcon, { className: "file-icon" }, FileType.GraphicalAbstract),
|
|
108
105
|
],
|
|
109
|
-
[undefined,
|
|
106
|
+
[undefined, (0, jsx_runtime_1.jsx)(icons_1.FileUnknownIcon, { className: "file-icon" }, undefined)],
|
|
110
107
|
]);
|
|
111
108
|
const getFileType = (name) => {
|
|
112
109
|
const extension = getExtension(name);
|
|
@@ -1,22 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
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';
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useCallback, useState } from 'react';
|
|
18
3
|
import styled, { css } from 'styled-components';
|
|
19
|
-
import {
|
|
4
|
+
import { IconTextButton } from './Button';
|
|
20
5
|
import { AttentionBlueIcon, AttentionGreenIcon, AttentionOrangeIcon, AttentionRedIcon, } from './icons';
|
|
21
6
|
const buttonStyles = css `
|
|
22
7
|
color: inherit;
|
|
@@ -35,12 +20,6 @@ const buttonStyles = css `
|
|
|
35
20
|
export const TextButton = styled(IconTextButton) `
|
|
36
21
|
${buttonStyles}
|
|
37
22
|
`;
|
|
38
|
-
const CloseIconButton = styled(IconButton).attrs({
|
|
39
|
-
defaultColor: true,
|
|
40
|
-
size: 16,
|
|
41
|
-
}) `
|
|
42
|
-
${buttonStyles}
|
|
43
|
-
`;
|
|
44
23
|
const InformativeIcon = styled.div `
|
|
45
24
|
height: 24px;
|
|
46
25
|
margin-right: ${(props) => props.theme.grid.unit * 3}px;
|
|
@@ -112,27 +91,15 @@ const alertContainers = {
|
|
|
112
91
|
info: InfoAlertContainer,
|
|
113
92
|
warning: WarningAlertContainer,
|
|
114
93
|
};
|
|
115
|
-
export
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
this.setState({ isOpen: false });
|
|
123
|
-
};
|
|
94
|
+
export const AlertMessage = ({ dismissButton, children, type, }) => {
|
|
95
|
+
const [isOpen, setIsOpen] = useState(true);
|
|
96
|
+
const handleClose = useCallback(() => {
|
|
97
|
+
setIsOpen(false);
|
|
98
|
+
}, []);
|
|
99
|
+
if (!isOpen) {
|
|
100
|
+
return null;
|
|
124
101
|
}
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
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
|
-
}
|
|
102
|
+
const AlertContainer = alertContainers[type];
|
|
103
|
+
const AlertIcon = alertIcons[type];
|
|
104
|
+
return (_jsx(AlertContainer, Object.assign({ className: 'alert-message' }, { children: _jsxs(InnerContainer, { children: [_jsx(InformativeIcon, { children: _jsx(AlertIcon, {}) }), _jsx(TextContainer, { children: children }), dismissButton && (_jsx(TextButton, Object.assign({ onClick: dismissButton.action ? dismissButton.action : handleClose }, { children: dismissButton.text })))] }) })));
|
|
105
|
+
};
|
|
@@ -1,52 +1,32 @@
|
|
|
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
|
-
|
|
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();
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useCallback, useEffect, useState, } from 'react';
|
|
3
|
+
export const AutoSaveInput = ({ component: Component, field, form, placeholder, disabled, testId, isInvalid, saveOn, }) => {
|
|
4
|
+
const [focused, setFocused] = useState(false);
|
|
5
|
+
const handleSubmit = useCallback(() => {
|
|
6
|
+
window.setTimeout(form.submitForm, 10);
|
|
7
|
+
}, [form]);
|
|
8
|
+
const handleFocus = useCallback(() => {
|
|
9
|
+
setFocused(true);
|
|
10
|
+
}, []);
|
|
11
|
+
const handleBlur = useCallback((event) => {
|
|
12
|
+
setFocused(false);
|
|
13
|
+
field.onBlur(event);
|
|
14
|
+
if (saveOn === 'blur') {
|
|
15
|
+
handleSubmit();
|
|
16
|
+
}
|
|
17
|
+
}, [field, saveOn, handleSubmit]);
|
|
18
|
+
const handleChange = useCallback((event) => {
|
|
19
|
+
field.onChange(event);
|
|
20
|
+
if (saveOn === 'change') {
|
|
21
|
+
handleSubmit();
|
|
22
|
+
}
|
|
23
|
+
}, [field, saveOn, handleSubmit]);
|
|
24
|
+
useEffect(() => {
|
|
25
|
+
return () => {
|
|
26
|
+
if (focused) {
|
|
27
|
+
handleSubmit();
|
|
40
28
|
}
|
|
41
29
|
};
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
|
|
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
|
-
}
|
|
30
|
+
}, [focused, handleSubmit]);
|
|
31
|
+
return (_jsx(Component, Object.assign({}, field, { placeholder: placeholder, disabled: disabled, checked: !!field.value, onFocus: handleFocus, onBlur: handleBlur, onChange: handleChange, "data-testid": testId && `${testId}__input`, "aria-invalid": isInvalid || undefined })));
|
|
32
|
+
};
|
|
@@ -1,19 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
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';
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useCallback, useState } from 'react';
|
|
17
3
|
import styled from 'styled-components';
|
|
18
4
|
import { ProfileIcon } from './icons';
|
|
19
5
|
const AvatarContainer = styled.div `
|
|
@@ -44,5 +30,5 @@ export const Avatar = (props) => {
|
|
|
44
30
|
const handleSrcError = useCallback(() => {
|
|
45
31
|
setSrcError(true);
|
|
46
32
|
}, []);
|
|
47
|
-
return (
|
|
33
|
+
return (_jsx(AvatarContainer, Object.assign({ opacity: props.opacity || 1 }, { children: props.src && !srcError ? (_jsx(RoundedImage, { src: props.src, size: props.size, onError: handleSrcError })) : (_jsx(StyledAvatar, { height: props.size, width: props.size, color: props.color })) })));
|
|
48
34
|
};
|
|
@@ -1,19 +1,4 @@
|
|
|
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';
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
17
2
|
import styled from 'styled-components';
|
|
18
3
|
import { IconButton, IconButtonGroup } from './Button';
|
|
19
4
|
import * as Icons from './icons';
|
|
@@ -35,9 +20,7 @@ const icons = Object.entries(Icons).reduce((acc, [name, IconComponent]) => {
|
|
|
35
20
|
acc[iconName] = IconComponent;
|
|
36
21
|
return acc;
|
|
37
22
|
}, {});
|
|
38
|
-
export const ContextMenu = ({ actions }) => (
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
React.createElement(Tooltip, { id: action.icon, place: "bottom" }, action.label)));
|
|
43
|
-
})));
|
|
23
|
+
export const ContextMenu = ({ actions }) => (_jsx(IconButtonGroup, Object.assign({ size: 32 }, { children: actions.map((action) => {
|
|
24
|
+
const Icon = icons[action.icon];
|
|
25
|
+
return (_jsxs(ContextMenuIconButton, Object.assign({ "data-tooltip-id": action.icon, onClick: action.action, className: action.selected ? 'selected' : '' }, { children: [_jsx(Icon, { width: 18, height: 18 }), _jsx(Tooltip, Object.assign({ id: action.icon, place: "bottom" }, { children: action.label }))] }), action.icon));
|
|
26
|
+
}) })));
|
|
@@ -1,62 +1,103 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
import
|
|
4
|
-
import
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
require('react-day-picker/style.css');
|
|
3
|
+
import { Popover, PopoverButton, PopoverPanel } from '@headlessui/react';
|
|
4
|
+
import { add, format, intervalToDuration, isValid } from 'date-fns';
|
|
5
|
+
import { useCallback, useEffect, useMemo, useState } from 'react';
|
|
6
|
+
import { DayPicker } from 'react-day-picker';
|
|
5
7
|
import styled from 'styled-components';
|
|
6
8
|
import { Category, Dialog, MessageContainer } from '../Dialog';
|
|
7
|
-
const
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
});
|
|
12
|
-
const calendarPotentialDueDate = (stepDueDate, dueDate, submissionDueDate) => {
|
|
9
|
+
const calendarPotentialDueDate = (stepDueDate, selectedDate, submissionDueDate) => {
|
|
10
|
+
if (!selectedDate || !isValid(selectedDate)) {
|
|
11
|
+
return null;
|
|
12
|
+
}
|
|
13
13
|
const duration = intervalToDuration({
|
|
14
14
|
start: stepDueDate,
|
|
15
|
-
end:
|
|
15
|
+
end: selectedDate,
|
|
16
16
|
});
|
|
17
17
|
return add(submissionDueDate, duration);
|
|
18
18
|
};
|
|
19
19
|
const calendarDatePickerDefaultDateFormat = 'd MMM, EEEE';
|
|
20
|
-
const CalendarDatePicker = ({
|
|
21
|
-
datePickerConfigs = Object.assign({ position: 'bottom', color: '#f2fbfc', selectedDayClassName: 'selected-day', calendarClassName: 'responsive-calendar' }, datePickerConfigs);
|
|
20
|
+
const CalendarDatePicker = ({ handleDateChange, originalDueDate, currentDueDate, dialogConfigs, primaryButtonTitle = 'Reschedule', secondaryButtonTitle = 'Cancel', buttonLabel = 'Change Date', }) => {
|
|
22
21
|
const dialog = Object.assign({}, dialogConfigs, {
|
|
23
22
|
header: 'Change the task due date?',
|
|
24
23
|
});
|
|
25
|
-
const [
|
|
24
|
+
const [selectedDay, setSelectedDay] = useState(currentDueDate);
|
|
25
|
+
const [potentialNewDate, setPotentialNewDate] = useState(undefined);
|
|
26
26
|
const [toggleDialog, setToggleDialog] = useState(false);
|
|
27
27
|
const onConfirmClick = useCallback(() => {
|
|
28
|
-
|
|
28
|
+
if (potentialNewDate) {
|
|
29
|
+
handleDateChange(potentialNewDate);
|
|
30
|
+
setSelectedDay(potentialNewDate);
|
|
31
|
+
}
|
|
29
32
|
setToggleDialog(false);
|
|
30
|
-
}, [
|
|
31
|
-
const
|
|
32
|
-
format(
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
33
|
+
}, [potentialNewDate, handleDateChange]);
|
|
34
|
+
const formattedPotentialDate = useMemo(() => potentialNewDate && isValid(potentialNewDate)
|
|
35
|
+
? format(potentialNewDate, calendarDatePickerDefaultDateFormat)
|
|
36
|
+
: 'Invalid Date', [potentialNewDate]);
|
|
37
|
+
const formattedPotentialDueDate = useMemo(() => {
|
|
38
|
+
const potentialDate = calendarPotentialDueDate(currentDueDate, potentialNewDate, originalDueDate);
|
|
39
|
+
return potentialDate && isValid(potentialDate)
|
|
40
|
+
? format(potentialDate, calendarDatePickerDefaultDateFormat)
|
|
41
|
+
: 'Calculation Error';
|
|
42
|
+
}, [originalDueDate, currentDueDate, potentialNewDate]);
|
|
43
|
+
const handleDaySelect = (date) => {
|
|
44
|
+
if (date) {
|
|
45
|
+
setPotentialNewDate(date);
|
|
46
|
+
setToggleDialog(true);
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
useEffect(() => {
|
|
50
|
+
setSelectedDay(currentDueDate);
|
|
51
|
+
}, [currentDueDate]);
|
|
52
|
+
return (_jsxs(_Fragment, { children: [_jsxs(Popover, { children: [_jsx(CalendarPopoverButton, { children: buttonLabel }), _jsx(CalendarPopoverPanel, { children: _jsx(DayPicker, { mode: "single", selected: selectedDay, onSelect: handleDaySelect, initialFocus: true }) })] }), _jsx(Dialog, { isOpen: toggleDialog, category: Category.confirmation, header: dialog.header, message: _jsxs(_Fragment, { children: [_jsx(UpdatedDueDate, { children: formattedPotentialDate }), dialog.dueDateMessage && (_jsx(DueDateMessage, { children: dialog.dueDateMessage })), _jsxs(Value, { children: [_jsx(StrikeDueDate, Object.assign({ as: 'del' }, { children: isValid(originalDueDate)
|
|
53
|
+
? format(originalDueDate, calendarDatePickerDefaultDateFormat)
|
|
54
|
+
: 'Invalid Original Date' })), formattedPotentialDueDate] })] }), actions: {
|
|
55
|
+
primary: {
|
|
56
|
+
action: onConfirmClick,
|
|
57
|
+
title: primaryButtonTitle,
|
|
58
|
+
},
|
|
59
|
+
secondary: {
|
|
60
|
+
action: () => setToggleDialog(false),
|
|
61
|
+
title: secondaryButtonTitle,
|
|
62
|
+
},
|
|
63
|
+
} })] }));
|
|
59
64
|
};
|
|
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
|
+
`;
|
|
60
101
|
const StrikeDueDate = styled(MessageContainer) `
|
|
61
102
|
margin: 0;
|
|
62
103
|
min-height: min-content;
|
|
@@ -69,41 +110,6 @@ const Value = styled.div `
|
|
|
69
110
|
align-items: center;
|
|
70
111
|
line-height: 1;
|
|
71
112
|
`;
|
|
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
|
-
`;
|
|
107
113
|
const UpdatedDueDate = styled.div `
|
|
108
114
|
background: ${(props) => props.theme.colors.background.secondary};
|
|
109
115
|
color: ${(props) => props.theme.colors.text.primary};
|
|
@@ -118,4 +124,4 @@ const DueDateMessage = styled(MessageContainer) `
|
|
|
118
124
|
min-height: min-content;
|
|
119
125
|
margin: ${(props) => props.theme.grid.unit * 6}px 0 0 0;
|
|
120
126
|
`;
|
|
121
|
-
export {
|
|
127
|
+
export { calendarPotentialDueDate, calendarDatePickerDefaultDateFormat, CalendarDatePicker, };
|
|
@@ -1,18 +1,3 @@
|
|
|
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
1
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
17
2
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
18
3
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
@@ -22,7 +7,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
22
7
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
23
8
|
});
|
|
24
9
|
};
|
|
25
|
-
import
|
|
10
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
11
|
+
import { useCallback, useEffect, useState } from 'react';
|
|
26
12
|
import styled from 'styled-components';
|
|
27
13
|
import { ButtonGroup, PrimaryButton, SecondaryButton } from './Button';
|
|
28
14
|
import { AttentionOrangeIcon, AttentionRedIcon } from './icons';
|
|
@@ -79,55 +65,25 @@ export var Category;
|
|
|
79
65
|
Category["confirmation"] = "confirmation";
|
|
80
66
|
Category["warning"] = "warning";
|
|
81
67
|
})(Category || (Category = {}));
|
|
82
|
-
const PrimaryAction = (props) => props.isDestructive ? (props.hasForm ? (
|
|
83
|
-
const SecondaryAction = (props) => (
|
|
84
|
-
export
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
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
|
-
}
|
|
68
|
+
const PrimaryAction = (props) => props.isDestructive ? (props.hasForm ? (_jsx(PrimaryButton, Object.assign({ disabled: props.disabled, form: "formDialog", type: "submit" }, { children: props.title }))) : (_jsx(PrimaryButton, Object.assign({ disabled: props.disabled, onClick: props.action, autoFocus: true }, { children: props.title })))) : props.hasForm ? (_jsx(PrimaryButton, Object.assign({ disabled: props.disabled, form: "formDialog", type: "submit" }, { children: props.title }))) : (_jsx(PrimaryButton, Object.assign({ disabled: props.disabled, onClick: props.action, autoFocus: true }, { children: props.title })));
|
|
69
|
+
const SecondaryAction = (props) => (_jsx(SecondaryButton, Object.assign({ disabled: props.disabled, onClick: props.action }, { children: props.title })));
|
|
70
|
+
export const Dialog = ({ actions, isOpen, header, message, category, children, confirmFieldText, className, }) => {
|
|
71
|
+
const [primaryActionDisabled, setPrimaryActionDisabled] = useState(true);
|
|
72
|
+
useEffect(() => {
|
|
73
|
+
setPrimaryActionDisabled(!!confirmFieldText);
|
|
74
|
+
}, [confirmFieldText]);
|
|
75
|
+
const checkInputValue = useCallback((event) => {
|
|
76
|
+
const testingVal = confirmFieldText && confirmFieldText.toUpperCase();
|
|
77
|
+
const target = event.target;
|
|
78
|
+
const newVal = target.value.toUpperCase();
|
|
79
|
+
setPrimaryActionDisabled(newVal !== testingVal);
|
|
80
|
+
}, [confirmFieldText]);
|
|
81
|
+
const handleSubmit = useCallback((e) => __awaiter(void 0, void 0, void 0, function* () {
|
|
82
|
+
e.preventDefault();
|
|
83
|
+
if (!primaryActionDisabled) {
|
|
84
|
+
actions.primary.action();
|
|
85
|
+
}
|
|
86
|
+
}), [primaryActionDisabled, actions.primary]);
|
|
87
|
+
const renderButtons = useCallback((disabled) => (_jsx(ButtonsContainer, { children: actions.secondary ? (!actions.primary.isDestructive ? (_jsxs(_Fragment, { children: [_jsx(SecondaryAction, { action: actions.secondary.action, hasForm: !!confirmFieldText, title: actions.secondary.title }), _jsx(PrimaryAction, { action: actions.primary.action, disabled: disabled, title: actions.primary.title || 'Dismiss' })] })) : (_jsxs(_Fragment, { children: [_jsx(PrimaryAction, { action: actions.primary.action, disabled: disabled, isDestructive: true, hasForm: !!confirmFieldText, title: actions.primary.title || 'Dismiss' }), _jsx(SecondaryAction, { action: actions.secondary.action, title: actions.secondary.title })] }))) : (_jsx(PrimaryAction, { action: actions.primary.action, disabled: disabled, isDestructive: actions.primary.isDestructive, hasForm: !!confirmFieldText, title: actions.primary.title || 'Dismiss' })) })), [actions, confirmFieldText]);
|
|
88
|
+
return (_jsx(StyledModal, Object.assign({ isOpen: isOpen, onRequestClose: actions.onClose, shouldCloseOnOverlayClick: true, className: className }, { children: _jsxs(DialogModalBody, { children: [_jsxs(HeaderContainer, { children: [category === Category.error && (_jsx(Icon, { children: _jsx(AttentionRedIcon, {}) })), category === Category.warning && (_jsx(Icon, { children: _jsx(AttentionOrangeIcon, {}) })), header] }), _jsxs(MessageContainer, { children: [message, confirmFieldText && (_jsx("form", Object.assign({ id: "formDialog", onSubmit: handleSubmit }, { children: _jsx(ConfirmationTextField, { autoFocus: true, onChange: checkInputValue, placeholder: 'Please type: ' + confirmFieldText, required: true }) }))), children] }), renderButtons(primaryActionDisabled)] }) })));
|
|
89
|
+
};
|