@uipath/apollo-react 6.72.0 → 6.74.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 (81) hide show
  1. package/dist/canvas/components/JsonTree/JsonTree.cjs +256 -214
  2. package/dist/canvas/components/JsonTree/JsonTree.d.ts +31 -25
  3. package/dist/canvas/components/JsonTree/JsonTree.d.ts.map +1 -1
  4. package/dist/canvas/components/JsonTree/JsonTree.js +238 -217
  5. package/dist/canvas/components/JsonTree/index.cjs +67 -58
  6. package/dist/canvas/components/JsonTree/index.d.ts +2 -8
  7. package/dist/canvas/components/JsonTree/index.d.ts.map +1 -1
  8. package/dist/canvas/components/JsonTree/index.js +2 -8
  9. package/dist/canvas/components/NodeIOView/NodeIOView.types.d.ts +1 -1
  10. package/dist/canvas/components/NodeIOView/NodeIOView.types.d.ts.map +1 -1
  11. package/dist/canvas/components/StageNode/StageNode.types.d.ts +1 -1
  12. package/dist/canvas/components/StageNode/StageNode.types.d.ts.map +1 -1
  13. package/dist/canvas/components/StageNode/StageNodeHeader.cjs +15 -6
  14. package/dist/canvas/components/StageNode/StageNodeHeader.d.ts.map +1 -1
  15. package/dist/canvas/components/StageNode/StageNodeHeader.js +15 -6
  16. package/dist/canvas/stories/templates/LayoutPreviewsPage.cjs +1257 -0
  17. package/dist/canvas/stories/templates/LayoutPreviewsPage.d.ts +2 -0
  18. package/dist/canvas/stories/templates/LayoutPreviewsPage.d.ts.map +1 -0
  19. package/dist/canvas/stories/templates/LayoutPreviewsPage.js +1223 -0
  20. package/dist/canvas/styles/tailwind.canvas.css +1 -1
  21. package/package.json +2 -2
  22. package/dist/canvas/components/JsonTree/DecorationChip.cjs +0 -81
  23. package/dist/canvas/components/JsonTree/DecorationChip.d.ts +0 -5
  24. package/dist/canvas/components/JsonTree/DecorationChip.d.ts.map +0 -1
  25. package/dist/canvas/components/JsonTree/DecorationChip.js +0 -47
  26. package/dist/canvas/components/JsonTree/EditorChrome.cjs +0 -93
  27. package/dist/canvas/components/JsonTree/EditorChrome.d.ts +0 -18
  28. package/dist/canvas/components/JsonTree/EditorChrome.d.ts.map +0 -1
  29. package/dist/canvas/components/JsonTree/EditorChrome.js +0 -56
  30. package/dist/canvas/components/JsonTree/JsonContainerEditor.cjs +0 -103
  31. package/dist/canvas/components/JsonTree/JsonContainerEditor.d.ts +0 -10
  32. package/dist/canvas/components/JsonTree/JsonContainerEditor.d.ts.map +0 -1
  33. package/dist/canvas/components/JsonTree/JsonContainerEditor.js +0 -69
  34. package/dist/canvas/components/JsonTree/JsonLeafValueEditor.cjs +0 -98
  35. package/dist/canvas/components/JsonTree/JsonLeafValueEditor.d.ts +0 -9
  36. package/dist/canvas/components/JsonTree/JsonLeafValueEditor.d.ts.map +0 -1
  37. package/dist/canvas/components/JsonTree/JsonLeafValueEditor.js +0 -64
  38. package/dist/canvas/components/JsonTree/JsonMultilineLeafEditor.cjs +0 -86
  39. package/dist/canvas/components/JsonTree/JsonMultilineLeafEditor.d.ts +0 -9
  40. package/dist/canvas/components/JsonTree/JsonMultilineLeafEditor.d.ts.map +0 -1
  41. package/dist/canvas/components/JsonTree/JsonMultilineLeafEditor.js +0 -52
  42. package/dist/canvas/components/JsonTree/JsonTree.types.cjs +0 -18
  43. package/dist/canvas/components/JsonTree/JsonTree.types.d.ts +0 -110
  44. package/dist/canvas/components/JsonTree/JsonTree.types.d.ts.map +0 -1
  45. package/dist/canvas/components/JsonTree/JsonTree.types.js +0 -0
  46. package/dist/canvas/components/JsonTree/JsonTreeRow.cjs +0 -358
  47. package/dist/canvas/components/JsonTree/JsonTreeRow.d.ts +0 -36
  48. package/dist/canvas/components/JsonTree/JsonTreeRow.d.ts.map +0 -1
  49. package/dist/canvas/components/JsonTree/JsonTreeRow.js +0 -318
  50. package/dist/canvas/components/JsonTree/JsonTreeToolbar.cjs +0 -224
  51. package/dist/canvas/components/JsonTree/JsonTreeToolbar.d.ts +0 -17
  52. package/dist/canvas/components/JsonTree/JsonTreeToolbar.d.ts.map +0 -1
  53. package/dist/canvas/components/JsonTree/JsonTreeToolbar.js +0 -190
  54. package/dist/canvas/components/JsonTree/JsonTypeBadge.cjs +0 -70
  55. package/dist/canvas/components/JsonTree/JsonTypeBadge.d.ts +0 -10
  56. package/dist/canvas/components/JsonTree/JsonTypeBadge.d.ts.map +0 -1
  57. package/dist/canvas/components/JsonTree/JsonTypeBadge.js +0 -36
  58. package/dist/canvas/components/JsonTree/NodeKey.cjs +0 -86
  59. package/dist/canvas/components/JsonTree/NodeKey.d.ts +0 -10
  60. package/dist/canvas/components/JsonTree/NodeKey.d.ts.map +0 -1
  61. package/dist/canvas/components/JsonTree/NodeKey.js +0 -52
  62. package/dist/canvas/components/JsonTree/RowActions.cjs +0 -121
  63. package/dist/canvas/components/JsonTree/RowActions.d.ts +0 -8
  64. package/dist/canvas/components/JsonTree/RowActions.d.ts.map +0 -1
  65. package/dist/canvas/components/JsonTree/RowActions.js +0 -87
  66. package/dist/canvas/components/JsonTree/ScalarValueCell.cjs +0 -132
  67. package/dist/canvas/components/JsonTree/ScalarValueCell.d.ts +0 -12
  68. package/dist/canvas/components/JsonTree/ScalarValueCell.d.ts.map +0 -1
  69. package/dist/canvas/components/JsonTree/ScalarValueCell.js +0 -95
  70. package/dist/canvas/components/JsonTree/buildJsonTree.cjs +0 -321
  71. package/dist/canvas/components/JsonTree/buildJsonTree.d.ts +0 -39
  72. package/dist/canvas/components/JsonTree/buildJsonTree.d.ts.map +0 -1
  73. package/dist/canvas/components/JsonTree/buildJsonTree.js +0 -254
  74. package/dist/canvas/components/JsonTree/clipboard.cjs +0 -63
  75. package/dist/canvas/components/JsonTree/clipboard.d.ts +0 -2
  76. package/dist/canvas/components/JsonTree/clipboard.d.ts.map +0 -1
  77. package/dist/canvas/components/JsonTree/clipboard.js +0 -29
  78. package/dist/canvas/components/JsonTree/leafEditTypes.cjs +0 -74
  79. package/dist/canvas/components/JsonTree/leafEditTypes.d.ts +0 -6
  80. package/dist/canvas/components/JsonTree/leafEditTypes.d.ts.map +0 -1
  81. package/dist/canvas/components/JsonTree/leafEditTypes.js +0 -34
