@simoncomputing/mui-bueno-v2 0.25.3 → 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,16 @@ 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
+
14
24
  ## [0.25.3] - 2026-02-06
15
25
 
16
26
  ### Added
@@ -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 {};