@uipath/apollo-wind 2.67.1 → 2.68.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.
- package/dist/components/forms/metadata-form.cjs +40 -44
- package/dist/components/forms/metadata-form.js +40 -44
- package/dist/components/ui/index.cjs +51 -40
- package/dist/components/ui/index.d.ts +1 -0
- package/dist/components/ui/index.js +1 -0
- package/dist/components/ui/json-tree-view/JsonTree.types.d.ts +26 -0
- package/dist/components/ui/json-tree-view/JsonTreeRow.cjs +13 -10
- package/dist/components/ui/json-tree-view/JsonTreeRow.js +14 -11
- package/dist/components/ui/json-tree-view/JsonTreeToolbar.cjs +22 -11
- package/dist/components/ui/json-tree-view/JsonTreeToolbar.d.ts +6 -1
- package/dist/components/ui/json-tree-view/JsonTreeToolbar.js +22 -11
- package/dist/components/ui/json-tree-view/NodeKey.cjs +4 -0
- package/dist/components/ui/json-tree-view/NodeKey.js +4 -0
- package/dist/components/ui/json-tree-view/RowActions.cjs +23 -17
- package/dist/components/ui/json-tree-view/RowActions.d.ts +4 -1
- package/dist/components/ui/json-tree-view/RowActions.js +23 -17
- package/dist/components/ui/json-tree-view/buildJsonTree.cjs +99 -44
- package/dist/components/ui/json-tree-view/buildJsonTree.d.ts +15 -2
- package/dist/components/ui/json-tree-view/buildJsonTree.js +97 -45
- package/dist/components/ui/panel-tabs.cjs +99 -0
- package/dist/components/ui/panel-tabs.d.ts +34 -0
- package/dist/components/ui/panel-tabs.js +53 -0
- package/dist/index.cjs +29 -10
- package/dist/index.d.ts +3 -1
- package/dist/index.js +3 -2
- package/dist/styles.css +33 -0
- package/package.json +1 -1
|
@@ -42,12 +42,12 @@ const external_JsonTypeBadge_cjs_namespaceObject = require("./JsonTypeBadge.cjs"
|
|
|
42
42
|
const external_NodeKey_cjs_namespaceObject = require("./NodeKey.cjs");
|
|
43
43
|
const external_RowActions_cjs_namespaceObject = require("./RowActions.cjs");
|
|
44
44
|
const external_ScalarValueCell_cjs_namespaceObject = require("./ScalarValueCell.cjs");
|
|
45
|
-
const ROW_CLASS = 'group flex min-h-7 cursor-default items-center gap-
|
|
45
|
+
const ROW_CLASS = 'group flex min-h-7 cursor-default items-center gap-2 py-1 pr-1 transition hover:bg-surface-overlay';
|
|
46
46
|
const ROW_MIN_HEIGHT_PX = 28;
|
|
47
47
|
const VALUE_CELL_CLASS = 'flex min-w-8 flex-1 items-center';
|
|
48
48
|
function rowIndent(depth, extra = 0) {
|
|
49
49
|
return {
|
|
50
|
-
paddingLeft: `${
|
|
50
|
+
paddingLeft: `${8 + 16 * depth + extra}px`
|
|
51
51
|
};
|
|
52
52
|
}
|
|
53
53
|
const KEY_ALIGN_OFFSET = 44;
|
|
@@ -138,12 +138,13 @@ function JsonTreeRow({ node, depth }) {
|
|
|
138
138
|
isContainer ? /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("button", {
|
|
139
139
|
type: "button",
|
|
140
140
|
onClick: ()=>onToggleCollapsed?.(node.path),
|
|
141
|
-
|
|
142
|
-
"aria-
|
|
143
|
-
|
|
141
|
+
disabled: !onToggleCollapsed,
|
|
142
|
+
"aria-label": (0, external_buildJsonTree_cjs_namespaceObject.isPathCollapsed)(collapsed, node.path) ? strings.expandKey(node.key) : strings.collapseKey(node.key),
|
|
143
|
+
"aria-expanded": !(0, external_buildJsonTree_cjs_namespaceObject.isPathCollapsed)(collapsed, node.path),
|
|
144
|
+
className: "grid size-2.5 shrink-0 cursor-pointer place-items-center text-foreground-subtle transition hover:text-foreground disabled:cursor-default disabled:hover:text-foreground-subtle",
|
|
144
145
|
children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_lucide_react_namespaceObject.ChevronDown, {
|
|
145
146
|
size: 10,
|
|
146
|
-
className: (0, index_cjs_namespaceObject.cn)('transition-transform duration-100', collapsed
|
|
147
|
+
className: (0, index_cjs_namespaceObject.cn)('transition-transform duration-100', (0, external_buildJsonTree_cjs_namespaceObject.isPathCollapsed)(collapsed, node.path) && '-rotate-90')
|
|
147
148
|
})
|
|
148
149
|
}) : /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
|
|
149
150
|
className: "size-2.5 shrink-0"
|
|
@@ -168,7 +169,7 @@ function JsonTreeRow({ node, depth }) {
|
|
|
168
169
|
"aria-label": strings.pathCopied
|
|
169
170
|
}),
|
|
170
171
|
decoration?.sublabel && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("span", {
|
|
171
|
-
className:
|
|
172
|
+
className: (0, index_cjs_namespaceObject.cn)('min-w-0 truncate font-mono text-[10px] text-foreground-subtle leading-4', decoration.sublabelOnHover && 'hidden group-hover:block group-focus-within:block'),
|
|
172
173
|
children: decoration.sublabel
|
|
173
174
|
}),
|
|
174
175
|
node.required && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_label_cjs_namespaceObject.RequiredIndicator, {
|
|
@@ -191,12 +192,13 @@ function JsonTreeRow({ node, depth }) {
|
|
|
191
192
|
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_RowActions_cjs_namespaceObject.RowActions, {
|
|
192
193
|
node: node,
|
|
193
194
|
actions: actions,
|
|
194
|
-
maxInline: maxInlineActions
|
|
195
|
+
maxInline: maxInlineActions,
|
|
196
|
+
meta: decoration?.meta
|
|
195
197
|
})
|
|
196
198
|
]
|
|
197
199
|
}) : /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(jsx_runtime_namespaceObject.Fragment, {
|
|
198
200
|
children: [
|
|
199
|
-
!wrapped && (null != customCell ? /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("span", {
|
|
201
|
+
!wrapped && !decoration?.hideValue && (null != customCell ? /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("span", {
|
|
200
202
|
className: VALUE_CELL_CLASS,
|
|
201
203
|
children: customCell
|
|
202
204
|
}) : !(readOnly && void 0 === node.value || isTemplate) && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(jsx_runtime_namespaceObject.Fragment, {
|
|
@@ -226,7 +228,8 @@ function JsonTreeRow({ node, depth }) {
|
|
|
226
228
|
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_RowActions_cjs_namespaceObject.RowActions, {
|
|
227
229
|
node: node,
|
|
228
230
|
actions: actions,
|
|
229
|
-
maxInline: maxInlineActions
|
|
231
|
+
maxInline: maxInlineActions,
|
|
232
|
+
meta: decoration?.meta
|
|
230
233
|
})
|
|
231
234
|
]
|
|
232
235
|
})
|
|
@@ -4,7 +4,7 @@ import { RequiredIndicator } from "../label.js";
|
|
|
4
4
|
import { ChevronDown, CircleCheck, Copy, Pencil, WrapText } from "lucide-react";
|
|
5
5
|
import { createContext, useContext } from "react";
|
|
6
6
|
import { useJsonTreeViewStrings } from "./strings.js";
|
|
7
|
-
import { formatLeafValue, isArrayItemTemplateRoot } from "./buildJsonTree.js";
|
|
7
|
+
import { formatLeafValue, isArrayItemTemplateRoot, isPathCollapsed } from "./buildJsonTree.js";
|
|
8
8
|
import { DecorationChip } from "./DecorationChip.js";
|
|
9
9
|
import { JsonContainerEditor } from "./JsonContainerEditor.js";
|
|
10
10
|
import { JsonMultilineLeafEditor } from "./JsonMultilineLeafEditor.js";
|
|
@@ -12,12 +12,12 @@ import { JsonTypeBadge } from "./JsonTypeBadge.js";
|
|
|
12
12
|
import { NodeKey } from "./NodeKey.js";
|
|
13
13
|
import { RowActions } from "./RowActions.js";
|
|
14
14
|
import { ScalarValueCell, valueColorClass } from "./ScalarValueCell.js";
|
|
15
|
-
const ROW_CLASS = 'group flex min-h-7 cursor-default items-center gap-
|
|
15
|
+
const ROW_CLASS = 'group flex min-h-7 cursor-default items-center gap-2 py-1 pr-1 transition hover:bg-surface-overlay';
|
|
16
16
|
const ROW_MIN_HEIGHT_PX = 28;
|
|
17
17
|
const VALUE_CELL_CLASS = 'flex min-w-8 flex-1 items-center';
|
|
18
18
|
function rowIndent(depth, extra = 0) {
|
|
19
19
|
return {
|
|
20
|
-
paddingLeft: `${
|
|
20
|
+
paddingLeft: `${8 + 16 * depth + extra}px`
|
|
21
21
|
};
|
|
22
22
|
}
|
|
23
23
|
const KEY_ALIGN_OFFSET = 44;
|
|
@@ -108,12 +108,13 @@ function JsonTreeRow({ node, depth }) {
|
|
|
108
108
|
isContainer ? /*#__PURE__*/ jsx("button", {
|
|
109
109
|
type: "button",
|
|
110
110
|
onClick: ()=>onToggleCollapsed?.(node.path),
|
|
111
|
-
|
|
112
|
-
"aria-
|
|
113
|
-
|
|
111
|
+
disabled: !onToggleCollapsed,
|
|
112
|
+
"aria-label": isPathCollapsed(collapsed, node.path) ? strings.expandKey(node.key) : strings.collapseKey(node.key),
|
|
113
|
+
"aria-expanded": !isPathCollapsed(collapsed, node.path),
|
|
114
|
+
className: "grid size-2.5 shrink-0 cursor-pointer place-items-center text-foreground-subtle transition hover:text-foreground disabled:cursor-default disabled:hover:text-foreground-subtle",
|
|
114
115
|
children: /*#__PURE__*/ jsx(ChevronDown, {
|
|
115
116
|
size: 10,
|
|
116
|
-
className: cn('transition-transform duration-100', collapsed
|
|
117
|
+
className: cn('transition-transform duration-100', isPathCollapsed(collapsed, node.path) && '-rotate-90')
|
|
117
118
|
})
|
|
118
119
|
}) : /*#__PURE__*/ jsx("div", {
|
|
119
120
|
className: "size-2.5 shrink-0"
|
|
@@ -138,7 +139,7 @@ function JsonTreeRow({ node, depth }) {
|
|
|
138
139
|
"aria-label": strings.pathCopied
|
|
139
140
|
}),
|
|
140
141
|
decoration?.sublabel && /*#__PURE__*/ jsx("span", {
|
|
141
|
-
className:
|
|
142
|
+
className: cn('min-w-0 truncate font-mono text-[10px] text-foreground-subtle leading-4', decoration.sublabelOnHover && 'hidden group-hover:block group-focus-within:block'),
|
|
142
143
|
children: decoration.sublabel
|
|
143
144
|
}),
|
|
144
145
|
node.required && /*#__PURE__*/ jsx(RequiredIndicator, {
|
|
@@ -161,12 +162,13 @@ function JsonTreeRow({ node, depth }) {
|
|
|
161
162
|
/*#__PURE__*/ jsx(RowActions, {
|
|
162
163
|
node: node,
|
|
163
164
|
actions: actions,
|
|
164
|
-
maxInline: maxInlineActions
|
|
165
|
+
maxInline: maxInlineActions,
|
|
166
|
+
meta: decoration?.meta
|
|
165
167
|
})
|
|
166
168
|
]
|
|
167
169
|
}) : /*#__PURE__*/ jsxs(Fragment, {
|
|
168
170
|
children: [
|
|
169
|
-
!wrapped && (null != customCell ? /*#__PURE__*/ jsx("span", {
|
|
171
|
+
!wrapped && !decoration?.hideValue && (null != customCell ? /*#__PURE__*/ jsx("span", {
|
|
170
172
|
className: VALUE_CELL_CLASS,
|
|
171
173
|
children: customCell
|
|
172
174
|
}) : !(readOnly && void 0 === node.value || isTemplate) && /*#__PURE__*/ jsxs(Fragment, {
|
|
@@ -196,7 +198,8 @@ function JsonTreeRow({ node, depth }) {
|
|
|
196
198
|
/*#__PURE__*/ jsx(RowActions, {
|
|
197
199
|
node: node,
|
|
198
200
|
actions: actions,
|
|
199
|
-
maxInline: maxInlineActions
|
|
201
|
+
maxInline: maxInlineActions,
|
|
202
|
+
meta: decoration?.meta
|
|
200
203
|
})
|
|
201
204
|
]
|
|
202
205
|
})
|
|
@@ -45,7 +45,7 @@ function JsonTreeToolbar({ strings, tooltipContentClassName, ...props }) {
|
|
|
45
45
|
})
|
|
46
46
|
});
|
|
47
47
|
}
|
|
48
|
-
function JsonTreeToolbarContent({ query, onQueryChange, searchPlaceholder, filters, activeFilterId = null, onFilterChange, allCollapsed = false, onToggleAll, leading, controlsHidden = false, className }) {
|
|
48
|
+
function JsonTreeToolbarContent({ query, onQueryChange, searchPlaceholder, filters, activeFilterId = null, onFilterChange, allCollapsed = false, onToggleAll, leading, trailing, controlsHidden = false, className }) {
|
|
49
49
|
const strings = (0, external_strings_cjs_namespaceObject.useJsonTreeViewStrings)();
|
|
50
50
|
const [searchOpen, setSearchOpen] = (0, external_react_namespaceObject.useState)(false);
|
|
51
51
|
const activeFilter = filters?.find((f)=>f.id === activeFilterId);
|
|
@@ -67,7 +67,7 @@ function JsonTreeToolbarContent({ query, onQueryChange, searchPlaceholder, filte
|
|
|
67
67
|
className: "relative flex min-w-0 flex-1 items-center overflow-hidden",
|
|
68
68
|
children: [
|
|
69
69
|
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_lucide_react_namespaceObject.Search, {
|
|
70
|
-
size:
|
|
70
|
+
size: 12,
|
|
71
71
|
className: "pointer-events-none absolute left-2 text-foreground-subtle"
|
|
72
72
|
}),
|
|
73
73
|
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_input_cjs_namespaceObject.Input, {
|
|
@@ -78,7 +78,10 @@ function JsonTreeToolbarContent({ query, onQueryChange, searchPlaceholder, filte
|
|
|
78
78
|
value: query,
|
|
79
79
|
onChange: (e)=>onQueryChange(e.target.value),
|
|
80
80
|
onKeyDown: (e)=>{
|
|
81
|
-
if ('Escape'
|
|
81
|
+
if ('Escape' !== e.key) return;
|
|
82
|
+
e.preventDefault();
|
|
83
|
+
e.stopPropagation();
|
|
84
|
+
closeSearch();
|
|
82
85
|
},
|
|
83
86
|
"aria-label": resolvedSearchPlaceholder,
|
|
84
87
|
placeholder: resolvedSearchPlaceholder,
|
|
@@ -86,7 +89,7 @@ function JsonTreeToolbarContent({ query, onQueryChange, searchPlaceholder, filte
|
|
|
86
89
|
paddingLeft: '1.75rem',
|
|
87
90
|
paddingRight: '1.5rem'
|
|
88
91
|
},
|
|
89
|
-
className: "h-
|
|
92
|
+
className: "h-5 w-full text-foreground placeholder:text-foreground-subtle focus-visible:ring-0"
|
|
90
93
|
}),
|
|
91
94
|
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("button", {
|
|
92
95
|
type: "button",
|
|
@@ -109,13 +112,13 @@ function JsonTreeToolbarContent({ query, onQueryChange, searchPlaceholder, filte
|
|
|
109
112
|
delay: true,
|
|
110
113
|
children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_button_cjs_namespaceObject.Button, {
|
|
111
114
|
variant: "ghost",
|
|
112
|
-
size: "
|
|
115
|
+
size: "4xs",
|
|
113
116
|
icon: true,
|
|
114
117
|
onClick: ()=>setSearchOpen(true),
|
|
115
118
|
"aria-label": searchActionLabel,
|
|
116
119
|
className: "rounded text-foreground-subtle hover:bg-surface-overlay hover:text-foreground",
|
|
117
120
|
children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_lucide_react_namespaceObject.Search, {
|
|
118
|
-
size:
|
|
121
|
+
size: 12
|
|
119
122
|
})
|
|
120
123
|
})
|
|
121
124
|
})
|
|
@@ -131,13 +134,13 @@ function JsonTreeToolbarContent({ query, onQueryChange, searchPlaceholder, filte
|
|
|
131
134
|
asChild: true,
|
|
132
135
|
children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(external_button_cjs_namespaceObject.Button, {
|
|
133
136
|
variant: "ghost",
|
|
134
|
-
size: "
|
|
137
|
+
size: "4xs",
|
|
135
138
|
icon: true,
|
|
136
139
|
"aria-label": filterLabel,
|
|
137
140
|
className: "relative rounded text-foreground-subtle hover:bg-surface-overlay hover:text-foreground",
|
|
138
141
|
children: [
|
|
139
142
|
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_lucide_react_namespaceObject.Filter, {
|
|
140
|
-
size:
|
|
143
|
+
size: 12
|
|
141
144
|
}),
|
|
142
145
|
activeFilter && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("span", {
|
|
143
146
|
className: "absolute right-0.5 top-0.5 size-1.5 rounded-full bg-primary ring-1 ring-surface"
|
|
@@ -183,19 +186,27 @@ function JsonTreeToolbarContent({ query, onQueryChange, searchPlaceholder, filte
|
|
|
183
186
|
delay: true,
|
|
184
187
|
children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_button_cjs_namespaceObject.Button, {
|
|
185
188
|
variant: "ghost",
|
|
186
|
-
size: "
|
|
189
|
+
size: "4xs",
|
|
187
190
|
icon: true,
|
|
188
191
|
onClick: onToggleAll,
|
|
189
192
|
"aria-label": toggleAllLabel,
|
|
190
193
|
className: "rounded text-foreground-subtle hover:bg-surface-overlay hover:text-foreground",
|
|
191
194
|
children: allCollapsed ? /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_lucide_react_namespaceObject.ChevronsUpDown, {
|
|
192
|
-
size:
|
|
195
|
+
size: 12
|
|
193
196
|
}) : /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_lucide_react_namespaceObject.ChevronsDownUp, {
|
|
194
|
-
size:
|
|
197
|
+
size: 12
|
|
195
198
|
})
|
|
196
199
|
})
|
|
197
200
|
})
|
|
198
201
|
]
|
|
202
|
+
}),
|
|
203
|
+
trailing && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(jsx_runtime_namespaceObject.Fragment, {
|
|
204
|
+
children: [
|
|
205
|
+
controlsHidden && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
|
|
206
|
+
className: "flex-1"
|
|
207
|
+
}),
|
|
208
|
+
trailing
|
|
209
|
+
]
|
|
199
210
|
})
|
|
200
211
|
]
|
|
201
212
|
});
|
|
@@ -21,7 +21,12 @@ export interface JsonTreeToolbarProps {
|
|
|
21
21
|
*/
|
|
22
22
|
leading?: ReactNode;
|
|
23
23
|
/**
|
|
24
|
-
*
|
|
24
|
+
* Content rendered at the end of the row, after the tree controls (e.g. a
|
|
25
|
+
* node output mode select). Stays visible when `controlsHidden` is set.
|
|
26
|
+
*/
|
|
27
|
+
trailing?: ReactNode;
|
|
28
|
+
/**
|
|
29
|
+
* Hides the search / filter / collapse controls, keeping only `leading` and `trailing`.
|
|
25
30
|
* Use when a non-tree tab is active and the controls would be inert.
|
|
26
31
|
*/
|
|
27
32
|
controlsHidden?: boolean;
|
|
@@ -17,7 +17,7 @@ function JsonTreeToolbar({ strings, tooltipContentClassName, ...props }) {
|
|
|
17
17
|
})
|
|
18
18
|
});
|
|
19
19
|
}
|
|
20
|
-
function JsonTreeToolbarContent({ query, onQueryChange, searchPlaceholder, filters, activeFilterId = null, onFilterChange, allCollapsed = false, onToggleAll, leading, controlsHidden = false, className }) {
|
|
20
|
+
function JsonTreeToolbarContent({ query, onQueryChange, searchPlaceholder, filters, activeFilterId = null, onFilterChange, allCollapsed = false, onToggleAll, leading, trailing, controlsHidden = false, className }) {
|
|
21
21
|
const strings = useJsonTreeViewStrings();
|
|
22
22
|
const [searchOpen, setSearchOpen] = useState(false);
|
|
23
23
|
const activeFilter = filters?.find((f)=>f.id === activeFilterId);
|
|
@@ -39,7 +39,7 @@ function JsonTreeToolbarContent({ query, onQueryChange, searchPlaceholder, filte
|
|
|
39
39
|
className: "relative flex min-w-0 flex-1 items-center overflow-hidden",
|
|
40
40
|
children: [
|
|
41
41
|
/*#__PURE__*/ jsx(Search, {
|
|
42
|
-
size:
|
|
42
|
+
size: 12,
|
|
43
43
|
className: "pointer-events-none absolute left-2 text-foreground-subtle"
|
|
44
44
|
}),
|
|
45
45
|
/*#__PURE__*/ jsx(Input, {
|
|
@@ -50,7 +50,10 @@ function JsonTreeToolbarContent({ query, onQueryChange, searchPlaceholder, filte
|
|
|
50
50
|
value: query,
|
|
51
51
|
onChange: (e)=>onQueryChange(e.target.value),
|
|
52
52
|
onKeyDown: (e)=>{
|
|
53
|
-
if ('Escape'
|
|
53
|
+
if ('Escape' !== e.key) return;
|
|
54
|
+
e.preventDefault();
|
|
55
|
+
e.stopPropagation();
|
|
56
|
+
closeSearch();
|
|
54
57
|
},
|
|
55
58
|
"aria-label": resolvedSearchPlaceholder,
|
|
56
59
|
placeholder: resolvedSearchPlaceholder,
|
|
@@ -58,7 +61,7 @@ function JsonTreeToolbarContent({ query, onQueryChange, searchPlaceholder, filte
|
|
|
58
61
|
paddingLeft: '1.75rem',
|
|
59
62
|
paddingRight: '1.5rem'
|
|
60
63
|
},
|
|
61
|
-
className: "h-
|
|
64
|
+
className: "h-5 w-full text-foreground placeholder:text-foreground-subtle focus-visible:ring-0"
|
|
62
65
|
}),
|
|
63
66
|
/*#__PURE__*/ jsx("button", {
|
|
64
67
|
type: "button",
|
|
@@ -81,13 +84,13 @@ function JsonTreeToolbarContent({ query, onQueryChange, searchPlaceholder, filte
|
|
|
81
84
|
delay: true,
|
|
82
85
|
children: /*#__PURE__*/ jsx(Button, {
|
|
83
86
|
variant: "ghost",
|
|
84
|
-
size: "
|
|
87
|
+
size: "4xs",
|
|
85
88
|
icon: true,
|
|
86
89
|
onClick: ()=>setSearchOpen(true),
|
|
87
90
|
"aria-label": searchActionLabel,
|
|
88
91
|
className: "rounded text-foreground-subtle hover:bg-surface-overlay hover:text-foreground",
|
|
89
92
|
children: /*#__PURE__*/ jsx(Search, {
|
|
90
|
-
size:
|
|
93
|
+
size: 12
|
|
91
94
|
})
|
|
92
95
|
})
|
|
93
96
|
})
|
|
@@ -103,13 +106,13 @@ function JsonTreeToolbarContent({ query, onQueryChange, searchPlaceholder, filte
|
|
|
103
106
|
asChild: true,
|
|
104
107
|
children: /*#__PURE__*/ jsxs(Button, {
|
|
105
108
|
variant: "ghost",
|
|
106
|
-
size: "
|
|
109
|
+
size: "4xs",
|
|
107
110
|
icon: true,
|
|
108
111
|
"aria-label": filterLabel,
|
|
109
112
|
className: "relative rounded text-foreground-subtle hover:bg-surface-overlay hover:text-foreground",
|
|
110
113
|
children: [
|
|
111
114
|
/*#__PURE__*/ jsx(Filter, {
|
|
112
|
-
size:
|
|
115
|
+
size: 12
|
|
113
116
|
}),
|
|
114
117
|
activeFilter && /*#__PURE__*/ jsx("span", {
|
|
115
118
|
className: "absolute right-0.5 top-0.5 size-1.5 rounded-full bg-primary ring-1 ring-surface"
|
|
@@ -155,19 +158,27 @@ function JsonTreeToolbarContent({ query, onQueryChange, searchPlaceholder, filte
|
|
|
155
158
|
delay: true,
|
|
156
159
|
children: /*#__PURE__*/ jsx(Button, {
|
|
157
160
|
variant: "ghost",
|
|
158
|
-
size: "
|
|
161
|
+
size: "4xs",
|
|
159
162
|
icon: true,
|
|
160
163
|
onClick: onToggleAll,
|
|
161
164
|
"aria-label": toggleAllLabel,
|
|
162
165
|
className: "rounded text-foreground-subtle hover:bg-surface-overlay hover:text-foreground",
|
|
163
166
|
children: allCollapsed ? /*#__PURE__*/ jsx(ChevronsUpDown, {
|
|
164
|
-
size:
|
|
167
|
+
size: 12
|
|
165
168
|
}) : /*#__PURE__*/ jsx(ChevronsDownUp, {
|
|
166
|
-
size:
|
|
169
|
+
size: 12
|
|
167
170
|
})
|
|
168
171
|
})
|
|
169
172
|
})
|
|
170
173
|
]
|
|
174
|
+
}),
|
|
175
|
+
trailing && /*#__PURE__*/ jsxs(Fragment, {
|
|
176
|
+
children: [
|
|
177
|
+
controlsHidden && /*#__PURE__*/ jsx("div", {
|
|
178
|
+
className: "flex-1"
|
|
179
|
+
}),
|
|
180
|
+
trailing
|
|
181
|
+
]
|
|
171
182
|
})
|
|
172
183
|
]
|
|
173
184
|
});
|
|
@@ -45,6 +45,10 @@ function NodeKey({ node, label, displayPath, onCopyPath, className }) {
|
|
|
45
45
|
content: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
|
|
46
46
|
className: "flex max-w-60 flex-col gap-1",
|
|
47
47
|
children: [
|
|
48
|
+
null != label && label !== node.key && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("span", {
|
|
49
|
+
className: "text-xs font-semibold leading-4",
|
|
50
|
+
children: label
|
|
51
|
+
}),
|
|
48
52
|
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("span", {
|
|
49
53
|
className: "break-all font-mono text-xs font-semibold leading-4",
|
|
50
54
|
children: copyPathText
|
|
@@ -17,6 +17,10 @@ function NodeKey({ node, label, displayPath, onCopyPath, className }) {
|
|
|
17
17
|
content: /*#__PURE__*/ jsxs("div", {
|
|
18
18
|
className: "flex max-w-60 flex-col gap-1",
|
|
19
19
|
children: [
|
|
20
|
+
null != label && label !== node.key && /*#__PURE__*/ jsx("span", {
|
|
21
|
+
className: "text-xs font-semibold leading-4",
|
|
22
|
+
children: label
|
|
23
|
+
}),
|
|
20
24
|
/*#__PURE__*/ jsx("span", {
|
|
21
25
|
className: "break-all font-mono text-xs font-semibold leading-4",
|
|
22
26
|
children: copyPathText
|
|
@@ -41,32 +41,38 @@ const ACTION_TONE_CLASS = {
|
|
|
41
41
|
warning: 'text-warning hover:text-warning',
|
|
42
42
|
error: 'text-error hover:text-error'
|
|
43
43
|
};
|
|
44
|
-
function RowActions({ node, actions, maxInline }) {
|
|
44
|
+
function RowActions({ node, actions, maxInline, meta }) {
|
|
45
45
|
const strings = (0, external_strings_cjs_namespaceObject.useJsonTreeViewStrings)();
|
|
46
46
|
const [menuOpen, setMenuOpen] = (0, external_react_namespaceObject.useState)(false);
|
|
47
|
-
if (0 === actions.length) return null;
|
|
47
|
+
if (0 === actions.length && null == meta) return null;
|
|
48
48
|
const overflowing = actions.length > maxInline;
|
|
49
49
|
const inline = overflowing ? [] : actions;
|
|
50
50
|
const overflow = overflowing ? actions : [];
|
|
51
51
|
const moreLabel = strings.moreActions;
|
|
52
|
+
const renderInline = (action)=>/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_JsonTreeTooltip_cjs_namespaceObject.JsonTreeTooltip, {
|
|
53
|
+
content: action.tooltip ?? action.label,
|
|
54
|
+
placement: "top",
|
|
55
|
+
delay: true,
|
|
56
|
+
children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_button_cjs_namespaceObject.Button, {
|
|
57
|
+
variant: "ghost",
|
|
58
|
+
size: "4xs",
|
|
59
|
+
icon: true,
|
|
60
|
+
disabled: action.disabled,
|
|
61
|
+
onClick: ()=>action.onSelect(node),
|
|
62
|
+
"aria-label": action.label,
|
|
63
|
+
className: (0, index_cjs_namespaceObject.cn)(ACTION_BUTTON_CLASS, '[&_svg]:size-2.75', action.tone && ACTION_TONE_CLASS[action.tone], action.persistent && 'opacity-100', action.active && 'text-brand opacity-100 hover:text-brand'),
|
|
64
|
+
children: action.icon
|
|
65
|
+
})
|
|
66
|
+
}, action.id);
|
|
52
67
|
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("span", {
|
|
53
68
|
className: "ml-auto flex shrink-0 items-center gap-0.5",
|
|
54
69
|
children: [
|
|
55
|
-
inline.
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
size: "4xs",
|
|
62
|
-
icon: true,
|
|
63
|
-
disabled: action.disabled,
|
|
64
|
-
onClick: ()=>action.onSelect(node),
|
|
65
|
-
"aria-label": action.label,
|
|
66
|
-
className: (0, index_cjs_namespaceObject.cn)(ACTION_BUTTON_CLASS, '[&_svg]:size-2.75', action.tone && ACTION_TONE_CLASS[action.tone], action.active && 'text-brand opacity-100 hover:text-brand'),
|
|
67
|
-
children: action.icon
|
|
68
|
-
})
|
|
69
|
-
}, action.id)),
|
|
70
|
+
inline.filter((action)=>'start' === action.placement).map(renderInline),
|
|
71
|
+
null != meta && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("span", {
|
|
72
|
+
className: "mx-1.5 flex shrink-0 items-center",
|
|
73
|
+
children: meta
|
|
74
|
+
}),
|
|
75
|
+
inline.filter((action)=>'start' !== action.placement).map(renderInline),
|
|
70
76
|
overflow.length > 0 && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(external_dropdown_menu_cjs_namespaceObject.DropdownMenu, {
|
|
71
77
|
open: menuOpen,
|
|
72
78
|
onOpenChange: setMenuOpen,
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { type ReactNode } from 'react';
|
|
1
2
|
import type { JsonTreeNode, NodeAction } from './JsonTree.types';
|
|
2
3
|
export interface RowActionsProps {
|
|
3
4
|
node: JsonTreeNode;
|
|
@@ -5,6 +6,8 @@ export interface RowActionsProps {
|
|
|
5
6
|
actions: NodeAction[];
|
|
6
7
|
/** When the action count exceeds this cap, all actions collapse into one menu. */
|
|
7
8
|
maxInline: number;
|
|
9
|
+
/** Decoration `meta`, rendered between the `start` and `end` actions. */
|
|
10
|
+
meta?: ReactNode;
|
|
8
11
|
}
|
|
9
12
|
/**
|
|
10
13
|
* The trailing icon-button group for a row. Renders `actions` uniformly (icon,
|
|
@@ -12,4 +15,4 @@ export interface RowActionsProps {
|
|
|
12
15
|
* inline; when the count exceeds that cap, every action moves into one menu so
|
|
13
16
|
* the row has a single, predictable overflow state.
|
|
14
17
|
*/
|
|
15
|
-
export declare function RowActions({ node, actions, maxInline }: RowActionsProps): import("react/jsx-runtime").JSX.Element | null;
|
|
18
|
+
export declare function RowActions({ node, actions, maxInline, meta }: RowActionsProps): import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -13,32 +13,38 @@ const ACTION_TONE_CLASS = {
|
|
|
13
13
|
warning: 'text-warning hover:text-warning',
|
|
14
14
|
error: 'text-error hover:text-error'
|
|
15
15
|
};
|
|
16
|
-
function RowActions({ node, actions, maxInline }) {
|
|
16
|
+
function RowActions({ node, actions, maxInline, meta }) {
|
|
17
17
|
const strings = useJsonTreeViewStrings();
|
|
18
18
|
const [menuOpen, setMenuOpen] = useState(false);
|
|
19
|
-
if (0 === actions.length) return null;
|
|
19
|
+
if (0 === actions.length && null == meta) return null;
|
|
20
20
|
const overflowing = actions.length > maxInline;
|
|
21
21
|
const inline = overflowing ? [] : actions;
|
|
22
22
|
const overflow = overflowing ? actions : [];
|
|
23
23
|
const moreLabel = strings.moreActions;
|
|
24
|
+
const renderInline = (action)=>/*#__PURE__*/ jsx(JsonTreeTooltip, {
|
|
25
|
+
content: action.tooltip ?? action.label,
|
|
26
|
+
placement: "top",
|
|
27
|
+
delay: true,
|
|
28
|
+
children: /*#__PURE__*/ jsx(Button, {
|
|
29
|
+
variant: "ghost",
|
|
30
|
+
size: "4xs",
|
|
31
|
+
icon: true,
|
|
32
|
+
disabled: action.disabled,
|
|
33
|
+
onClick: ()=>action.onSelect(node),
|
|
34
|
+
"aria-label": action.label,
|
|
35
|
+
className: cn(ACTION_BUTTON_CLASS, '[&_svg]:size-2.75', action.tone && ACTION_TONE_CLASS[action.tone], action.persistent && 'opacity-100', action.active && 'text-brand opacity-100 hover:text-brand'),
|
|
36
|
+
children: action.icon
|
|
37
|
+
})
|
|
38
|
+
}, action.id);
|
|
24
39
|
return /*#__PURE__*/ jsxs("span", {
|
|
25
40
|
className: "ml-auto flex shrink-0 items-center gap-0.5",
|
|
26
41
|
children: [
|
|
27
|
-
inline.
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
size: "4xs",
|
|
34
|
-
icon: true,
|
|
35
|
-
disabled: action.disabled,
|
|
36
|
-
onClick: ()=>action.onSelect(node),
|
|
37
|
-
"aria-label": action.label,
|
|
38
|
-
className: cn(ACTION_BUTTON_CLASS, '[&_svg]:size-2.75', action.tone && ACTION_TONE_CLASS[action.tone], action.active && 'text-brand opacity-100 hover:text-brand'),
|
|
39
|
-
children: action.icon
|
|
40
|
-
})
|
|
41
|
-
}, action.id)),
|
|
42
|
+
inline.filter((action)=>'start' === action.placement).map(renderInline),
|
|
43
|
+
null != meta && /*#__PURE__*/ jsx("span", {
|
|
44
|
+
className: "mx-1.5 flex shrink-0 items-center",
|
|
45
|
+
children: meta
|
|
46
|
+
}),
|
|
47
|
+
inline.filter((action)=>'start' !== action.placement).map(renderInline),
|
|
42
48
|
overflow.length > 0 && /*#__PURE__*/ jsxs(DropdownMenu, {
|
|
43
49
|
open: menuOpen,
|
|
44
50
|
onOpenChange: setMenuOpen,
|