@uipath/apollo-wind 2.60.1 → 2.62.0

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 (154) hide show
  1. package/dist/components/forms/field-actions.cjs +181 -0
  2. package/dist/components/forms/field-actions.d.ts +131 -0
  3. package/dist/components/forms/field-actions.js +129 -0
  4. package/dist/components/forms/field-control.cjs +415 -0
  5. package/dist/components/forms/field-control.d.ts +52 -0
  6. package/dist/components/forms/field-control.js +372 -0
  7. package/dist/components/forms/field-renderer.cjs +77 -420
  8. package/dist/components/forms/field-renderer.d.ts +2 -3
  9. package/dist/components/forms/field-renderer.js +78 -421
  10. package/dist/components/forms/form-designer.cjs +7 -1
  11. package/dist/components/forms/form-designer.js +7 -1
  12. package/dist/components/forms/form-schema.d.ts +121 -2
  13. package/dist/components/forms/form-strings.cjs +67 -0
  14. package/dist/components/forms/form-strings.d.ts +30 -0
  15. package/dist/components/forms/form-strings.js +30 -0
  16. package/dist/components/forms/index.cjs +53 -9
  17. package/dist/components/forms/index.d.ts +6 -1
  18. package/dist/components/forms/index.js +6 -1
  19. package/dist/components/forms/literal-value-context.cjs +37 -0
  20. package/dist/components/forms/literal-value-context.d.ts +5 -0
  21. package/dist/components/forms/literal-value-context.js +3 -0
  22. package/dist/components/forms/metadata-form.cjs +100 -21
  23. package/dist/components/forms/metadata-form.d.ts +5 -0
  24. package/dist/components/forms/metadata-form.js +101 -22
  25. package/dist/components/forms/mode-aware-field.cjs +589 -0
  26. package/dist/components/forms/mode-aware-field.d.ts +15 -0
  27. package/dist/components/forms/mode-aware-field.js +555 -0
  28. package/dist/components/forms/opaque-value.cjs +44 -0
  29. package/dist/components/forms/opaque-value.d.ts +7 -0
  30. package/dist/components/forms/opaque-value.js +7 -0
  31. package/dist/components/forms/rules-engine.cjs +13 -0
  32. package/dist/components/forms/rules-engine.js +13 -0
  33. package/dist/components/forms/schema-serializer.cjs +8 -0
  34. package/dist/components/forms/schema-serializer.js +8 -0
  35. package/dist/components/forms/string-list-field.cjs +36 -18
  36. package/dist/components/forms/string-list-field.d.ts +6 -0
  37. package/dist/components/forms/string-list-field.js +35 -20
  38. package/dist/components/forms/validation-converter.cjs +32 -2
  39. package/dist/components/forms/validation-converter.d.ts +17 -1
  40. package/dist/components/forms/validation-converter.js +30 -3
  41. package/dist/components/forms/value-modes.cjs +253 -0
  42. package/dist/components/forms/value-modes.d.ts +236 -0
  43. package/dist/components/forms/value-modes.js +180 -0
  44. package/dist/components/ui/avatar.d.ts +1 -1
  45. package/dist/components/ui/badge.d.ts +1 -1
  46. package/dist/components/ui/boolean-radio-group.cjs +114 -0
  47. package/dist/components/ui/boolean-radio-group.d.ts +24 -0
  48. package/dist/components/ui/boolean-radio-group.js +77 -0
  49. package/dist/components/ui/button.d.ts +2 -2
  50. package/dist/components/ui/checkbox.cjs +10 -5
  51. package/dist/components/ui/checkbox.js +12 -7
  52. package/dist/components/ui/command.d.ts +7 -7
  53. package/dist/components/ui/field-addons/field-menu.cjs +1 -0
  54. package/dist/components/ui/field-addons/field-menu.d.ts +2 -0
  55. package/dist/components/ui/field-addons/field-menu.js +1 -0
  56. package/dist/components/ui/field-addons/index.cjs +4 -0
  57. package/dist/components/ui/field-addons/index.d.ts +1 -0
  58. package/dist/components/ui/field-addons/index.js +2 -1
  59. package/dist/components/ui/field-addons/value-mode-strings.cjs +7 -1
  60. package/dist/components/ui/field-addons/value-mode-strings.d.ts +9 -0
  61. package/dist/components/ui/field-addons/value-mode-strings.js +7 -1
  62. package/dist/components/ui/field-addons/value-mode-switch-dialog.cjs +73 -0
  63. package/dist/components/ui/field-addons/value-mode-switch-dialog.d.ts +16 -0
  64. package/dist/components/ui/field-addons/value-mode-switch-dialog.js +39 -0
  65. package/dist/components/ui/form-field.cjs +2 -1
  66. package/dist/components/ui/form-field.d.ts +2 -0
  67. package/dist/components/ui/form-field.js +2 -1
  68. package/dist/components/ui/index.cjs +237 -193
  69. package/dist/components/ui/index.d.ts +4 -0
  70. package/dist/components/ui/index.js +4 -0
  71. package/dist/components/ui/input-group.cjs +6 -3
  72. package/dist/components/ui/input-group.d.ts +6 -5
  73. package/dist/components/ui/input-group.js +6 -3
  74. package/dist/components/ui/json-tree-view/DecorationChip.cjs +81 -0
  75. package/dist/components/ui/json-tree-view/DecorationChip.d.ts +4 -0
  76. package/dist/components/ui/json-tree-view/DecorationChip.js +47 -0
  77. package/dist/components/ui/json-tree-view/EditorChrome.cjs +88 -0
  78. package/dist/components/ui/json-tree-view/EditorChrome.d.ts +21 -0
  79. package/dist/components/ui/json-tree-view/EditorChrome.js +51 -0
  80. package/dist/components/ui/json-tree-view/JsonContainerEditor.cjs +95 -0
  81. package/dist/components/ui/json-tree-view/JsonContainerEditor.d.ts +18 -0
  82. package/dist/components/ui/json-tree-view/JsonContainerEditor.js +61 -0
  83. package/dist/components/ui/json-tree-view/JsonLeafValueEditor.cjs +86 -0
  84. package/dist/components/ui/json-tree-view/JsonLeafValueEditor.d.ts +12 -0
  85. package/dist/components/ui/json-tree-view/JsonLeafValueEditor.js +52 -0
  86. package/dist/components/ui/json-tree-view/JsonMultilineLeafEditor.cjs +74 -0
  87. package/dist/components/ui/json-tree-view/JsonMultilineLeafEditor.d.ts +13 -0
  88. package/dist/components/ui/json-tree-view/JsonMultilineLeafEditor.js +40 -0
  89. package/dist/components/ui/json-tree-view/JsonTree.cjs +253 -0
  90. package/dist/components/ui/json-tree-view/JsonTree.d.ts +81 -0
  91. package/dist/components/ui/json-tree-view/JsonTree.js +219 -0
  92. package/dist/components/ui/json-tree-view/JsonTree.types.cjs +18 -0
  93. package/dist/components/ui/json-tree-view/JsonTree.types.d.ts +253 -0
  94. package/dist/components/ui/json-tree-view/JsonTree.types.js +0 -0
  95. package/dist/components/ui/json-tree-view/JsonTreeRow.cjs +284 -0
  96. package/dist/components/ui/json-tree-view/JsonTreeRow.d.ts +50 -0
  97. package/dist/components/ui/json-tree-view/JsonTreeRow.js +244 -0
  98. package/dist/components/ui/json-tree-view/JsonTreeToolbar.cjs +209 -0
  99. package/dist/components/ui/json-tree-view/JsonTreeToolbar.d.ts +35 -0
  100. package/dist/components/ui/json-tree-view/JsonTreeToolbar.js +175 -0
  101. package/dist/components/ui/json-tree-view/JsonTreeTooltip.cjs +84 -0
  102. package/dist/components/ui/json-tree-view/JsonTreeTooltip.d.ts +21 -0
  103. package/dist/components/ui/json-tree-view/JsonTreeTooltip.js +47 -0
  104. package/dist/components/ui/json-tree-view/JsonTypeBadge.cjs +70 -0
  105. package/dist/components/ui/json-tree-view/JsonTypeBadge.d.ts +17 -0
  106. package/dist/components/ui/json-tree-view/JsonTypeBadge.js +36 -0
  107. package/dist/components/ui/json-tree-view/NodeKey.cjs +77 -0
  108. package/dist/components/ui/json-tree-view/NodeKey.d.ts +16 -0
  109. package/dist/components/ui/json-tree-view/NodeKey.js +43 -0
  110. package/dist/components/ui/json-tree-view/RowActions.cjs +120 -0
  111. package/dist/components/ui/json-tree-view/RowActions.d.ts +15 -0
  112. package/dist/components/ui/json-tree-view/RowActions.js +86 -0
  113. package/dist/components/ui/json-tree-view/ScalarValueCell.cjs +112 -0
  114. package/dist/components/ui/json-tree-view/ScalarValueCell.d.ts +18 -0
  115. package/dist/components/ui/json-tree-view/ScalarValueCell.js +75 -0
  116. package/dist/components/ui/json-tree-view/buildJsonTree.cjs +324 -0
  117. package/dist/components/ui/json-tree-view/buildJsonTree.d.ts +75 -0
  118. package/dist/components/ui/json-tree-view/buildJsonTree.js +257 -0
  119. package/dist/components/ui/json-tree-view/clipboard.cjs +63 -0
  120. package/dist/components/ui/json-tree-view/clipboard.d.ts +6 -0
  121. package/dist/components/ui/json-tree-view/clipboard.js +29 -0
  122. package/dist/components/ui/json-tree-view/index.cjs +175 -0
  123. package/dist/components/ui/json-tree-view/index.d.ts +10 -0
  124. package/dist/components/ui/json-tree-view/index.js +11 -0
  125. package/dist/components/ui/json-tree-view/leafEditTypes.cjs +74 -0
  126. package/dist/components/ui/json-tree-view/leafEditTypes.d.ts +12 -0
  127. package/dist/components/ui/json-tree-view/leafEditTypes.js +34 -0
  128. package/dist/components/ui/json-tree-view/strings.cjs +122 -0
  129. package/dist/components/ui/json-tree-view/strings.d.ts +65 -0
  130. package/dist/components/ui/json-tree-view/strings.js +79 -0
  131. package/dist/components/ui/prompt-value-control.cjs +70 -0
  132. package/dist/components/ui/prompt-value-control.d.ts +28 -0
  133. package/dist/components/ui/prompt-value-control.js +36 -0
  134. package/dist/components/ui/sheet.d.ts +1 -1
  135. package/dist/components/ui/spinner.d.ts +1 -1
  136. package/dist/components/ui/switch.d.ts +2 -2
  137. package/dist/components/ui/textarea.cjs +1 -1
  138. package/dist/components/ui/textarea.js +1 -1
  139. package/dist/components/ui/toggle-group.d.ts +2 -2
  140. package/dist/components/ui/toggle.d.ts +2 -2
  141. package/dist/components/ui/variable-value-control.cjs +98 -0
  142. package/dist/components/ui/variable-value-control.d.ts +35 -0
  143. package/dist/components/ui/variable-value-control.js +64 -0
  144. package/dist/index.cjs +145 -16
  145. package/dist/index.d.ts +21 -3
  146. package/dist/index.js +11 -2
  147. package/dist/lib/index.cjs +4 -1
  148. package/dist/lib/index.d.ts +1 -1
  149. package/dist/lib/index.js +2 -2
  150. package/dist/lib/utils.cjs +21 -1
  151. package/dist/lib/utils.d.ts +8 -0
  152. package/dist/lib/utils.js +18 -1
  153. package/dist/styles.css +279 -0
  154. package/package.json +1 -1
