@manuscripts/style-guide 1.13.12-LEAN-3771.0 → 1.13.12-LEAN-3645

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (68) hide show
  1. package/dist/cjs/components/FileManager/FileActions.js +134 -0
  2. package/dist/cjs/components/FileManager/FileContainer.js +39 -0
  3. package/dist/cjs/components/FileManager/FileCreatedDate.js +25 -0
  4. package/dist/cjs/components/FileManager/FileManager.js +60 -0
  5. package/dist/cjs/components/FileManager/FileManagerDragLayer.js +55 -0
  6. package/dist/cjs/components/FileManager/FileManagerProvider.js +39 -0
  7. package/dist/cjs/components/FileManager/FileName.js +27 -0
  8. package/dist/cjs/components/FileManager/FileSectionAlert.js +170 -0
  9. package/dist/cjs/components/FileManager/FileTypeIcon.js +20 -0
  10. package/dist/cjs/components/FileManager/FileUploader.js +85 -0
  11. package/dist/cjs/components/FileManager/InlineFilesSection.js +133 -0
  12. package/dist/cjs/components/FileManager/OtherFilesSection.js +101 -0
  13. package/dist/cjs/components/FileManager/SupplementsSection.js +118 -0
  14. package/dist/cjs/components/FileManager/index.js +32 -0
  15. package/dist/cjs/components/FileManager/util.js +138 -0
  16. package/dist/cjs/components/{TableFootnotesSelector.js → FootnotesSelector.js} +7 -7
  17. package/dist/cjs/components/InsertTableDialog.js +130 -0
  18. package/dist/cjs/components/Menus/Menus.js +19 -2
  19. package/dist/cjs/hooks/use-files.js +39 -0
  20. package/dist/cjs/hooks/use-menus.js +2 -2
  21. package/dist/cjs/index.js +5 -1
  22. package/dist/cjs/lib/files.js +77 -125
  23. package/dist/es/components/FileManager/FileActions.js +104 -0
  24. package/dist/es/components/FileManager/FileContainer.js +33 -0
  25. package/dist/es/components/FileManager/FileCreatedDate.js +18 -0
  26. package/dist/es/components/FileManager/FileManager.js +33 -0
  27. package/dist/es/components/FileManager/FileManagerDragLayer.js +48 -0
  28. package/dist/es/components/FileManager/FileManagerProvider.js +12 -0
  29. package/dist/es/components/FileManager/FileName.js +20 -0
  30. package/dist/es/components/FileManager/FileSectionAlert.js +163 -0
  31. package/dist/es/components/FileManager/FileTypeIcon.js +13 -0
  32. package/dist/es/components/FileManager/FileUploader.js +58 -0
  33. package/dist/es/components/FileManager/InlineFilesSection.js +103 -0
  34. package/dist/es/components/FileManager/OtherFilesSection.js +74 -0
  35. package/dist/es/components/FileManager/SupplementsSection.js +91 -0
  36. package/dist/es/components/FileManager/index.js +16 -0
  37. package/dist/es/components/FileManager/util.js +128 -0
  38. package/dist/es/components/{TableFootnotesSelector.js → FootnotesSelector.js} +5 -5
  39. package/dist/es/components/InsertTableDialog.js +100 -0
  40. package/dist/es/components/Menus/Menus.js +19 -2
  41. package/dist/es/hooks/use-files.js +35 -0
  42. package/dist/es/hooks/use-menus.js +2 -2
  43. package/dist/es/index.js +5 -1
  44. package/dist/es/lib/files.js +73 -117
  45. package/dist/types/components/FileManager/FileActions.d.ts +19 -0
  46. package/dist/types/components/FileManager/FileContainer.d.ts +1 -0
  47. package/dist/types/components/FileManager/FileCreatedDate.d.ts +8 -0
  48. package/dist/types/components/FileManager/FileManager.d.ts +30 -0
  49. package/dist/types/components/FileManager/FileManagerDragLayer.d.ts +2 -0
  50. package/dist/types/components/FileManager/FileManagerProvider.d.ts +15 -0
  51. package/dist/types/components/FileManager/FileName.d.ts +6 -0
  52. package/dist/types/components/FileManager/FileSectionAlert.d.ts +13 -0
  53. package/dist/types/components/FileManager/FileTypeIcon.d.ts +5 -0
  54. package/dist/types/components/FileManager/FileUploader.d.ts +5 -0
  55. package/dist/types/components/FileManager/InlineFilesSection.d.ts +6 -0
  56. package/dist/types/components/FileManager/OtherFilesSection.d.ts +5 -0
  57. package/dist/types/components/FileManager/SupplementsSection.d.ts +5 -0
  58. package/dist/types/components/FileManager/index.d.ts +16 -0
  59. package/dist/types/components/FileManager/util.d.ts +25 -0
  60. package/dist/types/components/{TableFootnotesSelector.d.ts → FootnotesSelector.d.ts} +2 -1
  61. package/dist/types/components/InsertTableDialog.d.ts +22 -0
  62. package/dist/types/components/Menus/Menus.d.ts +2 -2
  63. package/dist/types/hooks/use-files.d.ts +8 -0
  64. package/dist/types/hooks/use-menus.d.ts +2 -2
  65. package/dist/types/index.d.ts +5 -1
  66. package/dist/types/lib/files.d.ts +24 -19
  67. package/dist/types/lib/menus.d.ts +6 -1
  68. package/package.json +2 -2