@@ -1,318 +0,0 @@
1
- import { Fragment, jsx, jsxs } from "react/jsx-runtime";
2
- import { RequiredIndicator, cn } from "@uipath/apollo-wind";
3
- import { ChevronDown, CircleCheck, Copy, Pencil, WrapText } from "lucide-react";
4
- import { createContext, useContext } from "react";
5
- import { useSafeLingui } from "../../../i18n/index.js";
6
- import { formatLeafValue, isArrayItemTemplateRoot } from "./buildJsonTree.js";
7
- import { DecorationChip } from "./DecorationChip.js";
8
- import { JsonContainerEditor } from "./JsonContainerEditor.js";
9
- import { JsonMultilineLeafEditor } from "./JsonMultilineLeafEditor.js";
10
- import { JsonTypeBadge } from "./JsonTypeBadge.js";
11
- import { NodeKey } from "./NodeKey.js";
12
- import { RowActions } from "./RowActions.js";
13
- import { ScalarValueCell, valueColorClass } from "./ScalarValueCell.js";
14
- const ROW_CLASS = 'group flex min-h-7 cursor-default items-center gap-1.5 py-1 pr-1 transition hover:bg-surface-overlay';
15
- const ROW_MIN_HEIGHT_PX = 28;
16
- const VALUE_CELL_CLASS = 'flex min-w-8 flex-1 items-center';
17
- function rowIndent(depth, extra = 0) {
18
- return {
19
- paddingLeft: `${6 + 12 * depth + extra}px`
20
- };
21
- }
22
- const KEY_ALIGN_OFFSET = 44;
23
- const JsonTreeRowContext = /*#__PURE__*/ createContext(null);
24
- const JsonTreeRowContextProvider = JsonTreeRowContext.Provider;
25
- function useJsonTreeRowContext() {
26
- const ctx = useContext(JsonTreeRowContext);
27
- if (!ctx) throw new Error('JsonTreeRow must be rendered inside a JsonTreeRowContext provider');
28
- return ctx;
29
- }
30
- function JsonTreeRow({ node, depth }) {
31
- const { _ } = useSafeLingui();
32
- const { collapsed, onToggleCollapsed, readOnly, decorateNode, deriveTypeIcon, renderValue, nodeActions, maxInlineActions, renderCodeEditor, pathForCopy, canEdit, RowWrapper, templateItemLabel, editingPath, jsonEditingPath, wrappedPaths, copied, setEditingPath, setJsonEditingPath, copyPath, copyValue, toggleWrapped, commitEdit } = useJsonTreeRowContext();
33
- const buildDefaultActions = (node, flags)=>{
34
- const actions = [];
35
- if (flags.wrappable) actions.push({
36
- id: 'wrap',
37
- icon: /*#__PURE__*/ jsx(WrapText, {}),
38
- active: flags.wrapped,
39
- tooltip: flags.wrapped ? _({
40
- id: 'canvas.json_value_panel.unwrap_value',
41
- message: 'Unwrap value'
42
- }) : _({
43
- id: 'canvas.json_value_panel.wrap_value',
44
- message: 'Wrap value'
45
- }),
46
- label: flags.wrapped ? _({
47
- id: 'canvas.json_value_panel.unwrap_value_of',
48
- message: 'Unwrap value of {key}',
49
- values: {
50
- key: node.key
51
- }
52
- }) : _({
53
- id: 'canvas.json_value_panel.wrap_value_of',
54
- message: 'Wrap value of {key}',
55
- values: {
56
- key: node.key
57
- }
58
- }),
59
- onSelect: ()=>toggleWrapped(node)
60
- });
61
- if (flags.isContainer && canEdit && !node.isArrayItemTemplate) actions.push({
62
- id: 'edit-json',
63
- icon: /*#__PURE__*/ jsx(Pencil, {}),
64
- tooltip: _({
65
- id: 'canvas.json_value_panel.edit_as_json',
66
- message: 'Edit as JSON'
67
- }),
68
- label: _({
69
- id: 'canvas.json_value_panel.edit_key_as_json',
70
- message: 'Edit {key} as JSON',
71
- values: {
72
- key: node.key
73
- }
74
- }),
75
- onSelect: ()=>setJsonEditingPath(node.path)
76
- });
77
- if (flags.canCopyValue) actions.push({
78
- id: 'copy-value',
79
- icon: flags.copiedValue ? /*#__PURE__*/ jsx(CircleCheck, {
80
- className: "text-brand"
81
- }) : /*#__PURE__*/ jsx(Copy, {}),
82
- tooltip: _({
83
- id: 'canvas.json_value_panel.copy_value',
84
- message: 'Copy value'
85
- }),
86
- label: _({
87
- id: 'canvas.json_value_panel.copy_value_of',
88
- message: 'Copy value of {key}',
89
- values: {
90
- key: node.key
91
- }
92
- }),
93
- onSelect: ()=>copyValue(node)
94
- });
95
- return actions;
96
- };
97
- const isContainer = void 0 !== node.children;
98
- const isTemplate = !!node.isArrayItemTemplate;
99
- const isTemplateItem = isArrayItemTemplateRoot(node);
100
- const childCount = node.children?.filter((c)=>!isArrayItemTemplateRoot(c)).length ?? 0;
101
- const decoration = decorateNode?.(node);
102
- const customCell = renderValue?.(node, {
103
- readOnly,
104
- commit: (value)=>commitEdit(node, value),
105
- clear: ()=>commitEdit(node, void 0)
106
- });
107
- const canCopyValue = void 0 !== node.value;
108
- const wrappable = !isContainer && null == customCell && void 0 !== node.value && 'boolean' !== node.type && !node.schema?.enum?.length;
109
- const wrapped = wrappable && !!wrappedPaths[node.path];
110
- const copiedValue = copied?.path === node.path && 'value' === copied.kind;
111
- let builtDefaults;
112
- const getDefaultActions = ()=>{
113
- builtDefaults ??= buildDefaultActions(node, {
114
- isContainer,
115
- wrappable,
116
- wrapped,
117
- canCopyValue,
118
- copiedValue
119
- });
120
- return builtDefaults;
121
- };
122
- const actions = nodeActions?.(node, {
123
- readOnly,
124
- get defaultActions () {
125
- return getDefaultActions();
126
- },
127
- commit: (value)=>commitEdit(node, value),
128
- clear: ()=>commitEdit(node, void 0)
129
- }) ?? getDefaultActions();
130
- const rowClickable = isContainer && !!onToggleCollapsed;
131
- const handleRowClick = (event)=>{
132
- if (event.target.closest('button, a, input, textarea, select, [contenteditable="true"]')) return;
133
- onToggleCollapsed?.(node.path);
134
- };
135
- return /*#__PURE__*/ jsxs("div", {
136
- children: [
137
- /*#__PURE__*/ jsxs(RowWrapper, {
138
- node: node,
139
- className: cn(ROW_CLASS, rowClickable && 'cursor-pointer'),
140
- style: rowIndent(depth),
141
- onClick: rowClickable ? handleRowClick : void 0,
142
- children: [
143
- isContainer ? /*#__PURE__*/ jsx("button", {
144
- type: "button",
145
- onClick: ()=>onToggleCollapsed?.(node.path),
146
- "aria-label": collapsed[node.path] ? _({
147
- id: 'canvas.json_value_panel.expand_key',
148
- message: 'Expand {key}',
149
- values: {
150
- key: node.key
151
- }
152
- }) : _({
153
- id: 'canvas.json_value_panel.collapse_key',
154
- message: 'Collapse {key}',
155
- values: {
156
- key: node.key
157
- }
158
- }),
159
- "aria-expanded": !collapsed[node.path],
160
- className: "grid size-2.5 shrink-0 cursor-pointer place-items-center text-foreground-subtle transition hover:text-foreground",
161
- children: /*#__PURE__*/ jsx(ChevronDown, {
162
- size: 10,
163
- className: cn('transition-transform duration-100', collapsed[node.path] && '-rotate-90')
164
- })
165
- }) : /*#__PURE__*/ jsx("div", {
166
- className: "size-2.5 shrink-0"
167
- }),
168
- /*#__PURE__*/ jsx(JsonTypeBadge, {
169
- type: node.type,
170
- icon: decoration?.badge?.icon ?? deriveTypeIcon?.(node),
171
- className: decoration?.badge?.className
172
- }),
173
- /*#__PURE__*/ jsx(NodeKey, {
174
- node: node,
175
- label: isTemplateItem ? templateItemLabel : decoration?.label,
176
- displayPath: pathForCopy?.(node.path) ?? node.path,
177
- onCopyPath: copyPath,
178
- className: isTemplateItem ? 'font-normal italic text-foreground-subtle' : void 0
179
- }),
180
- copied?.path === node.path && 'path' === copied.kind && /*#__PURE__*/ jsx(CircleCheck, {
181
- size: 11,
182
- className: "shrink-0 text-brand",
183
- role: "img",
184
- "aria-label": _({
185
- id: 'canvas.json_value_panel.path_copied',
186
- message: 'Path copied'
187
- })
188
- }),
189
- decoration?.sublabel && /*#__PURE__*/ jsx("span", {
190
- className: "min-w-0 truncate font-mono text-[10px] text-foreground-subtle leading-4",
191
- children: decoration.sublabel
192
- }),
193
- node.required && /*#__PURE__*/ jsx(RequiredIndicator, {
194
- className: "ml-0 shrink-0 text-[10px] text-foreground",
195
- srLabel: _({
196
- id: 'canvas.json_value_panel.required_marker',
197
- message: 'required'
198
- })
199
- }),
200
- isContainer ? /*#__PURE__*/ jsxs(Fragment, {
201
- children: [
202
- !decoration?.hideCount && /*#__PURE__*/ jsx("span", {
203
- className: "shrink-0 whitespace-nowrap font-mono italic text-[10px] text-foreground-subtle",
204
- children: 'array' === node.type ? _({
205
- id: 'canvas.json_value_panel.item_count',
206
- message: '{count, plural, one {# item} other {# items}}',
207
- values: {
208
- count: childCount
209
- }
210
- }) : _({
211
- id: 'canvas.json_value_panel.key_count',
212
- message: '{count, plural, one {# key} other {# keys}}',
213
- values: {
214
- count: childCount
215
- }
216
- })
217
- }),
218
- null != customCell && /*#__PURE__*/ jsx("span", {
219
- className: VALUE_CELL_CLASS,
220
- children: customCell
221
- }),
222
- /*#__PURE__*/ jsx(DecorationChip, {
223
- decoration: decoration
224
- }),
225
- /*#__PURE__*/ jsx(RowActions, {
226
- node: node,
227
- actions: actions,
228
- maxInline: maxInlineActions
229
- })
230
- ]
231
- }) : /*#__PURE__*/ jsxs(Fragment, {
232
- children: [
233
- !wrapped && (null != customCell ? /*#__PURE__*/ jsx("span", {
234
- className: VALUE_CELL_CLASS,
235
- children: customCell
236
- }) : !(readOnly && void 0 === node.value || isTemplate) && /*#__PURE__*/ jsxs(Fragment, {
237
- children: [
238
- /*#__PURE__*/ jsx("span", {
239
- className: "shrink-0 font-mono text-xs text-foreground-subtle",
240
- children: "="
241
- }),
242
- /*#__PURE__*/ jsx("span", {
243
- className: cn(VALUE_CELL_CLASS, 'shrink-3'),
244
- children: /*#__PURE__*/ jsx(ScalarValueCell, {
245
- node: node,
246
- readOnly: readOnly,
247
- editing: editingPath === node.path,
248
- onStartEdit: (n)=>setEditingPath(n.path),
249
- onStopEdit: ()=>setEditingPath(null),
250
- onEdit: canEdit ? commitEdit : void 0
251
- })
252
- })
253
- ]
254
- })),
255
- editingPath !== node.path && /*#__PURE__*/ jsxs(Fragment, {
256
- children: [
257
- /*#__PURE__*/ jsx(DecorationChip, {
258
- decoration: decoration
259
- }),
260
- /*#__PURE__*/ jsx(RowActions, {
261
- node: node,
262
- actions: actions,
263
- maxInline: maxInlineActions
264
- })
265
- ]
266
- })
267
- ]
268
- })
269
- ]
270
- }),
271
- wrapped && /*#__PURE__*/ jsx("div", {
272
- className: "pb-1.5 pr-3.5",
273
- style: rowIndent(depth, KEY_ALIGN_OFFSET),
274
- children: editingPath === node.path && canEdit ? /*#__PURE__*/ jsx(JsonMultilineLeafEditor, {
275
- node: node,
276
- onCommit: (value)=>{
277
- setEditingPath(null);
278
- commitEdit(node, value);
279
- },
280
- onCancel: ()=>setEditingPath(null)
281
- }) : /*#__PURE__*/ jsx("button", {
282
- type: "button",
283
- disabled: !canEdit,
284
- onClick: ()=>setEditingPath(node.path),
285
- "aria-label": _({
286
- id: 'canvas.json_value_panel.edit_value_of',
287
- message: 'Edit value of {key}',
288
- values: {
289
- key: node.key
290
- }
291
- }),
292
- title: canEdit ? _({
293
- id: 'canvas.json_value_panel.edit_hint',
294
- message: 'Click to edit'
295
- }) : void 0,
296
- className: cn('w-full whitespace-pre-wrap break-all rounded text-left font-mono text-xs leading-5', canEdit && 'cursor-text', valueColorClass(node.type, node.value)),
297
- children: formatLeafValue(node.type, node.value, {
298
- preserveStringWhitespace: true
299
- })
300
- })
301
- }),
302
- isContainer && jsonEditingPath === node.path && /*#__PURE__*/ jsx("div", {
303
- className: "py-1.5 pr-3.5",
304
- style: rowIndent(depth, KEY_ALIGN_OFFSET),
305
- children: /*#__PURE__*/ jsx(JsonContainerEditor, {
306
- node: node,
307
- onCommit: (value)=>{
308
- setJsonEditingPath(null);
309
- commitEdit(node, value);
310
- },
311
- onCancel: ()=>setJsonEditingPath(null),
312
- renderCodeEditor: renderCodeEditor
313
- })
314
- })
315
- ]
316
- });
317
- }
318
- export { JsonTreeRow, JsonTreeRowContextProvider, ROW_MIN_HEIGHT_PX };
@@ -1,224 +0,0 @@
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
- JsonTreeToolbar: ()=>JsonTreeToolbar
28
- });
29
- const jsx_runtime_namespaceObject = require("react/jsx-runtime");
30
- const apollo_wind_namespaceObject = require("@uipath/apollo-wind");
31
- const external_lucide_react_namespaceObject = require("lucide-react");
32
- const external_react_namespaceObject = require("react");
33
- const index_cjs_namespaceObject = require("../../../i18n/index.cjs");
34
- const external_CanvasTooltip_cjs_namespaceObject = require("../CanvasTooltip.cjs");
35
- const ALL_FILTER_VALUE = '__all__';
36
- function JsonTreeToolbar({ query, onQueryChange, searchPlaceholder, filters, activeFilterId = null, onFilterChange, allCollapsed = false, onToggleAll, leading, controlsHidden = false, className }) {
37
- const { _ } = (0, index_cjs_namespaceObject.useSafeLingui)();
38
- const [searchOpen, setSearchOpen] = (0, external_react_namespaceObject.useState)(false);
39
- const activeFilter = filters?.find((f)=>f.id === activeFilterId);
40
- const resolvedSearchPlaceholder = searchPlaceholder ?? _({
41
- id: 'canvas.json_value_panel.search_fields',
42
- message: 'Search fields and values...'
43
- });
44
- const filterLabel = activeFilter ? _({
45
- id: 'canvas.json_value_panel.filter_active',
46
- message: 'Filter: {label}',
47
- values: {
48
- label: activeFilter.label
49
- }
50
- }) : _({
51
- id: 'canvas.json_value_panel.filter',
52
- message: 'Filter'
53
- });
54
- const searchActionLabel = _({
55
- id: 'canvas.json_value_panel.search_fields_action',
56
- message: 'Search fields and values'
57
- });
58
- const toggleAllLabel = allCollapsed ? _({
59
- id: 'canvas.json_value_panel.expand_all',
60
- message: 'Expand all'
61
- }) : _({
62
- id: 'canvas.json_value_panel.collapse_all',
63
- message: 'Collapse all'
64
- });
65
- const closeSearch = ()=>{
66
- onQueryChange('');
67
- setSearchOpen(false);
68
- };
69
- return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
70
- className: (0, apollo_wind_namespaceObject.cn)('flex items-center gap-1.5', className),
71
- children: [
72
- leading,
73
- !controlsHidden && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(jsx_runtime_namespaceObject.Fragment, {
74
- children: [
75
- searchOpen ? /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
76
- className: "relative flex min-w-0 flex-1 items-center overflow-hidden",
77
- children: [
78
- /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_lucide_react_namespaceObject.Search, {
79
- size: 13,
80
- className: "pointer-events-none absolute left-2 text-foreground-subtle"
81
- }),
82
- /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(apollo_wind_namespaceObject.Input, {
83
- autoFocus: true,
84
- type: "text",
85
- variant: "ghost",
86
- size: "xs",
87
- value: query,
88
- onChange: (e)=>onQueryChange(e.target.value),
89
- onKeyDown: (e)=>{
90
- if ('Escape' === e.key) closeSearch();
91
- },
92
- "aria-label": resolvedSearchPlaceholder,
93
- placeholder: resolvedSearchPlaceholder,
94
- style: {
95
- paddingLeft: '1.75rem',
96
- paddingRight: '1.5rem'
97
- },
98
- className: "h-6 w-full text-foreground placeholder:text-foreground-subtle focus-visible:ring-0"
99
- }),
100
- /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("button", {
101
- type: "button",
102
- onClick: closeSearch,
103
- "aria-label": _({
104
- id: 'canvas.json_value_panel.clear_search',
105
- message: 'Clear search'
106
- }),
107
- className: "absolute right-1.5 grid size-4 place-items-center text-foreground-subtle transition hover:text-foreground",
108
- children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_lucide_react_namespaceObject.X, {
109
- size: 12
110
- })
111
- })
112
- ]
113
- }) : /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(jsx_runtime_namespaceObject.Fragment, {
114
- children: [
115
- /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
116
- className: "flex-1"
117
- }),
118
- /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_CanvasTooltip_cjs_namespaceObject.CanvasTooltip, {
119
- content: searchActionLabel,
120
- placement: "top",
121
- delay: true,
122
- children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(apollo_wind_namespaceObject.Button, {
123
- variant: "ghost",
124
- size: "3xs",
125
- icon: true,
126
- onClick: ()=>setSearchOpen(true),
127
- "aria-label": searchActionLabel,
128
- className: "rounded text-foreground-subtle hover:bg-surface-overlay hover:text-foreground",
129
- children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_lucide_react_namespaceObject.Search, {
130
- size: 14
131
- })
132
- })
133
- })
134
- ]
135
- }),
136
- !!filters?.length && onFilterChange && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(apollo_wind_namespaceObject.DropdownMenu, {
137
- children: [
138
- /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_CanvasTooltip_cjs_namespaceObject.CanvasTooltip, {
139
- content: filterLabel,
140
- placement: "top",
141
- delay: true,
142
- children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(apollo_wind_namespaceObject.DropdownMenuTrigger, {
143
- asChild: true,
144
- children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(apollo_wind_namespaceObject.Button, {
145
- variant: "ghost",
146
- size: "3xs",
147
- icon: true,
148
- "aria-label": filterLabel,
149
- className: "relative rounded text-foreground-subtle hover:bg-surface-overlay hover:text-foreground",
150
- children: [
151
- /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_lucide_react_namespaceObject.Filter, {
152
- size: 14
153
- }),
154
- activeFilter && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("span", {
155
- className: "absolute right-0.5 top-0.5 size-1.5 rounded-full bg-primary ring-1 ring-surface"
156
- })
157
- ]
158
- })
159
- })
160
- }),
161
- /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(apollo_wind_namespaceObject.DropdownMenuContent, {
162
- align: "end",
163
- className: "w-52",
164
- children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(apollo_wind_namespaceObject.DropdownMenuRadioGroup, {
165
- value: activeFilterId ?? ALL_FILTER_VALUE,
166
- onValueChange: (value)=>onFilterChange(value === ALL_FILTER_VALUE ? null : value),
167
- children: [
168
- /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(apollo_wind_namespaceObject.DropdownMenuRadioItem, {
169
- value: ALL_FILTER_VALUE,
170
- className: "text-[11px] [&>span:first-child]:text-foreground-accent",
171
- children: _({
172
- id: 'canvas.json_value_panel.filter_all',
173
- message: 'All'
174
- })
175
- }),
176
- filters.map((filter)=>/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(apollo_wind_namespaceObject.DropdownMenuRadioItem, {
177
- value: filter.id,
178
- className: "text-[11px] [&>span:first-child]:text-foreground-accent",
179
- children: [
180
- /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("span", {
181
- className: "flex-1 truncate",
182
- children: filter.label
183
- }),
184
- void 0 !== filter.count && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("span", {
185
- className: "ml-3 rounded bg-surface-overlay px-1.5 py-0.5 font-mono text-[10px] font-medium leading-none text-foreground-muted",
186
- children: filter.count
187
- })
188
- ]
189
- }, filter.id))
190
- ]
191
- })
192
- })
193
- ]
194
- }),
195
- onToggleAll && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_CanvasTooltip_cjs_namespaceObject.CanvasTooltip, {
196
- content: toggleAllLabel,
197
- placement: "top",
198
- delay: true,
199
- children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(apollo_wind_namespaceObject.Button, {
200
- variant: "ghost",
201
- size: "3xs",
202
- icon: true,
203
- onClick: onToggleAll,
204
- "aria-label": toggleAllLabel,
205
- className: "rounded text-foreground-subtle hover:bg-surface-overlay hover:text-foreground",
206
- children: allCollapsed ? /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_lucide_react_namespaceObject.ChevronsUpDown, {
207
- size: 14
208
- }) : /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_lucide_react_namespaceObject.ChevronsDownUp, {
209
- size: 14
210
- })
211
- })
212
- })
213
- ]
214
- })
215
- ]
216
- });
217
- }
218
- exports.JsonTreeToolbar = __webpack_exports__.JsonTreeToolbar;
219
- for(var __rspack_i in __webpack_exports__)if (-1 === [
220
- "JsonTreeToolbar"
221
- ].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
222
- Object.defineProperty(exports, '__esModule', {
223
- value: true
224
- });
@@ -1,17 +0,0 @@
1
- import { type ReactNode } from 'react';
2
- import type { JsonTreeFilterOption } from './JsonTree.types';
3
- export interface JsonTreeToolbarProps {
4
- query: string;
5
- onQueryChange: (query: string) => void;
6
- searchPlaceholder?: string;
7
- filters?: JsonTreeFilterOption[];
8
- activeFilterId?: string | null;
9
- onFilterChange?: (id: string | null) => void;
10
- allCollapsed?: boolean;
11
- onToggleAll?: () => void;
12
- leading?: ReactNode;
13
- controlsHidden?: boolean;
14
- className?: string;
15
- }
16
- export declare function JsonTreeToolbar({ query, onQueryChange, searchPlaceholder, filters, activeFilterId, onFilterChange, allCollapsed, onToggleAll, leading, controlsHidden, className, }: JsonTreeToolbarProps): import("react/jsx-runtime").JSX.Element;
17
- //# sourceMappingURL=JsonTreeToolbar.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"JsonTreeToolbar.d.ts","sourceRoot":"","sources":["../../../../src/canvas/components/JsonTree/JsonTreeToolbar.tsx"],"names":[],"mappings":"AAWA,OAAO,EAAE,KAAK,SAAS,EAAY,MAAM,OAAO,CAAC;AAGjD,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AAK7D,MAAM,WAAW,oBAAoB;IAEnC,KAAK,EAAE,MAAM,CAAC;IACd,aAAa,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACvC,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAE3B,OAAO,CAAC,EAAE,oBAAoB,EAAE,CAAC;IAEjC,cAAc,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B,cAAc,CAAC,EAAE,CAAC,EAAE,EAAE,MAAM,GAAG,IAAI,KAAK,IAAI,CAAC;IAE7C,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,WAAW,CAAC,EAAE,MAAM,IAAI,CAAC;IAMzB,OAAO,CAAC,EAAE,SAAS,CAAC;IAKpB,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAGD,wBAAgB,eAAe,CAAC,EAC9B,KAAK,EACL,aAAa,EACb,iBAAiB,EACjB,OAAO,EACP,cAAqB,EACrB,cAAc,EACd,YAAoB,EACpB,WAAW,EACX,OAAO,EACP,cAAsB,EACtB,SAAS,GACV,EAAE,oBAAoB,2CA4KtB"}