@oursprivacy/react-json-view 1.27.4 → 1.27.6

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/index.d.ts CHANGED
@@ -1,338 +1,327 @@
1
- import type * as React from "react";
2
-
3
1
  /**
4
- * TypeScript definitions for react-json-view
5
- *
6
- * This type definition file provides comprehensive TypeScript support for the react-json-view library.
7
- * It includes all props, interfaces, and type definitions needed for type-safe usage of the ReactJsonView component.
8
- *
9
- * This file is internally maintained and can be modified as needed to match the library's implementation.
10
- * If you need to make changes or download the latest version, please visit the GitHub repository:
11
- *
12
- * @see {@link https://github.com/with-ours/react-json-view | GitHub Repository}
13
- *
14
- * The repository contains the full source code, including this type definition file, making it easy
15
- * to download, edit, and customize the types to suit your specific needs.
2
+ * Type definitions for react-json-view
3
+ *
4
+ * This is a fork maintained at: https://github.com/with-ours/react-json-view
5
+ * Engineers can edit this file and publish a new version as needed.
16
6
  */
17
7
 
8
+ import * as React from 'react'
9
+
18
10
  export interface ReactJsonViewProps {
19
- /**
20
- * This property contains your input JSON.
21
- *
22
- * Required.
23
- */
24
- src: object;
25
- /**
26
- * Contains the name of your root node. Use null or false for no name.
27
- *
28
- * Default: "root"
29
- */
30
- name?: React.JSX.Element | string | null | false;
31
- /**
32
- * RJV supports base-16 themes. Check out the list of supported themes in the demo.
33
- * A custom "rjv-default" theme applies by default.
34
- *
35
- * Default: "rjv-default"
36
- */
37
- theme?: ThemeKeys | ThemeObject;
38
- /**
39
- * Style attributes for react-json-view container.
40
- * Explicit style attributes will override attributes provided by a theme.
41
- *
42
- * Default: "rjv-default"
43
- */
44
- style?: React.CSSProperties;
45
- /**
46
- * Style of expand/collapse icons. Accepted values are "circle", triangle" or "square".
47
- *
48
- * Default: {}
49
- */
50
- iconStyle?: "circle" | "triangle" | "square";
51
- /**
52
- * Set the indent-width for nested objects.
53
- *
54
- * Default: 4
55
- */
56
- indentWidth?: number;
57
- /**
58
- * When set to true, all nodes will be collapsed by default.
59
- * Use an integer value to collapse at a particular depth.
60
- *
61
- * Default: false
62
- */
63
- collapsed?: boolean | number;
64
- /**
65
- * When an integer value is assigned, strings will be cut off at that length.
66
- * Collapsed strings are followed by an ellipsis.
67
- * String content can be expanded and collapsed by clicking on the string value.
68
- *
69
- * Default: false
70
- */
71
- collapseStringsAfterLength?: number | false;
72
- /**
73
- * Callback function to provide control over what objects and arrays should be collapsed by default.
74
- * An object is passed to the callback containing name, src, type ("array" or "object") and namespace.
75
- *
76
- * Default: false
77
- */
78
- shouldCollapse?: false | ((field: CollapsedFieldProps) => boolean);
79
- /**
80
- * When an integer value is assigned, arrays will be displayed in groups by count of the value.
81
- * Groups are displayed with brakcet notation and can be expanded and collapsed by clickong on the brackets.
82
- *
83
- * Default: 100
84
- */
85
- groupArraysAfterLength?: number;
86
- /**
87
- * When prop is not false, the user can copy objects and arrays to clipboard by clicking on the clipboard icon.
88
- * Copy callbacks are supported.
89
- *
90
- * Default: true
91
- */
92
- enableClipboard?: boolean | ((copy: OnCopyProps) => void);
93
- /**
94
- * When set to true, objects and arrays are labeled with size.
95
- *
96
- * Default: true
97
- */
98
- displayObjectSize?: boolean;
99
- /**
100
- * When set to true, data type labels prefix values.
101
- *
102
- * Default: true
103
- */
104
- displayDataTypes?: boolean;
105
- /**
106
- * When set to true, the index of the elements prefix values
107
- *
108
- * Default: true
109
- */
110
- displayArrayKey?: boolean;
111
- /**
112
- * set to false to remove quotes from keys (eg. "name": vs. name:)
113
- *
114
- * Default: true
115
- */
116
- quotesOnKeys?: boolean;
117
- /**
118
- * When a callback function is passed in, edit functionality is enabled.
119
- * The callback is invoked before edits are completed. Returning false
120
- * from onEdit will prevent the change from being made. see: onEdit docs.
121
- *
122
- * Default: false
123
- */
124
- onEdit?: ((edit: InteractionProps) => false | any) | false;
125
- /**
126
- * When a callback function is passed in, add functionality is enabled.
127
- * The callback is invoked before additions are completed.
128
- * Returning false from onAdd will prevent the change from being made. see: onAdd docs
129
- *
130
- * Default: false
131
- */
132
- onAdd?: ((add: InteractionProps) => false | any) | false;
133
- /**
134
- * When a callback function is passed in, delete functionality is enabled.
135
- * The callback is invoked before deletions are completed.
136
- * Returning false from onDelete will prevent the change from being made. see: onDelete docs
137
- *
138
- * Default: false
139
- */
140
- onDelete?: ((del: InteractionProps) => false | any) | false;
141
- /**
142
- * When a function is passed in, clicking a value triggers the onSelect method to be called.
143
- *
144
- * Default: false
145
- */
146
- onSelect?: ((select: OnSelectProps) => void) | false;
147
- /**
148
- * Custom message for validation failures to onEdit, onAdd, or onDelete callbacks.
149
- *
150
- * Default: "Validation Error"
151
- */
152
- validationMessage?: string;
153
- /**
154
- * Set to true to sort object keys.
155
- *
156
- * Default: false
157
- */
158
- sortKeys?: boolean;
159
- /**
160
- * Set to a value to be used as defaultValue when adding new key to json
161
- *
162
- * Default: null
163
- */
164
- defaultValue?: TypeDefaultValue | TypeDefaultValue[] | null;
165
- /**
166
- * Whether to select the textarea contents on edit
167
- *
168
- * Default: false
169
- */
170
- selectOnFocus?: boolean;
171
- /**
172
- * The key modifier to be combined with a click on JSON values to edit them
173
- *
174
- * Default: (e) => e.metaKey || e.ctrlKey
175
- */
176
- keyModifier?: (event: Event, type: "edit" | "submit") => boolean;
177
- /**
178
- * Set to true to escape strings sequences such as \n, \t, \r, \f
179
- *
180
- * Default: true
181
- */
182
- escapeStrings?: boolean;
183
- /**
184
- * An object mapping key names to decorator functions. Each decorator function
185
- * receives the key content as children and returns a React element that wraps it.
186
- * Allows custom rendering of specific object keys.
187
- *
188
- * Default: undefined
189
- */
190
- keyDecorators?: Record<
191
- string,
192
- (children: React.ReactNode) => React.ReactNode
193
- >;
11
+ /**
12
+ * This property contains your input JSON.
13
+ *
14
+ * Required.
15
+ */
16
+ src: object
17
+ /**
18
+ * Contains the name of your root node. Use null or false for no name.
19
+ *
20
+ * Default: "root"
21
+ */
22
+ name?: React.JSX.Element | string | null | false
23
+ /**
24
+ * RJV supports base-16 themes. Check out the list of supported themes in the demo.
25
+ * A custom "rjv-default" theme applies by default.
26
+ *
27
+ * Default: "rjv-default"
28
+ */
29
+ theme?: ThemeKeys | ThemeObject
30
+ /**
31
+ * Style attributes for react-json-view container.
32
+ * Explicit style attributes will override attributes provided by a theme.
33
+ *
34
+ * Default: "rjv-default"
35
+ */
36
+ style?: React.CSSProperties
37
+ /**
38
+ * Style of expand/collapse icons. Accepted values are "circle", triangle" or "square".
39
+ *
40
+ * Default: {}
41
+ */
42
+ iconStyle?: 'circle' | 'triangle' | 'square'
43
+ /**
44
+ * Set the indent-width for nested objects.
45
+ *
46
+ * Default: 4
47
+ */
48
+ indentWidth?: number
49
+ /**
50
+ * When set to true, all nodes will be collapsed by default.
51
+ * Use an integer value to collapse at a particular depth.
52
+ *
53
+ * Default: false
54
+ */
55
+ collapsed?: boolean | number
56
+ /**
57
+ * When an integer value is assigned, strings will be cut off at that length.
58
+ * Collapsed strings are followed by an ellipsis.
59
+ * String content can be expanded and collapsed by clicking on the string value.
60
+ *
61
+ * Default: false
62
+ */
63
+ collapseStringsAfterLength?: number | false
64
+ /**
65
+ * Callback function to provide control over what objects and arrays should be collapsed by default.
66
+ * An object is passed to the callback containing name, src, type ("array" or "object") and namespace.
67
+ *
68
+ * Default: false
69
+ */
70
+ shouldCollapse?: false | ((field: CollapsedFieldProps) => boolean)
71
+ /**
72
+ * When an integer value is assigned, arrays will be displayed in groups by count of the value.
73
+ * Groups are displayed with brakcet notation and can be expanded and collapsed by clickong on the brackets.
74
+ *
75
+ * Default: 100
76
+ */
77
+ groupArraysAfterLength?: number
78
+ /**
79
+ * When prop is not false, the user can copy objects and arrays to clipboard by clicking on the clipboard icon.
80
+ * Copy callbacks are supported.
81
+ *
82
+ * Default: true
83
+ */
84
+ enableClipboard?: boolean | ((copy: OnCopyProps) => void)
85
+ /**
86
+ * When set to true, objects and arrays are labeled with size.
87
+ *
88
+ * Default: true
89
+ */
90
+ displayObjectSize?: boolean
91
+ /**
92
+ * When set to true, data type labels prefix values.
93
+ *
94
+ * Default: true
95
+ */
96
+ displayDataTypes?: boolean
97
+ /**
98
+ * When set to true, the index of the elements prefix values
99
+ *
100
+ * Default: true
101
+ */
102
+ displayArrayKey?: boolean
103
+ /**
104
+ * set to false to remove quotes from keys (eg. "name": vs. name:)
105
+ *
106
+ * Default: true
107
+ */
108
+ quotesOnKeys?: boolean
109
+ /**
110
+ * When a callback function is passed in, edit functionality is enabled.
111
+ * The callback is invoked before edits are completed. Returning false
112
+ * from onEdit will prevent the change from being made. see: onEdit docs.
113
+ *
114
+ * Default: false
115
+ */
116
+ onEdit?: ((edit: InteractionProps) => false | any) | false
117
+ /**
118
+ * When a callback function is passed in, add functionality is enabled.
119
+ * The callback is invoked before additions are completed.
120
+ * Returning false from onAdd will prevent the change from being made. see: onAdd docs
121
+ *
122
+ * Default: false
123
+ */
124
+ onAdd?: ((add: InteractionProps) => false | any) | false
125
+ /**
126
+ * When a callback function is passed in, delete functionality is enabled.
127
+ * The callback is invoked before deletions are completed.
128
+ * Returning false from onDelete will prevent the change from being made. see: onDelete docs
129
+ *
130
+ * Default: false
131
+ */
132
+ onDelete?: ((del: InteractionProps) => false | any) | false
133
+ /**
134
+ * When a function is passed in, clicking a value triggers the onSelect method to be called.
135
+ *
136
+ * Default: false
137
+ */
138
+ onSelect?: ((select: OnSelectProps) => void) | false
139
+ /**
140
+ * Custom message for validation failures to onEdit, onAdd, or onDelete callbacks.
141
+ *
142
+ * Default: "Validation Error"
143
+ */
144
+ validationMessage?: string
145
+ /**
146
+ * Set to true to sort object keys.
147
+ *
148
+ * Default: false
149
+ */
150
+ sortKeys?: boolean
151
+ /**
152
+ * Set to a value to be used as defaultValue when adding new key to json
153
+ *
154
+ * Default: null
155
+ */
156
+ defaultValue?: TypeDefaultValue | TypeDefaultValue[] | null
157
+ /**
158
+ * Whether to select the textarea contents on edit
159
+ *
160
+ * Default: false
161
+ */
162
+ selectOnFocus?: boolean
163
+ /**
164
+ * The key modifier to be combined with a click on JSON values to edit them
165
+ *
166
+ * Default: (e) => e.metaKey || e.ctrlKey
167
+ */
168
+ keyModifier?: (event: Event, type: 'edit' | 'submit') => boolean
169
+ /**
170
+ * Set to true to escape strings sequences such as \n, \t, \r, \f
171
+ *
172
+ * Default: true
173
+ */
174
+ escapeStrings?: boolean
175
+ /**
176
+ * Object mapping key names to decorator functions that replace the key name content.
177
+ * Decorator functions receive the key name (string) as children and return JSX that replaces the default span.
178
+ * Only applies to object keys, not array indices.
179
+ *
180
+ * Default: undefined
181
+ */
182
+ keyDecorators?: Record<string, (children: string) => React.JSX.Element>
194
183
  }
