@simoncomputing/mui-bueno-v2 0.16.2 → 0.17.1
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/CHANGELOG.md +26 -0
- package/dist/@types/index.d.ts +10 -9
- package/dist/components/Form/Inputs/CitationField/CitationField.d.ts +8 -12
- package/dist/components/Form/Inputs/CitationField/CitationFieldContext/CitationFieldContext.d.ts +2 -1
- package/dist/components/Form/Inputs/CitationField/CitationFieldContext/CitationFieldProvider.d.ts +10 -1
- package/dist/components/Form/Inputs/CitationField/CitationMenu/AttachmentForm.d.ts +2 -2
- package/dist/components/Form/Inputs/CitationField/CitationMenu/CitationBubbleMenu.d.ts +1 -1
- package/dist/components/Form/Inputs/CitationField/CitationMenu/CitationForm.d.ts +2 -2
- package/dist/components/Form/Inputs/CitationField/CitationMenu/CitationMenu.d.ts +4 -8
- package/dist/components/Form/Inputs/CitationField/CitationMenu/CitationTable.d.ts +2 -1
- package/dist/index.cjs.js +92 -92
- package/dist/index.es.js +1909 -1898
- package/dist/index.umd.js +91 -91
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -11,6 +11,32 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
11
11
|
- Minor increment --> singlular/minor changes. Minimal breaking changes.
|
|
12
12
|
- Patch increment --> singlular/minor changes. Zero breaking changes.
|
|
13
13
|
|
|
14
|
+
## [0.17.1] - 2025-09-TBD
|
|
15
|
+
|
|
16
|
+
### Fixed
|
|
17
|
+
|
|
18
|
+
- `CitationField`:
|
|
19
|
+
- fixed "empty" node lingering after citation has been deleted
|
|
20
|
+
- fixed bubble menu getting cut off when going to different pages on the citation paginated table
|
|
21
|
+
|
|
22
|
+
### Changed
|
|
23
|
+
|
|
24
|
+
- `CitationFieldProvider` - optimized to only fetch citation data from API on initial load to reduce excessive API calls. As a compromise, paginated fetches made by the citation table in the `CitationField` bubble menu will automatically update any outdated citations in the provider's local citation list.
|
|
25
|
+
- `CitationMenu` - renamed `onContentUpdate` prop to `onContentChange`
|
|
26
|
+
|
|
27
|
+
## [0.17.0] - 2025-09-11
|
|
28
|
+
|
|
29
|
+
### Changed
|
|
30
|
+
|
|
31
|
+
- `CitationField`:
|
|
32
|
+
- Renamed `fetchExistingCitations` to `getCitationsPaginated`
|
|
33
|
+
- Renamed menu button to "Insert Citation/Attachments" (formerly "Insert Citation")
|
|
34
|
+
- `CitationFieldProvider`: Renamed `fetchExistingCitations` to `getCitations`
|
|
35
|
+
|
|
36
|
+
### Fixed
|
|
37
|
+
|
|
38
|
+
- `CitationField`: Fixed citation link not displaying initially for newly uploaded attachments.
|
|
39
|
+
|
|
14
40
|
## [0.16.2] - 2025-08-15
|
|
15
41
|
|
|
16
42
|
### Added
|
package/dist/@types/index.d.ts
CHANGED
|
@@ -164,7 +164,7 @@ export type CheckboxOption =
|
|
|
164
164
|
|
|
165
165
|
/**
|
|
166
166
|
* Used for CitationField
|
|
167
|
-
* Represents a citation (
|
|
167
|
+
* Represents a citation (url or attachment)
|
|
168
168
|
*/
|
|
169
169
|
export type Citation = {
|
|
170
170
|
id: number;
|
|
@@ -172,9 +172,13 @@ export type Citation = {
|
|
|
172
172
|
updatedBy?: number;
|
|
173
173
|
deletedBy?: number;
|
|
174
174
|
|
|
175
|
+
title: string;
|
|
176
|
+
|
|
177
|
+
// for attachments
|
|
175
178
|
fileName?: string;
|
|
179
|
+
|
|
180
|
+
// for urls
|
|
176
181
|
url?: string;
|
|
177
|
-
title: string;
|
|
178
182
|
source?: string; // publisher
|
|
179
183
|
accessedAt?: string | null;
|
|
180
184
|
classification?: string; // public, unclassified
|
|
@@ -186,12 +190,9 @@ export type Citation = {
|
|
|
186
190
|
*/
|
|
187
191
|
export type UnsavedCitation = {
|
|
188
192
|
id?: number;
|
|
193
|
+
type: 'Url' | 'Attachment';
|
|
194
|
+
file?: File;
|
|
189
195
|
} & Omit<Citation, 'id'>;
|
|
190
196
|
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
* Used to represent a (potentially) unsaved Attachment (same as UnsavedCitation but with a File obj)
|
|
194
|
-
*/
|
|
195
|
-
export type UnsavedAttachment = {
|
|
196
|
-
file?: File;
|
|
197
|
-
} & UnsavedCitation;
|
|
197
|
+
type UnsavedUrlCitation = Omit<UnsavedCitation, 'type'> & { type: 'Url' };
|
|
198
|
+
type UnsavedAttachmentCitation = Omit<UnsavedCitation, 'type'> & { type: 'Attachment' };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Citation, PageState, PageResponse, UnsavedCitation
|
|
1
|
+
import { Citation, PageState, PageResponse, UnsavedCitation } from '../../../../@types';
|
|
2
2
|
export type CitationFieldProps = {
|
|
3
3
|
/**
|
|
4
4
|
* Name and ID of the component. Must match a key from initialValues in Formik.
|
|
@@ -42,13 +42,13 @@ export type CitationFieldProps = {
|
|
|
42
42
|
*
|
|
43
43
|
* Error handling is supported internally.
|
|
44
44
|
*/
|
|
45
|
-
|
|
45
|
+
getCitationsPaginated: (req: PageState) => Promise<PageResponse<Citation>>;
|
|
46
46
|
/**
|
|
47
47
|
* API call for creating a new citation/attachment.
|
|
48
48
|
*
|
|
49
49
|
* Error handling is supported internally.
|
|
50
50
|
*/
|
|
51
|
-
onCreateCitation: (
|
|
51
|
+
onCreateCitation: (unsavedCitation: UnsavedCitation) => Promise<Citation>;
|
|
52
52
|
/**
|
|
53
53
|
* API call for updating a citation/attachment.
|
|
54
54
|
*
|
|
@@ -67,12 +67,6 @@ export type CitationFieldProps = {
|
|
|
67
67
|
* Error handling is supported internally.
|
|
68
68
|
*/
|
|
69
69
|
getCitationById: (id: number) => Promise<Citation>;
|
|
70
|
-
/**
|
|
71
|
-
* API call for storing an attachment (ex. in an s3 bucket)
|
|
72
|
-
*
|
|
73
|
-
* Error handling is supported internally.
|
|
74
|
-
*/
|
|
75
|
-
onStoreAttachment: (citation: UnsavedAttachment) => Promise<Citation>;
|
|
76
70
|
/**
|
|
77
71
|
* Error callback.
|
|
78
72
|
*
|
|
@@ -84,9 +78,11 @@ export type CitationFieldProps = {
|
|
|
84
78
|
/**
|
|
85
79
|
* Rich Text field -- uses MUI Tip Tap
|
|
86
80
|
*
|
|
87
|
-
*
|
|
88
|
-
*
|
|
89
|
-
*
|
|
81
|
+
* IMPORTANT: As per Mui TipTap's documentation, it's not efficient to use it as a fully controlled component since the
|
|
82
|
+
* editor content has to be serialized to HTML (which is what is stored in Formik). Therefore, keep in mind that what is
|
|
83
|
+
* shown in the editor will not match the Formik value until the field __loses focus__.
|
|
84
|
+
*
|
|
85
|
+
* Recommended to use with `CitationFieldProvider` for cross-field synchronization.
|
|
90
86
|
*/
|
|
91
87
|
export declare const CitationField: (props: CitationFieldProps) => import("react/jsx-runtime").JSX.Element;
|
|
92
88
|
export default CitationField;
|
package/dist/components/Form/Inputs/CitationField/CitationFieldContext/CitationFieldContext.d.ts
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { Citation } from '../../../../../@types';
|
|
2
2
|
interface SyncContextType {
|
|
3
3
|
citations: Citation[];
|
|
4
|
-
|
|
4
|
+
isLoaded: boolean;
|
|
5
5
|
addUpdateCitation: (citation: Citation) => void;
|
|
6
6
|
deleteCitation: (id: number) => void;
|
|
7
|
+
batchUpdate: (newCitations: Citation[]) => void;
|
|
7
8
|
}
|
|
8
9
|
export declare const SyncContext: import('react').Context<SyncContextType | undefined>;
|
|
9
10
|
export declare const useCitationSync: () => SyncContextType;
|
package/dist/components/Form/Inputs/CitationField/CitationFieldContext/CitationFieldProvider.d.ts
CHANGED
|
@@ -2,7 +2,16 @@ import { default as React } from 'react';
|
|
|
2
2
|
import { Citation } from '../../../../../@types';
|
|
3
3
|
type CitationFieldProviderProps = {
|
|
4
4
|
children: React.ReactNode;
|
|
5
|
-
|
|
5
|
+
getCitations: () => Promise<Citation[]>;
|
|
6
6
|
};
|
|
7
|
+
/**
|
|
8
|
+
* CitationFieldProvider ensures `CitationField` stays in sync with other `CitationField` components. Always
|
|
9
|
+
* use when multiple `CitationField` components are on the same page.
|
|
10
|
+
*
|
|
11
|
+
* NOTE: The provider is optimized to reduce excessive API calls. Currently, it will only perform the inital full
|
|
12
|
+
* data fetch on initial load. Subsequent changes are updated locally based on what add/update/delete actions
|
|
13
|
+
* are made by the user, but any remote additions/updates/deletions will not be fetched. Keep this in mind when
|
|
14
|
+
* deciding what level to place the provider in your app so that you can control how often the provider is initialized.
|
|
15
|
+
*/
|
|
7
16
|
export declare const CitationFieldProvider: React.FC<CitationFieldProviderProps>;
|
|
8
17
|
export {};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { Citation,
|
|
1
|
+
import { Citation, UnsavedAttachmentCitation } from '../../../../../@types';
|
|
2
2
|
import { CitationMenuError } from './CitationMenu';
|
|
3
3
|
export type NewAttachmentFormProps = {
|
|
4
4
|
id?: number;
|
|
5
|
-
onSave: (
|
|
5
|
+
onSave: (unsavedAttachment: UnsavedAttachmentCitation) => Promise<void>;
|
|
6
6
|
onCancel: () => void;
|
|
7
7
|
getCitationById: (id: number) => Promise<Citation>;
|
|
8
8
|
disableFileUpload?: boolean;
|
|
@@ -24,4 +24,4 @@ export type CitationBubbleMenuProps = Partial<Except<ControlledBubbleMenuProps,
|
|
|
24
24
|
* update, which will happen if it's a child of the component using
|
|
25
25
|
* `useEditor`).
|
|
26
26
|
*/
|
|
27
|
-
export default function CitationBubbleMenuTipTap({
|
|
27
|
+
export default function CitationBubbleMenuTipTap({ getCitationsPaginated, onCreateCitation, onUpdateCitation, onDeleteCitation, getCitationById, ...controlledBubbleMenuProps }: CitationBubbleMenuProps): import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { Citation,
|
|
1
|
+
import { Citation, UnsavedUrlCitation } from '../../../../../@types';
|
|
2
2
|
import { CitationMenuError } from './CitationMenu';
|
|
3
3
|
export type CitationFormProps = {
|
|
4
4
|
id?: number;
|
|
5
|
-
onSave: (
|
|
5
|
+
onSave: (unsavedUrl: UnsavedUrlCitation) => Promise<void>;
|
|
6
6
|
onCancel: () => void;
|
|
7
7
|
getCitationById: (id: number) => Promise<Citation>;
|
|
8
8
|
setError: React.Dispatch<React.SetStateAction<CitationMenuError | undefined>>;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { Citation, PageState, PageResponse, UnsavedCitation
|
|
1
|
+
import { Citation, PageState, PageResponse, UnsavedCitation } from '../../../../../@types';
|
|
2
2
|
export interface CitationMenuProps {
|
|
3
3
|
/**
|
|
4
4
|
* API call for fetching citations. These will populate the "Insert Citation/Attachment(s)" table.
|
|
5
5
|
*/
|
|
6
|
-
|
|
6
|
+
getCitationsPaginated: (req: PageState) => Promise<PageResponse<Citation>>;
|
|
7
7
|
/**
|
|
8
8
|
* API call for creating a new citation/attachment.
|
|
9
9
|
*/
|
|
@@ -20,10 +20,6 @@ export interface CitationMenuProps {
|
|
|
20
20
|
* API call for retrieving a citation by id
|
|
21
21
|
*/
|
|
22
22
|
getCitationById: (id: number) => Promise<Citation>;
|
|
23
|
-
/**
|
|
24
|
-
* API call for storing an attachment (ex. in an s3 bucket)
|
|
25
|
-
*/
|
|
26
|
-
onStoreAttachment: (citation: UnsavedAttachment) => Promise<Citation>;
|
|
27
23
|
/**
|
|
28
24
|
* Set which citations should be pre-checked in the citations table when this component is first rendered (used
|
|
29
25
|
* to initialize useState).
|
|
@@ -44,7 +40,7 @@ export interface CitationMenuProps {
|
|
|
44
40
|
*
|
|
45
41
|
* Currently, this will be called when the data in the citations table changes, and when the content itself changes (ex. clicks on "Add Citation")
|
|
46
42
|
*/
|
|
47
|
-
|
|
43
|
+
onContentChange?: () => void;
|
|
48
44
|
/**
|
|
49
45
|
* Error callback.
|
|
50
46
|
*
|
|
@@ -74,5 +70,5 @@ export declare enum CitationMenuState {
|
|
|
74
70
|
*
|
|
75
71
|
* Intended to be used within a bubble/pop-up/modal/dialog. For in-line citations, see CitationField instead.
|
|
76
72
|
*/
|
|
77
|
-
export declare function CitationMenu({
|
|
73
|
+
export declare function CitationMenu({ getCitationsPaginated, onCreateCitation, onUpdateCitation, onDeleteCitation, getCitationById, onSelectCitations, onCancel, initialSelectedIds, onContentChange, onError, }: CitationMenuProps): import("react/jsx-runtime").JSX.Element;
|
|
78
74
|
export default CitationMenu;
|
|
@@ -8,7 +8,7 @@ export type CitationTableProps = {
|
|
|
8
8
|
onEditAttachment: (citation: Citation) => void;
|
|
9
9
|
onDeleteCitation: (id: number) => Promise<void>;
|
|
10
10
|
onSelect: (selectedIds: number[]) => void;
|
|
11
|
-
|
|
11
|
+
getCitationsPaginated: (req: PageState) => Promise<PageResponse<Citation>>;
|
|
12
12
|
selectedIds: number[];
|
|
13
13
|
setSelectedIds: React.Dispatch<React.SetStateAction<number[]>>;
|
|
14
14
|
/**
|
|
@@ -19,6 +19,7 @@ export type CitationTableProps = {
|
|
|
19
19
|
*/
|
|
20
20
|
onError?: (err: string) => void;
|
|
21
21
|
setError: React.Dispatch<React.SetStateAction<CitationMenuError | undefined>>;
|
|
22
|
+
setSuccess: React.Dispatch<React.SetStateAction<string | undefined>>;
|
|
22
23
|
};
|
|
23
24
|
declare const CitationTable: (props: CitationTableProps) => import("react/jsx-runtime").JSX.Element;
|
|
24
25
|
export default CitationTable;
|