@script-it/json-views-react 0.1.0-beta.1 → 2026.10.27

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.
Files changed (35) hide show
  1. package/README.md +24 -3
  2. package/dist/index.d.ts +1 -0
  3. package/dist/json/html-view/format-value.d.ts +5 -0
  4. package/dist/json/html-view/format-value.js +84 -0
  5. package/dist/json/html-view/native-control.d.ts +3 -8
  6. package/dist/json/html-view/native-control.js +3 -1
  7. package/dist/json/html-view/template.js +5 -0
  8. package/dist/json/html-view.js +50 -8
  9. package/dist/json/json-content.d.ts +3 -0
  10. package/dist/json/json-content.js +22 -15
  11. package/dist/json/json-view.d.ts +1 -1
  12. package/dist/json/json-view.js +34 -32
  13. package/dist/json/schema-value.js +11 -3
  14. package/dist/json/table-view.js +27 -14
  15. package/dist/json/view-model.d.ts +1 -1
  16. package/dist/json/view-model.js +3 -1
  17. package/dist/json/view-settings.js +42 -23
  18. package/dist/json/view-types.d.ts +3 -0
  19. package/dist/json/viewers/general/json-node-view.js +6 -2
  20. package/dist/lib/enter-key.d.ts +29 -0
  21. package/dist/lib/enter-key.js +27 -0
  22. package/dist/primitives/choice-control.js +2 -1
  23. package/dist/structured-data/atomic-value-editor.d.ts +4 -1
  24. package/dist/structured-data/atomic-value-editor.js +17 -9
  25. package/dist/structured-data/table-cell-options.d.ts +20 -0
  26. package/dist/structured-data/table-cell-options.js +11 -0
  27. package/dist/structured-data/tabular-data-cell.d.ts +19 -0
  28. package/dist/structured-data/tabular-data-cell.js +55 -0
  29. package/dist/styles.css +1 -1
  30. package/dist/tabular-data-view.js +23 -3
  31. package/dist/widget-registry.d.ts +5 -0
  32. package/dist/widget-registry.js +13 -7
  33. package/dist/widgets/date-picker-widget.js +11 -0
  34. package/dist/widgets/textarea-widget.js +4 -1
  35. package/package.json +4 -4
@@ -3,6 +3,7 @@ import { useEffect, useId, useMemo, useRef, useState } from 'react';
3
3
  import { AlertTriangle, ChevronLeft, ChevronRight } from 'lucide-react';
4
4
  import { convertDateTimeToOffset, formatFixedOffset, localOffsetForDate, parseDateValue, serializeDateEditorValue, validateDateValue, } from '@script-it/json-views-core';
5
5
  import { cn } from '../lib/cn.js';
6
+ import { submitsOnEnter } from '../lib/enter-key.js';
6
7
  import { MenuSelect } from '../primitives/menu-select.js';
7
8
  import { DropdownMenu, DropdownMenuContent, DropdownMenuTrigger, } from '../primitives/dropdown-menu.js';
8
9
  function pad(value, size = 2) {
@@ -240,6 +241,16 @@ export function DateValueEditor({ descriptor, disabled, error, label, value, onC
240
241
  event.preventDefault();
241
242
  event.stopPropagation();
242
243
  cancel();
244
+ return;
245
+ }
246
+ // Enter in a field (the time, the Include time checkbox) saves the
247
+ // draft; a day or other button keeps its own Enter action.
248
+ if (event.target instanceof HTMLButtonElement)
249
+ return;
250
+ if (submitsOnEnter(event, { multiline: false, enterKey: 'submit' })) {
251
+ event.preventDefault();
252
+ event.stopPropagation();
253
+ save();
243
254
  }
244
255
  }, children: [_jsxs("div", { className: "flex items-center justify-between gap-2", children: [_jsx("strong", { className: "text-sm font-medium", children: monthLabel }), _jsxs("div", { className: "flex gap-1", children: [_jsx("button", { type: "button", "aria-label": "Previous month", className: "grid h-8 w-8 place-items-center rounded-md hover:bg-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring", onClick: () => {
245
256
  const next = shiftMonth(calendarDate(month.year, month.month, 1), -1);
@@ -22,7 +22,10 @@ export function TextareaWidget({ value, onChange, onBlur, ariaLabel, ariaDescrib
22
22
  return;
23
23
  const textarea = textareaRef.current;
24
24
  textarea.style.height = 'auto';
25
- textarea.style.height = `${Math.max(minHeight ?? 0, textarea.scrollHeight)}px`;
25
+ // A border-box height also holds the borders `scrollHeight` leaves out;
26
+ // without them the last pixels overflow and a scrollbar appears.
27
+ const borders = textarea.offsetHeight - textarea.clientHeight;
28
+ textarea.style.height = `${Math.max(minHeight ?? 0, textarea.scrollHeight + borders)}px`;
26
29
  if (!readOnly)
27
30
  textarea.focus({ preventScroll: true });
28
31
  }, [autoSize, minHeight, readOnly, value]);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@script-it/json-views-react",
3
- "version": "0.1.0-beta.1",
3
+ "version": "2026.10.27",
4
4
  "description": "Extensible React viewer and editor for JSON Views",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -28,7 +28,7 @@
28
28
  },
29
29
  "dependencies": {
30
30
  "@codemirror/lang-json": "^6.0.2",
31
- "@codemirror/language": "^6.12.4",
31
+ "@codemirror/language": "6.12.4",
32
32
  "@codemirror/state": "^6.7.4",
33
33
  "@codemirror/view": "^6.43.11",
34
34
  "@lezer/highlight": "^1.2.3",
@@ -38,7 +38,7 @@
38
38
  "@radix-ui/react-slot": "^1.2.4",
39
39
  "@radix-ui/react-tabs": "^1.1.13",
40
40
  "@radix-ui/react-tooltip": "^1.2.8",
41
- "@script-it/json-views-core": "0.1.0-beta.1",
41
+ "@script-it/json-views-core": "2026.10.27",
42
42
  "@tanstack/react-virtual": "3.14.10",
43
43
  "class-variance-authority": "^0.7.1",
44
44
  "clsx": "^2.1.1",
@@ -60,7 +60,7 @@
60
60
  "react": "^19.1.1",
61
61
  "react-dom": "^19.1.1",
62
62
  "typescript": "^5.9.3",
63
- "vitest": "3.2.7"
63
+ "vitest": "4.1.11"
64
64
  },
65
65
  "repository": {
66
66
  "type": "git",