195
184
 
196
185
  export interface OnCopyProps {
197
- /**
198
- * The JSON tree source object
199
- */
200
- src: object;
201
- /**
202
- * List of keys.
203
- */
204
- namespace: Array<string | null>;
205
- /**
206
- * The last key in the namespace array.
207
- */
208
- name: string | null;
186
+ /**
187
+ * The JSON tree source object
188
+ */
189
+ src: object
190
+ /**
191
+ * List of keys.
192
+ */
193
+ namespace: Array<string | null>
194
+ /**
195
+ * The last key in the namespace array.
196
+ */
197
+ name: string | null
209
198
  }
210
199
 
211
200
  export interface CollapsedFieldProps {
212
- /**
213
- * The name of the entry.
214
- */
215
- name: string | null;
216
- /**
217
- * The corresponding JSON subtree.
218
- */
219
- src: object;
220
- /**
221
- * The type of src. Can only be "array" or "object".
222
- */
223
- type: "array" | "object";
224
- /**
225
- * The scopes above the current entry.
226
- */
227
- namespace: Array<string | null>;
201
+ /**
202
+ * The name of the entry.
203
+ */
204
+ name: string | null
205
+ /**
206
+ * The corresponding JSON subtree.
207
+ */
208
+ src: object
209
+ /**
210
+ * The type of src. Can only be "array" or "object".
211
+ */
212
+ type: 'array' | 'object'
213
+ /**
214
+ * The scopes above the current entry.
215
+ */
216
+ namespace: Array<string | null>
228
217
  }
