@uipath/apollo-wind 2.87.0 → 2.88.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (56) hide show
  1. package/dist/components/ui/connection-picker/components/connection-actions-menu.cjs +129 -0
  2. package/dist/components/ui/connection-picker/components/connection-actions-menu.d.ts +21 -0
  3. package/dist/components/ui/connection-picker/components/connection-actions-menu.js +95 -0
  4. package/dist/components/ui/connection-picker/components/connection-status.cjs +81 -0
  5. package/dist/components/ui/connection-picker/components/connection-status.d.ts +22 -0
  6. package/dist/components/ui/connection-picker/components/connection-status.js +41 -0
  7. package/dist/components/ui/connection-picker/connection-picker.cjs +411 -0
  8. package/dist/components/ui/connection-picker/connection-picker.d.ts +12 -0
  9. package/dist/components/ui/connection-picker/connection-picker.js +374 -0
  10. package/dist/components/ui/connection-picker/index.cjs +39 -0
  11. package/dist/components/ui/connection-picker/index.d.ts +2 -0
  12. package/dist/components/ui/connection-picker/index.js +2 -0
  13. package/dist/components/ui/connection-picker/types.cjs +18 -0
  14. package/dist/components/ui/connection-picker/types.d.ts +124 -0
  15. package/dist/components/ui/connection-picker/types.js +0 -0
  16. package/dist/components/ui/folder-picker/folder-picker.cjs +4 -3
  17. package/dist/components/ui/folder-picker/folder-picker.js +4 -3
  18. package/dist/components/ui/index.cjs +270 -244
  19. package/dist/components/ui/index.d.ts +2 -0
  20. package/dist/components/ui/index.js +2 -0
  21. package/dist/components/ui/{folder-picker/components/folder-picker-empty-state.cjs → picker-empty-state.cjs} +11 -11
  22. package/dist/components/ui/picker-empty-state.d.ts +33 -0
  23. package/dist/components/ui/{folder-picker/components/folder-picker-empty-state.js → picker-empty-state.js} +9 -9
  24. package/dist/components/ui/resource-picker/command-value.cjs +48 -0
  25. package/dist/components/ui/resource-picker/command-value.d.ts +11 -0
  26. package/dist/components/ui/resource-picker/command-value.js +11 -0
  27. package/dist/components/ui/resource-picker/components/resource-group-header.cjs +102 -0
  28. package/dist/components/ui/resource-picker/components/resource-group-header.d.ts +44 -0
  29. package/dist/components/ui/resource-picker/components/resource-group-header.js +65 -0
  30. package/dist/components/ui/resource-picker/components/resource-picker-footer.cjs +55 -0
  31. package/dist/components/ui/resource-picker/components/resource-picker-footer.d.ts +14 -0
  32. package/dist/components/ui/resource-picker/components/resource-picker-footer.js +21 -0
  33. package/dist/components/ui/resource-picker/components/resource-row-actions-menu.cjs +136 -0
  34. package/dist/components/ui/resource-picker/components/resource-row-actions-menu.d.ts +30 -0
  35. package/dist/components/ui/resource-picker/components/resource-row-actions-menu.js +102 -0
  36. package/dist/components/ui/resource-picker/components/resource-row.cjs +115 -0
  37. package/dist/components/ui/resource-picker/components/resource-row.d.ts +16 -0
  38. package/dist/components/ui/resource-picker/components/resource-row.js +81 -0
  39. package/dist/components/ui/resource-picker/focus.cjs +66 -0
  40. package/dist/components/ui/resource-picker/focus.d.ts +1 -0
  41. package/dist/components/ui/resource-picker/focus.js +32 -0
  42. package/dist/components/ui/resource-picker/index.cjs +42 -0
  43. package/dist/components/ui/resource-picker/index.d.ts +2 -0
  44. package/dist/components/ui/resource-picker/index.js +2 -0
  45. package/dist/components/ui/resource-picker/resource-picker.cjs +606 -0
  46. package/dist/components/ui/resource-picker/resource-picker.d.ts +40 -0
  47. package/dist/components/ui/resource-picker/resource-picker.js +566 -0
  48. package/dist/components/ui/resource-picker/types.cjs +50 -0
  49. package/dist/components/ui/resource-picker/types.d.ts +209 -0
  50. package/dist/components/ui/resource-picker/types.js +16 -0
  51. package/dist/index.cjs +24 -7
  52. package/dist/index.d.ts +4 -0
  53. package/dist/index.js +3 -1
  54. package/dist/styles.css +75 -29
  55. package/package.json +1 -1
  56. package/dist/components/ui/folder-picker/components/folder-picker-empty-state.d.ts +0 -26