@@ -0,0 +1,15 @@
1
+ import { Model } from '@manuscripts/json-schema';
2
+ import React from 'react';
3
+ import { DeleteModel, FileManagement, SaveModel } from './FileManager';
4
+ export declare const FileManagerContext: React.Context<{
5
+ saveModel: SaveModel;
6
+ deleteModel: DeleteModel;
7
+ modelMap: Map<string, Model>;
8
+ fileManagement: FileManagement;
9
+ }>;
10
+ export declare const FileManagerProvider: React.FC<{
11
+ saveModel: SaveModel;
12
+ deleteModel: DeleteModel;
13
+ modelMap: Map<string, Model>;
14
+ fileManagement: FileManagement;
15
+ }>;
@@ -0,0 +1,6 @@
1
+ import React from 'react';
2
+ import { FileAttachment } from '../../lib/files';
3
+ export declare const FileName: React.FC<{
4
+ file: FileAttachment;
5
+ }>;
6
+ export declare const FileNameText: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
@@ -0,0 +1,13 @@
1
+ import React from 'react';
2
+ export declare enum FileSectionAlertType {
3
+ NONE = 0,
4
+ UPLOAD_IN_PROGRESS = 1,
5
+ UPLOAD_SUCCESSFUL = 2,
6
+ MOVE_SUCCESSFUL = 3
7
+ }
8
+ export declare const FileSectionAlert: React.FC<{
9
+ alert: {
10
+ type: FileSectionAlertType;
11
+ message: string;
12
+ };
13
+ }>;
@@ -0,0 +1,5 @@
1
+ import React from 'react';
2
+ import { FileAttachment } from '../../lib/files';
3
+ export declare const FileTypeIcon: React.FC<{
4
+ file: FileAttachment;
5
+ }>;
@@ -0,0 +1,5 @@
1
+ import React from 'react';
2
+ export interface FileUploaderProps {
3
+ onUpload: (file: File) => void;
4
+ }
5
+ export declare const FileUploader: React.FC<FileUploaderProps>;
@@ -0,0 +1,6 @@
1
+ import React from 'react';
2
+ import { ElementFiles } from '../../lib/files';
3
+ export declare const InlineFilesSection: React.FC<{
4
+ elements: ElementFiles[];
5
+ isEditor: boolean;
6
+ }>;
@@ -0,0 +1,5 @@
1
+ import React from 'react';
2
+ import { FileAttachment } from '../../lib/files';
3
+ export declare const OtherFilesSection: React.FC<{
4
+ files: FileAttachment[];
5
+ }>;
@@ -0,0 +1,5 @@
1
+ import React from 'react';
2
+ import { ModelFile } from '../../lib/files';
3
+ export declare const SupplementsSection: React.FC<{
4
+ supplements: ModelFile[];
5
+ }>;
@@ -0,0 +1,16 @@
1
+ /*!
2
+ * © 2020 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
+ export * from './FileManager';
@@ -0,0 +1,25 @@
1
+ /// <reference types="react" />
2
+ import { FileAttachment } from '../../lib/files';
3
+ export declare enum FileSectionType {
4
+ Inline = "Inline files",
5
+ Supplements = "Supplements",
6
+ OtherFile = "Other files"
7
+ }
8
+ export declare enum FileType {
9
+ Image = 0,
10
+ Audio = 1,
11
+ Video = 2,
12
+ PlainDocument = 3,
13
+ SheetsWorkbooks = 4,
14
+ Latex = 5,
15
+ CodeFile = 6,
16
+ PdfFile = 7,
17
+ CompressedFile = 8,
18
+ PlainText = 9,
19
+ Figure = 10,
20
+ GraphicalAbstract = 11
21
+ }
22
+ export declare const getFileType: (file: FileAttachment) => FileType | undefined;
23
+ export declare const getFileIcon: (file: FileAttachment) => JSX.Element | undefined;
24
+ export declare const getFileTypeIcon: (type: FileType) => JSX.Element | undefined;
25
+ export declare const isImageFile: (file: FileAttachment) => boolean;
@@ -19,10 +19,11 @@ export type FootnoteWithIndex = {
19
19
  node: FootnoteNode;
20
20
  index?: string;
21
21
  };
22
- export declare const TableFootnotesSelector: React.FC<{
22
+ export declare const FootnotesSelector: React.FC<{
23
23
  notes: FootnoteWithIndex[];
24
24
  inlineFootnote?: InlineFootnoteNode;
25
25
  onAdd: () => void;
26
26
  onInsert: (notes: FootnoteWithIndex[]) => void;
27
27
  onCancel: () => void;
28
+ addNewLabel?: string;
28
29
  }>;
@@ -0,0 +1,22 @@
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';
17
+ import { TableConfig } from '../lib/menus';
18
+ export declare const InsertTableDialog: React.FC<{
19
+ run: (tableConfig: TableConfig) => void;
20
+ open: boolean;
21
+ onClose: () => void;
22
+ }>;
@@ -14,11 +14,11 @@
14
14
  * limitations under the License.
15
15
  */