229
218
 
230
219
  export interface InteractionProps {
231
- /**
232
- * The updated subtree of the JSON tree.
233
- */
234
- updated_src: object;
235
- /**
236
- * The existing subtree of the JSON tree.
237
- */
238
- existing_src: object;
239
- /**
240
- * The key of the entry that is interacted with.
241
- */
242
- name: string | null;
243
- /**
244
- * List of keys.
245
- */
246
- namespace: Array<string | null>;
247
- /**
248
- * The original value of the entry that is interacted with.
249
- */
250
- existing_value: object | string | number | boolean | null;
251
- /**
252
- * The updated value of the entry that is interacted with.
253
- */
254
- new_value?: object | string | number | boolean | null;
220
+ /**
221
+ * The updated subtree of the JSON tree.
222
+ */
223
+ updated_src: object
224
+ /**
225
+ * The existing subtree of the JSON tree.
226
+ */
227
+ existing_src: object
228
+ /**
229
+ * The key of the entry that is interacted with.
230
+ */
231
+ name: string | null
232
+ /**
233
+ * List of keys.
234
+ */
235
+ namespace: Array<string | null>
236
+ /**
237
+ * The original value of the entry that is interacted with.
238
+ */
239
+ existing_value: object | string | number | boolean | null
240
+ /**
241
+ * The updated value of the entry that is interacted with.
242
+ */
243
+ new_value?: object | string | number | boolean | null
255
244
  }
