@simoncomputing/mui-bueno-v2 0.25.2 → 0.25.4

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,27 @@ 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.25.4] - 2026-02-09
15
+
16
+ ### Added
17
+
18
+ - `DiffProvider`
19
+ - Added `getCurrentValue` to `useDiff`. Define `currentSnapshot` prop to use.
20
+ - Renamed `getSnapshotValue` to `getPreviousValue`
21
+ - If nothing is passed to `getCurrentValue`/`getPreviousValue`, the original value (`previousSnapshot`/`currentSnapshot`) will be returned
22
+ - Added 2nd param to `getCurrentValue`/`getPreviousValue` for the default value (recommended for arrays).
23
+
24
+ ## [0.25.3] - 2026-02-06
25
+
26
+ ### Added
27
+
28
+ - `DiffTable`
29
+ - Added `renderExpand` prop from `Table`
30
+ - `ReadOnly`/`Diff`
31
+ - Added new mode "comma". See `MultiAutocomplete` for an example.
32
+ - `MultiAutocomplete`
33
+ - Added support for `DiffProvider` & `ReadOnlyProvider`
34
+
14
35
  ## [0.25.2] - 2026-02-05
15
36
 
16
37
  ### Changed
@@ -1,4 +1,4 @@
1
- export type DiffMode = 'word' | 'sentence' | 'html';
1
+ export type DiffMode = 'word' | 'sentence' | 'html' | 'comma';
2
2
  export type DiffProps = {
3
3
  beforeTxt?: string;
4
4
  afterTxt?: string;
@@ -6,6 +6,7 @@ export type DiffProps = {
6
6
  * word - use word-based diff
7
7
  * sentence - use sentence-based diff
8
8
  * html - use HTML-based diff
9
+ * comma - use comma-based diff
9
10
  *
10
11
  * @default sentence
11
12
  */
@@ -4,16 +4,26 @@ type DiffContextValue = {
4
4
  */
5
5
  showDiff: boolean;
6
6
  /**
7
- * Obtains the snapshot value from `previousSnapshot`.
7
+ * Obtains the previous value from `previousSnapshot`.
8
8
  *
9
- * @param name - formik field name
9
+ * @param name - formik field name (leave out to get full object)
10
+ * @param defaultVal - default value if undefined (ex. fallback array to [])
10
11
  * @returns value in previousSnapshot (ex. name='phone' could return "999-123-1234")
11
12
  */
12
- getSnapshotValue: (name: string) => any;
13
+ getPreviousValue: (name?: string, defaultVal?: any) => any;
14
+ /**
15
+ * Obtains the current value from `currentSnapshot` (alternative to getting the value directly form formik)
16
+ *
17
+ * @param name - formik field name (leave out to get full object)
18
+ * @param defaultVal - default value if undefined (ex. fallback array to [])
19
+ * @returns value in currentSnapshot (ex. name='phone' could return "999-123-1234")
20
+ */
21
+ getCurrentValue: (name?: string, defaultVal?: any) => any;
13
22
  };
14
23
  type DiffProviderProps = {
15
24
  showDiff?: boolean;
16
25
  previousSnapshot?: any;
26
+ currentSnapshot?: any;
17
27
  children: React.ReactNode;
18
28
  };
19
29
  /**
@@ -21,7 +31,8 @@ type DiffProviderProps = {
21
31
  *
22
32
  * @param showDiff - when true (default), enables text diff. Set to false to return form to normal.
23
33
  * @param previousSnapshot - previous snapshot. This should match the same stucture as your fields (i.e. formik initialValues)
34
+ * @param currentSnapshot - current snapshot. This should match the same structure as `previousSnapshot`
24
35
  */
25
- export declare const DiffProvider: ({ showDiff, previousSnapshot, children }: DiffProviderProps) => import("react/jsx-runtime").JSX.Element;
36
+ export declare const DiffProvider: ({ showDiff, previousSnapshot, currentSnapshot, children, }: DiffProviderProps) => import("react/jsx-runtime").JSX.Element;
26
37
  export declare const useDiff: () => DiffContextValue;
27
38
  export {};
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * Base props for ALL inputs
3
3
  *
4
- * TODO: Add other shared props, if possible. Maybe `label`, `required`, etc.?
4
+ * TODO: Add other shared props, if possible. Maybe `required`, etc.?
5
5
  *
6
6
  * TODO: make sure components are correctly calling formik's handlers (onChange, onBlur, etc.) like TextField
7
7
  */
@@ -11,5 +11,11 @@ export type ReadOnlyProps = {
11
11
  diffSnapshot?: string;
12
12
  diffMode?: DiffMode;
13
13
  } & Omit<DiffProps, 'beforeTxt' | 'afterTxt'>;
14
+ /**
15
+ * To be used by form field components when a component should NOT be editable.
16
+ * This includes when showing the text diff of a field (showDiff from useDiff hook is true).
17
+ *
18
+ * For examples, see TextField, Select, RadioGroup, Autocomplete
19
+ */
14
20
  export declare const ReadOnly: (props: ReadOnlyProps) => import("react/jsx-runtime").JSX.Element;
15
21
  export default ReadOnly;
@@ -7,8 +7,27 @@ export type TableDiff<T> = {
7
7
  export type DiffTableProps<T> = {
8
8
  beforeData: T[];
9
9
  afterData: T[];
10
+ /**
11
+ * See Table.columns
12
+ */
10
13
  columns: TableConfig<T>;
14
+ /**
15
+ * See Table.renderExpand
16
+ *
17
+ * DiffProvider will automatically be applied to content.
18
+ */
19
+ renderExpand?: (item: T) => React.ReactNode;
11
20
  };
21
+ /**
22
+ * Used to display changes (additions, modifications, removals) for a set of data.
23
+ *
24
+ * Adds a new column (left) that denotes whether a row was added, changed or removed. Any unchanged
25
+ * rows will be counted and displayed at the bottom, under the table.
26
+ *
27
+ * Data sets MUST be objects with an id property.
28
+ *
29
+ * NOTE: Changed rows only display that the row was changed. Cell-level diff is not yet implemented.
30
+ */
12
31
  export declare const DiffTable: <T extends {
13
32
  id: number;
14
33
  }>(props: DiffTableProps<T>) => import("react/jsx-runtime").JSX.Element;