@@ -670,6 +670,45 @@ export default function Demo() {
670
670
671
671
## Props
672
672
673
+ Migrate from kkt v1 to v2. The new v2 version has removed the ~~ ` quotes ` ~~ and ~~ ` components ` ~~ props.
674
+
675
+ ``` diff
676
+ export interface JsonViewProps<T extends object> extends React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement> {
677
+ - quotes?: "'" | '"' | '';
678
+ - components?: {};
679
+ }
680
+ ```
681
+
682
+ ``` ts
683
+ export interface JsonViewProps <T extends object > extends React .DetailedHTMLProps <React .HTMLAttributes <HTMLDivElement >, HTMLDivElement > {
684
+ /** This property contains your input JSON */
685
+ value? : T ;
686
+ /** Define the root node name. @default undefined */
687
+ keyName? : string | number ;
688
+ /** Whether sort keys through `String.prototype.localeCompare()` @default false */
689
+ objectSortKeys? : boolean | ((a : string , b : string ) => number );
690
+ /** Set the indent-width for nested objects @default 15 */
691
+ indentWidth? : number ;
692
+ /** When set to `true`, `objects` and `arrays` are labeled with size @default true */
693
+ displayObjectSize? : boolean ;
694
+ /** When set to `true`, data type labels prefix values @default true */
695
+ displayDataTypes? : boolean ;
696
+ /** The user can copy objects and arrays to clipboard by clicking on the clipboard icon. @default true */
697
+ enableClipboard? : boolean ;
698
+ /** Whether to highlight updates. @default true */
699
+ highlightUpdates? : boolean ;
700
+ /** Callback function for when a treeNode is expanded or collapsed */
701
+ onExpand? : (props : {
702
+ expand: boolean ;
703
+ value? : T ;
704
+ keyid: string ;
705
+ keyName? : string | number ;
706
+ }) => void ;
707
+ /** Fires event when you copy */
708
+ onCopied? : (text : string , value ? : T ) => void ;
709
+ }
710
+ ```
711
+
673
712
``` ts
674
713
import { BraceLeft } from ' ./symbol/BraceLeft' ;
675
714
import { BraceRight } from ' ./symbol/BraceRight' ;
@@ -700,36 +739,7 @@ import { KeyName } from './section/KeyName';
700
739
import { type CountInfoProps } from " ./comps/CountInfo" ;
701
740
import { type CopiedOption } from " ./comps/Copied" ;
702
741
import { type NestedOpenProps } from " ./comps/NestedOpen" ;
703
- export interface JsonViewProps <T extends object > extends React .DetailedHTMLProps <React .HTMLAttributes <HTMLDivElement >, HTMLDivElement > {
704
- /** This property contains your input JSON */
705
- value? : T ;
706
- /** Whether sort keys through `String.prototype.localeCompare()` @default false */
707
- objectSortKeys? : boolean | ((a : string , b : string ) => number );
708
- /** Set the indent-width for nested objects @default 15 */
709
- indentWidth? : number ;
710
- /** When set to `true`, `objects` and `arrays` are labeled with size @default true */
711
- displayObjectSize? : boolean ;
712
- /** When set to `true`, data type labels prefix values @default true */
713
- displayDataTypes? : boolean ;
714
- /** The user can copy objects and arrays to clipboard by clicking on the clipboard icon. @default true */
715
- enableClipboard? : boolean ;
716
- /** Whether to highlight updates. @default true */
717
- highlightUpdates? : boolean ;
718
- /** Callback function for when a treeNode is expanded or collapsed */
719
- onExpand? : (props : {
720
- expand: boolean ;
721
- value? : T ;
722
- keyid: string ;
723
- keyName? : string | number ;
724
- }) => void ;
725
- /** Fires event when you copy */
726
- onCopied? : (text : string , value ? : T ) => void ;
727
- /** Redefine interface elements to re-render. */
728
- components? : {
729
- copied? : (props : React .SVGProps <SVGSVGElement >, opts : CopiedOption <T >) => React .ReactNode ;
730
- countInfoExtra? : (props : NestedOpenProps <T >) => React .ReactNode ;
731
- };
732
- }
742
+
733
743
type JsonViewComponent = React .FC <React .PropsWithRef <JsonViewProps <object >>> & {
734
744
Bigint: typeof Bigint ;
735
745
Date: typeof Date ;
0 commit comments