@@ -0,0 +1,86 @@
1
+ "use strict";
2
+ var __webpack_require__ = {};
3
+ (()=>{
4
+ __webpack_require__.d = (exports1, definition)=>{
5
+ for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
6
+ enumerable: true,
7
+ get: definition[key]
8
+ });
9
+ };
10
+ })();
11
+ (()=>{
12
+ __webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
13
+ })();
14
+ (()=>{
15
+ __webpack_require__.r = (exports1)=>{
16
+ if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
17
+ value: 'Module'
18
+ });
19
+ Object.defineProperty(exports1, '__esModule', {
20
+ value: true
21
+ });
22
+ };
23
+ })();
24
+ var __webpack_exports__ = {};
25
+ __webpack_require__.r(__webpack_exports__);
26
+ __webpack_require__.d(__webpack_exports__, {
27
+ JsonLeafValueEditor: ()=>JsonLeafValueEditor
28
+ });
29
+ const jsx_runtime_namespaceObject = require("react/jsx-runtime");
30
+ const index_cjs_namespaceObject = require("../../../lib/index.cjs");
31
+ const external_react_namespaceObject = require("react");
32
+ const external_strings_cjs_namespaceObject = require("./strings.cjs");
33
+ const external_leafEditTypes_cjs_namespaceObject = require("./leafEditTypes.cjs");
34
+ function JsonLeafValueEditor({ node, onCommit, onCancel, className }) {
35
+ const strings = (0, external_strings_cjs_namespaceObject.useJsonTreeViewStrings)();
36
+ const editType = (0, external_leafEditTypes_cjs_namespaceObject.resolveLeafEditType)(node.type, node.schema);
37
+ const initial = void 0 === node.value || null === node.value ? String(node.schema?.default ?? '') : String(node.value);
38
+ const [raw, setRaw] = (0, external_react_namespaceObject.useState)(initial);
39
+ const cancelledRef = (0, external_react_namespaceObject.useRef)(false);
40
+ const inputRef = (0, external_react_namespaceObject.useRef)(null);
41
+ const invalid = void 0 === (0, external_leafEditTypes_cjs_namespaceObject.parseLeafValue)(raw, editType);
42
+ (0, external_react_namespaceObject.useEffect)(()=>{
43
+ inputRef.current?.focus();
44
+ }, []);
45
+ const commit = ()=>{
46
+ const parsed = (0, external_leafEditTypes_cjs_namespaceObject.parseLeafValue)(raw, editType);
47
+ if (void 0 === parsed) return;
48
+ onCommit(parsed);
49
+ };
50
+ return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("input", {
51
+ ref: inputRef,
52
+ type: "text",
53
+ value: raw,
54
+ inputMode: 'integer' === editType ? 'numeric' : 'number' === editType ? 'decimal' : void 0,
55
+ onChange: (e)=>setRaw(e.target.value),
56
+ onFocus: (e)=>e.target.select(),
57
+ onBlur: ()=>{
58
+ if (cancelledRef.current) {
59
+ cancelledRef.current = false;
60
+ return;
61
+ }
62
+ if (invalid) onCancel();
63
+ else commit();
64
+ },
65
+ onKeyDown: (e)=>{
66
+ if ('Enter' === e.key) commit();
67
+ if ('Escape' === e.key) {
68
+ e.preventDefault();
69
+ e.stopPropagation();
70
+ cancelledRef.current = true;
71
+ onCancel();
72
+ }
73
+ },
74
+ "aria-label": strings.editValueOf(node.key),
75
+ "aria-invalid": invalid || void 0,
76
+ placeholder: (0, external_leafEditTypes_cjs_namespaceObject.isNumericEdit)(editType) ? strings.enterNumber : strings.enterValue,
77
+ className: (0, index_cjs_namespaceObject.cn)('min-w-0 flex-1 rounded bg-transparent font-mono text-xs text-foreground outline-none ring-1', invalid ? 'ring-error' : 'ring-brand', className)
78
+ });
79
+ }
80
+ exports.JsonLeafValueEditor = __webpack_exports__.JsonLeafValueEditor;
81
+ for(var __rspack_i in __webpack_exports__)if (-1 === [
82
+ "JsonLeafValueEditor"
83
+ ].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
84
+ Object.defineProperty(exports, '__esModule', {
85
+ value: true
86
+ });
@@ -0,0 +1,12 @@
1
+ import type { JsonTreeNode, JsonValue } from './JsonTree.types';
2
+ export interface JsonLeafValueEditorProps {
3
+ node: JsonTreeNode;
4
+ onCommit: (value: JsonValue) => void;
5
+ onCancel: () => void;
6
+ className?: string;
7
+ }
8
+ /**
9
+ * Inline editor for scalar leaves (string, number, null). Commits on Enter or
10
+ * blur, cancels on Escape. Invalid numbers are flagged and never committed.
11
+ */
12
+ export declare function JsonLeafValueEditor({ node, onCommit, onCancel, className, }: JsonLeafValueEditorProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,52 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ import { cn } from "../../../lib/index.js";
3
+ import { useEffect, useRef, useState } from "react";
4
+ import { useJsonTreeViewStrings } from "./strings.js";
5
+ import { isNumericEdit, parseLeafValue, resolveLeafEditType } from "./leafEditTypes.js";
6
+ function JsonLeafValueEditor({ node, onCommit, onCancel, className }) {
7
+ const strings = useJsonTreeViewStrings();
8
+ const editType = resolveLeafEditType(node.type, node.schema);
9
+ const initial = void 0 === node.value || null === node.value ? String(node.schema?.default ?? '') : String(node.value);
10
+ const [raw, setRaw] = useState(initial);
11
+ const cancelledRef = useRef(false);
12
+ const inputRef = useRef(null);
13
+ const invalid = void 0 === parseLeafValue(raw, editType);
14
+ useEffect(()=>{
15
+ inputRef.current?.focus();
16
+ }, []);
17
+ const commit = ()=>{
18
+ const parsed = parseLeafValue(raw, editType);
19
+ if (void 0 === parsed) return;
20
+ onCommit(parsed);
21
+ };
22
+ return /*#__PURE__*/ jsx("input", {
23
+ ref: inputRef,
24
+ type: "text",
25
+ value: raw,
26
+ inputMode: 'integer' === editType ? 'numeric' : 'number' === editType ? 'decimal' : void 0,
27
+ onChange: (e)=>setRaw(e.target.value),
28
+ onFocus: (e)=>e.target.select(),
29
+ onBlur: ()=>{
30
+ if (cancelledRef.current) {
31
+ cancelledRef.current = false;
32
+ return;
33
+ }
34
+ if (invalid) onCancel();
35
+ else commit();
36
+ },
37
+ onKeyDown: (e)=>{
38
+ if ('Enter' === e.key) commit();
39
+ if ('Escape' === e.key) {
40
+ e.preventDefault();
41
+ e.stopPropagation();
42
+ cancelledRef.current = true;
43
+ onCancel();
44
+ }
45
+ },
46
+ "aria-label": strings.editValueOf(node.key),
47
+ "aria-invalid": invalid || void 0,
48
+ placeholder: isNumericEdit(editType) ? strings.enterNumber : strings.enterValue,
49
+ className: cn('min-w-0 flex-1 rounded bg-transparent font-mono text-xs text-foreground outline-none ring-1', invalid ? 'ring-error' : 'ring-brand', className)
50
+ });
51
+ }
52
+ export { JsonLeafValueEditor };
@@ -0,0 +1,74 @@
1
+ "use strict";
2
+ var __webpack_require__ = {};
3
+ (()=>{
4
+ __webpack_require__.d = (exports1, definition)=>{
5
+ for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
6
+ enumerable: true,
7
+ get: definition[key]
8
+ });
9
+ };
10
+ })();
11
+ (()=>{
12
+ __webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
13
+ })();
14
+ (()=>{
15
+ __webpack_require__.r = (exports1)=>{
16
+ if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
17
+ value: 'Module'
18
+ });
19
+ Object.defineProperty(exports1, '__esModule', {
20
+ value: true
21
+ });
22
+ };
23
+ })();
24
+ var __webpack_exports__ = {};
25
+ __webpack_require__.r(__webpack_exports__);
26
+ __webpack_require__.d(__webpack_exports__, {
27
+ JsonMultilineLeafEditor: ()=>JsonMultilineLeafEditor
28
+ });
29
+ const jsx_runtime_namespaceObject = require("react/jsx-runtime");
30
+ const index_cjs_namespaceObject = require("../../../lib/index.cjs");
31
+ const external_react_namespaceObject = require("react");
32
+ const external_strings_cjs_namespaceObject = require("./strings.cjs");
33
+ const external_EditorChrome_cjs_namespaceObject = require("./EditorChrome.cjs");
34
+ const external_leafEditTypes_cjs_namespaceObject = require("./leafEditTypes.cjs");
35
+ function JsonMultilineLeafEditor({ node, onCommit, onCancel, className }) {
36
+ const strings = (0, external_strings_cjs_namespaceObject.useJsonTreeViewStrings)();
37
+ const editType = (0, external_leafEditTypes_cjs_namespaceObject.resolveLeafEditType)(node.type, node.schema);
38
+ const initial = void 0 === node.value || null === node.value ? String(node.schema?.default ?? '') : String(node.value);
39
+ const [raw, setRaw] = (0, external_react_namespaceObject.useState)(initial);
40
+ const invalid = void 0 === (0, external_leafEditTypes_cjs_namespaceObject.parseLeafValue)(raw, editType);
41
+ const apply = ()=>{
42
+ const parsed = (0, external_leafEditTypes_cjs_namespaceObject.parseLeafValue)(raw, editType);
43
+ if (void 0 === parsed) return;
44
+ onCommit(parsed);
45
+ };
46
+ return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
47
+ className: (0, index_cjs_namespaceObject.cn)('flex flex-col gap-1.5', className),
48
+ children: [
49
+ /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_EditorChrome_cjs_namespaceObject.EditorTextarea, {
50
+ value: raw,
51
+ onChange: setRaw,
52
+ onApply: apply,
53
+ onCancel: onCancel,
54
+ invalid: invalid,
55
+ rows: Math.min(10, Math.max(3, raw.split('\n').length + 1)),
56
+ ariaLabel: strings.editValueOf(node.key),
57
+ placeholder: (0, external_leafEditTypes_cjs_namespaceObject.isNumericEdit)(editType) ? strings.enterNumber : strings.enterValue,
58
+ className: "whitespace-pre-wrap"
59
+ }),
60
+ /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_EditorChrome_cjs_namespaceObject.EditorActions, {
61
+ onApply: apply,
62
+ onCancel: onCancel,
63
+ applyDisabled: invalid
64
+ })
65
+ ]
66
+ });
67
+ }
68
+ exports.JsonMultilineLeafEditor = __webpack_exports__.JsonMultilineLeafEditor;
69
+ for(var __rspack_i in __webpack_exports__)if (-1 === [
70
+ "JsonMultilineLeafEditor"
71
+ ].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
72
+ Object.defineProperty(exports, '__esModule', {
73
+ value: true
74
+ });
@@ -0,0 +1,13 @@
1
+ import type { JsonTreeNode, JsonValue } from './JsonTree.types';
2
+ export interface JsonMultilineLeafEditorProps {
3
+ node: JsonTreeNode;
4
+ onCommit: (value: JsonValue) => void;
5
+ onCancel: () => void;
6
+ className?: string;
7
+ }
8
+ /**
9
+ * Multiline editor for scalar leaves, used by the expanded row view so long
10
+ * values can wrap. Applies with the Apply button or Ctrl/Cmd+Enter; Escape
11
+ * cancels. Commits with the same type rules as the inline leaf editor.
12
+ */
13
+ export declare function JsonMultilineLeafEditor({ node, onCommit, onCancel, className, }: JsonMultilineLeafEditorProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,40 @@
1
+ import { jsx, jsxs } from "react/jsx-runtime";
2
+ import { cn } from "../../../lib/index.js";
3
+ import { useState } from "react";
4
+ import { useJsonTreeViewStrings } from "./strings.js";
5
+ import { EditorActions, EditorTextarea } from "./EditorChrome.js";
6
+ import { isNumericEdit, parseLeafValue, resolveLeafEditType } from "./leafEditTypes.js";
7
+ function JsonMultilineLeafEditor({ node, onCommit, onCancel, className }) {
8
+ const strings = useJsonTreeViewStrings();
9
+ const editType = resolveLeafEditType(node.type, node.schema);
10
+ const initial = void 0 === node.value || null === node.value ? String(node.schema?.default ?? '') : String(node.value);
11
+ const [raw, setRaw] = useState(initial);
12
+ const invalid = void 0 === parseLeafValue(raw, editType);
13
+ const apply = ()=>{
14
+ const parsed = parseLeafValue(raw, editType);
15
+ if (void 0 === parsed) return;
16
+ onCommit(parsed);
17
+ };
18
+ return /*#__PURE__*/ jsxs("div", {
19
+ className: cn('flex flex-col gap-1.5', className),
20
+ children: [
21
+ /*#__PURE__*/ jsx(EditorTextarea, {
22
+ value: raw,
23
+ onChange: setRaw,
24
+ onApply: apply,
25
+ onCancel: onCancel,
26
+ invalid: invalid,
27
+ rows: Math.min(10, Math.max(3, raw.split('\n').length + 1)),
28
+ ariaLabel: strings.editValueOf(node.key),
29
+ placeholder: isNumericEdit(editType) ? strings.enterNumber : strings.enterValue,
30
+ className: "whitespace-pre-wrap"
31
+ }),
32
+ /*#__PURE__*/ jsx(EditorActions, {
33
+ onApply: apply,
34
+ onCancel: onCancel,
35
+ applyDisabled: invalid
36
+ })
37
+ ]
38
+ });
39
+ }
40
+ export { JsonMultilineLeafEditor };
@@ -0,0 +1,253 @@
1
+ "use strict";
2
+ var __webpack_require__ = {};
3
+ (()=>{
4
+ __webpack_require__.d = (exports1, definition)=>{
5
+ for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
6
+ enumerable: true,
7
+ get: definition[key]
8
+ });
9
+ };
10
+ })();
11
+ (()=>{
12
+ __webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
13
+ })();
14
+ (()=>{
15
+ __webpack_require__.r = (exports1)=>{
16
+ if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
17
+ value: 'Module'
18
+ });
19
+ Object.defineProperty(exports1, '__esModule', {
20
+ value: true
21
+ });
22
+ };
23
+ })();
24
+ var __webpack_exports__ = {};
25
+ __webpack_require__.r(__webpack_exports__);
26
+ __webpack_require__.d(__webpack_exports__, {
27
+ JsonTreeView: ()=>JsonTreeView
28
+ });
29
+ const jsx_runtime_namespaceObject = require("react/jsx-runtime");
30
+ const react_virtual_namespaceObject = require("@tanstack/react-virtual");
31
+ const external_react_namespaceObject = require("react");
32
+ const index_cjs_namespaceObject = require("../../../lib/index.cjs");
33
+ const external_buildJsonTree_cjs_namespaceObject = require("./buildJsonTree.cjs");
34
+ const external_clipboard_cjs_namespaceObject = require("./clipboard.cjs");
35
+ const external_JsonTreeRow_cjs_namespaceObject = require("./JsonTreeRow.cjs");
36
+ const external_JsonTreeTooltip_cjs_namespaceObject = require("./JsonTreeTooltip.cjs");
37
+ const external_strings_cjs_namespaceObject = require("./strings.cjs");
38
+ const useIsomorphicLayoutEffect = "u" < typeof window ? external_react_namespaceObject.useEffect : external_react_namespaceObject.useLayoutEffect;
39
+ const VIRTUAL_OVERSCAN = 10;
40
+ function scrollMarginOf(element, scrollElement) {
41
+ return Math.round(element.getBoundingClientRect().top - scrollElement.getBoundingClientRect().top + scrollElement.scrollTop);
42
+ }
43
+ function VirtualRows({ rows, container, scrollElement, pinnedPaths }) {
44
+ const [scrollMargin, setScrollMargin] = (0, external_react_namespaceObject.useState)(0);
45
+ const getItemKey = (0, external_react_namespaceObject.useCallback)((index)=>rows[index]?.node.path ?? index, [
46
+ rows
47
+ ]);
48
+ const virtualizer = (0, react_virtual_namespaceObject.useVirtualizer)({
49
+ count: rows.length,
50
+ getScrollElement: ()=>scrollElement ?? container,
51
+ estimateSize: ()=>external_JsonTreeRow_cjs_namespaceObject.ROW_MIN_HEIGHT_PX,
52
+ getItemKey,
53
+ overscan: VIRTUAL_OVERSCAN,
54
+ scrollMargin
55
+ });
56
+ useIsomorphicLayoutEffect(()=>{
57
+ if (!container || !scrollElement) {
58
+ if (0 !== scrollMargin) setScrollMargin(0);
59
+ return;
60
+ }
61
+ if (virtualizer.isScrolling) return;
62
+ const next = scrollMarginOf(container, scrollElement);
63
+ if (next !== scrollMargin) setScrollMargin(next);
64
+ });
65
+ const isPinning = pinnedPaths.length > 0;
66
+ const indexByPath = (0, external_react_namespaceObject.useMemo)(()=>{
67
+ if (!isPinning) return;
68
+ const byPath = new Map();
69
+ for (const [index, row] of rows.entries())byPath.set(row.node.path, index);
70
+ return byPath;
71
+ }, [
72
+ isPinning,
73
+ rows
74
+ ]);
75
+ const items = virtualizer.getVirtualItems();
76
+ const firstWindowed = items[0]?.index ?? -1;
77
+ const lastWindowed = items[items.length - 1]?.index ?? -2;
78
+ const pinnedItems = [];
79
+ if (indexByPath) for (const path of pinnedPaths){
80
+ const index = indexByPath.get(path);
81
+ if (void 0 === index || index >= firstWindowed && index <= lastWindowed) continue;
82
+ const measurement = virtualizer.measurementsCache[index];
83
+ if (measurement) pinnedItems.push(measurement);
84
+ }
85
+ const rendered = 0 === pinnedItems.length ? items : [
86
+ ...pinnedItems.filter((item)=>item.index < firstWindowed),
87
+ ...items,
88
+ ...pinnedItems.filter((item)=>item.index > lastWindowed)
89
+ ];
90
+ return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
91
+ className: "relative",
92
+ style: {
93
+ height: virtualizer.getTotalSize()
94
+ },
95
+ children: rendered.map((item)=>{
96
+ const row = rows[item.index];
97
+ if (!row) return null;
98
+ return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
99
+ "data-index": item.index,
100
+ ref: virtualizer.measureElement,
101
+ className: "absolute top-0 left-0 w-full",
102
+ style: {
103
+ transform: `translateY(${item.start - virtualizer.options.scrollMargin}px)`
104
+ },
105
+ children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_JsonTreeRow_cjs_namespaceObject.JsonTreeRow, {
106
+ node: row.node,
107
+ depth: row.depth
108
+ })
109
+ }, item.key);
110
+ })
111
+ });
112
+ }
113
+ function valueAsText(node) {
114
+ if ('string' == typeof node.value) return node.value;
115
+ if (void 0 === node.value) return 'null';
116
+ return JSON.stringify(node.value, null, 2);
117
+ }
118
+ const DefaultRowWrapper = ({ className, style, onClick, children })=>/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
119
+ className: className,
120
+ style: style,
121
+ onClick: onClick,
122
+ children: children
123
+ });
124
+ function JsonTreeView({ strings, tooltipContentClassName, ...props }) {
125
+ return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_strings_cjs_namespaceObject.JsonTreeViewProvider, {
126
+ strings: strings,
127
+ tooltipContentClassName: tooltipContentClassName,
128
+ children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(JsonTreeViewContent, {
129
+ ...props
130
+ })
131
+ });
132
+ }
133
+ function JsonTreeViewContent({ nodes, collapsed = {}, onToggleCollapsed, query, filterPredicate, readOnly = false, onEdit, rowWrapper, decorateNode, deriveTypeIcon, renderValue, nodeActions, maxInlineActions = 3, renderCodeEditor, pathForCopy, onCopy, virtualized = false, scrollElement, emptyMessage, className }) {
134
+ const strings = (0, external_strings_cjs_namespaceObject.useJsonTreeViewStrings)();
135
+ const [container, setContainer] = (0, external_react_namespaceObject.useState)(null);
136
+ const usesAncestorScroller = virtualized && !!scrollElement;
137
+ const RowWrapper = rowWrapper ?? DefaultRowWrapper;
138
+ const [editingPath, setEditingPath] = (0, external_react_namespaceObject.useState)(null);
139
+ const [jsonEditingPath, setJsonEditingPath] = (0, external_react_namespaceObject.useState)(null);
140
+ const [wrappedPaths, setWrappedPaths] = (0, external_react_namespaceObject.useState)({});
141
+ const pinnedPaths = (0, external_react_namespaceObject.useMemo)(()=>[
142
+ ...new Set([
143
+ editingPath,
144
+ jsonEditingPath
145
+ ].filter((path)=>null !== path))
146
+ ], [
147
+ editingPath,
148
+ jsonEditingPath
149
+ ]);
150
+ const [copied, setCopied] = (0, external_react_namespaceObject.useState)(null);
151
+ const copyTimerRef = (0, external_react_namespaceObject.useRef)(null);
152
+ (0, external_react_namespaceObject.useEffect)(()=>()=>{
153
+ if (copyTimerRef.current) clearTimeout(copyTimerRef.current);
154
+ }, []);
155
+ const copy = (node, kind, text)=>{
156
+ (0, external_clipboard_cjs_namespaceObject.copyTextToClipboard)(text).then((ok)=>{
157
+ if (!ok) return;
158
+ setCopied({
159
+ path: node.path,
160
+ kind
161
+ });
162
+ if (copyTimerRef.current) clearTimeout(copyTimerRef.current);
163
+ copyTimerRef.current = setTimeout(()=>setCopied(null), 1500);
164
+ onCopy?.({
165
+ kind,
166
+ path: node.path,
167
+ text
168
+ });
169
+ });
170
+ };
171
+ const copyPath = (node)=>copy(node, 'path', pathForCopy?.(node.path) ?? node.path);
172
+ const copyValue = (node)=>copy(node, 'value', valueAsText(node));
173
+ const toggleWrapped = (node)=>{
174
+ setWrappedPaths((prev)=>({
175
+ ...prev,
176
+ [node.path]: !prev[node.path]
177
+ }));
178
+ if (editingPath === node.path) setEditingPath(null);
179
+ };
180
+ const commitEdit = (node, value)=>onEdit?.(node, value);
181
+ const canEdit = !readOnly && !!onEdit;
182
+ const rows = (0, external_react_namespaceObject.useMemo)(()=>(0, external_buildJsonTree_cjs_namespaceObject.flattenJsonTree)(nodes, {
183
+ collapsed,
184
+ query,
185
+ filterPredicate,
186
+ displayTexts: decorateNode
187
+ }), [
188
+ nodes,
189
+ collapsed,
190
+ query,
191
+ filterPredicate,
192
+ decorateNode
193
+ ]);
194
+ const templateItemLabel = strings.arrayItem;
195
+ const filtering = !!query?.trim() || !!filterPredicate;
196
+ const resolvedEmptyMessage = filtering ? strings.emptySearch : emptyMessage ?? strings.emptyDefault;
197
+ const rowContext = {
198
+ collapsed,
199
+ onToggleCollapsed,
200
+ readOnly,
201
+ decorateNode,
202
+ deriveTypeIcon,
203
+ renderValue,
204
+ nodeActions,
205
+ maxInlineActions,
206
+ renderCodeEditor,
207
+ pathForCopy,
208
+ canEdit,
209
+ RowWrapper,
210
+ templateItemLabel,
211
+ editingPath,
212
+ jsonEditingPath,
213
+ wrappedPaths,
214
+ copied,
215
+ setEditingPath,
216
+ setJsonEditingPath,
217
+ copyPath,
218
+ copyValue,
219
+ toggleWrapped,
220
+ commitEdit
221
+ };
222
+ return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_JsonTreeTooltip_cjs_namespaceObject.JsonTreeTooltipProvider, {
223
+ children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_JsonTreeRow_cjs_namespaceObject.JsonTreeRowContextProvider, {
224
+ value: rowContext,
225
+ children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
226
+ ref: setContainer,
227
+ className: (0, index_cjs_namespaceObject.cn)(usesAncestorScroller ? 'overflow-x-clip' : 'h-full overflow-y-auto overflow-x-hidden', virtualized && !usesAncestorScroller && 'max-h-screen', virtualized && '[overflow-anchor:none]', className),
228
+ children: [
229
+ virtualized ? /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(VirtualRows, {
230
+ rows: rows,
231
+ container: container,
232
+ scrollElement: scrollElement,
233
+ pinnedPaths: pinnedPaths
234
+ }) : rows.map(({ node, depth })=>/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_JsonTreeRow_cjs_namespaceObject.JsonTreeRow, {
235
+ node: node,
236
+ depth: depth
237
+ }, node.path)),
238
+ 0 === rows.length && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("span", {
239
+ className: "p-4 text-center text-xs text-foreground-subtle",
240
+ children: resolvedEmptyMessage
241
+ })
242
+ ]
243
+ })
244
+ })
245
+ });
246
+ }
247
+ exports.JsonTreeView = __webpack_exports__.JsonTreeView;
248
+ for(var __rspack_i in __webpack_exports__)if (-1 === [
249
+ "JsonTreeView"
250
+ ].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
251
+ Object.defineProperty(exports, '__esModule', {
252
+ value: true
253
+ });
@@ -0,0 +1,81 @@
1
+ import type { CopyEvent, DeriveTypeIcon, JsonTreeNode, JsonTreeRowWrapper, JsonValue, NodeActionsResolver, NodeDecoration, RenderCodeEditor, RenderValueCell } from './JsonTree.types';
2
+ import { type JsonTreeViewStrings } from './strings';
3
+ export interface JsonTreeViewProps {
4
+ /** Tree built with `buildJsonTree`. */
5
+ nodes: JsonTreeNode[];
6
+ /** Collapsed container paths. */
7
+ collapsed?: Record<string, boolean>;
8
+ onToggleCollapsed?: (path: string) => void;
9
+ /** Search query matched against keys and scalar values. */
10
+ query?: string;
11
+ /**
12
+ * Rows are kept when the node (or any descendant) matches; a node that
13
+ * matches directly shows its whole subtree.
14
+ */
15
+ filterPredicate?: (node: JsonTreeNode) => boolean;
16
+ /** Hides all editing affordances. */
17
+ readOnly?: boolean;
18
+ /** Called with the node and its new value after an inline edit. Undefined removes the value. */
19
+ onEdit?: (node: JsonTreeNode, value: JsonValue | undefined) => void;
20
+ /**
21
+ * Custom row container (e.g. to make rows drag sources). Renders `children`
22
+ * inside a single element applying `className`/`style`. Must be a stable
23
+ * component reference (module scope or memoized), not an inline arrow.
24
+ */
25
+ rowWrapper?: JsonTreeRowWrapper;
26
+ /** Per-node visual annotations (labels, chips, badge overrides). None by default. */
27
+ decorateNode?: (node: JsonTreeNode) => NodeDecoration | undefined;
28
+ /** Custom type-badge icons per node. Return undefined to keep the default type icon. */
29
+ deriveTypeIcon?: DeriveTypeIcon;
30
+ /** Custom value cell renderer; return undefined to keep the default cell. */
31
+ renderValue?: RenderValueCell;
32
+ /**
33
+ * Customizes the trailing row actions per node: compose with the built-ins
34
+ * via `ctx.defaultActions`, return `[]` to omit them, or `undefined` to keep
35
+ * the defaults.
36
+ */
37
+ nodeActions?: NodeActionsResolver;
38
+ /**
39
+ * Maximum row actions shown inline before the surplus collapses into an
40
+ * overflow menu. Default 3.
41
+ */
42
+ maxInlineActions?: number;
43
+ /** Renders the object/array editing surface as a code editor (defaults to a textarea). */
44
+ renderCodeEditor?: RenderCodeEditor;
45
+ /** Builds the text copied when a field name is clicked. Defaults to the path itself. */
46
+ pathForCopy?: (path: string) => string;
47
+ /** Called after something is copied to the clipboard. */
48
+ onCopy?: (event: CopyEvent) => void;
49
+ /**
50
+ * Mounts only the rows in view (plus a small overscan) instead of every row,
51
+ * for values with thousands of fields. Rows are measured, so wrapped values
52
+ * and inline editors keep their height. The tree scrolls inside its own box,
53
+ * capped at the viewport height, unless `scrollElement` names the scroller.
54
+ * Off by default.
55
+ */
56
+ virtualized?: boolean;
57
+ /**
58
+ * With `virtualized`, the ancestor that scrolls the tree. The tree then grows
59
+ * to its content and windows its rows by that element's scroll position, so
60
+ * the panel keeps its single scrollbar. The element must be height-bound: one
61
+ * that grows with its content never scrolls, and every row would count as in
62
+ * view.
63
+ */
64
+ scrollElement?: HTMLElement | null;
65
+ emptyMessage?: string;
66
+ /**
67
+ * Overrides for the tree's user-facing strings. Omitted keys fall back to an outer
68
+ * `JsonTreeViewProvider`, then to `DEFAULT_JSON_TREE_VIEW_STRINGS` (English).
69
+ */
70
+ strings?: Partial<JsonTreeViewStrings>;
71
+ /** Extra classes for every tooltip panel (e.g. a z-index above a host's overlays). */
72
+ tooltipContentClassName?: string;
73
+ className?: string;
74
+ }
75
+ /**
76
+ * Interactive tree of a JSON value merged with its schema. Containers
77
+ * collapse, leaves edit inline (all JSON types), field names copy their
78
+ * path, and the row actions copy the value or wrap long scalars
79
+ * into a full-width block with a multiline editor.
80
+ */
81
+ export declare function JsonTreeView({ strings, tooltipContentClassName, ...props }: JsonTreeViewProps): import("react/jsx-runtime").JSX.Element;