react18-json-view
Version:
JSON viewer for react18
1,936 lines (1,934 loc) • 14.5 kB
text/typescript
export const argTypes = {
src: {
description: 'Array | Object'
},
className: {
control: 'text',
description: 'String'
},
style: {
control: 'object',
description: 'Object'
},
dark: {
control: 'boolean',
description: 'Boolean',
table: {
defaultValue: { summary: false }
}
},
theme: {
control: 'select',
options: ['default', 'a11y', 'github', 'vscode', 'atom', 'winter-is-coming'],
table: {
defaultValue: { summary: false }
}
},
collapseStringsAfterLength: {
control: 'number',
description:
'When an integer value is assigned, strings longer than that length will be truncated and indicated by an ellipsis. To expand or collapse the string content, simply click on the string value.',
table: {
defaultValue: { summary: 99 }
}
},
collapseStringMode: {
control: 'select',
options: ['directly', 'word', 'address'],
table: {
defaultValue: { summary: 'word' }
}
},
collapseObjectsAfterLength: {
control: 'number',
description: 'When an integer value is assigned, the object and array will initially collapse.',
table: {
defaultValue: { summary: 99 }
}
},
collapsed: {
description:
'When set to true, all nodes will be collapsed by default. Use an integer value to collapse at a specific depth. The collapsed also can be a function. ',
table: {
defaultValue: { summary: false }
}
},
enableClipboard: {
control: 'boolean',
description: 'Boolean',
table: {
defaultValue: { summary: false }
}
},
matchesURL: {
control: 'boolean',
description: 'Boolean',
table: {
defaultValue: { summary: false }
}
},
editable: {
table: {
defaultValue: { summary: false }
},
description: 'When set to true, you can add, edit, or delete the property, and the actions will trigger onAdd, onEdit, or onDelete. Options is available.'
},
onAdd: {
description: `(params: { indexOrName: string | number, depth: number, src: any; parentType: 'object' | 'array' }) => void`
},
onDelete: {
description: `(params: {
value: any,
indexOrName: string | number,
depth: number,
src: any,
parentType: 'object' | 'array',
}) => void`
},
onEdit: {
description: `(params: {
newValue: any,
oldValue: any,
depth: number,
src: any,
indexOrName: string | number,
parentType: 'object' | 'array',
}) => void`
},
customizeNode: {
description: 'Highly customize every node.'
},
customizeCopy: {
description: 'Customize copy behavior.'
}
}
export const largeArray = [
80,
{ 1: 1, 2: { 2: 2 } },
[1, [2, 2], [3, [3]]],
65,
85,
1,
0,
0,
0,
3,
184,
1,
0,
0,
0,
3,
13,
2,
121,
186,
6,
56,
151,
112,
160,
192,
103,
230,
223,
173,
213,
151,
104,
95,
90,
175,
137,
114,
220,
5,
166,
242,
114,
62,
120,
82,
231,
37,
102,
145,
116,
74,
228,
166,
36,
138,
186,
227,
23,
146,
212,
225,
12,
185,
71,
197,
15,
101,
203,
86,
2,
248,
12,
115,
233,
201,
42,
79,
226,
138,
44,
12,
1,
4,
157,
208,
184,
187,
127,
90,
250,
216,
242,
181,
250,
189,
98,
16,
235,
234,
149,
144,
123,
224,
41,
167,
81,
44,
171,
90,
47,
85,
152,
223,
136,
190,
1,
152,
0,
68,
157,
166,
231,
23,
165,
185,
184,
220,
182,
37,
60,
52,
146,
241,
170,
36,
164,
117,
93,
110,
3,
198,
12,
87,
249,
33,
18,
196,
1,
6,
226,
188,
138,
202,
169,
152,
161,
6,
36,
226,
186,
234,
50,
74,
8,
46,
231,
253,
157,
60,
41,
51,
98,
145,
149,
145,
8,
207,
26,
202,
192,
1,
41,
107,
95,
9,
167,
138,
95,
103,
203,
155,
75,
88,
163,
170,
8,
149,
93,
71,
210,
244,
125,
230,
249,
150,
103,
251,
134,
124,
149,
173,
106,
28,
0,
7,
243,
226,
158,
84,
94,
194,
7,
95,
243,
235,
143,
250,
119,
21,
129,
234,
93,
225,
206,
24,
134,
130,
131,
43,
108,
48,
241,
59,
139,
69,
79,
187,
51,
105,
199,
20,
222,
225,
123,
106,
82,
34,
60,
187,
60,
250,
222,
191,
119,
86,
123,
51,
46,
237,
214,
161,
238,
142,
88,
43,
36,
139,
3,
212,
1,
8,
123,
24,
130,
228,
156,
250,
90,
197,
208,
225,
102,
222,
101,
70,
61,
85,
229,
205,
172,
144,
26,
85,
84,
121,
229,
122,
78,
18,
7,
24,
33,
110,
58,
41,
161,
239,
202,
74,
43,
216,
59,
151,
116,
197,
17,
122,
185,
4,
16,
189,
224,
113,
9,
177,
139,
141,
189,
143,
255,
146,
90,
187,
182,
110,
1,
10,
94,
76,
53,
238,
86,
212,
41,
129,
7,
115,
109,
165,
226,
99,
212,
149,
45,
163,
37,
57,
86,
235,
246,
99,
111,
247,
150,
238,
119,
184,
252,
247,
46,
36,
139,
58,
178,
13,
179,
57,
16,
145,
29,
74,
222,
92,
185,
174,
15,
2,
25,
209,
241,
45,
81,
58,
65,
83,
214,
61,
155,
169,
115,
245,
0,
11,
211,
8,
189,
14,
182,
190,
141,
26,
120,
10,
30,
246,
214,
214,
34,
191,
166,
28,
29,
154,
31,
90,
48,
146,
74,
18,
177,
206,
66,
255,
10,
62,
108,
39,
176,
121,
177,
231,
137,
161,
34,
133,
187,
38,
187,
213,
9,
64,
150,
194,
156,
90,
150,
240,
203,
148,
123,
12,
237,
72,
161,
169,
227,
187,
1,
12,
131,
85,
178,
81,
89,
109,
167,
107,
249,
126,
154,
249,
39,
104,
38,
205,
192,
41,
175,
151,
96,
20,
8,
117,
58,
50,
175,
52,
57,
199,
104,
58,
81,
243,
55,
161,
163,
108,
21,
103,
141,
61,
253,
26,
136,
173,
48,
119,
223,
246,
111,
99,
213,
205,
233,
136,
1,
225,
183,
105,
95,
228,
42,
182,
1,
13,
22,
113,
162,
211,
40,
246,
12,
213,
30,
107,
124,
117,
9,
233,
211,
50,
61,
98,
87,
145,
76,
169,
58,
134,
16,
204,
246,
120,
40,
103,
72,
197,
77,
1,
161,
214,
193,
248,
238,
182,
78,
11,
236,
218,
157,
43,
4,
186,
2,
26,
121,
139,
144,
66,
26,
17,
94,
138,
109,
115,
191,
140,
33,
213,
0,
14,
156,
79,
100,
224,
40,
213,
31,
196,
39,
191,
235,
47,
231,
136,
145,
139,
9,
74,
238,
243,
133,
111,
84,
199,
150,
217,
235,
7,
250,
125,
61,
175,
89,
144,
43,
233,
236,
187,
26,
246,
99,
134,
51,
132,
220,
49,
87,
214,
76,
201,
139,
67,
205,
31,
229,
9,
113,
224,
89,
213,
99,
113,
71,
111,
0,
15,
33,
114,
28,
210,
244,
89,
240,
151,
165,
241,
212,
120,
2,
194,
233,
180,
93,
5,
238,
120,
15,
139,
224,
179,
187,
176,
185,
70,
52,
123,
25,
145,
33,
242,
192,
117,
55,
235,
250,
74,
149,
215,
111,
95,
244,
185,
242,
14,
159,
52,
238,
173,
97,
254,
208,
85,
204,
160,
42,
174,
22,
227,
13,
8,
1,
16,
68,
136,
108,
58,
224,
187,
244,
212,
255,
71,
34,
221,
27,
253,
138,
77,
202,
245,
102,
133,
211,
211,
174,
227,
2,
104,
62,
208,
61,
15,
196,
163,
112,
57,
166,
122,
110,
128,
17,
224,
33,
109,
12,
28,
74,
246,
150,
182,
255,
146,
249,
9,
28,
214,
123,
221,
120,
185,
141,
201,
44,
108,
34,
102,
0,
18,
108,
193,
84,
172,
81,
179,
225,
195,
131,
2,
0,
21,
142,
140,
50,
3,
223,
162,
195,
223,
208,
99,
252,
191,
50,
216,
13,
152,
236,
171,
172,
245,
18,
147,
156,
67,
192,
130,
107,
124,
117,
167,
120,
89,
201,
67,
141,
136,
32,
158,
64,
128,
249,
224,
22,
48,
175,
103,
224,
155,
5,
235,
207,
246,
1,
101,
164,
214,
118,
0,
0,
0,
0,
0,
26,
225,
1,
250,
237,
172,
88,
81,
227,
43,
155,
35,
181,
249,
65,
26,
140,
43,
172,
74,
174,
62,
212,
221,
123,
129,
29,
209,
167,
46,
164,
170,
113,
0,
0,
0,
0,
2,
41,
109,
38,
1,
65,
85,
87,
86,
0,
0,
0,
0,
0,
7,
48,
177,
76,
0,
0,
39,
16,
103,
123,
175,
16,
218,
153,
59,
20,
203,
105,
228,
123,
46,
106,
212,
223,
151,
222,
99,
254,
3,
0,
85,
0,
35,
86,
175,
149,
41,
161,
6,
77,
65,
227,
45,
97,
126,
44,
225,
220,
165,
115,
58,
250,
144,
29,
171,
169,
226,
182,
141,
238,
93,
83,
236,
249,
0,
0,
0,
0,
17,
227,
150,
179,
0,
0,
0,
0,
0,
5,
0,
129,
255,
255,
255,
248,
0,
0,
0,
0,
101,
164,
214,
118,
0,
0,
0,
0,
101,
164,
214,
117,
0,
0,
0,
0,
17,
201,
8,
84,
0,
0,
0,
0,
0,
4,
47,
79,
10,
54,
90,
117,
73,
30,
131,
22,
242,
0,
165,
35,
44,
86,
5,
90,
115,
157,
217,
149,
77,
197,
4,
182,
88,
183,
242,
234,
63,
42,
48,
41,
224,
189,
89,
90,
239,
224,
65,
86,
24,
255,
22,
53,
122,
134,
59,
16,
136,
202,
164,
149,
192,
39,
9,
255,
236,
225,
223,
168,
52,
245,
29,
162,
237,
64,
118,
214,
185,
55,
180,
148,
75,
225,
6,
172,
83,
182,
51,
7,
30,
149,
254,
106,
192,
190,
190,
210,
26,
82,
55,
170,
114,
167,
239,
162,
50,
8,
5,
205,
42,
26,
75,
62,
25,
231,
118,
33,
11,
230,
205,
211,
188,
63,
108,
109,
196,
180,
204,
33,
157,
219,
96,
125,
163,
248,
66,
114,
19,
51,
30,
86,
120,
134,
104,
56,
150,
91,
57,
7,
189,
180,
47,
22,
113,
27,
232,
251,
21,
137,
9,
138,
1,
34,
243,
166,
138,
10,
87,
100,
191,
76,
186,
1,
125,
233,
5,
40,
136,
151,
152,
33,
111,
163,
151,
137,
129,
233,
204,
121,
168,
205,
19,
38,
187,
5,
218,
26,
166,
80,
231,
173,
125,
181,
64,
61,
25,
241,
220,
70,
252,
0,
85,
0,
35,
215,
49,
81,
19,
245,
177,
211,
186,
122,
131,
96,
76,
68,
185,
77,
121,
244,
253,
105,
175,
119,
248,
4,
252,
127,
146,
10,
109,
198,
87,
68,
0,
0,
0,
0,
8,
80,
101,
172,
0,
0,
0,
0,
0,
2,
52,
101,
255,
255,
255,
248,
0,
0,
0,
0,
101,
164,
214,
118,
0,
0,
0,
0,
101,
164,
214,
117,
0,
0,
0,
0,
8,
63,
95,
21,
0,
0,
0,
0,
0,
2,
119,
209,
10,
161,
248,
146,
171,
227,
175,
169,
205,
54,
92,
186,
2,
102,
211,
1,
167,
46,
10,
7,
36,
26,
152,
85,
185,
126,
91,
143,
115,
22,
145,
254,
90,
227,
75,
109,
86,
213,
8,
95,
199,
6,
217,
169,
240,
165,
134,
181,
72,
203,
142,
42,
137,
177,
26,
141,
240,
137,
153,
206,
206,
245,
29,
162,
237,
64,
118,
214,
185,
55,
180,
148,
75,
225,
6,
172,
83,
182,
51,
7,
30,
149,
254,
106,
192,
190,
190,
210,
26,
82,
55,
170,
114,
167,
239,
162,
50,
8,
5,
205,
42,
26,
75,
62,
25,
231,
118,
33,
11,
230,
205,
211,
188,
63,
108,
109,
196,
180,
204,
33,
157,
219,
96,
125,
163,
248,
66,
114,
19,
51,
30,
86,
120,
134,
104,
56,
150,
91,
57,
7,
189,
180,
47,
22,
113,
27,
232,
251,
21,
137,
9,
138,
1,
34,
243,
166,
138,
10,
87,
100,
191,
76,
186,
1,
125,
233,
5,
40,
136,
151,
152,
33,
111,
163,
151,
137,
129,
233,
204,
121,
168,
205,
19,
38,
187,
5,
218,
26,
166,
80,
231,
173,
125,
181,
64,
61,
25,
241,
220,
70,
252,
0,
85,
0,
229,
178,
116,
178,
97,
17,
67,
223,
5,
93,
110,
124,
216,
217,
63,
225,
150,
23,
22,
188,
212,
220,
161,
202,
216,
122,
131,
188,
30,
120,
193,
239,
0,
0,
0,
0,
0,
211,
102,
126,
0,
0,
0,
0,
0,
0,
81,
70,
255,
255,
255,
248,
0,
0,
0,
0,
101,
164,
214,
118,
0,
0,
0,
0,
101,
164,
214,
117,
0,
0,
0,
0,
0,
209,
139,
204,
0,
0,
0,
0,
0,
0,
96,
149,
10,
62,
205,
57,
44,
196,
138,
88,
133,
149,
104,
117,
136,
186,
96,
134,
179,
113,
63,
17,
85,
189,
83,
37,
152,
240,
134,
20,
35,
121,
186,
18,
20,
29,
151,
145,
128,
223,
94,
86,
115,
69,
94,
149,
125,
204,
127,
169,
100,
3,
245,
207,
96,
108,
201,
211,
142,
212,
199,
162,
124,
184,
247,
189,
70,
48,
68,
237,
226,
173,
185,
89,
156,
206,
175,
110,
124,
87,
236,
119,
94,
1,
123,
213,
151,
224,
235,
40,
250,
126,
237,
49,
45,
62,
253,
237,
210,
241,
105,
61,
20,
143,
60,
15,
223,
245,
76,
16,
5,
239,
174,
171,
17,
109,
109,
133,
211,
33,
191,
55,
118,
234,
62,
174,
91,
116,
191,
120,
177,
136,
168,
7,
179,
144,
172,
193,
10,
147,
48,
210,
119,
200,
51,
96,
50,
193,
173,
73,
115,
253,
163,
102,
6,
92,
4,
120,
17,
65,
115,
253,
103,
67,
35,
245,
187,
83,
59,
183,
69,
77,
240,
152,
215,
75,
10,
159,
61,
21,
46,
141,
255,
205,
19,
38,
187,
5,
218,
26,
166,
80,
231,
173,
125,
181,
64,
61,
25,
241,
220,
70,
252
]