@uipath/apollo-wind 2.87.0 → 2.89.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/ui/connection-picker/components/connection-actions-menu.cjs +129 -0
- package/dist/components/ui/connection-picker/components/connection-actions-menu.d.ts +21 -0
- package/dist/components/ui/connection-picker/components/connection-actions-menu.js +95 -0
- package/dist/components/ui/connection-picker/components/connection-status.cjs +81 -0
- package/dist/components/ui/connection-picker/components/connection-status.d.ts +22 -0
- package/dist/components/ui/connection-picker/components/connection-status.js +41 -0
- package/dist/components/ui/connection-picker/connection-picker.cjs +411 -0
- package/dist/components/ui/connection-picker/connection-picker.d.ts +12 -0
- package/dist/components/ui/connection-picker/connection-picker.js +374 -0
- package/dist/components/ui/connection-picker/index.cjs +39 -0
- package/dist/components/ui/connection-picker/index.d.ts +2 -0
- package/dist/components/ui/connection-picker/index.js +2 -0
- package/dist/components/ui/connection-picker/types.cjs +18 -0
- package/dist/components/ui/connection-picker/types.d.ts +124 -0
- package/dist/components/ui/connection-picker/types.js +0 -0
- package/dist/components/ui/field-actions/ai-assist-action.cjs +32 -8
- package/dist/components/ui/field-actions/ai-assist-action.d.ts +25 -2
- package/dist/components/ui/field-actions/ai-assist-action.js +33 -9
- package/dist/components/ui/field-actions/collapse.cjs +7 -3
- package/dist/components/ui/field-actions/collapse.d.ts +2 -0
- package/dist/components/ui/field-actions/collapse.js +3 -2
- package/dist/components/ui/field-actions/insert-variable-action.d.ts +4 -1
- package/dist/components/ui/folder-picker/folder-picker.cjs +4 -3
- package/dist/components/ui/folder-picker/folder-picker.js +4 -3
- package/dist/components/ui/index.cjs +254 -228
- package/dist/components/ui/index.d.ts +3 -1
- package/dist/components/ui/index.js +2 -0
- package/dist/components/ui/input-group.cjs +57 -5
- package/dist/components/ui/input-group.d.ts +2 -0
- package/dist/components/ui/input-group.js +58 -6
- package/dist/components/ui/{folder-picker/components/folder-picker-empty-state.cjs → picker-empty-state.cjs} +11 -11
- package/dist/components/ui/picker-empty-state.d.ts +33 -0
- package/dist/components/ui/{folder-picker/components/folder-picker-empty-state.js → picker-empty-state.js} +9 -9
- package/dist/components/ui/prompt-editor/components/TokenPill.cjs +1 -1
- package/dist/components/ui/prompt-editor/components/TokenPill.js +1 -1
- package/dist/components/ui/prompt-editor/types.d.ts +6 -0
- package/dist/components/ui/reference-chip-colors.cjs +6 -0
- package/dist/components/ui/reference-chip-colors.d.ts +14 -0
- package/dist/components/ui/reference-chip-colors.js +6 -0
- package/dist/components/ui/reference-chip.cjs +6 -7
- package/dist/components/ui/reference-chip.d.ts +3 -0
- package/dist/components/ui/reference-chip.js +6 -7
- package/dist/components/ui/resource-picker/command-value.cjs +48 -0
- package/dist/components/ui/resource-picker/command-value.d.ts +11 -0
- package/dist/components/ui/resource-picker/command-value.js +11 -0
- package/dist/components/ui/resource-picker/components/resource-group-header.cjs +102 -0
- package/dist/components/ui/resource-picker/components/resource-group-header.d.ts +44 -0
- package/dist/components/ui/resource-picker/components/resource-group-header.js +65 -0
- package/dist/components/ui/resource-picker/components/resource-picker-footer.cjs +55 -0
- package/dist/components/ui/resource-picker/components/resource-picker-footer.d.ts +14 -0
- package/dist/components/ui/resource-picker/components/resource-picker-footer.js +21 -0
- package/dist/components/ui/resource-picker/components/resource-row-actions-menu.cjs +136 -0
- package/dist/components/ui/resource-picker/components/resource-row-actions-menu.d.ts +30 -0
- package/dist/components/ui/resource-picker/components/resource-row-actions-menu.js +102 -0
- package/dist/components/ui/resource-picker/components/resource-row.cjs +115 -0
- package/dist/components/ui/resource-picker/components/resource-row.d.ts +16 -0
- package/dist/components/ui/resource-picker/components/resource-row.js +81 -0
- package/dist/components/ui/resource-picker/focus.cjs +66 -0
- package/dist/components/ui/resource-picker/focus.d.ts +1 -0
- package/dist/components/ui/resource-picker/focus.js +32 -0
- package/dist/components/ui/resource-picker/index.cjs +42 -0
- package/dist/components/ui/resource-picker/index.d.ts +2 -0
- package/dist/components/ui/resource-picker/index.js +2 -0
- package/dist/components/ui/resource-picker/resource-picker.cjs +606 -0
- package/dist/components/ui/resource-picker/resource-picker.d.ts +40 -0
- package/dist/components/ui/resource-picker/resource-picker.js +566 -0
- package/dist/components/ui/resource-picker/types.cjs +50 -0
- package/dist/components/ui/resource-picker/types.d.ts +209 -0
- package/dist/components/ui/resource-picker/types.js +16 -0
- package/dist/components/ui/variable-picker/variable-picker.cjs +1 -1
- package/dist/components/ui/variable-picker/variable-picker.d.ts +2 -1
- package/dist/components/ui/variable-picker/variable-picker.js +1 -1
- package/dist/components/ui/variable-value-control.d.ts +5 -2
- package/dist/index.cjs +24 -7
- package/dist/index.d.ts +5 -1
- package/dist/index.js +3 -1
- package/dist/styles.css +179 -39
- package/package.json +1 -1
- package/dist/components/ui/folder-picker/components/folder-picker-empty-state.d.ts +0 -26
|
@@ -0,0 +1,606 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
"use client";
|
|
3
|
+
var __webpack_require__ = {};
|
|
4
|
+
(()=>{
|
|
5
|
+
__webpack_require__.d = (exports1, definition)=>{
|
|
6
|
+
for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: definition[key]
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
})();
|
|
12
|
+
(()=>{
|
|
13
|
+
__webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
|
|
14
|
+
})();
|
|
15
|
+
(()=>{
|
|
16
|
+
__webpack_require__.r = (exports1)=>{
|
|
17
|
+
if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
18
|
+
value: 'Module'
|
|
19
|
+
});
|
|
20
|
+
Object.defineProperty(exports1, '__esModule', {
|
|
21
|
+
value: true
|
|
22
|
+
});
|
|
23
|
+
};
|
|
24
|
+
})();
|
|
25
|
+
var __webpack_exports__ = {};
|
|
26
|
+
__webpack_require__.r(__webpack_exports__);
|
|
27
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
28
|
+
keepResourceSearchOnEscape: ()=>keepResourceSearchOnEscape,
|
|
29
|
+
ResourcePicker: ()=>ResourcePicker,
|
|
30
|
+
ResourcePickerContent: ()=>ResourcePickerContent
|
|
31
|
+
});
|
|
32
|
+
const jsx_runtime_namespaceObject = require("react/jsx-runtime");
|
|
33
|
+
const external_cmdk_namespaceObject = require("cmdk");
|
|
34
|
+
const external_lucide_react_namespaceObject = require("lucide-react");
|
|
35
|
+
const external_react_namespaceObject = require("react");
|
|
36
|
+
const external_command_cjs_namespaceObject = require("../command.cjs");
|
|
37
|
+
const field_addon_button_cjs_namespaceObject = require("../field-addons/field-addon-button.cjs");
|
|
38
|
+
const external_form_field_cjs_namespaceObject = require("../form-field.cjs");
|
|
39
|
+
const external_input_group_cjs_namespaceObject = require("../input-group.cjs");
|
|
40
|
+
const external_input_group_context_cjs_namespaceObject = require("../input-group-context.cjs");
|
|
41
|
+
const external_popover_cjs_namespaceObject = require("../popover.cjs");
|
|
42
|
+
const index_cjs_namespaceObject = require("../../../lib/index.cjs");
|
|
43
|
+
const external_picker_empty_state_cjs_namespaceObject = require("../picker-empty-state.cjs");
|
|
44
|
+
const external_command_value_cjs_namespaceObject = require("./command-value.cjs");
|
|
45
|
+
const resource_group_header_cjs_namespaceObject = require("./components/resource-group-header.cjs");
|
|
46
|
+
const resource_picker_footer_cjs_namespaceObject = require("./components/resource-picker-footer.cjs");
|
|
47
|
+
const resource_row_cjs_namespaceObject = require("./components/resource-row.cjs");
|
|
48
|
+
const resource_row_actions_menu_cjs_namespaceObject = require("./components/resource-row-actions-menu.cjs");
|
|
49
|
+
const external_focus_cjs_namespaceObject = require("./focus.cjs");
|
|
50
|
+
const external_types_cjs_namespaceObject = require("./types.cjs");
|
|
51
|
+
const PICKER_VALUE_PREFIX = '\uE000resource-picker:';
|
|
52
|
+
const collapsedValue = (groupId)=>`${PICKER_VALUE_PREFIX}collapsed:${groupId}`;
|
|
53
|
+
const openHeadingValue = (groupId)=>`${PICKER_VALUE_PREFIX}open:${groupId}`;
|
|
54
|
+
const hasEnabledRow = (group)=>group.items.some((item)=>!item.disabled);
|
|
55
|
+
const defaultCollapsedGroupLabel = (label)=>`${label}, collapsed`;
|
|
56
|
+
const defaultActionsMenuLabel = (label)=>`Actions for ${label}`;
|
|
57
|
+
const defaultExpandedGroupLabel = (label)=>`${label}, expanded`;
|
|
58
|
+
function CursorPlacer({ target, rootRef, placing }) {
|
|
59
|
+
const current = (0, external_cmdk_namespaceObject.useCommandState)((state)=>state.value);
|
|
60
|
+
(0, external_react_namespaceObject.useLayoutEffect)(()=>{
|
|
61
|
+
if (null === target || (0, external_command_value_cjs_namespaceObject.fromCommandValue)(current) === target) return;
|
|
62
|
+
queueMicrotask(()=>placeCursor(rootRef.current, placing, (value)=>value === target));
|
|
63
|
+
});
|
|
64
|
+
return null;
|
|
65
|
+
}
|
|
66
|
+
const rowValue = (element)=>(0, external_command_value_cjs_namespaceObject.fromCommandValue)(element.getAttribute('data-value'));
|
|
67
|
+
function placeCursor(root, placing, accept) {
|
|
68
|
+
const row = Array.from(root?.querySelectorAll('[cmdk-item]') ?? []).find((item)=>'true' !== item.getAttribute('aria-disabled') && accept(rowValue(item)));
|
|
69
|
+
if (!row) return;
|
|
70
|
+
placing.current = true;
|
|
71
|
+
row.dispatchEvent(new MouseEvent('pointermove', {
|
|
72
|
+
bubbles: true
|
|
73
|
+
}));
|
|
74
|
+
placing.current = false;
|
|
75
|
+
}
|
|
76
|
+
function ResourcePickerContent({ groups, onSelect, value, searchPlaceholder = 'Search...', initialSearch = '', query: controlledQuery, onQueryChange, emptyText = 'No matches.', loading = false, loadingText, loadError, onRetry, retryLabel, noMatchText, collapsedGroupLabel = defaultCollapsedGroupLabel, expandedGroupLabel = defaultExpandedGroupLabel, listLabel = 'Resources', showCounts = true, locale, formatCount, itemActions, actionsMenuLabel = defaultActionsMenuLabel, onTabOut, footerLeading, footerTrailing, className }) {
|
|
77
|
+
const [uncontrolledQuery, setUncontrolledQuery] = (0, external_react_namespaceObject.useState)(initialSearch);
|
|
78
|
+
const query = controlledQuery ?? uncontrolledQuery;
|
|
79
|
+
const queryReadOnly = void 0 !== controlledQuery && !onQueryChange;
|
|
80
|
+
const [collapsedIds, setCollapsedIds] = (0, external_react_namespaceObject.useState)(()=>new Set(groups.filter((group)=>group.defaultCollapsed).map((group)=>group.id)));
|
|
81
|
+
const [seenIds, setSeenIds] = (0, external_react_namespaceObject.useState)(()=>new Set(groups.map((group)=>group.id)));
|
|
82
|
+
const newGroups = groups.filter((group)=>!seenIds.has(group.id));
|
|
83
|
+
if (newGroups.length > 0) {
|
|
84
|
+
setSeenIds(new Set([
|
|
85
|
+
...seenIds,
|
|
86
|
+
...newGroups.map((group)=>group.id)
|
|
87
|
+
]));
|
|
88
|
+
const collapsedNew = newGroups.filter((group)=>group.defaultCollapsed);
|
|
89
|
+
if (collapsedNew.length > 0) setCollapsedIds((current)=>new Set([
|
|
90
|
+
...current,
|
|
91
|
+
...collapsedNew.map((group)=>group.id)
|
|
92
|
+
]));
|
|
93
|
+
}
|
|
94
|
+
const setQuery = (nextQuery)=>{
|
|
95
|
+
if (void 0 === controlledQuery) setUncontrolledQuery(nextQuery);
|
|
96
|
+
onQueryChange?.(nextQuery);
|
|
97
|
+
};
|
|
98
|
+
(0, external_react_namespaceObject.useEffect)(()=>{
|
|
99
|
+
if ("u" < typeof process || 'production' === process.env.NODE_ENV) return;
|
|
100
|
+
if (groups.some((group)=>group.items.some((item)=>'' === item.id))) console.warn('ResourcePicker: dropped rows with an empty id, which the picker reserves for no selection.');
|
|
101
|
+
}, [
|
|
102
|
+
groups
|
|
103
|
+
]);
|
|
104
|
+
const groupIdBase = (0, external_react_namespaceObject.useId)();
|
|
105
|
+
const visibleGroups = (0, external_react_namespaceObject.useMemo)(()=>(0, external_types_cjs_namespaceObject.filterGroups)(groups, query, locale), [
|
|
106
|
+
groups,
|
|
107
|
+
query,
|
|
108
|
+
locale
|
|
109
|
+
]);
|
|
110
|
+
const countFormatter = (0, external_react_namespaceObject.useMemo)(()=>{
|
|
111
|
+
if (formatCount) return formatCount;
|
|
112
|
+
if (!locale) return String;
|
|
113
|
+
const numberFormat = new Intl.NumberFormat(locale);
|
|
114
|
+
return (count)=>numberFormat.format(count);
|
|
115
|
+
}, [
|
|
116
|
+
formatCount,
|
|
117
|
+
locale
|
|
118
|
+
]);
|
|
119
|
+
const filtering = query.trim().length > 0;
|
|
120
|
+
const hasRows = (0, external_react_namespaceObject.useMemo)(()=>(0, external_types_cjs_namespaceObject.filterGroups)(groups, '').length > 0, [
|
|
121
|
+
groups
|
|
122
|
+
]);
|
|
123
|
+
const rootRef = (0, external_react_namespaceObject.useRef)(null);
|
|
124
|
+
const activeValue = ()=>{
|
|
125
|
+
const active = rootRef.current?.querySelector('[cmdk-item][aria-selected="true"]');
|
|
126
|
+
return active ? rowValue(active) : '';
|
|
127
|
+
};
|
|
128
|
+
const [cursorTarget, setCursorTarget] = (0, external_react_namespaceObject.useState)(null);
|
|
129
|
+
const placingCursor = (0, external_react_namespaceObject.useRef)(false);
|
|
130
|
+
const [openMenu, setOpenMenu] = (0, external_react_namespaceObject.useState)(null);
|
|
131
|
+
const shownGroups = visibleGroups.filter((group)=>filtering || !collapsedIds.has(group.id));
|
|
132
|
+
const shownRows = shownGroups.flatMap((group)=>group.items);
|
|
133
|
+
const groupOfRow = (id)=>shownGroups.find((group)=>group.items.some((row)=>row.id === id))?.id;
|
|
134
|
+
const menuFor = (id, groupId)=>{
|
|
135
|
+
if (null === id || !itemActions) return null;
|
|
136
|
+
if (void 0 !== groupId && groupOfRow(id) !== groupId) return null;
|
|
137
|
+
const item = shownRows.find((row)=>row.id === id);
|
|
138
|
+
if (!item || item.disabled) return null;
|
|
139
|
+
const anchor = Array.from(rootRef.current?.querySelectorAll('[cmdk-item]') ?? []).find((row)=>rowValue(row) === id);
|
|
140
|
+
if (!anchor) return null;
|
|
141
|
+
const actions = itemActions(item);
|
|
142
|
+
return actions.length > 0 ? {
|
|
143
|
+
item,
|
|
144
|
+
actions,
|
|
145
|
+
anchor
|
|
146
|
+
} : null;
|
|
147
|
+
};
|
|
148
|
+
const actionsMenu = openMenu && menuFor(openMenu.id, openMenu.groupId);
|
|
149
|
+
const searchInput = ()=>rootRef.current?.querySelector('[data-slot="resource-picker-search"]');
|
|
150
|
+
const actionsMenuGone = null !== openMenu && null === actionsMenu;
|
|
151
|
+
(0, external_react_namespaceObject.useLayoutEffect)(()=>{
|
|
152
|
+
if (!actionsMenuGone) return;
|
|
153
|
+
setOpenMenu(null);
|
|
154
|
+
const root = rootRef.current;
|
|
155
|
+
if (!root) return;
|
|
156
|
+
const active = root.getRootNode().activeElement;
|
|
157
|
+
if (active && active !== root.ownerDocument.body) return;
|
|
158
|
+
root.querySelector('[data-slot="resource-picker-search"]')?.focus();
|
|
159
|
+
}, [
|
|
160
|
+
actionsMenuGone
|
|
161
|
+
]);
|
|
162
|
+
const openActionsMenu = ()=>{
|
|
163
|
+
const active = activeValue();
|
|
164
|
+
const groupId = groupOfRow(active);
|
|
165
|
+
if (void 0 === groupId || !menuFor(active)) return false;
|
|
166
|
+
setOpenMenu({
|
|
167
|
+
id: active,
|
|
168
|
+
groupId
|
|
169
|
+
});
|
|
170
|
+
return true;
|
|
171
|
+
};
|
|
172
|
+
const leaveActionsMenu = (backwards)=>{
|
|
173
|
+
const anchor = actionsMenu?.anchor;
|
|
174
|
+
const root = rootRef.current;
|
|
175
|
+
setOpenMenu(null);
|
|
176
|
+
if (!anchor || !root) return;
|
|
177
|
+
if ((0, external_focus_cjs_namespaceObject.focusBeside)(anchor, backwards, root)) return;
|
|
178
|
+
if (!backwards && onTabOut) return void onTabOut();
|
|
179
|
+
if (!backwards && (0, external_focus_cjs_namespaceObject.focusBeside)(root, false)) return;
|
|
180
|
+
searchInput()?.focus();
|
|
181
|
+
};
|
|
182
|
+
const closeActionsMenu = (restoreFocus)=>{
|
|
183
|
+
setOpenMenu(null);
|
|
184
|
+
if (restoreFocus) searchInput()?.focus();
|
|
185
|
+
};
|
|
186
|
+
const setCollapsed = (id, collapse)=>{
|
|
187
|
+
if (filtering) return;
|
|
188
|
+
setCollapsedIds((current)=>{
|
|
189
|
+
const next = new Set(current);
|
|
190
|
+
if (collapse) next.add(id);
|
|
191
|
+
else next.delete(id);
|
|
192
|
+
return next;
|
|
193
|
+
});
|
|
194
|
+
};
|
|
195
|
+
const changeGroup = (leaving, target)=>{
|
|
196
|
+
const active = activeValue();
|
|
197
|
+
if ('' !== active && leaving(active)) placeCursor(rootRef.current, placingCursor, (value)=>!leaving(value));
|
|
198
|
+
if (void 0 !== target) setCursorTarget(target);
|
|
199
|
+
};
|
|
200
|
+
const collapseGroup = (group)=>{
|
|
201
|
+
if (filtering) return;
|
|
202
|
+
const leaving = new Set([
|
|
203
|
+
...group.items.map((item)=>item.id),
|
|
204
|
+
openHeadingValue(group.id)
|
|
205
|
+
]);
|
|
206
|
+
changeGroup((value)=>leaving.has(value), collapsedValue(group.id));
|
|
207
|
+
setCollapsed(group.id, true);
|
|
208
|
+
};
|
|
209
|
+
const expandGroup = (group)=>{
|
|
210
|
+
if (filtering) return;
|
|
211
|
+
const standIn = collapsedValue(group.id);
|
|
212
|
+
const target = group.items.find((item)=>!item.disabled)?.id ?? openHeadingValue(group.id);
|
|
213
|
+
changeGroup((value)=>value === standIn, target);
|
|
214
|
+
setCollapsed(group.id, false);
|
|
215
|
+
};
|
|
216
|
+
const handleGroupKeys = (event)=>{
|
|
217
|
+
if ('ArrowLeft' !== event.key && 'ArrowRight' !== event.key) return;
|
|
218
|
+
if (!(event.target instanceof HTMLInputElement) || 'resource-picker-search' !== event.target.dataset.slot) return;
|
|
219
|
+
if (filtering || event.altKey || event.ctrlKey || event.metaKey || event.shiftKey) return;
|
|
220
|
+
const active = activeValue();
|
|
221
|
+
for (const group of visibleGroups){
|
|
222
|
+
const collapsed = collapsedIds.has(group.id);
|
|
223
|
+
if ('ArrowRight' === event.key && collapsed && active === collapsedValue(group.id)) {
|
|
224
|
+
event.preventDefault();
|
|
225
|
+
expandGroup(group);
|
|
226
|
+
return;
|
|
227
|
+
}
|
|
228
|
+
if ('ArrowLeft' === event.key && !collapsed && (active === openHeadingValue(group.id) || group.items.some((item)=>item.id === active))) {
|
|
229
|
+
event.preventDefault();
|
|
230
|
+
collapseGroup(group);
|
|
231
|
+
return;
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
};
|
|
235
|
+
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(external_command_cjs_namespaceObject.Command, {
|
|
236
|
+
loop: true,
|
|
237
|
+
shouldFilter: false,
|
|
238
|
+
"data-slot": "resource-picker",
|
|
239
|
+
"data-query-readonly": queryReadOnly ? '' : void 0,
|
|
240
|
+
className: (0, index_cjs_namespaceObject.cn)('flex max-h-80 min-w-0 flex-col overflow-hidden bg-popover', className),
|
|
241
|
+
label: listLabel,
|
|
242
|
+
ref: rootRef,
|
|
243
|
+
onPointerMoveCapture: ()=>{
|
|
244
|
+
if (!placingCursor.current && null !== cursorTarget) setCursorTarget(null);
|
|
245
|
+
},
|
|
246
|
+
onKeyDown: (event)=>{
|
|
247
|
+
if (null !== cursorTarget) setCursorTarget(null);
|
|
248
|
+
handleGroupKeys(event);
|
|
249
|
+
if ('Enter' === event.key && event.shiftKey && openActionsMenu()) return void event.preventDefault();
|
|
250
|
+
if ('Escape' === event.key && query && !queryReadOnly) {
|
|
251
|
+
event.preventDefault();
|
|
252
|
+
event.stopPropagation();
|
|
253
|
+
setQuery('');
|
|
254
|
+
}
|
|
255
|
+
},
|
|
256
|
+
children: [
|
|
257
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_command_cjs_namespaceObject.CommandInput, {
|
|
258
|
+
"data-slot": "resource-picker-search",
|
|
259
|
+
value: query,
|
|
260
|
+
onValueChange: setQuery,
|
|
261
|
+
readOnly: queryReadOnly,
|
|
262
|
+
placeholder: searchPlaceholder
|
|
263
|
+
}),
|
|
264
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
|
|
265
|
+
role: "status",
|
|
266
|
+
onKeyDown: (event)=>{
|
|
267
|
+
if ('Escape' !== event.key && 'Tab' !== event.key) event.stopPropagation();
|
|
268
|
+
},
|
|
269
|
+
children: 0 === visibleGroups.length && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_picker_empty_state_cjs_namespaceObject.PickerEmptyState, {
|
|
270
|
+
announce: false,
|
|
271
|
+
error: loadError,
|
|
272
|
+
loading: loading,
|
|
273
|
+
query: hasRows ? query.trim() : '',
|
|
274
|
+
emptyText: emptyText,
|
|
275
|
+
noMatchText: noMatchText,
|
|
276
|
+
loadingText: loadingText,
|
|
277
|
+
onRetry: onRetry && (()=>{
|
|
278
|
+
rootRef.current?.querySelector('input[data-slot="resource-picker-search"]')?.focus();
|
|
279
|
+
onRetry();
|
|
280
|
+
}),
|
|
281
|
+
retryLabel: retryLabel
|
|
282
|
+
})
|
|
283
|
+
}),
|
|
284
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_command_cjs_namespaceObject.CommandList, {
|
|
285
|
+
label: listLabel,
|
|
286
|
+
className: "min-h-0 flex-1",
|
|
287
|
+
children: visibleGroups.map((group, index)=>{
|
|
288
|
+
const collapsed = !filtering && collapsedIds.has(group.id);
|
|
289
|
+
const labelId = `${groupIdBase}-group-${index}`;
|
|
290
|
+
const heading = {
|
|
291
|
+
label: group.label,
|
|
292
|
+
labelId,
|
|
293
|
+
count: countFormatter(group.items.length),
|
|
294
|
+
showCount: showCounts,
|
|
295
|
+
icon: group.icon
|
|
296
|
+
};
|
|
297
|
+
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
|
|
298
|
+
role: "group",
|
|
299
|
+
"aria-labelledby": labelId,
|
|
300
|
+
children: collapsed ? /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(resource_group_header_cjs_namespaceObject.ResourceGroupHeadingOption, {
|
|
301
|
+
...heading,
|
|
302
|
+
collapsed: true,
|
|
303
|
+
value: collapsedValue(group.id),
|
|
304
|
+
ariaLabel: collapsedGroupLabel(group.label),
|
|
305
|
+
onToggle: ()=>expandGroup(group)
|
|
306
|
+
}) : /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(jsx_runtime_namespaceObject.Fragment, {
|
|
307
|
+
children: [
|
|
308
|
+
filtering || hasEnabledRow(group) ? /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(resource_group_header_cjs_namespaceObject.ResourceGroupHeader, {
|
|
309
|
+
...heading,
|
|
310
|
+
collapsed: false,
|
|
311
|
+
disabled: filtering,
|
|
312
|
+
onToggle: ()=>collapseGroup(group)
|
|
313
|
+
}) : /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(resource_group_header_cjs_namespaceObject.ResourceGroupHeadingOption, {
|
|
314
|
+
...heading,
|
|
315
|
+
collapsed: false,
|
|
316
|
+
value: openHeadingValue(group.id),
|
|
317
|
+
ariaLabel: expandedGroupLabel(group.label),
|
|
318
|
+
onToggle: ()=>collapseGroup(group)
|
|
319
|
+
}),
|
|
320
|
+
group.items.map((item)=>/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(resource_row_cjs_namespaceObject.ResourceRow, {
|
|
321
|
+
item: item,
|
|
322
|
+
chosen: item.id === value,
|
|
323
|
+
onSelect: ()=>!item.disabled && onSelect(item),
|
|
324
|
+
actions: itemActions?.(item)
|
|
325
|
+
}, item.id))
|
|
326
|
+
]
|
|
327
|
+
})
|
|
328
|
+
}, group.id);
|
|
329
|
+
})
|
|
330
|
+
}),
|
|
331
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(resource_picker_footer_cjs_namespaceObject.ResourcePickerFooter, {
|
|
332
|
+
leading: footerLeading,
|
|
333
|
+
trailing: footerTrailing
|
|
334
|
+
}),
|
|
335
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(CursorPlacer, {
|
|
336
|
+
target: cursorTarget,
|
|
337
|
+
rootRef: rootRef,
|
|
338
|
+
placing: placingCursor
|
|
339
|
+
}),
|
|
340
|
+
actionsMenu && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(resource_row_actions_menu_cjs_namespaceObject.ResourceRowActionsMenu, {
|
|
341
|
+
anchor: actionsMenu.anchor,
|
|
342
|
+
label: actionsMenuLabel(actionsMenu.item.label),
|
|
343
|
+
actions: actionsMenu.actions,
|
|
344
|
+
onClose: closeActionsMenu,
|
|
345
|
+
onTabOut: leaveActionsMenu
|
|
346
|
+
})
|
|
347
|
+
]
|
|
348
|
+
});
|
|
349
|
+
}
|
|
350
|
+
function keepResourceSearchOnEscape(event) {
|
|
351
|
+
const target = event.composedPath?.()[0] ?? event.target;
|
|
352
|
+
if (!(target instanceof Element)) return;
|
|
353
|
+
const picker = target.closest('[data-slot="resource-picker"]');
|
|
354
|
+
if (!picker || picker.hasAttribute('data-query-readonly')) return;
|
|
355
|
+
const search = picker.querySelector('input[data-slot="resource-picker-search"]');
|
|
356
|
+
if (search?.value) event.preventDefault();
|
|
357
|
+
}
|
|
358
|
+
const WARNING_FIELD_CLASS = 'border-warning future:ring-1 future:ring-warning/40';
|
|
359
|
+
function ResourcePickerField({ groups, onSelect, onClear, value = '', placeholder = 'Select...', disabled: disabledProp = false, clearable = true, clearAriaLabel = 'Clear selection', icon, children, align = 'start', open: controlledOpen, onOpenChange, trailingAdornment, error, errorId, warning = false, contentClassName, className, id, 'aria-labelledby': ariaLabelledBy, 'aria-describedby': ariaDescribedBy, 'aria-invalid': ariaInvalid, 'aria-errormessage': ariaErrorMessage, ...contentProps }, forwardedRef) {
|
|
360
|
+
const outerGroup = (0, external_input_group_context_cjs_namespaceObject.useInputGroup)();
|
|
361
|
+
const grouped = outerGroup.inGroup;
|
|
362
|
+
const disabled = disabledProp || Boolean(outerGroup.disabled);
|
|
363
|
+
const pickerGroup = (0, external_react_namespaceObject.useMemo)(()=>disabled && !outerGroup.disabled ? {
|
|
364
|
+
...outerGroup,
|
|
365
|
+
disabled
|
|
366
|
+
} : outerGroup, [
|
|
367
|
+
outerGroup,
|
|
368
|
+
disabled
|
|
369
|
+
]);
|
|
370
|
+
const [uncontrolledOpen, setUncontrolledOpen] = (0, external_react_namespaceObject.useState)(false);
|
|
371
|
+
const requestedOpen = controlledOpen ?? uncontrolledOpen;
|
|
372
|
+
const open = !disabled && requestedOpen;
|
|
373
|
+
const closedByDisable = disabled && requestedOpen;
|
|
374
|
+
(0, external_react_namespaceObject.useEffect)(()=>{
|
|
375
|
+
if (!closedByDisable) return;
|
|
376
|
+
setUncontrolledOpen(false);
|
|
377
|
+
onOpenChange?.(false);
|
|
378
|
+
}, [
|
|
379
|
+
closedByDisable
|
|
380
|
+
]);
|
|
381
|
+
const contentRef = (0, external_react_namespaceObject.useRef)(null);
|
|
382
|
+
const triggerRef = (0, external_react_namespaceObject.useRef)(null);
|
|
383
|
+
const attachTrigger = (0, external_react_namespaceObject.useMemo)(()=>(0, index_cjs_namespaceObject.composeRefs)(triggerRef, forwardedRef), [
|
|
384
|
+
forwardedRef
|
|
385
|
+
]);
|
|
386
|
+
const fieldRef = (0, external_react_namespaceObject.useRef)(null);
|
|
387
|
+
const tabbingOut = (0, external_react_namespaceObject.useRef)(false);
|
|
388
|
+
const setOpen = (nextOpen)=>{
|
|
389
|
+
if (nextOpen && disabled) return;
|
|
390
|
+
if (void 0 === controlledOpen) setUncontrolledOpen(nextOpen);
|
|
391
|
+
onOpenChange?.(nextOpen);
|
|
392
|
+
};
|
|
393
|
+
const selected = (0, external_react_namespaceObject.useMemo)(()=>{
|
|
394
|
+
if (!value) return null;
|
|
395
|
+
for (const group of groups){
|
|
396
|
+
const hit = group.items.find((item)=>item.id === value);
|
|
397
|
+
if (hit) return hit;
|
|
398
|
+
}
|
|
399
|
+
return null;
|
|
400
|
+
}, [
|
|
401
|
+
groups,
|
|
402
|
+
value
|
|
403
|
+
]);
|
|
404
|
+
const showClear = Boolean(clearable && onClear && value && !disabled && !children);
|
|
405
|
+
const showAdornment = Boolean(trailingAdornment) && !children;
|
|
406
|
+
const valueId = (0, external_react_namespaceObject.useId)();
|
|
407
|
+
const generatedErrorId = (0, external_react_namespaceObject.useId)();
|
|
408
|
+
const validationId = errorId ?? `resource-picker-${generatedErrorId.replace(/:/g, '')}-error`;
|
|
409
|
+
const externallyLabelled = Boolean(id || ariaLabelledBy);
|
|
410
|
+
const unmatchedValueHidden = Boolean(value) && !selected && placeholder !== value;
|
|
411
|
+
const describeValue = Boolean(value) && (externallyLabelled || unmatchedValueHidden);
|
|
412
|
+
const describedBy = [
|
|
413
|
+
ariaDescribedBy,
|
|
414
|
+
describeValue ? valueId : void 0
|
|
415
|
+
].filter(Boolean).join(' ') || void 0;
|
|
416
|
+
const fieldElement = ()=>fieldRef.current ?? triggerRef.current?.closest('[data-slot="input-group"]') ?? triggerRef.current;
|
|
417
|
+
const blockDisabledTrigger = disabled && void 0 !== children;
|
|
418
|
+
const triggerOwn = children?.props ?? {};
|
|
419
|
+
const customTriggerAria = void 0 !== children ? {
|
|
420
|
+
...(0, external_input_group_context_cjs_namespaceObject.controlValidation)(external_input_group_context_cjs_namespaceObject.NO_GROUP, {
|
|
421
|
+
error,
|
|
422
|
+
errorId: validationId,
|
|
423
|
+
'aria-invalid': ariaInvalid ?? triggerOwn['aria-invalid'],
|
|
424
|
+
'aria-describedby': [
|
|
425
|
+
triggerOwn['aria-describedby'],
|
|
426
|
+
ariaDescribedBy
|
|
427
|
+
].filter(Boolean).join(' ') || void 0,
|
|
428
|
+
'aria-errormessage': ariaErrorMessage ?? triggerOwn['aria-errormessage']
|
|
429
|
+
}),
|
|
430
|
+
'aria-disabled': disabled ? true : triggerOwn['aria-disabled']
|
|
431
|
+
} : void 0;
|
|
432
|
+
const popover = /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(external_popover_cjs_namespaceObject.Popover, {
|
|
433
|
+
open: open,
|
|
434
|
+
onOpenChange: setOpen,
|
|
435
|
+
children: [
|
|
436
|
+
void 0 !== children ? /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_popover_cjs_namespaceObject.PopoverTrigger, {
|
|
437
|
+
ref: forwardedRef,
|
|
438
|
+
asChild: true,
|
|
439
|
+
disabled: disabled,
|
|
440
|
+
children: children && customTriggerAria ? /*#__PURE__*/ (0, external_react_namespaceObject.cloneElement)(children, customTriggerAria) : children
|
|
441
|
+
}) : /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(jsx_runtime_namespaceObject.Fragment, {
|
|
442
|
+
children: [
|
|
443
|
+
icon && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_input_group_cjs_namespaceObject.InputGroupAddon, {
|
|
444
|
+
align: "inline-start",
|
|
445
|
+
children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("span", {
|
|
446
|
+
"aria-hidden": true,
|
|
447
|
+
className: "grid size-4 shrink-0 place-items-center text-foreground-muted",
|
|
448
|
+
children: icon
|
|
449
|
+
})
|
|
450
|
+
}),
|
|
451
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(resource_picker_ResourcePickerTrigger, {
|
|
452
|
+
ref: attachTrigger,
|
|
453
|
+
id: id,
|
|
454
|
+
open: open,
|
|
455
|
+
disabled: disabled,
|
|
456
|
+
label: selected ? selected.fieldLabel ?? selected.label : void 0,
|
|
457
|
+
labelId: valueId,
|
|
458
|
+
placeholder: placeholder,
|
|
459
|
+
className: grouped ? className : void 0,
|
|
460
|
+
error: error,
|
|
461
|
+
errorId: validationId,
|
|
462
|
+
"aria-labelledby": ariaLabelledBy,
|
|
463
|
+
"aria-describedby": describedBy,
|
|
464
|
+
"aria-invalid": ariaInvalid,
|
|
465
|
+
"aria-errormessage": ariaErrorMessage
|
|
466
|
+
}),
|
|
467
|
+
!selected && value && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("span", {
|
|
468
|
+
id: valueId,
|
|
469
|
+
hidden: true,
|
|
470
|
+
children: value
|
|
471
|
+
}),
|
|
472
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(external_input_group_cjs_namespaceObject.InputGroupAddon, {
|
|
473
|
+
align: "inline-end",
|
|
474
|
+
children: [
|
|
475
|
+
showClear && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_input_group_cjs_namespaceObject.InputGroupButton, {
|
|
476
|
+
size: "3xs",
|
|
477
|
+
"aria-label": clearAriaLabel,
|
|
478
|
+
className: (0, index_cjs_namespaceObject.cn)(field_addon_button_cjs_namespaceObject.FIELD_ADDON_BUTTON_CLASS, 'opacity-0 transition-opacity focus-visible:opacity-100 group-hover/input-group:opacity-100 group-has-[[data-slot=input-group-control]:focus-visible]/input-group:opacity-100'),
|
|
479
|
+
onClick: ()=>{
|
|
480
|
+
onClear?.();
|
|
481
|
+
triggerRef.current?.focus();
|
|
482
|
+
},
|
|
483
|
+
children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_lucide_react_namespaceObject.X, {})
|
|
484
|
+
}),
|
|
485
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("span", {
|
|
486
|
+
"aria-hidden": true,
|
|
487
|
+
"data-slot": "resource-picker-caret",
|
|
488
|
+
className: "grid size-4 shrink-0 cursor-pointer place-items-center text-muted-foreground",
|
|
489
|
+
onClick: ()=>setOpen(!open),
|
|
490
|
+
children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_lucide_react_namespaceObject.ChevronDown, {
|
|
491
|
+
className: "size-4"
|
|
492
|
+
})
|
|
493
|
+
}),
|
|
494
|
+
showAdornment && trailingAdornment
|
|
495
|
+
]
|
|
496
|
+
})
|
|
497
|
+
]
|
|
498
|
+
}),
|
|
499
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_popover_cjs_namespaceObject.PopoverContent, {
|
|
500
|
+
align: align,
|
|
501
|
+
sideOffset: 4,
|
|
502
|
+
className: (0, index_cjs_namespaceObject.cn)('w-(--radix-popover-trigger-width) min-w-72 overflow-hidden p-0', contentClassName),
|
|
503
|
+
ref: contentRef,
|
|
504
|
+
"aria-label": contentProps.listLabel ?? 'Resources',
|
|
505
|
+
onEscapeKeyDown: keepResourceSearchOnEscape,
|
|
506
|
+
onInteractOutside: (event)=>{
|
|
507
|
+
const target = event.detail.originalEvent.composedPath()[0] ?? event.target;
|
|
508
|
+
if (target instanceof Element && target.closest('[data-slot="resource-picker-caret"]')) event.preventDefault();
|
|
509
|
+
},
|
|
510
|
+
onOpenAutoFocus: (event)=>{
|
|
511
|
+
event.preventDefault();
|
|
512
|
+
contentRef.current?.querySelector('input')?.focus();
|
|
513
|
+
},
|
|
514
|
+
onCloseAutoFocus: (event)=>{
|
|
515
|
+
if (!tabbingOut.current) return;
|
|
516
|
+
tabbingOut.current = false;
|
|
517
|
+
event.preventDefault();
|
|
518
|
+
const field = fieldElement();
|
|
519
|
+
if (field) (0, external_focus_cjs_namespaceObject.focusBeside)(field, false);
|
|
520
|
+
},
|
|
521
|
+
children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(ResourcePickerContent, {
|
|
522
|
+
...contentProps,
|
|
523
|
+
itemActions: open ? contentProps.itemActions : void 0,
|
|
524
|
+
onRetry: open ? contentProps.onRetry : void 0,
|
|
525
|
+
onTabOut: ()=>{
|
|
526
|
+
tabbingOut.current = true;
|
|
527
|
+
setOpen(false);
|
|
528
|
+
},
|
|
529
|
+
groups: groups,
|
|
530
|
+
value: value,
|
|
531
|
+
onSelect: (item)=>{
|
|
532
|
+
if (!open) return;
|
|
533
|
+
onSelect(item);
|
|
534
|
+
setOpen(false);
|
|
535
|
+
}
|
|
536
|
+
})
|
|
537
|
+
})
|
|
538
|
+
]
|
|
539
|
+
});
|
|
540
|
+
if (void 0 !== children) return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
|
|
541
|
+
ref: fieldRef,
|
|
542
|
+
className: (0, index_cjs_namespaceObject.cn)('min-w-0', className),
|
|
543
|
+
onClickCapture: blockDisabledTrigger ? (event)=>{
|
|
544
|
+
event.preventDefault();
|
|
545
|
+
event.stopPropagation();
|
|
546
|
+
} : void 0,
|
|
547
|
+
children: [
|
|
548
|
+
popover,
|
|
549
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_form_field_cjs_namespaceObject.FormFieldError, {
|
|
550
|
+
id: validationId,
|
|
551
|
+
children: error
|
|
552
|
+
})
|
|
553
|
+
]
|
|
554
|
+
});
|
|
555
|
+
if (grouped) return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_input_group_context_cjs_namespaceObject.InputGroupContext.Provider, {
|
|
556
|
+
value: pickerGroup,
|
|
557
|
+
children: popover
|
|
558
|
+
});
|
|
559
|
+
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_input_group_cjs_namespaceObject.InputGroup, {
|
|
560
|
+
ref: fieldRef,
|
|
561
|
+
errorId: validationId,
|
|
562
|
+
disabled: disabled,
|
|
563
|
+
className: (0, index_cjs_namespaceObject.cn)('min-w-0', warning && !error && true !== ariaInvalid && 'true' !== ariaInvalid && WARNING_FIELD_CLASS, className),
|
|
564
|
+
children: popover
|
|
565
|
+
});
|
|
566
|
+
}
|
|
567
|
+
const ResourcePicker = /*#__PURE__*/ (0, external_react_namespaceObject.forwardRef)(ResourcePickerField);
|
|
568
|
+
ResourcePicker.displayName = 'ResourcePicker';
|
|
569
|
+
const resource_picker_ResourcePickerTrigger = /*#__PURE__*/ (0, external_react_namespaceObject.forwardRef)(function({ id, open, disabled, label, labelId, placeholder, className, error, errorId, 'aria-labelledby': ariaLabelledBy, 'aria-describedby': ariaDescribedBy, 'aria-invalid': ariaInvalid, 'aria-errormessage': ariaErrorMessage }, ref) {
|
|
570
|
+
const group = (0, external_input_group_context_cjs_namespaceObject.useInputGroup)();
|
|
571
|
+
const validation = (0, external_input_group_context_cjs_namespaceObject.useControlValidation)(group, {
|
|
572
|
+
error,
|
|
573
|
+
errorId,
|
|
574
|
+
'aria-invalid': ariaInvalid,
|
|
575
|
+
'aria-describedby': ariaDescribedBy,
|
|
576
|
+
'aria-errormessage': ariaErrorMessage
|
|
577
|
+
});
|
|
578
|
+
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_input_group_cjs_namespaceObject.InputGroupPopoverTrigger, {
|
|
579
|
+
ref: ref,
|
|
580
|
+
id: id,
|
|
581
|
+
disabled: disabled,
|
|
582
|
+
"aria-haspopup": "dialog",
|
|
583
|
+
"aria-expanded": open,
|
|
584
|
+
"aria-labelledby": ariaLabelledBy,
|
|
585
|
+
...validation.aria,
|
|
586
|
+
placeholder: placeholder,
|
|
587
|
+
caret: false,
|
|
588
|
+
className: className,
|
|
589
|
+
children: void 0 !== label && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("span", {
|
|
590
|
+
id: labelId,
|
|
591
|
+
className: "min-w-0 flex-1 truncate",
|
|
592
|
+
children: label
|
|
593
|
+
})
|
|
594
|
+
});
|
|
595
|
+
});
|
|
596
|
+
exports.ResourcePicker = __webpack_exports__.ResourcePicker;
|
|
597
|
+
exports.ResourcePickerContent = __webpack_exports__.ResourcePickerContent;
|
|
598
|
+
exports.keepResourceSearchOnEscape = __webpack_exports__.keepResourceSearchOnEscape;
|
|
599
|
+
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
600
|
+
"ResourcePicker",
|
|
601
|
+
"ResourcePickerContent",
|
|
602
|
+
"keepResourceSearchOnEscape"
|
|
603
|
+
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
604
|
+
Object.defineProperty(exports, '__esModule', {
|
|
605
|
+
value: true
|
|
606
|
+
});
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import type { ResourcePickerContentProps, ResourcePickerProps } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* Search and grouped rows for embedding in a consumer-owned popover or sheet.
|
|
4
|
+
*
|
|
5
|
+
* Rows commit on click. One resource is one decision, so a confirm step would
|
|
6
|
+
* only add a second click to a choice that is already unambiguous.
|
|
7
|
+
*/
|
|
8
|
+
export declare function ResourcePickerContent({ groups, onSelect, value, searchPlaceholder, initialSearch, query: controlledQuery, onQueryChange, emptyText, loading, loadingText, loadError, onRetry, retryLabel, noMatchText, collapsedGroupLabel, expandedGroupLabel, listLabel, showCounts, locale, formatCount, itemActions, actionsMenuLabel, onTabOut, footerLeading, footerTrailing, className, }: ResourcePickerContentProps): import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
/**
|
|
10
|
+
* Holds a Radix surface open while the picker's search has text, so Escape
|
|
11
|
+
* clears the search instead of dismissing, wherever focus is in the picker.
|
|
12
|
+
* Radix hears Escape on the document in the capture phase, before the
|
|
13
|
+
* picker's own handler, so the picker cannot stop the dismissal itself. It
|
|
14
|
+
* clears the search as the key reaches it. Escape from outside a picker is
|
|
15
|
+
* left alone, and so is a picker whose controlled query has no
|
|
16
|
+
* `onQueryChange`, since its search could never be cleared.
|
|
17
|
+
*
|
|
18
|
+
* Inside an open shadow root, as under `PortalContainerProvider`, the
|
|
19
|
+
* document sees the event retargeted to the shadow host, so the element the
|
|
20
|
+
* key was pressed in is read from the event's composed path instead.
|
|
21
|
+
*
|
|
22
|
+
* `ResourcePicker` applies it to its popover. Pass it as `onEscapeKeyDown` to a
|
|
23
|
+
* Dialog, Sheet or Popover that hosts `ResourcePickerContent`.
|
|
24
|
+
*/
|
|
25
|
+
export declare function keepResourceSearchOnEscape(event: {
|
|
26
|
+
target: EventTarget | null;
|
|
27
|
+
composedPath?(): EventTarget[];
|
|
28
|
+
preventDefault(): void;
|
|
29
|
+
}): void;
|
|
30
|
+
/**
|
|
31
|
+
* Field-and-popover picker over grouped resources.
|
|
32
|
+
*
|
|
33
|
+
* The field is an InputGroup, as every Apollo picker field is: the trigger is
|
|
34
|
+
* the group's control, the resource icon is a leading addon, and the clear
|
|
35
|
+
* control and `trailingAdornment` are a trailing addon. Placed inside a
|
|
36
|
+
* consumer's own InputGroup, the picker becomes that group's control instead,
|
|
37
|
+
* and the group draws the box and the validation message.
|
|
38
|
+
*/
|
|
39
|
+
export declare const ResourcePicker: import("react").ForwardRefExoticComponent<ResourcePickerProps & import("react").RefAttributes<HTMLButtonElement>>;
|
|
40
|
+
export type { ResourceGroup, ResourceItem, ResourceItemAction, ResourcePickerContentProps, ResourcePickerProps, } from './types';
|