Skip to content

Infisical is the open-source platform for securing secrets, certificates, access, and AI Agents.

improvement(secret-manager): migrate secret manager and PAM pickers to Combobox (#8835)

Andrew Huang1760751b7e08
diff --git a/frontend/src/pages/pam/PamAccessControlPage/components/AddGroupModal.tsx b/frontend/src/pages/pam/PamAccessControlPage/components/AddGroupModal.tsx
index d41d338074..47132610df 100644
--- a/frontend/src/pages/pam/PamAccessControlPage/components/AddGroupModal.tsx
+++ b/frontend/src/pages/pam/PamAccessControlPage/components/AddGroupModal.tsx
@@ -5,6 +5,7 @@ import { ExternalLink } from "lucide-react";
import { createNotification } from "@app/components/notifications";
import {
Button,
+ Combobox,
Dialog,
DialogContent,
DialogDescription,
@@ -12,8 +13,7 @@ import {
DialogHeader,
DialogTitle,
Field,
- FieldLabel,
- FilterableSelect
+ FieldLabel
} from "@app/components/v3";
import { useOrganization, useProject } from "@app/context";
import { useGetOrganizationGroups, useListWorkspaceGroups } from "@app/hooks/api";
@@ -79,12 +79,14 @@ export const AddGroupModal = ({ isOpen, onOpenChange }: Props) => {
{availableGroups.length ? (
<div className="flex flex-col gap-5">
<Field>
- <FieldLabel>
+ <FieldLabel htmlFor="pam-add-group">
Group <span className="text-product-pam">*</span>
</FieldLabel>
- <FilterableSelect
+ <Combobox
+ id="pam-add-group"
+ isClearable={false}
value={selectedGroup}
- onChange={(val) => setSelectedGroup(val as { id: string; name: string } | null)}
+ onValueChange={setSelectedGroup}
getOptionValue={(option) => option.id}
getOptionLabel={(option) => option.name}
options={availableGroups}
diff --git a/frontend/src/pages/pam/PamAccessControlPage/components/InviteMemberModal.tsx b/frontend/src/pages/pam/PamAccessControlPage/components/InviteMemberModal.tsx
index 8fadca9ed4..cea8fc6ab1 100644
--- a/frontend/src/pages/pam/PamAccessControlPage/components/InviteMemberModal.tsx
+++ b/frontend/src/pages/pam/PamAccessControlPage/components/InviteMemberModal.tsx
@@ -6,6 +6,7 @@ import {
Alert,
AlertDescription,
Button,
+ Combobox,
Dialog,
DialogContent,
DialogDescription,
@@ -13,8 +14,7 @@ import {
DialogHeader,
DialogTitle,
Field,
- FieldLabel,
- FilterableSelect
+ FieldLabel
} from "@app/components/v3";
import { useOrganization, useProject } from "@app/context";
import { useGetOrgUsers, useGetWorkspaceUsers } from "@app/hooks/api";
@@ -145,16 +145,19 @@ export const InviteMemberModal = ({ isOpen, onOpenChange }: Props) => {
<div className="flex flex-col gap-5">
<Field>
- <FieldLabel>
+ <FieldLabel htmlFor="pam-invite-members">
Users <span className="text-product-pam">*</span>
</FieldLabel>
- <FilterableSelect
+ <Combobox
+ id="pam-invite-members"
placeholder="Select one or more users..."
- isMulti
+ multiple
options={availableUsers}
value={selectedUsers}
- onChange={(val) => setSelectedUsers(val as SelectOption[])}
- noOptionsMessage={() => "All organization members have already been added."}
+ onValueChange={setSelectedUsers}
+ getOptionValue={(option) => option.value}
+ getOptionLabel={(option) => option.label}
+ emptyMessage="All organization members have already been added."
/>
</Field>
diff --git a/frontend/src/pages/pam/PamAccountsPage/components/FolderApprovalsTab.tsx b/frontend/src/pages/pam/PamAccountsPage/components/FolderApprovalsTab.tsx
index b0c1a3a98c..7574701542 100644
--- a/frontend/src/pages/pam/PamAccountsPage/components/FolderApprovalsTab.tsx
+++ b/frontend/src/pages/pam/PamAccountsPage/components/FolderApprovalsTab.tsx
@@ -1,5 +1,4 @@
import { useEffect, useMemo, useState } from "react";
-import { components, OptionProps } from "react-select";
import {
Ban,
FilterIcon,
@@ -21,13 +20,13 @@ import {
CardDescription,
CardHeader,
CardTitle,
+ Combobox,
ConfirmationAlertDialog,
DropdownMenu,
DropdownMenuCheckboxItem,
DropdownMenuContent,
DropdownMenuLabel,
DropdownMenuTrigger,
- FilterableSelect,
IconButton,
Pagination,
Table,
@@ -85,20 +84,18 @@ const KIND_ICON: Record<PamApproverType, typeof UserIcon> = {
[PamApproverType.Group]: UsersIcon
};
-const ApproverSelectOption = ({ children, ...props }: OptionProps<ApproverOption>) => {
- const Icon = KIND_ICON[props.data.kind];
+const renderApproverOption = (option: ApproverOption) => {
+ const Icon = KIND_ICON[option.kind];
return (
- <components.Option {...props}>
- <div className="flex items-center gap-2.5">
- <Icon className="size-4 shrink-0 text-muted" />
- <div className="min-w-0">
- <p className="truncate">{children}</p>
- {props.data.subtitle && (
- <p className="truncate text-xs leading-4 text-muted">{props.data.subtitle}</p>
- )}
- </div>
+ <div className="flex items-center gap-2.5">
+ <Icon className="size-4 shrink-0 text-muted" />
+ <div className="min-w-0">
+ <p className="truncate">{option.label}</p>
+ {option.subtitle && (
+ <p className="truncate text-xs leading-4 text-muted">{option.subtitle}</p>
+ )}
</div>
- </components.Option>
+ </div>
);
};
@@ -374,17 +371,16 @@ export const FolderApprovalsTab = ({ folderId, onDirtyChange }: Props) => {
</CardDescription>
</CardHeader>
<CardContent className="flex flex-col gap-4">
- <FilterableSelect
+ <Combobox
+ isClearable={false}
value={null}
options={approverOptions}
- onChange={(opt) => addApprover(opt as ApproverOption | null)}
+ onValueChange={addApprover}
getOptionValue={(opt) => `${opt.kind}:${opt.value}`}
getOptionLabel={(opt) => opt.label}
- components={{ Option: ApproverSelectOption }}
+ renderOption={renderApproverOption}
placeholder="Add a user or group..."
- noOptionsMessage={() =>
- "No eligible folder members left. Add users or groups to this folder under the Permissions tab first."
- }
+ emptyMessage="No eligible folder members left. Add users or groups to this folder under the Permissions tab first."
/>
{approvers.length === 0 ? (
@@ -462,17 +458,16 @@ export const FolderApprovalsTab = ({ folderId, onDirtyChange }: Props) => {
</CardDescription>
</CardHeader>
<CardContent className="flex flex-col gap-4">
- <FilterableSelect
+ <Combobox
+ isClearable={false}
value={null}
options={breakGlassOptions}
- onChange={(opt) => addBreakGlassUser(opt as ApproverOption | null)}
+ onValueChange={addBreakGlassUser}
getOptionValue={(opt) => `${opt.kind}:${opt.value}`}
getOptionLabel={(opt) => opt.label}
- components={{ Option: ApproverSelectOption }}
+ renderOption={renderApproverOption}
placeholder="Add a user or group..."
- noOptionsMessage={() =>
- "No eligible folder members left. Add users or groups to this folder under the Permissions tab first."
- }
+ emptyMessage="No eligible folder members left. Add users or groups to this folder under the Permissions tab first."
/>
{breakGlassUsers.length === 0 ? (
diff --git a/frontend/src/pages/pam/PamAccountsPage/components/FolderNotificationsSection.tsx b/frontend/src/pages/pam/PamAccountsPage/components/FolderNotificationsSection.tsx
index 2fc55aa030..777703330a 100644
--- a/frontend/src/pages/pam/PamAccountsPage/components/FolderNotificationsSection.tsx
+++ b/frontend/src/pages/pam/PamAccountsPage/components/FolderNotificationsSection.tsx
@@ -1,10 +1,4 @@
import { useMemo } from "react";
-import {
- components as selectComponents,
- MultiValueGenericProps,
- OptionProps,
- SingleValueProps
-} from "react-select";
import { Bell, Trash2 } from "lucide-react";
import {
@@ -14,7 +8,7 @@ import {
CardDescription,
CardHeader,
CardTitle,
- FilterableSelect,
+ Combobox,
IconButton,
Tooltip,
TooltipContent,
@@ -61,40 +55,25 @@ type IntegrationOption = { value: string; label: string };
type ChannelOption = { id: string; name: string };
type EventOption = (typeof EVENT_OPTIONS)[number];
-const WorkspaceOption = ({ children, ...props }: OptionProps<IntegrationOption>) => (
- <selectComponents.Option {...props}>
- <div className="flex items-center gap-2">
- <SlackLogo className="size-4 shrink-0" />
- <span className="truncate">{children}</span>
- </div>
- </selectComponents.Option>
+const renderWorkspace = (option: IntegrationOption) => (
+ <span className="flex min-w-0 items-center gap-2">
+ <SlackLogo className="size-4 shrink-0" />
+ <span className="truncate">{option.label}</span>
+ </span>
);
-const WorkspaceSingleValue = ({ children, ...props }: SingleValueProps<IntegrationOption>) => (
- <selectComponents.SingleValue {...props}>
- <div className="flex items-center gap-2">
- <SlackLogo className="size-4 shrink-0" />
- <span className="truncate">{children}</span>
- </div>
- </selectComponents.SingleValue>
+const renderChannelChip = (option: ChannelOption) => (
+ <span className="flex items-center gap-1.5">
+ <SlackLogo className="size-3.5 shrink-0" />
+ {`#${option.name}`}
+ </span>
);
-const ChannelMultiValueLabel = ({ children, ...props }: MultiValueGenericProps<ChannelOption>) => (
- <selectComponents.MultiValueLabel {...props}>
- <div className="flex items-center gap-1.5">
- <SlackLogo className="size-3.5 shrink-0" />
- {children}
- </div>
- </selectComponents.MultiValueLabel>
-);
-
-const EventMultiValueLabel = ({ children, ...props }: MultiValueGenericProps<EventOption>) => (
- <selectComponents.MultiValueLabel {...props}>
- <div className="flex items-center gap-1.5">
- <Bell className="size-3.5 shrink-0 text-muted" />
- {children}
- </div>
- </selectComponents.MultiValueLabel>
+const renderEventChip = (option: EventOption) => (
+ <span className="flex items-center gap-1.5">
+ <Bell className="size-3.5 shrink-0 text-muted" />
+ {option.label}
+ </span>
);
type ConfigCardProps = {
@@ -147,19 +126,20 @@ const NotificationConfigCard = ({
<div className="flex flex-col gap-4 rounded-md border border-border p-4">
<div className="flex items-start gap-2">
<div className="flex-1">
- <FilterableSelect
+ <Combobox
isDisabled
+ isClearable={false}
value={selectedIntegration}
options={workspaceOptions}
- onChange={(opt) => {
- const next = opt as IntegrationOption | null;
- if (!next || next.value === config.workflowIntegrationId) return;
+ onValueChange={(next) => {
+ if (next.value === config.workflowIntegrationId) return;
// channels belong to the previous workspace, so a workspace change clears them
onChange({ ...config, workflowIntegrationId: next.value, channels: [] });
}}
getOptionValue={(opt) => opt.value}
getOptionLabel={(opt) => opt.label}
- components={{ Option: WorkspaceOption, SingleValue: WorkspaceSingleValue }}
+ renderOption={renderWorkspace}
+ renderValue={renderWorkspace}
placeholder="Select a Slack workspace..."
/>
</div>
@@ -182,22 +162,19 @@ const NotificationConfigCard = ({
<>
<div className="flex flex-col gap-1.5">
<span className="text-sm font-medium">Slack channels</span>
- <FilterableSelect
- isMulti
+ <Combobox
+ multiple
isDisabled
value={config.channels}
options={channelOptions}
- onChange={(selected) => {
- const channels = (selected as ChannelOption[] | null) ?? [];
+ onValueChange={(channels) => {
onChange({ ...config, channels: channels.map(({ id, name }) => ({ id, name })) });
}}
getOptionValue={(opt) => opt.id}
getOptionLabel={(opt) => `#${opt.name}`}
- components={{ MultiValueLabel: ChannelMultiValueLabel }}
+ renderValue={renderChannelChip}
placeholder="Add Slack channel..."
- noOptionsMessage={() =>
- "No channels found. Invite the Infisical Slack app to private channels to list them here."
- }
+ emptyMessage="No channels found. Invite the Infisical Slack app to private channels to list them here."
/>
{isChannelListError && (
<p className="text-xs text-muted">
@@ -209,18 +186,17 @@ const NotificationConfigCard = ({
<div className="flex flex-col gap-1.5">
<span className="text-sm font-medium">Notify on</span>
- <FilterableSelect
- isMulti
+ <Combobox
+ multiple
isDisabled
value={EVENT_OPTIONS.filter((opt) => config.events.includes(opt.value))}
options={EVENT_OPTIONS}
- onChange={(selected) => {
- const events = ((selected as EventOption[] | null) ?? []).map((opt) => opt.value);
- onChange({ ...config, events });
+ onValueChange={(selected) => {
+ onChange({ ...config, events: selected.map((opt) => opt.value) });
}}
getOptionValue={(opt) => opt.value}
getOptionLabel={(opt) => opt.label}
- components={{ MultiValueLabel: EventMultiValueLabel }}
+ renderValue={renderEventChip}
placeholder="Add event..."
/>
</div>
diff --git a/frontend/src/pages/pam/PamDiscoveryPage/components/DiscoveryConfigFields.tsx b/frontend/src/pages/pam/PamDiscoveryPage/components/DiscoveryConfigFields.tsx
index c2b50d02f2..07a2931aee 100644
--- a/frontend/src/pages/pam/PamDiscoveryPage/components/DiscoveryConfigFields.tsx
+++ b/frontend/src/pages/pam/PamDiscoveryPage/components/DiscoveryConfigFields.tsx
@@ -5,12 +5,12 @@ import { z } from "zod";
import {
Alert,
AlertDescription,
+ Combobox,
Field,
FieldContent,
FieldDescription,
FieldError,
FieldLabel,
- FilterableSelect,
Input,
Select,
SelectContent,
@@ -277,14 +277,13 @@ export const CredentialAccountsField = ({
name="credentialAccountIds"
render={({ field, fieldState }) => (
<Field>
- <FieldLabel>Credential Accounts</FieldLabel>
+ <FieldLabel htmlFor="discovery-credential-accounts">Credential Accounts</FieldLabel>
<FieldContent>
- <FilterableSelect
- isMulti
+ <Combobox
+ id="discovery-credential-accounts"
+ multiple
value={matchingAccounts.filter((a) => field.value?.includes(a.id))}
- onChange={(val) =>
- field.onChange(((val as typeof matchingAccounts | null) ?? []).map((a) => a.id))
- }
+ onValueChange={(val) => field.onChange(val.map((a) => a.id))}
options={matchingAccounts}
getOptionValue={(a) => a.id}
getOptionLabel={(a) => (a.folderName ? `${a.folderName} / ${a.name}` : a.name)}
@@ -351,13 +350,13 @@ export const CredentialAccountField = ({
name="credentialAccountId"
render={({ field, fieldState }) => (
<Field>
- <FieldLabel>Credential Account</FieldLabel>
+ <FieldLabel htmlFor="discovery-credential-account">Credential Account</FieldLabel>
<FieldContent>
- <FilterableSelect
+ <Combobox
+ id="discovery-credential-account"
+ isClearable={false}
value={credentialAccounts.find((a) => a.id === field.value) ?? null}
- onChange={(val) =>
- field.onChange((val as (typeof credentialAccounts)[number] | null)?.id ?? "")
- }
+ onValueChange={(val) => field.onChange(val.id)}
options={credentialAccounts}
getOptionValue={(a) => a.id}
getOptionLabel={(a) => (a.folderName ? `${a.folderName} / ${a.name}` : a.name)}
diff --git a/frontend/src/pages/project/SettingsPage/components/CrossProjectSharingSection/ShareSecretsSheet.tsx b/frontend/src/pages/project/SettingsPage/components/CrossProjectSharingSection/ShareSecretsSheet.tsx
index 0e361ef0b6..ac82d797a5 100644
--- a/frontend/src/pages/project/SettingsPage/components/CrossProjectSharingSection/ShareSecretsSheet.tsx
+++ b/frontend/src/pages/project/SettingsPage/components/CrossProjectSharingSection/ShareSecretsSheet.tsx
@@ -1,13 +1,12 @@
import { useEffect, useState } from "react";
-import { MultiValue } from "react-select";
import { ArrowDown, Box, FolderIcon, Layers, Plus, Trash2, X } from "lucide-react";
import { createNotification } from "@app/components/notifications";
import {
Button,
+ Combobox,
Field,
FieldGroup,
- FilterableSelect,
IconButton,
SecretPathInput,
Select,
@@ -465,10 +464,10 @@ export const ShareSecretsSheet = ({
<span className="text-sm">{editData!.targetProjectName}</span>
</div>
) : (
- <FilterableSelect
- isMulti
+ <Combobox
+ multiple
value={targetProjects}
- onChange={(options) => setTargetProjects([...(options as MultiValue<Project>)])}
+ onValueChange={setTargetProjects}
isLoading={isProjectsLoading}
options={availableProjects}
placeholder="Search projects..."
diff --git a/frontend/src/pages/secret-manager/OverviewPage/components/FolderAccessSheet/AddFolderAccessSheet.tsx b/frontend/src/pages/secret-manager/OverviewPage/components/FolderAccessSheet/AddFolderAccessSheet.tsx
index b062c3d1a2..3b3ea2976e 100644
--- a/frontend/src/pages/secret-manager/OverviewPage/components/FolderAccessSheet/AddFolderAccessSheet.tsx
+++ b/frontend/src/pages/secret-manager/OverviewPage/components/FolderAccessSheet/AddFolderAccessSheet.tsx
@@ -5,7 +5,7 @@ import { createNotification } from "@app/components/notifications";
import {
Badge,
Button,
- FilterableSelect,
+ Combobox,
Label,
Sheet,
SheetContent,
@@ -25,10 +25,7 @@ import {
import { DEFAULT_TEMPORARY_RANGE } from "./folder-access.const";
import { byName, TFolderAccessActor, toIdentityActor, toUserActor } from "./folder-access.utils";
-import {
- FolderAccessActorMultiValueLabel,
- FolderAccessActorOption
-} from "./FolderAccessActorOption";
+import { FolderAccessActorOption, FolderAccessActorValue } from "./FolderAccessActorOption";
import { FolderTierRadioGroup } from "./FolderTierRadioGroup";
import { TemporaryAccessPopover } from "./TemporaryAccessPopover";
@@ -157,27 +154,23 @@ export const AddFolderAccessSheet = ({
<div className="thin-scrollbar flex-1 space-y-5 overflow-y-auto p-4">
<div className="space-y-2">
- <Label>Users & machine identities</Label>
- <FilterableSelect
- isMulti
+ <Label htmlFor="folder-access-actors">Users & machine identities</Label>
+ <Combobox
+ id="folder-access-actors"
+ multiple
value={selected}
options={candidates}
isLoading={isUsersPending || isIdentitiesPending}
- onInputChange={(value, { action }) => {
- if (action === "input-change") setSearch(value);
- }}
- onChange={(value) => setSelected((value ?? []) as TFolderAccessActor[])}
- components={{
- Option: FolderAccessActorOption,
- MultiValueLabel: FolderAccessActorMultiValueLabel
- }}
- getOptionValue={(option) => `${option.type}-${option.id}`}
- getOptionLabel={(option) => option.name}
// the candidate lists are already searched server side, so the label-only
// client filter would drop matches found by email or identity metadata
- filterOption={null}
+ onSearchChange={setSearch}
+ onValueChange={setSelected}
+ renderOption={(option) => <FolderAccessActorOption actor={option} />}
+ renderValue={(option) => <FolderAccessActorValue actor={option} />}
+ getOptionValue={(option) => `${option.type}-${option.id}`}
+ getOptionLabel={(option) => option.name}
placeholder="Search users & machine identities"
- noOptionsMessage={({ inputValue }) =>
+ emptyMessage={(inputValue) =>
inputValue
? "No matches found"
: "Every project member already has access to this folder."
diff --git a/frontend/src/pages/secret-manager/OverviewPage/components/FolderAccessSheet/FolderAccessActorOption.tsx b/frontend/src/pages/secret-manager/OverviewPage/components/FolderAccessSheet/FolderAccessActorOption.tsx
index ba985534f7..2502a2537a 100644
--- a/frontend/src/pages/secret-manager/OverviewPage/components/FolderAccessSheet/FolderAccessActorOption.tsx
+++ b/frontend/src/pages/secret-manager/OverviewPage/components/FolderAccessSheet/FolderAccessActorOption.tsx
@@ -1,5 +1,4 @@
-import { components, MultiValueGenericProps, OptionProps } from "react-select";
-import { BotIcon, CheckIcon, UserIcon } from "lucide-react";
+import { BotIcon, UserIcon } from "lucide-react";
import { ActorType } from "@app/hooks/api/auditLogs/enums";
@@ -12,38 +11,17 @@ const ActorTypeIcon = ({ type }: { type: TFolderAccessActor["type"] }) =>
<UserIcon className="size-3.5 shrink-0 text-muted" />
);
-export const FolderAccessActorOption = ({
- isSelected,
- children,
- ...props
-}: OptionProps<TFolderAccessActor>) => {
- const { type, subtitle } = props.data;
+export const FolderAccessActorOption = ({ actor }: { actor: TFolderAccessActor }) => (
+ <div className="flex min-w-0 items-center gap-2">
+ <ActorTypeIcon type={actor.type} />
+ <span className="truncate">{actor.name}</span>
+ <span className="truncate text-xs text-muted">{actor.subtitle}</span>
+ </div>
+);
- return (
- <components.Option isSelected={isSelected} {...props}>
- <div className="flex flex-row items-center justify-between gap-2">
- <div className="flex min-w-0 items-center gap-2">
- <ActorTypeIcon type={type} />
- <span className="truncate">{children}</span>
- <span className="truncate text-xs text-muted">{subtitle}</span>
- </div>
- {isSelected && <CheckIcon className="size-4 shrink-0" />}
- </div>
- </components.Option>
- );
-};
-
-export const FolderAccessActorMultiValueLabel = (
- props: MultiValueGenericProps<TFolderAccessActor>
-) => {
- const { data, children } = props;
-
- return (
- <components.MultiValueLabel {...props}>
- <span className="flex items-center gap-1.5">
- <ActorTypeIcon type={data.type} />
- {children}
- </span>
- </components.MultiValueLabel>
- );
-};
+export const FolderAccessActorValue = ({ actor }: { actor: TFolderAccessActor }) => (
+ <span className="flex items-center gap-1.5">
+ <ActorTypeIcon type={actor.type} />
+ {actor.name}
+ </span>
+);
diff --git a/frontend/src/pages/secret-manager/OverviewPage/components/SecretTableRow/SecretAccessInsights.tsx b/frontend/src/pages/secret-manager/OverviewPage/components/SecretTableRow/SecretAccessInsights.tsx
index 18b4a2375f..c9ca5d3590 100644
--- a/frontend/src/pages/secret-manager/OverviewPage/components/SecretTableRow/SecretAccessInsights.tsx
+++ b/frontend/src/pages/secret-manager/OverviewPage/components/SecretTableRow/SecretAccessInsights.tsx
@@ -20,6 +20,7 @@ import {
import { createNotification } from "@app/components/notifications";
import {
Button,
+ Combobox,
Command,
CommandEmpty,
CommandGroup,
@@ -35,7 +36,6 @@ import {
EmptyDescription,
EmptyHeader,
EmptyTitle,
- FilterableSelect,
IconButton,
InputGroup,
InputGroupAddon,
@@ -370,13 +370,14 @@ function AddMemberPopover({
</Command>
<div className="border-t border-border px-3 py-2">
<span className="mb-1 block text-xs text-muted">Grant access:</span>
- <FilterableSelect
- isMulti
+ <Combobox
+ multiple
value={selectedActions}
- onChange={(opts) =>
- setSelectedActions([...(opts as { value: string; label: string }[])])
- }
+ onValueChange={setSelectedActions}
options={SECRET_ACTION_OPTIONS}
+ getOptionValue={(option) => option.value}
+ getOptionLabel={(option) => option.label}
+ getOptionKeywords={(option) => [option.value]}
placeholder="Select permissions..."
/>
</div>
diff --git a/frontend/src/pages/secret-manager/OverviewPage/components/SelectionPanel/components/BulkTagDialog/BulkTagDialog.tsx b/frontend/src/pages/secret-manager/OverviewPage/components/SelectionPanel/components/BulkTagDialog/BulkTagDialog.tsx
index 995004b5bc..37c04b09ef 100644
--- a/frontend/src/pages/secret-manager/OverviewPage/components/SelectionPanel/components/BulkTagDialog/BulkTagDialog.tsx
+++ b/frontend/src/pages/secret-manager/OverviewPage/components/SelectionPanel/components/BulkTagDialog/BulkTagDialog.tsx
@@ -7,7 +7,7 @@ import { z } from "zod";
import { createNotification } from "@app/components/notifications";
import {
Button,
- CreatableSelect,
+ Combobox,
Dialog,
DialogClose,
DialogContent,
@@ -273,15 +273,16 @@ const BulkTagDialogContent = ({
<div className="flex shrink-0 flex-col gap-4">
<Field>
- <FieldLabel>Tags</FieldLabel>
+ <FieldLabel htmlFor="bulk-tag-select">Tags</FieldLabel>
<FieldContent>
<Controller
name="tags"
control={control}
render={({ field }) => (
- <CreatableSelect
- isMulti
- noOptionsMessage={({ inputValue }) =>
+ <Combobox
+ id="bulk-tag-select"
+ multiple
+ emptyMessage={(inputValue) =>
inputValue && !slugSchema().safeParse(inputValue).success
? "Tag must be slug-friendly"
: "No tags match search"
@@ -290,13 +291,25 @@ const BulkTagDialogContent = ({
placeholder="Select or create tags..."
options={tagOptions}
value={field.value}
- onChange={(newValue) => field.onChange(newValue)}
- onCreateOption={handleCreateTag}
- isValidNewOption={(inputValue) =>
- !canAddTags
- ? false
- : slugSchema().safeParse(inputValue).success &&
- !projectTags?.map((tag) => tag.slug).includes(inputValue)
+ onValueChange={field.onChange}
+ getOptionValue={(option) => option.value}
+ getOptionLabel={(option) => option.label}
+ creation={
+ canAddTags
+ ? {
+ onCreate: handleCreateTag,
+ isValid: (inputValue) =>
+ slugSchema().safeParse(inputValue).success &&
+ !projectTags?.map((tag) => tag.slug).includes(inputValue),
+ formatLabel: (inputValue) => {
+ if (!slugSchema().safeParse(inputValue).success)
+ return "Tag must be slug-friendly";
+ if (projectTags?.some((tag) => tag.slug === inputValue))
+ return "Tag already exists";
+ return `Create "${inputValue}"`;
+ }
+ }
+ : undefined
}
/>
)}
diff --git a/frontend/src/pages/secret-manager/SecretApprovalsPage/components/ApprovalPolicyList/components/AccessPolicyModal.tsx b/frontend/src/pages/secret-manager/SecretApprovalsPage/components/ApprovalPolicyList/components/AccessPolicyModal.tsx
index 3235a11993..8a35d2e9a8 100644
--- a/frontend/src/pages/secret-manager/SecretApprovalsPage/components/ApprovalPolicyList/components/AccessPolicyModal.tsx
+++ b/frontend/src/pages/secret-manager/SecretApprovalsPage/components/ApprovalPolicyList/components/AccessPolicyModal.tsx
@@ -1,6 +1,5 @@
import { Fragment, useCallback, useEffect, useMemo, useState } from "react";
import { Controller, useFieldArray, useForm } from "react-hook-form";
-import { FormatOptionLabelMeta, MultiValue } from "react-select";
import { zodResolver } from "@hookform/resolvers/zod";
import slugify from "@sindresorhus/slugify";
import axios from "axios";
@@ -23,7 +22,6 @@ import {
Badge,
Button,
Combobox,
- CreatableSelect,
DiscardChangesAlertDialog,
Field,
FieldContent,
@@ -85,22 +83,16 @@ const getApproverOptionValue = (option: ApproverOptionData) =>
const getApproverOptionLabel = (option: ApproverOptionData) =>
option.name ?? option.username ?? option.id ?? "Unknown approver";
-const formatApproverOptionLabel = (
- option: ApproverOptionData,
- { context }: FormatOptionLabelMeta<ApproverOptionData>
-) =>
- context === "menu" ? (
- <ApproverOption option={option} label={getApproverOptionLabel(option)} />
- ) : (
- getApproverOptionLabel(option)
- );
+const renderApproverOption = (option: ApproverOptionData) => (
+ <ApproverOption option={option} label={getApproverOptionLabel(option)} />
+);
-const filterApproverOption = ({ data }: { data: ApproverOptionData }, input: string) => {
- const search = input.trim().toLowerCase();
- return [data.name, data.memberEmail, data.username, data.id].some((value) =>
- value?.toLowerCase().includes(search)
+const getApproverOptionKeywords = (option: ApproverOptionData) =>
+ [option.name, option.memberEmail, option.username, option.id].filter((value): value is string =>
+ Boolean(value)
);
-};
+
+const MEMBER_EMAIL_HINT = "Enter an exact project member email address.";
const getManualMemberOption = (
email: string,
@@ -119,6 +111,12 @@ const canAddMemberEmail = (input: string, options: readonly ApproverOptionData[]
);
};
+const formatMemberEmailCreateLabel = (input: string, options: readonly ApproverOptionData[]) => {
+ if (!isValidMemberEmail(input.trim().toLowerCase())) return MEMBER_EMAIL_HINT;
+ if (!canAddMemberEmail(input, options)) return "Member already listed";
+ return `Use member email “${input.trim()}”`;
+};
+
const hasOptionId = (option: ApproverOptionData): option is ApproverOptionData & { id: string } =>
Boolean(option.id);
@@ -589,36 +587,33 @@ const Form = ({
};
return (
- <CreatableSelect<ApproverOptionData>
- isMulti
+ <Combobox
+ multiple
aria-label={`Approvers for step ${index + 1}`}
placeholder="Select approvers or enter a member email..."
options={approverOptions}
getOptionValue={getApproverOptionValue}
getOptionLabel={getApproverOptionLabel}
- filterOption={filterApproverOption}
- formatOptionLabel={formatApproverOptionLabel}
- formatCreateLabel={(input) => `Use member email “${input.trim()}”`}
- isValidNewOption={(input, value) =>
- canAddMemberEmail(input, [
- ...(value as MultiValue<ApproverOptionData>),
- ...approverOptions
- ])
- }
+ getOptionKeywords={getApproverOptionKeywords}
+ renderOption={renderApproverOption}
isOptionDisabled={(option) =>
option.type === ApproverType.User && option.isOrgMembershipActive === false
}
value={selectedOptions}
- onChange={(newValue) =>
- updateSelectedOptions([...(newValue as MultiValue<ApproverOptionData>)])
- }
- onCreateOption={(input) =>
- updateSelectedOptions([
- ...selectedOptions,
- getManualMemberOption(input, ApproverType.User)
- ])
- }
- noOptionsMessage={() => "Enter an exact project member email address."}
+ onValueChange={updateSelectedOptions}
+ creation={{
+ isValid: (input, { options, selectedOptions: selected }) =>
+ canAddMemberEmail(input, [...selected, ...options]),
+ isDuplicate: () => false,
+ formatLabel: (input) =>
+ formatMemberEmailCreateLabel(input, [...selectedOptions, ...approverOptions]),
+ emptyLabel: MEMBER_EMAIL_HINT,
+ onCreate: (input) =>
+ updateSelectedOptions([
+ ...selectedOptions,
+ getManualMemberOption(input, ApproverType.User)
+ ])
+ }}
isError={Boolean(
errors.sequenceApprovers?.[index]?.user || errors.sequenceApprovers?.[index]?.group
)}
@@ -997,36 +992,36 @@ const Form = ({
<Field>
<FieldLabel>Approvers</FieldLabel>
<FieldContent>
- <CreatableSelect<ApproverOptionData>
- isMulti
+ <Combobox
+ multiple
aria-label="Approvers"
placeholder="Select approvers or enter a member email..."
options={approverOptions}
getOptionValue={getApproverOptionValue}
getOptionLabel={getApproverOptionLabel}
- filterOption={filterApproverOption}
- formatOptionLabel={formatApproverOptionLabel}
- formatCreateLabel={(input) => `Use member email “${input.trim()}”`}
- isValidNewOption={(input, value) =>
- canAddMemberEmail(input, [
- ...(value as MultiValue<ApproverOptionData>),
- ...approverOptions
- ])
- }
+ getOptionKeywords={getApproverOptionKeywords}
+ renderOption={renderApproverOption}
isOptionDisabled={(option) =>
option.type === ApproverType.User && option.isOrgMembershipActive === false
}
value={selectedPolicyApprovers}
- onChange={(newValue) =>
- updatePolicyApprovers([...(newValue as MultiValue<ApproverOptionData>)])
- }
- onCreateOption={(input) =>
- updatePolicyApprovers([
- ...selectedPolicyApprovers,
- getManualMemberOption(input, ApproverType.User)
- ])
- }
- noOptionsMessage={() => "Enter an exact project member email address."}
+ onValueChange={updatePolicyApprovers}
+ creation={{
+ isValid: (input, { options, selectedOptions }) =>
+ canAddMemberEmail(input, [...selectedOptions, ...options]),
+ isDuplicate: () => false,
+ formatLabel: (input) =>
+ formatMemberEmailCreateLabel(input, [
+ ...selectedPolicyApprovers,
+ ...approverOptions
+ ]),
+ emptyLabel: MEMBER_EMAIL_HINT,
+ onCreate: (input) =>
+ updatePolicyApprovers([
+ ...selectedPolicyApprovers,
+ getManualMemberOption(input, ApproverType.User)
+ ])
+ }}
isError={Boolean(errors.userApprovers || errors.groupApprovers)}
/>
<FieldError errors={[errors.userApprovers, errors.groupApprovers]} />
@@ -1103,36 +1098,36 @@ const Form = ({
<Field>
<FieldLabel>Bypassers</FieldLabel>
<FieldContent>
- <CreatableSelect<ApproverOptionData>
- isMulti
+ <Combobox
+ multiple
aria-label="Bypassers"
placeholder="Select bypassers or enter a member email..."
options={bypasserOptions}
getOptionValue={getApproverOptionValue}
getOptionLabel={getApproverOptionLabel}
- filterOption={filterApproverOption}
- formatOptionLabel={formatApproverOptionLabel}
- formatCreateLabel={(input) => `Use member email “${input.trim()}”`}
- isValidNewOption={(input, value) =>
- canAddMemberEmail(input, [
- ...(value as MultiValue<ApproverOptionData>),
- ...bypasserOptions
- ])
- }
+ getOptionKeywords={getApproverOptionKeywords}
+ renderOption={renderApproverOption}
isOptionDisabled={(option) =>
option.type === BypasserType.User && option.isOrgMembershipActive === false
}
value={selectedPolicyBypassers}
- onChange={(newValue) =>
- updatePolicyBypassers([...(newValue as MultiValue<ApproverOptionData>)])
- }
- onCreateOption={(input) =>
- updatePolicyBypassers([
- ...selectedPolicyBypassers,
- getManualMemberOption(input, BypasserType.User)
- ])
- }
- noOptionsMessage={() => "Enter an exact project member email address."}
+ onValueChange={updatePolicyBypassers}
+ creation={{
+ isValid: (input, { options, selectedOptions }) =>
+ canAddMemberEmail(input, [...selectedOptions, ...options]),
+ isDuplicate: () => false,
+ formatLabel: (input) =>
+ formatMemberEmailCreateLabel(input, [
+ ...selectedPolicyBypassers,
+ ...bypasserOptions
+ ]),
+ emptyLabel: MEMBER_EMAIL_HINT,
+ onCreate: (input) =>
+ updatePolicyBypassers([
+ ...selectedPolicyBypassers,
+ getManualMemberOption(input, BypasserType.User)
+ ])
+ }}
isError={Boolean(errors.userBypassers || errors.groupBypassers)}
/>
<FieldError errors={[errors.userBypassers, errors.groupBypassers]} />
diff --git a/frontend/src/pages/secret-manager/SecretDashboardPage/components/ActionBar/CreateSecretImportForm.tsx b/frontend/src/pages/secret-manager/SecretDashboardPage/components/ActionBar/CreateSecretImportForm.tsx
index de4d77f227..13d587edad 100644
--- a/frontend/src/pages/secret-manager/SecretDashboardPage/components/ActionBar/CreateSecretImportForm.tsx
+++ b/frontend/src/pages/secret-manager/SecretDashboardPage/components/ActionBar/CreateSecretImportForm.tsx
@@ -8,6 +8,7 @@ import { z } from "zod";
import { createNotification } from "@app/components/notifications";
import {
Button,
+ Combobox,
Dialog,
DialogContent,
DialogDescription,
@@ -19,7 +20,6 @@ import {
FieldDescription,
FieldError,
FieldLabel,
- FilterableSelect,
Item,
ItemContent,
ItemDescription,
@@ -202,18 +202,18 @@ export const CreateSecretImportForm = ({
const selectedItem = environments.find((e) => e.slug === field.value?.slug);
return (
<Field>
- <FieldLabel>Environment</FieldLabel>
+ <FieldLabel htmlFor="secret-import-environment">Environment</FieldLabel>
<FieldContent>
- <FilterableSelect
+ <Combobox
+ id="secret-import-environment"
+ isClearable={false}
options={environments}
getOptionLabel={(option) => option.name}
getOptionValue={(option) => option.slug}
+ getOptionKeywords={(option) => [option.slug]}
placeholder="Select environment..."
value={selectedItem || null}
- onChange={(newValue) => {
- const single = Array.isArray(newValue) ? newValue[0] : newValue;
- field.onChange(single || null);
- }}
+ onValueChange={field.onChange}
/>
</FieldContent>
<FieldError>{errors.environment?.message}</FieldError>
@@ -293,9 +293,11 @@ export const CreateSecretImportForm = ({
return (
<div className="space-y-4">
<Field>
- <FieldLabel>Project</FieldLabel>
+ <FieldLabel htmlFor="secret-import-source-project">Project</FieldLabel>
<FieldContent>
- <FilterableSelect
+ <Combobox
+ id="secret-import-source-project"
+ isClearable={false}
options={sourceProjectOptions}
getOptionLabel={(o) => o.label}
getOptionValue={(o) => o.value}
@@ -305,9 +307,8 @@ export const CreateSecretImportForm = ({
? (sourceProjectOptions.find((o) => o.value === selectedSourceProjectId) ?? null)
: null
}
- onChange={(newValue) => {
- const single = Array.isArray(newValue) ? newValue[0] : newValue;
- setSelectedSourceProjectId(single && "value" in single ? single.value : null);
+ onValueChange={(option) => {
+ setSelectedSourceProjectId(option.value);
setSelectedEnvironmentSlug(null);
setSelectedSecretPath(null);
}}
@@ -316,12 +317,15 @@ export const CreateSecretImportForm = ({
</Field>
<Field>
- <FieldLabel>Environment</FieldLabel>
+ <FieldLabel htmlFor="secret-import-source-environment">Environment</FieldLabel>
<FieldContent>
- <FilterableSelect
+ <Combobox
+ id="secret-import-source-environment"
+ isClearable={false}
options={environmentOptions}
getOptionLabel={(o) => o.label}
getOptionValue={(o) => o.value}
+ getOptionKeywords={(o) => [o.value]}
placeholder="Select environment..."
isDisabled={!selectedSourceProjectId}
value={
@@ -329,9 +333,8 @@ export const CreateSecretImportForm = ({
? (environmentOptions.find((o) => o.value === selectedEnvironmentSlug) ?? null)
: null
}
- onChange={(newValue) => {
- const single = Array.isArray(newValue) ? newValue[0] : newValue;
- setSelectedEnvironmentSlug(single && "value" in single ? single.value : null);
+ onValueChange={(option) => {
+ setSelectedEnvironmentSlug(option.value);
setSelectedSecretPath(null);
}}
/>
@@ -339,9 +342,11 @@ export const CreateSecretImportForm = ({
</Field>
<Field>
- <FieldLabel>Folder path</FieldLabel>
+ <FieldLabel htmlFor="secret-import-source-folder">Folder path</FieldLabel>
<FieldContent>
- <FilterableSelect
+ <Combobox
+ id="secret-import-source-folder"
+ isClearable={false}
options={folderOptions}
getOptionLabel={(o) => o.label}
getOptionValue={(o) => o.value}
@@ -352,10 +357,7 @@ export const CreateSecretImportForm = ({
? (folderOptions.find((o) => o.value === selectedSecretPath) ?? null)
: null
}
- onChange={(newValue) => {
- const single = Array.isArray(newValue) ? newValue[0] : newValue;
- setSelectedSecretPath(single && "value" in single ? single.value : null);
- }}
+ onValueChange={(option) => setSelectedSecretPath(option.value)}
/>
</FieldContent>
</Field>
diff --git a/frontend/src/pages/secret-manager/SettingsPage/components/SecretValidationRulesSection/SecretValidationRulesSection.tsx b/frontend/src/pages/secret-manager/SettingsPage/components/SecretValidationRulesSection/SecretValidationRulesSection.tsx
index 3d8bac4df2..6efa81ac15 100644
--- a/frontend/src/pages/secret-manager/SettingsPage/components/SecretValidationRulesSection/SecretValidationRulesSection.tsx
+++ b/frontend/src/pages/secret-manager/SettingsPage/components/SecretValidationRulesSection/SecretValidationRulesSection.tsx
@@ -34,6 +34,7 @@ import {
CardDescription,
CardHeader,
CardTitle,
+ Combobox,
DropdownMenu,
DropdownMenuContent,
DropdownMenuItem,
@@ -43,7 +44,6 @@ import {
EmptyDescription,
EmptyHeader,
EmptyTitle,
- FilterableSelect,
IconButton,
Input,
Select,
@@ -116,7 +116,9 @@ const ProviderMultiSelect = <T extends string>({
}) => {
return (
<div className="flex flex-col gap-1">
- <label className="text-xs font-medium text-muted">{label}</label>
+ <label htmlFor="secret-validation-rule-providers" className="text-xs font-medium text-muted">
+ {label}
+ </label>
<Controller
control={control}
name="enforcement.providers"
@@ -125,17 +127,16 @@ const ProviderMultiSelect = <T extends string>({
(field.value as T[] | undefined)?.includes(opt.value)
);
return (
- <FilterableSelect
- isMulti
+ <Combobox
+ id="secret-validation-rule-providers"
+ multiple
placeholder="Select provider(s)..."
value={selected}
- onChange={(next) => {
- const arr = (next as TProviderOption<T>[] | null) ?? [];
- field.onChange(arr.map((o) => o.value));
- }}
+ onValueChange={(next) => field.onChange(next.map((o) => o.value))}
options={options}
- getOptionValue={(o) => (o as TProviderOption<T>).value}
- getOptionLabel={(o) => (o as TProviderOption<T>).label}
+ getOptionValue={(o) => o.value}
+ getOptionKeywords={(o) => [o.value]}
+ getOptionLabel={(o) => o.label}
isError={Boolean(error)}
/>
);
diff --git a/frontend/src/pages/secret-manager/SettingsPage/components/WebhooksTab/AddWebhookForm.tsx b/frontend/src/pages/secret-manager/SettingsPage/components/WebhooksTab/AddWebhookForm.tsx
index c1c26b241b..e1de501890 100644
--- a/frontend/src/pages/secret-manager/SettingsPage/components/WebhooksTab/AddWebhookForm.tsx
+++ b/frontend/src/pages/secret-manager/SettingsPage/components/WebhooksTab/AddWebhookForm.tsx
@@ -1,8 +1,6 @@
-import { useEffect, useRef } from "react";
+import { useEffect } from "react";
import { Controller, useForm } from "react-hook-form";
-import { components, OptionProps } from "react-select";
import { zodResolver } from "@hookform/resolvers/zod";
-import { CheckIcon } from "lucide-react";
import z from "zod";
import {
@@ -11,11 +9,11 @@ import {
AccordionItem,
AccordionTrigger,
Button,
+ Combobox,
Field,
FieldDescription,
FieldError,
FieldLabel,
- FilterableSelect,
Input,
SecretPathInput,
Select,
@@ -50,21 +48,12 @@ const EVENT_OPTIONS: TWebhookEventOption[] = WEBHOOK_EVENTS.map((event) => ({
description: WEBHOOK_EVENT_METADATA[event].description
}));
-const OptionWithDescription = (props: OptionProps<TWebhookEventOption>) => {
- const { data, children, isSelected } = props;
-
- return (
- <components.Option {...props}>
- <div className="flex flex-row items-center justify-between">
- <div className="min-w-0 flex-1">
- <p className="truncate font-medium">{children}</p>
- <p className="truncate text-xs leading-4 text-muted">{data.description}</p>
- </div>
- {isSelected && <CheckIcon className="ml-2 size-4 shrink-0" />}
- </div>
- </components.Option>
- );
-};
+const renderEventOption = (option: TWebhookEventOption) => (
+ <div className="min-w-0">
+ <p className="truncate font-medium">{option.label}</p>
+ <p className="truncate text-xs leading-4 text-muted">{option.description}</p>
+ </div>
+);
const formSchema = z
.object({
@@ -117,7 +106,6 @@ export const AddWebhookForm = ({
const selectedWebhookType = watch("type");
const selectedEnvironment = watch("environment");
- const modalContainer = useRef<HTMLDivElement>(null);
const generalFormFields = (
<>
@@ -191,7 +179,7 @@ export const AddWebhookForm = ({
return (
<Sheet open={isOpen} onOpenChange={onOpenChange}>
<SheetContent className="sm:max-w-lg">
- <div ref={modalContainer} className="flex h-full min-h-0 flex-col">
+ <div className="flex h-full min-h-0 flex-col">
<form onSubmit={handleSubmit(onCreateWebhook)} className="flex h-full min-h-0 flex-col">
<SheetHeader>
<SheetTitle>Create a new webhook</SheetTitle>
@@ -300,23 +288,17 @@ export const AddWebhookForm = ({
return (
<Field>
<FieldLabel htmlFor="webhook-events">Events</FieldLabel>
- <FilterableSelect
- isMulti
- inputId="webhook-events"
+ <Combobox
+ multiple
+ id="webhook-events"
options={EVENT_OPTIONS}
value={selectedOptions}
- onChange={(selected) =>
- handleChange(selected as readonly TWebhookEventOption[])
- }
+ onValueChange={handleChange}
getOptionValue={(option) => option.value}
+ getOptionKeywords={(option) => [option.value]}
getOptionLabel={(option) => option.label}
placeholder="Select events..."
- menuPortalTarget={modalContainer.current}
- menuPosition="fixed"
- menuPlacement="bottom"
- closeMenuOnSelect={false}
- hideSelectedOptions={false}
- components={{ Option: OptionWithDescription }}
+ renderOption={renderEventOption}
/>
<FieldDescription>
{!hasSelection
diff --git a/frontend/src/pages/secret-manager/SettingsPage/components/WebhooksTab/EditWebhookEventsModal.tsx b/frontend/src/pages/secret-manager/SettingsPage/components/WebhooksTab/EditWebhookEventsModal.tsx
index aa79f28906..20f445059c 100644
--- a/frontend/src/pages/secret-manager/SettingsPage/components/WebhooksTab/EditWebhookEventsModal.tsx
+++ b/frontend/src/pages/secret-manager/SettingsPage/components/WebhooksTab/EditWebhookEventsModal.tsx
@@ -1,9 +1,8 @@
import { FormEvent, useEffect, useMemo, useState } from "react";
-import { components, OptionProps } from "react-select";
-import { CheckIcon } from "lucide-react";
import {
Button,
+ Combobox,
Dialog,
DialogClose,
DialogContent,
@@ -13,8 +12,7 @@ import {
DialogTitle,
Field,
FieldDescription,
- FieldLabel,
- FilterableSelect
+ FieldLabel
} from "@app/components/v3";
import {
DEFAULT_ENABLED_EVENTS,
@@ -45,21 +43,12 @@ const EVENT_OPTIONS: TWebhookEventOption[] = WEBHOOK_EVENTS.map((event) => ({
description: WEBHOOK_EVENT_METADATA[event].description
}));
-const OptionWithDescription = (props: OptionProps<TWebhookEventOption>) => {
- const { data, children, isSelected } = props;
-
- return (
- <components.Option {...props}>
- <div className="flex flex-row items-center justify-between">
- <div className="min-w-0 flex-1">
- <p className="truncate font-medium">{children}</p>
- <p className="truncate text-xs leading-4 text-muted">{data.description}</p>
- </div>
- {isSelected && <CheckIcon className="ml-2 size-4 shrink-0" />}
- </div>
- </components.Option>
- );
-};
+const renderEventOption = (option: TWebhookEventOption) => (
+ <div className="min-w-0">
+ <p className="truncate font-medium">{option.label}</p>
+ <p className="truncate text-xs leading-4 text-muted">{option.description}</p>
+ </div>
+);
const buildAllEnabled = (): TWebhookEventSettings =>
WEBHOOK_EVENTS.reduce<TWebhookEventSettings>((acc, event) => {
@@ -136,19 +125,17 @@ export const EditWebhookEventsModal = ({
<form onSubmit={handleSave} className="flex flex-col gap-6">
<Field>
<FieldLabel htmlFor="webhook-events">Events</FieldLabel>
- <FilterableSelect
- isMulti
- inputId="webhook-events"
+ <Combobox
+ multiple
+ id="webhook-events"
options={EVENT_OPTIONS}
value={selectedOptions}
- onChange={(selected) => handleChange(selected as readonly TWebhookEventOption[])}
+ onValueChange={handleChange}
getOptionValue={(option) => option.value}
+ getOptionKeywords={(option) => [option.value]}
getOptionLabel={(option) => option.label}
placeholder="Select events..."
- menuPlacement="bottom"
- closeMenuOnSelect={false}
- hideSelectedOptions={false}
- components={{ Option: OptionWithDescription }}
+ renderOption={renderEventOption}
/>
{!hasSelection && (
<FieldDescription>
diff --git a/frontend/src/pages/secret-manager/SettingsPage/components/WorkflowIntegrationSection/components/AddWorkflowIntegrationSheet.tsx b/frontend/src/pages/secret-manager/SettingsPage/components/WorkflowIntegrationSection/components/AddWorkflowIntegrationSheet.tsx
index 64b2b36f3d..efb71e5c65 100644
--- a/frontend/src/pages/secret-manager/SettingsPage/components/WorkflowIntegrationSection/components/AddWorkflowIntegrationSheet.tsx
+++ b/frontend/src/pages/secret-manager/SettingsPage/components/WorkflowIntegrationSection/components/AddWorkflowIntegrationSheet.tsx
@@ -1,4 +1,4 @@
-import { useRef, useState } from "react";
+import { useState } from "react";
import { BsMicrosoftTeams, BsSlack } from "react-icons/bs";
import {
@@ -42,7 +42,6 @@ export const AddWorkflowIntegrationSheet = ({ isOpen, onOpenChange }: Props) =>
const [selectedPlatform, setSelectedPlatform] = useState<WorkflowIntegrationPlatform | null>(
null
);
- const containerRef = useRef<HTMLDivElement>(null);
const { currentProject } = useProject();
const { data: slackConfig } = useGetWorkspaceWorkflowIntegrationConfig({
@@ -69,7 +68,7 @@ export const AddWorkflowIntegrationSheet = ({ isOpen, onOpenChange }: Props) =>
return (
<Sheet open={isOpen} onOpenChange={handleOpenChange}>
<SheetContent className="sm:max-w-lg">
- <div ref={containerRef} className="flex h-full min-h-0 flex-col">
+ <div className="flex h-full min-h-0 flex-col">
<SheetHeader>
<SheetTitle>
{selectedPlatform
@@ -121,14 +120,12 @@ export const AddWorkflowIntegrationSheet = ({ isOpen, onOpenChange }: Props) =>
<SlackIntegrationForm
onClose={() => handleOpenChange(false)}
onBack={() => setSelectedPlatform(null)}
- menuContainer={containerRef}
/>
)}
{selectedPlatform === WorkflowIntegrationPlatform.MICROSOFT_TEAMS && (
<MicrosoftTeamsIntegrationForm
onClose={() => handleOpenChange(false)}
onBack={() => setSelectedPlatform(null)}
- menuContainer={containerRef}
/>
)}
</div>
diff --git a/frontend/src/pages/secret-manager/SettingsPage/components/WorkflowIntegrationSection/components/EditWorkflowIntegrationSheet.tsx b/frontend/src/pages/secret-manager/SettingsPage/components/WorkflowIntegrationSection/components/EditWorkflowIntegrationSheet.tsx
index c481b82e0e..ab05adc40d 100644
--- a/frontend/src/pages/secret-manager/SettingsPage/components/WorkflowIntegrationSection/components/EditWorkflowIntegrationSheet.tsx
+++ b/frontend/src/pages/secret-manager/SettingsPage/components/WorkflowIntegrationSection/components/EditWorkflowIntegrationSheet.tsx
@@ -1,5 +1,3 @@
-import { useRef } from "react";
-
import { Sheet, SheetContent, SheetDescription, SheetHeader, SheetTitle } from "@app/components/v3";
import { WorkflowIntegrationPlatform } from "@app/hooks/api/workflowIntegrations/types";
@@ -14,8 +12,6 @@ type Props = {
};
export const EditWorkflowIntegrationSheet = ({ isOpen, onClose, integration }: Props) => {
- const containerRef = useRef<HTMLDivElement>(null);
-
const platformLabel = integration ? WORKFLOW_INTEGRATION_PLATFORM_LABELS[integration] : "";
return (
@@ -28,7 +24,7 @@ export const EditWorkflowIntegrationSheet = ({ isOpen, onClose, integration }: P
}}
>
<SheetContent className="sm:max-w-lg">
- <div ref={containerRef} className="flex h-full min-h-0 flex-col">
+ <div className="flex h-full min-h-0 flex-col">
<SheetHeader>
<SheetTitle>Edit {platformLabel} Integration</SheetTitle>
<SheetDescription>
@@ -36,10 +32,10 @@ export const EditWorkflowIntegrationSheet = ({ isOpen, onClose, integration }: P
</SheetDescription>
</SheetHeader>
{integration === WorkflowIntegrationPlatform.SLACK && (
- <SlackIntegrationForm onClose={onClose} menuContainer={containerRef} />
+ <SlackIntegrationForm onClose={onClose} />
)}
{integration === WorkflowIntegrationPlatform.MICROSOFT_TEAMS && (
- <MicrosoftTeamsIntegrationForm onClose={onClose} menuContainer={containerRef} />
+ <MicrosoftTeamsIntegrationForm onClose={onClose} />
)}
</div>
</SheetContent>
diff --git a/frontend/src/pages/secret-manager/SettingsPage/components/WorkflowIntegrationSection/components/MicrosoftTeamsIntegrationForm.tsx b/frontend/src/pages/secret-manager/SettingsPage/components/WorkflowIntegrationSection/components/MicrosoftTeamsIntegrationForm.tsx
index f6b849771d..780415ff82 100644
--- a/frontend/src/pages/secret-manager/SettingsPage/components/WorkflowIntegrationSection/components/MicrosoftTeamsIntegrationForm.tsx
+++ b/frontend/src/pages/secret-manager/SettingsPage/components/WorkflowIntegrationSection/components/MicrosoftTeamsIntegrationForm.tsx
@@ -1,4 +1,4 @@
-import { RefObject, useEffect } from "react";
+import { useEffect } from "react";
import { Controller, useForm } from "react-hook-form";
import { zodResolver } from "@hookform/resolvers/zod";
import { Link } from "@tanstack/react-router";
@@ -11,13 +11,13 @@ import {
AlertDescription,
AlertTitle,
Button,
+ Combobox,
Field,
FieldContent,
FieldDescription,
FieldError,
FieldLabel,
FieldTitle,
- FilterableSelect,
Select,
SelectContent,
SelectItem,
@@ -34,10 +34,7 @@ import {
useGetWorkspaceWorkflowIntegrationConfig,
useUpdateProjectWorkflowIntegrationConfig
} from "@app/hooks/api";
-import {
- MicrosoftTeamsIntegrationTeam,
- WorkflowIntegrationPlatform
-} from "@app/hooks/api/workflowIntegrations/types";
+import { WorkflowIntegrationPlatform } from "@app/hooks/api/workflowIntegrations/types";
const channelsSchema = z.object({
teamId: z.string(),
@@ -100,10 +97,9 @@ type TChannelOption = {
type Props = {
onClose: () => void;
onBack?: () => void;
- menuContainer: RefObject<HTMLDivElement | null>;
};
-export const MicrosoftTeamsIntegrationForm = ({ onClose, onBack, menuContainer }: Props) => {
+export const MicrosoftTeamsIntegrationForm = ({ onClose, onBack }: Props) => {
const { currentProject } = useProject();
const { data: microsoftTeamsConfig } = useGetWorkspaceWorkflowIntegrationConfig({
projectId: currentProject?.id ?? "",
@@ -234,12 +230,13 @@ export const MicrosoftTeamsIntegrationForm = ({ onClose, onBack, menuContainer }
render={({ field: { value, onChange }, fieldState: { error } }) => (
<Field>
<FieldLabel htmlFor={`${fieldPrefix}-team`}>Microsoft Teams team</FieldLabel>
- <FilterableSelect<MicrosoftTeamsIntegrationTeam>
- inputId={`${fieldPrefix}-team`}
+ <Combobox
+ id={`${fieldPrefix}-team`}
+ isClearable={false}
options={sortedTeams}
value={sortedTeams?.find((team) => team.teamId === value) ?? null}
- onChange={(selected) => {
- onChange((selected as MicrosoftTeamsIntegrationTeam | null)?.teamId ?? "");
+ onValueChange={(selected) => {
+ onChange(selected.teamId);
// Channels belong to a team; clear stale selections when the team changes.
setValue(`${fieldPrefix}.channelIds`, [], { shouldDirty: true });
}}
@@ -250,9 +247,6 @@ export const MicrosoftTeamsIntegrationForm = ({ onClose, onBack, menuContainer }
}
isLoading={isLoadingMicrosoftTeamsIntegrationTeams}
isError={Boolean(error)}
- menuPortalTarget={menuContainer.current}
- menuPosition="fixed"
- menuPlacement="bottom"
/>
<FieldError>{error?.message}</FieldError>
</Field>
@@ -264,27 +258,18 @@ export const MicrosoftTeamsIntegrationForm = ({ onClose, onBack, menuContainer }
render={({ field: { value, onChange }, fieldState: { error } }) => (
<Field>
<FieldLabel htmlFor={`${fieldPrefix}-channels`}>Microsoft Teams channels</FieldLabel>
- <FilterableSelect
- isMulti
- inputId={`${fieldPrefix}-channels`}
+ <Combobox
+ multiple
+ id={`${fieldPrefix}-channels`}
options={teamChannels}
value={teamChannels.filter((channel) => value?.includes(channel.channelId))}
- onChange={(selected) =>
- onChange(
- (selected as readonly TChannelOption[]).map((channel) => channel.channelId)
- )
- }
+ onValueChange={(selected) => onChange(selected.map((channel) => channel.channelId))}
getOptionValue={(option) => option.channelId}
getOptionLabel={(option) => option.channelName}
placeholder={selectedTeamId ? "Select channels..." : "Select a team first"}
isDisabled={!selectedTeamId}
isLoading={isLoadingMicrosoftTeamsIntegrationTeams}
isError={Boolean(error)}
- menuPortalTarget={menuContainer.current}
- menuPosition="fixed"
- menuPlacement="bottom"
- closeMenuOnSelect={false}
- hideSelectedOptions={false}
/>
<FieldError>{error?.message}</FieldError>
</Field>
diff --git a/frontend/src/pages/secret-manager/SettingsPage/components/WorkflowIntegrationSection/components/SlackIntegrationForm.tsx b/frontend/src/pages/secret-manager/SettingsPage/components/WorkflowIntegrationSection/components/SlackIntegrationForm.tsx
index 82c8cb0d5e..74d2a121b4 100644
--- a/frontend/src/pages/secret-manager/SettingsPage/components/WorkflowIntegrationSection/components/SlackIntegrationForm.tsx
+++ b/frontend/src/pages/secret-manager/SettingsPage/components/WorkflowIntegrationSection/components/SlackIntegrationForm.tsx
@@ -1,4 +1,4 @@
-import { RefObject, useEffect } from "react";
+import { useEffect } from "react";
import { Controller, useForm } from "react-hook-form";
import { zodResolver } from "@hookform/resolvers/zod";
import { Link } from "@tanstack/react-router";
@@ -11,13 +11,13 @@ import {
AlertDescription,
AlertTitle,
Button,
+ Combobox,
Field,
FieldContent,
FieldDescription,
FieldError,
FieldLabel,
FieldTitle,
- FilterableSelect,
Select,
SelectContent,
SelectItem,
@@ -54,7 +54,6 @@ type TSlackConfigForm = z.infer<typeof formSchema>;
type Props = {
onClose: () => void;
onBack?: () => void;
- menuContainer: RefObject<HTMLDivElement | null>;
};
type TChannelsFieldProps = {
@@ -64,7 +63,6 @@ type TChannelsFieldProps = {
error?: { message?: string };
channels?: SlackIntegrationChannel[];
isLoading: boolean;
- menuContainer: RefObject<HTMLDivElement | null>;
};
const ChannelsField = ({
@@ -73,35 +71,28 @@ const ChannelsField = ({
onChange,
error,
channels,
- isLoading,
- menuContainer
+ isLoading
}: TChannelsFieldProps) => (
<Field>
<FieldLabel htmlFor={inputId}>Slack channels</FieldLabel>
- <FilterableSelect
- isMulti
- inputId={inputId}
+ <Combobox
+ multiple
+ id={inputId}
options={channels}
value={(channels ?? []).filter((channel) => value?.includes(channel.id))}
- onChange={(selected) =>
- onChange((selected as readonly SlackIntegrationChannel[]).map((channel) => channel.id))
- }
+ onValueChange={(selected) => onChange(selected.map((channel) => channel.id))}
getOptionValue={(option) => option.id}
getOptionLabel={(option) => option.name}
+ getOptionKeywords={(option) => [option.id]}
placeholder="Select channels..."
isLoading={isLoading}
isError={Boolean(error)}
- menuPortalTarget={menuContainer.current}
- menuPosition="fixed"
- menuPlacement="bottom"
- closeMenuOnSelect={false}
- hideSelectedOptions={false}
/>
<FieldError>{error?.message}</FieldError>
</Field>
);
-export const SlackIntegrationForm = ({ onClose, onBack, menuContainer }: Props) => {
+export const SlackIntegrationForm = ({ onClose, onBack }: Props) => {
const { currentProject } = useProject();
const { data: slackConfig } = useGetWorkspaceWorkflowIntegrationConfig({
projectId: currentProject?.id ?? "",
@@ -305,7 +296,6 @@ export const SlackIntegrationForm = ({ onClose, onBack, menuContainer }: Props)
error={error}
channels={sortedSlackChannels}
isLoading={isSlackChannelsLoading}
- menuContainer={menuContainer}
/>
)}
/>
@@ -342,7 +332,6 @@ export const SlackIntegrationForm = ({ onClose, onBack, menuContainer }: Props)
error={error}
channels={sortedSlackChannels}
isLoading={isSlackChannelsLoading}
- menuContainer={menuContainer}
/>
)}
/>
@@ -379,7 +368,6 @@ export const SlackIntegrationForm = ({ onClose, onBack, menuContainer }: Props)
error={error}
channels={sortedSlackChannels}
isLoading={isSlackChannelsLoading}
- menuContainer={menuContainer}
/>
)}
/>