@uipath/apollo-wind 2.67.0 → 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 +72 -61
- 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/components/ui/tree-view.cjs +19 -5
- package/dist/components/ui/tree-view.js +19 -5
- 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
|
@@ -1,4 +1,10 @@
|
|
|
1
1
|
import type { JsonContainer, JsonObject, JsonSchema, JsonTreeNode, JsonTreeNodeType, JsonValue, PathSegment } from './JsonTree.types';
|
|
2
|
+
/**
|
|
3
|
+
* Whether `path` is collapsed. Own keys only: paths are arbitrary JSON keys, and
|
|
4
|
+
* one named after an Object.prototype member (`constructor`, `toString`, …)
|
|
5
|
+
* would otherwise read the inherited function and stay collapsed.
|
|
6
|
+
*/
|
|
7
|
+
export declare function isPathCollapsed(collapsed: Record<string, boolean>, path: string): boolean;
|
|
2
8
|
export declare function isJsonObject(value: JsonValue | undefined): value is JsonObject;
|
|
3
9
|
/** Appends a segment to an expression path (`a.b`, `a["x-y"]`, `a[0]`). */
|
|
4
10
|
export declare function appendPathSegment(path: string, segment: PathSegment): string;
|
|
@@ -48,13 +54,20 @@ export interface FlattenOptions {
|
|
|
48
54
|
/** Lets search also match consumer display labels (e.g. decoration labels). */
|
|
49
55
|
displayTexts?: NodeDisplayTexts;
|
|
50
56
|
}
|
|
51
|
-
/**
|
|
57
|
+
/**
|
|
58
|
+
* Flattens the tree to visible rows, honoring collapse state, search, and filter.
|
|
59
|
+
* Walks depth-first with an explicit stack rather than recursion, so a deeply
|
|
60
|
+
* nested tree can't overflow the call stack.
|
|
61
|
+
*/
|
|
52
62
|
export declare function flattenJsonTree(nodes: JsonTreeNode[], options?: FlattenOptions, depth?: number): FlatJsonTreeRow[];
|
|
53
63
|
export interface ContainerPath {
|
|
54
64
|
path: string;
|
|
55
65
|
depth: number;
|
|
56
66
|
}
|
|
57
|
-
/**
|
|
67
|
+
/**
|
|
68
|
+
* All container (object/array) paths in the tree, with their depth, in tree
|
|
69
|
+
* order. Walks with an explicit stack, so deep trees can't overflow the call stack.
|
|
70
|
+
*/
|
|
58
71
|
export declare function collectContainerPaths(nodes: JsonTreeNode[], depth?: number): ContainerPath[];
|
|
59
72
|
export declare function getValueAtPath(root: JsonValue | undefined, segments: PathSegment[]): JsonValue | undefined;
|
|
60
73
|
/**
|
|
@@ -2,6 +2,9 @@ const IDENTIFIER_RE = /^[A-Za-z_$][A-Za-z0-9_$]*$/;
|
|
|
2
2
|
function hasOwn(object, key) {
|
|
3
3
|
return Object.prototype.hasOwnProperty.call(object, key);
|
|
4
4
|
}
|
|
5
|
+
function isPathCollapsed(collapsed, path) {
|
|
6
|
+
return hasOwn(collapsed, path) && !!collapsed[path];
|
|
7
|
+
}
|
|
5
8
|
function isJsonObject(value) {
|
|
6
9
|
return 'object' == typeof value && null !== value && !Array.isArray(value);
|
|
7
10
|
}
|
|
@@ -40,7 +43,29 @@ function schemaDisplayType(schema) {
|
|
|
40
43
|
if (void 0 !== enumSample) return inferValueType(enumSample);
|
|
41
44
|
return 'null';
|
|
42
45
|
}
|
|
43
|
-
function
|
|
46
|
+
function buildNodes(inputs) {
|
|
47
|
+
const roots = [];
|
|
48
|
+
const stack = [];
|
|
49
|
+
for(let index = inputs.length - 1; index >= 0; index -= 1)stack.push({
|
|
50
|
+
input: inputs[index],
|
|
51
|
+
siblings: roots
|
|
52
|
+
});
|
|
53
|
+
while(stack.length > 0){
|
|
54
|
+
const { input, siblings } = stack.pop();
|
|
55
|
+
const node = createNode(input);
|
|
56
|
+
siblings.push(node);
|
|
57
|
+
const childInputs = 'object' === node.type ? objectChildInputs(input.hasValue ? input.value : void 0, input.schema, input.segments, input.path, input.isTemplate) : 'array' === node.type ? arrayChildInputs(input.schema, input.value, input.hasValue, input.segments, input.path, input.isTemplate) : void 0;
|
|
58
|
+
if (!childInputs) continue;
|
|
59
|
+
const children = [];
|
|
60
|
+
node.children = children;
|
|
61
|
+
for(let index = childInputs.length - 1; index >= 0; index -= 1)stack.push({
|
|
62
|
+
input: childInputs[index],
|
|
63
|
+
siblings: children
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
return roots;
|
|
67
|
+
}
|
|
68
|
+
function createNode(input) {
|
|
44
69
|
const type = input.hasValue ? inferValueType(input.value) : schemaDisplayType(input.schema);
|
|
45
70
|
const node = {
|
|
46
71
|
key: input.key,
|
|
@@ -52,13 +77,11 @@ function buildNode(input) {
|
|
|
52
77
|
};
|
|
53
78
|
if (input.hasValue) node.value = input.value;
|
|
54
79
|
if (input.isTemplate) node.isArrayItemTemplate = true;
|
|
55
|
-
if ('object' === type) node.children = buildObjectChildren(input.hasValue ? input.value : void 0, input.schema, input.segments, input.path, input.isTemplate);
|
|
56
|
-
else if ('array' === type) node.children = buildArrayChildren(input.schema, input.value, input.hasValue, input.segments, input.path, input.isTemplate);
|
|
57
80
|
return node;
|
|
58
81
|
}
|
|
59
|
-
function
|
|
82
|
+
function arrayChildInputs(schema, value, hasValue, segments, path, isTemplate) {
|
|
60
83
|
const items = hasValue && Array.isArray(value) ? value : [];
|
|
61
|
-
if (items.length > 0) return items.map((item, index)=>
|
|
84
|
+
if (items.length > 0) return items.map((item, index)=>({
|
|
62
85
|
key: String(index),
|
|
63
86
|
segments: [
|
|
64
87
|
...segments,
|
|
@@ -71,7 +94,7 @@ function buildArrayChildren(schema, value, hasValue, segments, path, isTemplate)
|
|
|
71
94
|
isTemplate
|
|
72
95
|
}));
|
|
73
96
|
if (schema?.items) return [
|
|
74
|
-
|
|
97
|
+
{
|
|
75
98
|
key: '0',
|
|
76
99
|
segments: [
|
|
77
100
|
...segments,
|
|
@@ -81,18 +104,18 @@ function buildArrayChildren(schema, value, hasValue, segments, path, isTemplate)
|
|
|
81
104
|
schema: schema.items,
|
|
82
105
|
hasValue: false,
|
|
83
106
|
isTemplate: true
|
|
84
|
-
}
|
|
107
|
+
}
|
|
85
108
|
];
|
|
86
109
|
return [];
|
|
87
110
|
}
|
|
88
|
-
function
|
|
111
|
+
function objectChildInputs(value, schema, segments, path, isTemplate) {
|
|
89
112
|
const properties = schema?.properties ?? {};
|
|
90
113
|
const required = new Set(schema?.required ?? []);
|
|
91
114
|
const additional = 'object' == typeof schema?.additionalProperties ? schema.additionalProperties : void 0;
|
|
92
115
|
const children = [];
|
|
93
116
|
for (const [key, childSchema] of Object.entries(properties)){
|
|
94
117
|
const hasValue = void 0 !== value && hasOwn(value, key);
|
|
95
|
-
children.push(
|
|
118
|
+
children.push({
|
|
96
119
|
key,
|
|
97
120
|
segments: [
|
|
98
121
|
...segments,
|
|
@@ -104,10 +127,10 @@ function buildObjectChildren(value, schema, segments, path, isTemplate) {
|
|
|
104
127
|
hasValue,
|
|
105
128
|
required: required.has(key),
|
|
106
129
|
isTemplate
|
|
107
|
-
})
|
|
130
|
+
});
|
|
108
131
|
}
|
|
109
132
|
if (void 0 !== value) {
|
|
110
|
-
for (const [key, childValue] of Object.entries(value))if (!hasOwn(properties, key)) children.push(
|
|
133
|
+
for (const [key, childValue] of Object.entries(value))if (!hasOwn(properties, key)) children.push({
|
|
111
134
|
key,
|
|
112
135
|
segments: [
|
|
113
136
|
...segments,
|
|
@@ -117,15 +140,15 @@ function buildObjectChildren(value, schema, segments, path, isTemplate) {
|
|
|
117
140
|
schema: additional,
|
|
118
141
|
value: childValue,
|
|
119
142
|
hasValue: true
|
|
120
|
-
})
|
|
143
|
+
});
|
|
121
144
|
}
|
|
122
145
|
return children;
|
|
123
146
|
}
|
|
124
147
|
function buildJsonTree(options) {
|
|
125
148
|
const { schema, value, basePath = '' } = options;
|
|
126
149
|
const rootIsArray = void 0 !== value ? Array.isArray(value) : !!schema && 'array' === schemaDisplayType(schema);
|
|
127
|
-
if (rootIsArray) return
|
|
128
|
-
return
|
|
150
|
+
if (rootIsArray) return buildNodes(arrayChildInputs(schema, value, void 0 !== value, [], basePath));
|
|
151
|
+
return buildNodes(objectChildInputs(isJsonObject(value) ? value : void 0, schema, [], basePath));
|
|
129
152
|
}
|
|
130
153
|
function isArrayItemTemplateRoot(node) {
|
|
131
154
|
return !!node.isArrayItemTemplate && 'number' == typeof node.segments[node.segments.length - 1];
|
|
@@ -137,47 +160,76 @@ function nodeSelfMatchesQuery(node, query, displayTexts) {
|
|
|
137
160
|
if (display?.sublabel?.toLowerCase().includes(query)) return true;
|
|
138
161
|
return void 0 !== node.value && null !== node.value && 'object' != typeof node.value && String(node.value).toLowerCase().includes(query);
|
|
139
162
|
}
|
|
140
|
-
function
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
163
|
+
function indexMatches(nodes, test) {
|
|
164
|
+
const self = new Set();
|
|
165
|
+
const below = new Set();
|
|
166
|
+
const order = [];
|
|
167
|
+
const stack = [
|
|
168
|
+
...nodes
|
|
169
|
+
];
|
|
170
|
+
while(stack.length > 0){
|
|
171
|
+
const node = stack.pop();
|
|
172
|
+
order.push(node);
|
|
173
|
+
if (node.children) for (const child of node.children)stack.push(child);
|
|
174
|
+
}
|
|
175
|
+
for(let index = order.length - 1; index >= 0; index -= 1){
|
|
176
|
+
const node = order[index];
|
|
177
|
+
if (test(node)) self.add(node);
|
|
178
|
+
if (node.children?.some((child)=>self.has(child) || below.has(child))) below.add(node);
|
|
179
|
+
}
|
|
180
|
+
return {
|
|
181
|
+
self,
|
|
182
|
+
below
|
|
183
|
+
};
|
|
147
184
|
}
|
|
148
185
|
function flattenJsonTree(nodes, options = {}, depth = 0) {
|
|
149
|
-
const { collapsed = {},
|
|
150
|
-
const query = options.query?.trim().toLowerCase() ?? '';
|
|
186
|
+
const { collapsed = {}, displayTexts } = options;
|
|
151
187
|
const rows = [];
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
188
|
+
const stack = [];
|
|
189
|
+
const pushChildren = (children, childDepth, query, filterPredicate)=>{
|
|
190
|
+
for(let index = children.length - 1; index >= 0; index -= 1)stack.push({
|
|
191
|
+
node: children[index],
|
|
192
|
+
depth: childDepth,
|
|
193
|
+
query,
|
|
194
|
+
filterPredicate
|
|
195
|
+
});
|
|
196
|
+
};
|
|
197
|
+
const rootQuery = options.query?.trim().toLowerCase() ?? '';
|
|
198
|
+
pushChildren(nodes, depth, rootQuery, options.filterPredicate);
|
|
199
|
+
const queryMatches = rootQuery ? indexMatches(nodes, (node)=>nodeSelfMatchesQuery(node, rootQuery, displayTexts)) : void 0;
|
|
200
|
+
const predicateMatches = options.filterPredicate ? indexMatches(nodes, options.filterPredicate) : void 0;
|
|
201
|
+
while(stack.length > 0){
|
|
202
|
+
const { node, depth: nodeDepth, query, filterPredicate } = stack.pop();
|
|
203
|
+
const selfQueryMatch = !!query && !!queryMatches?.self.has(node);
|
|
204
|
+
if (query && !selfQueryMatch && !queryMatches?.below.has(node)) continue;
|
|
205
|
+
const selfPredicateMatch = !!filterPredicate && !!predicateMatches?.self.has(node);
|
|
206
|
+
if (filterPredicate && !selfPredicateMatch && !predicateMatches?.below.has(node)) continue;
|
|
207
|
+
rows.push({
|
|
208
|
+
node,
|
|
209
|
+
depth: nodeDepth
|
|
210
|
+
});
|
|
211
|
+
if (node.children && !isPathCollapsed(collapsed, node.path)) pushChildren(node.children, nodeDepth + 1, selfQueryMatch ? '' : query, selfPredicateMatch ? void 0 : filterPredicate);
|
|
170
212
|
}
|
|
171
213
|
return rows;
|
|
172
214
|
}
|
|
173
215
|
function collectContainerPaths(nodes, depth = 0) {
|
|
174
216
|
const paths = [];
|
|
175
|
-
|
|
217
|
+
const stack = [];
|
|
218
|
+
for(let index = nodes.length - 1; index >= 0; index -= 1)stack.push({
|
|
219
|
+
node: nodes[index],
|
|
220
|
+
depth
|
|
221
|
+
});
|
|
222
|
+
while(stack.length > 0){
|
|
223
|
+
const { node, depth: nodeDepth } = stack.pop();
|
|
224
|
+
if (!node.children) continue;
|
|
176
225
|
paths.push({
|
|
177
226
|
path: node.path,
|
|
178
|
-
depth
|
|
227
|
+
depth: nodeDepth
|
|
228
|
+
});
|
|
229
|
+
for(let index = node.children.length - 1; index >= 0; index -= 1)stack.push({
|
|
230
|
+
node: node.children[index],
|
|
231
|
+
depth: nodeDepth + 1
|
|
179
232
|
});
|
|
180
|
-
for (const child of collectContainerPaths(node.children, depth + 1))paths.push(child);
|
|
181
233
|
}
|
|
182
234
|
return paths;
|
|
183
235
|
}
|
|
@@ -254,4 +306,4 @@ function formatLeafValue(type, value, options) {
|
|
|
254
306
|
if ('string' === type) return options?.preserveStringWhitespace ? `"${value}"` : JSON.stringify(value);
|
|
255
307
|
return String(value);
|
|
256
308
|
}
|
|
257
|
-
export { appendPathSegment, buildJsonTree, collectContainerPaths, flattenJsonTree, formatLeafValue, getValueAtPath, inferValueType, isArrayItemTemplateRoot, isJsonObject, removeValueAtPath, schemaDisplayType, setValueAtPath };
|
|
309
|
+
export { appendPathSegment, buildJsonTree, collectContainerPaths, flattenJsonTree, formatLeafValue, getValueAtPath, inferValueType, isArrayItemTemplateRoot, isJsonObject, isPathCollapsed, removeValueAtPath, schemaDisplayType, setValueAtPath };
|
|
@@ -0,0 +1,99 @@
|
|
|
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
|
+
PanelTabsList: ()=>PanelTabsList,
|
|
28
|
+
PanelTabsStrip: ()=>PanelTabsStrip,
|
|
29
|
+
PanelTabs: ()=>PanelTabs,
|
|
30
|
+
PanelTabsTrigger: ()=>PanelTabsTrigger,
|
|
31
|
+
PanelTabsContent: ()=>PanelTabsContent
|
|
32
|
+
});
|
|
33
|
+
const jsx_runtime_namespaceObject = require("react/jsx-runtime");
|
|
34
|
+
const external_react_namespaceObject = require("react");
|
|
35
|
+
const index_cjs_namespaceObject = require("../../lib/index.cjs");
|
|
36
|
+
const external_tabs_cjs_namespaceObject = require("./tabs.cjs");
|
|
37
|
+
const PanelTabs = /*#__PURE__*/ external_react_namespaceObject.forwardRef(({ className, ...props }, ref)=>/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_tabs_cjs_namespaceObject.Tabs, {
|
|
38
|
+
ref: ref,
|
|
39
|
+
"data-slot": "panel-tabs",
|
|
40
|
+
className: (0, index_cjs_namespaceObject.cn)('flex min-h-0 flex-1 flex-col gap-1', className),
|
|
41
|
+
...props
|
|
42
|
+
}));
|
|
43
|
+
PanelTabs.displayName = 'PanelTabs';
|
|
44
|
+
const PanelTabsStrip = /*#__PURE__*/ external_react_namespaceObject.forwardRef(({ className, containerClassName, scrollButtonClassName, ...props }, ref)=>/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_tabs_cjs_namespaceObject.ScrollableTabsList, {
|
|
45
|
+
ref: ref,
|
|
46
|
+
"data-slot": "panel-tabs-strip",
|
|
47
|
+
containerClassName: (0, index_cjs_namespaceObject.cn)('w-auto', containerClassName),
|
|
48
|
+
className: (0, index_cjs_namespaceObject.cn)('h-auto justify-start gap-0.5 rounded-lg bg-transparent p-0 text-muted-foreground', className),
|
|
49
|
+
scrollButtonClassName: (0, index_cjs_namespaceObject.cn)('size-6 hover:bg-surface-overlay', scrollButtonClassName),
|
|
50
|
+
...props
|
|
51
|
+
}));
|
|
52
|
+
PanelTabsStrip.displayName = 'PanelTabsStrip';
|
|
53
|
+
const PanelTabsList = /*#__PURE__*/ external_react_namespaceObject.forwardRef(({ trailing, rowClassName, className, containerClassName, ...props }, ref)=>/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
|
|
54
|
+
"data-slot": "panel-tabs-list",
|
|
55
|
+
className: (0, index_cjs_namespaceObject.cn)('flex shrink-0 items-center gap-2 pt-3 pb-0.5 [padding-inline:var(--mf-content-inset,0px)]', rowClassName),
|
|
56
|
+
children: [
|
|
57
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(PanelTabsStrip, {
|
|
58
|
+
ref: ref,
|
|
59
|
+
className: className,
|
|
60
|
+
containerClassName: (0, index_cjs_namespaceObject.cn)('flex-1', containerClassName),
|
|
61
|
+
...props
|
|
62
|
+
}),
|
|
63
|
+
trailing
|
|
64
|
+
]
|
|
65
|
+
}));
|
|
66
|
+
PanelTabsList.displayName = 'PanelTabsList';
|
|
67
|
+
const PanelTabsTrigger = /*#__PURE__*/ external_react_namespaceObject.forwardRef(({ className, ...props }, ref)=>/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_tabs_cjs_namespaceObject.TabsTrigger, {
|
|
68
|
+
ref: ref,
|
|
69
|
+
"data-slot": "panel-tabs-trigger",
|
|
70
|
+
className: (0, index_cjs_namespaceObject.cn)('inline-flex h-6 shrink-0 items-center gap-1.5 whitespace-nowrap rounded-md px-2.5 text-xs font-medium text-muted-foreground shadow-none transition-colors hover:text-foreground data-[state=active]:bg-surface-overlay data-[state=active]:text-foreground data-[state=active]:shadow-sm', className),
|
|
71
|
+
...props
|
|
72
|
+
}));
|
|
73
|
+
PanelTabsTrigger.displayName = 'PanelTabsTrigger';
|
|
74
|
+
const PanelTabsContent = /*#__PURE__*/ external_react_namespaceObject.forwardRef(({ padded = true, innerClassName, className, children, ...props }, ref)=>/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_tabs_cjs_namespaceObject.TabsContent, {
|
|
75
|
+
ref: ref,
|
|
76
|
+
"data-slot": "panel-tabs-content",
|
|
77
|
+
className: (0, index_cjs_namespaceObject.cn)('mt-0 min-h-0 flex-1 overflow-auto', className),
|
|
78
|
+
...props,
|
|
79
|
+
children: padded ? /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
|
|
80
|
+
className: (0, index_cjs_namespaceObject.cn)('pt-1.5 pb-6 [padding-inline:var(--mf-content-inset,0px)]', innerClassName),
|
|
81
|
+
children: children
|
|
82
|
+
}) : children
|
|
83
|
+
}));
|
|
84
|
+
PanelTabsContent.displayName = 'PanelTabsContent';
|
|
85
|
+
exports.PanelTabs = __webpack_exports__.PanelTabs;
|
|
86
|
+
exports.PanelTabsContent = __webpack_exports__.PanelTabsContent;
|
|
87
|
+
exports.PanelTabsList = __webpack_exports__.PanelTabsList;
|
|
88
|
+
exports.PanelTabsStrip = __webpack_exports__.PanelTabsStrip;
|
|
89
|
+
exports.PanelTabsTrigger = __webpack_exports__.PanelTabsTrigger;
|
|
90
|
+
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
91
|
+
"PanelTabs",
|
|
92
|
+
"PanelTabsContent",
|
|
93
|
+
"PanelTabsList",
|
|
94
|
+
"PanelTabsStrip",
|
|
95
|
+
"PanelTabsTrigger"
|
|
96
|
+
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
97
|
+
Object.defineProperty(exports, '__esModule', {
|
|
98
|
+
value: true
|
|
99
|
+
});
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { type ScrollableTabsListProps, TabsContent } from './tabs';
|
|
3
|
+
/** Root: a column whose content area fills the remaining height. */
|
|
4
|
+
declare const PanelTabs: React.ForwardRefExoticComponent<Omit<Omit<import("@radix-ui/react-tabs").TabsProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
5
|
+
/**
|
|
6
|
+
* The tab strip alone, for a row that also holds other controls (e.g. a tree
|
|
7
|
+
* toolbar). In a narrow panel it reveals prev/next chevrons and keeps the active
|
|
8
|
+
* tab in view; in a wide one it reads as a plain strip.
|
|
9
|
+
*/
|
|
10
|
+
declare const PanelTabsStrip: React.ForwardRefExoticComponent<ScrollableTabsListProps & React.RefAttributes<HTMLDivElement>>;
|
|
11
|
+
interface PanelTabsListProps extends ScrollableTabsListProps {
|
|
12
|
+
/** Content after the tabs, at the end of the row (e.g. a notes toggle). */
|
|
13
|
+
trailing?: React.ReactNode;
|
|
14
|
+
/** Classes for the row around the strip. */
|
|
15
|
+
rowClassName?: string;
|
|
16
|
+
}
|
|
17
|
+
/** The pinned tab row: the strip, inset like the content, 12px below what sits above it. */
|
|
18
|
+
declare const PanelTabsList: React.ForwardRefExoticComponent<PanelTabsListProps & React.RefAttributes<HTMLDivElement>>;
|
|
19
|
+
/** A segmented pill tab. */
|
|
20
|
+
declare const PanelTabsTrigger: React.ForwardRefExoticComponent<Omit<Omit<import("@radix-ui/react-tabs").TabsTriggerProps & React.RefAttributes<HTMLButtonElement>, "ref"> & React.RefAttributes<HTMLButtonElement>, "ref"> & React.RefAttributes<HTMLButtonElement>>;
|
|
21
|
+
interface PanelTabsContentProps extends React.ComponentPropsWithoutRef<typeof TabsContent> {
|
|
22
|
+
/**
|
|
23
|
+
* Wraps the children in the standard padding: the content inset, pt-1.5 (12px
|
|
24
|
+
* below the tabs), and pb-6. Default true. Turn it off for content that pads
|
|
25
|
+
* itself (its first block must then start with the same 6px).
|
|
26
|
+
*/
|
|
27
|
+
padded?: boolean;
|
|
28
|
+
/** Classes for the padded wrapper (e.g. its own vertical rhythm). */
|
|
29
|
+
innerClassName?: string;
|
|
30
|
+
}
|
|
31
|
+
/** The active tab's content. It is the scroll container, so the tab row stays pinned. */
|
|
32
|
+
declare const PanelTabsContent: React.ForwardRefExoticComponent<PanelTabsContentProps & React.RefAttributes<HTMLDivElement>>;
|
|
33
|
+
export { PanelTabs, PanelTabsContent, PanelTabsList, PanelTabsStrip, PanelTabsTrigger };
|
|
34
|
+
export type { PanelTabsContentProps, PanelTabsListProps };
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef } from "react";
|
|
3
|
+
import { cn } from "../../lib/index.js";
|
|
4
|
+
import { ScrollableTabsList, Tabs, TabsContent, TabsTrigger } from "./tabs.js";
|
|
5
|
+
const PanelTabs = /*#__PURE__*/ forwardRef(({ className, ...props }, ref)=>/*#__PURE__*/ jsx(Tabs, {
|
|
6
|
+
ref: ref,
|
|
7
|
+
"data-slot": "panel-tabs",
|
|
8
|
+
className: cn('flex min-h-0 flex-1 flex-col gap-1', className),
|
|
9
|
+
...props
|
|
10
|
+
}));
|
|
11
|
+
PanelTabs.displayName = 'PanelTabs';
|
|
12
|
+
const PanelTabsStrip = /*#__PURE__*/ forwardRef(({ className, containerClassName, scrollButtonClassName, ...props }, ref)=>/*#__PURE__*/ jsx(ScrollableTabsList, {
|
|
13
|
+
ref: ref,
|
|
14
|
+
"data-slot": "panel-tabs-strip",
|
|
15
|
+
containerClassName: cn('w-auto', containerClassName),
|
|
16
|
+
className: cn('h-auto justify-start gap-0.5 rounded-lg bg-transparent p-0 text-muted-foreground', className),
|
|
17
|
+
scrollButtonClassName: cn('size-6 hover:bg-surface-overlay', scrollButtonClassName),
|
|
18
|
+
...props
|
|
19
|
+
}));
|
|
20
|
+
PanelTabsStrip.displayName = 'PanelTabsStrip';
|
|
21
|
+
const PanelTabsList = /*#__PURE__*/ forwardRef(({ trailing, rowClassName, className, containerClassName, ...props }, ref)=>/*#__PURE__*/ jsxs("div", {
|
|
22
|
+
"data-slot": "panel-tabs-list",
|
|
23
|
+
className: cn('flex shrink-0 items-center gap-2 pt-3 pb-0.5 [padding-inline:var(--mf-content-inset,0px)]', rowClassName),
|
|
24
|
+
children: [
|
|
25
|
+
/*#__PURE__*/ jsx(PanelTabsStrip, {
|
|
26
|
+
ref: ref,
|
|
27
|
+
className: className,
|
|
28
|
+
containerClassName: cn('flex-1', containerClassName),
|
|
29
|
+
...props
|
|
30
|
+
}),
|
|
31
|
+
trailing
|
|
32
|
+
]
|
|
33
|
+
}));
|
|
34
|
+
PanelTabsList.displayName = 'PanelTabsList';
|
|
35
|
+
const PanelTabsTrigger = /*#__PURE__*/ forwardRef(({ className, ...props }, ref)=>/*#__PURE__*/ jsx(TabsTrigger, {
|
|
36
|
+
ref: ref,
|
|
37
|
+
"data-slot": "panel-tabs-trigger",
|
|
38
|
+
className: cn('inline-flex h-6 shrink-0 items-center gap-1.5 whitespace-nowrap rounded-md px-2.5 text-xs font-medium text-muted-foreground shadow-none transition-colors hover:text-foreground data-[state=active]:bg-surface-overlay data-[state=active]:text-foreground data-[state=active]:shadow-sm', className),
|
|
39
|
+
...props
|
|
40
|
+
}));
|
|
41
|
+
PanelTabsTrigger.displayName = 'PanelTabsTrigger';
|
|
42
|
+
const PanelTabsContent = /*#__PURE__*/ forwardRef(({ padded = true, innerClassName, className, children, ...props }, ref)=>/*#__PURE__*/ jsx(TabsContent, {
|
|
43
|
+
ref: ref,
|
|
44
|
+
"data-slot": "panel-tabs-content",
|
|
45
|
+
className: cn('mt-0 min-h-0 flex-1 overflow-auto', className),
|
|
46
|
+
...props,
|
|
47
|
+
children: padded ? /*#__PURE__*/ jsx("div", {
|
|
48
|
+
className: cn('pt-1.5 pb-6 [padding-inline:var(--mf-content-inset,0px)]', innerClassName),
|
|
49
|
+
children: children
|
|
50
|
+
}) : children
|
|
51
|
+
}));
|
|
52
|
+
PanelTabsContent.displayName = 'PanelTabsContent';
|
|
53
|
+
export { PanelTabs, PanelTabsContent, PanelTabsList, PanelTabsStrip, PanelTabsTrigger };
|
|
@@ -50,6 +50,7 @@ const buildItemMap = (items)=>{
|
|
|
50
50
|
items.forEach(processItem);
|
|
51
51
|
return map;
|
|
52
52
|
};
|
|
53
|
+
const toAriaChecked = (state)=>'indeterminate' === state ? 'mixed' : 'checked' === state;
|
|
53
54
|
const getCheckState = (item, itemMap)=>{
|
|
54
55
|
const originalItem = itemMap.get(item.id);
|
|
55
56
|
if (!originalItem) return 'unchecked';
|
|
@@ -155,12 +156,17 @@ function TreeItem({ item, depth = 0, selectedIds, lastSelectedId, onSelect, expa
|
|
|
155
156
|
};
|
|
156
157
|
const handleAccessClick = (e)=>{
|
|
157
158
|
e.stopPropagation();
|
|
159
|
+
if (isDisabled) return;
|
|
158
160
|
if (onAccessChange) {
|
|
159
161
|
const currentState = getCheckState(item, itemMap);
|
|
160
162
|
const newChecked = 'checked' !== currentState;
|
|
161
163
|
onAccessChange(item, newChecked);
|
|
162
164
|
}
|
|
163
165
|
};
|
|
166
|
+
const renderName = ()=>showAccessRights ? /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("span", {
|
|
167
|
+
onClick: handleAccessClick,
|
|
168
|
+
children: item.name
|
|
169
|
+
}) : item.name;
|
|
164
170
|
const renderIcon = ()=>{
|
|
165
171
|
if (getIcon) return getIcon(item, depth);
|
|
166
172
|
return iconMap[item.type] || iconMap.folder || defaultIconMap.folder;
|
|
@@ -195,6 +201,7 @@ function TreeItem({ item, depth = 0, selectedIds, lastSelectedId, onSelect, expa
|
|
|
195
201
|
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(external_context_menu_cjs_namespaceObject.ContextMenu, {
|
|
196
202
|
children: [
|
|
197
203
|
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_context_menu_cjs_namespaceObject.ContextMenuTrigger, {
|
|
204
|
+
disabled: !menuItems?.length,
|
|
198
205
|
children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
|
|
199
206
|
children: [
|
|
200
207
|
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
|
|
@@ -203,6 +210,7 @@ function TreeItem({ item, depth = 0, selectedIds, lastSelectedId, onSelect, expa
|
|
|
203
210
|
"aria-expanded": item.children ? isOpen : void 0,
|
|
204
211
|
"aria-selected": isSelected && 'none' !== selectionMode,
|
|
205
212
|
"aria-disabled": isDisabled,
|
|
213
|
+
"aria-checked": showAccessRights ? toAriaChecked(getCheckState(item, itemMap)) : void 0,
|
|
206
214
|
tabIndex: 0,
|
|
207
215
|
"data-tree-item": true,
|
|
208
216
|
"data-id": item.id,
|
|
@@ -215,10 +223,16 @@ function TreeItem({ item, depth = 0, selectedIds, lastSelectedId, onSelect, expa
|
|
|
215
223
|
},
|
|
216
224
|
onClick: handleClick,
|
|
217
225
|
onKeyDown: (e)=>{
|
|
218
|
-
if (
|
|
219
|
-
|
|
220
|
-
|
|
226
|
+
if (e.target !== e.currentTarget) return;
|
|
227
|
+
if ('Enter' !== e.key && ' ' !== e.key) return;
|
|
228
|
+
e.preventDefault();
|
|
229
|
+
if ('none' === selectionMode) {
|
|
230
|
+
e.stopPropagation();
|
|
231
|
+
if (' ' === e.key && showAccessRights) handleAccessClick(e);
|
|
232
|
+
else if (item.children && !isDisabled) onToggleExpand(item.id, !isOpen);
|
|
233
|
+
return;
|
|
221
234
|
}
|
|
235
|
+
handleClick(e);
|
|
222
236
|
},
|
|
223
237
|
children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
|
|
224
238
|
className: "flex items-center h-8 min-w-0",
|
|
@@ -286,7 +300,7 @@ function TreeItem({ item, depth = 0, selectedIds, lastSelectedId, onSelect, expa
|
|
|
286
300
|
renderIcon(),
|
|
287
301
|
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("span", {
|
|
288
302
|
className: "flex-1 min-w-0 truncate",
|
|
289
|
-
children:
|
|
303
|
+
children: renderName()
|
|
290
304
|
}),
|
|
291
305
|
item.badge && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("span", {
|
|
292
306
|
className: "shrink-0 ml-1",
|
|
@@ -522,7 +536,7 @@ function TreeItem({ item, depth = 0, selectedIds, lastSelectedId, onSelect, expa
|
|
|
522
536
|
renderIcon(),
|
|
523
537
|
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("span", {
|
|
524
538
|
className: "flex-1 min-w-0 truncate",
|
|
525
|
-
children:
|
|
539
|
+
children: renderName()
|
|
526
540
|
}),
|
|
527
541
|
item.badge && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("span", {
|
|
528
542
|
className: "shrink-0 ml-1",
|
|
@@ -21,6 +21,7 @@ const buildItemMap = (items)=>{
|
|
|
21
21
|
items.forEach(processItem);
|
|
22
22
|
return map;
|
|
23
23
|
};
|
|
24
|
+
const toAriaChecked = (state)=>'indeterminate' === state ? 'mixed' : 'checked' === state;
|
|
24
25
|
const getCheckState = (item, itemMap)=>{
|
|
25
26
|
const originalItem = itemMap.get(item.id);
|
|
26
27
|
if (!originalItem) return 'unchecked';
|
|
@@ -126,12 +127,17 @@ function TreeItem({ item, depth = 0, selectedIds, lastSelectedId, onSelect, expa
|
|
|
126
127
|
};
|
|
127
128
|
const handleAccessClick = (e)=>{
|
|
128
129
|
e.stopPropagation();
|
|
130
|
+
if (isDisabled) return;
|
|
129
131
|
if (onAccessChange) {
|
|
130
132
|
const currentState = getCheckState(item, itemMap);
|
|
131
133
|
const newChecked = 'checked' !== currentState;
|
|
132
134
|
onAccessChange(item, newChecked);
|
|
133
135
|
}
|
|
134
136
|
};
|
|
137
|
+
const renderName = ()=>showAccessRights ? /*#__PURE__*/ jsx("span", {
|
|
138
|
+
onClick: handleAccessClick,
|
|
139
|
+
children: item.name
|
|
140
|
+
}) : item.name;
|
|
135
141
|
const renderIcon = ()=>{
|
|
136
142
|
if (getIcon) return getIcon(item, depth);
|
|
137
143
|
return iconMap[item.type] || iconMap.folder || defaultIconMap.folder;
|
|
@@ -166,6 +172,7 @@ function TreeItem({ item, depth = 0, selectedIds, lastSelectedId, onSelect, expa
|
|
|
166
172
|
return /*#__PURE__*/ jsxs(ContextMenu, {
|
|
167
173
|
children: [
|
|
168
174
|
/*#__PURE__*/ jsx(ContextMenuTrigger, {
|
|
175
|
+
disabled: !menuItems?.length,
|
|
169
176
|
children: /*#__PURE__*/ jsxs("div", {
|
|
170
177
|
children: [
|
|
171
178
|
/*#__PURE__*/ jsx("div", {
|
|
@@ -174,6 +181,7 @@ function TreeItem({ item, depth = 0, selectedIds, lastSelectedId, onSelect, expa
|
|
|
174
181
|
"aria-expanded": item.children ? isOpen : void 0,
|
|
175
182
|
"aria-selected": isSelected && 'none' !== selectionMode,
|
|
176
183
|
"aria-disabled": isDisabled,
|
|
184
|
+
"aria-checked": showAccessRights ? toAriaChecked(getCheckState(item, itemMap)) : void 0,
|
|
177
185
|
tabIndex: 0,
|
|
178
186
|
"data-tree-item": true,
|
|
179
187
|
"data-id": item.id,
|
|
@@ -186,10 +194,16 @@ function TreeItem({ item, depth = 0, selectedIds, lastSelectedId, onSelect, expa
|
|
|
186
194
|
},
|
|
187
195
|
onClick: handleClick,
|
|
188
196
|
onKeyDown: (e)=>{
|
|
189
|
-
if (
|
|
190
|
-
|
|
191
|
-
|
|
197
|
+
if (e.target !== e.currentTarget) return;
|
|
198
|
+
if ('Enter' !== e.key && ' ' !== e.key) return;
|
|
199
|
+
e.preventDefault();
|
|
200
|
+
if ('none' === selectionMode) {
|
|
201
|
+
e.stopPropagation();
|
|
202
|
+
if (' ' === e.key && showAccessRights) handleAccessClick(e);
|
|
203
|
+
else if (item.children && !isDisabled) onToggleExpand(item.id, !isOpen);
|
|
204
|
+
return;
|
|
192
205
|
}
|
|
206
|
+
handleClick(e);
|
|
193
207
|
},
|
|
194
208
|
children: /*#__PURE__*/ jsx("div", {
|
|
195
209
|
className: "flex items-center h-8 min-w-0",
|
|
@@ -257,7 +271,7 @@ function TreeItem({ item, depth = 0, selectedIds, lastSelectedId, onSelect, expa
|
|
|
257
271
|
renderIcon(),
|
|
258
272
|
/*#__PURE__*/ jsx("span", {
|
|
259
273
|
className: "flex-1 min-w-0 truncate",
|
|
260
|
-
children:
|
|
274
|
+
children: renderName()
|
|
261
275
|
}),
|
|
262
276
|
item.badge && /*#__PURE__*/ jsx("span", {
|
|
263
277
|
className: "shrink-0 ml-1",
|
|
@@ -493,7 +507,7 @@ function TreeItem({ item, depth = 0, selectedIds, lastSelectedId, onSelect, expa
|
|
|
493
507
|
renderIcon(),
|
|
494
508
|
/*#__PURE__*/ jsx("span", {
|
|
495
509
|
className: "flex-1 min-w-0 truncate",
|
|
496
|
-
children:
|
|
510
|
+
children: renderName()
|
|
497
511
|
}),
|
|
498
512
|
item.badge && /*#__PURE__*/ jsx("span", {
|
|
499
513
|
className: "shrink-0 ml-1",
|