@@ -0,0 +1,374 @@
1
+ "use client";
2
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
3
+ import { Pencil, Plus } from "lucide-react";
4
+ import { forwardRef, useCallback, useEffect, useId, useLayoutEffect, useMemo, useRef, useState } from "react";
5
+ import { Button } from "../button.js";
6
+ import { FormFieldError } from "../form-field.js";
7
+ import { InputGroup, InputGroupAddon, InputGroupTrigger } from "../input-group.js";
8
+ import { InputGroupContext, NO_GROUP, NO_GROUP_DISABLED, useInputGroup } from "../input-group-context.js";
9
+ import { cn } from "../../../lib/index.js";
10
+ import { ResourcePicker } from "../resource-picker/resource-picker.js";
11
+ import { ConnectionActionsMenu } from "./components/connection-actions-menu.js";
12
+ import { ConnectionStatusDot, ConnectionStatusLine, STATUS_LABELS } from "./components/connection-status.js";
13
+ const DEFAULT_CONNECTION_PICKER_STRINGS = {
14
+ statusLabels: STATUS_LABELS,
15
+ defaultReasons: {
16
+ broken: 'Connection broken. Reconnect to restore access.',
17
+ warning: 'Connection needs attention.'
18
+ },
19
+ fix: 'Fix',
20
+ fixLabel: (name)=>`Fix ${name}`,
21
+ edit: 'Edit',
22
+ editLabel: (name)=>`Edit ${name}`,
23
+ addNewConnection: 'Add new connection',
24
+ listLabel: 'Connections',
25
+ optionsLabel: 'Connection options',
26
+ editConnection: 'Edit connection',
27
+ refreshSchema: 'Refresh schema',
28
+ refreshingSchema: 'Refreshing schema...',
29
+ schemaRefreshed: 'Schema refreshed',
30
+ noMatchText: (query)=>`No results match “${query}”.`,
31
+ collapsedGroupLabel: (label)=>`${label}, collapsed`,
32
+ expandedGroupLabel: (label)=>`${label}, expanded`,
33
+ actionsMenuLabel: (label)=>`Actions for ${label}`
34
+ };
35
+ const statusOf = (connection)=>connection.status ?? 'connected';
36
+ const headlineOf = (reason)=>reason.split(/(?<=\.)\s+/)[0]?.replace(/\.$/, '') ?? '';
37
+ const statusLabelOf = (connection, labels)=>{
38
+ const status = statusOf(connection);
39
+ return 'warning' === status && connection.statusReason ? headlineOf(connection.statusReason) : labels[status];
40
+ };
41
+ const displayName = (connection)=>connection.account || connection.name;
42
+ const distinguishingName = (connection, collisions)=>connection.account && connection.account !== connection.name && collisions.has(displayName(connection)) ? connection.name : void 0;
43
+ const byHealth = (a, b)=>('broken' === statusOf(a) ? 1 : 0) - ('broken' === statusOf(b) ? 1 : 0);
44
+ function ConnectionPickerField({ connections, value = '', onSelect, onClear, onFix, onEdit, onAddConnection, onRefreshSchema, error, errorId, defaultFolder = 'My Workspace', addConnectionLabel = 'Add connection', placeholder = 'Select connection...', searchPlaceholder = 'Search connections...', emptyText = 'No connections yet.', strings, disabled: disabledProp = false, open: controlledOpen, onOpenChange, className, id, 'aria-labelledby': ariaLabelledBy, 'aria-describedby': ariaDescribedBy, 'aria-invalid': ariaInvalid, 'aria-errormessage': ariaErrorMessage, ...pickerProps }, forwardedRef) {
45
+ const enclosing = useInputGroup();
46
+ const disabled = disabledProp || Boolean(enclosing.disabled);
47
+ const groupContext = disabled ? NO_GROUP_DISABLED : NO_GROUP;
48
+ const messageId = useId();
49
+ const healthId = useId();
50
+ const addTextId = useId();
51
+ const loadErrorId = useId();
52
+ const text = useMemo(()=>({
53
+ ...DEFAULT_CONNECTION_PICKER_STRINGS,
54
+ ...strings
55
+ }), [
56
+ strings
57
+ ]);
58
+ const [uncontrolledOpen, setUncontrolledOpen] = useState(false);
59
+ const open = controlledOpen ?? uncontrolledOpen;
60
+ const setOpen = (nextOpen)=>{
61
+ if (void 0 === controlledOpen) setUncontrolledOpen(nextOpen);
62
+ onOpenChange?.(nextOpen);
63
+ };
64
+ const addOnly = 0 === connections.length && Boolean(onAddConnection) && !value && !pickerProps.loading && !pickerProps.loadError;
65
+ const closedByAddOnly = addOnly && open;
66
+ useEffect(()=>{
67
+ if (closedByAddOnly) setOpen(false);
68
+ }, [
69
+ closedByAddOnly
70
+ ]);
71
+ const focusWithin = useRef(false);
72
+ const trackFocus = {
73
+ onFocus: ()=>{
74
+ focusWithin.current = true;
75
+ },
76
+ onBlur: ()=>{
77
+ focusWithin.current = false;
78
+ }
79
+ };
80
+ const fieldRef = useRef(null);
81
+ const fieldControl = ()=>fieldRef.current?.querySelector('[data-slot="input-group-control"]');
82
+ useLayoutEffect(()=>{
83
+ if (!focusWithin.current) return;
84
+ const focusControl = ()=>{
85
+ const control = fieldControl();
86
+ if (!control) return;
87
+ const active = control.getRootNode().activeElement;
88
+ if (!active || active === control.ownerDocument.body) control.focus();
89
+ };
90
+ focusControl();
91
+ const settle = window.setTimeout(focusControl, 0);
92
+ return ()=>window.clearTimeout(settle);
93
+ }, [
94
+ addOnly
95
+ ]);
96
+ const byId = useMemo(()=>new Map(connections.map((connection)=>[
97
+ connection.id,
98
+ connection
99
+ ])), [
100
+ connections
101
+ ]);
102
+ const collisions = useMemo(()=>{
103
+ const seen = new Set();
104
+ const shared = new Set();
105
+ for (const connection of connections){
106
+ const name = displayName(connection);
107
+ if (seen.has(name)) shared.add(name);
108
+ else seen.add(name);
109
+ }
110
+ return shared;
111
+ }, [
112
+ connections
113
+ ]);
114
+ const fullName = useCallback((connection)=>{
115
+ const secondary = distinguishingName(connection, collisions);
116
+ return secondary ? `${displayName(connection)} (${secondary})` : displayName(connection);
117
+ }, [
118
+ collisions
119
+ ]);
120
+ const groups = useMemo(()=>{
121
+ const folders = new Map();
122
+ for (const connection of connections){
123
+ const folder = connection.folder || defaultFolder;
124
+ const members = folders.get(folder);
125
+ if (members) members.push(connection);
126
+ else folders.set(folder, [
127
+ connection
128
+ ]);
129
+ }
130
+ return [
131
+ ...folders
132
+ ].map(([folder, members])=>({
133
+ id: folder,
134
+ label: folder,
135
+ items: [
136
+ ...members
137
+ ].sort(byHealth).map((connection)=>({
138
+ id: connection.id,
139
+ label: displayName(connection),
140
+ description: distinguishingName(connection, collisions),
141
+ fieldLabel: fullName(connection),
142
+ icon: connection.logo ? /*#__PURE__*/ jsx("img", {
143
+ src: connection.logo,
144
+ alt: "",
145
+ className: "size-4 object-contain"
146
+ }) : connection.icon,
147
+ subtitle: /*#__PURE__*/ jsx(ConnectionStatusLine, {
148
+ status: statusOf(connection),
149
+ label: statusLabelOf(connection, text.statusLabels)
150
+ }),
151
+ subtitleText: statusLabelOf(connection, text.statusLabels),
152
+ keywords: [
153
+ connection.name,
154
+ ...connection.keywords ?? []
155
+ ],
156
+ disabled: connection.disabled
157
+ }))
158
+ }));
159
+ }, [
160
+ connections,
161
+ defaultFolder,
162
+ text.statusLabels,
163
+ collisions,
164
+ fullName
165
+ ]);
166
+ const selected = value ? byId.get(value) : void 0;
167
+ const selectedStatus = selected ? statusOf(selected) : void 0;
168
+ const unhealthy = 'broken' === selectedStatus || 'warning' === selectedStatus;
169
+ const handOff = (action, connection)=>{
170
+ setOpen(false);
171
+ action(connection);
172
+ };
173
+ const itemActions = onFix || onEdit ? (item)=>{
174
+ const connection = byId.get(item.id);
175
+ if (!connection) return [];
176
+ const name = fullName(connection);
177
+ const actions = [];
178
+ if (onFix && 'broken' === statusOf(connection)) actions.push({
179
+ id: 'fix',
180
+ label: text.fixLabel(name),
181
+ text: text.fix,
182
+ tone: 'danger',
183
+ onSelect: ()=>handOff(onFix, connection)
184
+ });
185
+ if (onEdit) actions.push({
186
+ id: 'edit',
187
+ label: text.editLabel(name),
188
+ text: text.edit,
189
+ icon: /*#__PURE__*/ jsx(Pencil, {
190
+ className: "size-3.5"
191
+ }),
192
+ onSelect: ()=>handOff(onEdit, connection)
193
+ });
194
+ return actions;
195
+ } : void 0;
196
+ const reason = selected && unhealthy ? selected.statusReason || text.defaultReasons[selectedStatus] : '';
197
+ const summary = headlineOf(reason);
198
+ const { loadError, onRetry, retryLabel = 'Retry' } = pickerProps;
199
+ const showLoadError = !error && Boolean(loadError);
200
+ const showHealth = !error && !showLoadError && Boolean(summary);
201
+ const broken = 'broken' === selectedStatus;
202
+ const describedBy = [
203
+ ariaDescribedBy,
204
+ selectedStatus ? healthId : void 0,
205
+ showHealth ? messageId : void 0,
206
+ showLoadError ? loadErrorId : void 0
207
+ ].filter(Boolean).join(' ') || void 0;
208
+ const fieldProps = {
209
+ id,
210
+ 'aria-labelledby': ariaLabelledBy,
211
+ 'aria-describedby': describedBy
212
+ };
213
+ if (addOnly) return /*#__PURE__*/ jsx(InputGroupContext.Provider, {
214
+ value: groupContext,
215
+ children: /*#__PURE__*/ jsx("div", {
216
+ ref: fieldRef,
217
+ className: cn('min-w-0', className),
218
+ ...trackFocus,
219
+ children: /*#__PURE__*/ jsxs(InputGroup, {
220
+ error: error,
221
+ errorId: errorId ?? messageId,
222
+ children: [
223
+ /*#__PURE__*/ jsx(InputGroupAddon, {
224
+ align: "inline-start",
225
+ children: /*#__PURE__*/ jsx(Plus, {
226
+ "aria-hidden": true,
227
+ className: "text-foreground-muted"
228
+ })
229
+ }),
230
+ /*#__PURE__*/ jsx(InputGroupTrigger, {
231
+ ref: forwardedRef,
232
+ ...fieldProps,
233
+ "aria-labelledby": ariaLabelledBy ? `${ariaLabelledBy} ${addTextId}` : id ? `${id} ${addTextId}` : void 0,
234
+ "aria-invalid": ariaInvalid,
235
+ "aria-errormessage": ariaErrorMessage,
236
+ disabled: disabled,
237
+ onClick: onAddConnection,
238
+ children: /*#__PURE__*/ jsx("span", {
239
+ id: addTextId,
240
+ className: "min-w-0 flex-1 truncate text-foreground-subtle",
241
+ children: addConnectionLabel
242
+ })
243
+ })
244
+ ]
245
+ })
246
+ })
247
+ });
248
+ return /*#__PURE__*/ jsx(InputGroupContext.Provider, {
249
+ value: groupContext,
250
+ children: /*#__PURE__*/ jsxs("div", {
251
+ ref: fieldRef,
252
+ className: cn('min-w-0', className),
253
+ ...trackFocus,
254
+ children: [
255
+ /*#__PURE__*/ jsx(ResourcePicker, {
256
+ ref: forwardedRef,
257
+ ...pickerProps,
258
+ ...fieldProps,
259
+ "aria-invalid": broken && !error ? true : ariaInvalid,
260
+ "aria-errormessage": broken && showHealth ? messageId : ariaErrorMessage,
261
+ error: error,
262
+ errorId: errorId,
263
+ warning: 'warning' === selectedStatus,
264
+ groups: groups,
265
+ value: value,
266
+ onSelect: (item)=>{
267
+ const connection = byId.get(item.id);
268
+ if (connection) onSelect(connection);
269
+ },
270
+ onClear: onClear,
271
+ placeholder: value && !selected ? value : placeholder,
272
+ searchPlaceholder: searchPlaceholder,
273
+ emptyText: emptyText,
274
+ listLabel: text.listLabel,
275
+ noMatchText: text.noMatchText,
276
+ collapsedGroupLabel: text.collapsedGroupLabel,
277
+ expandedGroupLabel: text.expandedGroupLabel,
278
+ actionsMenuLabel: text.actionsMenuLabel,
279
+ disabled: disabled,
280
+ open: open,
281
+ onOpenChange: setOpen,
282
+ icon: selectedStatus ? /*#__PURE__*/ jsx(ConnectionStatusDot, {
283
+ status: selectedStatus,
284
+ label: text.statusLabels[selectedStatus]
285
+ }) : void 0,
286
+ itemActions: itemActions,
287
+ trailingAdornment: selected && (onRefreshSchema || onEdit) && !disabled ? /*#__PURE__*/ jsx(ConnectionActionsMenu, {
288
+ onRefreshSchema: onRefreshSchema ? ()=>onRefreshSchema(selected) : void 0,
289
+ onEdit: onEdit ? ()=>onEdit(selected) : void 0,
290
+ strings: text
291
+ }, selected.id) : void 0,
292
+ footerLeading: onAddConnection ? /*#__PURE__*/ jsxs(Button, {
293
+ variant: "ghost",
294
+ size: "2xs",
295
+ className: "-ml-2 gap-1 font-semibold text-brand hover:text-brand future:text-brand future:hover:text-brand",
296
+ onClick: ()=>{
297
+ if (disabled || !open) return;
298
+ setOpen(false);
299
+ onAddConnection();
300
+ },
301
+ children: [
302
+ /*#__PURE__*/ jsx(Plus, {
303
+ className: "size-3.5"
304
+ }),
305
+ text.addNewConnection
306
+ ]
307
+ }) : void 0
308
+ }),
309
+ selectedStatus && /*#__PURE__*/ jsx("span", {
310
+ id: healthId,
311
+ hidden: true,
312
+ children: text.statusLabels[selectedStatus]
313
+ }),
314
+ showLoadError && /*#__PURE__*/ jsxs("div", {
315
+ className: "mt-1.5 flex min-w-0 items-baseline gap-1.5",
316
+ children: [
317
+ /*#__PURE__*/ jsx(FormFieldError, {
318
+ id: loadErrorId,
319
+ title: loadError ?? void 0,
320
+ className: "mt-0 min-w-0 truncate",
321
+ children: loadError
322
+ }),
323
+ !disabled && onRetry && /*#__PURE__*/ jsx(Button, {
324
+ variant: "text",
325
+ size: "4xs",
326
+ className: "shrink-0 px-0 text-xs",
327
+ onClick: ()=>{
328
+ fieldControl()?.focus();
329
+ onRetry();
330
+ },
331
+ children: retryLabel
332
+ })
333
+ ]
334
+ }),
335
+ showHealth && selectedStatus && /*#__PURE__*/ jsxs("div", {
336
+ className: "mt-1.5 flex min-w-0 items-baseline gap-1.5",
337
+ children: [
338
+ /*#__PURE__*/ jsx(FormFieldError, {
339
+ id: messageId,
340
+ severity: broken ? 'error' : 'warning',
341
+ title: reason,
342
+ className: "mt-0 min-w-0 truncate",
343
+ children: summary === reason ? summary : /*#__PURE__*/ jsxs(Fragment, {
344
+ children: [
345
+ /*#__PURE__*/ jsx("span", {
346
+ "aria-hidden": true,
347
+ children: summary
348
+ }),
349
+ /*#__PURE__*/ jsx("span", {
350
+ className: "sr-only",
351
+ children: reason
352
+ })
353
+ ]
354
+ })
355
+ }),
356
+ !disabled && selected && onFix && /*#__PURE__*/ jsx(Button, {
357
+ variant: "text",
358
+ size: "4xs",
359
+ className: "shrink-0 px-0 text-xs",
360
+ onClick: ()=>{
361
+ fieldControl()?.focus();
362
+ onFix(selected);
363
+ },
364
+ children: text.fix
365
+ })
366
+ ]
367
+ })
368
+ ]
369
+ })
370
+ });
371
+ }
372
+ const ConnectionPicker = /*#__PURE__*/ forwardRef(ConnectionPickerField);
373
+ ConnectionPicker.displayName = 'ConnectionPicker';
374
+ export { ConnectionPicker, DEFAULT_CONNECTION_PICKER_STRINGS };
@@ -0,0 +1,39 @@
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
+ DEFAULT_CONNECTION_PICKER_STRINGS: ()=>external_connection_picker_cjs_namespaceObject.DEFAULT_CONNECTION_PICKER_STRINGS,
28
+ ConnectionPicker: ()=>external_connection_picker_cjs_namespaceObject.ConnectionPicker
29
+ });
30
+ const external_connection_picker_cjs_namespaceObject = require("./connection-picker.cjs");
31
+ exports.ConnectionPicker = __webpack_exports__.ConnectionPicker;
32
+ exports.DEFAULT_CONNECTION_PICKER_STRINGS = __webpack_exports__.DEFAULT_CONNECTION_PICKER_STRINGS;
33
+ for(var __rspack_i in __webpack_exports__)if (-1 === [
34
+ "ConnectionPicker",
35
+ "DEFAULT_CONNECTION_PICKER_STRINGS"
36
+ ].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
37
+ Object.defineProperty(exports, '__esModule', {
38
+ value: true
39
+ });
@@ -0,0 +1,2 @@
1
+ export type { Connection, ConnectionPickerProps, ConnectionPickerStrings, ConnectionStatus, } from './connection-picker';
2
+ export { ConnectionPicker, DEFAULT_CONNECTION_PICKER_STRINGS } from './connection-picker';
@@ -0,0 +1,2 @@
1
+ import { ConnectionPicker, DEFAULT_CONNECTION_PICKER_STRINGS } from "./connection-picker.js";
2
+ export { ConnectionPicker, DEFAULT_CONNECTION_PICKER_STRINGS };
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ var __webpack_require__ = {};
3
+ (()=>{
4
+ __webpack_require__.r = (exports1)=>{
5
+ if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
6
+ value: 'Module'
7
+ });
8
+ Object.defineProperty(exports1, '__esModule', {
9
+ value: true
10
+ });
11
+ };
12
+ })();
13
+ var __webpack_exports__ = {};
14
+ __webpack_require__.r(__webpack_exports__);
15
+ for(var __rspack_i in __webpack_exports__)exports[__rspack_i] = __webpack_exports__[__rspack_i];
16
+ Object.defineProperty(exports, '__esModule', {
17
+ value: true
18
+ });
@@ -0,0 +1,124 @@
1
+ import type { ReactNode } from 'react';
2
+ import type { ResourcePickerProps } from '../resource-picker/types';
3
+ /**
4
+ * A connection's health. `warning` is usable but degraded, such as missing
5
+ * scopes or a rate limit, and is named by its `statusReason` headline when it
6
+ * has one; `broken` needs repair before it will work.
7
+ */
8
+ export type ConnectionStatus = 'connected' | 'warning' | 'broken';
9
+ export interface Connection {
10
+ id: string;
11
+ /** The connection's own name, such as "Outlook Work". */
12
+ name: string;
13
+ /**
14
+ * The account behind it. When present it is what the row and field show:
15
+ * a node bound to the wrong account is the mistake worth catching, and the
16
+ * connection name says which connector, not which account.
17
+ */
18
+ account?: string;
19
+ /** Defaults to `connected`. */
20
+ status?: ConnectionStatus;
21
+ /**
22
+ * Why the connection is not healthy, authored as "Headline. Detail.". The
23
+ * headline is shown under the field and the whole reason on hover. For a
24
+ * `warning` the headline also names the state on its row.
25
+ */
26
+ statusReason?: string;
27
+ /** The folder the connection lives in. Connections without one share `defaultFolder`. */
28
+ folder?: string;
29
+ /** The connector's logo, as an image URL. Takes precedence over `icon`. */
30
+ logo?: string;
31
+ /** Leading glyph for the row, for a connector without a logo image. */
32
+ icon?: ReactNode;
33
+ /** Extra terms the search matches, such as the connector name or a resource id. */
34
+ keywords?: string[];
35
+ disabled?: boolean;
36
+ metadata?: unknown;
37
+ }
38
+ export interface ConnectionPickerProps extends Pick<ResourcePickerProps, 'placeholder' | 'disabled' | 'clearable' | 'clearAriaLabel' | 'align' | 'open' | 'onOpenChange' | 'searchPlaceholder' | 'emptyText' | 'loading' | 'loadingText' | 'loadError' | 'onRetry' | 'retryLabel' | 'error' | 'errorId' | 'footerTrailing' | 'showCounts' | 'locale' | 'formatCount' | 'contentClassName' | 'className' | 'id' | 'aria-labelledby' | 'aria-describedby' | 'aria-invalid' | 'aria-errormessage'> {
39
+ connections: Connection[];
40
+ /** Id of the chosen connection. */
41
+ value?: string;
42
+ onSelect: (connection: Connection) => void;
43
+ /** Clears the field. Without it the clear control is not offered. */
44
+ onClear?: () => void;
45
+ /**
46
+ * Repairs an unhealthy connection. Under the field it is offered for a
47
+ * chosen connection that is `broken` or `warning`, such as one missing
48
+ * scopes, so it must handle both; the row shortcut is offered on `broken`
49
+ * rows only.
50
+ */
51
+ onFix?: (connection: Connection) => void;
52
+ /**
53
+ * Offered on every row, revealed under the cursor, and in the field's menu
54
+ * for the chosen connection, which is the route that reaches it from the
55
+ * keyboard.
56
+ */
57
+ onEdit?: (connection: Connection) => void;
58
+ /**
59
+ * Starts a new connection. Adds a footer link, and with no connections at
60
+ * all the field itself becomes the way in, since a list with nothing to
61
+ * pick has nothing to open.
62
+ */
63
+ onAddConnection?: () => void;
64
+ /**
65
+ * Re-reads the chosen connection's schema. Adds a field menu while a
66
+ * connection is chosen. Return a promise to show progress until it settles.
67
+ */
68
+ onRefreshSchema?: (connection: Connection) => void | Promise<void>;
69
+ /** Folder for connections that do not name one. */
70
+ defaultFolder?: string;
71
+ addConnectionLabel?: string;
72
+ /**
73
+ * Overrides for the text the picker renders that has no prop of its own,
74
+ * for localisation. Anything omitted falls back to
75
+ * `DEFAULT_CONNECTION_PICKER_STRINGS`.
76
+ */
77
+ strings?: Partial<ConnectionPickerStrings>;
78
+ }
79
+ /**
80
+ * Every user-facing string ConnectionPicker renders beyond its own props
81
+ * (`placeholder`, `searchPlaceholder`, `emptyText`, `addConnectionLabel`,
82
+ * `defaultFolder`, `clearAriaLabel`), including those of the ResourcePicker it
83
+ * is built on.
84
+ */
85
+ export interface ConnectionPickerStrings {
86
+ /** Health names, on the rows, the field's description and its dot. */
87
+ statusLabels: Record<ConnectionStatus, string>;
88
+ /**
89
+ * Reasons shown under the field for an unhealthy choice without a
90
+ * `statusReason`, as "Headline. Detail.".
91
+ */
92
+ defaultReasons: Record<Exclude<ConnectionStatus, 'connected'>, string>;
93
+ /** Visible text of the Fix action, on the rows and under the field. */
94
+ fix: string;
95
+ /** Accessible name of a row's Fix action, given the connection's name. */
96
+ fixLabel: (name: string) => string;
97
+ /** Visible text of the Edit action in a row's actions menu. */
98
+ edit: string;
99
+ /** Accessible name of a row's Edit action, given the connection's name. */
100
+ editLabel: (name: string) => string;
101
+ /** The footer link that starts a new connection. */
102
+ addNewConnection: string;
103
+ /** Accessible name of the list of connections. */
104
+ listLabel: string;
105
+ /** Accessible name of the field's menu button. */
106
+ optionsLabel: string;
107
+ /** The field menu's Edit item. */
108
+ editConnection: string;
109
+ /** The field menu's refresh item, at rest, while it runs, and once done. */
110
+ refreshSchema: string;
111
+ refreshingSchema: string;
112
+ schemaRefreshed: string;
113
+ /** ResourcePicker's `noMatchText`: shown when the search matches nothing. */
114
+ noMatchText: (query: string) => string;
115
+ /** ResourcePicker's `collapsedGroupLabel`: a collapsed folder's spoken name. */
116
+ collapsedGroupLabel: (label: string) => string;
117
+ /**
118
+ * ResourcePicker's `expandedGroupLabel`: an open folder's spoken name when
119
+ * every connection in it is disabled.
120
+ */
121
+ expandedGroupLabel: (label: string) => string;
122
+ /** ResourcePicker's `actionsMenuLabel`: a row's actions menu name. */
123
+ actionsMenuLabel: (label: string) => string;
124
+ }
File without changes
@@ -34,8 +34,8 @@ const external_lucide_react_namespaceObject = require("lucide-react");
34
34
  const external_react_namespaceObject = require("react");
