@simoncomputing/mui-bueno-v2 0.25.0 → 0.25.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,34 @@ 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.2] - 2026-02-05
15
+
16
+ ### Changed
17
+
18
+ - `Diff`/`Readonly`
19
+ - Added `mode`/`diffMode` prop to allow modifying which diff tool to use (word, sentence or HTML based diff).
20
+
21
+ - `TextField`, `Select`, `Autocomplete`, `RadioGroup`
22
+ - Diff will be sentence-based instead of word-based. For `TextField`, this is configurable but defaults to sentence-based.
23
+
24
+ ### Fixed
25
+
26
+ - `Diff`
27
+ - Fixed missing `DiffProps` export
28
+
29
+ ## [0.25.1] - 2026-02-04
30
+
31
+ ### Fixed
32
+
33
+ - `DiffProvider`/`useDiff` hook
34
+ - Added `getSnapshotValue` helper function to `useDiff` hook, which can be used to get desired field value from the `previousSnapshot`. Use this to obtain the before/snapshot value before passing it to `DiffTable` or `ReadOnly` component.
35
+ - Updated supported components (`TextField`, `TextArea`, `Select`, `Autocomplete`, `RadioGroup`, `CitationField`) to use `getSnapshotValue` internally. Previously, they were only working with non-nested formik names.
36
+
37
+ ### Removed
38
+
39
+ - `useDiff` hook
40
+ - `previousSnapshot` is no longer exposed. Use `getSnapshotValue` to get the specific value directly.
41
+
14
42
  ## [0.25.0] - 2026-02-04
15
43
 
16
44
  ### Changed
@@ -1,10 +1,21 @@
1
+ export type DiffMode = 'word' | 'sentence' | 'html';
1
2
  export type DiffProps = {
2
3
  beforeTxt?: string;
3
4
  afterTxt?: string;
4
5
  /**
5
- * Set to `true` for HTML
6
+ * word - use word-based diff
7
+ * sentence - use sentence-based diff
8
+ * html - use HTML-based diff
9
+ *
10
+ * @default sentence
6
11
  */
7
- useHtmlDiff?: boolean;
12
+ mode?: DiffMode;
8
13
  };
14
+ /**
15
+ * Displays diff between two strings.
16
+ *
17
+ * For use with form field components, use `ReadOnly` instead, since it already handles `Diff` internally.
18
+ * See any of the fields in this library (TextField, Select, etc.) for an example of how to use `ReadOnly`.
19
+ */
9
20
  export declare const Diff: (props: DiffProps) => import("react/jsx-runtime").JSX.Element;
10
21
  export default Diff;
@@ -1,4 +1,17 @@
1
- type DiffContextType = {
1
+ type DiffContextValue = {
2
+ /**
3
+ * Used by fields to determine whether to render as a read-only diff or not
4
+ */
5
+ showDiff: boolean;
6
+ /**
7
+ * Obtains the snapshot value from `previousSnapshot`.
8
+ *
9
+ * @param name - formik field name
10
+ * @returns value in previousSnapshot (ex. name='phone' could return "999-123-1234")
11
+ */
12
+ getSnapshotValue: (name: string) => any;
13
+ };
14
+ type DiffProviderProps = {
2
15
  showDiff?: boolean;
3
16
  previousSnapshot?: any;
4
17
  children: React.ReactNode;
@@ -9,9 +22,6 @@ type DiffContextType = {
9
22
  * @param showDiff - when true (default), enables text diff. Set to false to return form to normal.
10
23
  * @param previousSnapshot - previous snapshot. This should match the same stucture as your fields (i.e. formik initialValues)
11
24
  */
12
- export declare const DiffProvider: ({ showDiff, previousSnapshot, children }: DiffContextType) => import("react/jsx-runtime").JSX.Element;
13
- export declare const useDiff: () => {
14
- showDiff: boolean;
15
- previousSnapshot: null;
16
- };
25
+ export declare const DiffProvider: ({ showDiff, previousSnapshot, children }: DiffProviderProps) => import("react/jsx-runtime").JSX.Element;
26
+ export declare const useDiff: () => DiffContextValue;
17
27
  export {};
@@ -1,5 +1,6 @@
1
1
  import { TypographyProps, TextFieldProps as MuiTextFieldProps } from '@mui/material';
2
2
  import { BaseInputProps } from '../BaseInputProps';
3
+ import { DiffMode } from '../../Diff/Diff';
3
4
  import * as React from 'react';
4
5
  type BaseTextFieldProps = BaseInputProps & {
5
6
  /**
@@ -47,6 +48,7 @@ type BaseTextFieldProps = BaseInputProps & {
47
48
  * By default, TextField will trim leading and trailing whitespace on blur. To disable this, set `noTrimOnBlur` to true.
48
49
  */
49
50
  noTrimOnBlur?: boolean;
51
+ diffMode?: DiffMode;
50
52
  };
51
53
  export type TextFieldProps = BaseTextFieldProps & Omit<MuiTextFieldProps, 'defaultValue' | 'error' | 'fullWidth' | 'select' | 'SelectProps' | 'value'>;
52
54
  /**
@@ -1,5 +1,5 @@
1
1
  import { TypographyProps } from '@mui/material';
2
- import { DiffProps } from '../Diff/Diff';
2
+ import { DiffMode, DiffProps } from '../Diff/Diff';
3
3
  import { ReactNode } from 'react';
4
4
  export type ReadOnlyProps = {
5
5
  label: string;
@@ -9,7 +9,7 @@ export type ReadOnlyProps = {
9
9
  staticLabelProps?: TypographyProps;
10
10
  showDiff?: boolean;
11
11
  diffSnapshot?: string;
12
- useHtmlDiff?: boolean;
12
+ diffMode?: DiffMode;
13
13
  } & Omit<DiffProps, 'beforeTxt' | 'afterTxt'>;
14
14
  export declare const ReadOnly: (props: ReadOnlyProps) => import("react/jsx-runtime").JSX.Element;
15
15
  export default ReadOnly;