@simoncomputing/mui-bueno-v2 0.17.5 → 0.18.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 CHANGED
@@ -11,6 +11,48 @@ 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.18.1] - 2025-09-23
15
+
16
+ ### Added
17
+
18
+ - `CitationManager` & `SelectableCitationManager`
19
+ - Added `addlActions` to allow additional actions to be provided. These will be added in between download icon button (if applicable) and edit icon button for each row.
20
+
21
+ ### Fixed
22
+
23
+ - `CitationManager` & `SelectableCitationManager`
24
+
25
+ - Fixed citation `type` showing attachment icon when `fileName` is null
26
+ - Fixed `url` displaying instead of `fileName` for attachments
27
+ - Fixed `accessedAt` displaying a value for attachments
28
+ - Fixed `classification` typo (which also fixes data population issue)
29
+
30
+ - `CitationManager`
31
+ - Fixed sizing of table title (h6 -> h2)
32
+
33
+ ## [0.18.0] - 2025-09-23
34
+
35
+ ### Added
36
+
37
+ - `TableColumn`
38
+ - Added `tableCellSx` styling `TableCell` in `Table` and/or `PaginatedTable`
39
+ - `CitationManager`:
40
+ - Basic table offering CRUD operations for citations. Replaces `CitationMenu`.
41
+ - `SelectableCitationManager`
42
+ - Condensed table offering CRUD operations for citations, including selecting citations. Intended to be used in modals/popups. Replaces `CitationMenu`.
43
+ - `CitationField`, `CitationManager`, `SelectableCitationManager`:
44
+ - added `onDownloadAttachment` prop to support downloading attachments
45
+
46
+ ### Changed
47
+
48
+ - `CitationField`, `CitationManager`, `SelectableCitationManager`:
49
+ - made `onDeleteCitation` prop optional
50
+
51
+ ### Removed
52
+
53
+ - `CitationMenu`
54
+ - Replaced with `CitationManager` & `SelectableCitationManager`. See `Added` section.
55
+
14
56
  ## [0.17.5] - 2025-09-22
15
57
 
16
58
  ### Added
