json-edit-react 1.29.0 → 1.29.1-beta1

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/README.md CHANGED
@@ -6,86 +6,11 @@ The {{BLOCKS}} below are replaced from the equivalent blocks in the main README
6
6
  `yarn prepareReadme` script is run (which also happens before publish).
7
7
  -->
8
8
 
9
- <img width="60" alt="screenshot" src="image/logo192.png" style="float:left; margin-right: 1em;">
10
-
11
- A highly-configurable [React](https://github.com/facebook/react) component for editing or viewing JSON/object data
12
-
13
-
14
- ## [Explore the Demo](https://carlosnz.github.io/json-edit-react/) <!-- omit in toc -->
15
-
16
- ![NPM Version](https://img.shields.io/npm/v/json-edit-react)
17
- ![GitHub License](https://img.shields.io/github/license/carlosnz/json-edit-react)
18
- ![NPM Downloads](https://img.shields.io/npm/dm/json-edit-react)
19
-
20
- [![Ask DeepWiki](https://deepwiki.com/badge.svg)](https://deepwiki.com/CarlosNZ/json-edit-react)
21
- [![Discuss on GitHub](https://img.shields.io/badge/Discussions-Join%20the%20conversation-blue?logo=github)](https://github.com/CarlosNZ/json-edit-react/discussions)
22
- [![Sponsor](https://img.shields.io/badge/Sponsor-♥-pink.svg)](https://github.com/sponsors/CarlosNZ)
23
-
24
-
25
- ### Features include:
26
-
27
- - ✅ **Easy inline editing** of individual values or whole blocks of JSON text
28
- - 🔒 **Granular control** – restrict edits, deletions, or additions per element
29
- - 📏 **[JSON Schema](https://json-schema.org/) validation** (using 3rd-party validation library)
30
- - 🎨 **Customisable UI** — built-in or custom [themes](https://github.com/CarlosNZ/json-edit-react#themes--styles), CSS overrides or targeted classes
31
- - 📦 **Self-contained** — plain HTML/CSS, so no dependence on external UI libraries
32
- - 🔍 **Search & filter** — find data by key, value or custom function
33
- - 🚧 **[Custom components](https://github.com/CarlosNZ/json-edit-react#custom-nodes)** — replace specific nodes with specialised components (e.g. date picker, links, images, `undefined`, `BigInt`, `Symbol`)
34
- - 🌏 **[Localisation](https://github.com/CarlosNZ/json-edit-react#localisation)** — easily translate UI labels and messages
35
- - 🔄 **[Drag-n-drop](https://github.com/CarlosNZ/json-edit-react#drag-n-drop)** re-ordering within objects/arrays
36
- - 🎹 **[Keyboard customisation](https://github.com/CarlosNZ/json-edit-react#keyboard-customisation)** — define your own key bindings
37
- - 🎮 **[External control](https://github.com/CarlosNZ/json-edit-react#external-control-1)** via callbacks and triggers
38
-
39
- 💡 Try the **[Live Demo](https://carlosnz.github.io/json-edit-react/)** to see these features in action!
40
-
41
- <img width="392" alt="screenshot" src="image/screenshot.png">
9
+ [Block NPM INTRO not found]
42
10
 
43
11
  <img width="838" alt="breaking changes" src="image/admonition_npm.png">
44
12
 
45
- ## Installation
46
-
47
- ```sh
48
- # Depending on your package manager:
49
-
50
- npm i json-edit-react
51
- # OR
52
- yarn add json-edit-react
53
- ```
54
-
55
- ## Implementation
56
-
57
- ```jsx
58
- import { JsonEditor } from 'json-edit-react'
59
-
60
- // In your React component:
61
- return (
62
- <JsonEditor
63
- data={ jsonData }
64
- setData={ setJsonData } // optional
65
- { ...otherProps } />
66
- );
67
- ```
68
-
69
- ## Usage
70
-
71
- **(for end user)**
72
-
73
- It's pretty self explanatory (click the "edit" icon to edit, etc.), but there are a few not-so-obvious ways of interacting with the editor:
74
-
75
- - **Double-click** a value (or a key) to edit it
76
- - When editing a string, use `Cmd/Ctrl/Shift-Enter` to add a new line (`Enter` submits the value)
77
- - It's the opposite when editing a full object/array node (which you do by **clicking "edit"** on an object or array value) — `Enter` for new line, and `Cmd/Ctrl/Shift-Enter` for submit
78
- - `Escape` to **cancel** editing
79
- - When clicking the "**clipboard**" icon, holding down `Cmd/Ctrl` will copy the *path* to the selected node rather than its value
80
- - When opening/closing a node, hold down "Alt/Option" to open/close *all* child nodes at once
81
- - For Number inputs, **arrow-up** and **down** keys will increment/decrement the value
82
- - For Boolean inputs, **space bar** will toggle the value
83
- - Easily navigate to the next or previous node for editing using the `Tab`/`Shift-Tab` keys.
84
- - **Drag and drop** items to change the structure or modify display order
85
- - When editing is not permitted, double-clicking a string value will expand the text to the full value if it is truncated due to length (there is also a clickable "..." for long strings)
86
- - **JSON text input** can accept "looser" input, if an additional JSON parsing method is provided (e.g. [JSON5](https://json5.org/)). See `jsonParse` prop.
87
-
88
- [Have a play with the Demo app](https://carlosnz.github.io/json-edit-react/) to get a feel for it!
13
+ [Block NPM USAGE not found]
89
14
 
90
15
  ---
91
16
 
@@ -0,0 +1,426 @@
1
+ :root {
2
+ --jer-select-border: #b6b6b6;
3
+ --jer-select-focus: #777;
4
+ --jer-select-arrow: #777;
5
+ --jer-form-border: 1px solid #ededf0;
6
+ --jer-form-border-focus: 1px solid #e2e2e2;
7
+ --jer-highlight-color: #b3d8ff;
8
+ }
9
+
10
+ .jer-visible {
11
+ opacity: 1;
12
+ }
13
+
14
+ .jer-hidden {
15
+ opacity: 0;
16
+ }
17
+
18
+ /* Select styled as per:
19
+ https://moderncss.dev/custom-select-styles-with-pure-css/
20
+ */
21
+
22
+ .jer-select select {
23
+ -webkit-appearance: none;
24
+ -moz-appearance: none;
25
+ appearance: none;
26
+ background-color: transparent;
27
+ border: none;
28
+ padding: 0 1em 0 0;
29
+ margin: 0;
30
+ /* width: 100%; */
31
+ font-family: inherit;
32
+ font-size: 0.8em;
33
+ color: black;
34
+ cursor: inherit;
35
+ line-height: inherit;
36
+ z-index: 1;
37
+ outline: none;
38
+ }
39
+ select::-ms-expand {
40
+ display: none;
41
+ }
42
+
43
+ .jer-select {
44
+ display: grid;
45
+ grid-template-areas: 'select';
46
+ align-items: center;
47
+ position: relative;
48
+ min-width: 12ch;
49
+ max-width: 15ch;
50
+ border: 1px solid var(--jer-select-border);
51
+ border-radius: 0.25em;
52
+ padding: 0.25em 0.5em;
53
+ cursor: pointer;
54
+ line-height: 1.1;
55
+ background-color: #fff;
56
+ background-image: linear-gradient(to top, #f9f9f9, #fff 33%);
57
+ }
58
+ .jer-select select,
59
+ .jer-select::after {
60
+ grid-area: select;
61
+ }
62
+ .jer-select:not(.jer-select--multiple)::after {
63
+ content: '';
64
+ justify-self: end;
65
+ width: 0.8em;
66
+ height: 0.5em;
67
+ background-color: var(--jer-select-arrow);
68
+ clip-path: polygon(100% 0%, 0 0%, 50% 100%);
69
+ }
70
+
71
+ select:focus + .focus {
72
+ position: absolute;
73
+ top: -1px;
74
+ left: -1px;
75
+ right: -1px;
76
+ bottom: -1px;
77
+ border: 1px solid var(--jer-select-focus);
78
+ border-radius: inherit;
79
+ }
80
+
81
+ .jer-select-inner {
82
+ width: 100%;
83
+ text-overflow: ellipsis;
84
+ }
85
+
86
+ .jer-editor-container {
87
+ position: relative;
88
+ font-size: 16px;
89
+ line-height: 1;
90
+ padding: 1em;
91
+ padding-left: 2em;
92
+ /* margin-top: 1em; */
93
+ /* margin-bottom: 1em; */
94
+ border-radius: 0.5em;
95
+ text-align: left;
96
+ /* border: 1px solid green; */
97
+ }
98
+
99
+ .jer-editor-container textarea {
100
+ color: var(--jer-input-color);
101
+ border: var(--jer-form-border);
102
+ border-radius: 0.3em;
103
+ outline: none;
104
+ }
105
+
106
+ .jer-editor-container textarea:focus {
107
+ border: var(--jer-form-border-focus);
108
+ }
109
+
110
+ .jer-editor-container input {
111
+ border: var(--jer-form-border);
112
+ border-radius: 0.3em;
113
+ outline: none;
114
+ font-family: inherit;
115
+ }
116
+
117
+ .jer-editor-container input:focus {
118
+ border: var(--jer-form-border-focus);
119
+ }
120
+
121
+ /* Input highlighted text */
122
+ .jer-editor-container ::selection {
123
+ background-color: var(--jer-highlight-color);
124
+ }
125
+
126
+ /* .jer-editor-container select {
127
+ color: red;
128
+ } */
129
+
130
+ /* .jer-component {
131
+ } */
132
+
133
+ .jer-collection-header-row,
134
+ .jer-value-main-row {
135
+ display: flex;
136
+ min-height: 1.7em;
137
+ gap: 0.3em;
138
+ align-items: center;
139
+ }
140
+
141
+ .jer-collection-header-row {
142
+ display: flex;
143
+ flex-wrap: wrap;
144
+ }
145
+
146
+ /* .jer-brackets {
147
+ } */
148
+
149
+ /* .jer-bracket-outside {
150
+ } */
151
+
152
+ /* .jer-collection-item-count {
153
+ } */
154
+
155
+ .jer-collapse-icon {
156
+ position: absolute;
157
+ left: -1.2em;
158
+ top: 0.35em;
159
+ }
160
+
161
+ .jer-collection-inner {
162
+ position: relative;
163
+ }
164
+
165
+ .jer-collection-text-edit {
166
+ display: flex;
167
+ flex-direction: column;
168
+ gap: 0.3em;
169
+ align-items: flex-start;
170
+ line-height: 1.1em;
171
+ }
172
+
173
+ .jer-collection-text-area {
174
+ resize: both;
175
+ padding-top: 0.2em;
176
+ padding-left: 0.5em;
177
+ padding-right: 0.5em;
178
+ padding-bottom: 0;
179
+ overflow: hidden;
180
+ max-height: 40em;
181
+ font-family: inherit;
182
+ font-size: 0.85em;
183
+ }
184
+
185
+ .jer-collection-input-button-row {
186
+ display: flex;
187
+ justify-content: flex-end;
188
+ width: 100%;
189
+ font-size: 150%;
190
+ margin-top: 0.4em;
191
+ }
192
+
193
+ /* .jer-collection-element {
194
+ } */
195
+
196
+ .jer-collection-error-row {
197
+ position: absolute;
198
+ bottom: 0.5em;
199
+ }
200
+
201
+ /* .jer-collection-error-row-edit {
202
+ } */
203
+
204
+ .jer-error-slug {
205
+ margin-left: 1em;
206
+ }
207
+
208
+ .jer-value-component {
209
+ position: relative;
210
+ }
211
+
212
+ .jer-value-main-row {
213
+ display: flex;
214
+ gap: 0;
215
+ }
216
+
217
+ .jer-value-and-buttons {
218
+ display: flex;
219
+ justify-content: flex-start;
220
+ align-items: center;
221
+ padding-left: 0.5em;
222
+ }
223
+
224
+ .jer-value-error-row {
225
+ position: absolute;
226
+ }
227
+
228
+ .jer-value-string {
229
+ line-height: 1.3em;
230
+ white-space: pre-wrap;
231
+ overflow-wrap: anywhere;
232
+ word-break: break-word;
233
+ }
234
+
235
+ .jer-string-expansion {
236
+ cursor: pointer;
237
+ opacity: 0.6;
238
+ filter: saturate(50%);
239
+ }
240
+
241
+ .jer-show-less {
242
+ font-size: 80%;
243
+ }
244
+
245
+ .jer-hyperlink {
246
+ text-decoration: underline;
247
+ }
248
+
249
+ .jer-input-text {
250
+ resize: none;
251
+ margin: 0;
252
+ height: 1.4em;
253
+ padding-left: 0.5em;
254
+ padding-right: 0.5em;
255
+ padding-top: 0.25em;
256
+ padding-bottom: 0.2em;
257
+ min-width: 6em;
258
+ overflow: hidden;
259
+ line-height: 1.2em;
260
+ font-family: inherit;
261
+ font-size: 0.9em;
262
+ }
263
+
264
+ /* .jer-value-number {
265
+ } */
266
+
267
+ /* .jer-value-boolean {
268
+ } */
269
+
270
+ .jer-input-boolean {
271
+ transform: scale(1.5);
272
+ margin-left: 0.3em;
273
+ margin-right: 0.3em;
274
+ }
275
+
276
+ /* .jer-value-null {
277
+ } */
278
+
279
+ /* .jer-value-object {
280
+ } */
281
+
282
+ .jer-key-text {
283
+ word-break: break-word;
284
+ line-height: 1.1em;
285
+ white-space: pre-wrap;
286
+ }
287
+
288
+ .jer-key-edit {
289
+ padding: 0 0.3em;
290
+ font-size: inherit;
291
+ font-size: 0.9em;
292
+ }
293
+
294
+ /* .jer-value-array {
295
+ } */
296
+
297
+ .jer-value-invalid {
298
+ opacity: 0.5;
299
+ font-style: italic;
300
+ }
301
+
302
+ .jer-input-number {
303
+ min-width: 3em;
304
+ font-size: 90%;
305
+ }
306
+
307
+ /* .jer-input-component {
308
+ } */
309
+
310
+ .jer-edit-buttons,
311
+ .jer-confirm-buttons {
312
+ display: flex;
313
+ align-items: center;
314
+ cursor: pointer;
315
+ height: 1em;
316
+ }
317
+
318
+ .jer-input-buttons {
319
+ gap: 0.4em;
320
+ }
321
+
322
+ .jer-edit-buttons {
323
+ gap: 0.4em;
324
+ margin-left: 0.5em;
325
+ opacity: 0;
326
+ }
327
+
328
+ .jer-confirm-buttons {
329
+ gap: 0.2em;
330
+ margin-left: 0.4em;
331
+ }
332
+
333
+ .jer-edit-buttons:hover {
334
+ opacity: 1;
335
+ position: relative;
336
+ }
337
+
338
+ .jer-collection-header-row:hover > .jer-edit-buttons {
339
+ opacity: 1;
340
+ }
341
+
342
+ .jer-value-main-row:hover > .jer-edit-buttons {
343
+ opacity: 1;
344
+ }
345
+
346
+ .jer-value-and-buttons:hover > .jer-edit-buttons {
347
+ opacity: 1;
348
+ }
349
+
350
+ /* .jer-input-buttons {
351
+ } */
352
+
353
+ .jer-copy-pulse {
354
+ position: relative;
355
+ transition: 0.3s;
356
+ }
357
+
358
+ .jer-copy-pulse:hover {
359
+ opacity: 0.85;
360
+ transition: 0.3s;
361
+ transform: scale(1.2);
362
+ }
363
+
364
+ .jer-copy-pulse:after {
365
+ content: '';
366
+ display: block;
367
+ position: absolute;
368
+ border-radius: 50%;
369
+ left: 0;
370
+ top: 0;
371
+ width: 100%;
372
+ height: 100%;
373
+ opacity: 0;
374
+ transition: all 0.5s;
375
+ box-shadow: 0 0 15px 5px var(--jer-icon-copy-color);
376
+ }
377
+
378
+ .jer-copy-pulse:active:after {
379
+ box-shadow: 0 0 0 0 var(--jer-icon-copy-color);
380
+ position: absolute;
381
+ border-radius: 4em;
382
+ left: 0;
383
+ top: 0;
384
+ opacity: 1;
385
+ transition: 0s;
386
+ }
387
+
388
+ .jer-copy-pulse:active {
389
+ top: 0.07em;
390
+ }
391
+
392
+ .jer-rotate-90 {
393
+ transform: rotate(-90deg);
394
+ }
395
+
396
+ .jer-accordion-icon {
397
+ /* font-size: '2em'; */
398
+ }
399
+
400
+ .jer-icon:hover {
401
+ opacity: 0.85;
402
+ transition: 0.3s;
403
+ transform: scale(1.2);
404
+ }
405
+
406
+ /* For displaying keys that are purely <empty string> "" */
407
+ .jer-empty-string {
408
+ font-style: italic;
409
+ font-size: 90%;
410
+ }
411
+
412
+ .jer-drag-n-drop-padding {
413
+ height: 0.5em;
414
+ border: 1px dashed #e0e0e0;
415
+ border-radius: 0.3em;
416
+ }
417
+
418
+ /* Region to left of Collection node contents that is clickable to
419
+ collapse/expand node*/
420
+ .jer-clickzone {
421
+ position: absolute;
422
+ left: -1em;
423
+ top: 1.2em;
424
+ /* border: 1px solid red; */
425
+ height: calc(100% - 0.8em);
426
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "json-edit-react",
3
- "version": "1.29.0",
3
+ "version": "1.29.1-beta1",
4
4
  "description": "React component for editing or viewing JSON/object data",
5
5
  "main": "build/index.cjs.js",
6
6
  "module": "build/index.esm.js",
@@ -64,6 +64,7 @@
64
64
  "react-dom": "^19.1.0",
65
65
  "rollup": "^4.10.0",
66
66
  "rollup-plugin-bundle-size": "^1.0.3",
67
+ "rollup-plugin-copy": "^3.5.0",
67
68
  "rollup-plugin-delete": "^3.0.1",
68
69
  "rollup-plugin-dts": "^6.1.0",
69
70
  "rollup-plugin-peer-deps-external": "^2.2.4",