Repository navigation
feat(apollo-wind): add ConnectionPicker - #1246
andreea-ene wants to merge 1 commit into
Conversation
Dependency License Review
License distribution
Excluded packages
|
895f2ce to
72a9cd2
Compare
c0e0590 to
847ee0c
Compare
72a9cd2 to
23c4179
Compare
4a1d8a3 to
aa0695e
Compare
5b21e54 to
a581ace
Compare
dbacomputer
left a comment
There was a problem hiding this comment.
Reviewed the changes against feat/resource-picker, including the earlier review fixes. The 63 existing ConnectionPicker/ResourcePicker tests pass locally. Two additional interaction regressions reproduced in targeted tests are noted inline; I recommend fixing these before approval.
a581ace to
b9aea5c
Compare
aa0695e to
22d7212
Compare
b9aea5c to
5b75539
Compare
22d7212 to
a041670
Compare
5b75539 to
8edf3af
Compare
a041670 to
d822ff7
Compare
8edf3af to
f123a1d
Compare
d822ff7 to
ce4e3af
Compare
f123a1d to
ae9db56
Compare
ce4e3af to
97bfb4e
Compare
ae9db56 to
3ca22c4
Compare
38b54c7 to
6557097
Compare
868aa0c to
be62bea
Compare
be62bea to
3694d67
Compare
3694d67 to
2936fde
Compare
Epixa-Dogfood ReviewReview unavailable: Not reviewed: What this PR doesThe pull request author describes the intended change as follows: feat(apollo-wind): add ConnectionPicker This review did not reuse a local review of this change. Set up Epixa local review. Full review: 34f53a1 |
| onCloseAutoFocus={(event) => { | ||
| if (!tabbingOut.current) return; | ||
| tabbingOut.current = false; | ||
| const field = fieldRef.current; | ||
| if (field && focusBeside(field, false)) event.preventDefault(); | ||
| }} |
| /** The row whose actions menu is open, opened from the keyboard. */ | ||
| const [actionsMenu, setActionsMenu] = useState<{ | ||
| item: ResourceItem; | ||
| actions: ResourceItemAction[]; | ||
| anchor: HTMLElement; | ||
| } | null>(null); |
| // else is left where it is. | ||
| useLayoutEffect(() => { | ||
| const button = addButtonRef.current; | ||
| if (!addOnly || !focusWithin.current || !button) return; |
| data-slot="resource-row-actions-menu" | ||
| align="end" | ||
| sideOffset={2} | ||
| className="w-auto min-w-36 p-1" |
| onSelect={(item: ResourceItem) => { | ||
| onSelect(item); | ||
| setOpen(false); | ||
| }} |
ResourcePicker is a field and popover for choosing one record from a grouped list. It is generic over what it lists: a group is a heading with rows under it, and a row is an id, a label and an optional icon, so the same control serves Data Fabric entities, queues, storage buckets or anything else with that shape. Rows commit on click, so there is no Cancel and Select pair: one resource is one decision. The footer's two slots hold the ways out of the picker instead, which keeps product routes out of the component. Rows can also carry a subtitle, with a text form joined into their accessible name, search keywords they do not print, and trailing actions revealed under the cursor. The field has an error/warning status, and its trigger classes are exported so pickers built on it read as a pair. Built on Command and Popover, following VariablePicker, with the file layout FolderPicker uses. Selection is carried by a tick and a brand tint, kept apart from the neutral fill that marks the cursor: `surface-selected` and `surface-hover` resolve to the same value in every theme. ConnectionPicker builds on it to choose the connection an activity runs with, adding what only a connection has: - health on every row and on the field, as its leading dot, its border and a message underneath. A warning is named by its own reason's headline, falling back to "Needs attention" - broken connections sorted to the end of their folder - Fix on broken rows and under the field, Edit on every row and in the field menu, so both are reachable from the keyboard - an Add connection footer link, and with no connections at all the field itself starts one - a field menu to refresh the chosen connection's schema, showing progress while the returned promise is pending - an `error` message for validation, and the field's id and ARIA labelling forwarded to either trigger Rows and the field show the account, falling back to the connection name, since a node bound to the wrong account is the mistake worth catching. The name stays searchable. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>


Adds
ConnectionPicker, a field and popover for choosing the connection an activity runs with.Why a separate component
ConnectionPickeris built onResourcePickerrather than being a variant of it. The search, folders, keyboard model, empty states and footer are shared. What a connection adds is its own domain: a health, repair and edit actions, a message under the field and a schema refresh. As avariantprop, most of that would be props that only mean something for connections.ResourcePicker additions
Generic extension points, useful to any picker built on it:
subtitle: a second line under a row's labelkeywords: extra search terms for detail a row does not printitemActions(item) => ResourceItemAction[]: a row's actions (id,label, optionaltext,icon,tone,onSelect). The row shows them as pointer shortcuts, revealed under the cursor; clicking one does not commit the row. They are hidden from assistive technology and never focusable, since a listbox option is atomic. Shift+Enter on the row under the cursor opens them as a real menu beside the row (actionsMenuLabel, default "Actions for …"): ArrowUp/ArrowDown move, Enter runs an action, Escape returns to the search, and Tab/Shift+Tab move on from the rowonTabOut: called when Tab leaves a row's actions menu with nothing after the list inside an embeddedResourcePickerContent;ResourcePickeruses it to close its popover and move on from the fieldstatus: anerrororwarningstate on the field, witharia-invalidfor errors, plusaria-describedbyfor the consumer's messageThe list is a single listbox, the one the search's
aria-controlsnames, holding onlyrole="group"elements and options. Group headings are labels, not buttons: clicking an open heading collapses it, ArrowLeft on a row collapses its group, and a collapsed group stays as one option ("Shared, collapsed", set bycollapsedGroupLabel) that Enter, ArrowRight or a click reopens. The arrows only fold groups while the search is empty. OtherResourcePickerchanges made in review:noMatchText(query)for the no-results message; a controlledquerywithoutonQueryChangemakes the searchreadOnlyand lets Escape dismiss; the clear control shows for any setvalue, even one not found ingroups.The field's classes are exported as
resourcePickerTriggerClassNameso pickers built on it match. The trailing padding now also applies in the Future themes, wherefuture:px-4used to override it and let the value run under the clear control. The row icon slot grows from 14px to 16px so image logos keep their detail.ConnectionPicker
connected,warning(usable but degraded, such as missing scopes) orbroken. Rows show it as a second line. The field shows it as its leading dot, its border and, when unhealthy, a message underneath with the first sentence ofstatusReason(the whole reason on hover).logotakes an image URL for the connector, such as the third-party SVGs in@uipath/apollo-ui-icons.iconremains for a glyph.onFixadds Fix to broken rows, and to the message under the field once a broken or warning connection is chosen, so it must handle both.onEditadds Edit to every row.onAddConnectionadds a footer link, and with no connections and no value the field itself starts a new one (a value with no matching connection stays visible and clearable).onRefreshSchemaadds a field menu while a connection is chosen, showing progress until its promise settles.errorputs the field in its error state with the message underneath, taking the place of the health message.strings(ConnectionPickerStrings, defaults inDEFAULT_CONNECTION_PICKER_STRINGS) covers every string without a prop of its own: health labels, fallback reasons, Fix/Edit, the footer link, the list name, the field menu, andResourcePicker'snoMatchText,collapsedGroupLabelandactionsMenuLabel.Row actions are pointer shortcuts in the row and a Shift+Enter menu from the keyboard. Fix is also offered under the field once a broken or warning connection is chosen.
Screenshots
Field states: broken, missing scopes, required and no connections.
Stories
Components/Core/Connection Picker: Default, WithValue, Broken, MissingScopes, Slack, Required, NoConnections, SelectOnly, Disabled.Checks
Run locally:
biome formatbiome check(changed files)tsc --noEmitvitest run(connection-picker, resource-picker)npm run build🤖 Generated with Claude Code