16
16
  import React, { Ref } from 'react';
17
- import { Menu } from '../../lib/menus';
17
+ import { Menu, TableConfig } from '../../lib/menus';
18
18
  interface MenusProps {
19
19
  menus: Menu[];
20
20
  innerRef: Ref<HTMLDivElement>;
21
- handleClick: (position: number[]) => void;
21
+ handleClick: (position: number[], tableConfig?: TableConfig) => void;
22
22
  }
23
23
  export declare const Menus: React.FC<MenusProps>;
24
24
  export declare const orderedListContextMenu: {
@@ -0,0 +1,8 @@
1
+ import { Model } from '@manuscripts/json-schema';
2
+ import { ElementFiles, FileAttachment, ModelFile } from '../lib/files';
3
+ export declare const useFiles: (modelMap: Map<string, Model>, files: FileAttachment[]) => {
4
+ inlineFiles: ElementFiles[];
5
+ supplements: ModelFile[];
6
+ otherFiles: FileAttachment[];
7
+ };
8
+ export default useFiles;
@@ -1,7 +1,7 @@
1
1
  /// <reference types="react" />
2
- import { Menu, MenuSpec } from '../lib/menus';
2
+ import { Menu, MenuSpec, TableConfig } from '../lib/menus';
3
3
  export declare const useMenus: (menus: MenuSpec[]) => {
4
4
  menus: Menu[];
5
- handleClick: (indices: number[]) => void;
5
+ handleClick: (indices: number[], tableConfig?: TableConfig) => void;
6
6
  ref: import("react").RefObject<HTMLDivElement>;
7
7
  };
@@ -21,12 +21,15 @@ export * from './components/RadioButton';
21
21
  export * from './components/AutoSaveInput';
22
22
  export * from './components/Avatar';
23
23
  export * from './components/Dialog';
24
+ export * from './components/InsertTableDialog';
24
25
  export * from './components/Checkbox';
25
26
  export * from './components/Form';
27
+ export * from './components/FileManager';
28
+ export * from './components/FileManager/util';
26
29
  export * from './components/Resizer';
27
30
  export * from './components/SaveStatus';
28
31
  export * from './components/StyledModal';
29
- export * from './components/TableFootnotesSelector';
32
+ export * from './components/FootnotesSelector';
30
33
  export * from './components/Sidebar';
31
34
  export * from './components/RichText';
32
35
  export * from './components/TextField';
@@ -47,6 +50,7 @@ export * from './components/RelativeDate';
47
50
  export * from './components/Menus';
48
51
  export * from './components/SelectField';
49
52
  export * from './hooks/use-dropdown';
53
+ export * from './hooks/use-files';
50
54
  export * from './hooks/use-menus';
51
55
  export * from './hooks/use-scroll-detection';
52
56
  export { useDeepCompareMemo, useDeepCompareCallback, } from './hooks/use-deep-compare';
@@ -1,19 +1,24 @@
1
- /// <reference types="react" />
2
- export declare enum FileType {
3
- Image = 0,
4
- Audio = 1,
5
- Video = 2,
6
- PlainDocument = 3,
7
- SheetsWorkbooks = 4,
8
- Latex = 5,
9
- CodeFile = 6,
10
- PdfFile = 7,
11
- CompressedFile = 8,
12
- PlainText = 9,
13
- Figure = 10,
14
- GraphicalAbstract = 11
15
- }
16
- export declare const getFileType: (name: string) => FileType | undefined;
17
- export declare const getFileIcon: (name: string) => JSX.Element | undefined;
18
- export declare const getFileTypeIcon: (type: FileType) => JSX.Element | undefined;
19
- export declare const isImageFile: (name: string) => boolean;
1
+ import { Model } from '@manuscripts/json-schema';
2
+ import { FileType } from '../components/FileManager/util';
3
+ export type FileDesignation = {
4
+ id: string;
5
+ label?: string;
6
+ };
7
+ export type FileAttachment = {
8
+ id: string;
9
+ name: string;
10
+ type: FileDesignation;
11
+ createdDate?: Date;
12
+ };
13
+ export type ModelFile = FileAttachment & {
14
+ modelId: string;
15
+ };
16
+ export type ElementFiles = {
17
+ modelId: string;
18
+ label: string;
19
+ type: FileType;
20
+ files: ModelFile[];
21
+ };
22
+ export declare const isModelFile: (file: FileAttachment) => file is ModelFile;
23
+ export declare const getInlineFiles: (modelMap: Map<string, Model>, files: FileAttachment[]) => ElementFiles[];
24
+ export declare const getSupplements: (modelMap: Map<string, Model>, files: FileAttachment[]) => ModelFile[];
@@ -19,6 +19,11 @@ export interface MenuShortcut {
19
19
  mac: string;
20
20
  pc: string;
21
21
  }
22
+ export type TableConfig = {
23
+ numberOfColumns: number;
24
+ numberOfRows: number;
25
+ includeHeader: boolean;
26
+ };
22
27
  export interface MenuSpec {
23
28
  id: string;
24
29
  label: string;
@@ -26,7 +31,7 @@ export interface MenuSpec {
26
31
  shortcut?: MenuShortcut;
27
32
  isActive?: boolean;
28
33
  isEnabled: boolean;
29
- run?: () => void;
34
+ run?: (tableConfig?: TableConfig) => void;
30
35
  submenu?: (MenuSpec | MenuSeparator)[];
31
36
  options?: {
32
37
  [key: string]: () => void;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@manuscripts/style-guide",
3
3
  "description": "Shared components for Manuscripts applications",
4
- "version": "1.13.12-LEAN-3771.0",
4
+ "version": "1.13.12-LEAN-3645",
5
5
  "repository": "github:Atypon-OpenSource/manuscripts-style-guide",
6
6
  "license": "Apache-2.0",
7
7
  "main": "dist/cjs",
@@ -109,4 +109,4 @@
109
109
  "@types/react": "^17.0.2",
110
110
  "jackspeak": "2.1.1"
111
111
  }
112
- }
112
+ }