@@ -113,6 +113,7 @@ export type EnvironmentInfo = {
113
113
  * within the object. isMobile in case your styling depends on whether the user is viewing
114
114
  * on a phone vs tablet/desktop
115
115
  * @property {string} sortName - (Optional) Passed instead of `fieldName` to onSortChange(fieldName, ...). Useful if you're rendering the same object in 2+ columns and need a way to differentiate when sorting.
116
+ * @property {SxProps<Theme>} tableCellSx - (Optional) styles applies to TableCell (non-mobile)
116
117
  */
117
118
  export type TableColumn<T, K extends keyof T> = {
118
119
  key?: string;
@@ -120,6 +121,7 @@ export type TableColumn<T, K extends keyof T> = {
120
121
  fieldName: K;
121
122
  render?: (value: T[K], object: T, isMobile: boolean) => React.ReactNode;
122
123
  sortName?: string;
124
+ tableCellSx?: SxProps<Theme>;
123
125
  };
124
126
 
125
127
  // Sort order for Tables
@@ -1,5 +1,5 @@
1
1
  import { Extension } from '@tiptap/core';
2
- import { CitationBubbleMenuProps } from './CitationMenu/CitationBubbleMenu';
2
+ import { CitationBubbleMenuProps } from './CitationManager/CitationBubbleMenu';
3
3
  declare module '@tiptap/core' {
4
4
  interface Commands<ReturnType> {
5
5
  citationBubbleMenu: {
@@ -60,13 +60,17 @@ export type CitationFieldProps = {
60
60
  *
61
61
  * Error handling is supported internally.
62
62
  */
63
- onDeleteCitation: (id: number) => Promise<void>;
63
+ onDeleteCitation?: (id: number) => Promise<void>;
64
64
  /**
65
65
  * API call for retrieving a citation by id
66
66
  *
67
67
  * Error handling is supported internally.
68
68
  */
69
69
  getCitationById: (id: number) => Promise<Citation>;
70
+ /**
71
+ * API call to download the attachment
72
+ */
73
+ onDownloadAttachment?: (citation: Citation) => Promise<void>;
70
74
  /**
71
75
  * Error callback.
72
76
  *
@@ -0,0 +1,13 @@
1
+ import { Citation, UnsavedAttachmentCitation } from '../../../../../@types';
2
+ import { CitationManagerError } from './CitationAlert';
3
+ export type AttachmentFormProps = {
4
+ id?: number;
5
+ title?: string;
6
+ onSave: (unsavedAttachment: UnsavedAttachmentCitation) => Promise<void>;
7
+ onCancel: () => void;
8
+ getCitationById: (id: number) => Promise<Citation>;
9
+ disableFileUpload?: boolean;
10
+ setError: React.Dispatch<React.SetStateAction<CitationManagerError | undefined>>;
11
+ };
12
+ declare const AttachmentForm: (props: AttachmentFormProps) => import("react/jsx-runtime").JSX.Element;
13
+ export default AttachmentForm;
@@ -1,5 +1,6 @@
1
1
  import { Citation, PageState, PageResponse, UnsavedCitation } from '../../../../../@types';
2
- export interface CitationMenuProps {
2
+ import { ReactNode } from 'react';
3
+ export interface BaseCitationManagerProps {
3
4
  /**
4
5
  * API call for fetching citations. These will populate the "Insert Citation/Attachment(s)" table.
5
6
  */
@@ -15,11 +16,15 @@ export interface CitationMenuProps {
15
16
  /**
16
17
  * API call for deleting a citation/attachment.
17
18
  */
18
- onDeleteCitation: (id: number) => Promise<void>;
19
+ onDeleteCitation?: (id: number) => Promise<void>;
19
20
  /**
20
21
  * API call for retrieving a citation by id
21
22
  */
22
23
  getCitationById: (id: number) => Promise<Citation>;
24
+ /**
25
+ * API call to download the attachment
26
+ */
27
+ onDownloadAttachment?: (citation: Citation) => Promise<void>;
23
28
  /**
24
29
  * Set which citations should be pre-checked in the citations table when this component is first rendered (used
25
30
  * to initialize useState).
@@ -53,17 +58,12 @@ export interface CitationMenuProps {
53
58
  * When false, teh table will be rendered as a basic paginated table with all columns displayed.
54
59
  */
55
60
  renderAsSelectablePopup?: boolean;
61
+ /**
62
+ * Additional actions to be displayed for each row. Will be inserted in between Download (if applicable) and Edit button.
63
+ */
64
+ addlActions?: (citation: Citation) => ReactNode;
56
65
  }
57
- /**
58
- * Error for CitationMenu
59
- * title = human-friendly/shortened version of the error (ex. "Failed to create citation")
60
- * err = the actual error thrown by the exception that was caught
61
- */
62
- export type CitationMenuError = {
63
- title: string;
64
- err: string;
65
- };
66
- export declare enum CitationMenuState {
66
+ export declare enum CitationManagerState {
67
67
  CITATIONS_TABLE = "Insert Citation/Attachment(s)",
68
68
  ADD_CITATION = "Add Citation",
69
69
  EDIT_CITATION = "Edit Citation",
@@ -71,9 +71,11 @@ export declare enum CitationMenuState {
71
71
  EDIT_ATTACHMENT = "Edit Attachment"
72
72
  }
73
73
  /**
74
- * CitationMenu handles creating, updating, and selecting citations.
74
+ * BaseCitationManager handles creating, updating, deleting, downloading and selecting citations.
75
+ *
76
+ * INTERNAL COMPONENT. Use wrapper instead: `SelectableCitationManager` or `CitationManager`
75
77
  *
76
- * Intended to be used within a bubble/pop-up/modal/dialog. For in-line citations, see CitationField instead.
78
+ * For in-line citations, see CitationField instead.
77
79
  */
78
- export declare function CitationMenu({ getCitationsPaginated, onCreateCitation, onUpdateCitation, onDeleteCitation, getCitationById, onSelectCitations, onCancel, initialSelectedIds, onContentChange, onError, renderAsSelectablePopup, }: CitationMenuProps): import("react/jsx-runtime").JSX.Element;
79
- export default CitationMenu;
80
+ export declare function BaseCitationManager({ getCitationsPaginated, onCreateCitation, onUpdateCitation, onDeleteCitation, getCitationById, onDownloadAttachment, onSelectCitations, onCancel, initialSelectedIds, onContentChange, onError, renderAsSelectablePopup, addlActions, }: BaseCitationManagerProps): import("react/jsx-runtime").JSX.Element;
81
+ export default BaseCitationManager;
@@ -1,15 +1,15 @@
1
1
  type Props = {
2
- error?: CitationMenuError;
3
- setError: React.Dispatch<React.SetStateAction<CitationMenuError | undefined>>;
2
+ error?: CitationManagerError;
3
+ setError: React.Dispatch<React.SetStateAction<CitationManagerError | undefined>>;
4
4
  success?: string;
5
5
  setSuccess: React.Dispatch<React.SetStateAction<string | undefined>>;
6
6
  };
7
7
  /**
8
- * Error for CitationMenu
8
+ * Error for BaseCitationManager, CitationManager & SelectableCitationManager
9
9
  * title = human-friendly/shortened version of the error (ex. "Failed to create citation")
10
10
  * err = the actual error thrown by the exception that was caught
11
11
  */
12
- export type CitationMenuError = {
12
+ export type CitationManagerError = {
13
13
  title: string;
14
14
  err: string;
15
15
  };
@@ -1,11 +1,11 @@
1
1
  import { Except } from 'type-fest';
2
2
  import { ControlledBubbleMenuProps } from 'mui-tiptap';
3
- import { CitationMenuProps } from './CitationMenu';
4
- export type CitationBubbleMenuProps = Partial<Except<ControlledBubbleMenuProps, 'open' | 'editor' | 'children'>> & Omit<CitationMenuProps, 'onCancel' | 'onSelectCitations'> & {
3
+ import { BaseCitationManagerProps } from './BaseCitationManager';
4
+ export type CitationBubbleMenuProps = Partial<Except<ControlledBubbleMenuProps, 'open' | 'editor' | 'children'>> & Omit<BaseCitationManagerProps, 'onCancel' | 'onSelectCitations'> & {
5
5
  onChanged?: (ids: number[]) => void;
6
6
  };
7
7
  /**
8
- * TipTap Wrapper for CitationMenu so that it renders as a bubble/pop-up menu integrated
8
+ * TipTap Wrapper for SelectableCitationManager so that it renders as a bubble/pop-up menu integrated
9
9
  * with TipTap
10
10
  *
11
11
  * A component that renders a bubble menu when viewing, creating, or editing a
@@ -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({ getCitationsPaginated, onCreateCitation, onUpdateCitation, onDeleteCitation, getCitationById, ...controlledBubbleMenuProps }: CitationBubbleMenuProps): import("react/jsx-runtime").JSX.Element | null;
27
+ export default function CitationBubbleMenuTipTap({ getCitationsPaginated, onCreateCitation, onUpdateCitation, onDeleteCitation, getCitationById, onDownloadAttachment, ...controlledBubbleMenuProps }: CitationBubbleMenuProps): import("react/jsx-runtime").JSX.Element | null;
@@ -1,12 +1,12 @@
1
1
  import { Citation, UnsavedUrlCitation } from '../../../../../@types';
2
- import { CitationMenuError } from './CitationMenu';
2
+ import { CitationManagerError } from './CitationAlert';
3
3
  export type CitationFormProps = {
4
4
  id?: number;
5
5
  title?: string;
6
6
  onSave: (unsavedUrl: UnsavedUrlCitation) => Promise<void>;
7
7
  onCancel: () => void;
8
8
  getCitationById: (id: number) => Promise<Citation>;
9
- setError: React.Dispatch<React.SetStateAction<CitationMenuError | undefined>>;
9
+ setError: React.Dispatch<React.SetStateAction<CitationManagerError | undefined>>;
10
10
  };
11
11
  declare const CitationForm: (props: CitationFormProps) => import("react/jsx-runtime").JSX.Element;
12
12
  export default CitationForm;
@@ -0,0 +1,7 @@
1
+ import { BaseCitationManagerProps } from './BaseCitationManager';
2
+ export type CitationManagerProps = Omit<BaseCitationManagerProps, 'initialSelectedIds' | 'onSelectCitations' | 'onCancel' | 'onContentChange' | 'renderAsSelectablePopup'>;
3
+ /**
4
+ * CitationManager is a basic table that handles creating, updating, and deleting citations.
5
+ */
6
+ export declare function CitationManager({ ...rest }: CitationManagerProps): import("react/jsx-runtime").JSX.Element;
7
+ export default CitationManager;
@@ -1,5 +1,6 @@
1
+ import { ReactNode } from 'react';
1
2
  import { PageState, PageResponse, Citation } from '../../../../../@types';
2
- import { CitationMenuError } from './CitationMenu';
3
+ import { CitationManagerError } from './CitationAlert';
3
4
  export type CitationTableProps = {
4
5
  title: string;
5
6
  onCancel: () => void;
@@ -7,7 +8,8 @@ export type CitationTableProps = {
7
8
  onNewAttachment: () => void;
8
9
  onEditCitation: (citation: Citation) => void;
9
10
  onEditAttachment: (citation: Citation) => void;
10
- onDeleteCitation: (id: number) => Promise<void>;
11
+ onDeleteCitation?: (id: number) => Promise<void>;
12
+ onDownloadAttachment?: (citation: Citation) => Promise<void>;
11
13
  onSelect: (selectedIds: number[]) => void;
12
14
  getCitationsPaginated: (req: PageState) => Promise<PageResponse<Citation>>;
13
15
  selectedIds: number[];
@@ -19,7 +21,7 @@ export type CitationTableProps = {
19
21
  * help debug issues so developers can see specific details about an error.
20
22
  */
21
23
  onError?: (err: string) => void;
22
- setError: React.Dispatch<React.SetStateAction<CitationMenuError | undefined>>;
24
+ setError: React.Dispatch<React.SetStateAction<CitationManagerError | undefined>>;
23
25
  setSuccess: React.Dispatch<React.SetStateAction<string | undefined>>;
24
26
  /**
25
27
  * When true, the Source, Accessed At & Classification columns will not be displayed
@@ -33,6 +35,10 @@ export type CitationTableProps = {
33
35
  * NOTE: add buttons will move to the bottom of the component, inline with the Select/Cancel buttons.
34
36
  */
35
37
  canSelect?: boolean;
38
+ /**
39
+ * Additional actions to be displayed for each row. Will be inserted in between Download (if applicable) and Edit button.
40
+ */
41
+ addlActions?: (citation: Citation) => ReactNode;
36
42
  };
37
43
  declare const CitationTable: (props: CitationTableProps) => import("react/jsx-runtime").JSX.Element;
38
44
  export default CitationTable;
@@ -0,0 +1,9 @@
1
+ import { BaseCitationManagerProps } from './BaseCitationManager';
2
+ export type SelectableCitationManagerProps = Omit<BaseCitationManagerProps, 'renderAsSelectablePopup'>;
3
+ /**
4
+ * SelectableCitationManager is a condensed table that handles creating, updating, deleting and selecting citations.
5
+ *
6
+ * It's intended to be used in a pop-up/modal.
7
+ */
8
+ export declare function SelectableCitationManager({ ...rest }: SelectableCitationManagerProps): import("react/jsx-runtime").JSX.Element;
9
+ export default SelectableCitationManager;