35
35
  const external_popover_cjs_namespaceObject = require("../popover.cjs");
36
36
  const index_cjs_namespaceObject = require("../../../lib/index.cjs");
37
+ const external_picker_empty_state_cjs_namespaceObject = require("../picker-empty-state.cjs");
37
38
  const folder_breadcrumb_cjs_namespaceObject = require("./components/folder-breadcrumb.cjs");
38
- const folder_picker_empty_state_cjs_namespaceObject = require("./components/folder-picker-empty-state.cjs");
39
39
  const folder_picker_footer_cjs_namespaceObject = require("./components/folder-picker-footer.cjs");
40
40
  const folder_picker_search_cjs_namespaceObject = require("./components/folder-picker-search.cjs");
41
41
  const folder_row_cjs_namespaceObject = require("./components/folder-row.cjs");
@@ -44,7 +44,8 @@ const listedDraft = (current, entries, segments)=>entries.some((entry)=>!entry.d
44
44
  ...segments,
45
45
  entry.name
46
46
  ]) === current) ? current : null;
47
- function FolderPickerContent({ onLoadChildren, onSelect, onCancel, initialPath, rootLabel = 'Root', breadcrumbLabel, searchPlaceholder = 'Search...', clearSearchLabel, initialSearch = '', emptyText = 'No subfolders.', noMatchText, openFolderLabel, loadingText = 'Loading…', loadErrorText = 'Could not load this folder.', retryLabel = 'Retry', listLabel = 'Folders', footerLeading, cancelLabel = 'Cancel', selectLabel = 'Select', className }) {
47
+ const defaultNoMatchText = (query)=>`No folders match “${query}”.`;
48
+ function FolderPickerContent({ onLoadChildren, onSelect, onCancel, initialPath, rootLabel = 'Root', breadcrumbLabel, searchPlaceholder = 'Search...', clearSearchLabel, initialSearch = '', emptyText = 'No subfolders.', noMatchText = defaultNoMatchText, openFolderLabel, loadingText = 'Loading…', loadErrorText = 'Could not load this folder.', retryLabel = 'Retry', listLabel = 'Folders', footerLeading, cancelLabel = 'Cancel', selectLabel = 'Select', className }) {
48
49
  const initialSegments = (0, external_react_namespaceObject.useMemo)(()=>(initialPath ?? '').split('/').filter(Boolean), [
49
50
  initialPath
50
51
  ]);
@@ -261,7 +262,7 @@ function FolderPickerContent({ onLoadChildren, onSelect, onCancel, initialPath,
261
262
  className: "max-h-56 min-h-0 flex-1 overflow-y-auto py-1 outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring",
262
263
  onKeyDown: handleTreeKeyDown,
263
264
  children: [
264
- 0 === visibleEntries.length && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(folder_picker_empty_state_cjs_namespaceObject.FolderPickerEmptyState, {
265
+ 0 === visibleEntries.length && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_picker_empty_state_cjs_namespaceObject.PickerEmptyState, {
265
266
  error: levelError,
266
267
  loading: isLoadingCurrentLevel,
267
268
  query: search.trim(),
@@ -4,8 +4,8 @@ import { FolderOpen, X } from "lucide-react";
4
4
  import { useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState } from "react";
5
5
  import { Popover, PopoverContent, PopoverTrigger } from "../popover.js";
6
6
  import { cn } from "../../../lib/index.js";
7
+ import { PickerEmptyState } from "../picker-empty-state.js";
7
8
  import { FolderBreadcrumb } from "./components/folder-breadcrumb.js";
8
- import { FolderPickerEmptyState } from "./components/folder-picker-empty-state.js";
9
9
  import { FolderPickerFooter } from "./components/folder-picker-footer.js";
10
10
  import { FolderPickerSearch } from "./components/folder-picker-search.js";
11
11
  import { FolderRow } from "./components/folder-row.js";
@@ -14,7 +14,8 @@ const listedDraft = (current, entries, segments)=>entries.some((entry)=>!entry.d
14
14
  ...segments,
15
15
  entry.name
16
16
  ]) === current) ? current : null;
17
- function FolderPickerContent({ onLoadChildren, onSelect, onCancel, initialPath, rootLabel = 'Root', breadcrumbLabel, searchPlaceholder = 'Search...', clearSearchLabel, initialSearch = '', emptyText = 'No subfolders.', noMatchText, openFolderLabel, loadingText = 'Loading…', loadErrorText = 'Could not load this folder.', retryLabel = 'Retry', listLabel = 'Folders', footerLeading, cancelLabel = 'Cancel', selectLabel = 'Select', className }) {
17
+ const defaultNoMatchText = (query)=>`No folders match “${query}”.`;
18
+ function FolderPickerContent({ onLoadChildren, onSelect, onCancel, initialPath, rootLabel = 'Root', breadcrumbLabel, searchPlaceholder = 'Search...', clearSearchLabel, initialSearch = '', emptyText = 'No subfolders.', noMatchText = defaultNoMatchText, openFolderLabel, loadingText = 'Loading…', loadErrorText = 'Could not load this folder.', retryLabel = 'Retry', listLabel = 'Folders', footerLeading, cancelLabel = 'Cancel', selectLabel = 'Select', className }) {
18
19
  const initialSegments = useMemo(()=>(initialPath ?? '').split('/').filter(Boolean), [
19
20
  initialPath
20
21
  ]);
@@ -231,7 +232,7 @@ function FolderPickerContent({ onLoadChildren, onSelect, onCancel, initialPath,
231
232
  className: "max-h-56 min-h-0 flex-1 overflow-y-auto py-1 outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring",
232
233
  onKeyDown: handleTreeKeyDown,
233
234
  children: [
234
- 0 === visibleEntries.length && /*#__PURE__*/ jsx(FolderPickerEmptyState, {
235
+ 0 === visibleEntries.length && /*#__PURE__*/ jsx(PickerEmptyState, {
235
236
  error: levelError,
236
237
  loading: isLoadingCurrentLevel,
237
238
  query: search.trim(),