256
245
 
257
246
  export interface OnSelectProps {
258
- /**
259
- * The name of the currently selected entry.
260
- */
261
- name: string | null;
262
- /**
263
- * The value of the currently selected entry.
264
- */
265
- value: object | string | number | boolean | null;
266
- /**
267
- * The type of the value. For "number" type, it will be replaced with the more
268
- * accurate types: "float", "integer", or "nan".
269
- */
270
- type: string;
271
- /**
272
- * List of keys representing the scopes above the selected entry.
273
- */
274
- namespace: Array<string | null>;
247
+ /**
248
+ * The name of the currently selected entry.
249
+ */
250
+ name: string | null
251
+ /**
252
+ * The value of the currently selected entry.
253
+ */
254
+ value: object | string | number | boolean | null
255
+ /**
256
+ * The type of the value. For "number" type, it will be replaced with the more
257
+ * accurate types: "float", "integer", or "nan".
258
+ */
259
+ type: string
260
+ /**
261
+ * List of keys representing the scopes above the selected entry.
262
+ */
263
+ namespace: Array<string | null>
275
264
  }
276
265
 
277
- export type TypeDefaultValue = string | number | boolean | object;
266
+ export type TypeDefaultValue = string | number | boolean | object
278
267
 
279
268
  export interface ThemeObject {
280
- base00: string;
281
- base01: string;
282
- base02: string;
283
- base03: string;
284
- base04: string;
285
- base05: string;
286
- base06: string;
287
- base07: string;
288
- base08: string;
289
- base09: string;
290
- base0A: string;
291
- base0B: string;
292
- base0C: string;
293
- base0D: string;
294
- base0E: string;
295
- base0F: string;
269
+ base00: string
270
+ base01: string
271
+ base02: string
272
+ base03: string
273
+ base04: string
274
+ base05: string
275
+ base06: string
276
+ base07: string
277
+ base08: string
278
+ base09: string
279
+ base0A: string
280
+ base0B: string
281
+ base0C: string
282
+ base0D: string
283
+ base0E: string
284
+ base0F: string
296
285
  }
