@simoncomputing/mui-bueno-v2 0.17.4 → 0.17.5

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 CHANGED
@@ -11,6 +11,13 @@ 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.5] - 2025-09-22
15
+
16
+ ### Added
17
+
18
+ - `CitationMenu`:
19
+ - added `renderAsSelectablePopup` prop
20
+
14
21
  ## [0.17.4] - 2025-09-16
15
22
 
16
23
  ### Changed
@@ -78,9 +78,11 @@ export type CitationFieldProps = {
78
78
  /**
79
79
  * Rich Text field -- uses MUI Tip Tap
80
80
  *
81
- * Formik -- This field cannot be completely controlled, so keep in mind that the Formik value will not update until the field
82
- * __loses focus__. This is to prevent issues with converting from rich text to HTML as the user types as it could override
83
- * their changes unintentionally.
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.
84
86
  */
85
87
  export declare const CitationField: (props: CitationFieldProps) => import("react/jsx-runtime").JSX.Element;
86
88
  export default CitationField;
@@ -1,9 +1,10 @@
1
1
  import { Citation } from '../../../../../@types';
2
2
  interface SyncContextType {
3
3
  citations: Citation[];
4
- resync: () => void;
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;
@@ -4,5 +4,14 @@ 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 {};
@@ -2,6 +2,7 @@ import { Citation, UnsavedAttachmentCitation } from '../../../../../@types';
2
2
  import { CitationMenuError } from './CitationMenu';
3
3
  export type NewAttachmentFormProps = {
4
4
  id?: number;
5
+ title?: string;
5
6
  onSave: (unsavedAttachment: UnsavedAttachmentCitation) => Promise<void>;
6
7
  onCancel: () => void;
7
8
  getCitationById: (id: number) => Promise<Citation>;
@@ -0,0 +1,17 @@
1
+ type Props = {
2
+ error?: CitationMenuError;
3
+ setError: React.Dispatch<React.SetStateAction<CitationMenuError | undefined>>;
4
+ success?: string;
5
+ setSuccess: React.Dispatch<React.SetStateAction<string | undefined>>;
6
+ };
7
+ /**
8
+ * Error for CitationMenu
9
+ * title = human-friendly/shortened version of the error (ex. "Failed to create citation")
10
+ * err = the actual error thrown by the exception that was caught
11
+ */
12
+ export type CitationMenuError = {
13
+ title: string;
14
+ err: string;
15
+ };
16
+ declare const CitationAlert: (props: Props) => import("react/jsx-runtime").JSX.Element;
17
+ export default CitationAlert;
@@ -2,6 +2,7 @@ import { Citation, UnsavedUrlCitation } from '../../../../../@types';
2
2
  import { CitationMenuError } from './CitationMenu';
3
3
  export type CitationFormProps = {
4
4
  id?: number;
5
+ title?: string;
5
6
  onSave: (unsavedUrl: UnsavedUrlCitation) => Promise<void>;
6
7
  onCancel: () => void;
7
8
  getCitationById: (id: number) => Promise<Citation>;
@@ -40,7 +40,7 @@ export interface CitationMenuProps {
40
40
  *
41
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")
42
42
  */
43
- onContentUpdate?: () => void;
43
+ onContentChange?: () => void;
44
44
  /**
45
45
  * Error callback.
46
46
  *
@@ -48,6 +48,11 @@ export interface CitationMenuProps {
48
48
  * help debug issues so developers can see specific details about an error.
49
49
  */
50
50
  onError?: (err: string) => void;
51
+ /**
52
+ * When true, the table will be rendered for pop-ups with the ability to select citations from the table.
53
+ * When false, teh table will be rendered as a basic paginated table with all columns displayed.
54
+ */
55
+ renderAsSelectablePopup?: boolean;
51
56
  }
52
57
  /**
53
58
  * Error for CitationMenu
@@ -70,5 +75,5 @@ export declare enum CitationMenuState {
70
75
  *
71
76
  * Intended to be used within a bubble/pop-up/modal/dialog. For in-line citations, see CitationField instead.
72
77
  */
73
- export declare function CitationMenu({ getCitationsPaginated, onCreateCitation, onUpdateCitation, onDeleteCitation, getCitationById, onSelectCitations, onCancel, initialSelectedIds, onContentUpdate, onError, }: CitationMenuProps): import("react/jsx-runtime").JSX.Element;
78
+ export declare function CitationMenu({ getCitationsPaginated, onCreateCitation, onUpdateCitation, onDeleteCitation, getCitationById, onSelectCitations, onCancel, initialSelectedIds, onContentChange, onError, renderAsSelectablePopup, }: CitationMenuProps): import("react/jsx-runtime").JSX.Element;
74
79
  export default CitationMenu;
@@ -1,6 +1,7 @@
1
1
  import { PageState, PageResponse, Citation } from '../../../../../@types';
2
2
  import { CitationMenuError } from './CitationMenu';
3
3
  export type CitationTableProps = {
4
+ title: string;
4
5
  onCancel: () => void;
5
6
  onNewCitation: () => void;
6
7
  onNewAttachment: () => void;
@@ -19,6 +20,19 @@ export type CitationTableProps = {
19
20
  */
20
21
  onError?: (err: string) => void;
21
22
  setError: React.Dispatch<React.SetStateAction<CitationMenuError | undefined>>;
23
+ setSuccess: React.Dispatch<React.SetStateAction<string | undefined>>;
24
+ /**
25
+ * When true, the Source, Accessed At & Classification columns will not be displayed
26
+ * to preserve horizontal space.
27
+ */
28
+ condenseTable?: boolean;
29
+ /**
30
+ * When true, first column will be checkboxes, allowing users to select citations.
31
+ *
32
+ * Select/Cancel buttons will appear at the bottom of the component.
33
+ * NOTE: add buttons will move to the bottom of the component, inline with the Select/Cancel buttons.
34
+ */
35
+ canSelect?: boolean;
22
36
  };
23
37
  declare const CitationTable: (props: CitationTableProps) => import("react/jsx-runtime").JSX.Element;
24
38
  export default CitationTable;