@simoncomputing/mui-bueno-v2 0.15.1 → 0.15.2

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,21 @@ 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.15.2] - 2025-07-16
15
+
16
+ ### Added
17
+
18
+ - `CitationField`/`CitationMenu`:
19
+ - Users can delete citation/attachment(s)
20
+ - Submit buttons when creating or updating citations & attachments will show loading indication while saving
21
+ - `LoadingButton`: Shows a loading spinner and disables itself when `loading` is true. Intended to be used with forms.
22
+
23
+ ### Fixed
24
+
25
+ - `CitationField`
26
+ - reposition citation bubble menu when an error appears/disappears to avoid the content from getting cut off
27
+ - ignore citation(s) that cannot be resolved (ids to citations that no longer exist). This will visually hide the citation links but the underlying HTML will still contain them, so the service should handle any manual cleanup if a citation is deleted but it is still being referenced in the `CitationField`.
28
+
14
29
  ## [0.15.1] - 2025-07-14
15
30
 
16
31
  ### Added
@@ -0,0 +1,11 @@
1
+ import { ButtonProps } from '../Button/Button';
2
+ import * as React from 'react';
3
+ export type LoadingButtonProps = Omit<ButtonProps, 'startIcon' | 'loading'> & {
4
+ loading?: boolean;
5
+ };
6
+ /**
7
+ * Button with a loading spinner. Automatically disables itself when loading.
8
+ *
9
+ * Intended to be used with forms, so the default type is `submit`.
10
+ */
11
+ export declare const LoadingButton: React.FC<LoadingButtonProps>;
@@ -2,7 +2,7 @@ import { Extension } from '@tiptap/core';
2
2
  import { CitationBubbleMenuProps } from './CitationMenu/CitationBubbleMenu';
