@uipath/apollo-react 7.10.0 → 7.11.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/canvas/components/Guardrails/guardrail-palette-utils.cjs +28 -0
- package/dist/canvas/components/Guardrails/guardrail-palette-utils.d.ts +5 -1
- package/dist/canvas/components/Guardrails/guardrail-palette-utils.d.ts.map +1 -1
- package/dist/canvas/components/Guardrails/guardrail-palette-utils.js +26 -1
- package/dist/canvas/components/Guardrails/guardrail-palette.cjs +254 -57
- package/dist/canvas/components/Guardrails/guardrail-palette.d.ts +3 -1
- package/dist/canvas/components/Guardrails/guardrail-palette.d.ts.map +1 -1
- package/dist/canvas/components/Guardrails/guardrail-palette.js +257 -60
- package/dist/canvas/components/Guardrails/i18n.cjs +24 -0
- package/dist/canvas/components/Guardrails/i18n.d.ts +6 -0
- package/dist/canvas/components/Guardrails/i18n.d.ts.map +1 -1
- package/dist/canvas/components/Guardrails/i18n.js +24 -0
- package/dist/canvas/components/Guardrails/index.cjs +3 -0
- package/dist/canvas/components/Guardrails/index.d.ts +2 -2
- package/dist/canvas/components/Guardrails/index.d.ts.map +1 -1
- package/dist/canvas/components/Guardrails/index.js +2 -2
- package/dist/canvas/components/Guardrails/palette-types.d.ts +1 -0
- package/dist/canvas/components/Guardrails/palette-types.d.ts.map +1 -1
- package/dist/canvas/locales/en.cjs +1 -1
- package/dist/canvas/locales/en.d.ts.map +1 -1
- package/dist/canvas/locales/en.js +1 -1
- package/dist/canvas/styles/tailwind.canvas.css +1 -1
- package/dist/chat/styles/tailwind.chat.css +1 -1
- package/package.json +3 -3
|
@@ -25,6 +25,7 @@ var __webpack_exports__ = {};
|
|
|
25
25
|
__webpack_require__.r(__webpack_exports__);
|
|
26
26
|
__webpack_require__.d(__webpack_exports__, {
|
|
27
27
|
getGuardrailPaletteItemId: ()=>getGuardrailPaletteItemId,
|
|
28
|
+
filterGuardrailPaletteGroups: ()=>filterGuardrailPaletteGroups,
|
|
28
29
|
groupGuardrailsForPalette: ()=>groupGuardrailsForPalette
|
|
29
30
|
});
|
|
30
31
|
const external_definitions_enrich_cjs_namespaceObject = require("./definitions-enrich.cjs");
|
|
@@ -73,9 +74,36 @@ function groupGuardrailsForPalette(definitions, uipathGroupLabel, getName = (def
|
|
|
73
74
|
});
|
|
74
75
|
return groups;
|
|
75
76
|
}
|
|
77
|
+
function foldForSearch(value) {
|
|
78
|
+
return value.normalize('NFD').replace(/[\u0300-\u036f]/g, '').toLocaleLowerCase();
|
|
79
|
+
}
|
|
80
|
+
function filterGuardrailPaletteGroups(groups, { query = '', source = 'all' }, getName = (definition)=>definition.displayName) {
|
|
81
|
+
const words = foldForSearch(query).split(/\s+/).filter(Boolean);
|
|
82
|
+
const matches = (definition)=>{
|
|
83
|
+
const text = foldForSearch([
|
|
84
|
+
getName(definition),
|
|
85
|
+
definition.description,
|
|
86
|
+
definition.byoConnectorName,
|
|
87
|
+
definition.folderPath
|
|
88
|
+
].filter(Boolean).join(' '));
|
|
89
|
+
return words.every((word)=>text.includes(word));
|
|
90
|
+
};
|
|
91
|
+
return groups.flatMap((group)=>{
|
|
92
|
+
if ('all' !== source && group.isByo !== ('byo' === source)) return [];
|
|
93
|
+
const definitions = 0 === words.length ? group.definitions : group.definitions.filter(matches);
|
|
94
|
+
return 0 === definitions.length ? [] : [
|
|
95
|
+
{
|
|
96
|
+
...group,
|
|
97
|
+
definitions
|
|
98
|
+
}
|
|
99
|
+
];
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
exports.filterGuardrailPaletteGroups = __webpack_exports__.filterGuardrailPaletteGroups;
|
|
76
103
|
exports.getGuardrailPaletteItemId = __webpack_exports__.getGuardrailPaletteItemId;
|
|
77
104
|
exports.groupGuardrailsForPalette = __webpack_exports__.groupGuardrailsForPalette;
|
|
78
105
|
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
106
|
+
"filterGuardrailPaletteGroups",
|
|
79
107
|
"getGuardrailPaletteItemId",
|
|
80
108
|
"groupGuardrailsForPalette"
|
|
81
109
|
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
@@ -1,4 +1,8 @@
|
|
|
1
|
-
import type { GuardrailPaletteDefinition, GuardrailPaletteGroup } from './palette-types';
|
|
1
|
+
import type { GuardrailPaletteDefinition, GuardrailPaletteGroup, GuardrailPaletteSource } from './palette-types';
|
|
2
2
|
export declare function getGuardrailPaletteItemId(definition: GuardrailPaletteDefinition): string;
|
|
3
3
|
export declare function groupGuardrailsForPalette<T extends GuardrailPaletteDefinition>(definitions: readonly T[], uipathGroupLabel: string, getName?: (definition: T) => string): Array<GuardrailPaletteGroup<T>>;
|
|
4
|
+
export declare function filterGuardrailPaletteGroups<T extends GuardrailPaletteDefinition>(groups: ReadonlyArray<GuardrailPaletteGroup<T>>, { query, source }: {
|
|
5
|
+
query?: string;
|
|
6
|
+
source?: GuardrailPaletteSource;
|
|
7
|
+
}, getName?: (definition: T) => string): Array<GuardrailPaletteGroup<T>>;
|
|
4
8
|
//# sourceMappingURL=guardrail-palette-utils.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"guardrail-palette-utils.d.ts","sourceRoot":"","sources":["../../../../src/canvas/components/Guardrails/guardrail-palette-utils.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"guardrail-palette-utils.d.ts","sourceRoot":"","sources":["../../../../src/canvas/components/Guardrails/guardrail-palette-utils.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,0BAA0B,EAC1B,qBAAqB,EACrB,sBAAsB,EACvB,MAAM,iBAAiB,CAAC;AAQzB,wBAAgB,yBAAyB,CAAC,UAAU,EAAE,0BAA0B,GAAG,MAAM,CAIxF;AASD,wBAAgB,yBAAyB,CAAC,CAAC,SAAS,0BAA0B,EAC5E,WAAW,EAAE,SAAS,CAAC,EAAE,EACzB,gBAAgB,EAAE,MAAM,EACxB,OAAO,GAAE,CAAC,UAAU,EAAE,CAAC,KAAK,MAA+C,GAC1E,KAAK,CAAC,qBAAqB,CAAC,CAAC,CAAC,CAAC,CA2CjC;AAkBD,wBAAgB,4BAA4B,CAAC,CAAC,SAAS,0BAA0B,EAC/E,MAAM,EAAE,aAAa,CAAC,qBAAqB,CAAC,CAAC,CAAC,CAAC,EAC/C,EAAE,KAAU,EAAE,MAAc,EAAE,EAAE;IAAE,KAAK,CAAC,EAAE,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE,sBAAsB,CAAA;CAAE,EACnF,OAAO,GAAE,CAAC,UAAU,EAAE,CAAC,KAAK,MAA+C,GAC1E,KAAK,CAAC,qBAAqB,CAAC,CAAC,CAAC,CAAC,CAqBjC"}
|
|
@@ -44,4 +44,29 @@ function groupGuardrailsForPalette(definitions, uipathGroupLabel, getName = (def
|
|
|
44
44
|
});
|
|
45
45
|
return groups;
|
|
46
46
|
}
|
|
47
|
-
|
|
47
|
+
function foldForSearch(value) {
|
|
48
|
+
return value.normalize('NFD').replace(/[\u0300-\u036f]/g, '').toLocaleLowerCase();
|
|
49
|
+
}
|
|
50
|
+
function filterGuardrailPaletteGroups(groups, { query = '', source = 'all' }, getName = (definition)=>definition.displayName) {
|
|
51
|
+
const words = foldForSearch(query).split(/\s+/).filter(Boolean);
|
|
52
|
+
const matches = (definition)=>{
|
|
53
|
+
const text = foldForSearch([
|
|
54
|
+
getName(definition),
|
|
55
|
+
definition.description,
|
|
56
|
+
definition.byoConnectorName,
|
|
57
|
+
definition.folderPath
|
|
58
|
+
].filter(Boolean).join(' '));
|
|
59
|
+
return words.every((word)=>text.includes(word));
|
|
60
|
+
};
|
|
61
|
+
return groups.flatMap((group)=>{
|
|
62
|
+
if ('all' !== source && group.isByo !== ('byo' === source)) return [];
|
|
63
|
+
const definitions = 0 === words.length ? group.definitions : group.definitions.filter(matches);
|
|
64
|
+
return 0 === definitions.length ? [] : [
|
|
65
|
+
{
|
|
66
|
+
...group,
|
|
67
|
+
definitions
|
|
68
|
+
}
|
|
69
|
+
];
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
export { filterGuardrailPaletteGroups, getGuardrailPaletteItemId, groupGuardrailsForPalette };
|
|
@@ -36,6 +36,13 @@ const guardrail_status_chip_cjs_namespaceObject = require("./components/guardrai
|
|
|
36
36
|
const external_definitions_enrich_cjs_namespaceObject = require("./definitions-enrich.cjs");
|
|
37
37
|
const external_guardrail_palette_utils_cjs_namespaceObject = require("./guardrail-palette-utils.cjs");
|
|
38
38
|
const external_i18n_cjs_namespaceObject = require("./i18n.cjs");
|
|
39
|
+
const SOURCES = [
|
|
40
|
+
'all',
|
|
41
|
+
'uipath',
|
|
42
|
+
'byo'
|
|
43
|
+
];
|
|
44
|
+
const ENTRY_SELECTOR = '[data-slot="guardrail-palette-item"]';
|
|
45
|
+
const ROVING_SELECTOR = `${ENTRY_SELECTOR}, [data-slot="guardrail-palette-group-toggle"]`;
|
|
39
46
|
function definitionChips(definition, labels, previewChip, byoDisplay) {
|
|
40
47
|
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(jsx_runtime_namespaceObject.Fragment, {
|
|
41
48
|
children: [
|
|
@@ -60,36 +67,121 @@ function definitionChips(definition, labels, previewChip, byoDisplay) {
|
|
|
60
67
|
function paletteEntryName(definition) {
|
|
61
68
|
return definition.byoValidatorName ?? definition.displayName;
|
|
62
69
|
}
|
|
63
|
-
function GuardrailPalette({ ootbDefinitions, onSelectOotb, onCreateCustom, isLoading = false, error = null, previewChip = false, byoDisplay = false, labels: labelOverrides, className }) {
|
|
70
|
+
function GuardrailPalette({ ootbDefinitions, onSelectOotb, onCreateCustom, isLoading = false, error = null, previewChip = false, byoDisplay = false, searchable = true, sourceFilter = true, labels: labelOverrides, className }) {
|
|
64
71
|
const labels = (0, external_i18n_cjs_namespaceObject.useGuardrailPaletteLabels)(labelOverrides);
|
|
65
72
|
const headerIdPrefix = (0, external_react_namespaceObject.useId)();
|
|
66
73
|
const rootRef = (0, external_react_namespaceObject.useRef)(null);
|
|
74
|
+
const searchRef = (0, external_react_namespaceObject.useRef)(null);
|
|
67
75
|
const [activeEntry, setActiveEntry] = (0, external_react_namespaceObject.useState)(0);
|
|
68
|
-
const
|
|
76
|
+
const [query, setQuery] = (0, external_react_namespaceObject.useState)('');
|
|
77
|
+
const [source, setSource] = (0, external_react_namespaceObject.useState)('all');
|
|
78
|
+
const [collapsedGroups, setCollapsedGroups] = (0, external_react_namespaceObject.useState)(()=>new Set());
|
|
79
|
+
const [sourcePointerFocus, setSourcePointerFocus] = (0, external_react_namespaceObject.useState)(false);
|
|
80
|
+
const sourceOpenRef = (0, external_react_namespaceObject.useRef)(false);
|
|
81
|
+
const getName = byoDisplay ? paletteEntryName : void 0;
|
|
82
|
+
const groups = (0, external_react_namespaceObject.useMemo)(()=>(0, external_guardrail_palette_utils_cjs_namespaceObject.groupGuardrailsForPalette)(ootbDefinitions, labels.uipathGroup, getName), [
|
|
69
83
|
ootbDefinitions,
|
|
70
84
|
labels.uipathGroup,
|
|
71
|
-
|
|
85
|
+
getName
|
|
72
86
|
]);
|
|
87
|
+
const showSourceFilter = sourceFilter && groups.some((group)=>group.isByo) && groups.some((group)=>!group.isByo);
|
|
88
|
+
const activeSource = showSourceFilter ? source : 'all';
|
|
89
|
+
const showControls = (searchable || showSourceFilter) && groups.length > 0;
|
|
90
|
+
const searchedGroups = (0, external_react_namespaceObject.useMemo)(()=>searchable ? (0, external_guardrail_palette_utils_cjs_namespaceObject.filterGuardrailPaletteGroups)(groups, {
|
|
91
|
+
query
|
|
92
|
+
}, getName) : groups, [
|
|
93
|
+
groups,
|
|
94
|
+
searchable,
|
|
95
|
+
query,
|
|
96
|
+
getName
|
|
97
|
+
]);
|
|
98
|
+
const visibleGroups = (0, external_react_namespaceObject.useMemo)(()=>(0, external_guardrail_palette_utils_cjs_namespaceObject.filterGuardrailPaletteGroups)(searchedGroups, {
|
|
99
|
+
source: activeSource
|
|
100
|
+
}), [
|
|
101
|
+
searchedGroups,
|
|
102
|
+
activeSource
|
|
103
|
+
]);
|
|
104
|
+
const sourceCounts = (0, external_react_namespaceObject.useMemo)(()=>{
|
|
105
|
+
let all = 0;
|
|
106
|
+
let byo = 0;
|
|
107
|
+
for (const group of searchedGroups){
|
|
108
|
+
all += group.definitions.length;
|
|
109
|
+
if (group.isByo) byo += group.definitions.length;
|
|
110
|
+
}
|
|
111
|
+
return {
|
|
112
|
+
all,
|
|
113
|
+
uipath: all - byo,
|
|
114
|
+
byo
|
|
115
|
+
};
|
|
116
|
+
}, [
|
|
117
|
+
searchedGroups
|
|
118
|
+
]);
|
|
119
|
+
const sourceLabels = {
|
|
120
|
+
all: labels.sourceAll,
|
|
121
|
+
uipath: labels.sourceUipath,
|
|
122
|
+
byo: labels.byo
|
|
123
|
+
};
|
|
73
124
|
const isEmpty = 0 === groups.length && void 0 === onCreateCustom;
|
|
74
|
-
const
|
|
125
|
+
const hasNoMatches = groups.length > 0 && 0 === visibleGroups.length;
|
|
126
|
+
const roving = (0, external_react_namespaceObject.useMemo)(()=>{
|
|
75
127
|
let offset = onCreateCustom ? 1 : 0;
|
|
76
|
-
|
|
77
|
-
const
|
|
78
|
-
|
|
79
|
-
|
|
128
|
+
const groupLayout = visibleGroups.map((group)=>{
|
|
129
|
+
const headed = null !== group.header;
|
|
130
|
+
const collapsed = headed && collapsedGroups.has(group.key);
|
|
131
|
+
const headerIndex = headed ? offset : -1;
|
|
132
|
+
if (headed) offset += 1;
|
|
133
|
+
const firstEntry = offset;
|
|
134
|
+
if (!collapsed) offset += group.definitions.length;
|
|
135
|
+
return {
|
|
136
|
+
headerIndex,
|
|
137
|
+
firstEntry,
|
|
138
|
+
collapsed
|
|
139
|
+
};
|
|
80
140
|
});
|
|
141
|
+
return {
|
|
142
|
+
groupLayout,
|
|
143
|
+
count: offset
|
|
144
|
+
};
|
|
81
145
|
}, [
|
|
82
|
-
|
|
83
|
-
onCreateCustom
|
|
146
|
+
visibleGroups,
|
|
147
|
+
onCreateCustom,
|
|
148
|
+
collapsedGroups
|
|
84
149
|
]);
|
|
85
|
-
const
|
|
86
|
-
const
|
|
87
|
-
|
|
150
|
+
const rovingEntry = activeEntry < roving.count ? activeEntry : 0;
|
|
151
|
+
const updateQuery = (next)=>{
|
|
152
|
+
if ('' === query.trim() && '' !== next.trim()) setCollapsedGroups(new Set());
|
|
153
|
+
setQuery(next);
|
|
154
|
+
setActiveEntry(0);
|
|
155
|
+
};
|
|
156
|
+
const toggleGroup = (key)=>setCollapsedGroups((current)=>{
|
|
157
|
+
const next = new Set(current);
|
|
158
|
+
if (!next.delete(key)) next.add(key);
|
|
159
|
+
return next;
|
|
160
|
+
});
|
|
161
|
+
const updateSource = (next)=>{
|
|
162
|
+
setSource(next);
|
|
163
|
+
setActiveEntry(0);
|
|
164
|
+
};
|
|
165
|
+
const entryElements = ()=>Array.from(rootRef.current?.querySelectorAll(ROVING_SELECTOR) ?? []);
|
|
88
166
|
const handleKeyDown = (event)=>{
|
|
89
167
|
const entries = entryElements();
|
|
90
168
|
const focused = event.target;
|
|
91
169
|
const current = entries.indexOf(focused);
|
|
92
|
-
if (-1 === current)
|
|
170
|
+
if (-1 === current) {
|
|
171
|
+
if ('ArrowDown' === event.key && !event.nativeEvent.isComposing && 229 !== event.keyCode && focused === searchRef.current) {
|
|
172
|
+
const target = entries.find((entry)=>entry.matches(ENTRY_SELECTOR)) ?? entries[0];
|
|
173
|
+
if (!target) return;
|
|
174
|
+
event.preventDefault();
|
|
175
|
+
setActiveEntry(entries.indexOf(target));
|
|
176
|
+
target.focus();
|
|
177
|
+
}
|
|
178
|
+
return;
|
|
179
|
+
}
|
|
180
|
+
if ('ArrowUp' === event.key && 0 === current && searchRef.current) {
|
|
181
|
+
event.preventDefault();
|
|
182
|
+
searchRef.current.focus();
|
|
183
|
+
return;
|
|
184
|
+
}
|
|
93
185
|
let next;
|
|
94
186
|
switch(event.key){
|
|
95
187
|
case 'ArrowDown':
|
|
@@ -122,7 +214,7 @@ function GuardrailPalette({ ootbDefinitions, onSelectOotb, onCreateCustom, isLoa
|
|
|
122
214
|
"data-slot": "guardrail-palette",
|
|
123
215
|
role: "group",
|
|
124
216
|
"aria-label": labels.listAriaLabel,
|
|
125
|
-
className: (0, apollo_wind_namespaceObject.cn)('flex flex-col gap-2', className),
|
|
217
|
+
className: (0, apollo_wind_namespaceObject.cn)('flex min-h-0 flex-col gap-2', className),
|
|
126
218
|
onKeyDown: handleKeyDown,
|
|
127
219
|
onFocus: handleFocus,
|
|
128
220
|
children: [
|
|
@@ -141,52 +233,157 @@ function GuardrailPalette({ ootbDefinitions, onSelectOotb, onCreateCustom, isLoa
|
|
|
141
233
|
]
|
|
142
234
|
}) : /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(jsx_runtime_namespaceObject.Fragment, {
|
|
143
235
|
children: [
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
236
|
+
showControls && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
|
|
237
|
+
"data-slot": "guardrail-palette-controls",
|
|
238
|
+
className: "flex shrink-0 items-center gap-2",
|
|
239
|
+
children: [
|
|
240
|
+
searchable && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(apollo_wind_namespaceObject.InputGroup, {
|
|
241
|
+
className: "h-8 min-w-0 flex-1 future:h-9",
|
|
242
|
+
children: [
|
|
243
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(apollo_wind_namespaceObject.InputGroupAddon, {
|
|
244
|
+
align: "inline-start",
|
|
245
|
+
children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_lucide_react_namespaceObject.Search, {
|
|
246
|
+
className: "size-4",
|
|
247
|
+
"aria-hidden": "true"
|
|
248
|
+
})
|
|
249
|
+
}),
|
|
250
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(apollo_wind_namespaceObject.InputGroupInput, {
|
|
251
|
+
ref: searchRef,
|
|
252
|
+
type: "search",
|
|
253
|
+
autoComplete: "off",
|
|
254
|
+
"aria-label": labels.search,
|
|
255
|
+
placeholder: labels.search,
|
|
256
|
+
value: query,
|
|
257
|
+
onChange: (event)=>updateQuery(event.target.value),
|
|
258
|
+
className: "[&::-webkit-search-cancel-button]:appearance-none"
|
|
259
|
+
}),
|
|
260
|
+
query && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(apollo_wind_namespaceObject.InputGroupAddon, {
|
|
261
|
+
align: "inline-end",
|
|
262
|
+
children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(apollo_wind_namespaceObject.InputGroupButton, {
|
|
263
|
+
icon: true,
|
|
264
|
+
size: "3xs",
|
|
265
|
+
"aria-label": labels.clearSearch,
|
|
266
|
+
onClick: ()=>{
|
|
267
|
+
updateQuery('');
|
|
268
|
+
searchRef.current?.focus();
|
|
269
|
+
},
|
|
270
|
+
children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_lucide_react_namespaceObject.X, {
|
|
271
|
+
"aria-hidden": "true"
|
|
272
|
+
})
|
|
273
|
+
})
|
|
274
|
+
})
|
|
275
|
+
]
|
|
276
|
+
}),
|
|
277
|
+
showSourceFilter && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(apollo_wind_namespaceObject.Select, {
|
|
278
|
+
value: activeSource,
|
|
279
|
+
onValueChange: (value)=>updateSource(value),
|
|
280
|
+
onOpenChange: (open)=>{
|
|
281
|
+
sourceOpenRef.current = open;
|
|
282
|
+
},
|
|
283
|
+
children: [
|
|
284
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(apollo_wind_namespaceObject.SelectTrigger, {
|
|
285
|
+
"aria-label": labels.sourceFilter,
|
|
286
|
+
"data-pointer-focus": sourcePointerFocus || void 0,
|
|
287
|
+
onPointerDown: ()=>setSourcePointerFocus(true),
|
|
288
|
+
onKeyDown: ()=>setSourcePointerFocus(false),
|
|
289
|
+
onBlur: ()=>{
|
|
290
|
+
if (!sourceOpenRef.current) setSourcePointerFocus(false);
|
|
291
|
+
},
|
|
292
|
+
className: "h-8 w-auto shrink-0 gap-2 future:h-9 data-[pointer-focus]:focus:ring-0 data-[pointer-focus]:focus-visible:ring-0",
|
|
293
|
+
children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(apollo_wind_namespaceObject.SelectValue, {
|
|
294
|
+
children: sourceLabels[activeSource]
|
|
295
|
+
})
|
|
296
|
+
}),
|
|
297
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(apollo_wind_namespaceObject.SelectContent, {
|
|
298
|
+
onKeyDown: ()=>setSourcePointerFocus(false),
|
|
299
|
+
children: SOURCES.map((option)=>/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(apollo_wind_namespaceObject.SelectItem, {
|
|
300
|
+
value: option,
|
|
301
|
+
children: [
|
|
302
|
+
sourceLabels[option],
|
|
303
|
+
' ',
|
|
304
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("span", {
|
|
305
|
+
className: "tabular-nums text-muted-foreground",
|
|
306
|
+
children: sourceCounts[option]
|
|
307
|
+
})
|
|
308
|
+
]
|
|
309
|
+
}, option))
|
|
310
|
+
})
|
|
311
|
+
]
|
|
312
|
+
})
|
|
313
|
+
]
|
|
156
314
|
}),
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
315
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
|
|
316
|
+
"data-slot": "guardrail-palette-entries",
|
|
317
|
+
className: "-m-1 flex min-h-0 flex-1 flex-col gap-2 overflow-y-auto p-1",
|
|
318
|
+
children: [
|
|
319
|
+
onCreateCustom && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(guardrail_palette_item_cjs_namespaceObject.GuardrailPaletteItem, {
|
|
320
|
+
name: labels.createCustom,
|
|
321
|
+
description: labels.createCustomDescription,
|
|
322
|
+
icon: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_lucide_react_namespaceObject.Plus, {
|
|
323
|
+
"aria-hidden": "true"
|
|
324
|
+
}),
|
|
325
|
+
tabIndex: 0 === rovingEntry ? 0 : -1,
|
|
326
|
+
onSelect: onCreateCustom
|
|
327
|
+
}),
|
|
328
|
+
isEmpty && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("p", {
|
|
329
|
+
className: "px-2 py-1 text-sm text-muted-foreground",
|
|
330
|
+
children: labels.empty
|
|
331
|
+
}),
|
|
332
|
+
showControls && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("output", {
|
|
333
|
+
className: "px-2 py-1 text-sm text-muted-foreground empty:sr-only",
|
|
334
|
+
children: hasNoMatches ? labels.noMatches : null
|
|
335
|
+
}),
|
|
336
|
+
visibleGroups.map((group, groupIndex)=>{
|
|
337
|
+
const headerId = `${headerIdPrefix}-${groupIndex}`;
|
|
338
|
+
const layout = roving.groupLayout[groupIndex];
|
|
339
|
+
const collapsed = layout?.collapsed ?? false;
|
|
340
|
+
const FolderIcon = collapsed ? external_lucide_react_namespaceObject.Folder : external_lucide_react_namespaceObject.FolderOpen;
|
|
341
|
+
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
|
|
342
|
+
role: "group",
|
|
343
|
+
"aria-labelledby": null !== group.header ? headerId : void 0,
|
|
344
|
+
className: "flex flex-col gap-1",
|
|
168
345
|
children: [
|
|
169
|
-
group.
|
|
170
|
-
|
|
171
|
-
"
|
|
346
|
+
null !== group.header && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("button", {
|
|
347
|
+
type: "button",
|
|
348
|
+
"data-slot": "guardrail-palette-group-toggle",
|
|
349
|
+
"aria-expanded": !collapsed,
|
|
350
|
+
tabIndex: rovingEntry === layout?.headerIndex ? 0 : -1,
|
|
351
|
+
onClick: ()=>toggleGroup(group.key),
|
|
352
|
+
className: (0, apollo_wind_namespaceObject.cn)('flex w-full cursor-pointer items-center gap-1.5 rounded-md px-2 py-1 text-left text-xs font-semibold text-muted-foreground ring-offset-background transition-colors', 'hover:bg-accent hover:text-accent-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2'),
|
|
353
|
+
children: [
|
|
354
|
+
group.isByo && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(FolderIcon, {
|
|
355
|
+
className: "size-3.5 shrink-0",
|
|
356
|
+
"aria-hidden": "true"
|
|
357
|
+
}),
|
|
358
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("span", {
|
|
359
|
+
id: headerId,
|
|
360
|
+
className: "truncate",
|
|
361
|
+
children: group.header
|
|
362
|
+
}),
|
|
363
|
+
' ',
|
|
364
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("span", {
|
|
365
|
+
className: "ml-auto font-normal tabular-nums",
|
|
366
|
+
children: group.definitions.length
|
|
367
|
+
}),
|
|
368
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_lucide_react_namespaceObject.ChevronDown, {
|
|
369
|
+
className: (0, apollo_wind_namespaceObject.cn)('size-3.5 shrink-0 transition-transform', collapsed && '-rotate-90'),
|
|
370
|
+
"aria-hidden": "true"
|
|
371
|
+
})
|
|
372
|
+
]
|
|
172
373
|
}),
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
374
|
+
!collapsed && group.definitions.map((definition, definitionIndex)=>/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(guardrail_palette_item_cjs_namespaceObject.GuardrailPaletteItem, {
|
|
375
|
+
name: byoDisplay ? paletteEntryName(definition) : definition.displayName,
|
|
376
|
+
description: definition.description,
|
|
377
|
+
chips: definitionChips(definition, labels, previewChip, byoDisplay),
|
|
378
|
+
caption: byoDisplay && void 0 !== definition.byoConnectorName ? `${labels.provider}: ${definition.byoConnectorName}` : void 0,
|
|
379
|
+
disabled: 'Unauthorised' === definition.status,
|
|
380
|
+
tabIndex: rovingEntry === (layout?.firstEntry ?? 0) + definitionIndex ? 0 : -1,
|
|
381
|
+
onSelect: ()=>onSelectOotb(definition)
|
|
382
|
+
}, (0, external_guardrail_palette_utils_cjs_namespaceObject.getGuardrailPaletteItemId)(definition)))
|
|
177
383
|
]
|
|
178
|
-
})
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
description: definition.description,
|
|
182
|
-
chips: definitionChips(definition, labels, previewChip, byoDisplay),
|
|
183
|
-
caption: byoDisplay && void 0 !== definition.byoConnectorName ? `${labels.provider}: ${definition.byoConnectorName}` : void 0,
|
|
184
|
-
disabled: 'Unauthorised' === definition.status,
|
|
185
|
-
tabIndex: rovingEntry === groupOffset + definitionIndex ? 0 : -1,
|
|
186
|
-
onSelect: ()=>onSelectOotb(definition)
|
|
187
|
-
}, (0, external_guardrail_palette_utils_cjs_namespaceObject.getGuardrailPaletteItemId)(definition)))
|
|
188
|
-
]
|
|
189
|
-
}, group.key);
|
|
384
|
+
}, group.key);
|
|
385
|
+
})
|
|
386
|
+
]
|
|
190
387
|
})
|
|
191
388
|
]
|
|
192
389
|
})
|
|
@@ -8,8 +8,10 @@ export interface GuardrailPaletteProps<T extends GuardrailPaletteDefinition = Gu
|
|
|
8
8
|
error?: Error | null;
|
|
9
9
|
previewChip?: boolean;
|
|
10
10
|
byoDisplay?: boolean;
|
|
11
|
+
searchable?: boolean;
|
|
12
|
+
sourceFilter?: boolean;
|
|
11
13
|
labels?: Partial<GuardrailPaletteLabels>;
|
|
12
14
|
className?: string;
|
|
13
15
|
}
|
|
14
|
-
export declare function GuardrailPalette<T extends GuardrailPaletteDefinition>({ ootbDefinitions, onSelectOotb, onCreateCustom, isLoading, error, previewChip, byoDisplay, labels: labelOverrides, className, }: GuardrailPaletteProps<T>): import("react/jsx-runtime").JSX.Element;
|
|
16
|
+
export declare function GuardrailPalette<T extends GuardrailPaletteDefinition>({ ootbDefinitions, onSelectOotb, onCreateCustom, isLoading, error, previewChip, byoDisplay, searchable, sourceFilter, labels: labelOverrides, className, }: GuardrailPaletteProps<T>): import("react/jsx-runtime").JSX.Element;
|
|
15
17
|
//# sourceMappingURL=guardrail-palette.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"guardrail-palette.d.ts","sourceRoot":"","sources":["../../../../src/canvas/components/Guardrails/guardrail-palette.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"guardrail-palette.d.ts","sourceRoot":"","sources":["../../../../src/canvas/components/Guardrails/guardrail-palette.tsx"],"names":[],"mappings":"AAuBA,OAAO,EAAE,KAAK,sBAAsB,EAA6B,MAAM,QAAQ,CAAC;AAChF,OAAO,KAAK,EAAE,0BAA0B,EAA0B,MAAM,iBAAiB,CAAC;AAE1F,MAAM,WAAW,qBAAqB,CACpC,CAAC,SAAS,0BAA0B,GAAG,0BAA0B;IAMjE,eAAe,EAAE,CAAC,EAAE,CAAC;IAErB,YAAY,EAAE,CAAC,UAAU,EAAE,CAAC,KAAK,IAAI,CAAC;IAKtC,cAAc,CAAC,EAAE,MAAM,IAAI,CAAC;IAC5B,SAAS,CAAC,EAAE,OAAO,CAAC;IAEpB,KAAK,CAAC,EAAE,KAAK,GAAG,IAAI,CAAC;IAErB,WAAW,CAAC,EAAE,OAAO,CAAC;IAMtB,UAAU,CAAC,EAAE,OAAO,CAAC;IAKrB,UAAU,CAAC,EAAE,OAAO,CAAC;IAOrB,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,MAAM,CAAC,EAAE,OAAO,CAAC,sBAAsB,CAAC,CAAC;IACzC,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AA8CD,wBAAgB,gBAAgB,CAAC,CAAC,SAAS,0BAA0B,EAAE,EACrE,eAAe,EACf,YAAY,EACZ,cAAc,EACd,SAAiB,EACjB,KAAY,EACZ,WAAmB,EACnB,UAAkB,EAClB,UAAiB,EACjB,YAAmB,EACnB,MAAM,EAAE,cAAc,EACtB,SAAS,GACV,EAAE,qBAAqB,CAAC,CAAC,CAAC,2CA6W1B"}
|