297
286
 
298
287
  export type ThemeKeys =
299
- | "apathy"
300
- | "apathy:inverted"
301
- | "ashes"
302
- | "bespin"
303
- | "brewer"
304
- | "bright:inverted"
305
- | "bright"
306
- | "chalk"
307
- | "codeschool"
308
- | "colors"
309
- | "eighties"
310
- | "embers"
311
- | "flat"
312
- | "google"
313
- | "grayscale"
314
- | "grayscale:inverted"
315
- | "greenscreen"
316
- | "harmonic"
317
- | "hopscotch"
318
- | "isotope"
319
- | "marrakesh"
320
- | "mocha"
321
- | "monokai"
322
- | "ocean"
323
- | "paraiso"
324
- | "pop"
325
- | "railscasts"
326
- | "rjv-default"
327
- | "shapeshifter"
328
- | "shapeshifter:inverted"
329
- | "solarized"
330
- | "summerfruit"
331
- | "summerfruit:inverted"
332
- | "threezerotwofour"
333
- | "tomorrow"
334
- | "tube"
335
- | "twilight";
288
+ | 'apathy'
289
+ | 'apathy:inverted'
290
+ | 'ashes'
291
+ | 'bespin'
292
+ | 'brewer'
293
+ | 'bright:inverted'
294
+ | 'bright'
295
+ | 'chalk'
296
+ | 'codeschool'
297
+ | 'colors'
298
+ | 'eighties'
299
+ | 'embers'
300
+ | 'flat'
301
+ | 'google'
302
+ | 'grayscale'
303
+ | 'grayscale:inverted'
304
+ | 'greenscreen'
305
+ | 'harmonic'
306
+ | 'hopscotch'
307
+ | 'isotope'
308
+ | 'marrakesh'
309
+ | 'mocha'
310
+ | 'monokai'
311
+ | 'ocean'
312
+ | 'paraiso'
313
+ | 'pop'
314
+ | 'railscasts'
315
+ | 'rjv-default'
316
+ | 'shapeshifter'
317
+ | 'shapeshifter:inverted'
318
+ | 'solarized'
319
+ | 'summerfruit'
320
+ | 'summerfruit:inverted'
321
+ | 'threezerotwofour'
322
+ | 'tomorrow'
323
+ | 'tube'
324
+ | 'twilight'
336
325
 
337
- declare const ReactJson: React.ComponentType<ReactJsonViewProps>;
338
- export default ReactJson;
326
+ declare const ReactJson: React.ComponentType<ReactJsonViewProps>
327
+ export default ReactJson