3
3
  declare module '@tiptap/core' {
4
4
  interface Commands<ReturnType> {
5
- citation: {
5
+ citationBubbleMenu: {
6
6
  /**
7
7
  * Open/show the link bubble menu. Create a link if one doesn't exist at
8
8
  * the current cursor selection, or edit the existing link if there is
@@ -28,7 +28,7 @@ export type CitationBubbleMenuHandlerStorage = {
28
28
  isOpen: boolean;
29
29
  selectedIds: number[];
30
30
  bubbleMenuOptions: Partial<CitationBubbleMenuProps> | undefined;
31
- selectedNodePos: number | undefined;
31
+ selectedNodePos: number;
32
32
  };
33
33
  /**
34
34
  * To be used in conjunction with the `CitationBubbleMenuTipTap` component, as this
@@ -40,36 +40,37 @@ export type CitationFieldProps = {
40
40
  /**
41
41
  * API call for fetching paginated citations. These will populate the "Insert Citation/Attachment(s)" table.
42
42
  *
43
- * If an error occurs during the API call, notify the user then throw the error so that
44
- * Mui Bueno can handle updating state.
43
+ * Error handling is supported internally.
45
44
  */
46
45
  fetchExistingCitations: (req: PageState) => Promise<PageResponse<Citation>>;
47
46
  /**
48
47
  * API call for creating a new citation/attachment.
49
48
  *
50
- * If an error occurs during the API call, notify the user then throw the error so that
51
- * Mui Bueno can handle updating state.
49
+ * Error handling is supported internally.
52
50
  */
53
51
  onCreateCitation: (citation: UnsavedCitation) => Promise<Citation>;
54
52
  /**
55
53
  * API call for updating a citation/attachment.
56
54
  *
57
- * If an error occurs during the API call, notify the user then throw the error so that
58
- * Mui Bueno can handle updating state.
55
+ * Error handling is supported internally.
59
56
  */
60
57
  onUpdateCitation: (citation: Citation) => Promise<Citation>;
58
+ /**
59
+ * API call for updating a citation/attachment.
60
+ *
61
+ * Error handling is supported internally.
62
+ */
63
+ onDeleteCitation: (id: number) => Promise<void>;
61
64
  /**
62
65
  * API call for retrieving a citation by id
63
66
  *
64
- * If an error occurs during the API call, notify the user then throw the error so that
65
- * Mui Bueno can handle updating state.
67
+ * Error handling is supported internally.
66
68
  */
67
69
  getCitationById: (id: number) => Promise<Citation>;
68
70
  /**
69
71
  * API call for storing an attachment (ex. in an s3 bucket)
70
72
  *
71
- * If an error occurs during the API call, notify the user then throw the error so that
72
- * Mui Bueno can handle updating state.
73
+ * Error handling is supported internally.
73
74
  */
74
75
  onStoreAttachment: (citation: UnsavedAttachment) => Promise<Citation>;
75
76
  /**
@@ -3,6 +3,7 @@ interface SyncContextType {
3
3
  citations: Citation[];
4
4
  resync: () => void;
5
5
  addUpdateCitation: (citation: Citation) => void;
6
+ deleteCitation: (id: number) => void;
6
7
  }
7
8
  export declare const SyncContext: import('react').Context<SyncContextType | undefined>;
8
9
  export declare const useCitationSync: () => SyncContextType;
@@ -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({ fetchExistingCitations, onCreateCitation, onUpdateCitation, getCitationById, onStoreAttachment, ...controlledBubbleMenuProps }: CitationBubbleMenuProps): import("react/jsx-runtime").JSX.Element | null;
27
+ export default function CitationBubbleMenuTipTap({ fetchExistingCitations, onCreateCitation, onUpdateCitation, onDeleteCitation, getCitationById, onStoreAttachment, ...controlledBubbleMenuProps }: CitationBubbleMenuProps): import("react/jsx-runtime").JSX.Element | null;
@@ -12,6 +12,10 @@ export interface CitationMenuProps {
12
12
  * API call for updating a citation/attachment.
13
13
  */
14
14
  onUpdateCitation: (citation: Citation) => Promise<Citation>;
15
+ /**
16
+ * API call for deleting a citation/attachment.
17
+ */
18
+ onDeleteCitation: (id: number) => Promise<void>;
15
19
  /**
16
20
  * API call for retrieving a citation by id
17
21
  */
@@ -70,5 +74,5 @@ export declare enum CitationMenuState {
70
74
  *
71
75
  * Intended to be used within a bubble/pop-up/modal/dialog. For in-line citations, see CitationField instead.
72
76
  */
73
- export declare function CitationMenu({ fetchExistingCitations, onCreateCitation, onUpdateCitation, getCitationById, onStoreAttachment, onSelectCitations, onCancel, initialSelectedIds, onContentUpdate, onError, }: CitationMenuProps): import("react/jsx-runtime").JSX.Element;
77
+ export declare function CitationMenu({ fetchExistingCitations, onCreateCitation, onUpdateCitation, onDeleteCitation, getCitationById, onStoreAttachment, onSelectCitations, onCancel, initialSelectedIds, onContentUpdate, onError, }: CitationMenuProps): import("react/jsx-runtime").JSX.Element;
74
78
  export default CitationMenu;
@@ -1,10 +1,12 @@
1
1
  import { PageState, PageResponse, Citation } from '../../../../../@types';
2
+ import { CitationMenuError } from './CitationMenu';
2
3
  export type CitationTableProps = {
3
4
  onCancel: () => void;
4
5
  onNewCitation: () => void;
5
6
  onNewAttachment: () => void;
6
7
  onEditCitation: (citation: Citation) => void;
7
8
  onEditAttachment: (citation: Citation) => void;
9
+ onDeleteCitation: (id: number) => Promise<void>;
8
10
  onSelect: (selectedIds: number[]) => void;
9
11
  fetchExistingCitations: (req: PageState) => Promise<PageResponse<Citation>>;
10
12
  selectedIds: number[];
@@ -16,6 +18,7 @@ export type CitationTableProps = {
16
18
  * help debug issues so developers can see specific details about an error.
17
19
  */
18
20
  onError?: (err: string) => void;
21
+ setError: React.Dispatch<React.SetStateAction<CitationMenuError | undefined>>;
19
22
  };
20
23
  declare const CitationTable: (props: CitationTableProps) => import("react/jsx-runtime").JSX.Element;
21
24
  export default CitationTable;
@@ -1,2 +1,15 @@
1
1
  import { Node } from '@tiptap/core';
2
+ declare module '@tiptap/core' {
3
+ interface Commands<ReturnType = any> {
4
+ citation: {
5
+ insertCitation: (attrs: {
6
+ ids: number[];
7
+ }) => ReturnType;
8
+ updateCitation: (attrs: {
9
+ ids: number[];
10
+ }, pos: number) => ReturnType;
11
+ deleteCitation: (pos: number) => ReturnType;
12
+ };
13
+ }
14
+ }
2
15
  export declare const CitationNode: Node<any, any>;